summaryrefslogtreecommitdiff
path: root/newlib/crt0.s
diff options
context:
space:
mode:
authorMiguel <m.i@gmx.at>2018-09-13 02:14:46 +0200
committerMiguel <m.i@gmx.at>2018-09-13 02:14:46 +0200
commit6a886cb2a4af303fae01b61a2e6590ca22bb4a3e (patch)
treeaff66570735d0869dcdf7b98ebd5aa595213c81d /newlib/crt0.s
parentb669230cae92f061bc36f25cd01dd84d276d226b (diff)
reentrenacy for newilb
Diffstat (limited to 'newlib/crt0.s')
-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