2013-03-11 18:06:12 +08:00
|
|
|
.text
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <linux/linkage.h>
|
|
|
|
#include <asm/segment.h>
|
2009-02-14 03:14:01 +08:00
|
|
|
#include <asm/page_types.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-04-11 05:28:10 +08:00
|
|
|
# Copyright 2003, 2008 Pavel Machek <pavel@suse.cz>, distribute under GPLv2
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
.code32
|
|
|
|
ALIGN
|
|
|
|
|
2008-04-11 05:28:10 +08:00
|
|
|
ENTRY(wakeup_pmode_return)
|
2005-04-17 06:20:36 +08:00
|
|
|
wakeup_pmode_return:
|
|
|
|
movw $__KERNEL_DS, %ax
|
|
|
|
movw %ax, %ss
|
|
|
|
movw %ax, %ds
|
|
|
|
movw %ax, %es
|
|
|
|
movw %ax, %fs
|
|
|
|
movw %ax, %gs
|
|
|
|
|
|
|
|
# reload the gdt, as we need the full 32 bit address
|
|
|
|
lidt saved_idt
|
|
|
|
lldt saved_ldt
|
2008-04-11 05:28:10 +08:00
|
|
|
ljmp $(__KERNEL_CS), $1f
|
2005-04-17 06:20:36 +08:00
|
|
|
1:
|
|
|
|
movl %cr3, %eax
|
|
|
|
movl %eax, %cr3
|
|
|
|
wbinvd
|
|
|
|
|
|
|
|
# and restore the stack ... but you need gdt for this to work
|
|
|
|
movl saved_context_esp, %esp
|
|
|
|
|
|
|
|
movl %cs:saved_magic, %eax
|
|
|
|
cmpl $0x12345678, %eax
|
|
|
|
jne bogus_magic
|
|
|
|
|
|
|
|
# jump to place where we left off
|
2008-04-11 05:28:10 +08:00
|
|
|
movl saved_eip, %eax
|
2005-04-17 06:20:36 +08:00
|
|
|
jmp *%eax
|
|
|
|
|
|
|
|
bogus_magic:
|
|
|
|
jmp bogus_magic
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-04-11 05:28:10 +08:00
|
|
|
save_registers:
|
2005-04-17 06:20:36 +08:00
|
|
|
sidt saved_idt
|
|
|
|
sldt saved_ldt
|
|
|
|
str saved_tss
|
|
|
|
|
|
|
|
leal 4(%esp), %eax
|
|
|
|
movl %eax, saved_context_esp
|
2008-04-11 05:28:10 +08:00
|
|
|
movl %ebx, saved_context_ebx
|
|
|
|
movl %ebp, saved_context_ebp
|
|
|
|
movl %esi, saved_context_esi
|
|
|
|
movl %edi, saved_context_edi
|
|
|
|
pushfl
|
|
|
|
popl saved_context_eflags
|
|
|
|
|
|
|
|
movl $ret_point, saved_eip
|
2005-04-17 06:20:36 +08:00
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
restore_registers:
|
2008-04-11 05:28:10 +08:00
|
|
|
movl saved_context_ebp, %ebp
|
|
|
|
movl saved_context_ebx, %ebx
|
|
|
|
movl saved_context_esi, %esi
|
|
|
|
movl saved_context_edi, %edi
|
|
|
|
pushl saved_context_eflags
|
|
|
|
popfl
|
|
|
|
ret
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
ENTRY(do_suspend_lowlevel)
|
|
|
|
call save_processor_state
|
|
|
|
call save_registers
|
2012-07-27 07:40:08 +08:00
|
|
|
pushl $3
|
2013-10-31 09:31:18 +08:00
|
|
|
call x86_acpi_enter_sleep_state
|
2012-07-27 07:40:08 +08:00
|
|
|
addl $4, %esp
|
2006-08-15 13:37:31 +08:00
|
|
|
|
|
|
|
# In case of S3 failure, we'll emerge here. Jump
|
|
|
|
# to ret_point to recover
|
|
|
|
jmp ret_point
|
2005-04-17 06:20:36 +08:00
|
|
|
.p2align 4,,7
|
|
|
|
ret_point:
|
|
|
|
call restore_registers
|
|
|
|
call restore_processor_state
|
|
|
|
ret
|
|
|
|
|
2006-06-23 17:04:50 +08:00
|
|
|
.data
|
2005-04-17 06:20:36 +08:00
|
|
|
ALIGN
|
2006-06-23 17:04:50 +08:00
|
|
|
ENTRY(saved_magic) .long 0
|
|
|
|
ENTRY(saved_eip) .long 0
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
# saved registers
|
|
|
|
saved_idt: .long 0,0
|
|
|
|
saved_ldt: .long 0
|
|
|
|
saved_tss: .long 0
|
|
|
|
|