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

Method AsmTransform

extra/yassl/taocrypt/src/sha.cpp:763–1028  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

761
762#ifdef _MSC_VER
763 __declspec(naked)
764#else
765 __attribute__ ((noinline))
766#endif
767void SHA::AsmTransform(const byte* data, word32 times)
768{
769#ifdef __GNUC__
770 #define AS1(x) #x ";"
771 #define AS2(x, y) #x ", " #y ";"
772
773 #define PROLOG() \
774 __asm__ __volatile__ \
775 ( \
776 ".intel_syntax noprefix;" \
777 "push ebx;" \
778 "push ebp;"
779 #define EPILOG() \
780 "pop ebp;" \
781 "pop ebx;" \
782 "emms;" \
783 ".att_syntax;" \
784 : \
785 : "c" (this), "D" (data), "a" (times) \
786 : "%esi", "%edx", "memory", "cc" \
787 );
788
789#else
790 #define AS1(x) __asm x
791 #define AS2(x, y) __asm x, y
792
793 #define PROLOG() \
794 AS1( push ebp ) \
795 AS2( mov ebp, esp ) \
796 AS2( movd mm3, edi ) \
797 AS2( movd mm4, ebx ) \
798 AS2( movd mm5, esi ) \
799 AS2( movd mm6, ebp ) \
800 AS2( mov edi, data ) \
801 AS2( mov eax, times )
802
803 #define EPILOG() \
804 AS2( movd ebp, mm6 ) \
805 AS2( movd esi, mm5 ) \
806 AS2( movd ebx, mm4 ) \
807 AS2( movd edi, mm3 ) \
808 AS2( mov esp, ebp ) \
809 AS1( pop ebp ) \
810 AS1( emms ) \
811 AS1( ret 8 )
812#endif
813
814 PROLOG()
815
816 AS2( mov esi, ecx )
817
818 #ifdef OLD_GCC_OFFSET
819 AS2( add esi, 20 ) // digest_[0]
820 #else

Callers

nothing calls this directly

Calls 1

AS2Function · 0.85

Tested by

no test coverage detected