Define the macros that one could use to access the registers within
`struct __regs` that represent the ABI/calling convention specific
that contain the arguments (and the return value).
Signed-off-by: Sergiu Moga <sergiu@unikraft.io>
Approved-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Andrei Tatar <andrei@unikraft.io>
GitHub-Closes: #1618
#include <uk/arch/types.h>
+/*
+ * Mappings of `struct __regs` register fields
+ * according to AAPCS64 definition for function calls
+ * rargX - Arguments 0..7
+ * rretX - Function call return value
+ */
+
+#define __fn_rarg0 x[0]
+#define __fn_rarg1 x[1]
+#define __fn_rarg2 x[2]
+#define __fn_rarg3 x[3]
+#define __fn_rarg4 x[4]
+#define __fn_rarg5 x[5]
+#define __fn_rarg6 x[6]
+#define __fn_rarg7 x[7]
+
+#define __fn_rret0 x[0]
+#define __fn_rret1 x[1]
+
/*
* Change this structure must update TRAP_STACK_SIZE at the same time.
* This data structure must be 16-byte alignment.
#include <uk/arch/types.h>
#include <uk/essentials.h>
+/*
+ * Mappings of `struct __regs` register fields
+ * according to AMD64 SysV ABI definition for function calls
+ * rargX - Arguments 0..5
+ * rretX - Function call return value
+ */
+
+#define __fn_rarg0 rdi
+#define __fn_rarg1 rsi
+#define __fn_rarg2 rdx
+#define __fn_rarg3 rcx
+#define __fn_rarg4 r8
+#define __fn_rarg5 r9
+
+#define __fn_rret0 rax
+#define __fn_rret1 rdx
+
struct __regs {
unsigned long pad; /* 8 bytes to make struct size multiple of 16 */
unsigned long r15;