From: Scott Wood <scottwood@freescale.com>
To: "wilbur.chan" <wilbur512@gmail.com>
Cc: linuxppc-dev@ozlabs.org
Subject: Re: Can't write value into memory ?(E500 V2)
Date: Wed, 26 Aug 2009 14:20:31 -0500 [thread overview]
Message-ID: <20090826192030.GA17027@b07421-ec1.am.freescale.net> (raw)
In-Reply-To: <e997b7420908260739u49fb4b36j9eb148782829547b@mail.gmail.com>
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
next prev parent reply other threads:[~2009-08-26 19:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-26 14:39 Can't write value into memory ?(E500 V2) wilbur.chan
2009-08-26 19:20 ` Scott Wood [this message]
2009-08-27 15:53 ` wilbur.chan
2009-08-27 15:59 ` Scott Wood
2009-08-27 16:27 ` wilbur.chan
2009-08-27 16:34 ` Scott Wood
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090826192030.GA17027@b07421-ec1.am.freescale.net \
--to=scottwood@freescale.com \
--cc=linuxppc-dev@ozlabs.org \
--cc=wilbur512@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).