[v6,1/2] sim: riscv: Fix crash during instruction decoding
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_build--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-arm |
success
|
Testing passed
|
Commit Message
From: Jaydeep Patil <jaydeep.patil@imgtec.com>
The match_never() function has been removed and thus step_once() crashes
during instruction decoding. Fixed it by checking for null pointer before
invoking function attached to match_func member of riscv_opcode structure
---
sim/riscv/sim-main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
<jaydeep.patil@imgtec.com> writes:
> From: Jaydeep Patil <jaydeep.patil@imgtec.com>
>
> The match_never() function has been removed and thus step_once() crashes
> during instruction decoding. Fixed it by checking for null pointer before
> invoking function attached to match_func member of riscv_opcode structure
> ---
> sim/riscv/sim-main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Thank you for continuing to work on these patches.
For patch 1/2:
Approved-By: Andrew Burgess <aburgess@redhat.com>
Thanks,
Andrew
>
> diff --git a/sim/riscv/sim-main.c b/sim/riscv/sim-main.c
> index b04d12c0de1..25dc9b41412 100644
> --- a/sim/riscv/sim-main.c
> +++ b/sim/riscv/sim-main.c
> @@ -1040,7 +1040,7 @@ void step_once (SIM_CPU *cpu)
> for (; op->name; op++)
> {
> /* Does the opcode match? */
> - if (! op->match_func (op, iw))
> + if (! op->match_func || ! op->match_func (op, iw))
> continue;
> /* Is this a pseudo-instruction and may we print it as such? */
> if (op->pinfo & INSN_ALIAS)
> --
> 2.25.1
On 11 Jan 2024 05:28, jaydeep.patil@imgtec.com wrote:
> The match_never() function has been removed and thus step_once() crashes
> during instruction decoding. Fixed it by checking for null pointer before
> invoking function attached to match_func member of riscv_opcode structure
pushed now, thx
-mike
@@ -1040,7 +1040,7 @@ void step_once (SIM_CPU *cpu)
for (; op->name; op++)
{
/* Does the opcode match? */
- if (! op->match_func (op, iw))
+ if (! op->match_func || ! op->match_func (op, iw))
continue;
/* Is this a pseudo-instruction and may we print it as such? */
if (op->pinfo & INSN_ALIAS)