Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: Sebastian Huber <sebastian.huber@embedded-brains.de>,
	gdb-patches@sourceware.org
Subject: Re: [PATCH 3/4] sim/mips: Deliver the reserved instruction exception
Date: Tue, 18 Aug 2026 11:18:40 +0100	[thread overview]
Message-ID: <87tsor20lb.fsf@redhat.com> (raw)
In-Reply-To: <20260816234357.278358-4-sebastian.huber@embedded-brains.de>

Sebastian Huber <sebastian.huber@embedded-brains.de> writes:

> The ReservedInstruction and CoProcessorUnusable cases of
> signal_exception() compute CAUSE, SR and EPC and set PC to the exception
> handler address, and then assign PC = EPC, which discards all of it.
> The client resumes on the faulting instruction rather than in its
> handler, so it raises the same exception again and never advances.  The
> address error cases immediately above deliberately do not do this and
> say so in a comment.
>
> The consequence is that a target which handles the exception never runs.
> A compiler emits rdhwr to read the thread pointer for every access to a
> thread-local object on every MIPS target, because the instruction exists
> since MIPS32r2 and the operating system is expected to emulate it where
> the processor lacks it.  The R3900 lacks it.
>
> Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>

Please remove the 'Signed-off-by' tag from all commits.  This tag has no
meaning for the GDB project, but might in the future.  Sorry I missed
giving this feedback on the earlier patches.

Otherwise:

Approved-By: Andrew Burgess <aburgess@redhat.com>

Thanks,
Andrew

> ---
>  sim/mips/interp.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/sim/mips/interp.c b/sim/mips/interp.c
> index a2757ec5ef7..5dbd1482b99 100644
> --- a/sim/mips/interp.c
> +++ b/sim/mips/interp.c
> @@ -1992,7 +1992,8 @@ signal_exception (SIM_DESC sd,
>  
>         case ReservedInstruction:
>         case CoProcessorUnusable:
> -	 PC = EPC;
> +	 /* Leave PC at the exception handler address.  This allows emulating
> +	    an instruction the CPU lacks.  */
>  	 sim_engine_halt (SD, CPU, NULL, PC,
>  			  sim_stopped, SIM_SIGILL);
>  
> -- 
> 2.51.0


  reply	other threads:[~2026-08-18 10:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-16 23:43 [PATCH 0/4] Fix some MIPS GDB simulator issues Sebastian Huber
2026-08-16 23:43 ` [PATCH 1/4] sim: Allow an overdue event to be descheduled Sebastian Huber
2026-08-18  9:59   ` Andrew Burgess
2026-08-16 23:43 ` [PATCH 2/4] sim/mips: Do not abort on a HI/LO hazard Sebastian Huber
2026-08-18 10:04   ` Andrew Burgess
2026-08-16 23:43 ` [PATCH 3/4] sim/mips: Deliver the reserved instruction exception Sebastian Huber
2026-08-18 10:18   ` Andrew Burgess [this message]
2026-08-16 23:43 ` [PATCH 4/4] sim/mips: Recognise a software interrupt request Sebastian Huber
2026-08-18 10:42   ` Andrew Burgess
2026-08-18 11:45     ` Sebastian Huber
2026-08-19  0:03     ` Maciej W. Rozycki
2026-08-19  0:27       ` Sebastian Huber
2026-08-19 13:17         ` Maciej W. Rozycki

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=87tsor20lb.fsf@redhat.com \
    --to=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=sebastian.huber@embedded-brains.de \
    /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