@2:\r
mov eax, ss\r
lea bp, [esp + sizeof (IA32_REGS)]\r
+ ;\r
+ ; rsi in the following 2 instructions is indeed bp in 16-bit code\r
+ ;\r
mov word ptr (IA32_REGS ptr [rsi - sizeof (IA32_REGS)])._ESP, bp\r
+ DB 66h\r
mov ebx, (IA32_REGS ptr [rsi - sizeof (IA32_REGS)])._EIP\r
shl ax, 4 ; shl eax, 4\r
add bp, ax ; add ebp, eax\r
mov ax, cs\r
shl ax, 4\r
lea ax, [eax + ebx + (@64BitCode - @Base)]\r
- DB 2eh ; cs:\r
- mov [rdi + (@64Eip - @Base)], ax\r
+ DB 66h, 2eh, 89h, 87h ; mov cs:[bx + (@64Eip - @Base)], eax\r
+ DW @64Eip - @Base\r
DB 66h, 0b8h ; mov eax, imm32\r
SavedCr4 DD ?\r
mov cr4, rax\r
+ ;\r
+ ; rdi in the instruction below is indeed bx in 16-bit code\r
+ ;\r
DB 66h, 2eh\r
lgdt fword ptr [rdi + (SavedGdt - @Base)]\r
DB 66h\r