PPC: Make DCR uint32_t
PATCH 1/1 PPC: Make DCR uint32_t
For what I know DCR is always 32 bits wide, so we should also use uint32_t to pass it along the stacks.
This fixes a warning when compiling qemu-system-ppc64 with KVM enabled, making it compile without --disable-werror
Signed-off-by Alexander Graf <[email protected]>
--- darwin-user/main.c | 4 ++-- hw/ppc.c | 4 ++-- hw/ppc.h | 4 ++-- hw/ppc405_uc.c | 46 +++++++++++++++++++++++----------------------- hw/ppc4xx_devs.c | 14 +++++++------- linux-user/main.c | 4 ++-- target-ppc/cpu.h | 4 ++-- target-ppc/helper.h | 4 ++-- target-ppc/op_helper.c | 10 +++++----- 9 files changed, 47 insertions(+), 47 deletions(-)
darwin-user/main.c +2 -2
@@ -113,12 +113,12 @@ uint32_t cpu_ppc601_load_rtcl (CPUState *env) }/* XXX: to be fixed */ -int ppc_dcr_read (ppc_dcr_t *dcr_env,int dcrn,target_ulong *valp) +int ppc_dcr_read (ppc_dcr_t *dcr_env,int dcrn,uint32_t *valp) {return -1 ; } -int ppc_dcr_write (ppc_dcr_t *dcr_env,int dcrn,target_ulong val) +int ppc_dcr_write (ppc_dcr_t *dcr_env,int dcrn,uint32_t val) {return -1 ; }
hw/ppc.c +2 -2
@@ -1009,7 +1009,7 @@ struct ppc_dcr_t {int (*write_error)(int dcrn); }; -int ppc_dcr_read (ppc_dcr_t *dcr_env,int dcrn,target_ulong *valp) +int ppc_dcr_read (ppc_dcr_t *dcr_env,int dcrn,uint32_t *valp) {ppc_dcrn_t *dcr;
@@ -1029,7 +1029,7 @@ int ppc_dcr_read (ppc_dcr_t *dcr_env, int dcrn, target_ulong *valp)return -1 ; } -int ppc_dcr_write (ppc_dcr_t *dcr_env,int dcrn,target_ulong val) +int ppc_dcr_write (ppc_dcr_t *dcr_env,int dcrn,uint32_t val) {ppc_dcrn_t *dcr;
hw/ppc.h +2 -2
@@ -13,8 +13,8 @@ static inline void clk_setup (clk_setup_t *clk, uint32_t freq)clk_setup_cb cpu_ppc_tb_init (CPUState *env,uint32_t freq);/* Embedded PowerPC DCR management */ -typedef target_ulong (*dcr_read_cb )(void *opaque,int dcrn); -typedef void (*dcr_write_cb )(void *opaque,int dcrn,target_ulong val); +typedef uint32_t (*dcr_read_cb )(void *opaque,int dcrn); +typedef void (*dcr_write_cb )(void *opaque,int dcrn,uint32_t val);int ppc_dcr_init (CPUState *env,int (*dcr_read_error)(int dcrn),int (*dcr_write_error)(int dcrn)); int ppc_dcr_register (CPUState *env, int dcrn, void *opaque,
hw/ppc405_uc.c +23 -23
156 lines not on this page · raw message
hw/ppc4xx_devs.c +7 -7
@@ -183,10 +183,10 @@ static void ppcuic_set_irq (void *opaque, int irq_num, int level)ppcuic_trigger_irq (uic); } -static target_ulong dcr_read_uic (void *opaque,int dcrn) +static uint32_t dcr_read_uic (void *opaque,int dcrn) {ppcuic_t *uic; -target_ulong ret; +uint32_t ret; uic = opaque; dcrn -= uic->dcr_base;
@@ -229,13 +229,13 @@ static target_ulong dcr_read_uic (void *opaque, int dcrn)return ret; } -static void dcr_write_uic (void *opaque,int dcrn,target_ulong val) +static void dcr_write_uic (void *opaque,int dcrn,uint32_t val) {ppcuic_t *uic; uic = opaque; dcrn -= uic->dcr_base; -LOG_UIC ("%s: dcr %d val " TARGET_FMT_lx"\n" , __func__, dcrn, val); +LOG_UIC ("%s: dcr %d val 0x%x\n" , __func__, dcrn, val);switch (dcrn) {case DCR_UICSR : uic->uicsr &= ~val;
@@ -448,10 +448,10 @@ static void sdram_unmap_bcr (ppc4xx_sdram_t *sdram) } } -static target_ulong dcr_read_sdram (void *opaque,int dcrn) +static uint32_t dcr_read_sdram (void *opaque,int dcrn) {ppc4xx_sdram_t *sdram; -target_ulong ret; +uint32_t ret; sdram = opaque;switch (dcrn) {
@@ -516,7 +516,7 @@ static target_ulong dcr_read_sdram (void *opaque, int dcrn)return ret; } -static void dcr_write_sdram (void *opaque,int dcrn,target_ulong val) +static void dcr_write_sdram (void *opaque,int dcrn,uint32_t val) {ppc4xx_sdram_t *sdram;
linux-user/main.c +2 -2
@@ -1097,12 +1097,12 @@ uint32_t cpu_ppc601_load_rtcl (CPUState *env) }/* XXX: to be fixed */ -int ppc_dcr_read (ppc_dcr_t *dcr_env,int dcrn,target_ulong *valp) +int ppc_dcr_read (ppc_dcr_t *dcr_env,int dcrn,uint32_t *valp) {return -1 ; } -int ppc_dcr_write (ppc_dcr_t *dcr_env,int dcrn,target_ulong val) +int ppc_dcr_write (ppc_dcr_t *dcr_env,int dcrn,uint32_t val) {return -1 ; }
target-ppc/cpu.h +2 -2
@@ -795,8 +795,8 @@ static inline uint64_t ppc_dump_gpr(CPUPPCState *env, int gprn) }/* Device control registers */ -int ppc_dcr_read (ppc_dcr_t *dcr_env,int dcrn,target_ulong *valp); -int ppc_dcr_write (ppc_dcr_t *dcr_env,int dcrn,target_ulong val); +int ppc_dcr_read (ppc_dcr_t *dcr_env,int dcrn,uint32_t *valp); +int ppc_dcr_write (ppc_dcr_t *dcr_env,int dcrn,uint32_t val);#define cpu_init cpu_ppc_init#define cpu_exec cpu_ppc_exec
target-ppc/helper.h +2 -2
@@ -359,8 +359,8 @@ DEF_HELPER_2(divo, tl, tl, tl) DEF_HELPER_2(divs, tl, tl, tl) DEF_HELPER_2(divso, tl, tl, tl) -DEF_HELPER_1 (load_dcr, tl, tl); -DEF_HELPER_2(store_dcr, void, tl, tl) +DEF_HELPER_1 (load_dcr, i32, i32); +DEF_HELPER_2(store_dcr, void, i32, i32) DEF_HELPER_1(load_dump_spr, void, i32)DEF_HELPER_1 (store_dump_spr, void, i32)
target-ppc/op_helper.c +5 -5
@@ -1828,30 +1828,30 @@ target_ulong helper_602_mfrom (target_ulong arg)/* Embedded PowerPC specific helpers */ /* XXX: to be improved to check access rights when in user-mode */ -target_ulong helper_load_dcr (target_ulong dcrn) +uint32_t helper_load_dcr (uint32_t dcrn) { -target_ulong val =0 ; +uint32_t val =0 ;if (unlikely (env->dcr_env ==NULL )) {qemu_log ("No DCR environment\n" );helper_raise_exception_err (POWERPC_EXCP_PROGRAM ,POWERPC_EXCP_INVAL |POWERPC_EXCP_INVAL_INVAL ); }else if (unlikely (ppc_dcr_read (env->dcr_env, dcrn, &val) !=0 )) { -qemu_log ("DCR read error %d %03x\n" , (int )dcrn, (int )dcrn); +qemu_log ("DCR read error %d %03x\n" , dcrn, dcrn);helper_raise_exception_err (POWERPC_EXCP_PROGRAM ,POWERPC_EXCP_INVAL |POWERPC_EXCP_PRIV_REG ); }return val; } -void helper_store_dcr (target_ulong dcrn,target_ulong val) +void helper_store_dcr (uint32_t dcrn,uint32_t val) {if (unlikely (env->dcr_env ==NULL )) {qemu_log ("No DCR environment\n" );helper_raise_exception_err (POWERPC_EXCP_PROGRAM ,POWERPC_EXCP_INVAL |POWERPC_EXCP_INVAL_INVAL ); }else if (unlikely (ppc_dcr_write (env->dcr_env, dcrn, val) !=0 )) { -qemu_log ("DCR write error %d %03x\n" , (int )dcrn, (int )dcrn); +qemu_log ("DCR write error %d %03x\n" , dcrn, dcrn);helper_raise_exception_err (POWERPC_EXCP_PROGRAM ,POWERPC_EXCP_INVAL |POWERPC_EXCP_PRIV_REG ); }
Signature · 1 line
1.6.0.2
Quoted 7 lines · Alexander Graf
For what I know DCR is always 32 bits wide, so we should also use
uint32_tto pass it along the stacks.This fixes a warning when compiling qemu-system-ppc64 with KVM enabled, making it compile without --disable-werror
Signed-off-by Alexander Graf <[email protected]>
Acked-by Hollis Blanchard <[email protected]>