From 41a639dea811272c66ed71eb9ca6c233050f57b3 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Tue, 25 Feb 2003 20:36:29 +0000 Subject: [PATCH] 2002-02-25 D.Venkatasubramanian * libc/sys/h8300hms/Makefile.am: Add support for new files. * libc/sys/h8300hms/Makefile.in: Regenerated. * libc/sys/h8300hms/close.S: New file. * libc/sys/h8300hms/fstat.S: Ditto. * libc/sys/h8300hms/lseek.S: Ditto. * libc/sys/h8300hms/open.S: Ditto. * libc/sys/h8300hms/stat.S: Ditto. * libc/sys/h8300hms/read.S: New file to replace read.c. * libc/sys/h8300hms/read.c: Removed. * libc/sys/h8300hms/syscalls.c: Removed functions _open, _lseek, _close, _stat, _fstat. * libc/sys/h8300hms/write.S: New file to replace write.c. * libc/sys/h8300hms/write.c: Removed. --- newlib/ChangeLog | 16 ++++++++++++++ newlib/libc/sys/h8300hms/Makefile.am | 3 ++- newlib/libc/sys/h8300hms/Makefile.in | 11 ++++++---- newlib/libc/sys/h8300hms/close.S | 22 +++++++++++++++++++ newlib/libc/sys/h8300hms/fstat.S | 23 +++++++++++++++++++ newlib/libc/sys/h8300hms/lseek.S | 23 +++++++++++++++++++ newlib/libc/sys/h8300hms/open.S | 19 ++++++++++++++++ newlib/libc/sys/h8300hms/read.S | 23 +++++++++++++++++++ newlib/libc/sys/h8300hms/read.c | 27 ----------------------- newlib/libc/sys/h8300hms/stat.S | 17 ++++++++++++++ newlib/libc/sys/h8300hms/syscalls.c | 33 ---------------------------- newlib/libc/sys/h8300hms/write.S | 23 +++++++++++++++++++ newlib/libc/sys/h8300hms/write.c | 16 -------------- 13 files changed, 175 insertions(+), 81 deletions(-) create mode 100644 newlib/libc/sys/h8300hms/close.S create mode 100644 newlib/libc/sys/h8300hms/fstat.S create mode 100644 newlib/libc/sys/h8300hms/lseek.S create mode 100644 newlib/libc/sys/h8300hms/open.S create mode 100644 newlib/libc/sys/h8300hms/read.S delete mode 100644 newlib/libc/sys/h8300hms/read.c create mode 100644 newlib/libc/sys/h8300hms/stat.S create mode 100644 newlib/libc/sys/h8300hms/write.S delete mode 100644 newlib/libc/sys/h8300hms/write.c diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 7781da129..c09409ff4 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,19 @@ +2002-02-25 D.Venkatasubramanian + + * libc/sys/h8300hms/Makefile.am: Add support for new files. + * libc/sys/h8300hms/Makefile.in: Regenerated. + * libc/sys/h8300hms/close.S: New file. + * libc/sys/h8300hms/fstat.S: Ditto. + * libc/sys/h8300hms/lseek.S: Ditto. + * libc/sys/h8300hms/open.S: Ditto. + * libc/sys/h8300hms/stat.S: Ditto. + * libc/sys/h8300hms/read.S: New file to replace read.c. + * libc/sys/h8300hms/read.c: Removed. + * libc/sys/h8300hms/syscalls.c: Removed functions _open, + _lseek, _close, _stat, _fstat. + * libc/sys/h8300hms/write.S: New file to replace write.c. + * libc/sys/h8300hms/write.c: Removed. + 2003-02-20 Nick Clifton * Add support for Cirrus Maverick ARM co-processor: diff --git a/newlib/libc/sys/h8300hms/Makefile.am b/newlib/libc/sys/h8300hms/Makefile.am index a6d0815d9..b4b8823b7 100644 --- a/newlib/libc/sys/h8300hms/Makefile.am +++ b/newlib/libc/sys/h8300hms/Makefile.am @@ -6,7 +6,8 @@ INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) noinst_LIBRARIES = lib.a -lib_a_SOURCES = syscalls.c write.c _exit.c read.c sbrk.c misc.c crt1.c +lib_a_SOURCES = syscalls.c _exit.c sbrk.c misc.c crt1.c \ + close.S fstat.S lseek.S open.S read.S stat.S write.S all: crt0.o diff --git a/newlib/libc/sys/h8300hms/Makefile.in b/newlib/libc/sys/h8300hms/Makefile.in index 865da548e..971ada259 100644 --- a/newlib/libc/sys/h8300hms/Makefile.in +++ b/newlib/libc/sys/h8300hms/Makefile.in @@ -1,6 +1,6 @@ -# Makefile.in generated automatically by automake 1.4 from Makefile.am +# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -89,7 +89,9 @@ INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) noinst_LIBRARIES = lib.a -lib_a_SOURCES = syscalls.c write.c _exit.c read.c sbrk.c misc.c crt1.c +lib_a_SOURCES = syscalls.c _exit.c sbrk.c misc.c crt1.c \ + close.S fstat.S lseek.S open.S read.S stat.S write.S + ACLOCAL_AMFLAGS = -I ../../.. CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host @@ -103,7 +105,8 @@ DEFS = @DEFS@ -I. -I$(srcdir) CPPFLAGS = @CPPFLAGS@ LIBS = @LIBS@ lib_a_LIBADD = -lib_a_OBJECTS = syscalls.o write.o _exit.o read.o sbrk.o misc.o crt1.o +lib_a_OBJECTS = syscalls.o _exit.o sbrk.o misc.o crt1.o close.o fstat.o \ +lseek.o open.o read.o stat.o write.o CFLAGS = @CFLAGS@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) diff --git a/newlib/libc/sys/h8300hms/close.S b/newlib/libc/sys/h8300hms/close.S new file mode 100644 index 000000000..54a1214d7 --- /dev/null +++ b/newlib/libc/sys/h8300hms/close.S @@ -0,0 +1,22 @@ +;int close(int fd); +;Integer arguments have to be zero extended. + +#if defined(__H8300H__) + .h8300h +#endif +#if defined(__H8300S__) + .h8300s +#endif + + .section .text + .align 2 + .global __close +__close: +#if defined(__H8300H__) || defined(__H8300S__) +#if __INT_MAX__ == 32767 + extu.l er0 +#endif +#endif + jsr @@0xc9 + rts + .end diff --git a/newlib/libc/sys/h8300hms/fstat.S b/newlib/libc/sys/h8300hms/fstat.S new file mode 100644 index 000000000..a6214e662 --- /dev/null +++ b/newlib/libc/sys/h8300hms/fstat.S @@ -0,0 +1,23 @@ +;int fstat(int filedes, struct stat *buf); +;Integer arguments have to be zero extended. + +#if defined(__H8300H__) + .h8300h +#endif +#if defined(__H8300S__) + .h8300s +#endif + + .section .text + .align 2 + .global __fstat +__fstat: +#if defined(__H8300H__) || defined(__H8300S__) +#if __INT_MAX__ == 32767 + extu.l er0 +#endif +#endif + jsr @@0xcb + rts + .end + diff --git a/newlib/libc/sys/h8300hms/lseek.S b/newlib/libc/sys/h8300hms/lseek.S new file mode 100644 index 000000000..1af533c14 --- /dev/null +++ b/newlib/libc/sys/h8300hms/lseek.S @@ -0,0 +1,23 @@ +;off_t lseek(int fildes, off_t offset, int whence); +;Integer arguments have to be zero extended. + +#if defined(__H8300H__) + .h8300h +#endif +#if defined(__H8300S__) + .h8300s +#endif + + .section .text + .align 2 + .global __lseek +__lseek: +#if defined(__H8300H__) || defined(__H8300S__) +#if __INT_MAX__ == 32767 + extu.l er0 + extu.l er2 +#endif +#endif + jsr @@0xc8 + rts + .end diff --git a/newlib/libc/sys/h8300hms/open.S b/newlib/libc/sys/h8300hms/open.S new file mode 100644 index 000000000..f025aac60 --- /dev/null +++ b/newlib/libc/sys/h8300hms/open.S @@ -0,0 +1,19 @@ +;int open(const char *pathname, int flags); +;Integer arguments have to be zero extended. +;The second argument is taken from the stack, +;hence it is not zero extended here. + +#if defined(__H8300H__) + .h8300h +#endif +#if defined(__H8300S__) + .h8300s +#endif + + .section .text + .align 2 + .global __open +__open: + jsr @@0xc5 + rts + .end diff --git a/newlib/libc/sys/h8300hms/read.S b/newlib/libc/sys/h8300hms/read.S new file mode 100644 index 000000000..77a7f1c3a --- /dev/null +++ b/newlib/libc/sys/h8300hms/read.S @@ -0,0 +1,23 @@ +;ssize_t read(int fd, void *buf, size_t count); +;Integer arguments have to be zero extended. + +#if defined(__H8300H__) + .h8300h +#endif +#if defined(__H8300S__) + .h8300s +#endif + + .section .text + .align 2 + .global __read +__read: +#if defined(__H8300H__) || defined(__H8300S__) +#if __INT_MAX__ == 32767 + extu.l er0 +#endif +#endif + jsr @@0xc6 + rts + .end + diff --git a/newlib/libc/sys/h8300hms/read.c b/newlib/libc/sys/h8300hms/read.c deleted file mode 100644 index 01316f951..000000000 --- a/newlib/libc/sys/h8300hms/read.c +++ /dev/null @@ -1,27 +0,0 @@ -#include "sys/syscall.h" - -int _read(file, ptr, len) - int file; - char *ptr; - int len; -{ - register int ret asm("r0") ; - - /* Type cast int as short so that we can copy int values into 16 bit - registers in case of -mint32 switch is given. - This is not going to affect data as file= 0 for stdin and len=1024 */ - - asm("mov.b %0, r0l":: "i" (SYS_read)) ; /* Syscall Number */ - asm("mov.w %0, r1" :: "r"((short)file) :"r1", "r2", "r3") ; - asm("mov.w %0, r3" :: "r"((short)len) :"r1", "r2", "r3") ; -#if defined(__H8300__) || defined(__NORMAL_MODE__) - asm("mov.w %0, r2" :: "r"(ptr) :"r1", "r2", "r3") ; -#else - asm("mov.l %0, er2" :: "r"(ptr) :"r1", "er2", "r3") ; -#endif - // This is magic trap similar to _write for simulator - asm("jsr @@0xc8") ; - return ret; -} - - diff --git a/newlib/libc/sys/h8300hms/stat.S b/newlib/libc/sys/h8300hms/stat.S new file mode 100644 index 000000000..d4ce3ff37 --- /dev/null +++ b/newlib/libc/sys/h8300hms/stat.S @@ -0,0 +1,17 @@ +;int stat(const char *file_name, struct stat *buf); + +#if defined(__H8300H__) + .h8300h +#endif +#if defined(__H8300S__) + .h8300s +#endif + + .section .text + .align 2 + .global __stat +__stat: + jsr @@0xca + rts + .end + diff --git a/newlib/libc/sys/h8300hms/syscalls.c b/newlib/libc/sys/h8300hms/syscalls.c index 3ebac8843..b716e62fc 100644 --- a/newlib/libc/sys/h8300hms/syscalls.c +++ b/newlib/libc/sys/h8300hms/syscalls.c @@ -1,47 +1,14 @@ /* Operating system stubs, set up for the MRI simulator */ #include <_ansi.h> -#include -#include #include - -int _DEFUN(_lseek,(file, ptr, dir), - int file _AND - int ptr _AND - int dir) -{ - return 0; -} - -int _DEFUN(_close,(file), - int file) -{ - return -1; -} - int isatty(file) int file; { return 1; } -int _DEFUN(_fstat,(file, st), - int file _AND - struct stat *st) -{ - st->st_mode = S_IFCHR; - return 0; -} - -int -_open (path, flags) - const char *path; - int flags; -{ - return 0; -} - int _unlink (path) const char *path; diff --git a/newlib/libc/sys/h8300hms/write.S b/newlib/libc/sys/h8300hms/write.S new file mode 100644 index 000000000..ccd06c5b7 --- /dev/null +++ b/newlib/libc/sys/h8300hms/write.S @@ -0,0 +1,23 @@ +;ssize_t write(int fd, const void *buf, size_t count); +;Integer arguments have to be zero extended. + +#if defined(__H8300H__) + .h8300h +#endif + +#if defined(__H8300S__) + .h8300s +#endif + + .section .text + .align 2 + .global __write +__write: +#if defined(__H8300H__) || defined(__H8300S__) +#if __INT_MAX__ == 32767 + extu.l er0 +#endif +#endif + jsr @@0xc7 + rts + .end diff --git a/newlib/libc/sys/h8300hms/write.c b/newlib/libc/sys/h8300hms/write.c deleted file mode 100644 index 22fc63d57..000000000 --- a/newlib/libc/sys/h8300hms/write.c +++ /dev/null @@ -1,16 +0,0 @@ - - -int _write(file, ptr, len) - int file; - char *ptr; - int len; -{ - int todo; - - for (todo = 0; todo < len; todo++) - { - asm("mov.b #0,r1l\n mov.b %0l,r2l\njsr @@0xc4" : : "r" (*ptr++) : "r1", "r2"); - } - return len; -} -