* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef THUNK_H
#define THUNK_H
-#include <inttypes.h>
#include "cpu.h"
+#include "exec/user/abitypes.h"
/* types enums definitions */
/* Translation table for bitmasks... */
typedef struct bitmask_transtbl {
- unsigned int x86_mask;
- unsigned int x86_bits;
- unsigned int alpha_mask;
- unsigned int alpha_bits;
+ unsigned int target_mask;
+ unsigned int target_bits;
+ unsigned int host_mask;
+ unsigned int host_bits;
} bitmask_transtbl;
void thunk_register_struct(int id, const char *name, const argtype *types);
const StructEntry *se1);
const argtype *thunk_convert(void *dst, const void *src,
const argtype *type_ptr, int to_host);
-#ifndef NO_THUNK_TYPE_SIZE
+const argtype *thunk_print(void *arg, const argtype *type_ptr);
extern StructEntry *struct_entries;
se = struct_entries + type_ptr[1];
return se->size[is_host];
default:
- return -1;
+ g_assert_not_reached();
}
}
case TYPE_CHAR:
return 1;
case TYPE_SHORT:
- return 2;
+ if (is_host) {
+ return __alignof__(short);
+ } else {
+ return ABI_SHORT_ALIGNMENT;
+ }
case TYPE_INT:
- return 4;
+ if (is_host) {
+ return __alignof__(int);
+ } else {
+ return ABI_INT_ALIGNMENT;
+ }
case TYPE_LONGLONG:
case TYPE_ULONGLONG:
- return 8;
+ if (is_host) {
+ return __alignof__(long long);
+ } else {
+ return ABI_LLONG_ALIGNMENT;
+ }
case TYPE_LONG:
case TYPE_ULONG:
case TYPE_PTRVOID:
case TYPE_PTR:
if (is_host) {
- return sizeof(void *);
+ return __alignof__(long);
} else {
- return TARGET_ABI_BITS / 8;
+ return ABI_LONG_ALIGNMENT;
}
break;
case TYPE_OLDDEVT:
se = struct_entries + type_ptr[1];
return se->align[is_host];
default:
- return -1;
+ g_assert_not_reached();
}
}
-#endif /* NO_THUNK_TYPE_SIZE */
-
-unsigned int target_to_host_bitmask(unsigned int x86_mask,
+unsigned int target_to_host_bitmask(unsigned int target_mask,
const bitmask_transtbl * trans_tbl);
-unsigned int host_to_target_bitmask(unsigned int alpha_mask,
+unsigned int host_to_target_bitmask(unsigned int host_mask,
const bitmask_transtbl * trans_tbl);
void thunk_init(unsigned int max_structs);