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.
This commit is contained in:
Jeff Johnston 2005-07-18 16:18:17 +00:00
parent e17dbb54c7
commit ce4654708c
3 changed files with 73 additions and 30 deletions

View File

@ -1,3 +1,18 @@
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.
2005-07-06 Aldy Hernandez <aldyh@redhat.com>
* configure.in: Add ms1 case.

View File

@ -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;
}

View File

@ -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
}