tcg/ppc: Use tcg_use_softmmu
Fix TCG_GUEST_BASE_REG to use 'TCG_REG_R30' instead of '30'. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
e3a650cd9d
commit
5b5bd4a9b1
@ -107,9 +107,7 @@
|
|||||||
|
|
||||||
#define have_isel (cpuinfo & CPUINFO_ISEL)
|
#define have_isel (cpuinfo & CPUINFO_ISEL)
|
||||||
|
|
||||||
#ifndef CONFIG_SOFTMMU
|
#define TCG_GUEST_BASE_REG TCG_REG_R30
|
||||||
#define TCG_GUEST_BASE_REG 30
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_TCG
|
#ifdef CONFIG_DEBUG_TCG
|
||||||
static const char tcg_target_reg_names[TCG_TARGET_NB_REGS][4] = {
|
static const char tcg_target_reg_names[TCG_TARGET_NB_REGS][4] = {
|
||||||
@ -2317,7 +2315,7 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h,
|
|||||||
s_bits == MO_128);
|
s_bits == MO_128);
|
||||||
a_bits = h->aa.align;
|
a_bits = h->aa.align;
|
||||||
|
|
||||||
#ifdef CONFIG_SOFTMMU
|
if (tcg_use_softmmu) {
|
||||||
int mem_index = get_mmuidx(oi);
|
int mem_index = get_mmuidx(oi);
|
||||||
int cmp_off = is_ld ? offsetof(CPUTLBEntry, addr_read)
|
int cmp_off = is_ld ? offsetof(CPUTLBEntry, addr_read)
|
||||||
: offsetof(CPUTLBEntry, addr_write);
|
: offsetof(CPUTLBEntry, addr_write);
|
||||||
@ -2352,13 +2350,17 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h,
|
|||||||
*/
|
*/
|
||||||
if (TCG_TARGET_REG_BITS == 64) {
|
if (TCG_TARGET_REG_BITS == 64) {
|
||||||
if (cmp_off == 0) {
|
if (cmp_off == 0) {
|
||||||
tcg_out32(s, LDUX | TAB(TCG_REG_TMP2, TCG_REG_TMP1, TCG_REG_TMP2));
|
tcg_out32(s, LDUX | TAB(TCG_REG_TMP2,
|
||||||
|
TCG_REG_TMP1, TCG_REG_TMP2));
|
||||||
} else {
|
} else {
|
||||||
tcg_out32(s, ADD | TAB(TCG_REG_TMP1, TCG_REG_TMP1, TCG_REG_TMP2));
|
tcg_out32(s, ADD | TAB(TCG_REG_TMP1,
|
||||||
tcg_out_ld(s, TCG_TYPE_I64, TCG_REG_TMP2, TCG_REG_TMP1, cmp_off);
|
TCG_REG_TMP1, TCG_REG_TMP2));
|
||||||
|
tcg_out_ld(s, TCG_TYPE_I64, TCG_REG_TMP2,
|
||||||
|
TCG_REG_TMP1, cmp_off);
|
||||||
}
|
}
|
||||||
} else if (cmp_off == 0 && !HOST_BIG_ENDIAN) {
|
} else if (cmp_off == 0 && !HOST_BIG_ENDIAN) {
|
||||||
tcg_out32(s, LWZUX | TAB(TCG_REG_TMP2, TCG_REG_TMP1, TCG_REG_TMP2));
|
tcg_out32(s, LWZUX | TAB(TCG_REG_TMP2,
|
||||||
|
TCG_REG_TMP1, TCG_REG_TMP2));
|
||||||
} else {
|
} else {
|
||||||
tcg_out32(s, ADD | TAB(TCG_REG_TMP1, TCG_REG_TMP1, TCG_REG_TMP2));
|
tcg_out32(s, ADD | TAB(TCG_REG_TMP1, TCG_REG_TMP1, TCG_REG_TMP2));
|
||||||
tcg_out_ld(s, TCG_TYPE_I32, TCG_REG_TMP2, TCG_REG_TMP1,
|
tcg_out_ld(s, TCG_TYPE_I32, TCG_REG_TMP2, TCG_REG_TMP1,
|
||||||
@ -2430,13 +2432,15 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h,
|
|||||||
offsetof(CPUTLBEntry, addend));
|
offsetof(CPUTLBEntry, addend));
|
||||||
|
|
||||||
/* High part comparison into cr6. */
|
/* High part comparison into cr6. */
|
||||||
tcg_out_cmp(s, TCG_COND_EQ, addrhi, TCG_REG_TMP2, 0, 6, TCG_TYPE_I32);
|
tcg_out_cmp(s, TCG_COND_EQ, addrhi, TCG_REG_TMP2,
|
||||||
|
0, 6, TCG_TYPE_I32);
|
||||||
|
|
||||||
/* Combine comparisons into cr7. */
|
/* Combine comparisons into cr7. */
|
||||||
tcg_out32(s, CRAND | BT(7, CR_EQ) | BA(6, CR_EQ) | BB(7, CR_EQ));
|
tcg_out32(s, CRAND | BT(7, CR_EQ) | BA(6, CR_EQ) | BB(7, CR_EQ));
|
||||||
} else {
|
} else {
|
||||||
/* Full comparison into cr7. */
|
/* Full comparison into cr7. */
|
||||||
tcg_out_cmp(s, TCG_COND_EQ, TCG_REG_R0, TCG_REG_TMP2, 0, 7, addr_type);
|
tcg_out_cmp(s, TCG_COND_EQ, TCG_REG_R0, TCG_REG_TMP2,
|
||||||
|
0, 7, addr_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Load a pointer into the current opcode w/conditional branch-link. */
|
/* Load a pointer into the current opcode w/conditional branch-link. */
|
||||||
@ -2444,7 +2448,7 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h,
|
|||||||
tcg_out32(s, BC | BI(7, CR_EQ) | BO_COND_FALSE | LK);
|
tcg_out32(s, BC | BI(7, CR_EQ) | BO_COND_FALSE | LK);
|
||||||
|
|
||||||
h->base = TCG_REG_TMP1;
|
h->base = TCG_REG_TMP1;
|
||||||
#else
|
} else {
|
||||||
if (a_bits) {
|
if (a_bits) {
|
||||||
ldst = new_ldst_label(s);
|
ldst = new_ldst_label(s);
|
||||||
ldst->is_ld = is_ld;
|
ldst->is_ld = is_ld;
|
||||||
@ -2461,7 +2465,7 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h,
|
|||||||
}
|
}
|
||||||
|
|
||||||
h->base = guest_base ? TCG_GUEST_BASE_REG : 0;
|
h->base = guest_base ? TCG_GUEST_BASE_REG : 0;
|
||||||
#endif
|
}
|
||||||
|
|
||||||
if (TCG_TARGET_REG_BITS == 64 && addr_type == TCG_TYPE_I32) {
|
if (TCG_TARGET_REG_BITS == 64 && addr_type == TCG_TYPE_I32) {
|
||||||
/* Zero-extend the guest address for use in the host address. */
|
/* Zero-extend the guest address for use in the host address. */
|
||||||
@ -2695,12 +2699,10 @@ static void tcg_target_qemu_prologue(TCGContext *s)
|
|||||||
}
|
}
|
||||||
tcg_out_st(s, TCG_TYPE_PTR, TCG_REG_R0, TCG_REG_R1, FRAME_SIZE+LR_OFFSET);
|
tcg_out_st(s, TCG_TYPE_PTR, TCG_REG_R0, TCG_REG_R1, FRAME_SIZE+LR_OFFSET);
|
||||||
|
|
||||||
#ifndef CONFIG_SOFTMMU
|
if (!tcg_use_softmmu && guest_base) {
|
||||||
if (guest_base) {
|
|
||||||
tcg_out_movi_int(s, TCG_TYPE_PTR, TCG_GUEST_BASE_REG, guest_base, true);
|
tcg_out_movi_int(s, TCG_TYPE_PTR, TCG_GUEST_BASE_REG, guest_base, true);
|
||||||
tcg_regset_set_reg(s->reserved_regs, TCG_GUEST_BASE_REG);
|
tcg_regset_set_reg(s->reserved_regs, TCG_GUEST_BASE_REG);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
tcg_out_mov(s, TCG_TYPE_PTR, TCG_AREG0, tcg_target_call_iarg_regs[0]);
|
tcg_out_mov(s, TCG_TYPE_PTR, TCG_AREG0, tcg_target_call_iarg_regs[0]);
|
||||||
tcg_out32(s, MTSPR | RS(tcg_target_call_iarg_regs[1]) | CTR);
|
tcg_out32(s, MTSPR | RS(tcg_target_call_iarg_regs[1]) | CTR);
|
||||||
|
Loading…
Reference in New Issue
Block a user