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:
authorJeff Johnston <jjohnstn@redhat.com>2005-07-18 20:18:17 +0400
committerJeff Johnston <jjohnstn@redhat.com>2005-07-18 20:18:17 +0400
commitce4654708cc111c6eff691d1e564e3fb5b64eb17 (patch)
treebb1d96ad859f90f418cd6100d72fea2a7bae7f6f /libgloss/arm
parente17dbb54c7511db941829c353eb1a95bd3d43ace (diff)
2005-07-18 Shaun Jackman <sjackman@gmail.com>
* libgloss/arm/libcfunc.c (abort): Call _exit instead of the RDI swi. (alarm): Add the weak attribute. (pause): New function. Return ENOSYS. * libgloss/arm/syscalls.c (_getpid): Add the weak attribute. (_fstat): Ditto. (_stat): Ditto. (_link): Ditto. Return ENOSYS. (_unlink): Call the swi instead of returning -1. (_raise): Add the weak attribute. Return ENOSYS. (isatty): Rename to _isatty. Call the swi instead of returning 1. (_system): Call the swi instead of returning ENOSYS. (_rename): Ditto.
Diffstat (limited to 'libgloss/arm')
-rw-r--r--libgloss/arm/libcfunc.c21
-rw-r--r--libgloss/arm/syscalls.c67
2 files changed, 58 insertions, 30 deletions
diff --git a/libgloss/arm/libcfunc.c b/libgloss/arm/libcfunc.c
index ddc611f34..f684c2526 100644
--- a/libgloss/arm/libcfunc.c
+++ b/libgloss/arm/libcfunc.c
@@ -5,10 +5,12 @@
Note: These functions are in a seperate file so that OS providers can
overrride the system call stubs (defined in syscalls.c) without having
to provide libc funcitons as well. */
+
#include "swi.h"
+#include <errno.h>
+#include <unistd.h>
#ifdef ARM_RDI_MONITOR
-
static inline int
do_AngelSWI (int reason, void * arg)
{
@@ -22,19 +24,28 @@ do_AngelSWI (int reason, void * arg)
}
#endif /* ARM_RDI_MONITOR */
-
void
abort (void)
{
+ extern void _exit (int n);
#ifdef ARM_RDI_MONITOR
do_AngelSWI (AngelSWI_Reason_ReportException,
(void *) ADP_Stopped_RunTimeError);
#else
- asm ("mov r0,#17\nswi %a0" :: "i" (SWI_Exit));
+ _exit(17);
#endif
}
-void
-alarm (void)
+unsigned __attribute__((weak))
+alarm (unsigned seconds)
+{
+ (void)seconds;
+ return 0;
+}
+
+int __attribute__((weak))
+pause (void)
{
+ errno = ENOSYS;
+ return -1;
}
diff --git a/libgloss/arm/syscalls.c b/libgloss/arm/syscalls.c
index f0e60da8f..f178049d9 100644
--- a/libgloss/arm/syscalls.c
+++ b/libgloss/arm/syscalls.c
@@ -7,6 +7,7 @@
#include <sys/stat.h>
#include <sys/fcntl.h>
#include <stdio.h>
+#include <string.h>
#include <time.h>
#include <sys/time.h>
#include <sys/times.h>
@@ -18,11 +19,11 @@
/* Forward prototypes. */
int _system _PARAMS ((const char *));
int _rename _PARAMS ((const char *, const char *));
-int isatty _PARAMS ((int));
+int _isatty _PARAMS ((int));
clock_t _times _PARAMS ((struct tms *));
int _gettimeofday _PARAMS ((struct timeval *, struct timezone *));
-void _raise _PARAMS ((void));
-int _unlink _PARAMS ((void));
+int _raise _PARAMS ((int));
+int _unlink _PARAMS ((const char *));
int _link _PARAMS ((void));
int _stat _PARAMS ((const char *, struct stat *));
int _fstat _PARAMS ((int, struct stat *));
@@ -345,8 +346,6 @@ _write (int file,
return len - x;
}
-extern int strlen (const char *);
-
int
_swiopen (const char * path,
int flags)
@@ -461,7 +460,7 @@ _kill (int n, int m)
n = n; m = m;
}
-int
+int __attribute__((weak))
_getpid (int n)
{
return 1;
@@ -501,9 +500,7 @@ _sbrk (int incr)
return (caddr_t) prev_heap_end;
}
-extern void memset (struct stat *, int, unsigned int);
-
-int
+int __attribute__((weak))
_fstat (int file, struct stat * st)
{
memset (st, 0, sizeof (* st));
@@ -513,7 +510,8 @@ _fstat (int file, struct stat * st)
file = file;
}
-int _stat (const char *fname, struct stat *st)
+int __attribute__((weak))
+_stat (const char *fname, struct stat *st)
{
int file;
@@ -529,22 +527,30 @@ int _stat (const char *fname, struct stat *st)
return 0;
}
-int
+int __attribute__((weak))
_link (void)
{
+ errno = ENOSYS;
return -1;
}
int
-_unlink (void)
+_unlink (const char *path)
{
- return -1;
+#ifdef ARM_RDI_MONITOR
+ return do_AngelSWI (AngelSWI_Reason_Remove, &path);
+#else
+ (void)path;
+ asm ("swi %a0" :: "i" (SWI_Remove));
+#endif
}
-void
-_raise (void)
+int __attribute__((weak))
+_raise (int sig)
{
- return;
+ (void)sig;
+ errno = ENOSYS;
+ return -1;
}
int
@@ -601,24 +607,35 @@ _times (struct tms * tp)
int
-isatty (int fd)
+_isatty (int fd)
{
- return 1;
- fd = fd;
+#ifdef ARM_RDI_MONITOR
+ return do_AngelSWI (AngelSWI_Reason_IsTTY, &fd);
+#else
+ (void)fd;
+ asm ("swi %a0" :: "i" (SWI_IsTTY));
+#endif
}
int
_system (const char *s)
{
- if (s == NULL)
- return 0;
- errno = ENOSYS;
- return -1;
+#ifdef ARM_RDI_MONITOR
+ return do_AngelSWI (AngelSWI_Reason_System, &s);
+#else
+ (void)s;
+ asm ("swi %a0" :: "i" (SWI_CLI));
+#endif
}
int
_rename (const char * oldpath, const char * newpath)
{
- errno = ENOSYS;
- return -1;
+#ifdef ARM_RDI_MONITOR
+ const char *block[2] = {oldpath, newpath};
+ return do_AngelSWI (AngelSWI_Reason_Rename, block);
+#else
+ (void)oldpath; (void)newpath;
+ asm ("swi %a0" :: "i" (SWI_Rename));
+#endif
}