| 224 | |
| 225 | #ifdef _MSC_VER |
| 226 | __declspec(naked) |
| 227 | #else |
| 228 | __attribute__ ((noinline)) |
| 229 | #endif |
| 230 | void MD5::AsmTransform(const byte* data, word32 times) |
| 231 | { |
| 232 | #ifdef __GNUC__ |
| 233 | #define AS1(x) #x ";" |
| 234 | #define AS2(x, y) #x ", " #y ";" |
| 235 | |
| 236 | #define PROLOG() \ |
| 237 | __asm__ __volatile__ \ |
| 238 | ( \ |
| 239 | ".intel_syntax noprefix;" \ |
| 240 | "push ebx;" \ |
| 241 | "push ebp;" |
| 242 | #define EPILOG() \ |
| 243 | "pop ebp;" \ |
| 244 | "pop ebx;" \ |
| 245 | "emms;" \ |
| 246 | ".att_syntax;" \ |
| 247 | : \ |
| 248 | : "c" (this), "D" (data), "a" (times) \ |
| 249 | : "%esi", "%edx", "memory", "cc" \ |
| 250 | ); |
| 251 | |
| 252 | #else |
| 253 | #define AS1(x) __asm x |
| 254 | #define AS2(x, y) __asm x, y |
| 255 | |
| 256 | #define PROLOG() \ |
| 257 | AS1( push ebp ) \ |
| 258 | AS2( mov ebp, esp ) \ |
| 259 | AS2( movd mm3, edi ) \ |
| 260 | AS2( movd mm4, ebx ) \ |
| 261 | AS2( movd mm5, esi ) \ |
| 262 | AS2( movd mm6, ebp ) \ |
| 263 | AS2( mov edi, DWORD PTR [ebp + 8] ) \ |
| 264 | AS2( mov eax, DWORD PTR [ebp + 12] ) |
| 265 | |
| 266 | #define EPILOG() \ |
| 267 | AS2( movd ebp, mm6 ) \ |
| 268 | AS2( movd esi, mm5 ) \ |
| 269 | AS2( movd ebx, mm4 ) \ |
| 270 | AS2( movd edi, mm3 ) \ |
| 271 | AS2( mov esp, ebp ) \ |
| 272 | AS1( pop ebp ) \ |
| 273 | AS1( emms ) \ |
| 274 | AS1( ret 8 ) |
| 275 | |
| 276 | #endif |
| 277 | |
| 278 | |
| 279 | PROLOG() |
| 280 | |
| 281 | AS2( mov esi, ecx ) |
| 282 | |
| 283 | #ifdef OLD_GCC_OFFSET |