Revision d0ecd2aa

b/cpu-all.h
857 857
void stl_phys(target_phys_addr_t addr, uint32_t val);
858 858
void stq_phys(target_phys_addr_t addr, uint64_t val);
859 859

  
860
void cpu_physical_memory_write_rom(target_phys_addr_t addr, 
861
                                   const uint8_t *buf, int len);
860 862
int cpu_memory_rw_debug(CPUState *env, target_ulong addr, 
861 863
                        uint8_t *buf, int len, int is_write);
862 864

  
b/exec.c
2080 2080
    }
2081 2081
}
2082 2082

  
2083
/* used for ROM loading : can write in RAM and ROM */
2084
void cpu_physical_memory_write_rom(target_phys_addr_t addr, 
2085
                                   const uint8_t *buf, int len)
2086
{
2087
    int l;
2088
    uint8_t *ptr;
2089
    target_phys_addr_t page;
2090
    unsigned long pd;
2091
    PhysPageDesc *p;
2092
    
2093
    while (len > 0) {
2094
        page = addr & TARGET_PAGE_MASK;
2095
        l = (page + TARGET_PAGE_SIZE) - addr;
2096
        if (l > len)
2097
            l = len;
2098
        p = phys_page_find(page >> TARGET_PAGE_BITS);
2099
        if (!p) {
2100
            pd = IO_MEM_UNASSIGNED;
2101
        } else {
2102
            pd = p->phys_offset;
2103
        }
2104
        
2105
        if ((pd & ~TARGET_PAGE_MASK) != IO_MEM_RAM &&
2106
            (pd & ~TARGET_PAGE_MASK) != IO_MEM_ROM) {
2107
            /* do nothing */
2108
        } else {
2109
            unsigned long addr1;
2110
            addr1 = (pd & TARGET_PAGE_MASK) + (addr & ~TARGET_PAGE_MASK);
2111
            /* ROM/RAM case */
2112
            ptr = phys_ram_base + addr1;
2113
            memcpy(ptr, buf, l);
2114
        }
2115
        len -= l;
2116
        buf += l;
2117
        addr += l;
2118
    }
2119
}
2120

  
2121

  
2083 2122
/* warning: addr must be aligned */
2084 2123
uint32_t ldl_phys(target_phys_addr_t addr)
2085 2124
{

Also available in: Unified diff