/[qemu]/qemu/exec.c
ViewVC logotype

Diff of /qemu/exec.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.55 by bellard, Thu Jan 27 23:58:13 2005 UTC revision 1.56 by bellard, Fri Jan 28 22:37:14 2005 UTC
# Line 2032  void cpu_physical_memory_rw(target_phys_ Line 2032  void cpu_physical_memory_rw(target_phys_
2032          addr += l;          addr += l;
2033      }      }
2034  }  }
2035    
2036    /* never used */
2037    uint32_t ldl_phys(target_phys_addr_t addr)
2038    {
2039        return 0;
2040    }
2041    
2042    void stl_phys_notdirty(target_phys_addr_t addr, uint32_t val)
2043    {
2044    }
2045    
2046    void stl_phys(target_phys_addr_t addr, uint32_t val)
2047    {
2048    }
2049    
2050  #else  #else
2051  void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf,  void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf,
2052                              int len, int is_write)                              int len, int is_write)
# Line 2118  void cpu_physical_memory_rw(target_phys_ Line 2133  void cpu_physical_memory_rw(target_phys_
2133          addr += l;          addr += l;
2134      }      }
2135  }  }
2136    
2137    /* warning: addr must be aligned */
2138    uint32_t ldl_phys(target_phys_addr_t addr)
2139    {
2140        int io_index;
2141        uint8_t *ptr;
2142        uint32_t val;
2143        unsigned long pd;
2144        PhysPageDesc *p;
2145    
2146        p = phys_page_find(addr >> TARGET_PAGE_BITS);
2147        if (!p) {
2148            pd = IO_MEM_UNASSIGNED;
2149        } else {
2150            pd = p->phys_offset;
2151        }
2152            
2153        if ((pd & ~TARGET_PAGE_MASK) > IO_MEM_ROM &&
2154            (pd & ~TARGET_PAGE_MASK) != IO_MEM_CODE) {
2155            /* I/O case */
2156            io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1);
2157            val = io_mem_read[io_index][2](io_mem_opaque[io_index], addr);
2158        } else {
2159            /* RAM case */
2160            ptr = phys_ram_base + (pd & TARGET_PAGE_MASK) +
2161                (addr & ~TARGET_PAGE_MASK);
2162            val = ldl_p(ptr);
2163        }
2164        return val;
2165    }
2166    
2167    /* warning: addr must be aligned. The ram page is not masked as dirty
2168       and the code inside is not invalidated. It is useful if the dirty
2169       bits are used to track modified PTEs */
2170    void stl_phys_notdirty(target_phys_addr_t addr, uint32_t val)
2171    {
2172        int io_index;
2173        uint8_t *ptr;
2174        unsigned long pd;
2175        PhysPageDesc *p;
2176    
2177        p = phys_page_find(addr >> TARGET_PAGE_BITS);
2178        if (!p) {
2179            pd = IO_MEM_UNASSIGNED;
2180        } else {
2181            pd = p->phys_offset;
2182        }
2183            
2184        if ((pd & ~TARGET_PAGE_MASK) != 0) {
2185            io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1);
2186            io_mem_write[io_index][2](io_mem_opaque[io_index], addr, val);
2187        } else {
2188            ptr = phys_ram_base + (pd & TARGET_PAGE_MASK) +
2189                (addr & ~TARGET_PAGE_MASK);
2190            stl_p(ptr, val);
2191        }
2192    }
2193    
2194    /* warning: addr must be aligned */
2195    /* XXX: optimize code invalidation test */
2196    void stl_phys(target_phys_addr_t addr, uint32_t val)
2197    {
2198        int io_index;
2199        uint8_t *ptr;
2200        unsigned long pd;
2201        PhysPageDesc *p;
2202    
2203        p = phys_page_find(addr >> TARGET_PAGE_BITS);
2204        if (!p) {
2205            pd = IO_MEM_UNASSIGNED;
2206        } else {
2207            pd = p->phys_offset;
2208        }
2209            
2210        if ((pd & ~TARGET_PAGE_MASK) != 0) {
2211            io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1);
2212            io_mem_write[io_index][2](io_mem_opaque[io_index], addr, val);
2213        } else {
2214            unsigned long addr1;
2215            addr1 = (pd & TARGET_PAGE_MASK) + (addr & ~TARGET_PAGE_MASK);
2216            /* RAM case */
2217            ptr = phys_ram_base + addr1;
2218            stl_p(ptr, val);
2219            /* invalidate code */
2220            tb_invalidate_phys_page_range(addr1, addr1 + 4, 0);
2221            /* set dirty bit */
2222            phys_ram_dirty[addr1 >> TARGET_PAGE_BITS] = 1;
2223        }
2224    }
2225    
2226  #endif  #endif
2227    
2228  /* virtual memory access for debug */  /* virtual memory access for debug */

Legend:
Removed from v.1.55  
changed lines
  Added in v.1.56

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26