[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 12/42] target/ppc: used ternary operator when registering MAS
From: |
David Gibson |
Subject: |
[PULL 12/42] target/ppc: used ternary operator when registering MAS |
Date: |
Thu, 3 Jun 2021 18:22:01 +1000 |
From: "Bruno Larsen (billionai)" <bruno.larsen@eldorado.org.br>
The write calback decision when registering the MAS SPR has been turned
into a ternary operation, rather than an if-then-else block.
This was done because when building without TCG, even though the
compiler will optimize away the pointers to spr_write_generic*, it
doesn't optimize away the decision and assignment to the local pointer,
creating compiler errors. This cleanup looked better than using ifdefs,
so we decided to with it.
Signed-off-by: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20210525115355.8254-2-bruno.larsen@eldorado.org.br>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
target/ppc/cpu_init.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
index 310dfbd26a..a32893fde8 100644
--- a/target/ppc/cpu_init.c
+++ b/target/ppc/cpu_init.c
@@ -1205,15 +1205,12 @@ static void register_BookE206_sprs(CPUPPCState *env,
uint32_t mas_mask,
/* TLB assist registers */
/* XXX : not implemented */
for (i = 0; i < 8; i++) {
- void (*uea_write)(DisasContext *ctx, int sprn, int gprn) =
- &spr_write_generic32;
- if (i == 2 && (mas_mask & (1 << i)) && (env->insns_flags & PPC_64B)) {
- uea_write = &spr_write_generic;
- }
if (mas_mask & (1 << i)) {
spr_register(env, mas_sprn[i], mas_names[i],
SPR_NOACCESS, SPR_NOACCESS,
- &spr_read_generic, uea_write,
+ &spr_read_generic,
+ (i == 2 && (env->insns_flags & PPC_64B))
+ ? &spr_write_generic : &spr_write_generic32,
0x00000000);
}
}
--
2.31.1
- [PULL 02/42] target/ppc: moved ppc_store_lpcr and ppc_store_msr to cpu.c, (continued)
- [PULL 02/42] target/ppc: moved ppc_store_lpcr and ppc_store_msr to cpu.c, David Gibson, 2021/06/03
- [PULL 03/42] target/ppc: reduce usage of fpscr_set_rounding_mode, David Gibson, 2021/06/03
- [PULL 01/42] target/ppc: cleaned error_report from ppc_store_sdr1, David Gibson, 2021/06/03
- [PULL 04/42] target/ppc: removed unnecessary inclusion of helper-proto.h, David Gibson, 2021/06/03
- [PULL 11/42] spapr: Set LPCR to current AIL mode when starting a new CPU, David Gibson, 2021/06/03
- [PULL 10/42] spapr: Remove stale comment about power-saving LPCR bits, David Gibson, 2021/06/03
- [PULL 07/42] spapr: nvdimm: Forward declare and move the definitions, David Gibson, 2021/06/03
- [PULL 09/42] target/ppc: fold ppc_store_ptcr into it's only caller, David Gibson, 2021/06/03
- [PULL 06/42] spapr: Fix EEH capability issue on KVM guest for PCI passthru, David Gibson, 2021/06/03
- [PULL 05/42] spapr: Don't hijack current_machine->boot_order, David Gibson, 2021/06/03
- [PULL 12/42] target/ppc: used ternary operator when registering MAS,
David Gibson <=
- [PULL 14/42] target/ppc: created tcg-stub.c file, David Gibson, 2021/06/03
- [PULL 13/42] target/ppc: added ifdefs around TCG-only code, David Gibson, 2021/06/03
- [PULL 20/42] hw/core/cpu: removed cpu_dump_statistics function, David Gibson, 2021/06/03
- [PULL 08/42] spapr: nvdimm: Fix the persistent-memory root node name in device tree, David Gibson, 2021/06/03
- [PULL 21/42] HMP: added info cpustats to removed_features.rst, David Gibson, 2021/06/03
- [PULL 22/42] target/ppc: removed GEN_OPCODE decision tree, David Gibson, 2021/06/03
- [PULL 17/42] target/ppc: removed mentions to DO_PPC_STATISTICS, David Gibson, 2021/06/03
- [PULL 18/42] monitor: removed cpustats command, David Gibson, 2021/06/03
- [PULL 23/42] target/ppc: removed all mentions to PPC_DUMP_CPU, David Gibson, 2021/06/03
- [PULL 24/42] target/ppc: overhauled and moved logic of storing fpscr, David Gibson, 2021/06/03