diff options
| author | Ian Moffett <ian@osmora.org> | 2025-11-11 00:02:58 -0500 |
|---|---|---|
| committer | Ian Moffett <ian@osmora.org> | 2025-11-11 00:02:58 -0500 |
| commit | 9a30df58affaa1c00ebdc77693ffe6004e507230 (patch) | |
| tree | b0eb5198ea86f6e4a196e030cc6bb9b311bd15d7 /mbr/stage1.asm | |
| parent | 2b4d74005690b074ffe95f50e9f01fd70cd1e605 (diff) | |
mbr: Transfer to C in protected mode
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'mbr/stage1.asm')
| -rw-r--r-- | mbr/stage1.asm | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/mbr/stage1.asm b/mbr/stage1.asm index ea51f22..d0299e4 100644 --- a/mbr/stage1.asm +++ b/mbr/stage1.asm @@ -17,9 +17,39 @@ _start: call enable_a20 call disk_load - jmp 0x0000:0x8000 - hlt - jmp $ + ;; Enable protected mode + mov eax, cr0 + or al, 1 + mov cr0, eax + + lgdt [GDTR] + jmp 0x8:0x8000 + +GDT32: +.null_desc: + dw 0x0000 + dw 0x0000 + db 0x00 + db 0b00000000 + db 0b00000000 + db 0x00 +.code_desc: + dw 0xFFFF + dw 0x0000 + db 0x00 + db 0b10011010 + db 0b11001111 + db 0x00 +.data_desc: + dw 0xFFFF + dw 0x0000 + db 0x00 + db 0b10010010 + db 0b11001111 + db 0x00 +GDTR: + dw $ - GDT32 - 1 + dd GDT32 ;; ;; Write a string to the screen |
