*** newlib/libc/sys/h8300hms/read.c.original Thu Nov 14 17:20:04 2002 --- newlib/libc/sys/h8300hms/read.c.modified Fri Nov 29 13:51:42 2002 *************** int _read(file, ptr, len) *** 5,27 **** 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; } --- 5,11 ---- char *ptr; int len; { ! asm("jsr @@0xc6") ; } *** newlib/libc/sys/h8300hms/write.c.original Thu Nov 14 17:20:19 2002 --- newlib/libc/sys/h8300hms/write.c.modified Fri Nov 29 13:52:23 2002 *************** int _write(file, ptr, len) *** 5,16 **** 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; } --- 5,10 ---- char *ptr; int len; { ! asm("jsr @@0xc7"); } *** newlib/libc/sys/h8300hms/syscalls.c.original Thu Nov 14 17:19:38 2002 --- newlib/libc/sys/h8300hms/syscalls.c.modified Fri Nov 29 13:52:57 2002 *************** *** 4,23 **** #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) --- 4,31 ---- #include #include #include + #include "sys/syscall.h" + int + _open (path, flags) + const char *path; + int flags; + { + asm("jsr @@0xc5"); + } int _DEFUN(_lseek,(file, ptr, dir), int file _AND int ptr _AND int dir) { ! asm("jsr @@0xc8"); } int _DEFUN(_close,(file), int file) { ! asm("jsr @@0xc9"); } int isatty(file) *************** int isatty(file) *** 26,45 **** 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 --- 34,52 ---- return 1; } ! int _DEFUN(_stat,(path, sbuf), ! const char *path _AND ! struct stat *st) { ! asm("jsr @@0xca"); } ! ! int _DEFUN(_fstat,(file, st), ! int file _AND ! struct stat *st) { ! asm("jsr @@0xcb"); } int *** include/opcode/h8300.h.original Thu Nov 14 17:35:40 2002 --- include/opcode/h8300.h.modified Mon Dec 2 17:11:07 2002 *************** struct h8_opcode *** 305,310 **** --- 305,320 ---- #define O_STM 86 #define O_STMAC 87 #define O_LAST 88 + /* Change made for System Call processing. */ + #define O_SYS_CREAT 100 + #define O_SYS_OPEN 101 + #define O_SYS_READ 102 + #define O_SYS_WRITE 103 + #define O_SYS_LSEEK 104 + #define O_SYS_CLOSE 105 + #define O_SYS_STAT 106 + #define O_SYS_FSTAT 107 + /* End of System Call specific Changes. */ #define SB 0 #define SW 1 #define SL 2