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:
authorAlexandre Oliva <aoliva@redhat.com>2002-02-08 10:11:13 +0300
committerAlexandre Oliva <aoliva@redhat.com>2002-02-08 10:11:13 +0300
commit9f25eed9c96cb37ee58fcb65aafb44f9c6183dde (patch)
tree883185ab319291de419f4bba42754e7a71b23560 /newlib/libc/sys/sh
parent561486e7f1220b06414524d9b72eca3794a45dd3 (diff)
Contribute sh64-elf.
2001-03-13 Alexandre Oliva <aoliva@redhat.com> * configure.host (newlib_cflags) [sh*-*-*]: Enable long long support in printf. 2001-01-29 Alexandre Oliva <aoliva@redhat.com> * libc/machine/sh/setjmp.S [SH5]: Switch to SHmedia mode before any labels. 2001-01-24 Alexandre Oliva <aoliva@redhat.com> * libc/sys/sh/trap.S (___trap34) [SH5]: Don't trash r2. 2000-12-16 Alexandre Oliva <aoliva@redhat.com> * libc/machine/sh/configure.in: Rework conditionals. * libc/machine/sh/Makefile.am: Likewise. * libc/machine/sh/configure, libc/machine/sh/Makefile.in: Rebuilt. 2000-12-01 Alexandre Oliva <aoliva@redhat.com> * configure.host: Match `sh*'. * libc/include/machine/setjmp.h: Define for SH5. * libc/machine/sh/configure.in: Detect SH5. * libc/machine/sh/configure: Rebuilt. * libc/machine/sh/Makefile.am: Use only setjmp.S for SH5. * libc/machine/sh/Makefile.in: Rebuilt. * libc/machine/sh/asm.h: Adjust for SH5. * libc/machine/sh/setjmp.S: Implement in SHmedia. * libc/sys/sh/crt0.S: Likewise. * libc/sys/sh/trap.S: Likewise.
Diffstat (limited to 'newlib/libc/sys/sh')
-rw-r--r--newlib/libc/sys/sh/crt0.S67
-rw-r--r--newlib/libc/sys/sh/trap.S28
2 files changed, 95 insertions, 0 deletions
diff --git a/newlib/libc/sys/sh/crt0.S b/newlib/libc/sys/sh/crt0.S
index 88c9fac0d..6eccf3a4b 100644
--- a/newlib/libc/sys/sh/crt0.S
+++ b/newlib/libc/sys/sh/crt0.S
@@ -1,3 +1,69 @@
+
+#ifdef __SH5__
+ .section .data,"aw"
+ .global ___data
+___data:
+
+ .section .rodata,"a"
+ .global ___rodata
+___rodata:
+
+#if __SH5__ == 64
+ .section .text,"ax"
+#define LOAD_ADDR(sym, reg) \
+ movi (sym >> 48) & 65535, reg; \
+ shori (sym >> 32) & 65535, reg; \
+ shori (sym >> 16) & 65535, reg; \
+ shori sym & 65535, reg
+#else
+ .mode SHmedia
+ .section .text..SHmedia32,"ax"
+#define LOAD_ADDR(sym, reg) \
+ movi (sym >> 16) & 65535, reg; \
+ shori sym & 65535, reg
+#endif
+ .global start
+start:
+ LOAD_ADDR (_stack, r15)
+
+ pt/l zero_bss_loop, tr0
+ pt/l _atexit, tr1
+ pt/l _init, tr5
+ pt/l _main, tr6
+ pt/l _exit, tr7
+
+ ! zero out bss
+ LOAD_ADDR (_edata, r0)
+ LOAD_ADDR (_end, r1)
+zero_bss_loop:
+ stx.q r0, r63, r63
+ addi r0, 8, r0
+ bgt/l r1, r0, tr0
+
+ LOAD_ADDR (___data, r26)
+ LOAD_ADDR (___rodata, r27)
+
+#if ! __SH4_NOFPU__
+ getcon cr0, r0
+ movi 1, r1
+ shlli r1, 15, r1
+ or r1, r0, r0
+ putcon r0, cr0
+#endif
+
+ ! arrange for exit to call fini
+ LOAD_ADDR (_fini, r2)
+ blink tr1, r18
+
+ ! call init
+ blink tr5, r18
+
+ ! call the mainline
+ blink tr6, r18
+
+ ! call exit
+ blink tr7, r18
+#else
.section .text
.global start
start:
@@ -46,6 +112,7 @@ main_k:
.long _main
exit_k:
.long _exit
+#endif
#ifdef __ELF__
.section .stack,"aw"
diff --git a/newlib/libc/sys/sh/trap.S b/newlib/libc/sys/sh/trap.S
index 4512293e3..0eb6e5dfe 100644
--- a/newlib/libc/sys/sh/trap.S
+++ b/newlib/libc/sys/sh/trap.S
@@ -1,3 +1,30 @@
+#if __SH5__
+ .mode SHmedia
+#if __SH5__ == 32 && __SHMEDIA__
+ .section .text..SHmedia32, "ax"
+#else
+ .text
+#endif
+ .global ___trap34
+___trap34:
+ movi 34, r0
+ trapa r0
+ pt/l ret, tr1
+ ptabs/l r18, tr0
+ beqi r1, 0, tr1
+#if __SH5__ == 64
+ movi ((_errno >> 48) & 65535), r0
+ shori ((_errno >> 32) & 65535), r0
+ shori ((_errno >> 16) & 65535), r0
+#else
+ movi ((_errno >> 16) & 65535), r0
+#endif
+ shori (_errno & 65535), r0
+ stx.l r0, r63, r1
+ret:
+ blink tr0, r63
+
+#else
.text
.global ___trap34
___trap34:
@@ -13,3 +40,4 @@ ret:
.align 2
perrno:
.long _errno
+#endif /* ! __SH5__ */