-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathkernel.fth
49 lines (40 loc) · 895 Bytes
/
kernel.fth
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
46
47
48
; program: kernel
; by José Dinuncio <[email protected]
; 12/2009
%include "forth.h"
global main
extern main_test
[BITS 32]
section .text
; function: main
; Initialize the forth machinery.
;
global main
main:
mov [var_S0], esp ; Save the initial data stack pointer in FORTH variable S0.
mov ebp, return_stack_top ; init the return stack
mov esi, cold_start ; fist foth word to exec
next
section .rodata
; Bridge to the forth's word main
cold_start:
dd main_kernel
; function: main
; Firts foth word to be executed by the kernel
extern pit_init
extern irq_init
extern idt_init
: main_kernel, main_kernel, 0
idt_init
100 pit_init
irq_init
main_test
stop
;
; stacks
section .bss
align 4096
RETURN_STACK_SIZE equ 8192
return_stack:
resb RETURN_STACK_SIZE
return_stack_top: