PATCH - panic on resume in pmap_invalidate
Nate Lawson
nate at root.org
Tue Feb 27 05:55:16 UTC 2007
Attached is a patch by Alan Cox (alc@) that changes how we map memory
for acpi wake code. It should solve a problem that was reported of a
panic after resume in pmap_invalidate(). It should work on 7.x or 6.x.
If you have that problem, please report if it works.
--
Nate
-------------- next part --------------
Index: sys/i386/acpica/acpi_wakeup.c
===================================================================
RCS file: /home/ncvs/src/sys/i386/acpica/acpi_wakeup.c,v
retrieving revision 1.45
diff -u -r1.45 acpi_wakeup.c
--- sys/i386/acpica/acpi_wakeup.c 8 Aug 2006 01:30:54 -0000 1.45
+++ sys/i386/acpica/acpi_wakeup.c 27 Feb 2007 05:28:53 -0000
@@ -192,11 +192,9 @@
{
ACPI_STATUS status;
struct pmap *pm;
- vm_page_t page;
int ret;
uint32_t cr3;
u_long ef;
- struct proc *p;
ret = 0;
if (sc->acpi_wakeaddr == 0)
@@ -206,10 +204,12 @@
ef = read_eflags();
- /* Create Identity Mapping */
- if ((p = curproc) == NULL)
- p = &proc0;
- pm = vmspace_pmap(p->p_vmspace);
+ /*
+ * Temporarily switch to the kernel pmap because it provides an
+ * identity mapping (setup at boot) for the low physical memory
+ * region containing the wakeup code.
+ */
+ pm = kernel_pmap;
cr3 = rcr3();
#ifdef PAE
load_cr3(vtophys(pm->pm_pdpt));
@@ -217,10 +217,6 @@
load_cr3(vtophys(pm->pm_pdir));
#endif
- page = PHYS_TO_VM_PAGE(sc->acpi_wakephys);
- pmap_enter(pm, sc->acpi_wakephys, page,
- VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE, 1);
-
ret_addr = 0;
ACPI_DISABLE_IRQS();
if (acpi_savecpu()) {
@@ -283,7 +279,6 @@
}
out:
- pmap_remove(pm, sc->acpi_wakephys, sc->acpi_wakephys + PAGE_SIZE);
load_cr3(cr3);
write_eflags(ef);
Index: sys/i386/i386/pmap.c
===================================================================
RCS file: /home/ncvs/src/sys/i386/i386/pmap.c,v
retrieving revision 1.581
diff -u -r1.581 pmap.c
--- sys/i386/i386/pmap.c 18 Feb 2007 06:33:02 -0000 1.581
+++ sys/i386/i386/pmap.c 27 Feb 2007 05:26:22 -0000
@@ -422,6 +422,13 @@
/* Turn on PG_G on kernel page(s) */
pmap_set_pg();
+
+ /*
+ * Create an identity mapping (virt == phys) for the low 1 MB
+ * physical memory region that is used by the ACPI wakeup code.
+ * This mapping must not have PG_G set.
+ */
+ kernel_pmap->pm_pdir[0] = PG_PS | PG_RW | PG_V;
}
/*
More information about the freebsd-acpi
mailing list