[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 06/29] target/ppc: switch EXTRACT_HELPER macros over to
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 06/29] target/ppc: switch EXTRACT_HELPER macros over to use sextract32/extract32 |
Date: |
Wed, 9 Jan 2019 09:45:37 +1100 |
From: Mark Cave-Ayland <address@hidden>
These ensure that we consistently handle signed and unsigned extensions
correctly
when decoding immediates from instruction opcodes.
Signed-off-by: Mark Cave-Ayland <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
target/ppc/internal.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/target/ppc/internal.h b/target/ppc/internal.h
index 8b35863549..5d460247e2 100644
--- a/target/ppc/internal.h
+++ b/target/ppc/internal.h
@@ -52,20 +52,20 @@ FUNC_MASK(mask_u64, uint64_t, 64, UINT64_MAX);
#define EXTRACT_HELPER(name, shift, nb) \
static inline uint32_t name(uint32_t opcode) \
{ \
- return (opcode >> (shift)) & ((1 << (nb)) - 1); \
+ return extract32(opcode, shift, nb); \
}
#define EXTRACT_SHELPER(name, shift, nb) \
static inline int32_t name(uint32_t opcode) \
{ \
- return (int16_t)((opcode >> (shift)) & ((1 << (nb)) - 1)); \
+ return sextract32(opcode, shift, nb); \
}
#define EXTRACT_HELPER_SPLIT(name, shift1, nb1, shift2, nb2) \
static inline uint32_t name(uint32_t opcode) \
{ \
- return (((opcode >> (shift1)) & ((1 << (nb1)) - 1)) << nb2) | \
- ((opcode >> (shift2)) & ((1 << (nb2)) - 1)); \
+ return extract32(opcode, shift1, nb1) << nb2 | \
+ extract32(opcode, shift2, nb2); \
}
#define EXTRACT_HELPER_SPLIT_3(name, \
--
2.20.1
- [Qemu-ppc] [PULL 00/29] ppc-for-4.0 queue 20190109, David Gibson, 2019/01/08
- [Qemu-ppc] [PULL 01/29] spapr: Add H-Call H_HOME_NODE_ASSOCIATIVITY, David Gibson, 2019/01/08
- [Qemu-ppc] [PULL 04/29] MAINTAINERS: Add more files to sam460ex, David Gibson, 2019/01/08
- [Qemu-ppc] [PULL 05/29] target/ppc: fix typo in SIMM5 extraction helper, David Gibson, 2019/01/08
- [Qemu-ppc] [PULL 02/29] ppc/spapr: Receive and store device tree blob from SLOF, David Gibson, 2019/01/08
- [Qemu-ppc] [PULL 06/29] target/ppc: switch EXTRACT_HELPER macros over to use sextract32/extract32,
David Gibson <=
- [Qemu-ppc] [PULL 08/29] target/ppc: introduce get_avr64() and set_avr64() helpers for VMX register access, David Gibson, 2019/01/08
- [Qemu-ppc] [PULL 03/29] ppc4xx: Disable debug logging by default, David Gibson, 2019/01/08
- [Qemu-ppc] [PULL 10/29] target/ppc: switch FPR, VMX and VSX helpers to access data directly from cpu_env, David Gibson, 2019/01/08
- [Qemu-ppc] [PULL 14/29] MAINTAINERS: Add some missing ppc-related files, David Gibson, 2019/01/08
- [Qemu-ppc] [PULL 16/29] spapr: move spapr_create_phb() to core machine code, David Gibson, 2019/01/08
- [Qemu-ppc] [PULL 11/29] target/ppc: merge ppc_vsr_t and ppc_avr_t union types, David Gibson, 2019/01/08
- [Qemu-ppc] [PULL 18/29] spapr_pci: Define SPAPR_MAX_PHBS in hw/pci-host/spapr.h, David Gibson, 2019/01/08
- [Qemu-ppc] [PULL 13/29] target/ppc: replace AVR* macros with Vsr* macros, David Gibson, 2019/01/08
- [Qemu-ppc] [PULL 15/29] MAINTAINERS: add qemu_vga.ndrv file entry for Mac machines, David Gibson, 2019/01/08
- [Qemu-ppc] [PULL 09/29] target/ppc: introduce get_cpu_vsr{l, h}() and set_cpu_vsr{l, h}() helpers for VSR register access, David Gibson, 2019/01/08