summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid McCullough <davidm@snapgear.com>2001-12-19 03:43:54 +0000
committerDavid McCullough <davidm@snapgear.com>2001-12-19 03:43:54 +0000
commitbf126cb24e809f36067ce43f9186cbe53b906cad (patch)
treee9612ead69662cd0cd642829041195b06750b2d3
parent41b035e634135310bca3381877120981d7b248a4 (diff)
merged the two startup files so that uClinux people always get the correct
arg processing whether they are using PIC or not, and vice-versa for the MMU folks.
-rw-r--r--libc/sysdeps/linux/arm/Makefile6
-rw-r--r--libc/sysdeps/linux/arm/crt0.S30
-rw-r--r--libc/sysdeps/linux/arm/crt0pic.S65
3 files changed, 31 insertions, 70 deletions
diff --git a/libc/sysdeps/linux/arm/Makefile b/libc/sysdeps/linux/arm/Makefile
index 009d7d8e1..1e08d094b 100644
--- a/libc/sysdeps/linux/arm/Makefile
+++ b/libc/sysdeps/linux/arm/Makefile
@@ -26,11 +26,7 @@ ASFLAGS=$(CFLAGS)
TARGET_MACHINE_TYPE=$(shell $(CC) -dumpmachine)
-ifeq ($(DOPIC),true)
- CRT0=crt0pic.S
-else
- CRT0=crt0.S
-endif
+CRT0=crt0.S
CRT0_OBJ=crt0.o
SSRC=longjmp.S setjmp.S vfork.S
diff --git a/libc/sysdeps/linux/arm/crt0.S b/libc/sysdeps/linux/arm/crt0.S
index 65253881c..de7ef7848 100644
--- a/libc/sysdeps/linux/arm/crt0.S
+++ b/libc/sysdeps/linux/arm/crt0.S
@@ -6,6 +6,18 @@
NULL
env[0...N] environment variables (pointers)
NULL
+
+ For uClinux it looks like this:
+
+ argc argument counter (integer)
+ argv char *argv[]
+ envp char *envp[]
+ argv[0] program name (pointer)
+ argv[1...N] program args (pointers)
+ argv[argc-1] end of args (integer)
+ NULL
+ env[0...N] environment variables (pointers)
+ NULL
When we are done here, we want
a1=argc
@@ -34,6 +46,7 @@ ARM register quick reference:
pc r15 program counter
*/
+#include <features.h>
.text
.global _start
@@ -44,10 +57,17 @@ ARM register quick reference:
.text
_start:
+#if 0 /* some old code the I feel should not be here - davidm */
+ @ adjust the data segment base pointer
+ ldr r3,=__data_start
+ sub sl,sl,r3
+ mov BASEREG,sl
+#endif
/* clear the frame pointer */
mov fp, #0
+#ifdef __UCLIBC_HAS_MMU__
/* Load register r0 (argc) from the stack to its final resting place */
ldr r0, [sp], #4
@@ -58,6 +78,16 @@ _start:
we find there (hopefully the environment) in r2 */
add r2, r1, r0, lsl #2
add r2, r2, #4
+#else
+ /*
+ * uClinux stacks look a little different to MMU stacks
+ * for no good reason
+ */
+ /* pull argc, argv and envp off the stack */
+ ldr r0,[sp, #0]
+ ldr r1,[sp, #4]
+ ldr r2,[sp, #8]
+#endif
/* Ok, now run uClibc's main() -- shouldn't return */
bl __uClibc_main
diff --git a/libc/sysdeps/linux/arm/crt0pic.S b/libc/sysdeps/linux/arm/crt0pic.S
deleted file mode 100644
index 7cb26e80e..000000000
--- a/libc/sysdeps/linux/arm/crt0pic.S
+++ /dev/null
@@ -1,65 +0,0 @@
-/* When we enter this piece of code, the program stack looks like this:
- argc argument counter (integer)
- argv[0] program name (pointer)
- argv[1...N] program args (pointers)
- argv[argc-1] end of args (integer)
- NULL
- env[0...N] environment variables (pointers)
- NULL
-
- When we are done here, we want
- a1=argc
- a2=argv[0]
- a3=argv[argc+1]
-
-ARM register quick reference:
-
- Name Number ARM Procedure Calling Standard Role
-
- a1 r0 argument 1 / integer result / scratch register / argc
- a2 r1 argument 2 / scratch register / argv
- a3 r2 argument 3 / scratch register / envp
- a4 r3 argument 4 / scratch register
- v1 r4 register variable
- v2 r5 register variable
- v3 r6 register variable
- v4 r7 register variable
- v5 r8 register variable
- sb/v6 r9 static base / register variable
- sl/v7 r10 stack limit / stack chunk handle / reg. variable
- fp r11 frame pointer
- ip r12 scratch register / new-sb in inter-link-unit calls
- sp r13 lower end of current stack frame
- lr r14 link address / scratch register
- pc r15 program counter
-*/
-
-.text
- .global _start
- .global __uClibc_main
-
- .type _start,%function
- .type __uClibc_main,%function
-
-
-@ r0 = argc
-@ r1 = argv
-@ r2 = envp
-@ sl = data segment
-#define BASEREG r9
-
-.text
-_start:
- @ adjust the data segment base pointer
- ldr r3,=__data_start
- sub sl,sl,r3
- mov BASEREG,sl
-
- /* pull argc, argv and envp off the stack */
- ldr r0,[sp, #0]
- ldr r1,[sp, #4]
- ldr r2,[sp, #8]
-
- /* Ok, now run uClibc's main() -- shouldn't return */
- bl __uClibc_main
-