Skip to contentSkip to conversation

fix compilation on FreeBSD for mac_*world.c

PATCH Andreas Tobler 3 participants 4 messages Nov 28, 2013 – Nov 29, 2013 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

Hello,

Quoted 13 lines · Andreas Tobler

Hello,

the attached patch fixes compilation on FreeBSD for hw/ppc/mac_new/oldworld.c on FreeBSD.

The affected function is present in machine/param.h on FreeBSD:

#define round_page(x) ((((unsigned long)(x)) + PAGE_MASK) & ~(PAGE_MASK))

To make it compile on FreeBSD I'd like to propose the below patch which is in use since a longer time on the ports tree (FreeBSD) and in my personal git tree.

Quoted 6 lines

Thanks,

Andreas

This time qemu-devel list included.

Ping?

TIA,
Andreas

hw/ppc/mac_newworld.c +4 -0
index 5e79575..cce2dec 100644
@@ -125,6 +125,10 @@ static uint64_t translate_kernel_address(void *opaque, uint64_t addr)
     return (addr & 0x0fffffff) + KERNEL_LOAD_ADDR;
 }
 
+#if defined(__FreeBSD__)
+#undef round_page
+#endif
+
 static hwaddr round_page(hwaddr addr)
 {
     return (addr + TARGET_PAGE_SIZE - 1) & TARGET_PAGE_MASK;
hw/ppc/mac_oldworld.c +4 -0
index 2f27754..b8c6678 100644
@@ -59,6 +59,10 @@ static uint64_t translate_kernel_address(void *opaque, uint64_t addr)
     return (addr & 0x0fffffff) + KERNEL_LOAD_ADDR;
 }
 
+#if defined(__FreeBSD__)
+#undef round_page
+#endif
+
 static hwaddr round_page(hwaddr addr)
 {
     return (addr + TARGET_PAGE_SIZE - 1) & TARGET_PAGE_MASK;
#2 lore raw
Quoted 15 lines · Andreas Tobler

Hello,

Quoted 12 lines · Andreas Tobler

Hello,

the attached patch fixes compilation on FreeBSD for hw/ppc/mac_new/oldworld.c on FreeBSD.

The affected function is present in machine/param.h on FreeBSD:

#define round_page(x) ((((unsigned long)(x)) + PAGE_MASK) & ~(PAGE_MASK))

To make it compile on FreeBSD I'd like to propose the below patch which is in use since a longer time on the ports tree (FreeBSD) and in my personal git tree.

Rather than doing this:
+ #if defined(__FreeBSD__)
+ #undef round_page
+ #endif

personally I'd prefer it if we just replaced the uses of round_page() with TARGET_PAGE_ALIGN(), which is the macro we define in the headers for aligning up to the next page size.

Up to the ppc submaintainers though...

thanks
-- PMM

#3 lore raw
Quoted 22 lines · Peter Maydell
Quoted 15 lines · Andreas Tobler

Hello,

Quoted 12 lines · Andreas Tobler

Hello,

the attached patch fixes compilation on FreeBSD for hw/ppc/mac_new/oldworld.c on FreeBSD.

The affected function is present in machine/param.h on FreeBSD:

#define round_page(x) ((((unsigned long)(x)) + PAGE_MASK) & ~(PAGE_MASK))

To make it compile on FreeBSD I'd like to propose the below patch which is in use since a longer time on the ports tree (FreeBSD) and in my personal git tree.

Rather than doing this:
+ #if defined(__FreeBSD__)
+ #undef round_page
+ #endif

Quoted 5 lines

personally I'd prefer it if we just replaced the uses of round_page() with TARGET_PAGE_ALIGN(), which is the macro we define in the headers for aligning up to the next page size.

Up to the ppc submaintainers though...

Whatever you prefer, I'm ready to test....

Thanks for the feedback.
Andreas

#4 lore raw
In reply to Andreas Tobler

Am 28.11.2013 22:33, schrieb Andreas Tobler:

Quoted 18 lines

Hello,

Quoted 15 lines · Andreas Tobler

Hello,

the attached patch fixes compilation on FreeBSD for hw/ppc/mac_new/oldworld.c on FreeBSD.

The affected function is present in machine/param.h on FreeBSD:

#define round_page(x) ((((unsigned long)(x)) + PAGE_MASK) & ~(PAGE_MASK))

To make it compile on FreeBSD I'd like to propose the below patch which is in use since a longer time on the ports tree (FreeBSD) and in my personal git tree.

Thanks,

Quoted 8 lines
Quoted 4 lines

Andreas

This time qemu-devel list included.

Ping?

I remember writing a patch to fix this or a very similar issue in those files by adding a prefix for the local version. Have you checked the list archives or git log?

Apart from that, the Sob is broken and we prefer patches git-send-email style with a ready-to-apply commit message:
http://wiki.qemu.org/Contribute/SubmitAPatch

Regards,
Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg