mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 09:13:55 -06:00
tcg: Mask TCGMemOp appropriately for indexing
The addition of MO_AMASK means that places that used inverted masks need to be changed to use positive masks, and places that failed to mask the intended bits need updating. Reviewed-by: Yongbok Kim <yongbok.kim@imgtec.com> Tested-by: Yongbok Kim <yongbok.kim@imgtec.com> Signed-off-by: Richard Henderson <rth@twiddle.net>
This commit is contained in:
parent
44ee94e486
commit
2b7ec66f02
8 changed files with 34 additions and 34 deletions
|
@ -1075,12 +1075,11 @@ static void tcg_out_qemu_ld(TCGContext *s, TCGReg data, TCGReg addr,
|
|||
TCGMemOp memop = get_memop(oi);
|
||||
#ifdef CONFIG_SOFTMMU
|
||||
unsigned memi = get_mmuidx(oi);
|
||||
TCGMemOp s_bits = memop & MO_SIZE;
|
||||
TCGReg addrz, param;
|
||||
tcg_insn_unit *func;
|
||||
tcg_insn_unit *label_ptr;
|
||||
|
||||
addrz = tcg_out_tlb_load(s, addr, memi, s_bits,
|
||||
addrz = tcg_out_tlb_load(s, addr, memi, memop & MO_SIZE,
|
||||
offsetof(CPUTLBEntry, addr_read));
|
||||
|
||||
/* The fast path is exactly one insn. Thus we can perform the
|
||||
|
@ -1092,7 +1091,8 @@ static void tcg_out_qemu_ld(TCGContext *s, TCGReg data, TCGReg addr,
|
|||
tcg_out_bpcc0(s, COND_E, BPCC_A | BPCC_PT
|
||||
| (TARGET_LONG_BITS == 64 ? BPCC_XCC : BPCC_ICC), 0);
|
||||
/* delay slot */
|
||||
tcg_out_ldst_rr(s, data, addrz, TCG_REG_O1, qemu_ld_opc[memop]);
|
||||
tcg_out_ldst_rr(s, data, addrz, TCG_REG_O1,
|
||||
qemu_ld_opc[memop & (MO_BSWAP | MO_SSIZE)]);
|
||||
|
||||
/* TLB Miss. */
|
||||
|
||||
|
@ -1105,10 +1105,10 @@ static void tcg_out_qemu_ld(TCGContext *s, TCGReg data, TCGReg addr,
|
|||
|
||||
/* We use the helpers to extend SB and SW data, leaving the case
|
||||
of SL needing explicit extending below. */
|
||||
if ((memop & ~MO_BSWAP) == MO_SL) {
|
||||
func = qemu_ld_trampoline[memop & ~MO_SIGN];
|
||||
if ((memop & MO_SSIZE) == MO_SL) {
|
||||
func = qemu_ld_trampoline[memop & (MO_BSWAP | MO_SIZE)];
|
||||
} else {
|
||||
func = qemu_ld_trampoline[memop];
|
||||
func = qemu_ld_trampoline[memop & (MO_BSWAP | MO_SSIZE)];
|
||||
}
|
||||
assert(func != NULL);
|
||||
tcg_out_call_nodelay(s, func);
|
||||
|
@ -1119,13 +1119,13 @@ static void tcg_out_qemu_ld(TCGContext *s, TCGReg data, TCGReg addr,
|
|||
Which complicates things for sparcv8plus. */
|
||||
if (SPARC64) {
|
||||
/* We let the helper sign-extend SB and SW, but leave SL for here. */
|
||||
if (is_64 && (memop & ~MO_BSWAP) == MO_SL) {
|
||||
if (is_64 && (memop & MO_SSIZE) == MO_SL) {
|
||||
tcg_out_arithi(s, data, TCG_REG_O0, 0, SHIFT_SRA);
|
||||
} else {
|
||||
tcg_out_mov(s, TCG_TYPE_REG, data, TCG_REG_O0);
|
||||
}
|
||||
} else {
|
||||
if (s_bits == MO_64) {
|
||||
if ((memop & MO_SIZE) == MO_64) {
|
||||
tcg_out_arithi(s, TCG_REG_O0, TCG_REG_O0, 32, SHIFT_SLLX);
|
||||
tcg_out_arithi(s, TCG_REG_O1, TCG_REG_O1, 0, SHIFT_SRL);
|
||||
tcg_out_arith(s, data, TCG_REG_O0, TCG_REG_O1, ARITH_OR);
|
||||
|
@ -1147,7 +1147,7 @@ static void tcg_out_qemu_ld(TCGContext *s, TCGReg data, TCGReg addr,
|
|||
}
|
||||
tcg_out_ldst_rr(s, data, addr,
|
||||
(GUEST_BASE ? TCG_GUEST_BASE_REG : TCG_REG_G0),
|
||||
qemu_ld_opc[memop]);
|
||||
qemu_ld_opc[memop & (MO_BSWAP | MO_SSIZE)]);
|
||||
#endif /* CONFIG_SOFTMMU */
|
||||
}
|
||||
|
||||
|
@ -1157,12 +1157,11 @@ static void tcg_out_qemu_st(TCGContext *s, TCGReg data, TCGReg addr,
|
|||
TCGMemOp memop = get_memop(oi);
|
||||
#ifdef CONFIG_SOFTMMU
|
||||
unsigned memi = get_mmuidx(oi);
|
||||
TCGMemOp s_bits = memop & MO_SIZE;
|
||||
TCGReg addrz, param;
|
||||
tcg_insn_unit *func;
|
||||
tcg_insn_unit *label_ptr;
|
||||
|
||||
addrz = tcg_out_tlb_load(s, addr, memi, s_bits,
|
||||
addrz = tcg_out_tlb_load(s, addr, memi, memop & MO_SIZE,
|
||||
offsetof(CPUTLBEntry, addr_write));
|
||||
|
||||
/* The fast path is exactly one insn. Thus we can perform the entire
|
||||
|
@ -1172,7 +1171,8 @@ static void tcg_out_qemu_st(TCGContext *s, TCGReg data, TCGReg addr,
|
|||
tcg_out_bpcc0(s, COND_E, BPCC_A | BPCC_PT
|
||||
| (TARGET_LONG_BITS == 64 ? BPCC_XCC : BPCC_ICC), 0);
|
||||
/* delay slot */
|
||||
tcg_out_ldst_rr(s, data, addrz, TCG_REG_O1, qemu_st_opc[memop]);
|
||||
tcg_out_ldst_rr(s, data, addrz, TCG_REG_O1,
|
||||
qemu_st_opc[memop & (MO_BSWAP | MO_SIZE)]);
|
||||
|
||||
/* TLB Miss. */
|
||||
|
||||
|
@ -1182,13 +1182,13 @@ static void tcg_out_qemu_st(TCGContext *s, TCGReg data, TCGReg addr,
|
|||
param++;
|
||||
}
|
||||
tcg_out_mov(s, TCG_TYPE_REG, param++, addr);
|
||||
if (!SPARC64 && s_bits == MO_64) {
|
||||
if (!SPARC64 && (memop & MO_SIZE) == MO_64) {
|
||||
/* Skip the high-part; we'll perform the extract in the trampoline. */
|
||||
param++;
|
||||
}
|
||||
tcg_out_mov(s, TCG_TYPE_REG, param++, data);
|
||||
|
||||
func = qemu_st_trampoline[memop];
|
||||
func = qemu_st_trampoline[memop & (MO_BSWAP | MO_SIZE)];
|
||||
assert(func != NULL);
|
||||
tcg_out_call_nodelay(s, func);
|
||||
/* delay slot */
|
||||
|
@ -1202,7 +1202,7 @@ static void tcg_out_qemu_st(TCGContext *s, TCGReg data, TCGReg addr,
|
|||
}
|
||||
tcg_out_ldst_rr(s, data, addr,
|
||||
(GUEST_BASE ? TCG_GUEST_BASE_REG : TCG_REG_G0),
|
||||
qemu_st_opc[memop]);
|
||||
qemu_st_opc[memop & (MO_BSWAP | MO_SIZE)]);
|
||||
#endif /* CONFIG_SOFTMMU */
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue