[ Pobierz całość w formacie PDF ]

segment of the 32K program address space
Upon entry to this procedure:
are automatically mapped into the highest 4K
word segment of the physical address space.
(a) the processor is running at priority zero, in ker-
nel mode and with the previous mode shown
We may note that from this point on, all the
as user mode
kernel mode segmentation registers will remain un-
changed with the single exception of the seventh
(b) the kernel mode segmentation registers have
kernel segmentation address register.
been set and the memory management unit
This register is explicitly manipulated by UNIX
has been enabled
to point to a variety of locations in physical mem-
(c) all the data areas used by the operating system
ory. Each such location is the beginning of an area
have been initialised
512 words long, known as a \ per process data area".
The seventh kernel address register is now set
(d) the stack pointer (SP or r6) points to a word
to point to the segment which will become the per
which contains a return address in \start".
process data area for process #0.
1559: The rst action of \ main" would appear to
0646: The stack pointer is set to point to the high-
be redundant, since \updlock" should have
est word of the per process data area
already been set to zero as part of the initial-
isation performed by \start"
0647: By incrementing the value of SR0 from zero
to one, the \memory management enabled"
1560: \i" is initialised to the ordinal of the rst
bit is conveniently set.
32 word block beyond the \per process data
area" for process #0
From this point, all program addresses are trans-
lated to physical addresses the memory management
1562: The rst pair of user mode segmentation
hardware.
registers are used to provide a \moving win-
dow" into higher areas of the physical mem-
0649: \bss" refers to the second part of the pro-
ory.
gram data area, which is not initialised by
At each position of the windowan attempt is
the loader (see \A.OUT(V)" in the PM). The
made (using \ fuibyte") to read the rst ac-
lower and upper limits of this area are de ned
cessible word in the window. If this is not
by the loader pseudo variables, \ edata" and
successful, it is assumed that the end of the
\ end" respectively
physical memory has been reached. Other-
wise the next 32 word block is initialised to
0668: The processor status word (PS) is changed
zero (using \ clearseg" (0676)) and added to
to indicate that the \previous mode" was
the list of available memory, and the window
\user mode".
is advanced by 32 words.
This prepares the way for the investigation
and initialisation of the areas of physical
\fuibyte" and \ clearseg" are both to be found
memory which are not part of the kernel ad-
in \m40.s", \fuibyte" will normally return a posi-
dress space. (This involves use of the spe- tive value in the range 0 to 255. However, in the
cial instructions \ mtpi" and \ mfpi" (Move
exceptional case where the memory location refer-
To/From Previous Instruction space) together
enced does not respond, the value {1 is returned.
with some manipulation of the user mode seg- The way this is brought about is a little obscure,
mentation registers.)
and will be explained later in Chapter Ten.)
0669: A call is then made to the procedure \main"
1582: \maxmem" de nes the maximum amount of
(1550).
main memory which may be used by a user
program. This is the minimum of:
It will be seen later that \main" calls \sched"
which never terminates. The need for or use of
the physically available memory (\maxmem")
the last three instructions of \start" (lines 0670,
an installation de nable parameter (\MAXMEM")
0671 and 0672) is therefore somewhat enigmatic.
(0135)
The reason will come later. In the meantime you
the ultimate limit imposed by the PDP11
might like to ponder \ why?". What do these lines
architecture
do anyway?
1583: \swapmap" de nes available space on the Details of the representation of processes in
swapping disk which may be used when user UNIX will be discussed in the next chapter. For
programs are swapped out of main memory. nowwe just note that each process involves a \ proc"
It is initialised to a single area of size \nswap", structure from the array called \proc" and a \ per
starting at relative address \swplo". Note process data area" which includes one copy of the
that \nswap" and \swplo" are initialised in structure \u".
\conf.c" (lines 4697, 4698)
1589: The signi cance of this and the next four 6.5 Initialisation of proc[0]
lines will be discussed shortly
The explicit initialisation of the structure \proc[0]"
1599: The design of UNIX assumes the existence of
is performed starting at line 1589. Only four ele-
a system clock which interrupts the processor
ments are changed from the overall initial value of
at line frequency (i.e 50 Hz or 60 Hz).
zero:
There are two possible clock types available:
(a) \p stat" is set to \SRUN" which implies that
a line frequency clock (KW11-L) which has
process 0 is \ ready to run"
a control register on the Unibus at address
777546, or a programmable, real-time clock
(b) \p ag" is set to show both \SLOAD" and
(KW11-P) located at address 777540 (lines
\SSYS". The former implies that the process
1509, 1510).
is to be found in core (it has not been swapped
UNIX does not presume which clock will be
out onto the disk), and the second, that it
present. It attempts to read the status word
should never be swapped out
for the line frequency clock rst. If success-
ful, that clock is initialised and the other (if
(c) \p size" is set to \USIZE"
present) remains unused. If the rst attempt
(d) \p addr" is set to the contents of the kernel
is unsuccessful, then the other clock is tried.
segmentation address register #6.
If both attempts are unsuccessful, there is a
call on \ panic" which e ectively halts the sys-
It will be seen that process #0 has acquired an
tem with an error message to the operator.
area of \USIZE" blocks (exactly the size of a \per
Since the absence of a clock will be indicated
process data area") which begins immediately after
by a bus timeout error, it is convenient to make the
the o cial end (\ end") of the operating system [ Pobierz całość w formacie PDF ]

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • skydive.htw.pl
  • Copyright © 2016 Moje życie zaczęło siÄ™ w dniu, gdy ciÄ™ spotkaÅ‚em.
    Design: Solitaire