summaryrefslogtreecommitdiff
path: root/src/kernel/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/core')
-rw-r--r--src/kernel/core/loader_.asm22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/kernel/core/loader_.asm b/src/kernel/core/loader_.asm
index 07de52c..28d1d2f 100644
--- a/src/kernel/core/loader_.asm
+++ b/src/kernel/core/loader_.asm
@@ -2,6 +2,7 @@
[GLOBAL loader] ; making entry point visible to linker
[EXTERN kmain] ; kmain is defined in kmain.c
[EXTERN tasking_tmpStack] ; a temporary 4k stack used by tasking, and used when setting up kernel stuff
+EXTERN start_ctors, end_ctors, start_dtors, end_dtors
; setting up the Multiboot header - see GRUB docs for details
MODULEALIGN equ 1<<0 ; align loaded modules on page boundaries
@@ -36,9 +37,30 @@ higherhalf: ; now we're running in higher half
add ebx, k_highhalf_addr ; update the MB info structure so that it is in the new seg
push ebx ; pass Multiboot info structure
+static_ctors_loop:
+ mov ebx, start_ctors
+ jmp .test
+.body:
+ call [ebx]
+ add ebx,4
+.test:
+ cmp ebx, end_ctors
+ jb .body
+
call kmain ; call kernel proper
cli ; disable interupts
+
+static_dtors_loop:
+ mov ebx, start_dtors
+ jmp .test
+.body:
+ call [ebx]
+ add ebx,4
+.test:
+ cmp ebx, end_dtors
+ jb .body
+
hang:
hlt ; halt machine should kernel return
jmp hang