From: Warner Losh <imp@bsdimp.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
arrowd@FreeBSD.org, Kyle Evans <kevans@FreeBSD.org>,
Richard Henderson <richard.henderson@linaro.org>,
def@FreeBSD.org, jrtc27@FreeBSD.org, Warner Losh <imp@bsdimp.com>,
Brad Smith <brad@comstyle.com>
Subject: [PULL 14/16] bsd-user: introduce target.h
Date: Mon, 28 Feb 2022 11:12:12 -0700 [thread overview]
Message-ID: <20220228181214.2602-15-imp@bsdimp.com> (raw)
In-Reply-To: <20220228181214.2602-1-imp@bsdimp.com>
Create target.h. This file is intended to be simple and describe basic
things about the architecture. If something is a basic feature of the
architecture, it belongs here. Should we need something that's per-BSD
there will be a target-os.h that will live in the per-bsd directories.
Define regpairs_aligned to reflect whether or not registers are 'paired'
for 64-bit arguments or not. This will be false for all 64-bit targets,
and will be true on those architectures that pair (currently just armv7
and powerpc on FreeBSD 14.x).
Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
bsd-user/arm/target.h | 21 +++++++++++++++++++++
bsd-user/i386/target.h | 21 +++++++++++++++++++++
bsd-user/qemu.h | 1 +
bsd-user/x86_64/target.h | 21 +++++++++++++++++++++
4 files changed, 64 insertions(+)
create mode 100644 bsd-user/arm/target.h
create mode 100644 bsd-user/i386/target.h
create mode 100644 bsd-user/x86_64/target.h
diff --git a/bsd-user/arm/target.h b/bsd-user/arm/target.h
new file mode 100644
index 00000000000..419c039b68e
--- /dev/null
+++ b/bsd-user/arm/target.h
@@ -0,0 +1,21 @@
+/*
+ * Intel general target stuff that's common to all i386 details
+ *
+ * Copyright (c) 2022 M. Warner Losh <imp@bsdimp.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef TARGET_H
+#define TARGET_H
+
+/*
+ * arm EABI 'lumps' the registers for 64-bit args.
+ */
+static inline bool regpairs_aligned(void *cpu_env)
+{
+ return true;
+}
+
+#endif /* ! TARGET_H */
+
diff --git a/bsd-user/i386/target.h b/bsd-user/i386/target.h
new file mode 100644
index 00000000000..9b9df047a3b
--- /dev/null
+++ b/bsd-user/i386/target.h
@@ -0,0 +1,21 @@
+/*
+ * Intel general target stuff that's common to all i386 details
+ *
+ * Copyright (c) 2022 M. Warner Losh <imp@bsdimp.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef TARGET_ARCH_H
+#define TARGET_ARCH_H
+
+/*
+ * i386 doesn't 'lump' the registers for 64-bit args.
+ */
+static inline bool regpairs_aligned(void *cpu_env)
+{
+ return false;
+}
+
+#endif /* ! TARGET_ARCH_H */
+
diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h
index 56042ddbc5d..a9efa807b78 100644
--- a/bsd-user/qemu.h
+++ b/bsd-user/qemu.h
@@ -35,6 +35,7 @@ extern char **environ;
#include "target_syscall.h"
#include "target_os_vmparam.h"
#include "target_os_signal.h"
+#include "target.h"
#include "exec/gdbstub.h"
/*
diff --git a/bsd-user/x86_64/target.h b/bsd-user/x86_64/target.h
new file mode 100644
index 00000000000..8956631db1d
--- /dev/null
+++ b/bsd-user/x86_64/target.h
@@ -0,0 +1,21 @@
+/*
+ * Intel general target stuff that's common to all x86_64 details
+ *
+ * Copyright (c) 2022 M. Warner Losh <imp@bsdimp.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef TARGET_H
+#define TARGET_H
+
+/*
+ * x86 doesn't 'lump' the registers for 64-bit args, all args are 64 bits.
+ */
+static inline bool regpairs_aligned(void *cpu_env)
+{
+ return false;
+}
+
+#endif /* ! TARGET_H */
+
--
2.33.1
next prev parent reply other threads:[~2022-02-28 18:21 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-28 18:11 [PULL 00/16] Bsd user preen 2022q1 patches Warner Losh
2022-02-28 18:11 ` [PULL 01/16] bsd-user/main.c: Drop syscall flavor arg -bsd Warner Losh
2022-02-28 18:12 ` [PULL 02/16] bsd-user/x86_64/target_arch_cpu.h: int $80 never was a BSD system call on amd64 Warner Losh
2022-02-28 18:12 ` [PULL 03/16] bsd-user/x86_64/target_arch_cpu.h: Remove openbsd syscall Warner Losh
2022-02-28 18:12 ` [PULL 04/16] bsd-user/i386/target_arch_cpu.h: " Warner Losh
2022-02-28 18:12 ` [PULL 05/16] bsd-user/arm/target_arch_cpu.h: Only support FreeBSD sys calls Warner Losh
2022-02-28 18:12 ` [PULL 06/16] bsd-user/arm/target_arch_thread.h: Assume a FreeBSD target Warner Losh
2022-02-28 18:12 ` [PULL 07/16] bsd-user/x86_64/target_arch_thread.h: " Warner Losh
2022-02-28 18:12 ` [PULL 08/16] bsd-user: Remove bsd_type Warner Losh
2022-02-28 18:12 ` [PULL 09/16] bsd-user/freebsd/os-syscall.c: Move syscall processing here Warner Losh
2022-02-28 18:12 ` [PULL 10/16] bsd-user: Move system call building to os-syscall.c Warner Losh
2022-02-28 18:12 ` [PULL 11/16] bsd-user/sycall.c: Now obsolete, remove Warner Losh
2022-02-28 18:12 ` [PULL 12/16] bsd-user/freebsd/os-syscall.c: Add get_errno and host_to_target_errno Warner Losh
2022-02-28 18:12 ` [PULL 13/16] bsd-user/bsd-file.h: Implementation details for the filesystem calls Warner Losh
2022-02-28 18:12 ` Warner Losh [this message]
2022-02-28 18:12 ` [PULL 15/16] bsd-user: Define target_arg64 Warner Losh
2022-02-28 18:12 ` [PULL 16/16] bsd-user: Add safe system call macros Warner Losh
2022-03-02 10:45 ` [PULL 00/16] Bsd user preen 2022q1 patches Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220228181214.2602-15-imp@bsdimp.com \
--to=imp@bsdimp.com \
--cc=arrowd@FreeBSD.org \
--cc=brad@comstyle.com \
--cc=def@FreeBSD.org \
--cc=jrtc27@FreeBSD.org \
--cc=kevans@FreeBSD.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).