Skip to content

Commit 623f07a

Browse files
chedahubplafosse
authored andcommitted
Fix: PowerPC decode logic for Rx, Ry, Rz register
1 parent be34c8d commit 623f07a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

arch/powerpc/decode/vle16.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,17 +335,20 @@ static InstructionId Decode16Vle(uint16_t word16, uint32_t decodeFlags)
335335
}
336336
static uint16_t Get16Rx(uint16_t word16)
337337
{
338-
return word16 & 0xf;
338+
uint16_t rx = word16 & 0xf;
339+
return rx + ((rx & 0x8) >> 3) * 16;
339340
}
340341

341342
static uint16_t Get16Ry(uint16_t word16)
342343
{
343-
return (word16 >> 4) & 0xf;
344+
uint16_t ry = (word16 >> 4) & 0xf;
345+
return ry + ((ry & 0x8) >> 3) * 16;
344346
}
345347

346348
static uint16_t Get16Rz(uint16_t word16)
347349
{
348-
return (word16 >> 4) & 0xf;
350+
uint16_t rz = (word16 >> 4) & 0xf;
351+
return rz + ((rz & 0x8) >> 3) * 16;
349352
}
350353

351354
static void FillOperands16Vle(Instruction* instruction, uint16_t word16, uint64_t address, bool translate)

0 commit comments

Comments
 (0)