blob: e120d6fed4c867f60f8d09a3ece8831e25235fe5 [file] [log] [blame]
bellard7a3f1942003-09-30 20:36:07 +00001#ifndef EXEC_SPARC_H
2#define EXEC_SPARC_H 1
bellard34751872005-07-02 14:31:34 +00003#include "config.h"
ths8294eba2007-03-19 14:47:40 +00004#include "dyngen-exec.h"
bellard7a3f1942003-09-30 20:36:07 +00005
6register struct CPUSPARCState *env asm(AREG0);
bellard34751872005-07-02 14:31:34 +00007
bellarde8af50a2004-09-30 21:55:55 +00008#define DT0 (env->dt0)
9#define DT1 (env->dt1)
blueswir11f587322007-11-25 18:40:20 +000010#define QT0 (env->qt0)
11#define QT1 (env->qt1)
bellard7a3f1942003-09-30 20:36:07 +000012
13#include "cpu.h"
14#include "exec-all.h"
15
bellard0d1a29f2004-10-12 22:01:28 +000016static inline void env_to_regs(void)
17{
18}
19
20static inline void regs_to_env(void)
21{
22}
23
blueswir191736d32008-08-29 20:50:21 +000024/* op_helper.c */
blueswir1f2bc7e72008-05-27 17:35:30 +000025void do_interrupt(CPUState *env);
bellard9d893302005-02-07 23:10:53 +000026
Igor Kovalenko52109772009-07-12 12:35:31 +040027static inline int cpu_interrupts_enabled(CPUState *env1)
28{
29#if !defined (TARGET_SPARC64)
30 if (env1->psret != 0)
31 return 1;
32#else
33 if (env1->pstate & PS_IE)
34 return 1;
35#endif
36
37 return 0;
38}
39
aliguori6a4955a2009-04-24 18:03:20 +000040static inline int cpu_has_work(CPUState *env1)
41{
42 return (env1->interrupt_request & CPU_INTERRUPT_HARD) &&
Igor Kovalenko52109772009-07-12 12:35:31 +040043 cpu_interrupts_enabled(env1);
aliguori6a4955a2009-04-24 18:03:20 +000044}
45
46
blueswir122548762008-05-10 10:12:00 +000047static inline int cpu_halted(CPUState *env1) {
48 if (!env1->halted)
thsbfed01f2007-06-03 17:44:37 +000049 return 0;
aliguori6a4955a2009-04-24 18:03:20 +000050 if (cpu_has_work(env1)) {
blueswir122548762008-05-10 10:12:00 +000051 env1->halted = 0;
thsbfed01f2007-06-03 17:44:37 +000052 return 0;
53 }
54 return EXCP_HALTED;
55}
56
bellard7a3f1942003-09-30 20:36:07 +000057#endif