Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2005-12-12 14:16:41 +0300
committerNathan Sidwell <nathan@codesourcery.com>2005-12-12 14:16:41 +0300
commitad83f0cc13928b8d465e7bc39edb28666570dc18 (patch)
tree3cc4fb0ac26e32a66b645e7055890a6640ab5946 /libgloss/mt/crt0.S
parent2193d02b4ddfc329e0817258093a40050b2d582a (diff)
Rename ms1 files to mt files (part 1 -- renames only)
Diffstat (limited to 'libgloss/mt/crt0.S')
-rw-r--r--libgloss/mt/crt0.S63
1 files changed, 63 insertions, 0 deletions
diff --git a/libgloss/mt/crt0.S b/libgloss/mt/crt0.S
new file mode 100644
index 000000000..276124f5c
--- /dev/null
+++ b/libgloss/mt/crt0.S
@@ -0,0 +1,63 @@
+# Startup Code for the Morpho ms1
+
+# Create a label for the start of the eh_frame section.
+ .section .eh_frame
+__eh_frame_begin:
+
+ .section .text
+ .global _start
+_start:
+
+ ;; Initialise the stack pointer
+ ldui sp, #%hi16(__stack)
+ addui sp, sp, #%lo16(__stack)
+ or fp, sp, sp
+
+ ;; Zero the data space
+ ldui r9, #%hi16(_edata)
+ addui r9, r9, #%lo16(_edata)
+ ldui r10, #%hi16(_end)
+ addui r10, r10, #%lo16(_end)
+ addi r5, r0, #0
+
+.L0:
+ stw r5, r9, #0
+ addi r9, r9, #4
+ or r0, r0, r0 ; nop
+ brle r9, r10, .L0
+ or r0, r0, r0 ; nop
+
+ ;; Call global and static constructors
+ ldui r10, #%hi16(_init)
+ addui r10, r10, #%lo16(_init)
+ or r0, r0, r0 ; nop
+ jal r14, r10
+ or r0, r0, r0 ; nop
+ ;; Setup destructors to be called from exit.
+ ;; (Just in case main never returns....)
+ ldui r10, #%hi16(atexit)
+ addui r10, r10, #%lo16(atexit)
+ ldui r1, #%hi16(_fini)
+ addui r1, r1, #%lo16(_fini)
+ or r0, r0, r0 ; nop
+ jal r14, r10
+ or r0, r0, r0 ; nop
+
+ ;; Initialise argc, argv and envp to empty
+ addi r1, r0, #0
+ addi r2, r0, #0
+ addi r3, r0, #0
+
+ ;; Call main
+ ldui r10, #%hi16(main)
+ addui r10, r10, #%lo16(main)
+ or r0, r0, r0 ; nop
+ jal r14, r10
+ or r0, r0, r0 ; nop
+
+ ;; Jump to exit
+ ldui r10, #%hi16(exit)
+ addui r10, r10, #%lo16(exit)
+ or r0, r0, r0 ; nop
+ jal r14, r10
+ or r0, r0, r0 ; nop