Checked the same code under 4.7. linaro 4.7-2013.04-20130415 does not have
this problem. Note instruction at 0x8030602c that does store relative $r7
and it updates $r7. Whereas in 4.8 similar instruction comes at address
0x80319548 which is after instruction that corrupts saved on stack register.
4.7 vs 4.8
----------
Checked the same code under 4.7. linaro 4.7-2013. 04-20130415 does not have
this problem. Note instruction at 0x8030602c that does store relative $r7
and it updates $r7. Whereas in 4.8 similar instruction comes at address
0x80319548 which is after instruction that corrupts saved on stack register.
4.7
---
(gdb) disassemble xhci_check_ trb_in_ td_math trb_in_ td_math: ------- ------- -- ------- ------- -- ------- ------- -- ------- ------- -----
Dump of assembler code for function xhci_check_
0x8030600c <+0>: stmdb sp!, {r4, r5, r6, r7, r8, r9, r10, r11, lr} <---
0x80306010 <+4>: sub sp, #436 ; 0x1b4 <------
0x80306012 <+6>: push {lr} <------
0x80306014 <+8>: bl 0x8000cdcc <__gnu_mcount_nc> <------------------
0x80306018 <+12>: add r7, sp, #432 ; 0x1b0 <------
0x8030601a <+14>: mov r9, r0
0x8030601c <+16>: ldr r1, [r0, #116] ; 0x74
0x8030601e <+18>: add r3, sp, #176 ; 0xb0
0x80306020 <+20>: ldr r2, [r0, #96] ; 0x60
0x80306022 <+22>: movs r0, #0
0x80306024 <+24>: movs r4, #0
0x80306026 <+26>: ldr.w r8, [r1]
0x8030602a <+30>: movs r1, #0
0x8030602c <+32>: strd r0, r1, [r7, #-384]! ; 0x180 <--------------
0x80306030 <+36>: mov r6, r4
0x80306032 <+38>: ldr r2, [r2, #0]
0x80306034 <+40>: ldr.w r1, [r8]
0x80306038 <+44>: str r4, [sp, #40] ; 0x28
0x8030603a <+46>: ldrd r10, r11, [r2, #8]
0x8030603e <+50>: add.w r0, r1, #1008 ; 0x3f0
0x80306042 <+54>: str r1, [sp, #28]
0x80306044 <+56>: str r0, [sp, #44] ; 0x2c
0x80306046 <+58>: ldrd r0, r1, [r8, #8]
0x8030604a <+62>: strd r10, r11, [sp, #32]
0x8030604e <+66>: ldrd r10, r11, [r8, #8]
0x80306052 <+70>: adds r1, #64 ; 0x40
0x80306054 <+72>: ldr r5, [r2, #0]
0x80306056 <+74>: adc.w r0, r0, #0
0x8030605a <+78>: str.w r8, [r3]
0x8030605e <+82>: subs.w r11, r11, #16
0x80306062 <+86>: strd r0, r1, [r3, #112] ; 0x70
0x80306066 <+90>: ldrd r0, r1, [r8, #8]
0x8030606a <+94>: adc.w r10, r10, #4294967295
0x8030606e <+98>: strd r10, r11, [r7, #16] <------
4.8
---
(gdb) disassemble xhci_check_ trb_in_ td_math trb_in_ td_math: ------- ------- -- ------- ------- -- ------- ------- -- ------- ------- ------- --
Dump of assembler code for function xhci_check_
0x803194e4 <+0>: stmdb sp!, {r4, r5, r6, r7, r8, r9, r10, r11, lr} <---
0x803194e8 <+4>: sub sp, #444 ; 0x1bc <------
0x803194ea <+6>: push {lr} <------
0x803194ec <+8>: bl 0x8000cc8c <__gnu_mcount_nc> <------------------
0x803194f0 <+12>: mov r9, r0
0x803194f2 <+14>: movs r5, #0
0x803194f4 <+16>: ldr r0, [r0, #116] ; 0x74
0x803194f6 <+18>: mov r11, r5
0x803194f8 <+20>: ldr.w r1, [r9, #96] ; 0x60
0x803194fc <+24>: add.w lr, sp, #184 ; 0xb8
0x80319500 <+28>: str r5, [sp, #32]
0x80319502 <+30>: add r7, sp, #440 ; 0x1b8 <------
0x80319504 <+32>: ldr.w r8, [r0]
0x80319508 <+36>: ldr r0, [r1, #0]
0x8031950a <+38>: str r5, [sp, #36] ; 0x24
0x8031950c <+40>: str r5, [sp, #52] ; 0x34
0x8031950e <+42>: ldrd r4, r5, [r8, #8]
0x80319512 <+46>: ldr r2, [r0, #0]
0x80319514 <+48>: ldr.w r10, [r8]
0x80319518 <+52>: adds.w r3, r5, #64 ; 0x40
0x8031951c <+56>: str.w r8, [lr]
0x80319520 <+60>: str.w r2, [lr, #68] ; 0x44
0x80319524 <+64>: adc.w r2, r4, #0
0x80319528 <+68>: strd r2, r3, [lr, #112] ; 0x70
0x8031952c <+72>: subs.w r3, r5, #16
0x80319530 <+76>: adc.w r2, r4, #4294967295
0x80319534 <+80>: add.w r6, r10, #1008 ; 0x3f0
0x80319538 <+84>: strd r2, r3, [r7, #16] <------
0x8031953c <+88>: ldrd r2, r3, [sp, #32]
0x80319540 <+92>: str r6, [sp, #48] ; 0x30
0x80319542 <+94>: str.w r6, [lr, #8]
0x80319546 <+98>: mov r6, r11
0x80319548 <+100>: strd r2, r3, [r7, #-384]! ; 0x180 <---------------
0x8031954c <+104>: movw r3, #12272 ; 0x2ff0
0x80319550 <+108>: movt r3, #32859 ; 0x805b