From patchwork Mon Apr 26 16:52:46 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guy Martin X-Patchwork-Id: 95093 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o3QGr1GG005745 for ; Mon, 26 Apr 2010 16:53:02 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753497Ab0DZQxA (ORCPT ); Mon, 26 Apr 2010 12:53:00 -0400 Received: from smtp6.tech.numericable.fr ([82.216.111.42]:57262 "EHLO smtp6.tech.numericable.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752543Ab0DZQw7 (ORCPT ); Mon, 26 Apr 2010 12:52:59 -0400 Received: from ibiza.bxl.tuxicoman.be (cable-85.28.107.20.coditel.net [85.28.107.20]) by smtp6.tech.numericable.fr (Postfix) with ESMTP id B3EF4144023; Mon, 26 Apr 2010 18:52:56 +0200 (CEST) Received: from [2001:6f8:310:301::1] (helo=borg.bxl.tuxicoman.be) by ibiza.bxl.tuxicoman.be with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1O6RY7-0003Pf-1G; Mon, 26 Apr 2010 18:52:54 +0200 Date: Mon, 26 Apr 2010 18:52:46 +0200 From: Guy Martin To: Mauro Carvalho Chehab Cc: Linux Media Mailing List Subject: Re: Xawtv sparc 64bit fix Message-ID: <20100426185246.174c0197@borg.bxl.tuxicoman.be> In-Reply-To: <4BD47410.9000006@redhat.com> References: <20100423170316.12e01bfc@borg.bxl.tuxicoman.be> <4BD47410.9000006@redhat.com> X-Mailer: Claws Mail 3.7.5 (GTK+ 2.18.7; x86_64-pc-linux-gnu) Mime-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 26 Apr 2010 16:53:02 +0000 (UTC) diff --git a/structs/struct-dump.c b/structs/struct-dump.c index 0ee7fc8..49bfe2d 100644 --- a/structs/struct-dump.c +++ b/structs/struct-dump.c @@ -43,7 +43,9 @@ int print_struct(FILE *fp, struct struct_desc *desc, void *data, int16_t s16; uint8_t u8; int8_t s8; - int al = sizeof(long)-1; /* struct + union + 64bit alignment */ + struct al64_t { char c; uint64_t t; } al64_t; + int al = sizeof(long)-1; /* struct + union */ + int al64 = (unsigned long)&al64_t.t - (unsigned long)&al64_t.c - 1; /* 64 bit alignement */ void *p; unsigned int i,j,first; @@ -149,7 +151,7 @@ int print_struct(FILE *fp, struct struct_desc *desc, void *data, ptr += 4; break; case BITS64: - ptr = (void*)(((intptr_t)ptr + al) & ~al); + ptr = (void*)(((intptr_t)ptr + al64) & ~al64); u64 = *((uint64_t*)ptr); first = 1; fprintf(fp,"0x%" PRIx64 " [",u64); @@ -166,13 +168,13 @@ int print_struct(FILE *fp, struct struct_desc *desc, void *data, break; case UINT64: - ptr = (void*)(((intptr_t)ptr + al) & ~al); + ptr = (void*)(((intptr_t)ptr + al64) & ~al64); u64 = *((uint64_t*)ptr); fprintf(fp,"%" PRIu64,u64); ptr += 8; break; case SINT64: - ptr = (void*)(((intptr_t)ptr + al) & ~al); + ptr = (void*)(((intptr_t)ptr + al64) & ~al64); s64 = *((int64_t*)ptr); fprintf(fp,"%" PRId64,s64); ptr += 8;