This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
[patch] libgloss/arm: Move do_AngelSWI to swi.h.
- From: Kazu Hirata <kazu at codesourcery dot com>
- To: newlib at sources dot redhat dot com
- Cc: paul at codesourcery dot com
- Date: Wed, 20 Dec 2006 02:59:45 -0800
- Subject: [patch] libgloss/arm: Move do_AngelSWI to swi.h.
Hi,
Attached is a patch to move do_ANgelSWI to swi.h.
Tested by building newlib. OK to apply?
Kazu Hirata
libgloss/
2006-12-20 Kazu Hirata <kazu@codesourcery.com>
* arm/licfunc.c (do_AngelSWI): Remove.
* arm/syscalls.c (do_AngelSWI): Remove.
* arm/swi.h (do_AngelSWI): New.
Index: libcfunc.c
===================================================================
RCS file: /cvs/src/src/libgloss/arm/libcfunc.c,v
retrieving revision 1.8
diff -u -d -p -r1.8 libcfunc.c
--- libcfunc.c 5 Jun 2006 19:46:18 -0000 1.8
+++ libcfunc.c 20 Dec 2006 10:52:47 -0000
@@ -10,20 +10,6 @@
#include <errno.h>
#include <unistd.h>
-#ifdef ARM_RDI_MONITOR
-static inline int
-do_AngelSWI (int reason, void * arg)
-{
- int value;
- asm volatile ("mov r0, %1; mov r1, %2; " AngelSWIInsn " %a3; mov %0, r0"
- : "=r" (value) /* Outputs */
- : "r" (reason), "r" (arg), "i" (AngelSWI) /* Inputs */
- : "r0", "r1", "lr"
- /* Clobbers r0 and r1, and lr if in supervisor mode */);
- return value;
-}
-#endif /* ARM_RDI_MONITOR */
-
unsigned __attribute__((weak))
alarm (unsigned seconds)
{
Index: swi.h
===================================================================
RCS file: /cvs/src/src/libgloss/arm/swi.h,v
retrieving revision 1.2
diff -u -d -p -r1.2 swi.h
--- swi.h 7 Feb 2006 18:46:23 -0000 1.2
+++ swi.h 20 Dec 2006 10:52:47 -0000
@@ -66,3 +66,24 @@
#define AngelSWI_Reason_ReportException 0x18
#define ADP_Stopped_ApplicationExit ((2 << 16) + 38)
#define ADP_Stopped_RunTimeError ((2 << 16) + 35)
+
+#if defined(ARM_RDI_MONITOR) && !defined(__ASSEMBLER__)
+
+static inline int
+do_AngelSWI (int reason, void * arg)
+{
+ int value;
+ asm volatile ("mov r0, %1; mov r1, %2; " AngelSWIInsn " %a3; mov %0, r0"
+ : "=r" (value) /* Outputs */
+ : "r" (reason), "r" (arg), "i" (AngelSWI) /* Inputs */
+ : "r0", "r1", "r2", "r3", "ip", "lr", "memory", "cc"
+ /* Clobbers r0 and r1, and lr if in supervisor mode */);
+ /* Accordingly to page 13-77 of ARM DUI 0040D other registers
+ can also be clobbered. Some memory positions may also be
+ changed by a system call, so they should not be kept in
+ registers. Note: we are assuming the manual is right and
+ Angel is respecting the APCS. */
+ return value;
+}
+
+#endif
Index: syscalls.c
===================================================================
RCS file: /cvs/src/src/libgloss/arm/syscalls.c,v
retrieving revision 1.11
diff -u -d -p -r1.11 syscalls.c
--- syscalls.c 13 Jun 2006 20:51:08 -0000 1.11
+++ syscalls.c 20 Dec 2006 10:52:47 -0000
@@ -49,7 +49,6 @@ static int wrap _PARAMS ((int));
static int error _PARAMS ((int));
static int get_errno _PARAMS ((void));
static int remap_handle _PARAMS ((int));
-static int do_AngelSWI _PARAMS ((int, void *));
static int findslot _PARAMS ((int));
/* Register name faking - works in collusion with the linker. */
@@ -95,26 +94,6 @@ findslot (int fh)
return i;
}
-#ifdef ARM_RDI_MONITOR
-
-static inline int
-do_AngelSWI (int reason, void * arg)
-{
- int value;
- asm volatile ("mov r0, %1; mov r1, %2; " AngelSWIInsn " %a3; mov %0, r0"
- : "=r" (value) /* Outputs */
- : "r" (reason), "r" (arg), "i" (AngelSWI) /* Inputs */
- : "r0", "r1", "r2", "r3", "ip", "lr", "memory", "cc"
- /* Clobbers r0 and r1, and lr if in supervisor mode */);
- /* Accordingly to page 13-77 of ARM DUI 0040D other registers
- can also be clobbered. Some memory positions may also be
- changed by a system call, so they should not be kept in
- registers. Note: we are assuming the manual is right and
- Angel is respecting the APCS. */
- return value;
-}
-#endif /* ARM_RDI_MONITOR */
-
/* Function to convert std(in|out|err) handles to internal versions. */
static int
remap_handle (int fh)