summaryrefslogtreecommitdiffstats
path: root/sys/i386/acpica
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2003-07-21 20:59:27 +0000
committerpeter <peter@FreeBSD.org>2003-07-21 20:59:27 +0000
commit57defe6f29377d5df5ee2d95638673b88a928681 (patch)
tree26895b6e6a6ea1ab74e45c03e03d1531b64980dc /sys/i386/acpica
parentb03a1147332ddbe41f75a85dd618e5b77d7554ef (diff)
downloadFreeBSD-src-57defe6f29377d5df5ee2d95638673b88a928681.zip
FreeBSD-src-57defe6f29377d5df5ee2d95638673b88a928681.tar.gz
Commit Ian Dowse's workaround for acpi resume resetting after the
LAZY_SWITCH changes. He pointed out the acpi code sets up an identity mapping in the current vmspace and that got messed up by the %cr3 being out of sync with the current page directory. As a workaround, restore %cr3 across the sleep/resume. A more complete fix would be to undo the lazy state and clear the pm_active bit from the borrowed pmap, but this works and people are currently hurting. I'll clean this up. This is mostly Ian's patch, plus a PAE tweak from me.
Diffstat (limited to 'sys/i386/acpica')
-rw-r--r--sys/i386/acpica/acpi_wakeup.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/i386/acpica/acpi_wakeup.c b/sys/i386/acpica/acpi_wakeup.c
index 81a396a..472438f 100644
--- a/sys/i386/acpica/acpi_wakeup.c
+++ b/sys/i386/acpica/acpi_wakeup.c
@@ -193,6 +193,7 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state)
static vm_page_t opage = NULL;
int ret = 0;
int pteobj_allocated = 0;
+ u_int32_t cr3;
u_long ef;
struct proc *p;
@@ -209,6 +210,12 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state)
if ((p = curproc) == NULL)
p = &proc0;
pm = vmspace_pmap(p->p_vmspace);
+ cr3 = rcr3();
+#ifdef PAE
+ load_cr3(vtophys(pm->pm_pdpt));
+#else
+ load_cr3(vtophys(pm->pm_pdir));
+#endif
if (pm->pm_pteobj == NULL) {
pm->pm_pteobj = vm_object_allocate(OBJT_DEFAULT, PTDPTDI + 1);
pteobj_allocated = 1;
@@ -295,6 +302,7 @@ out:
vm_object_deallocate(pm->pm_pteobj);
pm->pm_pteobj = NULL;
}
+ load_cr3(cr3);
write_eflags(ef);
OpenPOWER on IntegriCloud