aboutsummaryrefslogtreecommitdiff
path: root/softmmu_template.h
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-04-25 17:57:43 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-04-25 17:57:43 +0000
commitd720b93d0bcfe1beb729245b9ed1e5f071a24bd5 (patch)
tree4f9d65b82b9eb8bd65681cfde6bb18e7b6bd2eae /softmmu_template.h
parenteeab3a558f89e30ee93ef628bcbd6a3f64b9b8a6 (diff)
downloadqemu-d720b93d0bcfe1beb729245b9ed1e5f071a24bd5.zip
qemu-d720b93d0bcfe1beb729245b9ed1e5f071a24bd5.tar.gz
qemu-d720b93d0bcfe1beb729245b9ed1e5f071a24bd5.tar.bz2
precise self modifying code support
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@745 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'softmmu_template.h')
-rw-r--r--softmmu_template.h20
1 files changed, 12 insertions, 8 deletions
diff --git a/softmmu_template.h b/softmmu_template.h
index 2203c5a..413c599 100644
--- a/softmmu_template.h
+++ b/softmmu_template.h
@@ -70,20 +70,23 @@ static inline DATA_TYPE glue(io_read, SUFFIX)(unsigned long physaddr,
static inline void glue(io_write, SUFFIX)(unsigned long physaddr,
DATA_TYPE val,
- unsigned long tlb_addr)
+ unsigned long tlb_addr,
+ void *retaddr)
{
int index;
index = (tlb_addr >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1);
+ env->mem_write_vaddr = tlb_addr;
+ env->mem_write_pc = (unsigned long)retaddr;
#if SHIFT <= 2
- io_mem_write[index][SHIFT](physaddr, val, tlb_addr);
+ io_mem_write[index][SHIFT](physaddr, val);
#else
#ifdef TARGET_WORDS_BIGENDIAN
- io_mem_write[index][2](physaddr, val >> 32, tlb_addr);
- io_mem_write[index][2](physaddr + 4, val, tlb_addr);
+ io_mem_write[index][2](physaddr, val >> 32);
+ io_mem_write[index][2](physaddr + 4, val);
#else
- io_mem_write[index][2](physaddr, val, tlb_addr);
- io_mem_write[index][2](physaddr + 4, val >> 32, tlb_addr);
+ io_mem_write[index][2](physaddr, val);
+ io_mem_write[index][2](physaddr + 4, val >> 32);
#endif
#endif /* SHIFT > 2 */
}
@@ -193,7 +196,8 @@ void REGPARM(2) glue(glue(__st, SUFFIX), MMUSUFFIX)(unsigned long addr,
/* IO access */
if ((addr & (DATA_SIZE - 1)) != 0)
goto do_unaligned_access;
- glue(io_write, SUFFIX)(physaddr, val, tlb_addr);
+ retaddr = GETPC();
+ glue(io_write, SUFFIX)(physaddr, val, tlb_addr, retaddr);
} else if (((addr & 0xfff) + DATA_SIZE - 1) >= TARGET_PAGE_SIZE) {
do_unaligned_access:
retaddr = GETPC();
@@ -229,7 +233,7 @@ static void glue(glue(slow_st, SUFFIX), MMUSUFFIX)(unsigned long addr,
/* IO access */
if ((addr & (DATA_SIZE - 1)) != 0)
goto do_unaligned_access;
- glue(io_write, SUFFIX)(physaddr, val, tlb_addr);
+ glue(io_write, SUFFIX)(physaddr, val, tlb_addr, retaddr);
} else if (((addr & 0xfff) + DATA_SIZE - 1) >= TARGET_PAGE_SIZE) {
do_unaligned_access:
/* XXX: not efficient, but simple */