aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2021-11-17 16:14:00 +0100
committerRichard Henderson <richard.henderson@linaro.org>2021-12-20 10:12:24 -0800
commitbbf15aaf7c7506c88062288b3ae122b882f65e69 (patch)
tree35c44f9cb40a66389e85da8afbb4fd65efc71af2
parent2ac16d01e371ba9fb268f04249eaca9fafceb00b (diff)
common-user: Move safe-syscall.* from linux-user
Move linux-user safe-syscall.S and safe-syscall-error.c to common-user so that bsd-user can also use it. Also move safe-syscall.h to include/user/. Since there is nothing here that is related to the guest, as opposed to the host, build it once. Reviewed-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
-rw-r--r--MAINTAINERS2
-rw-r--r--bsd-user/meson.build2
-rw-r--r--common-user/host/aarch64/safe-syscall.inc.S (renamed from linux-user/host/aarch64/safe-syscall.inc.S)2
-rw-r--r--common-user/host/arm/safe-syscall.inc.S (renamed from linux-user/host/arm/safe-syscall.inc.S)2
-rw-r--r--common-user/host/i386/safe-syscall.inc.S (renamed from linux-user/host/i386/safe-syscall.inc.S)2
-rw-r--r--common-user/host/mips/safe-syscall.inc.S (renamed from linux-user/host/mips/safe-syscall.inc.S)2
-rw-r--r--common-user/host/ppc64/safe-syscall.inc.S (renamed from linux-user/host/ppc64/safe-syscall.inc.S)2
-rw-r--r--common-user/host/riscv/safe-syscall.inc.S (renamed from linux-user/host/riscv/safe-syscall.inc.S)2
-rw-r--r--common-user/host/s390x/safe-syscall.inc.S (renamed from linux-user/host/s390x/safe-syscall.inc.S)2
-rw-r--r--common-user/host/sparc64/safe-syscall.inc.S (renamed from linux-user/host/sparc64/safe-syscall.inc.S)2
-rw-r--r--common-user/host/x86_64/safe-syscall.inc.S (renamed from linux-user/host/x86_64/safe-syscall.inc.S)2
-rw-r--r--common-user/meson.build6
-rw-r--r--common-user/safe-syscall-error.c (renamed from linux-user/safe-syscall-error.c)2
-rw-r--r--common-user/safe-syscall.S (renamed from linux-user/safe-syscall.S)0
-rw-r--r--include/user/safe-syscall.h (renamed from linux-user/safe-syscall.h)0
-rw-r--r--linux-user/meson.build5
-rw-r--r--linux-user/signal.c2
-rw-r--r--linux-user/syscall.c2
-rw-r--r--meson.build18
19 files changed, 42 insertions, 15 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 9a8d1bdf72..be8fc57538 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3079,6 +3079,8 @@ M: Riku Voipio <riku.voipio@iki.fi>
S: Maintained
F: thunk.c
F: accel/tcg/user-exec*.c
+F: include/user/
+F: common-user/
BSD user
M: Warner Losh <imp@bsdimp.com>
diff --git a/bsd-user/meson.build b/bsd-user/meson.build
index 87885d91ed..25c3976ead 100644
--- a/bsd-user/meson.build
+++ b/bsd-user/meson.build
@@ -2,6 +2,8 @@ if not have_bsd_user
subdir_done()
endif
+common_user_inc += include_directories('.')
+
bsd_user_ss.add(files(
'bsdload.c',
'elfload.c',
diff --git a/linux-user/host/aarch64/safe-syscall.inc.S b/common-user/host/aarch64/safe-syscall.inc.S
index 87c9580faa..73a04b73b3 100644
--- a/linux-user/host/aarch64/safe-syscall.inc.S
+++ b/common-user/host/aarch64/safe-syscall.inc.S
@@ -1,7 +1,7 @@
/*
* safe-syscall.inc.S : host-specific assembly fragment
* to handle signals occurring at the same time as system calls.
- * This is intended to be included by linux-user/safe-syscall.S
+ * This is intended to be included by common-user/safe-syscall.S
*
* Written by Richard Henderson <rth@twiddle.net>
* Copyright (C) 2016 Red Hat, Inc.
diff --git a/linux-user/host/arm/safe-syscall.inc.S b/common-user/host/arm/safe-syscall.inc.S
index f1a6aabfd3..66176a902c 100644
--- a/linux-user/host/arm/safe-syscall.inc.S
+++ b/common-user/host/arm/safe-syscall.inc.S
@@ -1,7 +1,7 @@
/*
* safe-syscall.inc.S : host-specific assembly fragment
* to handle signals occurring at the same time as system calls.
- * This is intended to be included by linux-user/safe-syscall.S
+ * This is intended to be included by common-user/safe-syscall.S
*
* Written by Richard Henderson <rth@twiddle.net>
* Copyright (C) 2016 Red Hat, Inc.
diff --git a/linux-user/host/i386/safe-syscall.inc.S b/common-user/host/i386/safe-syscall.inc.S
index 1fb031d228..aced8c5141 100644
--- a/linux-user/host/i386/safe-syscall.inc.S
+++ b/common-user/host/i386/safe-syscall.inc.S
@@ -1,7 +1,7 @@
/*
* safe-syscall.inc.S : host-specific assembly fragment
* to handle signals occurring at the same time as system calls.
- * This is intended to be included by linux-user/safe-syscall.S
+ * This is intended to be included by common-user/safe-syscall.S
*
* Written by Richard Henderson <rth@twiddle.net>
* Copyright (C) 2016 Red Hat, Inc.
diff --git a/linux-user/host/mips/safe-syscall.inc.S b/common-user/host/mips/safe-syscall.inc.S
index e9362e774d..fc75a337d1 100644
--- a/linux-user/host/mips/safe-syscall.inc.S
+++ b/common-user/host/mips/safe-syscall.inc.S
@@ -1,7 +1,7 @@
/*
* safe-syscall.inc.S : host-specific assembly fragment
* to handle signals occurring at the same time as system calls.
- * This is intended to be included by linux-user/safe-syscall.S
+ * This is intended to be included by common-user/safe-syscall.S
*
* Written by Richard Henderson <richard.henderson@linaro.org>
* Copyright (C) 2021 Linaro, Inc.
diff --git a/linux-user/host/ppc64/safe-syscall.inc.S b/common-user/host/ppc64/safe-syscall.inc.S
index 69d3c70094..947a850dfd 100644
--- a/linux-user/host/ppc64/safe-syscall.inc.S
+++ b/common-user/host/ppc64/safe-syscall.inc.S
@@ -1,7 +1,7 @@
/*
* safe-syscall.inc.S : host-specific assembly fragment
* to handle signals occurring at the same time as system calls.
- * This is intended to be included by linux-user/safe-syscall.S
+ * This is intended to be included by common-user/safe-syscall.S
*
* Written by Richard Henderson <rth@twiddle.net>
* Copyright (C) 2016 Red Hat, Inc.
diff --git a/linux-user/host/riscv/safe-syscall.inc.S b/common-user/host/riscv/safe-syscall.inc.S
index ca456d8a46..dfe83c300e 100644
--- a/linux-user/host/riscv/safe-syscall.inc.S
+++ b/common-user/host/riscv/safe-syscall.inc.S
@@ -1,7 +1,7 @@
/*
* safe-syscall.inc.S : host-specific assembly fragment
* to handle signals occurring at the same time as system calls.
- * This is intended to be included by linux-user/safe-syscall.S
+ * This is intended to be included by common-user/safe-syscall.S
*
* Written by Richard Henderson <rth@twiddle.net>
* Copyright (C) 2018 Linaro, Inc.
diff --git a/linux-user/host/s390x/safe-syscall.inc.S b/common-user/host/s390x/safe-syscall.inc.S
index 66f84385a2..2ccbaa2402 100644
--- a/linux-user/host/s390x/safe-syscall.inc.S
+++ b/common-user/host/s390x/safe-syscall.inc.S
@@ -1,7 +1,7 @@
/*
* safe-syscall.inc.S : host-specific assembly fragment
* to handle signals occurring at the same time as system calls.
- * This is intended to be included by linux-user/safe-syscall.S
+ * This is intended to be included by common-user/safe-syscall.S
*
* Written by Richard Henderson <rth@twiddle.net>
* Copyright (C) 2016 Red Hat, Inc.
diff --git a/linux-user/host/sparc64/safe-syscall.inc.S b/common-user/host/sparc64/safe-syscall.inc.S
index f4b3c0f9ae..a2f2b9c967 100644
--- a/linux-user/host/sparc64/safe-syscall.inc.S
+++ b/common-user/host/sparc64/safe-syscall.inc.S
@@ -1,7 +1,7 @@
/*
* safe-syscall.inc.S : host-specific assembly fragment
* to handle signals occurring at the same time as system calls.
- * This is intended to be included by linux-user/safe-syscall.S
+ * This is intended to be included by common-user/safe-syscall.S
*
* Written by Richard Henderson <richard.henderson@linaro.org>
* Copyright (C) 2021 Linaro, Inc.
diff --git a/linux-user/host/x86_64/safe-syscall.inc.S b/common-user/host/x86_64/safe-syscall.inc.S
index f88cbe1347..84fed206f9 100644
--- a/linux-user/host/x86_64/safe-syscall.inc.S
+++ b/common-user/host/x86_64/safe-syscall.inc.S
@@ -1,7 +1,7 @@
/*
* safe-syscall.inc.S : host-specific assembly fragment
* to handle signals occurring at the same time as system calls.
- * This is intended to be included by linux-user/safe-syscall.S
+ * This is intended to be included by common-user/safe-syscall.S
*
* Copyright (C) 2015 Timothy Edward Baldwin <T.E.Baldwin99@members.leeds.ac.uk>
*
diff --git a/common-user/meson.build b/common-user/meson.build
new file mode 100644
index 0000000000..5cb42bc664
--- /dev/null
+++ b/common-user/meson.build
@@ -0,0 +1,6 @@
+common_user_inc += include_directories('host/' / host_arch)
+
+common_user_ss.add(files(
+ 'safe-syscall.S',
+ 'safe-syscall-error.c',
+))
diff --git a/linux-user/safe-syscall-error.c b/common-user/safe-syscall-error.c
index 55d95ac39a..cf74b504f8 100644
--- a/linux-user/safe-syscall-error.c
+++ b/common-user/safe-syscall-error.c
@@ -10,7 +10,7 @@
*/
#include "qemu/osdep.h"
-#include "safe-syscall.h"
+#include "user/safe-syscall.h"
/*
* This is intended to be invoked via tail-call on the error path
diff --git a/linux-user/safe-syscall.S b/common-user/safe-syscall.S
index 74f7e35694..74f7e35694 100644
--- a/linux-user/safe-syscall.S
+++ b/common-user/safe-syscall.S
diff --git a/linux-user/safe-syscall.h b/include/user/safe-syscall.h
index 61a04e2b5a..61a04e2b5a 100644
--- a/linux-user/safe-syscall.h
+++ b/include/user/safe-syscall.h
diff --git a/linux-user/meson.build b/linux-user/meson.build
index 94ac3c58ce..eef1dd68bd 100644
--- a/linux-user/meson.build
+++ b/linux-user/meson.build
@@ -2,6 +2,9 @@ if not have_linux_user
subdir_done()
endif
+common_user_inc += include_directories('host/' / host_arch)
+common_user_inc += include_directories('.')
+
linux_user_ss.add(files(
'elfload.c',
'exit.c',
@@ -9,8 +12,6 @@ linux_user_ss.add(files(
'linuxload.c',
'main.c',
'mmap.c',
- 'safe-syscall.S',
- 'safe-syscall-error.c',
'signal.c',
'strace.c',
'syscall.c',
diff --git a/linux-user/signal.c b/linux-user/signal.c
index 12b1705287..510db73c34 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -31,7 +31,7 @@
#include "trace.h"
#include "signal-common.h"
#include "host-signal.h"
-#include "safe-syscall.h"
+#include "user/safe-syscall.h"
static struct target_sigaction sigact_table[TARGET_NSIG];
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index f5bf6d155c..56a3e17183 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -132,7 +132,7 @@
#include "signal-common.h"
#include "loader.h"
#include "user-mmap.h"
-#include "safe-syscall.h"
+#include "user/safe-syscall.h"
#include "qemu/guest-random.h"
#include "qemu/selfmap.h"
#include "user/syscall-trace.h"
diff --git a/meson.build b/meson.build
index 2495360fd0..4e0a8033f7 100644
--- a/meson.build
+++ b/meson.build
@@ -2378,6 +2378,7 @@ block_ss = ss.source_set()
bsd_user_ss = ss.source_set()
chardev_ss = ss.source_set()
common_ss = ss.source_set()
+common_user_ss = ss.source_set()
crypto_ss = ss.source_set()
hwcore_ss = ss.source_set()
io_ss = ss.source_set()
@@ -2622,15 +2623,30 @@ subdir('tcg')
subdir('fpu')
subdir('accel')
subdir('plugins')
+subdir('ebpf')
+
+common_user_inc = []
+
+subdir('common-user')
subdir('bsd-user')
subdir('linux-user')
-subdir('ebpf')
specific_ss.add_all(when: 'CONFIG_BSD_USER', if_true: bsd_user_ss)
linux_user_ss.add(files('thunk.c'))
specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true: linux_user_ss)
+common_user_ss = common_user_ss.apply(config_all, strict: false)
+common_user = static_library('common-user',
+ sources: common_user_ss.sources(),
+ dependencies: common_user_ss.dependencies(),
+ include_directories: common_user_inc,
+ name_suffix: 'fa',
+ build_by_default: false)
+common_user = declare_dependency(link_with: common_user)
+
+user_ss.add(common_user)
+
# needed for fuzzing binaries
subdir('tests/qtest/libqos')
subdir('tests/qtest/fuzz')