--- qemu/tcg/ppc64/tcg-target.c 2018/04/24 19:18:21 1.1.1.7 +++ qemu/tcg/ppc64/tcg-target.c 2018/04/24 19:35:47 1.1.1.8 @@ -235,6 +235,9 @@ static int target_parse_constraint (TCGA tcg_regset_reset_reg (ct->u.regs, TCG_REG_R3); #ifdef CONFIG_SOFTMMU tcg_regset_reset_reg (ct->u.regs, TCG_REG_R4); +#ifdef CONFIG_TCG_PASS_AREG0 + tcg_regset_reset_reg (ct->u.regs, TCG_REG_R5); +#endif #endif break; case 'S': /* qemu_st constraint */ @@ -244,6 +247,9 @@ static int target_parse_constraint (TCGA #ifdef CONFIG_SOFTMMU tcg_regset_reset_reg (ct->u.regs, TCG_REG_R4); tcg_regset_reset_reg (ct->u.regs, TCG_REG_R5); +#ifdef CONFIG_TCG_PASS_AREG0 + tcg_regset_reset_reg (ct->u.regs, TCG_REG_R6); +#endif #endif break; case 'Z': @@ -552,6 +558,27 @@ static void tcg_out_ldsta (TCGContext *s #include "../../softmmu_defs.h" +#ifdef CONFIG_TCG_PASS_AREG0 +/* helper signature: helper_ld_mmu(CPUState *env, target_ulong addr, + int mmu_idx) */ +static const void * const qemu_ld_helpers[4] = { + helper_ldb_mmu, + helper_ldw_mmu, + helper_ldl_mmu, + helper_ldq_mmu, +}; + +/* helper signature: helper_st_mmu(CPUState *env, target_ulong addr, + uintxx_t val, int mmu_idx) */ +static const void * const qemu_st_helpers[4] = { + helper_stb_mmu, + helper_stw_mmu, + helper_stl_mmu, + helper_stq_mmu, +}; +#else +/* legacy helper signature: __ld_mmu(target_ulong addr, int + mmu_idx) */ static void *qemu_ld_helpers[4] = { __ldb_mmu, __ldw_mmu, @@ -559,12 +586,15 @@ static void *qemu_ld_helpers[4] = { __ldq_mmu, }; +/* legacy helper signature: __st_mmu(target_ulong addr, uintxx_t val, + int mmu_idx) */ static void *qemu_st_helpers[4] = { __stb_mmu, __stw_mmu, __stl_mmu, __stq_mmu, }; +#endif static void tcg_out_tlb_read (TCGContext *s, int r0, int r1, int r2, int addr_reg, int s_bits, int offset) @@ -618,7 +648,7 @@ static void tcg_out_qemu_ld (TCGContext { int addr_reg, data_reg, r0, r1, rbase, bswap; #ifdef CONFIG_SOFTMMU - int r2, mem_index, s_bits; + int r2, mem_index, s_bits, ir; void *label1_ptr, *label2_ptr; #endif @@ -635,7 +665,7 @@ static void tcg_out_qemu_ld (TCGContext rbase = 0; tcg_out_tlb_read (s, r0, r1, r2, addr_reg, s_bits, - offsetof (CPUState, tlb_table[mem_index][0].addr_read)); + offsetof (CPUArchState, tlb_table[mem_index][0].addr_read)); tcg_out32 (s, CMP | BF (7) | RA (r2) | RB (r1) | CMP_L); @@ -645,8 +675,12 @@ static void tcg_out_qemu_ld (TCGContext #endif /* slow path */ - tcg_out_mov (s, TCG_TYPE_I64, 3, addr_reg); - tcg_out_movi (s, TCG_TYPE_I64, 4, mem_index); + ir = 3; +#ifdef CONFIG_TCG_PASS_AREG0 + tcg_out_mov (s, TCG_TYPE_I64, ir++, TCG_AREG0); +#endif + tcg_out_mov (s, TCG_TYPE_I64, ir++, addr_reg); + tcg_out_movi (s, TCG_TYPE_I64, ir++, mem_index); tcg_out_call (s, (tcg_target_long) qemu_ld_helpers[s_bits], 1); @@ -766,7 +800,7 @@ static void tcg_out_qemu_st (TCGContext { int addr_reg, r0, r1, rbase, data_reg, bswap; #ifdef CONFIG_SOFTMMU - int r2, mem_index; + int r2, mem_index, ir; void *label1_ptr, *label2_ptr; #endif @@ -782,7 +816,7 @@ static void tcg_out_qemu_st (TCGContext rbase = 0; tcg_out_tlb_read (s, r0, r1, r2, addr_reg, opc, - offsetof (CPUState, tlb_table[mem_index][0].addr_write)); + offsetof (CPUArchState, tlb_table[mem_index][0].addr_write)); tcg_out32 (s, CMP | BF (7) | RA (r2) | RB (r1) | CMP_L); @@ -792,9 +826,13 @@ static void tcg_out_qemu_st (TCGContext #endif /* slow path */ - tcg_out_mov (s, TCG_TYPE_I64, 3, addr_reg); - tcg_out_rld (s, RLDICL, 4, data_reg, 0, 64 - (1 << (3 + opc))); - tcg_out_movi (s, TCG_TYPE_I64, 5, mem_index); + ir = 3; +#ifdef CONFIG_TCG_PASS_AREG0 + tcg_out_mov (s, TCG_TYPE_I64, ir++, TCG_AREG0); +#endif + tcg_out_mov (s, TCG_TYPE_I64, ir++, addr_reg); + tcg_out_rld (s, RLDICL, ir++, data_reg, 0, 64 - (1 << (3 + opc))); + tcg_out_movi (s, TCG_TYPE_I64, ir++, mem_index); tcg_out_call (s, (tcg_target_long) qemu_st_helpers[opc], 1); @@ -882,9 +920,9 @@ static void tcg_target_qemu_prologue (TC ; frame_size = (frame_size + 15) & ~15; - tcg_set_frame(s, TCG_REG_CALL_STACK, frame_size - - CPU_TEMP_BUF_NLONGS * sizeof(long), - CPU_TEMP_BUF_NLONGS * sizeof(long)); + tcg_set_frame (s, TCG_REG_CALL_STACK, frame_size + - CPU_TEMP_BUF_NLONGS * sizeof (long), + CPU_TEMP_BUF_NLONGS * sizeof (long)); #ifndef __APPLE__ /* First emit adhoc function descriptor */ @@ -908,7 +946,7 @@ static void tcg_target_qemu_prologue (TC #ifdef CONFIG_USE_GUEST_BASE if (GUEST_BASE) { tcg_out_movi (s, TCG_TYPE_I64, TCG_GUEST_BASE_REG, GUEST_BASE); - tcg_regset_set_reg(s->reserved_regs, TCG_GUEST_BASE_REG); + tcg_regset_set_reg (s->reserved_regs, TCG_GUEST_BASE_REG); } #endif @@ -1612,7 +1650,6 @@ static const TCGTargetOpDef ppc_op_defs[ { INDEX_op_ld16s_i64, { "r", "r" } }, { INDEX_op_ld32u_i64, { "r", "r" } }, { INDEX_op_ld32s_i64, { "r", "r" } }, - { INDEX_op_ld_i64, { "r", "r" } }, { INDEX_op_add_i32, { "r", "r", "ri" } }, { INDEX_op_mul_i32, { "r", "r", "ri" } },