From: "Christian Groessler" <cpg@aladdin.de>
To: axp-list@redhat.com
Cc: "Sean Hunter" <sean@uncarved.co.uk>
Subject: Re: Unaligned traps et al
Date: Thu, 19 Aug 1999 10:52:55 +0100 [thread overview]
Message-ID: <412567D2.0037281A.00@saturn.aladdin.de> (raw)
Hi,
On 8/18/99 10:23:49 PM Sean Hunter wrote:
>
>The trouble is, you need to use setsysinfo to get your program to do
>this, which is fine for stuff you're writing, but a pain for other
>programs. What I propose is to set up a sysctl so that it will
>automatically set this behaviour as desired. This means that normally
>you just leave this as is, bit if you feel like doing a spot o'
>debugging you can echo "some_magic" >> /proc/sys/kernel/uac_control,
>and all newly-started process will automatically have the correct
>behaviour set in the tss, and will SIGBUS and coredump on encountering
>the unaligned trap. Similarly, if you attempting to show a prototype
>port to your boss, and don't what to be embarrassed by the unaligned
>traps you haven't fixed yet, you echo some magic to the same place to
>turn the messages off.
The following program creates a subshell and all programs
started from therein will SIGBUS on unaligned accesses.
----------------------
/* 28-May-98, chris */
#ifndef __linux__
#include <sys/sysinfo.h>
#else
#include <asm/sysinfo.h>
#include <asm/unistd.h>
static int setsysinfo(unsigned long op, void *buffer, unsigned long size,
int *start, void *arg, unsigned long flag)
{
syscall(__NR_osf_setsysinfo, op, buffer, size, start, arg, flag);
}
#endif
void trap_unaligned(void)
{
unsigned int buf[2];
buf[0] = SSIN_UACPROC;
buf[1] = UAC_SIGBUS | UAC_NOPRINT;
setsysinfo(SSI_NVPAIRS, buf, 1, 0, 0, 0);
}
int main(int ac)
{
trap_unaligned();
printf("creating subshell with SIGBUS setting!\n");
execl("/bin/bash","/bin/bash",(char *)0);
return(0); /* not reached */
}
----------------------
regards,
chris
next reply other threads:[~1999-08-19 8:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-08-19 9:52 Christian Groessler [this message]
1999-08-19 10:12 ` Unaligned traps et al Sean Hunter
-- strict thread matches above, loose matches on Subject: below --
1999-08-18 21:50 Jano Lukac
1999-08-18 22:10 ` Sean Hunter
1999-08-18 16:38 Paul Jakma
1999-08-18 13:47 Sean Hunter
1999-08-18 16:26 ` Dan Morrill
[not found] ` <199908181556.JAA28448@ellpspace.math.ualberta.ca>
1999-08-18 21:23 ` Sean Hunter
1999-08-18 23:11 ` Richard Henderson
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