summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bsd-user/freebsd/meson.build3
-rw-r--r--bsd-user/freebsd/os-sys.c27
-rw-r--r--bsd-user/meson.build3
-rw-r--r--bsd-user/qemu.h3
-rw-r--r--bsd-user/syscall.c50
5 files changed, 36 insertions, 50 deletions
diff --git a/bsd-user/freebsd/meson.build b/bsd-user/freebsd/meson.build
new file mode 100644
index 0000000000..4b69cca7b9
--- /dev/null
+++ b/bsd-user/freebsd/meson.build
@@ -0,0 +1,3 @@
+bsd_user_ss.add(files(
+ 'os-sys.c',
+))
diff --git a/bsd-user/freebsd/os-sys.c b/bsd-user/freebsd/os-sys.c
new file mode 100644
index 0000000000..309e27b9d6
--- /dev/null
+++ b/bsd-user/freebsd/os-sys.c
@@ -0,0 +1,27 @@
+/*
+ * FreeBSD sysctl() and sysarch() system call emulation
+ *
+ * Copyright (c) 2013-15 Stacey D. Son
+ *
+ * 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/>.
+ */
+
+#include "qemu.h"
+#include "target_arch_sysarch.h"
+
+/* sysarch() is architecture dependent. */
+abi_long do_freebsd_sysarch(void *cpu_env, abi_long arg1, abi_long arg2)
+{
+ return do_freebsd_arch_sysarch(cpu_env, arg1, arg2);
+}
diff --git a/bsd-user/meson.build b/bsd-user/meson.build
index 5378f56f71..87885d91ed 100644
--- a/bsd-user/meson.build
+++ b/bsd-user/meson.build
@@ -12,3 +12,6 @@ bsd_user_ss.add(files(
'syscall.c',
'uaccess.c',
))
+
+# Pull in the OS-specific build glue, if any
+subdir(targetos)
diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h
index cdb85140f4..e65e41d53d 100644
--- a/bsd-user/qemu.h
+++ b/bsd-user/qemu.h
@@ -239,6 +239,9 @@ extern unsigned long target_sgrowsiz;
abi_long get_errno(abi_long ret);
bool is_error(abi_long ret);
+/* os-sys.c */
+abi_long do_freebsd_sysarch(void *cpu_env, abi_long arg1, abi_long arg2);
+
/* user access */
#define VERIFY_READ PAGE_READ
diff --git a/bsd-user/syscall.c b/bsd-user/syscall.c
index 2fd2ba8330..d3322760f4 100644
--- a/bsd-user/syscall.c
+++ b/bsd-user/syscall.c
@@ -88,56 +88,6 @@ static abi_long do_obreak(abi_ulong new_brk)
return 0;
}
-#if defined(TARGET_I386)
-static abi_long do_freebsd_sysarch(CPUX86State *env, int op, abi_ulong parms)
-{
- abi_long ret = 0;
- abi_ulong val;
- int idx;
-
- switch (op) {
-#ifdef TARGET_ABI32
- case TARGET_FREEBSD_I386_SET_GSBASE:
- case TARGET_FREEBSD_I386_SET_FSBASE:
- if (op == TARGET_FREEBSD_I386_SET_GSBASE)
-#else
- case TARGET_FREEBSD_AMD64_SET_GSBASE:
- case TARGET_FREEBSD_AMD64_SET_FSBASE:
- if (op == TARGET_FREEBSD_AMD64_SET_GSBASE)
-#endif
- 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;
-#ifdef TARGET_ABI32
- case TARGET_FREEBSD_I386_GET_GSBASE:
- case TARGET_FREEBSD_I386_GET_FSBASE:
- if (op == TARGET_FREEBSD_I386_GET_GSBASE)
-#else
- case TARGET_FREEBSD_AMD64_GET_GSBASE:
- case TARGET_FREEBSD_AMD64_GET_FSBASE:
- if (op == TARGET_FREEBSD_AMD64_GET_GSBASE)
-#endif
- 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;
-}
-#endif
-
#ifdef __FreeBSD__
/*
* XXX this uses the undocumented oidfmt interface to find the kind of