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:
authorHans-Peter Nilsson <hp@axis.com>2007-02-21 17:08:26 +0300
committerHans-Peter Nilsson <hp@axis.com>2007-02-21 17:08:26 +0300
commit0bb4152b761196e4e1ab4df5bd104a70c7a2dfe5 (patch)
tree446f3664f873e90d0513341a1e6e4fa0ba21ad99 /libgloss/cris
parent547c5c61044e4751d961ad4e9ae66b5a96a30afa (diff)
* cris/crt0.S: Use jump, not ba, to skip the interrupt table. Use
"setf", not "nop", for common_v10_v32 compatibility. Move out interrupt table to irqtable.S. Include here for non-ELF. * cris/irqtable.S: Extracted from cris/crt0.S. Provide per-entry weak default stub definitions. * cris/crtn.c: Use "setf", not "nop", for common_v10_v32 compatibility. * cris/setup.S [__arch_common_v10_v32]: Return. * cris/Makefile.in (BSP_OBJS): Add irqtable.o.
Diffstat (limited to 'libgloss/cris')
-rw-r--r--libgloss/cris/Makefile.in3
-rw-r--r--libgloss/cris/crt0.S36
-rw-r--r--libgloss/cris/crtn.c6
-rw-r--r--libgloss/cris/irqtable.S82
-rw-r--r--libgloss/cris/setup.S9
5 files changed, 112 insertions, 24 deletions
diff --git a/libgloss/cris/Makefile.in b/libgloss/cris/Makefile.in
index ca3ec3804..eac0f32e7 100644
--- a/libgloss/cris/Makefile.in
+++ b/libgloss/cris/Makefile.in
@@ -86,7 +86,7 @@ BSP_PREFIX =
BSP_LDFLAGS =
BSP_BSP = libbsp.a
BSP_CRT0 = crt0.o
-BSP_OBJS = ${OBJS} setup.o
+BSP_OBJS = ${OBJS} setup.o irqtable.o
BSP_SCRIPTS =
BSP_TEST =
BSP_INSTALL = install-bsp
@@ -273,5 +273,6 @@ wait.o: wait.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/
write.o: write.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
lcrt0.o: lcrt0.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
setup.o: setup.S
+irqtable.o: irqtable.S
crti.o: crti.c
crtn.o: crtn.c
diff --git a/libgloss/cris/crt0.S b/libgloss/cris/crt0.S
index a48efceb2..74c159415 100644
--- a/libgloss/cris/crt0.S
+++ b/libgloss/cris/crt0.S
@@ -1,5 +1,5 @@
/* Generic simplistic start-up-stub for CRIS/CRISv32.
- Copyright (C) 1993-2005 Axis Communications.
+ Copyright (C) 1993-2005, 2007 Axis Communications.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -42,25 +42,27 @@
.global __start
nop
__start:
- ba 0f
- nop
+ move.d 0f,$r9
+ jump $r9
+ setf
+
+#ifndef __ELF__
- .rept 256 - 2
- .dword _.int
- .endr
+; For a.out, everything read-only and code-wise goes into a
+; single section, so we can't separate the interrupt table from
+; the startup code if we want to have files in-between.
+#define IN_CRT0
+#include "irqtable.S"
-_.int:
-#ifdef __arch_common_v10_v32
- ; This is just to allow the multilib to compile without
- ; hackery: the "common" subset doesn't recognize
- ; interrupt-return insns.
-#elif __CRIS_arch_version >= 32
- rete
- rfe
#else
- reti
- nop
-#endif
+
+; The interrupt table (at offset 12, irq #3) is expected here.
+; The simplest way to make sure we link it in, is to sacrifice
+; some memory and refer to it with a relocation.
+ .text
+ .dword __irqtable_at_irq3
+
+#endif /* __ELF__ */
0:
move.d __setup,$r9
diff --git a/libgloss/cris/crtn.c b/libgloss/cris/crtn.c
index 012e5b1e4..a819daa22 100644
--- a/libgloss/cris/crtn.c
+++ b/libgloss/cris/crtn.c
@@ -1,5 +1,5 @@
/* Executable and DSO init/fini end for cris*-axis-linux-gnu and simulators
- Copyright (C) 2000, 2001, 2004, 2005 Axis Communications.
+ Copyright (C) 2000, 2001, 2004, 2005, 2007 Axis Communications.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -36,7 +36,7 @@ __asm__ (".section .init\n"
#endif
"\tmove.d [sp+],r9\n"
"\tjump r9\n"
- "\tnop\n"
+ "\tsetf\n"
"\t.section .fini\n"
#ifdef __PIC__
@@ -44,7 +44,7 @@ __asm__ (".section .init\n"
#endif
"\tmove.d [sp+],r9\n"
"\tjump r9\n"
- "\tnop\n");
+ "\tsetf\n");
#else
extern int Dummy;
diff --git a/libgloss/cris/irqtable.S b/libgloss/cris/irqtable.S
new file mode 100644
index 000000000..202e952eb
--- /dev/null
+++ b/libgloss/cris/irqtable.S
@@ -0,0 +1,82 @@
+/* Default interrupt table for CRIS/CRISv32.
+ Copyright (C) 2007 Axis Communications.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ 2. Neither the name of Axis Communications nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY AXIS COMMUNICATIONS AND ITS CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL AXIS
+ COMMUNICATIONS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE. */
+
+#ifdef __ELF__
+ .section .startup,"ax"
+#else
+ .text
+#endif
+
+#if defined (__ELF__) || defined (IN_CRT0)
+; This is included from crt0.S for a.out, as we can't have it as
+; a separate object file in a library due to the lack of named
+; section support and the required placement at address 3*4.
+
+; We define an interrupt table with references to the symbols
+; _.irq_XX where XX are hex numbers 3..ff (lower-case). They
+; are satisfied by weak aliases to the _.irq stub function in
+; this file. When overridden, the overriding function must be
+; in code explicitly linked in, i.e. *not* in a library.
+
+ .global __irqtable_at_irq3
+__irqtable_at_irq3:
+
+ .irpc irqno,3456789abcdef
+ .weak _.irq_0\irqno
+ .set _.irq_0\irqno,_.irq
+ .dword _.irq_0\irqno
+ .endr
+
+ .irpc irqhd,123456789abcdef
+ .irpc irqld,0123456789abcdef
+ .weak _.irq_\irqhd\irqld
+ .set _.irq_\irqhd\irqld,_.irq
+ .dword _.irq_\irqhd\irqld
+ .endr
+ .endr
+
+; No use having a separate file with default _.irq_[0-f][0-f]
+; definitions; just provide a single stub with a weak definition
+; and make it up to the user to provide a strong definition that
+; they force to be linked in (i.e. not in a library or at least
+; together with another symbol they know is linked in).
+ .text
+
+_.irq:
+#ifdef __arch_common_v10_v32
+ ; This is just to allow the multilib to compile without
+ ; hackery: the "common" subset doesn't recognize
+ ; interrupt-return insns.
+#elif __CRIS_arch_version >= 32
+ rete
+ rfe
+#else
+ reti
+ nop
+#endif
+#endif /* __ELF__ || IN_CRT0 */
diff --git a/libgloss/cris/setup.S b/libgloss/cris/setup.S
index ef0be7109..410037582 100644
--- a/libgloss/cris/setup.S
+++ b/libgloss/cris/setup.S
@@ -1,5 +1,5 @@
/* Support for standalone CRIS/CRISv32 code.
- Copyright (C) 2005 Axis Communications.
+ Copyright (C) 2005, 2007 Axis Communications.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -32,8 +32,11 @@ __setup:
/* Make sure to save SRP. */
#ifdef __arch_common_v10_v32
/* Can't do anything if we don't know for which arch. This file is
- then only a placeholder. Oh, and we can't use the "ret" insn in
- "common" code. */
+ then only a placeholder. Oh, and we can't use the "ret" and "nop"
+ insns in "common" code. */
+ move $srp,$r9
+ jump $r9
+ setf
#else
/* Code missing:
- Initialize RAM circuits.