Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: gdb-patches@sourceware.org
Cc: "Steve Ellcey " <sellcey@mips.com>
Subject: Re: [patch, sim, mips] Implement unlink, lseek, and stat for MIPS
Date: Tue, 03 Sep 2013 06:14:00 -0000	[thread overview]
Message-ID: <201309030214.30844.vapier@gentoo.org> (raw)
In-Reply-To: <77654af0-7a94-479e-98f2-35691968037f@BAMAIL02.ba.imgtec.org>

[-- Attachment #1: Type: Text/Plain, Size: 1813 bytes --]

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 
common/syscall.c and common/callback.c files where a bunch of funcs are already 
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 = STATE_CALLBACK (sd);
	struct stat statbuf;
	int result;

	result = (*cb->stat) (cb, path, &statbuf);

you'll need to initialize cb->stat_map to a string (probably in 
sim_create_inferior).  see bfin/interp.c:cb_linux_stat_map_32 as an example.
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

      parent reply	other threads:[~2013-09-03  6:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-10 14:49 Steve Ellcey 
2013-07-24 23:19 ` Steve Ellcey
2013-08-07 21:48   ` Steve Ellcey
2013-09-03  6:14     ` Mike Frysinger
2013-09-03  6:14 ` Mike Frysinger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201309030214.30844.vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=gdb-patches@sourceware.org \
    --cc=sellcey@mips.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox