Date: Wed, 17 Feb 2010 14:54:05 +0000 From: Rui Paulo <rpaulo@gmail.com> To: Grzegorz Bernacki <gjb@semihalf.com> Cc: freebsd-arm@freebsd.org Subject: Re: kdump on ARM Message-ID: <FF73974A-6960-4F75-82E9-1DBAACCB8E0F@gmail.com> In-Reply-To: <4B7BFAA4.4040607@semihalf.com> References: <4B7BFAA4.4040607@semihalf.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 17 Feb 2010, at 14:18, Grzegorz Bernacki wrote: > Hi, >=20 > 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. >=20 > grzesiek >=20 >=20 > 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") =3D=3D 0) { > if (datalen !=3D 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") =3D=3D 0) { > if (datalen < sizeof(struct sockaddr) || > datalen !=3D ((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 wonder if this can't be made non arm conditional? -- Rui Paulo
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?FF73974A-6960-4F75-82E9-1DBAACCB8E0F>