Skip to contentSkip to conversation

qtest: Handle addresses and values for {in, out}[bwl] as unsigned

PATCH Applied Peter Maydell 3 participants 3 messages Apr 21, 2013 – Apr 22, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qtest: Handle addresses and values for {in, out}[bwl] as unsigned

Handle the addresses and values for {in,out}[bwl] as unsigned (ie with strtoul), as per the protocol specification comment. This fixes a test failure in test_i440fx_defaults on 32-bit hosts where the test tries to write 0x80000000 and qtest was instead writing 0x7fffffff.

---
This fixes the actual parsing error; checking strtol errors is a separate bug which should be done for the whole file.

 qtest.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
qtest.c +3 -3
index 3bba3e5..07a9612 100644
@@ -271,8 +271,8 @@ static void qtest_process_command(CharDriverState *chr, gchar **words)
         uint32_t value;
 
         g_assert(words[1] && words[2]);
-        addr = strtol(words[1], NULL, 0);
-        value = strtol(words[2], NULL, 0);
+        addr = strtoul(words[1], NULL, 0);
+        value = strtoul(words[2], NULL, 0);
 
         if (words[0][3] == 'b') {
             cpu_outb(addr, value);
@@ -290,7 +290,7 @@ static void qtest_process_command(CharDriverState *chr, gchar **words)
         uint32_t value = -1U;
 
         g_assert(words[1]);
-        addr = strtol(words[1], NULL, 0);
+        addr = strtoul(words[1], NULL, 0);
 
         if (words[0][2] == 'b') {
             value = cpu_inb(addr);
Signature · 1 line
1.7.10.4
Tested-by on v1 1/1
#1 lore raw
Quoted 6 lines · Peter Maydell

Handle the addresses and values for {in,out}[bwl] as unsigned (ie with strtoul), as per the protocol specification comment. This fixes a test failure in test_i440fx_defaults on 32-bit hosts where the test tries to write 0x80000000 and qtest was instead writing 0x7fffffff.

Fixes the problem for me.

Quoted 34 lines

---
This fixes the actual parsing error; checking strtol errors is a separate bug which should be done for the whole file.

 qtest.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
qtest.c +3 -4
index 3bba3e5..07a9612 100644
@@ -271,8 +271,8 @@ static void qtest_process_command(CharDriverState *chr, gchar **words)
         uint32_t value;
 
         g_assert(words[1] && words[2]);
-        addr = strtol(words[1], NULL, 0);
-        value = strtol(words[2], NULL, 0);
+        addr = strtoul(words[1], NULL, 0);
+        value = strtoul(words[2], NULL, 0);
 
         if (words[0][3] == 'b') {
             cpu_outb(addr, value);
@@ -290,7 +290,7 @@ static void qtest_process_command(CharDriverState *chr, gchar **words)
         uint32_t value = -1U;
 
         g_assert(words[1]);
-        addr = strtol(words[1], NULL, 0);
+        addr = strtoul(words[1], NULL, 0);
 
         if (words[0][2] == 'b') {
             value = cpu_inb(addr);
--

1.7.10.4