Ömer Özsipahi feature: C kernel
ignite_long_mode.asm 705 B
_ignite_long_mode:
lgdt [_gdt64_descriptor]
mov ax, GDT64_KERNEL_DATA
mov ds, ax
; jmp $
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
jmp GDT64_KERNEL_CODE:_ignite_defs
[BITS 64]
_ignite_defs:
jmp _ignite
DEFINE_PRINT_STR_VGA _print_str_vga64, rbx, rcx, rdx
_ignite:
mov rbx, MSG_LONG_MODE
mov rcx, 11
call _print_str_vga64
mov rsi, KERNEL_TMP_ADDR ; rsi = SOURCE INDEX
mov rdi, KERNEL_LOAD_ADDR ; rdi = DEST INDEX
mov rcx, KERNEL_SECTOR_COUNT * 512 ; rcx counter for rep instruction
rep movsb ; movsb copies a byte from rsi to rdi and increments both register
cli
mov rsp, 0x1FFFF0
jmp KERNEL_LOAD_ADDR