4 #if !defined(REGPARM) && defined(__i386__)
\r
5 #define REGPARM(x) __attribute__((regparm(x)))
\r
10 // registers - matches structure order
\r
12 SHR_R0 = 0, SHR_SP = 15,
\r
13 SHR_PC, SHR_PPC, SHR_PR, SHR_SR,
\r
14 SHR_GBR, SHR_VBR, SHR_MACH, SHR_MACL,
\r
19 unsigned int r[16]; // 00
\r
20 unsigned int pc; // 40
\r
24 unsigned int gbr, vbr; // 50
\r
25 unsigned int mach, macl; // 58
\r
28 const void *read8_map; // 60
\r
29 const void *read16_map;
\r
30 const void **write8_tab;
\r
31 const void **write16_tab;
\r
36 void *p_bios; // convenience pointers
\r
38 void *p_sdram; // 80
\r
40 unsigned int pdb_io_csum[2];
\r
42 // interpreter stuff
\r
43 int icount; // cycles left in current timeslice
\r
46 unsigned int test_irq;
\r
48 int pending_level; // MAX(pending_irl, pending_int_irq)
\r
50 int pending_int_irq; // internal irq
\r
51 int pending_int_vector;
\r
52 int REGPARM(2) (*irq_callback)(struct SH2_ *sh2, int level);
\r
55 unsigned int cycles_timeslice;
\r
57 // we use 68k reference cycles for easier sync
\r
58 unsigned int m68krcycles_done;
\r
59 unsigned int mult_m68k_to_sh2;
\r
60 unsigned int mult_sh2_to_m68k;
\r
63 #define CYCLE_MULT_SHIFT 10
\r
64 #define C_M68K_TO_SH2(xsh2, c) \
\r
65 ((int)((c) * (xsh2).mult_m68k_to_sh2) >> CYCLE_MULT_SHIFT)
\r
66 #define C_SH2_TO_M68K(xsh2, c) \
\r
67 ((int)((c + 3) * (xsh2).mult_sh2_to_m68k) >> CYCLE_MULT_SHIFT)
\r
69 int sh2_init(SH2 *sh2, int is_slave);
\r
70 void sh2_finish(SH2 *sh2);
\r
71 void sh2_reset(SH2 *sh2);
\r
72 int sh2_irl_irq(SH2 *sh2, int level, int nested_call);
\r
73 void sh2_internal_irq(SH2 *sh2, int level, int vector);
\r
74 void sh2_do_irq(SH2 *sh2, int level, int vector);
\r
75 void sh2_pack(const SH2 *sh2, unsigned char *buff);
\r
76 void sh2_unpack(SH2 *sh2, const unsigned char *buff);
\r
78 int sh2_execute(SH2 *sh2, int cycles);
\r
80 // regs, pending_int*, cycles, reserved
\r
81 #define SH2_STATE_SIZE ((24 + 2 + 2 + 12) * 4)
\r
84 // XXX: move somewhere else
\r
85 unsigned int REGPARM(2) p32x_sh2_read8(unsigned int a, SH2 *sh2);
\r
86 unsigned int REGPARM(2) p32x_sh2_read16(unsigned int a, SH2 *sh2);
\r
87 unsigned int REGPARM(2) p32x_sh2_read32(unsigned int a, SH2 *sh2);
\r
88 int REGPARM(3) p32x_sh2_write8 (unsigned int a, unsigned int d, SH2 *sh2);
\r
89 int REGPARM(3) p32x_sh2_write16(unsigned int a, unsigned int d, SH2 *sh2);
\r
90 int REGPARM(3) p32x_sh2_write32(unsigned int a, unsigned int d, SH2 *sh2);
\r
94 void do_sh2_trace(SH2 *current, int cycles);
\r
95 void do_sh2_cmp(SH2 *current);
\r
98 #endif /* __SH2_H__ */
\r