From 4d95d0e99afd7799f3c8b0e1273d67e1cd136e8d Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Wed, 3 Jan 2007 16:55:25 +0000 Subject: [PATCH] 2006-01-03 Kazu Hirata * arm/Makefile (RDPMON_OBJS): Add _exit.o and _kill.o. (RDIMON_OBJS): Define in terms of RDPMON_OBJS. (rdimon-_exit.o, rdimon-_kill.o): New. * arm/_exit.c, arm/_kill.c: New. * arm/syscalls.c (_exit, _kill): Remove. --- libgloss/ChangeLog | 8 ++++++++ libgloss/arm/Makefile.in | 10 ++++++++-- libgloss/arm/_exit.c | 15 +++++++++++++++ libgloss/arm/_kill.c | 25 +++++++++++++++++++++++++ libgloss/arm/syscalls.c | 33 --------------------------------- 5 files changed, 56 insertions(+), 35 deletions(-) create mode 100644 libgloss/arm/_exit.c create mode 100644 libgloss/arm/_kill.c diff --git a/libgloss/ChangeLog b/libgloss/ChangeLog index 5b5a85f80..04245047a 100644 --- a/libgloss/ChangeLog +++ b/libgloss/ChangeLog @@ -1,3 +1,11 @@ +2006-01-03 Kazu Hirata + + * arm/Makefile (RDPMON_OBJS): Add _exit.o and _kill.o. + (RDIMON_OBJS): Define in terms of RDPMON_OBJS. + (rdimon-_exit.o, rdimon-_kill.o): New. + * arm/_exit.c, arm/_kill.c: New. + * arm/syscalls.c (_exit, _kill): Remove. + 2007-01-03 Kazu Hirata Merge from newlib-csl-20060320-branch: diff --git a/libgloss/arm/Makefile.in b/libgloss/arm/Makefile.in index 523baeaff..cecadfd07 100644 --- a/libgloss/arm/Makefile.in +++ b/libgloss/arm/Makefile.in @@ -66,13 +66,13 @@ REDBOOT_INSTALL = install-redboot RDPMON_CRT0 = rdpmon-crt0.o RDPMON_BSP = librdpmon.a -RDPMON_OBJS = syscalls.o libcfunc.o trap.o +RDPMON_OBJS = syscalls.o libcfunc.o trap.o _exit.o _kill.o RDPMON_SCRIPTS = rdpmon.specs RDPMON_INSTALL = install-rdpmon RDIMON_CRT0 = rdimon-crt0.o RDIMON_BSP = librdimon.a -RDIMON_OBJS = rdimon-syscalls.o rdimon-libcfunc.o rdimon-trap.o +RDIMON_OBJS = $(patsubst %,rdimon-%,$(RDPMON_OBJS)) RDIMON_SCRIPTS = rdimon.specs RDIMON_INSTALL = install-rdimon @@ -115,6 +115,12 @@ rdimon-crt0.o: crt0.S rdimon-trap.o: trap.S $(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -DARM_RDI_MONITOR -o $@ -c $< +rdimon-_exit.o: _exit.c + $(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -DARM_RDI_MONITOR -o $@ -c $< + +rdimon-_kill.o: _kill.c + $(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -DARM_RDI_MONITOR -o $@ -c $< + rdimon-syscalls.o: syscalls.c $(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -DARM_RDI_MONITOR -o $@ -c $< diff --git a/libgloss/arm/_exit.c b/libgloss/arm/_exit.c new file mode 100644 index 000000000..ed0087637 --- /dev/null +++ b/libgloss/arm/_exit.c @@ -0,0 +1,15 @@ +#include <_ansi.h> + +int _kill _PARAMS ((int, int)); +void _exit _PARAMS ((int)); + +void +_exit (int status) +{ + /* There is only one SWI for both _exit and _kill. For _exit, call + the SWI with the second argument set to -1, an invalid value for + signum, so that the SWI handler can distinguish the two calls. + Note: The RDI implementation of _kill throws away both its + arguments. */ + _kill (status, -1); +} diff --git a/libgloss/arm/_kill.c b/libgloss/arm/_kill.c new file mode 100644 index 000000000..81354d473 --- /dev/null +++ b/libgloss/arm/_kill.c @@ -0,0 +1,25 @@ +#include <_ansi.h> +#include +#include "swi.h" + +int _kill _PARAMS ((int, int)); + +int +_kill (int pid, int sig) +{ + (void) pid; (void) sig; +#ifdef ARM_RDI_MONITOR + /* Note: The pid argument is thrown away. */ + switch (sig) + { + case SIGABRT: + return do_AngelSWI (AngelSWI_Reason_ReportException, + (void *) ADP_Stopped_RunTimeError); + default: + return do_AngelSWI (AngelSWI_Reason_ReportException, + (void *) ADP_Stopped_ApplicationExit); + } +#else + asm ("swi %a0" :: "i" (SWI_Exit)); +#endif +} diff --git a/libgloss/arm/syscalls.c b/libgloss/arm/syscalls.c index 913dd3d88..81d172494 100644 --- a/libgloss/arm/syscalls.c +++ b/libgloss/arm/syscalls.c @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include "swi.h" @@ -30,8 +29,6 @@ int _stat _PARAMS ((const char *, struct stat *)); int _fstat _PARAMS ((int, struct stat *)); caddr_t _sbrk _PARAMS ((int)); int _getpid _PARAMS ((int)); -int _kill _PARAMS ((int, int)); -void _exit _PARAMS ((int)); int _close _PARAMS ((int)); clock_t _clock _PARAMS ((void)); int _swiclose _PARAMS ((int)); @@ -439,36 +436,6 @@ _close (int file) return wrap (_swiclose (file)); } -int -_kill (int pid, int sig) -{ - (void)pid; (void)sig; -#ifdef ARM_RDI_MONITOR - /* Note: The pid argument is thrown away. */ - switch (sig) { - case SIGABRT: - return do_AngelSWI (AngelSWI_Reason_ReportException, - (void *) ADP_Stopped_RunTimeError); - default: - return do_AngelSWI (AngelSWI_Reason_ReportException, - (void *) ADP_Stopped_ApplicationExit); - } -#else - asm ("swi %a0" :: "i" (SWI_Exit)); -#endif -} - -void -_exit (int status) -{ - /* There is only one SWI for both _exit and _kill. For _exit, call - the SWI with the second argument set to -1, an invalid value for - signum, so that the SWI handler can distinguish the two calls. - Note: The RDI implementation of _kill throws away both its - arguments. */ - _kill(status, -1); -} - int __attribute__((weak)) _getpid (int n) {