Skip to content

Commit

Permalink
ACPI: preserve the ebx value in acpi_copy_wakeup_routine
Browse files Browse the repository at this point in the history
Register %ebx serves as the "global offset table base register" for
position-independent code.  For absolute code, %ebx serves as a local
register and has no specified role in the function calling sequence.  In
either case, a function must preserve the register value for the caller.

acpi_copy_wakeup_routine overrides %ebx without saving it, this may corrupt
the called data.

Kevin found that most time the value of Sx is saved in %esi, however
sometimes compiler also uses %ebx.  When this happens, suspends fails since
sleep value in ebx is changed by acpi_copy_wakeup_routine.

The same funtion in X86_64 doesn't have this problem.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Looks-okay-to: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Cc: Len Brown <lenb@kernel.org>
Acked-by: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Tian Kevin authored and Linus Torvalds committed Jun 24, 2007
1 parent e5d2861 commit c8cbee6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions arch/i386/kernel/acpi/wakeup.S
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ bogus_magic:
#
ENTRY(acpi_copy_wakeup_routine)

pushl %ebx
sgdt saved_gdt
sidt saved_idt
sldt saved_ldt
Expand Down Expand Up @@ -263,6 +264,7 @@ ENTRY(acpi_copy_wakeup_routine)
movl %edx, video_flags - wakeup_start (%eax)
movl $0x12345678, real_magic - wakeup_start (%eax)
movl $0x12345678, saved_magic
popl %ebx
ret

save_registers:
Expand Down

0 comments on commit c8cbee6

Please sign in to comment.