From: bellard Date: Sun, 30 Oct 2005 20:48:42 +0000 (+0000) Subject: more physical memory access functions X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.1~14763 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=aab33094073678d459ccaac5c60ea7533e8d1d8e;p=sdk%2Femulator%2Fqemu.git more physical memory access functions git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1587 c046a42c-6fe2-441c-8c8c-71466251a162 --- diff --git a/cpu-all.h b/cpu-all.h index 4f1f7726a3..be42bc9eb4 100644 --- a/cpu-all.h +++ b/cpu-all.h @@ -735,9 +735,15 @@ static inline void cpu_physical_memory_write(target_phys_addr_t addr, { cpu_physical_memory_rw(addr, (uint8_t *)buf, len, 1); } +uint32_t ldub_phys(target_phys_addr_t addr); +uint32_t lduw_phys(target_phys_addr_t addr); uint32_t ldl_phys(target_phys_addr_t addr); +uint64_t ldq_phys(target_phys_addr_t addr); void stl_phys_notdirty(target_phys_addr_t addr, uint32_t val); +void stb_phys(target_phys_addr_t addr, uint32_t val); +void stw_phys(target_phys_addr_t addr, uint32_t val); void stl_phys(target_phys_addr_t addr, uint32_t val); +void stq_phys(target_phys_addr_t addr, uint64_t val); int cpu_memory_rw_debug(CPUState *env, target_ulong addr, uint8_t *buf, int len, int is_write); diff --git a/exec.c b/exec.c index 11a3a64997..95fbe12ced 100644 --- a/exec.c +++ b/exec.c @@ -2284,6 +2284,30 @@ uint32_t ldl_phys(target_phys_addr_t addr) return val; } +/* XXX: optimize */ +uint32_t ldub_phys(target_phys_addr_t addr) +{ + uint8_t val; + cpu_physical_memory_read(addr, &val, 1); + return val; +} + +/* XXX: optimize */ +uint32_t lduw_phys(target_phys_addr_t addr) +{ + uint16_t val; + cpu_physical_memory_read(addr, (uint8_t *)&val, 2); + return tswap16(val); +} + +/* XXX: optimize */ +uint64_t ldq_phys(target_phys_addr_t addr) +{ + uint64_t val; + cpu_physical_memory_read(addr, (uint8_t *)&val, 8); + return tswap64(val); +} + /* warning: addr must be aligned. The ram page is not masked as dirty and the code inside is not invalidated. It is useful if the dirty bits are used to track modified PTEs */ @@ -2345,6 +2369,27 @@ void stl_phys(target_phys_addr_t addr, uint32_t val) } } +/* XXX: optimize */ +void stb_phys(target_phys_addr_t addr, uint32_t val) +{ + uint8_t v = val; + cpu_physical_memory_write(addr, &v, 1); +} + +/* XXX: optimize */ +void stw_phys(target_phys_addr_t addr, uint32_t val) +{ + uint16_t v = tswap16(val); + cpu_physical_memory_write(addr, (const uint8_t *)&v, 2); +} + +/* XXX: optimize */ +void stq_phys(target_phys_addr_t addr, uint64_t val) +{ + val = tswap64(val); + cpu_physical_memory_write(addr, (const uint8_t *)&val, 8); +} + #endif /* virtual memory access for debug */