Ömer Özsipahi feature: C kernel
NakedOS boot.asm
boot.asm 1.3 KB
[ORG 0x7C00]
[BITS 16]
%include "nkboot/conf.asm"
_start:
mov bx, MSG_REAL_MODE
call _write_string
mov cl, 2
mov dh, BOOT_SECTOR_COUNT
xor ax, ax
mov es, ax
mov bx, BOOT_SECTOR_ADDR
call _disk_load
mov cl, 3
mov dh, KERNEL_SECTOR_COUNT
xor ax, ax
mov es, ax
mov bx, KERNEL_TMP_ADDR
call _disk_load
cli
jmp BOOT_SECTOR_ADDR
HEX_STR:
db "0x0000", 0
MSG_LONG_MODE:
db 'Successfully switched to 64-bit Long Mode', 0
MSG_COMP_MODE:
db "It's not magic talent and sweat", 0
MSG_REAL_MODE:
db 'Started in 16-bit Real Mode ', 0
MSG_PROT_MODE:
db 'Successfully switched to 32-bit Protected Mode', 0
DISK_ERR_MSG:
db ' An error accured while reading from disk ', 0
BOOT_DRIVE:
db 0
%include "nkboot/real_mode/basic_write.asm"
%include "nkboot/real_mode/write_string.asm"
%include "nkboot/real_mode/print_hex.asm"
%include "nkboot/real_mode/disk_load.asm"
times 510 - ($-$$) db 0;
dw 0xAA55
%include "nkboot/pm/print_str_vga.asm"
%include "nkboot/pm/switch_pm.asm"
%include "nkboot/long_mode/paging_table_res.asm"
%include "nkboot/long_mode/paging_table.asm"
%include "nkboot/long_mode/ignite_long_mode.asm"
%include "nkboot/pm/gdt.asm"
%include "nkboot/long_mode/gdt64.asm"
times 1024 - ($-$$) db 0