[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 20/24] bsd-user: introduce host_os.h for bsd-specific code and def
From: |
imp |
Subject: |
[PULL 20/24] bsd-user: introduce host_os.h for bsd-specific code and defaults |
Date: |
Fri, 23 Apr 2021 14:39:55 -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.
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 95fda8c5ae..fbcc8cc28c 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -40,6 +40,8 @@
#include "exec/log.h"
#include "trace/control.h"
+#include "host_os.h"
+
int singlestep;
unsigned long mmap_min_addr;
uintptr_t guest_base;
@@ -761,7 +763,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
[PULL 12/24] bsd-user: style tweak: if 0 -> ifdef notyet for code needed in future, imp, 2021/04/23
[PULL 20/24] bsd-user: introduce host_os.h for bsd-specific code and defaults,
imp <=
[PULL 13/24] bsd-user: style tweak: if 0 -> ifdef notyet for code needed in future, imp, 2021/04/23
[PULL 14/24] bsd-user: style tweak: if 0 -> ifdef notyet for code needed in future, imp, 2021/04/23
[PULL 15/24] bsd-user: Fix commentary issues, imp, 2021/04/23
[PULL 19/24] bsd-user: use qemu_strtol in preference to strtol, imp, 2021/04/23