summaryrefslogtreecommitdiff
path: root/interface/crt0.s
diff options
context:
space:
mode:
Diffstat (limited to 'interface/crt0.s')
-rw-r--r--interface/crt0.s30
1 files changed, 26 insertions, 4 deletions
diff --git a/interface/crt0.s b/interface/crt0.s
index c24d2d9..65123b7 100644
--- a/interface/crt0.s
+++ b/interface/crt0.s
@@ -1,9 +1,12 @@
.global _start
+.global myinit //temporary quickfix / test
_start:
-push %ebx
-push %ecx
+// ALIGN stack
+
+//push %ebx
+//push %ecx
//cmp $0,_impure_ptr
//jne skipzero
@@ -19,6 +22,7 @@ push %ecx
//skipzero:
+/*
mov _impure_ptr,%eax
mov $0xf5000000,%ebx
@@ -30,19 +34,33 @@ add $4, %eax
cmp $0xf5001000,%ebx
jne copy
+*/
+
movl $0xf5000000, _impure_ptr
-pop %ecx
-pop %ebx
+//call _init
# environment adress was passed on stack
pop %eax
mov %eax, environ
+pop %ecx
+pop %ebx
+
+and $-16,%esp
+sub $8,%esp
+
+push %ebx
+push %ecx
+
# call main (argc and argv are on the stack)
call main
+// ALIGN stack
+and $-16,%esp
+sub $4,%esp
+
# push exit code and pass to _exit syscall
push %eax
call exit
@@ -51,3 +69,7 @@ call exit
.wait:
hlt
jmp .wait
+
+myinit:
+call _init
+ret