;------------------------------------------------------------------------------\r
InternalX86DisablePaging64 PROC\r
cli\r
- lea r10, @F\r
+ lea rsi, @F ; rsi <- The start address of transition code\r
+ mov rdi, [rsp + 28h] ; rdi <- New stack\r
+ sub rdi, 64 ; rdi <- use 64 byte in stack to hold transition code \r
+ mov r10, rdi ; r10 <- The start address of transicition code below 4G\r
+ lea rax, mTransitionEnd ; rax <- end of transition code\r
+ sub rax, rsi ; rax <- The size of transition piece code \r
+ push rcx ; save rcx to stack\r
+ mov rcx, rax ; rcx <- The size of transition piece code\r
+ rep movsb ; copy transition code to (new stack - 64byte) below 4G\r
+ pop rcx ; restore rcx\r
+ \r
mov esi, r8d\r
mov edi, r9d\r
mov eax, [rsp + 28h] ; eax <- New Stack\r
push r10\r
DB 48h ; prefix to composite "retq" with next "retf"\r
retf ; Use far return to load CS register from stack\r
+\r
+; Start of transition code\r
@@:\r
mov esp, eax ; set up new stack\r
mov rax, cr0\r
hlt ; no one should get here\r
InternalX86DisablePaging64 ENDP\r
\r
+mTransitionEnd LABEL BYTE\r
+\r
END\r