diff options
author | Ranjith Kumaran <ranjith@cygnus.com> | 2000-03-17 22:48:54 +0000 |
---|---|---|
committer | Ranjith Kumaran <ranjith@cygnus.com> | 2000-03-17 22:48:54 +0000 |
commit | 03261851a10dd2d6900a0a00a7515a0a46fb5d76 (patch) | |
tree | 7c22ac6cbbc99fd5cd1b5426853be8d4fd7bfcf1 /libgloss/mcore/crt0.S | |
parent | fae4c299f14fc23e2829c8656992eba21f79242a (diff) | |
download | cygnal-03261851a10dd2d6900a0a00a7515a0a46fb5d76.tar.gz cygnal-03261851a10dd2d6900a0a00a7515a0a46fb5d76.tar.bz2 cygnal-03261851a10dd2d6900a0a00a7515a0a46fb5d76.zip |
20000317 sourceware import
Diffstat (limited to 'libgloss/mcore/crt0.S')
-rw-r--r-- | libgloss/mcore/crt0.S | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/libgloss/mcore/crt0.S b/libgloss/mcore/crt0.S new file mode 100644 index 000000000..cea437019 --- /dev/null +++ b/libgloss/mcore/crt0.S @@ -0,0 +1,49 @@ +// MCore StartUp Code. + + .import main + .import exit + + .text + .export _start +_start: + .export _mainCRTStartup +_mainCRTStartup: + // Initialise the stack pointer + lrw r1, _stack + mov r0, r1 + + // Zero the .bss data space + lrw r1, __bss_start__ + lrw r2, __bss_end__ + movi r3, 0 +.L0: + st r3, (r1, 0) + addi r1, 4 + cmphs r1, r2 + bf .L0 +#ifdef __ELF__ + // Call the global/static constructors + jbsr _init + + // Setup destructors to be called from exit, + // just in case main never returns... + lrw r2, _fini + jbsr atexit +#endif + + // Initialise the parameters to main() + movi r2, 0 // argc + movi r3, 0 // argv + movi r4, 0 // envp + + // Call main + jbsr main + + // Call exit + movi r2, 0 + jbsr exit + + // We should never reach here. + bkpt + + |