Merge remote-tracking branch 'qmp/for-anthony' into staging
[qemu.git] / target-unicore32 / exec.h
blob4ab55f42cfd2d6bf83dfcbf9c88467880f89245d
1 /*
2 * UniCore32 execution defines
4 * Copyright (C) 2010-2011 GUAN Xue-tao
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10 #ifndef __UC32_EXEC_H__
11 #define __UC32_EXEC_H__
13 #include "config.h"
14 #include "dyngen-exec.h"
16 register struct CPUState_UniCore32 *env asm(AREG0);
18 #include "cpu.h"
19 #include "exec-all.h"
21 static inline void env_to_regs(void)
25 static inline void regs_to_env(void)
29 static inline int cpu_has_work(CPUState *env)
31 return env->interrupt_request &
32 (CPU_INTERRUPT_HARD | CPU_INTERRUPT_EXITTB);
35 static inline int cpu_halted(CPUState *env)
37 if (!env->halted) {
38 return 0;
40 /* An interrupt wakes the CPU even if the I and R ASR bits are
41 set. We use EXITTB to silently wake CPU without causing an
42 actual interrupt. */
43 if (cpu_has_work(env)) {
44 env->halted = 0;
45 return 0;
47 return EXCP_HALTED;
50 #endif /* __UC32_EXEC_H__ */