From 2822d55ea88b4bb0345cd918cfc5465d2791c9dd Mon Sep 17 00:00:00 2001 From: Oleksii Kurochko Date: Tue, 1 Sep 2026 09:57:58 +0200 Subject: [PATCH] xen/riscv: drop bug.h's duplicate instruction length helpers asm/riscv_encoding.h already provides INSN_16BIT_MASK and INSN_LEN(), and emulate.c uses them, so the tree carried two spellings of the same thing which could drift apart. COMPRESSED_INSN_MASK never had a user. No functional change. Signed-off-by: Oleksii Kurochko Reviewed-by: Baptiste Le Duc Acked-by: Jan Beulich --- xen/arch/riscv/include/asm/bug.h | 19 ------------------- xen/arch/riscv/traps.c | 2 +- 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/xen/arch/riscv/include/asm/bug.h b/xen/arch/riscv/include/asm/bug.h index e6f2868816..c2cdc2dc2a 100644 --- a/xen/arch/riscv/include/asm/bug.h +++ b/xen/arch/riscv/include/asm/bug.h @@ -13,25 +13,6 @@ #define BUG_INSTR "unimp" -/* - * The base instruction set has a fixed length of 32-bit naturally aligned - * instructions. - * - * There are extensions of variable length ( where each instruction can be - * any number of 16-bit parcels in length ). - * - * Compressed ISA is used now where the instruction length is 16 bit and - * 'unimp' instruction, in this case, can be either 16 or 32 bit ( - * depending on if compressed ISA is used or not ) - */ -#define INSN_LENGTH_MASK _UL(0x3) -#define INSN_LENGTH_32 _UL(0x3) - -#define COMPRESSED_INSN_MASK _UL(0xffff) - -#define GET_INSN_LENGTH(insn) \ - (((insn) & INSN_LENGTH_MASK) == INSN_LENGTH_32 ? 4 : 2) \ - #endif /* !__ASSEMBLER__ */ #endif /* ASM__RISCV__BUG_H */ diff --git a/xen/arch/riscv/traps.c b/xen/arch/riscv/traps.c index d35c013e13..10d6855d91 100644 --- a/xen/arch/riscv/traps.c +++ b/xen/arch/riscv/traps.c @@ -214,7 +214,7 @@ void do_trap(struct cpu_user_regs *cpu_regs) die(); } - cpu_regs->sepc += GET_INSN_LENGTH(*(uint16_t *)pc); + cpu_regs->sepc += INSN_LEN(*(const uint16_t *)pc); break; }