Patchwork bsd-user: fix build

login
register
mail settings
Submitter Blue Swirl
Date June 24, 2012, 8:18 p.m.
Message ID <d8525db14b70f9486452c1b32f6a43ce583e715b.1340569077.git.blauwirbel@gmail.com>
Download mbox | patch
Permalink /patch/166901/
State New
Headers show

Comments

Blue Swirl - June 24, 2012, 8:18 p.m.
Link in oslib objects also for BSD user, but avoid using the version of
qemu_vmalloc() defined in oslib-posix.c.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
 Makefile.target |    2 +-
 oslib-posix.c   |    3 +++
 2 files changed, 4 insertions(+), 1 deletions(-)
Peter Maydell - June 24, 2012, 8:34 p.m.
On 24 June 2012 21:18, Blue Swirl <blauwirbel@gmail.com> wrote:
> Link in oslib objects also for BSD user, but avoid using the version of
> qemu_vmalloc() defined in oslib-posix.c.

Do you happen to know why bsd-user has its own implementation of
qemu_vmalloc() but linux-user doesn't? Discrepancies between the
two make me mildly uneasy...

-- PMM
Blue Swirl - June 24, 2012, 8:45 p.m.
On Sun, Jun 24, 2012 at 8:34 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 24 June 2012 21:18, Blue Swirl <blauwirbel@gmail.com> wrote:
>> Link in oslib objects also for BSD user, but avoid using the version of
>> qemu_vmalloc() defined in oslib-posix.c.
>
> Do you happen to know why bsd-user has its own implementation of
> qemu_vmalloc() but linux-user doesn't? Discrepancies between the
> two make me mildly uneasy...

2e9a5713f0567fffaa3518f495b8d16a2b74f84a removed PAGE_RESERVED bits
from linux-user but not from bsd-user. page_init() in exec.c builds a
map of reserved pages which are then checked by qemu_vmalloc().
Actually I'm not sure how linux-user works and why is/was this ever
needed.

>
> -- PMM

Patch

diff --git a/Makefile.target b/Makefile.target
index 8f12b0f..b81cba0 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -108,7 +108,7 @@  ifdef CONFIG_BSD_USER
 QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH)
 
 obj-y += bsd-user/
-obj-y += gdbstub.o user-exec.o
+obj-y += gdbstub.o user-exec.o $(oslib-obj-y)
 
 endif #CONFIG_BSD_USER
 
diff --git a/oslib-posix.c b/oslib-posix.c
index b6a3c7f..6b7ba64 100644
--- a/oslib-posix.c
+++ b/oslib-posix.c
@@ -105,6 +105,8 @@  void *qemu_memalign(size_t alignment, size_t size)
     return ptr;
 }
 
+/* conflicts with qemu_vmalloc in bsd-user/mmap.c */
+#if !defined(CONFIG_BSD_USER)
 /* alloc shared memory pages */
 void *qemu_vmalloc(size_t size)
 {
@@ -127,6 +129,7 @@  void *qemu_vmalloc(size_t size)
     trace_qemu_vmalloc(size, ptr);
     return ptr;
 }
+#endif
 
 void qemu_vfree(void *ptr)
 {