aboutsummaryrefslogtreecommitdiff
path: root/bsd-user/x86_64/target_arch_sysarch.h
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2021-01-11 15:15:35 +0000
committerPeter Maydell <peter.maydell@linaro.org>2021-01-11 15:15:35 +0000
commitb3f846c59d8405bb87c551187721fc92ff2f1b92 (patch)
tree8218e587659d3f163767d4b260d3256328f70163 /bsd-user/x86_64/target_arch_sysarch.h
parent7b09f127738ae3d0e71716cea086fc8f847a5686 (diff)
parentb677001d70529df271a5d9314440bb201da40acf (diff)
Merge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2021-01-11v2' into staging
* Fuzzer improvements * Add OpenSUSE leap to the gitlab-CI * Some fixes to get our CI "green" again * Some initial patches to update bsd-user # gpg: Signature made Mon 11 Jan 2021 14:00:07 GMT # gpg: using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5 # gpg: issuer "thuth@redhat.com" # gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full] # gpg: aka "Thomas Huth <thuth@redhat.com>" [full] # gpg: aka "Thomas Huth <huth@tuxfamily.org>" [full] # gpg: aka "Thomas Huth <th.huth@posteo.de>" [unknown] # Primary key fingerprint: 27B8 8847 EEE0 2501 18F3 EAB9 2ED9 D774 FE70 2DB5 * remotes/huth-gitlab/tags/pull-request-2021-01-11v2: fuzz: map all BARs and enable PCI devices tests/acceptance: Fix race conditions in s390x tests & skip fedora on gitlab-CI bsd-user: Update strace.list for FreeBSD's latest syscalls bsd-user: move strace OS/arch dependent code to host/arch dirs bsd-user: regenerate FreeBSD's system call numbers fuzz: heuristic split write based on past IOs fuzz: add minimization options fuzz: set bits in operand of write/out to zero fuzz: remove IO commands iteratively fuzz: split write operand using binary approach fuzz: double the IOs to remove for every loop fuzz: accelerate non-crash detection util/oslib-win32: Fix _aligned_malloc() arguments order qtest/libqtest: fix heap-buffer-overflow in qtest_cb_for_every_machine() gitlab-ci.yml: Add openSUSE Leap 15.2 for gitlab CI/CD Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'bsd-user/x86_64/target_arch_sysarch.h')
-rw-r--r--bsd-user/x86_64/target_arch_sysarch.h76
1 files changed, 76 insertions, 0 deletions
diff --git a/bsd-user/x86_64/target_arch_sysarch.h b/bsd-user/x86_64/target_arch_sysarch.h
new file mode 100644
index 0000000000..5c36fc0752
--- /dev/null
+++ b/bsd-user/x86_64/target_arch_sysarch.h
@@ -0,0 +1,76 @@
+/*
+ * x86_64 sysarch() syscall emulation
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef BSD_USER_ARCH_SYSARCH_H_
+#define BSD_USER_ARCH_SYSARCH_H_
+
+#include "target_syscall.h"
+
+static inline abi_long do_freebsd_arch_sysarch(CPUX86State *env, int op,
+ abi_ulong parms)
+{
+ abi_long ret = 0;
+ abi_ulong val;
+ int idx;
+
+ switch (op) {
+ case TARGET_FREEBSD_AMD64_SET_GSBASE:
+ case TARGET_FREEBSD_AMD64_SET_FSBASE:
+ if (op == TARGET_FREEBSD_AMD64_SET_GSBASE) {
+ idx = R_GS;
+ } else {
+ idx = R_FS;
+ }
+ if (get_user(val, parms, abi_ulong)) {
+ return -TARGET_EFAULT;
+ }
+ cpu_x86_load_seg(env, idx, 0);
+ env->segs[idx].base = val;
+ break;
+
+ case TARGET_FREEBSD_AMD64_GET_GSBASE:
+ case TARGET_FREEBSD_AMD64_GET_FSBASE:
+ if (op == TARGET_FREEBSD_AMD64_GET_GSBASE) {
+ idx = R_GS;
+ } else {
+ idx = R_FS;
+ }
+ val = env->segs[idx].base;
+ if (put_user(val, parms, abi_ulong)) {
+ return -TARGET_EFAULT;
+ }
+ break;
+
+ /* XXX handle the others... */
+ default:
+ ret = -TARGET_EINVAL;
+ break;
+ }
+ return ret;
+}
+
+static inline void do_freebsd_arch_print_sysarch(
+ const struct syscallname *name, abi_long arg1, abi_long arg2,
+ abi_long arg3, abi_long arg4, abi_long arg5, abi_long arg6)
+{
+
+ gemu_log("%s(%d, " TARGET_ABI_FMT_lx ", " TARGET_ABI_FMT_lx ", "
+ TARGET_ABI_FMT_lx ")", name->name, (int)arg1, arg2, arg3, arg4);
+}
+
+#endif /*! BSD_USER_ARCH_SYSARCH_H_ */