From owner-freebsd-hackers Sat Nov 2 08:40:39 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id IAA20628 for hackers-outgoing; Sat, 2 Nov 1996 08:40:39 -0800 (PST) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id IAA20607 for ; Sat, 2 Nov 1996 08:40:32 -0800 (PST) Received: (from bde@localhost) by godzilla.zeta.org.au (8.7.6/8.6.9) id DAA10756; Sun, 3 Nov 1996 03:31:12 +1100 Date: Sun, 3 Nov 1996 03:31:12 +1100 From: Bruce Evans Message-Id: <199611021631.DAA10756@godzilla.zeta.org.au> To: freebsd-hackers@FreeBSD.org, j@uriah.heep.sax.de Subject: Re: VM answer requested Sender: owner-hackers@FreeBSD.org X-Loop: FreeBSD.org Precedence: bulk >> I'd like to be able to turn on the bit so that I get a fault (and it >> kills the offending process) when an unaligned access occurs. > >Adding support for this should be fairly simple. I wonder why you Especially since it was added on 1995/01/14 in rev.1.46 of locore.s :-). Applications have to set PSL_AC when they want alignment faults. Alignment faults generate SIGBUS. gcc still generates misaligned accesses, e.g., --- struct foo { short x[2]; }; struct bar { short pad; struct foo r; } bar1, bar2; main() { asm("pushfl; popl %eax; orl $0x40000,%eax; pushl %eax; popfl"); bar1.r = bar2.r; /* trap */ } --- Bruce