On 01/07/11 20:55, Somebody in the thread at some point said:
..snip..
>>> I am inclined to think it might be compiler related. Andy's package is
>>> the same version as mine, his works, mine does not. The only thing that
>>> is likely to be different is the build environment.
>>
>> That and the development board. You are using a sheevaplug.
>> It is also likely that Andy's hardware does fixups for misaligned
>> accesses.
>
> It's an NXP LPC3250, ARM926EJ-S. I have no idea if the hardware is handling
> the alignment issue but that would explain why everything is exactly zero on
> that box's alignment error stats. Searching the datasheet for
'alignment'
> doesn't tell anything relevant.
A test would be to write a simple program like
Yeah... let's find out.
/tmp/x.c:
#include <stdio.h>
#include <string.h>
int main(int argc, char * argv[])
{
unsigned char buf[8];
unsigned int *p = (unsigned int *)&buf[1];
strcpy(buf, "abcdefg");
printf("0x%08x\n", *p);
return 0;
}
[root@ivmon tmp]# gcc -o x x.c
[root@ivmon tmp]# ./x
0x61646362
[root@ivmon tmp]# cat /proc/cpu/alignment
User: 1
System: 0
Skipped: 0
Half: 0
Word: 0
DWord: 0
Multi: 0
User faults: 0 (ignored)
[root@ivmon tmp]# ./x
0x61646362
[root@ivmon tmp]# cat /proc/cpu/alignment
User: 2
System: 0
Skipped: 0
Half: 0
Word: 0
DWord: 0
Multi: 0
User faults: 0 (ignored)
[root@ivmon tmp]#
Nothing is fixing it up, not even the kernel, and the data is broken.
So it's true my box is alignment error -clean after boot. I don't use
the Fedora sysvinit and instead come up in my own /etc/rc.d/rc.sysinit
as "init" at the moment.
-Andy