From owner-freebsd-current Tue May 28 12:30:00 1996 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id MAA23299 for current-outgoing; Tue, 28 May 1996 12:30:00 -0700 (PDT) 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 SMTP id MAA23289 for ; Tue, 28 May 1996 12:29:52 -0700 (PDT) Received: (from bde@localhost) by godzilla.zeta.org.au (8.6.12/8.6.9) id FAA31591; Wed, 29 May 1996 05:25:44 +1000 Date: Wed, 29 May 1996 05:25:44 +1000 From: Bruce Evans Message-Id: <199605281925.FAA31591@godzilla.zeta.org.au> To: bde@zeta.org.au, terry@lambert.org Subject: Re: memset/memcopy vs bzero/bcopy Cc: current@FreeBSD.ORG, scrappy@ki.net Sender: owner-current@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >If we have a processor where we can turn on unaligned access exceptions, >and we turn them on, how much of the kernel code starts failing? I would None, because alignment checking is only done in ring 3 :-). On Pentiums you can count misaligned data references in counter 11. >like to see this flag on by default for P5 or better systems... the >better to encourage writing code that can run on RISC systems. The library certainly isn't well aligned. The following example dumps core in printf: int ef; main() { asm("pushfl; orl $0x40000,(%esp); popfl"); asm("pushfl; popl _ef"); printf("%x", ef); asm("pushfl; andl $~0x40000,(%esp); popfl"); } It works if 0 or 1 is printed instead of `ef' but fails if 0x40000 is printed instead of `ef' I know of only one compiler bug in this area. The builtin memcpy() doesn't bother aligning things. The builtin memcpy() is used for structs that aren't necessarily aligned. Bruce