qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: Hesham ALMatary <heshamelmatary@gmail.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] openrisc: terminate qemu process upon receiving a halt signal.
Date: Fri, 03 Apr 2015 13:41:52 -0700	[thread overview]
Message-ID: <551EFB10.3000504@twiddle.net> (raw)
In-Reply-To: <1427993406-21323-1-git-send-email-heshamelmatary@gmail.com>

On 04/02/2015 09:50 AM, Hesham ALMatary wrote:
> or1ksim simulator currently handles "l.nop 0xC" instruction as
> a halt signal. Do the same for QEMU.
> 
> Signed-off-by: Hesham ALMatary  <heshamelmatary@gmail.com>
> ---
>  target-openrisc/translate.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/target-openrisc/translate.c b/target-openrisc/translate.c
> index dc76789..5fa8ede 100644
> --- a/target-openrisc/translate.c
> +++ b/target-openrisc/translate.c
> @@ -750,6 +750,11 @@ static void dec_misc(DisasContext *dc, uint32_t insn)
>          switch (op1) {
>          case 0x01:    /* l.nop */
>              LOG_DIS("l.nop %d\n", I16);
> +
> +            if(I16 == 0xC) {
> +                exit(0);
> +            }
> +

Ug.  IMO l.nop was a poor choice; l.trap would have been better.
But whatever...

Further:

 (1) This is translation time, not execution time.  You can't do
     the exit here, only when the instruction is executed.

 (2) This, and the other 10 things hidden under l_nop are
     similar to the "-semihosting" switch available for arm,
     lm32, m68k, and xtensa.

     Although semihosting is typically even more complex,
     generally implementing the exit/read/write/open/close/lseek/stat
     families of syscalls.


r~

  reply	other threads:[~2015-04-03 20:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-02 16:50 [Qemu-devel] [PATCH] openrisc: terminate qemu process upon receiving a halt signal Hesham ALMatary
2015-04-03 20:41 ` Richard Henderson [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-04-02 16:13 Hesham ALMatary

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=551EFB10.3000504@twiddle.net \
    --to=rth@twiddle.net \
    --cc=heshamelmatary@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /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;
as well as URLs for NNTP newsgroup(s).