From: jhi@snakemail.hut.fi (Jarkko Hietaniemi)
Subject: Re: unaligned access
Date: 06 Feb 1994 09:39:14 GMT [thread overview]
Message-ID: <JHI.94Feb6113914@alpha.hut.fi> (raw)
In-Reply-To: monnier@di.epfl.ch's message of 5 Feb 1994 22:21:35 +0100
This should do the trick:
#include <sys/types.h>
#include <sys/sysinfo.h>
#include <sys/proc.h>
#include <stdio.h>
#include <errno.h>
extern char *sys_errlist[];
extern int sys_nerr;
main()
{
int sbuf[2];
sbuf[0] = SSIN_UACPARNT;
sbuf[1] = UAC_NOFIX | UAC_SIGBUS;
errno = 0;
if (setsysinfo(SSI_NVPAIRS, (caddr_t) sbuf, 1, 0, 0) == 0)
printf("uatrap: unaligned access will now cause SIGBUS\n");
else {
fprintf(stderr, "uatrap: setsysinfo(): ");
if (errno < sys_nerr)
fprintf(stderr, sys_errlist[errno]);
else
fprintf(stderr, "errno = %d", errno);
fprintf(stderr, "\n");
}
exit(errno);
}
and to test it:
main()
{
char foo[10];
*(int *)(foo + 1) = 0xdeadbeef;
exit(42);
}
next prev parent reply other threads:[~1994-02-06 9:39 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
1994-02-05 21:21 unaligned access Stefan Monnier
1994-02-06 9:39 ` Jarkko Hietaniemi [this message]
-- strict thread matches above, loose matches on Subject: below --
2003-03-06 6:27 Unaligned access Emmanuel STAPF [ISE]
2000-03-31 5:00 Kraisit Vittinanon
2000-04-04 4:00 ` Oisin McGuinness
1998-03-31 5:00 Allen M. Cohen
1998-04-01 5:00 ` Joe Mario
1996-11-15 5:00 unaligned access gautam
1996-11-16 5:00 ` Dirk Grunwald
1996-11-20 5:00 ` Jeff Denham
1996-11-22 5:00 ` Curt Smith
1996-11-21 5:00 ` Anthony Berent
1995-05-20 4:00 Adrian Wenden
1995-05-22 4:00 ` Eric Osborne
1995-05-24 4:00 ` Vepa V Sirish
1995-05-25 4:00 ` John Wood
1993-11-30 22:25 Roland Schemers
1993-11-30 23:25 ` Matt Thomas
1993-12-01 12:06 ` Burkhard Neidecker-Lutz
1993-12-07 1:27 ` Jim Hurst
1993-02-23 15:55 Unaligned access Byron Jennings
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox