#ifndef AMD64_H
#define AMD64_H
+// Conventions in this file:
+
+// body: implementation. other macros call this one
+// disp: displacement
+// inst: instruction
+// is_half: short if true, byte if false (then why is it named is_half...?)
+// imm: immediate
+// mem: read from (immediate-supplied address?)
+// membase: read from address in a base register plus a displacement
+// memindex: SIP addressing: (address in base register) + (displacement in index register)<<(shift)
+// reg: register, encode modR/M bits 00
+// regp: register, encode modR/M bits 11
+// size: Expected 1,2,4 or 8
+// widen: extends from 1 or 2 bytes
+
#include <glib.h>
typedef enum {
/* Only if storage == ArgValuetypeInReg */
ArgStorage pair_storage [2];
gint8 pair_regs [2];
- /* The size of each pair */
+ /* The size of each pair (bytes) */
int pair_size [2];
int nregs;
/* Only if storage == ArgOnStack */
- int arg_size;
+ int arg_size; // Bytes, will always be rounded up/aligned to 8 byte boundary
} ArgInfo;
typedef struct {
gpointer addr;
/* The trampoline reads this, so keep the size explicit */
int ret_marshal;
- /* If ret_marshal != NONE, this is the reg of the vret arg, else -1 */
+ /* If ret_marshal != NONE, this is the reg of the vret arg, else -1 (used in out case) */
+ /* Equivalent of vret_arg_slot in the x86 implementation. */
int vret_arg_reg;
- /* The stack slot where the return value will be stored */
+ /* The stack slot where the return value will be stored (used in in case) */
int vret_slot;
int stack_usage, map_count;
/* If not -1, then make a virtual call using this vtable offset */