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:
parent
e17dbb54c7
commit
ce4654708c
|
@ -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>
|
2005-07-06 Aldy Hernandez <aldyh@redhat.com>
|
||||||
|
|
||||||
* configure.in: Add ms1 case.
|
* configure.in: Add ms1 case.
|
||||||
|
|
|
@ -5,10 +5,12 @@
|
||||||
Note: These functions are in a seperate file so that OS providers can
|
Note: These functions are in a seperate file so that OS providers can
|
||||||
overrride the system call stubs (defined in syscalls.c) without having
|
overrride the system call stubs (defined in syscalls.c) without having
|
||||||
to provide libc funcitons as well. */
|
to provide libc funcitons as well. */
|
||||||
|
|
||||||
#include "swi.h"
|
#include "swi.h"
|
||||||
|
#include <errno.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#ifdef ARM_RDI_MONITOR
|
#ifdef ARM_RDI_MONITOR
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
do_AngelSWI (int reason, void * arg)
|
do_AngelSWI (int reason, void * arg)
|
||||||
{
|
{
|
||||||
|
@ -22,19 +24,28 @@ do_AngelSWI (int reason, void * arg)
|
||||||
}
|
}
|
||||||
#endif /* ARM_RDI_MONITOR */
|
#endif /* ARM_RDI_MONITOR */
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
abort (void)
|
abort (void)
|
||||||
{
|
{
|
||||||
|
extern void _exit (int n);
|
||||||
#ifdef ARM_RDI_MONITOR
|
#ifdef ARM_RDI_MONITOR
|
||||||
do_AngelSWI (AngelSWI_Reason_ReportException,
|
do_AngelSWI (AngelSWI_Reason_ReportException,
|
||||||
(void *) ADP_Stopped_RunTimeError);
|
(void *) ADP_Stopped_RunTimeError);
|
||||||
#else
|
#else
|
||||||
asm ("mov r0,#17\nswi %a0" :: "i" (SWI_Exit));
|
_exit(17);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
unsigned __attribute__((weak))
|
||||||
alarm (void)
|
alarm (unsigned seconds)
|
||||||
{
|
{
|
||||||
|
(void)seconds;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int __attribute__((weak))
|
||||||
|
pause (void)
|
||||||
|
{
|
||||||
|
errno = ENOSYS;
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/fcntl.h>
|
#include <sys/fcntl.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/times.h>
|
#include <sys/times.h>
|
||||||
|
@ -18,11 +19,11 @@
|
||||||
/* Forward prototypes. */
|
/* Forward prototypes. */
|
||||||
int _system _PARAMS ((const char *));
|
int _system _PARAMS ((const char *));
|
||||||
int _rename _PARAMS ((const char *, const char *));
|
int _rename _PARAMS ((const char *, const char *));
|
||||||
int isatty _PARAMS ((int));
|
int _isatty _PARAMS ((int));
|
||||||
clock_t _times _PARAMS ((struct tms *));
|
clock_t _times _PARAMS ((struct tms *));
|
||||||
int _gettimeofday _PARAMS ((struct timeval *, struct timezone *));
|
int _gettimeofday _PARAMS ((struct timeval *, struct timezone *));
|
||||||
void _raise _PARAMS ((void));
|
int _raise _PARAMS ((int));
|
||||||
int _unlink _PARAMS ((void));
|
int _unlink _PARAMS ((const char *));
|
||||||
int _link _PARAMS ((void));
|
int _link _PARAMS ((void));
|
||||||
int _stat _PARAMS ((const char *, struct stat *));
|
int _stat _PARAMS ((const char *, struct stat *));
|
||||||
int _fstat _PARAMS ((int, struct stat *));
|
int _fstat _PARAMS ((int, struct stat *));
|
||||||
|
@ -345,8 +346,6 @@ _write (int file,
|
||||||
return len - x;
|
return len - x;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int strlen (const char *);
|
|
||||||
|
|
||||||
int
|
int
|
||||||
_swiopen (const char * path,
|
_swiopen (const char * path,
|
||||||
int flags)
|
int flags)
|
||||||
|
@ -461,7 +460,7 @@ _kill (int n, int m)
|
||||||
n = n; m = m;
|
n = n; m = m;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int __attribute__((weak))
|
||||||
_getpid (int n)
|
_getpid (int n)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -501,9 +500,7 @@ _sbrk (int incr)
|
||||||
return (caddr_t) prev_heap_end;
|
return (caddr_t) prev_heap_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void memset (struct stat *, int, unsigned int);
|
int __attribute__((weak))
|
||||||
|
|
||||||
int
|
|
||||||
_fstat (int file, struct stat * st)
|
_fstat (int file, struct stat * st)
|
||||||
{
|
{
|
||||||
memset (st, 0, sizeof (* st));
|
memset (st, 0, sizeof (* st));
|
||||||
|
@ -513,7 +510,8 @@ _fstat (int file, struct stat * st)
|
||||||
file = file;
|
file = file;
|
||||||
}
|
}
|
||||||
|
|
||||||
int _stat (const char *fname, struct stat *st)
|
int __attribute__((weak))
|
||||||
|
_stat (const char *fname, struct stat *st)
|
||||||
{
|
{
|
||||||
int file;
|
int file;
|
||||||
|
|
||||||
|
@ -529,22 +527,30 @@ int _stat (const char *fname, struct stat *st)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int __attribute__((weak))
|
||||||
_link (void)
|
_link (void)
|
||||||
{
|
{
|
||||||
|
errno = ENOSYS;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
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
|
int __attribute__((weak))
|
||||||
_raise (void)
|
_raise (int sig)
|
||||||
{
|
{
|
||||||
return;
|
(void)sig;
|
||||||
|
errno = ENOSYS;
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -601,24 +607,35 @@ _times (struct tms * tp)
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
isatty (int fd)
|
_isatty (int fd)
|
||||||
{
|
{
|
||||||
return 1;
|
#ifdef ARM_RDI_MONITOR
|
||||||
fd = fd;
|
return do_AngelSWI (AngelSWI_Reason_IsTTY, &fd);
|
||||||
|
#else
|
||||||
|
(void)fd;
|
||||||
|
asm ("swi %a0" :: "i" (SWI_IsTTY));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
_system (const char *s)
|
_system (const char *s)
|
||||||
{
|
{
|
||||||
if (s == NULL)
|
#ifdef ARM_RDI_MONITOR
|
||||||
return 0;
|
return do_AngelSWI (AngelSWI_Reason_System, &s);
|
||||||
errno = ENOSYS;
|
#else
|
||||||
return -1;
|
(void)s;
|
||||||
|
asm ("swi %a0" :: "i" (SWI_CLI));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
_rename (const char * oldpath, const char * newpath)
|
_rename (const char * oldpath, const char * newpath)
|
||||||
{
|
{
|
||||||
errno = ENOSYS;
|
#ifdef ARM_RDI_MONITOR
|
||||||
return -1;
|
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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue