From owner-freebsd-arm@FreeBSD.ORG Wed Feb 17 14:44:08 2010 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F904106566C for ; Wed, 17 Feb 2010 14:44:08 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe05.swip.net [212.247.154.129]) by mx1.freebsd.org (Postfix) with ESMTP id 992258FC1F for ; Wed, 17 Feb 2010 14:44:07 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.0 c=1 a=MnI1ikcADjEx7bvsp0jZvQ==:17 a=b7Me_CeqYRheD2dx2JQA:9 a=Fj_g-0flJBSx6uBwkyIA:7 a=X42QrNPQRFndd6da7SR3AGOlUYQA:4 Received: from [188.126.201.140] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe05.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 1274151488; Wed, 17 Feb 2010 15:44:05 +0100 From: Hans Petter Selasky To: freebsd-arm@freebsd.org Date: Wed, 17 Feb 2010 15:42:35 +0100 User-Agent: KMail/1.12.4 (FreeBSD/8.0-STABLE; KDE/4.3.4; amd64; ; ) References: <4B7BFAA4.4040607@semihalf.com> In-Reply-To: <4B7BFAA4.4040607@semihalf.com> X-Face: +~\`s("[*|O,="7?X@L.elg*F"OA\I/3%^p8g?ab%RN'(; _IjlA: hGE..Ew, XAQ*o#\/M~SC=S1-f9{EzRfT'|Hhll5Q]ha5Bt-s|oTlKMusi:1e[wJl}kd}GR Z0adGx-x_0zGbZj'e(Y[(UNle~)8CQWXW@:DX+9)_YlB[tIccCPN$7/L' MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201002171542.35757.hselasky@c2i.net> Cc: Subject: Re: kdump on ARM X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2010 14:44:08 -0000 On Wednesday 17 February 2010 15:18:12 Grzegorz Bernacki wrote: > Hi, > > I've noticed that kdump on ARM doesn't work properly, it generates bus > error. The problem is that structures dumped into ktrace.out are not > aligned. Processing such a structure causes Aligment Fault. One solution > is to copy structure into local variable and then process it, please see > patch below. But I am not sure if this is the best solution and maybe > someone has a better idea. > > grzesiek > > > diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c > index 386221e..5a15886 100644 > --- a/usr.bin/kdump/kdump.c > +++ b/usr.bin/kdump/kdump.c > @@ -1325,6 +1325,10 @@ ktrstat(struct stat *statp) > void > ktrstruct(char *buf, size_t buflen) > { > +#if defined(__arm__) > + struct stat stat; > + struct sockaddr sockaddr; > +#endif > char *name, *data; > size_t namelen, datalen; > int i; > @@ -1348,12 +1352,22 @@ ktrstruct(char *buf, size_t buflen) > if (strcmp(name, "stat") == 0) { > if (datalen != sizeof(struct stat)) > goto invalid; > +#if defined(__arm__) > + memcpy(&stat, data, sizeof(struct stat)); > + ktrstat(&stat); > +#else > ktrstat((struct stat *)data); > +#endif > } else if (strcmp(name, "sockaddr") == 0) { > if (datalen < sizeof(struct sockaddr) || > datalen != ((struct sockaddr *)(data))->sa_len) > goto invalid; > +#if defined(__arm__) > + memcpy(&sockaddr, data, sizeof(struct sockaddr)); > + ktrsockaddr(&sockaddr); > +#else > ktrsockaddr((struct sockaddr *)data); > +#endif > } else { > printf("unknown structure\n"); > } I think more than ARM is affected by this. --HPS