From 0cafadacaea54453384422ac3852597ecf752fde Mon Sep 17 00:00:00 2001 From: Nate Lawson Date: Thu, 5 Aug 2004 06:29:12 +0000 Subject: [PATCH] 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) --- sys/i386/acpica/acpi_wakeup.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/sys/i386/acpica/acpi_wakeup.c b/sys/i386/acpica/acpi_wakeup.c index 10be0523e0e6..4a2e64fa5c07 100644 --- a/sys/i386/acpica/acpi_wakeup.c +++ b/sys/i386/acpica/acpi_wakeup.c @@ -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);