qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 1/2] pass parameter as char.


From: Glauber Costa
Subject: [Qemu-devel] [PATCH 1/2] pass parameter as char.
Date: Thu, 11 Dec 2008 09:11:49 -0500

pass parameter to tb_invalidate_phys_page_fast() as a char, that we'll
actually transform into an integer. It will make it easier for generator macros
to deal with it.

Signed-off-by: Glauber Costa <address@hidden>
---
 exec.c |   26 ++++++++++++++++++++++----
 1 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/exec.c b/exec.c
index 105812f..35e0b8e 100644
--- a/exec.c
+++ b/exec.c
@@ -997,11 +997,29 @@ void tb_invalidate_phys_page_range(target_phys_addr_t 
start, target_phys_addr_t
 #endif
 }
 
+static inline int size2len(char size)
+{
+    switch (size) {
+    case 'b':
+        return 1;
+    case 'w':
+        return 2;
+    case 'l':
+        return 4;
+    }
+     
+    /* should never happen */
+    fprintf(stderr, "%s: invalid size %d\n", __func__, size);
+    exit(1);
+    return -1;
+}
+
 /* len must be <= 8 and start must be a multiple of len */
-static inline void tb_invalidate_phys_page_fast(target_phys_addr_t start, int 
len)
+static inline void tb_invalidate_phys_page_fast(target_phys_addr_t start, char 
size)
 {
     PageDesc *p;
     int offset, b;
+    int len = size2len(size);
 #if 0
     if (1) {
         if (loglevel) {
@@ -2444,7 +2462,7 @@ static void notdirty_mem_writeb(void *opaque, 
target_phys_addr_t ram_addr,
     dirty_flags = phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS];
     if (!(dirty_flags & CODE_DIRTY_FLAG)) {
 #if !defined(CONFIG_USER_ONLY)
-        tb_invalidate_phys_page_fast(ram_addr, 1);
+        tb_invalidate_phys_page_fast(ram_addr, 'b');
         dirty_flags = phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS];
 #endif
     }
@@ -2469,7 +2487,7 @@ static void notdirty_mem_writew(void *opaque, 
target_phys_addr_t ram_addr,
     dirty_flags = phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS];
     if (!(dirty_flags & CODE_DIRTY_FLAG)) {
 #if !defined(CONFIG_USER_ONLY)
-        tb_invalidate_phys_page_fast(ram_addr, 2);
+        tb_invalidate_phys_page_fast(ram_addr, 'w');
         dirty_flags = phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS];
 #endif
     }
@@ -2494,7 +2512,7 @@ static void notdirty_mem_writel(void *opaque, 
target_phys_addr_t ram_addr,
     dirty_flags = phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS];
     if (!(dirty_flags & CODE_DIRTY_FLAG)) {
 #if !defined(CONFIG_USER_ONLY)
-        tb_invalidate_phys_page_fast(ram_addr, 4);
+        tb_invalidate_phys_page_fast(ram_addr, 'l');
         dirty_flags = phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS];
 #endif
     }
-- 
1.5.6.5





reply via email to

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