summaryrefslogtreecommitdiff
path: root/newlib
diff options
context:
space:
mode:
Diffstat (limited to 'newlib')
-rw-r--r--newlib/crt0.s21
1 files changed, 21 insertions, 0 deletions
diff --git a/newlib/crt0.s b/newlib/crt0.s
index e8f0405..ad9884f 100644
--- a/newlib/crt0.s
+++ b/newlib/crt0.s
@@ -2,10 +2,31 @@
_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
+
# environment adress was passed on stack
+
+movl $0xf5000000, _impure_ptr
+
pop %eax
mov %eax, environ
+
# call main (argc and argv are on the stack)
call main