From patchwork Sat Dec 8 15:18:48 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 204669 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E8CA32C022F for ; Sun, 9 Dec 2012 02:19:06 +1100 (EST) Received: from localhost ([::1]:52426 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ThMBE-0005df-2B for incoming@patchwork.ozlabs.org; Sat, 08 Dec 2012 10:19:04 -0500 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 Received: from localhost.localdomain (unknown [78.238.229.36]) by smtp6-g21.free.fr (Postfix) with ESMTP id E19628230E; Sat, 8 Dec 2012 16:18:50 +0100 (CET) From: Laurent Vivier To: qemu-devel@nongnu.org Date: Sat, 8 Dec 2012 16:18:48 +0100 Message-Id: <1354979928-19000-1-git-send-email-laurent@vivier.eu> X-Mailer: git-send-email 1.7.10.4 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a01:e0c:1:1599::15 Cc: Riku Voipio , Laurent Vivier Subject: [Qemu-devel] [PATCH] linux-user: correctly align types in thunking code X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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: