How to trap unaligned accesses on Ultrix/MIPS?

Arndt Jonasson arndt at zyx.ZYX.SE
Sat Feb 23 02:46:08 AEST 1991


Environment: DECStation (MIPS), Ultrix 4.1.

When a process accesses a word of memory on a non-aligned address, the
kernel fixes up the access, and optionally prints a message. This message
can be turned off with the 'uac' command.

For debugging purposes, it would be much more convenient if the kernel
didn't fix up the access, and sent a signal to the process instead
(e.g., "bus error" or "segmentation violation"). Is it possible to
make this happen?

/*
  When this program runs, it should get a signal on at least one of the
  marked lines.
*/
main ()
{
   char *kaka = "vanilj";
   int *ip;

   ip = (int *) kaka;
   *ip = 1;			/* XXX */
   ip = (int *) (kaka+1);
   *ip = 2;			/* XXX */
}
-- 
Arndt Jonasson, ZYX AB, Styrmansgatan 6, 114 54 Stockholm, Sweden
email address:   arndt at zyx.SE   or      <backbone>!mcsun!sunic!zyx!arndt



More information about the Comp.unix.ultrix mailing list