Hi, Ksh
你好!
我在使用skyeye的过程当中发现,在pxa27x cpu上的ldrb指令执行后的结果与我期望的不太一样,想请教一下
如果我在skyeye上执行 ldrb r0, addr
实际结果是 r0中存放着的内容原来内存中 (addr,addr+1,addr+2,addr+3)四个字节的内容,
但是根据arm架构参考手册上A3.11.4小节的例子来看,希望的结果似乎应该是
r0最低8位存放原来内存addr处的一个字节,高24位清零。
我不知道在实际的pxa机器上是什么样子,但是在omap上面应该是和arm手册上一致的,因为这个问题造成了
原来在omap上正常运行的代码出错,原因就是高24位没有清零。
你觉得这是skyeye的一个问题吗?还是说实际的pxa就是这样的?
谢谢!
宋昱鹏
2、我的测试用例如下:
/* place 0x10004000 to the address 0x1008000 */
mov r0, #0x10000000
add r0, r0, #0x4000
mov r1, #0x1000000
add r1, r1, #0x8000
str r0, [r1]
/* clear the value of 0*/
mov r0, #0x0
/* load the value at 0x1008000 to r0 by ldrb , to check the value of r0*/
mov r1, #0x1000000
add r1, r1, #0x8000
ldrb r0, [r1]
3、测试结果如下
Remote debugging using :12345
0x01000000 in begin ()
(gdb) break *0x01000024
(gdb) c
Continuing.
Breakpoint 2, 0x01000024 in begin ()
(gdb) info registers r0 r1
r0 0x0 0
r1 0x1000000 16777216
(gdb) disassemble 0x1000024 # Here , we have load the value
0x10004000 to the address 0x1008000
Dump of assembler code for function begin:
0x01000000 <begin+0>: mov r0, #147 ; 0x93
0x01000004 <begin+4>: msr CPSR_c, r0
0x01000008 <begin+8>: mov r0, #268435456 ; 0x10000000
0x0100000c <begin+12>: add r0, r0, #16384 ; 0x4000
0x01000010 <begin+16>: mov r1, #16777216 ; 0x1000000
0x01000014 <begin+20>: add r1, r1, #32768 ; 0x8000
0x01000018 <begin+24>: str r0, [r1]
0x0100001c <begin+28>: mov r0, #0 ; 0x0
0x01000020 <begin+32>: mov r1, #16777216 ; 0x1000000
0x01000024 <begin+36>: add r1, r1, #32768 ; 0x8000
0x01000028 <begin+40>: ldrb r0, [r1]
0x0100002c <begin+44>: mov r1, #210 ; 0xd2
0x01000030 <begin+48>: sub r2, r0, r1
0x01000034 <begin+52>: ldr sp, [pc, #4] ; 0x1000040 <begin+64>
0x01000038 <begin+56>: bl 0x1000050 <hello>
0x0100003c <begin+60>: b 0x1000000 <begin>
0x01000040 <begin+64>: tsteq r0, r0
(gdb) si
0x01000028 in begin ()
(gdb) info registers r0 r1 # here , r0 is clear and ldrb will
load the vlaue at 0x1008000 to r0.
r0 0x0 0
r1 0x1008000 16809984
(gdb) si
0x0100002c in begin ()
(gdb) info registers r0 r1 # here , r0 is loaded by ldrb with the
first byte , not filled by all the bytes of the value 0x10004000 at
0x1008000
r0 0x0 0
r1 0x1008000 16809984
(gdb) x 0x1008000
0x1008000: 0x10004000
(gdb)
Thanks
MK
2009/8/8 Michael.Kang <blackf...@gmail.com>: