Port-amd64 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: unaligned memory access & SIGBUS



On Wed, Apr 11, 2012 at 02:25:51AM +0000, Christos Zoulas wrote:
> In article <20120410092122.GA26870%lynche.sis.pasteur.fr@localhost>,
> Nicolas Joly  <njoly%pasteur.fr@localhost> wrote:
> >-=-=-=-=-=-
> >
> >While trying to chase some unaligned memory access originally noticed
> >on alpha, i wanted to have a way to detect this on amd64 ...
> >
> >Unfortunately, the attached sample code does not fail with SIGBUS on
> >NetBSD/amd64 unlike other OSes i checked (Linux and FreeBSD). It
> >simply tries to set the Alignment Check bit from RFLAGS register and
> >then trigger an unaligned memory access.
> >
> >Any specific reason for such a behaviour ?
> >
> >Thanks.
> >
> >njoly@lanfeust [tmp/malign]> uname -a
> >NetBSD lanfeust.sis.pasteur.fr 6.99.4 NetBSD 6.99.4 (LANFEUST) #2: Mon
> >Apr  9 23:30:03 CEST 2012 
> >njoly%lanfeust.sis.pasteur.fr@localhost:/local/src/NetBSD/obj.amd64/sys/arch/amd64/compile/LANFEUST
> > amd64
> >njoly@lanfeust [tmp/malign]> cc -o malign malign.c 
> >njoly@lanfeust [tmp/malign]> ./malign 
> >0
[...]
> PSL_AC needs to be part of PSL_USER?

Thanks for the tip, but simply adding it to PSL_USER do not change
anything; still no SIGBUS signal.

Unless someone beats me ;) i'll need to find some spare to understand
that part of code hoping to see what's going on.

-- 
Nicolas Joly

Projects and Developments in Bioinformatics
Institut Pasteur, Paris.


Home | Main Index | Thread Index | Old Index