diff options
| author | Miguel <m.i@gmx.at> | 2018-10-05 14:36:42 +0200 |
|---|---|---|
| committer | Miguel <m.i@gmx.at> | 2018-10-05 14:36:42 +0200 |
| commit | 4dbe6a264d7a3bd38ca1ac0921248654a50f1b5e (patch) | |
| tree | 5ab6b10a281eec07d46dc678805a9a4eb59e6341 /userspace/xterm/crt0.s | |
| parent | 7e56d9ac1e6888faed2109e2eefe124650aa4a72 (diff) | |
user space xterm continued
Diffstat (limited to 'userspace/xterm/crt0.s')
| -rw-r--r-- | userspace/xterm/crt0.s | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/userspace/xterm/crt0.s b/userspace/xterm/crt0.s new file mode 100644 index 0000000..dedc86c --- /dev/null +++ b/userspace/xterm/crt0.s @@ -0,0 +1,39 @@ +.global _start + +_start: + +# copy reent to this page +push %ebx +push %ecx + +mov _impure_ptr,%eax +mov $0xf5000000,%ebx +copy: +mov (%eax),%ecx +mov %ecx,(%ebx) +add $4, %ebx +add $4, %eax +cmp $0xf5001000,%ebx +jne copy + +pop %ecx +pop %ebx + +movl $0xf5000000, _impure_ptr + +# environment adress was passed on stack + +pop %eax +mov %eax, environ + +# call main (argc and argv are on the stack) +call main + +# push exit code and pass to _exit syscall +push %eax +call exit + +# this should never be reached! +.wait: + hlt +jmp .wait |
