From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13466 invoked by alias); 3 Jan 2003 08:30:16 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 13435 invoked from network); 3 Jan 2003 08:30:07 -0000 Received: from unknown (HELO ngate.noida.hcltech.com) (202.54.110.230) by 209.249.29.67 with SMTP; 3 Jan 2003 08:30:07 -0000 Received: from exch-01.noida.hcltech.com (exch-01 [204.160.254.29]) by ngate.noida.hcltech.com (8.9.3/8.9.3) with ESMTP id NAA06196; Fri, 3 Jan 2003 13:55:15 +0530 Received: by exch-01.noida.hcltech.com with Internet Mail Service (5.5.2656.59) id ; Fri, 3 Jan 2003 13:54:17 +0530 Message-ID: From: "D.Venkatasubramanian, Noida" To: "'Kazu Hirata'" , "'gdb-patches@sources.redhat.com'" , "'newlib@sources.redhat.com'" Cc: "D.Venkatasubramanian, Noida" Subject: RE: PATCH : H8300 Simulator File I/O Implementation Date: Fri, 03 Jan 2003 08:30:00 -0000 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----_=_NextPart_000_01C2B301.7F34EF70" X-SW-Source: 2003-01/txt/msg00054.txt.bz2 This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_000_01C2B301.7F34EF70 Content-Type: text/plain; charset="iso-8859-1" Content-length: 1706 Hi All, Based on my earlier mail: http://sources.redhat.com/ml/gdb-patches/2002-12/msg00760.html and subsequent ideas and suggestions from Kazu Hirata, I am submitting the modified patches. Changes: 1) Comments included in each .S file. 2) An include directive which had unintentionally crept in last time has been removed. 3) A commented C statement in my earlier patch removed in simulator patch. Regards, Venky 2003-01-03 D.Venkatasubramanian * compile.c (decode): Added code for some more magic traps. * compile.c (sim_resume): Added support for File I/O system calls through callback to host_system. System calls provided support for : open, read, write, lseek, close, stat, fstat Only basic support for stat and fstat. 2003-01-03 D.Venkatasubramanian * /libc/sys/h8300hms/syscalls.c: Removed functions _open, _lseek, _close, _stat, _fstat. * /libc/sys/h8300hms/read.c: Removed. * /libc/sys/h8300hms/write.c: Removed. * /libc/sys/h8300hms/open.S: Hand coded assembly for implementing _open removed from syscalls.c. * /libc/sys/h8300hms/read.S: Hand coded assembly for implementing _open removed from read.c. * /libc/sys/h8300hms/write.S: Hand coded assembly for implementing _open removed from write.c. * /libc/sys/h8300hms/lseek.S: Hand coded assembly for implementing _open removed from syscalls.c. * /libc/sys/h8300hms/close.S: Hand coded assembly for implementing _open removed from syscalls.c. * /libc/sys/h8300hms/fstat.S: Hand coded assembly for implementing _open removed from syscalls.c. * /libc/sys/h8300hms/stat.S: Hand coded assembly for implementing _open removed from syscalls.c. ------_=_NextPart_000_01C2B301.7F34EF70 Content-Type: text/plain; name="ChangeLog.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="ChangeLog.txt" Content-length: 1296 2003-01-03 D.Venkatasubramanian * compile.c (decode): Added code for some more magic traps. * compile.c (sim_resume): Added support for File I/O system calls through callback to host_system. System calls provided support for : open, read, write, lseek, close, stat, fstat Only basic support for stat and fstat. 2003-01-03 D.Venkatasubramanian * /libc/sys/h8300hms/syscalls.c: Removed functions _open,=20 _lseek, _close, _stat, _fstat. * /libc/sys/h8300hms/read.c: Removed. * /libc/sys/h8300hms/write.c: Removed. * /libc/sys/h8300hms/open.S: Hand coded assembly for=20 implementing _open removed from syscalls.c. * /libc/sys/h8300hms/read.S: Hand coded assembly for=20 implementing _open removed from read.c. * /libc/sys/h8300hms/write.S: Hand coded assembly for=20 implementing _open removed from write.c. * /libc/sys/h8300hms/lseek.S: Hand coded assembly for=20 implementing _open removed from syscalls.c. * /libc/sys/h8300hms/close.S: Hand coded assembly for=20 implementing _open removed from syscalls.c. * /libc/sys/h8300hms/fstat.S: Hand coded assembly for=20 implementing _open removed from syscalls.c. * /libc/sys/h8300hms/stat.S: Hand coded assembly for=20 implementing _open removed from syscalls.c. ------_=_NextPart_000_01C2B301.7F34EF70 Content-Type: application/octet-stream; name="close.S" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="close.S" Content-length: 412 ;int close(int fd);=0A= ;Integer arguments have to be zero extended.=0A= =0A= #if defined(__H8300H__)=0A= .h8300h=0A= #endif=0A= #if defined(__H8300S__)=0A= .h8300s=0A= #endif=0A= =0A= .section .text=0A= .align 2=0A= .global __close=0A= __close:=0A= #if defined(__H8300H__) || defined(__H8300S__)=0A= #if __INT_MAX__ =3D=3D 32767=0A= extu.l er0=0A= #endif=0A= #endif=0A= jsr @@0xc9=0A= rts=0A= .end=0A= ------_=_NextPart_000_01C2B301.7F34EF70 Content-Type: application/octet-stream; name="fstat.S" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="fstat.S" Content-length: 467 ;int fstat(int filedes, struct stat *buf);=0A= ;Integer arguments have to be zero extended.=0A= =0A= #if defined(__H8300H__)=0A= .h8300h=0A= #endif=0A= #if defined(__H8300S__)=0A= .h8300s=0A= #endif=0A= =0A= .section .text=0A= .align 2=0A= .global __fstat=0A= __fstat:=0A= #if defined(__H8300H__) || defined(__H8300S__)=0A= #if __INT_MAX__ =3D=3D 32767=0A= extu.l er0=0A= #endif=0A= #endif=0A= jsr @@0xcb=0A= rts=0A= .end=0A= =09=09=09=09=09=09=09=09=09=0A= ------_=_NextPart_000_01C2B301.7F34EF70 Content-Type: application/octet-stream; name="lseek.S" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="lseek.S" Content-length: 460 ;off_t lseek(int fildes, off_t offset, int whence);=0A= ;Integer arguments have to be zero extended.=0A= =0A= #if defined(__H8300H__)=0A= .h8300h=0A= #endif=0A= #if defined(__H8300S__)=0A= .h8300s=0A= #endif=0A= =0A= .section .text=0A= .align 2=0A= .global __lseek=0A= __lseek:=0A= #if defined(__H8300H__) || defined(__H8300S__)=0A= #if __INT_MAX__ =3D=3D 32767=0A= extu.l er0=0A= extu.l er2=0A= #endif=0A= #endif=0A= jsr @@0xc8=0A= rts=0A= .end=0A= ------_=_NextPart_000_01C2B301.7F34EF70 Content-Type: text/plain; name="newlib_patch.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="newlib_patch.txt" Content-length: 2297 *** newlib/libc/sys/h8300hms/syscalls.c.original Sat Dec 28 16:37:10 2002 --- newlib/libc/sys/h8300hms/syscalls.c.modified Fri Jan 3 11:10:01 2003 *************** *** 1,47 **** /* Operating system stubs, set up for the MRI simulator */ =20=20 #include <_ansi.h> - #include - #include #include =20=20 -=20 - int _DEFUN(_lseek,(file, ptr, dir), - int file _AND - int ptr _AND - int dir) - { - return 0; - } -=20 - int _DEFUN(_close,(file), - int file) - { - return -1; - } -=20 int isatty(file) int file; { return 1; } =20=20 - int _DEFUN(_fstat,(file, st), - int file _AND - struct stat *st) - { - st->st_mode =3D S_IFCHR; - return 0; - } -=20 - int - _open (path, flags) - const char *path; - int flags; - { - return 0; - } -=20 int _unlink (path) const char *path; --- 1,14 ---- *** newlib/libc/sys/h8300hms/Makefile.in.original Mon Dec 30 16:07:12 2002 --- newlib/libc/sys/h8300hms/Makefile.in.modified Tue Dec 31 14:29:23 2002 *************** INCLUDES =3D $(NEWLIB_CFLAGS) $(CROSS_CFLA *** 89,95 **** =20=20 noinst_LIBRARIES =3D lib.a =20=20 ! lib_a_SOURCES =3D syscalls.c write.c _exit.c read.s sbrk.c misc.c crt1.c =20=20 ACLOCAL_AMFLAGS =3D -I ../../.. CONFIG_STATUS_DEPENDENCIES =3D $(newlib_basedir)/configure.host --- 89,96 ---- =20=20 noinst_LIBRARIES =3D lib.a =20=20 ! lib_a_SOURCES =3D syscalls.c open.s read.s write.s lseek.s close.s stat.s= \ ! fstat.s _exit.c sbrk.c misc.c crt1.c =20=20 ACLOCAL_AMFLAGS =3D -I ../../.. CONFIG_STATUS_DEPENDENCIES =3D $(newlib_basedir)/configure.host *************** DEFS =3D @DEFS@ -I. -I$(srcdir)=20 *** 103,109 **** CPPFLAGS =3D @CPPFLAGS@ LIBS =3D @LIBS@ lib_a_LIBADD =3D=20 ! lib_a_OBJECTS =3D syscalls.o write.o _exit.o read.o sbrk.o misc.o crt1.o CFLAGS =3D @CFLAGS@ COMPILE =3D $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFL= AGS) $(CFLAGS) CCLD =3D $(CC) --- 104,111 ---- CPPFLAGS =3D @CPPFLAGS@ LIBS =3D @LIBS@ lib_a_LIBADD =3D=20 ! lib_a_OBJECTS =3D syscalls.o open.o read.o write.o lseek.o close.o stat.o= \ ! fstat.o _exit.o sbrk.o misc.o crt1.o CFLAGS =3D @CFLAGS@ COMPILE =3D $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFL= AGS) $(CFLAGS) CCLD =3D $(CC) ------_=_NextPart_000_01C2B301.7F34EF70 Content-Type: application/octet-stream; name="open.S" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="open.S" Content-length: 403 ;int open(const char *pathname, int flags);=0A= ;Integer arguments have to be zero extended.=0A= ;The second argument is taken from the stack,=0A= ;hence it is not zero extended here.=0A= =0A= #if defined(__H8300H__)=0A= .h8300h=0A= #endif=0A= #if defined(__H8300S__)=0A= .h8300s=0A= #endif=0A= =0A= .section .text=0A= .align 2=0A= .global __open=0A= __open:=0A= jsr @@0xc5=0A= rts=0A= .end=0A= ------_=_NextPart_000_01C2B301.7F34EF70 Content-Type: application/octet-stream; name="read.S" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="read.S" Content-length: 471 ;ssize_t read(int fd, void *buf, size_t count);=0A= ;Integer arguments have to be zero extended.=0A= =0A= #if defined(__H8300H__)=0A= .h8300h=0A= #endif=0A= #if defined(__H8300S__)=0A= .h8300s=0A= #endif=0A= =0A= .section .text=0A= .align 2=0A= .global __read=0A= __read:=0A= #if defined(__H8300H__) || defined(__H8300S__)=0A= #if __INT_MAX__ =3D=3D 32767=0A= extu.l er0=0A= #endif=0A= #endif=0A= jsr @@0xc6=0A= rts=0A= .end=0A= =09=09=09=09=09=09=09=09=09=0A= ------_=_NextPart_000_01C2B301.7F34EF70 Content-Type: text/plain; name="simulator_patch.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="simulator_patch.txt" Content-length: 11394 *** sim/h8300/compile.c.original Thu Dec 26 17:15:41 2002 --- sim/h8300/compile.c.modified Fri Jan 3 11:07:21 2003 *************** *** 35,40 **** --- 35,42 ---- #include "gdb/callback.h" #include "gdb/remote-sim.h" #include "gdb/sim-h8300.h" + #include "sys/stat.h" + #include "sys/types.h" =20=20 #ifndef SIGTRAP # define SIGTRAP 5 *************** decode (addr, data, dst) *** 452,461 **** =20=20 if (dst->opcode =3D=3D O (O_JSR, SB)) { ! if (dst->src.literal =3D=3D 0xc4) { ! dst->opcode =3D O (O_SYSCALL, SB); } } =20=20 dst->next_pc =3D addr + len / 2; --- 454,484 ---- =20=20 if (dst->opcode =3D=3D O (O_JSR, SB)) { ! switch (dst->src.literal) { ! case 0xc5: ! dst->opcode =3D O (O_SYS_OPEN, SB); ! break; ! case 0xc6: ! dst->opcode =3D O (O_SYS_READ, SB); ! break; ! case 0xc7: ! dst->opcode =3D O (O_SYS_WRITE, SB); ! break; ! case 0xc8: ! dst->opcode =3D O (O_SYS_LSEEK, SB); ! break; ! case 0xc9: ! dst->opcode =3D O (O_SYS_CLOSE, SB); ! break; ! case 0xca: ! dst->opcode =3D O (O_SYS_STAT, SB); ! break; ! case 0xcb: ! dst->opcode =3D O (O_SYS_FSTAT, SB); ! break; } + /* End of Processing for system calls. */ } =20=20 dst->next_pc =3D addr + len / 2; *************** sim_resume (sd, step, siggnal) *** 1392,1403 **** goto condtrue; goto next; =20=20 ! case O (O_SYSCALL, SB): { ! char c =3D cpu.regs[2]; ! sim_callback->write_stdout (sim_callback, &c, 1); } goto next; =20=20 ONOT (O_NOT, rd =3D ~rd; v =3D 0;); OSHIFTS (O_SHLL, --- 1415,1703 ---- goto condtrue; goto next; =20=20 ! /* System call processing starts. */ ! case O (O_SYS_OPEN, SB): { ! int len =3D 0; /* Length of filename. */ ! char *filename; /* Filename would go here. */ ! char temp_char; /* Temporary character */ ! int mode =3D 0; /* Mode bits for the file. */ ! int open_return; /* Return value of open, file descriptor. */ ! int i; /* Loop counter */ ! int filename_ptr; /* Pointer to filename in cpu memory. */ !=20 ! /* Setting filename_ptr to first argument of open. */ ! filename_ptr =3D h8300hmode ? GET_L_REG (0) : GET_W_REG (0); !=20 ! /* Trying to get mode. */ ! if (h8300hmode || h8300smode) ! { ! mode =3D GET_MEMORY_L (cpu.regs[7] + 4); ! } ! else ! { ! mode =3D GET_MEMORY_W (cpu.regs[7] + 2); ! } !=20 ! /* Trying to find the length of the filename. */ ! temp_char =3D GET_MEMORY_B (cpu.regs[0]); !=20 ! len =3D 1; ! while (temp_char !=3D '\0') ! { ! temp_char =3D GET_MEMORY_B (filename_ptr + len); ! len++; ! } !=20 ! /* Allocating space for the filename. */ ! filename =3D (char *) malloc (sizeof (char) * len); !=20 ! /* String copying the filename from memory. */ ! for (i =3D 0; i < len; i++) ! { ! temp_char =3D GET_MEMORY_B (filename_ptr + i); ! filename[i] =3D temp_char; ! } !=20 ! /* Callback to open and return the file descriptor. */ ! open_return =3D sim_callback->open (sim_callback, filename, mode); !=20 ! /* Return value in register 0. */ ! cpu.regs[0] =3D open_return; !=20 ! /* Freeing memory used for filename. */ ! free (filename); ! } ! goto next; !=20 ! case O (O_SYS_READ, SB): ! { ! char *char_ptr; /* Where characters read would be stored. */ ! int fd; /* File descriptor */ ! int buf_size; /* BUF_SIZE parameter in read. */ ! int i =3D 0; /* Temporary Loop counter */ ! int read_return =3D 0; /* Return value from callback to ! read. */ !=20 ! fd =3D h8300hmode ? GET_L_REG (0) : GET_W_REG (0); ! buf_size =3D h8300hmode ? GET_L_REG (2) : GET_W_REG (2); !=20 ! char_ptr =3D (char *) malloc (sizeof (char) * buf_size); !=20 ! /* Callback to read and return the no. of characters read. */ ! read_return =3D ! sim_callback->read (sim_callback, fd, char_ptr, buf_size); !=20 ! /* The characters read are stored in cpu memory. */ ! for (i =3D 0; i < buf_size; i++) ! { ! SET_MEMORY_B ((cpu.regs[1] + (sizeof (char) * i)), ! *(char_ptr + (sizeof (char) * i))); ! } !=20 ! /* Return value in Register 0. */ ! cpu.regs[0] =3D read_return; !=20 ! /* Freeing memory used as buffer. */ ! free (char_ptr); ! } ! goto next; !=20 ! case O (O_SYS_WRITE, SB): ! { ! int fd; /* File descriptor */ ! char temp_char; /* Temporary character */ ! int len; /* Length of write, Parameter II to write. */ ! int char_ptr; /* Character Pointer, Parameter I of write. */ ! char *ptr; /* Where characters to be written are stored.=20 ! */ ! int write_return; /* Return value from callback to write. */ ! int i =3D 0; /* Loop counter */ !=20 ! fd =3D h8300hmode ? GET_L_REG (0) : GET_W_REG (0); ! char_ptr =3D h8300hmode ? GET_L_REG (1) : GET_W_REG (1); ! len =3D h8300hmode ? GET_L_REG (2) : GET_W_REG (2); !=20 ! /* Allocating space for the characters to be written. */ ! ptr =3D (char *) malloc (sizeof (char) * len); !=20 ! /* Fetching the characters from cpu memory. */ ! for (i =3D 0; i < len; i++) ! { ! temp_char =3D GET_MEMORY_B (char_ptr + i); ! ptr[i] =3D temp_char; ! } !=20 ! /* Callback write and return the no. of characters written. */ ! write_return =3D sim_callback->write (sim_callback, fd, ptr, len); !=20 ! /* Return value in Register 0. */ ! cpu.regs[0] =3D write_return; !=20 ! /* Freeing memory used as buffer. */ ! free (ptr); ! } ! goto next; !=20 ! case O (O_SYS_LSEEK, SB): ! { ! int fd; /* File descriptor */ ! int offset; /* Offset */ ! int origin; /* Origin */ ! int lseek_return; /* Return value from callback to lseek. */ !=20 ! fd =3D h8300hmode ? GET_L_REG (0) : GET_W_REG (0); ! offset =3D h8300hmode ? GET_L_REG (1) : GET_W_REG (1); ! origin =3D h8300hmode ? GET_L_REG (2) : GET_W_REG (2); !=20 ! /* Callback lseek and return offset. */ ! lseek_return =3D ! sim_callback->lseek (sim_callback, fd, offset, origin); !=20 ! /* Return value in register 0. */ ! cpu.regs[0] =3D lseek_return; ! } ! goto next; !=20 ! case O (O_SYS_CLOSE, SB): ! { ! int fd; /* File descriptor */ ! int close_return; /* Return value from callback to close. */ !=20 ! fd =3D h8300hmode ? GET_L_REG (0) : GET_W_REG (0); !=20 ! /* Callback close and return. */ ! close_return =3D sim_callback->close (sim_callback, fd); !=20 ! /* Return value in register 0. */ ! cpu.regs[0] =3D close_return; ! } ! goto next; !=20 ! case O (O_SYS_FSTAT, SB): ! { ! int fd; /* File descriptor */ ! struct stat stat_rec; /* Stat record */ ! int fstat_return; /* Return value from callback to stat. */ ! int stat_ptr; /* Pointer to stat record. */ ! char *temp_stat_ptr; /* Temporary stat_rec pointer. */ !=20 ! fd =3D h8300hmode ? GET_L_REG (0) : GET_W_REG (0); !=20 ! /* Setting stat_ptr to second argument of stat. */ ! stat_ptr =3D h8300hmode ? GET_L_REG (1) : GET_W_REG (1); !=20 ! /* Callback stat and return. */ ! fstat_return =3D sim_callback->fstat (sim_callback, fd, &stat_rec); !=20 ! /* Have stat_ptr point to starting of stat_rec. */ ! temp_stat_ptr =3D (char *) (&stat_rec); !=20 ! /* Setting up the stat structure returned. */ ! SET_MEMORY_W (stat_ptr, stat_rec.st_dev); ! stat_ptr +=3D 2; ! SET_MEMORY_W (stat_ptr, stat_rec.st_ino); ! stat_ptr +=3D 2; ! SET_MEMORY_L (stat_ptr, stat_rec.st_mode); ! stat_ptr +=3D 4; ! SET_MEMORY_W (stat_ptr, stat_rec.st_nlink); ! stat_ptr +=3D 2; ! SET_MEMORY_W (stat_ptr, stat_rec.st_uid); ! stat_ptr +=3D 2; ! SET_MEMORY_W (stat_ptr, stat_rec.st_gid); ! stat_ptr +=3D 2; ! SET_MEMORY_W (stat_ptr, stat_rec.st_rdev); ! stat_ptr +=3D 2; ! SET_MEMORY_L (stat_ptr, stat_rec.st_size); ! stat_ptr +=3D 4; ! SET_MEMORY_L (stat_ptr, stat_rec.st_atime); ! stat_ptr +=3D 8; ! SET_MEMORY_L (stat_ptr, stat_rec.st_mtime); ! stat_ptr +=3D 8; ! SET_MEMORY_L (stat_ptr, stat_rec.st_ctime); !=20 ! /* Return value in register 0. */ ! cpu.regs[0] =3D fstat_return; ! } ! goto next; !=20 ! case O (O_SYS_STAT, SB): ! { ! int len =3D 0; /* Length of filename. */ ! char *filename; /* Filename would go here. */ ! char temp_char; /* Temporary character */ ! int filename_ptr; /* Pointer to filename in cpu memory. */ ! struct stat stat_rec; /* Stat record */ ! int stat_return; /* Return value from callback to stat */ ! int stat_ptr; /* Pointer to stat record. */ ! char *temp_stat_ptr; /* Temporary stat_rec pointer. */ ! int i =3D 0; /* Loop Counter */ !=20 ! /* Setting filename_ptr to first argument of open. */ ! filename_ptr =3D h8300hmode ? GET_L_REG (0) : GET_W_REG (0); !=20 ! /* Trying to find the length of the filename. */ ! temp_char =3D GET_MEMORY_B (cpu.regs[0]); !=20 ! len =3D 1; ! while (temp_char !=3D '\0') ! { ! temp_char =3D GET_MEMORY_B (filename_ptr + len); ! len++; ! } !=20 ! /* Allocating space for the filename. */ ! filename =3D (char *) malloc (sizeof (char) * len); !=20 ! /* String copying the filename from memory. */ ! for (i =3D 0; i < len; i++) ! { ! temp_char =3D GET_MEMORY_B (filename_ptr + i); ! filename[i] =3D temp_char; ! } !=20 ! /* Setting stat_ptr to second argument of stat. */ ! /* stat_ptr =3D cpu.regs[1]; */ ! stat_ptr =3D h8300hmode ? GET_L_REG (1) : GET_W_REG (1); !=20 ! /* Callback stat and return. */ ! stat_return =3D ! sim_callback->stat (sim_callback, filename, &stat_rec); !=20 ! /* Have stat_ptr point to starting of stat_rec. */ ! temp_stat_ptr =3D (char *) (&stat_rec); !=20 ! /* Freeing memory used for filename. */ ! free (filename); !=20 ! /* Setting up the stat structure returned. */ ! SET_MEMORY_W (stat_ptr, stat_rec.st_dev); ! stat_ptr +=3D 2; ! SET_MEMORY_W (stat_ptr, stat_rec.st_ino); ! stat_ptr +=3D 2; ! SET_MEMORY_L (stat_ptr, stat_rec.st_mode); ! stat_ptr +=3D 4; ! SET_MEMORY_W (stat_ptr, stat_rec.st_nlink); ! stat_ptr +=3D 2; ! SET_MEMORY_W (stat_ptr, stat_rec.st_uid); ! stat_ptr +=3D 2; ! SET_MEMORY_W (stat_ptr, stat_rec.st_gid); ! stat_ptr +=3D 2; ! SET_MEMORY_W (stat_ptr, stat_rec.st_rdev); ! stat_ptr +=3D 2; ! SET_MEMORY_L (stat_ptr, stat_rec.st_size); ! stat_ptr +=3D 4; ! SET_MEMORY_L (stat_ptr, stat_rec.st_atime); ! stat_ptr +=3D 8; ! SET_MEMORY_L (stat_ptr, stat_rec.st_mtime); ! stat_ptr +=3D 8; ! SET_MEMORY_L (stat_ptr, stat_rec.st_ctime); !=20 ! /* Return value in register 0. */ ! cpu.regs[0] =3D stat_return; } goto next; + /* End of system call processing. */ =20=20 ONOT (O_NOT, rd =3D ~rd; v =3D 0;); OSHIFTS (O_SHLL, ------_=_NextPart_000_01C2B301.7F34EF70 Content-Type: application/octet-stream; name="stat.S" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="stat.S" Content-length: 303 ;int stat(const char *file_name, struct stat *buf);=0A= =0A= #if defined(__H8300H__)=0A= .h8300h=0A= #endif=0A= #if defined(__H8300S__)=0A= .h8300s=0A= #endif=0A= =0A= .section .text=0A= .align 2=0A= .global __stat=0A= __stat:=0A= jsr @@0xca=0A= rts=0A= .end=0A= =09=09=09=09=09=09=09=09=09=0A= ------_=_NextPart_000_01C2B301.7F34EF70 Content-Type: application/octet-stream; name="write.S" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="write.S" Content-length: 452 ;ssize_t write(int fd, const void *buf, size_t count);=0A= ;Integer arguments have to be zero extended.=0A= =0A= #if defined(__H8300H__)=0A= .h8300h=0A= #endif=0A= =0A= #if defined(__H8300S__)=0A= .h8300s=0A= #endif=0A= =0A= .section .text=0A= .align 2=0A= .global __write=0A= __write:=0A= #if defined(__H8300H__) || defined(__H8300S__)=0A= #if __INT_MAX__ =3D=3D 32767=0A= extu.l er0=0A= #endif=0A= #endif=0A= jsr @@0xc7=0A= rts=0A= .end=0A= ------_=_NextPart_000_01C2B301.7F34EF70--