2002-02-25 D.Venkatasubramanian <dvenkat@noida.hcltech.com>
* 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.
			
			
This commit is contained in:
		| @@ -1,3 +1,19 @@ | |||||||
|  | 2002-02-25   D.Venkatasubramanian <dvenkat@noida.hcltech.com> | ||||||
|  |  | ||||||
|  | 	* 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  <nickc@redhat.com> | 2003-02-20  Nick Clifton  <nickc@redhat.com> | ||||||
|  |  | ||||||
| 	* Add support for Cirrus Maverick ARM co-processor: | 	* Add support for Cirrus Maverick ARM co-processor: | ||||||
|   | |||||||
| @@ -6,7 +6,8 @@ INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) | |||||||
|  |  | ||||||
| noinst_LIBRARIES = lib.a | 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 | all: crt0.o | ||||||
|  |  | ||||||
|   | |||||||
| @@ -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 | # This Makefile.in is free software; the Free Software Foundation | ||||||
| # gives unlimited permission to copy and/or distribute it, | # gives unlimited permission to copy and/or distribute it, | ||||||
| # with or without modifications, as long as this notice is preserved. | # 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 | 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 ../../.. | ACLOCAL_AMFLAGS = -I ../../.. | ||||||
| CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host | CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host | ||||||
| @@ -103,7 +105,8 @@ DEFS = @DEFS@ -I. -I$(srcdir) | |||||||
| CPPFLAGS = @CPPFLAGS@ | CPPFLAGS = @CPPFLAGS@ | ||||||
| LIBS = @LIBS@ | LIBS = @LIBS@ | ||||||
| lib_a_LIBADD =  | 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@ | CFLAGS = @CFLAGS@ | ||||||
| COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) | COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) | ||||||
| CCLD = $(CC) | CCLD = $(CC) | ||||||
|   | |||||||
							
								
								
									
										22
									
								
								newlib/libc/sys/h8300hms/close.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								newlib/libc/sys/h8300hms/close.S
									
									
									
									
									
										Normal file
									
								
							| @@ -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 | ||||||
							
								
								
									
										23
									
								
								newlib/libc/sys/h8300hms/fstat.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								newlib/libc/sys/h8300hms/fstat.S
									
									
									
									
									
										Normal file
									
								
							| @@ -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 | ||||||
|  | 									 | ||||||
							
								
								
									
										23
									
								
								newlib/libc/sys/h8300hms/lseek.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								newlib/libc/sys/h8300hms/lseek.S
									
									
									
									
									
										Normal file
									
								
							| @@ -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 | ||||||
							
								
								
									
										19
									
								
								newlib/libc/sys/h8300hms/open.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								newlib/libc/sys/h8300hms/open.S
									
									
									
									
									
										Normal file
									
								
							| @@ -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 | ||||||
							
								
								
									
										23
									
								
								newlib/libc/sys/h8300hms/read.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								newlib/libc/sys/h8300hms/read.S
									
									
									
									
									
										Normal file
									
								
							| @@ -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 | ||||||
|  | 									 | ||||||
| @@ -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; |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  |  | ||||||
							
								
								
									
										17
									
								
								newlib/libc/sys/h8300hms/stat.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								newlib/libc/sys/h8300hms/stat.S
									
									
									
									
									
										Normal file
									
								
							| @@ -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 | ||||||
|  | 									 | ||||||
| @@ -1,47 +1,14 @@ | |||||||
| /* Operating system stubs, set up for the MRI simulator */ | /* Operating system stubs, set up for the MRI simulator */ | ||||||
|  |  | ||||||
| #include <_ansi.h> | #include <_ansi.h> | ||||||
| #include <sys/types.h> |  | ||||||
| #include <sys/stat.h> |  | ||||||
| #include <errno.h> | #include <errno.h> | ||||||
|  |  | ||||||
|  |  | ||||||
| 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 isatty(file) | ||||||
|      int file; |      int file; | ||||||
| { | { | ||||||
|   return 1; |   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 | int | ||||||
| _unlink (path) | _unlink (path) | ||||||
|      const char *path; |      const char *path; | ||||||
|   | |||||||
							
								
								
									
										23
									
								
								newlib/libc/sys/h8300hms/write.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								newlib/libc/sys/h8300hms/write.S
									
									
									
									
									
										Normal file
									
								
							| @@ -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 | ||||||
| @@ -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; |  | ||||||
| } |  | ||||||
|  |  | ||||||
		Reference in New Issue
	
	Block a user