shrd ebx, ecx, 20\r
and ecx, 0xf\r
mov bx, cx\r
- mov [@jmp_addr], ebx\r
+ mov [@jmp_addr + 1], ebx\r
retf\r
+BITS 16\r
.0:\r
- DB 0xb8, 0x30, 0 ; mov ax, 30h as selector\r
- mov ds, eax\r
- mov es, eax\r
- mov fs, eax\r
- mov gs, eax\r
- mov ss, eax\r
- mov rax, cr0\r
- mov rbx, cr4\r
- DB 0x66\r
+ mov ax, 0x30\r
+ mov ds, ax\r
+ mov es, ax\r
+ mov fs, ax\r
+ mov gs, ax\r
+ mov ss, ax\r
+ mov eax, cr0\r
+ mov ebx, cr4\r
and eax, ((~ 0x80000001) & 0xffffffff)\r
and bl, ~ (1 << 5)\r
- mov cr0, rax\r
- DB 0x66\r
+ mov cr0, eax\r
mov ecx, 0xc0000080\r
rdmsr\r
and ah, ~ 1\r
wrmsr\r
- mov cr4, rbx\r
- DB 0xea ; jmp far @jmp_addr\r
-@jmp_addr: DD 0\r
+ mov cr4, ebx\r
+@jmp_addr:\r
+ jmp 0x0:0x0\r
\r
global ASM_PFX(AsmTransferControl32)\r
ASM_PFX(AsmTransferControl32):\r
+BITS 32\r
; S3WakingVector :DWORD\r
; AcpiLowMemoryBase :DWORD\r
- push rbp\r
+ push ebp\r
mov ebp, esp\r
DB 0x8d, 0x5 ; lea eax, AsmTransferControl16\r
ASM_PFX(AsmFixAddress16): DD 0\r
push 0x28 ; CS\r
- push rax\r
+ push eax\r
retf\r
\r
global ASM_PFX(AsmTransferControl16)\r
ASM_PFX(AsmTransferControl16):\r
- DB 0xb8, 0x30, 0 ; mov ax, 30h as selector\r
- mov ds, ax\r
- mov es, ax\r
- mov fs, ax\r
- mov gs, ax\r
- mov ss, ax\r
- mov rax, cr0 ; Get control register 0\r
- DB 0x66\r
- DB 0x83, 0xe0, 0xfe ; and eax, 0fffffffeh ; Clear PE bit (bit #0)\r
- DB 0xf, 0x22, 0xc0 ; mov cr0, eax ; Activate real mode\r
+BITS 16\r
+ mov ax, 0x30\r
+o32 mov ds, eax\r
+o32 mov es, eax\r
+o32 mov fs, eax\r
+o32 mov gs, eax\r
+o32 mov ss, eax\r
+ mov eax, cr0 ; Get control register 0\r
+ and eax, 0fffffffeh ; Clear PE bit (bit #0)\r
+ mov cr0, eax ; Activate real mode\r
DB 0xea ; jmp far AsmJmpAddr32\r
ASM_PFX(AsmJmpAddr32): DD 0\r
\r
global ASM_PFX(PageFaultHandlerHook)\r
ASM_PFX(PageFaultHandlerHook):\r
+BITS 64\r
push rax ; save all volatile registers\r
push rcx\r
push rdx\r
pop rcx\r
pop rax ; restore all volatile registers\r
jnz .1\r
- jmp ASM_PFX(mOriginalHandler)\r
+ jmp qword [ASM_PFX(mOriginalHandler)]\r
.1:\r
add rsp, 0x8 ; skip error code for PF\r
iretq\r