blob: 87b5e53a39d62633d5d9a4f796687b80dd434adc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
; MIT License, Copyright (c) 2021 Marvin Borner
extern bss_begin
extern bss_end
extern start
extern gdt
section .entry
global _start
_start:
cld
; Clear bss section
xor al, al
mov edi, bss_begin
mov ecx, bss_end
sub ecx, bss_begin
rep stosb
lgdt [gdt] ; Load GDT
jmp 0x18:.reload_cs ; Use third GDT segment for code
.reload_cs:
mov eax, 0x20 ; Use fourth GDT segment for data/other
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
jmp start
|