mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 10:13:56 -06:00
target/mips: Add simple user-mode mips_cpu_tlb_fill()
tlb_helper.c's #ifdef'ry hides a quite simple user-mode implementation of mips_cpu_tlb_fill(). Copy the user-mode implementation (without #ifdef'ry) to tcg/user/helper.c and simplify tlb_helper.c's #ifdef'ry. This will allow us to restrict tlb_helper.c to sysemu. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20210428170410.479308-15-f4bug@amsat.org>
This commit is contained in:
parent
0a31c16c9c
commit
8074365fc7
2 changed files with 36 additions and 10 deletions
|
@ -22,6 +22,42 @@
|
|||
#include "exec/exec-all.h"
|
||||
#include "internal.h"
|
||||
|
||||
static void raise_mmu_exception(CPUMIPSState *env, target_ulong address,
|
||||
MMUAccessType access_type)
|
||||
{
|
||||
CPUState *cs = env_cpu(env);
|
||||
|
||||
env->error_code = 0;
|
||||
if (access_type == MMU_INST_FETCH) {
|
||||
env->error_code |= EXCP_INST_NOTAVAIL;
|
||||
}
|
||||
|
||||
/* Reference to kernel address from user mode or supervisor mode */
|
||||
/* Reference to supervisor address from user mode */
|
||||
if (access_type == MMU_DATA_STORE) {
|
||||
cs->exception_index = EXCP_AdES;
|
||||
} else {
|
||||
cs->exception_index = EXCP_AdEL;
|
||||
}
|
||||
|
||||
/* Raise exception */
|
||||
if (!(env->hflags & MIPS_HFLAG_DM)) {
|
||||
env->CP0_BadVAddr = address;
|
||||
}
|
||||
}
|
||||
|
||||
bool mips_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
|
||||
MMUAccessType access_type, int mmu_idx,
|
||||
bool probe, uintptr_t retaddr)
|
||||
{
|
||||
MIPSCPU *cpu = MIPS_CPU(cs);
|
||||
CPUMIPSState *env = &cpu->env;
|
||||
|
||||
/* data access */
|
||||
raise_mmu_exception(env, address, access_type);
|
||||
do_raise_exception_err(env, cs->exception_index, env->error_code, retaddr);
|
||||
}
|
||||
|
||||
void mips_cpu_do_interrupt(CPUState *cs)
|
||||
{
|
||||
cs->exception_index = EXCP_NONE;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue