Darwin/aarch64: size_t assumptions
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
diff --git a/src/aarch64/ffi.c b/src/aarch64/ffi.c
index a2c731b..ec773d6 100644
--- a/src/aarch64/ffi.c
+++ b/src/aarch64/ffi.c
@@ -65,13 +65,13 @@ static inline void ffi_clear_cache(void *start, void *end)
}
static void *
-get_x_addr (struct call_context *context, unsigned n)
+get_x_addr (struct call_context *context, size_t n)
{
return &context->x[n];
}
static void *
-get_s_addr (struct call_context *context, unsigned n)
+get_s_addr (struct call_context *context, size_t n)
{
#if defined __AARCH64EB__
return &context->v[n].d[1].s[1];
@@ -81,7 +81,7 @@ get_s_addr (struct call_context *context, unsigned n)
}
static void *
-get_d_addr (struct call_context *context, unsigned n)
+get_d_addr (struct call_context *context, size_t n)
{
#if defined __AARCH64EB__
return &context->v[n].d[1];
@@ -91,7 +91,7 @@ get_d_addr (struct call_context *context, unsigned n)
}
static void *
-get_v_addr (struct call_context *context, unsigned n)
+get_v_addr (struct call_context *context, size_t n)
{
return &context->v[n];
}
@@ -207,7 +207,7 @@ ffi_call_SYSV (unsigned (*)(struct call_context *context, unsigned char *,
extended_cif *),
struct call_context *context,
extended_cif *,
- unsigned,
+ size_t,
void (*fn)(void));
extern void
@@ -388,14 +388,14 @@ is_v_register_candidate (ffi_type *ty)
struct arg_state
{
- unsigned ngrn; /* Next general-purpose register number. */
- unsigned nsrn; /* Next vector register number. */
- unsigned nsaa; /* Next stack offset. */
+ size_t ngrn; /* Next general-purpose register number. */
+ size_t nsrn; /* Next vector register number. */
+ size_t nsaa; /* Next stack offset. */
};
/* Initialize a procedure call argument marshalling state. */
static void
-arg_init (struct arg_state *state, unsigned call_frame_size)
+arg_init (struct arg_state *state, size_t call_frame_size)
{
state->ngrn = 0;
state->nsrn = 0;
@@ -405,7 +405,7 @@ arg_init (struct arg_state *state, unsigned call_frame_size)
/* Return the number of available consecutive core argument
registers. */
-static unsigned
+static size_t
available_x (struct arg_state *state)
{
return N_X_ARG_REG - state->ngrn;
@@ -414,7 +414,7 @@ available_x (struct arg_state *state)
/* Return the number of available consecutive vector argument
registers. */
-static unsigned
+static size_t
available_v (struct arg_state *state)
{
return N_V_ARG_REG - state->nsrn;
@@ -450,8 +450,8 @@ allocate_to_v (struct call_context *context, struct arg_state *state)
/* Allocate an aligned slot on the stack and return a pointer to it. */
static void *
-allocate_to_stack (struct arg_state *state, void *stack, unsigned alignment,
- unsigned size)
+allocate_to_stack (struct arg_state *state, void *stack, size_t alignment,
+ size_t size)
{
void *allocation;
@@ -757,7 +757,7 @@ ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
case FFI_SYSV:
{
struct call_context context;
- unsigned stack_bytes;
+ size_t stack_bytes;
/* Figure out the total amount of stack space we need, the
above call frame space needs to be 16 bytes aligned to
@@ -809,7 +809,7 @@ ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
}
else if ((cif->rtype->size + 7) / 8 < N_X_ARG_REG)
{
- unsigned size = ALIGN (cif->rtype->size, sizeof (UINT64));
+ size_t size = ALIGN (cif->rtype->size, sizeof (UINT64));
memcpy (rvalue, get_x_addr (&context, 0), size);
}
else
@@ -1093,7 +1093,7 @@ ffi_closure_SYSV_inner (ffi_closure *closure, struct call_context *context,
}
else if ((cif->rtype->size + 7) / 8 < N_X_ARG_REG)
{
- unsigned size = ALIGN (cif->rtype->size, sizeof (UINT64)) ;
+ size_t size = ALIGN (cif->rtype->size, sizeof (UINT64)) ;
memcpy (get_x_addr (context, 0), rvalue, size);
}
else
@@ -1112,4 +1112,3 @@ ffi_closure_SYSV_inner (ffi_closure *closure, struct call_context *context,
(closure->fun) (cif, rvalue, avalue, closure->user_data);
}
}
-
diff --git a/src/aarch64/sysv.S b/src/aarch64/sysv.S
index abb42af..901ee6a 100644
--- a/src/aarch64/sysv.S
+++ b/src/aarch64/sysv.S
@@ -63,7 +63,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
extended_cif *),
struct call_context *context,
extended_cif *,
- unsigned required_stack_size,
+ size_t required_stack_size,
void (*fn)(void));
Therefore on entry we have: