Discussion:
Help needed: Alignment trap not handling instruction edcd1106
tao yuan
2005-05-06 16:39:09 UTC
Permalink
HI all,
I am working on PXA270 and meet problems when using WMMX
instruction in kernel, it reports a aligbment trap problem and system
OOps. BTW: I mapped PXA270 256K SRAM to 0xBF000000 and let some code
reside in SRAM, The code had been successfully working for a long
time but now it reports this error, after some changes in device
drivers which should not impact it at all.

Video Stream: pid = 0x200, plain.
Audio Stream: pid = 0x28a, plain.
PCR Stream: pid = 0x1ffe, plain.
Start to play...
Alignment trap: not handling instruction edcd1106 at [<bf002e8c>]
Unhandled fault: alignment exception (0x813) at 0xc3d999d4
pgd = c0004000
[c3d999d4] *pgd=a3c0042e(bad)
Internal error: Oops: 0 [#1]
Modules linked in:
CPU: 0
PC is at 0xbf002e90
LR is at 0xc3d99adf
pc : [<bf002e90>] lr : [<c3d99adf>] Not tainted
sp : c3d999bc ip : 00000008 fp : bf003b40
r10: 00000004 r9 : 00000000 r8 : 0000000f
r7 : 00000000 r6 : c026cd24 r5 : 00040000 r4 : c3d99ad8
r3 : c026d584 r2 : 04040404 r1 : 04040404 r0 : 00000001
Flags: nZCv IRQs on FIQs on Mode SVC_32 Segment kernel
Control: 397F Table: A38F8000 DAC: 0000001D
Process movie-player (pid: 644, stack limit = 0xc3d981a0)
Stack: (0xc3d999bc to 0xc3d9a000)
99a0: 04040404
99c0: 04040404 00000017 00000017 00000017 00000017 00000017 00000017 00000017
99e0: 00000017 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9a00: 00000000 c026cdd8 c026ce94 c026cf50 c026d00c c026d57c c026c7f4 c3d99ad8
9a20: c026d2fc c026c800 c026c8bc c026c978 c026ca34 c026caf0 c026cbac c026cc68
9a40: c026cd24 02000000 c00d8888 60000013 ffffffff 000000bc c3d99ad8 c3d99a68
9a60: c0020360 c0021498 c3d99da8 c5907ee4 fffffff4 8498a0c6 d8f6e205 62e62789
9a80: 1974806b e33515af a058d566 7da80692 000000bc c3d99ad8 80000013 c3d99cec
9aa0: 000000bc c3d00b7c c3d99cec 00000000 000000bc c3d99ad8 c3d99ac4 c002bfb8
9ac0: c002bf20 00000000 c3d99cec c3d99b2c c3d99adc c016bb90 00000000 00000000
9ae0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9b00: 00000000 00000000 00000000 00000000 00000000 00000000 c3d99c64 c3d99c74
9b20: c3d99c84 c3d99dc8 00001fff c3d99cec c3d99c64 c3d99da8 c3d99ff4 c3d99b48
9b40: bf0021c4 bf001618 00001ffe 00000000 00001fff 00001fff 00001fff 00001fff
9b60: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9b80: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9ba0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9bc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9be0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9c00: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9c20: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9c40: 00000000 00000000 00000000 00000000 00000000 00000000 c3d98000 00000125
9c60: c3d8cc20 00000ce1 00000200 0000028a 00000101 00001ffe 00000000 00001fff
9c80: 00001fff 00001fff 00001fff 00000e21 00000ec1 c01d8698 c0024d2c 00000000
9ca0: c3d8cc54 00000000 00000010 00000101 00000102 00000103 00000104 00000105
9cc0: 00000106 00000107 00000108 00000109 0000010a c3d99fb0 c0020718 c01d862c
9ce0: 00000000 00000000 00000006 1d240147 0339fc9e eaa97046 e8e55dd9 30b05807
9d00: 3e8c8271 def4d6b9 8dd1d246 74db15b2 60e2e3c5 1ef5006b c451686f df89939f
9d20: 979df6e6 5172ea01 18c1b6f1 dbf361a7 ef5a4964 b3593719 9326265a d70aa72e
9d40: aa82eb5c 5ab29179 039de42e 00e04cb7 00000000 00000000 00000000 00000000
9d60: 00000000 00000000 00000000 00000000 00000000 13010000 aa90763a e33515af
9d80: a058d566 7da80692 82ec3479 a6631f0d 024c80aa 48036262 1974806b 8498a0c6
9da0: d8f6e205 62e62789 00000ce1 00000200 0000028a 00000101 00001ffe 00000000
9dc0: 00001fff 00001fff 00001fff 00001fff 00000000 00000000 00000000 00000000
9de0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9e00: 00000000 00000000 00000000 00000000 00000000 00000ce1 00000200 0000028a
9e20: 00001ffe 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9e40: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9e60: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9e80: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9ea0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9ec0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9ee0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9f00: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9f20: 00000000 00000000 00000000 00000000 00000000 0000000b 00000000 00000ce1
9f40: 00000d62 00000da1 00000dc1 00000dc3 00000de6 00000de7 00000e01 00000e21
9f60: 00000ec1 c01d8698 c0024d2c 00000000 c3d8cc54 00000000 00000010 00000101
9f80: 00000102 00000103 00000104 00000105 00000106 00000107 00000108 00000109
9fa0: 0000010a c3d99fb0 c0020718 c01d862c 00000000 00000000 00000006 2d627664
9fc0: 79616c70 00007265 00000000 00000000 00000000 00000000 00000000 00000000
9fe0: 00000000 00000000 00000000 c3d99ff8 c0030d24 bf001e10 00000000 00000000
Backtrace: invalid frame pointer 0xbf003b40
Code: 1e11100e 0e111009 ee111000 edcd1106 (ee388008)



Can anybody give me some hints on this? Instruction edcd1106 comes
from assembly code and AREG_OFFSET was defined to be 0:
... ...
scypher_initAB:

@ generate mask for even/odd ck, 0-even, 1-odd
ldr r5, [r1]
ldr r1, [r1, #4]
ldr r9, [sp, #STACK_CKODD_OFFSET]
ldr r6, [r3] @ ck[0]-ck[3] even
mov r5, #0
tmcrr wr11, r5, r1 @ mask of even/odd key

ldr r7, [r9] @ ck[0]-ck[3] odd

mov r8, r6, lsr #4
and r8, r8, #0xf @ A[1] even
tbcstb wr0,r8
mov r8, r7, lsr #4
and r8, r8, #0xf @ A[1] odd
tbcstb wr1,r8
wand wr1,wr1,wr11
wandn wr0,wr0,wr11
wor wr0,wr0,wr1 @ A[1]
wstrd wr0,[r11,#AREG_OFFSET+8] @ < ---- will cause align exception
and r8, r6, #0xf @ A[2] even
tbcstb wr1,r8
and r8, r7, #0xf @ A[2] odd
tbcstb wr2,r8
wand wr2,wr2,wr11
wandn wr1,wr1,wr11
wor wr1,wr1,wr2 @ A[2]
wstrd wr1,[r11,#AREG_OFFSET+8*2]

mov r8, r6, lsr #12
and r8, r8, #0xf @ A[3] even


Thanks a lot!

Tao

-------------------------------------------------------------------
Subscription options: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel
FAQ: http://www.arm.linux.org.uk/armlinux/mlfaq.php
Etiquette: http://www.arm.linux.org.uk/armlinux/mletiquette.php
tao yuan
2005-05-06 16:40:22 UTC
Permalink
Sorry forgot the kernel version information, I am using linux 2.6.9
with some changes, mostly some device drivers, etc.

Thanks,

Tao
Post by tao yuan
HI all,
I am working on PXA270 and meet problems when using WMMX
instruction in kernel, it reports a aligbment trap problem and system
OOps. BTW: I mapped PXA270 256K SRAM to 0xBF000000 and let some code
reside in SRAM, The code had been successfully working for a long
time but now it reports this error, after some changes in device
drivers which should not impact it at all.
Video Stream: pid = 0x200, plain.
Audio Stream: pid = 0x28a, plain.
PCR Stream: pid = 0x1ffe, plain.
Start to play...
Alignment trap: not handling instruction edcd1106 at [<bf002e8c>]
Unhandled fault: alignment exception (0x813) at 0xc3d999d4
pgd = c0004000
[c3d999d4] *pgd=a3c0042e(bad)
Internal error: Oops: 0 [#1]
CPU: 0
PC is at 0xbf002e90
LR is at 0xc3d99adf
pc : [<bf002e90>] lr : [<c3d99adf>] Not tainted
sp : c3d999bc ip : 00000008 fp : bf003b40
r10: 00000004 r9 : 00000000 r8 : 0000000f
r7 : 00000000 r6 : c026cd24 r5 : 00040000 r4 : c3d99ad8
r3 : c026d584 r2 : 04040404 r1 : 04040404 r0 : 00000001
Flags: nZCv IRQs on FIQs on Mode SVC_32 Segment kernel
Control: 397F Table: A38F8000 DAC: 0000001D
Process movie-player (pid: 644, stack limit = 0xc3d981a0)
Stack: (0xc3d999bc to 0xc3d9a000)
99a0: 04040404
99c0: 04040404 00000017 00000017 00000017 00000017 00000017 00000017 00000017
99e0: 00000017 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9a00: 00000000 c026cdd8 c026ce94 c026cf50 c026d00c c026d57c c026c7f4 c3d99ad8
9a20: c026d2fc c026c800 c026c8bc c026c978 c026ca34 c026caf0 c026cbac c026cc68
9a40: c026cd24 02000000 c00d8888 60000013 ffffffff 000000bc c3d99ad8 c3d99a68
9a60: c0020360 c0021498 c3d99da8 c5907ee4 fffffff4 8498a0c6 d8f6e205 62e62789
9a80: 1974806b e33515af a058d566 7da80692 000000bc c3d99ad8 80000013 c3d99cec
9aa0: 000000bc c3d00b7c c3d99cec 00000000 000000bc c3d99ad8 c3d99ac4 c002bfb8
9ac0: c002bf20 00000000 c3d99cec c3d99b2c c3d99adc c016bb90 00000000 00000000
9ae0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9b00: 00000000 00000000 00000000 00000000 00000000 00000000 c3d99c64 c3d99c74
9b20: c3d99c84 c3d99dc8 00001fff c3d99cec c3d99c64 c3d99da8 c3d99ff4 c3d99b48
9b40: bf0021c4 bf001618 00001ffe 00000000 00001fff 00001fff 00001fff 00001fff
9b60: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9b80: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9ba0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9bc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9be0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9c00: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9c20: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9c40: 00000000 00000000 00000000 00000000 00000000 00000000 c3d98000 00000125
9c60: c3d8cc20 00000ce1 00000200 0000028a 00000101 00001ffe 00000000 00001fff
9c80: 00001fff 00001fff 00001fff 00000e21 00000ec1 c01d8698 c0024d2c 00000000
9ca0: c3d8cc54 00000000 00000010 00000101 00000102 00000103 00000104 00000105
9cc0: 00000106 00000107 00000108 00000109 0000010a c3d99fb0 c0020718 c01d862c
9ce0: 00000000 00000000 00000006 1d240147 0339fc9e eaa97046 e8e55dd9 30b05807
9d00: 3e8c8271 def4d6b9 8dd1d246 74db15b2 60e2e3c5 1ef5006b c451686f df89939f
9d20: 979df6e6 5172ea01 18c1b6f1 dbf361a7 ef5a4964 b3593719 9326265a d70aa72e
9d40: aa82eb5c 5ab29179 039de42e 00e04cb7 00000000 00000000 00000000 00000000
9d60: 00000000 00000000 00000000 00000000 00000000 13010000 aa90763a e33515af
9d80: a058d566 7da80692 82ec3479 a6631f0d 024c80aa 48036262 1974806b 8498a0c6
9da0: d8f6e205 62e62789 00000ce1 00000200 0000028a 00000101 00001ffe 00000000
9dc0: 00001fff 00001fff 00001fff 00001fff 00000000 00000000 00000000 00000000
9de0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9e00: 00000000 00000000 00000000 00000000 00000000 00000ce1 00000200 0000028a
9e20: 00001ffe 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9e40: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9e60: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9e80: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9ea0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9ec0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9ee0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9f00: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9f20: 00000000 00000000 00000000 00000000 00000000 0000000b 00000000 00000ce1
9f40: 00000d62 00000da1 00000dc1 00000dc3 00000de6 00000de7 00000e01 00000e21
9f60: 00000ec1 c01d8698 c0024d2c 00000000 c3d8cc54 00000000 00000010 00000101
9f80: 00000102 00000103 00000104 00000105 00000106 00000107 00000108 00000109
9fa0: 0000010a c3d99fb0 c0020718 c01d862c 00000000 00000000 00000006 2d627664
9fc0: 79616c70 00007265 00000000 00000000 00000000 00000000 00000000 00000000
9fe0: 00000000 00000000 00000000 c3d99ff8 c0030d24 bf001e10 00000000 00000000
Backtrace: invalid frame pointer 0xbf003b40
Code: 1e11100e 0e111009 ee111000 edcd1106 (ee388008)
Can anybody give me some hints on this? Instruction edcd1106 comes
... ...
@ generate mask for even/odd ck, 0-even, 1-odd
ldr r5, [r1]
ldr r1, [r1, #4]
ldr r9, [sp, #STACK_CKODD_OFFSET]
mov r5, #0
mov r8, r6, lsr #4
tbcstb wr0,r8
mov r8, r7, lsr #4
tbcstb wr1,r8
wand wr1,wr1,wr11
wandn wr0,wr0,wr11
tbcstb wr1,r8
tbcstb wr2,r8
wand wr2,wr2,wr11
wandn wr1,wr1,wr11
wstrd wr1,[r11,#AREG_OFFSET+8*2]
mov r8, r6, lsr #12
Thanks a lot!
Tao
-------------------------------------------------------------------
Subscription options: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel
FAQ: http://www.arm.linux.org.uk/armlinux/mlfaq.php
Etiquette: http://www.arm.linux.org.uk/armlinux/mletiquette.php
Nicolas Pitre
2005-05-06 17:08:32 UTC
Permalink
Post by tao yuan
HI all,
I am working on PXA270 and meet problems when using WMMX
instruction in kernel, it reports a aligbment trap problem and system
OOps. BTW: I mapped PXA270 256K SRAM to 0xBF000000 and let some code
reside in SRAM, The code had been successfully working for a long
time but now it reports this error, after some changes in device
drivers which should not impact it at all.
Video Stream: pid = 0x200, plain.
Audio Stream: pid = 0x28a, plain.
PCR Stream: pid = 0x1ffe, plain.
Start to play...
Alignment trap: not handling instruction edcd1106 at [<bf002e8c>]
Unhandled fault: alignment exception (0x813) at 0xc3d999d4
pgd = c0004000
[c3d999d4] *pgd=a3c0042e(bad)
Internal error: Oops: 0 [#1]
CPU: 0
PC is at 0xbf002e90
LR is at 0xc3d99adf
pc : [<bf002e90>] lr : [<c3d99adf>] Not tainted
sp : c3d999bc ip : 00000008 fp : bf003b40
So 0xc3d999bc - 24 = C3D999A4 which is _not_ 64-bit aligned.
And don't expect the alignment trap handler to ever suport those.

Oh and btw iWMMXt in the kernel is forbiden for the same reasons as
floating point is. Move it to user space.


Nicolas

-------------------------------------------------------------------
Subscription options: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel
FAQ: http://www.arm.linux.org.uk/armlinux/mlfaq.php
Etiquette: http://www.arm.linux.org.uk/armlinux/mletiquette.php
tao yuan
2005-05-07 02:28:41 UTC
Permalink
Thanks for your advice! One more question, I do not know why iWMMXt
can't be used as float point in kernel. We can't use F.P in kernel
b/c kernel can't do FP emulation for kernel, if the CPU do not have
FPU if I recall correctly, but does things still the same if the
CPU has FPU??

For iWMMXt, in fact I had a kernel thread run in a big while circle
and execute some iWMMXt instructions and seems works well..... and
this is the reason why I have the question.

Cound you please give more comments?

Thanks a lot!

Tao
Post by Nicolas Pitre
Oh and btw iWMMXt in the kernel is forbiden for the same reasons as
floating point is. Move it to user space.
Nicolas
-------------------------------------------------------------------
Subscription options: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel
FAQ: http://www.arm.linux.org.uk/armlinux/mlfaq.php
Etiquette: http://www.arm.linux.org.uk/armlinux/mletiquette.php
Nicolas Pitre
2005-05-09 19:40:27 UTC
Permalink
Post by tao yuan
Thanks for your advice! One more question, I do not know why iWMMXt
can't be used as float point in kernel. We can't use F.P in kernel
b/c kernel can't do FP emulation for kernel, if the CPU do not have
FPU if I recall correctly, but does things still the same if the
CPU has FPU??
It's more a matter of context. Since only the general purpose registers
are preserved when switching from a process context to a kernel
exception (preserving/restoring the FP registers or emulated equivalents
would be too costly) you can't use them or upon returning to user space
they'll be corrupted.
Post by tao yuan
For iWMMXt, in fact I had a kernel thread run in a big while circle
and execute some iWMMXt instructions and seems works well..... and
this is the reason why I have the question.
For a pure kernel thread this is probably OK since it is seen like
another process and full task switching is taking place. But iWMMXt nor
FP can be used from any exception
context since you're then running over a standard process which has no
idea about being interrupted.

Of course if you do the wrong thing you might notice the corruption only
randomly and the problem probably won't be easily reproducible.


Nicolas

-------------------------------------------------------------------
Subscription options: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel
FAQ: http://www.arm.linux.org.uk/armlinux/mlfaq.php
Etiquette: http://www.arm.linux.org.uk/armlinux/mletiquette.php
tao yuan
2005-05-10 23:10:12 UTC
Permalink
Post by Nicolas Pitre
Post by tao yuan
Thanks for your advice! One more question, I do not know why iWMMXt
can't be used as float point in kernel. We can't use F.P in kernel
b/c kernel can't do FP emulation for kernel, if the CPU do not have
FPU if I recall correctly, but does things still the same if the
CPU has FPU??
It's more a matter of context. Since only the general purpose registers
are preserved when switching from a process context to a kernel
exception (preserving/restoring the FP registers or emulated equivalents
would be too costly) you can't use them or upon returning to user space
they'll be corrupted.
Thanks for point me out!
Post by Nicolas Pitre
Post by tao yuan
For iWMMXt, in fact I had a kernel thread run in a big while circle
and execute some iWMMXt instructions and seems works well..... and
this is the reason why I have the question.
For a pure kernel thread this is probably OK since it is seen like
another process and full task switching is taking place. But iWMMXt nor
FP can be used from any exception
context since you're then running over a standard process which has no
idea about being interrupted.
Of course if you do the wrong thing you might notice the corruption only
randomly and the problem probably won't be easily reproducible.
Yes, after call local_irq_disable before call iWMMXt instruction and
call local_irq_enable after call iWMMXt instruction the alignment trap
goes away, though this is not the case we need.

Does it also means if we preserve iWMMXt registers at the entry of
exception/interrupts and restore them when got out, we can solve this
problem?

Thanks,

Tao
Post by Nicolas Pitre
Nicolas
-------------------------------------------------------------------
Subscription options: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel
FAQ: http://www.arm.linux.org.uk/armlinux/mlfaq.php
Etiquette: http://www.arm.linux.org.uk/armlinux/mletiquette.php

Loading...