From 16368b1774dec7d3952aa00e3978d0c5488eff45 Mon Sep 17 00:00:00 2001 From: Mike Larkin Date: Thu, 1 Jul 2010 00:48:49 +0000 Subject: More accurate comment as to what happens with acpi_savecpu ok deraadt@ --- sys/arch/amd64/amd64/acpi_machdep.c | 10 ++++++++-- sys/arch/i386/i386/acpi_machdep.c | 18 +++++++----------- 2 files changed, 15 insertions(+), 13 deletions(-) (limited to 'sys') diff --git a/sys/arch/amd64/amd64/acpi_machdep.c b/sys/arch/amd64/amd64/acpi_machdep.c index 8fde0558fc6..16637cbccd1 100644 --- a/sys/arch/amd64/amd64/acpi_machdep.c +++ b/sys/arch/amd64/amd64/acpi_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi_machdep.c,v 1.36 2010/06/26 04:05:32 mlarkin Exp $ */ +/* $OpenBSD: acpi_machdep.c,v 1.37 2010/07/01 00:48:48 mlarkin Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * @@ -225,8 +225,12 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state) if (sc->sc_facs->version == 1) sc->sc_facs->x_wakeup_vector = 0; - /* Copy the current cpu registers into a safe place for resume. */ + /* Copy the current cpu registers into a safe place for resume. + * acpi_savecpu actually returns twice - once in the suspend + * path and once in the resume path (see setjmp(3)). + */ if (acpi_savecpu()) { + /* Suspend path */ fpusave_cpu(curcpu(), 1); #ifdef MULTIPROCESSOR x86_broadcast_ipi(X86_IPI_FLUSH_FPU); @@ -236,6 +240,8 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state) acpi_enter_sleep_state(sc, state); panic("%s: acpi_enter_sleep_state failed", DEVNAME(sc)); } + + /* Resume path continues here */ #if 0 /* Temporarily disabled for debugging purposes */ /* Reset the wakeup vector to avoid resuming on reboot */ diff --git a/sys/arch/i386/i386/acpi_machdep.c b/sys/arch/i386/i386/acpi_machdep.c index d7caf9980c2..14e811e0ca3 100644 --- a/sys/arch/i386/i386/acpi_machdep.c +++ b/sys/arch/i386/i386/acpi_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi_machdep.c,v 1.30 2010/04/20 22:05:41 tedu Exp $ */ +/* $OpenBSD: acpi_machdep.c,v 1.31 2010/07/01 00:48:48 mlarkin Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * @@ -243,8 +243,12 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state) if (sc->sc_facs->version == 1) sc->sc_facs->x_wakeup_vector = 0; - /* Copy the current cpu registers into a safe place for resume. */ + /* Copy the current cpu registers into a safe place for resume. + * acpi_savecpu actually returns twice - once in the suspend + * path and once in the resume path (see setjmp(3)). + */ if (acpi_savecpu()) { + /* Suspend path */ npxsave_cpu(curcpu(), 1); #ifdef MULTIPROCESSOR i386_broadcast_ipi(I386_IPI_FLUSH_FPU); @@ -255,15 +259,7 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state) panic("%s: acpi_enter_sleep_state failed", DEVNAME(sc)); } - /* - * On resume, the execution path will actually occur here. - * This is because we previously saved the stack location - * in acpi_savecpu, and issued a far jmp to the restore - * routine in the wakeup code. This means we are - * returning to the location immediately following the - * last call instruction - after the call to acpi_savecpu. - */ - + /* Resume path continues here */ #if 0 /* Temporarily disabled for debugging purposes */ /* Reset the wakeup vector to avoid resuming on reboot */ -- cgit v1.2.3