[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 23/48] bsd-user: introduce host_os.h for bsd-specific code and
From: |
imp |
Subject: |
[PATCH v2 23/48] bsd-user: introduce host_os.h for bsd-specific code and defaults |
Date: |
Sat, 24 Apr 2021 09:59:51 -0600 |
From: Warner Losh <imp@bsdimp.com>
Introduce host_os.h for frebsd, netbsd and openbsd. This sets the default bsd
being implemented today. In the future it will have code that is per-BSD
specific. Abstracted from a larger c93465b6208c4c95cc0a394ffef4180ba6ccf27a in
the qemu-bsd-user repo.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Stacey Son <sson@FreeBSD.org>
Signed-off-by: Warner Losh <imp@bsdimp.com>
---
bsd-user/freebsd/host_os.h | 25 +++++++++++++++++++++++++
bsd-user/main.c | 4 +++-
bsd-user/netbsd/host_os.h | 25 +++++++++++++++++++++++++
bsd-user/openbsd/host_os.h | 25 +++++++++++++++++++++++++
4 files changed, 78 insertions(+), 1 deletion(-)
create mode 100644 bsd-user/freebsd/host_os.h
create mode 100644 bsd-user/netbsd/host_os.h
create mode 100644 bsd-user/openbsd/host_os.h
diff --git a/bsd-user/freebsd/host_os.h b/bsd-user/freebsd/host_os.h
new file mode 100644
index 0000000000..ceb1543d06
--- /dev/null
+++ b/bsd-user/freebsd/host_os.h
@@ -0,0 +1,25 @@
+/*
+ * FreeBSD host dependent code and definitions
+ *
+ * Copyright (c) 2013 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/>.
+ */
+
+#ifndef __HOST_OS_H_
+#define __HOST_OS_H_
+
+#define HOST_DEFAULT_BSD_TYPE target_freebsd
+
+#endif /*!__HOST_OS_H_ */
diff --git a/bsd-user/main.c b/bsd-user/main.c
index a98a45df21..a81a70f8ac 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -41,6 +41,8 @@
#include "exec/log.h"
#include "trace/control.h"
+#include "host_os.h"
+
int singlestep;
unsigned long mmap_min_addr;
uintptr_t guest_base;
@@ -619,7 +621,7 @@ int main(int argc, char **argv)
const char *gdbstub = NULL;
char **target_environ, **wrk;
envlist_t *envlist = NULL;
- bsd_type = target_openbsd;
+ bsd_type = HOST_DEFAULT_BSD_TYPE;
if (argc <= 1) {
usage();
diff --git a/bsd-user/netbsd/host_os.h b/bsd-user/netbsd/host_os.h
new file mode 100644
index 0000000000..ccbea076e6
--- /dev/null
+++ b/bsd-user/netbsd/host_os.h
@@ -0,0 +1,25 @@
+/*
+ * NetBSD host dependent code and definitions
+ *
+ * Copyright (c) 2013 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/>.
+ */
+
+#ifndef __HOST_OS_H_
+#define __HOST_OS_H_
+
+#define HOST_DEFAULT_BSD_TYPE target_netbsd
+
+#endif /*!__HOST_OS_H_ */
diff --git a/bsd-user/openbsd/host_os.h b/bsd-user/openbsd/host_os.h
new file mode 100644
index 0000000000..79468073e4
--- /dev/null
+++ b/bsd-user/openbsd/host_os.h
@@ -0,0 +1,25 @@
+/*
+ * OpenBSD host dependent code and definitions
+ *
+ * Copyright (c) 2013 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/>.
+ */
+
+#ifndef __HOST_OS_H_
+#define __HOST_OS_H_
+
+#define HOST_DEFAULT_BSD_TYPE target_openbsd
+
+#endif /*!__HOST_OS_H_ */
--
2.22.1
- [PATCH v2 37/48] bsd-user: style tweak: don't assign in if statements, (continued)
- [PATCH v2 37/48] bsd-user: style tweak: don't assign in if statements, imp, 2021/04/24
- [PATCH v2 41/48] bsd-user: style tweak: don't assign in if statements, imp, 2021/04/24
- [PATCH v2 40/48] bsd-user: style tweak: Use preferred block comments, imp, 2021/04/24
- [PATCH v2 43/48] bsd-user: style tweak: fold long lines, imp, 2021/04/24
- [PATCH v2 29/48] bsd-user: style tweak: use {} correctly, imp, 2021/04/24
- [PATCH v2 23/48] bsd-user: introduce host_os.h for bsd-specific code and defaults,
imp <=
- [PATCH v2 45/48] bsd-user: style tweak: Use preferred {} in if/else statements., imp, 2021/04/24
- [PATCH v2 31/48] bsd-user: style tweak: use {} for all if statements, format else correctly, imp, 2021/04/24
- [PATCH v2 39/48] bsd-user: style tweak: spaces around =, remove stray space, imp, 2021/04/24
- [PATCH v2 11/48] bsd-user: style tweak: Remove #if 0'd code, imp, 2021/04/24
- [PATCH v2 25/48] bsd-user: move x86 (i386 and x86_64) cpu_loop to target_arch_cpu.h, imp, 2021/04/24