summaryrefslogtreecommitdiffstats
path: root/usr/klibc/arch/parisc/crt0.S
diff options
context:
space:
mode:
Diffstat (limited to 'usr/klibc/arch/parisc/crt0.S')
-rw-r--r--usr/klibc/arch/parisc/crt0.S37
1 files changed, 37 insertions, 0 deletions
diff --git a/usr/klibc/arch/parisc/crt0.S b/usr/klibc/arch/parisc/crt0.S
new file mode 100644
index 0000000..0922446
--- /dev/null
+++ b/usr/klibc/arch/parisc/crt0.S
@@ -0,0 +1,37 @@
+ .align 4
+
+ .import $global$, data
+ .import __libc_init, code
+
+ .global _start
+ .export _start, ENTRY
+ .type _start,@function
+
+ .proc
+ .callinfo
+
+_start:
+/* extend the stack by 64-bytes */
+ ldo 64(%sp), %sp
+
+/* %r25 = argc
+ * %r24 = argv
+ * envp = argv + (argc + 1)
+ * elfdata = (argv - 4)
+ */
+ ldo -4(%r24), %r26
+
+/* load global data */
+ ldil L%$global$, %dp
+ ldo R%$global$(%dp), %dp
+
+/* parisc abi puts the atexit pointer in %r23, see ELF_PLAT_INIT() */
+ copy %r23, %r25
+
+/* branch to __libc_init */
+ bl __libc_init,%r2
+ nop
+/* break miserably if we ever return */
+ iitlbp %r0,(%sr0,%r0) /* illegal instruction */
+ nop
+ .procend