昨天为机器码编译程序写了个专用的unit test框架,今天用中间语言在这个框架上写了个程序。程序将12个字符串连接起来,然后跟另外一个字符串进行比较,如果相等返回true。当然程序如果返回false了,要么就是程序有问题,要么就是编译器有问题。当然现在是测试通过了。程序如下:
1 CONSTANT
2 STR1 stra:a
3 STR2 stra:bc
4 STR3 stra:def
5 STR4 stra:ghij
6 STR5 stra:klmno
7 STR6 stra:pqrstu
8 STR7 stra:vwxyzAB
9 STR8 stra:CDEFGHIJ
10 STR9 stra:KLMNOPQRS
11 STR10 stra:TUVWXYZabc
12 STR11 stra:defghijklmn
13 STR12 stra:opqrstuvwxyz
14 STRX stra:abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
15
16 CODE
17
18 SIGNATURE 12 GetStr12_Signature STDCALL
19 END SIGNATURE
20
21 FUNCTION 4 Return STDCALL
22 BEGIN
23 BLOCK
24 VAR 12 TempResult
25 VAR 78 Buffer
26 VAR 4 Address
27 VAR 4 Dest
28 VAR 4 Source
29 VAR 4 Count
30 VAR 4 GetStr12Address
31 BEGIN
32 LDP ptr GetStr12Address, func GetStr12
33
34 LDA ptr Address, bytes[78] Buffer
35 CALLF bytes[1] PTR Address, func GetStr1
36 ADD int32s Address, int32s Address, int32s 1
37 CALLF bytes[2] PTR Address, func GetStr2
38 ADD int32s Address, int32s Address, int32s 2
39 CALLF bytes[3] PTR Address, func GetStr3
40 ADD int32s Address, int32s Address, int32s 3
41 CALLF bytes[4] PTR Address, func GetStr4
42 ADD int32s Address, int32s Address, int32s 4
43 CALLF bytes[5] PTR Address, func GetStr5
44 ADD int32s Address, int32s Address, int32s 5
45 CALLF bytes[6] PTR Address, func GetStr6
46 ADD int32s Address, int32s Address, int32s 6
47 CALLF bytes[7] PTR Address, func GetStr7
48 ADD int32s Address, int32s Address, int32s 7
49 CALLF bytes[8] PTR Address, func GetStr8
50 ADD int32s Address, int32s Address, int32s 8
51 CALLF bytes[9] PTR Address, func GetStr9
52 ADD int32s Address, int32s Address, int32s 9
53 CALLF bytes[10] PTR Address, func GetStr10
54 ADD int32s Address, int32s Address, int32s 10
55 CALLF bytes[11] PTR Address, func GetStr11
56 ADD int32s Address, int32s Address, int32s 11
57 CALLFI bytes[12] PTR Address, sign GetStr12_Signature, ptr GetStr12Address
58 ADD int32s Address, int32s Address, int32s 12
59
60 CALLP func GetStr12
61 CALLP func WeekFunction
62 CALLPI sign GetStr12_Signature, ptr GetStr12Address
63
64 LDA ptr Dest, bytes[78] Buffer
65 LDA ptr Source, bytes[78] STRX
66 MOV int32s Count, int32s 78
67 BLOCK @LOOP
68 VAR 1 IsEqual
69 BEGIN
70 EQU int8u IsEqual, int32s Count, int32s 0
71 JET int8u IsEqual, @LOOP
72 EQU int8u IsEqual, int8u PTR Dest, int8u PTR Source
73 JEF int8u IsEqual, @LOOP
74
75 SUB int32s Count, int32s Count, int32s 1
76 ADD int32s Dest, int32s Dest, int32s 1
77 ADD int32s Source, int32s Source, int32s 1
78 JB @LOOP
79 END BLOCK
80
81 MOV int32s #RETURN_VALUE, int32s Count
82 END BLOCK
83 END FUNCTION
84
85 FUNCTION 4 WeekFunction RETURN_FLOAT STDCALL
86 BEGIN
87 MOV fp32 #RETURN_VALUE, int32s 0
88 END FUNCTION
89
90 FUNCTION 1 GetStr1 STDCALL
91 BEGIN
92 COPY bytes[1] #RETURN_VALUE, bytes[1] STR1, int32s 1
93 END FUNCTION
94
95 FUNCTION 2 GetStr2 STDCALL
96 BEGIN
97 COPY bytes[2] #RETURN_VALUE, bytes[2] STR2, int32s 2
98 END FUNCTION
99
100 FUNCTION 3 GetStr3 STDCALL
101 BEGIN
102 COPY bytes[3] #RETURN_VALUE, bytes[3] STR3, int32s 3
103 END FUNCTION
104
105 FUNCTION 4 GetStr4 STDCALL
106 BEGIN
107 COPY bytes[4] #RETURN_VALUE, bytes[4] STR4, int32s 4
108 END FUNCTION
109
110 FUNCTION 5 GetStr5 STDCALL
111 BEGIN
112 COPY bytes[5] #RETURN_VALUE, bytes[5] STR5, int32s 5
113 END FUNCTION
114
115 FUNCTION 6 GetStr6 STDCALL
116 BEGIN
117 COPY bytes[6] #RETURN_VALUE, bytes[6] STR6, int32s 6
118 END FUNCTION
119
120 FUNCTION 7 GetStr7 STDCALL
121 BEGIN
122 COPY bytes[7] #RETURN_VALUE, bytes[7] STR7, int32s 7
123 END FUNCTION
124
125 FUNCTION 8 GetStr8 STDCALL
126 BEGIN
127 COPY bytes[8] #RETURN_VALUE, bytes[8] STR8, int32s 8
128 END FUNCTION
129
130 FUNCTION 9 GetStr9 STDCALL
131 BEGIN
132 COPY bytes[9] #RETURN_VALUE, bytes[9] STR9, int32s 9
133 END FUNCTION
134
135 FUNCTION 10 GetStr10 STDCALL
136 BEGIN
137 COPY bytes[10] #RETURN_VALUE, bytes[10] STR10, int32s 10
138 END FUNCTION
139
140 FUNCTION 11 GetStr11 STDCALL
141 BEGIN
142 COPY bytes[11] #RETURN_VALUE, bytes[11] STR11, int32s 11
143 END FUNCTION
144
145 FUNCTION 12 GetStr12 STDCALL
146 BEGIN
147 COPY bytes[12] #RETURN_VALUE, bytes[12] STR12, int32s 12
148 END FUNCTION
这个程序测试了非浮点(浮点测试在另外的程序里面)的各种函数返回值的正确性,以及函数指针的正确性。编译器产生了如下机器码:
1 022C0000 FF F5 push ebp
2 022C0002 89 E5 mov ebp,esp
3 022C0004 81 EC 80 00 00 00 sub esp,80h
4 022C000A 60 pushad
5 022C000B B8 2C 05 2C 02 mov eax,22C052Ch
6 022C0010 89 85 F4 FF FF FF mov dword ptr [ebp+FFFFFFF4h],eax
7 022C0016 8D 85 94 FF FF FF lea eax,[ebp+FFFFFF94h]
8 022C001C 89 85 E4 FF FF FF mov dword ptr [ebp+FFFFFFE4h],eax
9 022C0022 E8 0B 03 00 00 call 022C0332
10 022C0027 8B 8D E4 FF FF FF mov ecx,dword ptr [ebp+FFFFFFE4h]
11 022C002D 88 01 mov byte ptr [ecx],al
12 022C002F B8 01 00 00 00 mov eax,1
13 022C0034 89 C2 mov edx,eax
14 022C0036 8B 85 E4 FF FF FF mov eax,dword ptr [ebp+FFFFFFE4h]
15 022C003C 01 D0 add eax,edx
16 022C003E 89 85 E4 FF FF FF mov dword ptr [ebp+FFFFFFE4h],eax
17 022C0044 E8 17 03 00 00 call 022C0360
18 022C0049 8B 8D E4 FF FF FF mov ecx,dword ptr [ebp+FFFFFFE4h]
19 022C004F 66 89 01 mov word ptr [ecx],ax
20 022C0052 B8 02 00 00 00 mov eax,2
21 022C0057 89 C2 mov edx,eax
22 022C0059 8B 85 E4 FF FF FF mov eax,dword ptr [ebp+FFFFFFE4h]
23 022C005F 01 D0 add eax,edx
24 022C0061 89 85 E4 FF FF FF mov dword ptr [ebp+FFFFFFE4h],eax
25 022C0067 E8 22 03 00 00 call 022C038E
26 022C006C 8B 8D E4 FF FF FF mov ecx,dword ptr [ebp+FFFFFFE4h]
27 022C0072 66 89 01 mov word ptr [ecx],ax
28 022C0075 C1 E8 10 shr eax,10h
29 022C0078 88 81 02 00 00 00 mov byte ptr [ecx+00000002h],al
30 022C007E B8 03 00 00 00 mov eax,3
31 022C0083 89 C2 mov edx,eax
32 022C0085 8B 85 E4 FF FF FF mov eax,dword ptr [ebp+FFFFFFE4h]
33 022C008B 01 D0 add eax,edx
34 022C008D 89 85 E4 FF FF FF mov dword ptr [ebp+FFFFFFE4h],eax
35 022C0093 E8 24 03 00 00 call 022C03BC
36 022C0098 8B 8D E4 FF FF FF mov ecx,dword ptr [ebp+FFFFFFE4h]
37 022C009E 89 01 mov dword ptr [ecx],eax
38 022C00A0 B8 04 00 00 00 mov eax,4
39 022C00A5 89 C2 mov edx,eax
40 022C00A7 8B 85 E4 FF FF FF mov eax,dword ptr [ebp+FFFFFFE4h]
41 022C00AD 01 D0 add eax,edx
42 022C00AF 89 85 E4 FF FF FF mov dword ptr [ebp+FFFFFFE4h],eax
43 022C00B5 E8 30 03 00 00 call 022C03EA
44 022C00BA 8B 8D E4 FF FF FF mov ecx,dword ptr [ebp+FFFFFFE4h]
45 022C00C0 89 01 mov dword ptr [ecx],eax
46 022C00C2 88 91 04 00 00 00 mov byte ptr [ecx+00000004h],dl
47 022C00C8 B8 05 00 00 00 mov eax,5
48 022C00CD 89 C2 mov edx,eax
49 022C00CF 8B 85 E4 FF FF FF mov eax,dword ptr [ebp+FFFFFFE4h]
50 022C00D5 01 D0 add eax,edx
51 022C00D7 89 85 E4 FF FF FF mov dword ptr [ebp+FFFFFFE4h],eax
52 022C00DD E8 3C 03 00 00 call 022C041E
53 022C00E2 8B 8D E4 FF FF FF mov ecx,dword ptr [ebp+FFFFFFE4h]
54 022C00E8 89 01 mov dword ptr [ecx],eax
55 022C00EA 66 89 91 04 00 00 00 mov word ptr [ecx+00000004h],dx
56 022C00F1 B8 06 00 00 00 mov eax,6
57 022C00F6 89 C2 mov edx,eax
58 022C00F8 8B 85 E4 FF FF FF mov eax,dword ptr [ebp+FFFFFFE4h]
59 022C00FE 01 D0 add eax,edx
60 022C0100 89 85 E4 FF FF FF mov dword ptr [ebp+FFFFFFE4h],eax
61 022C0106 E8 47 03 00 00 call 022C0452
62 022C010B 8B 8D E4 FF FF FF mov ecx,dword ptr [ebp+FFFFFFE4h]
63 022C0111 89 01 mov dword ptr [ecx],eax
64 022C0113 66 89 91 04 00 00 00 mov word ptr [ecx+00000004h],dx
65 022C011A C1 EA 10 shr edx,10h
66 022C011D 88 91 06 00 00 00 mov byte ptr [ecx+00000006h],dl
67 022C0123 B8 07 00 00 00 mov eax,7
68 022C0128 89 C2 mov edx,eax
69 022C012A 8B 85 E4 FF FF FF mov eax,dword ptr [ebp+FFFFFFE4h]
70 022C0130 01 D0 add eax,edx
71 022C0132 89 85 E4 FF FF FF mov dword ptr [ebp+FFFFFFE4h],eax
72 022C0138 E8 49 03 00 00 call 022C0486
73 022C013D 8B 8D E4 FF FF FF mov ecx,dword ptr [ebp+FFFFFFE4h]
74 022C0143 89 01 mov dword ptr [ecx],eax
75 022C0145 89 91 04 00 00 00 mov dword ptr [ecx+00000004h],edx
76 022C014B B8 08 00 00 00 mov eax,8
77 022C0150 89 C2 mov edx,eax
78 022C0152 8B 85 E4 FF FF FF mov eax,dword ptr [ebp+FFFFFFE4h]
79 022C0158 01 D0 add eax,edx
80 022C015A 89 85 E4 FF FF FF mov dword ptr [ebp+FFFFFFE4h],eax
81 022C0160 8B 85 E4 FF FF FF mov eax,dword ptr [ebp+FFFFFFE4h]
82 022C0166 E8 4F 03 00 00 call 022C04BA
83 022C016B B8 09 00 00 00 mov eax,9
84 022C0170 89 C2 mov edx,eax
85 022C0172 8B 85 E4 FF FF FF mov eax,dword ptr [ebp+FFFFFFE4h]
86 022C0178 01 D0 add eax,edx
87 022C017A 89 85 E4 FF FF FF mov dword ptr [ebp+FFFFFFE4h],eax
88 022C0180 8B 85 E4 FF FF FF mov eax,dword ptr [ebp+FFFFFFE4h]
89 022C0186 E8 55 03 00 00 call 022C04E0
90 022C018B B8 0A 00 00 00 mov eax,0Ah
91 022C0190 89 C2 mov edx,eax
92 022C0192 8B 85 E4 FF FF FF mov eax,dword ptr [ebp+FFFFFFE4h]
93 022C0198 01 D0 add eax,edx
94 022C019A 89 85 E4 FF FF FF mov dword ptr [ebp+FFFFFFE4h],eax
95 022C01A0 8B 85 E4 FF FF FF mov eax,dword ptr [ebp+FFFFFFE4h]
96 022C01A6 E8 5B 03 00 00 call 022C0506
97 022C01AB B8 0B 00 00 00 mov eax,0Bh
98 022C01B0 89 C2 mov edx,eax
99 022C01B2 8B 85 E4 FF FF FF mov eax,dword ptr [ebp+FFFFFFE4h]
100 022C01B8 01 D0 add eax,edx
101 022C01BA 89 85 E4 FF FF FF mov dword ptr [ebp+FFFFFFE4h],eax
102 022C01C0 8B 85 F4 FF FF FF mov eax,dword ptr [ebp+FFFFFFF4h]
103 022C01C6 89 C1 mov ecx,eax
104 022C01C8 8B 85 E4 FF FF FF mov eax,dword ptr [ebp+FFFFFFE4h]
105 022C01CE FF D1 call ecx
106 022C01D0 B8 0C 00 00 00 mov eax,0Ch
107 022C01D5 89 C2 mov edx,eax
108 022C01D7 8B 85 E4 FF FF FF mov eax,dword ptr [ebp+FFFFFFE4h]
109 022C01DD 01 D0 add eax,edx
110 022C01DF 89 85 E4 FF FF FF mov dword ptr [ebp+FFFFFFE4h],eax
111 022C01E5 81 EC 0C 00 00 00 sub esp,0Ch
112 022C01EB 89 E2 mov edx,esp
113 022C01ED 89 D0 mov eax,edx
114 022C01EF E8 38 03 00 00 call 022C052C
115 022C01F4 81 C4 0C 00 00 00 add esp,0Ch
116 022C01FA E8 0E 01 00 00 call 022C030D
117 022C01FF D9 F7 fincstp
118 022C0201 81 EC 0C 00 00 00 sub esp,0Ch
119 022C0207 89 E2 mov edx,esp
120 022C0209 8B 85 F4 FF FF FF mov eax,dword ptr [ebp+FFFFFFF4h]
121 022C020F 89 C1 mov ecx,eax
122 022C0211 89 D0 mov eax,edx
123 022C0213 FF D1 call ecx
124 022C0215 81 C4 0C 00 00 00 add esp,0Ch
125 022C021B 8D 85 94 FF FF FF lea eax,[ebp+FFFFFF94h]
126 022C0221 89 85 E8 FF FF FF mov dword ptr [ebp+FFFFFFE8h],eax
127 022C0227 8D 05 5A 00 2A 02 lea eax,ds:[022A005Ah]
128 022C022D 89 85 EC FF FF FF mov dword ptr [ebp+FFFFFFECh],eax
129 022C0233 B8 4E 00 00 00 mov eax,4Eh
130 022C0238 89 85 F0 FF FF FF mov dword ptr [ebp+FFFFFFF0h],eax
131 022C023E B8 00 00 00 00 mov eax,0
132 022C0243 89 C2 mov edx,eax
133 022C0245 8B 85 F0 FF FF FF mov eax,dword ptr [ebp+FFFFFFF0h]
134 022C024B 31 FF xor edi,edi
135 022C024D B9 01 00 00 00 mov ecx,1
136 022C0252 39 D0 cmp eax,edx
137 022C0254 0F 44 F9 cmove edi,ecx
138 022C0257 89 F8 mov eax,edi
139 022C0259 88 85 F8 FF FF FF mov byte ptr [ebp+FFFFFFF8h],al
140 022C025F 31 C0 xor eax,eax
141 022C0261 8A 85 F8 FF FF FF mov al,byte ptr [ebp+FFFFFFF8h]
142 022C0267 A9 FF FF FF FF test eax,0FFFFFFFFh
143 022C026C 0F 85 81 00 00 00 jne 022C02F3
144 022C0272 8B 8D EC FF FF FF mov ecx,dword ptr [ebp+FFFFFFECh]
145 022C0278 31 C0 xor eax,eax
146 022C027A 8A 01 mov al,byte ptr [ecx]
147 022C027C 89 C2 mov edx,eax
148 022C027E 8B 8D E8 FF FF FF mov ecx,dword ptr [ebp+FFFFFFE8h]
149 022C0284 31 C0 xor eax,eax
150 022C0286 8A 01 mov al,byte ptr [ecx]
151 022C0288 31 FF xor edi,edi
152 022C028A B9 01 00 00 00 mov ecx,1
153 022C028F 39 D0 cmp eax,edx
154 022C0291 0F 44 F9 cmove edi,ecx
155 022C0294 89 F8 mov eax,edi
156 022C0296 88 85 F8 FF FF FF mov byte ptr [ebp+FFFFFFF8h],al
157 022C029C 31 C0 xor eax,eax
158 022C029E 8A 85 F8 FF FF FF mov al,byte ptr [ebp+FFFFFFF8h]
159 022C02A4 A9 FF FF FF FF test eax,0FFFFFFFFh
160 022C02A9 0F 84 44 00 00 00 je 022C02F3
161 022C02AF B8 01 00 00 00 mov eax,1
162 022C02B4 89 C2 mov edx,eax
163 022C02B6 8B 85 F0 FF FF FF mov eax,dword ptr [ebp+FFFFFFF0h]
164 022C02BC 29 D0 sub eax,edx
165 022C02BE 89 85 F0 FF FF FF mov dword ptr [ebp+FFFFFFF0h],eax
166 022C02C4 B8 01 00 00 00 mov eax,1
167 022C02C9 89 C2 mov edx,eax
168 022C02CB 8B 85 E8 FF FF FF mov eax,dword ptr [ebp+FFFFFFE8h]
169 022C02D1 01 D0 add eax,edx
170 022C02D3 89 85 E8 FF FF FF mov dword ptr [ebp+FFFFFFE8h],eax
171 022C02D9 B8 01 00 00 00 mov eax,1
172 022C02DE 89 C2 mov edx,eax
173 022C02E0 8B 85 EC FF FF FF mov eax,dword ptr [ebp+FFFFFFECh]
174 022C02E6 01 D0 add eax,edx
175 022C02E8 89 85 EC FF FF FF mov dword ptr [ebp+FFFFFFECh],eax
176 022C02EE E9 4B FF FF FF jmp 022C023E
177 022C02F3 8B 85 F0 FF FF FF mov eax,dword ptr [ebp+FFFFFFF0h]
178 022C02F9 89 85 FC FF FF FF mov dword ptr [ebp+FFFFFFFCh],eax
179 022C02FF 61 popad
180 022C0300 8B 85 FC FF FF FF mov eax,dword ptr [ebp+FFFFFFFCh]
181 022C0306 89 EC mov esp,ebp
182 022C0308 8F C5 pop ebp
183 022C030A C2 00 00 ret 0
184 022C030D FF F5 push ebp
185 022C030F 89 E5 mov ebp,esp
186 022C0311 81 EC 0C 00 00 00 sub esp,0Ch
187 022C0317 60 pushad
188 022C0318 DD 05 A9 00 2A 02 fld qword ptr ds:[022A00A9h]
189 022C031E D9 9D FC FF FF FF fstp dword ptr [ebp+FFFFFFFCh]
190 022C0324 61 popad
191 022C0325 D9 85 FC FF FF FF fld dword ptr [ebp+FFFFFFFCh]
192 022C032B 89 EC mov esp,ebp
193 022C032D 8F C5 pop ebp
194 022C032F C2 00 00 ret 0
195 022C0332 FF F5 push ebp
196 022C0334 89 E5 mov ebp,esp
197 022C0336 81 EC 0C 00 00 00 sub esp,0Ch
198 022C033C 60 pushad
199 022C033D 8D BD FC FF FF FF lea edi,[ebp+FFFFFFFCh]
200 022C0343 8D 35 00 00 2A 02 lea esi,ds:[022A0000h]
201 022C0349 B8 01 00 00 00 mov eax,1
202 022C034E 89 C1 mov ecx,eax
203 022C0350 F3 A4 rep movs byte ptr es:[edi],byte ptr [esi]
204 022C0352 61 popad
205 022C0353 8B 85 FC FF FF FF mov eax,dword ptr [ebp+FFFFFFFCh]
206 022C0359 89 EC mov esp,ebp
207 022C035B 8F C5 pop ebp
208 022C035D C2 00 00 ret 0
209 022C0360 FF F5 push ebp
210 022C0362 89 E5 mov ebp,esp
211 022C0364 81 EC 0C 00 00 00 sub esp,0Ch
212 022C036A 60 pushad
213 022C036B 8D BD FC FF FF FF lea edi,[ebp+FFFFFFFCh]
214 022C0371 8D 35 02 00 2A 02 lea esi,ds:[022A0002h]
215 022C0377 B8 02 00 00 00 mov eax,2
216 022C037C 89 C1 mov ecx,eax
217 022C037E F3 A4 rep movs byte ptr es:[edi],byte ptr [esi]
218 022C0380 61 popad
219 022C0381 8B 85 FC FF FF FF mov eax,dword ptr [ebp+FFFFFFFCh]
220 022C0387 89 EC mov esp,ebp
221 022C0389 8F C5 pop ebp
222 022C038B C2 00 00 ret 0
223 022C038E FF F5 push ebp
224 022C0390 89 E5 mov ebp,esp
225 022C0392 81 EC 0C 00 00 00 sub esp,0Ch
226 022C0398 60 pushad
227 022C0399 8D BD FC FF FF FF lea edi,[ebp+FFFFFFFCh]
228 022C039F 8D 35 05 00 2A 02 lea esi,ds:[022A0005h]
229 022C03A5 B8 03 00 00 00 mov eax,3
230 022C03AA 89 C1 mov ecx,eax
231 022C03AC F3 A4 rep movs byte ptr es:[edi],byte ptr [esi]
232 022C03AE 61 popad
233 022C03AF 8B 85 FC FF FF FF mov eax,dword ptr [ebp+FFFFFFFCh]
234 022C03B5 89 EC mov esp,ebp
235 022C03B7 8F C5 pop ebp
236 022C03B9 C2 00 00 ret 0
237 022C03BC FF F5 push ebp
238 022C03BE 89 E5 mov ebp,esp
239 022C03C0 81 EC 0C 00 00 00 sub esp,0Ch
240 022C03C6 60 pushad
241 022C03C7 8D BD FC FF FF FF lea edi,[ebp+FFFFFFFCh]
242 022C03CD 8D 35 09 00 2A 02 lea esi,ds:[022A0009h]
243 022C03D3 B8 04 00 00 00 mov eax,4
244 022C03D8 89 C1 mov ecx,eax
245 022C03DA F3 A4 rep movs byte ptr es:[edi],byte ptr [esi]
246 022C03DC 61 popad
247 022C03DD 8B 85 FC FF FF FF mov eax,dword ptr [ebp+FFFFFFFCh]
248 022C03E3 89 EC mov esp,ebp
249 022C03E5 8F C5 pop ebp
250 022C03E7 C2 00 00 ret 0
251 022C03EA FF F5 push ebp
252 022C03EC 89 E5 mov ebp,esp
253 022C03EE 81 EC 10 00 00 00 sub esp,10h
254 022C03F4 60 pushad
255 022C03F5 8D BD F8 FF FF FF lea edi,[ebp+FFFFFFF8h]
256 022C03FB 8D 35 0E 00 2A 02 lea esi,ds:[022A000Eh]
257 022C0401 B8 05 00 00 00 mov eax,5
258 022C0406 89 C1 mov ecx,eax
259 022C0408 F3 A4 rep movs byte ptr es:[edi],byte ptr [esi]
260 022C040A 61 popad
261 022C040B 8B 85 F8 FF FF FF mov eax,dword ptr [ebp+FFFFFFF8h]
262 022C0411 8B 95 FC FF FF FF mov edx,dword ptr [ebp+FFFFFFFCh]
263 022C0417 89 EC mov esp,ebp
264 022C0419 8F C5 pop ebp
265 022C041B C2 00 00 ret 0
266 022C041E FF F5 push ebp
267 022C0420 89 E5 mov ebp,esp
268 022C0422 81 EC 10 00 00 00 sub esp,10h
269 022C0428 60 pushad
270 022C0429 8D BD F8 FF FF FF lea edi,[ebp+FFFFFFF8h]
271 022C042F 8D 35 14 00 2A 02 lea esi,ds:[022A0014h]
272 022C0435 B8 06 00 00 00 mov eax,6
273 022C043A 89 C1 mov ecx,eax
274 022C043C F3 A4 rep movs byte ptr es:[edi],byte ptr [esi]
275 022C043E 61 popad
276 022C043F 8B 85 F8 FF FF FF mov eax,dword ptr [ebp+FFFFFFF8h]
277 022C0445 8B 95 FC FF FF FF mov edx,dword ptr [ebp+FFFFFFFCh]
278 022C044B 89 EC mov esp,ebp
279 022C044D 8F C5 pop ebp
280 022C044F C2 00 00 ret 0
281 022C0452 FF F5 push ebp
282 022C0454 89 E5 mov ebp,esp
283 022C0456 81 EC 10 00 00 00 sub esp,10h
284 022C045C 60 pushad
285 022C045D 8D BD F8 FF FF FF lea edi,[ebp+FFFFFFF8h]
286 022C0463 8D 35 1B 00 2A 02 lea esi,ds:[022A001Bh]
287 022C0469 B8 07 00 00 00 mov eax,7
288 022C046E 89 C1 mov ecx,eax
289 022C0470 F3 A4 rep movs byte ptr es:[edi],byte ptr [esi]
290 022C0472 61 popad
291 022C0473 8B 85 F8 FF FF FF mov eax,dword ptr [ebp+FFFFFFF8h]
292 022C0479 8B 95 FC FF FF FF mov edx,dword ptr [ebp+FFFFFFFCh]
293 022C047F 89 EC mov esp,ebp
294 022C0481 8F C5 pop ebp
295 022C0483 C2 00 00 ret 0
296 022C0486 FF F5 push ebp
297 022C0488 89 E5 mov ebp,esp
298 022C048A 81 EC 10 00 00 00 sub esp,10h
299 022C0490 60 pushad
300 022C0491 8D BD F8 FF FF FF lea edi,[ebp+FFFFFFF8h]
301 022C0497 8D 35 23 00 2A 02 lea esi,ds:[022A0023h]
302 022C049D B8 08 00 00 00 mov eax,8
303 022C04A2 89 C1 mov ecx,eax
304 022C04A4 F3 A4 rep movs byte ptr es:[edi],byte ptr [esi]
305 022C04A6 61 popad
306 022C04A7 8B 85 F8 FF FF FF mov eax,dword ptr [ebp+FFFFFFF8h]
307 022C04AD 8B 95 FC FF FF FF mov edx,dword ptr [ebp+FFFFFFFCh]
308 022C04B3 89 EC mov esp,ebp
309 022C04B5 8F C5 pop ebp
310 022C04B7 C2 00 00 ret 0
311 022C04BA FF F5 push ebp
312 022C04BC 89 E5 mov ebp,esp
313 022C04BE 81 EC 08 00 00 00 sub esp,8
314 022C04C4 60 pushad
315 022C04C5 89 C3 mov ebx,eax
316 022C04C7 8D 3B lea edi,[ebx]
317 022C04C9 8D 35 2C 00 2A 02 lea esi,ds:[022A002Ch]
318 022C04CF B8 09 00 00 00 mov eax,9
319 022C04D4 89 C1 mov ecx,eax
320 022C04D6 F3 A4 rep movs byte ptr es:[edi],byte ptr [esi]
321 022C04D8 61 popad
322 022C04D9 89 EC mov esp,ebp
323 022C04DB 8F C5 pop ebp
324 022C04DD C2 00 00 ret 0
325 022C04E0 FF F5 push ebp
326 022C04E2 89 E5 mov ebp,esp
327 022C04E4 81 EC 08 00 00 00 sub esp,8
328 022C04EA 60 pushad
329 022C04EB 89 C3 mov ebx,eax
330 022C04ED 8D 3B lea edi,[ebx]
331 022C04EF 8D 35 36 00 2A 02 lea esi,ds:[022A0036h]
332 022C04F5 B8 0A 00 00 00 mov eax,0Ah
333 022C04FA 89 C1 mov ecx,eax
334 022C04FC F3 A4 rep movs byte ptr es:[edi],byte ptr [esi]
335 022C04FE 61 popad
336 022C04FF 89 EC mov esp,ebp
337 022C0501 8F C5 pop ebp
338 022C0503 C2 00 00 ret 0
339 022C0506 FF F5 push ebp
340 022C0508 89 E5 mov ebp,esp
341 022C050A 81 EC 08 00 00 00 sub esp,8
342 022C0510 60 pushad
343 022C0511 89 C3 mov ebx,eax
344 022C0513 8D 3B lea edi,[ebx]
345 022C0515 8D 35 41 00 2A 02 lea esi,ds:[022A0041h]
346 022C051B B8 0B 00 00 00 mov eax,0Bh
347 022C0520 89 C1 mov ecx,eax
348 022C0522 F3 A4 rep movs byte ptr es:[edi],byte ptr [esi]
349 022C0524 61 popad
350 022C0525 89 EC mov esp,ebp
351 022C0527 8F C5 pop ebp
352 022C0529 C2 00 00 ret 0
353 022C052C FF F5 push ebp
354 022C052E 89 E5 mov ebp,esp
355 022C0530 81 EC 08 00 00 00 sub esp,8
356 022C0536 60 pushad
357 022C0537 89 C3 mov ebx,eax
358 022C0539 8D 3B lea edi,[ebx]
359 022C053B 8D 35 4D 00 2A 02 lea esi,ds:[022A004Dh]
360 022C0541 B8 0C 00 00 00 mov eax,0Ch
361 022C0546 89 C1 mov ecx,eax
362 022C0548 F3 A4 rep movs byte ptr es:[edi],byte ptr [esi]
363 022C054A 61 popad
364 022C054B 89 EC mov esp,ebp
365 022C054D 8F C5 pop ebp
366 022C054F C2 00 00 ret 0
做完布尔运算和Load Address(Complex)之后,就可以着手实现sin、cos等特殊浮点函数了。在没有窥孔优化之前,这些汇编还真是惨不忍睹啊……
posted on 2009-04-15 21:15
陈梓瀚(vczh) 阅读(2120)
评论(1) 编辑 收藏 引用 所属分类:
JIT