From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28171 invoked by alias); 3 Sep 2013 06:14:27 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 28112 invoked by uid 89); 3 Sep 2013 06:14:27 -0000 Received: from smtp.gentoo.org (HELO smtp.gentoo.org) (140.211.166.183) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Tue, 03 Sep 2013 06:14:27 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-7.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,KHOP_PGP_SIGNED,KHOP_THREADED autolearn=ham version=3.3.2 X-HELO: smtp.gentoo.org Received: from vapier.localnet (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 50F5633EABE; Tue, 3 Sep 2013 06:14:24 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: Re: [patch, sim, mips] Implement unlink, lseek, and stat for MIPS Date: Tue, 03 Sep 2013 06:14:00 -0000 User-Agent: KMail/1.13.7 (Linux/3.10.6; KDE/4.6.5; x86_64; ; ) Cc: "Steve Ellcey " References: <77654af0-7a94-479e-98f2-35691968037f@BAMAIL02.ba.imgtec.org> In-Reply-To: <77654af0-7a94-479e-98f2-35691968037f@BAMAIL02.ba.imgtec.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart9517881.mxLqSfQt4R"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <201309030214.30844.vapier@gentoo.org> X-IsSubscribed: yes X-SW-Source: 2013-09/txt/msg00055.txt.bz2 --nextPart9517881.mxLqSfQt4R Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-length: 1784 On Wednesday 10 July 2013 10:48:28 Steve Ellcey wrote: > A while back I submitted a GCC patch that allowed me to build the Fortran > compiler on a newlib based cross compiler. While using the GNU simulator > to test that, I found that a number of tests failed due to unimplemented > system calls on the MIPS GNU simulator. This patch implements unlink, > lseek, and stat in the GNU simulator for MIPS. There is a second small > patch that I sent to newlib that generates the necessary functions for > the simulator to see and intercept these functions like it does others > that are already implemented such as open and close. yeah, it'd be nice if mips could just use the already existing=20 common/syscall.c and common/callback.c files where a bunch of funcs are alr= eady=20 implemented ... > --- a/sim/mips/interp.c > +++ b/sim/mips/interp.c > > +/* We may need to swap stat data around before passing it on to the > + program being run. */ > +#define copy16(x) (BigEndianMem ? bswap_16(x) : (x)) > +#define copy32(x) (BigEndianMem ? bswap_32(x) : (x)) > + > + case 15: /* int stat(const char *path, struct stat *buf); */ > + { > + /* We need to put the data into the type of stat structure > + that MIPS uses and make sure it has the correct endianness. > + We are assuming that the host and MIPS agree on what the bits > + in st_mode mean. That appears to be true for x86 linux and > + MIPS. */ instead of doing this, can you use the existing stat cb handler instead ? host_callback *cb =3D STATE_CALLBACK (sd); struct stat statbuf; int result; result =3D (*cb->stat) (cb, path, &statbuf); you'll need to initialize cb->stat_map to a string (probably in=20 sim_create_inferior). see bfin/interp.c:cb_linux_stat_map_32 as an example. -mike --nextPart9517881.mxLqSfQt4R Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. Content-length: 836 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (GNU/Linux) iQIcBAABAgAGBQJSJX5GAAoJEEFjO5/oN/WB6oAQANpirV/Dz8c46QeO/52H075d DClEHortxdM7JWVsiXa1ca4HOW/POacM9YxTcUyhdbY7X6GaAVjrsFiysPeuDaVB vq/SKD92Wr1aGvu1C9b6ysyzicyVlQhGFyxTVnpGLZfC2UJGcRARJ7rd7STrbq4d UlBepP1mf3WP6gVNcn1hpbKqNv/kPV59f2sdNAWSAr+KFQwZFI1CkidJqUvYUOYb qz3xq0Rw9qzqLMuTGbTW6bj14JOtfZE940ZAa7NKS3wP8lUC8ORddS7X7hYsIMxR skZmZ1e2AFpFu21aHkDbxTzMcNy9tJbYooxoIAU69kScYIwL/lYPKaQI/38M7GQE Ojsc9B5vBsEjHLbJGyZmBUUfP721WpFFVFFXYdw5xHxQs808llXh6p42CchvqKFr oBaDUoFLm8Wp0n7DIUPdCL6BFO3IerBVy2wIONSaaPzspm950kDsiCz345HagO5Z 6OTALZXM1KyakOQ3h3OrBYbwdgaPGLnDPPl40k46YorT1uLPHoWnk4SZYloRNLmA rxwF2FcyZQvH0p+BhZDXmsgn2S6oWqwVbSow9nFifWSPhypoZRXhHJ9F408BNc04 2/XDKAhpRt6TVSV+mWUMUfLdsapP+piuUFK2F1xf5FHRPjvx93Sj9JN6ZjXqxujH McEIBDvpzW4sBdRGu/+Z =Lkj+ -----END PGP SIGNATURE----- --nextPart9517881.mxLqSfQt4R--