target/sh4: Split user/system helpers
PATCH 1/1 target/sh4: Split user/system helpers
cpu_sh4_is_cached() is the single user-emulation helper:
move the function to its own file and simplify the #ifdef'ry.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
---
Based-on: <[email protected]>
---
target/sh4/{helper.c => helper_system.c} | 15 +------------
target/sh4/helper_user.c | 28 ++++++++++++++++++++++++
target/sh4/meson.build | 10 +++++++--
3 files changed, 37 insertions(+), 16 deletions(-)
rename target/sh4/{helper.c => helper_system.c} (98%)
create mode 100644 target/sh4/helper_user.ctarget/sh4/helper_system.c renamed from target/sh4/helper.c +1 -14
@@ -1,5 +1,5 @@/* -* SH4 emulation +* SH4 system emulation helpers * * Copyright (c) 2005 Samuel Tardieu *
@@ -23,10 +23,8 @@#include "exec/exec-all.h" #include "exec/log.h" -#if !defined(CONFIG_USER_ONLY )#include "hw/sh4/sh_intc.h" #include "sysemu/runstate.h" -#endif #define MMU_OK 0#define MMU_ITLB_MISS (-1)
@@ -43,16 +41,6 @@#define MMU_DADDR_ERROR_READ (-12)#define MMU_DADDR_ERROR_WRITE (-13) -#if defined(CONFIG_USER_ONLY ) - -int cpu_sh4_is_cached (CPUSH4State *env,target_ulong addr) -{ -/* For user mode, only U0 area is cacheable. */ -return !(addr &0x80000000 ); -} - -#else /* !CONFIG_USER_ONLY */ -void superh_cpu_do_interrupt (CPUState *cs) {SuperHCPU *cpu =SUPERH_CPU (cs);
@@ -860,4 +848,3 @@ bool superh_cpu_tlb_fill(CPUState *cs, vaddr address, int size, }cpu_loop_exit_restore (cs, retaddr); } -#endif /* !CONFIG_USER_ONLY */
target/sh4/helper_user.c new file +28 -0
@@ -0,0 +1,28 @@ +/* +* SH4 user emulation helpers +* +* Copyright (c) 2005 Samuel Tardieu +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; either +* version 2.1 of the License, or (at your option) any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, see <http://www.gnu.org/licenses/>. +*/ + +#include "qemu/osdep.h" + +#include "cpu.h" + +int cpu_sh4_is_cached (CPUSH4State *env,target_ulong addr) +{ +/* For user mode, only U0 area is cacheable. */ +return !(addr &0x80000000 ); +}
target/sh4/meson.build +8 -2
@@ -2,13 +2,19 @@ sh4_ss.add(files( 'cpu.c', 'gdbstub.c', - 'helper.c', 'op_helper.c', 'translate.c', )) +sh4_user_ss = ss.source_set() +sh4_user_ss.add(files('helper_user.c')) + sh4_softmmu_ss = ss.source_set() -sh4_softmmu_ss.add(files('monitor.c')) +sh4_softmmu_ss.add(files( + 'monitor.c', + 'helper_system.c', +)) target_arch += {'sh4': sh4_ss} target_softmmu_arch += {'sh4': sh4_softmmu_ss} +target_user_arch += {'sh4': sh4_user_ss}
Signature · 1 line
2.31.1