2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
/* Support files for GNU libc. Files in the system namespace go here.
|
|
|
|
Files in the C namespace (ie those that do not start with an
|
|
|
|
underscore) go in .c. */
|
|
|
|
|
|
|
|
#include <_ansi.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sys/fcntl.h>
|
|
|
|
#include <stdio.h>
|
2005-07-18 18:18:17 +02:00
|
|
|
#include <string.h>
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
#include <time.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <sys/times.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <reent.h>
|
|
|
|
#include <unistd.h>
|
2006-06-13 22:51:08 +02:00
|
|
|
#include <sys/wait.h>
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
#include "swi.h"
|
|
|
|
|
|
|
|
/* Forward prototypes. */
|
|
|
|
int _system _PARAMS ((const char *));
|
|
|
|
int _rename _PARAMS ((const char *, const char *));
|
2005-07-18 18:18:17 +02:00
|
|
|
int _isatty _PARAMS ((int));
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
clock_t _times _PARAMS ((struct tms *));
|
2007-07-06 19:00:13 +02:00
|
|
|
int _gettimeofday _PARAMS ((struct timeval *, void *));
|
2005-07-18 18:18:17 +02:00
|
|
|
int _unlink _PARAMS ((const char *));
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
int _link _PARAMS ((void));
|
|
|
|
int _stat _PARAMS ((const char *, struct stat *));
|
|
|
|
int _fstat _PARAMS ((int, struct stat *));
|
2007-08-10 21:36:46 +02:00
|
|
|
int _swistat _PARAMS ((int fd, struct stat * st));
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
caddr_t _sbrk _PARAMS ((int));
|
|
|
|
int _getpid _PARAMS ((int));
|
|
|
|
int _close _PARAMS ((int));
|
2005-12-01 00:37:14 +01:00
|
|
|
clock_t _clock _PARAMS ((void));
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
int _swiclose _PARAMS ((int));
|
|
|
|
int _open _PARAMS ((const char *, int, ...));
|
|
|
|
int _swiopen _PARAMS ((const char *, int));
|
|
|
|
int _write _PARAMS ((int, char *, int));
|
|
|
|
int _swiwrite _PARAMS ((int, char *, int));
|
|
|
|
int _lseek _PARAMS ((int, int, int));
|
|
|
|
int _swilseek _PARAMS ((int, int, int));
|
|
|
|
int _read _PARAMS ((int, char *, int));
|
|
|
|
int _swiread _PARAMS ((int, char *, int));
|
|
|
|
void initialise_monitor_handles _PARAMS ((void));
|
|
|
|
|
2007-08-10 21:36:46 +02:00
|
|
|
static int checkerror _PARAMS ((int));
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
static int error _PARAMS ((int));
|
|
|
|
static int get_errno _PARAMS ((void));
|
2007-08-10 21:36:46 +02:00
|
|
|
|
|
|
|
/* Struct used to keep track of the file position, just so we
|
|
|
|
can implement fseek(fh,x,SEEK_CUR). */
|
|
|
|
struct fdent
|
|
|
|
{
|
|
|
|
int handle;
|
|
|
|
int pos;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define MAX_OPEN_FILES 20
|
|
|
|
|
|
|
|
/* User file descriptors (fd) are integer indexes into
|
|
|
|
the openfiles[] array. Error checking is done by using
|
|
|
|
findslot().
|
|
|
|
|
|
|
|
This openfiles array is manipulated directly by only
|
|
|
|
these 5 functions:
|
|
|
|
|
|
|
|
findslot() - Translate entry.
|
|
|
|
newslot() - Find empty entry.
|
|
|
|
initilise_monitor_handles() - Initialize entries.
|
|
|
|
_swiopen() - Initialize entry.
|
|
|
|
_close() - Handle stdout == stderr case.
|
|
|
|
|
|
|
|
Every other function must use findslot(). */
|
|
|
|
|
|
|
|
static struct fdent openfiles [MAX_OPEN_FILES];
|
|
|
|
|
|
|
|
static struct fdent* findslot _PARAMS ((int));
|
|
|
|
static int newslot _PARAMS ((void));
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
|
|
|
|
/* Register name faking - works in collusion with the linker. */
|
|
|
|
register char * stack_ptr asm ("sp");
|
|
|
|
|
|
|
|
|
|
|
|
/* following is copied from libc/stdio/local.h to check std streams */
|
|
|
|
extern void _EXFUN(__sinit,(struct _reent *));
|
2005-02-08 20:38:47 +01:00
|
|
|
#define CHECK_INIT(ptr) \
|
|
|
|
do \
|
|
|
|
{ \
|
|
|
|
if ((ptr) && !(ptr)->__sdidinit) \
|
|
|
|
__sinit (ptr); \
|
|
|
|
} \
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
while (0)
|
|
|
|
|
|
|
|
static int monitor_stdin;
|
|
|
|
static int monitor_stdout;
|
|
|
|
static int monitor_stderr;
|
|
|
|
|
2007-08-10 21:36:46 +02:00
|
|
|
/* Return a pointer to the structure associated with
|
|
|
|
the user file descriptor fd. */
|
|
|
|
static struct fdent*
|
|
|
|
findslot (int fd)
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
{
|
2007-08-10 21:36:46 +02:00
|
|
|
CHECK_INIT(_REENT);
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
|
2007-08-10 21:36:46 +02:00
|
|
|
/* User file descriptor is out of range. */
|
|
|
|
if ((unsigned int)fd >= MAX_OPEN_FILES)
|
|
|
|
return NULL;
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
|
2007-08-10 21:36:46 +02:00
|
|
|
/* User file descriptor is open? */
|
|
|
|
if (openfiles[fd].handle == -1)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
/* Valid. */
|
|
|
|
return &openfiles[fd];
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
}
|
|
|
|
|
2007-08-10 21:36:46 +02:00
|
|
|
/* Return the next lowest numbered free file
|
|
|
|
structure, or -1 if we can't find one. */
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
static int
|
2007-08-10 21:36:46 +02:00
|
|
|
newslot (void)
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
{
|
2007-08-10 21:36:46 +02:00
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < MAX_OPEN_FILES; i++)
|
|
|
|
if (openfiles[i].handle == -1)
|
|
|
|
break;
|
2005-02-08 20:38:47 +01:00
|
|
|
|
2007-08-10 21:36:46 +02:00
|
|
|
if (i == MAX_OPEN_FILES)
|
|
|
|
return -1;
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
|
2007-08-10 21:36:46 +02:00
|
|
|
return i;
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
initialise_monitor_handles (void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2005-08-16 20:05:35 +02:00
|
|
|
/* Open the standard file descriptors by opening the special
|
|
|
|
* teletype device, ":tt", read-only to obtain a descritpor for
|
|
|
|
* standard input and write-only to obtain a descriptor for standard
|
|
|
|
* output. Finally, open ":tt" in append mode to obtain a descriptor
|
|
|
|
* for standard error. Since this is a write mode, most kernels will
|
|
|
|
* probably return the same value as for standard output, but the
|
|
|
|
* kernel can differentiate the two using the mode flag and return a
|
|
|
|
* different descriptor for standard error.
|
|
|
|
*/
|
|
|
|
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
#ifdef ARM_RDI_MONITOR
|
|
|
|
int volatile block[3];
|
|
|
|
|
|
|
|
block[0] = (int) ":tt";
|
|
|
|
block[2] = 3; /* length of filename */
|
|
|
|
block[1] = 0; /* mode "r" */
|
|
|
|
monitor_stdin = do_AngelSWI (AngelSWI_Reason_Open, (void *) block);
|
|
|
|
|
|
|
|
block[0] = (int) ":tt";
|
|
|
|
block[2] = 3; /* length of filename */
|
|
|
|
block[1] = 4; /* mode "w" */
|
2005-08-16 20:05:35 +02:00
|
|
|
monitor_stdout = do_AngelSWI (AngelSWI_Reason_Open, (void *) block);
|
|
|
|
|
|
|
|
block[0] = (int) ":tt";
|
|
|
|
block[2] = 3; /* length of filename */
|
|
|
|
block[1] = 8; /* mode "a" */
|
|
|
|
monitor_stderr = do_AngelSWI (AngelSWI_Reason_Open, (void *) block);
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
#else
|
|
|
|
int fh;
|
|
|
|
const char * name;
|
|
|
|
|
|
|
|
name = ":tt";
|
|
|
|
asm ("mov r0,%2; mov r1, #0; swi %a1; mov %0, r0"
|
|
|
|
: "=r"(fh)
|
|
|
|
: "i" (SWI_Open),"r"(name)
|
|
|
|
: "r0","r1");
|
|
|
|
monitor_stdin = fh;
|
|
|
|
|
|
|
|
name = ":tt";
|
|
|
|
asm ("mov r0,%2; mov r1, #4; swi %a1; mov %0, r0"
|
|
|
|
: "=r"(fh)
|
|
|
|
: "i" (SWI_Open),"r"(name)
|
|
|
|
: "r0","r1");
|
2005-08-16 20:05:35 +02:00
|
|
|
monitor_stdout = fh;
|
|
|
|
|
|
|
|
name = ":tt";
|
|
|
|
asm ("mov r0,%2; mov r1, #8; swi %a1; mov %0, r0"
|
|
|
|
: "=r"(fh)
|
|
|
|
: "i" (SWI_Open),"r"(name)
|
|
|
|
: "r0","r1");
|
|
|
|
monitor_stderr = fh;
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
#endif
|
|
|
|
|
2007-08-10 21:36:46 +02:00
|
|
|
/* If we failed to open stderr, redirect to stdout. */
|
|
|
|
if (monitor_stderr == -1)
|
|
|
|
monitor_stderr = monitor_stdout;
|
|
|
|
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
for (i = 0; i < MAX_OPEN_FILES; i ++)
|
|
|
|
openfiles[i].handle = -1;
|
|
|
|
|
|
|
|
openfiles[0].handle = monitor_stdin;
|
|
|
|
openfiles[0].pos = 0;
|
|
|
|
openfiles[1].handle = monitor_stdout;
|
|
|
|
openfiles[1].pos = 0;
|
2005-08-16 20:05:35 +02:00
|
|
|
openfiles[2].handle = monitor_stderr;
|
|
|
|
openfiles[2].pos = 0;
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
get_errno (void)
|
|
|
|
{
|
|
|
|
#ifdef ARM_RDI_MONITOR
|
|
|
|
return do_AngelSWI (AngelSWI_Reason_Errno, NULL);
|
|
|
|
#else
|
2005-04-28 20:40:39 +02:00
|
|
|
register r0 asm("r0");
|
2005-05-06 01:15:53 +02:00
|
|
|
asm ("swi %a1" : "=r"(r0) : "i" (SWI_GetErrno));
|
2005-04-28 20:40:39 +02:00
|
|
|
return r0;
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2007-08-10 21:36:46 +02:00
|
|
|
/* Set errno and return result. */
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
static int
|
|
|
|
error (int result)
|
|
|
|
{
|
|
|
|
errno = get_errno ();
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2007-08-10 21:36:46 +02:00
|
|
|
/* Check the return and set errno appropriately. */
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
static int
|
2007-08-10 21:36:46 +02:00
|
|
|
checkerror (int result)
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
{
|
|
|
|
if (result == -1)
|
|
|
|
return error (-1);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2007-08-10 21:36:46 +02:00
|
|
|
/* fh, is a valid internal file handle.
|
|
|
|
ptr, is a null terminated string.
|
|
|
|
len, is the length in bytes to read.
|
|
|
|
Returns the number of bytes *not* written. */
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
int
|
2007-08-10 21:36:46 +02:00
|
|
|
_swiread (int fh,
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
char * ptr,
|
|
|
|
int len)
|
|
|
|
{
|
|
|
|
#ifdef ARM_RDI_MONITOR
|
|
|
|
int block[3];
|
|
|
|
|
|
|
|
block[0] = fh;
|
|
|
|
block[1] = (int) ptr;
|
|
|
|
block[2] = len;
|
|
|
|
|
2007-08-10 21:36:46 +02:00
|
|
|
return checkerror (do_AngelSWI (AngelSWI_Reason_Read, block));
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
#else
|
2007-08-10 21:36:46 +02:00
|
|
|
register r0 asm("r0");
|
|
|
|
register r1 asm("r1");
|
|
|
|
register r2 asm("r2");
|
|
|
|
r0 = fh;
|
|
|
|
r1 = (int)ptr;
|
|
|
|
r2 = len;
|
|
|
|
asm ("swi %a4"
|
|
|
|
: "=r" (r0)
|
|
|
|
: "0"(r0), "r"(r1), "r"(r2), "i"(SWI_Read));
|
|
|
|
return checkerror (r0);
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2014-02-11 20:55:22 +01:00
|
|
|
/* fd, is a valid user file handle.
|
2007-08-10 21:36:46 +02:00
|
|
|
Translates the return of _swiread into
|
|
|
|
bytes read. */
|
2014-02-11 20:55:22 +01:00
|
|
|
int __attribute__((weak))
|
2007-08-10 21:36:46 +02:00
|
|
|
_read (int fd,
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
char * ptr,
|
|
|
|
int len)
|
|
|
|
{
|
2007-08-10 21:36:46 +02:00
|
|
|
int res;
|
|
|
|
struct fdent *pfd;
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
|
2007-08-10 21:36:46 +02:00
|
|
|
pfd = findslot (fd);
|
|
|
|
if (pfd == NULL)
|
|
|
|
{
|
|
|
|
errno = EBADF;
|
|
|
|
return -1;
|
|
|
|
}
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
|
2007-08-10 21:36:46 +02:00
|
|
|
res = _swiread (pfd->handle, ptr, len);
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
|
2007-08-10 21:36:46 +02:00
|
|
|
if (res == -1)
|
|
|
|
return res;
|
|
|
|
|
|
|
|
pfd->pos += len - res;
|
|
|
|
|
|
|
|
/* res == len is not an error,
|
|
|
|
at least if we want feof() to work. */
|
|
|
|
return len - res;
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
}
|
|
|
|
|
2007-08-10 21:36:46 +02:00
|
|
|
/* fd, is a user file descriptor. */
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
int
|
2007-08-10 21:36:46 +02:00
|
|
|
_swilseek (int fd,
|
|
|
|
int ptr,
|
|
|
|
int dir)
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
{
|
|
|
|
int res;
|
2007-08-10 21:36:46 +02:00
|
|
|
struct fdent *pfd;
|
|
|
|
|
|
|
|
/* Valid file descriptor? */
|
|
|
|
pfd = findslot (fd);
|
|
|
|
if (pfd == NULL)
|
|
|
|
{
|
|
|
|
errno = EBADF;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Valid whence? */
|
|
|
|
if ((dir != SEEK_CUR)
|
|
|
|
&& (dir != SEEK_SET)
|
|
|
|
&& (dir != SEEK_END))
|
|
|
|
{
|
|
|
|
errno = EINVAL;
|
|
|
|
return -1;
|
|
|
|
}
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
|
2007-08-10 21:36:46 +02:00
|
|
|
/* Convert SEEK_CUR to SEEK_SET */
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
if (dir == SEEK_CUR)
|
|
|
|
{
|
2007-08-10 21:36:46 +02:00
|
|
|
ptr = pfd->pos + ptr;
|
|
|
|
/* The resulting file offset would be negative. */
|
|
|
|
if (ptr < 0)
|
|
|
|
{
|
|
|
|
errno = EINVAL;
|
|
|
|
if ((pfd->pos > 0) && (ptr > 0))
|
|
|
|
errno = EOVERFLOW;
|
|
|
|
return -1;
|
|
|
|
}
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
dir = SEEK_SET;
|
|
|
|
}
|
2007-08-10 21:36:46 +02:00
|
|
|
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
#ifdef ARM_RDI_MONITOR
|
2007-08-10 21:36:46 +02:00
|
|
|
int block[2];
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
if (dir == SEEK_END)
|
|
|
|
{
|
2007-08-10 21:36:46 +02:00
|
|
|
block[0] = pfd->handle;
|
|
|
|
res = checkerror (do_AngelSWI (AngelSWI_Reason_FLen, block));
|
|
|
|
if (res == -1)
|
|
|
|
return -1;
|
|
|
|
ptr += res;
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* This code only does absolute seeks. */
|
2007-08-10 21:36:46 +02:00
|
|
|
block[0] = pfd->handle;
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
block[1] = ptr;
|
2007-08-10 21:36:46 +02:00
|
|
|
res = checkerror (do_AngelSWI (AngelSWI_Reason_Seek, block));
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
#else
|
|
|
|
if (dir == SEEK_END)
|
|
|
|
{
|
|
|
|
asm ("mov r0, %2; swi %a1; mov %0, r0"
|
|
|
|
: "=r" (res)
|
2007-08-10 21:36:46 +02:00
|
|
|
: "i" (SWI_Flen), "r" (pfd->handle)
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
: "r0");
|
2007-08-10 21:36:46 +02:00
|
|
|
checkerror (res);
|
|
|
|
if (res == -1)
|
|
|
|
return -1;
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
ptr += res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This code only does absolute seeks. */
|
|
|
|
asm ("mov r0, %2; mov r1, %3; swi %a1; mov %0, r0"
|
|
|
|
: "=r" (res)
|
2007-08-10 21:36:46 +02:00
|
|
|
: "i" (SWI_Seek), "r" (pfd->handle), "r" (ptr)
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
: "r0", "r1");
|
2007-08-10 21:36:46 +02:00
|
|
|
checkerror (res);
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
#endif
|
2007-08-10 21:36:46 +02:00
|
|
|
/* At this point ptr is the current file position. */
|
|
|
|
if (res >= 0)
|
|
|
|
{
|
|
|
|
pfd->pos = ptr;
|
|
|
|
return ptr;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return -1;
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
}
|
|
|
|
|
2007-08-10 21:36:46 +02:00
|
|
|
_lseek (int fd,
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
int ptr,
|
|
|
|
int dir)
|
|
|
|
{
|
2007-08-10 21:36:46 +02:00
|
|
|
return _swilseek (fd, ptr, dir);
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
}
|
|
|
|
|
2007-08-10 21:36:46 +02:00
|
|
|
/* fh, is a valid internal file handle.
|
|
|
|
Returns the number of bytes *not* written. */
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
int
|
|
|
|
_swiwrite (
|
2007-08-10 21:36:46 +02:00
|
|
|
int fh,
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
char * ptr,
|
|
|
|
int len)
|
|
|
|
{
|
|
|
|
#ifdef ARM_RDI_MONITOR
|
|
|
|
int block[3];
|
|
|
|
|
|
|
|
block[0] = fh;
|
|
|
|
block[1] = (int) ptr;
|
|
|
|
block[2] = len;
|
|
|
|
|
2007-08-10 21:36:46 +02:00
|
|
|
return checkerror (do_AngelSWI (AngelSWI_Reason_Write, block));
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
#else
|
2007-08-10 21:36:46 +02:00
|
|
|
register r0 asm("r0");
|
|
|
|
register r1 asm("r1");
|
|
|
|
register r2 asm("r2");
|
|
|
|
r0 = fh;
|
|
|
|
r1 = (int)ptr;
|
|
|
|
r2 = len;
|
|
|
|
asm ("swi %a4"
|
|
|
|
: "=r" (r0)
|
|
|
|
: "0"(r0), "r"(r1), "r"(r2), "i"(SWI_Write));
|
|
|
|
return checkerror (r0);
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2007-08-10 21:36:46 +02:00
|
|
|
/* fd, is a user file descriptor. */
|
2014-02-11 20:55:22 +01:00
|
|
|
int __attribute__((weak))
|
2007-08-10 21:36:46 +02:00
|
|
|
_write (int fd,
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
char * ptr,
|
|
|
|
int len)
|
|
|
|
{
|
2007-08-10 21:36:46 +02:00
|
|
|
int res;
|
|
|
|
struct fdent *pfd;
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
|
2007-08-10 21:36:46 +02:00
|
|
|
pfd = findslot (fd);
|
|
|
|
if (pfd == NULL)
|
|
|
|
{
|
|
|
|
errno = EBADF;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
res = _swiwrite (pfd->handle, ptr,len);
|
|
|
|
|
|
|
|
/* Clearly an error. */
|
|
|
|
if (res < 0)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
pfd->pos += len - res;
|
|
|
|
|
|
|
|
/* We wrote 0 bytes?
|
|
|
|
Retrieve errno just in case. */
|
|
|
|
if ((len - res) == 0)
|
|
|
|
return error (0);
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
|
2007-08-10 21:36:46 +02:00
|
|
|
return (len - res);
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2007-08-10 21:36:46 +02:00
|
|
|
_swiopen (const char * path, int flags)
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
{
|
|
|
|
int aflags = 0, fh;
|
|
|
|
#ifdef ARM_RDI_MONITOR
|
|
|
|
int block[3];
|
|
|
|
#endif
|
|
|
|
|
2007-08-10 21:36:46 +02:00
|
|
|
int fd = newslot ();
|
|
|
|
|
|
|
|
if (fd == -1)
|
|
|
|
{
|
|
|
|
errno = EMFILE;
|
|
|
|
return -1;
|
|
|
|
}
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
|
2007-08-10 21:36:46 +02:00
|
|
|
/* It is an error to open a file that already exists. */
|
|
|
|
if ((flags & O_CREAT)
|
|
|
|
&& (flags & O_EXCL))
|
|
|
|
{
|
|
|
|
struct stat st;
|
|
|
|
int res;
|
|
|
|
res = _stat (path, &st);
|
|
|
|
if (res != -1)
|
|
|
|
{
|
|
|
|
errno = EEXIST;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
|
2007-08-10 21:36:46 +02:00
|
|
|
/* The flags are Unix-style, so we need to convert them. */
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
#ifdef O_BINARY
|
|
|
|
if (flags & O_BINARY)
|
|
|
|
aflags |= 1;
|
|
|
|
#endif
|
2007-08-10 21:36:46 +02:00
|
|
|
|
|
|
|
/* In O_RDONLY we expect aflags == 0. */
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
|
2007-08-10 21:36:46 +02:00
|
|
|
if (flags & O_RDWR)
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
aflags |= 2;
|
|
|
|
|
2007-08-10 21:36:46 +02:00
|
|
|
if ((flags & O_CREAT)
|
|
|
|
|| (flags & O_TRUNC)
|
|
|
|
|| (flags & O_WRONLY))
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
aflags |= 4;
|
|
|
|
|
|
|
|
if (flags & O_APPEND)
|
|
|
|
{
|
2007-08-10 21:36:46 +02:00
|
|
|
/* Can't ask for w AND a; means just 'a'. */
|
|
|
|
aflags &= ~4;
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
aflags |= 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef ARM_RDI_MONITOR
|
|
|
|
block[0] = (int) path;
|
|
|
|
block[2] = strlen (path);
|
|
|
|
block[1] = aflags;
|
|
|
|
|
|
|
|
fh = do_AngelSWI (AngelSWI_Reason_Open, block);
|
|
|
|
|
|
|
|
#else
|
|
|
|
asm ("mov r0,%2; mov r1, %3; swi %a1; mov %0, r0"
|
|
|
|
: "=r"(fh)
|
|
|
|
: "i" (SWI_Open),"r"(path),"r"(aflags)
|
|
|
|
: "r0","r1");
|
|
|
|
#endif
|
|
|
|
|
2007-08-10 21:36:46 +02:00
|
|
|
/* Return a user file descriptor or an error. */
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
if (fh >= 0)
|
|
|
|
{
|
2007-08-10 21:36:46 +02:00
|
|
|
openfiles[fd].handle = fh;
|
|
|
|
openfiles[fd].pos = 0;
|
|
|
|
return fd;
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
}
|
2007-08-10 21:36:46 +02:00
|
|
|
else
|
|
|
|
return error (fh);
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2007-08-10 21:36:46 +02:00
|
|
|
_open (const char * path, int flags, ...)
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
{
|
2007-08-10 21:36:46 +02:00
|
|
|
return _swiopen (path, flags);
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
}
|
|
|
|
|
2007-08-10 21:36:46 +02:00
|
|
|
/* fh, is a valid internal file handle. */
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
int
|
2007-08-10 21:36:46 +02:00
|
|
|
_swiclose (int fh)
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
{
|
|
|
|
#ifdef ARM_RDI_MONITOR
|
2007-08-10 21:36:46 +02:00
|
|
|
return checkerror (do_AngelSWI (AngelSWI_Reason_Close, &fh));
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
#else
|
2007-08-10 21:36:46 +02:00
|
|
|
register r0 asm("r0");
|
|
|
|
r0 = fh;
|
|
|
|
asm ("swi %a2"
|
|
|
|
: "=r"(r0)
|
|
|
|
: "0"(r0), "i" (SWI_Close));
|
|
|
|
return checkerror (r0);
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2007-08-10 21:36:46 +02:00
|
|
|
/* fd, is a user file descriptor. */
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
int
|
2007-08-10 21:36:46 +02:00
|
|
|
_close (int fd)
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
{
|
2007-08-10 21:36:46 +02:00
|
|
|
int res;
|
|
|
|
struct fdent *pfd;
|
|
|
|
|
|
|
|
pfd = findslot (fd);
|
|
|
|
if (pfd == NULL)
|
|
|
|
{
|
|
|
|
errno = EBADF;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle stderr == stdout. */
|
|
|
|
if ((fd == 1 || fd == 2)
|
|
|
|
&& (openfiles[1].handle == openfiles[2].handle))
|
|
|
|
{
|
|
|
|
pfd->handle = -1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Attempt to close the handle. */
|
|
|
|
res = _swiclose (pfd->handle);
|
|
|
|
|
|
|
|
/* Reclaim handle? */
|
|
|
|
if (res == 0)
|
|
|
|
pfd->handle = -1;
|
|
|
|
|
|
|
|
return res;
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
}
|
|
|
|
|
2005-07-18 18:18:17 +02:00
|
|
|
int __attribute__((weak))
|
2007-08-10 21:36:46 +02:00
|
|
|
_getpid (int n __attribute__ ((unused)))
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2014-02-11 20:55:22 +01:00
|
|
|
caddr_t __attribute__((weak))
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
_sbrk (int incr)
|
|
|
|
{
|
2007-08-10 21:36:46 +02:00
|
|
|
extern char end asm ("end"); /* Defined by the linker. */
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
static char * heap_end;
|
2007-08-10 21:36:46 +02:00
|
|
|
char * prev_heap_end;
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
|
|
|
|
if (heap_end == NULL)
|
|
|
|
heap_end = & end;
|
|
|
|
|
|
|
|
prev_heap_end = heap_end;
|
|
|
|
|
|
|
|
if (heap_end + incr > stack_ptr)
|
|
|
|
{
|
|
|
|
/* Some of the libstdc++-v3 tests rely upon detecting
|
|
|
|
out of memory errors, so do not abort here. */
|
|
|
|
#if 0
|
|
|
|
extern void abort (void);
|
|
|
|
|
|
|
|
_write (1, "_sbrk: Heap and stack collision\n", 32);
|
|
|
|
|
|
|
|
abort ();
|
|
|
|
#else
|
|
|
|
errno = ENOMEM;
|
|
|
|
return (caddr_t) -1;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
heap_end += incr;
|
|
|
|
|
|
|
|
return (caddr_t) prev_heap_end;
|
|
|
|
}
|
|
|
|
|
2007-08-10 21:36:46 +02:00
|
|
|
int
|
|
|
|
_swistat (int fd, struct stat * st)
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
{
|
2007-08-10 21:36:46 +02:00
|
|
|
struct fdent *pfd;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
pfd = findslot (fd);
|
|
|
|
if (pfd == NULL)
|
|
|
|
{
|
|
|
|
errno = EBADF;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Always assume a character device,
|
|
|
|
with 1024 byte blocks. */
|
|
|
|
st->st_mode |= S_IFCHR;
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
st->st_blksize = 1024;
|
2007-08-10 21:36:46 +02:00
|
|
|
#ifdef ARM_RDI_MONITOR
|
|
|
|
res = checkerror (do_AngelSWI (AngelSWI_Reason_FLen, &pfd->handle));
|
|
|
|
#else
|
|
|
|
asm ("mov r0, %2; swi %a1; mov %0, r0"
|
|
|
|
: "=r" (res)
|
|
|
|
: "i" (SWI_Flen), "r" (pfd->handle)
|
|
|
|
: "r0");
|
|
|
|
checkerror (res);
|
|
|
|
#endif
|
|
|
|
if (res == -1)
|
|
|
|
return -1;
|
|
|
|
/* Return the file size. */
|
|
|
|
st->st_size = res;
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2005-07-18 18:18:17 +02:00
|
|
|
int __attribute__((weak))
|
2007-08-10 21:36:46 +02:00
|
|
|
_fstat (int fd, struct stat * st)
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
{
|
2007-08-10 21:36:46 +02:00
|
|
|
memset (st, 0, sizeof (* st));
|
|
|
|
return _swistat (fd, st);
|
|
|
|
}
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
|
2007-08-10 21:36:46 +02:00
|
|
|
int __attribute__((weak))
|
|
|
|
_stat (const char *fname, struct stat *st)
|
|
|
|
{
|
|
|
|
int fd, res;
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
memset (st, 0, sizeof (* st));
|
2007-08-10 21:36:46 +02:00
|
|
|
/* The best we can do is try to open the file readonly.
|
|
|
|
If it exists, then we can guess a few things about it. */
|
|
|
|
if ((fd = _open (fname, O_RDONLY)) == -1)
|
|
|
|
return -1;
|
|
|
|
st->st_mode |= S_IFREG | S_IREAD;
|
|
|
|
res = _swistat (fd, st);
|
|
|
|
/* Not interested in the error. */
|
|
|
|
_close (fd);
|
|
|
|
return res;
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
}
|
|
|
|
|
2005-07-18 18:18:17 +02:00
|
|
|
int __attribute__((weak))
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
_link (void)
|
|
|
|
{
|
2005-07-18 18:18:17 +02:00
|
|
|
errno = ENOSYS;
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2005-07-18 18:18:17 +02:00
|
|
|
_unlink (const char *path)
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
{
|
2007-08-10 21:36:46 +02:00
|
|
|
int res;
|
2005-07-18 18:18:17 +02:00
|
|
|
#ifdef ARM_RDI_MONITOR
|
2006-06-13 22:51:08 +02:00
|
|
|
int block[2];
|
2006-12-26 00:03:21 +01:00
|
|
|
block[0] = (int)path;
|
2006-06-13 22:51:08 +02:00
|
|
|
block[1] = strlen(path);
|
2007-08-10 21:36:46 +02:00
|
|
|
res = do_AngelSWI (AngelSWI_Reason_Remove, block);
|
2005-07-18 18:18:17 +02:00
|
|
|
#else
|
2007-08-10 21:36:46 +02:00
|
|
|
register r0 asm("r0");
|
|
|
|
r0 = (int)path;
|
|
|
|
asm ("swi %a2"
|
|
|
|
: "=r"(r0)
|
|
|
|
: "0"(r0), "i" (SWI_Remove));
|
|
|
|
res = r0;
|
2005-07-18 18:18:17 +02:00
|
|
|
#endif
|
2007-08-10 21:36:46 +02:00
|
|
|
if (res == -1)
|
|
|
|
return error (res);
|
|
|
|
return 0;
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2007-07-06 19:00:13 +02:00
|
|
|
_gettimeofday (struct timeval * tp, void * tzvp)
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
{
|
2007-07-06 19:00:13 +02:00
|
|
|
struct timezone *tzp = tzvp;
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
if (tp)
|
|
|
|
{
|
|
|
|
/* Ask the host for the seconds since the Unix epoch. */
|
|
|
|
#ifdef ARM_RDI_MONITOR
|
|
|
|
tp->tv_sec = do_AngelSWI (AngelSWI_Reason_Time,NULL);
|
|
|
|
#else
|
|
|
|
{
|
|
|
|
int value;
|
|
|
|
asm ("swi %a1; mov %0, r0" : "=r" (value): "i" (SWI_Time) : "r0");
|
|
|
|
tp->tv_sec = value;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
tp->tv_usec = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return fixed data for the timezone. */
|
|
|
|
if (tzp)
|
|
|
|
{
|
|
|
|
tzp->tz_minuteswest = 0;
|
|
|
|
tzp->tz_dsttime = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return a clock that ticks at 100Hz. */
|
|
|
|
clock_t
|
2005-12-01 00:37:14 +01:00
|
|
|
_clock (void)
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
{
|
|
|
|
clock_t timeval;
|
|
|
|
|
|
|
|
#ifdef ARM_RDI_MONITOR
|
|
|
|
timeval = do_AngelSWI (AngelSWI_Reason_Clock,NULL);
|
|
|
|
#else
|
|
|
|
asm ("swi %a1; mov %0, r0" : "=r" (timeval): "i" (SWI_Clock) : "r0");
|
|
|
|
#endif
|
2005-12-01 00:37:14 +01:00
|
|
|
return timeval;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return a clock that ticks at 100Hz. */
|
|
|
|
clock_t
|
|
|
|
_times (struct tms * tp)
|
|
|
|
{
|
|
|
|
clock_t timeval = _clock();
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
|
|
|
|
if (tp)
|
|
|
|
{
|
|
|
|
tp->tms_utime = timeval; /* user time */
|
|
|
|
tp->tms_stime = 0; /* system time */
|
|
|
|
tp->tms_cutime = 0; /* user time, children */
|
|
|
|
tp->tms_cstime = 0; /* system time, children */
|
|
|
|
}
|
|
|
|
|
|
|
|
return timeval;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
int
|
2005-07-18 18:18:17 +02:00
|
|
|
_isatty (int fd)
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
{
|
2007-08-10 21:36:46 +02:00
|
|
|
struct fdent *pfd;
|
2010-08-27 13:55:36 +02:00
|
|
|
int tty;
|
2007-08-10 21:36:46 +02:00
|
|
|
|
|
|
|
pfd = findslot (fd);
|
|
|
|
if (pfd == NULL)
|
|
|
|
{
|
|
|
|
errno = EBADF;
|
2010-08-27 13:55:36 +02:00
|
|
|
return 0;
|
2007-08-10 21:36:46 +02:00
|
|
|
}
|
|
|
|
|
2005-07-18 18:18:17 +02:00
|
|
|
#ifdef ARM_RDI_MONITOR
|
2010-08-27 13:55:36 +02:00
|
|
|
tty = do_AngelSWI (AngelSWI_Reason_IsTTY, &pfd->handle);
|
2005-07-18 18:18:17 +02:00
|
|
|
#else
|
2007-08-10 21:36:46 +02:00
|
|
|
register r0 asm("r0");
|
|
|
|
r0 = pfd->handle;
|
|
|
|
asm ("swi %a2"
|
|
|
|
: "=r" (r0)
|
|
|
|
: "0"(r0), "i" (SWI_IsTTY));
|
2010-08-27 13:55:36 +02:00
|
|
|
tty = r0;
|
2005-07-18 18:18:17 +02:00
|
|
|
#endif
|
2010-08-27 13:55:36 +02:00
|
|
|
|
|
|
|
if (tty == 1)
|
|
|
|
return 1;
|
|
|
|
errno = get_errno ();
|
|
|
|
return 0;
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
_system (const char *s)
|
|
|
|
{
|
2005-07-18 18:18:17 +02:00
|
|
|
#ifdef ARM_RDI_MONITOR
|
2006-06-13 22:51:08 +02:00
|
|
|
int block[2];
|
|
|
|
int e;
|
|
|
|
|
|
|
|
/* Hmmm. The ARM debug interface specification doesn't say whether
|
|
|
|
SYS_SYSTEM does the right thing with a null argument, or assign any
|
|
|
|
meaning to its return value. Try to do something reasonable.... */
|
|
|
|
if (!s)
|
|
|
|
return 1; /* maybe there is a shell available? we can hope. :-P */
|
2006-12-26 00:03:21 +01:00
|
|
|
block[0] = (int)s;
|
2006-06-13 22:51:08 +02:00
|
|
|
block[1] = strlen (s);
|
2007-08-10 21:36:46 +02:00
|
|
|
e = checkerror (do_AngelSWI (AngelSWI_Reason_System, block));
|
2006-06-13 22:51:08 +02:00
|
|
|
if ((e >= 0) && (e < 256))
|
|
|
|
{
|
|
|
|
/* We have to convert e, an exit status to the encoded status of
|
|
|
|
the command. To avoid hard coding the exit status, we simply
|
|
|
|
loop until we find the right position. */
|
|
|
|
int exit_code;
|
|
|
|
|
|
|
|
for (exit_code = e; e && WEXITSTATUS (e) != exit_code; e <<= 1)
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
return e;
|
2005-07-18 18:18:17 +02:00
|
|
|
#else
|
2007-08-10 21:36:46 +02:00
|
|
|
register r0 asm("r0");
|
|
|
|
r0 = (int)s;
|
|
|
|
asm ("swi %a2"
|
|
|
|
: "=r" (r0)
|
|
|
|
: "0"(r0), "i" (SWI_CLI));
|
|
|
|
return checkerror (r0);
|
2005-07-18 18:18:17 +02:00
|
|
|
#endif
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
_rename (const char * oldpath, const char * newpath)
|
|
|
|
{
|
2005-07-18 18:18:17 +02:00
|
|
|
#ifdef ARM_RDI_MONITOR
|
2006-06-13 22:51:08 +02:00
|
|
|
int block[4];
|
2006-12-26 00:03:21 +01:00
|
|
|
block[0] = (int)oldpath;
|
2006-06-13 22:51:08 +02:00
|
|
|
block[1] = strlen(oldpath);
|
2006-12-26 00:03:21 +01:00
|
|
|
block[2] = (int)newpath;
|
2006-06-13 22:51:08 +02:00
|
|
|
block[3] = strlen(newpath);
|
2007-08-10 21:36:46 +02:00
|
|
|
return checkerror (do_AngelSWI (AngelSWI_Reason_Rename, block)) ? -1 : 0;
|
2005-07-18 18:18:17 +02:00
|
|
|
#else
|
2007-08-10 21:36:46 +02:00
|
|
|
register r0 asm("r0");
|
|
|
|
register r1 asm("r1");
|
|
|
|
r0 = (int)oldpath;
|
|
|
|
r1 = (int)newpath;
|
|
|
|
asm ("swi %a3"
|
|
|
|
: "=r" (r0)
|
|
|
|
: "0" (r0), "r" (r1), "i" (SWI_Rename));
|
|
|
|
return checkerror (r0);
|
2005-07-18 18:18:17 +02:00
|
|
|
#endif
|
2004-06-09 Toralf Lund <toralf@procaptura.com>
* arm/crt0.S: Copied from newlib and it now also sets up stacks for
FIQ and IRQ mode, plus calls hardware_init_hook() and
software_init_hook() if present.
* arm/libcfunc.c, arm/swi.h, arm/syscalls.c: Copied
from newlib.
* arm/Makefile.in: Build crt0.o, rdpmon-crt0.o, rdimon-crt0.o,
librdpmon.a, librdimon.a - support file for "bare" setup, as well
as "RDP" and "RDI" monitors.
* arm/coff-rdpmon.specs, arm/elf-rdpmon.specs,
arm/coff-rdimon.specs, arm/elf-rdimon.specs: gcc specs files to go
with above mentioned support libs and startfiles.
2004-06-09 21:06:50 +02:00
|
|
|
}
|