提交 3c688828 编写于 作者: B Blue Swirl

m68k: use caller supplied CPUState for interrupt related stuff

Pass CPUState to do_interrupt(). This is needed by later patches.

It would be cleaner to move the function to helper.c, but there are
a few dependencies between do_interrupt() and other functions.
Signed-off-by: NBlue Swirl <blauwirbel@gmail.com>
上级 e694d4e2
...@@ -294,7 +294,7 @@ int cpu_exec(CPUState *env1) ...@@ -294,7 +294,7 @@ int cpu_exec(CPUState *env1)
#elif defined(TARGET_CRIS) #elif defined(TARGET_CRIS)
do_interrupt(env); do_interrupt(env);
#elif defined(TARGET_M68K) #elif defined(TARGET_M68K)
do_interrupt(0); do_interrupt(env);
#elif defined(TARGET_S390X) #elif defined(TARGET_S390X)
do_interrupt(env); do_interrupt(env);
#endif #endif
...@@ -529,7 +529,7 @@ int cpu_exec(CPUState *env1) ...@@ -529,7 +529,7 @@ int cpu_exec(CPUState *env1)
provide/save the vector when the interrupt is provide/save the vector when the interrupt is
first signalled. */ first signalled. */
env->exception_index = env->pending_vector; env->exception_index = env->pending_vector;
do_interrupt(1); do_interrupt_m68k_hardirq(env);
next_tb = 0; next_tb = 0;
} }
#elif defined(TARGET_S390X) && !defined(CONFIG_USER_ONLY) #elif defined(TARGET_S390X) && !defined(CONFIG_USER_ONLY)
......
...@@ -119,7 +119,8 @@ void m68k_tcg_init(void); ...@@ -119,7 +119,8 @@ void m68k_tcg_init(void);
CPUM68KState *cpu_m68k_init(const char *cpu_model); CPUM68KState *cpu_m68k_init(const char *cpu_model);
int cpu_m68k_exec(CPUM68KState *s); int cpu_m68k_exec(CPUM68KState *s);
void cpu_m68k_close(CPUM68KState *s); void cpu_m68k_close(CPUM68KState *s);
void do_interrupt(int is_hw); void do_interrupt(CPUState *env1);
void do_interrupt_m68k_hardirq(CPUState *env1);
/* you can call this signal handler from your SIGBUS and SIGSEGV /* you can call this signal handler from your SIGBUS and SIGSEGV
signal handlers to inform the virtual CPU of exceptions. non zero signal handlers to inform the virtual CPU of exceptions. non zero
is returned if the signal was handled by the virtual CPU. */ is returned if the signal was handled by the virtual CPU. */
......
...@@ -21,9 +21,13 @@ ...@@ -21,9 +21,13 @@
#if defined(CONFIG_USER_ONLY) #if defined(CONFIG_USER_ONLY)
void do_interrupt(int is_hw) void do_interrupt(CPUState *env1)
{
env1->exception_index = -1;
}
void do_interrupt_m68k_hardirq(CPUState *env1)
{ {
env->exception_index = -1;
} }
#else #else
...@@ -90,7 +94,7 @@ static void do_rte(void) ...@@ -90,7 +94,7 @@ static void do_rte(void)
env->aregs[7] = sp + 8; env->aregs[7] = sp + 8;
} }
void do_interrupt(int is_hw) static void do_interrupt_all(int is_hw)
{ {
uint32_t sp; uint32_t sp;
uint32_t fmt; uint32_t fmt;
...@@ -155,6 +159,25 @@ void do_interrupt(int is_hw) ...@@ -155,6 +159,25 @@ void do_interrupt(int is_hw)
env->pc = ldl_kernel(env->vbr + vector); env->pc = ldl_kernel(env->vbr + vector);
} }
void do_interrupt(CPUState *env1)
{
CPUState *saved_env;
saved_env = env;
env = env1;
do_interrupt_all(0);
env = saved_env;
}
void do_interrupt_m68k_hardirq(CPUState *env1)
{
CPUState *saved_env;
saved_env = env;
env = env1;
do_interrupt_all(1);
env = saved_env;
}
#endif #endif
static void raise_exception(int tt) static void raise_exception(int tt)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册