PATCH : H8300 Simulator File I/O Implementation
Kazu Hirata
kazu@cs.umass.edu
Tue Dec 24 01:56:00 GMT 2002
Hi Venky,
> I had submitted a patch for providing File I/O Support for
> H8300 simulator. The message link is:
>
> http://sources.redhat.com/ml/gdb-patches/2002-12/msg00013.html
>
> Could you point out if this patch is acceptable, or are there
> still some inconsistencies to be fixed. I would be willing to
> do any further changes required.
Not being the maintainer of the h8300 port other than in gcc...
I would split the gdb part of your patch into the opcodes part and the
rest because opcodes is part of binutils.
I am guessing that you probably don't need to change the order of
functions in newlib/libc/sys/h8300hms/syscalls.c. You might want to
submit a patch with few or no formatting changes to make your real
changes exposed. See the attached patch below. Also, please use
"asm (...)" instead of "asm(...)".
For the gdb part, I would run 'indent' to see what it recommends. One
thing it suggests should be to change
! filename = (char *)malloc(sizeof(char) * len);
to something like
! filename = (char *) malloc (sizeof (char) * len);
Some variables seem to be unused.
! case O (O_SYS_FSTAT, SB):
:
:
! int i = 0; /* Loop Counter */
! int j = 0; /* Temporary variable for Position in source */
! int short_size = sizeof (short); /* Sizeof short */
! int int_size = sizeof (int); /* Sizeof int */
Here i, j, short_size, and int_size seem to be unused.
! case O (O_SYS_STAT, SB):
:
:
! int j = 0; /* Temporary variable for Position in source */
! int short_size = sizeof (short); /* Sizeof short */
! int int_size = sizeof (int); /* Sizeof int */
Here j, short_size, and int_size seem to be unused.
Meanwhile, I'll try to run the simulator with your patch. Thanks!
Kazu Hirata
Index: syscalls.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/sys/h8300hms/syscalls.c,v
retrieving revision 1.3
diff -c -r1.3 syscalls.c
*** syscalls.c 17 May 2002 20:13:38 -0000 1.3
--- syscalls.c 16 Dec 2002 23:32:08 -0000
***************
*** 4,9 ****
--- 4,10 ----
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
+ #include "sys/syscall.h"
int _DEFUN(_lseek,(file, ptr, dir),
***************
*** 11,23 ****
int ptr _AND
int dir)
{
! return 0;
}
int _DEFUN(_close,(file),
int file)
{
! return -1;
}
int isatty(file)
--- 12,24 ----
int ptr _AND
int dir)
{
! asm ("jsr @@0xc8");
}
int _DEFUN(_close,(file),
int file)
{
! asm ("jsr @@0xc9");
}
int isatty(file)
***************
*** 26,37 ****
return 1;
}
int _DEFUN(_fstat,(file, st),
int file _AND
struct stat *st)
{
! st->st_mode = S_IFCHR;
! return 0;
}
int
--- 27,45 ----
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
***************
*** 39,45 ****
const char *path;
int flags;
{
! return 0;
}
int
--- 47,53 ----
const char *path;
int flags;
{
! asm ("jsr @@0xc5");
}
int
More information about the Newlib
mailing list