small clean up and use configured segment for return to real mode

This commit is contained in:
2025-09-07 14:50:40 -04:00
parent 875527aa98
commit 69bd7d8f56

View File

@@ -274,9 +274,6 @@ EnterUnrealMode:
; set cs to a pm code segment (0x8) w/ the following ; set cs to a pm code segment (0x8) w/ the following
jmp 0x0008:EnterUnrealMode.set_segs jmp 0x0008:EnterUnrealMode.set_segs
;db 0xEA ; jmp far imm16:imm16
;dw EnterUnrealMode.set_segs ; error_far_ptr
;dw 0x0008 ; error_far_seg
.set_segs: .set_segs:
mov ax, 0x10 ; select descriptor 2 mov ax, 0x10 ; select descriptor 2
mov ds, ax ; 10h = 0001_0000b mov ds, ax ; 10h = 0001_0000b
@@ -291,7 +288,7 @@ EnterUnrealMode:
mov eax, cr0 mov eax, cr0
and eax, ~1 ; toggle bit 1 of cr0 and eax, ~1 ; toggle bit 1 of cr0
mov cr0, eax ; back to realmode mov cr0, eax ; back to realmode
jmp 0x0000:EnterUnrealMode.endp jmp __STAGE2_SEGMENT:EnterUnrealMode.endp
.endp: .endp:
sti ; re-enable interupts sti ; re-enable interupts