From owner-freebsd-mips@FreeBSD.ORG Wed Feb 18 06:26:10 2009 Return-Path: Delivered-To: mips@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A671C106564A; Wed, 18 Feb 2009 06:26:10 +0000 (UTC) (envelope-from xcllnt@mac.com) Received: from asmtpout017.mac.com (asmtpout017.mac.com [17.148.16.92]) by mx1.freebsd.org (Postfix) with ESMTP id 8E8E88FC13; Wed, 18 Feb 2009 06:26:10 +0000 (UTC) (envelope-from xcllnt@mac.com) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Received: from MacBook-Pro.lan.xcllnt.net (xcllnt.net [75.101.29.67]) by asmtp017.mac.com (Sun Java(tm) System Messaging Server 6.3-7.03 (built Aug 7 2008; 32bit)) with ESMTPSA id <0KF9003FQ0JKV900@asmtp017.mac.com>; Tue, 17 Feb 2009 22:26:10 -0800 (PST) Message-id: <4CB77F1D-4235-47D8-B654-1C4F29B6C649@mac.com> From: Marcel Moolenaar To: "M. Warner Losh" In-reply-to: <20090217.222152.-109416210.imp@bsdimp.com> Date: Tue, 17 Feb 2009 22:26:08 -0800 References: <20090218023328.227617302F@freebsd-current.sentex.ca> <20090217.203647.-1518647466.imp@bsdimp.com> <20090217.222152.-109416210.imp@bsdimp.com> X-Mailer: Apple Mail (2.930.3) Cc: mips@FreeBSD.org, tinderbox@FreeBSD.org, current@FreeBSD.org Subject: Re: [head tinderbox] failure on mips/mips X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Feb 2009 06:26:11 -0000 On Feb 17, 2009, at 9:21 PM, M. Warner Losh wrote: > In message: <20090217.203647.-1518647466.imp@bsdimp.com> > "M. Warner Losh" writes: > : In message: <20090218023328.227617302F@freebsd-current.sentex.ca> > : FreeBSD Tinderbox writes: > : : /src/usr.sbin/bsnmpd/modules/snmp_mibII/../../../../contrib/ > bsnmp/snmp_mibII/mibII.c:1016: warning: cast increases required > alignment of target type > : > : there's still 3 or 4 of these in the tree that I'm trying to track > : back to root cause. A simple (void *) fixes the problem, but I want > : to understand the issues before I slap that bad-boy in there... > > The first one is: > > case RTM_IFINFO: > ifm = (struct if_msghdr *)rtm; > mib_extract_addrs(ifm->ifm_addrs, (u_char *)(ifm + 1), addrs); > if ((ifp = mib_find_if_sys(ifm->ifm_index)) == NULL) > break; > > rtm is of type struct rt_msghdr. This has an alignment requirement of > 4 on mips, at least on 32-bit mips (the biggest data element is a > u_long). struct if_msghdr has an alignment requirement of 8, because > time_t is int64_t on MIPS, which is 8-bytes in size. Normally on 32-bit architectures, 64-bit data types have a 32-bit alignment requirement by virtue of needing 2 32-bit loads/stores to read/write them. Does 32-bit MIPS use 64-bit wide registers? > One way to fix this is to add __aligned(8) to struct rt_msghdr to > compensate for this. Otherwise, if the time_t element is referenced > in ifm_data we'll core dump. A safer approach is to mark ifi_epoch as packed or put differently, define time_t as a 64-bit integral with 32-bit alignment. This can avoid a lot of unexpected internal padding as well (e.g. struct timeval). Just a thought. -- Marcel Moolenaar xcllnt@mac.com