diff options
author | Andrew Hsieh <andrewhsieh@google.com> | 2012-06-08 00:48:19 -0700 |
---|---|---|
committer | android code review <noreply-gerritcodereview@google.com> | 2012-06-08 00:48:20 -0700 |
commit | 60ead539cfabd48f7d054e315803f2ae7650609e (patch) | |
tree | 7e0851da5038a2579bc1270e6d3d1c899703ced7 /target-mips | |
parent | cf9ba9a06006592bf47ce5837188986172e1a925 (diff) | |
parent | 741dc13597ac064e6a48bb2a6ec069cbc1cd0dbb (diff) | |
download | external_qemu-60ead539cfabd48f7d054e315803f2ae7650609e.zip external_qemu-60ead539cfabd48f7d054e315803f2ae7650609e.tar.gz external_qemu-60ead539cfabd48f7d054e315803f2ae7650609e.tar.bz2 |
Merge "[MIPS] Add Goldfish target support"
Diffstat (limited to 'target-mips')
-rw-r--r-- | target-mips/cpu.h | 31 | ||||
-rw-r--r-- | target-mips/exec.h | 18 |
2 files changed, 46 insertions, 3 deletions
diff --git a/target-mips/cpu.h b/target-mips/cpu.h index 27bdc95..7c04fbe 100644 --- a/target-mips/cpu.h +++ b/target-mips/cpu.h @@ -518,6 +518,37 @@ static inline void cpu_clone_regs(CPUState *env, target_ulong newsp) env->active_tc.gpr[2] = 0; } +static inline int cpu_mips_hw_interrupts_pending(CPUState *env) +{ + int32_t pending; + int32_t status; + int r; + + if (!(env->CP0_Status & (1 << CP0St_IE)) || + (env->CP0_Status & (1 << CP0St_EXL)) || + (env->CP0_Status & (1 << CP0St_ERL)) || + (env->hflags & MIPS_HFLAG_DM)) { + /* Interrupts are disabled */ + return 0; + } + + pending = env->CP0_Cause & CP0Ca_IP_mask; + status = env->CP0_Status & CP0Ca_IP_mask; + + if (env->CP0_Config3 & (1 << CP0C3_VEIC)) { + /* A MIPS configured with a vectorizing external interrupt controller + will feed a vector into the Cause pending lines. The core treats + the status lines as a vector level, not as indiviual masks. */ + r = pending > status; + } else { + /* A MIPS configured with compatibility or VInt (Vectored Interrupts) + treats the pending lines as individual interrupt lines, the status + lines are individual masks. */ + r = pending & status; + } + return r; +} + #include "cpu-all.h" #include "exec-all.h" diff --git a/target-mips/exec.h b/target-mips/exec.h index 8a118bb..0720366 100644 --- a/target-mips/exec.h +++ b/target-mips/exec.h @@ -35,10 +35,22 @@ static inline void regs_to_env(void) static inline int cpu_has_work(CPUState *env) { - return (env->interrupt_request & - (CPU_INTERRUPT_HARD | CPU_INTERRUPT_TIMER)); -} + int has_work = 0; + + /* It is implementation dependent if non-enabled interrupts + wake-up the CPU, however most of the implementations only + check for interrupts that can be taken. */ + if ((env->interrupt_request & CPU_INTERRUPT_HARD) && + cpu_mips_hw_interrupts_pending(env)) { + has_work = 1; + } + if (env->interrupt_request & CPU_INTERRUPT_TIMER) { + has_work = 1; + } + + return has_work; +} static inline int cpu_halted(CPUState *env) { |