.de sc
.ne 3
.sp 1
..
.de pa
.br
.ti 6
..
.de hd
'sp 2
.ns
..
.de fo
'sp 1
.tl ''-%-''
'bp
.ns
..
.wh 0 hd
.wh -8 fo
.po 10
.nf
.ti 46
UNIX document # 13.
.sp 4
.ce
.ul
Miscellaneous _kernel _changes.
.fi
.sp 3
.pa
The following changes are a
preparation for system change #\ 14.
They are independent of each other
and do not change the behaviour
or the specifications of the system.
.sc
.ul
13-_I
.pa
move
panic("swap error")
from the places where
swap(..)
in
dmr/bio.c
is called to
swap(..)
itself.
Note that in
xalloc(..)
in
ken/text.c,
the panic call was
left out originally.
.sc
.ul
13-_II
.pa
in
ken/malloc.c,
a routine
swall(size)
is added,
which allocates swap space
in coremap units and calls
panic("out of swap space")
if necessary.
Two includes had to be inserted
as well.
.sc
.ul
13-_III
.pa
obsolete and not implemented.
.sc
.ul
13-_IV
.pa
Add two routines to
ken/main.c,
namely esturst() and esturdo(d).
Calls to estabur(..) are replaced
with calls to esturst()
and esturdo(.).
.sc
.ul
13-_V
.pa
In ken/main.c, a routine setsr(..)
was added, and estabur(..)
rewritten to use it.
.sc
.ul
13-_VI
.pa
in ken/main.c, routine sureg()
was rearranged.
.sc
.ul
13-_VII
.pa
A routine verbuf(..) was added to
ken/main.c, and physio(..),
dmr/bio.c, was rewritten to
use it.
.sp 2
Modules changed and recompiled:
.nf
    ken/main.c
	malloc.c
	sig.c
	slp.c
	sys1.c
	text.c
    dmr/bio.c
.fi
.sp 3
.ti 40
George Rolf.
.bp
.nf
.ti 46
UNIX document # 14.
.sp 4
.ce
.ul
Shared_Data_Areas.
.fi
.sp 3
.pa
Before implementing this change,
change # 13 must have been applied
in its entirety.
Shared data segments use the same
system table,
.ul
text,
as do shared text segments.
The code is different however.
.sc
In
.ul
user._h
added :
.nf
	int u_sdsize;	/* size of shared data segment */
		(zero if none)
	char u_sdpage;	/* page slot of shared data area */
		(ranging from 0 to 7)
.fi
.sc
In
.ul
proc._h
added:
.nf
	int *p_sdap;	/* pointer to shared data area */
		(zero if none)
.fi
.sc
In
.ul
text._h
added:
.nf
	XBUSY	1
	XWANT	2
	XSDAP	4
.fi
which are x_iptr flags.
XSDAP marks the text entry as
unavailable for allocation.
XBUSY indicates that the shared data segment
is being swapped out, which means that the
scheduler has to wait before swapping it in.
XWANT indicates that the scheduler
has to be woken up when the process is finished
swapping its shared data segment out.
Shared data segments, and shared text segments
may be swapped out by processes themselves instead
of the scheduler, namely when doing a
newproc() (=fork()), an expand(), an exit()
or a relsda(). The latter three cause a synchronization
problem.
.sc
In
.ul
seg._h
added:
.nf
	SD	0100000   /* shared data area bit */
	DM	0077777   /* descriptor mask to be applied
			     to prototype descriptor registers
			     upon loading into hardware regs */
.fi
.sc
In
.ul
ken/_main._c
changed:
.pa
sureg(), esturst(), esturdo(), estabur() and verbuf().
.sc
In
.ul
sig._c
.pa
core() was changed to dump the contents of the shared
data area behind the stack.
.sc
In
.ul
slp._c:
.in 12
.ti -6
sched() was changed to swap the shared data
area in.
.ti -6
newproc() was changed to copy the shared
data area pointer to the new process.
.in
.sc
In
.ul
sys1._c
.in 12
.ti -6
exec(): a call to estabur() had to be
changed.
.ti -6
exit() is to call xdfree().
.ti -6
relsda() was inserted.
.in
.sc
In
.ul
sysent._c
.pa
entries were added for getsda and relsda.
.sc
In
.ul
text._c
.in 12
.ti -6
xswap() is to call xccdda().
.ti -6
xccdda() was added. It is the analogue of
xccdec() for shared data areas.
.ti -6
xdfree() was added as the equivalent of xfree().
.ti -6
getsda() was added.
.in
.sp 1
.pa
In addition to these ken modules,
all other ken modules were recompiled
as well, plus the following dmr/..
modules: dl.c, tty.c, sys.c.
.sc
.ul
ps(_I)_
.pa
had to be recompiled.
Files: /bin/ps, and s2/ps.c on the
source disk.
.sc
.ul
C-interfaces:
.pa
s4/getsda.s and s5/relsda.s. The objects
have to be put into the C-library, /lib/libc.a.
Note that it is advisable to have cerror.o
at the rear end of /lib/libc.a.
.sc
.ul
Documentation:
.pa
man2/getsda.2 and man2/relsda.2.
.sp 3
.ti 40
George Rolf.
.sp 1
.nf
Computer Graphics Group.
Faculty of Science.
Toernooiveld,
Nijmegen, The Netherlands.
.fi
