2020-09-18 23:15:27 +03:00
|
|
|
extern bss_begin
|
|
|
|
extern bss_end
|
|
|
|
extern entry
|
2020-12-06 18:43:38 +03:00
|
|
|
extern gdt
|
2020-09-18 23:15:27 +03:00
|
|
|
|
2023-09-12 00:48:37 +03:00
|
|
|
section .entry progbits alloc exec nowrite align=16
|
2020-09-18 23:15:27 +03:00
|
|
|
|
|
|
|
global _start
|
|
|
|
_start:
|
|
|
|
cld
|
|
|
|
|
|
|
|
; Zero out .bss
|
|
|
|
xor al, al
|
|
|
|
mov edi, bss_begin
|
|
|
|
mov ecx, bss_end
|
|
|
|
sub ecx, bss_begin
|
|
|
|
rep stosb
|
|
|
|
|
2020-12-06 18:43:38 +03:00
|
|
|
lgdt [gdt]
|
|
|
|
jmp 0x18:.reload_cs
|
|
|
|
.reload_cs:
|
|
|
|
mov eax, 0x20
|
|
|
|
mov ds, ax
|
|
|
|
mov es, ax
|
|
|
|
mov fs, ax
|
|
|
|
mov gs, ax
|
|
|
|
mov ss, ax
|
|
|
|
|
2020-09-18 23:15:27 +03:00
|
|
|
jmp entry
|
2023-09-28 12:15:33 +03:00
|
|
|
|
|
|
|
section .note.GNU-stack noalloc noexec nowrite progbits
|