summaryrefslogtreecommitdiffstats
path: root/libgloss/bfin/crt0.S
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2006-11-08 19:36:56 +0000
committerJeff Johnston <jjohnstn@redhat.com>2006-11-08 19:36:56 +0000
commitc0977673acb66eb05898458a280da873067e6709 (patch)
tree6e68ea94b3a4fedf1ac12945af7a8cb4d48201c0 /libgloss/bfin/crt0.S
parent292f8e2328d56d163f5a2fc7f07f348ccd6bb1ae (diff)
downloadcygnal-c0977673acb66eb05898458a280da873067e6709.tar.gz
cygnal-c0977673acb66eb05898458a280da873067e6709.tar.bz2
cygnal-c0977673acb66eb05898458a280da873067e6709.zip
2006-11-08 Jie Zhang <jzhang918@gmail.com>
* bfin/configure.in: New. * bfin/crt0.S: New. * bfin/Makefile.in: New. * bfin/syscalls.c: New. * bfin/aclocal.m4: Generate. * bfin/configure: Ditto. * configure.in: Add support for bfin-*-*. * configure: Regenerate. * syscall.h (SYS_argc): Define. (SYS_argnlen): Define. (SYS_argn): Define.
Diffstat (limited to 'libgloss/bfin/crt0.S')
-rw-r--r--libgloss/bfin/crt0.S72
1 files changed, 72 insertions, 0 deletions
diff --git a/libgloss/bfin/crt0.S b/libgloss/bfin/crt0.S
new file mode 100644
index 000000000..f34b5154b
--- /dev/null
+++ b/libgloss/bfin/crt0.S
@@ -0,0 +1,72 @@
+/*
+ * crt0.S for the Blackfin processor
+ *
+ * Copyright (C) 2006 Analog Devices, Inc.
+ *
+ * The authors hereby grant permission to use, copy, modify, distribute,
+ * and license this software and its documentation for any purpose, provided
+ * that existing copyright notices are retained in all copies and that this
+ * notice is included verbatim in any distributions. No written agreement,
+ * license, or royalty fee is required for any of the authorized uses.
+ * Modifications to this software may be copyrighted by their authors
+ * and need not follow the licensing terms described here, provided that
+ * the new terms are clearly indicated on the first page of each file where
+ * they apply.
+ */
+
+ .text
+ .align 2
+
+ .global __start
+__start:
+
+ /* Start by setting up a stack */
+ link 0xc;
+ /* Zero the memory in the .bss section. */
+
+ p0.l = __edata;
+ p0.h = __edata;
+ p1.l = __end;
+ p1.h = __end;
+ p1 -= p0;
+ r0 = 0;
+ lsetup (L$L$clear_bss, L$L$clear_bss) lc0 = p1;
+L$L$clear_bss:
+ B [p0++] = r0;
+
+#ifdef __BFIN_FDPIC__
+ /* Set up GOT pointer. */
+ P0.L = __ROFIXUP_END__;
+ P0.H = __ROFIXUP_END__;
+ P4 = [P0 - 4];
+#endif
+
+ /* Need to set up standard file handles */
+ /* Parse string at r1 */
+
+ p0.l = __init;
+ p0.h = __init;
+ P3 = P4;
+ call (p0)
+
+ p0.l = _atexit;
+ p0.h = _atexit;
+#ifdef __BFIN_FDPIC__
+ r0 = [P4 + __fini@FUNCDESC_GOT17M4] ;
+ P3 = P4;
+#else
+ r0.l = __fini;
+ r0.h = __fini;
+#endif
+ call (p0)
+
+ p0.l = ___setup_argv_and_call_main;
+ p0.h = ___setup_argv_and_call_main;
+ P3 = P4;
+ call (p0)
+
+ p0.l = _exit;
+ p0.h = _exit;
+ P3 = P4;
+ jump (p0) /* Should not return. */
+ nop;