diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2001-01-19 01:25:13 +0000 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2001-01-19 01:25:13 +0000 |
commit | a302b48c21aaf08f166b8514705b87f1331c147f (patch) | |
tree | 66ba2814d00a53aed3a3df2b0c6ab6a34a2e2735 /newlib/libc/sys/arc/crt0.S | |
parent | 74a3cd0a4f15c1c9dfe4044d7a54b420e5a5f7f6 (diff) | |
download | cygnal-a302b48c21aaf08f166b8514705b87f1331c147f.tar.gz cygnal-a302b48c21aaf08f166b8514705b87f1331c147f.tar.bz2 cygnal-a302b48c21aaf08f166b8514705b87f1331c147f.zip |
2001-01-18 Jeff Johnston <jjohnstn@redhat.com>
* libc/sys/arc/Makefile.am: New file.
* libc/sys/arc/Makefile.in: Ditto.
* libc/sys/arc/aclocal.m4: Ditto.
* libc/sys/arc/configure: Ditto.
* libc/sys/arc/configure.in: Ditto.
* libc/sys/arc/crt0.S: Ditto.
* libc/sys/arc/isatty.c: Ditto.
* libc/sys/arc/mem-layout.c: Ditto.
* libc/sys/arc/sbrk.c: Ditto.
* libc/sys/arc/syscalls.c: Ditto.
* libc/sys/arc/sys/syscall.h: Ditto.
Diffstat (limited to 'newlib/libc/sys/arc/crt0.S')
-rw-r--r-- | newlib/libc/sys/arc/crt0.S | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/newlib/libc/sys/arc/crt0.S b/newlib/libc/sys/arc/crt0.S new file mode 100644 index 000000000..346339774 --- /dev/null +++ b/newlib/libc/sys/arc/crt0.S @@ -0,0 +1,75 @@ +; ARC start up file +; In the absence of a custom linker script, go with something simple. +; We do not support passing arguments to "main", but this is an embedded +; system anyway. +; +; We call init/fini here without cpu prefixes because there is always +; only one .init/.fini section per image. + + .section .text + .align 4 + + .global start +start: + + mov sp,end ; Round "sp" up to page after "end". + add sp,sp,4095 + and sp,sp,-4096 + + ld r8,[stack_size] ; Add stack size to "sp". + add sp,sp,r8 + + st sp,[sbrk_start] ; Initialize malloc heap. + st sp,[sbrk_loc] + + sub sp,sp,16 ; callee expects 16 bytes already "pushed". + mov fp,0 ; Top of stack frame indicator. + + mov r0,edata ; Zero bss. + mov r2,end + sub r2,r2,r0 + mov r1,0 + +#ifdef __base__ + bl.nd _memset + bl.nd init ; .init section entry point. + mov r0,%st(fini) ; .fini section entry point. + bl.nd _atexit + mov r0,0 ; argc + mov r1,0 ; argv + bl.nd _main + bl.nd _exit +#endif + +#ifdef __host__ + bl.nd _host_memset + bl.nd init ; .init section entry point. + mov r0,%st(fini) ; .fini section entry point. + bl.nd _host_atexit + mov r0,0 ; argc + mov r1,0 ; argv + bl.nd _host_main + bl.nd _host_exit +#endif + +#ifdef __graphics__ + bl.nd _graphics_memset + bl.nd init ; .init section entry point. + mov r0,%st(fini) ; .fini section entry point. + bl.nd _graphics_atexit + mov r0,0 ; argc + mov r1,0 ; argv + bl.nd _graphics_main + bl.nd _graphics_exit +#endif + +#ifdef __audio__ + bl.nd _audio_memset + bl.nd init ; .init section entry point. + mov r0,%st(fini) ; .fini section entry point. + bl.nd _audio_atexit + mov r0,0 ; argc + mov r1,0 ; argv + bl.nd _audio_main + bl.nd _audio_exit +#endif |