From d4ab5bbc823b9d764b6f252b11e7b3ed03110d82 Mon Sep 17 00:00:00 2001 From: Philipp Hug Date: Mon, 29 Oct 2018 17:55:55 +0100 Subject: src/arch/riscv/misaligned.c: Fix an off-by-one error when loading the opcode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pointer to opcode increases by unit uint16_t not byte. Change-Id: I2986ca5402ad86d80e0eb955478bfbdc5d50e1f5 Signed-off-by: Philipp Hug Reviewed-on: https://review.coreboot.org/29339 Tested-by: build bot (Jenkins) Reviewed-by: Jonathan Neuschäfer --- src/arch/riscv/misaligned.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/arch') diff --git a/src/arch/riscv/misaligned.c b/src/arch/riscv/misaligned.c index ba96102839..ebff2d6678 100644 --- a/src/arch/riscv/misaligned.c +++ b/src/arch/riscv/misaligned.c @@ -160,7 +160,7 @@ static int fetch_16bit_instruction(uintptr_t vaddr, uintptr_t *insn, int *size) static int fetch_32bit_instruction(uintptr_t vaddr, uintptr_t *insn, int *size) { uint32_t l = (uint32_t)mprv_read_mxr_u16((uint16_t *)vaddr + 0); - uint32_t h = (uint32_t)mprv_read_mxr_u16((uint16_t *)vaddr + 2); + uint32_t h = (uint32_t)mprv_read_mxr_u16((uint16_t *)vaddr + 1); uint32_t ins = (h << 16) | l; if ((EXTRACT_FIELD(ins, 0x3) == 3) && (EXTRACT_FIELD(ins, 0x1c) != 0x7)) { -- cgit v1.2.3