diff mbox

fix compilation on FreeBSD for mac_*world.c

Message ID 5297B6A4.1020300@FreeBSD.org
State New
Headers show

Commit Message

Andreas Tobler Nov. 28, 2013, 9:33 p.m. UTC
Hello,

On 09.11.13 00:15, Andreas Tobler wrote:
> 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,
> 
> Andreas
> 
> Signed-off-by: Andreas Tobler <address@hidden>
> 

This time qemu-devel list included.

Ping?

TIA,
Andreas

Comments

Peter Maydell Nov. 28, 2013, 10:38 p.m. UTC | #1
On 28 November 2013 21:33, Andreas Tobler <andreast@freebsd.org> wrote:
> Hello,
>
> On 09.11.13 00:15, Andreas Tobler wrote:
>> 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
Andreas Tobler Nov. 28, 2013, 10:48 p.m. UTC | #2
On 28.11.13 23:38, Peter Maydell wrote:
> On 28 November 2013 21:33, Andreas Tobler <andreast@freebsd.org> wrote:
>> Hello,
>>
>> On 09.11.13 00:15, Andreas Tobler wrote:
>>> 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...

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

Thanks for the feedback.
Andreas
Andreas Färber Nov. 29, 2013, 4:01 a.m. UTC | #3
Am 28.11.2013 22:33, schrieb Andreas Tobler:
> Hello,
> 
> On 09.11.13 00:15, Andreas Tobler wrote:
>> 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,
>>
>> Andreas
>>
>> Signed-off-by: Andreas Tobler <address@hidden>
>>
> 
> 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
diff mbox

Patch

diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
index 5e79575..cce2dec 100644
--- a/hw/ppc/mac_newworld.c
+++ b/hw/ppc/mac_newworld.c
@@ -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;
diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
index 2f27754..b8c6678 100644
--- a/hw/ppc/mac_oldworld.c
+++ b/hw/ppc/mac_oldworld.c
@@ -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;