From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30209 invoked by alias); 24 Dec 2002 09:56:52 -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 30183 invoked from network); 24 Dec 2002 09:56:49 -0000 Received: from unknown (HELO mail.cs.umass.edu) (128.119.243.168) by 209.249.29.67 with SMTP; 24 Dec 2002 09:56:49 -0000 Received: from localhost (IDENT:PFTyJP6VXaldOddv+1FgSvUDuDF8UVb4@loki.cs.umass.edu [128.119.243.168]) by mail.cs.umass.edu (8.12.6/8.12.5) with ESMTP id gBO9twlU010388; Tue, 24 Dec 2002 04:55:58 -0500 Date: Tue, 24 Dec 2002 06:51:00 -0000 Message-Id: <20021224.045555.78725758.kazu@cs.umass.edu> To: dvenkat@noida.hcltech.com Cc: gdb-patches@sources.redhat.com, binutils@sources.redhat.com, newlib@sources.redhat.com Subject: Re: PATCH : H8300 Simulator File I/O Implementation From: Kazu Hirata In-Reply-To: References: Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Checked: This message probably not SPAM X-Spam-Score: -3.4, Required: 5 X-Spam-Tests: IN_REP_TO X-Spam-Report: SPAM: -3.4 hits, 5 required; SPAM: * -3.4 -- Found a In-Reply-To header X-Scanned-By: MIMEDefang 2.26 (www . roaringpenguin . com / mimedefang) X-SW-Source: 2002-12/txt/msg00663.txt.bz2 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 #include #include + #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