kayws426 / embox

Automatically exported from code.google.com/p/embox
0 stars 1 forks source link

memcpy optimization lead to unaligned access #674

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.r12408; arm/ti816x
2.apply patch cpio_unalign.patch
3.build with -O2
4.run embox

What is the expected output? What do you see instead?
        unit: initializing embox.fs.rootfs: initfs_mount: unpack initinitfs at 0x81059aa8 into /
p_field 0x810dcbd0 raw 0x81059aae field_buff 0x810dcbc4
EXCEPTION:
r0=00000038 r1=00000002 r2=00000001 r3=00000000
r4=81059aae r5=810dcbd0 r6=810dcc20 r7=8105af4c
r8=00000000 r9=00000af0 r10=8072e5a8 r11=810dcc1c
r12=810dcaf8 r14=81009b40
cpsr=60000197 spsr=6000011f

Disassembler:
  5194         printk("p_field %p raw %p field_buff %p\n",
  5195 81009b2c:   e1a01005    mov r1, r5
  5196 81009b30:   e1a02004    mov r2, r4
  5197 81009b34:   e24b3058    sub r3, fp, #88 ; 0x58
  5198 81009b38:   e59f00d4    ldr r0, [pc, #212]  ; 81009c14 <cpio_parse_entry+0x138>
  5199 81009b3c:   eb00e189    bl  81042168 <printk>
  5200                 p_field, raw, field_buff);
  5201 
  5202         memcpy(&field_buff[0], (void *)raw, NEWC_FIELD_SZ);
  5203 81009b40:   e5940000    ldr r0, [r4]
  5204 81009b44:   e5941004    ldr r1, [r4, #4]

Please use labels and text to provide additional information.
gcc 4.7.2
objdump 2.23.1

Original issue reported on code.google.com by ki.stfu on 16 Jan 2014 at 2:38

Attachments:

GoogleCodeExporter commented 9 years ago
CPU configured to disable unaligned access, but compiler flags not specifies 
unaligned mode; seems that it's enabled to this arch by default

Original comment by drakon.m...@gmail.com on 16 Jan 2014 at 3:04

GoogleCodeExporter commented 9 years ago
fixed by r12409

Original comment by ki.stfu on 16 Jan 2014 at 3:07