summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/metag/crt1.S
diff options
context:
space:
mode:
authorMarkos Chandras <markos.chandras@imgtec.com>2008-02-05 14:51:48 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2013-03-14 22:45:15 +0100
commit22686a1383c4a4a319eaaa6b16b1a9540114bd66 (patch)
tree04e12086f9187c150ba6a33db0368b9903e50363 /libc/sysdeps/linux/metag/crt1.S
parent37439e66a31f251eba39604885f57099a43d943d (diff)
Add support for the Meta architecture
Meta cores are 32-bit, hardware multithreaded, general purpose, embedded processors which also feature a DSP instruction set, and can be found in many digital radios. They are capable of running different operating systems on different hardware threads, for example a digital radio might run RTOSes for DAB decoding and audio decoding on 3 hardware threads, and run Linux on the 4th hardware thread to manage the user interface, networking etc. HTPs are also capable of running SMP Linux on multiple hardware threads. Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'libc/sysdeps/linux/metag/crt1.S')
-rw-r--r--libc/sysdeps/linux/metag/crt1.S76
1 files changed, 76 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/metag/crt1.S b/libc/sysdeps/linux/metag/crt1.S
new file mode 100644
index 000000000..74adc1fdb
--- /dev/null
+++ b/libc/sysdeps/linux/metag/crt1.S
@@ -0,0 +1,76 @@
+! Copyright (C) 2013 Imagination Technologies Ltd.
+
+! Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
+
+
+#include <asm/unistd.h>
+
+ .text
+ .global __start
+ .type __start,function
+__start:
+ MOV D0FrT,A0StP
+ MOV A0FrP,A0StP
+
+ MOV A0.2,#0
+ MOV A0.3,#0
+
+ MOV A1.1,#0
+ MOV A1.2,#0
+ MOV A1.3,#0
+
+ MOV D0.5,#0
+ MOV D0.6,#0
+ MOV D0.7,#0
+
+ MOV D1.5,#0
+ MOV D1.6,#0
+ MOV D1.7,#0
+
+ MOV D1Ar3,D0Ar2 ! argv
+ MOV D0Ar2,D1Ar1 ! argc
+
+#ifdef __PIC__
+ ADDT A1LbP,CPC1,#HI(__GLOBAL_OFFSET_TABLE__)
+ ADD A1LbP,A1LbP,#LO(__GLOBAL_OFFSET_TABLE__+4)
+
+ MOV D1Ar1,A1LbP
+ ADDT D1Ar1,D1Ar1,#HI(_main@GOTOFF)
+ ADD D1Ar1,D1Ar1,#LO(_main@GOTOFF)
+
+ MOV D0Ar4,A1LbP
+ ADDT D0Ar4,D0Ar4,#HI(__init@GOTOFF)
+ ADD D0Ar4,D0Ar4,#LO(__init@GOTOFF)
+
+ MOV D1Ar5,A1LbP
+ ADDT D1Ar5,D1Ar5,#HI(__fini@GOTOFF)
+ ADD D1Ar5,D1Ar5,#LO(__fini@GOTOFF)
+#else
+ MOVT D1Ar1,#HI(_main)
+ ADD D1Ar1,D1Ar1,#LO(_main)
+ MOVT D0Ar4,#HI(__init)
+ ADD D0Ar4,D0Ar4,#LO(__init)
+ MOVT D1Ar5,#HI(__fini)
+ ADD D1Ar5,D1Ar5,#LO(__fini)
+#endif
+
+ MOV D0Ar6,#0 ! rtld_fini
+
+ MOVT D1Re0,#0x80
+
+ SETL [A0StP++],D0Re0,D1Re0 ! stack_end (8Mb)
+
+ MOV D1Re0,#0
+ MOV D0Re0,#0
+
+#ifdef __PIC__
+ CALLR D1RtP, ___uClibc_main@PLT
+#else
+ CALLR D1RtP, ___uClibc_main
+#endif
+
+ MOV D1Re0,#__NR_exit
+ MOV D1Ar1,#0x1
+ SWITCH #0x440001 ! exit syscall
+
+ .size __start,.-__start