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
34
35
36
37
38
39
40
41
42
43
44
45
|
[BITS 32]
global _start
extern start_kernel
CODE_SEG equ 0x08
DATA_SEG equ 0x10
; No access to BIOS from now on....
_start:
; Set all segments to the same as the DATA_SEG
mov ax, DATA_SEG
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
; Set the stack pointer and base pointer further in mem
mov ebp, 0x00200000
mov esp, ebp
; Enable A20 line
in al, 0x92
or al, 2
out 0x92, al
; Remap master PIC
mov al, 00010001b
out 0x20, al ; MasterPIC
mov al, 0x20 ; Start master ISR at 0x20
out 0x21, al
mov al, 00000001b ; Put the PIC in x86 mode
out 0x21, al
sti
; Jump to C code
call start_kernel
jmp $
; Hack to align the source code at 16bytes (because 512 is a multiple of 16)
times 512 - ($ - $$) db 0
|