File mempolicy.patch of Package qemu
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 7166be7b82..0956a7b310 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -427,6 +427,15 @@ _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
+#if defined(TARGET_NR_move_pages) && defined(__NR_move_pages)
+_syscall6(long, move_pages, pid_t, pid, unsigned long, nr_pages,
+ const void **, pages, const int *, nodes, int *, status,
+ int, flags)
+#endif
static const bitmask_transtbl fcntl_flags_tbl[] = {
{ TARGET_O_ACCMODE, TARGET_O_WRONLY, O_ACCMODE, O_WRONLY, },
@@ -14076,6 +14085,64 @@ 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
+
+#if defined(TARGET_NR_move_pages) && defined(__NR_move_pages)
+ case TARGET_NR_move_pages:
+ {
+ int *nodes = 0;
+ const void **pages;
+ int *status;
+ unsigned long total_size = arg2 * sizeof(abi_ulong);
+ pages = lock_user(VERIFY_READ, arg3, total_size, 1);
+ if (!pages) {
+ return -TARGET_EFAULT;
+ }
+ if (arg4) {
+ nodes = lock_user(VERIFY_READ, arg4, total_size, 1);
+ if (!nodes) {
+ unlock_user(pages, arg3, total_size);
+ return -TARGET_EFAULT;
+ }
+ }
+ status = lock_user(VERIFY_WRITE, arg5, arg2 * 4, 0);
+ if (!status) {
+ unlock_user(pages, arg3, total_size);
+ unlock_user(nodes, arg4, total_size);
+ return -TARGET_EFAULT;
+ }
+ ret = get_errno(move_pages(arg1, arg2, pages, nodes, status, arg6));
+ unlock_user(pages, arg3, total_size);
+ unlock_user(nodes, arg4, total_size);
+ unlock_user(status, arg5, arg2 * 4);
+ }
+ return ret;
+#endif
+
default:
qemu_log_mask(LOG_UNIMP, "Unsupported syscall: %d\n", num);
return -TARGET_ENOSYS;