From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:42271) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ThMB7-0005dM-4h for qemu-devel@nongnu.org; Sat, 08 Dec 2012 10:18:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ThMB5-0006lK-PO for qemu-devel@nongnu.org; Sat, 08 Dec 2012 10:18:57 -0500 Received: from smtp6-g21.free.fr ([2a01:e0c:1:1599::15]:33113) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ThMB5-0006l0-6o for qemu-devel@nongnu.org; Sat, 08 Dec 2012 10:18:55 -0500 From: Laurent Vivier Date: Sat, 8 Dec 2012 16:18:48 +0100 Message-Id: <1354979928-19000-1-git-send-email-laurent@vivier.eu> Subject: [Qemu-devel] [PATCH] linux-user: correctly align types in thunking code List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Riku Voipio , Laurent Vivier Signed-off-by: Laurent Vivier --- thunk.h | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/thunk.h b/thunk.h index 87025c3..d3e9f3d 100644 --- a/thunk.h +++ b/thunk.h @@ -151,20 +151,32 @@ static inline int thunk_type_align(const argtype *type_ptr, int is_host) case TYPE_CHAR: return 1; case TYPE_SHORT: - return 2; + if (is_host) { + return __alignof__(short); + } else { + return TARGET_SHORT_ALIGNMENT; + } case TYPE_INT: - return 4; + if (is_host) { + return __alignof__(int); + } else { + return TARGET_INT_ALIGNMENT; + } case TYPE_LONGLONG: case TYPE_ULONGLONG: - return 8; + if (is_host) { + return __alignof__(long long); + } else { + return TARGET_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 TARGET_LONG_ALIGNMENT; } break; case TYPE_OLDDEVT: -- 1.7.10.4