mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-17 06:47:49 +00:00
Do a far jump to long mode and print OKAY
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
global start
|
global start
|
||||||
|
extern long_mode_start
|
||||||
|
|
||||||
section .text
|
section .text
|
||||||
bits 32
|
bits 32
|
||||||
@@ -15,6 +16,8 @@ start:
|
|||||||
; load the 64-bit GDT
|
; load the 64-bit GDT
|
||||||
lgdt [gdt64.pointer]
|
lgdt [gdt64.pointer]
|
||||||
|
|
||||||
|
jmp gdt64.code:long_mode_start
|
||||||
|
|
||||||
; print `OK` to screen
|
; print `OK` to screen
|
||||||
mov dword [0xb8000], 0x2f4b2f4f
|
mov dword [0xb8000], 0x2f4b2f4f
|
||||||
hlt
|
hlt
|
||||||
@@ -154,6 +157,7 @@ stack_top:
|
|||||||
section .rodata
|
section .rodata
|
||||||
gdt64:
|
gdt64:
|
||||||
dq 0 ; zero entry
|
dq 0 ; zero entry
|
||||||
|
.code: equ $ - gdt64 ; new
|
||||||
dq (1<<43) | (1<<44) | (1<<47) | (1<<53) ; code segment
|
dq (1<<43) | (1<<44) | (1<<47) | (1<<53) ; code segment
|
||||||
.pointer:
|
.pointer:
|
||||||
dw $ - gdt64 - 1
|
dw $ - gdt64 - 1
|
||||||
|
|||||||
9
src/arch/x86_64/long_mode_init.asm
Normal file
9
src/arch/x86_64/long_mode_init.asm
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
global long_mode_start
|
||||||
|
|
||||||
|
section .text
|
||||||
|
bits 64
|
||||||
|
long_mode_start:
|
||||||
|
; print `OKAY` to screen
|
||||||
|
mov rax, 0x2f592f412f4b2f4f
|
||||||
|
mov qword [0xb8000], rax
|
||||||
|
hlt
|
||||||
Reference in New Issue
Block a user