Remove the attempt to cache the previous page mapped at our identity
location (for the wake code). It should not be needed since we don't map other pages at the same location and if there was an old mapping, it would be restored by a fault. The old code had serious problems, namely that it was restoring the new page it had just removed (not opage) and it could only guess at the right protection (since there's no pmap_extract_protect function). Thanks to Alan Cox for explaining much of this to me. Also, remove a commented-out initializecpu() call since it is not needed. Restoring the cpu context is better than attempting to init from scratch. Reviewed by: alc (earlier version)
This commit is contained in:
parent
2939c8a0b9
commit
0cafadacae
@ -175,15 +175,14 @@ int
|
||||
acpi_sleep_machdep(struct acpi_softc *sc, int state)
|
||||
{
|
||||
ACPI_STATUS status;
|
||||
vm_paddr_t oldphys;
|
||||
struct pmap *pm;
|
||||
vm_page_t page;
|
||||
static vm_page_t opage = NULL;
|
||||
int ret = 0;
|
||||
int ret;
|
||||
uint32_t cr3;
|
||||
u_long ef;
|
||||
struct proc *p;
|
||||
|
||||
ret = 0;
|
||||
if (sc->acpi_wakeaddr == 0)
|
||||
return (0);
|
||||
|
||||
@ -203,9 +202,6 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state)
|
||||
load_cr3(vtophys(pm->pm_pdir));
|
||||
#endif
|
||||
|
||||
oldphys = pmap_extract(pm, sc->acpi_wakephys);
|
||||
if (oldphys)
|
||||
opage = PHYS_TO_VM_PAGE(oldphys);
|
||||
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);
|
||||
@ -261,9 +257,6 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state)
|
||||
for (;;) ;
|
||||
} else {
|
||||
/* Execute Wakeup */
|
||||
#if 0
|
||||
initializecpu();
|
||||
#endif
|
||||
intr_resume();
|
||||
|
||||
if (bootverbose) {
|
||||
@ -274,13 +267,7 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state)
|
||||
|
||||
out:
|
||||
pmap_remove(pm, sc->acpi_wakephys, sc->acpi_wakephys + PAGE_SIZE);
|
||||
if (opage) {
|
||||
pmap_enter(pm, sc->acpi_wakephys, page,
|
||||
VM_PROT_READ | VM_PROT_WRITE, 0);
|
||||
}
|
||||
|
||||
load_cr3(cr3);
|
||||
|
||||
write_eflags(ef);
|
||||
|
||||
return (ret);
|
||||
|
Loading…
x
Reference in New Issue
Block a user