base/asm-common.h, *.S: Add `INTFUNC' macro for internal subroutines.
[catacomb] / symm / rijndael-x86ish-aesni.S
index 8090bca..b0b880a 100644 (file)
@@ -332,10 +332,15 @@ FUNC(rijndael_setup_x86ish_aesni)
 #endif
        ret
 
-       .align  16
-endswap_block:
+ENDFUNC
+
+INTFUNC(endswap_block)
        // End-swap NKW words starting at SI.  The end-swapping table is
        // already loaded into XMM5; and it's OK to work in 16-byte chunks.
+#if CPUFAM_AMD64 && ABI_WIN
+  .seh_endprologue
+#endif
+
        mov     ecx, NKW
 0:     movdqu  xmm1, [SI]
        pshufb  xmm1, xmm5
@@ -343,8 +348,11 @@ endswap_block:
        add     SI, 16
        sub     ecx, 4
        ja      0b
+
        ret
 
+ENDFUNC
+
 #undef CTX
 #undef BLKSZ
 #undef SI
@@ -356,8 +364,6 @@ endswap_block:
 #undef LRK
 #undef BLKOFF
 
-ENDFUNC
-
 ///--------------------------------------------------------------------------
 /// Encrypting and decrypting blocks.
 
@@ -509,17 +515,23 @@ ENDFUNC
 ///--------------------------------------------------------------------------
 /// Random utilities.
 
-       .align  16
+INTFUNC(bogus)
        // Abort the process because of a programming error.  Indirecting
        // through this point serves several purposes: (a) by CALLing, rather
        // than branching to, `abort', we can save the return address, which
        // might at least provide a hint as to what went wrong; (b) we don't
        // have conditional CALLs (and they'd be big anyway); and (c) we can
        // write a HLT here as a backstop against `abort' being mad.
-bogus: callext F(abort)
+#if CPUFAM_AMD64 && ABI_WIN
+  .seh_endprologue
+#endif
+
+       callext F(abort)
 0:     hlt
        jmp     0b
 
+ENDFUNC
+
 ///--------------------------------------------------------------------------
 /// Data tables.