wakeup: Switch back to 32bit mode first

On x86_64 we need to leave long mode before we can switch to 16bit
mode. Oh joy! When's my 64bit resume pointer coming?

Why didn't this get caught earlier? Seems the Asrock E350M2 didn't
do Suspend/Resume?

Yes, I know it's Intel syntax. Will be converted to AT&T syntax
as soon as the whole thing actually works.. 8)

Change-Id: Ic51869cf67d842041f8842cd9964d72a024c335f
Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-on: http://review.coreboot.org/11106
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
This commit is contained in:
Stefan Reinauer 2015-07-31 16:46:28 -07:00 committed by Stefan Reinauer
parent f79d05b778
commit ac901e6bed
1 changed files with 28 additions and 0 deletions

View File

@ -32,6 +32,34 @@
.globl __wakeup .globl __wakeup
__wakeup: __wakeup:
#ifdef __x86_64__
.intel_syntax noprefix
xor rax,rax
mov ax, ss
push rax
mov rax, rsp
add rax, 8
push rax
pushfq
push 0x10
lea rax,[rip+3]
push rax
iretq
.code32
/* disable paging */
mov eax, cr0
btc eax, 31
mov cr0, eax
/* disable long mode */
mov ecx, 0xC0000080
rdmsr
btc eax, 8
wrmsr
.att_syntax prefix
#endif
/* First prepare the jmp to the resume vector */ /* First prepare the jmp to the resume vector */
mov 0x4(%esp), %eax /* vector */ mov 0x4(%esp), %eax /* vector */
/* last 4 bits of linear addr are taken as offset */ /* last 4 bits of linear addr are taken as offset */