for points of reference.. qemu f12 with a different kernel and the
default gurplug install
results from qemu f12 with new kernel:
root@fedora-arm ~]# cat /proc/cpu/alignment
User: 0
System: 0
Skipped: 0
Half: 0
Word: 0
DWord: 0
Multi: 0
User faults: 0 (ignored)
[root@fedora-arm ~]# vi x.c
[root@fedora-arm ~]# gcc -o x x.c
[root@fedora-arm ~]# ./x
0x65646362
[root@fedora-arm ~]# ./x
0x65646362
[root@fedora-arm ~]# ./x
0x65646362
[root@fedora-arm ~]# ./x
0x65646362
[root@fedora-arm ~]# cat /proc/cpu/alignment
User: 0
System: 0
Skipped: 0
Half: 0
Word: 0
DWord: 0
Multi: 0
User faults: 0 (ignored)
[root@fedora-arm ~]# gcc --version
gcc (GCC) 4.4.2 20091019 (Red Hat 4.4.2-5)
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[root@fedora-arm ~]# uname -a
Linux fedora-arm 2.6.36 #1 Wed Oct 27 16:28:38 EDT 2010 armv5tejl
armv5tejl armv5tejl GNU/Linux
[root@fedora-arm ~]#
Here are the results from guruplug default install (debian lenny):
root@sheevaplug-debian:~# cat /proc/cpu/alignment
User: 0
System: 0
Skipped: 0
Half: 0
Word: 0
DWord: 0
Multi: 0
User faults: 0 (ignored)
root@sheevaplug-debian:~# vi x.c
root@sheevaplug-debian:~# gcc -o x x.c
root@sheevaplug-debian:~# ./x
0x61646362
root@sheevaplug-debian:~# ./x
0x61646362
root@sheevaplug-debian:~# ./x
0x61646362
root@sheevaplug-debian:~# ./x
0x61646362
root@sheevaplug-debian:~# cat /proc/cpu/alignment
User: 4
System: 0
Skipped: 0
Half: 0
Word: 0
DWord: 0
Multi: 0
User faults: 0 (ignored)
root@sheevaplug-debian:~#
root@sheevaplug-debian:~# gcc --version
gcc (Debian 4.3.2-1.1) 4.3.2
root@sheevaplug-debian:~# uname -a
Linux sheevaplug-debian 2.6.32-00007-g56678ec #1 PREEMPT Mon Feb 8
03:49:55 PST 2010 armv5tel GNU/Linux
root@sheevaplug-debian:~#
Quoting Andy Green <andy(a)warmcat.com>:
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.