File mempolicy.patch of Package qemu
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 770aeae33f..d9335318fa 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -429,6 +429,10 @@ _syscall5(int, sys_statx, int, dirfd, const char *, pathname, int, flags,
#if defined(TARGET_NR_membarrier) && defined(__NR_membarrier)
_syscall2(int, membarrier, int, cmd, int, flags)
#endif
+#if defined(TARGET_NR_get_mempolicy) && defined(__NR_get_mempolicy)
+_syscall5(long, get_mempolicy, int *, mode, unsigned long *, nodemask,
+ unsigned long, maxnode, unsigned long, addr, unsigned long, flags)
+#endif
static const bitmask_transtbl fcntl_flags_tbl[] = {
{ TARGET_O_ACCMODE, TARGET_O_WRONLY, O_ACCMODE, O_WRONLY, },
@@ -13974,6 +13978,32 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
return do_riscv_hwprobe(cpu_env, arg1, arg2, arg3, arg4, arg5);
#endif
+#if defined(TARGET_NR_get_mempolicy) && defined(__NR_get_mempolicy)
+ case TARGET_NR_get_mempolicy:
+ {
+ int *mode = 0;
+ void *p1 = 0;
+ unsigned long maxnode;
+ if (arg1) {
+ mode = lock_user(VERIFY_WRITE, arg1, 4, 0);
+ if (!mode)
+ return -TARGET_EFAULT;
+ }
+ maxnode = DIV_ROUND_UP(arg3, TARGET_ABI_BITS);
+ if (arg2) {
+ p1 = lock_user(VERIFY_WRITE, arg2, maxnode, 0);
+ if (!p1) {
+ unlock_user(mode, arg1, 4);
+ return -TARGET_EFAULT;
+ }
+ }
+ ret = get_errno(get_mempolicy(mode, p1, arg3, arg4, arg5));
+ unlock_user(p1, arg2, maxnode);
+ unlock_user(mode, arg1, 4);
+ }
+ return ret;
+#endif
+
default:
qemu_log_mask(LOG_UNIMP, "Unsupported syscall: %d\n", num);
return -TARGET_ENOSYS;