* [Qemu-devel] [PATCH] user-exec.c: fix build on NetBSD/sparc64 and NetBSD/arm
@ 2015-03-05 21:37 Tobias Nygren
2015-03-08 10:27 ` Peter Maydell
2015-03-13 16:38 ` Peter Maydell
0 siblings, 2 replies; 7+ messages in thread
From: Tobias Nygren @ 2015-03-05 21:37 UTC (permalink / raw)
To: qemu-devel; +Cc: Tobias Nygren
A couple of #ifdef changes necessary to use NetBSD's ucontext
structs on sparc64 and arm.
Signed-off-by: Tobias Nygren <tnn@NetBSD.org>
---
user-exec.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/user-exec.c b/user-exec.c
index 1ff8673..8f57e8a 100644
--- a/user-exec.c
+++ b/user-exec.c
@@ -404,6 +404,10 @@ int cpu_signal_handler(int host_signum, void *pinfo,
struct sigcontext *uc = puc;
unsigned long pc = uc->sc_pc;
void *sigmask = (void *)(long)uc->sc_mask;
+#elif defined(__NetBSD__)
+ ucontext_t *uc = puc;
+ unsigned long pc = _UC_MACHINE_PC(uc);
+ void *sigmask = (void *)&uc->uc_sigmask;
#endif
#endif
@@ -441,15 +445,25 @@ int cpu_signal_handler(int host_signum, void *pinfo,
#elif defined(__arm__)
+#if defined(__NetBSD__)
+#include <ucontext.h>
+#endif
+
int cpu_signal_handler(int host_signum, void *pinfo,
void *puc)
{
siginfo_t *info = pinfo;
+#if defined(__NetBSD__)
+ ucontext_t *uc = puc;
+#else
struct ucontext *uc = puc;
+#endif
unsigned long pc;
int is_write;
-#if defined(__GLIBC__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3))
+#if defined(__NetBSD__)
+ pc = uc->uc_mcontext.__gregs[_REG_R15];
+#elif defined(__GLIBC__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3))
pc = uc->uc_mcontext.gregs[R15];
#else
pc = uc->uc_mcontext.arm_pc;
--
2.3.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] user-exec.c: fix build on NetBSD/sparc64 and NetBSD/arm
2015-03-05 21:37 [Qemu-devel] [PATCH] user-exec.c: fix build on NetBSD/sparc64 and NetBSD/arm Tobias Nygren
@ 2015-03-08 10:27 ` Peter Maydell
2015-03-08 12:37 ` Tobias Nygren
2015-03-13 16:38 ` Peter Maydell
1 sibling, 1 reply; 7+ messages in thread
From: Peter Maydell @ 2015-03-08 10:27 UTC (permalink / raw)
To: Tobias Nygren; +Cc: QEMU Developers
On 6 March 2015 at 06:37, Tobias Nygren <tnn@netbsd.org> wrote:
> A couple of #ifdef changes necessary to use NetBSD's ucontext
> structs on sparc64 and arm.
>
> Signed-off-by: Tobias Nygren <tnn@NetBSD.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Does NetBSD have a big stack of out-of-tree patches for QEMU,
or do you run basically stock upstream QEMU?
thanks
-- PMM
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] user-exec.c: fix build on NetBSD/sparc64 and NetBSD/arm
2015-03-08 10:27 ` Peter Maydell
@ 2015-03-08 12:37 ` Tobias Nygren
2015-03-08 12:53 ` Peter Maydell
0 siblings, 1 reply; 7+ messages in thread
From: Tobias Nygren @ 2015-03-08 12:37 UTC (permalink / raw)
To: Peter Maydell; +Cc: Tobias Nygren, QEMU Developers
Hello,
On Sun, 8 Mar 2015 19:27:27 +0900
Peter Maydell <peter.maydell@linaro.org> wrote:
> On 6 March 2015 at 06:37, Tobias Nygren <tnn@netbsd.org> wrote:
> > A couple of #ifdef changes necessary to use NetBSD's ucontext
> > structs on sparc64 and arm.
> >
> > Signed-off-by: Tobias Nygren <tnn@NetBSD.org>
>
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
>
> Does NetBSD have a big stack of out-of-tree patches for QEMU,
> or do you run basically stock upstream QEMU?
Hi, it is more or less stock except for this patch. There
are three other small patches that add parenthesis in a few
places to work around a conflict with system macros when
-fstack-protector is enabled but I'm not confident
those are suitable for upstreaming.
Kind regards,
-Tobias
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] user-exec.c: fix build on NetBSD/sparc64 and NetBSD/arm
2015-03-08 12:37 ` Tobias Nygren
@ 2015-03-08 12:53 ` Peter Maydell
2015-03-08 14:59 ` Tobias Nygren
0 siblings, 1 reply; 7+ messages in thread
From: Peter Maydell @ 2015-03-08 12:53 UTC (permalink / raw)
To: Tobias Nygren; +Cc: QEMU Developers
On 8 March 2015 at 21:37, Tobias Nygren <tnn@netbsd.org> wrote:
> On Sun, 8 Mar 2015 19:27:27 +0900
> Peter Maydell <peter.maydell@linaro.org> wrote:
>> Does NetBSD have a big stack of out-of-tree patches for QEMU,
>> or do you run basically stock upstream QEMU?
>
> Hi, it is more or less stock except for this patch.
Cool. (I know the FreeBSD folk have a pretty large set
of user-mode emulation changes which we've unfortunately
not been able to get upstream yet since there's a lot of
cleanup work required.)
Does the user-emulation work for running random
binaries, or are there known limitations to what
guest/host architectures work well? (I have some
BSD VMs which I was using for compile testing of
the bsd-user code a while back, but I forget what
results I was seeing with which BSD variant...)
> There
> are three other small patches that add parenthesis in a few
> places to work around a conflict with system macros when
> -fstack-protector is enabled but I'm not confident
> those are suitable for upstreaming.
If they're small you might as well post them here anyway;
we may be able to suggest a better fix or perhaps they'll
be OK to apply upstream anyway.
-- PMM
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] user-exec.c: fix build on NetBSD/sparc64 and NetBSD/arm
2015-03-08 12:53 ` Peter Maydell
@ 2015-03-08 14:59 ` Tobias Nygren
2015-03-08 15:01 ` Peter Maydell
0 siblings, 1 reply; 7+ messages in thread
From: Tobias Nygren @ 2015-03-08 14:59 UTC (permalink / raw)
To: Peter Maydell; +Cc: Tobias Nygren, QEMU Developers
On Sun, 8 Mar 2015 21:53:30 +0900
Peter Maydell <peter.maydell@linaro.org> wrote:
> On 8 March 2015 at 21:37, Tobias Nygren <tnn@netbsd.org> wrote:
> > On Sun, 8 Mar 2015 19:27:27 +0900
> > Peter Maydell <peter.maydell@linaro.org> wrote:
> >> Does NetBSD have a big stack of out-of-tree patches for QEMU,
> >> or do you run basically stock upstream QEMU?
> >
> > Hi, it is more or less stock except for this patch.
>
> Cool. (I know the FreeBSD folk have a pretty large set
> of user-mode emulation changes which we've unfortunately
> not been able to get upstream yet since there's a lot of
> cleanup work required.)
>
> Does the user-emulation work for running random
> binaries, or are there known limitations to what
> guest/host architectures work well? (I have some
> BSD VMs which I was using for compile testing of
> the bsd-user code a while back, but I forget what
> results I was seeing with which BSD variant...)
I don't know much more than that developers are actively using it to
test their changes on some architectures. It works well enough for them
to get their job done, I suppose.
Standalone static binaries and basic syscall emulation seem to work OK.
There is a problem with ps_strings / argv[0] being NULL in crt0.o.
(looks like it would not be hard to fix)
> > There
> > are three other small patches that add parenthesis in a few
> > places to work around a conflict with system macros when
> > -fstack-protector is enabled but I'm not confident
> > those are suitable for upstreaming.
>
> If they're small you might as well post them here anyway;
> we may be able to suggest a better fix or perhaps they'll
> be OK to apply upstream anyway.
Actually looking further this has been properly fixed in the base system
and only affects the old 5.x release which is due to be desupported
when 7.0 is released, so I wouldn't worry about it.
Cheers,
-Tobias
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] user-exec.c: fix build on NetBSD/sparc64 and NetBSD/arm
2015-03-08 14:59 ` Tobias Nygren
@ 2015-03-08 15:01 ` Peter Maydell
0 siblings, 0 replies; 7+ messages in thread
From: Peter Maydell @ 2015-03-08 15:01 UTC (permalink / raw)
To: Tobias Nygren; +Cc: QEMU Developers
On 8 March 2015 at 23:59, Tobias Nygren <tnn@netbsd.org> wrote:
> Standalone static binaries and basic syscall emulation seem to work OK.
> There is a problem with ps_strings / argv[0] being NULL in crt0.o.
> (looks like it would not be hard to fix)
Yeah, ps_strings rings a bell, I think that was what I was seeing.
-- PMM
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] user-exec.c: fix build on NetBSD/sparc64 and NetBSD/arm
2015-03-05 21:37 [Qemu-devel] [PATCH] user-exec.c: fix build on NetBSD/sparc64 and NetBSD/arm Tobias Nygren
2015-03-08 10:27 ` Peter Maydell
@ 2015-03-13 16:38 ` Peter Maydell
1 sibling, 0 replies; 7+ messages in thread
From: Peter Maydell @ 2015-03-13 16:38 UTC (permalink / raw)
To: Tobias Nygren; +Cc: QEMU Developers
On 5 March 2015 at 21:37, Tobias Nygren <tnn@netbsd.org> wrote:
> A couple of #ifdef changes necessary to use NetBSD's ucontext
> structs on sparc64 and arm.
>
> Signed-off-by: Tobias Nygren <tnn@NetBSD.org>
> ---
> user-exec.c | 16 +++++++++++++++-
> 1 file changed, 15 insertions(+), 1 deletion(-)
Applied to qemu master, since we don't have any
particularly BSD-specific subtree at the moment.
-- PMM
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-03-13 16:38 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-05 21:37 [Qemu-devel] [PATCH] user-exec.c: fix build on NetBSD/sparc64 and NetBSD/arm Tobias Nygren
2015-03-08 10:27 ` Peter Maydell
2015-03-08 12:37 ` Tobias Nygren
2015-03-08 12:53 ` Peter Maydell
2015-03-08 14:59 ` Tobias Nygren
2015-03-08 15:01 ` Peter Maydell
2015-03-13 16:38 ` Peter Maydell
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).