MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / AsmProcess

Method AsmProcess

extra/yassl/taocrypt/src/arc4.cpp:107–238  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105
106#ifdef _MSC_VER
107 __declspec(naked)
108#else
109 __attribute__ ((noinline))
110#endif
111void ARC4::AsmProcess(byte* out, const byte* in, word32 length)
112{
113#ifdef __GNUC__
114 #define AS1(x) #x ";"
115 #define AS2(x, y) #x ", " #y ";"
116
117 #define PROLOG() \
118 __asm__ __volatile__ \
119 ( \
120 ".intel_syntax noprefix;" \
121 "push ebx;" \
122 "push ebp;" \
123 "mov ebp, eax;"
124 #define EPILOG() \
125 "pop ebp;" \
126 "pop ebx;" \
127 "emms;" \
128 ".att_syntax;" \
129 : \
130 : "c" (this), "D" (out), "S" (in), "a" (length) \
131 : "%edx", "memory", "cc" \
132 );
133
134#else
135 #define AS1(x) __asm x
136 #define AS2(x, y) __asm x, y
137
138 #define PROLOG() \
139 AS1( push ebp ) \
140 AS2( mov ebp, esp ) \
141 AS2( movd mm3, edi ) \
142 AS2( movd mm4, ebx ) \
143 AS2( movd mm5, esi ) \
144 AS2( movd mm6, ebp ) \
145 AS2( mov edi, DWORD PTR [ebp + 8] ) \
146 AS2( mov esi, DWORD PTR [ebp + 12] ) \
147 AS2( mov ebp, DWORD PTR [ebp + 16] )
148
149 #define EPILOG() \
150 AS2( movd ebp, mm6 ) \
151 AS2( movd esi, mm5 ) \
152 AS2( movd ebx, mm4 ) \
153 AS2( movd edi, mm3 ) \
154 AS2( mov esp, ebp ) \
155 AS1( pop ebp ) \
156 AS1( emms ) \
157 AS1( ret 12 )
158
159#endif
160
161 PROLOG()
162
163 AS2( sub esp, 4 ) // make room
164

Callers

nothing calls this directly

Calls 1

AS2Function · 0.85

Tested by

no test coverage detected