target/sparc: Make sparc_cpu_tlb_fill sysemu only

The fallback code in cpu_loop_exit_sigsegv is sufficient
for sparc linux-user.

This makes all of the code in mmu_helper.c sysemu only, so remove
the ifdefs and move the file to sparc_softmmu_ss.  Remove the code
from cpu_loop that handled TT_DFAULT and TT_TFAULT.

Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2021-09-15 08:05:53 -07:00
parent cac720ec54
commit caac44a52a
4 changed files with 2 additions and 52 deletions

View File

@ -219,17 +219,6 @@ void cpu_loop (CPUSPARCState *env)
case TT_WIN_UNF: /* window underflow */ case TT_WIN_UNF: /* window underflow */
restore_window(env); restore_window(env);
break; break;
case TT_TFAULT:
case TT_DFAULT:
{
info.si_signo = TARGET_SIGSEGV;
info.si_errno = 0;
/* XXX: check env->error_code */
info.si_code = TARGET_SEGV_MAPERR;
info._sifields._sigfault._addr = env->mmuregs[4];
queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info);
}
break;
#else #else
case TT_SPILL: /* window overflow */ case TT_SPILL: /* window overflow */
save_window(env); save_window(env);
@ -237,20 +226,6 @@ void cpu_loop (CPUSPARCState *env)
case TT_FILL: /* window underflow */ case TT_FILL: /* window underflow */
restore_window(env); restore_window(env);
break; break;
case TT_TFAULT:
case TT_DFAULT:
{
info.si_signo = TARGET_SIGSEGV;
info.si_errno = 0;
/* XXX: check env->error_code */
info.si_code = TARGET_SEGV_MAPERR;
if (trapnr == TT_DFAULT)
info._sifields._sigfault._addr = env->dmmu.mmuregs[4];
else
info._sifields._sigfault._addr = cpu_tsptr(env)->tpc;
queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info);
}
break;
#ifndef TARGET_ABI32 #ifndef TARGET_ABI32
case 0x16e: case 0x16e:
flush_windows(env); flush_windows(env);

View File

@ -865,9 +865,9 @@ static const struct SysemuCPUOps sparc_sysemu_ops = {
static const struct TCGCPUOps sparc_tcg_ops = { static const struct TCGCPUOps sparc_tcg_ops = {
.initialize = sparc_tcg_init, .initialize = sparc_tcg_init,
.synchronize_from_tb = sparc_cpu_synchronize_from_tb, .synchronize_from_tb = sparc_cpu_synchronize_from_tb,
.tlb_fill = sparc_cpu_tlb_fill,
#ifndef CONFIG_USER_ONLY #ifndef CONFIG_USER_ONLY
.tlb_fill = sparc_cpu_tlb_fill,
.cpu_exec_interrupt = sparc_cpu_exec_interrupt, .cpu_exec_interrupt = sparc_cpu_exec_interrupt,
.do_interrupt = sparc_cpu_do_interrupt, .do_interrupt = sparc_cpu_do_interrupt,
.do_transaction_failed = sparc_cpu_do_transaction_failed, .do_transaction_failed = sparc_cpu_do_transaction_failed,

View File

@ -6,7 +6,6 @@ sparc_ss.add(files(
'gdbstub.c', 'gdbstub.c',
'helper.c', 'helper.c',
'ldst_helper.c', 'ldst_helper.c',
'mmu_helper.c',
'translate.c', 'translate.c',
'win_helper.c', 'win_helper.c',
)) ))
@ -16,6 +15,7 @@ sparc_ss.add(when: 'TARGET_SPARC64', if_true: files('int64_helper.c', 'vis_helpe
sparc_softmmu_ss = ss.source_set() sparc_softmmu_ss = ss.source_set()
sparc_softmmu_ss.add(files( sparc_softmmu_ss.add(files(
'machine.c', 'machine.c',
'mmu_helper.c',
'monitor.c', 'monitor.c',
)) ))

View File

@ -25,30 +25,6 @@
/* Sparc MMU emulation */ /* Sparc MMU emulation */
#if defined(CONFIG_USER_ONLY)
bool sparc_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
MMUAccessType access_type, int mmu_idx,
bool probe, uintptr_t retaddr)
{
SPARCCPU *cpu = SPARC_CPU(cs);
CPUSPARCState *env = &cpu->env;
if (access_type == MMU_INST_FETCH) {
cs->exception_index = TT_TFAULT;
} else {
cs->exception_index = TT_DFAULT;
#ifdef TARGET_SPARC64
env->dmmu.mmuregs[4] = address;
#else
env->mmuregs[4] = address;
#endif
}
cpu_loop_exit_restore(cs, retaddr);
}
#else
#ifndef TARGET_SPARC64 #ifndef TARGET_SPARC64
/* /*
* Sparc V8 Reference MMU (SRMMU) * Sparc V8 Reference MMU (SRMMU)
@ -926,4 +902,3 @@ hwaddr sparc_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
} }
return phys_addr; return phys_addr;
} }
#endif