root / op_string.h @ cabb4d61
History | View | Annotate | Download (5.1 kB)
1 | 24f9e90b | bellard | |
---|---|---|---|
2 | 24f9e90b | bellard | void OPPROTO glue(glue(op_movs, SUFFIX), STRING_SUFFIX)(void) |
3 | 24f9e90b | bellard | { |
4 | 24f9e90b | bellard | int v, inc;
|
5 | 24f9e90b | bellard | inc = (DF << SHIFT); |
6 | 24f9e90b | bellard | v = glue(ldu, SUFFIX)(SI_ADDR); |
7 | 24f9e90b | bellard | glue(st, SUFFIX)(DI_ADDR, v); |
8 | 24f9e90b | bellard | inc = (DF << SHIFT); |
9 | 24f9e90b | bellard | INC_SI(); |
10 | 24f9e90b | bellard | INC_DI(); |
11 | 24f9e90b | bellard | } |
12 | 24f9e90b | bellard | |
13 | 24f9e90b | bellard | void OPPROTO glue(glue(op_rep_movs, SUFFIX), STRING_SUFFIX)(void) |
14 | 24f9e90b | bellard | { |
15 | 24f9e90b | bellard | int v, inc;
|
16 | 24f9e90b | bellard | inc = (DF << SHIFT); |
17 | 24f9e90b | bellard | while (CX != 0) { |
18 | 24f9e90b | bellard | v = glue(ldu, SUFFIX)(SI_ADDR); |
19 | 24f9e90b | bellard | glue(st, SUFFIX)(DI_ADDR, v); |
20 | 24f9e90b | bellard | INC_SI(); |
21 | 24f9e90b | bellard | INC_DI(); |
22 | 24f9e90b | bellard | DEC_CX(); |
23 | 24f9e90b | bellard | } |
24 | 24f9e90b | bellard | FORCE_RET(); |
25 | 24f9e90b | bellard | } |
26 | 24f9e90b | bellard | |
27 | 24f9e90b | bellard | void OPPROTO glue(glue(op_stos, SUFFIX), STRING_SUFFIX)(void) |
28 | 24f9e90b | bellard | { |
29 | 24f9e90b | bellard | int inc;
|
30 | 24f9e90b | bellard | glue(st, SUFFIX)(DI_ADDR, EAX); |
31 | 24f9e90b | bellard | inc = (DF << SHIFT); |
32 | 24f9e90b | bellard | INC_DI(); |
33 | 24f9e90b | bellard | } |
34 | 24f9e90b | bellard | |
35 | 24f9e90b | bellard | void OPPROTO glue(glue(op_rep_stos, SUFFIX), STRING_SUFFIX)(void) |
36 | 24f9e90b | bellard | { |
37 | 24f9e90b | bellard | int inc;
|
38 | 24f9e90b | bellard | inc = (DF << SHIFT); |
39 | 24f9e90b | bellard | while (CX != 0) { |
40 | 24f9e90b | bellard | glue(st, SUFFIX)(DI_ADDR, EAX); |
41 | 24f9e90b | bellard | INC_DI(); |
42 | 24f9e90b | bellard | DEC_CX(); |
43 | 24f9e90b | bellard | } |
44 | 24f9e90b | bellard | FORCE_RET(); |
45 | 24f9e90b | bellard | } |
46 | 24f9e90b | bellard | |
47 | 24f9e90b | bellard | void OPPROTO glue(glue(op_lods, SUFFIX), STRING_SUFFIX)(void) |
48 | 24f9e90b | bellard | { |
49 | 24f9e90b | bellard | int v, inc;
|
50 | 24f9e90b | bellard | v = glue(ldu, SUFFIX)(SI_ADDR); |
51 | 24f9e90b | bellard | #if SHIFT == 0 |
52 | 24f9e90b | bellard | EAX = (EAX & ~0xff) | v;
|
53 | 24f9e90b | bellard | #elif SHIFT == 1 |
54 | 24f9e90b | bellard | EAX = (EAX & ~0xffff) | v;
|
55 | 24f9e90b | bellard | #else
|
56 | 24f9e90b | bellard | EAX = v; |
57 | 24f9e90b | bellard | #endif
|
58 | 24f9e90b | bellard | inc = (DF << SHIFT); |
59 | 24f9e90b | bellard | INC_SI(); |
60 | 24f9e90b | bellard | } |
61 | 24f9e90b | bellard | |
62 | 24f9e90b | bellard | /* don't know if it is used */
|
63 | 24f9e90b | bellard | void OPPROTO glue(glue(op_rep_lods, SUFFIX), STRING_SUFFIX)(void) |
64 | 24f9e90b | bellard | { |
65 | 24f9e90b | bellard | int v, inc;
|
66 | 24f9e90b | bellard | inc = (DF << SHIFT); |
67 | 24f9e90b | bellard | while (CX != 0) { |
68 | 24f9e90b | bellard | v = glue(ldu, SUFFIX)(SI_ADDR); |
69 | 24f9e90b | bellard | #if SHIFT == 0 |
70 | 24f9e90b | bellard | EAX = (EAX & ~0xff) | v;
|
71 | 24f9e90b | bellard | #elif SHIFT == 1 |
72 | 24f9e90b | bellard | EAX = (EAX & ~0xffff) | v;
|
73 | 24f9e90b | bellard | #else
|
74 | 24f9e90b | bellard | EAX = v; |
75 | 24f9e90b | bellard | #endif
|
76 | 24f9e90b | bellard | INC_SI(); |
77 | 24f9e90b | bellard | DEC_CX(); |
78 | 24f9e90b | bellard | } |
79 | 24f9e90b | bellard | FORCE_RET(); |
80 | 24f9e90b | bellard | } |
81 | 24f9e90b | bellard | |
82 | 24f9e90b | bellard | void OPPROTO glue(glue(op_scas, SUFFIX), STRING_SUFFIX)(void) |
83 | 24f9e90b | bellard | { |
84 | 24f9e90b | bellard | int v, inc;
|
85 | 24f9e90b | bellard | |
86 | 24f9e90b | bellard | v = glue(ldu, SUFFIX)(DI_ADDR); |
87 | 24f9e90b | bellard | inc = (DF << SHIFT); |
88 | 24f9e90b | bellard | INC_DI(); |
89 | 24f9e90b | bellard | CC_SRC = EAX; |
90 | 24f9e90b | bellard | CC_DST = EAX - v; |
91 | 24f9e90b | bellard | } |
92 | 24f9e90b | bellard | |
93 | 24f9e90b | bellard | void OPPROTO glue(glue(op_repz_scas, SUFFIX), STRING_SUFFIX)(void) |
94 | 24f9e90b | bellard | { |
95 | 24f9e90b | bellard | int v1, v2, inc;
|
96 | 24f9e90b | bellard | |
97 | 24f9e90b | bellard | if (CX != 0) { |
98 | 24f9e90b | bellard | /* NOTE: the flags are not modified if CX == 0 */
|
99 | 24f9e90b | bellard | v1 = EAX & DATA_MASK; |
100 | 24f9e90b | bellard | inc = (DF << SHIFT); |
101 | 24f9e90b | bellard | do {
|
102 | 24f9e90b | bellard | v2 = glue(ldu, SUFFIX)(DI_ADDR); |
103 | 24f9e90b | bellard | INC_DI(); |
104 | 24f9e90b | bellard | DEC_CX(); |
105 | 24f9e90b | bellard | if (v1 != v2)
|
106 | 24f9e90b | bellard | break;
|
107 | 24f9e90b | bellard | } while (CX != 0); |
108 | 24f9e90b | bellard | CC_SRC = v1; |
109 | 24f9e90b | bellard | CC_DST = v1 - v2; |
110 | 24f9e90b | bellard | CC_OP = CC_OP_SUBB + SHIFT; |
111 | 24f9e90b | bellard | } |
112 | 24f9e90b | bellard | FORCE_RET(); |
113 | 24f9e90b | bellard | } |
114 | 24f9e90b | bellard | |
115 | 24f9e90b | bellard | void OPPROTO glue(glue(op_repnz_scas, SUFFIX), STRING_SUFFIX)(void) |
116 | 24f9e90b | bellard | { |
117 | 24f9e90b | bellard | int v1, v2, inc;
|
118 | 24f9e90b | bellard | |
119 | 24f9e90b | bellard | if (CX != 0) { |
120 | 24f9e90b | bellard | /* NOTE: the flags are not modified if CX == 0 */
|
121 | 24f9e90b | bellard | v1 = EAX & DATA_MASK; |
122 | 24f9e90b | bellard | inc = (DF << SHIFT); |
123 | 24f9e90b | bellard | do {
|
124 | 24f9e90b | bellard | v2 = glue(ldu, SUFFIX)(DI_ADDR); |
125 | 24f9e90b | bellard | INC_DI(); |
126 | 24f9e90b | bellard | DEC_CX(); |
127 | 24f9e90b | bellard | if (v1 == v2)
|
128 | 24f9e90b | bellard | break;
|
129 | 24f9e90b | bellard | } while (CX != 0); |
130 | 24f9e90b | bellard | CC_SRC = v1; |
131 | 24f9e90b | bellard | CC_DST = v1 - v2; |
132 | 24f9e90b | bellard | CC_OP = CC_OP_SUBB + SHIFT; |
133 | 24f9e90b | bellard | } |
134 | 24f9e90b | bellard | FORCE_RET(); |
135 | 24f9e90b | bellard | } |
136 | 24f9e90b | bellard | |
137 | 24f9e90b | bellard | void OPPROTO glue(glue(op_cmps, SUFFIX), STRING_SUFFIX)(void) |
138 | 24f9e90b | bellard | { |
139 | 24f9e90b | bellard | int v1, v2, inc;
|
140 | 24f9e90b | bellard | v1 = glue(ldu, SUFFIX)(SI_ADDR); |
141 | 24f9e90b | bellard | v2 = glue(ldu, SUFFIX)(DI_ADDR); |
142 | 24f9e90b | bellard | inc = (DF << SHIFT); |
143 | 24f9e90b | bellard | INC_SI(); |
144 | 24f9e90b | bellard | INC_DI(); |
145 | 24f9e90b | bellard | CC_SRC = v1; |
146 | 24f9e90b | bellard | CC_DST = v1 - v2; |
147 | 24f9e90b | bellard | } |
148 | 24f9e90b | bellard | |
149 | 24f9e90b | bellard | void OPPROTO glue(glue(op_repz_cmps, SUFFIX), STRING_SUFFIX)(void) |
150 | 24f9e90b | bellard | { |
151 | 24f9e90b | bellard | int v1, v2, inc;
|
152 | 24f9e90b | bellard | if (CX != 0) { |
153 | 24f9e90b | bellard | inc = (DF << SHIFT); |
154 | 24f9e90b | bellard | do {
|
155 | 24f9e90b | bellard | v1 = glue(ldu, SUFFIX)(SI_ADDR); |
156 | 24f9e90b | bellard | v2 = glue(ldu, SUFFIX)(DI_ADDR); |
157 | 24f9e90b | bellard | INC_SI(); |
158 | 24f9e90b | bellard | INC_DI(); |
159 | 24f9e90b | bellard | DEC_CX(); |
160 | 24f9e90b | bellard | if (v1 != v2)
|
161 | 24f9e90b | bellard | break;
|
162 | 24f9e90b | bellard | } while (CX != 0); |
163 | 24f9e90b | bellard | CC_SRC = v1; |
164 | 24f9e90b | bellard | CC_DST = v1 - v2; |
165 | 24f9e90b | bellard | CC_OP = CC_OP_SUBB + SHIFT; |
166 | 24f9e90b | bellard | } |
167 | 24f9e90b | bellard | FORCE_RET(); |
168 | 24f9e90b | bellard | } |
169 | 24f9e90b | bellard | |
170 | 24f9e90b | bellard | void OPPROTO glue(glue(op_repnz_cmps, SUFFIX), STRING_SUFFIX)(void) |
171 | 24f9e90b | bellard | { |
172 | 24f9e90b | bellard | int v1, v2, inc;
|
173 | 24f9e90b | bellard | if (CX != 0) { |
174 | 24f9e90b | bellard | inc = (DF << SHIFT); |
175 | 24f9e90b | bellard | do {
|
176 | 24f9e90b | bellard | v1 = glue(ldu, SUFFIX)(SI_ADDR); |
177 | 24f9e90b | bellard | v2 = glue(ldu, SUFFIX)(DI_ADDR); |
178 | 24f9e90b | bellard | INC_SI(); |
179 | 24f9e90b | bellard | INC_DI(); |
180 | 24f9e90b | bellard | DEC_CX(); |
181 | 24f9e90b | bellard | if (v1 == v2)
|
182 | 24f9e90b | bellard | break;
|
183 | 24f9e90b | bellard | } while (CX != 0); |
184 | 24f9e90b | bellard | CC_SRC = v1; |
185 | 24f9e90b | bellard | CC_DST = v1 - v2; |
186 | 24f9e90b | bellard | CC_OP = CC_OP_SUBB + SHIFT; |
187 | 24f9e90b | bellard | } |
188 | 24f9e90b | bellard | FORCE_RET(); |
189 | 24f9e90b | bellard | } |
190 | 24f9e90b | bellard | |
191 | 24f9e90b | bellard | void OPPROTO glue(glue(op_outs, SUFFIX), STRING_SUFFIX)(void) |
192 | 24f9e90b | bellard | { |
193 | 24f9e90b | bellard | int v, dx, inc;
|
194 | 24f9e90b | bellard | dx = EDX & 0xffff;
|
195 | 24f9e90b | bellard | v = glue(ldu, SUFFIX)(SI_ADDR); |
196 | bf7c65bd | bellard | glue(cpu_x86_out, SUFFIX)(env, dx, v); |
197 | 24f9e90b | bellard | inc = (DF << SHIFT); |
198 | 24f9e90b | bellard | INC_SI(); |
199 | 24f9e90b | bellard | } |
200 | 24f9e90b | bellard | |
201 | 24f9e90b | bellard | void OPPROTO glue(glue(op_rep_outs, SUFFIX), STRING_SUFFIX)(void) |
202 | 24f9e90b | bellard | { |
203 | 24f9e90b | bellard | int v, dx, inc;
|
204 | 24f9e90b | bellard | inc = (DF << SHIFT); |
205 | 24f9e90b | bellard | dx = EDX & 0xffff;
|
206 | 24f9e90b | bellard | while (CX != 0) { |
207 | 24f9e90b | bellard | v = glue(ldu, SUFFIX)(SI_ADDR); |
208 | bf7c65bd | bellard | glue(cpu_x86_out, SUFFIX)(env, dx, v); |
209 | 24f9e90b | bellard | INC_SI(); |
210 | 24f9e90b | bellard | DEC_CX(); |
211 | 24f9e90b | bellard | } |
212 | 24f9e90b | bellard | FORCE_RET(); |
213 | 24f9e90b | bellard | } |
214 | 24f9e90b | bellard | |
215 | 24f9e90b | bellard | void OPPROTO glue(glue(op_ins, SUFFIX), STRING_SUFFIX)(void) |
216 | 24f9e90b | bellard | { |
217 | 24f9e90b | bellard | int v, dx, inc;
|
218 | 24f9e90b | bellard | dx = EDX & 0xffff;
|
219 | bf7c65bd | bellard | v = glue(cpu_x86_in, SUFFIX)(env, dx); |
220 | 24f9e90b | bellard | glue(st, SUFFIX)(DI_ADDR, v); |
221 | 24f9e90b | bellard | inc = (DF << SHIFT); |
222 | 24f9e90b | bellard | INC_DI(); |
223 | 24f9e90b | bellard | } |
224 | 24f9e90b | bellard | |
225 | 24f9e90b | bellard | void OPPROTO glue(glue(op_rep_ins, SUFFIX), STRING_SUFFIX)(void) |
226 | 24f9e90b | bellard | { |
227 | 24f9e90b | bellard | int v, dx, inc;
|
228 | 24f9e90b | bellard | inc = (DF << SHIFT); |
229 | 24f9e90b | bellard | dx = EDX & 0xffff;
|
230 | 24f9e90b | bellard | while (CX != 0) { |
231 | bf7c65bd | bellard | v = glue(cpu_x86_in, SUFFIX)(env, dx); |
232 | 24f9e90b | bellard | glue(st, SUFFIX)(DI_ADDR, v); |
233 | 24f9e90b | bellard | INC_DI(); |
234 | 24f9e90b | bellard | DEC_CX(); |
235 | 24f9e90b | bellard | } |
236 | 24f9e90b | bellard | FORCE_RET(); |
237 | 24f9e90b | bellard | } |
238 | 24f9e90b | bellard | |
239 | 24f9e90b | bellard | #undef STRING_SUFFIX
|
240 | 24f9e90b | bellard | #undef SI_ADDR
|
241 | 24f9e90b | bellard | #undef DI_ADDR
|
242 | 24f9e90b | bellard | #undef INC_SI
|
243 | 24f9e90b | bellard | #undef INC_DI
|
244 | 24f9e90b | bellard | #undef CX
|
245 | 24f9e90b | bellard | #undef DEC_CX |