From 2ebbd8afb9db48cd481133aaca93ec7995f8095c Mon Sep 17 00:00:00 2001 From: jhb Date: Wed, 16 Oct 2002 17:22:03 +0000 Subject: [PATCH] - curproc may be NULL in 4-stable. In that case use the vmspace from proc0. - Remove unused include. Sponsored by: The Weather Channel --- sys/amd64/acpica/acpi_wakeup.c | 6 ++++-- sys/i386/acpica/acpi_wakeup.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/sys/amd64/acpica/acpi_wakeup.c b/sys/amd64/acpica/acpi_wakeup.c index d54a68beff08..6dc942eafe8c 100644 --- a/sys/amd64/acpica/acpi_wakeup.c +++ b/sys/amd64/acpica/acpi_wakeup.c @@ -32,7 +32,6 @@ #include #include #include -#include #include #include @@ -189,6 +188,7 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state) int ret = 0; int pteobj_allocated = 0; u_long ef; + struct proc *p; if (sc->acpi_wakeaddr == 0) { return (0); @@ -200,7 +200,9 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state) disable_intr(); /* Create Identity Mapping */ - pm = vmspace_pmap(CURPROC->p_vmspace); + if ((p = curproc) == NULL) + p = &proc0; + pm = vmspace_pmap(p->p_vmspace); if (pm->pm_pteobj == NULL) { pm->pm_pteobj = vm_object_allocate(OBJT_DEFAULT, PTDPTDI + 1); pteobj_allocated = 1; diff --git a/sys/i386/acpica/acpi_wakeup.c b/sys/i386/acpica/acpi_wakeup.c index d54a68beff08..6dc942eafe8c 100644 --- a/sys/i386/acpica/acpi_wakeup.c +++ b/sys/i386/acpica/acpi_wakeup.c @@ -32,7 +32,6 @@ #include #include #include -#include #include #include @@ -189,6 +188,7 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state) int ret = 0; int pteobj_allocated = 0; u_long ef; + struct proc *p; if (sc->acpi_wakeaddr == 0) { return (0); @@ -200,7 +200,9 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state) disable_intr(); /* Create Identity Mapping */ - pm = vmspace_pmap(CURPROC->p_vmspace); + if ((p = curproc) == NULL) + p = &proc0; + pm = vmspace_pmap(p->p_vmspace); if (pm->pm_pteobj == NULL) { pm->pm_pteobj = vm_object_allocate(OBJT_DEFAULT, PTDPTDI + 1); pteobj_allocated = 1;