hi All,
Again, I run into problems when reading slp.c and savu/retu.
Actually, I have 3 questions.
First, I doubt whether all processes share one "u" or each process has
its own "u".
line 0402: One allocated per process.
It seems that each process has its own user structure.
But the "u" is defined as a universal variable (line 0459), and the
line 0407 clearly states that the "u" resides at virtual kernel loc
140000.
So isn't it saying that there's only one "u" in the core memory?
This concept is very important, because it's bound tightly with
savu/retu mechanism.
---------------------------------------------------------------------------
Now comes the second question:
The savu procedure is supposed to save r5 and sp to u.u_rsav,
and the retu is supposed to reset the r5 and sp with the saved values.
If each process has its own u, then savu/retu simply work fine.
But if all processes share one u, the newest call to savu will
overwrite the previously saved values of r5 and sp, so that retu is
not able to get back the r5/sp again!
The story is like this:
1889: r5/sp of process #1 are saved to u.u_rsav
2189: r5/sp of process #0 are saved! Thus overwriting the values of process #1.
So when we are coming to 2228, how can retu work in a way as it is expected to?
-----------------------------------------------------------------------------
The final question is about how savu/retu work.
savu:
line 0729 and line 0730: r5 and sp are saved to (r0) and (r0)+, which
are the address of u.u_rsav.
retu:
0746 and 0747: sp and r5 are read from (r0) and (r0)+, which is
"rp->p_addr" (see line 2228). It looks weird to me. (Okay...I have to
confess I look stupid here...) When making call to retu, why bother
"retu(rp->p_addr)"? Why not calling with "retu(u.u_rsav)"? Does it
mean that rp->p_addr == u.u_rsav?
OMG, I am totally confused...
--------------------------------------------------------------------------------
I guess It's kind of boring to read my question...but hopefully
someone can give me some hint...Thanks in advance!
Regards,
Qinglai
No.
On PDP 11 assembler the left and right shifts were a
single < and >.
You made a typo when transcribing the source
statement: you typed
> 0636: mov $USIZE-1/<8|6, (r1)+
but the actual code from m40.s reads
> 0636: mov $usize-1\<8|6,(r1)+
However, since < and > where also used to delimit
strings, there was a
need to escape them so as to distinguish their usage
as shifts from the
string delimiters. The escaping was achieved by \
which is what you see
in the code.
See the assembler section of vol 2b of the Unix V7
manuals for details at
http://plan9.bell-labs.com/7thEdMan/v7vol2b.pdf
or
http://web.cuzuco.com/%7Ecuzuco/v7/v7vol2b.pdf
namely:
6.1 Expression operators
The operators are:
(blank) when there is no operand between operands,
the effect is
exactly the same as if a + had appeared.
+ addition
subtraction
* multiplication
\/ division (note that plain / starts a
comment)
& bitwise and
| bitwise or
\> logical right shift
\< logical left shift
... ... ...
j
On Mon, 2 Oct 2006 09:44:58 +0300
jigsaw <jigsaw(a)gmail.com> wrote:
> hi all,
>
> I just started to read the source code of V6 with
Lion's book.
>
> But before I went far I was stopped by m40.s
>
> 0636: mov $USIZE-1/<8|6, (r1)+
>
> What does the slash "/" stand for?
>
> I guess this line should be
>
> mov $USIZE-1<<8|6, (r1)+
>
> Is "/<" the same as "<<"?
>
> I checked in Unix PDP11 Assemble Refrence Manual but
didn't find a clue.
>
> Is it the right place to ask such question?
>
> Thanks in advance
>
> Regards,
>
> Qinglai
______________________________________________
LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.
http://es.voice.yahoo.com
No.
On PDP 11 assembler the left and right shifts were a single < and >.
You made a typo when transcribing the source statement: you typed
> 0636: mov $USIZE-1/<8|6, (r1)+
but the actual code from m40.s reads
> 0636: mov $usize-1\<8|6,(r1)+
However, since < and > where also used to delimit strings, there was a
need to escape them so as to distinguish their usage as shifts from the
string delimiters. The escaping was achieved by \ which is what you see
in the code.
See the assembler section of vol 2b of the Unix V7 manuals for details at
http://plan9.bell-labs.com/7thEdMan/v7vol2b.pdf
or
http://web.cuzuco.com/%7Ecuzuco/v7/v7vol2b.pdf
namely:
6.1 Expression operators
The operators are:
(blank) when there is no operand between operands, the effect is
exactly the same as if a + had appeared.
+ addition
subtraction
* multiplication
\/ division (note that plain / starts a comment)
& bitwise and
| bitwise or
\> logical right shift
\< logical left shift
... ... ...
j
On Mon, 2 Oct 2006 09:44:58 +0300
jigsaw <jigsaw(a)gmail.com> wrote:
> hi all,
>
> I just started to read the source code of V6 with Lion's book.
>
> But before I went far I was stopped by m40.s
>
> 0636: mov $USIZE-1/<8|6, (r1)+
>
> What does the slash "/" stand for?
>
> I guess this line should be
>
> mov $USIZE-1<<8|6, (r1)+
>
> Is "/<" the same as "<<"?
>
> I checked in Unix PDP11 Assemble Refrence Manual but didn't find a clue.
>
> Is it the right place to ask such question?
>
> Thanks in advance
>
> Regards,
>
> Qinglai
______________________________________________
LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.
http://es.voice.yahoo.com
hi all,
I just started to read the source code of V6 with Lion's book.
But before I went far I was stopped by m40.s
0636: mov $USIZE-1/<8|6, (r1)+
What does the slash "/" stand for?
I guess this line should be
mov $USIZE-1<<8|6, (r1)+
Is "/<" the same as "<<"?
I checked in Unix PDP11 Assemble Refrence Manual but didn't find a clue.
Is it the right place to ask such question?
Thanks in advance
Regards,
Qinglai