Can't write value into memory ?(E500 V2)

Scott Wood scottwood at freescale.com
Thu Aug 27 05:20:31 EST 2009


On Wed, Aug 26, 2009 at 10:39:24PM +0800, wilbur.chan wrote:
> In  an assemblely code ,   I invalided all the TLB entries except for
> the entry  we are executed in.
> 
> After that , I setuped a 1:1 TLB entry mapping of 1GB .

What is it you're trying to do?

> At last , I wrote value 30 into the physical address 0x0400,0000 (also
> the virtual address because of my 1:1 mapping).
> 
> However, it seemed failed to store the value '30' at address
> 0x400,0000. The following is my code:
> 
> //code start
> 
> // setup a 1:1 mapping of 1GB
> ...

"..." is not code. :-)

> //store '30' into address 0x0400,0000
> 
> li  r23, 30
> lis r22, 0x400
> ori r22,r22,0x0
> stb  r23,0(r22)
> 
> 
> //check if we successfully store value at 0x400,0000
> 
> lis r22, 0x400
> ori r22,r22,0x0
> lwz r23,0(r22)
> cmpw r23, 30

The values should not be equal, since you wrote a byte and read back a
word.

Furthermore, you are storing the constant 30, but are comparing r23 with
the register r30 (I never liked that aspect of ppc asm syntax -- too
error prone).  If you want to compare with the constant 30, use "cmpwi".

> beq  print_equal
> 
> 1: b 1b
> 
> print_equal:
>  ...
> //code end
> 
> I found that, print_equal was not called ,the whole code seemed  to
> enter an  infinite loop.

That's because you have an infinite loop in your code, right after "beq
print_equal".

-Scott


More information about the Linuxppc-dev mailing list