* newlib/libc/sys/h8300hms/Makeile.am (lib_a_SOURCES): Add read.c.
* newlib/libc/sys/h8300hms/read.c: New file. Magic trap 0xC8 for sim. * newlib/libc/sys/h8300hms/syscalls.c: Move _read() to read.c. * newlib/libs/sys/h8300hms/sys/syscall.h: New file.
This commit is contained in:
		| @@ -1,3 +1,10 @@ | |||||||
|  | 2002-05-14 Dhananjay Deshpande <dhananjayd@kpit.com> | ||||||
|  |  | ||||||
|  | 	* newlib/libc/sys/h8300hms/Makeile.am (lib_a_SOURCES): Add read.c. | ||||||
|  | 	* newlib/libc/sys/h8300hms/read.c: New file.  Magic trap 0xC8 for sim. | ||||||
|  | 	* newlib/libc/sys/h8300hms/syscalls.c: Move _read() to read.c. | ||||||
|  | 	* newlib/libs/sys/h8300hms/sys/syscall.h: New file. | ||||||
|  |  | ||||||
| Thu May 16 17:24:57 2002  J"orn Rennecke <joern.rennecke@superh.com> | Thu May 16 17:24:57 2002  J"orn Rennecke <joern.rennecke@superh.com> | ||||||
|  |  | ||||||
| 	* libc/machine/sh/strcpy.S (strcpy): Replace LITTLE_ENDIAN with | 	* libc/machine/sh/strcpy.S (strcpy): Replace LITTLE_ENDIAN with | ||||||
|   | |||||||
| @@ -6,7 +6,7 @@ INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) | |||||||
|  |  | ||||||
| noinst_LIBRARIES = lib.a | noinst_LIBRARIES = lib.a | ||||||
|  |  | ||||||
| lib_a_SOURCES = syscalls.c write.c _exit.c sbrk.c misc.c crt1.c | lib_a_SOURCES = syscalls.c write.c _exit.c read.c sbrk.c misc.c crt1.c | ||||||
|  |  | ||||||
| all: crt0.o | all: crt0.o | ||||||
|  |  | ||||||
|   | |||||||
| @@ -88,7 +88,7 @@ INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) | |||||||
|  |  | ||||||
| noinst_LIBRARIES = lib.a | noinst_LIBRARIES = lib.a | ||||||
|  |  | ||||||
| lib_a_SOURCES = syscalls.c write.c _exit.c sbrk.c misc.c crt1.c | lib_a_SOURCES = syscalls.c write.c _exit.c read.c sbrk.c misc.c crt1.c | ||||||
|  |  | ||||||
| ACLOCAL_AMFLAGS = -I ../../.. | ACLOCAL_AMFLAGS = -I ../../.. | ||||||
| CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host | CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host | ||||||
| @@ -102,7 +102,7 @@ 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 sbrk.o misc.o crt1.o | lib_a_OBJECTS =  syscalls.o write.o _exit.o read.o sbrk.o misc.o crt1.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) | ||||||
|   | |||||||
							
								
								
									
										27
									
								
								newlib/libc/sys/h8300hms/read.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								newlib/libc/sys/h8300hms/read.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | |||||||
|  | #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") ; | ||||||
|  | #ifdef __H8300__ | ||||||
|  | 	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; | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
							
								
								
									
										1
									
								
								newlib/libc/sys/h8300hms/sys/syscall.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								newlib/libc/sys/h8300hms/sys/syscall.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | |||||||
|  | #define	SYS_read	4 | ||||||
| @@ -5,14 +5,6 @@ | |||||||
| #include <sys/stat.h> | #include <sys/stat.h> | ||||||
| #include <errno.h> | #include <errno.h> | ||||||
|  |  | ||||||
| int _DEFUN(_read,(file, ptr, len), |  | ||||||
| 	   int file _AND |  | ||||||
| 	   char *ptr _AND |  | ||||||
| 	   int len) |  | ||||||
| { |  | ||||||
|   return 0; |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  |  | ||||||
| int _DEFUN(_lseek,(file, ptr, dir), | int _DEFUN(_lseek,(file, ptr, dir), | ||||||
| 	  int file _AND | 	  int file _AND | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user