base/asm-common.h, *.S: Add `INTFUNC' macro for internal subroutines.
[catacomb] / base / asm-common.h
index 4a0a420..fdd7fad 100644 (file)
 #endif
 #define DATA .data
 
-// Announcing an external function.
-#define FUNC(name)                                                     \
-       .globl  F(name);                                                \
+// Announcing an internal function.
+#define INTFUNC(name)                                                  \
        TYPE_FUNC(name);                                                \
        .macro ENDFUNC; _ENDFUNC(name); .endm;                          \
        FUNC_PREHOOK(name);                                             \
-F(name):                                                               \
+name:                                                                  \
        FUNC_POSTHOOK(name)
 
+// Announcing an external function.
+#define FUNC(name)                                                     \
+       .globl  F(name);                                                \
+INTFUNC(F(name))
+
 // Marking the end of a function.
 #define _ENDFUNC(name)                                                 \
        .purgem ENDFUNC;                                                \
@@ -124,6 +128,14 @@ name:
 
 #if CPUFAM_X86 || CPUFAM_AMD64
 
+// Word size.
+#if CPUFAM_X86
+#  define WORDSZ 4
+#endif
+#if CPUFAM_AMD64
+#  define WORDSZ 8
+#endif
+
 // Set the function hooks.
 #define FUNC_PREHOOK(_) .balign 16
 
@@ -863,13 +875,13 @@ name:
 
 // Default values for the various hooks.
 #ifndef FUNC_PREHOOK
-#  define FUNC_PREHOOK(name)
+#  define FUNC_PREHOOK(_)
 #endif
 #ifndef FUNC_POSTHOOK
-#  define FUNC_POSTHOOK(name)
+#  define FUNC_POSTHOOK(_)
 #endif
 #ifndef ENDFUNC_HOOK
-#  define ENDFUNC_HOOK(name)
+#  define ENDFUNC_HOOK(_)
 #endif
 
 #ifndef F