qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] ds1225y: Fix compiler errors in debug code
@ 2010-09-30 19:30 Stefan Weil
  2010-09-30 19:37 ` [Qemu-devel] " Blue Swirl
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Weil @ 2010-09-30 19:30 UTC (permalink / raw)
  To: QEMU Developers; +Cc: Blue Swirl

TARGET_FMT_lx is not allowed here, so use type casts to unsigned
(which should be large enough to hold typical nvram addresses).

./hw/ds1225y.c:48:35: error: attempt to use poisoned "TARGET_FMT_lx"
./hw/ds1225y.c: In function ‘nvram_readb’:
./hw/ds1225y.c:48: error: expected ‘)’ before ‘TARGET_FMT_lx’
./hw/ds1225y.c:48: error: too few arguments for format
./hw/ds1225y.c:76:36: error: attempt to use poisoned "TARGET_FMT_lx"
./hw/ds1225y.c: In function ‘nvram_writeb’:
./hw/ds1225y.c:76: error: expected ‘)’ before ‘TARGET_FMT_lx’
./hw/ds1225y.c:76: error: too few arguments for format
./hw/ds1225y.c:107:47: error: attempt to use poisoned "TARGET_FMT_lx"
./hw/ds1225y.c: In function ‘nvram_writeb_protected’:
./hw/ds1225y.c:107: error: expected ‘)’ before ‘TARGET_FMT_lx’
./hw/ds1225y.c:107: error: too few arguments for format

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
 hw/ds1225y.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/ds1225y.c b/hw/ds1225y.c
index 009d127..381ca65 100644
--- a/hw/ds1225y.c
+++ b/hw/ds1225y.c
@@ -45,7 +45,7 @@ static uint32_t nvram_readb (void *opaque, target_phys_addr_t addr)
     val = s->contents[addr];
 
 #ifdef DEBUG_NVRAM
-    printf("nvram: read 0x%x at " TARGET_FMT_lx "\n", val, addr);
+    printf("nvram: read 0x%x at %08x\n", val, (unsigned)addr);
 #endif
     return val;
 }
@@ -73,7 +73,7 @@ static void nvram_writeb (void *opaque, target_phys_addr_t addr, uint32_t val)
     ds1225y_t *s = opaque;
 
 #ifdef DEBUG_NVRAM
-    printf("nvram: write 0x%x at " TARGET_FMT_lx "\n", val, addr);
+    printf("nvram: write 0x%x at %08x\n", val, (unsigned)addr);
 #endif
 
     s->contents[addr] = val & 0xff;
@@ -104,7 +104,7 @@ static void nvram_writeb_protected (void *opaque, target_phys_addr_t addr, uint3
 
     if (s->protection != 7) {
 #ifdef DEBUG_NVRAM
-    printf("nvram: prevent write of 0x%x at " TARGET_FMT_lx "\n", val, addr);
+    printf("nvram: prevent write of 0x%x at %08x\n", val, (unsigned)addr);
 #endif
         return;
     }
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Qemu-devel] Re: [PATCH] ds1225y: Fix compiler errors in debug code
  2010-09-30 19:30 [Qemu-devel] [PATCH] ds1225y: Fix compiler errors in debug code Stefan Weil
@ 2010-09-30 19:37 ` Blue Swirl
  2010-09-30 19:55   ` Stefan Weil
  0 siblings, 1 reply; 5+ messages in thread
From: Blue Swirl @ 2010-09-30 19:37 UTC (permalink / raw)
  To: Stefan Weil; +Cc: QEMU Developers

On Thu, Sep 30, 2010 at 7:30 PM, Stefan Weil <weil@mail.berlios.de> wrote:
> TARGET_FMT_lx is not allowed here, so use type casts to unsigned
> (which should be large enough to hold typical nvram addresses).

The correct format is TARGET_FMT_plx.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Qemu-devel] Re: [PATCH] ds1225y: Fix compiler errors in debug code
  2010-09-30 19:37 ` [Qemu-devel] " Blue Swirl
@ 2010-09-30 19:55   ` Stefan Weil
  2010-09-30 20:09     ` Blue Swirl
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Weil @ 2010-09-30 19:55 UTC (permalink / raw)
  To: Blue Swirl; +Cc: QEMU Developers

Am 30.09.2010 21:37, schrieb Blue Swirl:
> On Thu, Sep 30, 2010 at 7:30 PM, Stefan Weil<weil@mail.berlios.de>  wrote:
>    
>> TARGET_FMT_lx is not allowed here, so use type casts to unsigned
>> (which should be large enough to hold typical nvram addresses).
>>      
> The correct format is TARGET_FMT_plx.
>    


addr is typically less than 8192 (size of nvram).

TARGET_FMT_plx displays addr using 16 hex characters
when the target has 64 bit addresses. That's correct but
does not look pretty.

Do you prefer TARGET_FMT_plx nevertheless?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Qemu-devel] Re: [PATCH] ds1225y: Fix compiler errors in debug code
  2010-09-30 19:55   ` Stefan Weil
@ 2010-09-30 20:09     ` Blue Swirl
  2010-09-30 20:22       ` Stefan Weil
  0 siblings, 1 reply; 5+ messages in thread
From: Blue Swirl @ 2010-09-30 20:09 UTC (permalink / raw)
  To: Stefan Weil; +Cc: QEMU Developers

On Thu, Sep 30, 2010 at 7:55 PM, Stefan Weil <weil@mail.berlios.de> wrote:
> Am 30.09.2010 21:37, schrieb Blue Swirl:
>>
>> On Thu, Sep 30, 2010 at 7:30 PM, Stefan Weil<weil@mail.berlios.de>  wrote:
>>
>>>
>>> TARGET_FMT_lx is not allowed here, so use type casts to unsigned
>>> (which should be large enough to hold typical nvram addresses).
>>>
>>
>> The correct format is TARGET_FMT_plx.
>>
>
>
> addr is typically less than 8192 (size of nvram).
>
> TARGET_FMT_plx displays addr using 16 hex characters
> when the target has 64 bit addresses. That's correct but
> does not look pretty.
>
> Do you prefer TARGET_FMT_plx nevertheless?

We could also introduce a new format which does not perform zero padding.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Qemu-devel] Re: [PATCH] ds1225y: Fix compiler errors in debug code
  2010-09-30 20:09     ` Blue Swirl
@ 2010-09-30 20:22       ` Stefan Weil
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Weil @ 2010-09-30 20:22 UTC (permalink / raw)
  To: Blue Swirl; +Cc: QEMU Developers

Am 30.09.2010 22:09, schrieb Blue Swirl:
> On Thu, Sep 30, 2010 at 7:55 PM, Stefan Weil <weil@mail.berlios.de> wrote:
>> Am 30.09.2010 21:37, schrieb Blue Swirl:
>>>
>>> On Thu, Sep 30, 2010 at 7:30 PM, Stefan Weil<weil@mail.berlios.de> 
>>>  wrote:
>>>
>>>>
>>>> TARGET_FMT_lx is not allowed here, so use type casts to unsigned
>>>> (which should be large enough to hold typical nvram addresses).
>>>>
>>>
>>> The correct format is TARGET_FMT_plx.
>>>
>>
>>
>> addr is typically less than 8192 (size of nvram).
>>
>> TARGET_FMT_plx displays addr using 16 hex characters
>> when the target has 64 bit addresses. That's correct but
>> does not look pretty.
>>
>> Do you prefer TARGET_FMT_plx nevertheless?
>
> We could also introduce a new format which does not perform zero padding.

Like PRIxTPA (TPA = Target Physical Address)? That would allow devices
to print their addresses according to their needs with 1, 2, 4 or more
characters.

#if TARGET_PHYS_ADDR_BITS == 32
#define PRIxTPA PRIx32
#elif TARGET_PHYS_ADDR_BITS == 64
#define PRIxTPA PRIx64
#endif

If that's ok for everybody, I could provide a patch for targphys.h
and update the patch for ds1225y.c.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-09-30 20:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-30 19:30 [Qemu-devel] [PATCH] ds1225y: Fix compiler errors in debug code Stefan Weil
2010-09-30 19:37 ` [Qemu-devel] " Blue Swirl
2010-09-30 19:55   ` Stefan Weil
2010-09-30 20:09     ` Blue Swirl
2010-09-30 20:22       ` Stefan Weil

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).