From: Aleksej Saushev <asau@inbox.ru>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [diff] BSD support (NetBSD, FreeBSD, Dragonfly)
Date: Sun, 11 Oct 2009 20:57:14 +0400 [thread overview]
Message-ID: <87iqelzx5h.fsf@inbox.ru> (raw)
Hello!
qemu 0.11.0 doesn't build on NetBSD out of the box,
it doesn't on FreeBSD and Dragonfly either.
--- exec.c.orig 2009-09-23 23:01:32.000000000 +0400
+++ exec.c 2009-09-30 14:03:55.000000000 +0400
@@ -464,7 +464,7 @@
exit(1);
}
}
-#elif defined(__FreeBSD__) || defined(__DragonFly__)
+#elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__)
{
int flags;
void *addr = NULL;
--- osdep.c.orig 2009-09-23 23:01:32.000000000 +0400
+++ osdep.c 2009-09-30 14:05:39.000000000 +0400
@@ -110,7 +110,7 @@
void *ptr;
/* no need (?) for a dummy file on OpenBSD/FreeBSD */
-#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
+#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__)
int map_anon = MAP_ANON;
#else
int map_anon = 0;
@@ -181,7 +181,7 @@
}
size = (size + 4095) & ~4095;
ftruncate(phys_ram_fd, phys_ram_size + size);
-#endif /* !(__OpenBSD__ || __FreeBSD__ || __DragonFly__) */
+#endif /* !(__OpenBSD__ || __FreeBSD__ || __DragonFly__ || __NetBSD__) */
ptr = mmap(NULL,
size,
PROT_WRITE | PROT_READ, map_anon | MAP_SHARED,
--- vl.c.orig 2009-09-23 23:01:32.000000000 +0400
+++ vl.c 2009-09-30 14:10:21.000000000 +0400
@@ -567,7 +567,7 @@
{
use_rt_clock = 0;
#if defined(__linux__) || (defined(__FreeBSD__) && __FreeBSD_version >= 500000) \
- || defined(__DragonFly__)
+ || defined(__DragonFly__) || defined(__NetBSD__)
{
struct timespec ts;
if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) {
@@ -580,7 +580,7 @@
static int64_t get_clock(void)
{
#if defined(__linux__) || (defined(__FreeBSD__) && __FreeBSD_version >= 500000) \
- || defined(__DragonFly__)
+ || defined(__DragonFly__) || defined(__NetBSD__)
if (use_rt_clock) {
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
--- cpu-exec.c.orig 2009-09-23 23:01:32.000000000 +0400
+++ cpu-exec.c 2009-09-30 14:18:16.000000000 +0400
@@ -1247,6 +1247,20 @@
# define TRAP_sig(context) ((context)->uc_mcontext->es.trapno)
# define ERROR_sig(context) ((context)->uc_mcontext->es.err)
# define MASK_sig(context) ((context)->uc_sigmask)
+#elif defined (__NetBSD__)
+# include <ucontext.h>
+
+# define EIP_sig(context) ((context)->uc_mcontext.__gregs[_REG_EIP])
+# define TRAP_sig(context) ((context)->uc_mcontext.__gregs[_REG_TRAPNO])
+# define ERROR_sig(context) ((context)->uc_mcontext.__gregs[_REG_ERR])
+# define MASK_sig(context) ((context)->uc_sigmask)
+#elif defined (__FreeBSD__) || defined(__DragonFly__)
+# include <ucontext.h>
+
+# define EIP_sig(context) (*((unsigned long*)&(context)->uc_mcontext.mc_eip))
+# define TRAP_sig(context) ((context)->uc_mcontext.mc_trapno)
+# define ERROR_sig(context) ((context)->uc_mcontext.mc_err)
+# define MASK_sig(context) ((context)->uc_sigmask)
#elif defined(__OpenBSD__)
# define EIP_sig(context) ((context)->sc_eip)
# define TRAP_sig(context) ((context)->sc_trapno)
@@ -1263,7 +1277,9 @@
void *puc)
{
siginfo_t *info = pinfo;
-#if defined(__OpenBSD__)
+#if defined(__NetBSD__) || defined (__FreeBSD__) || defined(__DragonFly__)
+ ucontext_t *uc = puc;
+#elif defined(__OpenBSD__)
struct sigcontext *uc = puc;
#else
struct ucontext *uc = puc;
--
HE CE3OH...
next reply other threads:[~2009-10-11 16:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-11 16:57 Aleksej Saushev [this message]
2009-10-11 23:31 ` [Qemu-devel] [diff] BSD support (NetBSD, FreeBSD, Dragonfly) Juergen Lock
2009-11-05 2:42 ` Aleksej Saushev
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=87iqelzx5h.fsf@inbox.ru \
--to=asau@inbox.ru \
--cc=qemu-devel@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.