[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Error msg - unaligned trap



> Why do I get this, when I run netstat on my woody. I get a similar
> error when i run emacs. I only work in tty-mode, no xserver installed
> (my S3 Trio64 isn't supported by xserver-xfree86 v. 4.1.0).
>
> netstat(5719): unaligned trap at 00000200000b354c: 0000000120038cc4 2d 7

The Alpha CPU is a 64-bit chip. Therefore, each time a program requests a
memory address to be loaded to its registers (to do most kinds of work you
have to load specific words to the CPU's registers), the word must be
64-bit aligned. What does this mean? Suppose you have the following
information on your memory, starting from (to oversimplify things) address
0x0000000000000000:

|       |       |       |       |       |
asdfghjklqwertyuiopzxcvbnm1234567890etc...

The marks I did over them are (if I typed it correctly ;-) ) at each
8th byte - Every 64th bit.

If your program requests what it thinks to be a 32-bit word starting at
0x0000000000000004 (it wants to access 'ghjk'), the CPU cannot satisfy its
request, and raises an exception - this means, it tells the kernel that
something didn't work as it should have. The kernel sees what happened,
and determines it was an 'unaligned trap' - The program requested a word
that was not properly aligned to your CPU's aligning needs. Then, the
kernel fetches the 64-bit word found at 0x0000000000000000 ('asdfghjk'),
and hands back to the program what it requested. Of course, this takes up
time... And is not the desired behavior.

Why does this happen? Most times, I don't really know. It usually is
because GCC may be a great 32-bit compiler, but is not so great when
producing 64-bit code (I think this has been getting better with the
latest releases). Sometimes, it is because some applications require
better control than what a program generally needs... For example, I used
Postgres (6.5.3, I think) on my Alpha. It really sucked. Each time I did a
query, I had an unaligned trap. This is because a database requires to
maximize speed and storage efficiency, sometimes using even bit-level
access. Of course, Postgres was not developed on an Alpha :) )

Things are getting easier - More and more people are getting 64-bit
machines. When IA64 becomes popular, mostly everything will work correctly
on our beloved CPUs. :)

------------------------------------------------------------
Gunnar Wolf - gwolf@campus.iztacala.unam.mx - (+52)5623-1118
Desarrollo y Admon. de Sistemas en Red - FES Iztacala - UNAM
Departamento de Seguridad en Computo   -   DGSCA    -   UNAM
------------------------------------------------------------
Quidquid latine dictum sit, altum viditur.



Reply to: