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.
This commit is contained in:
parent
b03a114733
commit
57defe6f29
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user