Path: blob/master/arch/x86/kernel/acpi/wakeup_32.S
10820 views
.section .text..page_aligned1#include <linux/linkage.h>2#include <asm/segment.h>3#include <asm/page_types.h>45# Copyright 2003, 2008 Pavel Machek <[email protected]>, distribute under GPLv267.code328ALIGN910ENTRY(wakeup_pmode_return)11wakeup_pmode_return:12movw $__KERNEL_DS, %ax13movw %ax, %ss14movw %ax, %ds15movw %ax, %es16movw %ax, %fs17movw %ax, %gs1819# reload the gdt, as we need the full 32 bit address20lgdt saved_gdt21lidt saved_idt22lldt saved_ldt23ljmp $(__KERNEL_CS), $1f241:25movl %cr3, %eax26movl %eax, %cr327wbinvd2829# and restore the stack ... but you need gdt for this to work30movl saved_context_esp, %esp3132movl %cs:saved_magic, %eax33cmpl $0x12345678, %eax34jne bogus_magic3536# jump to place where we left off37movl saved_eip, %eax38jmp *%eax3940bogus_magic:41jmp bogus_magic42434445save_registers:46sgdt saved_gdt47sidt saved_idt48sldt saved_ldt49str saved_tss5051leal 4(%esp), %eax52movl %eax, saved_context_esp53movl %ebx, saved_context_ebx54movl %ebp, saved_context_ebp55movl %esi, saved_context_esi56movl %edi, saved_context_edi57pushfl58popl saved_context_eflags5960movl $ret_point, saved_eip61ret626364restore_registers:65movl saved_context_ebp, %ebp66movl saved_context_ebx, %ebx67movl saved_context_esi, %esi68movl saved_context_edi, %edi69pushl saved_context_eflags70popfl71ret7273ENTRY(do_suspend_lowlevel)74call save_processor_state75call save_registers76pushl $377call acpi_enter_sleep_state78addl $4, %esp7980# In case of S3 failure, we'll emerge here. Jump81# to ret_point to recover82jmp ret_point83.p2align 4,,784ret_point:85call restore_registers86call restore_processor_state87ret8889.data90ALIGN91ENTRY(saved_magic) .long 092ENTRY(saved_eip) .long 09394# saved registers95saved_gdt: .long 0,096saved_idt: .long 0,097saved_ldt: .long 098saved_tss: .long 099100101102