mirror of
https://github.com/qemu/qemu.git
synced 2025-08-09 19:15:32 +00:00
tcg: Use CPUClass::tlb_fill in cputlb.c
We can now use the CPUClass hook instead of a named function. Create a static tlb_fill function to avoid other changes within cputlb.c. This also isolates the asserts within. Remove the named tlb_fill function from all of the targets. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
b008c45612
commit
c319dc1357
@ -855,6 +855,25 @@ static inline ram_addr_t qemu_ram_addr_from_host_nofail(void *ptr)
|
|||||||
return ram_addr;
|
return ram_addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Note: tlb_fill() can trigger a resize of the TLB. This means that all of the
|
||||||
|
* caller's prior references to the TLB table (e.g. CPUTLBEntry pointers) must
|
||||||
|
* be discarded and looked up again (e.g. via tlb_entry()).
|
||||||
|
*/
|
||||||
|
static void tlb_fill(CPUState *cpu, target_ulong addr, int size,
|
||||||
|
MMUAccessType access_type, int mmu_idx, uintptr_t retaddr)
|
||||||
|
{
|
||||||
|
CPUClass *cc = CPU_GET_CLASS(cpu);
|
||||||
|
bool ok;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is not a probe, so only valid return is success; failure
|
||||||
|
* should result in exception + longjmp to the cpu loop.
|
||||||
|
*/
|
||||||
|
ok = cc->tlb_fill(cpu, addr, size, access_type, mmu_idx, false, retaddr);
|
||||||
|
assert(ok);
|
||||||
|
}
|
||||||
|
|
||||||
static uint64_t io_readx(CPUArchState *env, CPUIOTLBEntry *iotlbentry,
|
static uint64_t io_readx(CPUArchState *env, CPUIOTLBEntry *iotlbentry,
|
||||||
int mmu_idx,
|
int mmu_idx,
|
||||||
target_ulong addr, uintptr_t retaddr,
|
target_ulong addr, uintptr_t retaddr,
|
||||||
|
@ -474,15 +474,6 @@ static inline void assert_no_pages_locked(void)
|
|||||||
*/
|
*/
|
||||||
struct MemoryRegionSection *iotlb_to_section(CPUState *cpu,
|
struct MemoryRegionSection *iotlb_to_section(CPUState *cpu,
|
||||||
hwaddr index, MemTxAttrs attrs);
|
hwaddr index, MemTxAttrs attrs);
|
||||||
|
|
||||||
/*
|
|
||||||
* Note: tlb_fill() can trigger a resize of the TLB. This means that all of the
|
|
||||||
* caller's prior references to the TLB table (e.g. CPUTLBEntry pointers) must
|
|
||||||
* be discarded and looked up again (e.g. via tlb_entry()).
|
|
||||||
*/
|
|
||||||
void tlb_fill(CPUState *cpu, target_ulong addr, int size,
|
|
||||||
MMUAccessType access_type, int mmu_idx, uintptr_t retaddr);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_USER_ONLY)
|
#if defined(CONFIG_USER_ONLY)
|
||||||
|
@ -275,12 +275,6 @@ bool alpha_cpu_tlb_fill(CPUState *cs, vaddr addr, int size,
|
|||||||
prot, mmu_idx, TARGET_PAGE_SIZE);
|
prot, mmu_idx, TARGET_PAGE_SIZE);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tlb_fill(CPUState *cs, target_ulong addr, int size,
|
|
||||||
MMUAccessType access_type, int mmu_idx, uintptr_t retaddr)
|
|
||||||
{
|
|
||||||
alpha_cpu_tlb_fill(cs, addr, size, access_type, mmu_idx, false, retaddr);
|
|
||||||
}
|
|
||||||
#endif /* USER_ONLY */
|
#endif /* USER_ONLY */
|
||||||
|
|
||||||
void alpha_cpu_do_interrupt(CPUState *cs)
|
void alpha_cpu_do_interrupt(CPUState *cs)
|
||||||
|
@ -13127,14 +13127,6 @@ bool arm_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef CONFIG_USER_ONLY
|
|
||||||
void tlb_fill(CPUState *cs, target_ulong addr, int size,
|
|
||||||
MMUAccessType access_type, int mmu_idx, uintptr_t retaddr)
|
|
||||||
{
|
|
||||||
arm_cpu_tlb_fill(cs, addr, size, access_type, mmu_idx, false, retaddr);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void HELPER(dc_zva)(CPUARMState *env, uint64_t vaddr_in)
|
void HELPER(dc_zva)(CPUARMState *env, uint64_t vaddr_in)
|
||||||
{
|
{
|
||||||
/* Implement DC ZVA, which zeroes a fixed-length block of memory.
|
/* Implement DC ZVA, which zeroes a fixed-length block of memory.
|
||||||
|
@ -123,12 +123,6 @@ bool cris_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
|
|||||||
cpu_loop_exit(cs);
|
cpu_loop_exit(cs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tlb_fill(CPUState *cs, target_ulong addr, int size,
|
|
||||||
MMUAccessType access_type, int mmu_idx, uintptr_t retaddr)
|
|
||||||
{
|
|
||||||
cris_cpu_tlb_fill(cs, addr, size, access_type, mmu_idx, false, retaddr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void crisv10_cpu_do_interrupt(CPUState *cs)
|
void crisv10_cpu_do_interrupt(CPUState *cs)
|
||||||
{
|
{
|
||||||
CRISCPU *cpu = CRIS_CPU(cs);
|
CRISCPU *cpu = CRIS_CPU(cs);
|
||||||
|
@ -260,12 +260,6 @@ bool hppa_cpu_tlb_fill(CPUState *cs, vaddr addr, int size,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tlb_fill(CPUState *cs, target_ulong addr, int size,
|
|
||||||
MMUAccessType type, int mmu_idx, uintptr_t retaddr)
|
|
||||||
{
|
|
||||||
hppa_cpu_tlb_fill(cs, addr, size, type, mmu_idx, false, retaddr);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Insert (Insn/Data) TLB Address. Note this is PA 1.1 only. */
|
/* Insert (Insn/Data) TLB Address. Note this is PA 1.1 only. */
|
||||||
void HELPER(itlba)(CPUHPPAState *env, target_ulong addr, target_ureg reg)
|
void HELPER(itlba)(CPUHPPAState *env, target_ulong addr, target_ureg reg)
|
||||||
{
|
{
|
||||||
|
@ -700,11 +700,3 @@ bool x86_cpu_tlb_fill(CPUState *cs, vaddr addr, int size,
|
|||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(CONFIG_USER_ONLY)
|
|
||||||
void tlb_fill(CPUState *cs, target_ulong addr, int size,
|
|
||||||
MMUAccessType access_type, int mmu_idx, uintptr_t retaddr)
|
|
||||||
{
|
|
||||||
x86_cpu_tlb_fill(cs, addr, size, access_type, mmu_idx, false, retaddr);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
@ -44,12 +44,6 @@ bool lm32_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tlb_fill(CPUState *cs, target_ulong addr, int size,
|
|
||||||
MMUAccessType access_type, int mmu_idx, uintptr_t retaddr)
|
|
||||||
{
|
|
||||||
lm32_cpu_tlb_fill(cs, addr, size, access_type, mmu_idx, false, retaddr);
|
|
||||||
}
|
|
||||||
|
|
||||||
hwaddr lm32_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
|
hwaddr lm32_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
|
||||||
{
|
{
|
||||||
LM32CPU *cpu = LM32_CPU(cs);
|
LM32CPU *cpu = LM32_CPU(cs);
|
||||||
|
@ -884,14 +884,6 @@ bool m68k_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
|
|||||||
cpu_loop_exit_restore(cs, retaddr);
|
cpu_loop_exit_restore(cs, retaddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef CONFIG_USER_ONLY
|
|
||||||
void tlb_fill(CPUState *cs, target_ulong addr, int size,
|
|
||||||
MMUAccessType access_type, int mmu_idx, uintptr_t retaddr)
|
|
||||||
{
|
|
||||||
m68k_cpu_tlb_fill(cs, addr, size, access_type, mmu_idx, false, retaddr);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uint32_t HELPER(bitrev)(uint32_t x)
|
uint32_t HELPER(bitrev)(uint32_t x)
|
||||||
{
|
{
|
||||||
x = ((x >> 1) & 0x55555555u) | ((x << 1) & 0xaaaaaaaau);
|
x = ((x >> 1) & 0x55555555u) | ((x << 1) & 0xaaaaaaaau);
|
||||||
|
@ -108,12 +108,6 @@ bool mb_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
|
|||||||
cpu_loop_exit_restore(cs, retaddr);
|
cpu_loop_exit_restore(cs, retaddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tlb_fill(CPUState *cs, target_ulong addr, int size,
|
|
||||||
MMUAccessType access_type, int mmu_idx, uintptr_t retaddr)
|
|
||||||
{
|
|
||||||
mb_cpu_tlb_fill(cs, addr, size, access_type, mmu_idx, false, retaddr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void mb_cpu_do_interrupt(CPUState *cs)
|
void mb_cpu_do_interrupt(CPUState *cs)
|
||||||
{
|
{
|
||||||
MicroBlazeCPU *cpu = MICROBLAZE_CPU(cs);
|
MicroBlazeCPU *cpu = MICROBLAZE_CPU(cs);
|
||||||
|
@ -944,12 +944,6 @@ bool mips_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef CONFIG_USER_ONLY
|
#ifndef CONFIG_USER_ONLY
|
||||||
void tlb_fill(CPUState *cs, target_ulong addr, int size,
|
|
||||||
MMUAccessType access_type, int mmu_idx, uintptr_t retaddr)
|
|
||||||
{
|
|
||||||
mips_cpu_tlb_fill(cs, addr, size, access_type, mmu_idx, false, retaddr);
|
|
||||||
}
|
|
||||||
|
|
||||||
hwaddr cpu_mips_translate_address(CPUMIPSState *env, target_ulong address, int rw)
|
hwaddr cpu_mips_translate_address(CPUMIPSState *env, target_ulong address, int rw)
|
||||||
{
|
{
|
||||||
hwaddr physical;
|
hwaddr physical;
|
||||||
|
@ -26,12 +26,6 @@
|
|||||||
#include "qemu/host-utils.h"
|
#include "qemu/host-utils.h"
|
||||||
#include "exec/helper-proto.h"
|
#include "exec/helper-proto.h"
|
||||||
|
|
||||||
void tlb_fill(CPUState *cs, target_ulong addr, int size,
|
|
||||||
MMUAccessType access_type, int mmu_idx, uintptr_t retaddr)
|
|
||||||
{
|
|
||||||
moxie_cpu_tlb_fill(cs, addr, size, access_type, mmu_idx, false, retaddr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void helper_raise_exception(CPUMoxieState *env, int ex)
|
void helper_raise_exception(CPUMoxieState *env, int ex)
|
||||||
{
|
{
|
||||||
CPUState *cs = CPU(moxie_env_get_cpu(env));
|
CPUState *cs = CPU(moxie_env_get_cpu(env));
|
||||||
|
@ -311,10 +311,4 @@ bool nios2_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
|
|||||||
env->regs[CR_BADADDR] = address;
|
env->regs[CR_BADADDR] = address;
|
||||||
cpu_loop_exit_restore(cs, retaddr);
|
cpu_loop_exit_restore(cs, retaddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tlb_fill(CPUState *cs, target_ulong addr, int size,
|
|
||||||
MMUAccessType access_type, int mmu_idx, uintptr_t retaddr)
|
|
||||||
{
|
|
||||||
nios2_cpu_tlb_fill(cs, addr, size, access_type, mmu_idx, false, retaddr);
|
|
||||||
}
|
|
||||||
#endif /* !CONFIG_USER_ONLY */
|
#endif /* !CONFIG_USER_ONLY */
|
||||||
|
@ -178,10 +178,4 @@ hwaddr openrisc_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
|
|||||||
return phys_addr;
|
return phys_addr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void tlb_fill(CPUState *cs, target_ulong addr, int size,
|
|
||||||
MMUAccessType access_type, int mmu_idx, uintptr_t retaddr)
|
|
||||||
{
|
|
||||||
openrisc_cpu_tlb_fill(cs, addr, size, access_type, mmu_idx, 0, retaddr);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -3080,9 +3080,3 @@ bool ppc_cpu_tlb_fill(CPUState *cs, vaddr addr, int size,
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tlb_fill(CPUState *cs, target_ulong addr, int size,
|
|
||||||
MMUAccessType access_type, int mmu_idx, uintptr_t retaddr)
|
|
||||||
{
|
|
||||||
ppc_cpu_tlb_fill(cs, addr, size, access_type, mmu_idx, false, retaddr);
|
|
||||||
}
|
|
||||||
|
@ -378,12 +378,6 @@ void riscv_cpu_do_unaligned_access(CPUState *cs, vaddr addr,
|
|||||||
env->badaddr = addr;
|
env->badaddr = addr;
|
||||||
riscv_raise_exception(env, cs->exception_index, retaddr);
|
riscv_raise_exception(env, cs->exception_index, retaddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tlb_fill(CPUState *cs, target_ulong addr, int size,
|
|
||||||
MMUAccessType access_type, int mmu_idx, uintptr_t retaddr)
|
|
||||||
{
|
|
||||||
riscv_cpu_tlb_fill(cs, addr, size, access_type, mmu_idx, false, retaddr);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool riscv_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
|
bool riscv_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
|
||||||
|
@ -178,12 +178,6 @@ bool s390_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
|
|||||||
cpu_loop_exit(cs);
|
cpu_loop_exit(cs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tlb_fill(CPUState *cs, target_ulong addr, int size,
|
|
||||||
MMUAccessType access_type, int mmu_idx, uintptr_t retaddr)
|
|
||||||
{
|
|
||||||
s390_cpu_tlb_fill(cs, addr, size, access_type, mmu_idx, false, retaddr);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void do_program_interrupt(CPUS390XState *env)
|
static void do_program_interrupt(CPUS390XState *env)
|
||||||
{
|
{
|
||||||
uint64_t mask, addr;
|
uint64_t mask, addr;
|
||||||
|
@ -872,11 +872,3 @@ bool superh_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
|
|||||||
}
|
}
|
||||||
cpu_loop_exit_restore(cs, retaddr);
|
cpu_loop_exit_restore(cs, retaddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef CONFIG_USER_ONLY
|
|
||||||
void tlb_fill(CPUState *cs, target_ulong addr, int size,
|
|
||||||
MMUAccessType access_type, int mmu_idx, uintptr_t retaddr)
|
|
||||||
{
|
|
||||||
superh_cpu_tlb_fill(cs, addr, size, access_type, mmu_idx, false, retaddr);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
@ -1924,10 +1924,4 @@ void QEMU_NORETURN sparc_cpu_do_unaligned_access(CPUState *cs, vaddr addr,
|
|||||||
#endif
|
#endif
|
||||||
cpu_raise_exception_ra(env, TT_UNALIGNED, retaddr);
|
cpu_raise_exception_ra(env, TT_UNALIGNED, retaddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tlb_fill(CPUState *cs, target_ulong addr, int size,
|
|
||||||
MMUAccessType access_type, int mmu_idx, uintptr_t retaddr)
|
|
||||||
{
|
|
||||||
sparc_cpu_tlb_fill(cs, addr, size, access_type, mmu_idx, false, retaddr);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -85,12 +85,6 @@ bool tricore_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void tlb_fill(CPUState *cs, target_ulong addr, int size,
|
|
||||||
MMUAccessType access_type, int mmu_idx, uintptr_t retaddr)
|
|
||||||
{
|
|
||||||
tricore_cpu_tlb_fill(cs, addr, size, access_type, mmu_idx, false, retaddr);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void tricore_cpu_list_entry(gpointer data, gpointer user_data)
|
static void tricore_cpu_list_entry(gpointer data, gpointer user_data)
|
||||||
{
|
{
|
||||||
ObjectClass *oc = data;
|
ObjectClass *oc = data;
|
||||||
|
@ -275,12 +275,6 @@ bool uc32_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
|
|||||||
cpu_loop_exit_restore(cs, retaddr);
|
cpu_loop_exit_restore(cs, retaddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tlb_fill(CPUState *cs, target_ulong addr, int size,
|
|
||||||
MMUAccessType access_type, int mmu_idx, uintptr_t retaddr)
|
|
||||||
{
|
|
||||||
uc32_cpu_tlb_fill(cs, addr, size, access_type, mmu_idx, false, retaddr);
|
|
||||||
}
|
|
||||||
|
|
||||||
hwaddr uc32_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
|
hwaddr uc32_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
|
||||||
{
|
{
|
||||||
error_report("function uc32_cpu_get_phys_page_debug not "
|
error_report("function uc32_cpu_get_phys_page_debug not "
|
||||||
|
@ -305,12 +305,6 @@ bool xtensa_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void tlb_fill(CPUState *cs, target_ulong vaddr, int size,
|
|
||||||
MMUAccessType access_type, int mmu_idx, uintptr_t retaddr)
|
|
||||||
{
|
|
||||||
xtensa_cpu_tlb_fill(cs, vaddr, size, access_type, mmu_idx, false, retaddr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void xtensa_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr, vaddr addr,
|
void xtensa_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr, vaddr addr,
|
||||||
unsigned size, MMUAccessType access_type,
|
unsigned size, MMUAccessType access_type,
|
||||||
int mmu_idx, MemTxAttrs attrs,
|
int mmu_idx, MemTxAttrs attrs,
|
||||||
|
Loading…
Reference in New Issue
Block a user