Re: git: 8398d52d6541 - main - arm: print out the undefined instruction upon an undefined instruction panic

From: Jessica Clarke <jrtc27_at_freebsd.org>
Date: Mon, 18 Oct 2021 20:14:24 UTC
On 18 Oct 2021, at 20:19, Adrian Chadd <adrian@FreeBSD.org> wrote:
> 
> The branch main has been updated by adrian:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=8398d52d6541d316fcd88c856b5a72bb9cce0534
> 
> commit 8398d52d6541d316fcd88c856b5a72bb9cce0534
> Author:     Adrian Chadd <adrian@FreeBSD.org>
> AuthorDate: 2021-10-16 03:15:15 +0000
> Commit:     Adrian Chadd <adrian@FreeBSD.org>
> CommitDate: 2021-10-18 19:18:52 +0000
> 
>    arm: print out the undefined instruction upon an undefined instruction panic
> 
>    It's SUPER useful to be able to see the actual undefined instruction
>    when we hit said undefined instruction.
> ---
> sys/arm/arm/undefined.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/sys/arm/arm/undefined.c b/sys/arm/arm/undefined.c
> index ef9e72c89163..4e9a5295d338 100644
> --- a/sys/arm/arm/undefined.c
> +++ b/sys/arm/arm/undefined.c
> @@ -341,7 +341,8 @@ undefinedinstruction(struct trapframe *frame)
> 			return;
> 		}
> 		else
> -			panic("Undefined instruction in kernel.\n");
> +			panic("Undefined instruction in kernel (0x%08x).\n",
> +			    fault_instruction);

As I said in the review, printing this without the PSR_T bit in SPSR
isn’t all that helpful, you can’t decode it without knowing what SPSR
is (though you may be able to guess by seeing whether one decoding is
total junk and the other might plausibly trap).

Jess