Add PowerPC power-management state check callback.
[qemu] / target-m68k / op-hacks.h
1 /* Various hacks to make code written for a dynamic code generator work
2    with regular QEMU.  */
3
4 static int free_qreg;
5
6 #define QMODE_I32 1
7 #define QMODE_F32 1
8 #define QMODE_F64 2
9
10 static inline int gen_new_qreg(int mode)
11 {
12     int qreg;
13
14     qreg = free_qreg;
15     free_qreg += mode;
16     if (free_qreg > MAX_QREGS) {
17         fprintf(stderr, "qreg overflow\n");
18         abort();
19     }
20     return qreg + TARGET_NUM_QREGS;
21 }
22
23 static inline int gen_im32(uint32_t i)
24 {
25     int qreg = gen_new_qreg(QMODE_I32);
26     gen_op_mov32_im(qreg, i);
27     return qreg;
28 }
29
30 static inline void gen_op_ldf32_raw(int dest, int addr)
31 {
32     gen_op_ld32_raw(dest, addr);
33 }
34
35 static inline void gen_op_stf32_raw(int addr, int dest)
36 {
37     gen_op_st32_raw(addr, dest);
38 }
39
40 #if !defined(CONFIG_USER_ONLY)
41 static inline void gen_op_ldf32_user(int dest, int addr)
42 {
43     gen_op_ld32_user(dest, addr);
44 }
45
46 static inline void gen_op_stf32_user(int addr, int dest)
47 {
48     gen_op_st32_user(addr, dest);
49 }
50
51 static inline void gen_op_ldf32_kernel(int dest, int addr)
52 {
53     gen_op_ld32_kernel(dest, addr);
54 }
55
56 static inline void gen_op_stf32_kernel(int addr, int dest)
57 {
58     gen_op_st32_kernel(addr, dest);
59 }
60 #endif
61
62 static inline void gen_op_pack_32_f32(int dest, int src)
63 {
64     gen_op_mov32(dest, src);
65 }
66
67 static inline void gen_op_pack_f32_32(int dest, int src)
68 {
69     gen_op_mov32(dest, src);
70 }
71
72 static inline void gen_op_flags_set(void)
73 {
74     /* Dummy op.  */
75 }
76
77 static inline void gen_op_shl_im_cc(int val, int shift)
78 {
79     gen_op_shl_cc(val, gen_im32(shift));
80 }
81
82 static inline void gen_op_shr_im_cc(int val, int shift)
83 {
84     gen_op_shr_cc(val, gen_im32(shift));
85 }
86
87 static inline void gen_op_sar_im_cc(int val, int shift)
88 {
89     gen_op_sar_cc(val, gen_im32(shift));
90 }
91
92 #ifdef USE_DIRECT_JUMP
93 #define TBPARAM(x)
94 #else
95 #define TBPARAM(x) (long)(x)
96 #endif
97
98 static inline void gen_op_goto_tb(int dummy, int n, long tb)
99 {
100     if (n == 0) {
101         gen_op_goto_tb0(TBPARAM(tb));
102     } else {
103         gen_op_goto_tb1(TBPARAM(tb));
104     }
105 }
106
107 static inline void gen_op_jmp_z32(int val, int label)
108 {
109     gen_op_set_T0_z32(val);
110     gen_op_jmp_T0(label);
111 }
112
113 static inline void gen_op_jmp_nz32(int val, int label)
114 {
115     gen_op_set_T0_nz32(val);
116     gen_op_jmp_T0(label);
117 }
118
119 static inline void gen_op_jmp_s32(int val, int label)
120 {
121     gen_op_set_T0_s32(val);
122     gen_op_jmp_T0(label);
123 }
124
125 static inline void gen_op_jmp_ns32(int val, int label)
126 {
127     gen_op_set_T0_ns32(val);
128     gen_op_jmp_T0(label);
129 }
130