summaryrefslogtreecommitdiff
path: root/register.c
diff options
context:
space:
mode:
Diffstat (limited to 'register.c')
-rw-r--r--register.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/register.c b/register.c
new file mode 100644
index 0000000..ca095ea
--- /dev/null
+++ b/register.c
@@ -0,0 +1,48 @@
+#include "register.h"
+
+const struct reg RAX = {
+ .qword = "rax",
+ .dword = "eax",
+ .word = "ax",
+ .byte = "al",
+};
+const struct reg RDI = {
+ .qword = "rdi",
+ .dword = "edi",
+ .word = "di",
+ .byte = "dil",
+};
+const struct reg RSI = {
+ .qword = "rsi",
+ .dword = "esi",
+ .word = "si",
+ .byte = "sil",
+};
+const struct reg RDX = {
+ .qword = "rdx",
+ .dword = "edx",
+ .word = "dx",
+ .byte = "dl",
+};
+const struct reg R10 = {
+ .qword = "r10",
+ .dword = "r10d",
+ .word = "r10w",
+ .byte = "r10b",
+};
+const struct reg R9 = {
+ .qword = "r9",
+ .dword = "r9d",
+ .word = "r9w",
+ .byte = "r9b",
+};
+const struct reg R8 = {
+ .qword = "r8",
+ .dword = "r8d",
+ .word = "r8w",
+ .byte = "r8b",
+};
+
+const struct reg* const CALLING_CONV[] = {&RDI, &RSI, &RDX, &R10, &R9, &R8};
+const unsigned long long CC_N_REGS =
+ sizeof(CALLING_CONV) / sizeof(const struct reg* const);