Memory Management

Johnny Billquist bqt at Update.UU.SE
Fri Feb 5 05:07:56 AEST 1999


On Thu, 21 Jan 1999, Erin W. Corliss wrote:

> The documentation that Warren gave me describes the memory management
> scheme.  It says that when the machine is first started, the memory
> management unit is disabled -- anyone know how to enable it, and where the
> segmentation registers are (I'm assuming they are in the 0160000-0177777
> range somewhere)?

I haven't seen anyone answering this, so here I go...

Reg.	Addr.

MMR0	777572
MMR1	777574
MMR2	777576
MMR3	772516
UIPAR	777640-777656
UDPAR	777660-777676
UIPDR	777600-777616
UDPDR	777620-777636
SIPAR	772240-772256
SDPAR	772260-772276
SIPDR	772200-772216
SDPDR	772220-772236
KIPAR	772340-772356
KDPAR	772360-772376
KIPDR	772300-772316
KDPDR	772320-772336

xy in xyP?R is:

x:	U - User
	S - Supervisor
	K - Kernel
y:	I - Instruction
	D - Data

PAR is Page Address Register
PDR is Page Description Register

Okay, so for the layout of the registers...

MMR0:

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 ! ! ! !     ! ! ! \-/ ! \---/ +-- Enable relocation
 ! ! ! !     ! ! !  !  !   +------ Page number
 ! ! ! !     ! ! !  !  +---------- Page address space I/D
 ! ! ! !     ! ! !  +------------- Page mode
 ! ! ! !     ! ! +---------------- Instruction completed
 ! ! ! !     ! +------------------ Maintenance mode
 ! ! ! !     +-------------------- Enable memory management trap
 ! ! ! +-------------------------- Trap-Memory management
 ! ! +---------------------------- Abort-Read only access violation
 ! +------------------------------ Abort-Page length error
 +-------------------------------- Abort-Non resident

The page info is for when a trap/fault occurs, and tells in which page it
occured.The rest should be pretty obvious.

MMR1:

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 \-------/ \---/ \-------/ \---/
     !       !       !       +---- Register number
     !       !       +------------ Amount changed (2 compl.)
     !       +-------------------- Register numbe
     +---------------------------- Amount changed (2 compl.)

Low byte is written first, and this register tells how much registers have
changed part way through an instruction, which needs to be undone to start
the intruction again.

MMR2:

Virtual address of instruction where fault occured.

MMR3:

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                     ! !   ! ! +--- Enable user D space
                     ! !   ! +----- Enable supervisor D space
                     ! !   +------- Enable kernel D space
                     ! +----------- Enable 22-bit mapping
                     +------------- Enable unibus map

If 22-bit mapping isn't enabled, the machine will be in 18-bit addressign
when MMU is enabled. Unibus-mapping is something I'll skip for now. You
need it for DMA on a 22-bit unibus machine only.

Note that at the end of a MMU trap/abort, MMR0 bit 15-12 must be cleared
for MMR1 and MMR2 to become active again.


>From a virtual address (VA), you get to the physical address (PA) like
this:

APF=VA[15:13]
DF=VA[12:0]

PA=PAR(APF)*64+DF


The PDR looks loke this:

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   \-----------/ ! !     ! \---/
         !       ! !     !   +----- ACF
         !       ! !     +--------- ED
         !       ! +--------------- W
         !       +----------------- A
         +------------------------- PLF

ACF - Access Control Field
	000 - Non resident; abort on all accesses
	001 - Read only; abort on write attempt, memory mgmt trap on read
	010 - Read only; abort on write attempt
	011 - Unused; abort on all accesses - reserved for future use
	100 - Read/Write; memory mgmt trap upon completion of read or write
	101 - Read/Write; memory mgmt trap upon completion of write
	110 - Read/Write; no system trap/abort action
	111 - Unused; abort on all accesses - reserved for future use

A - Access to page has been made.
W - Page has been written to since PAR/PDR was loaded
ED - Expansion direction
PLF - Page length field

Now, have fun...
	Johnny

Johnny Billquist                  || "I'm on a bus
                                  ||  on a psychedelic trip
email: bqt at update.uu.se           ||  Reading murder books
pdp is alive!                     ||  tryin' to stay hip" - B. Idol




More information about the TUHS mailing list