* [9fans] ARM question
@ 2005-03-10 21:55 Ronald G. Minnich
2005-03-10 22:05 ` Russ Cox
0 siblings, 1 reply; 9+ messages in thread
From: Ronald G. Minnich @ 2005-03-10 21:55 UTC (permalink / raw)
To: 9fans
here's the code in c:
#include <u.h>
#include <libc.h>
y(){
unsigned long *x;
x = (unsigned long *) 0x4000;
*x = (unsigned long) 0x40e;
}
main(){
unsigned long *x;
static unsigned long y[64];
int i;
x = (unsigned long *) 0x4000;
*x = (unsigned long) 0x40e;
x++;
*x = (unsigned long)0x100000 + 0x40e;
x++;
*x = (unsigned long)0x200000 + 0x40e;
x++;
*x = (unsigned long)0x300000 + 0x40e;
x++;
*x = (unsigned long)0x400000 + 0x40e;
x++;
*x = (unsigned long)0x500000 + 0x40e;
x++;
*x = (unsigned long)0x600000 + 0x40e;
x++;
*x = (unsigned long)0x700000 + 0x40e;
}
And the .s
TEXT y+0(SB),0,$4
MOVW $1038,R4
MOVW $16384,R1
MOVW R4,0(R1)
RET ,
TEXT main+0(SB),0,$8
MOVW $1049614,R10
MOVW $2098190,R9
MOVW $3146766,R8
MOVW $4195342,R7
MOVW $5243918,R6
MOVW $6292494,R5
MOVW $7341070,R4
MOVW $16384,R3
MOVW $1038,R2
MOVW.P R2,4(R3)
MOVW.P R10,4(R3)
MOVW.P R9,4(R3)
MOVW.P R8,4(R3)
MOVW.P R7,4(R3)
MOVW.P R6,4(R3)
MOVW R5,0(R3)
MOVW R4,4(R3)
RET ,
GLOBL y$2<>+0(SB),R0,$256
END ,
The code for y() I can understand.
but this:
MOVW $16384,R3
MOVW $1038,R2
MOVW.P R2,4(R3)
I don't get. How can R2 get stored to 16384, given the 4(R3)?
Are we pretty much agreed that the MOVW.P is a post-increment mode?
ron
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [9fans] ARM question
2005-03-10 21:55 [9fans] ARM question Ronald G. Minnich
@ 2005-03-10 22:05 ` Russ Cox
2005-03-11 8:59 ` Richard Miller
0 siblings, 1 reply; 9+ messages in thread
From: Russ Cox @ 2005-03-10 22:05 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
perhaps the argument to MOVW.P is the final
(post-increment) value instead of the value used
during the write.
On Thu, 10 Mar 2005 14:55:37 -0700 (MST), Ronald G. Minnich
<rminnich@lanl.gov> wrote:
>
> here's the code in c:
> #include <u.h>
> #include <libc.h>
> y(){
> unsigned long *x;
> x = (unsigned long *) 0x4000;
> *x = (unsigned long) 0x40e;
> }
> main(){
> unsigned long *x;
> static unsigned long y[64];
> int i;
>
> x = (unsigned long *) 0x4000;
> *x = (unsigned long) 0x40e;
> x++;
> *x = (unsigned long)0x100000 + 0x40e;
> x++;
> *x = (unsigned long)0x200000 + 0x40e;
> x++;
> *x = (unsigned long)0x300000 + 0x40e;
> x++;
> *x = (unsigned long)0x400000 + 0x40e;
> x++;
> *x = (unsigned long)0x500000 + 0x40e;
> x++;
> *x = (unsigned long)0x600000 + 0x40e;
> x++;
> *x = (unsigned long)0x700000 + 0x40e;
>
> }
>
> And the .s
> TEXT y+0(SB),0,$4
> MOVW $1038,R4
> MOVW $16384,R1
> MOVW R4,0(R1)
> RET ,
> TEXT main+0(SB),0,$8
> MOVW $1049614,R10
> MOVW $2098190,R9
> MOVW $3146766,R8
> MOVW $4195342,R7
> MOVW $5243918,R6
> MOVW $6292494,R5
> MOVW $7341070,R4
> MOVW $16384,R3
> MOVW $1038,R2
> MOVW.P R2,4(R3)
> MOVW.P R10,4(R3)
> MOVW.P R9,4(R3)
> MOVW.P R8,4(R3)
> MOVW.P R7,4(R3)
> MOVW.P R6,4(R3)
> MOVW R5,0(R3)
> MOVW R4,4(R3)
> RET ,
> GLOBL y$2<>+0(SB),R0,$256
> END ,
>
> The code for y() I can understand.
>
> but this:
>
> MOVW $16384,R3
> MOVW $1038,R2
> MOVW.P R2,4(R3)
>
> I don't get. How can R2 get stored to 16384, given the 4(R3)?
>
> Are we pretty much agreed that the MOVW.P is a post-increment mode?
>
> ron
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [9fans] ARM question
2005-03-10 22:05 ` Russ Cox
@ 2005-03-11 8:59 ` Richard Miller
2005-03-11 13:02 ` Bruce Ellis
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Richard Miller @ 2005-03-11 8:59 UTC (permalink / raw)
To: russcox, 9fans
> perhaps the argument to MOVW.P is the final
> (post-increment) value instead of the value used
> during the write.
Exactly. MOVW.P x,d(Ry) means "store x at the address pointed to
by Ry, then increment Ry by d". It's the exact equivalent of
"*Ry++ = x" in C, if d is sizeof(*Ry).
-- Richard
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [9fans] ARM question
2005-03-11 8:59 ` Richard Miller
@ 2005-03-11 13:02 ` Bruce Ellis
2005-03-11 13:10 ` Charles Forsyth
2005-03-11 13:16 ` boyd, rounin
` (2 subsequent siblings)
3 siblings, 1 reply; 9+ messages in thread
From: Bruce Ellis @ 2005-03-11 13:02 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
page 3-116 explains the flags. (jagger ref).
brucee
On Fri, 11 Mar 2005 08:59:52 +0000, Richard Miller <9fans@hamnavoe.com> wrote:
> > perhaps the argument to MOVW.P is the final
> > (post-increment) value instead of the value used
> > during the write.
>
> Exactly. MOVW.P x,d(Ry) means "store x at the address pointed to
> by Ry, then increment Ry by d". It's the exact equivalent of
> "*Ry++ = x" in C, if d is sizeof(*Ry).
>
> -- Richard
>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [9fans] ARM question
2005-03-11 8:59 ` Richard Miller
2005-03-11 13:02 ` Bruce Ellis
@ 2005-03-11 13:16 ` boyd, rounin
2005-03-11 14:56 ` Ronald G. Minnich
2005-03-11 15:04 ` boyd, rounin
3 siblings, 0 replies; 9+ messages in thread
From: boyd, rounin @ 2005-03-11 13:16 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
> "*Ry++ = x" in C, if d is sizeof(*Ry).
sounds good to me.
--
MGRS 31U DQ 52572 12604
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [9fans] ARM question
2005-03-11 8:59 ` Richard Miller
2005-03-11 13:02 ` Bruce Ellis
2005-03-11 13:16 ` boyd, rounin
@ 2005-03-11 14:56 ` Ronald G. Minnich
2005-03-11 15:04 ` boyd, rounin
3 siblings, 0 replies; 9+ messages in thread
From: Ronald G. Minnich @ 2005-03-11 14:56 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs; +Cc: russcox
On Fri, 11 Mar 2005, Richard Miller wrote:
> Exactly. MOVW.P x,d(Ry) means "store x at the address pointed to
> by Ry, then increment Ry by d". It's the exact equivalent of
> "*Ry++ = x" in C, if d is sizeof(*Ry).
>
gotcha. Thanks for the info. I knew the code was probably right, I just
couldn't make any sense of it.
ron
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [9fans] ARM question
2005-03-11 8:59 ` Richard Miller
` (2 preceding siblings ...)
2005-03-11 14:56 ` Ronald G. Minnich
@ 2005-03-11 15:04 ` boyd, rounin
3 siblings, 0 replies; 9+ messages in thread
From: boyd, rounin @ 2005-03-11 15:04 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
> "*Ry++ = x" in C, if d is sizeof(*Ry).
sounds good to me.
--
MGRS 31U DQ 52572 12604
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2005-03-11 15:04 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-10 21:55 [9fans] ARM question Ronald G. Minnich
2005-03-10 22:05 ` Russ Cox
2005-03-11 8:59 ` Richard Miller
2005-03-11 13:02 ` Bruce Ellis
2005-03-11 13:10 ` Charles Forsyth
2005-03-11 13:21 ` Bruce Ellis
2005-03-11 13:16 ` boyd, rounin
2005-03-11 14:56 ` Ronald G. Minnich
2005-03-11 15:04 ` boyd, rounin
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).