Finished implementing paging init and long mode switch

This commit is contained in:
2022-12-13 22:22:04 +00:00
parent 3402207602
commit 766667a6ad
5 changed files with 219 additions and 24 deletions

View File

@@ -1,10 +1,57 @@
.code64
.section .boot.rodata, "a", @progbits
/*******
ERROR MESSAGE STRINGS
*******/
kernel_identifier:
.asciz " Socks kernel version " BUILD_ID " "
.section .boot.text, "ax", @progbits
.code64
print_kernel_identifier:
/* line 1: empty padding line */
mov $kernel_identifier, %rsi
mov $0xb8000, %rdi
1:
movw $0x7000, (%rdi) # black text on white background.
add $0x02, %rdi
inc %rsi
cmpb $0, (%rsi)
jne 1b
/* line 2: kernel identiifer */
mov $kernel_identifier, %rsi
mov $0xb80A0, %rdi
2:
movsb
movb $0x70, (%rdi) # black text on white background
inc %rdi
cmpb $0, (%rsi)
jne 2b
/* line 3: empty padding line */
mov $kernel_identifier, %rsi
mov $0xb8140, %rdi
1:
movw $0x7000, (%rdi) # black text on white background.
add $0x02, %rdi
inc %rsi
cmpb $0, (%rsi)
jne 1b
ret
.global start_64
.type start_64, @function
start_64:
mov $0xb8000, %rax
movb $77, (%rax)
inc %rax
movb $0xF, (%rax)
call print_kernel_identifier
cli
hlt