Commit 046d6672e2238342b1c174e45c41005be78285a7

Authored by bellard
1 parent 75dfaa1e

avoid unneeded casts


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@754 c046a42c-6fe2-441c-8c8c-71466251a162
target-ppc/helper.c
@@ -178,8 +178,8 @@ static int find_pte (uint32_t *RPN, int *prot, uint32_t base, uint32_t va, @@ -178,8 +178,8 @@ static int find_pte (uint32_t *RPN, int *prot, uint32_t base, uint32_t va,
178 int ret = -1; /* No entry found */ 178 int ret = -1; /* No entry found */
179 179
180 for (i = 0; i < 8; i++) { 180 for (i = 0; i < 8; i++) {
181 - pte0 = ldl_raw((void *)((uint32_t)phys_ram_base + base + (i * 8)));  
182 - pte1 = ldl_raw((void *)((uint32_t)phys_ram_base + base + (i * 8) + 4)); 181 + pte0 = ldl_raw(phys_ram_base + base + (i * 8));
  182 + pte1 = ldl_raw(phys_ram_base + base + (i * 8) + 4);
183 #if defined (DEBUG_MMU) 183 #if defined (DEBUG_MMU)
184 if (loglevel > 0) { 184 if (loglevel > 0) {
185 fprintf(logfile, "Load pte from 0x%08x => 0x%08x 0x%08x " 185 fprintf(logfile, "Load pte from 0x%08x => 0x%08x 0x%08x "
@@ -269,8 +269,7 @@ static int find_pte (uint32_t *RPN, int *prot, uint32_t base, uint32_t va, @@ -269,8 +269,7 @@ static int find_pte (uint32_t *RPN, int *prot, uint32_t base, uint32_t va,
269 } 269 }
270 } 270 }
271 if (store) { 271 if (store) {
272 - stl_raw((void *)((uint32_t)phys_ram_base + base + (good * 8) + 4),  
273 - keep); 272 + stl_raw(phys_ram_base + base + (good * 8) + 4, keep);
274 } 273 }
275 } 274 }
276 275
target-ppc/translate.c
@@ -127,7 +127,7 @@ static uint8_t spr_access[1024 / 2]; @@ -127,7 +127,7 @@ static uint8_t spr_access[1024 / 2];
127 /* internal defines */ 127 /* internal defines */
128 typedef struct DisasContext { 128 typedef struct DisasContext {
129 struct TranslationBlock *tb; 129 struct TranslationBlock *tb;
130 - uint32_t *nip; 130 + uint32_t nip;
131 uint32_t opcode; 131 uint32_t opcode;
132 uint32_t exception; 132 uint32_t exception;
133 /* Time base offset */ 133 /* Time base offset */
@@ -1509,13 +1509,13 @@ GEN_HANDLER(b, 0x12, 0xFF, 0xFF, 0x00000000, PPC_FLOW) @@ -1509,13 +1509,13 @@ GEN_HANDLER(b, 0x12, 0xFF, 0xFF, 0x00000000, PPC_FLOW)
1509 1509
1510 gen_op_update_tb(ctx->tb_offset); 1510 gen_op_update_tb(ctx->tb_offset);
1511 gen_op_update_decr(ctx->decr_offset); 1511 gen_op_update_decr(ctx->decr_offset);
1512 - gen_op_process_exceptions((uint32_t)ctx->nip - 4); 1512 + gen_op_process_exceptions(ctx->nip - 4);
1513 if (AA(ctx->opcode) == 0) 1513 if (AA(ctx->opcode) == 0)
1514 - target = (uint32_t)ctx->nip + li - 4; 1514 + target = ctx->nip + li - 4;
1515 else 1515 else
1516 target = li; 1516 target = li;
1517 if (LK(ctx->opcode)) { 1517 if (LK(ctx->opcode)) {
1518 - gen_op_setlr((uint32_t)ctx->nip); 1518 + gen_op_setlr(ctx->nip);
1519 } 1519 }
1520 gen_op_b((long)ctx->tb, target); 1520 gen_op_b((long)ctx->tb, target);
1521 ctx->exception = EXCP_BRANCH; 1521 ctx->exception = EXCP_BRANCH;
@@ -1535,7 +1535,7 @@ static inline void gen_bcond(DisasContext *ctx, int type) @@ -1535,7 +1535,7 @@ static inline void gen_bcond(DisasContext *ctx, int type)
1535 1535
1536 gen_op_update_tb(ctx->tb_offset); 1536 gen_op_update_tb(ctx->tb_offset);
1537 gen_op_update_decr(ctx->decr_offset); 1537 gen_op_update_decr(ctx->decr_offset);
1538 - gen_op_process_exceptions((uint32_t)ctx->nip - 4); 1538 + gen_op_process_exceptions(ctx->nip - 4);
1539 1539
1540 if ((bo & 0x4) == 0) 1540 if ((bo & 0x4) == 0)
1541 gen_op_dec_ctr(); 1541 gen_op_dec_ctr();
@@ -1543,7 +1543,7 @@ static inline void gen_bcond(DisasContext *ctx, int type) @@ -1543,7 +1543,7 @@ static inline void gen_bcond(DisasContext *ctx, int type)
1543 case BCOND_IM: 1543 case BCOND_IM:
1544 li = s_ext16(BD(ctx->opcode)); 1544 li = s_ext16(BD(ctx->opcode));
1545 if (AA(ctx->opcode) == 0) { 1545 if (AA(ctx->opcode) == 0) {
1546 - target = (uint32_t)ctx->nip + li - 4; 1546 + target = ctx->nip + li - 4;
1547 } else { 1547 } else {
1548 target = li; 1548 target = li;
1549 } 1549 }
@@ -1557,7 +1557,7 @@ static inline void gen_bcond(DisasContext *ctx, int type) @@ -1557,7 +1557,7 @@ static inline void gen_bcond(DisasContext *ctx, int type)
1557 break; 1557 break;
1558 } 1558 }
1559 if (LK(ctx->opcode)) { 1559 if (LK(ctx->opcode)) {
1560 - gen_op_setlr((uint32_t)ctx->nip); 1560 + gen_op_setlr(ctx->nip);
1561 } 1561 }
1562 if (bo & 0x10) { 1562 if (bo & 0x10) {
1563 /* No CR condition */ 1563 /* No CR condition */
@@ -1612,9 +1612,9 @@ static inline void gen_bcond(DisasContext *ctx, int type) @@ -1612,9 +1612,9 @@ static inline void gen_bcond(DisasContext *ctx, int type)
1612 } 1612 }
1613 } 1613 }
1614 if (type == BCOND_IM) { 1614 if (type == BCOND_IM) {
1615 - gen_op_btest((long)ctx->tb, target, (uint32_t)ctx->nip); 1615 + gen_op_btest((long)ctx->tb, target, ctx->nip);
1616 } else { 1616 } else {
1617 - gen_op_btest_T1((uint32_t)ctx->nip); 1617 + gen_op_btest_T1(ctx->nip);
1618 } 1618 }
1619 no_test: 1619 no_test:
1620 ctx->exception = EXCP_BRANCH; 1620 ctx->exception = EXCP_BRANCH;
@@ -2989,7 +2989,7 @@ int gen_intermediate_code_internal (CPUState *env, TranslationBlock *tb, @@ -2989,7 +2989,7 @@ int gen_intermediate_code_internal (CPUState *env, TranslationBlock *tb,
2989 gen_opc_ptr = gen_opc_buf; 2989 gen_opc_ptr = gen_opc_buf;
2990 gen_opc_end = gen_opc_buf + OPC_MAX_SIZE; 2990 gen_opc_end = gen_opc_buf + OPC_MAX_SIZE;
2991 gen_opparam_ptr = gen_opparam_buf; 2991 gen_opparam_ptr = gen_opparam_buf;
2992 - ctx.nip = (uint32_t *)pc_start; 2992 + ctx.nip = pc_start;
2993 ctx.tb_offset = 0; 2993 ctx.tb_offset = 0;
2994 ctx.decr_offset = 0; 2994 ctx.decr_offset = 0;
2995 ctx.tb = tb; 2995 ctx.tb = tb;
@@ -3015,18 +3015,18 @@ int gen_intermediate_code_internal (CPUState *env, TranslationBlock *tb, @@ -3015,18 +3015,18 @@ int gen_intermediate_code_internal (CPUState *env, TranslationBlock *tb,
3015 lj++; 3015 lj++;
3016 while (lj < j) 3016 while (lj < j)
3017 gen_opc_instr_start[lj++] = 0; 3017 gen_opc_instr_start[lj++] = 0;
3018 - gen_opc_pc[lj] = (uint32_t)ctx.nip; 3018 + gen_opc_pc[lj] = ctx.nip;
3019 gen_opc_instr_start[lj] = 1; 3019 gen_opc_instr_start[lj] = 1;
3020 } 3020 }
3021 } 3021 }
3022 #if defined DEBUG_DISAS 3022 #if defined DEBUG_DISAS
3023 if (loglevel > 0) { 3023 if (loglevel > 0) {
3024 fprintf(logfile, "----------------\n"); 3024 fprintf(logfile, "----------------\n");
3025 - fprintf(logfile, "nip=%p super=%d ir=%d\n", 3025 + fprintf(logfile, "nip=%08x super=%d ir=%d\n",
3026 ctx.nip, 1 - msr_pr, msr_ir); 3026 ctx.nip, 1 - msr_pr, msr_ir);
3027 } 3027 }
3028 #endif 3028 #endif
3029 - ctx.opcode = ldl_code(ctx.nip); 3029 + ctx.opcode = ldl_code((void *)ctx.nip);
3030 #if defined DEBUG_DISAS 3030 #if defined DEBUG_DISAS
3031 if (loglevel > 0) { 3031 if (loglevel > 0) {
3032 fprintf(logfile, "translate opcode %08x (%02x %02x %02x)\n", 3032 fprintf(logfile, "translate opcode %08x (%02x %02x %02x)\n",
@@ -3034,7 +3034,7 @@ int gen_intermediate_code_internal (CPUState *env, TranslationBlock *tb, @@ -3034,7 +3034,7 @@ int gen_intermediate_code_internal (CPUState *env, TranslationBlock *tb,
3034 opc3(ctx.opcode)); 3034 opc3(ctx.opcode));
3035 } 3035 }
3036 #endif 3036 #endif
3037 - ctx.nip++; 3037 + ctx.nip += 4;
3038 ctx.tb_offset++; 3038 ctx.tb_offset++;
3039 /* Check decrementer exception */ 3039 /* Check decrementer exception */
3040 if (++ctx.decr_offset == env->decr + 1) 3040 if (++ctx.decr_offset == env->decr + 1)
@@ -3054,28 +3054,28 @@ int gen_intermediate_code_internal (CPUState *env, TranslationBlock *tb, @@ -3054,28 +3054,28 @@ int gen_intermediate_code_internal (CPUState *env, TranslationBlock *tb,
3054 if (loglevel > 0) { 3054 if (loglevel > 0) {
3055 if (handler->handler == &gen_invalid) { 3055 if (handler->handler == &gen_invalid) {
3056 fprintf(logfile, "invalid/unsupported opcode: " 3056 fprintf(logfile, "invalid/unsupported opcode: "
3057 - "%02x -%02x - %02x (%08x) %p\n", 3057 + "%02x -%02x - %02x (%08x) 0x%08x\n",
3058 opc1(ctx.opcode), opc2(ctx.opcode), 3058 opc1(ctx.opcode), opc2(ctx.opcode),
3059 - opc3(ctx.opcode), ctx.opcode, ctx.nip - 1); 3059 + opc3(ctx.opcode), ctx.opcode, ctx.nip - 4);
3060 } else { 3060 } else {
3061 fprintf(logfile, "invalid bits: %08x for opcode: " 3061 fprintf(logfile, "invalid bits: %08x for opcode: "
3062 - "%02x -%02x - %02x (0x%08x) (%p)\n", 3062 + "%02x -%02x - %02x (0x%08x) (0x%08x)\n",
3063 ctx.opcode & handler->inval, opc1(ctx.opcode), 3063 ctx.opcode & handler->inval, opc1(ctx.opcode),
3064 opc2(ctx.opcode), opc3(ctx.opcode), 3064 opc2(ctx.opcode), opc3(ctx.opcode),
3065 - ctx.opcode, ctx.nip - 1); 3065 + ctx.opcode, ctx.nip - 4);
3066 } 3066 }
3067 } else { 3067 } else {
3068 if (handler->handler == &gen_invalid) { 3068 if (handler->handler == &gen_invalid) {
3069 printf("invalid/unsupported opcode: " 3069 printf("invalid/unsupported opcode: "
3070 - "%02x -%02x - %02x (%08x) %p\n", 3070 + "%02x -%02x - %02x (%08x) 0x%08x\n",
3071 opc1(ctx.opcode), opc2(ctx.opcode), 3071 opc1(ctx.opcode), opc2(ctx.opcode),
3072 - opc3(ctx.opcode), ctx.opcode, ctx.nip - 1); 3072 + opc3(ctx.opcode), ctx.opcode, ctx.nip - 4);
3073 } else { 3073 } else {
3074 printf("invalid bits: %08x for opcode: " 3074 printf("invalid bits: %08x for opcode: "
3075 - "%02x -%02x - %02x (0x%08x) (%p)\n", 3075 + "%02x -%02x - %02x (0x%08x) (0x%08x)\n",
3076 ctx.opcode & handler->inval, opc1(ctx.opcode), 3076 ctx.opcode & handler->inval, opc1(ctx.opcode),
3077 opc2(ctx.opcode), opc3(ctx.opcode), 3077 opc2(ctx.opcode), opc3(ctx.opcode),
3078 - ctx.opcode, ctx.nip - 1); 3078 + ctx.opcode, ctx.nip - 4);
3079 } 3079 }
3080 } 3080 }
3081 (*gen_invalid)(&ctx); 3081 (*gen_invalid)(&ctx);
@@ -3089,9 +3089,9 @@ int gen_intermediate_code_internal (CPUState *env, TranslationBlock *tb, @@ -3089,9 +3089,9 @@ int gen_intermediate_code_internal (CPUState *env, TranslationBlock *tb,
3089 * - rfi, trap or syscall 3089 * - rfi, trap or syscall
3090 * - first instruction of an exception handler 3090 * - first instruction of an exception handler
3091 */ 3091 */
3092 - (msr_se && ((uint32_t)ctx.nip < 0x100 ||  
3093 - (uint32_t)ctx.nip > 0xF00 ||  
3094 - ((uint32_t)ctx.nip & 0xFC) != 0x04) && 3092 + (msr_se && (ctx.nip < 0x100 ||
  3093 + ctx.nip > 0xF00 ||
  3094 + (ctx.nip & 0xFC) != 0x04) &&
3095 ctx.exception != EXCP_SYSCALL && ctx.exception != EXCP_RFI && 3095 ctx.exception != EXCP_SYSCALL && ctx.exception != EXCP_RFI &&
3096 ctx.exception != EXCP_TRAP)) { 3096 ctx.exception != EXCP_TRAP)) {
3097 #if !defined(CONFIG_USER_ONLY) 3097 #if !defined(CONFIG_USER_ONLY)
@@ -3102,9 +3102,9 @@ int gen_intermediate_code_internal (CPUState *env, TranslationBlock *tb, @@ -3102,9 +3102,9 @@ int gen_intermediate_code_internal (CPUState *env, TranslationBlock *tb,
3102 } 3102 }
3103 } 3103 }
3104 /* if we reach a page boundary, stop generation */ 3104 /* if we reach a page boundary, stop generation */
3105 - if (((uint32_t)ctx.nip & (TARGET_PAGE_SIZE - 1)) == 0) { 3105 + if ((ctx.nip & (TARGET_PAGE_SIZE - 1)) == 0) {
3106 if (ctx.exception == EXCP_NONE) { 3106 if (ctx.exception == EXCP_NONE) {
3107 - gen_op_b((long)ctx.tb, (uint32_t)ctx.nip); 3107 + gen_op_b((long)ctx.tb, ctx.nip);
3108 ctx.exception = EXCP_BRANCH; 3108 ctx.exception = EXCP_BRANCH;
3109 } 3109 }
3110 } 3110 }
@@ -3113,7 +3113,7 @@ int gen_intermediate_code_internal (CPUState *env, TranslationBlock *tb, @@ -3113,7 +3113,7 @@ int gen_intermediate_code_internal (CPUState *env, TranslationBlock *tb,
3113 if (ctx.exception != EXCP_BRANCH && ctx.exception != EXCP_RFI) { 3113 if (ctx.exception != EXCP_BRANCH && ctx.exception != EXCP_RFI) {
3114 gen_op_update_tb(ctx.tb_offset); 3114 gen_op_update_tb(ctx.tb_offset);
3115 gen_op_update_decr(ctx.decr_offset); 3115 gen_op_update_decr(ctx.decr_offset);
3116 - gen_op_process_exceptions((uint32_t)ctx.nip); 3116 + gen_op_process_exceptions(ctx.nip);
3117 } 3117 }
3118 #if 1 3118 #if 1
3119 /* TO BE FIXED: T0 hasn't got a proper value, which makes tb_add_jump 3119 /* TO BE FIXED: T0 hasn't got a proper value, which makes tb_add_jump
@@ -3136,7 +3136,7 @@ int gen_intermediate_code_internal (CPUState *env, TranslationBlock *tb, @@ -3136,7 +3136,7 @@ int gen_intermediate_code_internal (CPUState *env, TranslationBlock *tb,
3136 } 3136 }
3137 #endif 3137 #endif
3138 } else { 3138 } else {
3139 - tb->size = (uint32_t)ctx.nip - pc_start; 3139 + tb->size = ctx.nip - pc_start;
3140 } 3140 }
3141 env->access_type = ACCESS_INT; 3141 env->access_type = ACCESS_INT;
3142 #ifdef DEBUG_DISAS 3142 #ifdef DEBUG_DISAS
@@ -3144,7 +3144,7 @@ int gen_intermediate_code_internal (CPUState *env, TranslationBlock *tb, @@ -3144,7 +3144,7 @@ int gen_intermediate_code_internal (CPUState *env, TranslationBlock *tb,
3144 fprintf(logfile, "---------------- excp: %04x\n", ctx.exception); 3144 fprintf(logfile, "---------------- excp: %04x\n", ctx.exception);
3145 cpu_ppc_dump_state(env, logfile, 0); 3145 cpu_ppc_dump_state(env, logfile, 0);
3146 fprintf(logfile, "IN: %s\n", lookup_symbol((void *)pc_start)); 3146 fprintf(logfile, "IN: %s\n", lookup_symbol((void *)pc_start));
3147 - disas(logfile, (void *)pc_start, (uint32_t)ctx.nip - pc_start, 0, 0); 3147 + disas(logfile, (void *)pc_start, ctx.nip - pc_start, 0, 0);
3148 fprintf(logfile, "\n"); 3148 fprintf(logfile, "\n");
3149 3149
3150 fprintf(logfile, "OP:\n"); 3150 fprintf(logfile, "OP:\n");