summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlue Swirl <blauwirbel@gmail.com>2011-07-04 20:57:05 +0000
committerBlue Swirl <blauwirbel@gmail.com>2011-10-01 09:31:26 +0000
commit0527fcaabef6b0c1d5e2d3deb97ae11e5d243646 (patch)
treefa1cc26e01bd423b626d28c9cd9c9a6a286337dd
parent3ee3fd07c690c023528b5d090684a4e32e750a81 (diff)
downloadqemu-0527fcaabef6b0c1d5e2d3deb97ae11e5d243646.tar.gz
qemu-0527fcaabef6b0c1d5e2d3deb97ae11e5d243646.tar.bz2
qemu-0527fcaabef6b0c1d5e2d3deb97ae11e5d243646.zip
softmmu_header: pass CPUState to tlb_fill
Pass CPUState pointer to tlb_fill() instead of architecture local cpu_single_env hacks. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
-rw-r--r--exec-all.h2
-rw-r--r--softmmu_template.h8
-rw-r--r--target-alpha/op_helper.c7
-rw-r--r--target-arm/op_helper.c6
-rw-r--r--target-cris/op_helper.c7
-rw-r--r--target-i386/op_helper.c7
-rw-r--r--target-lm32/op_helper.c7
-rw-r--r--target-m68k/op_helper.c7
-rw-r--r--target-microblaze/op_helper.c7
-rw-r--r--target-mips/op_helper.c7
-rw-r--r--target-ppc/op_helper.c7
-rw-r--r--target-s390x/op_helper.c7
-rw-r--r--target-sh4/op_helper.c7
-rw-r--r--target-sparc/op_helper.c7
-rw-r--r--target-xtensa/op_helper.c5
15 files changed, 43 insertions, 55 deletions
diff --git a/exec-all.h b/exec-all.h
index 9b8d62c239..b1dfe109d2 100644
--- a/exec-all.h
+++ b/exec-all.h
@@ -273,7 +273,7 @@ extern CPUWriteMemoryFunc *io_mem_write[IO_MEM_NB_ENTRIES][4];
extern CPUReadMemoryFunc *io_mem_read[IO_MEM_NB_ENTRIES][4];
extern void *io_mem_opaque[IO_MEM_NB_ENTRIES];
-void tlb_fill(target_ulong addr, int is_write, int mmu_idx,
+void tlb_fill(CPUState *env1, target_ulong addr, int is_write, int mmu_idx,
void *retaddr);
#include "softmmu_defs.h"
diff --git a/softmmu_template.h b/softmmu_template.h
index ae0ccf226c..36eb2e8fc0 100644
--- a/softmmu_template.h
+++ b/softmmu_template.h
@@ -136,7 +136,7 @@ DATA_TYPE REGPARM glue(glue(__ld, SUFFIX), MMUSUFFIX)(target_ulong addr,
if ((addr & (DATA_SIZE - 1)) != 0)
do_unaligned_access(addr, READ_ACCESS_TYPE, mmu_idx, retaddr);
#endif
- tlb_fill(addr, READ_ACCESS_TYPE, mmu_idx, retaddr);
+ tlb_fill(env, addr, READ_ACCESS_TYPE, mmu_idx, retaddr);
goto redo;
}
return res;
@@ -186,7 +186,7 @@ static DATA_TYPE glue(glue(slow_ld, SUFFIX), MMUSUFFIX)(target_ulong addr,
}
} else {
/* the page is not in the TLB : fill it */
- tlb_fill(addr, READ_ACCESS_TYPE, mmu_idx, retaddr);
+ tlb_fill(env, addr, READ_ACCESS_TYPE, mmu_idx, retaddr);
goto redo;
}
return res;
@@ -274,7 +274,7 @@ void REGPARM glue(glue(__st, SUFFIX), MMUSUFFIX)(target_ulong addr,
if ((addr & (DATA_SIZE - 1)) != 0)
do_unaligned_access(addr, 1, mmu_idx, retaddr);
#endif
- tlb_fill(addr, 1, mmu_idx, retaddr);
+ tlb_fill(env, addr, 1, mmu_idx, retaddr);
goto redo;
}
}
@@ -321,7 +321,7 @@ static void glue(glue(slow_st, SUFFIX), MMUSUFFIX)(target_ulong addr,
}
} else {
/* the page is not in the TLB : fill it */
- tlb_fill(addr, 1, mmu_idx, retaddr);
+ tlb_fill(env, addr, 1, mmu_idx, retaddr);
goto redo;
}
}
diff --git a/target-alpha/op_helper.c b/target-alpha/op_helper.c
index 38be2346e0..d8945dcbca 100644
--- a/target-alpha/op_helper.c
+++ b/target-alpha/op_helper.c
@@ -1335,15 +1335,14 @@ void QEMU_NORETURN cpu_unassigned_access(CPUState *env1,
NULL, it means that the function was called in C code (i.e. not
from generated code or from helper.c) */
/* XXX: fix it to restore all registers */
-void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr)
+void tlb_fill(CPUState *env1, target_ulong addr, int is_write, int mmu_idx,
+ void *retaddr)
{
CPUState *saved_env;
int ret;
- /* XXX: hack to restore env in all cases, even if not called from
- generated code */
saved_env = env;
- env = cpu_single_env;
+ env = env1;
ret = cpu_alpha_handle_mmu_fault(env, addr, is_write, mmu_idx);
if (unlikely(ret != 0)) {
do_restore_state(retaddr);
diff --git a/target-arm/op_helper.c b/target-arm/op_helper.c
index 37b77e14e5..ab9c9239d3 100644
--- a/target-arm/op_helper.c
+++ b/target-arm/op_helper.c
@@ -75,17 +75,15 @@ uint32_t HELPER(neon_tbl)(uint32_t ireg, uint32_t def,
NULL, it means that the function was called in C code (i.e. not
from generated code or from helper.c) */
/* XXX: fix it to restore all registers */
-void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr)
+void tlb_fill(CPUState *env1, target_ulong addr, int is_write, int mmu_idx,
+ void *retaddr)
{
TranslationBlock *tb;
CPUState *saved_env;
unsigned long pc;
int ret;
- /* XXX: hack to restore env in all cases, even if not called from
- generated code */
saved_env = env;
- env = cpu_single_env;
ret = cpu_arm_handle_mmu_fault(env, addr, is_write, mmu_idx);
if (unlikely(ret)) {
if (retaddr) {
diff --git a/target-cris/op_helper.c b/target-cris/op_helper.c
index 0cfe1b1870..1eacc5fd7f 100644
--- a/target-cris/op_helper.c
+++ b/target-cris/op_helper.c
@@ -56,17 +56,16 @@
NULL, it means that the function was called in C code (i.e. not
from generated code or from helper.c) */
/* XXX: fix it to restore all registers */
-void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr)
+void tlb_fill(CPUState *env1, target_ulong addr, int is_write, int mmu_idx,
+ void *retaddr)
{
TranslationBlock *tb;
CPUState *saved_env;
unsigned long pc;
int ret;
- /* XXX: hack to restore env in all cases, even if not called from
- generated code */
saved_env = env;
- env = cpu_single_env;
+ env = env1;
D_LOG("%s pc=%x tpc=%x ra=%x\n", __func__,
env->pc, env->debug1, retaddr);
diff --git a/target-i386/op_helper.c b/target-i386/op_helper.c
index 1fc248fa17..3bb5a919ce 100644
--- a/target-i386/op_helper.c
+++ b/target-i386/op_helper.c
@@ -4997,17 +4997,16 @@ void helper_boundl(target_ulong a0, int v)
NULL, it means that the function was called in C code (i.e. not
from generated code or from helper.c) */
/* XXX: fix it to restore all registers */
-void tlb_fill(target_ulong addr, int is_write, int mmu_idx, void *retaddr)
+void tlb_fill(CPUState *env1, target_ulong addr, int is_write, int mmu_idx,
+ void *retaddr)
{
TranslationBlock *tb;
int ret;
unsigned long pc;
CPUX86State *saved_env;
- /* XXX: hack to restore env in all cases, even if not called from
- generated code */
saved_env = env;
- env = cpu_single_env;
+ env = env1;
ret = cpu_x86_handle_mmu_fault(env, addr, is_write, mmu_idx);
if (ret) {
diff --git a/target-lm32/op_helper.c b/target-lm32/op_helper.c
index 557da6ce38..02be13412e 100644
--- a/target-lm32/op_helper.c
+++ b/target-lm32/op_helper.c
@@ -75,17 +75,16 @@ uint32_t helper_rcsr_jrx(void)
NULL, it means that the function was called in C code (i.e. not
from generated code or from helper.c) */
/* XXX: fix it to restore all registers */
-void tlb_fill(target_ulong addr, int is_write, int mmu_idx, void *retaddr)
+void tlb_fill(CPUState *env1, target_ulong addr, int is_write, int mmu_idx,
+ void *retaddr)
{
TranslationBlock *tb;
CPUState *saved_env;
unsigned long pc;
int ret;
- /* XXX: hack to restore env in all cases, even if not called from
- generated code */
saved_env = env;
- env = cpu_single_env;
+ env = env1;
ret = cpu_lm32_handle_mmu_fault(env, addr, is_write, mmu_idx);
if (unlikely(ret)) {
diff --git a/target-m68k/op_helper.c b/target-m68k/op_helper.c
index c66fa0cf3d..2f7fe6bc4e 100644
--- a/target-m68k/op_helper.c
+++ b/target-m68k/op_helper.c
@@ -55,17 +55,16 @@ extern int semihosting_enabled;
NULL, it means that the function was called in C code (i.e. not
from generated code or from helper.c) */
/* XXX: fix it to restore all registers */
-void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr)
+void tlb_fill(CPUState *env1, target_ulong addr, int is_write, int mmu_idx,
+ void *retaddr)
{
TranslationBlock *tb;
CPUState *saved_env;
unsigned long pc;
int ret;
- /* XXX: hack to restore env in all cases, even if not called from
- generated code */
saved_env = env;
- env = cpu_single_env;
+ env = env1;
ret = cpu_m68k_handle_mmu_fault(env, addr, is_write, mmu_idx);
if (unlikely(ret)) {
if (retaddr) {
diff --git a/target-microblaze/op_helper.c b/target-microblaze/op_helper.c
index 8a7deac487..7433cec291 100644
--- a/target-microblaze/op_helper.c
+++ b/target-microblaze/op_helper.c
@@ -42,17 +42,16 @@
NULL, it means that the function was called in C code (i.e. not
from generated code or from helper.c) */
/* XXX: fix it to restore all registers */
-void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr)
+void tlb_fill(CPUState *env1, target_ulong addr, int is_write, int mmu_idx,
+ void *retaddr)
{
TranslationBlock *tb;
CPUState *saved_env;
unsigned long pc;
int ret;
- /* XXX: hack to restore env in all cases, even if not called from
- generated code */
saved_env = env;
- env = cpu_single_env;
+ env = env1;
ret = cpu_mb_handle_mmu_fault(env, addr, is_write, mmu_idx);
if (unlikely(ret)) {
diff --git a/target-mips/op_helper.c b/target-mips/op_helper.c
index 96e40c6018..c51b9cb6f0 100644
--- a/target-mips/op_helper.c
+++ b/target-mips/op_helper.c
@@ -2316,17 +2316,16 @@ static void do_unaligned_access (target_ulong addr, int is_write, int is_user, v
helper_raise_exception ((is_write == 1) ? EXCP_AdES : EXCP_AdEL);
}
-void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr)
+void tlb_fill(CPUState *env1, target_ulong addr, int is_write, int mmu_idx,
+ void *retaddr)
{
TranslationBlock *tb;
CPUState *saved_env;
unsigned long pc;
int ret;
- /* XXX: hack to restore env in all cases, even if not called from
- generated code */
saved_env = env;
- env = cpu_single_env;
+ env = env1;
ret = cpu_mips_handle_mmu_fault(env, addr, is_write, mmu_idx);
if (ret) {
if (retaddr) {
diff --git a/target-ppc/op_helper.c b/target-ppc/op_helper.c
index c5e0601292..134b0c6587 100644
--- a/target-ppc/op_helper.c
+++ b/target-ppc/op_helper.c
@@ -3714,17 +3714,16 @@ uint32_t helper_efdcmpeq (uint64_t op1, uint64_t op2)
NULL, it means that the function was called in C code (i.e. not
from generated code or from helper.c) */
/* XXX: fix it to restore all registers */
-void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr)
+void tlb_fill(CPUState *env1, target_ulong addr, int is_write, int mmu_idx,
+ void *retaddr)
{
TranslationBlock *tb;
CPUState *saved_env;
unsigned long pc;
int ret;
- /* XXX: hack to restore env in all cases, even if not called from
- generated code */
saved_env = env;
- env = cpu_single_env;
+ env = env1;
ret = cpu_ppc_handle_mmu_fault(env, addr, is_write, mmu_idx);
if (unlikely(ret != 0)) {
if (likely(retaddr)) {
diff --git a/target-s390x/op_helper.c b/target-s390x/op_helper.c
index b3ac630a6a..cd57678150 100644
--- a/target-s390x/op_helper.c
+++ b/target-s390x/op_helper.c
@@ -52,17 +52,16 @@
NULL, it means that the function was called in C code (i.e. not
from generated code or from helper.c) */
/* XXX: fix it to restore all registers */
-void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr)
+void tlb_fill(CPUState *env1, target_ulong addr, int is_write, int mmu_idx,
+ void *retaddr)
{
TranslationBlock *tb;
CPUState *saved_env;
unsigned long pc;
int ret;
- /* XXX: hack to restore env in all cases, even if not called from
- generated code */
saved_env = env;
- env = cpu_single_env;
+ env = env1;
ret = cpu_s390x_handle_mmu_fault(env, addr, is_write, mmu_idx);
if (unlikely(ret != 0)) {
if (likely(retaddr)) {
diff --git a/target-sh4/op_helper.c b/target-sh4/op_helper.c
index 163858f560..b299576651 100644
--- a/target-sh4/op_helper.c
+++ b/target-sh4/op_helper.c
@@ -55,15 +55,14 @@ static void cpu_restore_state_from_retaddr(void *retaddr)
#define SHIFT 3
#include "softmmu_template.h"
-void tlb_fill(target_ulong addr, int is_write, int mmu_idx, void *retaddr)
+void tlb_fill(CPUState *env1, target_ulong addr, int is_write, int mmu_idx,
+ void *retaddr)
{
CPUState *saved_env;
int ret;
- /* XXX: hack to restore env in all cases, even if not called from
- generated code */
saved_env = env;
- env = cpu_single_env;
+ env = env1;
ret = cpu_sh4_handle_mmu_fault(env, addr, is_write, mmu_idx);
if (ret) {
/* now we have a real cpu fault */
diff --git a/target-sparc/op_helper.c b/target-sparc/op_helper.c
index 48e1db8227..1cb0636c30 100644
--- a/target-sparc/op_helper.c
+++ b/target-sparc/op_helper.c
@@ -4225,15 +4225,14 @@ static void do_unaligned_access(target_ulong addr, int is_write, int is_user,
NULL, it means that the function was called in C code (i.e. not
from generated code or from helper.c) */
/* XXX: fix it to restore all registers */
-void tlb_fill(target_ulong addr, int is_write, int mmu_idx, void *retaddr)
+void tlb_fill(CPUState *env1, target_ulong addr, int is_write, int mmu_idx,
+ void *retaddr)
{
int ret;
CPUState *saved_env;
- /* XXX: hack to restore env in all cases, even if not called from
- generated code */
saved_env = env;
- env = cpu_single_env;
+ env = env1;
ret = cpu_sparc_handle_mmu_fault(env, addr, is_write, mmu_idx);
if (ret) {
diff --git a/target-xtensa/op_helper.c b/target-xtensa/op_helper.c
index d02706db62..64847fc8e6 100644
--- a/target-xtensa/op_helper.c
+++ b/target-xtensa/op_helper.c
@@ -70,11 +70,12 @@ static void do_unaligned_access(target_ulong addr, int is_write, int is_user,
}
}
-void tlb_fill(target_ulong vaddr, int is_write, int mmu_idx, void *retaddr)
+void tlb_fill(CPUState *env1, target_ulong vaddr, int is_write, int mmu_idx,
+ void *retaddr)
{
CPUState *saved_env = env;
- env = cpu_single_env;
+ env = env1;
{
uint32_t paddr;
uint32_t page_size;