[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 12/29] target/mips: Add simple user-mode mips_cpu_do_interrupt
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v2 12/29] target/mips: Add simple user-mode mips_cpu_do_interrupt() |
Date: |
Mon, 19 Apr 2021 00:50:41 +0200 |
The #ifdef'ry hides that the user-mode implementation of
mips_cpu_do_interrupt() simply sets exception_index = EXCP_NONE.
Add this simple implementation to tcg/user/tlb_helper.c, and
the corresponding Meson machinery to build this file when user
emulation is configured.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
v2: Renamed helper.c -> tlb_helper.c (rth)
---
target/mips/tcg/user/tlb_helper.c | 28 ++++++++++++++++++++++++++++
target/mips/tlb_helper.c | 5 -----
target/mips/meson.build | 5 +++++
target/mips/tcg/meson.build | 3 +++
target/mips/tcg/user/meson.build | 3 +++
5 files changed, 39 insertions(+), 5 deletions(-)
create mode 100644 target/mips/tcg/user/tlb_helper.c
create mode 100644 target/mips/tcg/meson.build
create mode 100644 target/mips/tcg/user/meson.build
diff --git a/target/mips/tcg/user/tlb_helper.c
b/target/mips/tcg/user/tlb_helper.c
new file mode 100644
index 00000000000..453b9e9b930
--- /dev/null
+++ b/target/mips/tcg/user/tlb_helper.c
@@ -0,0 +1,28 @@
+/*
+ * MIPS TLB (Translation lookaside buffer) helpers.
+ *
+ * Copyright (c) 2004-2005 Jocelyn Mayer
+ *
+ * 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"
+#include "exec/exec-all.h"
+#include "internal.h"
+
+void mips_cpu_do_interrupt(CPUState *cs)
+{
+ cs->exception_index = EXCP_NONE;
+}
diff --git a/target/mips/tlb_helper.c b/target/mips/tlb_helper.c
index 8d3ea497803..46e9555c9ab 100644
--- a/target/mips/tlb_helper.c
+++ b/target/mips/tlb_helper.c
@@ -964,11 +964,8 @@ static inline void set_badinstr_registers(CPUMIPSState
*env)
}
}
-#endif /* !CONFIG_USER_ONLY */
-
void mips_cpu_do_interrupt(CPUState *cs)
{
-#if !defined(CONFIG_USER_ONLY)
MIPSCPU *cpu = MIPS_CPU(cs);
CPUMIPSState *env = &cpu->env;
bool update_badinstr = 0;
@@ -1271,11 +1268,9 @@ void mips_cpu_do_interrupt(CPUState *cs)
env->CP0_Status, env->CP0_Cause, env->CP0_BadVAddr,
env->CP0_DEPC);
}
-#endif
cs->exception_index = EXCP_NONE;
}
-#if !defined(CONFIG_USER_ONLY)
void r4k_invalidate_tlb(CPUMIPSState *env, int idx, int use_extra)
{
CPUState *cs = env_cpu(env);
diff --git a/target/mips/meson.build b/target/mips/meson.build
index 15c2f835c68..ca3cc62cf7a 100644
--- a/target/mips/meson.build
+++ b/target/mips/meson.build
@@ -6,6 +6,7 @@
decodetree.process('tx79.decode', extra_args: '--static-decode=decode_tx79'),
]
+mips_user_ss = ss.source_set()
mips_ss = ss.source_set()
mips_ss.add(files(
'cpu.c',
@@ -34,6 +35,9 @@
), if_false: files(
'mxu_translate.c',
))
+if 'CONFIG_TCG' in config_all
+ subdir('tcg')
+endif
mips_ss.add(when: 'CONFIG_KVM', if_true: files('kvm.c'))
@@ -52,3 +56,4 @@
target_arch += {'mips': mips_ss}
target_softmmu_arch += {'mips': mips_softmmu_ss}
+target_user_arch += {'mips': mips_user_ss}
diff --git a/target/mips/tcg/meson.build b/target/mips/tcg/meson.build
new file mode 100644
index 00000000000..b74fa04303e
--- /dev/null
+++ b/target/mips/tcg/meson.build
@@ -0,0 +1,3 @@
+if have_user
+ subdir('user')
+endif
diff --git a/target/mips/tcg/user/meson.build b/target/mips/tcg/user/meson.build
new file mode 100644
index 00000000000..79badcd3217
--- /dev/null
+++ b/target/mips/tcg/user/meson.build
@@ -0,0 +1,3 @@
+mips_user_ss.add(files(
+ 'tlb_helper.c',
+))
--
2.26.3
- [PATCH v2 02/29] target/mips: Move IEEE rounding mode array to new source file, (continued)
- [PATCH v2 02/29] target/mips: Move IEEE rounding mode array to new source file, Philippe Mathieu-Daudé, 2021/04/18
- [PATCH v2 03/29] target/mips: Move msa_reset() to new source file, Philippe Mathieu-Daudé, 2021/04/18
- [PATCH v2 04/29] target/mips: Make CPU/FPU regnames[] arrays global, Philippe Mathieu-Daudé, 2021/04/18
- [PATCH v2 05/29] target/mips: Optimize CPU/FPU regnames[] arrays, Philippe Mathieu-Daudé, 2021/04/18
- [PATCH v2 06/29] target/mips: Restrict mips_cpu_dump_state() to cpu.c, Philippe Mathieu-Daudé, 2021/04/18
- [PATCH v2 07/29] target/mips: Turn printfpr() macro into a proper function, Philippe Mathieu-Daudé, 2021/04/18
- [PATCH v2 08/29] target/mips: Declare mips_cpu_set_error_pc() inlined in "internal.h", Philippe Mathieu-Daudé, 2021/04/18
- [PATCH v2 09/29] target/mips: Extract load/store helpers to ldst_helper.c, Philippe Mathieu-Daudé, 2021/04/18
- [PATCH v2 10/29] meson: Introduce meson_user_arch source set for arch-specific user-mode, Philippe Mathieu-Daudé, 2021/04/18
- [PATCH v2 11/29] target/mips: Introduce tcg-internal.h for TCG specific declarations, Philippe Mathieu-Daudé, 2021/04/18
- [PATCH v2 12/29] target/mips: Add simple user-mode mips_cpu_do_interrupt(),
Philippe Mathieu-Daudé <=
- [PATCH v2 13/29] target/mips: Add simple user-mode mips_cpu_tlb_fill(), Philippe Mathieu-Daudé, 2021/04/18
- [PATCH v2 14/29] target/mips: Move cpu_signal_handler definition around, Philippe Mathieu-Daudé, 2021/04/18
- [PATCH v2 15/29] target/mips: Move sysemu specific files under sysemu/ subfolder, Philippe Mathieu-Daudé, 2021/04/18
- [PATCH v2 16/29] target/mips: Move physical addressing code to sysemu/physaddr.c, Philippe Mathieu-Daudé, 2021/04/18
- [PATCH v2 17/29] target/mips: Restrict cpu_mips_get_random() / update_pagemask() to TCG, Philippe Mathieu-Daudé, 2021/04/18
- [PATCH v2 18/29] target/mips: Move sysemu TCG-specific code to tcg/sysemu/ subfolder, Philippe Mathieu-Daudé, 2021/04/18
- [PATCH v2 19/29] target/mips: Restrict mmu_init() to TCG, Philippe Mathieu-Daudé, 2021/04/18
- [PATCH v2 20/29] target/mips: Move tlb_helper.c to tcg/sysemu/, Philippe Mathieu-Daudé, 2021/04/18
- [PATCH v2 21/29] target/mips: Restrict CPUMIPSTLBContext::map_address() handlers scope, Philippe Mathieu-Daudé, 2021/04/18
- [PATCH v2 22/29] target/mips: Move Special opcodes to tcg/sysemu/special_helper.c, Philippe Mathieu-Daudé, 2021/04/18