From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <93bac309c98e6202fc6cf35886d3587d.axp-list@archive.invalid> X-Archive-Original-Message-ID: <199709240110.VAA12106@linux03.amt.tay1.dec.com> Date: Tue, 23 Sep 1997 21:28:48 -0400 From: Jim Paradis Subject: Re: This may be a really dumb question Sheer Panic wrote: > > But what _exactly_ causes an unaligned trap on the kernel? Unaligned accesses 8-) The Alpha architecture requires that memory operations take place on "natural" boundaries; e.g. the effective address of a longword load/store must be 0 MOD 4, the effective address of a quadword load/store must be 0 MOD 8, etc. Accesses that violate these rules are called "unaligned" accesses; they are not supported by the processor, and they cause an exception when they occur. Imposing the requirement of aligned accesses saves a *lot* of silicon that can be put to other uses (reduces the amount of shift logic required to line up the appropriate byte lanes with the register file, and streamlines the cache address logic, among other things). Every sane operating system for Alpha includes an "unaligned access" handler which intercepts these exceptions and performs the desired memory access in software. Needless to say, this is *VERY* inefficient; instead of executing one memory access instruction, you've just executed several hundred in the act of taking the exception, simulating the unaligned access, and returning to the main code. You also may have messed up your I-cache and branch-prediction stacks too. This is why the kernel prints a message when an unaligned access occurs; it's to encourage you VERY STRONGLY to root them out in the source and avoid the massive performance penalty. -- Jim Paradis jrp@jrp.tiac.net http://www.tiac.net/users/jrp/index.html "It's not procrastination, it's my new Just-In-Time Workload Management System!" -- To unsubscribe: send e-mail to axp-list-request@redhat.com with 'unsubscribe' as the subject. Do not send it to axp-list@redhat.com