@samitouri / QOSamiQemu / commits / e83a42cbf7

linux-user/mips: implement sysmips(MIPS_FLUSH_CACHE)

Add the target sysmips dispatcher and implement MIPS_FLUSH_CACHE as a successful no-op for linux-user. Self-modifying code is handled by QEMU's normal user-mode translation invalidation machinery, so the target ABI only needs the syscall command to be accepted. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: James Hilliard <james.hilliard1@gmail.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-Id: <20260520172313.23777-2-philmd@linaro.org>

James Hilliard committed May 8, 2026 at 09:13 UTC e83a42cbf72bf83eabb71d85be88df34c953b158
3 files changed +19
linux-user/mips/target_syscall.h
+1
@@ -10,6 +10,7 @@
10 #define TARGET_MCL_ONFAULT 4
11
12 #define TARGET_FORCE_SHMLBA
13 +#define TARGET_SYSMIPS_FLUSH_CACHE 3
14
15 static inline abi_ulong target_shmlba(CPUMIPSState *env)
16 {
linux-user/mips64/target_syscall.h
+1
@@ -10,6 +10,7 @@
10 #define TARGET_MCL_ONFAULT 4
11
12 #define TARGET_FORCE_SHMLBA
13 +#define TARGET_SYSMIPS_FLUSH_CACHE 3
14
15 static inline abi_ulong target_shmlba(CPUMIPSState *env)
16 {
linux-user/syscall.c
+17
@@ -6630,6 +6630,19 @@ static abi_long do_prctl_syscall_user_dispatch(CPUArchState *env,
6630 }
6631 }
6632
6633 +#ifdef TARGET_NR_sysmips
6634 +static abi_long do_sysmips(CPUArchState *env, abi_long cmd, abi_long arg1,
6635 + abi_long arg2)
6636 +{
6637 + switch (cmd) {
6638 + case TARGET_SYSMIPS_FLUSH_CACHE:
6639 + return 0;
6640 + default:
6641 + return -TARGET_EINVAL;
6642 + }
6643 +}
6644 +#endif
6645 +
6646 static abi_long do_prctl(CPUArchState *env, abi_long option, abi_long arg2,
6647 abi_long arg3, abi_long arg4, abi_long arg5)
6648 {
@@ -12110,6 +12123,10 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
12123 case TARGET_NR_prctl:
12124 return do_prctl(cpu_env, arg1, arg2, arg3, arg4, arg5);
12125 break;
12126 +#ifdef TARGET_NR_sysmips
12127 + case TARGET_NR_sysmips:
12128 + return do_sysmips(cpu_env, arg1, arg2, arg3);
12129 +#endif
12130 #ifdef TARGET_NR_arch_prctl
12131 case TARGET_NR_arch_prctl:
12132 return do_arch_prctl(cpu_env, arg1, arg2);