aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--thunk.c23
-rw-r--r--thunk.h7
2 files changed, 26 insertions, 4 deletions
diff --git a/thunk.c b/thunk.c
index dc9e315d7d..7331aeb477 100644
--- a/thunk.c
+++ b/thunk.c
@@ -31,6 +31,8 @@
/* XXX: make it dynamic */
StructEntry struct_entries[MAX_STRUCTS];
+static const argtype *thunk_type_next_ptr(const argtype *type_ptr);
+
static inline const argtype *thunk_type_next(const argtype *type_ptr)
{
int type;
@@ -47,9 +49,9 @@ static inline const argtype *thunk_type_next(const argtype *type_ptr)
case TYPE_PTRVOID:
return type_ptr;
case TYPE_PTR:
- return thunk_type_next(type_ptr);
+ return thunk_type_next_ptr(type_ptr);
case TYPE_ARRAY:
- return thunk_type_next(type_ptr + 1);
+ return thunk_type_next_ptr(type_ptr + 1);
case TYPE_STRUCT:
return type_ptr + 1;
default:
@@ -57,6 +59,11 @@ static inline const argtype *thunk_type_next(const argtype *type_ptr)
}
}
+static const argtype *thunk_type_next_ptr(const argtype *type_ptr)
+{
+ return thunk_type_next(type_ptr);
+}
+
void thunk_register_struct(int id, const char *name, const argtype *types)
{
const argtype *type_ptr;
@@ -267,3 +274,15 @@ unsigned int host_to_target_bitmask(unsigned int alpha_mask,
}
return(x86_mask);
}
+
+#ifndef NO_THUNK_TYPE_SIZE
+int thunk_type_size_array(const argtype *type_ptr, int is_host)
+{
+ return thunk_type_size(type_ptr, is_host);
+}
+
+int thunk_type_align_array(const argtype *type_ptr, int is_host)
+{
+ return thunk_type_align(type_ptr, is_host);
+}
+#endif /* ndef NO_THUNK_TYPE_SIZE */
diff --git a/thunk.h b/thunk.h
index 4bf256a004..d650fa4c13 100644
--- a/thunk.h
+++ b/thunk.h
@@ -75,6 +75,9 @@ const argtype *thunk_convert(void *dst, const void *src,
extern StructEntry struct_entries[];
+int thunk_type_size_array(const argtype *type_ptr, int is_host);
+int thunk_type_align_array(const argtype *type_ptr, int is_host);
+
static inline int thunk_type_size(const argtype *type_ptr, int is_host)
{
int type, size;
@@ -103,7 +106,7 @@ static inline int thunk_type_size(const argtype *type_ptr, int is_host)
break;
case TYPE_ARRAY:
size = type_ptr[1];
- return size * thunk_type_size(type_ptr + 2, is_host);
+ return size * thunk_type_size_array(type_ptr + 2, is_host);
case TYPE_STRUCT:
se = struct_entries + type_ptr[1];
return se->size[is_host];
@@ -139,7 +142,7 @@ static inline int thunk_type_align(const argtype *type_ptr, int is_host)
}
break;
case TYPE_ARRAY:
- return thunk_type_align(type_ptr + 2, is_host);
+ return thunk_type_align_array(type_ptr + 2, is_host);
case TYPE_STRUCT:
se = struct_entries + type_ptr[1];
return se->align[is_host];