summaryrefslogtreecommitdiffstats
path: root/src/abi.inc
diff options
context:
space:
mode:
authorMurilo Ijanc <[email protected]>2026-07-26 12:56:51 -0300
committerMurilo Ijanc <[email protected]>2026-07-26 12:56:59 -0300
commitb7b08a7d29d84de187dd8a55e0c94de66b07a572 (patch)
tree7e55661d3eca3cf3b16aada6e87eabee68802fb9 /src/abi.inc
downloadasm-b7b08a7d29d84de187dd8a55e0c94de66b07a572.tar.gz
Initial importv0.1.0
Diffstat (limited to 'src/abi.inc')
-rw-r--r--src/abi.inc58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/abi.inc b/src/abi.inc
new file mode 100644
index 0000000..490c4b1
--- /dev/null
+++ b/src/abi.inc
@@ -0,0 +1,58 @@
+#ifndef CEPIS_ABI_INC
+#define CEPIS_ABI_INC
+
+.macro FUNC name
+ .text
+ .globl \name
+ .hidden \name
+ .type \name, @function
+ .p2align 4
+\name:
+.endm
+
+.macro PUBFUNC name
+ .text
+ .globl \name
+ .type \name, @function
+ .p2align 4
+\name:
+.endm
+
+.macro ENDFUNC name
+ .size \name, . - \name
+.endm
+
+.macro PROLOGUE n=8
+.if (\n % 16) != 8
+ .error "PROLOGUE frame size must be congruent to 8 modulo 16"
+.endif
+ push %rbp
+ mov %rsp, %rbp
+ push %rbx
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+ sub $\n, %rsp
+.endm
+
+.macro EPILOGUE
+ lea -40(%rbp), %rsp
+ pop %r15
+ pop %r14
+ pop %r13
+ pop %r12
+ pop %rbx
+ pop %rbp
+.endm
+
+#define LOCAL0 -48
+#define LOCAL1 -56
+#define LOCAL2 -64
+#define LOCAL3 -72
+#define LOCAL4 -80
+#define LOCAL5 -88
+#define LOCAL6 -96
+#define LOCAL7 -104
+
+#endif