- db 66h, 8Bh, 1Ch ; mov ebx,dword ptr [si]\r
-\r
- db 0BFh ; opcode of mov di, mem16\r
- dw PmodeOffsetLocation ; mov di, PmodeOffsetLocation\r
- db 66h, 8Bh, 05h ; mov eax,dword ptr [di]\r
- db 8Bh, 0F8h ; mov di, ax\r
- db 83h, 0EFh,06h ; sub di, 06h\r
- db 66h, 03h, 0C3h ; add eax, ebx\r
- db 66h, 89h, 05h ; mov dword ptr [di],eax\r
-\r
- db 0BFh ; opcode of mov di, mem16\r
- dw LmodeOffsetLocation ; mov di, LmodeOffsetLocation\r
- db 66h, 8Bh, 05h ; mov eax,dword ptr [di]\r
- db 8Bh, 0F8h ; mov di, ax\r
- db 83h, 0EFh,06h ; sub di, 06h\r
- db 66h, 03h, 0C3h ; add eax, ebx\r
- db 66h, 89h, 05h ; mov dword ptr [di],eax\r
-\r
- db 0BEh\r
- dw Cr3Location ; mov si, Cr3Location\r
- db 66h, 8Bh, 0Ch ; mov ecx,dword ptr [si] ; ECX is keeping the value of CR3\r
+ db 66h, 8Bh, 1Ch ; mov ebx, dword ptr [si]\r
+\r
+ db 0BFh ; opcode of mov di, mem16 \r
+ dw LmodeOffsetLocation ; mov di, LmodeOffsetLocation\r
+ db 66h, 8Bh, 05h ; mov eax, [di]\r
+ db 0BFh ; opcode of mov di, mem16 \r
+ dw CodeSegmentLocation ; mov di, CodeSegmentLocation\r
+ db 66h, 8Bh, 15h ; mov edx, [di]\r
+ db 89h, 0C7h ; mov di, ax\r
+ db 83h, 0EFh, 02h ; sub di, 02h \r
+ db 89h, 15h ; mov [di], dx ; Patch long mode CS\r
+ db 83h, 0EFh, 04h ; sub di, 04h\r
+ db 66h, 01h, 0D8h ; add eax, ebx\r
+ db 66h, 89h, 05h ; mov [di], eax ; Patch address\r