qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Isaku Yamahata <yamahata@valinux.co.jp>
To: qemu-devel@nongnu.org
Cc: yamahata@valinux.co.jp
Subject: [Qemu-devel] [PATCH 6/6] use uint{32, 16, 8}_t for ioport port and value instead of int.
Date: Fri,  3 Jul 2009 13:42:39 +0900	[thread overview]
Message-ID: <1246596159-16126-7-git-send-email-yamahata@valinux.co.jp> (raw)
In-Reply-To: <1246596159-16126-1-git-send-email-yamahata@valinux.co.jp>

use uint{32, 16, 8}_t for ioport port and value instead of int.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 ioport-user.c |   24 ++++++++++++------------
 ioport.c      |   45 ++++++++++++++++++++++-----------------------
 ioport.h      |   18 +++++++++---------
 3 files changed, 43 insertions(+), 44 deletions(-)

diff --git a/ioport-user.c b/ioport-user.c
index fe8567f..8b9a8cf 100644
--- a/ioport-user.c
+++ b/ioport-user.c
@@ -25,35 +25,35 @@
 #include "qemu-common.h"
 #include "ioport.h"
 
-void cpu_outb(CPUState *env, int addr, int val)
+void cpu_outb(CPUState *env, uint32_t addr, uint8_t val)
 {
-    fprintf(stderr, "outb: port=0x%04x, data=%02x\n", addr, val);
+    fprintf(stderr, "outb: port=0x%04"PRIx32", data=%02"PRIx8"\n", addr, val);
 }
 
-void cpu_outw(CPUState *env, int addr, int val)
+void cpu_outw(CPUState *env, uint32_t addr, uint16_t val)
 {
-    fprintf(stderr, "outw: port=0x%04x, data=%04x\n", addr, val);
+    fprintf(stderr, "outw: port=0x%04"PRIx32", data=%04"PRIx16"\n", addr, val);
 }
 
-void cpu_outl(CPUState *env, int addr, int val)
+void cpu_outl(CPUState *env, uint32_t addr, uint32_t val)
 {
-    fprintf(stderr, "outl: port=0x%04x, data=%08x\n", addr, val);
+    fprintf(stderr, "outl: port=0x%04"PRIx32", data=%08"PRIx32"\n", addr, val);
 }
 
-int cpu_inb(CPUState *env, int addr)
+uint8_t cpu_inb(CPUState *env, uint32_t addr)
 {
-    fprintf(stderr, "inb: port=0x%04x\n", addr);
+    fprintf(stderr, "inb: port=0x%04"PRIx32"\n", addr);
     return 0;
 }
 
-int cpu_inw(CPUState *env, int addr)
+uint16_t cpu_inw(CPUState *env, uint32_t addr)
 {
-    fprintf(stderr, "inw: port=0x%04x\n", addr);
+    fprintf(stderr, "inw: port=0x%04"PRIx32"\n", addr);
     return 0;
 }
 
-int cpu_inl(CPUState *env, int addr)
+uint32_t cpu_inl(CPUState *env, uint32_t addr)
 {
-    fprintf(stderr, "inl: port=0x%04x\n", addr);
+    fprintf(stderr, "inl: port=0x%04"PRIx32"\n", addr);
     return 0;
 }
diff --git a/ioport.c b/ioport.c
index 87c01b4..58264a0 100644
--- a/ioport.c
+++ b/ioport.c
@@ -82,13 +82,13 @@ static void ioport_write(int index, uint32_t address, uint32_t data)
 
 static uint32_t default_ioport_readb(void *opaque, uint32_t address)
 {
-    LOG_UNUSED_IOPORT("unused inb: port=0x%04x\n", address);
+    LOG_UNUSED_IOPORT("unused inb: port=0x%04"PRIx32"\n", address);
     return 0xff;
 }
 
 static void default_ioport_writeb(void *opaque, uint32_t address, uint32_t data)
 {
-    LOG_UNUSED_IOPORT("unused outb: port=0x%04x data=0x%02x\n",
+    LOG_UNUSED_IOPORT("unused outb: port=0x%04"PRIx32" data=0x%02"PRIx32"\n",
                       address, data);
 }
 
@@ -111,13 +111,13 @@ static void default_ioport_writew(void *opaque, uint32_t address, uint32_t data)
 
 static uint32_t default_ioport_readl(void *opaque, uint32_t address)
 {
-    LOG_UNUSED_IOPORT("unused inl: port=0x%04x\n", address);
+    LOG_UNUSED_IOPORT("unused inl: port=0x%04"PRIx32"\n", address);
     return 0xffffffff;
 }
 
 static void default_ioport_writel(void *opaque, uint32_t address, uint32_t data)
 {
-    LOG_UNUSED_IOPORT("unused outl: port=0x%04x data=0x%02x\n",
+    LOG_UNUSED_IOPORT("unused outl: port=0x%04"PRIx32" data=0x%02"PRIx32"\n",
                       address, data);
 }
 
@@ -136,7 +136,7 @@ static int ioport_bsize(int size, int *bsize)
 }
 
 /* size is the word size in byte */
-int register_ioport_read(int start, int length, int size,
+int register_ioport_read(uint32_t start, int length, int size,
                          IOPortReadFunc *func, void *opaque)
 {
     int i, bsize;
@@ -155,7 +155,7 @@ int register_ioport_read(int start, int length, int size,
 }
 
 /* size is the word size in byte */
-int register_ioport_write(int start, int length, int size,
+int register_ioport_write(uint32_t start, int length, int size,
                           IOPortWriteFunc *func, void *opaque)
 {
     int i, bsize;
@@ -173,7 +173,7 @@ int register_ioport_write(int start, int length, int size,
     return 0;
 }
 
-void isa_unassign_ioport(int start, int length)
+void isa_unassign_ioport(uint32_t start, int length)
 {
     int i;
 
@@ -192,9 +192,9 @@ void isa_unassign_ioport(int start, int length)
 
 /***********************************************************/
 
-void cpu_outb(CPUState *env, int addr, int val)
+void cpu_outb(CPUState *env, uint32_t addr, uint8_t val)
 {
-    LOG_IOPORT("outb: %04x %02x\n", addr, val);
+    LOG_IOPORT("outb: %04"PRIx32" %02"PRIx8"\n", addr, val);
     ioport_write(0, addr, val);
 #ifdef CONFIG_KQEMU
     if (env)
@@ -202,9 +202,9 @@ void cpu_outb(CPUState *env, int addr, int val)
 #endif
 }
 
-void cpu_outw(CPUState *env, int addr, int val)
+void cpu_outw(CPUState *env, uint32_t addr, uint16_t val)
 {
-    LOG_IOPORT("outw: %04x %04x\n", addr, val);
+    LOG_IOPORT("outw: %04"PRIx32" %04"PRIx16"\n", addr, val);
     ioport_write(1, addr, val);
 #ifdef CONFIG_KQEMU
     if (env)
@@ -212,9 +212,9 @@ void cpu_outw(CPUState *env, int addr, int val)
 #endif
 }
 
-void cpu_outl(CPUState *env, int addr, int val)
+void cpu_outl(CPUState *env, uint32_t addr, uint32_t val)
 {
-    LOG_IOPORT("outl: %04x %08x\n", addr, val);
+    LOG_IOPORT("outl: %04"PRIx32" %08"PRIx32"\n", addr, val);
     ioport_write(2, addr, val);
 #ifdef CONFIG_KQEMU
     if (env)
@@ -222,11 +222,11 @@ void cpu_outl(CPUState *env, int addr, int val)
 #endif
 }
 
-int cpu_inb(CPUState *env, int addr)
+uint8_t cpu_inb(CPUState *env, uint32_t addr)
 {
-    int val;
+    uint8_t val;
     val = ioport_read(0, addr);
-    LOG_IOPORT("inb : %04x %02x\n", addr, val);
+    LOG_IOPORT("inb : %04"PRIx32" %02"PRIx8"\n", addr, val);
 #ifdef CONFIG_KQEMU
     if (env)
         env->last_io_time = cpu_get_time_fast();
@@ -234,11 +234,11 @@ int cpu_inb(CPUState *env, int addr)
     return val;
 }
 
-int cpu_inw(CPUState *env, int addr)
+uint16_t cpu_inw(CPUState *env, uint32_t addr)
 {
-    int val;
+    uint16_t val;
     val = ioport_read(1, addr);
-    LOG_IOPORT("inw : %04x %04x\n", addr, val);
+    LOG_IOPORT("inw : %04"PRIx32" %04"PRIx16"\n", addr, val);
 #ifdef CONFIG_KQEMU
     if (env)
         env->last_io_time = cpu_get_time_fast();
@@ -246,15 +246,14 @@ int cpu_inw(CPUState *env, int addr)
     return val;
 }
 
-int cpu_inl(CPUState *env, int addr)
+uint32_t cpu_inl(CPUState *env, uint32_t addr)
 {
-    int val;
+    uint32_t val;
     val = ioport_read(2, addr);
-    LOG_IOPORT("inl : %04x %08x\n", addr, val);
+    LOG_IOPORT("inl : %04"PRIx32" %08"PRIx32"\n", addr, val);
 #ifdef CONFIG_KQEMU
     if (env)
         env->last_io_time = cpu_get_time_fast();
 #endif
     return val;
 }
-
diff --git a/ioport.h b/ioport.h
index 4cb59e9..e5020f3 100644
--- a/ioport.h
+++ b/ioport.h
@@ -34,22 +34,22 @@
 typedef void (IOPortWriteFunc)(void *opaque, uint32_t address, uint32_t data);
 typedef uint32_t (IOPortReadFunc)(void *opaque, uint32_t address);
 
-int register_ioport_read(int start, int length, int size,
+int register_ioport_read(uint32_t start, int length, int size,
                          IOPortReadFunc *func, void *opaque);
-int register_ioport_write(int start, int length, int size,
+int register_ioport_write(uint32_t start, int length, int size,
                           IOPortWriteFunc *func, void *opaque);
-void isa_unassign_ioport(int start, int length);
+void isa_unassign_ioport(uint32_t start, int length);
 
 
 /* NOTE: as these functions may be even used when there is an isa
    brige on non x86 targets, we always defined them */
 #if !defined(NO_CPU_IO_DEFS) && defined(NEED_CPU_H)
-void cpu_outb(CPUState *env, int addr, int val);
-void cpu_outw(CPUState *env, int addr, int val);
-void cpu_outl(CPUState *env, int addr, int val);
-int cpu_inb(CPUState *env, int addr);
-int cpu_inw(CPUState *env, int addr);
-int cpu_inl(CPUState *env, int addr);
+void cpu_outb(CPUState *env, uint32_t addr, uint8_t val);
+void cpu_outw(CPUState *env, uint32_t addr, uint16_t val);
+void cpu_outl(CPUState *env, uint32_t addr, uint32_t val);
+uint8_t cpu_inb(CPUState *env, uint32_t addr);
+uint16_t cpu_inw(CPUState *env, uint32_t addr);
+uint32_t cpu_inl(CPUState *env, uint32_t addr);
 #endif
 
 #endif /* IOPORT_H */
-- 
1.6.0.2

      parent reply	other threads:[~2009-07-03  4:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-03  4:42 [Qemu-devel] [PATCH 0/6] ioport related clean ups Isaku Yamahata
2009-07-03  4:42 ` [Qemu-devel] [PATCH 1/6] split out ioport related stuffs from vl.c into ioport.c Isaku Yamahata
2009-07-03  4:42 ` [Qemu-devel] [PATCH 2/6] use constant IOPORTS_MASK instead of 0xffff Isaku Yamahata
2009-07-03  4:42 ` [Qemu-devel] [PATCH 3/6] ioport: consolidate duplicated logic in register_ioport_{read, write}() Isaku Yamahata
2009-07-03  4:42 ` [Qemu-devel] [PATCH 4/6] ioport: remove some #ifdef DEBUG_UNUSED_IOPORT Isaku Yamahata
2009-07-09 19:10   ` Anthony Liguori
2009-07-09 22:06     ` [Qemu-devel] " Paolo Bonzini
2009-07-09 22:07       ` Anthony Liguori
2009-07-03  4:42 ` [Qemu-devel] [PATCH 5/6] consolidate user cpu_{in, out}[bwl] into ioport-user.c Isaku Yamahata
2009-07-03  4:42 ` Isaku Yamahata [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1246596159-16126-7-git-send-email-yamahata@valinux.co.jp \
    --to=yamahata@valinux.co.jp \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).