qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 12/20] w64: Fix data types in softmmu*.h


From: Stefan Weil
Subject: Re: [Qemu-devel] [PATCH 12/20] w64: Fix data types in softmmu*.h
Date: Sun, 15 Apr 2012 16:30:19 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.28) Gecko/20120313 Thunderbird/3.1.20

Am 15.04.2012 16:13, schrieb Stefan Weil:
w64 requires uintptr_t.

Signed-off-by: Stefan Weil<address@hidden>
---
  softmmu_header.h   |    6 +++---
  softmmu_template.h |   20 ++++++++------------
  2 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/softmmu_header.h b/softmmu_header.h
index edc7826..77c95dc 100644
--- a/softmmu_header.h
+++ b/softmmu_header.h
@@ -111,7 +111,7 @@ glue(glue(glue(CPU_PREFIX, ld), USUFFIX), 
MEMSUFFIX)(ENV_PARAM
                                                                       mmu_idx);
      } else {
          uintptr_t physaddr = addr + 
env->tlb_table[mmu_idx][page_index].addend;
-        res = glue(glue(ld, USUFFIX), _raw)((uint8_t *)physaddr);
+        res = glue(glue(ld, USUFFIX), _raw)(physaddr);
      }
      return res;
  }
@@ -134,7 +134,7 @@ glue(glue(glue(CPU_PREFIX, lds), SUFFIX), 
MEMSUFFIX)(ENV_PARAM
                                 MMUSUFFIX)(ENV_VAR addr, mmu_idx);
      } else {
          uintptr_t physaddr = addr + 
env->tlb_table[mmu_idx][page_index].addend;
-        res = glue(glue(lds, SUFFIX), _raw)((uint8_t *)physaddr);
+        res = glue(glue(lds, SUFFIX), _raw)(physaddr);
      }
      return res;
  }
@@ -161,7 +161,7 @@ glue(glue(glue(CPU_PREFIX, st), SUFFIX), 
MEMSUFFIX)(ENV_PARAM target_ulong ptr,
                                                                 mmu_idx);
      } else {
          uintptr_t physaddr = addr + 
env->tlb_table[mmu_idx][page_index].addend;
-        glue(glue(st, SUFFIX), _raw)((uint8_t *)physaddr, v);
+        glue(glue(st, SUFFIX), _raw)(physaddr, v);
      }
  }

diff --git a/softmmu_template.h b/softmmu_template.h
index b285d78..8db33c1 100644
--- a/softmmu_template.h
+++ b/softmmu_template.h
@@ -112,7 +112,6 @@ glue(glue(glue(HELPER_PREFIX, ld), SUFFIX), 
MMUSUFFIX)(ENV_PARAM
      int index;
      target_ulong tlb_addr;
      target_phys_addr_t ioaddr;
-    unsigned long addend;
      uintptr_t retaddr;

      /* test if there is match for unaligned or IO access */
@@ -145,8 +144,8 @@ glue(glue(glue(HELPER_PREFIX, ld), SUFFIX), 
MMUSUFFIX)(ENV_PARAM
                  do_unaligned_access(ENV_VAR addr, READ_ACCESS_TYPE, mmu_idx, 
retaddr);
              }
  #endif
-            addend = env->tlb_table[mmu_idx][index].addend;
-            res = glue(glue(ld, USUFFIX), _raw)((uint8_t 
*)(long)(addr+addend));
+            uintptr_t addend = env->tlb_table[mmu_idx][index].addend;
+            res = glue(glue(ld, USUFFIX), _raw)((uint8_t *)(addr+addend));
          }
      } else {
          /* the page is not in the TLB : fill it */
@@ -171,7 +170,6 @@ glue(glue(slow_ld, SUFFIX), MMUSUFFIX)(ENV_PARAM
      DATA_TYPE res, res1, res2;
      int index, shift;
      target_phys_addr_t ioaddr;
-    unsigned long addend;
      target_ulong tlb_addr, addr1, addr2;

      index = (addr>>  TARGET_PAGE_BITS)&  (CPU_TLB_SIZE - 1);
@@ -202,8 +200,8 @@ glue(glue(slow_ld, SUFFIX), MMUSUFFIX)(ENV_PARAM
              res = (DATA_TYPE)res;
          } else {
              /* unaligned/aligned access in the same page */
-            addend = env->tlb_table[mmu_idx][index].addend;
-            res = glue(glue(ld, USUFFIX), _raw)((uint8_t 
*)(long)(addr+addend));
+            uintptr_t addend = env->tlb_table[mmu_idx][index].addend;
+            res = glue(glue(ld, USUFFIX), _raw)((uint8_t *)(addr+addend));
          }
      } else {
          /* the page is not in the TLB : fill it */
@@ -258,7 +256,6 @@ void glue(glue(glue(HELPER_PREFIX, st), SUFFIX), 
MMUSUFFIX)(ENV_PARAM
                                                              int mmu_idx)
  {
      target_phys_addr_t ioaddr;
-    unsigned long addend;
      target_ulong tlb_addr;
      uintptr_t retaddr;
      int index;
@@ -290,8 +287,8 @@ void glue(glue(glue(HELPER_PREFIX, st), SUFFIX), 
MMUSUFFIX)(ENV_PARAM
                  do_unaligned_access(ENV_VAR addr, 1, mmu_idx, retaddr);
              }
  #endif
-            addend = env->tlb_table[mmu_idx][index].addend;
-            glue(glue(st, SUFFIX), _raw)((uint8_t *)(long)(addr+addend), val);
+            uintptr_t addend = env->tlb_table[mmu_idx][index].addend;
+            glue(glue(st, SUFFIX), _raw)((uint8_t *)(addr+addend), val);
          }
      } else {
          /* the page is not in the TLB : fill it */
@@ -313,7 +310,6 @@ static void glue(glue(slow_st, SUFFIX), MMUSUFFIX)(ENV_PARAM
                                                     uintptr_t retaddr)
  {
      target_phys_addr_t ioaddr;
-    unsigned long addend;
      target_ulong tlb_addr;
      int index, i;

@@ -345,8 +341,8 @@ static void glue(glue(slow_st, SUFFIX), MMUSUFFIX)(ENV_PARAM
              }
          } else {
              /* aligned/unaligned access in the same page */
-            addend = env->tlb_table[mmu_idx][index].addend;
-            glue(glue(st, SUFFIX), _raw)((uint8_t *)(long)(addr+addend), val);
+            uintptr_t addend = env->tlb_table[mmu_idx][index].addend;
+            glue(glue(st, SUFFIX), _raw)((uint8_t *)(addr+addend), val);
          }
      } else {
          /* the page is not in the TLB : fill it */


Sorry, I just noticed that I removed too many type casts in this patch.
Compilation fails on 386 hosts.

I'll send an update.

Stefan W.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]