Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Doug Evans <dje@transmeta.com>
To: Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com>
Cc: Andrew Cagney <ac131313@redhat.com>, gdb-patches@sources.redhat.com
Subject: Re: [PATCH] fix trap in parallel for m32r-sim
Date: Mon, 19 Jan 2004 23:05:00 -0000	[thread overview]
Message-ID: <16396.25248.771893.16597@claire.transmeta.com> (raw)
In-Reply-To: <002401c3de56$6dcfe240$2569910a@tool.maec.co.jp>

Kazuhiro Inaoka writes:
 > Hi Doug,
 > 
 > I want to fix the following problem.
 > 
 > test pattern is:
 > main()
 > {
 >   asm("trap #0 || ldi r0,#1"); /* the same as exit() ? */
 > 
 >   abort();
 > }

Ah hah!  So this is about TRAP_SYSCALL. :-)
TRAP_SYSCALL is a simulator-only facility to simplify printf,exit,etc.

I gather you want r0 to be 1 before the trap is taken,
violating standard parallel execution semantics: all inputs
read before any outputs written.
i.e. you want the trap to _read_ the value of r0 and get 1.
This is different than the violation I refered to previously
where the trap will _write_ the value of r0, say, before
other insns have read their inputs.

It seems like you're trying to fix a broken program by breaking
(or at least hacking) the simulator.  How about instead just having
a rule that says the TRAP_SYSCALL trap cannot be paired with instructions
that set up inputs for the syscall?  This would be no different
than trying to make

    asm ("add r1,r0 || ldi r0,#1"); // increment r1 by 1

work.  It doesn't work because the `add' will read the value of r0
before the ldi has set it to 1.
[apologies if I got the syntax wrong, haven't programmed m32r
assembler in a while :-)]

 > command line:
 > m32r-elf-gcc -m32rx test.c
 > 
 > In this case, it will pass through an asm function without exit.
 > At the time of m32r_trap() execution, r0 is not 1 yet.
 > It's not a problem of the current simulator implementation for trap
 > instruction.
 > I think it's a problem of timing to call back system call when trap is in
 > parallel.
 > 
 > Changed a patch and comment.
 > 
 > Regards,
 > 
 > Kazuhiro Inaoka
 > 
 > sim/m32r/ChangeLog
 > 
 > 2004-01-19  Kazuhiro Inaoka < inaoka dot kazuhiro at renesas dot com >
 > 
 >  * mloopx.in (xextract-pbb): Fixed trap for system calls operation
 >  in parallel.
 >  * mloop2.in (xextract-pbb): Ditto.


  reply	other threads:[~2004-01-19 23:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-16  3:26 Kazuhiro Inaoka
2004-01-16  3:43 ` Doug Evans
2004-01-16  5:56   ` Kazuhiro Inaoka
2004-01-16 21:11     ` Doug Evans
2004-01-19  6:29       ` Kazuhiro Inaoka
2004-01-19 23:05         ` Doug Evans [this message]
2004-01-20  4:57           ` Kazuhiro Inaoka
2004-01-27  3:53         ` Andrew Cagney

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=16396.25248.771893.16597@claire.transmeta.com \
    --to=dje@transmeta.com \
    --cc=ac131313@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=inaoka.kazuhiro@renesas.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