Digital PDFs
Documents
Guest
Register
Log In
AA-K785A-TE
May 1981
703 pages
Original
7.8MB
view
download
Document:
VMS Internals and Data Structures 2.2 1981
Order Number:
AA-K785A-TE
Revision:
0
Pages:
703
Original Filename:
VMS_Internals_and_Data_Structures_2.2_1981.pdf
OCR Text
VAX/VMS Internals and Data Structures April 1981 This manual explains the internal control paths and data structures used by the VAX/VMS operating system. VAX/VMS Intern als and Data Structures Order No. AA-K785A- TE SUPERSESSION/UPDATE INFORMATION: This is a new document for this release. OPERATING SYSTEM AND VERSION: VAX/VMS V2.2 SOFTWARE VERSION: Not Applicable digital equipment corporation · maynard, massachusetts F i r s t P r i n t i ng , Apr i l 1 9 8 1 The i n fo rma t i o n i n t h i s d o c um e n t i s s ub j e c t t o c h a ng e w i t h o u t n o t i c e a nd should no t b e c o n s t r ued a s a c omm i tme n t b y D i g i t a l E q u i pm e n t Co r po r a t i o n . D i g i t a l E q u i pment Co r po r a t i o n a s s um e s n o r e s pons i b i l i ty f o r a n y e r ro r s tha t m a y a ppe a r i n th i s d o c um e n t . Th e s o f t wa r e d e sc r i b ed i n th i s d o c um e n t i s f u r n i shed und e r a l i c en s e a nd m a y o n l y b e u s e d o r c o p i ed i n a c c o rd a n c e wi th t h e t e rms o f s uc h l i c en s e . No r e spo n s i b i l i ty i s a s s umed for the u s e o r r e l i a b i l i t y o f so f twa r e o n e qu i pm e n t tha t i s n o t s upp l i ed by D I G I TA L o r i t s a f f i l i a t ed compa n i e s . C o py r i g h t P e rm i s s i o n to a c knowl edged . @) r e p r i nt 1 9 8 1 by D i g i t a l E q u i pm e n t C o r po r a t i o n Al l R i gh t s Re s e r v e d . the f o l l o w i ng m a te r i a l is g ra te f u l l y F r om Th e Hobb i t b y J . R . R . To l k i e n . C o py r i g h t @ 1 9 6 6 by J . R . R . To l k i e n . R e p r i n t ed 1 n the Un i t ed S t a t e s b y pe rm i s s i o n o f Ho ug h to n M i f f l i n Compa ny . Re p r i n t ed o u t s i d e the Un i t ed S t a t e s b y pe rm i s s i o n o f G e o r g e A l l en & U n w i n , Ltd . F r o m Th e Re t u r n o f t h e K i ng , Be i ng the Th i r d Pa r t o f Th e Lo rd o f the R i ng 7 b y J . R . R . Copy r i g h t @ 1 9 6 5 by J . R . R . To l k i e n . To l k i e n . R e p r1n t ed i n the Un i t e d S t a t e s b y p e rm i s s i o n o f Ho ug h t o n M i f f l i n Rep r i n t ed o u t s i d e the Un i ted S t a t e s by pe rm i s s i o n of G e o r g e Compa n y . A l l e n & Unwi n , Ltd . The po s tag e p r e pa i d READER ' S C OMM ENTS f o rm o n the l a s t pag e o f t h i s d o c um e n t r eq ue s t s the use r ' s c r i t i c a l e va l ua t i o n to a s s i s t u s i n p r e pa r i ng f u t u r e d o c um e n ta t i o n . The fo l l ow i ng a r e t r ad em a r k s o f D i g i ta l Equ i pm e n t C o r po r a t i o n : DEC D E CU S D IG I TA L PDP UN I B U S VAX D E Cn e t DEC s ys tem- 1 0 DEC S Y S TEM - 2 0 DECw r i te r D I BOL EduSys t em !AS MAS S B US 3/83-14 PDT RSTS RSX VMS VT �omoomo C ONTENTS Page PRE FAC E xxvii PART I I N TRODUC T I ON C HA PTER 1 S Y S T EM OVE RV I EW PROC E S S , JOB , AND I MAG E 1.1 1. 1. 1 Process Ha r d wa r e Co n t e x t 1. 1. 1. 1 So f twa r e Co n t ext 1. 1.1.2 V i r t ua l Ad d r e s s S pa c e De s c r i p t i o n 1.1.1.3 Imag e 1. 1.2 Job 1.1.3 FUNC T I ONA L I TY PROV I DE D B Y VAX/VM S 1.2 Ope r a t i ng Sy s t em Ke r n e l 1. 2. 1 I / 0 S u b s y s tem 1.2.1.1 Memo r y Ma n ag em e n t 1 . 2.1.2 S c h ed u l i ng a nd P r o c e s s Co n t r o l 1.2. 1. 3 M i s c e l l a n e o us S e r v i c e s 1.2.1.4 Da t a Ma n ag em e n t 1 . 2. 2 User Inter face 1 . 2. 3 1.2. 3. 1 I m ag e s I n s t a l l ed w i t h P r i v i l eg e O t h e r P r i v i l eg e d I m a g e s 1.2.3.2 1 . 2. 3. 3 Imag e s Th a t L i n k w i t h SY S $ SYS TEM : S YS . STB 1.2.4 I n t e r f a c e b e twe e n Ke r n e l S u b s ys t em s I / 0 S u b s y s t em Re que s t s 1.2.4.1 Memo r y Ma n ag em e n t Re qu e s t s 1 . 2. 4. 2 S c h e d u l e r Re q u e s t s 1.2.4.3 HARDWARE I M P LEM ENTAT I ON O F O P E RAT ING S Y S T EM 1.3 K E RN E L VAX A r c h i t ec t u r e Fe a t u r e s E x p l o i t ed b y VM S 1.3.1 VAX- 1 1 I n s t r uc t i o n Se t 1 . 3.2 I m p l em e n t a t i o n o f VM S Ke r n e l Ro u t i n e s 1. 3.3 P r o c e s s Co n t e x t a nd Sy s t em S t a t e 1 . 3. 3. 1 P r o c e s s - B a s e d Ro u t i n e s 1 . 3.3. 2 Sys t em S e r v i c e s 1 . 3. 3. 2. 1 Pag e Fa u l t H a nd l e r 1 . 3.3.2.2 I n t e r r u p t S e r v i c e Ro u t i n e s 1.3.3.3 1 . 3. 3. 4 Spec i a l P r o c e s s e s - Swa ppe r a nd N u l l 1.3.3.5 Spec i a l S u b r o u t i n e s 1.3.4 Memo r y Ma n ag em e n t a nd Ac c e s s Mo d e s 1.3.5 Ex c e pt i o n s , I n t e r r up t s , a nd RE I 1. 3.5. 1 Compa r i s o n o f E x c e p t i o n s a nd I n t e r r up t s 1 . 3. 5. 2 O t h e r U s e s o f E x c e p t i o ns a nd I n t e r r up t s 1. 3. 5. 3 Th e RE I I n s t r uc t i o n 1 . 3.6 P r o c e s s S t r uc t u r e OTHER SYSTEM C ONC E PT S 1.4 1.4.1 Re s o u r c e C o n t r o l 1.4.1.1 H a r d wa r e P r o t e c t i o n P r o c e s s Pr i v i l eg e s 1 . 4. 1. 2 1.4.1.3 Q uo t a s a nd L i m i t s 1.4.1.4 Us e r I d e n t i f i c a t i on Code ( U I C ) iii 1-1 1-1 1-1 1-3 1-3 1-3 1-4 1-4 1-4 1-4 1-4 1-6 1-6 1-6 1-6 1 -7 1 -7 1-9 1-9 1-1 0 1-1 0 1-1 0 1-1 0 1-1 0 1-1 1 l-1 2 1-1 3 1-1 4 1-1 4 1-1 5 1-1 5 1-1 5 1-16 1-1 6 1-1 7 1-1 7 1-1 8 1-1 8 1-18 1-19 1-19 1-19 1-19 1-20 1-20 C ONTENTS 1.4.2 Ot h e r Sys t em P r i m i t i v e s 1 . 4 . 2. 1 S yn c h r o n i z a t i o n 1.4.2. 2 Dyn am i c Memo r y Al l o c a t i o n 1.4.2. 3 Log i c a l Na m e s LAYO UT O F VI RTUA L ADDR E S S S PACE 1.5 Sy s t em V i r t ua l Ad d r e s s Spa c e 1 . 5. 1 Th e Co n t r o l Reg i o n ( P l S pa c e ) 1.5.2 Th e P r o g r am Reg i o n ( P O S pa c e ) 1.5.3 PART I I C ONTROL M EC HAN I S M S C HA PTER 2 C OND I T I ON HAND L I NG 2.1 2.1.1 2.1.2 2.2 2.2.1 2.2.1.1 2.2.1. 2 2.2.1.3 2.2.1.4 2.2.2 2 . 2 . 2. 1 2 . 2 . 2. 2 2.3 2.3.1 2. 3.2 2.3.2.1 2. 3. 2. 2 2 . 3 . 2. 3 2.3.3 2.3.3.1 2.3.3.2 2.4 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.5 2.5.1 2.5.2 2 . 5. 3 2.5.3.1 2.5.3.2 C HAPTER 3 3.1 3.2 3.2.1 3.2.2 3.3 3.3.1 3.3.2 3.3.3 3.3.4 OVERVI EW OF TH E C OND I T I ON HANDL I NG FAC IL I TY Go a l s o f VAX- 1 1 C o nd i t i o n Hand l i ng Fa c i l i t y Fe a t u r e s o f VAX- 1 1 C o nd i t i o n Hand l i ng Fa c i l i t y G E N E RAT I ON OF E XC E PT I ON S E x c ept i o n s Th a t O r i g i n a t e i n the Ha r d wa r e E x c ep t i o n s Th a t VM S T r e a t s i n a Spec i a l Wa y O t h e r Ha r d wa r e E x c ept i o n s I n i t i a l Ac t i o n o f E x c e p t i o n S e r v i c e Ro ut i n e s Mo r e S p e c i a l Ca s e s i n E x c ept i o n D i s pa tch i ng Ex c e p t i o n s De t e c ted by S o f twa r e Pa s s i ng S t a t u s f r om a P r o c ed u r e I n i t i a l Ope r a t i o n o f L I B $ S I GNA L UN I F ORM E XC E PT I ON D I S PATC H ING Es t a b l i sh i ng a Co nd i t i o n Ha nd l e r Th e S e a r c h fo r a Cond i t i o n Ha nd l e r P r i m a r y a nd S e c o nd a r y E x c ept i o n Ve c to r s Ca l l F r am e C o nd i t i o n H a nd l e r s La s t Ch a n c e Cond i t i o n H a nd l e r M u l t i p l y Ac t i v e S i g n a l s Common Ca l l S i t e fo r C o nd i t i o n Hand l e r s E x ampl e o f M u l t i pl y Ac t i v e S i g n a l s C OND I T I ON HANDLE R ACT I ON C o n t i n u e o r Re s i g n a l Un w i nd i ng t h e C a l l S t a c k E x ampl e o f Unw i nd i ng t h e Ca l l S t a c k Po t e n t i a l I n f i n i t e Lo o p Unwi nd i ng M u l t i pl y Ac t i v e S i g n a l s D E FAULT ( VM S - S U PP L I E D ) C OND I T I ON HANDLERS T r a c e b a c k Ha n d l e r E s t a b l i shed by Ima g e S t a r t up Ca t c h Al l Cond i t i o n Ha nd l e r Ha n d l e r s Us ed by Ot h e r Ac c e s s Mo d e s Ex c ept i o n s i n Ke r n e l o r Ex ec u t i v e Mo d e C o nd i t i o n Ha n d l e r U s e d b y DC L o r MCR 1-20 1-20 1-21 1-21 1-21 1-21 1-22 1 -2 4 2-1 2-1 2-2 2-3 2-3 2-7 2-7 2-8 2-9 2-1 4 2-1 4 2-1 4 2-1 6 2-1 6 2-1 8 2-1 8 2-1 8 2-1 8 2-2 0 2-20 2-21 2-2 3 2-2 3 2-24 2-2 4 2-27 2-28 2-28 2-30 2-3 0 2-30 2-31 2-31 S Y S T EM S ERVI C E D I S PATC H ING S YS TEM S ERVI C E VE C TORS C HANG E MODE I NS TR UC T I ON S C HM K , CHM E C HM S , C HM U C HANG E M ODE D I S PA TCH ING I N VM S Ope r a t i o n o f the Ch a n g e Mod e D i s pa t c h e r Ch a ng e -Mo d e- to-Ke r ne l D i s p a tche r Ch a ng e -Mod e- t o - E x e c u t i ve D i s p a t c h e r RM S D i s pa t c h i ng iv 3-1 3-4 3 -4 3-4 3-4 3-5 3-1 0 3-10 3-10 C ONTENTS Re t u r n Pa th f o r Sys t em S e r v i c e s 3.3.5 Re t u r n Pa th f o r RMS S e r v i c e s 3.3.6 Wa i t S t a t e As so c i a t ed w i t h RMS Requ e s t s 3.3.6.1 RM S E r r o r De t e c t i o n 3.3.6.2 U S E R-WR I TT EN SYSTEM S ERVI C E D I S PATC H ING 3.4 Pe r - P r o c e s s U s e r -Wr i t t e n D i s pa t c h e r 3.4.1 Pr i v i l eg ed Sha r e a b l e Imag es 3.4.2 Sys t em-W i d e U s e r -Wr i t t e n D i s pa tc h e r 3. 4.3 RELATE D SYS TEM S ERVI C E S 3. 5 Se t Sys t em Se r v i c e Fa i l u r e E x c e p t i o n s Sys tem 3.5.1 Se r v i c e Ch a ng e Mo d e Sy s t em Se r v i c e s 3.5.2 C HAPTER 4 4. 1 4.1.1 4.1.2 4.2 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 C HAPTER 5 5.1 5. 1 . 1 5. 1 . 2 5.2 5.2.1 5.2.2 5.2.3 5.2.4 5. 3 5. 3.1 5. 3 . 2 5.3.3 5. 4 5.4.1 5 . 4. 2 5 . 4. 3 5 . 4. 4 5 . 4. 5 5 . 4. 6 5.5 5. 5. 1 5.5.2 5. 5 . 3 5.5.4 5.5.4.1 5.5.4.2 C HAPTER 6 6.1 6.1.1 3-1 0 3-12 3-12 3-1 3 3-1 3 3-13 3-1 3 3-17 3-17 3-17 3-18 S OFTWARE INTERR U PTS THE S OFTWARE INTERR U PT H a r d wa r e Mec h a n i sm o f So f twa r e I n t e r r up t s So f twa r e I n t e r r up t S e r v i c e Ro u t i n e s S OFTWARE INTERR U PT LEVE LS I N VAX/VM S Fo r k P r o c e s s i ng So f t wa r e T i m e r I /0 Po s t p r o c e s s i ng Re s c h e d u l i ng I n t e r r up t A S T De l i v e r y I n t e r r up t 4-1 4-1 4-3 4-3 4-4 4-6 4-7 4-7 4-8 A S T D E L I VE RY HARDWARE ASS I STANC E TO AST DE L I VE RY RE I I n s t r uc t i o n A S T LVL P r o c e s s o r Reg i s t e r ( PR $ ASTLVL ) Q U E U ING AN AST TO A PROC E S S AST C o n t r o l B l o c k Ac c e s s Mo d e a n d AST Que u i ng Sp e c i a l Ke r n e l Mo d e ASTs Comp u t a t i o n o f a New Va l ue fo r ASTLVL DE L I VE R ING AN AST TO A PROC E S S AST De l i v e r y I n t e r r up t Arg um e n t L i s t A S T E x i t Pa th S PE C IAL KERN E L ASTS I /0 Po s t p r o c e s s i ng in Pr o c e s s Co n t e x t P r o c e s s S u s pe n s i o n P r o c e s s De l e t i o n $G E TJ P I Sys tem Se r v i c e Powe r Re c o v e r y ASTs O t h e r Sys t em U s e o f ASTs ATTENT I ON A STS Se t At t e n t i o n Me c ha n i sm De l i v e r y o f At t e n t i o n ASTs Fl ush i ng a n At t e n t i o n AST L i s t Ex amp l e s i n VAX/VM S Te r m i n a l D r i v e r a nd CTRL/Y No t i f i c a t i o n Ma i l b o x D r i v e r 5-l 5-l 5-2 5-2 5-2 5 -4 5-5 5-5 5-6 5-6 5-8 5-8 5-9 5-1 0 5- 1 0 5-1 1 5-1 1 5-12 5-1 2 5-1 2 5-1 3 5-1 3 5-14 5-1 5 5-1 5 5-1 5 HARDWARE INTERRU PTS HARDWARE I NTERRUPT D I S PATC H ING I n t e r r up t D i spa tch i ng v 6-1 6-2 C ONTENTS S y s t em Co n t r o l B l o c k 6.1.2 6.1.2. 1 VAX- 1 1 / 7 5 0 E x t e r n a l Ad a p t e r s 6. 1.2.2 VAX- 1 1 /7 8 0 E x t e r n a l Ad a p t e r s 6.1.2.3 Ad a p t e r Co n f i g u r a t i o n VAX/VM S I N TERRUPT S ERVI C E R O UT INE S 6.2 6.2.1 Re s t r i c t i o n s Impo sed o n I n t e r r upt S e r v i c e Ro u t i n e s 6.2.2 S e r v i c i ng UN I B US I n t e r r up t s 6.2. 2. 1 VAX- 1 1 /7 5 0 UN I B US I n t e r r upt S e r v i c e Ro u t i n e s 6.2. 2. 2 VAX- 1 1 / 7 8 0 UN I B US I n t e r r upt S e r v i c e Ro u t i n e s MAS S B U S I n t e r r u p t S e r v i c e Ro ut i n e s 6.2.3 DR 3 2 I n t e r r up t S e r v i c e Ro u t i n e 6.2.4 6.2.5 MA7 8 0 I n t e r r up t D i s p a tch i ng CONNEC T-TO- I NTERRUPT M E C HAN I SM 6.3 C HA P T E R 7 6-4 6-4 6-5 6-6 6-6 6-6 6-7 6-7 6-9 6-1 0 6-1 3 6-1 3 6-1 5 E RROR HAND L ING E RROR LOGG I NG 7.1 Ove r v i ew o f the E r r o r Logg i ng S ubsys t em 7.1.1 De v i c e D r i v e r E r r o r s 7.1.2 O t h e r E r r o r Log Me s s ag e s 7. 1.3 Ope r a t i o n o f the E r r o r Lo g g e r Ro u t i n e s 7.1.4 Wa k i ng the ERRFMT P r o c e s s 7.1. 4. 1 7.1.5 Cu r so r y Ov e r v i ew o f the E RR FMT P r o c e s s E r r o r L o g Ma i l bo x 7.1.6 S y s t em Se r v i c e Ca l l 7.1.6.1 Ac t i o n o f the E RRFMT P r o c e s s 7.1.6.2 SYS TEM CRA S H E S ( BUGC HECKS ) 7.2 B UGC H E C K M e c h a n i sm 7.2.1 Ope r a t i o n o f BUG C HECK Ro u t i n e 7.2.2 B ug c h e c k s f r om Us e r a nd S u pe r v i so r Mo d e 7.2.2.1 VM S U s e o f Bug c hec k s 7.2.2.2 Sys tem Dump Fi l e 7.2. 3 MAC H IN E C H E C K M E C HAN I SM 7.3 VAX- 1 1/7 5 0 Ma ch i n e Ch e c k 7.3. 1 VAX- 1 1 /7 8 0 Ma c h i n e Ch e c k 7.3.2 M a c h i n e Ch e c k Re c o ve r y Bl o c k s 7.3. 3 7.3.3. 1 Us i ng t h e Recove r y Mech a n i sm PART I I I S C H E D U L ING AND T IM E R S U PPORT C HA PTER 8 S C HE D U L ING PROC E S S S TATES 8.1 P r o c e s s Co n t r o l B l o c k 8.1.1 S o f t wa r e P r i o r i t y 8.1.2 Re a l -T i m e Pr i o r i t y Ra ng e 8.1.2. 1 No rma l P r i o r i t y Ra ng e 8.1. 2. 2 P r i o r i ty Ad j u s tm e n t 8.1.2. 3 Qua n t um E x p i r a t i o n 8.1.2.4 S t a te Que u e s 8.1.3 Comput a b l e S t a t e s 8.1.3.1 Wa i t S t a t e s 8.1.3.2 Vo l un t a r y Wa i t S t a t e s 8.1.3.2.1 8.1.3.2.2 Memo r y Ma n ag em e n t Wa i t S t a t e s M i s c e l l a n e o u s Wa i t S t a t e ( MWA I T ) 8.1. 3.2.3 Commo n Ev e n t B l o c k s 8.1. 3. 3 SYS TEM EVENTS 8.2 vi 7-1 7-1 7-2 7-2 7-2 7-3 7-3 7-3 7-4 7-4 7-4 7-4 7-5 7-5 7-6 7-9 7-9 7-1 0 7-1 1 7-1 2 7-1 2 8-1 8-1 8-3 8-3 8-4 8-5 8-5 8-9 8-9 8-9 8-9 8-1 1 8-11 8-1 4 8-15 C ONTENTS 8.2.1 S y s t em Ev e n t s a nd P r o c e s s S t a t e s P r o c e s s S t a t e Ch a ng e s 8.2.1.1 Wa i t S t a t e s a nd A S T De l i ve r y 8.2.1.2 S y s tem S e r v i c e Wa i t S t a t e s 8.2.1.2.1 Mem o r y Ma n a g em e n t Wa i t S t a t e s 8.2.1.2.2 Spec i a l Cases 8.2.1.2.3 Ev e n t R e po r t i ng 8.2.2 Sy s t em Even t s a nd As s o c i a t ed P r i o r i t y Bo o s t s 8.2.3 R E S C HE DU L I NG I NTERRUPT 8.3 Ha r dwa r e Co n t e x t 8.3.1 Remov a l o f C u r r e n t P r o c e s s f r om E x e c u t i o n 8.3.2 S e l e c t i o n o f Nex t P r o c e s s fo r Ex e c u t i o n 8.3. 3 Summa r y Lo ngwo r d a nd Compu t a b l e S t a t e Que ue s 8.3.4 Ha r d wa r e As s i s t a n c e i n Co n t e x t Swi tc h i ng 8.3.5 SVPC T X I n s t r uc t i o n 8.3.5.1 LDPC TX I n s t r uc t i o n 8.3. 5.2 C HA PTER 9 PROC E S S C ONTROL AND C OMMUN ICAT I ON E VENT F LAG S E RVI C E S 9.1 Lo c a l E v e n t F l ag s 9.1. 1 Common E v e n t F l ag s 9.1.2 E v e n t F l ag Wa i t S t a t e s 9.1. 3 S e t t i ng a nd C l e a r i ng E v e n t F l ag s 9.1.4 Ot h e r E v e n t Fl ag S e r v i c e s 9.1.4.1 AFFECT I NG THE C OM PUTAB I L I TY OF ANOTHER PROC E S S 9.2 Common E v e n t Fl ag s 9 . 2. 1 P r o c e s s Co n t r o l S e r v i c e s 9 . 2. 2 P r i v i l eg e Ch e c k s 9 . 2. 2. 1 P r o c e s s C r e a t i o n a nd De l e t i o n 9.2.2.2 Hi b e r n a t e /Wa k e 9.2. 2. 3 S u s pe nd / Re s um e 9.2.2.4 Process Suspens i on 9.2.2.4.1 Ope r a t i o n o f the Re s ume Sys t em S e r v i c e 9.2.2.4.2 Ex i t a n d Fo r c e d Ex i t 9.2.2.5 M i s c e l l a n eo u s P r o c e s s At t r i b u t e C h a ng e s 9.2. 3 Se t P r i o r i t y 9.2. 3.1 S e t P r o c e s s Name 9.2. 3. 2 P r o c e s s Mo d e S e r v i c e s 9.2. 3. 3 I NT E R PROC E S S C OMMUN I C AT I ON 9.3 E v e n t F l ag s 9.3. 1 Ma i l bo x e s 9.3.2 Log i c a l Nam e s 9.3.3 G l o ba l S e c t i o n s 9.3.4 I n t e r p r o c e s s o r Commun i c a t i o n wi th t h e MA7 8 0 9.3.5 C HAPTER 1 0 8-15 8-1 5 8-1 5 8-16 8-1 6 8- 1 6 8-17 8-1 8 8-2 0 8-20 8-22 8-22 8-23 8-26 8-26 8 - 27 9-1 9-1 9-1 9-4 9-6 9 -7 9-8 9-8 9-8 9-8 9-8 9-9 9-9 9-9 9-1 0 9-1 0 9-1 0 9-1 1 9-1 1 9-1 1 9-1 3 9-1 3 9- 1 3 9-1 4 9-1 4 9-14 T IM E R S U P PORT 10. 1 T I M E KE E P I NG I N VAX/VM S 10. 1 . 1 Ha r dwa r e C l o c k s Interval Clock 10. 1.1. 1 10. 1 . 1 . 2 T i m e - o f-D a y C l o c k 10. 1.2 S o f t wa r e T i m e 10. 1.3 S e t T i m e Sy s t em S e r v i c e 10. 1.3.1 $ S E T I M E S y s tem T i m e Re c a l i b r a t i o n Re que s t s 10. 1.3. 2 $ S E T I M E T i me-o f-D a y Re a d j u s tm e n t Reque s t s 10. 2 HARDWARE C LOCK I NTERRUPT S ERVI C E ROUT INE 10. 2. 1 Sy s t em T i m e Upd a t i ng 10. 2. 2 T i m e r Qu e ue Te s t i ng vi i 1 0- 1 1 0- 1 1 0- 1 1 0- 3 1 0- 3 1 0- 4 1 0-4 1 0- 5 1 0- 5 1 0- 6 1 0-6 C ONTENTS 10. 3 10. 3. 1 10. 3. 2 10. 3. 3 10. 3. 4 10. 3. 5 10. 4 10.4.1 10. 4. 2 S O FTWARE T I M E R INTE RRUPT S E RVI C E ROUT INE Qua n t um Ex p i r a t i o n T i m e r Qu e ue a n d T i m e r Qu e ue E l em e n t s T i m e r Reque s t S e r v i c i ng S c h ed u l e d Wa k e u p Pe r i od i c Sys t em P r o c ed u r e s T I MER SYS TEM S E RVI C E S $ S E T I M R Re q u e s t s S c h e d u l ed Wa k e up PART I V M EM ORY MANAG EM E NT C HA PTER 1 1 MEMORY MANAG EM E NT DATA S TRUC TUR E S 1 0-6 1 0-6 1 0-7 1 0-8 1 0- 9 1 0- 9 1 0- 1 0 1 0-1 0 1 0-1 1 1 1-1 PROC E S S DATA S TRUC TURES ( PROC E S S HEAD E R ) 11. 1 1 1-2 P r o c e s s Pa g e Ta b l e s 11. 1.1 P r o c e s s S e c t i o n Ta b l e I n d e x 1 1-4 11. 1.1.1 Pa g e F i l e V i r t u a l B l o c k Num b e r 1 1-4 11.1.1.2 G l o b a l Pa g e Ta b l e I n d e x 1 1-4 11. 1.1.3 Page in Trans i t ion 1 1-7 11.1.1.4 Dem a n d Z e r o Pag e s 1 1-7 11. 1.1.5 1 1-7 Wo r k i ng S e t L i s t 11.1.2 1 1-7 D i v i s i o n o f t h e Wo r k i ng S e t L i s t 11. 1 . 2. 1 1 1-1 1 P r o c e s s Se c t i o n Ta b l e 11.1.3 P r o c e s s He a d e r Pa g e A r r a ys 1 1-1 1 11.1.4 1 1-14 PFN DATA BASE 11 .2 1 1-16 PTE Ar r a y 11. 2. 1 1 1-16 BAK A r r a y 11.2. 2 1 1-16 S TATE A r r a y 11. 2. 3 1 1-17 TYPE Ar r a y 11.2. 4 Fo r wa r d and B a c kwa r d L i n k s 1 1-17 11. 2. 5 1 1-18 RE FCNT A r r a y 11.2.6 1 1 -1 9 S HRCNT A r r a y 11. 2.7 1 1-20 WS LX A r r a y 11.2.8 SWPVBN A r r a y 1 1 -2 0 11.2.9 DATA S TRUC TURES FOR G LOBAL PAG E S 1 1-20 11.3 G l o b a l Se c t i o n De s c r i p to r 11. 3. 1 1 1-20 Th e Sys tem He ad e r and G l o ba l S e c t i o n Ta b l e 11. 3. 2 1 1-20 En t r i e s G l oba l Pa g e Ta b l e En t r i e s 11. 3. 3 1 1-23 G l o b a l Pag e T a b l e a nd Sys t em Pag e Ta b l e 11. 3. 4 1 1-24 P r o c e s s PT Es fo r G l o b a l Pag e s 1 1-26 11.3.5 SWAPP I NG DATA S TRUCTURES 1 1-27 11.4 1 1-27 Bal ance Slots 11.4.1 1 1-27 Ba l a n c e S l o t Ar r a ys 11.4.2 Comme n t o n E q u a l S i z e Ba l a n c e S l o t s 11.4. 3 1 1-30 DATA S TRUC TUR E S THA T D E SC R I B E THE PAG E F I LE S AND 11.5 1 1-30 SWAP F I L E S 11. 5. 1 Pag e a n d Swa p F i l e Ve c to r 1 1-30 11. 5. 2 Pa g e F i l e Da t a Ba s e 1 1-30 Swa p F i l e Ta b l e E n t r i e s 11. 5. 3 1 1-32 11.6 SWAPPER AND M OD I F I E D PAG E WR I TE R PAGE TAB LE ARRAYS 1 1-32 11. 6. 1 1 1-34 D i r e c t I /O and Sc a t t e r/G a th e r 11.6.2 Swa ppe r I /0 1 1-34 11.6. 3 Mo d i f i e d Pa g e Wr i t e r PTE A r r a y 11-35 11.6.4 No n r e e n t r a n c y o f Swa ppe r a nd Mod i f i ed Pag e 1 1-3 5 Wr i t e r 11.7 DATA S TRUC TUR E S US E D W I TH S HARED M EM ORY 1 1-3 5 vi i i CONTENTS 11.7 . 1 11.7 . 1 . 1 11.7 . 1 . 2 11.7 . 1 . 3 11.7. 2 11.7. 3 11.7 . 4 C HAPT E R 1 2 Sh a r ed Memo r y C o n t r o l S t r uc t u r e s Ph y s i c a l La yo u t o f Sha r ed Memo r y Sh a r ed Memo r y Commo n Da t a Pag e P r o c e s so r -S pe c i f i c C o n t r o l G l o ba l S e c t i o n s i n Sh a r ed Mem o r y Ma i l bo x e s i n Sh a r ed Memo r y Comm o n Ev e n t F l a g C l u s t e r s i n Sh a r ed Memo r y PAG I NG DYNAM I C S OVERVI EW O F PAG E R O P E RAT I ON 12. 1 H a rdwa r e Ac t i o n 12. 1 . 1 I n i t i a l Pa g e r Ac t i o n 12. 1 . 2 PAG E FA U LTS FOR PROC E S S PR IVATE PAG E S 12. 2 Pag e Lo c a t ed i n a n Imag e Fi l e 12. 2 . 1 Imag e Pa g e Th a t I s No t Co py o n Re f e r e nc e 12. 2. 1 . 1 Pag e Fa u l t s o u t o f T r a n s i t i o n S t a t e s 12. 2 . 1 . 2 Co py-on-Re f e r e n c e Pa g e 12. 2. 1 . 3 Demand Z e r o Pa g e s 12. 2.2 G l o b a l C o p y-on-Re f e r e n c e Pa g e s 12. 2. 3 Pa g e Lo c a t ed i n the Pag e Fi l e 12. 2.4 PAG E FAU LTS FOR G LOBAL PAG E S 12. 3 Pa g e Fa u l t fo r G l o b a l Re ad-On l y Pag e 12. 3.1 G l o b a l Re a d /Wr i t e Pag e s 12. 3.2 G l o ba l Co py-on-Re f e r e n c e Pag e s 12. 3. 3 WORK I NG S E T R E PLAC EMENT 12. 4 S c a n o f Wo r k i ng Set L i s t 12. 4.1 S k i pp i ng Wo r k i ng S e t L i s t E n t r i e s 12. 4.2 I N PUT AND O UT PUT THAT S U PPORT PAG I NG 12. 5 Pa g e Re a d s 12. 5.1 Pag e Re a d C l u s t e r i ng 12. 5. 1 . 1 T e rm i n a t i ng Co nd i t i o n fo r C l u s t e r ed Re ad s 12. 5. 1.1.1 Ma t c h i ng Co nd i t i o ns Wh i l e Sc ann i ng P a g e 12. 5.1.1.2 Tabl e Ma x im um C l u s t e r S i z e fo r Pa g e Re ad 12. 5. 1.1.3 Pag e Re a d Compl e t i o n 12. 5. 1 . 2 Mod i f i ed P a g e Wr i t i ng 12. 5. 2 Ope r a t i o n o f the Mo d i f i ed Pa g e Wr i t e r 12. 5 . 2. 1 Mo d i f i e d Pa g e Wr i t e C l us t e r i ng 12. 5.2.2 Ba c k i ng S t o r e Ad d r e s s e s fo r Mo d i f i ed Pag e s 12. 5.2.3 Ex am p l e o f Mo d i f i ed Pa g e Wr i t e t o a Pag e 12. 5.2. 4 Fi l e Mo d i f i ed Pa g e Wr i t e Compl e t i o n 12. 5. 2 . 5 12. 5. 3 Upd a t e S e c t i o n Sy s t em S e r v i c e Pag e S e l e c t i o n 12. 5.3. 1 Wr i t e Compl e t i o n 12. 5 . 3 . 2 12. 6 PAG I NG AND S C HEDUL ING Pa g e Fa u l t Wa i t S t a t e 12. 6.1 12. 6.2 F r e e P a g e Wa i t S t a t e Co l l i d ed P a g e Wa i t S t a t e 12. 6.3 No Av a i l a b l e S p a c e i n the Pa g e F i l e 12. 6.4 C HAPTER 1 3 1 1 - 37 1 1 - 37 1 1-38 1 1-38 1 1-39 1 1-42 1 1-4 2 1 2-1 1 2-1 1 2-1 1 2-3 1 2-3 1 2 -4 1 2 -7 1 2-8 1 2- 1 0 1 2-1 0 1 2-1 2 1 2-1 2 1 2- 1 2 1 2- 1 5 1 2- 1 6 1 2 - 17 1 2-17 1 2- 1 8 1 2-19 1 2-20 1 2-20 1 2-20 1 2-21 1 2-21 1 2-24 1 2-25 1 2-2 5 1 2-25 12-26 1 2-28 1 2-28 1 2-29 1 2-29 1 2-29 1 2-30 1 2-30 1 2-30 1 2-30 1 2- 3 1 M EM ORY MANAG EM ENT SYS TEM S E RV I C E S D I S PATC H ME THOD F OR M EMORY MANAG EM ENT S Y S TEM S E RVI C E S VI RTUAL ADDR E S S C R EAT I ON AND DE L E T I ON 13. 2 Ad d r e s s S p a c e C r e a t i o n 13. 2.1 13. 2. 1. 1 L i m i t s o n Vi r t ua l Ad d r e s s Sp a c e C r e a t i o n 13. 1 ix 1 3 -1 1 3-2 1 3-2 1 3 -3 C ONTENTS 13.2. 1.2 E x p a n d Reg i o n Sy s t em S e r v i c e 13.2.1.3 Au t oma t i c Us e r S t a c k E x pa n s i o n 13.2.2 Ad d r e s s Spa c e De l e t i o n 13.2. 2. 1 D e l e t e V i r t u a l Ad d r e s s Spa c e Sys t em S e r v i c e 13.2.2.2 Pag e De l e t i o n a n d Sc h ed u l i ng 13.2. 2.3 Co n t r a c t Reg i o n Sy s t em S e r v i c e 13.2.3 Co n t r o l l ed Al l oc a t i o n o f V i r t ua l Memo r y 13. 3 PR I VA T E AND G LOBAL S ECT I ONS 13.3.1 C r e a t e a nd Ma p S e c t i o n Sys t em S e r v i c e 13.3.1.1 Pr i v a t e Sec t i on C r e a t i on G l o ba l Sec t i on C r ea t i on 13.3. 1. 2 G l o b a l S e c t i o n s i n Sh a r ed Memo r y 13.3.1.3 Ma p by PFN 13.3.1.4 Ma p G l o b a l S e c t i o n Sy s t em S e r v i c e 13. 3.2 De l e t e G l o b a l S e c t i o n Sys t em S e r v i c e 13.3.3 Upd a t e S e c t i o n Sys t em S e r v i c e 13.3.4 R E LATED S Y S T EM S ERVI C E S 13.4 Wo r k i ng S e t S i ze Ad j u s tme n t 13.4.1 13.4.1. 1 Ad j u s t Wo r k i ng S e t S i ze Sy s t em S e r v i c e S E T WO R K I NG S E T C omma nd 13.4. 1.2 Au t oma t i c Wo r k i ng Set S i z e Ad j us tm e n t 13.4.1.3 Pu r g e Wo r k i ng S e t Sys t em S e r v i c e 13.4.1.4 Lo c k i ng a n d Un l o c k i ng Pag e s 13.4.2 Lo c k i ng Pag e s i n th e Wo r k i ng S e t 13.4.2. 1 Lo c k i ng P a g e s i n Memo r y 13.4.2.2 Un l o c k i ng P a g e s 13.4.2. 3 P r o c e s s Swa p Mo d e 13.4.3 Al t e r i ng Pag e P r o t e c t i o n 13.4.4 C HAPTER 1 4 1 3-3 1 3-3 1 3-4 1 3-5 1 3-5 1 3-5 1 3-6 1 3-6 1 3-6 1 3-6 1 3 -7 1 3 -7 1 3 -8 1 3 -8 1 3-9 1 3- 1 0 1 3- 1 0 1 3- 1 0 1 3-1 1 1 3- 1 2 1 3- 1 2 1 3- 1 4 1 3- 1 4 1 3- 1 5 1 3- 1 5 1 3- 1 6 1 3- 1 6 1 3- 1 6 SWAPP I NG SWAPP I NG OVERVI EW Swa ppe r Re s po n s i b i l i t i e s Swa ppe r Impl em e n t a t i o n Compa r i so n o f Pag i ng a n d Swa pp i ng SWAP S C HE D U L ING S e l e c t i o n of I n s wa p C a nd i d a t e S e l e c t i o n o f O u t s wa p C a nd i d a t e s Sy s t em Ev e n t s Th a t T r i g g e r Swa ppe r Ac t i v i t y SWAPP E R ' S US E OF MEMORY MANAG EM E NT DATA S TR UC TUR E S P r o c e s s He ad e r 14. 3.1 Wo r k i ng S e t L i s t 14. 3 . 1 . 1 P r o c e s s Pa g e T a b l e s 14. 3. 1. 2 P r o c e s s He ad e r P a g e A r r a ys 14.3.1.3 14. 3 . 2 Swa ppe r I /G Da t a S t r uc t u r e s 14. 3.2. 1 Swa p F i l e Ta b l e E n t r i e s 14. 3 . 2. 1 . 1 Swa p F i l e I n i t i a l i z a t i o n 14. 3. 2 . 1 . 2 Al l o c a t i o n o f S wa p S l o t s 14. 3. 2. 2 Swa ppe r PTE A r r a y OUTSWAP O P E RAT I ON 14. 4 14. 4. 1 Se l ec t i o n o f O u t swa p Ca nd i d a te Ou t swa p o f t h e P r o c e s s Bo d y 14.4.2 Sc a n n i n g t h e Wo r k i ng S e t L i s t 14 . 4 . 2 . 1 Pag e s w i th D i r e c t I /0 i n P r o g r e s s 14. 4. 2. 2 G l o b a l Pag e s 14.4.2. 3 Ex ampl e o f P r o c e s s Bo d y O u t s wa p 14. 4. 2. 4 14.4. 3 O u t swa p o f P r o c e s s He ad e r Pa r t i a l O u t s wa p 14. 4. 3. 1 Sc a n n i ng t h e F r e e Pag e L i s t 14.4.3.2 14. 1 14. 1 . 1 14 . 1. 2 14 . 1 . 3 14. 2 14. 2 . 1 14. 2. 2 14. 2. 3 14. 3 X 1 4-1 1 4-1 1 4-2 1 4-2 1 4-2 1 4-4 1 4-4 1 4 -8 1 4- 1 0 1 4- 1 0 1 4- 1 0 1 4- 1 0 1 4-1 1 1 4-1 1 14-11 1 4-1 2 1 4- 1 2 14-12 1 4-1 3 1 4-1 3 1 4-1 3 1 4- 1 3 1 4- 1 4 1 4- 1 4 14-15 1 4- 2 0 1 4-20 1 4- 2 0 C ONTENTS F l u s h i ng t h e Mod i f i ed Pag e L i s t 14. 4. 3 . 3 O u t swa p o f t h e P r o c e s s He ad e r 14. 4. 3. 4 I N SWAP O P E RAT I ON 14 . 5 Se l e c t i o n o f a n In s wa p C a nd i d a t e 14 . 5. 1 I n s wa p o f t h e P r o c e s s H e a d e r 14 . 5. 2 Re b u i l d i ng t h e P r o c e s s Head e r 14 . 5. 2 . 1 14 . 5. 2 . 2 P l W i n d o w to the P r o c e s s H e a d e r Re b u i l d i ng t h e P r o c e s s Bo d y 14. 5. 3 Re b u i l d i ng t h e Wo r k i ng S e t L i s t a n d P r o c e s s 14 . 5. 3 . 1 Pag e Ta b l e s Pag e s w i t h I /0 i n P r o g r e s s Wh e n O u t s wa p 14.5.3.2 Oc c u r r e d Re s o l u t i o n o f G l o b a l Re a d - On l y Pag e s 14. 5. 3 . 3 Ac t i ve T r a n s i t i on Pag e s 14. 5. 3. 4 Ex ampl e o f a n I n swa p Ope r a t i o n 14 . 5. 3 . 5 F i n a l P r o c e s s i ng o f the I n swa p Ope r a t i o n 14 . 5. 3 . 6 PART V I N PUT/ O UT PUT C HA PTER 1 5 VAX/VM S DEVI C E DR IVE R S D I SK DR IVE R S 15. 1 ECC E r r o r Re c o ve r y 15. 1.1 Of f s e t Re c o ve r y 15. 1.2 Dy n am i c B a d B l o c k Ha n d l i ng 15. 1.3 Mul t i pl e- B l o c k No nc o n t i g uous Vi r t u a l I /0 15. 1.4 Ma ppi ng In fo rm a t i o n 15. 1.4.1 15. 1.4.2 No AC P I n t e r v e n t i o n AC P I n t e r v e n t i on 15. 1.4.3 MAGN E T I C TAPE DR IVERS 15. 2 TERM I NAL DR I VE R 15. 3 Al t e r n a t e Te rm i n a l D r i v e r s 15. 3. 1 Fu l l Dupl e x Op e r a t i o n 15. 3.2 C h a n n e l s a nd t h e DZ l l 15. 3.3 Typ e -Ah e ad B u f f e r 15. 3.4 15. 4 PS E UDO DEVI C E DR I VE R S Nu l l Dev i c e D r i v e r 15. 4.1 Ne two r k Dev i c e D r i v e r 15. 4.2 Ma i l box D r i v e r 15. 4. 3 P r o c e s s i ng S e t Mo d e Reque s t s 15.4.3.1 P r o c e s s i ng a Ma i l box Re a d Re que s t 15.4. 3.2 P r o c e s s i ng a Ma i l box Wr i t e Reque s t 15. 4. 3.3 C ON S O L E INTE RFAC E 15. 5 VAX- 1 1 / 7 5 0 C o n s o l e I n t e r f a c e 15. 5. 1 VAX- 1 1 /7 8 0 Co n s o l e I n t e r f a c e 15. 5. 2 Da t a T r a n s f e r b e twe e n the VAX- 1 1 C PU a nd 15. 5. 3 C o n s o l e Dev i c e s Co n s o l e I n t e r r upt D i s pa t c h i ng 15. 5.4 Co n s o l e Te rm i n a l I n t e r r upts 15. 5. 4 . 1 Co n s o l e B l o c k S t o r ag e Dev i c e I /0 15. 5. 4 . 2 Do ub l e Ma p p i ng o f B u f f e r Pag e s 15. 5. 4. 3 C HAPTE R 1 6 1 4-21 1 4-21 1 4-21 1 4-22 1 4 -2 2 1 4 -2 3 1 4-23 1 4 -2 4 1 4-24 1 4-24 1 4-25 1 4 -2 6 1 4 -2 6 1 4-27 1 5-1 1 5 -2 1 5- 3 1 5 -4 1 5 -4 1 5-4 1 5- 5 1 5-5 1 5- 6 1 5 -7 1 5 -7 1 5 -9 1 5-1 0 1 5- 1 1 1 5-1 1 1 5- 1 1 1 5-1 1 1 5-1 2 1 5-1 2 1 5-1 3 1 5-1 5 1 5-16 1 5-1 6 1 5-1 6 1 5- 1 7 1 5-1 8 1 5- 1 8 1 5-1 8 1 5-1 9 I /0 SYSTEM S ERVI C E S A S S IGN ING AND D E AS S I GN ING C HANNE LS 16. 1 Ch a nn e l As s i g nm e n t 16. 1.1 Lo c a l Dev i c e As s i g nm e n t 16. 1.1.1 xi 1 6-1 1 6-1 1 6- 2 C ONTENTS Spec i a l Ac t i o n Wh e n As s i g n i ng a S p o o l ed Dev i c e As s i g n i ng a Ch a n n e l t o the Ne t wo r k Dev i c e 16 . 1 . 1 .3 Dev i c e s Loc a t e d o n An o th e r No d e 16 . 1 . 1 .4 Ch a nn e l De a s s i g nm e n t 16 . 1 . 2 DE V I C E AL LOCAT I ON AND DEALLOCAT I ON 16 . 2 Dev i c e Al l o c a t i o n 16 . 2. 1 Dev i c e De a l l o c a t i o n 16 . 2. 2 $ Q I O S Y S TEM S E RVI C E 16 . 3 Dev i c e - I nd e pe n d e n t P r e p r o c e s s i ng 16 . 3 . 1 FDT Ro u t i n e s 16 . 3. 2 I /0 Po s t p r o c e s s i ng 16 . 3. 3 D i r e c t I /0 Compl e t i o n 16 . 3 . 3.1 B u f f e r ed I /0 Comp l e t i o n 16. 3. 3. 2 I /0 CANC E L LAT I ON 16 . 4 MA I LB O X C R EAT I ON AND D E LE T I ON 16 . 5 Ma i l bo x C r e a t i o n 16 . 5 . 1 Ma i l b o x C r e a t i o n i n Sh a r ed Memo r y 16. 5. 2 Ma i l bo x De l e t i o n 16 . 5 . 3 B R OADCAST S Y S TEM S E RVI C E 16. 6 I N FORMAT I ONA L S E RVI C E S 16.7 Dev i c e - I n d e pend e n t I n f o rm a t i o n 16 . 7 . 1 G e t Ch a n n e l /De v i c e I n fo rm a t i o n 16 . 7 . 1 .1 Dev i c e -D e p e nd e n t I n fo rma t i o n 16 . 7 . 2 16 . 1. 1 . 2 PART VI PROC E S S C REAT I ON AND D E L E T I ON C HAPTER 1 7 PROC E S S C REAT I ON 17 . 1 17 . 1 . 1 17 . 1 . 2 17 . 1 . 3 17 . 1 . 4 17 . 2 17 . 2 . 1 17 . 2. 2 17 . 3 17 . 3 . 1 17 . 3. 2 C HAPTER 1 8 C R EATE PROC E S S SYS TEM S E RVI C E Con t r o l F l o w o f C r e a te P r o c e s s E s t a b l i s h i ng Q uo t a s fo r t h e N e w P r o c e s s Th e PC B Ve c to r Fa b r i c a t i o n o f P r o c e s s I Ds T H E S H E L L PROC E S S I n s wa p f r o m S H E L L Co n f i g u r a t i o n o f the P r o c e s s He a d e r PROC E S S CREAT I ON I N THE C ONTE XT O F THE N EW PROC E S S Ope r a t i o n o f PROC S TRT C a tch Al l Co nd i t i o n Hand l e r 1 6-3 1 6- 3 1 6- 3 1 6- 3 1 6 -4 1 6- 5 1 6- 5 1 6-6 1 6-6 1 6- 7 1 6 -8 1 6 -8 1 6- 9 1 6-1 0 1 6-1 1 1 6- 1 1 1 6- 1 3 1 6- 1 6 1 6- 1 6 1 6- 1 8 1 6- 1 8 1 6- 1 9 1 6- 1 9 1 7- 1 1 7- 1 1 7 -8 1 7-9 1 7-9 1 7-1 2 1 7- 1 3 1 7-1 3 1 7- 1 6 1 7-1 6 1 7-1 9 I MAG E AC T I VA T I ON AND TERM I NA T I ON 18 . 1 IMAG E I N IT IAT I ON 18 . 1 . 1 Imag e Ac t i v a t i o n Impl em e n t a t i o n o f the Im a g e Ac t i v a t o r 18 . 1 . 1 . 1 18 . 1 . 1 . 2 Ov e r v i e w o f I m ag e Ac t i v a t i o n Ac t i v a t i o n o f a n Imag e w i th No G l o b a l 18 . 1 . 1 .3 Se c t i o n s Ac t i v a t i o n o f Imag e Co n t a i n i ng G l o b a l 18 . 1 . 1 .4 Sec ti ons 18 . 1 . 1.5 I n i t i a l Ac t i v a t i o n o f Known Imag e 18 . 1. 1. 6 La t e r Ac t i v a t i o n o f Known Imag e 18 . 1 . 1.7 Ac t i v a t i o n o f Compa t i b i l i t y Mo d e I ma g e s Imag e S t a r t u p 18 . 1 . 2 18 . 1. 2. 1 T r a n s f e r Ve c to r Ar r a y 18 . 1. 2. 2 I m a g e S t a r t up Sys t em S e r v i c e xii 1 8-1 1 8-1 1 8-3 1 8-5 1 8-5 1 8-1 1 1 8-1 2 1 8-1 5 1 8-1 5 1 8- 1 6 1 8- 1 6 1 8-1 7 C ONTENTS 18.1.2.3 E x c e p t i o n H a nd l e r f o r Tr a c e b a c k 18.2 I MAG E E X I T Co n t r o l F l ow o f t h e E x i t Sys t em Se r v i c e 18.2.1 Ex amp l e o f Te r m i n a t i o n H a nd l e r L i s t P r o c e s s i ng 18. 2 . 2 18. 3 IMAGE AND PROC E S S RUNDOWN 18.3.1 C o n t r o l F l ow o f Rund own PROC E S S PR I VI LEG E S 18. 4 18. 4 . 1 P r o c e s s P r i v i l eg e Ma s k s S e t P r i v i l eg e Sy s t em Se r v i c e 18. 4. 2 C HAPTER 1 9 19. 1 19. 1.1 19. 2 19. 2. 1 19. 2.2 19. 2. 3 C HAPT E R 2 0 1 8- 1 7 18-18 1 8- 1 8 1 8- 1 9 18-20 18-21 18-23 18-24 18-24 PROC E S S D E LE T I ON PROC E S S DE L E T I ON IN C ONT E XT OF CALLER De l e t e P r o c e s s Sys t em Se r v i c e PROC E S S DE L ET I ON IN C ONTE XT OF PROC E S S B E ING DE LETED S p e c i a l Ke r n e l AST f o r P r o c e s s De l e t i o n De l e t i o n o f a P r o c e s s Th a t Own s S ubp r o c e s s e s Ex amp l e o f P r o c e s s De l e t i o n wi t h Sub p r o c e s s e s 1 9-1 1 9-1 1 9-2 1 9-2 1 9-5 1 9-6 INT E RAC T I VE AND BATC H JOBS T H E JOB C ONTRO L L E R AND UNS O L I C I T E D I N PUT 20 . 1 2 0-1 Un s o l i c i ted Te rm i n a l I n pu t 2 0-1 20. 1 . 1 20-4 Th e S U BM I T Comma nd 20. 1 . 2 Un s o l i c i t ed C a r d Read e r I n pu t 2 0 -4 20. 1. 3 20-5 T H E LOG I NOUT I MAG E 20 . 2 20-5 I n t e r a c t i v e Jo b s 20. 2. 1 LOG INOUT Ope r a t i o n fo r Ba t c h Jo b s 2 0 -8 20 . 2. 2 2 0-8 Th e Lo g o u t Ope r a t i o n 20. 2. 3 C OM MAND LANG UAG E INTE R PRETERS AND I MAG E E XE C UT I ON 2 0 -9 20. 3 C L I In i ti a l i za t i on 2 0-9 20. 3. 1 20-11 Comma n d P r o c e s s i ng Lo o p 20. 3. 2 20-12 I m a g e I n i t i a t i o n b y DC L 20. 3. 3 I m a g e Te r m i n a t i o n 20-14 20. 3 . 4 2 0-1 4 Ab n o rm a l I m ag e Te rm i n a t i o n 20. 3. 5 CTR L/Y P r o c e s s i ng 20-1 4 20. 3. 5 . 1 2 0-1 5 20. 3. 5. 2 Th e Pa u s e C a pa b i l i t y Th e S t a te o f I n t e r r up t ed Imag e s 20-1 5 20. 3. 5 . 3 C ONT I N U E Comma nd 20-16 20. 3. 5. 4 20-16 DE BUG Comm a n d 20. 3. 5. 5 20-16 E X I T Comm a n d 20. 3 . 5 . 6 20-1 6 STOP C o mmand 20. 3 . 5 . 7 PART VI I S Y S TEM I N I T IA L I Z AT I ON C HAPTER 2 1 B OOTSTRA P PROC EDUR ES PROC E S S OR - S PEC I F I C I N I T IA L I Z ATI ON 21. 1 VA X-1 1 /7 5 0 I n i t i a l Bo o t s t r a p Ope r a t i o n 21. 1 . 1 VAX- 1 1 /7 5 0 C o n so l e P r o g r am 21. 1. 1 . 1 Dev i c e - S pe c i f i c ROM P r o g r am 21. 1 . 1 . 2 Bo o t B l o c k P r o g r am 21. 1 . 1 . 3 BOOT 5 8 21 . 1 . 1 . 4 VAX- 1 1 /7 8 0 I n i t i a l Boo t s t r a p Ope r a t i o n 21. 1.2 PR IMARY B O OTSTRA P PROGRAM 21 . 2 Mo t i va t i o n fo r Two Boo t s t r a p P r o g r am s 21. 2. 1 xii i 21-1 2 1-1 2 1-2 2 1-2 21-5 21-5 2 1-6 2 1 -7 2 1-8 CONTENTS 21. 2 . 2 21. 2.3 21 . 2 . 4 21 . 3 21 . 3 . 1 C HAPTER 2 2 Ope r a t i o n o f VMB Boo t s t r a p D r i v e r and I /O S u b r o u t i ne s F i l e Ope r a t i o n s S E C ONDARY BOOTSTRA P PROG RAM ( S YSBOOT ) De t a i l ed Ope r a t i o n o f S Y S B OOT O P E RATING SYS TEM I N I T I A L I Z AT I ON 22. 1 I N I T IA L E XE C U T I ON OF THE E XE C UT I VE ( I N I T ) 22. 1 . 1 Tu r n i ng o n Memo r y Ma n ag em e n t Do ub l e Ma p p i ng o f I N I T b y SYSB OOT 22. 1 . 1 . 1 I n s t r uc t i o n s Th a t Tu r n o n Memo r y Ma n ag em e n t 22. 1 . 1 . 2 I n i t i a l i za t i on o f the Execut ive 22. 1 . 2 I /O Ad a pt e r I n i t i a l i za t i o n 22. 1 . 3 C PU-De p e nd e n t Ro u t i n e s 22. 1 . 4 22. 2 I N I T I A L I Z AT I ON I N PROC ES S C ONTEXT S Y S I N I T Pr o c e s s 22. 2 . 1 Po o l Usag e by SYS I N I T 22. 2 . 1 . 1 D e t a i l ed Ope r a t i o n o f SYS I N IT 22. 2. 1 . 2 22. 2 . 2 Th e S TARTUP P r o c e s s S TARTUP . C OM 22. 2 . 2. 1 S i t e- S p e c i f i c S t a r t up Command F i l e 22. 2 . 2. 2 22. 3 THE S Y S G E N PR OGRAM 22. 3 . 1 C o n t e n t s o f Pa r am e t e r B l o c k U s e o f Pa r am e t e r F i l e s b y SYSBOOT 22. 3 . 2 U s e o f Pa r am e t e r F i l e s b y SYSGEN 22. 3 . 3 C HAPTER 2 3 2 1 -9 21-14 21-14 2 1-1 5 21-1 5 2 2-1 22-1 22-2 22-3 22-5 2 2-1 0 2 2-1 1 2 2- 1 3 2 2-1 3 2 2- 1 5 22-1 5 2 2- 1 7 22-18 2 2-1 8 22-19 22-19 22-19 2 2-2 3 POW ERFA I L REC OVERY POWERFAI L S E QUENC E 23. 1 POW E R R E C OVE R Y 23 . 2 23. 2 . 1 I n i t i a l S t e p i n Po we r Re c ov e r y Po we r Rec o v e r y o n the VAX- 1 1 /7 5 0 23 . 2 . 1 . 1 Po we r Rec o v e r y o n t h e VAX- 1 1/7 8 0 23. 2 . 1 . 2 Ope r a t i o n o f t h e Re s t a r t Ro u t i n e 23. 2. 2 Dev i c e No t i f i c a t i o n 23. 2 . 3 P r o c e s s No t i f i c a t i o n 23. 2 . 4 $ S E T PRA Sys tem S e r v i c e 23. 2 . 4 . 1 D e l i v e r y o f Powe r Re c o v e r y ASTs 23. 2.4.2 MULT I P L E POW E R FA I LURES 23. 3 N e s t ed Powe r Fa i l I n t e r r up t s 23. 3 . 1 P r ev e n t i o n o f Ne s t ed Re s t a r t s 23. 3 . 2 Dev i c e Dr i v e r Ac t i o n 23. 3 . 3 23. 4 POW E R FA I LURE O N THE UN I B US UN I B US Powe r Fa i l u r e o n the VAX- 1 1 /7 5 0 23. 4 . 1 UN I B US Powe r Fa i l u r e o n the VAX- 1 1 /7 8 0 23. 4 . 2 PART VI I I M I S C E L LANEOUS TOP I C S C HA PTER 2 4 SYNC HRON I Z AT I ON TECHN I QU E S E L EVAT E D I PL 24 . 1 Us e o f I P L $ S YN C H 24. 1 . 1 24. 1 . 2 Ot h e r I P L Leve l s Used fo r Sync h r o n i za t i o n 24. 1 . 2 . 1 I PL 3 1 24. 1.2.2 I PL 24 De v i c e I P L 24. 1.2.3 x iv 2 3-1 2 3-1 2 3-3 2 3- 3 23-4 23-5 2 3-7 2 3-8 2 3-8 2 3-8 23-9 23-9 23-9 23-10 2 3- 1 0 2 3-1 1 2 3- 1 1 2 4 -1 24-3 2 4-3 24-4 24-4 2 4-4 C ONTENTS Fo r k I PL 24 . 1 . 2 . 4 I P L $ Q U E UEAST 24 . 1 . 3 I PL 2 24. 1 . 4 S E R IA L I Z E D AC C E S S 24 . 2 Fo r k P r o c e s s i ng 24 . 2 . 1 I /0 Po s t p r o c e s s i ng 24 . 2 . 2 MUTUA L E XC LUS I ON S EMAPH OR E S ( MUTEXE S) 24 . 3 Lo c k i ng a M u t e x fo r Re a d Ac c e s s 24 . 3 . 1 Lo c k i ng a M u t e x fo r Wr i t e Ac c e s s 24 . 3 . 2 Mu t e x Wa i t S t a t e 24 . 3 . 3 Un l o c k i ng a M u t e x 24 . 3 . 4 Re s o u r c e Wa i t S t a t e 24. 3. 5 C HAPTER 2 5 25. 1 25. 1 . 1 25. 1 . 2 25. 1 . 3 25. 1 . 4 25. 2 25. 2. 1 25. 2. 2 25. 3 25. 3. 1 25. 3. 2 25. 3. 3 C HAPTER 2 6 26. 1 26 . 1 . 1 26 . 2 26 . 2 . 1 26 . 2 . 2 26 . 2 . 3 26. 2. 4 26 . 2 . 5 C HAPTER 2 7 24-4 24-5 24-5 2 4-6 24-6 24-7 2 4-7 24-9 24-9 2 4- 1 0 24-1 0 24-1 1 DYNAM I C M EMORY A L LOCAT I ON A L LOCAT I ON S TRATEGY AND I M P LEM ENTA T I ON Al l o c a t i o n o f Dyn am i c Memo r y De a l l o c a t i o n o f Dyn am i c Memo r y S yn c h r o n i z a t i o n G r a n u l a r i t y o f Al l o c a t i o n PREA LLOCATED I /0 R E Q U E S T PAC K E T S Al l o c a t i o n f r om t h e Lo o k a s i d e L i s t De a l l o c a t i o n t o the Lo o k a s i d e L i s t US E O F DYNAM I C M EM ORY · P r o c e s s Al l o c a t i o n Re g i o n P a g e d Dyn am i c Mem o r y No n pa g e d Dy n a m i c Memo r y 2 5-1 2 5- 1 2 5-2 2 5- 7 2 5-9 2 5-9 2 5-9 2 5-1 0 2 5- 1 1 2 5-1 1 2 5-1 1 2 5-1 3 LOG I C A L NAM E S L OG I C AL NAM E TAB L E S Log i c a l N a m e B l o c k LOG I CA L NAM E SYS TEM S ERVI C E S P r i v i l eg e a n d P r o t e c t i o n Ch e c k s Log i c a l Name Ta b l e M u t e x e s Log i c a l Name C r e a t i o n Lo g i c a l Name De l e t i o n Lo g i c a l Name T r a n s l a t i o n 26-1 26-1 26-3 26-4 2 6-4 26-4 2 6-4 2 6- 5 M I SC E LLANEOUS S YS T EM S ERVI C E S C OMMUN I C AT I ON W I TH S Y S TEM PROC E S S E S 27. 1 Ac c o un t i ng Ma n ag e r ( Jo b Co n t r o l l e r ) 2 7 . 1 . 1. Symb i o n t Ma n ag e r ( Jo b Co n t r o l l e r ) 27 . 1 . 2 Op e r a t o r Commun i c a t i o n s 27 . 1 . 3 E r r o r Logg e r 27 . 1 . 4 SYS T EM M E S SAG E F I LE S ERVI C E S 27 . 2 G e t Me s s ag e Sys t em S e r v i c e 27. 2. 1 F i n d i ng t h e Me s s ag e F i l e s 27 . 2 . 1 . 1 S e a r c h i ng a Lo c a t e d Me s sag e S e c t i o n 27 . 2 . 1 . 2 P u t Me s s a g e Sy s t em S e r v i c e 27. 2 . 2 P r o c ed u r e E XE $ E XCMSG 27 . 2 . 3 PROC E S S INF ORMAT I ON ( $G E TJ P I ) 27 . 3 Ope r a t i o n o f t h e $ G E TJ P I Sys tem S e r v i c e 27 . 3. 1 $G E TJ P I Spec i a l Ke r n e l A S Ts 27 . 3 . 2 W i l d C a r d S uppo r t i n $G E TJ P I 27 . 3. 3 FORMATT I NG S U P PORT 27 . 4 T i m e C o nv e r s i o n S e r v i c e s 27 . 4 . 1 F o r m a t ted A S C I I O u t p u t 27. 4. 2 XV 27-1 2 7- 1 2 7-2 2 7- 3 27-3 2 7- 4 2 7- 4 27-5 2 7- 6 27-6 2 7-7 2 7-7 2 7-8 27-9 27-1 0 2 7- 1 0 27- 1 1 27-1 1 C ONTENTS Pag e APPEND I C ES APPEND I X A US E OF L I S T ING AND MAP F I L ES H I NTS IN R EAD ING T H E E XE C UT IVE L I S T INGS A.1 S t r uc t u r e of a MAC RO L i s t i ng F i l e A.1. 1 $ x y z D E F Ma c r o s A. l. l. l Th e Ro u t i n e B o d y A. 1. 1. 2 The VA X- 1 1 I n s t r uc t i o n S e t a nd Ad d r e s s i ng Mo d e s A. 1 . 2 Te c h n i que s fo r I n c r e a s i ng In s t r uc t i o n Speed A. l . 2. 1 Un us ua l I n s t r uc t i o n a nd Ad d r e s s i ng Mo d e Us a g e A. l . 2. 2 Us e o f the R E I I n s t r uc t i o n A. 1. 3 Reg i s t e r C o n v e n t i o n s A. 1 . 4 E l i m i n a t i o n o f S e l d om - U s ed Cod e A. l . 5 E l i m i n a t i ng the Bo o t s t r a p P r og r am s A. 1 . 5. 1 S e l d om-U s e d Sys t em Ro u t i n e s A. 1 . 5. 2 Dyn am i c a l l y Lo c k i ng Co d e o r Da t a i n to Memo r y A. 1 . 6 Lo c k i ng Pag e s i n Ex t e r n a l Imag e s A. l . 6 . 1 Pl a c i ng Co d e i n t h e No n pag ed E x e c u t i v e A. 1 . 6 . 2 Dy n am i c Lo c k i ng o f Pag e s A. l . 6. 3 US E O F MAP F I LE S A. 2 The Ex e c u t i v e Ma p SYS . MAP A. 2. 1 RMS . MAP a nd DC L . MAP A. 2.2 D e v i c e D r i v e r Ma p F i l e s A. 2. 3 C PU-D e p e nd e n t Ro u t i n e s A. 2. 4 O t h e r Ma p F i l e s A.2. 5 T H E S YS TEM D UM P ANA LY Z E R ( S DA ) A. 3 G l o b a l Lo c a t i o n s A. 3 . 1 L a yo u t o f Sy s t em V i r t ua l Ad d r e s s Spa c e A. 3. 2 La yo u t o f P l S pa c e A. 3. 3 I NTERPR E T I NG MDL F I L E S A. 4 S a m p l e S t r uc t u r e De f i n i t i o n s A. 4. 1 Common l y Us ed M D L Comma nd s A. 4 . 2 $ S TRUC T D i r e c t i v e A. 4 . 2. 1 F Di r e c t i ve A.4. 2. 2 L Di r ect ive A. 4. 2. 3 E Di r ec t i v e A. 4 . 2. 4 S Di r ec t i ve A.4. 2. 5 C Di r e c t i ve A. 4 . 2 . 6 M a nd P D i r e c t i v e s A. 4 . 2. 7 B i t F i e l d De f i n i t i o n s - Th e V D i r e c t i v e A.4. 3 APPEND I X B B.l B. 1. 1 B.1.2 B.l. 3 B.1.4 B.l.5 B.1.6 B.1.7 B.l.8 B.1.9 B . l . lO B. 1 . 11 8. 1 . 12 8. 1 . 13 8 . 1 . 14 A- 1 A- 1 A-1 A-2 A- 4 A- 5 A- 7 A-8 A- 1 0 A- l l A- l l A- l l A- 1 2 A- 1 2 A- 1 2 A- 1 3 A-1 4 A-1 4 A- 1 5 A- 1 6 A- 1 6 A- 1 6 A- 1 6 A- 1 7 A- 1 7 A- 1 7 A- 1 7 A- 1 8 A-1 8 A- 1 8 A- 2 2 A- 2 2 A- 2 2 A- 2 2 A- 2 2 A- 2 3 A- 2 3 E X E C U T I VE DATA AREAS B-1 S TAT ICALLY A L LOCATED E XE C UT IVE DATA B-1 Sy s t em S e r v i c e Ve c to r A r e a ( $ $ $ 0 0 0 ) F i l e Sys tem Pe r f o rm a n c e Mo n i to r Da t a ( $ $ $ 0 0 0 PM S ) B-2 B-2 M i s c e l l a n e o us Bug c hec k I n fo rma t i o n ( $ $ $ 0 2 5 ) Da t a S t r uc t u r e s fo r D r i v e r s L i n k ed wi th VMS B-2 ($$$100) D r i v e r P r o l og u e Ta b l e s ( $ $ $ 1 0 5 PROLOG U E ) B-3 L i n k ed D r i v e r Cod e ( $ $ $ 1 1 5 D R I V E R ) B-4 Mem o r y Ma n ag em e n t Da t a ( $ $ $ 2 1 0 ) B-4 B-5 Pag e Fa u l t Mo n i to r Da t a ( $ $ $ 2 1 5 ) S c h ed u l e r Da t a ( $ $ $ 2 2 0 ) B-5 M emo r y Ma n ag em e n t Da t a ( $ $ $ 2 2 2 ) B-7 P r o c e s s Da t a fo r Sy s t em P r o c e s s e s ( $ $ $ 2 3 0 ) B-7 Co n so l e I n t e r r up t D i s p a t c h Da t a ( $ $ $ 2 5 0 ) B-8 S YS C OMMON - M i s c e l l a n e o u s Ex e c u t i v e Da t a B-8 ( $$$260 ) S t a t i s t i c s U s ed by D I S PLAY ( $ $ $ 2 7 0N P ) 8- 1 2 xvi C ON TENTS E n t r y Po i n t s fo r C PU-D e p e nd e n t Ro u t i n e s B. 1 . 15 Ta b l e o f Ad j us t a b l e SYS B OOT Pa r am e t e r s ( $ $ $ 9 1 7 ) B. 1 . 16 Rem a i nd e r o f E x e c u t i v e Imag e B. 1 . 17 DYNAM I CA L LY A L LOCATED E XE C UT IVE DATA B.2 Re s t a r t Pa r am e t e r B l o c k B. 2. 1 PFN D a t a Ba s e B.2. 2 Pag ed Dyn a m i c Mem o r y B.2. 3 N o n p a g e d Dyn am i c Memo r y B.2.4 I n t e r r u pt S t a c k B.2.5 Sys t em Co n t r o l B l o c k B.2.6 Ba l ance Slot Area B.2.7 Sy s t em He a d e r B.2.8 Sys t em Pag e Ta b l e B.2.9 G l o b a l Pa g e Ta b l e B.2. 10 PROC E S S -S PE C I F I C E XE C UT I VE DATA B. 3 P l Po i n t e r Pa g e B. 3. 1 O t h e r P l Spa c e D a t a A r e a s B.3. 2 Da t a Pag e s fo r Command Lang uag e I n t e r pr e t e r B.3.2.1 P r o c e s s A l l o c a t i o n Reg i o n B. 3. 2 . 2 Compa t i b i l i t y Mo d e Co n t e x t Pag e B. 3. 2. 3 P r o c e s s I /O Segme n t B. 3. 2 . 4 A PPEN D I X C C.1 C.2 C.3 A P PEND I X D B-1 3 B-1 4 B-2 2 B-22 B-22 B-22 B-22 B-2 3 B-2 3 B-23 B-2 3 B-2 3 B-23 B-23 B-24 B-24 B-26 B-2 6 B-2 7 B-27 B-27 NAM ING C ONVENT I ONS P UB L I C SYMBOL PATTERNS OBJECT DATA TYPE S FAC I L I TY PREF I X TAB L E C-1 C-8 C-9 DATA STRUC TURE D E F I N IT I ONS E XE C UT I VE DATA STR UC TUR E S D. l ACB - AST C o n t r o l B l o c k D. l. l ACC - Ac c o un t i ng a nd Te rm i n a t i o n Me s s ag e B l o c k D. l . 2 ARB - Ac c e s s R i g h t s B l o c k D. l . 3 B RD - B r o ad c a s t Me s s ag e D e s c r i pto r B l o c k D. 1.4 C E B - Common Ev e n t B l o c k D. l . 5 C HF - C o nd i t i o n H a nd l e r A r g um e n t L i s t A r r ay s D. l . 6 DM P - H e a d e r B l o c k o f Sy s t em Dump F i l e D. l . 7 EMB - E r r o r Lo g Me s s a g e B l o c k D. l . 8 EMB , CR - C r a sh / Re s t a r t E r r o r Log En t r y Fo rma t D. l . 8 . 1 EMB , HD - Lo ngwo rd H e a d e r fo r A l l En t r i e s D. l . 8 . 2 FKB - Fo r k B l o c k D. l . 9 G S D - G l o b a l S e c t i o n De sc r i pto r D. l . l O IAC - Imag e Ac t i v a t i o n Co n t r o l F l ag s D. 1 . 11 I FD - Imag e F i l e De sc r i pto r B l o c k D. 1. 12 I Hx - Imag e He a d e r F i e l d s D. 1 . 13 I HA - I m a g e He a d e r Tr a n s f e r Ad d r e s s A r r a y D. l . l3. 1 I H D - I m a g e He a d e r Re c o r d De f i n i t i o n s D. 1 . 1 3 . 2 Imag e He ad e r Id e n t i f i c a t i o n Se c t i o n IHI D. 1 . 13 . 3 I H P - I m ag e He a d e r Pa t c h Se c t i o n D. 1 . 13 . 4 I H S - I m ag e He a d e r Symbo l Ta b l e a n d De b ug D. 1 . 1 3 . 5 Sec t i o n I S D - Imag e Sec t i o n De sc r i pto r D. 1 . 14 J I B - Job I n fo rma t i o n B l o c k D. 1 . 15 KFH - Known F i l e Head e r D. 1 . 16 D. l . l7 K F I - Known F i l e En t r y K F P - Kn own F i l e Po i n t e r B l o c k D. l . l8 LOG - Log i c a l Name B l o c k D. l . l9 M B X - Sh a r ed Memo r y Ma i l box Co n t r o l B l o c k D. l . 20 xvi i D-3 D-3 D-3 D-4 D-4 D-4 D-4 D- 5 D-5 D-5 D-5 D-5 D- 6 D- 6 D-6 D-6 D-6 D-7 D-7 D-7 D-7 D-7 D-7 D-7 D-8 D-8 D-9 D-9 C ONTENTS 0. 1 . 21 MCHK - Ma c h i ne Ch e c k E r r o r Ma s k B i t De f i n i t i o n s 0. 1 . 22 MPM - M u l t i po'r t Memo r y Ad a p t e r Reg i s t e r s 0. 1 . 23 MTX - M u t e x ( Mu t u a l E x c l u s i o n S em a ph o r e } PC B - P r o c e s s Co n t r o l B l o c k 0 . 1 . 24 So f t wa r e P r o c e�s C o n t r o l B l o c k 0 . 1 . 2 4,. 1 0 . 1 . 24 . 2 Ha r dwa r e P r o c e s s C o n t r ol B l o c k PF L - P a g e F i l e Co n t r o l B l o c k 0. 1 . 25 PFN - PFN Da t a Ba s e De f i n i t i o n s 0. 1 . 26 PHD - P r o c e s s He a d e r 0 . 1 . 27 P LV - P r i v i l eg ed L i b r a r y Ve c to r 0 . 1 . 28 P QB - P r o c e s s Quo t a B l o c k 0. 1 . 29 PRM - P a r ame t e r De sc r i pto r B l o c k 0 . 1 . 30 PS L - P r o c e s so r S t a t u s Longwo rd 0. 1 . 31 PT E - P a g e Ta b l e E n t r y Fo rma t s 0. 1 . 32 PTR - P o i n t e r Co n t r o l B l o c k 0 . 1 . 33 RBM - R e a l - T i m e B i tma p 0. 1 . 34 R PB - R e s t a r t Pa r am e t e r B l o c k 0. 1 . 35 S E C - S e c t i o n Ta b l e En t r y 0. 1 . 36 S F T - S wa p F i l e Ta b l e E nt r y 0 . 1 . 37 S H B - S h a r ed Memo r y Co n t r o l B l o c k 0. 1 . 38 S H D - S h a r ed Memo r y Da t a Pag e 0 . 1 . 39 S T S - R e t u r n S t a t u s F i e l d De f i n i t i o n s 0. 1 . 40 T Q E - T i m e r Qu e ue E l eme n t 0. 1 . 41 VA - V i r t ua l Ad d r e s s F i e l d D e f i n i t i o n s 0 . 1 . 42 WQH - S c h e d u l e r Wa i t Que ue H e ad e r 0. 1 . 43 WS L - Wo r k i ng Se t L i s t E n t r y F i e l d De f i n i t i o n s 0. 1 . 44 CONSTANT S 0. 2 B T D - B o o t s t r a p Dev i c e Co d e s 0.2.1 C A - C o nd i t i o n a l As s emb l y Pa r ame t e r s 0. 2. 2 DYN - D a t a S t r uc t u r e Typ e De f i n i t i o n s 0. 2. 3 I 0 7 x x - I /O Spa c e Ad d r e s s S p e c i f i c a t i o n s 0. 2. 4 ! 0 7 5 0 - VAX- 1 1 /7 5 0 Phys i c a l Ad d r e s s Spa c e 0. 2. 4 . 1 De f i n i t i o n s ! 0 7 8 0 - VAX- 1 1 /7 8 0 Ph ys i c a l Ad d r e s s Spa c e 0. 2. 4 . 2 De f i n i t i ons I P L - P r o c e sso r P r i o r i t y Le v e l De f i n i t i o n s 0. 2. 5 J P I - $G E TJ P I Da t a I d e n t i f i e r De f i n i t i o n s 0. 2.6 MSG - S y s t em Wi d e Ma i l bo x Me s s a g e Type s 0. 2 . 7 NOT - N e x u s ( Ad a pt e r ) D e v i c e Type 0. 2 .8 P Q L - P r o c e s s Quo t a L i s t C o d e s 0. 2.9 P R - P r o c e sso r Reg i s t e r De f i n i t i o n s 0. 2 . 10 0. 2 . 11 PR I - P r i o r i t y I n c r emen t C l a s s De f i n i t i o n s 0. 2. 12 P R T - P r o t ec t i o n F i e l d D e f i n i t i o n s PRV - P r i v i l eg e B i t De f i n i t i o n s 0. 2 . 13 R S N - R e s o u r c e Name De f i n i t i o n s 0. 2. 14 SGN - S YS G E N Pa r am e t e r C o n s t a n t De f i n i t i o n s 0. 2 . 15 S S - S y s t em S e r v i c e Compl e t i o n Cod e s 0. 2. 16 S TATE - S c h e d u l i ng S t a t e s 0. 2 . 17 DATA S TR UC TUR E S US ED B Y T H E I / 0 SYS TEM 0. 3 DATA S TR UC TUR E S US ED BY F I LE S - 1 1 0. 4 M I S C E L LAN EOUS DATA S TR UC TUR E S AND C ONSTANTS 0. 5 xvi i i D- 9 D-9 D-9 D-9 D-1 0 D- 1 0 D- 1 0 D- 1 0 D-1 3 D-1 3 D-13 D-13 D-16 D-16 D-16 D-16 D-16 D-1 7 D-17 D-17 D-17 D-17 D-1 7 D- 1 8 D- 1 8 D-18 D-18 D-18 D- 18 D- 1 9 D- 1 9 D-19 D- 2 1 D- 2 1 D- 21 D- 2 1 D- 2 2 D- 2 2 D- 2 2 D- 2 2 D- 2 3 D- 2 3 D- 2 3 D- 2 4 D- 2 4 D- 2 4 D- 2 5 D- 2 6 D- 2 7 CONTENTS A PP E ND I X E E.l E.l. l E.l.2 E.l.3 E.2 E. 2. 1 E.2.2 E . 2. 3 E.2.4 E.3 E. 3.1 E.3.2 E.4 A P PEND I X F F. l F.l.l F.l . 2 F. 2 F.2.1 F.2.2 S I Z E OF SYS TEM VI RTUA L ADDR E S S S PAC E S I Z E OF PROC E S S H EADE R P r o c e s s Pa g e Ta b l e s Wo r k i ng S e t L i s t and P r o c e s s S e c t i o n Tab l e P r o c e s s He ad e r Pag e A r r a y s S Y S T EM V I R TUA L ADDR E S S S PA C E S y s t em V i r t ua l Ad d r e s s S p a c e a nd SYSB OOT Pa r am e t e r s S y s t em P a g e T a b l e a nd t h e PFN Da t a Ba s e App r o x i ma t i o n U s ed b y S Y S B OOT Re n o r ma l i za t i o n of S PTREQ P HYS ICAL M EMORY R E QU I R EM ENTS OF THE E XE C UT I VE Ph y s i c a l Memo r y U s e d by the E x e c u t i v e Sy s t em P r o c e s s e s S I Z E S O F P I EC E S O F P l S PAC E E-1 E-3 E-3 E-3 E-5 E- 1 0 E- 1 3 E- 1 4 E- 1 5 E- 1 5 E- 1 5 E- 1 7 E- 1 8 VAX/VM S VE R S I ON 2 . 2 E NHANC EMENTS S E COND LOOKAS I DE L I S T I n i t i a l i z a t i o n o f S e c o nd Lo o ka s i d e L i s t No n pag e d Po o l Al l o c a t i o n a nd De a l l o c a t i o n C HANG E T O S U PPORT A LARG E NUMB E R O F PROC ES S E S Swa p F i l e I n i t i a l i z a t i o n Process Lim i ts F-1 F-2 F-2 F-3 F-3 F-3 Index-1 I NDE X xix CONTENTS Pag e F IGUR E S F I GURE 1-1 1-2 1-3 1-4 1-5 1-6 1-7 1 -8 Da t a S t r uc t u r e s Th a t De sc r i be P r o c e s s Co n t e x t L a ye r ed De s i g n o f VAX/VM S I n t e r ac t i o n Be twe e n Compo n e n t s o f VMS Ke r n e l Me th o d s fo r A l t e r i ng Ac c e s s Mo d e Pa t h s i n to Compo n e n t s o f VM S K e r n e l L a yo ut o f Sy s t em V i r t ua l Ad d r e s s S pa c e La yo u t o f P l S pa c e P O Spa c e Al l o c a t i o n 1-2 1-5 1-9 1-12 1-1 3 1-22 1-23 1-25 2-1 2-2 S y s t em Co n t r o l B l o c k S i g n a l A r r a y Bu i l t by Ha r d wa r e a nd Exc e pt i o n Ro u t i n e s Rem ova l o f C a l l F r am e by L I B $ S IGNA L S i g n a l a nd Mec h a n i sm A r r a ys O r d e r o f S e a r c h fo r C o n d i t i o n Ha nd l e r Mo d i f i ed S e a r c h wi th M u l t i pl y Ac t i v e S i g n a l s C a l l F r a m e Mod i f i c a t i o n b y SYS $UNW IND Mo d i f i ed Unw i nd wi t h Mul t i pl y Ac t i v e S i g n a l s 2-4 2 -3 2-4 2-5 2-6 2-7 2-8 3-1 3-2 3-3 3-4 3-5 3 -6 3-7 3-8 3-9 4-1 4-2 5-1 5-2 6-1 6-2 6-3 6-4 6-5 6-6 6-7 8-1 8-2 8-3 2-9 2-1 5 2-17 2-1 9 2-22 2-2 5 2-29 Co n t e n t s o f t h e Sys t em S e r v i c e Ve c to r s C o n t r o l F l o w o f Sy s t em S e r v i c e s Th a t Ch a n g e Mo d e C o n t r o l F l ow o f Sy s t em S e r v i c e s Th a t Do No t Ch a ng e Mo d e C o n t en t s o f t h e VM S Ch a ng e Mo d e D i s pa tche r s E r r o r Ro ut i n e s a nd Common Ex i t Pa t h fo r Sys t em S e r v i c e s a n d RM S C a l l s C o n t r o l F l o w o f RM S D i s pa tch i ng Sta te o f the S t a c k W i th i n a Us e r -W r i t t e n Di spa tch e r D i s p a tc h i ng t o Us e r -W r i t t e n Sy s t em S e r v i c e s S t r uc t u r e o f P r i v i l eg ed Sh a r e a b l e Imag e 3-1 4 3- 1 5 3- 1 6 Co n t e n t o f S o f twa r e I n t e r r up t Re que s t Reg i s t e r a nd So f twa r e I n t e r r up t S umma r y Reg i s t e r L a yo u t o f Fo r k Bl o c k 4-2 4-5 A S T Co n t r o l B l o c k a nd AST Que ue in So f twa r e PC B A r g um e n t L i s t P a s s ed to AST by D i s pa tche r 5-3 5-8 Sys t em C o n t r o l B l o c k Ve c to r Fo rm a t Sy s t em C o n t r o l B l o c k Ve c to r s fo r Ha r d wa r e I n t e r r up t s C o n t r o l F l ow i n S e r v i c i ng a UN I B U S I n t e r r up t C o n t r o l F l ow i n S e rv i c i ng a MAS S B US I n t e r r upt Con t r o l Fl ow in S e r v i c i ng a DR 7 8 0 I n t e r r up t Co n t r o l Fl ow i n S e r v i c i ng a MA7 8 0 I n t e r r up t Ex t e nd i ng In t e r r up t D i s pa tch Mec h a n i sm w i th the Co n n e c t - t o - I n t e r r up t Fa c i l i ty Process Co n t r o l Block Fi elds Used in S c h e d u l i ng S o f twa r e P r i o r i t i e s a nd P r i o r i ty Ad j us tm e n t s Compu t a b l e ( Ex e c u t a b l e ) S t a t e Que u e s XX 3-2 3-6 3 -7 3 -8 3-9 3-1 1 6-2 6-3 6-8 6-1 2 6-1 4 6-1 5 6-17 8-2 8-6 8-1 0 C ONTENTS ( F IG URES , c ont. ) 8-4 8-5 8-6 8-7 Fo rma t o f Wa i t S t a t e Q u e ue Head e r s S t a te T r a n s i t i o n D i a g r am H a r dwa r e P r o c e s s Co n t r o l B l o c k S c h ed u l e r Ro u t i n e Th a t S e l e c t s Ne x t C a nd i d a t e 9-1 9-2 9-3 9 -4 9-5 S o f twa r e PC B F i e l d s Th a t S u ppo r t Eve n t Fl ag s L a yo u t o f Comm o n E v e n t B l o c k Common Ev e n t F l ag Wa i t Q u e u e s R e l a t i o n sh i p B e twe e n Ma s t e r a nd S l a v e C E B Sh a r ed Memo r y Comm o n Ev e n t Fl ag Da t a S t r uc t u r e s 9-3 9-4 9-5 9-1 6 1 0- 1 La yo u t o f a T i me r Que ue E l eme n t 1 0-7 1 1-1 1 1-2 1 1-3 1 1-4 1 1-5 1 1-6 1 1 -7 1 1 -8 1 1 -9 1 1 -1 0 1 1-11 1 1-1 2 1 1-1 3 D i s c r e t e Po r t i o n s o f t h e P r oc e s s He a d e r P r o c e s s Pa g e T a b l e s D i f f e r e n t Fo rms o f Pag e Ta b l e En t r y Wo r k i ng S e t L i s t Fo rma t o f Wo r k i ng S e t L i s t En t r y P r o c e s s S e c t i o n Ta b l e La yo u t o f P r o c e s s S e c t i o n Ta b l e En t r y P r o c e s s H e a d e r Pag e A r r a y s PFN Da t a B a s e Ar r a y s Po s s i b l e C o n t e n t s o f PFN BAK Ar r a y E l em e n t Co n t e n t s o f PFN S TATE Ar r ay E l em e n t Co n te n t s o f PFN TYPE Ar r a y E l em e n t Ex ampl e o f Fr e e Pa g e L i s t Showi n g L i n ka g e Me thod L a yo u t of G l o b a l S e c t i o n De sc r i pto r The Sy s t em H e ad e r Co n t a i n i ng the Sy s t em Wo r k i ng S e t L i s t a nd t h e G l o b a l Se c t i o n T a b l e La yo u t o f G l o b a l o r Sys t em Sec t i o n T a b l e E n t r y Lo c a t i o n o f G l o b a l Pag e Ta b l e a t V i r t ua l End o f Sy s t em Pa g e T a b l e Re l a t i o n s h i ps Amo ng Gl obal Sec t i on Da t a S t r uc t u r e s Re l a t i o n sh i p B e twe e n P r o c e s s PT Es a nd G l o b a l PTEs Ba l a n c e S l o t s Co n t a i n P r o c e s s H e ad e r s P r o c e s s H e a d e r Ve c to r Ar r a ys Pag e F i l e Da t a Ba s e Swa p Fi l e Da t a B a s e Swa ppe r a n d Mo d i f i ed Pa g e Wr i te r PTE Ar r a y s Phys i c a l L a yo u t o f Sh a r ed Memo r y Co n t e n t s o f Sh a r ed Memo r y Co n t r o l B l o c k Contents o f Sha r ed Mem o r y G l o b a l Sec t i on De s c r i pto r 1 1-2 1 1-3 1 1-5 1 1-8 1 1-1 0 1 1-1 2 1 1-1 3 1 1-1 4 1 1 -1 5 1 1-1 6 1 1- 1 7 1 1-18 1 1-14 1 1- 1 5 1 1-1 6 1 1- 1 7 1 1-18 1 1-19 1 1-20 1 1-21 1 1-22 1 1- 2 3 1 1-24 1 1-2 5 1 1 - 26 1 1-2 7 1 2- 1 1 2-2 1 2-3 1 2-4 1 2-5 Execut i on Fo rma t o f V i r t ua l Ad d r e s s Showi ng F i e l d s Used t o Lo c a t e Pa g e Ta b l e En t r y Th a t Ma ps the Pag e S t a te o f the Ke r n e l Stack Fo l l owi ng a T r a n s l a t i o n-No t-Va l i d Fa u l t S t a t e D i a g r am S h o w i ng Pag e Trans i t i o n s fo r P r i va t e Sec t i on Pag e Th a t I s No t Co py o n Re f e r e n c e S t a te D i a g r am Sh o w i ng Page Trans i t i ons fo r P r i v a t e a n d G l o b a l C o py-o n-Re f e r e n c e Pag e s a nd f o r Dema n d Z e r o Pag e s T r a n s i t i o n s f o r Pag e s Lo c a t ed i n a Pag e Fi l e xxi 8-10 8-1 2 8-21 8-24 9-1 7 1 1-1 9 1 1- 2 1 1 1-22 1 1-23 1 1-24 1 1-2 5 1 1-26 1 1- 2 8 1 1-29 1 1-31 1 1-33 1 1- 3 6 1 1-38 1 1- 4 0 1 1-41 1 2- 2 1 2- 2 1 2- 5 1 2- 9 C ON TENTS ( F I G URES , c o n t . ) 1 2-6 1 2-7 1 2-8 1 4-1 1 4-2 1 4-3 1 4-4 1 4-5 1 4-6 1 4 -7 1 5-1 1 5-2 1 5-3 1 5-4 1 6-1 1 6-2 1 6-3 1 6-4 1 6 -5 1 7-1 1 7-2 1 7-3 1 7-4 1 7-5 1 7- 6 1 8-1 1 8-2 1 8-3 1 8-4 1 8- 5 1 8-6 1 8-7 1 8-8 1 8-9 ( Co n t i n ua t i o n o f F i g u r e 1 2 - 4 ) Examp l e o f Pag e Tr a n s i t i o n s Ma d e by a G l obal Pa g e Ma pped b y Two P r o c e s s e s Trans i t ions Examp l e of Pag e fo r G l oba l Co py-on-R e f e r e n c e Pag e s Examp l e o f C l u s t e r ed Wr i t e to a P a g e F i l e Pa r a l l e l s Be twe e n I n swa p C a nd i d a t e S e l ec t i o n by the Swa p pe r a nd E x e c u t i o n C a nd i d a t e S e l e c t i o n by t h e S c hed u l e r Ex ampl e Wo r k i ng S e t L i s t B e f o r e Ou t s wa p S c a n Examp l e Wo r k i ng S e t L i s t A f t e r O u t s wa p S c a n P r o c e s s Pa g e Ta b l e Ch a n g e s A f t e r Swa p pe r ' s Wr i t e Comp l e te s Wo r k i ng Set L i s t a nd Swa ppe r Ma p B e fo re Ph ys i c a l Pa g e A l l o c a t i on Wo r k i ng Set L i s t a nd Swa ppe r Ma p Af t e r Ph ys i c a l Pa g e A l l o c a t i o n Wo r k i ng S e t L i s t and Re bu i l t Pag e Ta b l e s Te rm i n a l I /0 S y s t em Comm a n d s t h a t As s em b l e a nd L i n k t h e Te r m i n a l Dr i v e r Ro l e o f N E TDR I VE R i n P r o c e s s i ng Ne t wo r k I /0 Reque s t s La yo u t o f Ma i l bo x M e s s ag e B l o c k Da t a S t r uc t ur e s As so c i a t e d wi t h Ma i l bo x Crea ti on Co n t e n t s o f a S h a r ed Memo r y Ma i l bo x C o n t r o l Block Da t a S t r uc t ur e s As s o c i a t ed wi th Sh a r ed Mem o r y Ma i l box C r e a t i o n La yo u t o f a B r o a d c a s t De sc r i pto r B l o c k La yo u t o f a Wr i t e B u f f e r Pa c k e t Sampl e Mo vem e n t o f Pa r am e t e r s in Process Crea t i on Re l a t i o n sh i p B e twe e n J I B a nd PC Bs o f Seve ral P r o c e s s e s i n t h e Same Job Sampl e PC B Ve c to r Fa b r i c a t i o n o f P r o c e s s I Ds Lo c a t i o n o f S h e l l Process in the Exec u t i ve Imag e F i l e Remova l o f Process Pa r am e t e r s f r om Process Quo t a B l o c k Co n t e n t s o f Imag e He a d e r G e n e r a l Fo rm o f I m a g e S e c t i o n De sc r i p to r I S D a nd Pa g e Ta b l e E n t r i e s fo r P r o c e s s Pr i v a t e Se c t i o n I S D a n d Pa g e Tab l e En t r i e s fo r Dem a nd Z e ro Se c t i o n I S D a nd Pa g e Ta b l e E n t r i e s fo r G l o b a l Sec t i o n Fo rma t o f Known F i l e En t r y Tr a n s f e r Ve c t o r A r r a y Samp l e Te r m i n a t i o n H a nd l e r L i s t s Lo w Ad d r e s s E n d o f P l S p a c e Th a t I s De l e t ed a t Imag e Ex i t xx i i 1 2-1 1 1 2- 1 3 1 2- 1 6 1 2- 2 7 1 4-5 1 4-1 7 14-18 1 4- 1 9 1 4-28 1 4-29 1 4-30 1 5-7 1 5-8 1 5- 1 2 1 5- 1 4 1 6-1 3 1 6- 1 4 1 6-1 5 1 6- 1 7 1 6- 1 8 1 7-3 1 7-5 1 7-8 1 7- 1 1 1 7- 1 2 1 7- 1 7 1 8-6 1 8-7 1 8-9 1 8-1 0 1 8-1 3 1 8-1 4 1 8- 1 6 1 8-1 9 1 8- 2 2 C ONTENTS ( F I G UR E S , c o n t . ) 1 9- 1 S am p l e J o b to I l l u s t r a t e P r o c e s s De l e t i o n w i t h Subprocesses 2 0- 1 S t e ps I n vo l v ed i n In i t i a t i ng an I n t e r ac t i ve Job S t e ps I n v o l ved in I n i t i a t i ng a Ba t c h Jo b Th r o ug h a S UBM I T Comma nd a nd Th r o ug h a Ca r d Read e r S i mpl i f i e d Co n t r o l F l ow Th r o ug h a Comm a n d L a ng u a g e I n t e r p r e t e r A r g um e n t L i s t Pa s s e d to a n Imag e b y PROC S TRT o r a CLI 2 0- 2 20-3 20-4 21-1 21-2 22-1 Ph y s i c a l Memo r y L a yo u t s U s e d b y VMB a nd S Y S B O OT Ph ys i c a l Mem o r y La yo u t U s e d by the Ex ec u t i v e 1 9-6 2 0-2 2 0-3 20-1 0 20-1 3 21-1 3 21-19 22-5 Do ub l e U s e o f Sy s t em Page Ta b l e Ent r i e s by !NIT Ad d r e s s S pa c e Ch a ng e s a s Memo r y Ma n a g e m e n t Is E n a b l ed b y ! N I T L i nkag e a nd Cont r o l Flow Ex ampl e fo r C PU-De p e n d e n t Ro u t i n e s Mo v em e n t o f Pa r am e t e r Da t a b y SYS BOOT a nd SYS I N I T Mo vem e n t o f Pa r am e t e r Da t a b y SYSGEN 24-1 24-2 Ma c r o s U s ed by VM S t o Chang e I P L Fo rma t o f Mu t u a l E x c l u s i o n Sem a pho r e ( MUTE X ) 24-2 2 4 -9 2 5- 1 2 5-2 25-3 2 5-4 La yo u t o f Un u s e d Ar e a s i n Dyn a m i c Mem o r y Po o l s Ex ampl e s o f Al l o c a t i o n f r om Dyn am i c Mem o r y Ex ampl e s o f De a l l o c a t i o n to Dyn am i c Mem o r y P r e a l l o c a ted I /O Re q u e s t Pa c k e t s 2 5-2 2 5-3 2 5-5 2 5- 1 0 26-1 2 6-2 G l o b a l L i s th e ad s fo r Log i c a l N a m e Ta b l e s Log i c a l Name B l o c k 2 6-2 26-3 A- 1 S t a c k Mo d i f i c a t i o n D u e I n s t r uc t i o n D-1 D-2 De t a i l ed La yo u t o f J o b I n f o rm a t i o n B l o c k ( J I B ) D e t a i l ed La yo u t o f So f twa r e Process Co n t r o l B l o c k ( PC B ) E-1 La yo u t o f Sy s t em V i r t ua l Ad d r e s s S pa c e 2 2-2 2 2-3 2 2-4 xxi i i to PO PL (SP) Ps e ud o 2 2-2 2 2-4 2 2- 1 4 22-22 22-24 A-9 D-8 D- 1 1 E-5 C ONTENTS Pa g e TAB L E S TAB LE 1-7 1-1 Sy s t em P r o c e s s e s a nd P r i v i l eg ed Imag e s 2-1 Us e o f F i r s t 2 0 Lo c a t i o n s in Sy s t em Co n t r o l Block E x c e pt i o n s Th a t Us e t h e D i s pa t ch e r i n Mo d u l e E XC E PT I ON S i g n a l Nam e s fo r A r i thme t i c E x c e p t i o n s 2-1 0 2-1 2 3-1 Sys tem S e r v i c e s a nd R M S S e r v i c e s Th a t U s e E a c h Fo r m o f Sy s t em S e r v i c e Ve c t o r 3-3 4-1 So f twa r e I n t e r r up t Leve l s Us ed b y VAX/VM S 4-4 6-1 S t a nd a r d SBI VAX- 1 1/ 7 8 0 7-1 Co n t e n t s o f Dump F i l e He ad e r B l o c k 8-1 8-2 8-3 P r o c e s s S c h ed u l i ng S t a t e s Type s o f MWA I T S t a t e Sy s tem Ev e n t s a nd As s o c i a t ed P r i o r i t y Bo o s t s 8-2 8-1 3 8-19 9-1 9-2 S umma r y o f P r o c e s s C o n t r o l Sys tem S e r v i c e s M e a n i ng of Flags in PC B Sta tus Lo ng wo r d ( PC B $ L_S T S ) 9-2 9-12 10-1 VAX/VM S Ha r dwa r e C l o c k s a nd So f twa r e T i m e r s 1 0-2 11-1 Memo r y Ac c e s s P r o t e c t i o n Co d e s i n Pag e Ta b l e Ent r i e s PFN Da t a Ba s e A r r a y s Co n te n t s o f Sh a r ed Memo r y Common Da ta Pag e 1 1 -6 1 1-9 1 1-39 12-1 De s c r i p t i o n o f I /0 Re que s t s I s s ued Ma n ag eme n t 1 2- 2 2 1 3- 1 1 3-2 Wo r k i ng S e t L i s t L i m i t s a nd Quo t a s P r o c e s s a nd S y s tem P a r am e t e r s U s ed Automa t i c Wo r k i ng S e t S i ze Ad j u s tm e n t 14-1 1 4 -2 Compa r i so n o f Pa g i ng a nd Swa pp i ng Ord e r of Se a r ch fo r Po t e n t i a l O u t s wa p Cand i d a te Ev e n t s Th a t C a u s e t h e Swa ppe r o r Mod i f i ed Pag e W r i t e r to Be Awa k e n ed Sc a n o f Wo r k i ng S e t L i s t o n O u t s wa p Re b u i l d i ng t h e Wo r k i ng Set L i s t a nd the P r o c e s s Pa g e Tab l e s at I n s wa p 2-2 2-3 11-2 11-3 14-3 14-4 14-5 Ad a p t e r on As s i g nm e n t s the 2-5 6-5 7-8 by Memo r y by 1 3-1 1 1 3-1 3 1 4- 3 1 4-7 1 4-9 1 4-1 6 1 4-25 1 5- 1 S p e c i a l Us e s o f t h e C o n s o l e PR $_TXDB Reg i s t e r 1 5- 1 7 1 7- 1 Pa r ts o f P r o c e s s C r e a t i o n Th a t Oc c u r D i f f e r e n t P r o c e s s Co n t e x t s Co n t e n t s o f t h e P r o c e s s Quo t a B l o c k 1 7- 2 1 7- 4 1 7- 2 xxiv in C ONTENTS ( TAB LE S , c o n t . ) F l ag s in the S t a t us Lo ngwo r d in the PC B ( PC B $ L S T S ) Th a t Can Be Se t a t Process c r e a t ion S t o r ag e A r e a s fo r P r o c e s s Quo t a s Co n t e n t s o f t h e In i t i a l Swa p Imag e in the Sh e l l P r o c e s s 1 7-1 3 1 8-1 P r o c e s s P r i v i l eg e Ma s k s 1 8- 2 5 1 9-1 Co n t e n t s o f Te rm i n a t i o n Ma i l box Me s s ag e Sent t o Ac co un t i ng Ma nag e r a nd to P r o c e s s C r e a t o r 1 9- 4 2 0-1 Ge n e r a l Ac t i o n s Pe r f o r m ed by a Comm a n d La ng uag e I n t e r p r e te r Comma n d s Ha nd l ed by C L I I n t e r n a l P r o c ed u r e s 20-1 1 20-1 2 1 7-3 1 7-4 1 7-5 2 0-2 2 1 -1 2 1 -2 21-3 2 1 -4 a nd U s e d D u r i ng P r o g r am s Fi les Sequence I n p u t t o VMB ( Pr ima ry Reg i s t e r P r o g r am ) Co n t e n t s o f Re s t a r t Pa r am e t e r B l o c k Reg i s t e r I n p u t t o I N I T f r om SYS B OOT Boo t s t r a p Bo o t s t r a p 1 7 -7 1 7-1 0 21-3 2 1 -1 0 2 1 -1 2 21-1 6 22-1 2 2 -2 2 2-3 2 2-4 Us e of No n p ag e d Po o l by Mo d u l e I N I T Ex t e r n a l Ad a p t e r I n i t i a l i z a t i o n Compa r i so n o f S Y S B OOT a nd SYSGEN I n f o r ma t i o n S t o r ed fo r Ea c h Ad j us t a b l e Pa r am e t e r b y SYS B OOT a nd SYSGEN 2 3-1 Da t a S a v ed by Powe r f a i l Ro u t i n e D u r i ng P o we r Rec ove r y 24-1 2 4-2 Commo n I PL Leve l s Used by VAX/VM S for Syn c h r o n i z a t i o n L i s t o f Da t a S t r uc t u r e s P r o t e c ted b y Mu t e x e s 24-3 2 4-8 2 5 -1 2 5 -2 G l o ba l L i s t h e ad s f o r E a c h Po o l A r e a Compa r i so n o f D i f f e r e n t Po o l Ar e a s 2 5-8 2 5-1 2 A- 1 MDL Desc r i pt i o n a nd Re s u l t a n t Sym bo l De f i n i t i o n s f o r Lo g i c a l Name B l o c k E x ampl e s o f t h e S D i r e c t i v e S a m p l e Va r i a b l e Le ng th B i t F i e l d De f i n i t i o n s A-1 9 A-2 0 A-2 1 A-2 A-3 D- 1 D-2 D-3 D-4 E-1 E-2 E-3 E-4 a nd Re s to r ed Summa r y o f Arb i t rary Div i s i on of Da t a S t r uc t u r e s i n Th i s App e nd i x O f f s e t s i n to S o f t wa r e P r o c e s s Co n t r o l B l o c k O f f s e t s i n to F i x ed Po r t i o n o f the Process Head e r Dyn am i c Da t a S t r uc t u r e Type Cod e s Di s c r e te De t a i l ed S pa c e Di v i s i on No n pag e d De t a i l ed Po r t i o n s o f t h e P r o c e s s He a d e r La yo u t o f Sy s t em V i r t ua l Ad d r e s s o f S y s t em V i r t u a l Ad d r e s s S p a c e a nd Pa g ed P i e c e s L a yo u t o f P l S pa c e X XV i n to 2 2-6 2 2 -1 2 2 2-2 0 2 2 -2 1 2 3-2 D-2 D- 1 2 D-1 4 D- 2 0 E-2 E-6 E-1 6 E-1 9 PREFAC E MANUAL OBJECTIVE S Th i s m a n ua l e x p l a i n s h o w t h e VAX/VM S e x e c u t i v e wo r k s . In d o i ng s o , i t d e sc r i b e s t h e d a ta s t r uc t u r e s ma i n t a i n ed a nd m a n i pu l a t e d by VM S , d i sc u s s e s the me c h a n i sms t h a t t r a n s f e r c o n t r o l b e twe en use r processes a nd VM S a nd wi t h i n VM S i t s e l f , a nd d e s c r i b e s some o f the f e a t u r e s o f the VAX h a r d wa r e a s t h e y a r e u s ed b y VM S . Th i s d e sc r i pt i o n i nc l ud e s a l l the m a j o r c om po n e n t s o f the executive i nc l ud i ng s ys t em i n i t i a l i za t i o n a nd t h e o pe r a t i o n o f a l l s y s t em s e rv i c e s . I t does not i n c l ud e a g e n e r a l d i sc us s i o n o f the I /O s ub s y s t em b ec a u s e tha t s ub j e c t i s a l r e a d y d e sc r i b ed i n t h e VAX/VM S Gu i d e to Wr i t i ng a D ev i c e D r i v e r . Ho we v e r , t h e d e ta i l s o f some VAX/VM S dev i c e d r i v e r s , as we l l as t h e o pe r a t i o n s of I /O r e l a t ed sys tem s e rv i c e s , a r e i nc l ud ed in th i s m a n ua l . INTENDED AUD I ENC E Th i s m a n ua l i s i n t e nd ed f o r s ys t em p r o g r amme r s a nd o the r use r s o f VAX/VM S wh o wi sh t o und e r s t a nd t h e i n t e r n a l wo r k i ng s o f the e x e c u t i v e . A tho r o ug h knowl e d g e o f VAX- 1 1 MACRO p r og r amm i ng i s a s s umed . Re a d e r s wi th a s y s t ems l ev e l b a c kg r o und o n o th e r o p e r a t i ng s ys t ems wh o h a v e a wo r k i ng k n owl e d g e o f VAX a nd VM S c o n c e p t s c an g a i n some und e r s t a nd i ng o f how t h e VAX/VM S o pe r a t i ng s ys tem wo r k s . Th e wr i t i ng l ev e l o f t h i s m a n ua l a s s um e s t h a t the r e ad e r is f am i l i a r w i th VM S p r o g r amm i ng , pa r t i c u l a r l y wi th the use of s ys t em s e rv i c e s . Knowl ed g e o f VM S c o n c e p t s a nd the VAX a r c h i t e c t u r e i s a l s o a s s umed . In e x p l a i n i ng the o pe r a t i o n o f a s ub s ys t em o f the e x e c u t i ve , the emph a s i s i s on the d a ta s t r uc t u r e s m a n i pu l a ted by th a t c ompo n e n t , r a th e r t h a n on d e ta i l ed f l o w d i a g r ams o f m a j o r r o u t i n e s . Th e d e ta i l ed d e sc r i p t i o n o f d a ta s t r uc t u r e s sho u l d ena b l e sys tem m a n ag e r s t o m a k e mo r e i n t e l l i g e n t d ec i s i o n s wh en c o n f i g u r i ng s y s t ems fo r spa c e o r t i me c r i t i cal a pp l i c a t i o n s . Th e a pp l i c a t i o n d e s i g n e r wi l l a l s o b e ne f i t by b e i ng a b l e to r e a l i z e the e f f e c t s ( i n s pe ed or in memo r y c o n s ump t i o n ) o f d i f f e r e n t d e s i g n a nd impl emen t a t i o n d e c i s i o n s . NOTE Th i s m a n ua l i s d i f f e r en t f r om the r e f e r e n c e m a n ua l s t h a t m a k e up t h e r e s t o f t h e VAX/VM S d o c um e n t a t i o n s e t i n th a t i t d e sc r i b e s i nte rna l o pe r a t i o n s a nd d a t a s t r uc t u r e s . Wh i l e i t is unl i ke l y t h a t a n y c ompo n e n t d e sc r i b ed i n th i s ma n ua l wi l l be d r a s t i c a l l y c h ang ed wi th any ma j o r r e l e a s e of VAX/VM S , t h e r e i s no g u a r a n t e e tha t a n y d a t a s t r uc t u r e o r s u b r o u t i n e i n t e r f a c e d e s c r i b ed h e r e wi l l r em a i n t h e s ame f r om r e l e a s e to r e l e a s e . a ppl i c a t i o n p r og r ams th a t P r i v i l eg e d r e l y o n d e t a i l s c o n t a i n e d i n th i s m a n u a l mus t b e t e s t ed aga i n wi th each new ve r s i o n o f VAX/VM S . xxvii S TRUC TURE OF TH I S DOC UMENT Th i s m a n ua l i s b r o k e n up i n to e i g h t pa r t s , w i th e a c h pa r t d e s c r i b i ng a d i f f e r e n t f un c t i o n o f the o pe r a t i ng s ys t e m . • • • • Th e f i r s t c h a p t e r ( Pa r t I ) p r e s e n t s a n o v e r v i e w o f VAX/VM S a nd r e v i ews tho s e c o n c e p t s that a re c r uc i a l to l ater u nd e r s t a nd i ng o f t h e wo r k i ng s o f t h e s y s t em . Pa r t I I d e s c r i be s the d i f f e r e n t t ec h n i qu e s th a t a r e u s ed to pass control b e t we e n user p r og r am s a nd VM S . I nd i v i d ua l c h a p te r s d e s c r i b e e x c e p t i o n s , s ys tem s e rv i c e d i spa t c h i ng , the u s e of so f t wa r e i n t e r r upts , a s yn c h r o no u s s ys t em t r a ps ( AS Ts ) , a nd h a r d wa r e i n t e r r up t d i s pa tc h i ng . Th e faul t r e po r t i ng m ec h a n i sms u s ed by VM S a r e a l s o d i s c u s s e d . Th e s e i n c l ud e e r r o r l o gg i ng , m a c h i ne c h ec k s , a nd BUGC HECKs , t h e s ys t em ' s wa y o f r e po r t i ng i n te r n a l i n c o n s i s t e nc i e s . Th e n e x t s e c t i o n ( P a r t I I I ) d e s c r i b e s the s c h ed u l e r - r e l a t ed s y s t em s u ppo r t . Inte rproc ess c ommun i c a t i o n , i nc l ud i ng c ommun i c a t i o n b e t we e n p r o c e s so r s u s i ng t h e MA 7 8 0 m u l t i po r t m emo r y i s d i sc u s s ed . A d e s c r i p t i o n o f t i m e r s uppo r t a nd s ys t em t i m e k e e p i ng c o n c l ud e s t h i s s ec t i o n . Memo r y m a n ag em e n t i s d i sc u s s e d i n the n e x t s e c t i o n ( Pa r t I V ) . Th e d a t a s t r uc t u r e s t h a t a r e u s ed by bo th t h e pag e r a nd the s wa ppe r a r e d i s c u s s e d f i r s t . Th e o pe r a t i o n o f the pag e r in r e s po n s e t o t yp i c a l pag e f a u l t s i s t h e n d e sc r i b ed . Many o f t h e c o d e p a th s th r o ug h the pag e r a r e d e s i g ned t o d e a l w i th r a re but t r o ub l e s ome c a s e s . Th e s e r o ut i ne s a r e no t i n g en e r a l d i sc ussed . VM S a l s o p r ov i d e s c o n t r o l ove r the pag i ng a nd s wa pp i ng e nv i r o nm e n t i n the fo rm of s ys t em s e rv i c e s r e l a te d to m emo r y m a n ag em e n t . Th e s e s e r v i c e s a r e c om p l i c a t ed e n o ug h t o wa r r a n t t h e i r o wn c h a pt e r . Th e o pe r a t i o n o f t h e swa ppe r c o nc l ud e s t h e d e sc r i p t i o n o f m em o r y m a n ag eme n t . • • • Th e n e x t s e c t i o n ( Pa r t V ) d e sc r i b e s a no th e r m a j o r c om po n e n t o f VM S , the I / O s ubsys tem . Th i s s e c t i o n a s s um e s t h a t t h e r e ad e r i s f am i l i a r w i th t h e f i r s t f i ve c h a pt e r s o f VAX/VMS Guide to Wr i t i ng a Dev i c e D r i v e r . Th e o pe r a t i o n o f d ev i c e d r i v e r s , i n c l ud i ng a c om p l e t e d i sc u s s i o n f r om s t a r t to f i n i sh of a Q I O r e que s t i s p r e s e n t e d t h e r e . Th i s m a n ua l b u i l d s o n t h a t d i s c us s i o n b y d e sc r i b i ng t h e d e ta i l s o f VM S d ev i c e d r i v e r s a n d e x pl a i n i ng h o w t h e I /O r e l a t ed s ys t em s e r v i c e s wo r k . The c r e a t i o n a n d d e l e t i o n o f a p r o c e s s i nv o l v e s a s i g n i f i c a n t po r t i o n o f VM S a nd f o rm s t h e s ub j e c t o f Pa r t VI . Th e a c t i va t i o n a nd t e rm i n a t i o n o f a n i m a g e i n the c o n t e x t o f a p ro c e s s a r e a l so d e sc r i b ed . Be c a u s e the i n i t i a t i o n a nd t e rm i n a t i o n o f i m a g e s i n a n i n t e r a c t i ve o r b a tc h e n v i r o nm e n t i s s uc h a c ommo n v a r i a t i o n t o t h e s i t u a t i o n j us t d e sc r i b ed , a s e pa r a t e c h a p t e r i s d evo ted to t h e b e h a v i o r o f i n t e r a c t i ve a nd ba t c h j o b s . Pa r t VI I d e a l s w i t h s ys t em i n i t i a l i za t i o n . M a n y o f t h e d a ta s t r uc t u r e s a nd e v e n s om e o f t h e c o d e u s e d by VM S c a nno t b e c r e a te d u n t i l t h e s ys tem h a s b e e n c o n f i g u r ed w i th a set o f S Y S B OOT p a r am e t e r s . Th i s s e c t i o n o f the m a n u a l d e sc r i b e s the o pe r a t i o n o f the boo t s t r a p p r og r am s ( VM B a nd SYS B OOT ) th a t i n i t i a l i ze VM S a nd a l so the f i r s t c o d e i n VMS ( i n mod u l e I N I T ) tha t e x ec u te s . B e c a u s e t h e po we r d o wn a nd powe r f a i l xxviii r e c o v e r y p r o c ed u r e s a re r e l a t ed to the boo t s t r a p s e qu e nc e , t h e y a r e d e s c r i b ed i n t h i s s e c t i o n . • • Th e f i nal section o f the m a n ua l { Pa r t VI I I ) d i s c us s e s m i s c e l l a n e o u s t o p i c s th a t a r e n o t c o n v e n i e n t l y p i g e o nho l ed i n a ny c o nv en t i o n a l b r e a kd own o f o pe r a t i ng s ys t e m s . Th e t e chn i que s used by VM S fo r s yn c h r o n i z a t i o n a n d d yn am i c s t o r ag e a l l o c a t i o n and d e a l l o c a t i o n a r e d e sc r i b ed f i r s t . Th e i mp l em e n t a t i o n o f l o g i c a l nam e s , a powe r f u l t o o l f o r b o t h the s y s t em a n d for u s e r s i s e x pl a i n ed n ex t . Th e r ema i n i ng s ys t e m s e rv i c e s that do not f i t i n to any o f t h e p r ev i o u s s e c t i o n h e ad i ng s a r e d i s c u s s e d i n the f i n a l c h a p t e r . Th e m a n ua l i n c l ud e s s i x a ppend i c e s tha t w i l l be e sp e c i a l l y u s e f ul fo r th o s e r e ad e r s who wi s h to p u r s ue th i s m a t e r i a l b y r e ad i ng t h e m i c r o f i c h e l i s t i ng s o f VM S . Th e f i r s t a pp e nd i x i n c l ud e s h e l p f ul h i n t s fo r r e a d i ng the l i s t i ng s a nd i nd i c a t e s h o w the m a ps of t h e e x e c u t i v e and o th e r c ompo n e n t s c a n b e used wh i l e d o i ng th i s . Th e s y s t em d um p a n a l y ze r { S DA ) i s a l s o a v a l ua b l e to o l i n e x am i n i ng tho s e s t r uc t u r e s t h a t a r e n o t b u i l t un t i l the A d e sc r i pt i o n o f t h e s t r uc t u r e s ys t em is i n i t i a l i z ed . d e f i n i t i o n l a ng u a g e { MD L ) th a t is u s ed t o d e f i ne the e x e c ut i v e d a ta s t r uc t u r e s in a l a ng uag e i nd e pe nd e n t f a s h i o n i s a l s o i nc l ud ed . Th e r e a r e t h r e e i mpo r ta n t po i n t e r a r e a s used by VM S to l oc a te d yn am i c a l l y c o ns t r uc ted d ata bloc k s . Th e s e po i n t e r a r e a s a r e pa r t o f t h e s ta t i c e x e c u t i v e d a t a tha t i s a pa r t o f the e x e c u t i v e i m a g e Th e d e t a i l ed c o n t e n t s o f t h e s t a t i c d a t a a r e a s a r e l i s t ed i n Appe nd i x B . Th e s ym bo l nam i ng c o nv e nt i o n s tha t we r e a d h e r ed to wh e n VM S wa s o r i g i n a l l y wr i t t e n m a k e it e a s y to r e a d t h e sour c e cod e . Th e s e s ymbo l n am i ng c o nv e n t i o n s a r e l i s t ed in Ap pend i x C . Mo s t o f t h e o pe r a t i o n s o f VM S c a n b e e a s i l y und e r s to od once t h e c o n te n t s o f the va r i o us d a t a s t r uc t u r e s a r e k n o wn . Many o f t h e s e s t r uc t u r e s a r e d e s c r i b ed th r o ug h o u t the m a n ua l . Mo s t o f the s t r uc t u r e s u s e d by VM S , e x c e p t tho s e r e l a t ed to d ev i c e d r i v e r s a nd the f i l e s y s t em , are d e s c r i bed i n Append i x D . Th e d a ta s t r uc t u r e s r e l a t ed to d ev i c e d r i ve r s a r e d e sc r i b ed i n VAX/VM S G u i d e to W r i t i ng Th e d a t a s t r uc t u r e s t h a t a r e s pe c 1 f 1 c a D e v i c e D r i ve r . t o t h e f i l e s ys t em a r e n o t l i s t ed a n ywh e r e a t t h i s t i m e . App e nd i x E shows h o w t h e s i z e o f e ac h p i e c e o f s ys t em v i r t ua l add r e s s s pa c e d epe nd s on the v a l ue s o f SY S B OOT pa r am e t e r s . { Th i s c a l c u l a t i o n a l s o r e l a t e s t h e s i ze of the process head e r t o the v a l u e s o f s ev e r a l SY S B OOT pa r am e t e r s . ) A f t e r a l l the s e s i ze s h a ve b e en c a l cu l a t ed , the amo un t o f phys i c a l memo r y u s e d by VM S a s a fun c t i o n o f S Y S B OOT pa r am e t e r s i s a l s o p r e s e n t ed . App e nd i x F m e n t i o n s two c h a ng e s to the e x e c u t i v e t h a t a r e mad e by a ppl y i ng t h e Ve r s i o n 2 . 2 b i n a r y upd a t e to VM S . Th e s e t wo c h a ng e s a r e a ppl i ed by p a t c h i ng the ex e c u t i ve imag e SYS . E X E . Th i s a ppe nd i x i s t h e o n l y p l a c e wh e r e th i s f un c t i o n a l i t y i s c u r r e n t l y d e sc r i b ed . xxix A S S OC IATED DOCUM ENTS S e v e r a l d o c um e n ts i n the VAX/VM S d o c um e n t s e t sho u l d be r e a d b e fo r e a t t empt i ng to r ead t h i s m a n ua l . Th e fo l l o w i ng m a n ua l s a r e the mo s t i mpo r ta n t p r e r e qu i s i t e r e ad i ng f o r th i s m a n ua l . • VAX/VM S S y s tem S e r v i c e s Re f e r e n c e Ma n ua l • VAX- 1 1 S o f twa r e I n s t a l l a t i o n G u i d e • Ch a p t e r 6 o f t h e VAX- 1 1 Run -T i me L i b r a r y Re f e r e n c e Ma n ua l • VAX/VM S Re a l - T i m e Us e r ' s G u i d e • Ch a p t e r s 1 2 a nd 1 3 o f the VAX/VM S Sys t em Ma n ag e r ' s G u i d e Th e c o n c e p t s o f VAX a n d VM S a r e d i sc u s s ed i n • VAX/VM S S umma r y De sc r i pt i o n a n d G l o s s a r y • VAX So f twa r e H a n d bo o k a nd i n E a c h o f t h e s e two d o c um e n ts a l s o p r o v i d e s a g l o s s a r y o f the t e rms used t o d e sc r i b e t h e VA X a r c h i t e c t u r e a nd t h e VM S o pe r a t i ng s y s t em . Th e fo l l o w i ng d o c um e n ts w i l l r ea d i ng th i s m a n ua l . be h e l pful r e f e r en c e s • VA X/VM S G u i d e to Wr i t i ng a Dev i c e D r i v e r • VAX- 1 1 A r c h i t e c t u r e H a n d b o o k • VAX Ha rdwa r e H a n d bo o k wh i l e yo u a re A n e x c e l l e n t d e sc r i p t i o n o f t h e VAX a r c h i t e c t u r e , a as a s we l l d i sc u s s i o n o f some o f the d e s i g n d ec i s i o n s m a d e the f i r s t fo r i mp l em e n t a t i o n , th e VAX- 1 1 /7 8 0 , c a n be fo und i n Comp u t e r P r o g r amm i ng a n d A r c h i t e c t u r e Dig i ta l Press , 1 98 0 Th i s b o o k a l s o c o n t a i n s a b i b l i og r a ph y d e a l i ng w i th o pe r a t i ng s y s t e m d e s i g n . of s om e Th e VAX- 1 1 of the l i te r a t u r e C ONVENTIONS US ED I N T H I S DOCUM ENT In a l l p i c t u r e s o f m em o r y t h a t v i r t ua l a d d r e s s a ppe a r s a t t h e t o wa rd t h e b o t tom o f t h e pag e . g r owth i s t o wa rd t h e t o p o f t h e a ppe a r in t h i s m a n ua l , the l o we s t t o p o f t h e pag e a nd ad d r e s s e s i nc r e a s e Th i s m e a n s t h a t the d i r e c t i o n o f s t a c k p ag e . I n f i g u r e s t h a t d i sp l a y mo r e d e t a i l s uc h a s b y t e s w i th i n l o ng wo r d s , add resses a l so i nc r e a s e f r om r ight to left . Th a t i s , the l o we s t a d d r e s s ed b y t e ( o r b i t ) i n a l o ng wo r d i s o n t h e r i g h t h a nd s i d e of a f ig ure a nd the m o s t s i g n i f i c a n t b y t e ( o r b i t ) i s o n the l e f t h a nd s ide . Th e wo r d " s ys tem " o r " VM S " i s u s ed to d e sc r i b e the enti re s o f twa r e p a c ka g e tha t i s a pa r t o f a VA X- 1 1 s y s tem . Th i s i nc l ud e s p r i v i l eg ed p r o c e s s e s , u t i l i t i e s , a nd o th e r s uppo r t s o f twa r e a s we l l as the execut i ve i ts e l f . XXX Th e wo r d " e x e c u t iv e " r e f e r s to t ho s e p a r t s o f VMS th a t r e sid e i n s ys tem vi r t ua l add r e s s s pa c e . Thi s i nc l ud e s t h e c o n t e n t s o f the fi l e SYS . E XE , d evi c e d riv e r s , a nd o th e r c od e and d a ta s t r uc t u r e s l o ad ed at i n i t i a l i za tion time , i nc l ud i ng RMS a nd the s ys tem m e s s ag e fi l e . Wh e n e i th e r " p r o c e s s c o n t r o l b loc k " or " PC B " i s used wi tho u t a it r e f e r s to the so f twa r e s t r uc t u r e used by t h e sch e d u l e r . modi fie r , Th e d a ta s t r uc t u r e t h a t c o n t a i n s c o pi e s o f the g en e r a l r eg i s t e r s ( th a t t h e h a r d wa r e l oc a t e s th r o ug h t h e PR$ PCBB r egis te r ) i s a l wa ys c a l l ed the " h a r d wa r e PC B " . Wh e n r e f e r r i ng to a c c e s s m od e s , t h e t e rm " inne r a c c e s s m od e s " means tho s e a c c e s s m o d e s wi th m o r e p r ivi l eg e . Th e t e rm " o u t e r a c c e s s m od e s " m e a n s tho s e a c c e s s m od e s wi th l e s s p r ivi l eg e . Th us , t h e in n e rmo s t a c c e s s mod e i s k e r n e l a nd the o u t e rm o s t a c c e s s m o d e i s us e r . Th e t e rm " SYSB OOT pa r am e t e r " i s used to d e sc ri b e a n y o f t h e a d j u s t a b l e pa r am e t e r s tha t a r e u s ed by t h e s e c o nd a r y boo t s t r a p p r og r am SYSB OOT t o c o n fig u r e t h e sys tem . Th e a d j u s ta b l e pa r am e t e r s i n c l ud e bo th t h e d yn amic pa rame t e r s t h a t c a n b e c h a ng ed o n t h e r unning s y s t e m a nd t h e s ta t i c pa r am e t e r s tha t r eq ui r e a r eboo t i n o rd e r fo r t h e i r v a l ue s to c h a ng e . Th e s e pa r am e t e r s are r e f e r r ed to by thei r pa r am e te r n am e s r a th e r t h a n by t h e g l o b a l l o c a ti o n s wh e r e th e i r v a l ue s a r e s to r e d . App e nd i x B r e l a t e s the SYSB OOT p a r am e t e r n am e s to thei r c o r r e s po nd ing g l o b a l l o c a ti o n s . Th e t e rm s " by t e i n d e x " , " wo r d ind ex " , " l o ng wo r d ind ex " , a nd so on , refer to a m e thod of a c c e s s tha t u s e s the VAX- 1 1 c o n te x t i nd e x i ng ad d r e s si ng c a pa bi l i ty . Th a t i s , t h e i nd ex va l ue wi l l be m u l tipl i ed by o n e , t wo , f o u r , o r e ig h t ( d e pend i ng o n wh e the r a byte , wo r d , l o ng wo rd , o r quad wo r d i s b eing r e f e r en c ed ) a s pa r t o f o pe r a nd e v a l ua ti o n i n o rd e r to c a l c u l a t e t h e e f f e c ti v e a d d r e s s o f t h e o pe r a nd . I n g e n e r a l , t h e c ompo n e n t c a l l ed !N I T r e f e r s to a mod u l e o f t h a t n a m e i n the e x e c utive a nd n o t the vo l um e i n i ti a l i z a tion uti l i ty . Wh e n th a t u t i l i ty p r og r am i s b eing r e f e r en c ed , i t wi l l b e c l e a r l y s p e c i fi ed . Th e r e a r e th r e e c o nv e n tio n s tha t a r e o b s e r ved f o r l i s t s th a t a ppe a r i n thi s m a n ua l . • • • I n l i s t s s uc h a s this o ne , wh e r e the r e i s n o o r d e r o r hiera rchy , l i s t e l em e n t s a r e i nd i c a t ed by l ea d i ng b u l l e t s Sub l i s t s wi tho ut h i e r a r c h y a r e i nd i c a t e d by d a s h e s ( - ) . (e) . Li s t s t h a t i ndic a t e an o rd e r ed s e t o f o pe r a t i o n s a r e n umbe r e d ( o r l e t t e r ed ) . N umb e r ed l i s t s wi th t h e n umbe r s e nc l o s ed i n p a r e n th e s e s i nd i c a t e a c o r r e s po nd e n c e b e twe e n i n d ivid u a l l is t e l em e n t s a nd n um b e r ed i t ems i n a f ig u r e . xxxi PART I I NTRODUC T I ON Fo r t h e f a sh i o n o f M i n a s T i r i th wa s s uc h t h a t s ev e n l e v e l s , e a ch d e l v ed i t wa s b u i l t o n i n to a h i l l , a nd abo u t e a c h wa s s e t a wa l l , a nd i n e a c h wa l l wa s a g a t e . Th e Re t u r n o f the K i ng , Be i ng th e Th i r d Pa r t o f Th e Lo r d' o f t h e R i ng s J . R . R . To l k i e n C HA PTER 1 S YS TEM OVERV I EW Th i s c h a p t e r i n t r o d uc e s the b a s i c c o n c e p t s t h a t a r e u s ed to d e sc r i b e the VAX/VM S o pe r a t i ng s ys tem . Spec i a l a t te n t i o n i s pa i d to the h a rd wa r e f e a t u r e s of t h e VAX a r c h i t e c t u r e th a t a r e e i t h e r e x p l o i ted b y VM S o r e x i s t so l e l y t o s uppo r t a n o pe r a t i ng sys tem . I n ad d i t i o n , s om e o f the d e s i g n g o a l s t h a t g u i d ed the i mpl em e n t a t i o n of VM S a r e d i sc u s s e d . 1.1 PROC E S S , JOB , AND I MAG E The f und am e n t a l u n i t i n VAX/VM S , the ent i ty t h a t is s e l e c t ed fo r e x e c ut i o n by the s c h ed u l e r , is the p r o c e s s . I f a proc e s s c r eates s ub p r o c e s s e s , t h e c o l l e c t i o n o f t h e c r e a to r process , all the s ub p r o c e s s e s c r e a t e d by it, a nd al l s ub p r o c e s s e s c r ea t ed b y i t s d e s c e nd a n t s , i s c a l l ed a j o b . Th e p r og r am s tha t a p r o c e s s e x e c u t e s i n o rd e r to a c compl i s h m e a n i ng f u l wo r k a r e c a l l ed i m a g e s . 1.1.1 Process A p r o c e s s i s f u l l y d e s c r i b ed by h a r d wa r e c o n t ex t , s o f twa r e contex t ; a nd a v i r t u a l a d d r e s s s pa c e d e sc r i p t i o n . Th i s i n fo rma t i o n i s s t o r e d i n s e v e r a l d a t a s t r uc t u r e s l o c a t e d i n d i f f e r e n t p l a c e s i n the p r ocess a d d r e s s s pa c e . Th e d a t a s t r uc t u r e s tha t c o n t a i n t h e v a r i o u s p i e c e s o f p r o c e s s c o n t e x t a r e p i c t u r ed i n F i g u r e 1 - 1 . 1 . 1 . 1 . 1 H a r d wa r e Co n t e x t - Th e h a r d wa r e c o n t e x t c o n s i s t s o f c o p i e s o f the g e n e r a l p u r po s e r eg i s t e r s , the fo u r pe r - p r o c e s s s t a c k po i n t e r s , the p r og r am c o u n t e r ( PC ) , t h e p r o c e s s o r s t a t u s l o ng wo r d ( P S L ) , a nd t h e p r o c e s s - s pe c i f i c processo r r eg i s te r s i n c l ud i ng the m emo r y m a n a g em e n t r eg i s t e r s a nd the A S T l ev e l r eg i s t e r . Th e h a r d wa r e c o n t ex t r e s i d e s i n a data s t r uc t u r e c a l l ed t h e h a r d wa r e p r o c e s s c o n t r o l b l o c k t h a t i s u s e d p r i ma r i l y wh e n a process is r emoved f r om o r s e l e c t ed fo r execut ion . Ano the r pa r t o f p r o c e s s c o n t e x t t h a t i s r e l a t ed to h a r d wa r e is the ex i s tence o f fo u r pe r - p r o c e s s s t a c k s , one fo r e a c h of the fo u r a c c e s s mod e s . A n y code tha t e x e c u t e s o n beha l f o f a p r o c e s s u s es o n e o f tha t proce s s ' s four stacks . 1-1 1 . H a r d w a r e c o n t e x t is stored i n h a r d w a r e PCB • Per-Process Stacks (Control Reg i o n ) P 1 Space 2. Softw are context i s spread around in PCB. PHD. JIB a nd P1 space 3. V i r t u a l address space Proc ess Control Block Job Information Block • Pooled Q uo t a s ...til_ """' - -- - • Process Name • Scheduling Info This JIB p o i n t e d t o by a ll o t h e r proc e s s e s ( i f a n y ) i n s a me job • Process 10 • Pointers to RMS Data • I mage Data t---1 80000000 System Space d e s c r i p t i o n i s stored in PO and P 1 pa g e t ables • �� >� P roce ss Head e r '� � - - - - - - - - - - � - - - - - - • Working Set List \ • Process Sec t ion Table • Accounting Info other struc tures JIB - or---.., Hardware Process Control Blocks Hardware PCB PCB PO Page Table �� \ • General Registers • PC, PSL \ \ • Per-Process \ \ \ \ , Stack Pointers • Memory Management Registers • ASTLVL ( Hardware Contex t) (Virtual Address Space Description) � � P 1 Page Table PHD Figure 1-1 Da t a S t r uc t u r e s Th a t De sc r i b e P r o c e s s Co n t e x t en t< en ..a � 3 0 < � ::c < � � H SYSTEM OVERVI EW 1 . 1 . 1 . 2 S o f twa r e Co n t e x t - So f t wa r e c o n t e x t c o n s i s t s o f a l l th e d a t a r e q u i r ed by v a r i o u s p a r t s o f t h e o pe r a t i ng s y s t em to m a k e s c h ed u l i ng a n d o th e r d e c i s i o n s a b o u t a p r o c e s s . Th i s d a t a i nc l ud e s the process so f twa r e pr i o r i ty , i t s c u r r e n t sc h ed u l i ng s t a t e , p r o c e s s p r i v i l eg e s , q uo t a s a nd l i m i t s , a nd m i s c e l l a n e o u s i n fo rm a t i o n s uch a s p r o c e s s n am e a nd p r o c e s s I D . Th e i n fo rm a t i o n abo u t a p r o c e s s th a t mus t b e i n memo r y a t a l l t i m e s i s s to r ed i n a d a ta s t r uc t ur e c a l l ed t h e so f twa r e p r o c e s s c o n t r o l b l o c k ( PC B ) . Th i s d a ta i n c l ud e s t h e s o f twa r e pr i o r i t y o f t h e p r o c e s s , i ts un i que process id ent i f i c a t i o n ( PID) , a nd t h e pa r t i c u l a r sch ed u l i ng s t a t e th a t the p r o c e s s i s i n a t a g i v e n po i n t i n t i me . Some p r o c e s s quo t a s a nd l imi ts a re s to r e d i n t h e so f twa r e PC B . ( Th e q uo t a s a nd l i m i t s tha t a r e sha r ed amo ng a l l p r o c e s s e s i n the s am e j o b a r e s to r ed i n a sha r e d d a t a s t r uc t ur e c a l l ed t h e j o b i n f o rm a t i o n b l o c k . ) Th e i n fo rma t i o n abo u t a p r o c e s s tha t d o e s n o t h a v e to b e pe rm a n e n t l y r e s i d e nt ( s wa ppab l e p r o c e s s c o n t ex t ) i s c o n t a i ned i n a d a t a s t r uc t ur e c a l l ed t h e p r o c e s s h e a d e r . Th i s i n f o rm a t i o n i s o n l y n e ed e d wh e n the process i s r e s i d e n t a nd c o n s i s t s m a i n l y o f i n fo rma t i o n u s ed b y memo r y Th e d a t a i n the p r o c e s s h e a d e r is m a n ag em e n t wh e n pag e f a u l t s o c c u r . a l so used by the swa ppe r wh e n t h e p r o c e s s i s r em o v e d f r om memo r y ( o u t swa ppe d ) o r b r o ug h t b a c k i n to memo r y ( i n swa pped ) . Th e h a r d wa r e PC B , wh i c h conta i ns t h e h a r d wa r e c o n t e x t o f a p r o c e s s , i s a p a r t o f I n f o rma t i o n i n t h e p r o c e s s h e a d e r i s a v a i l a b l e to the proc ess h e ad e r . s u i t a b l y pr i v i l eg e d code wh e n e v e r t h e p r o c e s s i s r e s i d e n t ( i s in the bal ance se t ) . Al l o th e r r e f e r e n c e s to the p r o c e s s h e a d e r m u s t be mad e i n the c o n t e x t o f the p r o c e s s wh o s e p r o c e s s h e a d e r i s b e i ng e x am i n ed . O t h e r p r o c e s s - s p ec i f i c i n f o rm a t i o n i s s t o r e d i n the P l po r t i o n o f the p r o c e s s v i r t ua l ad d r e s s sp a c e ( the contr o l r eg i o n ) . Th i s d a t a i n c l ud e s e x c e p t i o n d i s pa tch i ng i n fo rm a t i o n , RM S d a t a tables , a nd i n f o rm a t i o n a b o u t the i m ag e t h a t i s c u r r e n t l y e x e c u t i ng . I n f o rm a t i o n t h a t i s s t o r ed. i n P l s pa c e i s o n l y a c c e s s i b l e wh en the proc ess is e x e c u t i ng (is the cur rent proces s ) b e c ause P l s pa c e i s process s pe c i f i c . 1 . 1 . 1 . 3 V i r t u a l Ad d r e s s Spa c e D e sc r i pt i o n - Th e v i r t u a l a d d r e s s s pa c e o f a p r o c e s s i s d e sc r i b ed b y t h e p r o c e s s P O a n d P l pag e t a b l e s , s t o r e d i n t h e h i g h ad d r e s s e nd o f t h e p r o c e s s h e a d e r . Th e p r o c e s s v i r t ua l address s pa c e i s a l t e r ed wh e n a n i m a g e i s i n i t i a l l y a c t i v a t ed , d u r i ng i m a g e e x e c u t i o n th r o ug h s e l ec ted sys t em s e r v i c e s , a n d wh e n an i m ag e t e rm i n a t e s . Th e p r o c e s s pag e t a b l e s r e s i d e i n sys tem v i r t ua l a d d r e s s s pa c e a nd a r e i n t u r n d e sc r i b ed by e n t r i e s i n t h e sys t em pag e t ab l e . Un l i k e the o th e r po r t i o n s o f t h e p r o c e s s h e a d e r , t h e p r o c e s s pag e t a b l e s a r e them s e l v e s pag e a b l e , and are f a u l t ed i n to the process wo r k i ng s e t o n l y wh e n t h e y a r e n e e d e d . 1.1.2 Image Th e p r o g r ams t h a t e x e c u t e i n t h e c o n tex t o f a process a r e c a l l ed imag e s . Imag es u s ua l l y r e s i d e i n f i l e s tha t a r e p r o d uc ed by o n e o f t h e VAX/VM S l i n ke r s . Wh e n the u s e r i n i t i a t e s i m ag e e x e c u t i o n ( a s pa r t of p r o c e s s c r ea t i o n o r t h r o ug h a DC L o r MCR c o mma nd i n a n i n t e r a c t i v e o r ba tch j o b ) , a com po n e n t o f the e x e c u t i v e c a l l e d t h e i m a g e a c t i v a to r sets up t h e p r o c e s s pag e ta b l e s to po i n t to the a pp r o p r i a t e s e c t i o n s o f th e i m a g e f i l e . VM S u s e s t h e same pag i ng m e c h a n i sm th a t i mp l em e n t s i t s v i r t ua l memo r y s uppo r t t o r e ad i m ag e pag e s i n to memo r y a s t h e y a r e n e ed ed . 1-3 SYS TEM OVE RVI EW 1.1.3 Job Th e c o l l e c t i o n of s ub p r o c e s s e s th a t h a s a c ommo n r oo t process is c a l l ed a j ob . Th e c o n c e p t o f a j o b ex i s t s so l e l y f o r the p u r po s e o f s h a r i ng r e s o u r c e s . Some quo t a s a n d l i m i t s , s o - c a l l ed po o l e d quo t a s , a r e s h a r ed among a l l p r o c e s s e s i n the s ame j o b . Th e c u r r e n t v a l u e s o f these q uo t a s a re c o n t a i n ed i n a d a ta s t r uc t u r e c a l l e d a j ob i n fo r m a t i o n b l o c k ( F i g u r e 1 - 1 ) th a t i s sha r e d by a l l p r o c e s s e s i n the s ame j o b . 1.2 FUNC T I ONAL I TY PROV I D E D BY VAX/VMS Any o pe r a t i ng s ys t em p r o v i d e s s e r v i c e s a t m a n y l ev e l s so that use r a ppl i c a t i o n s m a y e x e c u t e e a s i l y and e f fect ive l y . Th e f un c t i o n a l i t y p r ov i d ed by VAX/VM S i s p i c t u r ed i n F i g u r e 1 - 2 . Th e f i g u r e i s d e s i g n ed to show the l a ye r ed des ign of the VAX/VM S o p e r a t i ng s y s tem . In g e ne r a l , c ompo n e n t s i n a g i v e n l a ye r c a n m a k e u s e o f t h e f a c i l i t i e s i n a l l i nn e r l a ye r s . 1.2. 1 Ope r a t i ng S y s t em Ke r n e l the I /0 Th e m a i n to p i c o f t h i s m a n u a l i s t h e ope r a t i ng s y s t em k e r n e l ; s ub s ys tem , memo r y m a n ag em e n t , t h e s c h e d u l e r , a nd t h e VAX/VM S s y s t em s e rv i c e s th a t s uppo r t a nd c ompl eme n t th e s e c ompo n e n t s . Th e a pp r o a c h that is used i n d i s c u s s i ng th e s e th r e e c ompo n e n t s a nd other m i s c e l l a n e o u s pa r t s o f t h e o pe r a t i ng s ys tem k e r n e l f o c u s e s o n t h e d a t a s t r uc t u r e s tha t a r e m a n i pu l a t ed by a g i v en c om po n e n t . By d i s c u s s i ng wh a t e a c h m a j o r d a t a s t r uc t u r e r e p r e s e n t s , a n d h o w t h a t s t r uc t u r e is a l t e r ed b y d i f f e r e n t s e q u e nc e s o f e v e n t s in the s ys tem , we w i l l d e sc r i b e t h e d e t a i l ed o pe r a t i o n s o f e a c h m a j o r p i e c e o f the e x e c u t i v e . 1.2. 1 . 1 I /0 S u b s y s t em - Th e I /0 s ub s ys tem c o n s i s t s o f d e v i c e d r i v e r s a nd the i r a s s o c i a t ed data s t r uc t u r e s , d e v i c e i nd e pe nd e n t r o u t i n e s w i t h i n the e x e c u t i v e , a nd s ev e r a l s y s t em s e rv i c e s , t h e m o s t i m po r t a n t of wh i c h i s the $ Q I O r e qu e s t , t h e e v e n t u a l I /0 r e que s t t h a t i s i s s u ed b y a l l o u t e r l a ye r s of t h e s ys tem . Th e I /0 s u b s y s tem i s d e sc r i b ed in g r e a t d e ta i l f r om t h e po i n t o f v i e w o f a d d i ng a d ev i c e d r i v e r t o VM S i n t h e VAX/VM S G u i d e to Wr i t i ng a Dev i c e Dr i v e r . Ch a p te r s 1 5 and 16 of t h i s m a n ua l d e s c r i b e f e a t u r e s o f the I /0 s ub s ys t em th a t a r e n o t d e sc r i b ed th e r e . 1 . 2 . 1 . 2 Memo r y Ma n a g em e n t - Th e m a i n c ompo n e n t s of the memo r y m a n ag em e n t s ub s ys t em a r e t h e pag e f a u l t h a nd l e r , wh i c h i m pl em e n t s the v i r t u a l mem o r y s uppo r t of VAX/VM S , a n d the s wa ppe r , wh i c h a l l o ws the s ys t em to m o r e f u l l y u t i l i z e t h e amo un t of phys i c a l memo r y that i s ava i l able . Th e d a t a s t r uc t u r e s u s ed a nd m a n i p u l a t ed by t h e pag e r a nd s wa ppe r i n c l ud e t h e PFN d a t a b a s e a nd th e pag e t a b l e s o f e a c h p r o c e s s . Th e PFN d a t a b a s e d e sc r i b e s e a c h pag e o f phys i c a l memo r y t h a t is a v a i l a b l e fo r pag i ng and s wa pp i ng . V i r t u a l a d d r e s s s pa c e d e sc r i p t i o n s o f e a c h c u r r e n t l y r e s i d e n t p r o c e s s a r e c o n t a i n ed i n the i r r e spec t i v e pag e tab les . Sy s t em s e r v i c e s a r e a v a i l a b l e to a l l o w a u s e r ( o r the s y s t em on b e h a l f of t h e us e r ) to c r e a t e o r d e l e t e s p e c i f i c po r t i o n s o f v i r t u a l add r e s s s pa c e o r ma p a f i l e i n t o a s pe c i f i ed v i r t ua l a d d r e s s r a ng e . 1-4 P r i v i leged I m a ges P r o g r a m Dev el o pmen t Too l s I mages I nstalled with Privilege Other Privileged I mages Images Linked with system symbol table • • I-' I U1 • Tex t E d i t o rs • Linker • MACRO A ssembler • S y s t e m Message File System I nformational Utilities Compiler Run T i m e Li b rary Run Time Li b rary ( S p ec ific ) (General ) • • FO RTRA N • • PASCA L • PL/ 1 • Lay e red P rod uc t s • • • Math Library Stri ng M a n ipulati o n Screen Formatt i n g A s s o rted U t i l i t i e s • Language Compilers DATATRI EVE Forms Utilities SORT • File M a nipulation • H E LP • DIRECTORY Figure 1-2 La ye r e d De s i g n o f VAX/VM S en t< en t-3 tz:l 3: 0 < tz:l � < H tz:l � SYSTEM OVERVI EW 1. 2. 1 . 3 Sched u l i ng a nd P r o c e s s C o n t r o l - Th e thi r d ma j o r c om po n e n t o f t h e k e r n e l i s the s c h ed u l e r , wh i c h s e l e c t s p r o c e s s e s fo r e x e c u t i o n a nd r em o v e s p r o c e s s e s f r om ex e c u t i o n tha t c a n no l o ng e r e x e c u t e . Th e s c h ed u l e r a l so h a nd l e s c l o c k s e r vi c i ng a nd i n c l ud e s t ime r r e l a t e d sys t em s e rv i c e s . Sys tem s e rv i c e s a r e a v a i l a b l e to a l l o w a p r o c e s s ( o r p r og r amme r ) to c r e a t e o r d e l e t e o th e r processes . O t h e r s e rv i c e s p r ov i d e o n e p r o c e s s the a b i l i t y t o c o n t r o l t h e e x e c u ti o n o f a n o t he r . 1 . 2 . 1 . 4 M i sc e l l a n e o u s S e rv i c e s - O n e a r e a o f the o pe r a ting s ys tem ke r nel tha t is not pi c t u r ed i n Fig u r e 1 - 2 i nvo l v e s the m a n y m i s c e l l a n e o us s e rv i c e s th a t a r e avail ab l e in t h e o pe r a t ing sys tem k e r nel . Some of these s e r vi c e s , s uc h as l og i c a l n am e c r e a ti o n o r s t r ing f o rm a t t i ng , a r e a v a i l a b l e to the u s e r i n the fo rm o f s y s t em servi ces . Ot h e r s , s uc h as po o l m a nipu l a ti o n r o u t i n e s a nd s ync h r o n i z a tio n t e c hnique s , a r e o n l y u s e d by t h e k e r n e l a nd p r ivi l eg e d ut i l i t i e s . 1. 2. 2 D a t a Ma n a g e m e n t VAX/VMS p r o v i d e s d a t a m a n ag em e n t f a c i l i ti e s a t two l ev e l s . Th e r e c o r d s t r uc t u r e th a t e x i s t s w i thin a file i s i n t e r p r e t ed b y t h e VAX - 1 1 Re c o r d Ma nag em e n t S e r vi c e s ( RM S ) , whi c h e x i s t s i n a l aye r j us t o u t s i d e the ke rnel . RMS e x i s t s a s a s e r i e s o f p r oc e d u r e s l o c a t e d i n sys tem spa c e , s o i t i s i n some wa ys j u s t l i k e the r es t o f the o pe r a t i ng sys tem ke rnel . Mo s t o f t h e p r o c ed u r e s i n RM S e x e c u t e i n e x e c ut i v e a c c e s s m o d e , p r ov i d i ng a t h i n wa l l o f p r o t ec t i o n b e twe e n RM S a n d the ke rnel i tsel f . Th e pl a c em e n t o f f i l e s o n m a s s s to r ag e v o l um e s i s c o n t r o l l ed b y o n e o f the disk o r t a pe AC Ps ( Anc i l l a r y Co n t r o l Process ) . AC Ps are i m p l em e n t ed a s s e pa r a t e p r o c e s s e s b e c a u s e many o f their o pe r a t i o n s mus t b e s e r i a l i zed to avoid s yn ch r ono us access confl icts . Th e s e p r o c e s s e s i n t e r a c t w i th t h e k e r n e l bo th th r o ug h the sys t em s e rv i c e i nter face a nd a l so b y us i ng s om e o f t h e u t i l i ty r o u t i n e s th a t a r e no t a c c e s s i b l e to the g e n e r a l u s e r . 1.2.3 User Interface Th e i n t e r f a c e tha t i s p r e s e n ted t o t h e use r ( a s d i s tinc t f r om the a pp l i c a ti o n p r og r amme r wh o is us i ng s y s tem s e r v i c e s a nd Run-T i m e Li b r a r y p r o c ed u r e s ) i s o n e o f the c ommand l a ng uag � i n t e r p r e t e r s ( C L I ) . Some o f the s e r v i c es p e r fo rmed by a C L I c a l l RM S o r the s ys tem s e rv i c e s d i r e c t l y . Oth e r s r e s ul t i n the exec u t i o n o f a n e x t e r na l i m ag e . Th e s e imag e s a r e g e n e r a l l y n o d i f f e r e n t f r om u s e r -w r i t t e n a pp l i c a t ions i n tha t t h e i r o n l y i n te r f a c e to t h e e x e c u t i v e i s t h r o ug h the sys t em s e r v i c e s a nd RM S c a l l s . Some func t i o n s a v a i l a b l e to t h e us e r a r e pe r f o rmed by i mag e s th a t use und o c um e n ted i n te r f a c e s into t h e k e r n e l . Th e s e i m a g e s u s ua l l y r e qu i r e p r i v i l eg e s i n o r d e r to e x e c u t e , and a r e a l s o l i n k e d w i th the s ys tem s ymbo l t a b l e SYS $ S Y ST EM : S YS . S TB . 1-6 SYS TEM OVERVI EW 1. 2. 3. 1 Imag e s I n s ta l l ed w i t h P r i v i l eg e - Some o f the i n fo r m a t i o n a l ut i l i ti e s a nd d i s k a nd t a pe vo l um e m a nipu l a tion u t i l i t i e s r eq ui r e t h a t s e l e c ted po r ti o n s o f p r o t e c t ed d a t a s t r uc t u r e s b e r e ad o r wr i t t e n i n a c o n t r o l l ed f a shio n . Imag es t h a t r e qui r e p r iv i l eg e to pe r fo r m thei r f un c t i o n c a n b e i n s t a l l ed ( ma d e known to VM S ) by t h e s y s t e m m a n ag e r s o that th e y c a n pe r f o rm t h ei r f un c tio n i n a n o rd i n a r i l y n o n p r iv i l eged p r o c e s s e nvi r o nm e n t . I mag e s t h a t fit this d e sc r i p t i o n a r e D I S PLAY , VMO UNT ( th e vo l um e m o u n t u t i l i t y ) , S E T , a n d SHOW . Tabl e 1 - 1 li sts a l l th o s e imag e s t h a t a r e i n s t a l l ed wi th p r ivi l eg e in a t yp i c a l VM S s y s t em . 1.2. 3. 2 O t h e r P r i v i l eg ed Ima g e s - O t h e r imag e s tha t pe r f o rm p r ivi l eg e d f un c t i o n s are n o t i n s t a l l ed wi th p r iv i l eg e b e c a u s e thei r f un c ti o n s a r e l e s s c o n t r o l l ed a nd c o u l d d e s t r o y t h e sys tem i f e x e c u t ed by n a iv e o r m a l i c i o us use r s . Th e s e im ag e s c an o n l y b e e x e c uted by p r ivi l eg e d u s e r s . Ex ampl e s o f these imag es i nc l ud e SYSGEN ( fo r l o a d i ng d evi c e d r iv e r s ) , I N S TALL { wh i c h m a k e s i m a g e s p r ivi l eg ed o r sha r e a b l e ! ) , o r the im ag e s i nv o k e d by a C L I to m a n i p u l a te print o r b a tc h q u e ue s . Imag es t h a t r e qu i r e p r ivi l eg e to e x e c u t e b u t a r e no t i n s t a l l ed wi t h p r ivi l eg e i n a t ypi c a l VAX/VM S s y s t em a r e a l s o l i s ted in Tab l e 1 - 1 . Ta b l e 1 - 1 Sys tem P r o c e s s e s a nd Pr ivi l eg ed Imag e s Sys tem P r o c e s s e s Imag e Name L i n ked wi th SYS . STB C C P . E XE F l lAAC P . EXE F l lBAC P . EXE M TAAAC P . EXE R EMAC P . EXE Ye s Ye s Ye s Ye s Ye s Imag e fo r NETAC P F i l e s - 1 1 AC P f o r St r uc tu r e Lev e l 1 F i l e s- 1 1 A C P f o r S t r uc t u r e Lev e l 2 Mag n e t i c Ta pe AC P Rem o t e Te rm i n a l AC P ERRFMT . EXE I N PSM B . EXE JOBCTL . E XE O PC OM . EXE PRTSM B . EXE Ye s Ye s Ye s Ye s Ye s Er r o r Log Bu f fe r Fo rma t Pro c e s s Ca r d Re ad e r Inpu t Symb i o nt Job Co n t r o l l er / Sym b i o n t Man ag e r Ope r a to r Commun i c a t i o n Fac i l i ty Pr i n t Symb i o n t De sc r i pt i o n Imag e s In s ta l l ed wi th Pr i v i l eg e ( i n a typ i c a l VM S system) I m ag e Name L i n ke d wi th SYS . STB D I SMOUNT . E XE D I S PLAY . EXE I N IT . E XE LOG I NO UT . EXE MAI L . EXE R E QU E S T . EXE S E T . EXE S ET P O . EXE S H OW . EXE S UBM I T . EXE Ye s Ye s Ye s Ye s VMOUNT . EXE Ye s De sc r i pt i o n Vo l ume Di smo un t Ut i l i ty Sys tem Sta t i st i c s Ut i l i ty Vo l um e In i t i a l i za t i o n Ut i l i ty Log i n/Log o u t Imag e Ma i 1 Ut i 1 i t y Ope r a to r Requ e s t Fa c i l i t y SET Command Pro c e sso r SET Command Pro c e sso r SHOW Comma nd Pro c e s so r Ba tch a nd Pr i n t Job Subm i s s i on Fac i l i ty Vo l um e Mo un t Ut i l i ty Ye s Ye s Ye s 1-7 S Y S TEM OVERVI EW Ta b l e 1 - 1 ( co n t . ) Sy s t em P r o c e s s e s a n d P r i v i l eg ed Imag e s Imag e s Th a t Re qu i r e Pr iv i l eg e Th a t Ar e Typ i c a l l y No t I n s ta l l ed L i nked wi th SYS . STB Imag e Nam e I N F O . EXE I N S TA L L . EXE NC P . EXE O PCCRA S H . E XE QUEMAN . EXE R E PLY . EXE RM S S HA R E . EXE RTPA D . EXE R UNDE T . EXE S DA . EXE S YS G E N . EXE (*) TALK . EXE US ERS . EXE (*) ( *) ( *) De sc r i pt i o n P r o c e s s In fo rma t i o n Ut i l i ty Kn o wn Imag e In sta l l a t i o n Ut i l i t y Ne two r k Co n t r o l P r o g r am Sys tem Sh utd o wn Fa c i l i ty Que ue Ma n i pu l a t i o n Command Proc e s so r Me s sa g e B r o ad c a s t i ng Fa c i l i ty F i l e Sh a r i ng Ut i l i ty Rem o te Te r m i n a l Command I n te r fa c e RUN Pr o c e s s Command Pr o c e sso r Sys tem Dump �n a l y ze r Sys t em G e n e r a t i o n and Co n f i g ur a t i o n Ut i l i ty I n t e r te rm i n a l Commun i c a t i o n Ut i l i t y I n te r a c t i v e Us e r s D i spl a y Ye s Ye s Ye s Ye s Ye s Ye s Ye s Yes Th e se imag e s a r e no t s uppo r te d by D I G I TA L . Imag es Wh o se Ope r a t i o n s Ar e Pr o te c ted b y Sys t em U I C o r Vo l um e OWn e r sh i p Li nked wi th SYS . STB Imag e Na me Oe se r i pt i o n B A D . EXE DSC 1 . EXE Bad B l o c k Lo c a to r Di s k S a v e and Compr e s s Ut i l i ty f o r S t r uc t u r e Lev e l 1 Di s k Sa v e and Compr e s s Ut i l i ty fo r St r uc t u r e Lev el 2 Di s k Quo ta Ut i l i ty Fi l e St r uc t u r e Ve r i f i c a t i o n Ut i l i ty fo r St r uc t u r e Lev e l 1 F i l e St r uc t u r e Ve r i f i c a t i o n Ut i l i ty f o r St r uc t u r e Lev e l 2 DSC 2 . EXE D I S KQUOTA . EXE VFY l . EXE Ye s VFY 2 . EXE M i s c e l l aneo us Imag e s L i n ked wi th SYS $ S YS TEM : SYS . S TB Imag e Na me DC L . EXE MCR . EXE RM S . EXE Li n ked wi th SYS . STB Oe se r i pt i o n DC L Command In te r pr e te r MCR Comma nd In te r pr e te r Re c o rd Ma nag em en t Se r v i c e s Imag e Ye s Ye s Ye s 1-8 S YS TEM OVE RVI EW 1.2. 3. 3 I m a g e s Th a t L i n k w i th S Y S $ SY STEM : SY S . S TB - Ta b l e 1 - 1 a l so l i sts t ho s e c om po n e n t s t h a t a r e l i n k e d w i th t h e s ys t em s ym b o l t a b l e ( S YS $ S YS T EM : S YS . S T B ) . Th e s e i m a g e s a c c e s s k n o wn l oc a t i ons in the s y s t em i m ag e ( S YS . E X E ) t h r o ug h g l o b a l s ym b o l s a nd m u s t b e r e l i n k e d e a c h t i m e t h e s ys t e m i t s e l f i s r e l i n k e d . Us e r a pp l i c a t i o n s o r s pe c i a l c om po n e n t s s uc h a s d ev i c e d r i v e r s t h a t i n c l ud e SYS . S TB wh e n t h e y a r e l i n k e d m u s t b e r e l i n k e d wh e n e v e r a n e w v e r s i o n o f t h e s ym b o l t a b l e is r e l e a s e d , u s u a l l y a t e a c h m a j o r r e l e a s e o f VAX/VM S . 1.2.4 I n t e r f a c e b e twe e n Ke r n e l S ub s ys t ems Th e c o up l i ng b e t we e n the th r e e m a j o r s ub s ys t em s p i c t u r e d i n F i g u r e 1 - 2 is s o m e wh a t m i s l e a d i ng i n t h a t t h e r e i s a c t ua l l y l i t t l e i n t e r a c t i o n b e twe e n t h e t h r e e c om po n e n t s . In add i t ion , e a ch of the three c om po n e n t s h a s i t s o wn s e c t i o n o f e x e c u t i v e d a t a s t r uc t u r e s t h a t i t i s r e s po n s i b l e fo r . Wh e n o n e o f t h e o th e r p i e c e s o f t h e s ys t e m w i s h e s t o access s uc h d a t a s t r uc t u r e s , i t does so t h r o ug h s o m e c o n t r o l l ed i n te r fa c e . F i g u r e 1 - 3 s h o ws t h e sma l l am o u n t o f i n terac t i on that occurs b e t we e n t h e th r e e m a j o r s ub s ys t ems i n t h e o pe r a t i ng s y s t em ke rnel . Lock/U nlock Physical Pages for Direct 1/0 Page Fault Read l nswap/Outswap Modified Page Write Wait for 1/0 Request Wake Up 1/0 Request Swapper Complete Page Fault Wait Page Fault Read Complete Free Page Wait Physical Page Available l nswap Complete Outswap Complete Figure 1-3 I n t e r a c t i o n B e t we e n Compo n e n t s o f VM S K e r n e l 1-9 SYSTEM OVERV I EW 1.2. 4. 1 I /0 Subsys tem Re que s t s Th e I /0 s ub s y s t em ma k e s a r e q u e s t to memo r y m a n a g eme n t to l o c k d o wn s pe c i f i ed pag e s f o r a d i r e c t I /0 r eques t . Th e pag e r o r swa ppe r i s n o t i f i ed d i r e c t l y wh e n the I /0 r e q ue s t tha t j us t c om p l e t ed wa s i n i t i a t e d b y e i th e r o n e o f them . - I /0 r e q ue s t s c a n r e s u l t i n the r e q ue s t i ng p r o c e s s b e i ng p l a c ed in a wa i t s t a t e , un t i l the r e q u e s t c om p l e t e s . Th i s r eq u i r e s t h a t the I n a d d i t i o n , I / 0 c o mpl e t i o n c a n a l s o c ause a s c h ed u l e r b e no t i f i ed . p r o c e s s to c h a ng e i t s s c h ed u l i ng s ta t e . Ag a i n , t h e s c h ed u l e r wo u l d b e c a l l ed . 1 . 2 . 4 . 2 Memo r y Ma nag e me n t Reque s t s B o th the p ag e r a nd swa ppe r r e qu i r e i n p u t a nd o u t pu t o pe r a t i o n s i n o rd e r to f ul f i l l the i r f un c t i o n s . Ne i th e r c a l l s $ Q I O d i r e c t l y b e c a us e m a ny o f t h e p r o t ec t i o n checks tha t $ Q I O m a k e s a r e unne c e s s a r y a nd wo ul d s l ow d o wn pag e I /0 a nd swa p I /0 . I n s t e ad , t h e y u s e spec i a l e n t r y po i n t s i n to the I /0 s y s t em th a t a l l o w p r eb u i l t I /0 r e qu e s t s to b e q u e ued d i r e c t l y to a d r iver . - I f a p r o c e s s i nc u r s a pag e f a u l t t h a t r e s u l t s i n a r e a d f r om d i s k , or if a process r e qu i r e s phys i c a l memo r y a nd n o n e i s a v a i l a b l e , t h e p r o c e s s i s p u t i n t o o n e o f t h e memo r y m a n ag em e n t wa i t s t a t e s b y t h e s c h ed u l e r . Wh e n the pag e r e a d c ompl e te s o r phys i c a l memo r y b e com e s a v a i l a b l e , t h e p r o c e s s i s m a d e c omput a b l e a g a i n . 1.2.4.3 S c h e d u l e r Req u e s t s - Th e s c h ed u l e r act ively i nte r a c ts ve r y l i ttle wi th t he rest o f t h e sys tem . I t s e rv e s a m o r e pa s s i v e r o l e wh e n c o o pe r a t i o n w i th m emo r y m a n ag eme n t o r the I /0 s ub s ys t em is r e q u i r ed . On e e x c e p t i o n t o th i s pa s s i v e r o l e i s t h a t t h e s c h ed u l e r a wa k e n s the s wa ppe r wh e n a process that is n o t c u r r e n t l y m emo r y r e s i d e n t b e c om e s c om p u t a b l e . 1.3 HARDWARE I MPLEMENTAT I ON OF OPERATING SYSTEM KERN E L Th e m e t ho d o f i m p l eme n t i ng t h e many s e rv i c e s p r ov i d ed b y VAX/VMS i l l us t r a tes t h e c l o s e c o nn e c t i o n b e twe e n t h e h a r d wa r e d e s i g n a n d the o p e r a t i ng sys tem . Many o f the g ene r a l features of the VAX a r ch i t e c t u r e a r e u s e d to a d v a n t ag e by VAX/VMS . Oth e r f e a t u r e s o f the a r ch i t e c t u r e e x i s t e n t i r e l y t o s uppo r t a n o pe r a t i ng s ys t em . 1 . 3. 1 VAX A r c h i te c t u r e Fe a t u r e s E x pl o i t e d by VMS S e v e r a l f e a t u r e s o f t h e VAX a r c h i t ec t u r e th a t us e r s a r e used fo r s p e c i f i c p u r po s e s b y VM S . • • a re ava i l ab l e to all Th e g e ne r a l p u r po s e c a l l i ng m e ch a n i sm is the p r i m a r y pa th i n t o VM S f r om a l l o u t e r l a ye r s o f the s ys t em . Becaus e a l l s ys t em s e r v i c e s a r e p r o c e d u r e s , t h e y a r e ava i l ab l e to all n a t i v e mod e l a ng u a g e s . As me n t i o n ed a b ove , t h e m emo r y m a n ag em e n t p r o t ec t i o n s c h em e is used to protec t c o d e a nd d a t a u s e d by mo r e p r i v i l eg e d a c c e s s mod e s f r om mod i f i c a t i o n b y l e s s p r i v i l eg e d m od e s . Re a d - o n l y po r t i o n s o f t h e e x e c u t i v e a r e p r o t e c t ed i n t h e same manne r . 1-1 0 SYSTEM OVERVI EW • • • • Th e r e i s i mp l i c i t p r o t e c t i o n b u i l t i n to s pe c i a l i n s t r uc t i o n s Because only the t h a t m a y o n l y b e e x e c u t e d f r om k e r n el m o d e . e x e c ut i v e ( a n d s u i t ab l y p r i v i l eg ed p r o c e s s-ba sed c od e ) e x ec ut e s in k e r n e l m od e , s uc h i n s t r uc t i o n s a s MTPR , L D PC TX , a nd HA LT a r e p r o t e c t ed f r om ex e c u t i o n b y n o np r i v i l eg e d u s e r s . Th e o pe r a t i ng s y s t em u s e s i n t e r r up t pr i o r i t y l ev e l ( I P L ) fo r s eve r a l p u r po s e s . At i t s m o s t e l em e n ta r y l e v e l , I PL i s e l e v a ted so tha t certain i n t e r r up t s a re blocked . Fo r e x ampl e , c l oc k i n t e r r up t s m u s t b e b l o c k e d wh i l e t h e s ys t em t i m e ( s t o r e d in a q u a d wo r d ) i s c h e c ked b e c a u s e th i s c h e c k i ng t a ke s mo r e than one i n s t r uc t i o n . Clock i n t e r r up t s are b l o c k e d t o p r ev e n t t h e s ys tem t i me f r om b e i ng upd a t e d wh i l e i t i s b e i ng c h e c k e d . I P L i s a l so u s ed a s a s yn c h r o n i z a t i o n to o l . Fo r e x ampl e , a n y r o u t i n e t h a t a c c e s s e s a s ys tem-w i d e d a t a s t r uc t ur e m u s t r a i s e I PL to 7 ( c a l l ed I P L $ S YNC H ) . Th e a s s i g nm e n t o f v a r i o u s h a r dwa r e a nd so f twa re i n t e r r upt s to s pe c i f i c I P L v a l ue s e s t a b l i s h e s a n o rd e r of i mpo r t a n c e to t h e h a r d wa r e a nd s o f t wa r e i n t e r r up t s e r v i c e s th a t VM S pe r f o rm s . S e v e r a l o th e r f e a t u r e s o f t h e VAX a r c h i t e c t u r e a r e used by l a ter in spec i f i c c ompo n e n t s o f VM S a n d a r e d e s c r i b ed c h apte r s . Th e y i n c l ud e t h e c h a n g e m o d e i n s t r uc t i o n s ( C HM E a nd C HM K ) th a t a r e the only me a n s a v a i l a b l e fo r d e c r e a s i ng access mode ( t o g r ea t e r p r i v i l eg e ) ( F i g u r e 1 - 4 ) , the i nc l us i on o f m a ny p r o t e c t i o n chec ks a nd p e nd i ng i n t e r r up t c h e c k s in the s i ng l e i n s t r uc t i o n t h a t i s t h e c o mmo n i n t e r r u p t e x i t pa th , RE I , s o f t wa r e i n te r r up t s , a nd ha r d wa r e c o n t e x t a nd t h e s i ng l e i n s t r uc t i o n s LDPC TX ) t h a t s a v e a nd r e s t o r e i t . 1. 3.2 ( S VPC TX and VAX- 1 1 I n s t r uc t i o n S e t Wh i l e t h e VAX- 1 1 i n s t r uc t i o n s e t , d a t a t ype s , a nd a d d r e s s i ng m o d e s we r e d e s i g n ed to be somewh a t c ompa t i b l e w i t h t h e PD P- 1 1 , s e v e r a l f e a t u r e s t h a t we r e m i s s i ng in the PD P- 1 1 we r e a d d ed to the VAX a r c h i tec t ur e . T r ue contex t i nd e x i ng a l l o ws a r r a y e l em e n t s to b e ad d r e s s e d by e l em e n t n um b e r , w i t h t h e h a r d wa r e a c c o un t i ng f o r the s i z e ( by t e , wo r d , l o ngwo r d , o r q u a d wo r d ) o f e a ch e l em e n t . Sho r t l i t e r a l ad d r e s s i ng wa s a d d ed i n r e c o g n i t i o n o f t h e f a c t tha t the m a j o r i ty o f l i te r a l s t h a t a ppe a r i n a p r og r am a r e sm a l l n um b e r s . Va r i a b l e l e ng th b i t f i e l d s a nd c h a r ac t e r d a t a t ype s we r e ad d ed to s e rv e the need s o f s eve r a l c l a s s e s o f u s e r s , i n c l ud i ng o pe r a t i ng s ys tem d e s i g n e r s . Th e i n s t r uc t i o n s e t i nc l ud e s m a n y i n s t r uc t i o ns t h a t a r e u s e f u l to any d e s i g n e r a nd o c c u r o f t e n i n t h e VM S e x e c u t i v e . Th e q u e ue i n s t r uc t i o n s a l l o w t h e c o n s t r uc t i o n o f d o u b l y l i nk e d l i s t s a s a c ommo n d yn am i c d a t a s t r uc t u r e . C h a r a c t e r s t r i ng i n s t r uc t i o n s a r e u s e f u l wh en d e a l i ng wi th Bi t any d a t a s t r uc t ur e th a t c a n be t r e a ted as an a r ray o f byt e s . f i e l d i n s t r uc t i o n s a l l o w e f f i c i e n t o pe r a t i o n s o n f l ag s a nd m a s k s . 1-1 1 SYS TEM OVE RV I EW Access mode fields in the PSL are not directly accessible to the programmer or to the operating system. The only way to reach a LESS privileged access mode is through the REI instruction. The only way to reach a MORE privileged access mode is through one of the CHMx instructions. The boundaries between the access modes are nearly identical to the layer boundaries pictured in Figure 1 -2 . • Nearly a l l o f t h e system services execute i n kernel mode. • RMS and some system services execute i n executive mode. Command Language I nterpreters normally execute I n supervisor mode. • • Utilities, application programs, Run-Time Library procedures, and so on normally execute i n user mode. Privileged utilities sometimes execute in kernel or executive mode. Figur e 1 - 4 M e t h o d s f o r Al t e r i ng Ac c e s s Mo d e One o f t h e mo s t im po r t a n t f e a t u r e s o f t h e VAX a r c h i t e c t u r e is the c a l l i ng s t a nd a r d . An y p r o c ed u r e th a t a d h e r e s to th i s s t a nd a r d c a n b e c a l l ed f r om a n y n a t i v e l a ng u a g e , a n a d va n tag e fo r any l a rg e a pp l i c a t i o n th a t w i s h e s t o ma k e u s e o f t h e f e a t u r e s o f a wi d e r a ng e o f l a ng ua g e s . VM S ad h e r e s t o th i s s t and a rd in i ts i nter faces to the o u t s i d e wo r l d th r o ug h t h e sys t em s e r v i c e i n t e r f a c e , RMS e n t r y po i n t s , a nd t h e Run-T i m e L i b r a r y p r o c ed u r e s . Al l s ys t em s e rv i c es a nd RM S r o ut i nes a r e wr i t t e n a s p r o c e d u r e s t h a t c a n b e a c c e s s e d by i s s u i ng a CALLx to a b s o l u t e location SYS $ s e r v i c e in s ys tem v i r t ua l add r e s s s pa c e . Run-T i m e Li b r a r y p r o c ed u r es a r e i n c l ud ed i n a use r ' s i m a g e i n s t e a d o f b e i ng l o c a t ed i n s ys t em spa c e . 1 . 3. 3 Impl eme n ta t i o n o f VMS Ke r n e l Ro u t i n e s I n t h e p r ev i o u s sec t ion , w e d i v i d ed t h e VM S k e r n e l i n to th r e e f un c t i o n a l p i ec e s a nd t h e sys t em s e rv i c e i n t e r f a c e t o t h e r e s t o f the wo r l d . An a l t e rna t i v e me thod of pa r t i t i o n i ng t h e o pe r a t i ng s y s t em ke rnel is a c c o rd i ng to t h e m e thod u s e d to g a i n a c c e s s to e a c h pa r t . Th r e e c l a s s e s o f r o u t i n e s w i th i n the k e r n e l a r e p r o c ed u r e - b a s e d c od e , e x c ep t i o n s e rv i ce r o ut i ne s , a nd i n te r r up t s e r v i c e r o u t i n e s . Oth e r s ys t em-w i d e f un c t i o ns , the s wa pp i ng a nd mod i f i ed pag e wr i t i ng 1-1 2 S Y STEM OVERVI EW pe r f o rmed b y t h e swa ppe r , a r e i mp l em e n ted a s a s e pa r a t e p r o c e s s t h a t r e s i d e s i n s ys t e m s pa c e . F i g u r e 1 - 5 s h ows the v a r i o u s e n t r y pa t hs i n to t h e o pe r a t i ng s y s tem k e r n e l . E x t e r n a l Device � Hard w a re Interrupts � ( IPL 20 .. 23) = Device Driv e r F o r k Proce ssing Softw a re I n t e rrupts T r a n s l a t i o n - not - V a lid Fault (Page Fault) ' )l ( IPL = 8 1 1 ) .. ( Ex c e p t i o n , not Interrupt) ....- 1 / 0 Post processing Software Interrupt (IPL = 4 ) � R e s c h e d uling Sof t w a re I n t e r ru p t AST Delivery Softw a re I n t e rrupt ( IPL = 2 ) ( IPL = 3) Softw are Timer Inter rupt H a rdware C l o c k Interrupt (IPL = 7 ) ( IPL = 24) Figure 1-5 Pa t h s i n to Compo n e n t s o f VM S Ke r n e l 1 . 3. 3. 1 P r o c e s s C o n te x t a nd Sys t em S t a t e - Th e f i r s t s e c t i o n o f th i s c h a p t e r d e sc r i b e d the p i ec e s o f t h e s y s tem tha t a r e u s ed to d e s c r i b e a process . P r o c e s s c o n t ex t i n c l ud e s a c ompl e t e add r e ss s pa c e d e sc r i p t i o n , quo tas , p r i v i l eg e s , s c h ed u l i ng data , a n d so on . An y po r t i o n o f t h e s ys t em th a t e x e c u t e s i n the c o n t e x t o f a process can c o u n t o n a l l o f t h e s e p r o c e s s a t t r i b u t e s b e i ng av a i l a b l e . Th e r e i s a po r t i o n o f t h e k e r n e l , h o we v e r , t h a t o pe r a t e s o u t s i d e the c ontex t of a s pe c i f i c process . Th e l a rg e s t c l a s s o f r o u t i n e s th a t f a l l i n to th i s c a t e g o r y a r e i n t e r r up t s e rv i c e r o ut i nes , i nvoked in r e s po n s e t o e x t e r n a l e v e n t s wi th n o r eg a r d f o r t h e c u r r e n t l y e x e c u t i ng process . Po r t i o n s o f t h e i n i t i a l i z a t i o n s e q ue n c e a l s o f a l l i n to th i s c a teg o r y . I n a n y c a s e , t h e r e a r e n o p r o c e s s f e a t u r e s s uc h a s a k e r n e l s t ac k o r a pag e f a u l t h a nd l e r a v a i l a b l e wh e n t h e s e rout i nes are e x e c u t i ng . 1-13 SYSTEM OVERV I EW B e c a u s e o f t h e l a c k o f a p r o c e s s , t h i s s ys t em s t a t e o r i n t e r r up t s t a t e c a n b e c h a r a c t e r i z e d b y t h e f o l l o w i ng l i m i t e d c o n te x t . • • • • • • • • Al l s t a c k o pe r a t i o n s t a k e p l a c e o n t h e s ys tem-w i d e s tack . i n t e r r upt Th e pr i m a r y d e s c r i pt i o n o f s y s t em or i n t e r r up t s ta t e is c o n ta i n ed i n t h e p r o c e s so r s t a t u s l o ng wo r d ( PS L ) . Th i s wi l l i nd i c a t e t h a t t h e i n t e r r up t s t a c k i s b e i ng u s ed , that the c u r r en t a c c e s s mode is ke rnel mode , and tha t the I PL i s h i gh e r than I PL 2 . Th e s ys t em c o n t r o l b l o c k , t h e d a ta s t r uc t ur e tha t contro ls t h e d i s p a tc h i ng o f i n t e r r up t s a nd e x c e p t i o n s , c a n b e tho ug h t o f a s t h e s e c o nd a r y s t r uc t u r e th a t d e sc r i b e s s y s t em s t a te . Co d e t h a t e x e c u t e s i n t h i s s o - c a l l ed s ys tem c o n t e x t c a n o n l y refer to s ys tem v i r t u a l a d d r e s s e s . I n pa r t i c u l a r , the r e i s no P l space a va i l abl e . Th i s r e q u i r e s that the s ys tem-w i d e i n t e r r up t s t a c k b e l oc a t e d i n s ys t em s p a c e . No pag e f a u l t s a r e a l l o we d . Th e pag e f a u l t h a nd l e r g e ne r a t e s a f a t a l b ug c h e c k i f a pag e f a u l t o c c u r s a nd t h e I P L i s a b o v e I PL 2 . No e x c ep t i o n s a r e a l l o we d . E x c e p t i o n s , l i k e pag e f a u l t s , a r e a s s o c i a t ed wi th a process . Th e e x c e p t i o n d i spa t c h e r g e ne r a t e s a f a t a l b ug c h e c k i f a n e x c ep t i o n o c c u r s a bove I PL 2 o r wh i l e t h e p r o c e s so r i s e x e c u t i ng on t h e i n t e r r up t s t a c k . A S Ts , a s yn c h r o no u s ev e n t s t h a t a l l o w n o t i f i c a t i o n wh e n e x t e r n a l ev e n t s ( Th e A S T d e l i v e r y i n te r r up t a l l owed . d r o ps b e l o w I PL 2 , an i nd i c a t i o n l e a v i ng i n t e r r up t s t a t e . ) a process to . r e c e i v e h av e o c c u r r e d , a r e no t i s d e l i v e r ed wh en I PL tha t the proc esso r i s No s ys tem s e r v i c e s a r e a l l o we d i n s ys t em s t a te . ( In fact , s ys t em s e r v i c e s c a nn o t e v e n b e c a l l ed f r om p r o c e s s c o n t e x t a t I PL 2 . Sys t em s e r v i c e s c a n o n l y b e c a l l e d a t I P L 0 . ) 1 . 3 . 3 . 2 P r o c e s s - B a s ed Ro u t i n e s - P r o c e d u r e - b a s e d c o d e ( th e s e rv i c e s ) and except ion s e rv i c e rout ines us ua l l y e x e c u t e c ontex t of the c u r r e n t p r o c e s s ( on the kernel s t ac k wh e n in mode ) . sys tem in the k e r ne l 1.3. 3.2. 1 S y s tem S e r v i c e s - Th e s ys t em s e rv i c e s a re i m pl em e n t ed as p r o c ed u r e s . Th i s m a k e s t h em ava i l a b l e to a l l n a t i v e m o d e l a ng ua g e s . I n a d d i t i o n , t h e f a c t t h a t t h e y a r e p r o c ed u r e s m e a n s t h a t t h e r e is a call f r ame on the stac k . Th u s , e r r o r s d e te c t ed by a ut i l i t y s ub r o u t i n e u s e d by a s ys t em s e rv i c e c a n return an error s i mpl y by p u t t i ng the e r r o r s t a t u s i n to R O a n d i s s u i ng a RET i n s t r uc t i o n . Al l s u pe r f l uo us i n fo rm a t i o n i s c l e a n ed off the s t ac k b y the RET i n s t r uc t i o n . Th e s ys t e m s e r v i c e d i s pa t c h e r s , a c t ua l l y t h e d i spa tc h e r s f o r t h e C HMK a nd C HM E e x c ep t i o n s , a r e e x c e p t i o n s e r v i c e r o u t i n e s . Sys t em s e rv i c e s m u s t b e c a l l ed f r om p r o c e s s c o n tex t . Th e y a r e no t ava i l able f r om i n t e r r up t serv i c e r o u t i n e s o r o th e r c o d e ( s uc h a s 1-1 4 SYSTEM OVERVI EW po r t i o n s o f t h e i n i t i a l i za t i o n s e q u e n c e ) th a t e x e c u t e s o u t s i d e t h e c o n t ex t o f a process . One r e a so n fo r th i s i s tha t the v a r i o us s e rv i c e s a s s um e t h a t t h e r e is a p r o c e s s who s e p r i v i l eg e s c a n b e c h e c k ed a nd who s e quo t a s c a n b e c h a r g ed as pa r t o f t h e n o rma l o p e r a t i o n o f t h e s e rv i c e . Some s ys t em s e rv i c e s r e f e r e n c e l o c a t i o n s i n P l s pa c e , a po r t i o n o f a d d r e s s s pa c e o n l y ava i l ap l e wh i l e e x e c u t i ng i n process contex t . Sys tem s e rv i c e s a l s o m a k e a s s um p t i o n s a b o u t I P L a nd t h a t wo u l d b e v i o l a ted i f t h e y we r e c a l l ed f r om o th e r s yn ch r o n i z a t i o n t h a n p r o c e s s- b a sed cod e e x e c u t i ng a t I P L 0 . 1. 3. 3 . 2. 2 Pa g e Fa u l t Hand l e r - Th e pag e r i s a n except ion s e rv i c e r o u t i n e t h a t i s i nv o k e d i n r e s po n s e t o a t r a n s l a t i o n - n o t - v a l i d f a ul t . Th e pag e r thus s a t i s f i e s pag e f a u l t s i n t h e c o n t e x t of the process that i n c u r r ed the f a ul t . Be c a u s e pag e f a u l t s a r e a s so c i a t ed w i t h a process , the s ys t em c anno t to l e r a t e page f a ul t s that occ ur in i n te r r upt s e rv i c e r o u t i n e s o r o t h e r r o u t i n e s t h a t e x e c u t e o u t s i d e t h e context o f a process . Th e a c t u a l r e s t r i c t i o n i mp o s ed b y t h e pag e r is even mo re s t r i ng e n t . Pag e f a ul t s a r e n o t a l l o we d a bo v e I P L 2 . Th i s r e s t r i c t i o n a pp l i e s t o p r o c e s s - b a s e d co d e e x e c u t i ng a t e l e v a t ed I P L a s we l l a s t o i n t e r r up t s e r v i c e c o d e . 1.3.3.3 I n te r r up t S e r v i c e Ro u t i n e s - By t he i r a s yn ch r o n o us n a t u r e , i n t e r r up t s e x e c u t e w i tho u t the s uppo r t o f p r o c e s s c o n t e x t ( o n the s ys tem-w i d e i n t e r r up t s t a c k ) • • I /0 r e qu e s t s a r e i n i t i a t ed th r o ug h the $ Q I O s ys t em s e rv i c e , wh i c h c a n be i s s ued d i r e c t l y by t h e use r o r b y some i n t e rm e d i a r y s uc h as RM S on th e u s e r ' s b e h a l f . On c e an I /0 r e qu e s t h a s b e e n pl a c e d i n a d ev i c e que ue , i t r em a i n s t h e r e un t i l t h e d r i v e r is t r i g g e r ed , u s ua l l y b y a n i n t e r r up t g e n e r a t ed i n t h e e x t e r n a l d ev i c e . Two c l a s s e s o f s o f twa r e i n t e r r up t s e r v i c e r o ut i ne s ex i s t solely to s uppo r t the I /0 s ub s ys t em . Th e fo r k l ev e l i n t e r r up t s a l l o w d ev i c e d r i v e r s t o l o we r I P L i n a c o n t r o l l ed f a sh i o n . F i n a l p r o c e s s i ng o f I /0 r e que s t s i s a l so d o n e i n a s o f t wa r e i n t e r r up t s e r v i c e r o u t i n e . • • Th e t i m e r f unc t i o n s i n VM S i nc l ud e s uppo r t i n bo th the a s o f t wa r e h a r dwa r e c l o c k i n te r r up t s e rv i c e r o ut ine a nd i nd i v i d u a l i n t e r r up t s e r v i c e r o u t i n e th a t a c t ua l l y s e r v i c e s t ime r reque s t s . An o t h e r s o f twa r e i n t e r r up t pe r f o rm s the r e s c h e d u l i ng f un c t i o n , wh e r e o n e process i s r emoved f r om e x e c u t i o n a nd a n o t he r s e l e c t ed a nd p l a c ed i n to e x e c u t i o n . 1.3.3.4 Spec i a l P r o c e s s e s - Swa ppe r a nd N u l l - Th e s wa ppe r and the nul l process a r e d i f f e r e n t f r om a ny o th e r p r o c e s s e s t h a t e x i s t i n a VAX/VM S s ys tem . Th e d i f f e r e n c e s l i e n o t i n t h e i r o pe r a t i o n s , wh i c h a r e c ompl e t e l y no rm a l , b u t i n the i r l i m i t ed c o n t e x t . 1-1 5 S Y S TEM OVERVI EW The l i m i t e d c o n tex t o f e i th e r o f t h e s e p r o c e s s e s i s d u e , i n p a r t , to the fact that t h e s e t wo p r o c e s s e s e x i s t a s pa r t o f t h e s y s t em i m ag e SYS . EXE . Th e y d o n o t h a v e to be c r e a t ed wi th the C r e a te Process s ys tem s e rv i c e . Spe c i f i c a l l y , th e i r PC Bs a nd p r o c e s s h e a d e r s a r e a s s e m b l e d ( i n m o d u l e PDA T ) a n d l i n k e d i n to t h e sys tem imag e . Oth e r c h a r a c t e r i s t i c s o f t h e s e two p r o c e s s e s a r e l i s t ed h e r e . • Th e i r pr o c e s s h e a d e r s a r e s t a t i c . Th e r e i s n o wo r k i ng set l i s t a nd n o p r o c e s s s e c t i o n t a b l e . Th i s i mpl i e s t h a t n e i th e r p r o c e s s s uppo r t s pag e f a u l t s . Al l c o d e e x e c u t ed b y e i th e r p r o c e s s m u s t b e l o c k e d i n to m em o r y i n some wa y . I n fac t , the c o d e o f b o th o f t h e s e pr ocesses is pa r t of t h e n o n pag ed execut ive . • Bo t h p r o c e s s e s e l im i nates the modes . • N e i th e r p r o c e s s h a s a P l s p a c e . Th e k e r n e l s t ac k f o r p r o c e s s i s l o c a t ed i n s ys tem s p a c e . • Th e n u l l p r o c e s s d o e s n o t h a v e a P O s pa c e e i th e r . Th e s wa ppe r u s e s a n a r r a y a l l o c a t e d f r om no npag ed po o l a s i t s P O p a g e t a b l e f o r a s p e c i a l po r t i o n o f process c r ea t i o n , the p a r t t h a t t a k e s p l a c e i n t h e c o n t e x t o f t h e swa ppe r p r o c e s s . execute ent i r e l y i n ke rnel mo d e . Th i s need fo r s t a c k s f o r the o th e r th r e e a c c e s s e i th e r De s p i t e t h e i r l i m i t ed c o n t ex t s , b o th o f t h e s e p r o c e s s e s b e h a v e in a n o rma l f a sh i o n i n e v e r y o th e r wa y . Th e s wa ppe r a nd t h e n u l l p r o c e s s a r e s e l e c t ed f o r e x e c u t i o n b y t h e sched ul e r j us t l i ke a n y o th e r process in the s y s t em . Th e s wa ppe r s p e nd s i ts i d l e t ime i n the h i b e r n a t e s t a t e un t i l s o m e c o m po n e n t i n the s ys tem r e c og n i z e s a n e ed fo r o n e o f t h e swa ppe r f un c t i o n s , a t wh i c h t i m e i t i s a wa k e n ed . Th e n u l l p r o c e s s i s a l wa ys c om p u t a b l e , b u t s e t to the l o we s t p r i o r i t y in the s y s t em ( pr i o r i ty 0 ) . A l l C P U t i m e no t used by a n y o t h e r p r o c e s s i n t h e s ys t em w i l l b e u s ed by t h e n u l l p r o c e s s . 1.3.3.5 S p e c i a l S ub r o u t i ne s - Th e r e a r e s e v e r a l u t i l i ty s ub r o u t i n e s w i t h i n VM S r e l a ted to s c h ed u l i ng a n d r e so u r c e a l l o c a t i o n tha t a r e c a l l ed f r om bo th p r o c e s s - b a s e d c o d e s uc h a s s ys t em s e rv i c e s a nd f r om s o f t wa r e i n t e r r up t s e rv i c e rout ines . Th e s e s ub r o u t i n e s are c o n s t r a i n ed t o e x e c u t e w i th t h e l i m i t ed c o n t e x t o f i n t e r r upt o r s ys t em s t a te . 1 . 3.4 Memo r y Ma n a g e m e n t a nd Ac c e s s Mod e s Th e a d d r e s s t r a n s l a t i o n m e c h a n i sm i s d e sc r i b ed in t h e VAX H a r d wa r e Two s i d e e f f e c t s o f t h i s o pe r a t i o n a r e o f s pe c i a l i n t e r e s t Ha n d boo k . t o VM S . Wh e n a pag e i s no t v a l i d , a t r a ns l a t i o n-no t-va l i d e x c e pt i o n i s g en e r a ted tha t t r a n s f e r s c o n t r o l to a n e x c ep t i o n s e r v i c e r o u t i n e t h a t c a n t a k e wh a te v e r s t e ps a r e r e q u i r e d to m a ke the pag e v a l i d . Th i s e x c e p t i o n t r a n s f e r s c o n t r o l f r om a h a r d wa r e m e c h a n i sm , a d d r e s s t r a n s l a t i o n , t o a s o f twa r e e x c ep t i o n s e r v i c e r o u t i n e , t h e pag e faul t h a nd l e r , a nd a l l o ws VM S to g a in control on add r ess t r ansl a t ion f a i l u r e s i n o rd e r t o impl em e n t i t s d yn am i c m a pp i ng o f oag e s wh i l e a p r og r am i s e x e c u t i ng . 1-1 6 SYS TEM OVERVI EW Be f o r e t h e ad d r e s s t r a n s l a t i o n m e c h a n i sm chec k s the val id bi t , a protec t i o n chec k i s mad e to d e t e rm i n e wh e th e r t h e r eque s t ed a c c e s s wi l l be g r anted . Th e c h e c k u s e s t h e c u r r e n t a c c e s s m o d e in the PS L ( PS L < 2 5 : 2 4 > ) , a p r o t ec t i o n c o d e th a t i s d e f i ned fo r e a c h v i r t ua l pag e , and t h e t ype o f a c c e s s ( r e a d , m o d i f y , o r wr i te ) to m a k e i t s d e c i s i o n . Th i s p r o t e c t i o n check a l l o ws VM S t o m a k e r e a d - o n l y po r t i o n s o f t h e e x e c u t i v e i n a c c e s s i b l e to anyo n e (all access mod es ) fo r wr i t i ng , p r ev e n t i ng c o r r up t i o n o f o pe r a t i ng s ys tem code . In add i t ion , p r i v i l eg e d d a t a s t r uc t u r e s c a n b e p r o t e c t ed f r om e v e n r e ad access by no npr i v i l eg e d u s e r s , p r e s e r v i ng o p e r a t i ng s ys t em s e c u r i t y . E x c e p t i o n s , I n te r r up t s , a nd RE I 1.3. 5 Be f o r e m e n t i o n i ng o t he r features o f the e x c e p t i o n a nd i n t e r r up t m e c h a n i sm s used b y VM S , i t wo ul d b e h e l p f u l t o c ompa r e a nd c o n t r a s t t h e s e two m e c h a n i sm s . 1.3.5.1 C ompa r i s o n o f E x c e p t i o n s a nd I n t e r r up t s - Th e fo l l o w i ng l ist s umma r i z e s some o f t h e c h a r a c t e r i s t i c s o f e x c e p t i o n s a nd i n te r r up t s . • I n t e r r up t s o c c u r a s yn ch r o n o u s l y to t h e c u r r e n t l y e x e c u t i ng i n s t r uc t i o n s t r e am . Th e y a r e a c t ua l l y s e r v i c ed b e twe e n i nd i v i d u a l i n s t r uc t i o n s o r a t we l l d e f i n e d po i n t s w i t h i n the exec ut i on of a g i v en i n s t r uc t i o n . E x c ept i o n s occur s yn c h r o n o u s l y a s a d i r e c t e f f ec t o f the execut ion of the c u r r e n t i n s t r uc t i o n . • Bo th m e c h a n i sm s pa s s control t o serv i c e rout ines wh o s e ad d r e s s e s are s to r ed i n t h e sys tem c o n t r o l b l o c k . Th e s e r o u t i n e s pe r fo rm e x c e pt i o n- s p e c i f i c or i n t e r r up t - s p e c i f i c p r o c e s s i ng . • Ex c e p t i o n s a r e g e ne r a l l y a pa r t o f t h e c u r r e n t l y e x e c u t i ng process . Th e i r s e r v i c i ng i s a n ex t e n s i o n o f t h e i n s t r uc t i o n s t r e am t h a t i s c u r r e n t l y e x e c u t i ng o n b e h a l f o f t h a t p r o c e s s . I n t e r r up t s a r e s ys tem-w i d e e v e n t s tha t c a n n o t r e l y o n s uppo r t o f a p r o c e s s i n the i r s e rv i c e r o u t i nes . • A c o n s e q uenc e o f th i s l ast i t em is that the s y s t em-w i d e i n te r r up t s t a c k i s u s u a l l y u s e d t o s to r e t h e PC a nd PS L t h a t r e pr e s e n t t h e ma c h i ne s t a t e t h a t wa s i n te r r upted . Except i on s are us ua l l y s e rv i c ed o n t h e pe r - p r o c e s s k e r n e l s t a c k . Wh i c h s t a c k to u s e i s a c t ua l l y d e t e r m i ned by c o n t r o l b i ts in the s y s t em c o n t r o l b l o c k e n t r i e s f o r e a ch e x c ep t i o n o r i n t e r r upt . • I n t e r r u p t s c a u s e a PC / P S L p a i r to be p u s h e d o n to the s t ac k . Ex c e p t i o n s o f t e n c a u s e e x c e p t i o n - s p e c i f i c pa r am e t e r s to b e s t o r e d a l o ng w i th a PC/ P S L p a i r . • I n t e r r up t s c a u s e t h e I P L t o c h a ng e . E x c ep t i ons u s ua l l y d o ( Ma c h i n e c h e c k s no t h a v e a n I P L c h ange a s s o c i a t ed w i th t h em . a nd k e r n e l - s t a c k-no t-va l i d e x c e p t i o n s e l ev a t e I P L t o 3 1 . ) • A c o r o l l a r y o f th i s p r ev i o u s s t e p i s t h a t i n t e r r up t s can be b l oc ked b y e l ev a t i ng I PL t o a va l ue a t o r above t h e I PL a s s o c i a t ed wi t h the i n t e r r up t tha t is to be b l o c k ed . Except i on s , on t h e o th e r h a nd , c a nno t b e b l o c ked . Howev e r , some e x c e p t i o ns c a n be d i s a b l ed ( by c l e a r i ng a s s o c i a t ed b i ts i n t h e PSW) . 1-17 S Y STEM OVERVI EW • Wh e n an i n t e r r up t o r e x c e p t i o n o c c u r s , a n e w PS L is f o rmed tha t s umma r i z e s the n ew I PL , the c u r r e n t a c c e s s m o d e ( a l mo s t a l wa y s k e r n e l ) , wh e th e r t h e i n t e r r up t s t a c k i s i n u s e , a nd s o on . On e d i f f e r en c e b e t we e n e x c e p t i o n s a nd i n t e i r up t s , a d i f f e r e n c e t h a t r e f l ec t s t h e f a c t tha t i n t e r r up t s are not r e l a ted to the i n t e r r up t ed i n s t r uc t i o n s t r e am , i s t h a t t h e p r ev i o us a c c e s s m o d e f i e l d i n t h e n e w PS L i s set to ke rnel fo r i n t e r r up t s wh i l e t h e pr ev i o u s m o d e f i e l d f o r e x c e p t i o n s r e f l e c t s t h e a c c e s s m o d e i n wh i c h t h e e x c e p t i o n o c c u r r e d . 1 . 3 . 5 . 2 O th e r Us e s o f E x c e p t i o n s a nd I n te r r up t s - I n a d d i t i o n t o the t r a n s l a t i o n - n o t-va l i d f a ul t used by mem o r y m a n a g em e n t s o f twa r e , VM S a l so uses t h e c h a ng e -mo d e- t o - k e r n e l a nd c h a ng e -mo d e- t o - e x e c u t i v e e x c ep t i o n s a s e n t r y p a t h s to the ex e c u t i v e . Sy s tem s e r v i c e s t h a t m u s t e x e c u t e i n a m o r e p r i v i l eg e d a c c e s s m o d e u s e e i th e r t h e C HM K o r C HM E i n s t r uc t i o n to g a i n access r ights ( Fi g ure 1-4 ) . VM S h a nd l e s m o s t o th e r e x c ep t i o n s b y p a s s i ng t h em t h r o ug h a c ommo n e x c e p t i o n d i spa t c h e r d e s c r i b ed i n Ch a p t e r 2 . Ha r dwa r e i n t e r r up t s t em po r a r i l y s u s pe nd code tha t is e x e c u t i ng in o rd e r th a t a n i n t e r r up t - s pe c i f i c r o u t i n e c a n s e r v i c e t h e i n t e r r up t . I n t e r r up t s h a v e a n I P L a s s o c i a t ed w i t h t h em . Th e i n te r n a l p r o c e s so r p r i o r i ty l ev e l ( I PL ) i s r a i s ed wh e n the i n t e r r upt i s r ec og n i zed . High l ev e l i n t e r r up t s e r v i c e r o u t i n e s t h us pr ev e n t t h e r e c og n i t i o n o f l o we r l ev e l i n te r r up t s . Lo we r l ev e l i n t e r r up t s e rv i c e r o u t i nes c a n b e i n te r r up t ed b y s ub s e q ue n t h i g h e r l ev e l i n t e r r up t s . Ke r n e l mo d e r o ut i nes c a n a l so b l o c k i n te r r up t s a t c e r t a i n l ev e l s b y ma n ua l l y r a i s i ng t h e I P L . Th e VAX a r c h i t e c t u r e a l s o d e f i n e s a ser ies of s o f twa r e i n t e r r up t l ev e l s t h a t c a n b e u s e d fo r a v a r i e t y o f p u r po s e s . VM S u s e s t h em fo r s c h ed ul i ng , I /0 c ompl e t i o n r o u t i n e s , a nd f o r s yn c h r o n i z i ng access to c e r t a i n c l a s s e s o f d a t a s t r uc t u r e s . 1 . 3 . 5 . 3 Th e RE I I n s t r uc t i o n - Th e RE I i n s t r uc t i o n i s t h e c ommo n e x i t pa t h fo r i n t e r r up t s a nd e x c e pt i o n s . Ma ny p r o t e c t i o n a nd pr i v i l eg e c h e c k s a r e i n c o r po r a t e d i n to t h i s i n s t r uc t i o n . Be c a u se m o s t f i e l d s i n the proc esso r status l o ng wo r d a r e no t a c c e s s i b l e t o t h e p r og r amm e r , t h e RE I i n s t r uc t i o n p r o v i d e s t h e o n l y m e a n s f o r c h a ng i ng access mode to a l e s s p r i v i l eg e d m o d e ( F i g u r e 1 - 4 ) . I t i s a l s o t h e o n l y wa y t o r e a c h c om pa t i b i l i t y m o d e . Al tho ug h the I P L f i e l d o f t h e PS L i s a c c e s s i b l e t h r o ug h the PR$ I P L processo r r eg i s t e r , e x e c u t i o n o f a n RE I i s a c ommo n wa y t h a t I PL i s l o we r ed d u r i ng no rma l e x e c u t i o n . Bec ause a ch ange i n I PL can al ter t h e d e l i v e r ab i l i ty o f p e nd i ng i n te r r up t s , m a ny h a rd wa r e a nd e s pec i a l l y s o f twa r e i n t e r r up t s a r e d e l i v e r ed a f te r an RE I i n s t r uc t i o n is e x e c u t ed . 1.3. 6 P r o c e s s S t r uc t u r e Th e VAX a r c h i t e c t u r e a l s o d e f i n e s a d a t a s t r uc t u r e c a l l ed a h a r d wa r e process c o n t r o l b l o c k t h a t c o n t a i n s c o p i e s o f a l l a p r o c e s s ' s g e ne r a l r eg i s t e r s wh e n the p r o c e s s i s n o t a c t i v e . Wh e n a p r o c e s s i s s e l ec t e d fo r execut ion , t h e c o n t e n t s o f t h i s b l o c k a r e c o p i ed i n to t h e a c t ua l 1-18 SYSTEM OVERV I EW r eg i s t e r s i n s i d e the p r o c e s s o r w i t h a s i ng l e i n s t r uc t i o n , LDPCTX . Th e c o r r e s po nd i ng i n s t r uc t i o n that s a v e s t h e c o n t e n t s o f t h e g e ne r a l r eg i s t e r s wh en t h e p r o c e s s i s r emoved f r om e x ec u t i o n i s SVPC TX . 1.4 O THER SYS TEM C ON C E PTS i mpo r ta n t c o nc e p t s in We b eg a n t h i s c h a p t e r by d i s c u s s i ng the m o s t VM S , p r o c e s s a nd i m ag e . Th e r e a r e s ev e r a l o th e r f un d am e n t a l i d e a s tha t sho u l d be a t l e a s t m e n t i o n ed b e fo r e w e b eg i n a d e t a i l ed d e s c r i pt i o n o f VM S i n ternal s . Some o f t h e s e ideas are br iefly d e s c r i b ed h e r e . 1.4.1 Re s o u r c e C o n t r o l VAX/VM S p r o t e c t s i tsel f a nd o th e r p r ocesses in the s ys t em f r om c a rel e ss o r m a l i c i o us u s e r s w i th h a r d wa r e a nd s o f twa r e p r o t e c t i o n m e c h a n i sm s , s o f twa r e p r i v i l eg e s , a nd s o f twa r e q uo t a s a nd l i m i t s . 1.4.1.1 Ha r d wa r e P r o t e c t i o n - Th e m emo ry m a n a g em e n t p r o t ec t i on m e c h a n i sm that is r e l a t ed to access mode is used to pr ev e n t un a u t h o r i z e d u s e r s f r om m o d i fy i ng ( o r e v e n r e a d i ng ) p r i v i l eg ed d a t a s t r uc t u r e s . Ac c e s s m o d e p r o t e c t i o n i s a l s o u s ed to k e e p p r og r am c o d e a nd r e a d - o n l y d a t a s t r uc t ur e s , w i th i n e i th e r t h e e x e c u t i v e o r a use r p r og r am , f r om b e i ng mod i f i e d by p r og r amm i ng e r r o r s . A m o r e s ub t l e b u t pe r h a p s mo r e i m po r t a n t a spec t o f p r o t ec t i o n p r o v i d ed by t h e memo r y m a n ag em e n t a r c h i t e c t u r e i s t h a t t h e p r o c e s s ad d r e s s s pa c e o f o n e p r o c e s s ( P O s pa c e a n d P l s pa c e ) i s n o t a c c e s s i b l e to c o d e r un n i ng i n t h e c o n t ex t o f a n o the r p r o c e s s . Wh e n s uc h a c c e s s i b i l i t y i s d e s i r ed to s h a r e c ommo n r o u t i n e s o r d a t a , VM S p r o v i d e s a c o n t r o l l ed a c c e s s th r o ug h g l o b a l s e c t i o n s . An o th e r d i m e n s i o n to a c c e s s i b i l i t y i s t h a t s ys t em v i r t ua l add ress s pa c e is ava i l ab l e to all processes ( a l tho ug h pag e - by-page pr o t ec t i o n m a y d e ny r e ad o r w r i t e a c c e s s t o s p e c i f i c s ys t em v i r t ua l pag e s fo r c e r t a i n a c c e s s m o d e s ) . 1 . 4 . 1 . 2 P r o c e s s P r i v i l e g e s - Ma n y o pe r a t i o n s t h a t are pe r fo rmed by s ys tem s e rv i c e s c o u l d d e s t r o y o pe r a t i ng s ys tem c o d e o r d a t a o r c o r r u pt e x i s t i ng f i l e s i f pe r f o rmed carelessly . Oth e r s e rv i c e s a l l ow a p r o c e s s to a d v e r s e l y a f f e c t f e a t u r e s i n o th e r p r o c e s s e s i n the s ys tem . VM S r e q u i r e s t h a t proc esses w i sh i ng to execute these po t e n t i a l l y d am a g i ng o pe r a t i o n s b e s u i t a b l y p r i v i l eg e d . Pr o c e s s p r i v i l eg e s a r e a s s i g ned wh e n a p r o c e s s i s c r e a t ed , e i th e r b y t h e c r e a to r , o r th r o ug h t h e us e r ' s r e c o rd i n t h e a u t ho r i z a t i o n f i l e . Th e s e p r i v i l eg e s a r e d e s c r i b ed i n t h e VAX/VM S Sy s t em Ma n ag e r ' s G u i d e in the VAX/VM S Sys t em S e r v i c e s Re f e r e n c e Ma n ua l . a nd Th e p r i v i l eg e s t h em s e l v e s a r e spe c i f i c b i t s i n a q u a d wo r d tha t is s to r ed in the ( Th e l o c a t i o n s a nd m a n i pu l a t i o n s o f b eg i nn i ng o f the p r o c e s s head e r . t h e s ev e r a l p r o c e s s p r i v i l eg e m a s ks t h a t VM S ma i n t a i n s a r e d i sc u s s ed in Ch a pt e r 1 8 . ) Wh e n a VM S s e rv i c e t h a t r eq u i r e s p r i v i l eg e i s c a l l ed , t h e s e r v i c e c h e c k s to s e e wh e th e r t h e a s so c i a t ed b i t in the process p r i v i l eg e ma s k i s s e t . 1-19 SYSTEM OVERVI EW 1.4.1.3 Quo t a s a nd L i m i t s - VM S a l so contro l s a l locat ion of i ts s ys t em w i d e r esources s uc h a s n o n pag ed d yn am i c memo r y a nd pag e f i l e s pa c e th r o ug h the use o f q uo t a s a nd l i m i t s . Th e s e p r o c e s s a ttr i butes are a l so a s s i g ned wh e n t h e p r o c e s s i s c r e a t ed . B y r e s t r i c t i ng s uc h i t ems a s t h e n umb e r o f c o nc u r r e n t I /0 r e que s t s o r p e n d i ng ASTs , VM S exerc i se s c o n t ro l ove r t h e r e s o u r c e d r a i n th a t a s i ng l e p r o c e s s c a n ex e r t on s y s t em r e so u r c e s s uc h a s n o npag e d d yn am i c m em o r y . In g e ne r a l , a p r o c e s s c a nno t p e r f o rm c e r t a i n o pe r a t i o ns ( s uc h a s q u e u e a n AS T ) un l e s s i t h a s s u f f i c i e n t q uo t a ( no n z e r o PC B $W A S TCNT in th i s c a se ) . Th e l o c a t i o ns a nd v a l ue s o f t h e v a r i o u s q uo t as a nd l i m i t s u s e d by VM S a r e d e sc r i b ed i n Ch a pt e r 1 7 . 1.4.1.4 U s e r I d e n t i f i c a t i o n C o d e ( U I C ) - VM S u s e s u s e r i d e n t i f i c a t i o n c o d e ( U I C ) f o r two d i f f e r e n t p r o t e c t i o n pur po s e s . I f a p r o c e s s w i sh e s t o pe r fo rm some c o n t r o l o p e r a t i o n ( S u s pe nd , Wa k e , De l e t e , a nd s o o n ) o n a n o t h e r p r o c e s s , i t r e q u i r e s WOR LD p r i v i l eg e i n o rd e r t o a f f e c t a n y p r o c e s s i n the s ys t em . A p r o c e s s w i t h G R O U P p r i v i l eg e c a n o n l y a f f e c t o the r p r o c e s s e s wi th t h e s a m e g r o up n um b e r . A p r o c e s s w i th n e i th e r WOR LD no r G R O U P p r i v i l eg e c a n o n l y a f f e c t s ub p r o c e s s e s t h a t it has c r e a t ed . ( Th i s m e a n s t h a t a p r o c e s s w i th n e i th e r G R O U P n o r WOR LD p r i v i l eg e c a nno t a f f e c t any o t h e r p r o c e s s i n the sys tem , even if it h a s t h e s a m e U I C , un l e s s t h e t a r g e t p r o c e s s wa s c r e a t e d by t h e p r o c e s s in ques t i o n . ) Th e U I C i s a l s o the p a r am e t e r th a t d e t e rm i n e s wh e th e r a u s e r c a n r ead f r om o r w r i te to a g i v e n f i l e . Th e o wn e r o f a f i l e c a n d e te rm i n e h o w m u c h a c c e s s to h i s f i l e s h e g r a n t s t o h i ms e l f , t o o th e r processes in t h e s am e g r o up , a nd to a r b i t r a r y p r o c e s s e s i n t h e s ys t e m . Th e s ame U I C p r o t e c t i o n th a t e x i s t s f o r f i l e s i s a l s o u s ed f o r o th e r d a t a s t r uc t u r e s i n th e s ys t em . Bo th l o g i c a l n am e s a nd g l o b a l s e c t i o n s e x i s t i n two v a r i e t i e s , g r o up n am e s a nd s e c t i o n s o r s ys t em n am e s a nd secti ons . Th e g r o up v a r i e t y i s o n l y a v a i l a b l e to o th e r p r o c e s s e s i n t h e s am e g r o u p . Commo n e v e n t f l ag s , f l ag s t h a t c a n b e s h a r ed am o ng s e v e r a l p r o c e s s e s , a r e r e s t r i c t e d to p r o c e s s e s i n t h e s am e g r o u p . 1.4.2 Oth e r Sys t em P r i m i t i ve s S e v e r a l o t h e r s i mpl e t o o l s u s e d b y VM S a r e m e n t i o n e d f r e e l y t h r o ug h o u t t h i s m a n ua l b u t a r e n o t d e sc r i b e d un t i l th e f i n a l s e c t i o n , i n Ch a pt e r s 2 4 t h r o ug h 2 6 . 1 . 4 . 2 . 1 Synch r on i za t i o n - Any m u l t i p r og r amm i ng s ys t em must ta k e me a su r e s to p r ev e n t s imul taneous a c c e s s to s ys tem d a t a s t r uc t u r e s . VM S u s e s two s i mpl e s yn c h r o n i z a t i o n t e c h n i q ue s . By e l ev a t i ng I PL , a s ub s e t o f i n t e r r up t s c a n b e b l o c k e d , a l l o w i ng un r e s t r i c t e d a c c e s s t o s ys t em w i d e d a t a s t r uc t u r e s . Th e m o s t c ommo n s yn ch r o n i z a t i o n I PL u s ed by VM S i s I PL 7 , c a l l ed I P L $ _S YNC H . Fo r some d a t a s t r uc t u r e s , e l ev a t e d I PL i s e i th e r an unne c e s s a ry t o o l or a po t en t i a l s ys t e m d eg r ad a t i o n . Fo r e x ampl e , p r o c e s s e s e x e c u t i ng a b ov e I P L 3 c a nn o t b e r e s c h ed u l ed ( r em o v e d f r om execution ) . Onc e a p r o c e s s g a i ns c o n t r o l o f a d a t a s t r uc t u r e p r o t e c ted by e l ev a t e d I P L , i t g i v e s u p i ts i t w i l l n o t a l l o w a n o th e r p r oc e s s t o e x e c u t e u n t i l o wn e r sh i p . I n ad d i t i o n , pag e f a u l t s a r e no t a l l o we d a bo v e I PL 2 a nd 1-2 0 S Y S TEM OVERV I EW s o a n y d a t a s t r uc t u r e tha t e x i s t s i n pag e a b l e a d d r e s s s pa c e c a nno t s yn c h r o n i z e d w i t h e l e v a t e d ! P L . be VM S r e qu i r e s a s e c o nd s yn c h r o n i z a t i o n to o l t o a l l o w s yn c h r o n i z e d access to pag e a b l e d a t a s t r uc t u r e s . Th i s too l m us t a l so a l l o w a p r o c e s s to b e r em o v e d f r om e x e c u t i o n wh i l e i t m a i n t a i n s o wn e r sh i p o f the s t r uc t u r e i n que st ion . Th e s yn c h r o n i z a t i o n to o l t h a t f u l f i l l s t h e s e r e q u i r em e n t s i s c a l l e d a m u t ua l exc l us i o n s em a pho r e ( M UTE X ) . Syn c h r o n i z a t i o n , i n c l ud i ng t h e u s e o f m u t e x e s , i s d i s c u s s e d i n Ch a p t e r 24 . 1 . 4 . 2 . 2 Dyn am i c Memo r y A l l o c a t i o n - Th e s ys t em m a i n ta i n s th r e e d yn am i c m em o ry a r e a s f r om wh i c h b l o c k s o f m em o ry c a n b e a l l o c a t e d a nd d ea l l o c a ted . No n pag e d po o l c o n t a i n s tho s e s ys t em -w i d e s t r uc t u r e s t h a t m i ght b e man ipul a ted by ( h a rdwa r e o r so f t wa r e ) i n t e r r up t s e rv i c e r o u t i n e s o r p r o c e s s - b a sed c o d e e x e c u t i ng a b ov e I PL 2 . Pag ed po o l c o n ta i n s s ys t em-w i d e s t r uc t u r e s tha t d o n o t h av e t o b e k e p t m em o r y r e s id ent . Th e pr o c e s s a l l o c a t i o n r eg i o n , a po r t i o n o f t h e p r o c e s s Pl s pa c e , i s used fo r pag e a b l e d a t a s t r uc t u r e s th a t wi l l n o t b e s h a r e d among s ev e r a l p r o c e s s e s . Dyn am i c memo r y a l l o c a t i o n a nd d e a l l o c a t i o n a r e d i s c u s s ed i n d e t a i l i n Ch a p t e r 2 5 . 1.4.2. 3 Log i c a l Names - Th e s ys t em uses l og i c a l n am e s fo r m a ny p u r po s e s , i n c l ud i ng a t r a nspa r e n t wa y of i m pl em e n t i ng a d ev i c e- i n d e pend e n t I /0 s ys t em . Th e use of l og i c al n am e s as a p r og r amm i ng to o l i s d i s c u s s e d i n t h e VAX/VM S Sy s t em Se r v i c e s Re f e r e n c e Ma n ua l . Th e i n t e r n a l ope r a t i o n s o f t h e l og i c a l n am e sys tem s e rv i c e s , a s we l l a s t h e i n t e r n a l o rg a n i z a t i o n o f t h e l o g i c a l name t a b l e s , a r e d e s c r i b ed i n Ch a pt e r 2 6 . 1.5 LAYOUT OF V I RTUAL ADDRES S S PAC E Th i s s e c t i o n shows t h e a pp r o x i m a t e c o n t e n t s pa r t s o f v i r t ua l ad d r e s s spac e . 1.5. 1 of the three d i fferent Sys t em V i r t ua l Ad d r e s s S p a c e Th e l a yo u t o f s ys t em v i r t u a l ad d r e s s s pa c e s ys t em v i r t ua l add ress s pa c e l a yo u t is p i c t u r ed in Figure 1-6 . De t a i l s s uc h a s No-Ac c e s s g ua r d pag e s a t e i th e r end o f t h e i n t e r r up t s t a c k a r e om i t t ed t o avo i d c l u t t e r i ng t h e d i ag r am . Ta b l e E - 2 i n Ap pend i x E l i s t s a mo r e c o m p l e t e l a yo u t o f s ys tem spac e , i n c l ud i ng t h e s e g ua r d p ag e s , sys tem pag e s a l l o c a t e d b y d i s k d r i v e r s , a n d o th e r d e t a i l s . Th i s f i g u r e wa s p r o d u c ed f r om two l i s t s p r ov i d ed b y t h e s ys t em d um p analyzer ( th e s ys t em pag e t a b l e a nd t h e c o n t e n t s o f a l l g l o b a l d a t a a r e a s i n s ys t em s p a c e ) a nd f r om t h e s ys t em m a p SYS $ S YS TE M : SY S . MA P . Th e r e l a t i o n s b e twe e n t h e v a r i a b l e s i z e p i e c e s o f s ys t em spa c e a n d t h e i r a s s o c i a t ed S YS B OOT pa r am e t e r s a r e g i v e n i n App e nd i x E . 1-21 SYSTEM OVERV I EW 80000000 S y s t e m Service Vectors Linked Driver Code and D a t a Structures Nonpaged E x ecutive D a t a Nonp a ge d E x ecutive C o d e P a g e a ble Ex ec utive Routines s t a t ic Portion ( SY S .E X E ) X D E LTA ( usually unmapped), INIT S y s t e m Virtual Pages M a p p e d to 1 / 0 Addresses D ynamically m apped a t in itia lization time RMS I m a ge (RMS.EXE) System Message File ( SY SMSG.EXE) � Pool of Unmapped System P a g e s �� Restart Parameter Block PFN D a t abase Paged Dynamic Memory Nonpaged Dynamic Memory Interrupt Stack System Control Block �� Balanc e Slots �� System Header System P a ge Table High address end of system virtual address space Fi gur e 1 - 6 1 . 5. 2 Global Page Table La yo u t of Sys t em V i r t ua l Ad d r e s s Spa c e Th e C o n t r o l Reg i o n (Pl Space ) F i g u r e 1 - 7 s h ows t h e l a yo u t o f P l s pa c e . Th i s f i g u r e wa s p r o d uc ed m a i n l y f r om i n fo rma t i o n c o n t a i n ed in m o d u l e S H E L L , wh i c h c o n t a i n s a p r o to type o f a P l pag e t a b l e that is used wh e n ev e r a process is c r e a t ed . An S DA l i s t i ng o f p r o c e s s pag e t a b l e s wa s u s e d to d e t e rm i n e t h e o r d e r a nd s i z e o f t h e po r t i o ns o f P l s p a c e n o t d e f i n ed i n S HE LL . 1-22 SYSTEM OVE RV I EW 40000000 Ima g e-Specific Porti o n of P 1 Space User S t ac k (Dele ted at Image E x i t \ by MMGSIMGRESET Image 1/0 Segment ) Per-Process Message Section (s) CLI S ymbo l Table Dyn amic Permane n t Portion of P 1 Space +---e ::CTLSGL..CTLBASVA ( ( CLI Image P1 W indow to Process Header Locates Initial low address end of P1 space for each process as It Is created Process 1 / 0 S e g ment Static Permanent Portion of P 1 Space Per Proc ess C o mmon Area Per Proc e s s Co mmon Area Compa tibility Mode Data Page (no longer used) Process Alloca tion Region Generic CLI Data P a ge s I mage Activ a tor Scratch P a g es Debu gger Co nt e x t Vec tors l o r Messages a n d User-Written System Services Image Header Buffer Kernel Stack E x ecutive Stack Superv i s or Stack P 1 Poi n t er P a g e Debugger Sy mbol Table (not mapped if debugge r not present ) Figure 1-7 7 F F FFFFF L a yo u t of P1 S p a c e 1-2 3 ) +---e : :MMGSG L - CTLBASVA Channel Control Block Ta ble ) Locates border between image -specific a nd process-permanent pieces of P 1 space SYSTEM OVERVI EW Some o f t h e p i ec e s o f Pl s p a c e a r e c r e a t ed d y n a m i c a l l y wh e n t h e p r o c e s s i s c r e a t ed . Th e s e i n c l ud e a P l m a p o f p r o c e s s h e ad e r pag e s , a c ommand l a ng uag e i n t e r p r e t e r i f o n e i s b e i ng u s ed , a nd a s ymb o l tab l e fo r that C L I . Th e two p i e c e s o f P l s pa c e a t the l o we s t v i r t ua l ad d r e s s e s ( th e u s e r s t a c k a nd t h e i m a g e I /0 s egme n t ) a r e c r e a ted d yn am i c a l l y e a c h t i me a n i m a g e e x e c u t e s a nd a r e d e l e te d a s pa r t o f i m a g e r un d o wn . Append i x E c o n ta i ns a d e sc r i p t i o n o f the s i ze s o f the d i ffe rent p i ec e s o f P l s pa c e . Ta b l e E - 4 i n App e nd i x E sh ows a c om p l e t e l a yo u t o f Pl s pa c e , i n c l ud i ng d e t a i l s s uc h a s m em o r y m a n a g em e n t pag e p r o t e c t i o n a nd t h e n a m e o f t h e s ys tem c ompo n e n t t h a t m a ps a g i v e n po r t i o n . 1. 5. 3 The Prog r am Reg i o n ( P O Spac e ) F i g u r e 1 - 8 s h ows a t yp i c a l l a yo u t o f P O s pa c e f o r b o th a n a t i ve mode ( p r o d uc e d by t h e VAX- 1 1 L i n k e r ) a n d a c ompa t i b i l i t y m o d e i m ag e imag e ( p r o d uc e d by t h e RSX- l l M t a s k b u i l d e r ) . Th i s f ig ure i s m uc h m o r e c o n c e p t ua l than t h e p r ev i o us two i l l us t r a t i o n s b e c a u s e P O s p a c e d o e s n o t c o n t a i n p i ec e s o f t h e e x e c u t i v e l i k e P l s p a c e a nd s ys t em s pa c e d o . Th e f i g u r e d o e s s h o w t h e d e f a u l t o rd e r o f P O s p a c e i n t h e a b s e n c e o f e x p l i c i t i n s t r uc t i o n s t o t h e l i n k e r . Th e o rd e r i n wh i ch v i r t u a l spa c e i s a l l o c a t ed i s a l s o s h o wn . By d e f a u l t , t h e f i r s t pag e o f P O s p a c e {0 to l FF ) i s no t ma pped { p r o t ec t i o n set to No Ac c e s s ) . Th i s e n a b l e s e a s y d e t e c t i o n o f t wo c ommo n p r og r amm i ng e r r o r s , u s i ng z e r o or a sma l l n um b e r a s t h e ad d r e s s o f a d a t a l oc a t i o n o r u s i ng s uc h a sma l l n um b e r a s t h e d e s t i n a t i o n o f a c o n t r o l t r an s f e r . ( A l i n k t i m e r e que s t o r a s ys tem s e rv i c e c a l l c a n a l te r the p r o t ec t i o n o f v i r t ua l pag e z e r o . No t e a l s o th a t pag e z e r o i s a c c e s s i b l e t o c ompa t i b i l i t y m o d e i m ag e s . ) (1) An y p r ev i o u s l y l i n k e d sh a r ed image that i s n o t po s i t i o n i nd epend e n t ( P I C ) i s p l a c ed a t i t s p r ev i o u s l y s pe c i f i ed b a s e add res s . (2) Pa r t s o f t h e u s e r i m a g e t h a t a r e b eg i n n i ng a t a d d r e s s 2 0 0 { h e x ) . (3) I f the r e i s a n y r o om be twe e n the t wo p i e c e s a l r e a d y p l a c ed i n P O s pa c e , th i s r o om i s f i l l ed f i r s t wi t h p r ev i o u s l y l i nk e d P I C code and d a ta (4) a nd t h en w i t h P I C c o d e a nd d a t a t h a t a r e u s e r i m ag e . (5) I f t h e Run- T i m e L i b r a r y ( P I C a nd s h a r ed ) i s r e q u i r e d and no t o ve r r i d d en ( w i t h a /NOSYS SHR q u a l i f i e r to the L I NK c omma nd ) , t h i s b e c ome s t h e l a s t p i e c e o f t h e i mag e . (6) I f t h e d e b ug g e r o r t h e t r a c e b a c k f a c i l i ty i s r eq u i r ed , these i m ag e s a r e a d d ed at exec u t i o n t ime { even i f /DEBUG wa s s e l e c t ed a t l i n k t i m e ) by pr o c ed u r e S Y S $ I MG S TA . Th i s m a pp i ng i s d e s c r i be d i n d e t a i l in Ch a pt e r 1 8 . 1-24 not PIC are ad d ed pa r t nex t , of the Native Mode Image . 0 No Access Page ® G) This part of PO space Is defined by the ... linker and mapped by the Image activator 0 0 NON-PIC Image PIC Shared and PIC Image (As much as- fits) NON-PIC shared code and data (Previously linked) The AME is mapped b y the image activator when i t detects tha t it is a ctiv ating a compatibility mode ima g e RTL Vectors G) This part of PO space Is not defined at link time If either of these pieces Is required, It It mapped � This portion of PO space is defined by the R S X-1 1 task builder and mapped by the AME Compa tibility Mode Image 0 Compatibility Mode Image End of Compatibility Mode Image . not mapped The rest of PIC Shared and PIC Image (If any) - - - - - - - - - - � I N U1 . Run Time Library VMSRTL.EXE ( If needed a nd n o t e x cluded) Debugger ( LIB$DEBUG ) RSX- 1 1 M AME ( RSX.EXE) (BACKTRANS.EX E ) . Nativ e M o d e Image �� (If requested at link, run, or execution time) ... Tra c eback (LIB$TRACE ) . �� (If not overridden at link time and needed) not mapped POLR Pages �� 3FFFFFFF Figure 1-8 1 7 7 7 7 7 8 = FFFF 16 . PO Spa c e A l l o c a t i o n not mapped POLR Pages �� 3FFFFFFF PART I I C ONTROL MECHAN I SMS " Wo u l d yo u t e l l me , p l e a s e , wh i c h wa y I o ug h t t o g o f r om h e r e ? " " Th a t d e pend s a g o o d d e a l on wh e r e to g e t to , " s a i d t h e Ca t . yo u wa n t Al i c e ' s Ad v e n t u r e s i n Wo nd e r l a nd Lewi s Ca r r o l l C HAPTER 2 C OND I T I ON HANDLI NG One o f t h e d e s i g n g o a l s o f t h e VAX a r c h i te c t u r e wa s a g e ne r a l i z e d u n i fo rm c o nd i t i o n h a nd l i ng f a c i l i ty f o r b o th h a r d wa r e d e t e c t e d e x c e p t i o n s a nd s o f twa r e g e n e r a t ed c o nd i t i o n s . I n add i t ion t o m a k i ng t h i s f a c i l i t y a v a i l ab l e to u s e r s , VAX/VM S u s e s m a ny o f t h e f e a t u r e s o f t h e c o nd i t i o n h a nd l i ng f a c i l i ty f o r i t s o wn p u r po s e s . 2. 1 OVERVI EW OF THE C OND I T I ON HANDL ING FAC I L ITY Th e g e ne r a l i z e d c o nd i t i o n h a nd l i ng f a c i l i ty t h a t i s i n c l ud ed as pa r t of t h e VAX a r c h i t e c t u r e p r ov i d e s u s e r s a nd the s ys t em w i t h a po we r f u l t o o l i n h a nd l i ng except ional c o nd i t i o n s that a r i se d u r i ng no rma l p r og r am e x ec u t i o n . I n add i t io n , s o f twa r e d e t e c t ed c o nd i t i o n s ( no t n e c e s s a r i l y i nd i c a t i ng a n e r r o r ) c a n b e pa s s ed t o VM S t o a l l o w t h em to be h a nd l ed in e x a c t l y t h e s am e m a n ne r as h a r d wa r e d e te c t e d e x c e p t i o n s . Th e o p t i o n s t h a t a r e a v a i l a b l e t o u s e r p r og r am s t o a l l o w t h em to use the features o f t h e VAX- 1 1 c o nd i t i o n h a nd l i ng f a c i l i ty a r e d e s c r i bed i n the VAX/VM S Re f e r en c e Ma n ua l a nd t h e VAX- 1 1 sy s t em S e rv i c e s Run-T i m e L i b r a r y Re f e r e n c e Ma n ua l . Th i s c h a p t e r d i s c u s s e s h o w t h e t o o l s d e sc r i b e d in tho s e t wo m a n u a l s a c t ua l l y i m pl em e n t the i r f e a tu r e s . G o a l s o f VAX- 1 1 Cond i t i o n H a nd l i ng F a c i l i ty 2.1.1 S o m e o f t h e g o a l s o f t h e VAX- 1 1 c o nd i t i o n h and l i ng f a c i l i t y r e f l ec t goals o f t h e VAX- 1 1 p r o c ed u r e c a l l i ng s t a nd a r d . O t h e r g o a l s r e f l ec t t h e d e s i r e t o p l a c e a n e a s y- t o - u s e g e n e r a l p u r po s e m e c h a n i sm i n to the o pe r a t i ng s ys tem s o th a t a pp l i c a t i o n p r og r am s a nd o th e r l a ye r ed p r od uc t s s uc h a s c om p i l e r s c a n use t h i s m e c h a n i sm r a th e r than i nv e n t i ng t h e i r o wn a pp l i c a t i o n - s p e c i f i c to o l s . Some o f t h e e x pl i c i t a nd i mpl i c i t g o a l s o f t h e VAX- 1 1 c o nd i t i o n h a nd l i ng f a c i l i t y a r e t h e f o l l o w i ng . 1. the i nc l ud ed in be Th e c o nd i t i o n h a nd l i ng f a c i l i ty sho u l d a r c h i t e c t u r e s o th a t i t i s a v a i l a b l e a s a pa r t base mach i ne so f t wa r e some a nd a s pa r t o f no t o f the base mac h i ne f o r c o nd i t i o n h a nd l e r r es e rved s pa c e Th e c ompo n e n t . f r am e the call of l o ng wo r d the f i rs t in add resses a c c omp l i sh e s t h i s . 2-1 C OND I T I ON HANDL I NG 2. By i n c l ud i ng t h e h a nd l e r spe c i f i c a t i o n a s a p a r t o f t h e c a l l f r am e , s ignal h a nd l i ng i s a n i n t eg r a l pa r t o f a p r o c e d u r e , r a th e r than a g l obal f a c i l i ty w i t h i n a proc ess . Th i s cont r i butes t o t h e g e ne r a l g o a l o f m o d u l a r p r o c ed u r e s . Th i s a l so a l l ows c o nd i t i o n h a nd l e r s t o b e n � s t ed , wh e r e i nn e r h a nd l e r s c a n e i th e r s e r v i c e a d e t ec t ed e x c e p t i o n o r pa s s i t a l o ng t o some o u t e r h a nd l e r i n the c a l l i ng h i e r a r c h y . 3. S o m e l a ng uag e s s uc h a s BAS I C a nd PL/I h ave s i g n a l l i ng and e r r o r h a nd l i ng a s pa r t o f t h e l a ng uag e s pe c i f i c a t i o n . Th e s e l a ng uag e s c a n u s e the g e ne r a l m e c h a n i sm r a th e r t h a n i nv e n t i ng t h e i r o wn p r o c ed u r e s . 4. Th e r e s h o u l d be l i t t l e o r no c o s t to p r o c ed u r e s t h a t d o no t e s t a b l i sh h a nd l e r s . Fu r th e r , p r o c ed u r e s t h a t d o e s t a b l i sh h a nd l e r s s h o u l d i n c u r l i t t l e o v e r h e a d f o r e s t a b l i s h i ng t h em , w i th t h e expense in t ime b e i ng i n c u r red wh e n a n e r r o r a c t ua l l y o c c u r s . 5. As f a r a s t h e u s e r o r a ppl i c a t i o n p r og r amme r is c o n c e r n ed , ' t h e r e s h o u l d be n o d i f f e r e nc e i n t h e a ppe a r a n c e o f e x c e p t i o n s i n i t i a l l y d e t e c t e d b y t h e h a r d wa r e a nd s i g n a l s g e n e r a t e d b y s o f twa r e . Fe a t u r e s o f VAX- 1 1 C o nd i t i o n Hand l i ng Fa c i l i ty 2.1.2 Some o f t h e f e a t u r e s o f t h e VAX- 1 1 c o nd i t i o n h a nd l i ng fac i l i ty show h o w t h e s e g o a l s we r e a t t a i n ed . Oth e r s r e f l ec t t h e g e ne r a l d e s i r e t o p r od uc e a n e a s y- t o - u s e b u t g en e r a l c o nd i t i o n h a nd l i ng m e c h a n i sm . Fe a t u r e s o f the VAX- 1 1 c o nd i t i o n h a nd l i ng f a c i l i ty i n c l ud e the f o l l o w i ng . 1. A c o nd i t i o n h a nd l e r h a s th r e e o p t i o n s a v a i l a b l e to it. Th e h a nd l e r c a n f i x t h e c o nd i t i o n ( c o n t i n u i ng ) . Th e h a nd l e r m a y n o t be c a p a b l e o f f i x i ng t h e c o nd i t i o n so i t pa s s e s the c o nd i t i o n o n to the n e x t h a nd l e r i n t h e c a l l i ng h i e r a r c h y ( r e s i g n a l l i ng ) . Th e h a nd l e r c a n a l t e r the f l ow o f cont rol ( un w i nd i ng t h e c a l l s t ac k ) . 2. Be c a u s e c o nd i t i o n h a nd l e r s a r e t h em s e l v e s p r o c ed u r e s , they have the i r o wn c a l l f r ame w i th i t s o wn s l o t fo r a c o nd i t i o n h a nd l e r add r e s s . Th i s g i v e s h a nd l e r s t h e a b i l i ty to e s tabl i sh t h e i r o wn h a nd l e r s t o f i e l d e r r o r s t h a t t h e y m i g h t c a use . 3. Th e g o a l s r e l a t ed to c o s t i n s pa c e a nd t i m e we r e r e a l i z e d b y u s i ng only a s i ng l e l o ng wo rd pe r p r o c ed u r e a c t i v a t i o n f o r h a nd l e r a d d r e s s s to r ag e . Th e r e i s no cost in t i me fo r p r o c ed u r e s t h a t d o no t e s t ab l i s h h a nd l e r s . P r o c ed u r e s t h a t do e s t a b l i sh h a nd l e r s can d o so wi th a s i ng l e MOVAx i n s t r uc t i o n . No t i me i s s pe n t l o o k i ng f o r c o nd i t i o n h a nd l e r s u n t i l a s i g n a l i s a c t ua l l y g e ne r a t ed . 4. Th e m e c h a n i sm i s d e s i g ned to wo r k e v e n i f a c o nd i t i o n h a nd l e r is wr i t t e n in a l a ng uag e t h a t d o e s n o t p r o d uc e r e e n t r a n t code . Th u s , if a c o nd i t i o n h a nd l e r wr i t t e n i n FORTRAN g enera ted an e r r o r , th a t e r r o r wo u l d n o t be r e po r ted to th e s am e h a nd l e r . 2-2 C OND I T I ON HANDL I NG I n f a c t , t h e s pe c i a l a c t i o n s th a t a r e t a k e n in r e s po n s e m u l t i pl y a c t i v e s i g n a l s h a s a s e c o nd b en e f i t , n ame l y t h a t c o nd i t i o n h a nd l e r h a s t o wo r r y a bo u t e r ro r s th a t g ene r a tes , b e c a use a h a nd l e r wo u l d n ev e r b e c a l l ed r e s po n s e to i t s o wn s i g n a l s . 2. 2 to no it in 5. Un i f o rm ex c e p t i o n d i spa tch i ng f o r h a r d wa r e a nd so f twa r e except i ons is a c compl i shed by p r ov i d i ng p a r a l l e l m e c h a n i sms fo r the t wo f o rm s of e x cept i o n s . So f twa r e d e t e c ted ex cept i ons a r e g e n e r a ted by c a l l i ng a p r o c ed u r e in t h e Run-T i m e L i b r a r y . Ha r d wa r e e x c ep t i o n s t r an s f e r co n t r o l to a n e x c e p t i o n d i s pa t c h e r i n the execut ive . Wh i l e t h e i n i t i a l e x e c u t i o n o f th e s e two m e c h a n i sm s d i f f e r s s l i g h t l y t o r e f l e c t t h e i r d i f f e r i ng i n i t i a l co nd i t i o n s , t h e y e v e n t ua l l y e x e c u t e nea rly i d ent i c a l i n s t r uc t i o n sequenc es so th a t the i n fo rm a t i o n r e po r t ed to c o nd i t i o n h a nd l e r s i s i nd e pend e n t o f t h e i n i t i a l d e t e c t i o n m e c h a n i sm . 6. By m a k i ng c o nd i t i o n h a nd l i ng a pa r t o f a proced ur e , h igh l ev e l l a ng uag e s h av e t h e c a pa b i l i ty to e s t a b l i s h h a nd l e r s t h a t c a n e x am i n e a g i v e n s i g n a l a nd d e t e rm i n e wh e th e r the s ignal wa s g e n e r a ted a s a pa r t o f t h a t l a ng u a g e ' s s uppo r t l ibrary. I f so , t h e h a nd l e r · c a n a t tempt to f i x t h e e r r o r in the manner d e f i ned b y the l a ng ua g e . I f n o t , t h e h a nd l e r p a s s e s t h e s i g n a l a l o ng to pr oced u r e s f u r th e r up t h e c a l l stack . GENERAT I ON OF E XC E PT I ONS On e wa y of c l a s s i f y i ng the c o nd i t i o n s th a t occ u r i n a r un n i ng VAX/VM S s y s tem is to s e pa r a t e tho s e c o nd i t i o n s tha t o r i g i n a t e i n the VAX- 1 1 h a r dwa r e f r om tho se th a t are i n i t i a t ed b y so f twa r e . Th e p r i m a r y d i f f e r e n c e s b e twe e n t h e two s e t s o f i n i t i a l c o nd i t i o n s a r e th e i n i t i a l s t a t e o f the s t a c k t h a t c o n t a i n s the e x c e pt i o n p a r a m e t e r s a n d the l oc a t i o n of t h e r o u t i n e th a t pe r f o rm s t h e d i s pa t c h i ng . Th e i n i t i a l e x e c u t i o n o f the two d i spa tc h e r s r e f l e c t s t h e s e d i f f e r i ng initial c o nd i t i o n s . 2. 2. 1 E x c e p t i on s Th a t O r i g i n a t e i n t h e H a rdwa r e Wh e n a n e x c e p t i o n i s d e t e c t ed b y t h e h a r d wa r e , t h e e x c e p t i o n P C a nd PS L ( a n d po s s i b l e e x c e p t i o n - s p e c i f i c pa r ame t e r s ) a r e p u s h e d o n to t h e a pp r o p r i a t e s t a c k . Th e a pp r o p r i a t e s ta c k i s d e te rm i n ed b y t h e access mode i n wh i ch t h e e x c e p t i o n o c c u r red and wh e th e r t h e C P U wa s p r ev i o u s l y e x e c u t i ng on the i n t e r r up t s t a c k . • I f t h e e x c e p t i o n o c c u r r ed i n a ny mod e o th e r t h a n ke rnel a nd t h e e x c e p t i o n wa s n o t a C HMU , C HMS , o r C HM E e x c e pt i o n , t h e kernel stack is used . ( Th e i nt e r r up t s tac k is not a cons i d e ra t i on i n t h i s c a s e b e c a u s e i t i s i m po s s i b l e to be o n t h e i n t e r r up t s t a c k i n o th e r t h a n ke r n e l m o d e . ) • I f t h e e x c ep t i o n o c c u r r e d i n k e r n e l m o d e a nd t h e k e r n e l s t a c k wa s i n use , t h e k e r n e l s t a c k i s a l s o u s e d a s th e ex c e p t i o n s ta c k . 2-3 C OND I T I ON HANDL ING • I f t h e e x c e p t i o n o c c u r r ed i n k e r n e l m o d e a nd the i n t e r r up t s t a c k wa s in use , the i n t e r r upt s ta c k is used as the e x c ept i o n s t a c k . VM S d o e s n o t e x pe c t except i o ns to occur wh e n i t i s o pe r a t i ng o n t h e i n t e r r up t s t a c k . I f an ex c ep t i o n s h o u l d o c c u r o n t h e i n t e r r up t s t a c k , t h e e x c ep t i o n d i s pa t ch e r g e n e r a t e s a VM S - r e q u e s t ed s ys t em c r a sh c a l l ed a b ug c h e c k ( Ch a p te r 7 ) w i th a B UG $_I NVE XC E PTN c o d e . Th e a c t ua l s t a c k ( i n t e r r upt o r k e r n e l ) th a t is used to s e rv i c e an e x c ep t i o n o r i n t e r r up t i s d e t e rm i n ed b y t h e l o w-o r d e r two b i t s i n th e S C B e n t r y a nd wh e th e r t h e i n t e r r up t s t a c k i s a l ready in use . Th e rules j us t f o rm u l a ted r e f l ec t t h e b e h av i o r o f VM S , wh e r e e x c e p t i o n s a r e a s s o c i a t e d w i th a p r o c e s s a nd s e rv i c ed o n tha t process ' s ke rnel s t a c k ( b e c a u s e t h e l o w-o r d e r two b i t s i n t h e S C B e n t r y a r e z e r o ) . Th e i n te r r up t s t a c k i s o n l y u s ed if i t wa s a l r e a d y i n u s e wh e n t h e e x c ep t i o n o c c u r r e d . No t e t h a t two s e r i o u s a b o r t s ( ma c h i n e c h e c k a nd k e r n e l s t a c k n o t va l i d ) , e x c ept i o n s t h a t a l s o c h a ng e I P L to 31 , are s e rv i c ed o n t h e i n t e r r u pt s t a c k b y VM S . Af t e r a l l o f t h e e x c e p t i o n i n fo rm a t i o n h a s b e e n p u s h e d o n to t h e s t a c k , control i s t h e n pa s s ed to a n e x c e p t i o n - s pec i f i c s e r v i c e r o u t i n e who s e ad d r e s s i s s to r e d i n t h e S y s tem Co n t r o l B l o c k ( F i g u r e 2 - 1 ) . Th e use of the f i r s t twe nty l o c a t i o n s o f th i s tab l e a r e l i s t ed i n Ta b l e 2 - 1 . Mo s t o f t h e e x c e p t i o n s t h a t a r e l i s t ed i n th i s t a b l e a r e h a nd l ed i n a un i fo rm wa y by VM S . Th e a c t i o n s t h a t VM S t a k e s i n r e s p o n s e to th e s e e x c e p t i o n s wi l l b e t h e s ub j e c t o f mo s t o f th i s c h a p t e r . Some o f t h e except i ons , h owe ve r , r e s ul t in s pe c i a l a c t i o n o n th e pa r t o f VM S . Th e s e e x c e p t i o ns a r e d i s c u s s ed i n t h e pa r ag r a ph s th a t f o l l o w a n d a r e i nd i c a t e d i n Tab l e 2 - 1 b y a n a s t e r i s k . .-tiiiL � E x ceptions ( 20) ·� P ro c e s s o r F a u l t s ( 1 2 ) S o f t w a r e I nt e r r u p t s ( 1 6 ) PR$-SCBB T h e Sy stem Control Block B a s e R e g i s te r ( SC B B ) c o n t a in s t h e p hy s i c a l address of t h e page a ligned System Control B l o c k ( SC B ) I C l o c k a nd C o n s o l e ( 1 6 ) Ex t e r n a l A d a p t e r 1 1 - I n t e rr u p t s I : : E X E $ G L_SC B The s y s t e m v i rt u a l a d d r e s s of t h e S C B i s s t o r e d in g l o b a l l o c a t i o n E X E $ G L_S C B T h e VAX-1 1 /750 system control block is two pages long. The second page Is used for directly vectored UNI BUS d evice interrupts. S y s t e m C o n t ro l B l o c k Figur e 2-1 The VAX-1 1 /780 system control block is one page long. Sys t em C o n t r o l B l o c k 2-4 Ta b l e 2 - 1 U s e o f F i r s t 2 0 Loc a t i o n s i n Sys tem Co n t r o l B l o c k Byte f r om Of f s e t E x c e p t i o n Name S C B Ba s e 0 Un u s ed 4 Mac h i ne 8 �e r n e l 12 Ch e c k Stac k Ex t r a Type ( Ab o r t , No t e s o n VM S Pa r am e t e r s Fa u l t , Tr a p ) D i s pa tc h i ng No t e n o t Va l i d Po we r f a i l 1 Note 1 Commen t s No t e 1 ( Ch a pt e r 0 Abo r t No te 2 I PL = 3 1 , 0 I n t e r r up t No te 3 I PL = 3 0 7) I n t e r r up t ( Ch a pt e r l\J I lJ1 16 Re s e r v e d / P r i v i l eg ed 20 C u s t ome r Re s e r v ed 24 R e s e r v ed Op e r a nd 28 R e s e r v ed Ad d r e s s i ng 32 Ac c e s s 36 Tr ansl a t io n I n s t r uc t i o n I n s t r uc t i o n Mo d e Vi o l a t i o n no t Va l i d (1) Th e ma c h i n e c h e c k e x c e p t i o n i nd i c a t e s and ke rnel mod e cause b ug ch ec k s . n o r m a l e x c e p t i o n d i s pa t c h m e t h o d . a (2) Th e ke rnel ( 3) Powe r f a i l (4) Th e (5) I f e x e c u t i v e d e b ug g i ng pend i ng a r e a l t e r ed t o (6) except i o n serv ice causes an r o u t i ne i n t e r r up t t r a n s l a t i o n - n o t-va l i d fo r tha t faul t is the Fa u l t 0 Fa u l t 0 Abo r t/ Fa u l t 0 Faul t 2 Fa u l t 2 Faul t s t a c k no t va l i d control e n t r y pa th to the i n to a bo r t p o we r fa i l the pag i ng ( XD E LTA ) i s s e l e c t ed a t S Y S B OO T t i m e , t h e po i n t i n to XDE LTA f a u l t h a nd l e r s ( Ch a p t e r Th e c h a ng e-mod e - t o - k e r n e l RM S p r o c ed u r e s . a nd XF C No te p r o c e s s o r d e te c t e d i n t e r n a l Ma c h i n e c h e c k s i n s upe r v i so r pa s s e s the 0 c h a n g e-mo d e - t o- e x e c u t i v e t r a ps a re 4 St a c k 23) I n s t r uc t i o n ( Ch a pte r 12) e r ro r . Ma c h i n e chec ks in exec ut i ve a n d u s e r m o d e a r e r e po r ted t h r o ug h t h e i ssues a b ug c h ec k . h a nd l e r . fac i l i ty except ion i n VM S . v e c to r s for B PT and trace 22) . the entry paths i n to s y s t em service and ( co n t i nued on next pag e ) Ta b l e 2 - 1 ( co n t . ) U s e o f F i r s t 2 0 Loc a t i o n s i n Sys t em Co n t r o l B l o c k Byte Of f s e t f r om S C B Ba se Ex c ept i o n Name Ex t r a Pa r am e t e r s Type ( Abo r t , Fa ul t , Tr ap) No t e s on VM S D i s pa tc h i ng 40 T r a c e Pend i ng 0 Faul t No te 5 44 B PT I n s t r uc t i o n 0 Fa u l t No t e 5 48 Compa t i b i l i t y Mo d e 1 Abo r t/ Fa ul t 52 A r i t hm e t i c 1 Fa u l t / T r a p Commen t s VM S mod i f i e s c o d e ( Ta b l e 2 - 3 ) 56 Unused 60 Unused 64 C HM K 1 Trap No te 6 U s e s Ke r n e l St a c k ( Ch a p t e r 68 C HM E 1 Trap No t e 6 3) U s e s Ex e c u t i v e St a c k ( Ch a p t e r 3 ) 72 C HM S 1 Trap Us e s Supe r v i so r St a c k 76 C HM U 1 Trap Us e s Us e r St a c k COND I T I ON HANDL I NG 2.2. 1. 1 Ex cept i o n s Th a t VMS T r e a ts i n a Spec i a l Way A l t h o ug h VM S p r o v i d e s u n i f o r m h a nd l i ng o f mo s t e x c e p t i o n s g e n e r a t ed by u s e r s , s ev e r a l po s s i b l e e x c e p t i o n s a r e u s e d a s e n t r y p o i n t s i n to p r i v i l eg ed s y s t em p r o c ed u r e s . O th e r e x c e p t i o n s c a n o n l y be a c t ed upo n b y t h e e x e c ut i v e . It makes no sense to pa s s i n f o rm a t i o n a b o u t the s e e x c e p t i o n s a l o ng t o u s e r s . - 1. Th e ma c h i ne c h e c k e x c ep t i o n i s a p r o c e s so r - spec i f i c c o nd i t i o n tha t m a y o r m a y not be r ec o v e r ab l e . Th e m a c h i n e c h e c k e x c e p t i o n s e r v i c e r o u t i n e i s d i s c u s sed i n Ch a pt e r 7 . 2. A k e r ne l - s t a c k-no t-va l i d e x c ep t i o n i nd i c a t e s th a t th e ke rnel s ta c k wa s not val id wh i l e t h e p r oc e s s o r wa s p u s h i ng i n fo rm a t i o n o n t o the s ta c k d u r i ng the i n i t i a t ion o f an e x c ept i on or i n t e r r up t . Th e e x c ep t i o n s e r v i c e r o u t i n e f o r th i s except i on g ene r a tes a fatal b ug ch e c k wi th a B UG $ KRN L S TAKNV c o d e . 3. Th e po we r f a i l e n t r y po i n t t h a t a ppe a r s a s o n e o f t h e f i r s t 2 0 entr ies in the SCB i s n o t a n except ion . B e c a u s e a po we r f l uc t u a t i o n o c c u r s a s ynch r o no u s l y w i th r e spe c t to the c u r r e n t l y e x e c u t i ng i n s t r uc t i o n s t r e am , i t i s a c t ua l l y a n i n t e r r up t . Th e f a c t th a t po we r f a i l i s a n i n t e r r up t , w i t h an a s s o c i a t ed IPL, i m p l i e s t h a t t h e po we r f a i l i n te r r up t c a n b e b l o c k e d s im p l y b y r a i s i ng I PL t o 3 0 o r 3 1 . Th e s t eps th a t VM S t a ke s in r e spo n s e to powe r f a i l u r e a s we l l a s o n po we r r e c o v e r y a r e d e s c r i b ed i n Ch a p t e r 2 3 . 4. Th e t r an s l a t i o n-no t-va l i d e x c ep t i o n is a s ignal tha t a r e f e r e n c e wa s mad e to a vi r t ua l a d d r e s s th a t i s n o t c u r r e n t l y m a pped t o phys i c a l m emo r y . Th e pag e f a u l t h a nd l e r th a t is i nv o k e d i n r e spo n s e to th i s e x c e p t i o n i s d i s c u s s e d i n d e ta i l i n Ch a p t e r 1 2 . 5. Th e c h a ng e-mo d e - to - k e r n e l a nd c h ang e -m o d e- t o - e x e c u t i v e e x c e p t i o n s a r e t h e m e c h a n i sm s u s e d b y t h e VM S s ys t em s e rv i c e s a nd b y RMS t o r e a c h a mo r e p r i v i l eg ed a c c e s s mo d e . Th e d i spa t c h i ng s c h em e fo r s ys tem s e rv i c e s a nd RM S c a l l s i s d e s c r i b ed i n Ch a p t e r 3 . Th e l a s t t wo e x c ep t i o n s i n t h e l i s t ( th e t wo c h a ng e m o d e e x c e p t i o n s ) a r e pa ths i n to t h e o pe r a t i ng s y s t em th a t a l l o w nonpr i v i l eg ed us e r s t o r e a c h a p r i v i l eg ed a c c e s s m o d e i n a c o n t r o l l ed f a sh i o n . 2.2.1.2 O th e r Ha r dwa r e Except i o n s - Th e r est of the except ions d e t e c t ed b y h a rd wa r e a r e h and l ed un i fo rm l y by t h e i r e x c ep t i o n s e r v i c e r out ines . Th e s e e x c e p t i o n s a r e a l l r e po r t ed t o c o nd i t i o n h a nd l e r s e s t a b l i sh e d by the us e r o r b y t h e s ys t em , r a th e r t h a n r e s u l t i ng i n s p e c i a l s y s tem ac t i o n s uc h a s o c c u r s f o l l o w i ng a c h a ng e -mo d e- to - k e r n e l e x c e p t i o n o r a t r a n s l a t i o n - no t-v a l i d f a u l t ( pa g e f a u l t ) . Wh e n a h a r d wa r e-d e t e c t ed e x c e p t i o n o c c u r s , t h e PS L a nd PC a t the t ime of the e x c e p t i o n a r e p u sh ed o n to t h e s t a c k . Th e u s u a l s t ac k t h a t i s u s e d i s t h e ke r n e l s t a c k b u t t h e C HMx e x c e p t i o n s u s e t h e s ta c k o f the d es t inat i o n mode . Fo r e x ampl e , a C HM S e x c ep t i o n push e s th e P C a nd PS L o f the e x c ep t i o n o n to the s upe r v i so r s t ac k . No t e t h a t a CHMx i n s t r uc t i o n i s s ued f r om an i nn e r acc e s s m o d e i n an a t t em p t to r e a c h a l e s s p r i v i l eg ed ( o u t e r ) a c c e s s mod e wi l l n o t h a v e t h e d e s i r ed e f f ec t . Th e m o d e i nd i c a t ed b y t h e i n s t r uc t i o n i s m i n im i zed wi t h t h e c u r r e n t a c c e s s mod e t o d e t e rm i n e t h e a c t ua l ac c e s s m o d e t h a t wi l l b e used . Fo r e x am p l e , a CHMS i n s t r uc t i o n i s s ued f r om k e r n e l m o d e w i l l g e n e r a t e 2-7 CONDITION HANDLING a n e x c e p t i o n th r o ug h t h e c o r r e c t SCB v e c to r ( th e o n e f o r C HM S ) b u t t h e f i na l a c c e s s m o d e wi l l st i l l be ke rnel . I n o th e r wo r d s , as i l l u s t r a t ed i n F i g u r e 1 - 4 , t h e C HMx i n s t r uc t i o n s c a n o n l y r e a c h e q ua l o r mo r e p r i v i l eg ed a c c e s s m o d e s . Th e PC t h a t i s p u s h e d d e pe nd s o n th e n a t u r e o f t h e e x c e p t i o n , t h a t i s , wh e th e r the e x c e p t i o n i s a f a u l t , a t r a p , o r a n a b o r t . • • • E x c e p t i o n s t h a t a r e f a u l ts ( Ta b l e 2 - 1 ) c a us e t h e PC o f the f a u l t i ng i n s t r uc t i o n to b e push ed . Wh e n f a u l ts a r e d i sm i s s ed wi th an RE I i n s t r uc t i o n , the f a u l t i ng i n s t r uc t i o n w i l l e x e c u te aga i n . Ex c e p t i o n s t h a t a r e t r aps ( Ta b l e 2 - 1 ) p u s h t h e PC o f the n e x t i n s t r uc t i o n o n t o t h e d e s t i na t i o n s t ac k . I n s t r uc t i o n s t h a t c a us e t r a p s d o n o t r e e x e c u t e wh e n t h e e x c e p t i o n i s d i sm i s s e d wi th a n R E I i n s t r uc t i o n . A th i r d c l a s s o f e x c e p t i o n , a n ab o r t , c a uses a PC in the midd l e o f t h e i n s t r uc t i o n to b e p u s h e d o n to th e s t a c k . Th i s i m p l i e s t h a t a b o r t s a r e no t r e s t a r t ab l e . Some a bo r t s a l s o r a i se I PL to 3 1 , b l o c k i ng a l l o th e r a c t i v i ty o n t h e sys t em . I P L i s u s ua l l y n o t a f f e c t ed wh e n e x c e p t i o n s o c c u r , o n e o f t h e f e a t u r e s t h a t d i s t i ng u i sh e s t h em f r om i n t e r r up t s . Ex c e pt i o n s t h a t a r e a b o r t s i n c l ud e ke r n e l s t a c k no t v a l i d , some m a c h i n e c h e c k c o d e s , and some r e s e rved ope r a nd e x c e p t i o n s . Fo r a l l e x c e p t i o n s th a t wi l l e v e n t ua l l y be r e po r t ed to c o nd i t i o n h a nd l e r s , t h e h a r d wa r e h a s pushed a PC/PS L p a i r o n to th e d e s t i n a t i o n s t ac k . I n ad d i t i o n , f r om z e r o to two e x c e p t i o n - s pec i f i c pa r ame t e r s are p u sh ed o n to t h e d est ina t ion s ta c k ( Ta b l e 2 - 1 ) . Fi na l l y , t h e h a r d wa r e pa s s e s c o n t r o l t o the e x c e p t i o n s e r v i c e r o u t i n e wh o s e add r e s s VM S p l a c ed i n to t h e S C B wh en the sys t em wa s i n i t i a l i z ed . 2. 2.1.3 I n i t i a l Ac t i o n o f E x c e p t i o n S e r v i c e Ro u t i n e s - Th e s e ex cept i on s e rv i c e r o u t i n e s a l l pe r f o rm a pp r o x ima t e l y t h e s ame a c t i o n . Th e e x c e p t i o n n ame ( o f t h e f o rm S S $ e x c ept i o n- n am e ) a nd t h e to t a l n um b e r o f e x c e p t i o n pa r ame t e r s ( f r om t h e e x c e p t i o n n ame t o the s a v ed PS L i n c l u s i v e ) a r e p u s h e d o n to the s t a c � so th a t t h e d e s t i n a t i o n s t a c k n o w c o n t a i n s a l i s t , c a l l e d t h e s i g n a l a r r a y , t h a t r e s emb l e s a VA X- 1 1 a r g um e n t l i s t used by the CALLx i n s t r uc t i ons ( Fi g u r e 2-2 ) . Th e ex c e p t i o n s th a t VM S h a nd l e s i n th i s un i f o rm wa y , i n c l ud i ng t h e i r n am e s a nd to t a l num b e r o f s i g n a l a r r a y e l em e n t s , a r e l i s t ed i n Tab l e 2 - 2 . Af t e r VM S h a s b u i l t th i s a rray , control i s p a s s ed to a g ene r a l e x c ep t i o n d i s p a tc h e r th a t m u s t l o c a t e a n y c o nd i t i o n h a nd l e r s th a t h a v e b e e n e s t a b l i sh ed i n t h e a c c e s s m o d e of th e except ion . Th e se a r ch m e thod a nd the l i s t o f i n fo rma t i o n p a s s e d to c o nd i t i o n h a nd l e r s i s d e sc r i b ed i n S e c t i o n 2 . 3 be l ow . Al l h a r d wa r e except ions ( e x c e pt fo r CHM E , C HM S , a nd C HM U ) are i n i t i a l l y r e po r t ed o n t h e k e r n e l s t ac k ( a s s um i ng t h e p r o c e s s o r i s n o t a l r e ad y o n t h e i n t e r r u pt s t a c k ) . I n ad d i t i o n , t h e h a rd wa r e e x c e pt i o n r e po r t i ng m e c h a n i sm a s s um e s th a t the ke rnel s tack i s val id . Th e d e c i s i o n to u s e t h e k e r n e l s t a c k wa s m a d e to avo i d the c a se of a t t em p t i ng t o r e po r t a n e x c e p t i o n o n , l e t u s s a y , t h e u s e r s t ac k , o n l y t o f i nd th a t t h e u s e r s t a c k i s c o r r u pted in som e wa y { i nva l i d or o t h e r wi s e i naccess i b l e ) , r e s u l t i ng i n a no th e r ex cept ion . If a k e r n e l - s t a c k -no t-va l i d except ion i s g e n e r a t ed wh i l e r e po r t i ng an e x c e p t i o n , VM S c a u s e s a f a t a l b ug ch e c k to o c c u r . 2-8 C OND I T I ON HANDL I NG SS$_exception-name :=� From 0 to 2 exception-specific parameters (Table 2-1 ) Exception PC I } N Pushed by software N is the number of longwords from SS$_exception-name to the exception PSL. It ranges from 3 to 5. Pushed by hardware Arguments are pushed onto the kernel stack except for CHMS and CHMU exceptions where the supervisor or user stack is used. :: � Exception PSL Figur e 2-2 S i g n a l Ar r a y B u i l t by Ha r dwa r e a nd Ex c e p t i o n Ro u t i n e s Howe v e r , t h e e x c e p t i o n m u s t e v e n t u a l l y b e r e po r ted b a c k t o t h e a c c e s s mode i n wh i c h t h e ex cept i o n occ u r r ed . B e f o r e t h e d i spa tch e r b e g i n s i t s s e a r c h , i t c r e a t e s s pa c e o n t h e s t a c k o f t h e m o d e i n wh i c h the ex cept i o n o c c u r red . Th e e x c e p t i o n pa r am e t e r l i s t s a r e t h e n c o p i e d to t h a t s t ac k wh e r e they w i l l b e c om e the a rg um e n t l i s t th a t i s pa s s e d to c o nd i t i o n h a nd l e r s . 2.2.1.4 M o r e Spec i a l C a s e s i n E x c e p t i o n D i spa tch i ng - Al t h o ug h the p r o c ed u r e d e sc r i b e d above is a r e a s o n ab l e a pp r o x i m a t i o n to the o p e r a t i o n o f the e x c e p t i o n s e r v i c e r o u t i n e s i n VM S , t h e r e a r e d e t a i l ed d i ffe rences that o c c u r i n t h e d i spa tc h i ng o f s e v e r a l e x c e p t i o n s t h a t d e s e r v e spec i a l m e n t i o n . Th e s e s p e c i a l c a s e s a r e l i s t ed h e r e . 1. Us e r S t a c k Ov e r f l o w i s d e tec t ed by t h e h a r d wa r e a s a n access v i o l a t i on at t h e l o w a d d r e s s e nd o f P l s pa c e . Th e a c c e s s vio lation f a u l t h a nd l e r t e s t s wh e th e r the i na c c e s s i b l e v i r t ua l add r e s s i s a t t h e l o w e nd o f P l s pa c e . I f i t i s , the s t a c k i s e x p a nd ed a nd th e e x c e p t i o n d i sm i s s e d . Use r a nd s y s tem c o nd i t i o n h a n d l e r s wo u l d o n l y be n o t i f i e d a b o u t s uc h a n e x c e p t i o n i f th e s t a c k e x pa n s i o n we r e un s uc c e s s f u l . 2. Th e r e a r e t e n po s s i b l e a r i thme t i c e x c e p t i o n s th a t c a n o c c u r . Th e y a r e d i s t i ng u i shed i n the h a r d wa r e by d i f f e r e n t e x c e p t i o n p a r am e t e r s . Howev e r , t h e e x c e p t i o n s e r v i c e r o u t i n e d o e s no t s impl y push a g ene r i c e x c e p t i o n n ame o n to the stac k , r e s u l t i ng i n a f o u r pa r a m e t e r s ig nal array . Ra t h e r , the e x c e p t i o n pa r am e t e r i s u s e d by t h e e x c e p t i o n s e r v i c e r o u t i n e t o f a s h i o n a un i que e x c e p t i o n n am e f o r e a c h o f the po s s i b l e a r i thm e t i c ex cept i ons . Th e e x c e p t i o n pa r a m e te r s a nd t h e i r a s s o c i a t ed s i g n a l nam e s a r e l i s t ed i n Ta b l e 2 - 3 . 2-9 Ta b l e 2 - 2 E x c e p t i o n s Th a t Us e t h e D i s pa tc h e r i n Mod u l e E XC E PT I ON Ex c ept i o n Nam e Nam e i n S i g na l Ar r a y Ac c e s s Vi o l a t i o n S S $_ACCVI O No t e s o n VM S D i s pa t c h i ng ( Sec t i o n 2 . 2 . 1 . 4 ) I t em 1 S i ze o f S i g na l Ar r a y Ex t r a Pa r am e t e r s i n S i g n a l Ar r a y (No t e 1 ) S i g na l S i g na l 5 Ar i thm e t i c Ex c e pt i o n ( Ta b l e 2 - 3 ) I t em 2 3 No t e 2 A S T De l i v e ry S t a c k Fa u l t ( So f t wa r e ex c e pt i o n ) S S $_A S TF LT I t em 3 a . 7 S ignal Signal S i g na l S i g na l S i g na l Signal !'\) I .... (1) 0 (2) Ad d i t i o n a l = (3) = (2) = R e a so n Ma s k I n a c c e s s i b l e Vi r t ua l Ad d r e s s S P Va l ue a t Fa u l t A S T Pa r am e t e r o f fa i l ed AST ( No t e 3 ) ( 4 ) = PC a t AST d e l i v e r y i n te r r upt ( 5 ) = PS L a t AST d e l i v e r y i n t e r r up t ( 6 ) = PC to wh i c h AST wo u l d ha v e b e en d e l i v e r ed ( 7 ) = PS L a t wh i c h AST wo u l d h a v e b e en d e l i v e r ed (3) = Pa r am e t e r s i n t h e s i g n a l a r r a y a r e r e p r e s e n ted i n t h e f o l l o wi ng wa y . S i g na l (0) Si gnal (1) E x c e pt i o n name Si gnal (2) F i r s t add i t i o n a l pa r am e t e r S i g na l (3) S e c o nd a d d i t i o n a l pa r am e t e r Signal ( N- 1 ) E x c e p t i o n PC Signal (N) E x c e p t i o n PS L = N N um b e r o f a d d i t i o n a l l o ng wo r d s i n s i g n a l a r r a y Th e a r i thme t i c e x c e p t i o n h a s n o ex t r a pa r a m e t e r s , d e s p i t e t h e f a c t t h a t t h e h a r d wa r e pus h e s a n e x c e pt i o n code onto the ke rnel stac k . VMS mod i f i e s t h i s h a r d wa r e c o d e i n to a n e x c e pt i o n- s p e c i f i c e x c e p t i o n n a m e ( Ta b l e 2 - 3 ) . Si gnal (3) (2) (1) = 8 * c o d e + S S $_ARTR E S Th e AST d e l i v e r y c o d e e x c h a ng e s t h e i n t e r r up t PC/ P S L pa i r a nd t h e PC/ P S L to d e l i v e r ed . wh i c h the AST wo u l d have been ( cont inued on next page ) Ta b l e 2 - 2 { co n t . ) E x c e p t i o n s Th a t Us e the D i s pa tc h e r i n Mo d u l e E XC E PT I ON Except io n Name Name i n S i gnal Ar ray B PT I n s t r uc t i o n S S $_B REAK C h a ng e Mo d e to S u pe r v i so r S S $_CMODS U PR I t em 4 4 S i g na l (2) = C h a n g e mod e c od e Ch a n g e Mo d e t o Us e r S S $_CM ODUS ER I t em 4 4 S i g na l (2) = C h a n g e mod e c od e Co mpa t i b i l i t y Mo d e S S $_C OMPAT I t em 4 4 S i g na l (2) = Compa t i b i l i ty e x c e pt i o n c o d e De b ug S i g na l ( S o f t wa r e e x c ept i o n ) S S $_D E B UG I t em 3 3 Ma c h i n e Ch e c k S S $_MC HE C K 3 S S $_0 PC C US 3 C u s t om e r Re s e r v ed In s t r uc t i o n Re s e r v e d / P r i v i l eg ed No tes on VMS Di spa tch i ng ( Sec t i o n 2 . 2 . 1 . 4 ) Si ze o f Signal Ar ray 3 S S $_0 PC DEC I t em 5 3 Pag e Fa u l t Re a d E r r o r ( So f twa r e ex c e pt i o n ) S S $_PAGRDERR I t em 3 b . 5 Re s e r v ed Ad d r e s s i ng Mo d e S S $_RADRM OD 3 Re s e r v ed Ope r a nd S S $_R O PRAND 3 Sys t em Se r v i c e Fa i l u r e ( S o f t wa r e e x ce p t i o n ) S S $_S S FA I L Trace Pend i ng S S $_TB I T (4) In s t r uc t i o n Ex tra Pa ramete r s in S i g na l Ar ray ( No te 1 ) I t em 3 c . 4 No t e 4 S i g na l S i g na l (2) (3) S i g na l (2) = = = Re a so n Ma s k I n ac c e s s i b l e Vi r t ua l Ad d r e s s Sys t em s e r v i c e f i n a l s t a t u s 3 Mac h i n e c h e c k e x c e p t i o n s t h a t a r e r e po r t e d to a p r o c e s s d o no t h a v e a n y e x t r a pa r am e t e r s i n the s i g na l array. Th e mach i ne c h ec k pa r ame t e r s h a ve b e e n e x a m i n ed , wr i t t en t o t h e e r r o r l og , a n d d i s c a r d ed b y t h e m a c h i n e c h e c k h a nd l e r ( Ch a p t e r 7 ) . C OND I T I ON HANDL ING 3. Th e r e a r e th r e e e x c e pt i o n s th a t a r e l i s t ed i n Tab l e 2 - 2 that a r e d e t ec ted b y s o f twa r e r a th e r th a n by h a r d wa r e . Ho we v e r , Ra th e r , t h e s e c o nd i t i o n s a r e n o t g e n e r a t ed by L I B $ S I GNAL . t h e y a r e d e t e c t e d by t h e e x e c u t i v e a nd c o n t r o l i s pa s s e d to the same r o ut ines tha t a re u s ed fo r d i spa t c h i ng h a r dwa r e -d e t e c t e d except ions . Th e r e a so n wh y t h e y d i s pa tc h t h r o ug h t h e e x e c u t i v e i s th a t t h e y a r e typi c a l l y d e t e c ted in k e r n e l mod e b u t m u s t b e r e po r ted b a c k t o s o m e o th e r a c c e s s m od e . Th e c o d e t o a c compl i s h th i s access mode swi tch is c o n ta i ned in E XC E PT I ON . L I B $ S I GNA L h a s n o c o r r e s po nd i ng f un c t i o n a l i t y . Th e th r e e except i o n s that fa l l i n to th i s c a t ego r y a r e s y s tem s e rv i c e f a i l u r e e x c e p t i o n s , pag e f a u l t r e ad e r r o r s , a nd i n s u f f i c i e n t s t a c k s pa c e wh i l e a t t empt i ng to d e l i v e r an AST . Ta b l e 2 - 3 S i g n a l Nam e s fo r Ar i t hm e t i c Ex c e pt i o n s Ex c e pt i o n Type Co d e Pu shed By Ha rdwa r e Re sul t i ng Ex c e pt i o n Re po r ted by VMS No tes Tr a ps In t eg e r Ov e r fl ow 1 S S $ INTOVF I n teg e r Di v i d e by Z e r o 2 S S $ I NTDIV F l o a t i ng Ov er f l ow 3 S S $_F LT OVF No te 3 F l o a t i ng /Dec imal 4 S S $_F LTD IV No te 3 Fl o a t i ng Und e r fl ow 5 S S $_F LTUND No tes 2 , 3 Dec ima l Ov er f l ow 6 S S $_D E.C OVF No te 1 Subsc r i pt Ra ng e 7 S S $_S UBRNG Fl o a t i ng Ov er f l ow 8 S S $ F LTOVF F No te 3 F l o a t i ng Di v id e by Z e r o 9 S S $_F LTDIV_F No te 3 F l o a t i ng Und e r flo w 10 S S $_F LT UND_F No te 3 No te 1 - - D i v ide by Zero Fa ul ts - - (1) I n t eg e r over f l o w enab l e and dec imal over f l ow enab l e b i t s i n t h e PSW c a n b e a l te r ed e i th e r d i r ec t l y o r thro ug h the pr o c ed u re en t r y mask . (2) Th e fl o a t i ng und e r f l ow enab l e b i t i n the PSW c a n onl y b e al t e r ed d i r �c tl y . Th e r e i s n o c o r r e spo nd i ng b i t i n the pr o c ed u re e n t r y ma s k . (3) On the VAX-1 1 /7 5 0 , t h e s e t h r e e f l o a t i ng po i n t ex c e pt i o n s a r e fa ul ts . On the VA X-1 1 /7 8 0 , they a r e t r a ps . 2-1 2 COND I T I ON HANDL ING • Th e S S $ S S FA I L e x c e pt i o n i s r e po r t ed wh e n a p r o c e s s h a s e n a b l e d - s ys t em s e rv i c e f a i l u r e e x c e p t i o n s a nd a s ys t em s e r v i c e r e t u r n s un s uc c e s s f u l l y w i th a s t a t u s o f e i th e r S T S $ K E RROR o r S T S $ K S EVE R E . Th e S S $ PAG RDERR e x c e p t i o n i s r e po r t e d wh en a process i n c u r s -a pag e faul t fo r a pag e o n wh i c h a r e ad e r r o r o c c u r r ed i n r e s po n s e t o a p r ev i o u s p a g e f a u l t . - • • Th e S S $ A ST F LT e x c e pt i o n i s r e po r t e d wh e n a n i n a c c e s s i b l e s t a c k is d e t e c t ed wh i l e a t t em p t i ng to d e l i v e r an AST to a process . A f o u r th s o f twa r e d e t e c t ed e x c e p t i o n i s l i s t e d i n Tab l e 2 - 2 a l tho ug h it does no t have a g l o ba l e n t r y po i n t i n m o d u l e E XC E PT I ON . Th e s i g n a l S S $ DE BUG i s g e n e r a t ed by e i th e r the DC L o r MC R c omma nd l a nguag e i n te r p r e te r in r e sponse to a D E B UG c ommand wh i l e a n i m ag e e x i s t s i n a n i n t e r r up t ed s tate . Th e DEBUG c omma nd p r o c e s so r pushes t h e PC a nd PS L o f t h e i n t e r r up t e d i m a g e , t h e e x c e p t i o n n am e ( S S $ D E B UG ) , a nd the s i ze of the s i g n a l a r r a y ( 3 ) o n to t h e s upe r v i so r s t ac k a n d j umps t o EXE $RE FLECT , a g l ob a l entry ad d r ess in mod ul e E XC E PT I ON . Th e r e a s o n t h a t a C L I u s e s t h i s m e c h a n i sm fo r t h e D E B UG s i g na l r a th e r than s i mpl y c a l l i ng L I B $ S I GNAL i s th a t t h e D E BUG c ommand i s i s s u ed wh i l e in s upe r v i so r m o d e b u t the except i on h a s to be r e po r t e d back to us e r m o d e . Th i s i nv o l v e s m o v i ng t h e e x c e p t i o n pa r am e t e r s f r om o n e s tac k to f un c t i o n a l i t y t h a t d o e s n o t e x i s t i n L I B $ S I GNA L b u t a n o th e r , does ex i st in E XC E PT I ON b e c a u s e mo s t h a rdwa r e - d e t e c t e d e x c e pt i o n s a r e r e po r t ed o n t h e k e r n e l s t a c k . 4. Th e e x c e p t i o n d i s pa t c h i ng f o r t h e C HMS a nd C HM U e x c e p t i o ns a nd f o r c ompa t i b i l i ty m o d e e x c e pt i o ns c a n be sho r t c i r c u i t ed by use o f the De c l a r e Ch a ng e Mo d e o r Comp a t i b i l i t y Mo d e H a nd l e r s y s t em s e r v i c e . Wh e n t h i s s y s t em s e rv i c e i s ex e c u t ed , o n e o f three l o ng wo rd l oc a t i ons i n the Pl po i n t e r pag e ( Append i x B) is l o ad ed w i th the a d d r e s s o f the h a nd l e r pa s s e d as a pa r ame t e r to the s y s t em s e r v i c e . Wh e n t h e d i s pa t c h e r fo r the c h a ng e -mo d e - to - s up e r v i s o r or c h a ng e-mo d e- t o - u s e r e x c e pt i o n f i nd s n o n z e r o c o n t e n t s i n t h e a s s o c i a t e d l o ng wo r d i n P l s p a c e , i t t r a n s f e r s c o n t r o l to the r o u t i n e wh o s e a d d r e s s is s to r ed i n t h a t l o c a t i o n wi t h t h e e x c e pt i o n s t a c k ( s up e r v i s o r o r use r ) i n exac t l y the s am e s t a t e i t wa s i n f o l l o w i ng t h e e x c e p t i o n . Th a t i s , t h e c h a ng e mod e c o d e i s o n t h e t o p o f the stac k , a n d t h e ex cept i o n PC a nd e x c e p t i o n PS L o c c u py t h e n e x t t wo l o ng wo r d s . Th e d i s pa t c h e r f o r c ompa t i b i l i t y m o d e e x c e p t i o ns transfers control to t h e u s e r - d e c l a r ed c o m pa t i b i l i t y m o d e h a nd l e r ( i f o n e wa s d e c l a r ed ) wi t h t h e u s e r s t a c k i n t h e s ame state it wa s b e f o r e t h e c om pa t i b i l i ty mod e e x c e p t i o n o c c u r r ed . Th a t i s , n o p a r am e t e r s a r e passed to t h e c om pa t i b i l i t y m o d e h a nd l e r on the use r s tac k . Th e c ompa t i b i l i ty mo d e c o d e , t h e e x c e p t i o n P C a nd PS L , a nd t h e c o n t e n t s o f R O t h r o ug h R6 are s aved in the f i r s t t e n l o ng wo r d s o f t h e c om pa t i b i l i t y mod e c o n t e x t pag e i n P l s pa c e a t g l o b a l locat ion C T L $ A L CM CNTX ( Append i x B ) . 2-1 3 C OND I T I ON HANDL ING 5. Th e Re s e r v e d I n s t r uc t i o n f aul t i s g e n e r a t ed wh e n ev e r an un r e c og n i z e d o pc o d e i s d e t e c t ed b y t h e i n s t r uc t i o n d e c o d e r . Th e s am e e x c e p t i o n i s g e n e r a t e d wh e n a p r i v i l eg ed i n s t r uc t i o n i s e x e c u t e d f r om o th e r t h a n k e r n e l mo d e . VM S u s e s th i s f a u l t a s a pa th i n to t h e o pe r a t i ng s y s tem c r a s h c o d e c a l l ed t h e b ug ch e c k m e c h a n i sm . Opc o d e FF , f o l l o wed b y F E o r FO , t e l l s t h e r e s e r v e d i n s t r uc t i o n except i o n service routine tha t t h e e x c e p t i o n i s a c t ua l l y a b ug c h ec k . Co n t r o l i s passed to t h e b ug c h e c k r o ut ine tha t i s d e sc r i b ed in Ch a p t e r 7 . 2. 2. 2 E x c ep t i o n s De t e c ted b y S o f twa r e On e o f t h e g o a l s o f t h e d e s i g n o f t h e VAX a r ch i t e c t u r e wa s to have a c ommo n c o nd i t i o n h a nd l i ng f a c i l i ty fo r both h a r d wa r e a nd so f twa r e -d e t e c ted c o nd i t i o n s . Th e d i spa t c h i ng f o r c o nd i t i o n s th a t a r e initially d e t ec t ed by the h a r d wa r e ( a nd fo r fo ur s pe c i a l so f t wa r e - d e t e c t ed e x c e p t i o n s ) i s pe r f o rmed b y t h e routines in the execut ive modul e E XC E PT I ON . Th e Run-T i m e L i b r a r y p r o c ed u r e c a l l ed L IB $ S I GNAL p r ov i d e s a s i m i l a r c a pa b i l i ty to a ny u s e r of a VAX/VMS s ys tem . 2. 2. 2. 1 P a s s i ng S t a t us f r om a P r o c ed u r e - Th e r e are u s ua l l y t wo m e thod s a v a i l a b l e f o r a p r o c ed u r e to i nd i c a t e to i t s c a l l e r wh e th e r i t c om p l e ted s uc c e s s f u l l y . On e m e tho d i s t o i nd i c a t e a r e t u r n s t a t u s in RO . Th e o th e r i s t h e s i g n a l l i ng m e c h a n i sm . Th e s i g n a l l i ng mec h a n i sm i nvo l v e s a c a l l to t h e VAX- 1 1 Run-T i m e L i b r a r y p r o c ed u r e L I B $ S I GNAL to i n i t i a te a sequence of events exac tly l i ke tho s e tha t o c c u r i n r e s po n s e t o a h a r d wa r e -d e t e c t ed e x c e p t i o n . On e o f the cho i c e s th a t m u s t b e m a d e wh e n d e s i g n i ng a m o d u l a r p r o c ed u r e i s th e m e th o d fo r r e po r t i ng e x c e pt i o n a l c o nd i t i o n s b a c k to t h e c a l l e r . Th e r e a r e t wo r e a so n s wh y s i g n a l l i ng m a y b e cho s e n o v e r c om p l e t i o n s t a t us . I n some p r o c ed u r e s s uc h a s t h e m a thema t i c s p r o c ed u r e s i n th e Run-T i m e L i b r a r y , R O i s a l r e a d y u s e d fo r a n o t h e r p u r po s e , n am e l y t h e r e tu r n of a f un c t i o n va l ue , a n d i s t h e r e f o r e unava i l a b l e fo r e r r o r r e turn s ta tus . I n th i s c a s e , th e p r o c e d u r e m u s t u s e the s i g n a l l i ng mech a n i sm to i nd i c a t e e x c e p t i o n a l c o nd i t i o n s , s uc h a s an a t t em p t to t a ke the s qua r e r o o t o f a n eg a t i v e n umb e r . Th e s e c o nd c ommon u s e o f s i g n a l l i ng o c c u r s i n an a pp l i c a t i o n th a t is u s i ng an i nd e te rm i n a t e n um b e r o f p r o c ed u r e c a l l s to pe r f o rm some a c t i o n , s uc h as a r e c u r s i v e p r o c ed u r e tha t pa r s e s a command l i ne , wh e r e t h e u s e o f a r e t u r n s t a t u s i s o f t e n c um b e r some a nd d i f f i c u l t to code . In th i s c ase , the VAX- 1 1 s i g n a l l i ng m e c h a n i sm p r o v i d e s a g r ac e f u l wa y to n o t o n l y i nd i c a t e th a t an e r r o r h a s o c c u r r ed b u t a l s o r e t u r n c o n t r o l ( th r o ug h SYS $ UNW I ND ) to a kn own a l t e r n a t e r e t u r n po i n t i n t h e c a l l i ng h i e r a r c hy . 2. 2. 2. 2 I n i t i a l Ope r a t i o n o f L I B $ S IGNAL - Wh e n t h e p r o c ed u r e th a t d e te c t s a n e r r o r wi s h e s t o s i g n a l i t , t h e p r o c ed u r e c a l l s L I B $ S I GNAL wi th t h e n ame of the e x c ept i o n a nd wh a t ev e r add i t i o n a l pa r am e t e r s it wi she s to pa s s to t h e c o nd i t i o n h a nd l e r s t h a t h a v e b e e n e s t a b l i s h e d b y t h e u s e r a nd b y t h e s ys t em . Th e s t a t e o f t h e s t ac k f o l l o w i ng a call to L I B $ S I GNA L i s p i c t u r e d i n F i g u r e 2- 3 . 2-1 4 ,, State of the stack Immediately after the CALLS to LIB$SIGNAL !",' ' 0 � No condition handler Register save mask, etc. I Saved Saved AP Saved FP Saved PC 0 PSW ® G) 0 N I .... 32-blt status code (signal name) lJ1 I ' ) ,,, ' / / ,/,/ • ol ' M �- - - .. ..� ,_l.: ' ' :fig �� ''• ' "4< < ' ' -t '• ' ' .. .. '' '�� o.., ' Argument list passed to LIB$SIGNAL or LI B$STOP --- ' copied from elsewhere to signal array. Rest of call frame discarded In same fashion. ) Figure 2-3 Signal/Stop code 1 � LIB$SIGNAL 2 � LI B$STOP --- - - - - -- - The argument list Is shifted up 8 bytes to make room for PC/PSL pair so that hardware and software signal arrays look the same ,.o ,� ' (I -- == � ' - - - --- - - - - N Is the size of the signal array (N=M+2) I Additional arguments (If any) passed to LIB$SIGNA'L or LIB$STOP .. ... N == � Signal Array passed to Condition Handlers ' ' '"{9.,.,,.,, ' ' ' Location of PC/PSL pair for quick exit 32-blt Status code (signal name) ' "o-� ' 1-o:fl) ' ' '�. ' ' 1}.,� ' . ' ' ---- - - - - If CALLG Instead of CALLS, then argument list AP Saved PC � signal array - . � Saved FP � FP ' - AP ' ::: � to LIB$SIGNAL or LIB$STOP Saved Mechanism Array will go here Exit from LIB$SIGNAL ---with ��- -� ---REI and not RET. - . .r' '> . 40C ' � .. �,/,......'-, �0�o ' Additional arguments (If any) passed ( , f2\ \V f3\ \V f4\ \V ,...� "' ' � ::: � ,, / I' bytes M Ia the size of the argument list , " State of the stack after LIB$SIGNAL has removed the call frame Saved PSW � low 1 6 bits of PSL I n signal array Call ,, frame for ,' LIB$SIGNAL or LIB$STOP 0 .. 3 stack alignment �� , Call frame Is discarded before handlers are called 1'., , r; ...... , ' ' ' PC of Instruction following CALLx PSL that existed before CALLx Value of SP before call and push of argument list Remova l o f Ca l l F r ame b y L I B $ S IGNAL 0 G) .._ � C OND I T I ON HANDL ING B e f o r e L I B $ S I GNAL b eg i n s i t s s e a r c h f o r c o nd i t i o n h a nd l e r s , i t r emov e s the c a l l f r am e ( a nd po s s i b l y t h e a r g um e n t l i s t ) f r om th e s t a c k . Th i s c a u s e s t h e s t a c k t o a ppe a r a l mo s t e x a c t l y t h e s am e t o L I B $ S I GNAL a s i t d o e s to EXC E PT I ON f o l l owi ng a h a r d wa r e e x c e p t i o n ( F i g u r e 2 - 3 ) . Th i s p r o c ed u r e EXC E PT I ON to t h i s p r o c ed u r e s t ac k s w i t c h take s p l ace o n 2. 3 us e s a n i d e n t i c a l s e a r c h m e c h a n i sm to the o n e used by l o c a t e c o nd i t i o n h a nd l e r s . Th e o n l y d i f f e r e n c e b e twe e n a nd t h e c o d e c o n t a i n ed i n the execut ive is th a t n o is r e q u i r ed here . Th e s e a r ch f o r cond i t i o n h a nd l e r s th e s ta c k o f t h e c a l l e r o f L I B $ S IGNA L . UN I FORM E XC E PT I ON D I S PATCH ING At th i s po i n t , t h e d i f f e r e n c e s b e twe e n h a rd wa r e and so f twa r e e x c ep t i o n s a r e n o l o ng e r i mpo r ta n t . Th e o p e r a t i o n o f e x c e p t i o n d i s pa tc h i ng w i l l b e d i sc u s s ed i n g e n e r a l t e rm s a nd e x p l i c i t m e n t i o n o f E XC E PT I ON o r L I B $ S IGNAL w i l l o n l y b e mad e wh e r e t h e y d e pa r t f r om e a c h o th e r i n th e i r ope r a t i o n . Be f o r e the sea rch fo r a c o nd i t i o n h a nd l e r b eg i n s , the e x c e pt i o n d i s pa tc h e r m u s t b u i l d a s e c o nd d a t a s t r uc t u r e o n t h e s t a c k th a t wi l l b e u s ed to r e po r t t h e except ion . Th e add r e s s o f th i s s t r uc t u r e , c a l l ed t h e m e c h a n i sm a r ray , a l ong wi th the a d d r e s s o f t h e ta b l e c o n t a i n i ng t h e e x c e p t i o n a rg um e n t s w i l l b e th e two a rg um e n t s t h a t a r e passed t o a ny c o nd i t i o n h a nd l e r s th a t a r e c a l l ed b y t h e d i s pa tc h e r ( Fi g u r e 2-4 ) . 2.3.1 E s t a b l i sh i ng a Cond i t i o n H a nd l e r VM S p r o v i d e s h a nd l e r s . • • two d i f fe r ent m e tho d s fo r e s t a b l i s h i ng c o nd i t i o n One m e th o d u s e s th e c a l l s t a c k a s so c i a t ed wi th e a c h a c c e s s mod e . Each ca l l f r am e i n c l ud e s a l o ng wo r d to c o n t a i n the a d d r e s s of a c o nd i t i o n h a nd l e r a s s o c i a t ed wi th th a t f r am e . Th e s e c o nd me tho d u s e s so f twa r e e x c e p t i o n v e c to r s , s e t a s i d e i n t h e c o n t r o l r eg i o n ( P l s p a c e ) fo r e a c h o f t h e f o u r a c c e s s mod e s . Ve c t o r e d h a nd l e r s d o n o t po s s e s s the modul a r p r o pe r t i e s a s s o c i a t ed wi th c a l l f r am e h a nd l e r s a nd are i n t e n d e d p r im a r i l y f o r d e b ug g e r s a nd pe r f o rma n c e m o n i to r s . C a l l f r am e h a nd l e r s a r e e s t a b l i s h ed by p l ac i ng th e ad d r e s s o f the h a nd l e r in the f i rst l o ng wo r d of t h e c u r r e n t l y a c t i v e c a l l f r am e . Th i s i s a c compl i s hed i n a s s em b l y l a ng uag e wi th a s i ng l e i n s t r uc t i o n MOVAB n e w-h a nd l e r , ( FP ) Be c a u se t h e f r am e po i n t e r i s g e n e r a l l y n o t a v a i l a b l e t o h i g h l ev e l l a ng uag e p r og r amme r s , t h e Ru n - T i m e L i b r a r y p r o c ed u r e L I B $ E S TAB L I S H c a n b e c a l l ed i n t h e fo l l o w i ng wa y o l d-h a nd l e r = L I B $ E S TAB L I S H ( n e w-h a nd l e r ) to a c c om p l i s h the same r e s u l t . 2-1 6 C OND I T I ON HANDL I NG I address of signal array 2 .... - - address of m e c h a n i sm a rr a y These two longwords are used and modified by handler search procedure Because VAX-1 1 calling standard dictates that RO and R1 are not saved across calls, they must be preserved In some other way ( [l [l FP of e s t a b lisher f r a m e Exception generated by call to LIB$SIGNAL o r LIB$STOP Argument list passed by call to LIB$SIGNAL or LIB$STOP. PC and PSL are added before handlers are called. See Figure 2-3. � 4 depth argument s av ed R 1 ) ( """"- "' 1\) s a v e d RO If lists are built by LIB$SIGNAL, there are two extra longwords between mechanism array and signal a rray. See Figure 2-3. ' I Condition handlers can pass status back to mainline code by modifying saved RO (and R1 ) If lists are built by EXCEPTION, mechanism array Is adjacent to signal array 11 Argu ment count is nu mber of longwords i n signal array ( N 2: 3) N � "' e x c e ption or s i gn a l name A d d ition a l e x c e p t i o n p a r a m e ters � p u s hed by h a r d w a re o r � � a d d i ti o n a l a rguments p a s s e d t o LIB$SIGNAL or LIB$STOP -- E x c e ption PC or PC following c a l l to L I B $ S I G N A L o r L I B $ S T O P r'lll Exception dispatched through hardware dispatcher �� � E x c e p t ion P S L Figure 2-4 .JII( Parameters pushed Initially onto kernel stack (except for CHMS and CHMU) by hardware and copied to exception stack by software. Exception name and argument count are added by software before handlers are called. Value of SP before exception S i g n a l a nd Me ch a n i sm A r r ay s C o n d i t i o n h a nd l e r s a r e r em o v e d by c l e a r i ng the f i r s t l o ng wo r d c u r r e n t c a l l f r am e . Th e i n s t r uc t i o n C LR L ) of the ( FP ) a c c ompl i s h e s th i s in a s s emb l y l a ng u a g e . c o un t e r pa r t to L I B $ E S TA B L I S H i s L I B $ R EVE R T . Th e Run-T i m e L i b ra ry Ex c e p t i o n v e c to r h a nd l e r s a r e e s t a b l i s h e d and r em o v e d wi th the Set E x c e p t i o n Ve c to r sys tem s e r v i c e , wh i c h s i mp l y l o ad s t h e ad d r e s s o f t h e s pe c i f i ed h a nd l e r i n to t h e spec i f i ed e x c e p t i o n v e c to r , l o c a t e d i n t h e po i n t e r pag e i n P l s pa c e . 2-17 C OND I T I ON HANDL ING 2. 3.2 Th e S e a r ch f o r a Cond i t i o n H a n d l e r At t h i s po i n t i n the d i spa t c h s e q ue nc e , t h e s ig nal a nd m e c h a n i sm a r r a ys h a v e b e en set up o n the s t a c k o f t h e a c c e s s mo d e tha t the e x c ep t i o n w i l l b e r e po r ted to . Th e e s t a b l i sh e r f r am e a rg um e n t i n the m e c h a n i sm a r ra y ( F i g u r e 2 - 4 ) wi l l b e used b y t h e s e a r c h p r o c ed u r e to i nd i c a t e how f a r a l o ng the s e a r c h h a s g o n e . Th e d e pth a rg um e n t i n the m e c h a n i sm a r r a y n o t o n l y s e rv e s as us e f u l i n fo rm a t i o n to c o nd i t i o n h a nd l e r s th a t w i sh to unw i nd b u t a l s o a l l o ws t h e s e a r ch p r o c ed u r e t o d i s t i ng u i sh call f r am e h a nd l e r s ( no nn eg a t i v e d e pth ) f r om e x c e p t i o n v e c to r h a nd l e r s ( n eg a t i v e d e pth ) . 2. 3. 2. 1 P r ima r y a nd S e c o nd a ry E x c ept i o n Vec to r s - Th e sea rch fo r a c o nd i t i o n h a nd l e r b e g i n s w i th the p r ima r y e x c ep t i o n v e c to r o f the a c c e s s m o d e in wh i c h t h e e x c ep t i o n o c c u r r ed . If the v e c t o r conta ins t h e ad d r e s s o f a c o nd i t i o n h a n d l e r ( a n y n o n z e r o c o n te n t s ) , t h e h a nd l e r i s c a l l ed w i t h a d ep th a rg um e n t o f - 2 ( th i r d l o ng wo r d i n m e c h a n i sm a r ray , Figure 2-4 ) . I f tha t h a n d l e r r e s i g n a l s o r i f n o n e e x i s t s , t h e s am e s t e p i s pe r fo rmed fo r the s e c o nd a r y e x c e p t i o n v e c to r , wh e r e the d e pth a rg um e n t i s now - 1 . C a l l F r ame Co nd i t i o n Hand l e r s - I f the s e a r c h i s to con t i nue ( no h a nd l e r y e t pa s s ed b a c k a s ta t us o f S S $ C ONT INUE ) , t h e c o n t e n t s o f t h e c u r r e n t c a l l f r am e a r e e x am i n ed n ex t . If the f i rs t l o ng wo r d in the c u r r e n t c a l l f r am e i s n o n z e r o , t h a t h a nd l e r i s c a l l ed n ex t . I f no h a nd l e r i s fo und th e r e or i f tha t h a nd l e r r e s i g n a l s , t h e p r ev i o us c a l l f r am e i s e x am i n ed by u s i ng the s a v ed f r am e po i n t e r i n t h e c u r r e n t c a l l f r am e ( F i g u r e 2- 5 ) 2.3.2.2 • Th e s e a r c h c o n t i n u e s un t i l some h a nd l e r pa s s e s b a c k a s t a t u s c o d e o f S S $ C ONTI NUE o r un t i l a s a v ed f r ame po i n t e r o f ze ro is f o und ( i nd i c a t i ng the e nd of the c a l l f r am e cha i n ) . Wh en the except i o n d i s pa t c h e r r e c e i v e s a r e t u r n s t a t u s o f S S $ C ONT INUE ( a n y c o d e w i th t h e l ow b i t o f R O s e t wi l l d o ) , t h e s t a c k i s cle a n e d o f f , R O and Rl are r e s t o r ed f r om th e m e c h a n i sm a r r a y , a nd t h e e x c e p t i o n i s d i sm i s se d b y i s s u i ng a n R E I , us i ng the s a v ed PC a n d PS L t h a t fo rm th e l ast two e l em e n t s o f t h e s i g n a l a r r a y . No t e tha t L I B $ S IGNA L pa s s e s c o n t r o l b a c k to i t s caller wi th a n RE I b e c a us e i t d i sc a r d ed the c a l l f r am e th a t wa s s e t up wh e n i t wa s c a l l ed . Th a t i s , L I B $ S I GNAL m o d i f i e s i t s s t a c k to l o o k j u s t l i k e the s t a c k u s e d b y E XC E PT I ON ( F i g u r e 2 - 3 ) . 2. 3. 2. 3 La s t Ch a n c e Cond i t i o n Ha nd l e r - I n the event that al l h a nd l e r s r e s i g n a l , t h e s e a r c h t e rm i n a t e s wh e n a s a ved f r am e po i n t e r o f z e r o i s l o c a ted . Th e e x c e p t i o n d i spa tc h e r t h e n c a l l s t h e h a nd l e r wh o s e a d d r e s s is s to r ed i n the l a s t c h anc e e x c e p t i o n v e c to r w i th a d e pth a rg um e n t o f - 3 . ( Th i s h a nd l e r i s a l s o c a l l e d i n th e e v e n t tha t a ny e r ro r s o c c u r wh i l e s e a r c h i ng the s t ac k fo r th� e x i s t e n c e o f c o nd i t i o n h a nd l e r s . ) Th e u s ua l h a nd l e r fo und i n the l a s t c h a n c e v e c to r is the s o -c a l l ed c a tc h a l l c o nd i t i o n h a nd l e r e s t a b l i sh ed a s pa r t o f i mag e i n i t i a t i o n . Th e act ion o f th i s sys t em - s upp l i ed h a nd l e r is d e sc r i b ed a t the end o f th i s c h a p t e r . 2-1 8 COND I T I ON HANDL ING I2 Signal array - Mechanism array Signal and mecha nism arrays for signal S generated by procedure C Establisher FP - l 4 - .1 G) Depth � 1 RO R1 I � � N Name of signal S =� Other parameters ==;::: Exception PC in C Exception PSL � CH � Direction of stack growth Call frame for procedure C Saved FP - Saved PC in B � � BH Call frame for procedure B Saved FP Saved PC in A AH Call frame for procedure A Saved FP Saved PC Figure 2-5 To previous frame O r d e r o f S e a r c h fo r C o nd i t i o n Ha nd l e r 2-1 9 C OND I T I ON HANDL I NG I f th e l a s t c h a n c e h a nd l e r r e t u r n s to t h e d i spa tc h e r ( i t s s t a t us is i g n o r ed ) or if the l a s t c h ance v e c to r is emp t y , t h e e x c ept i o n d i s pa tc h e r i nd i c a t e s th a t n o h a nd l e r wa s fo und . Th i s no t i f i c a t i o n is p e r fo rmed b y a p r o c ed u r e c a l l ed E XE $ E XC M SG ( Ch a pte r 2 7 ) i n the ex ecut ive . I t s t wo i n p u t pa r am e t e r s a r e a n ASC I Z s t r i ng c o n t a i n i ng m e s sag e t ex t , a nd t h e a r g um e n t l i s t t h a t wa s pa s s e d to a n y c o nd i t i o n h a nd l e r s . Fo l l o w i ng th e c a l l to EXE $ E XC M SG ( Ch a pte r 2 7 ) , t h e i m a g e i s t e rm i n a t e d w i th a s t a t us i nd i c a t i ng e i th e r th a t n o h a n d l e r wa s fo und or t h a t a b a d s t a c k wa s d e tec ted wh i l e s e a r c h i ng fo r a c o nd i t i o n h a nd l e r . 2. 3.3 M u l t i pl y Ac t i ve S i g n a l s I f a n e x c e p t i o n o c c u r s i n a c o nd i t i o n h and l e r or i n s o m e p r o c ed u r e c a l l ed by a c o nd i t i o n h a nd l e r , a s i t ua t i o n c a l l ed m u l t i pl y a c t i v e s i g na l s i s r eached . I n o r d e r to avo i d a n i n f i n i t e l o o p o f e x c e p t i o n s , t h e p r o c ed u r e t h a t s e a r c h e s f o r cond i t i o n h a n d l e r s mo d i f i e s i t s s e a r c h a l g o r i thm so t h a t tho s e f r am e s s e a r c h e d wh i l e s e r v i c i ng the fi rst c o nd i t i o n a r e s k i pped wh i l e s e rv i c i ng t h e s e c o nd c o nd i t i o n . I n o rd e r f o r th i s s k i pp i ng to wo r k c o r r e c t l y , t h e h a r d wa r e e x c e pt i o n d i s pa t c h e r ( mod u l e EXC E PT I ON ) a n d t h e so f twa r e e x c e pt i o n d i spa tche r m u s t e a c h know wh e n t h e o th e r i s c u r r e n t l y s e r v i c i ng a n except i on . Th i s is a c compl i shed by r e q u i r i ng b o t h d i s pa tc h e r s to c a l l c o nd i t i o n h a nd l e r s th r o ug h a c ommo n c a l l s i t e l o c a t ed in the s ys tem s e rv i c e v e c to r a r e a . 2 . 3 . 3 . 1 Commo n C a l l S i t e f o r Co nd i t i o n H a nd l e r s - Be fo r e t h e d i spa t c h to t h e h a nd l e r o c c u r s , t h e s t ac k i s s e t u p to c o n t a i n t h e s i g n a l a nd m e c h a n i s m a r r a ys a nd the h a nd l e r a rg um e n t l i s t ( F i g u r e 2- 4 ) . Th e h a nd l e r a d d r e s s i s l o ad ed i n to Rl by t h e h a nd l e r s e a r c h p r o c ed u r e a nd c o n t r o l i s pa s s e d to t h e c ommo n d i s pa t c h s i t e w i th t h e i n s t r uc t i o n JSB @ # SYS $ C A L L_HAND L Th e c o d e l o c a t ed a t SYS $ C A L L HAND L s i mp l y c a l l s the p r o c ed u r e ad d r e s s i s s to r ed i n R l a nd re t u r n s to i t s c a l l e r wi th a n RSB . wh o s e SYS $CALL HAND L : : CA L LG 4 ( SP) , (Rl ) RSB Th e c a l l i ns t r uc t i o n l e a v e s t h e r e t u r n ad d r e s s SYS $CALL HAND L + 4 , t h e ad d r e s s of t h e RSB i n s t r uc t i o n , i n i t s c a l l f r am e . Thu s , t h e un i q u e i d e n t i fy i ng c h a r a c t e r i s t i c o f a c o nd i t i o n h a nd l e r is the add r e s s SYS $CALL HANDL + 4 i n t h e s a v ed P C o f i t s c a l l f r am e . Th i s s i g n a t u r e i s n o t o nl y u s ed b y t h e s e a r c h p r o c ed u r e b u t a l s o by t h e Unwi n d s ys t em s e rv i c e , a s d e sc r i b ed b e l o w . 2- 2 0 C OND I T I ON HANDL ING 2 . 3. 3. 2 E x am pl e o f Mul t i p l y Ac t i ve S i g n a l s - Th e m o d i f i ed search p r o c ed u r e c a n b e s t b e i l l us t r a te d t h r o ug h a n e x am p l e . F i g ur e 2 - 5 s h ows the s t a c k a f t e r p r o c ed u r e c , c a l l ed f r om B c a l l ed f r om A , has g e n e r a t ed s ignal s. We a r e a s s um i ng th a t th e p r i m a r y a nd s e c o nd a r y c o nd i t i o n h a nd l e r s ( i f t h e y e x i s t ) r e s i g n a l l ed . Co nd i t i o n h a nd l e r CH a l s o r e s i g na l l ed . (1) P r o c ed u r e A c a l l s p r o c ed u r e B wh o c a l l s p r o c ed u r e (2) P r o c ed u r e C g e n e r a t e s s i g n a l (3) Th e search p r o c ed u r e m o d i f i e s e s t a b l i sh e r f r am e a rg um e n t . c. s. the d e pth I f we a s s um e t h a t h a nd l e r C H r e s i g n a l s , a rg um e n t i s 1 wh e n BH i s c a l l ed . a rg um e n t then the a nd d e p th (4) Th e c a l l f r am e f o r h a nd l e r B H i s l o c a t ed (at l o we r v i r t ua l add resses) on top o f the s i g n a l a nd m e c h a n i sm a r r a y s f o r s ig n a l S ( Fi g u r e 2- 6 ) . ( Th e o n l y i n t e r v e n i ng i t em s a r e the s aved r eg i s t e r s a nd s t a c k a l i g nm e n t b y t e s i nd i c a t ed b y t h e r eg i s t e r s a v e ma s k i n the u ppe r by t e o f t h e s e c ond l o n g wo r d o f t h e c a l l f r am e f o r h a nd l e r B H . ) Th e s av e d f r am e po i n t e r i n t h e c a l l f r a m e f o r B H p o i n t s t o th e f r am e f o r p r o c ed u r e C . (5) Hand l e r B H now { Fi g u r e 2-6 ) . (6) P r o c e d u r e Y g e n e r a te s s i g n a l f r am e s t o b e e x am i n ed i s : t h e n f r ame A . F r ame s B a n d C we r e e x am i n e d wh i l e s e r v i c i ng (7 ) Th e s e a r c h p r o c ed u r e p r o c e ed s i n i t s n o rm a l f a sh i o n . Th e p r i ma r y a nd s e c o nd a r y v e c to r s a r e e x am i n ed f i r s t ( no s k i pp i ng here) . Th e n f r am e s Y , X , a nd BH a r e e x am i n ed , r e s u l t i ng in h a nd l e r s YH , XH , a nd B H H b e i ng c a l l ed i n t u r n . Le t us a s s um e t h a t a l l t h e s e h a nd l e r s r e s i g n a l . Af t e r h a nd l e r BHH r e t u r n s to t h e d i s pa tc h e r w i th a c o d e o f S S $ R E S IGNAL , t h e s e a r c h p r o c ed u r e no t e s th a t th i s is t h e f ram e o f a c o nd i t i o n h a nd l e r , b e c a us e i ts s av e d PC is SYS $ C A L L HAND L + 4 ( Fi g u r e 2-6 ) . c alls p r o c ed u r e X wh o calls p r o c ed u r e Y T. Th e d e s i r ed s equenc e o f f r am e Y , f r am e X , f r ame B H , a nd s h o u l d b e s k i pped b e c a use they c o nd i t i o n S . - (8) Th e s k i pp i ng i s a c compl i s h ed by l o c a t i ng the f r ame th a t e s t a b l i sh e d th i s h a nd l e r . Th e add r e s s o f ' th a t f r ame i s l o c a t e d i n t h e m e c h a n i sm a r r a y f o r s i g n a l s . To l o c a t e t h e m e c h a n i sm a r r a y f o r s i g n a l S , t h e v a l u e o f SP b e f o r e t h e c a l l t o B H m u s t b e c a l c u l a t ed , u s i ng th e r e g i s t e r s av e m a s k a n d s t a c k a l i g nm e n t b i t s i n t h e c a l l f r am e . (9) One extra l o ng wo r d , the r eturn PC f r om the JSB to S Y S $ C A L L HAND L , mus t b e s k i pped t o l o c a t e the a rg umen t l i s t ( a n d t h us t h e me c h a n i sm a r r a y ) f o r s i g n a l s . 2-21 C OND I T I ON HANDLING Signal array Signal and mechanism arrays for signal T generated by procedure Y Depth RO R1 Name of signal T Other parameters Exception PC in Y Exception PSL Direction of stack growth YH Call frame for procedure Y Saved FP Return PC in X XH To call frame for procedure A in Figure 2-5 Call frame for 1---� procedure X Saved FP Return PC in BH +-- BHH R.S.M. Call frame fo r procedure BH I Saved FP G Dispatcher call site :::: ::: Saved registers and stack alignment bytes indicated by register save mask (R.S. M.) in call frame BH Return PC from JSB F i g u r e 2-6 �� 0 @ .. , To call fra me for procedu re C in Figure 2-5 Mod i f i ed S e a rch w i th Mu l t i pl y Ac t i v e S i g na l s 2-22 C OND I T I ON HANDL ING (10) B e c a us e t h e f r am e po i n t e d to b y t h e m e c h a n i sm a r r a y e l em e n t has a l r e a d y b e e n s e a r c h ed , t h e n e x t f r am e e x am i n ed b y t h e s e a r c h p r o c ed u r e i s t h e f r ame po i n t ed to b y t h e s a v ed f r am e po i n t e r i n t h e c a l l f r am e o f p r o c ed u r e B , wh i c h i n th i s c a s e i s t h e f r am e fo r p r o c ed u r e A . Th e d e p th s t h a t a r e pa s s ed to h a nd l e r s a s a r e s u l t o f t h e m o d i f i ed s e a r c h a r e 0 fo r Y H , 1 f o r XH , 2 f o r BHH , a n d 3 f o r AH . (11) Th e f r ame f o r the s e a r ch p r o c ed u r e o r fo r a n y o f t h e h a nd l e r s YH , XH , BHH , a nd AH wh en t h e y a r e c a l l ed wi l l b e l o c a t e d o n t o p o f t h e s i g n a l a nd m e ch a n i sm a r rays fo r s i g n a l T ( a t l owe r v i r t ua l addresses) . ( On e e x ampl e i s s h o wn i n F i g u r e 2 - 8 , wh i c h i l l ustra tes the opera t io n of the $ UNW I ND s ys t em s e rv i ce . ) 2. 4 C OND I T I ON HANDLER ACT I ON C o nd i t i o n h a nd l e r s h a v e s ev e r a l � p t i o n s a v a i l a b l e to them . 2. 4. 1 • Th e y c a n f i x t h e e x c e p t i o n a nd a l l o w e x ec u t i o n to c o n t i n ue a t t h e i n t e r r upted po i n t i n t h e p r og r am . • Th e y c a n p a s s the r e s i g n a l l i ng . • r e s um e at any a r b i t r a ry Th e y c a n a l s o a l l o w e x e c u t i o n to place in t h e c a l l i ng h i e r a r c h y by unwi nd i ng a n um b e r o f f r am e s f r om the c a l l s t a c k . except ion a l o ng to ano the r h a nd l e r by C o n t i n ue o r Re s i g n a l A h a nd l e r f i r s t d e t e rm i n e s t h e n a t u r e o f t h e e x c e p t i o n b y e x am i n i ng the s ignal name in the s i g n a l a r r a y ( Fi g u r e 2 - 4 ) . I f the h a nd l e r d e te rm i n e s t h a t i t i s n o t c a pa b l e o f r e so l v i ng t h e c u r r e n t e x c e p t i o n f o r wh a t e v e r r e a so n , it i n f o rm s t h e e x c ep t i o n d i spa t c h e r th a t t h e s e a r ch fo r a h a nd l e r m u s t g o o n . Th i s i s c a l l ed r e s i g n a l l i ng and is p e r f o rmed b y p a s s i ng a r e t u r n s t a t u s c o d e o f S S $ R E S IGNA L b a c k t o t h e d i spa tch e r . ( Re c a l l th a t c o nd i t i o n h a nd l e r s a r e -f un c t i o n p r o c ed u r e s t h a t r e t u r n a s t a t u s t o the i r c a l l e r i n R O . ) On t h e o th e r h a nd , i f t h e cond i t i o n h and l e r i s a b l e to r e so l v e the ex cept i o n ( i n s o m e u n s p e c i f i ed wa y ) , i t i nd i c a te s t o t h e d i s p a tc h e r t h a t t h e p r og r am t h a t wa s i n t e r r up t ed wh e n the e x c e p t i o n o c c u r r ed c an c o n t i n ue . Th i s 1 s d o ne b y p a s s i ng the r etur n s t a t us c o d e o f S S $_C ONT INUE b a c k t o t h e c a l l e r . Wh e n t h e d i s pa tc h e r d e t e c t s t h i s r e t u r n s t a t us c o d e , it r em o v e s the a rg um e n t l i s t a nd m e c h a n i sm a r r a y f r om t h e s t a c k ( Figure 2-4 ) , r e s to r i ng RO and Rl i n t h e p r o c e s s . I t t h e n r emov e s a l l o f t h e s i g na l a r r a y e x c e p t t h e e x c e p t i o n P C a n d PS L f r om t h e s t a c k . Fi nal l y , these a r e r emoved w i th t h e RE I i n s t r uc t i o n th a t d i sm i s s e s t h e e x c e p t i o n a nd pa sse s control back to t h e p r og r am th a t wa s i n t e r r up t e d wh e n t h e e x c e p t i o n o c c u r r ed . I f the ex c ep t i o n th a t o c c u r r ed wa s a h a r d wa r e f a u l t ( s u c h a s a n a c c e s s v i o l a t i o n ) , t h e i n s t r uc t i o n t h a t c a us ed t h e e x c e p t i o n w i l l b e r e p e a t e d b e c a u s e t h e PC o f t h a t i n s t r uc t i o n wa s pushed o n to t h e s ta c k wh e n t h e e x c e p t i o n o c c u r r ed . If the e x c ep t i o n wa s a h a r d wa r e t r a p ( s uc h a s i n teg e r o v e r f l o w ) ' t h e n e x t i n s t r uc t i o n i n t h e i n s t r uc t i o n s t r e am wi l l 2-2 3 COND I T I ON HANDL I NG be the f i rs t to execute . In th e e v e n t th a t a c o nd i t i o n h a nd l e r c o n t i n u e s f r om a n e x c e pt i o n th a t wa s i n i t i a t ed th r o ug h a call to L I B $ S I GNA L , t h e f i r s t i n s t r uc t i o n t o ex e c u t e w i l l be the i n s t r uc t i o n f o l l o w i ng the CALLx i n s t r uc t i o n . 2.4. 2 Unwi nd i ng t h e C a l l S t a c k An o th e r powe r f u l to o l a v a i l a b l e t o c o nd i t i o n hand l e r s a l l o ws t h em to al ter the f l ow o f cont r o l wh e n an ex c e p t i o n o c c u r s . Th i s t o o l i s c a l l ed u n w i nd i ng a n d a l l o ws t h e c o nd i t i o n h a nd l e r t o pa s s c o n t r o l b a c k to a p r ev i o u s l ev e l in the c a l l i ng h i e r a r c h y by th r o w i ng awa y a s pe c i f i ed ( o r d e f a u l t ) n um b e r o f c a l l f r am e s . Th e Unw i nd Ca l l S t a c k s ys t em s e rv i c e is c a l led w i th two o pt i o n a l a rg um e n t s , t h e f i r s t o f wh i c h i nd i c a t e s t h e n um b e r o f f r ame s t o r emove f r om t h e c a l l s t a c k a nd t h e s e c o nd of wh i c h g i v e s a n a l t e r n a t e return P C t o wh i c h c o n t r o l w i l l b e r e t u r n ed . Th e Unwi nd s ys t em s e rv i c e d o e s n o t a c t ua l l y r emove f r am e s f r om t h e s ta c k . Ra th e r , i t c h ang e s t h e r e t u r n PC i n t h e s p e c i f i e d n umbe r o f f r am e s t o po i n t t o a s pe c i a l r o u t i n e i n t h e execut ive th a t w i l l be e n t e r ed a s e a ch p r o c ed u r e e x i t s w i th a R E T i n s t r uc t i o n . Th e e f f ec t o f c a l l i ng Unw i nd is p i c t u r ed in Figure 2-7 . If the a l ternate PC a r g um e n t h a s a l so b e e n p a s s e d to Unwi n d , t h e r e t u r n PC i n the n e x t c a l l f r am e i s a l t e r ed to t h e s p e c i f i ed a rg um e n t ( F i g u r e 2 - 7 ) . As e a c h p r o c ed u r e i s s u e s a R E T i n s t r uc t i o n , c o n t r o l i s pa s s ed to the e x e c u t i v e r o ut i n e t h a t e x am i n e s th e c u r r e n t f r am e f o r the e x i s t e n c e o f a c o nd i t i o n h a nd l e r . I f s uc h a h a nd l e r e x i s t s , i t i s c a l l ed wi t h the e x c e p t i o n n am e SS$ UNW I N D . Wh e n the c o nd i t i o n h a nd l e r r e t u r n s to the unwi nd r o u t i n e , a RET i s i s s ued b y the unwi nd r o u t i n e on b e h a l f of the p r o c ed u r e t o d i sc a r d t h e c u r r e n t c a l l f r ame . Th i s s e q ue n c e g o e s on un t i l the s pec i f i ed n umbe r o f c a l l f r am e s h av e been d i s c a r d ed . Th i s t e c h n i que o f c a l l i ng h a nd l e r s a s a pa r t o f the unwi nd s e q u e n c e a l l o ws h a nd l e r s t h a t p r ev i o u s l y r e s i g n a l l ed an e x c ep t i o n to r eg a i n c o n t r o l a nd pe r fo rm p r o c ed u r e - s p e c i f i c c l e a n u p . 2.4.3 E x ampl e of U n w i nd i ng th e C a l l S t a c k An e x ampl e o f a n unwi nd s e quenc e i s i l l u s t r a t ed h e r e w i th t h e h e l p o f Figure 2-7 . Th e s i t ua t i o n b eg i n s wi th a s e q u e n c e e x a c t l y l i k e t h e o n e p i c t u r ed i n F i g u r e 2 - 5 . P r o c ed u r e A c a l l s p r o c ed u r e B who calls p r o c ed u r e c. P r o c ed u r e C g e n e r a t e s s ignal s. Th e p r i m a r y a nd s e c o nd a r y h a nd l e r s ( i f the y e x i s t ) s i mpl y r e s i g n a l . H a nd l e r s C H a nd BH , l o c a ted ne x t by t h e s e a r c h p r o c ed u r e , a l s o r e s i g n a l . 2-24 COND I T I ON HANDL I NG Return PCs in these frames after they have been modified by EXE$UNWIND Call fram e s on e ntry to EXE$UNWIN D SYS$UNWIND's h andler Call frame for system service SYS$UNWIND (EXE$UNWI N D executes i n access mode of caller.) � FP Saved AP Saved FP Return PC in AH Return PC i n A H AHH ( i f established) .Jill � This AP locates the signal and mechanism arravs passed to handler AH Call frame for condition handler AH Saved FP Return PC in exception dispatcher (SYS$CALL_HANDL � 4) Signal and mechanism arrays for initial condition located here (Figure 2-5) +- J STARTUNWI N D Signal array contains return PC in procedure C which is bypassed if u nwinding any frames CH (if established) Call frame for procedure C Saved FP Return PC in B LOOPUNWI N D 0 (alternate return PC) 0 BH (if established) Call frame for procedure B Saved FP Return PC in A AH Call frame for procedure A Saved FP Return PC in calle r of A previous call frame F i g u r e 2- 7 C a l l F r am e Mod i f i c a t i o n by SYS $ UNW I ND 2-2 5 C ONDI T I ON HANDL ING F i n a l l y , h a nd l e r AH i s c a l l ed . AH d e c i d e s to unw i nd the c a l l stack back to i t s e s ta b l i sh e r f r am e . ( Th i s i s n o t t h e d e f a ul t c a s e . ) To a c c ompl i sh th i s , AH m u s t c a l l SYS $ UNW I N D w i t h a d e pth a r g um e n t e q u a l to t h e v a l ue c o n t a i n e d i n t h e m e c h a n i sm a r r a y . I n th i s e x ampl e , the d e p th a rg um e n t is 2 . Af t e r the c a l l to SYS $ UNWI ND , wh i c h e x e c u t e s in the a c c e s s m o d e o f i ts c a l l e r , b u t b e fo r e the f r am e mod i f i c a t i o n o c c u r s , t h e s t a c k h a s t h e fo rm p i c t u r ed on the l e f t h and side of Figure 2-7 . Th e o pe r a t i o n o f f r ame mo d i f i c a t i o n b y t h e $ UNW I ND s ys tem s e rv i c e n o w p r o c e e d s a s fo l l o ws . (1) Unwi nd l o o k s b a c k d o wn the c a l l s t ac k un t i l i t l ocates a c o nd i t i o n h a nd l e r . Re c a l l th a t a c o nd i t i o n h a nd l e r is i d e n t i f i ed b y a s av e d PC o f SYS $CALL HAND L + 4 . I f h a nd l e r A H h a d c a l l ed another p r o c ed u r e - i n th i s e x am p l e , no th i ng wo u l d h a v e h a pp e n e d to th a t p r o c ed u r e ' s c a l l f r am e . Th e f i r s t c a l l f r am e m od i f i ed by Unw i nd i s t h e f r am e o f the f i r s t h a nd l e r t h a t i t e nc o un t e r s , wh i c h in th i s e x amp l e is the f r am e fo r AH . (2) Unwi nd d o e s n o t mod i fy i t s o wn f r am e . c o n t r o l i s p a s s ed b a c k to h a nd l e r A H . (3) Th e f i r s t f r am e th a t Unwi nd mo d i f i e s is the f r am e o f the f i r s t c o nd i t i o n h a nd l e r th a t i t e nc o un t e r s b y t r a c i ng bac k the c a l l s t ac k . I t r epl aces the r et u r n add r e s s f o und the r e w i th the a d d r ess of a rout ine ( S TARTUNW I N D ) i n t e r n a l to i ts e l f . Wh e n i t i s s ue s a RET , Wh e n h a nd l e r AH i s s ue s i t s RE T , c o n t r o l w i l l n o t g o b a c k to th e e x c ep t i o n d i spa tc h e r . I n s t e ad , the i n s t r uc t i o n s b e g i nn i ng a t STARTUNW I N D e x e c u t e . No t e t h a t n o t r e t u r n i ng t o t h e e x c e p t i o n d i s pa tc h e r m e a ns th a t c o n t r o l w i l l n eve r g e t b a c k t o p r o c ed u r e C , b e c a u s e i t s r e t u r n P C i s s to r ed in the m e c h a n i sm a r r a y a nd wo u l d b e r e s to r ed b y t h e RE I i n s t r uc t i o n i s s ued b y t h e e x c e p t i o n d i spa t c h e r . (4) Unwi nd c on t i nues to mod i f y t h e s a v ed PC l o ngwo r d s in s uc c e s s i v e f r am e s o n the c a l l stack un t i l t h e n umb e r o f f r am e s s pe c i f i e d ( o r i m p l i ed ) i n t h e SYS $ U NW I N D a r g um e n t l i s t h a v e b e e n mo d i f i ed . Al l f r am e s e x c ep t the fi r s t h a v e the i r s a ved PC r e p l a c ed w i th a d d r e s s LOO PUNW I N D , a n o t h e r l a be l in t h e i n t e r n a l unw i nd r o u t i n e ( F i g u r e 2 - 7 ) . I t i s th i s r o u t i n e that checks wh e th e r the c u r r e n t f r am e h a s a h a nd l e r e s t a b l i s hed and , if so , c a l l s t h a t h a nd l e r w i th t h e s i g n a l n am e S S $ U NW I ND to a l low the h a nd l e r to pe r f o rm p r o c ed u r e -sp e c i f i c c l e a n u p . I f a h a nd l e r c a l l ed i n th i s wa y c a l l s SYS $ UNW I N D ( w i th the s ignal a r r a y c o n t a i n i ng SS$ U NW I ND as the s i g n a l nam e ) , an e r r o r s t a t u s of SS$ U NW I N D I NG T s r e t u r n ed , i nd i c a t i ng th a t a n unwi nd i s a l r e a d y i n p r og r e s s . (5) I f the a l t e r n a t e PC a r g um e n t wa s a l s o s uppl i ed to SYS $ UNW I ND , t h e c a l l f r ame i n to wh i ch th i s a rg um e n t wo u l d be i n s e r t ed i s t h e n e x t f r am e b eyo nd the l a s t f r am e s p e c i f i ed (or i m p l i ed ) in the f i rs t SYS $ UNWIND a r g um e n t . In th i s c a se , i f a n a l t e r n a t e P C a r g um e n t we r e p r e s e n t , i t wo u l d b e p l a c ed i n to the c a l l f r am e fo r p r o c ed u r e A . 2-26 C OND I T I ON HANDL ING Now t h a t a l l the f r am e s h a v e b e e n mo d i f i e d , the a c t ua l un w i nd i ng occurs . Th e s e q u e n c e o f s t eps i s a pp r o x i m a t e l y t h e f o l l o w i ng . 1. Unw i nd r e t u r n s c o n t r o l t o h a nd l e r AH . 2. Ha n d l e r AH d o e s wh a t ev e r e l s e i t n e ed s to d o to s e rv i c e the c o nd i t i o n . Wh e n i t h a s c om p l e t ed i t s wo r k , i t r e t u r n s t o th e c o d e b e g i n n i ng a t l abel STA RTUNW I ND i n mod u l e S Y S UNW I ND . ( Be c a us e n o n e o f the unwi nd r o u t i n e s c h e c k r e t u r n s t a t u s , i t d o e s n o t ma t t e r wh a t s t a t us i s p a s s ed b a c k b y AH a s it returns . ) 3. Th e r o u t i n e b eg i nn i ng a t S TARTUNW I ND f i r s t r e s t o r e s R O a nd R l f r om t h e m e c h a n i sm a r ray . I t then pe r f o rm s t h e fo l l o w i ng th r e e s t e ps . a. I f a h a nd l e r i s e s ta b l i sh ed fo r th i s f r ame , i s c a l l ed w i th the s i g n a l n am e S S $_UNW I ND . the h a nd l e r b. I f e i th e r R O o r Rl i s s pe c i f i ed in the r eg i s te r save ma s k , the unwi nd rout i ne r eplaces the v a l ue o f th a t r e g i s t e r i n t h e r eg i s t e r s a v e a r ea o f the c a l l f r am e wi th t h e c u r r e n t c o n t e n t s o f t h e r eg i s t e r . c. Co n t r o l i s r e t u r n ed t o wh a t ev e r ad d r e s s i s th e s aved PC l o ng wo r d of the c u r r e n t i s s u i ng a RE T . s pe c i f i ed in c a l l f r am e b y 4. Th e RET i s sued in s tep 3c d i sc a r d s the c a l l f r am e fo r p r o c ed u r e C , p a s s i ng c o n t r o l to LOOPUNW I N D wh e r e the th r e e s t e p s 3 a t h r o ug h 3 c a r e a g a i n e x e c u t ed . 5. Th e R E T t h a t d i s c a r d s the c a l l f r am e f o r p r o c e d u r e B pa sses control back t o t h e po i n t i n p r o c ed u r e A f o l l o w i ng t h e c a l l to p r o c ed u r e B ( i f we a s s ume no a l t e r n a t e PC a r g um e n t ) wh e r e e x ec u t i o n w i l l r e s ume . I n e f f e c t , S TARTUNW I ND a nd LOOPUNW I N D s i mul a t e r e t u r ns f r om each n e s t ed p r o c ed u r e t h a t is b e i ng unwo und . Th e s e p r o c ed u r e s n ev e r r ec e i ve c on t r o l aga i n . Howeve r , t h e o u t e rmo s t p r o c ed u r e r ec e i ves c o n t r o l a s i f a l l o f the n e s t ed p r o c ed u r e s h ad r e t u r ned no rm a l l y . 2. 4.4 Po t en t i a l I n f i n i t e Lo o p Th e r e i s o n e po s s i b l e p i tf a l l that can h a ppe n w i th th i s I n the p r ev 1 o u s s e c t i o n , we po i n t e d o u t th a t the i mpl em e n t a t i o n . e x c ep t i o n d i s pa tc h e r t a k e s c a r e ( wh e n m u l t i pl e s i g n a l s a r e a c t i v e ) no t to sea r ch f r am e s f o r the s e c ond c o nd i t i o n th a t we r e e x am i n ed o n t h e f i r s t pa s s . I f a c o nd i t i o n h a nd l e r g e n e r a t e s a n e x c e p t i o n , i t i s n o t c a l l ed i n r e s po n s e to i t s o wn s i g n a l ( un l e s s i t e s t a b l i sh e s i t s e l f t o h a nd l e i t s o wn s i g n a l s ! ) . Ho we v e r , Unw i nd c a nno t pe r f o rm s uc h a check . I t must cal l each c o nd i t i o n h a nd l e r th a t i t e nc o un te r s a s i t r em o v e s f r am e s f r om t h e s ta c k . Th u s , a poo r l y wr i t t e n c o nd i t i o n h a n d l e r ( o n e th a t g e n e r a t e s an ex cept i on ) c o ul d resul t in a n i n f i n i te l oo p of e x c ept i o n s i f a h a nd l e r h i g h e r up i n th e c a l l i ng h i e r a r c h y unwi nd s the f r am e i n wh i c h th i s po o r l y wr i t t e n h a nd l e r i s d e c l a r ed . Th i s h a s no e f f e c t o n t h e s ys tem b u t e f f e c t i v e l y d e s t r o ys t h e p r o c e s s in wh i ch th i s h a nd l e r ex i s ts . 2-27 C OND I T I ON HANDL ING Unwi nd i ng Mul t i p l y Ac t i ve S i g na l s 2.4.5 Th e r e i s a s l i g h t c h a ng e t o th e Unw i nd s y s t em s e rv i c e wh en m u l t i pl e s i g na l s a r e a c t i v e . Wh i l e m o d i f y i ng saved PCs i n c a l l f r ame s , Unwi nd c o un t s the n um b e r of f r am e s t h a t h a v e b e e n m o d i f i ed un t i l the r e que s ted n um b e r h a s b e en r e a c h e d . Th e o n l y c h a ng e th a t o c c u r s w i th m u l t i pl y a c t i v e s i g n a l s i s t h a t the l o o p s to p s c o un t i ng wh i l e the s k i pped f r am e s a r e b e i ng m o d i f i e d . Th e e x ampl e o f m u l t i pl y a c t i v e s i g n a l s p i c t u r ed i n F i g u r e s 2 - 5 and 2 - 6 can be used to i l lustrate th i s . Re c a l l t h a t p r o c ed u r e A c a l l ed p r o c ed u r e B wh o c a l l ed p r o c ed u r e C wh o s i g n a l l ed S. Hand l e r CH r e s i g n a l l ed . Hand l e r B H c a l l ed p r o c ed u r e X who c a l l ed p r o c ed u r e Y wh o s i g n a l l ed T . Hand l e r s Y H , XH , and BHH a l l r e s i g n a l l ed . F i nal l y , h a nd l e r A H wa s c a l l ed f o r s i g n a l T w i th a d e p th o f 3 . I f AH c a l l s SYS $UNW I ND , t h e top o f the s tack i s a s p i c t u r ed in Figure 2-8 , w i th t h e c o n t i n ua t i o n s o f th i s f i g u r e i n F i g u r e 2 - 6 . Le t u s f u r the r a s s ume t h a t t h e d e p th a rg um e n t pa s s e d to SYS $ UNW I N D i s 3, t a ke n f r om the m e ch a n i sm a r r a y ( me a n i ng unw i nd t o the e s t a b l i s h e r o f AH ) a n d t h e a l t e r n a t e P C a r g um e n t i s n o t p r e s e n t . Th e e nd r e s u l t o f the o pe r a t i o n o f Unwi nd i n th i s c a s e i s a s fo l l o ws . 2. 5 1. locates it a Unw i nd l o o k s b a c k d own the c a l l stack un t i l Th e s a v ed PC i s c o nd i t i o n h a nd l e r , wh i c h i n th i s c a s e i s AH . m o d i f i e d t o START UNW I N D . 2. Th e s a ved PC l o ng wo r d s i n f r am e s Y a nd X a r e a l t e r ed to conta i n add ress L O O PUNW I N D . No t e th a t we h a v e now a l t e r ed th r e e f r am e s . 3. Be c a use the nex t f r ame on the s tac k , BH , i nd i c a t e s a c o nd i t i o n h a n d l e r ( s aved PC o f SYS $CALL HANDL + 4 ) , i ts a s s o c i a t ed m e c h a n i sm a r r a y i s l o c a t ed ( by c lim b i ng o v e r s a v ed r eg i s te r s , s t a c k a l i g nm e n t byt e s , a n d a s a ved PC f r om th e J S B i n s t r uc t i o n ) . Th e s a v e d PC s i n a l l f r am e s up t o the f r am e po i n t ed to by t h e m e c h a n i sm a r r a y a r e m o d i f i ed ( b u t n o t c o un t ed t owa r d t h e n um b e r s pe c i f i ed i n t h e a r g um e n t pa s s ed to SYS $ UNW I N D ) to c o nta i n add r ess L O O PUNW I ND . Th i s c a u s e s f r am e s B H a n d C to get the i r s av ed PCs a l te r ed in the e x ampl e . 4. Th e saved PC i n t h e f r am e fo r p r o c ed u r e B i s no t a l t e r ed so t h a t wh e n t h e unwi nd t a k e s p l a c e , c o n t r o l wi l l r e t u r n to the c a l l s i t e o f p r o c ed u r e B i n p r o c ed u r e A . DEFAULT ( VMS-S U P PL I E D ) C OND I T I ON HANDLERS A l t h o ug h the use o f c o nd i t i o n h a nd l e r s is total ly g eneral a nd c ompl e t e l y i n the h a nd s o f t h e u s e r , s om e a c t i o n s wi l l a l wa ys o c c u r a s t h e r e s u l t o f d e fa u l t c o nd i t i o n h a nd l e r s th a t a r e e s t ab l i s h e d b y VM S a s a pa r t o f p r o c e s s c r e a t i o n o r i m a g e a c t i v a t i o n . Th e d i sc u s s i o n s o f p r o c e s s c r e a t i o n i n Ch a p t e r 1 7 a nd i m a g e i n i t i a t i o n in C h a p t e r 1 8 po i n t out ex a c t l y wh en a nd h o w e a ch o f t h e h a nd l e r s d e sc r i b ed i n th i s s e c t i o n i s e s t a b l i shed . Th e a c t i o n o f e a c h o f th e s e h a nd l e r s , o n c e t h e y a r e i nv o k e d , i s b r i e f l y d e sc r i b ed h e r e . 2-28 C OND I T I ON HANDL ING SYS$UNWIND's handler Call frame for system service SYS$UNWIN D (EXE$UNWIND executes in access mode of caller) FP Saved AP Saved FP Return PC in AH """".... AHH (if established) Call frame for condition handler AH R.S.M. I Direction of stack growth - Saved FP Return PC in exception dispatcher ::� Saved registers and stack alignment bytes indicated by register save mask R.S.M. in call frame AH �� ::;:; To fram e for proced ure Y in Figure 2-6 Return PC fro m JSB Signal and mechanism arrays for signal T Sig nal array M echanism array I 2 - ��.I �, ,.. -.,., To signal array in Figure 2-6 Figure 2-8 Mod i f i ed Un w i nd w i th Mu l t i pl y Ac t i v e S i g n a l s 2-2 9 C OND I T I ON HANDL ING 2.5.1 T r a c e b a c k Hand l e r E s tab l i s h ed by Imag e S t a r t up Wh e n a n imag e i n c l ud e s e i th e r the d eb ug g e r o r t h e t r a c eb a c k h a nd l e r , a n o th e r f r am e is put on t h e u s e r s t a c k b e fo r e t h e i m ag e i t s e l f i s c a l l ed ( Ch a p t e r 1 8 ) . Th e c o d e th a t e x e c u t e s b e fo r e c a l l i ng the i m ag e pl aces the add r e s s of a c o nd i t i o n h a nd l e r i n to th i s f r ame s o th a t s ub s e q ue n t c o nd i t i o n s th a t a r e n o t h a nd l ed b y a n i n t e r v e n i ng c o nd i t i o n h a nd l e r w i l l be p i c k e d up b y t h i s t r a c eb a c k h a nd l e r . Th i s h a nd l e r f i r s t c h e c k s wh e th e r the e x c e p t i o n t h a t o c c u r r ed wa s I f s o , i t m a ps the d e b ug g e r i n t o P O s p a c e ( i f n o t a l r e a d y S S $ D E B UG . m a pped ) a n d pa sse s c o n t r o l to i t . Th i s c o nd i t i o n i s s i g n a l l ed by a C L I i n r e s po n s e to a D E B UG c omma nd . Th i s f e a t u r e a l l o ws a n i m ag e th a t wa s n o t l i n k e d o r r un w i t h d eb ug g e r s uppo r t t o b e i n t e r r upted a n d have that s uppo r t a d d ed . Fo r a l l o the r e x c e p t i o n s , i f t h e s ev e r i t y l ev e l i s wa r n i ng , e r ro r , or s ev e r e e r r o r , the h a nd l e r m a ps th e t r ac eb a c k f a c i l i ty i n to the t o p o f P O s p a c e a nd pa s s e s c o n t r o l t o it. Th e t r ac ebac k f a c i l i ty p a s s e s i n f o rm a t i o n a b o u t t h e except ion to S Y S $ 0 UTPUT a nd t e rm i n a t e s the i m ag e . I f the s ev e r i ty l ev e l i s o the r t h a n the th r e e l i s t ed i n the p r ev i o us p a r ag r a ph , t h e t r a c e b a c k c o nd i t i o n h a nd l e r r e s i g n a l s the c o nd i t i o n , wh i c h u s ua l l y m e a n s t h a t the c o nd i t i o n i s b e i ng pa s s e d o n to th e c a tc h a l l c o ud i t i o n h a nd l e r . 2. 5. 2 C a t c h Al l C o nd i t i o n Ha nd l e r Th e a d d r e s s o f th i s h a nd l e r i s pl a c ed i n a n i n i t i a l c a l l f r ame o n the use r stack a nd in the l a s t c h a n c e ex c e p t i o n v e c t o r f o r user m o d e by e i the r PROC S TRT wh e n the p r o c e s s i s c r ea ted or by a c ommand l a ng uage i nterprete r b e f o r e a n i m ag e i s c a l l e d . Th i s h a nd l e r i s a l wa ys c a l l ed i f no o th e r h a nd l e r s e x i s t o r i f a l l o th e r h a nd l e r s r e s i g n a l . Bec ause t h e ad d r e s s o f t h e h a nd l e r i s d u pl i c a t ed i n th e l a s t c h a n c e v e c to r , i t w i l l a l s o b e c a l l ed i n the e v e n t o f some e r r o r wh i l e l o o k i ng th r o ug h t h e us e r s t a c k . Th e f i rst s t ep t h a t th i s h a nd l e r takes is to c a l l SYS $ P UTM SG ( Ch a p t e r 2 7 ) . If the h a nd l e r wa s c a l l e d th r o ug h t h e l a s t c h a n c e e x c e p t i o n v e c t o r ( d epth a r g um e n t i n m e c h a n i sm a r r a y i s - 3 ) , o r i f t h e s e ve r i t y l ev e l of the e x c e p t i o n n ame i n th e s i g n a l a r r a y i nd i c a t e s s eve r e ( e x c e p t i o n - n a m e < 2 : 0 > G E QU 4 ) , th en SYS $ E XCMSG ( Ch a p t e r 2 7 ) is c a l l ed t o pr int a s umma r y m e s s ag e a nd the i m ag e i s t e rm i n a t e d . O t h e r w i s e , t h e i m a g e i s c o n t i n u ed . 2. 5. 3 H a nd l e r s U s e d by O th e r Ac c e s s Mod e s I n a d d i t i o n t o the h a nd l e r s th a t VM S s uppl i e s t o h a nd l e e x c e p t i o n s that o c c u r i n u s e r m o d e , i t a l s o s e t s up h a nd l e r s t h a t wi l l d e t e rm i n e s ys tem b e h a v i o r i f a n e x c e p t i o n o c c u r s i n one o f the o the r th r e e access modes . 2-3 0 C OND I T I ON HANDLING 2 . 5. 3. 1 E x c e p t i o n s i n K e r n e l o r E x e c ut i v e Mo d e - I n r e s po n s e to an e x c ept i o n in k e rne l mode , t h e e x c e p t i o n d i spa tc h e r ma k e s s pe c i a l c h e c k s t o d e t e rm i n e wh e th e r the p r oc e s so r wa s o pe r a t i ng on the i n t e r r up t s t a c k wh e n t h e ex c e p t i o n o c c u r r ed o r wh e th e r I P L wa s a b o v e I PL $ ASTDE L ( I P L 2 ) . E i t h e r o f t h e s e i t ems c o u l d i nd i c a t e th a t the I n any c a s e , i f e i th e r o f e x c ept i o n i s n o t a s s o c i a t ed w i th a p r o c e s s . t h e s e c o nd i t i o n s h o l d s , an Inva l i d Ex c e p t i o n fatal b ug ch e c k ( BUG $ I NVE XC E PTN ) i s g e n e r a t ed . Ro u t i n e s wh i c h f a l l i n to the c a t eg o r y t h a t fo r b i d s e x c e p t i o n s i n c l ud e i n te r r up t s e rv i c e rout ines , d ev i c e d r ivers ( e x c e pt f o r t h e i r FDT r o u t i n e s ) , a nd p r o c e s s - b a sed c o d e th a t h a ppe ns t o b e ex e c u t i ng a b o v e I P L $ A S TDE L ( s uc h a s po r t i o n s o f c e r ta i n s ys t em s e rv i c e s ) . I f a ke r ne l m o d e e x c e p t i o n i s a s so c i a t ed w i th p r o c e s s - b a sed code fo r wh i ch e x c ept i on s a r e a l l o we d ( I P L i s l e s s th a n o r e q ua l to 2 a n d t h e e x c e pt i o n o c c u r r ed o n th e k e r n e l s t a c k ) , th en e x c e p t i o n d i s p a t c h i ng p r o c e ed s i n i t s usual manne r . Th e p r i m a r y e x c e p t i o n v e c to r s f o r bo th ke r n e l a nd exec ut i ve mod e s are i n i t i a l i zed in modul e SHELL ( Ch a p t e r 1 7 ) to c o n t a i n the add resses o f r o u t i n e s th a t g e n e r a t e a b ug c h e c k c o d e o f Un e x pe c t ed Sy s t em Se r v i c e E x c e p t i o n . Th e d i f f e r e n c e b e twe e n t h e b ug c h e c k s f o r t h e two a c c e s s m o d e s i s t h a t t h e b ug c h e c k g e n e r a t e d b y t h e k e r n e l m o d e p r i m a r y ex c e p t i o n h a nd l e r i s f a t a l wh i l e t h e c o r r e s po nd i ng b ug c h e c k g e n e r a t ed by t h e e x e c u t i v e m o d e p r i m a r y e x c e p t i o n v e c to r i s n o t . Fa t a l b ug c h e c k s c a u s e the s ys tem t o c r a s h . No n f a t a l b ug c h e c k s resul t in e rror l og entr ies . Th e b ug c h e c k o pe r a t i o n i s d e sc r i b ed i n Ch a p t e r 7 . Th i s m e a n s th a t i f a n ex c e p t i o n eve r o c c u r s wh i l e the s ys tem is in e i th e r k e r n e l o r e x e c u t i v e m o d e , t h e s ys t em w i l l b ug c h e c k b e c a u s e t h e p r i m a r y e x c e p t i o n v e c to r ' s h a nd l e r is f o und f i rst . Ro u t i n e s th a t e x e c u t e i n e x e c u t i v e m o d e i n c l ud e RM S , pa r t s o f the e x e c u t i v e , a nd a n y u s e r -wr i t t e n p r o c ed u r e t h a t i s e n t e r ed th r o ug h e i th e r a u s e r -w r i t t e n s ys tem s e rv i c e d i s pa tc h e r or t h r o ug h t h e Ch a ng e Mo d e t o E x e c u t i v e s ys tem s e rv i c e . Ro u t i n e s th a t e x e c u t e i n ke r n e l m o d e ( th a t c a n c a us e th i s b ug c h e c k a nd no t t h e I nv a l i d Ex c e p t i o n b ug c h e c k b e c a u s e t h e y e x ec u t e a t I P L 0 o r I P L 2 ) i n c l ud e po r t i o n s o f al l s ys tem s e r v i c e s , m a n y e x c e p t i o n s e r v i c e r o u t i n e s , d ev i c e d r i v e r FDT r o u t i n e s , i n c l ud i ng tho s e th a t a r e wr i t t e n b y u s e r s , a nd p r o c ed u r e s th a t a r e c a l l ed b y t h e e i th e r a use r -w r i t t e n s ys tem s e rv i c e d i s pa tc h e r o r b y t h e Ch a ng e Mo d e t o Ke r n e l s ys t em s e r v i c e . 2 . 5 . 3 . 2 Cond i t i o n H a nd l e r U s e d b y DC L o r MCR - Th e DC L a nd MCR c o mmand l a ng u a g e i n te r p r ete r s e s t a b l i s h n e a r l y i d e n t i c a l c o nd i t i o n h a nd l e r s a t the b eg i n n i ng o f t h e i r c ommand l o o p s to f i el d except i ons t h a t o c c u r i n s upe r v i so r mo d e . Th e f i r s t s t e p t h a t t h e c o nd i t i o n h a nd l e r t a k e s i s to a l t e r the entry po i n t c o n t a i n ed in the s u pe rv i so r m o d e t e rm i n a t i o n h a nd l e r c o n t r o l b l o c k f r om i t s n o rm a l c o n t e n t s t o a p r o c ed u r e tha t s i mpl y r e t u r n s s uc c e s s f u l l y . Th i s s t ep c a u s e s s upe r v i so r m o d e e x c e p t i o n s ( e x c e p t i o n s e nc o un te r ed wh i l e t h e C L I is e x e c u t i ng ) , to r esul t in process deletion . ( As we wi l l s e e i n Ch a p t e r 2 0 , t h e m e a n s b y wh i c h a C L I p r events p r o c e s s d e l et i on f o l l o w i ng i m a g e ex i t is th r o ug h the s up e rv i s o r m o d e t e rm i n a t i o n h a nd l e r tha t h a s j u s t b e e n e l i m i n a t e d . ) 2-31 C OND I T I ON HANDL ING Th e o n l y o th e r s t e p t a k e n by t h e s up e r v i s o r m o d e c o nd i t i o n h a nd l e r is t o cal l t h e c a tc h a l l h and l e r d i r e c t l y , w i th a d e pth a rg um e n t o f - 3 . As we s a w i n t h e d e sc r i pt i o n o f t h e c a t c h al l h a nd l e r , wh e n it is c a l l ed t h r o u g h t h e l a s t c h a n c e v e c to r ( d e t e rm i n ed b y a d e p t h a r g um e n t o f - 3 ) , i t fo r c e s i mag e e x i t . Th u s , an exc ept ion i n c u r red wh i l e e x e c u t i ng in s upe r v i so r m o d e r e s u l t s i n p r o c e s s d e l e t i o n , a f t e r some m e s s a g e s have b e e n sent to SYS $ 0 UT P U T ( a n d po s s i b l y SYS $ ERROR ) . 2-3 2 C HAPTER 3 SYSTEM SERVI C E D I S PATCH ING Ma n y o f the o pe r a t i o n s th a t VMS p e r f o r m s o n b e h a l f o f the user are i m p l emen ted a s p r o c ed u r e s c a l l ed s y s tem s e rv i c e s . Th e s e p r o c ed u r e s a r e l i n ked a s pa r t o f t h e e x e c u t i v e , reside in s y s t em space , have g l o ba l e n t r y p o i n t n am e s o f the f o rm EXE $ s e r v i c e , a nd t yp i c a l l y e x ec u t e i n k e r n e l o r e x e c u t i v e a c c e s s mod e s o th a t t h e y c a n r e a d or wr i t e d a ta s t r uc t u r e s p r o t e c t ed f r om a c c e s s by l e s s p r i v i l eg ed a c c e s s mod es . Some s e r v i c e s a r e i nvo ked d i r e c t l y by a ppl i c a t i o n p r og r am s . O t h e r s a r e c a l l ed o n b e h a l f o f t h e u s e r by c ompo n e n t s s uc h a s RM S . Th i s c h apte r d e s c r i b e s h o w c o n t r o l i s pa s sed f r om a u s e r p r og r am to t h e p r o c ed u r e s i n the e x e c u t i v e t h a t e x e c u t e s e r v i c e - s pec i f i c co d e . 3. 1 SYS TEM S ERVI C E VECTORS Th e l o we s t t h r e e pag e s o f s ys tem v i r t ua l add r e s s s pa c e ( add r e s s e s 8 0000000 to 8 0 00 05FF) are r e se rved fo r en t r y po i n t s t o t h e s ys t em s e rv i c e s a nd to RM S s e r v i c e r o u t i n e s . Th e g l o b a l e n t r y po i n t nam e o f e ach s ys tem s e rv i c e v e c t o r is SY S $ s e rv i c e , a s d i s t i ng u i s h e d f r om E XE $ s e rv i c e , the g l ob a l name of t h e p r o c ed u r e in the execut i ve i m ag e t h a t pe r fo rm s t h e a c t ua l wo r k o f t h e s ys tem se r v i c e . As n e w s e rv i c e s a r e a d d ed to f u t u r e r e l e a s e s o f VAX/VM S , t h e v e c to r a r ea w i l l g r o w t o ma k e r o om fo r n e w e n t r y po i n t s . I n ad d i t i o n , t h e a bso l ute l oc a t i ons of the SYS $ s e r v i c e entry po i n t s of ex i s t i ng s e rv i c e s w i l l r ema i n f i x ed fo r ev e r , s o t h a t ex i s t i ng us e r p r o g r am s w i l l no t h a v e t o b e r e l i n k e d a t e a c h n ew r e l e a s e o f VM S . E a c h s e rv i c e e n t r y po i n t c o n ta i n s e i g h t b y t e s o f c o d e a nd d a t a c a l l ed a sys tem s e rv i c e v e c t o r . E a c h v e c to r c o n s i s t s o f a g l o b a l en t r y po i n t n amed SYS $ s e rv i c e , a r eg i s t e r s a v e m a s k , a s i ng l e i n s t r uc t ion th a t t r a n s fe r s cont r o l e v e n t ua l l y t o a s e r v i c e- s p e c i f i c p r o c ed u r e i n th e e x e c u t i v e , a nd a n i n s t r uc t i o n ( u s ua l l y a RE T ) t h a t pa s s e s c o n t r o l b a c k t o th e c a l l e r . Mo s t o f t h e s ys t em s e r v i c e s e x e c u t e i n k e r n e l mod e a nd t h e v e c to r s f o r th e s e s e r v i c e s c o n t a i n a C HMK i n s t r uc t i o n . A f ew s e rv i c e s a nd all of the RMS s e r v i c e v e c t o r s c o n t a i n a C HM E i n s t r uc t i o n . S o m e se r v i c e s s uc h a s the tex t fo rma t t i ng serv ices exec ute i n t h e a c c e s s m o d e o f the c a l l e r a nd d i s pa t c h d i r e c t l y t o th e s e rv i c e - s p e c i f i c c o d e i n VM S w i th a JMP i n s t r uc t i o n . Figure 3-1 i l l u s t r a t e s t h e th r e e s e t s o f i n s t r uc t i o ns f o und i n th e sys t em s e r v i c e v e c to r a r ea . Ta b l e 3 - 1 l i s t s t h e VM S s ys t em s e r v i c e s th a t u s e e a c h o f t h e th r e e i l l us t r a t ed m e tho d s o f i n i t i a l d i s pa tc h . 3-1 SYSTEM SERVIC E D I S PATCH ING Ve c to r c on t e n t s fo r s e rv i c e s tha t c ha ng e mod e to ke r ne l S YS $ s e rv i c e : : ; En t r y po i n t fo r s e r v i c e s tha t ; e x e c u t e i n k e r ne l mod e . WOR D e n t r y-ma s k C HMK # s e rv i c e- spec i f i c - c o d e RET . B LKB ; Th i s m a s k i s i d en t i c a l to the ; ma s k f o und at l oc a t i o n ; E XE $ s e rv i c e ; Re t u r n to c a l l e r ; Sp a r e b y t e to m a k e vec to r ; e i g h t b yt e s l o ng 1 Ve c to r c o n te n t s fo r se r v i c e s tha t c ha ng e mod e to ex ecut i v e ; E n t r y po i n t fo r se r v i c e s tha t ; e x ec ut e i n ex ecut i v e mod e S YS $ s e rv i c e : : . WORD e n t r y -ma s k C HM E # s e r v i c e- s pec i f i c -c o d e ; Re t u r n to c a l l e r RET . B LKB ; Th i s m a s k i s i d en t i c a l to the ; ma s k f o und at l o c a t i o n ; E XE $ s e r v i c e ; Sp a r e b yt e to make v e c to r ; e i g h t b y t e s l o ng 1 ; Mo s t v e c to r s fo r RM S s e r v i c e c a l l s r epl a c e t h e se l a st t wo ; byt e s wi th a b r a n c h to an RM S s yn c h r o n i za t i o n r o ut i n e . Ve c to r c o n te n t s fo r s e r v i c e s tha t d o no t c h a ng e mod e ; En t r y po i n t fo r se r v i c e s th a t ; e x ec u t e i n the a c c e s s mod e ; o f the cal l e r S YS $ s e rv i c e : : . WORD e n t r y-ma s k JM P @ # E XE $ s e r v i c e + 2 ; ; F i g ure 3 -1 ; Th i s m a s k i s i d en t i c a l t o the ; ma s k fo und at l o c a t i o n ; E XE $ s e rv i c e ; T r a n s f e r c o n t r o l to f i r s t i n s t r uc t i o n a f t e r the e n t r y m a s k a t EXE $ s e r v i c e C o n t e n t s o f t h e Sys t em Se r v i c e Ve c to r s 3-2 SYS TEM S E RVI C E D I S PATC H ING Ta b l e 3 - 1 S y s t em Se r v i c e s a nd RM S Se r v i c e s Th a t Us e Ea c h Fo rm o f Sys t em Se r v i c e Ve c to r Th e s e s ys t em s e rv i c e s i n i t i a l l y e x ec u t e i n ke r ne l mod e . A DJS TK ADJW S L AL LOC ASC EFC A S S IGN B RDC S T CANC E L C ANE XH CANT IM CANWAK C LR EF C M KR N L C NTREG C R E LOG C REMB X C R E PRC C RETVA C RM PSC DAC EFC DA L LOC DA S S GN DC LAS T DC LCMH DC LEXH DE L LOG DE LM B X DE L PRC DE LTVA DE R LM B DGB LSC DLC EFC EXI T E XPREG F ORC E X GETC HN GETDEV G E TJ P I G E TPT I H I B ER LC KPAG LKW S E T MGB LSC PURGW S QIO Q I OW R EADEF R E S UM E R UN DWN S C HDWK S E TA S T S ETEF S E TE XV S E T IM E S E T IM R S ETPFM S ET PRA S E T PR I SETPR N S ET PR T S ETPR V S E TRWM S E TS FM SETSWM S NDE R R S US PN D TRNLOG UL KPAG ULW S E T U PDS EC WA ITFR WAKE WFLAND WFLOR Th e s e s ys t em s e rv i c e s i n i t i a l l y e x ec ute i n e x e c ut i v e mod e . C M EXEC G E TM SG G E TT IM I MGAC T N UM T IM SNDSMB SNDACC SNDO PR Th e s e s ys t em s e r v i c e s e x ec u t e i n t h e a c c e s s mod e o f t h e c a l l e r . A S C T IM B I N T IM E XCMSG FAO FAOL IMGS TA PUTM SG UNW IN D Th e se RM S s e rv i c e s b r a n c h to a s yn c h r o n i z a t i o n r o u t i n e b e fo r e r e t u r n i ng t o the c a l l e r . C LO S E C ONN E C T C R EATE DE LETE D I S C ONNE C T D I S PLAY ENTER E RAS E E XTEND F IND F LUS H F REE GET M ODIFY N XTVO L O PEN PAR S E PUT R EA D R E LEASE R EM OVE R E NAM E R EW IN D S EARC H S PAC E TRUNC ATE U PDA TE WA IT WRITE Th e v e c to r s fo r t h e s e RM S s e rv i c e s c o nta i n RET i n st r uc t i o n s r a the r tha n a b r a n c h t o a n RM S s yn c h r o n i za t i o n r o u t i n e . RM SRUN DWN S ETDDIR S E TDF PR OT 3-3 S SVE XC SYS TEM SERV I C E D I S PATC H ING 3.2 C HANGE MODE INSTRUC T I ON S Wh e n a c h a ng e mode i n s t r uc t i o n i s e x e c u ted , a n e x c e p t i o n i s g enera ted th a t p u s h e s t h e PS L , t h e PC o f the n ex t i n s t r uc t i o n , a n d the c o d e th a t i s the s i ng l e ope r a nd o f t h e c h a ng e m o d e i n s t r uc t i o n o n to the s tac k ( As a l r e a d y po i n t ed o u t i n the p r ev i o us i nd i c a t ed i n the i n s t r uc t i o n . c h a p t e r , t h e a c t u a l a c c e s s m o d e i s the m i n im um o f the a c c e ss mode i nd i c a t ed b y t h e i n s t r uc t i o n a nd t h e c u r r e n t a c c e s s m o d e c o n t a i n ed i n t h e PS L . ) Fo r e x ampl e , t h e e x ec u t i o n o f a C HM E #5 i n s t r uc t i o n wi l l pu sh a PS L , t h e PC o f t h e i n s t r uc t i o n f o l l o w i ng t h e C HM E i n s t r uc t i o n , a n d a 5 o n t o the ex e c u t i v e s t a c k . Co n t r o l is t h e n pa s s e d to the ex cept i o n s e rv i c e r o u t i n e wh o s e ad d r e s s i s l o c a t e d in the a pp r o p r i a t e e n t r y i n the s ys tem c o n t r o l b l o c k ( S C B ) • 3.2.1 C HM K , CHME A t i n i t i a l i z a t i o n t i m e , VM S f i l l s i n th e SCB e n t r i e s fo r C HM K and CHME w i t h the a d d r e s s e s o f c h a n g e mode d i spa t c h e r s th a t pa s s c o n t r o l to th e p r o c ed u r e s t h a t pe r fo rm s e rv i c e - s p e c i f i c c o d e . Th e a c t i o n o f the s e t wo d i s pa t c h e r s i s d i s c u s sed i n the n e x t s e c t i o n . 3. 2. 2 C HMS , C HM U Th e S C B e n t r i e s f o r C HM S a nd C HMU a r e f i l l ed i n w i th the a d d r e s s e s o f except i on s e rv i c e r o ut i ne s t h a t u s u a l l y pa s s c o n t r o l to the g e n e r a l e x c e p t i o n d i s pa tc h e r d e s c r i b ed i n t h e p r ev i o u s c h a p t e r . I n th i s c a s e , a C HM S o r C HMU e x c e p t i o n wo u l d be r e po r ted to a p r o c e s s th r o ug h t h e n o rm a l s i g na l a nd m e c h a n i s m a r r a y s . Th e pa r t i c u l a r e x c e p t i o n . n ames a r e S S $_CMODS U PR a nd S S $ _CMODUS ER r e spe c t i v e l y . Howe v e r , a u s e r c a n sho r t c i r c u i t t h e n o rm a l e x c e p t i o n d i s pa t c h i ng in t h e c a se o f e i th e r o f t h e s e ex c e p t i o n s b y u s i ng the $ DC LCMH s y s t em s e rv i c e to e s t a b l i sh a p e r - p r o c e s s c h a ng e -mo d e - to - s upe r v i so r or c h a ng e -m o d e - t o - u s e r ex c e pt i o n h a nd l e r . Th i s s e r v i c e f i l l s l o c a t i o n C T L$G L CMSUPR o r C T L$G L C M U S E R i n t h e P l po i n t e r p a g e wi th the a d d r e s s of t he u s e r -wr i t t e n ch a ng e mod e d i s pa tch e r . Th e e x c e p t i o n s e r v i c e r o u t i n e s fo r the C HM S a nd C HMU e x c e p t i o n s c h e c k these l oc a t i ons for n o n z e r o c o n t e n t s a n d d i s pa t c h a c c o r d i ng l y . Th e DC L a nd MCR c ommand l a ng u a g e i n terpreters use th i s service to c r e a te a s p e c i a l c h a ng e -mo d e- t o - s upe r v i s o r h a nd l e r . Th i s h a nd l e r i s u s e d wh e n i t i s n ec e s s a r y t o g e t to s upe r v i so r m o d e f r om use r mode wh e n an imag e is i n t e r r up t e d w i th a CTRL/Y . Th e use of the c h a ng e-mo d e - t o - s upe r v i s o r h a nd l e r i s d i sc u s s ed in Ch a pt e r 2 0 . Th e j o b c o n t r o l l e r us e s a c h a ng e -mod e - t o - u s e r d i s p a tch e r f o r i t s p r o c e s s i ng o f e r ro r messag e s . 3. 3 C HANGE MODE D I S PATCHING IN VMS Th e c h a ng e m o d e d i spa t c h e r t h a t r ec e i v e s c o n t r o l f r om the C HMK o r CHM E i n s t r uc t i o n in the s ys tem s e rv i c e v e c to r m u s t d i spa t c h to the p r o c ed u r e i nd i c a t ed b y t h e c od e th a t i s f o und o n t h e t o p o f the s t a c k . In add i t ion , b e c a u s e t h e s e rv i c e r o u t i n e s a r e wr i t t e n a s p r o c ed u r e s , t h e d i spa t c h e r m u s t c o n s t r uc t a c a l l f r am e o n the s ta c k . Th i s c o u l d b e a c c ompl i shed b y u s i ng a CALLx i n s t r uc t i o n a nd a d i spa t c h t ab l e o f s e rv i c e e n t r y po i n t s . 3-4 SYSTEM SERV I C E D I S PATCHING Howev e r , t h e c a l l f r am e th a t m u s t b e b u i l t is i d ent i c a l fo r each se rv i c e . In add i t ion , the r eg i s t e r s th a t the s e r v i c e - spec i f i c p r o c e d u r e w i l l m o d i fy h a v e a l r e a d y b e e n s a v ed b e c a use the r eg i s t e r save mask i n t h e v e c to r a r e a ( a t g l o b a l l o c a t i o n SYS $ s e r v i c e ) i s t h e s a m e a s t h e r eg i s t e r save ma s k at locat ion EXE $ s e r v i c e . So the d i spa tc h e r avo ids the ove rhead of the g eneral p u r po s e CALLx i n s t r uc t i o n a nd b u i l d s i t s c a l l f r am e b y h a nd . Fu r th e r s pe ed i m p r o veme n t i s a c h i e v e d i n th i s c ommo n l y e x e c u t ed code pa th b y o v e r l a pp i ng memo r y wr i t e o pe r a t i o n s ( b u i l d i ng t h e c a l l f r ame ) wi th r eg i s te r - t o - r eg i s t e r o pe r a t i o n s a nd i n s t r uc t i o n s t r e am r e fe r e nc e s . Th e a c t ua l d i s pa tch to t h e s e r v i c e - s p e c i f i c p r o c ed u r e i s t h e n a c compl i s hed wi th a CAS EW i n s t r uc t i o n tha t u s e s t h e C HMx c o d e as i ts i nd ex i n to t h e c a s e t a b l e . F i g u r e 3 - 2 p i c t ures the c o n t ro l f l ow f r om t h e us e r p r og r am a l l t h e wa y t o t h e s e rv i c e- s pec i f i c p r o c ed u r e . Th i s f l ow i s i l l u s t r a t e d f o r b o th k e r n e l a nd ex ec u t i v e a c c e s s m o d e s . F i g u r e 3 - 3 s h ows t h e c o r r e s pond i ng f l o w f o r tho s e s e r v i c e s th a t d o n o t c h a ng e mo d e . 3. 3. 1 Ope r a t i o n o f t h e C h a ng e Mo d e D i spa t c h e r Th e ope r a t i o n o f the c h a ng e m o d e d i spa t c h e r s i s a l m o s t i d en t i ca l fo r k e rne l a nd e x e c u t i v e m o d e s . Th i s s e c t i o n d i s c u s s e s t h e c ommo n po i n t s o f the d i s pa tc h e r s f o r k e r n e l a nd e x e c u t i v e mo d e s . Th e n e x t sec t i o ns po i n t o ut the o n l y d i f f e r enc e s b e twe e n the d i spa t c h e r s f o r t h e t wo a c c e s s mod e s . F i g u r e 3 - 4 c o n t a i n s t h e c o d e fo r th e s e two d i s p a t c h e r s , c o p i ed f r om t h e m o d u l e CMODS SDS P . Th e i n s t r uc t i o n s a r e n o t l i s t ed i n e x a c t l y t h e same o r d e r t h a t t h e y a ppe a r i n the so u r c e m o d u l e . Ra t h e r , th e i n s t r uc t i o n s a r e s h o wn i n t h e o r d e r tha t t h e y a r e fo und wh e n a l l th e PS E C Ts h a v e b e e n so r t e d o u t a t l i n k t i m e . Fig ur e 3 - 5 conta i ns the e r ro r rout ines tha t are b r a n c h ed to f r om the chec ks mad e in Fig ure 3-4 . Th e f i r s t i n s t r uc t i o n o f t h e d i spa t c h e r po ps the except i o n cod e , un i q ue fo r each s e r v i c e , f r om t h e s t a c k i n to R O . Th e c a l l f r am e i s b u i l t o n t h e s t a c k by t h e f o l l o w i ng f o u r i n s t r uc t i o n s . Ke r n e l Mo d e D i s p a t c h e r P U S HAB PUS H L PUSHL C LRQ B A K S RVE X I T FP AP - (SP) E x e c u t i v e Mo d e D i s pa t c h e r P U S HAB P US HL P US HL C LRQ B A S RVE X I T FP AP - (SP) Wh i l e t h e c a l l f r ame i s b e i ng b u i l t , t wo c h e c k s a r e pe r f o rmed on the a rg um e n t l i s t . Th e n um b e r o f a r g um e n t s a c t ua l l y p a s s e d ( f o und i n t h e f i r s t b y t e o f t h e a rg um e n t l i s t ) i s c ompa red to a s e r v i c e - s pec i f i c ent r y i n a p r e b u i l t t ab l e to d e t e rm i n e wh e th e r t h e r e q u i r e d n um b e r o f a rg um e n t s f o r th i s se r v i c e h a v e b e e n pa s s ed . Re a d a c c e s s i b i l i t y o f t h e a rg um e n t l i s t i s c h e c k e d ( w i th t h e PROB ER i n s t r uc t i o n g e n e r a ted by the I FNORD m a c ro ) . If e i th e r o f t h e s e c h e c k s f a i l s , c o n t r o l i s p a s s e d b a c k to t h e c a l l e r wi th a n e r r o r i nd i c a t i o n i n R O . F i n a l l y , a CASEW i n s t r uc t i o n i s e x e c u t ed , us i ng t h e un i q ue c o d e i n RO as an i nd ex i n to t h e c a s e t a b l e . Th e c a se t a b l e h a s b e e n s e t u p a t a s s em b l y t i m e t o c o n t a i n the ad d r e s s e s o f the f i rst i n s t r uc t i o n o f each s e rv i c e-spec i f i c rout i ne . B e c a u s e e a c h s e r v i c e i s wr i t t e n a s a p r o c ed u r e wi th a g l o b a l e n t r y po i n t n am e d EXE $ s e rv i c e po i n t i ng to a r eg i s t e r save ma s k , the c ase t a b l e c o n t a i n s a d d r e s s e s o f th e fo rm E XE $ s e r v i c e + 2 . Th i s i s i l l u s t r a t ed i n F i g u r e 3 - 4 . If contro l is p a ssed to the e nd of the c a s e t a b l e , t h e n a C HMx i n s t r uc t i o n wa s e x e c u t ed wi th a n i m p r o pe r c o d e a nd e r r o r p r o c e s s i ng d e s c r i b ed in the n e x t s e c t i o n i s pe r f o rmed . 3-5 I PO Space I I I User Program C A L Lx • • System Space I I I r:J hange Dispatcher System Service Vector SYS$service :: EXE$CMODx x x x : : 1) Build call frame 2) Check argument list CASEW • • • • w I � offsets • • • • • • - Service-Specific Procedure process ille� al chan �e mo e code EXE$service : : entry mask • • • RE T I (Jl t< til � twl 3: til twl ::a < H n twl t::l H til ., > toi n = H 2! G'l (K)SRVEXIT: • • • REI I Figure 3-2 C o n t r o l F l o w o f Sys tem Se r v i c e s Th a t Ch a ng e Mo d e I PO Space I System Space I I User Program • I I • w I -..J I I • I SY S$service :: I I Service-Specific Procedure JMP -. entry mask • • • I • I • RET I I I I I Figure 3-3 rn rn t< � tzl 3: entry mask EXE$service : : CALLx • System Service Vector Co n t r o l F l o w o f Sys t em Se r v i c e s Th a t Do No t Ch a ng e Mo d e m tzl �H n tzl tj H m ., > � n 0:: H z Cl SYSTEM SERV I C E D I S PATCH ING Th e s e r o ut i n e s a r e t h e c ha ng e mod e d i spa t c h e r s u s e d by VMS to transfer contr o l to s ys tem s e rv i c e s o r RM S s e rv i c e s . Th e two d i s pa t c h e r s a r e n ea r l y i d en t i c a l . Tho se entr ies c o n t a i n i ng * * * * * * i nd i c a te pl a c e s wh e r e the two c h a ng e mod e d i spa t c h e r s d i f fe r . Comme n t s h a v e b e en r em o v e d a n d i n s t r uc t i o n s a ppe a r i n the o rd e r tha t t h e y a ppe a r in the e x ec ut i v e i m ag e , no t n ec e s s a r i l y in the o rd e r t h a t they a ppe a r i n mod u l e CM ODS S DS P . Ch a ng e Mo d e to Ex ec u t i v e D i s pa tche r Ch a ng e Mo d e t o Ke r n e l D i s pa tc he r E XE $CMODEXEC : : P O PR # "" M < R O > E X E $CMODKRN L : : POPL RO B E QL ASTE X I T B "" K S RVE X I T P U S HAB R O , R1 MOVZ B L FP PUS H L MOVZ B L W"" B KRN LARG [R 1 ] , R1 AP PUS H L @ # 4 [ R 1 ] , FP MOVA L C LR Q - (S P ) F P , ( AP ) , ACCVI O I FNORD p ro b e r # O , fp , ( ap ) beql accv io MOVL S P , FP CM PB ( AP ) , R1 K INSARG B LS S U K ERDS P : S C H $G L C UR PC B , R 4 MOVL R 0 , # 1 , tKCASMAX CAS EW ****** P U S HAB MOVZ B L PUS HL MOVZ B L PUS HL MOVAL C LR Q I F NORD MOVL CM PB B LS S U E XEDS P : ****** CAS EW B "" SRVE X I T RO, R1 FP W "" B E XE C NARG [ R 1 ] , R 1 AP @ # 4 [R 1 ] , FP - (SP) F P , ( AP ) , E XAC CVI O prober # O , fp , ( ap) beql exaccv io S P , FP ( AP ) , R 1 E X I NSARG R O , # O , S ""' ECASMAX EXE $ s e r v i c e + 2 o f f s e t to E XE S s e rv i c e + 2 o f f s e t to ****** JSB @ CT L $ G L_RM SBASE B SBW M OVL B EQL JSB M OVL B E QL JSB B RW C HEC KARGL I S T @ # C T L $G L_US RC HM E , R 1 10$ (R1) L "" EXE $G L_U S RC HM E , Rl 20$ (R1) I L LS ER I L LC HM K : B S BW MOVL B E QL JSB 10$: M OVL B EQL JSB 2 0$ : NOP NOP I L LS ER : MOVZW L RET . C HE C KARG L I S T @ # C T L $G L U S RC HM K , R 1 10$ (R1 ) L "" EXE $G L U S RC HM K , R 1 20$ (R1 ) 1 0$: 20$: # S S $_I L LS ER , R O Figure 3-4 C o n t e n t s o f t h e VM S Ch a ng e Mo d e D i s pa tc h e r s 3-8 SYSTEM SERV I C E D I S PATCH ING The se rout i nes a r e i nvoked i f t he arg ument l i st ' i s i nacc es s i b l e o r i f a n i n suff i c i e n t number o f a rg uments was passed to the serv i c e . EXACCVIO : BRW ACCVIO EXINSARG : CMPW R O , fRCASCTR BGE QU BRW ; Fr om EXE $CMODEXEC ; On l y r e po r t INSARG f o r RMS a nd , and bui l t i n func tions ; Other wi se , g et back in l in e ; Re po r t e r ro r to c al l er E XEDS P INSARG CHECKARGL I S T : I FNORD MOVZ BL ASHL I FNORD RSB t 4 , ( AP) , ACCVIO RET ( AP ) , Rl f 4 , Rl , Rl R l , 4 (AP) , ACCVI O_RET ACCVI O : MOVL ACCVI O RET: MOVZWL RET KINSARG : INSARG : ; Check a rg ument l i st fo r , r ead access ib i l i ty ; Fi r s t chec k coun t ; Then g et count ; Co nv e r t to b yte coun t ; Now check r e st o f l i st ; Se t FP so tha t RET wo rks S P , FP ISS $_ACCVI O , RO CMPW BGE QU R O , #KCASCTR KERDS P MOVZWL RET #SS $_INSFARG , RO ; I s t h i s a r ecog n i zed cod e? ; No . Get bac k in l in e Th i s r o ut i ne i s t h e common ex i t pa th fo r al l system s e rv i c e and RMS s e r v i c e c al l s . The usua l ex i t pa th is the RE I i ns t r uc ti o n . The al te rnate ex i t pa th i s to repo rt a SS $SSFAIL except i on . SRVEXIT : SRVRE I : SSFA I L : BLBC R O , SSFA I L REI BITL BEQL #7 , RO SRVRE I BRW SSFA I LMAIN ; Check fo r mere wa rn i ng ; I f so , d o no t g en e r a te , except io n ; Go t o SSFAI L l og i c RO , l O $ ; Ke rn e l mod e ex i t pa th ; Br anch i f abno rmal compl e t i o n KSRVE XI T : B LBC REI S E T I PL 10$ : BRB #0 ; Do no t use e l eva ted I PL o n ; e r r o r path . ; check fo r SSFA I L except i on SSFA I L SSFAILMAIN : MOVL TS'IW BNEQ E XTZV ADDL 10$: 20$: SCH$G L CURPCB , Rl PCB $W MTXCNT ; Check fo r own e r sh i p o f a m utex ; I f so , BUGCHECK 20$ #PS L$V-C URMOD , #PSL$8 C URMOD, 4 (S P ) , - (S P ) #PCB$V-S SFEXC , ( S P) ; Ar e sys tem s e rv i c e ; fa i l ur e except i ons enabl ed , fo r c a l l e r ' s access mod e ( S P+) , PCB$L-STS ( R l ) , 1 0 $ ; If not , d i sm i ss the BBC , except ion ; I f so , pass control to the EXE $SSFAIL BRW , g en e r a l ex cept i o n d i spa tcher ; Re tu r n f rom se rv i c e wi th REI , e r r o r sta t us M TXCNTNONZ , FATAL B UG CHECK Figure 3-5 E r r o r Ro u t i n e s a nd Commo n Ex i t P a t h f o r Sy s t em Se r v i c e s a nd R M S Ca l l s 3-9 SYS TEM S E RVI C E D I S PATCH ING 3.3.2 C h a ng e -Mo d e - to -Ke r ne l D i spa tch e r Th e r e a r e two s t e p s pe r fo rm ed by t h e c h a ng e -mo d e - to- k e r n e l d i spa t c h e r a r e n o t pe r fo rm ed by t h e c h a ng e -m o d e - t o - e x e c u t i v e d i s pa tch e r . th a t B e f o r e c o n t r o l i s p a s s e d to tho s e s e rv i c e s tha t execute in kernel mod e , t h e a d d r e s s o f t h e PC B f o r t h e c u r r e n t p r o c e s s ( f o und a t g l o b a l l o c a t i o n S C H $G L C UR PC B ) i s p l a c ed i n to R 4 . Th e s ec o nd d i f f e r en c e is t h a t C HMK # 0 i s a s p e c i a l e n t r y p a th i n to k e r n e l m o d e th a t i s used b y t h e A S T d e l i v e r y r o u t i n e fo l l o w i ng t h e c a l l to the AST p r o c ed u r e . If t h e C HM K c o d e r em o v e d f r om t h e s t a c k i s a z e r o , c o n t r o l i s p a s s e d to a r o u t i n e c a l l ed ASTEX I T . Th e a c t i o n o f th i s r o u t i n e i s d e sc r i b ed in Ch a pt e r 5 . 3. 3.3 Ch a ng e-Mo d e - t o -E x e c u t i ve D i s p a tch e r Th e c h a ng e -m o d e - t o - e x ec u t i v e d i spa tc h e r pe r fo rms o n e s t e p un i que to execut i v e mode . If t h e C HM E code i s not a r ec og n i z ed sys t em s e r v i c e , t h e CAS EW i n s t r uc t i o n pa s se s c o n t r o l to t h e e nd o f t h e c a s e t a b l e . At tha t po i n t , t h e c h a ng e -m o d e - t o - e x ec u t i v e d i spa tch e r t r a n s f e r s c o n t r o l to t h e RM S d i s pa tc h e r to d e t e rm i n e wh e th e r th i s wa s a v a l i d RM S c a l l b e f o r e d r o p p i ng i n to t h e e r r o r p r o c e s s i ng d e sc r i b ed b e l o w . 3. 3 . 4 RMS D i s p a tc h i ng Th e RM S d i s p a t c h e r , i l l u s t r a t ed i n Figure 3-6 , cons i sts o f two i n s t r uc t i o n s . Th e CAS EW i n s t r uc t i o n wi l l d i spa t c h to RM S s e r v i c e- s pe c i f i c p r o ced u r e s f o r l eg i t i m a t e RM S s e rv i c e c o d e s . Th e s e p r o c ed u r e s wi l l e x i t w i th a RET b a c k t o S RVE X I T . I f a n i l l eg a l c o d e wa s i s s u ed , ( th a t i s , a c o d e n o t r e c o g n i z e d a s a n RM S s e r v i c e c a l l ) the RSB i n s t r uc t i o n f o l l o w i ng the CAS EW i n s t r uc t i o n w i l l pa s s c o n t r o l b a c k to EXE $ CMODEXEC f o r n o rm a l e r r o r p r o c e s s i ng . 3. 3.5 Re t u r n P a t h f o r Sys t em S e r v i c e s Wh e n t h e s e rv i c e- s p e c i f i c p r o c ed u r e h a s c ompl e t ed i t s o pe r a t i o n , it pl a c e s a s t a t us code i n RO and i s s u e s a RET i n s t r uc t i o n . Th i s i n s t r uc t i o n r e t u r n s c o n t r o l to the code a t l ab e l ( K ) S RVE X I T i n F i g u r e 3 - 5 b e c a us e th i s a d d r e s s wa s p u t i n to the s a v ed PC a r e a o f t h e c al l f r am e b u i l t b y t h e c h a ng e m o d e d i s pa tc h e r . Th e rout ine ( K ) S RVE X I T f i r s t c h e c k s wh e t h e r a n e r ro r o c c u r r ed . I f no e r ro r o c c u r red o r i f t h e e r r o r wa s m e r e l y a wa r n i ng ( R 0 < 2 : 0 >= 0 ) , t h e CHMx except ion is d i sm i s sed w i th an RE I i n s t r uc t i o n th a t pa s s e s c o n t r o l to the i n s t r uc t i o n f o l l o w i ng the C HMx in the v e c to r a rea . Th i s i n s t r uc t i o n i s a RET wh i c h f i n a l l y r e t u r n s c o n t r o l t o the us e r prog ram f o l l o w i ng t h e c a l l t o S YS $ s e r v i c e ( F i g u r e 3 - 1 ) . On e a d d i t i o n a l s t e p i s t a k e n by r o u t i n e KSRVE X I T , t h e e x i t r o u t i n e fo r s e rv i c e s that exec ute i n k e r n e l mod e . I PL i s e x p l i c i t l y l o we r ed to zero . Th i s s t e p i s unnec e s s a r y un l e s s t h e p r o c e s s h a s e n a b l ed sys tem s e rv i c e f a i l u r e e x c ept i o n s b e c a u s e t h e RE I i n s t r uc t i o n th a t d i sm i s s e s t h e C HMK e x c e p t i o n w i l l l o we r I PL . Howe v e r , if a sys t em s e r v i c e fa i l ur e e x c ep t i o n is t o b e g e n e r a ted , t h e e x c e p t i o n c o d e m us t b e e n t e r ed w i th I P L s e t t o z e r o . ( A s im i l a r check i s n o t n e e d ed fo r e x e c u t i v e mod e s e r v i c e s b e c a u s e o n l y k e r n e l mod e c od e c a n e x e c u t e a t e l ev a t ed I P L . ) 3-1 0 PO Space I Change Mode Dispatcher RMS Service Vector I User Program w I I-' I-' I • • • CA x • LL • • • I I System Space I I I EXE$CMODEXEC:: I 1 ) Build Call Frame 2) Check Argument List SYS$service:: e n t ry m a s k CASEW • • • C H M E •code I I RMS Dispatcher RMSSDISPATCH: /' : cA Ew • offsets • • • RSB I offsets • I • • JSB RMS Service-Specific Procedure I I I RMS$servlce: : I I I I I I Ro u t i n e Common Exit Path R MSCHK_STALL: .... • • • RET SRVEXIT: • _ Figure 3-6 • • REI Co n t r o l F l o w o f RM S D i s pa t c h i ng entry mask • • • RET 00 00 1-'3 tzl 3: 00 tzl ::c < 1-4 (') tzl t:1 1-4 00 1-( ., > t-3 (') ::c 1-4 2! G) S Y S TEM S E RV I C E D I S PATCH ING I f an e r r o r o r s ev e r e e r r o r o c c u r r e d , a c h e c k i s mad e to s e e wh e th e r the proc ess own s a ny m u t ex . I f so , a f a t a l b ug c h e c k i s g e n e r a t ed . ( Ch a p t e r 7 d e s c r i b e s b ug c h e c k p r o c e s s i ng . M u t e x e s a r e d e s c r i b ed in Ch a p t e r 2 4 . ) I f t h e m u t e x c h e c k s uc c e e d s , a c h e c k i s mad e to d e t e rm i n e wh e th e r t h i s p r o c e s s h a s e n a b l e d s y s t em s e r v i c e ex c e p t i o n s fo r the c a l l i ng a c c e s s mo d e . I f i t h a s , c o n t r o l i s p a s s e d t o the e x c e p t i o n d i spa tc h e r a t g l o b a l l a b e l EXE $ S S FA I L . Th e ex cept ion tha t wi l l be r e po r t ed t o the c a l l e r i n the s i g n a l a r r a y i s S S $ S S FA I L . Oth e r w i s e , c o n t r o l i s pa s s ed b a c k to the c a l l e r wi th R O cont a i n i ng the error s t a t us c o d e . 3. 3.6 Re t u r n Pa t h f o r RMS S e r v i c e s Th e r e t u r n pa th fo r RMS s e r v i c e s i s s l i g h t l y mo r e c ompl i c a t ed t h a n t h e r e t u r n pa th fo r s ys t em s e rv i c e s . Th e l a s t two b y t e s o f t h e v e c to r c o n t a i n a b r a nch ( B RB ) to a n RM S s yn c h r o n i z a t i o n r o u t i n e ( c o n t a i n e d i n mod ul e CMODS S DS P ) . Th i s r o u t i n e f i r s t c h e c k s wh e th e r the c a l l e r o f the RMS s e rv i c e wi sh e s t o wa i t . Th i s i s t h e u s ua l c a s e b u t RM S d o e s ( Th e r e t u r n s t a t u s c o d e i s s e t t o a l l o w a s yn c h r o n o u s I /O o p e r a t i o ns . RM S $ S TA L L by RM S i n the u s ua l s t a t e , wh e r e the p r o c e s s m u s t wa i t un t il t h e RMS o pe r a t i o n h a s c ompl e t ed . ) 3 . 3 . 6 . 1 Wa i t S t a te As s o c i a t ed wi t h RMS Reque s t s If a sta l l is i nd i c a t ed , the c a l l e r i s p u t i n t o a n ev e n t f l ag wa i t s t a t e , wa i t i ng f o r the e v e n t f l ag a s so c i a t ed w i th t h e I /0 r e que s t t h a t RMS h a s j us t i s s ued . Th e c r uc i a l po i n t i n th i s i mpl em e n t a t i o n i s th a t the c a l l e r i s wa i t i ng a t the a c c e s s m o d e a s so c i a t ed wi t h t h e o r i g i n a l c a l l to RMS and no t in e x e c u t i v e a c c e s s m o d e , t h us a l l o w i ng AST d e l i v e r y f o r a l l a c c e s s m o d e s a t l e a s t a s p r i v i l eg e d a s t h e c a l l e r o f RM S . ( In the u s ua l case wh e r e RM S i s c a l l e d f r om us e r m o d e , th i s a l l o ws bo th us e r a nd s upe r v i s o r ASTs a s we l l as e x ec ut i ve a nd ke rnel ASTs t o be d e l i v e r ed wh i l e wa i t i ng fo r t h e RM S o pe r a t i o n to c ompl e t e . ) - Wh e n th e o r i g i n a l I /0 c ompl e t e s , RM S g a i n s c o n t r o l f i rst i n an e x e c u t i v e m o d e A S T t h a t i t a s s o c i a t ed w i th i t s $ Q I O r e q u e s t . If it d e t e rm i n e s t h a t the o r i g i n a l r e qu e s t i s c om p l e t e , i t s e t s f i n a l s t a t us in the d a t a s t r uc t ur e ( FAB o r RAB ) a s s o c i a t ed wi th the o pe r a t i o n a nd r e t u r n s f r om i t s AST . Th e c a l l e r n o w d r ops t h r o ug h the even t f l ag wa i t in the s yn c h r o n i z a t i o n rout ine ( because the I /0 c ompl e t i o n r o u t i n e s e t t h e e v e n t f l ag ) . Th e s ynch r o n i z a t i o n r o u t i n e d e t e rm i n e s tha t the RM S o pe r a t i o n is c ompl e t e ( b e c a u s e t h e FAB o r RAB s t a t us f i e l d c o n t a i n s n o n z e r o ) , a n d e x e c u t e s a R E T , p a s s i ng c o n t r o l back to the po i n t wh e r e t h e i n i t i a l c a l l to R M S wa s i s s ued . I f the RM S e x e c u t i v e mo d e AST d e t e rm i n e s t h a t m o r e I /0 i s r e q u i r e d to c ompl e t e the o r i g i na l r e que s t ( s uch as o c c u r s wh e n r e a d i ng a l a rg e r e c o rd f r om a s e q ue n t i a l f i l e w i th sm a l l i n te r nal buf f e r s o r wh e n o pe r a t i ng o n a n ! S AM f i l e ) , RM S i s s ue s t h e n e x t $ Q I O a nd r e t u r n s f r om i t s AS T . B e c a u s e the p r ev i o us I /0 c o mpl e t i o n s e t th e a s s o c i a t ed e v e n t f l ag , the process i s n o w c ompu t a b l e . Ho we v e r , t h e RM S o pe r a t i o n i s n o t ye t c ompl e t e . Fo r th i s r e a so n , t h e RMS s yn c h r o n i z a t i o n r o ut i ne ( ex e c u t i ng i n the c a l l e r ' s a c c e s s m o d e ) c h e c k s t h e s t a t u s f i e l d i n t h e RAB o r F A B f o r z e r o , i nd i c a t i ng th a t RM S h a s m o r e to d o . In th i s c a se , the c al l e r is ag a i n pl a c ed i n to the L E F s t a t e b y t h e RM S s yn c h r o n i z a t i o n r o u t i n e . I n o th e r wo r d s , a t a pr i m i t i v e l ev e l , the Howe v e r , p r o c e s s i s p l a c ed i n to a L E F s t a t e by RMS o n e o r mo r e t i m e s . t h e a c t ua l i nd i c a t i o n t h a t the RMS o pe r a t i o n h a s c ompl e t ed i s n o n z e r o c o n t e n t s i n t h e s t a t u s f i e l d o f t h e FAB o r RAB . 3-1 2 SYSTEM S ERVI C E D I S PATC H ING 3. 3. 6.2 RMS E r r o r De t e c t i o n - Wh e n th e RM S s yn c h r o n i z a t i o n rout i ne f i na l l y d e c i d e s t h a t RM S h a s c om p l e t ed i t s wo r k , i t c h e c k s t h e f i na l status . I f th i s s t a t u s i nd i c a t e s e i th e r s uc c e s s o r wa r n i ng , a RET is e x e c uted . If e i th e r a n e r r o r o r a s ev e r e e r r o r o c c u r r e d , a s p e c i a l RM S c a l l { $ S SVE XC ) i s i s s ued . Th i s s e rv i c e s i m p l y r e po r t s the e r ro r s t a t us t h r o ug h t h e no r m a l VM S s e rv i c e ex i t p a th { S RVE X I T ) th a t d e te rm i n e s wh e th e r t h e p r o c e s s h a s e nab led s ys t em s e rv i c e fa i l ure e x c e pt i o n s . B e c a us e RM S e r r o r s are r e po r t ed th r o ug h t h e s ys t em s e rv i c e d i s pa t c h e r , t h e y a r e t r e a t ed i n e x a c t l y t h e s ame m a nne r as s ys t em s e rv i c e e r r o r s . 3. 4 U S ER-WR I TTEN SYS TEM S E RV I C E D I S PATC H I NG Th e VAX a r c h i t e c t u r e r e s e r v e s C HMx i n s t r uc t i o n s w i th n eg a t i v e codes f o r c u s tome r u s e . VM S s ys t em s e rv i c e d i spa tch i ng a c k n o wl ed g e s th i s i n i t s d i s pa t c h s c h em e a nd c o n t a i n s h o o k s th a t a l l o w a p r i v i l eg ed us e r to wr i t e h i s o wn s ys tem s e rv i c e s . Th e m e thod f o r d o i ng th i s i s d e s c r i b ed i n the VAX/VM S Re a l -T i m e Us e r ' s G u i d e . Th i s s e c t i o n me r e l y d e s c r i b e s h o w c o n t r o l i s pa s s ed t o us e r -w r i t t e n s y s t em s e rv i c e s . F i g u r e 3 - 4 i l l us t r a t e s t h e e r r o r p r o c e s s i ng c o d e th a t f o l l o ws the c a s e table fo r t h e c h a ng e -mod e - t o - k e r n e l o r c h a ng e-mo d e- t o - e x e c u t i v e d i s pa t c h e r . Th e o n l y d i f fe r e n c e s b e twe en these two r o u t i n e s a re the n am e s o f the g l o b a l po i n t e r s th a t a r e r e f e r e nced . 3. 4 . 1 Per- P r o c e s s U s e r -W r i t t e n D i s p a t c h e r I f c o n t r o l i s pa s s ed t o t h e e nd o f the c a s e t a b l e , th i s i nd i c a t e s th a t a C HMK o r C HM E i n s t r uc t i o n wa s e x e c u t ed wi th a n i nv a l i d c o d e . VM S a t t emp t s to pa s s c o n t r o l to a u s e r -wr i t ten ch ang e mod e d i s pa t c h e r . Fi r st , a location i n P l s p a c e { C T L $G L U S RC HMK o r C T L $ G L U S RC HM E ) i s c h e c k e d t o s e e wh e th e r a p e r - p r o c e s s -d i s pa t c h e r ex i s ts . No n z e r o c o n tents o f th i s l oca t i on a re i n t e r p r e t ed as the add r ess o f a u s e r -w r i t ten d i spa tc h e r a nd c o n t r o l i s p a s sed to i t w i th the s t a c k as s h o wn in Figure 3-7 . Th e a s s um p t i o n b e i ng m a d e b y VM S a t th i s po i n t t r an s f e r i s th a t a v a l i d c h a ng e m o d e c o d e w i l l r e s u l t i n t h e ev e n t u a l of control t o { K ) S RVE X I T w i th a R E T i n s t r uc t i o n . I f t h e pe r - p r o c e s s d i s pa t c h e r r e j e c t s t h e c o d e , i t r e t u r n s c o n t r o l t o the c o d e l i s t ed in F i g u r e 3 - 4 w i t h a n RSB i n s t r uc t i o n . 3. 4. 2 P r i v i l eg ed Sh a r e a b l e Imag e s Th e us u a l c o n t e n t s o f CT L $G L U S RC HMK a nd CTL$G L U S RC HM E a r e add resses w i t h i n t h e t wo pag e s i n P l s p a c e s e t a s i d e by VM S f o r u s e r -wr i t t e n s y s tem s e rv i c e s a nd imag e - s p e c i f i c m e s s a g e pr o c e s s i ng . Ke r n e l mo d e a nd e x ec u t i ve mode each have o ne h a l f pag e { 2 5 6 byt e s ) d ev o t ed t o s ys t em s e rv i c e d i spa tch i ng . Th e i n i t i a l c o n t e n t o f t h e f i r s t b y t e o f e a c h d i s pa t c h a r e a { s e t up b y PR OC STRT ) i s a n R S B i n s t r uc t i o n . W i th the d i s p a tch s c h em e d e s c r i b ed in the p r ev i o u s sec t i on , there is e f fe c t i v e l y n o pe r - p r o c e s s c h a ng e m o d e d i s pa tch i ng . 3-1 3 SYSTEM S E RVI C E DISPATCH ING Direction of stack growth r e t u r n PC in CMODSSDSP .-sP 0 ( c o n d i t i o n h a n d l e r a d d r es s ) 0 ( PSW / re g i s t e r s a v e m a s k ) s a v e d AP s a v ed FP (K)SRVEXIT (return PC) PC following CHMx instruction PSL following CHMx instruction Figure 3-7 S t a t e o f t h e S t a c k Wi t h i n a U s e r -Wr i t t e n D i s pa tc h e r Howe v e r , i f a n imag e executes th a t wa s p r ev i o u s l y l i n k e d wi th a p r i v i l eg ed shareab l e i m ag e ( l i n k e d wi th t h e / PROTECT a n d / S HAREABLE o p t i o n s a n d i n s t a l l ed w i th t h e / PROTECTED a nd / S HARED o p t i o n s ) , the i m ag e a c t i v a to r r e pl a c e s the RSB i n s t r uc t i o n wi t h a J S B to the u s e r -w r i t t e n c h a ng e mode d i spa tc h e r s pe c i f i ed as a p a r t of the p r i v i l eg ed sha reable i m ag e ( Figure 3-8 ) . VM S a l l o ws m u l t i pl e p r i v i l eg ed s h a r e a b l e i m ag e s to b e l i n ked i n to the same exec utab l e i m ag e . ( Th e r e i s a l i m i t o f 4 2 u s e r -wr i t t e n d i sp a tc h e r s o f e a c h t ype . Ho w t h e s e d i spa tc h e r s a r e c o l l e c t ed i n to pr i v i l eg ed shareable i m ag e s d e te rm i n e s t h e n umb e r of p r i v i l eg ed shareab l e i m ag e s th a t c a n b e i nc l ud ed i n a s i ng l e e x e c u t a b l e i m ag e . ) A n RSB i n s t r uc t i o n fo l l o ws t h e l ast JSB i n s t r uc t i o n i n the d i s pa t c h a r e a . Th e e x ampl e p i c t u r ed i n F i g u r e 3 - 8 s h ows t h r e e p r i v i l eg e d sh a r e a bl e i m ag e s . Wh e n the i m a g e a c t i v a to r ( Ch a p t e r 1 8 ) e n c o u n te r s a pr i v i l eg ed s h a r e a b l e i m ag e a s a pa r t o f t h e e x e c u t ab l e imag e i t i s a c t i v a t i ng , i t m a ps the s e c t i o n ( s ) c o n t a i n i ng t h e u s e r -wr i t t e n s ys tem s e r v i c e s i n the u s ua l manne r . Ho we v e r , i t a l s o u s e s i n f o rm a t i o n s to r ed i n th e f i r s t e i g h t l o ng wo r d s o f t h e i m a g e ( a pr i v i l eg ed l i b r a r y v e c to r p i c t u r ed in Figure 3-9 ) t o m o d i f y t h e P l s p a c e d i spa t c h a r e a . Fo r e x amp l e , i f a p r i v i l eg ed sha reable i m ag e c o n t a i n ed a c h a ng e -mo d e - to- k e r n e l d i spa tch e r , the i m ag e a c t i v a to r wo u l d i n se r t a J S B i n s t r uc t i o n i n P l s p a c e th a t t r a n s f e r r ed c o n t r o l t o t h e d i spa tc h e r s p e c i f i ed by t h e P LV$ L_K E RN E L l o ngwo r d i n the pr i v i l eg ed l i b r a r y v e c to r . 3-1 4 P1 PO Space I IIIIo. I U s e r P ro g r a m • • I • 1 __... C A LLx • Jill"" I • • � �� , w I I-' U1 I• Dispatcher A , RSB -@ � Dispatcher 8 I I �� . ENTRY � �--------• - - - - - - ...(b � I .... ""'111" s Figure 3-8 This Vector i s built by the I mage Activator (CTL$A_DISPVEC) + I I I I I I II I I __... .... en � en t-3 tz::l 3 E X E $ C M O Dx x x x : : 1 ) Build c a l l f rame 2) Check a r g u m e n t list CA SEW • • • ® en tz::l � 1-1 n tz::l offsets • • • 0 SB -®- •Jpro cess illegal 1-1 en c h a n g e mode c o d e s I I Change Mode Dispatcher I I �---------------- � C H Mx 1 RET � cA-se- :.(5)----. ENTRY : ® a t us RO 4: RET .... Sp - ace @J S 8 A �JS8 8 JS8 C RS8 S y s t e m S p a ce I I �� �� Common E x it P a t h ----.. .... (K)SRVEXIT : I D i spa tc h i ng to U s e r-Wr i t t e n Sys tem Se r v i c e s • ·® • REI �t-3 n = 1-1 z Cl SYS TEM S ERVI C E D I S PATCH ING { l /" ..J' .ENTRY CHMX RET #CO 1 E n t r y V e c tors /" o/ e ( 1 p e r s e rv ic e ) V e c t o r Type System Version - Kernel Dispatcher Privileged Library V e c t o r ( 1 per image ) E x e c u t i v e D i s p a t ch e r A d d ress Check "' , CASE RO, RSB CASE RO, RSB "" , ENTRY • �� Executive Dispatc her ••. Kernel Disp atcher mask • Functional Routines • MOVZWL RET F i g u r e 3-9 .•. # status, RO � � ( 1 per serv i c e ) S t r uc t u r e of P r i v i l eg ed Sha r e a b l e Imag e O n c e the i m ag e c o n t a i n i ng u s e r-wr i t t e n s ys t em s e rv i c e s is a c t i v a t ed , e x ec u t i o n p r o c e e d s no rm a l l y un t i l o n e o f t h e s e r v i c e s i s i n v o k ed . D i s p a tc h i ng p r o c e ed s a s f o l l o ws ( F i g u r e 3 - 8 ) . (l) A CALLx i n s t r uc t i o n t r a n s f e r s c o n t r o l to a se rv i c e- spec i f i c entry mask i n PO space . Th e C HMx ( C HM K o r C HM E ) i n s t r uc t i o n l o c a t ed t h e r e t r an s f e r s control t o t h e VM S c h a ng e m o d e d i spa t c h e r . (2) E x e c u t i o n p r o c e ed s a s i f a VM S s e rv i c e wa s i nvo k e d e x c e pt that the c h a ng e m o d e c o d e is not r e c og n i zed by t h e VM S d i spa tc h e r a nd c o n t r o l pa s s e s to t h e end o f the c a se tab l e ( Fi g u r e 3 - 4 ) . (3) Th e J S B i n s t r uc t i o n i n CMODS S DS P p a s s e s c o n t r o l to the Pl s pa c e d i s p a t c h a r e a wh e r e a no th e r J S B i n s t r uc t i o n pa s s e s c o n t r o l t o t h e f i r s t d i s pa tc h e r . (4) Th e cha ng e m o d e c o d e i s r e j e c t ed by t h e f i r s t d i spa tc h e r by s i mp l y e x e c u t i ng an RSB b a c k t o the Pl s p a c e v e c t o r wh e r e a s e c o nd J S B i s e x e c u t ed . 3-1 6 SYSTEM S E RVI C E D I S PATCH ING (5) Th e s e c o nd d i s pa tch e r r ec o g n i z e s t h e c h a ng e m o d e c od e a s v a l i d a n d d i spa t c h e s ( p r o b a b l y w i th a CAS Ex i n s t r uc t i o n ) t o a s e r v i c e - s pec i f i c p r o c ed u r e that i s a l so a pa r t o f the p r i v i l eg ed sh a r e a b l e i m ag e . (6) Wh e n the s e r v i c e c ompl e t e s ( s u c c e s s f u l l y o r un s uc c e s s f u l l y ) , it l o ad s a f i n a l s t a t u s i n to R O a nd ex i t s wi t h a RET wh i c h p a s s e s c o n t r o l to ( K ) S RVE X I T . At th i s po i n t , u s e r -w r i t t e n s y s t em s e r v i c e d i spa tch i ng m e r g e s w i th VM S s ys t em s e r v i c e d i s p a tch i ng . I f e a c h d i spa tc h e r r e j e c t e d t h e ch a ng e m o d e c o d e ( by e x e c u t i ng an RSB ) , control wo u l d e v e n t ua l l y r e a c h the R S B i n s t r uc t i o n i n t h e P l s p a c e v e c to r . Th i s R S B i n s t r uc t i o n pa s s e s c o n t r o l back to the VMS c h a ng e m o d e d i s pa tc h e r i n CMODS SDS P wh e r e a sys t em w i d e d i s p a t c h e r i s c h e c k e d fo r n e x t . 3.4.3 Sys t em -Wi d e Us e r -Wr i t t e n D i s pa tc h e r I f t h e P l s pa c e l ocat ion conta ins a ze ro , or if no pe r - p r o c e s s d i s pa t c h e r s a re i nv o k e d , or if the l a s t pe r - p r o c e s s u s e r -wr i t t e n d i spa tc he r r e t u r n s to t h e r o u t i n e i n CMODS SDS P w i th a n RSB , a l o c a t i o n in s ys tem s p a c e ( E XE $G L U S RC HMK o r E XE $G L U S RC HM E ) i s c h e c k ed f o r th e e x i s t e nc e o f a s y s t em-w i de u s e r -wr i t ten d i spa tc h e r . If none ex i s ts ( contents a r e ze ro , i t s u s u a l c o n ten t s i n a VM S s ys t em ) , o r i f th i s d i spa tc h e r pa s s e s c o n t r o l b a c k w i th a n R S B , a n i l l eg a l s y s t em se rv i c e cal l ( S S $ I L LS E R ) is r e po r ted b a c k t o the u s e r i n R O . Th i s s c heme a s s um e s that u s e r -wr i t t e n s ys t em s e r v i c e s tha t c om p l e t e success f u l l y w i l l e x i t wi t h a R E T b a c k t o ( K ) S RVE X I T , wh e r e a n RE I i n s t r uc t i o n w i l l d i sm i s s the C HMK o r CHM E e x c e p t i o n . 3. 5 R E LATED SYSTEM S ERVI C ES T h e r e a r e f o u r s ys t em s e rv i c e s i n VM S th a t a r e c l o s e l y r e l a ted to s ys tem s e r v i c e d i spa t c h i ng and the c h a ng e m o d e i n s t r uc t i o n s . Th e $ D C LCMH s y s t em s e r v i c e wa s d e sc r i b ed i n S e c t i o n 3 . 2 . 2 . Th i s sec t i on d e sc r i b e s t h e $ S E TS FM s e rv i c e a nd t h e c h a ng e mo d e s ys t em s e rv i c e s . 3. 5. 1 Se t Sys t em Se rv i c e Fa i l u r e E x c ep t i o n s Sys tem S e rv i c e Th e $ S ETSFM s ys t em s e rv i c e e i th e r e n a b l e s o r d i s a b l e s th e g ene r a t i on of e x c e p t i o n s wh en a n e r r o r i s d e t e c t ed by t h e s ys t em s e rv i c e c ommon e x i t pa th . Th e s e rv i c e i t s e l f s i mpl y s e t s ( t o enab l e ) o r c l e a r s ( to t h e b i t i n t h e p r o c e s s s t a t u s l o ng wo r d ( a t o f f s e t PC B $ L S T S d i sa b l e ) i n t h e so f twa r e PC B ) fo r t h e a c c e s s mo d e f r om wh i c h t h e s y s t em se rvi c e wa s c a l l ed . 3-1 7 SYSTEM SERVI C E D I S PATCHING 3. 5. 2 Chang e Mod e Sys t em Se rv i c e s Th e $ CMKRN L a nd $ CMEXE C s ys t em s e rv i c e s p r ov i d e a s i m p l e pa th fo r p r i v i l eg e d p r o c e s s e s to execute code i n k e r n e l o r e x e c u t i v e mo d e . Th e s e s e rv i c e s c h ec k f o r t h e a pp r o p r i a t e p r i v i l eg e ( CMKRN L o r CMEXE C ) and then d i s pa t c h ( wi th a CALLG i n s t r uc t i o n ) to the p r o c ed u r e wh o s e a d d r e s s i s s uppl i ed a s a n a rg um e n t to the s e rv i c e . ( No t e th a t if $ CMKRN L i s c a l l ed f r om e x e c u t i v e m o d e , n o p r i v i l eg e c h e c k i s m a d e . ) Th e p r o c ed u r e th a t e x e c u t e s i n k e r n e l o r e x e c u t i v e mod e m u s t l o ad a r e t u r n s ta tu s c o d e i n to R O . I f n o t , t h e p r ev i o us c o n t e n t s o f RO w i l l b e u s ed t o d e t e rm i n e wh e th e r a n e r r o r o c c u r r ed . 3-1 8 CHAPTER 4 S OFTWARE INTERRUPTS Th e so f twa r e i n t e r r up t m e c h a n i sm th a t is p r ov i d ed a s a n i n t eg r a l pa r t o f t h e VAX a r ch i t e c t u r e i s r e l i ed o n h e a v i l y b y VAX/VM S f o r s ev e r a l pu r po s e s . Th e s c h e d u l e r i s i nv o k e d a s a s o f twa r e i n te r r up t s e r v i c e rout ine . So f twa r e i n t e r r up t s p r ov i d e d ev i c e d r i v e r s a c l e a n m e thod for l o we r i ng I P L . S e v e r a l I/0 c ompl e t i o n ro u t i n e s r un as s o f twa r e i n t e r r up t serv i c e rout ines . Th i s c h a p t e r f i r s t d e sc r i b e s the g e n e r a l s o f twa r e i n t e r r upt m e c h a n i sm a n d th en l i s ts s ev e r a l u s e s o f s o f twa r e i n t e r r up t s i n VAX/VM S . 4.1 THE S OFTWARE I NTERRUPT A s o f twa r e i n t e r r up t i s a c t ua l l y a h a r d wa r e m e c h a n i sm , s i m i l a r to an i n t e r r upt g e n e r a t e d by a n ex t e r n a l d ev i c e . I t c a u s e s a PC/ PS L p a i r to b e pushed o n to a n a pp r o p r i a t e s t a c k ( u s ua l l y the i n t e r r up t s t a c k ) and pa s s e s c o n t r o l to a n i n t e r r up t s e r v i c e r o u t i n e wh o s e a d d r e s s is s to r ed i n the s ys tem co n t r o l b l o c k . L i k e h a r d wa r e i n t e r r up t s , VM S i n t e r p r e t s s o f twa r e i n t e r r up t s as s ys tem-w i d e events th a t a r e s e r v i c ed i nd e pe nd e n t l y o f the contex t o f a spec i f i c process . Th e AST i n t e r r upt , d i scussed b r i e f l y at the e nd of t h i s c h a p t e r a nd in g r e a t d e ta i l i n Ch a p t e r 5 , i s t h e o n l y v a r i a t i o n f r om th i s a s s um p t i o n . Th e b ig d i f f e r e nc e b e twe e n so f twa r e i n t e r r upts and h a rd wa r e i n t e r r up t s , a nd t h e r e a so n fo r t h e n am e , i s t h a t so f twa r e i n t e r r up t s a r e g e ne r a t e d by a n e x p l i c i t r eq u e s t f r om s o f twa r e . Th e t yp i c a l so f twa r e i n t e r r up t r e q ue s t o c c u r s as the r esul t o f a h a r d wa r e i n t e r r upt or wi th i n a n o th e r so f twa r e i n te r r up t serv i c e rout i ne . Howe v e r , there a re e x ampl e s w i th i n VM S o f so f twa r e i n t e r r u p t s b e i ng i s s ued f r om c o d e e x e c u t i ng i n p r o c e s s c o n t ex t . 4.1.1 Ha rdwa r e Mec h a n i sm o f So f twa r e I n t e r r up t s Th e VAX a r ch i t e c t u r e p r ov i d e s 15 s o f t wa r e i n te r r u pt l ev e l s , f r om Th e r e a r e 1 5 e n t r i e s i n t h e s ys tem c o n t r o l I P L 1 5 d o wn to I PL 1 . b l o c k ( S C B ) f o r a d d r e s s e s o f so f twa r e i n t e r r up t s e r v i c e r o u t i n e s , one fo r e a c h I P L l ev e l . A s o f twa r e rout ine ( u s ua l l y a h a r d wa r e o r so f twa r e i n te r r upt s e r v i c e r o u t i n e ) r e que s t s a so f t wa r e i n t e r r up t a t a g i v en I P L l ev e l by wr i t i ng th e d e s i r e d I P L v a l u e i n to the pr i v i l eg ed r eg i s t e r So f t wa r e I n t e r r up t Re q u e s t Reg i s te r ( P R $ S I RR ) . Wr i t i ng to th i s r eg i s t e r c a u s e s a b i t in the So f t wa r e I n t e rr upt Summ a r y Reg i s t e r ( PR $ S I S R ) to b e s e t . Th e b i t in the S I SR is c l ea r ed wh e n the i n te r r up t is f i n a l l y t a ken . Th e l a yo u t of these two p r o c e s s o r r eg i s t e r s i s p i c t u r ed i n F i g u r e 4 - 1 . Al l s o f t wa r e i n te r r upt r e que s t s 4-1 SOFTWARE INTERRUPTS i n VM S u s e the SOFT INT m a c r o to wr i t e the S I RR . m a c ro i s . MAC RO S O F T INT I PL MTPR I P L , S A # PR $_S I RR . ENDM S O F T INT Th e e x pa n s i o n of th i s I 4 3 IGNORED 0 REQUEST Softw a re Interrupt Request Register (Write Only) P R $ _ S I RR 16 31 PENDING SOFTWARE INTERRUPTS MBZ P R $_ S I S R Softwa re Interrupt Summary Register ( R e a d / Wri t e ) Figure 4-1 C o n t en t o f So f twa r e I n t e r r u pt Re q u e s t Reg i s t e r a n d So f twa r e I n t e r r up t S umm a r y Reg i s t e r Th e us ua l s i t ua t i o n i n VM S i s tha t t h e r e q ue s t e d I P L l ev e l is l e ss than o r equa l to t h e c u r r e n t I P L ( a s d e t e rm i n ed by PS L < 2 0 : 1 6 > ) . In th i s c a se , t h e i n t e r r upt i s d e f e r r ed un t i l th e I P L d r ops b e l o w t h e r e q ue s t ed l ev e l . Th e d e f e r r a l o f p e nd i ng so f twa r e i n t e r r up t s b a s e d o n c u r r e n t I P L i s e x a c t l y t h e wa y th a t pe nd i ng h a r d w� r e i n t e r r upts a r e t r ea t e d . Th i s l owe r i ng o f I P L u s u a l l y o c c u r s a s t h e r e s u l t o f an RE I i n s t r uc t i o n b u t c o u l d a l s o o c c u r i f p r i v i l eg ed c o d e d i r e c t l y a l t e r ed th e c u r r e n t I PL by w r i t i ng to the PR $ I P L r eg i s t e r ( wi th t h e S E T I P L o r t h e ENB I NT m a c r o s , d e sc r i b ed i n Ch a pt er 2 4 ) . I f the r e q u e s t ed I P L v a l u e i s h i g h e r than the l ev e l a t wh i c h t h e processo r is c u r r e n t l y r un n i ng , t h en the i n t e r r upt s e r v i c e r o u t i n e wh o s e ad d r e s s is i n the s e l ec ted slot in the SCB is e n t e r ed i mmed i a te l y . ( Th i s i s t h e s ame wa y t h a t pe nd i ng h a r d wa r e i n t e r r up t s a r e t r e a t ed . ) Th e r e a r e a f e w o c c u r r e n c e s i n VM S o f a so f twa r e i n t e r r up t r e que s t a t an I P L l ev e l g r e a t e r t h a n t h e p r oc e s s o r i s c u r r e n t l y r un n i ng a t . Fo r e x ampl e , d ev i c e d r i v e r FDT r o u t i n e s m a y s i g n a l c om p l e t i o n by c a l l i ng th e r o u t i n e s E XE $ F I N I S H I O o r EXE $ F I N I SH I OC . Th e s e r o u t i n e s e x e c u t e a t 4-2 S OFTWARE INTERRUPTS I PL 2 a nd te rm i n a t e by r e que s t i ng the I /0 po s t p r o c e s s i ng so f twa r e i n t e r r up t a t I P L 4 . I n th i s c a se , t h e i n t e r r u pt i s t a k e n i mmed i a te l y . Th e f i l e sys tem AC P u s e s t h e same t e c h n i q ue t o s i g n a l I /0 c ompl e t i o n f o r r e que s t s i n wh i c h i t wa s i nv o l v e d . 4. 1.2 So f twa r e I n t e r r up t S e rv i c e Ro u t i n e s Th e r e a r e s e v e r a l f e a t u r e s a b o u t t h e u s e o f so f twa r e i n t e r r up t s i n VM S tha t a r e i nd e pe nd e n t o f t h e p u r po s e s o f i nd i v i d u a l i n t e r r up t s e r v i c e r o ut i n e s . Some o f the s e a r e d i c t a t e d b y the pa r t i c u l a r wa y t h a t so f twa r e i n t e r r up t s a r e t r e a t ed i n t h e h a r d wa r e . Be c a u s e the VAX a r ch i t e c t u r e s upp l i e s n o mech a n i sm f o r d e t e rm i n i ng h 9 w m a n y t i m e s a so f twa r e i n t e r r up t h a s b e en r eque s t e d b e f o r e i t i s t a k e n , VM S uses s o f twa r e m u s t s uppl y some p r o to c o l f o r d e t e rm i n i ng th i s . queues ( d o ub l y l i nk e d l i s ts m a n i pu l a t ed b y t h e I N S QU E a nd REMQUE i n s t r uc t i o n s ) f o r th i s p u r po s e . I n g e ner a l , e a ch queue e l em e n t r epresents a spec i f i c o pe r a t i o n th a t m u s t b e pe r f o rmed . Th e u s e o f q ue ue s , p a r t i c u l a r l y t h e u s e o f t h e I N S Q U E a nd REMQUE i n s t r uc t i o n s , a l l ows o th e r o p t i m i z a t i o n s to b e m a d e . • • • 4.2 I n g e n e r a l , so f twa r e i n t e r r up t r e q u e s t s a r e mad e by c o d e th a t is e x e c u t i ng at e l ev a ted I P L , o f t en b y h a r d wa r e i n t e r r upt s e rv i c e r o u t i nes . Th e s e so f twa r e i n t e r r up t r eque sts a r e u s ua l l y a c c ompa n i ed by t h e i n s e r t i o n o f some type o f q u e ue e l em e n t i n to a wo r k l i s t w i th an I NSQUE i n s t r uc t i o n . C o nd i t i o n c o d e s ( i n pa r t i c u l a r , t h e s e t t i ng o f t h e Z - b i t ) i nd i c a t e wh e t h e r t h e que ue wa s p r ev i o u s l y n o t em pty ( a nd by i mpl i c a t i o n wh e t h e r the so f twa r e i n t e r r up t r equest h a s By us i ng th i s i n f o rm a t i o n , VM S m a k e s t h e a l r e ady b e e n mad e ) . s o f twa r e i n t e r r up t r e q ue s t o n l y o n c e , a v o i d i ng t h e o v e r h e a d o f t h e M T PR i n s t r uc t i o n f o r a d d i t i o n a l u n n ec e s s a r y so f t wa r e i n t e r r up t r e qu e s t s . Th e so f t wa r e i n t e r r up t serv i c e rout ine c an a l so use the i n fo rm a t i o n p r o v i d e d b y c o nd i t io n cod e s e t t i ng s , th i s t i me a s the r e s ul t o f e x e c u t i ng a REMQUE i n s t r uc t i o n . Th a t i n s t r uc t i o n r e t u r n s t h e V-b i t s e t i f t h e q u e ue wa s emp ty b e fo r e t h e i n s t r uc t i o n b eg a n e x e c u t i o n , an i nd i c a t i o n th a t t h e wo r k o f th i s pa r t i c u l a r i n te r r up t s e r v i c e r o ut i n e i s compl e t e . By c o d i ng so f twa r e i n t e r r up t s e r v i c e r o ut i n e s so th a t they keep r emov i ng wo r k l i s t e l em e n t s f r om a q u e u e un t i l th e r e i s no mo r e wo r k t o d o , i t i s po s s i b l e to s im p l y i g no r e e r r o n e o us s o f t wa r e i n t e r r up t r eque s t s . I n f a c t , a l l o f t h e so f t wa r e i n t e r r up t s e r v i c e r o u t i n e s i n VM S , i nc l ud i ng tho s e th a t d o n o t u s e q u e ue s , wo r k e v e n i n the e v e n t o f s p u r i o us i n t e r r up t s r e que s t s . S OFTWARE INTE RRUPT LEVE LS IN VAX/VMS VM S u s e s t h e so f twa r e i n t e r r up t m e c h a n i sm f o r s ev e r a l p u r po s e s . • De v i c e d r i v e r s u s e fo r k p r o c e s s e s so tha t t h e y c a n e x ec u t e a t a n I P L b e l o w d ev i c e I P L . 4-3 S OFTWARE INTERRUPTS • Th e s o f t wa r e t i m e r s e rv i c e r o ut i n e pe r fo rms t im e r o pe r a t i o n s t h a t wo u l d b o g t h e s ys t em d o wn ( b e c a u s e I /O d ev i c e i n t e r r up t s a r e b l o c k e d ) i f t h ey we r e p e r fo rmed a t I PL 2 4 , t h e l ev e l at wh i c h the h a r dwa r e c l o c k i n t e r r up t s . • Th e n e ed f o r I / O po s t pr o c e s s i ng c an b e f l agg ed by d ev i c e d r iver i n t e r r up t s e r v i c e r o u t i n e s b u t the a c t ua l p r o c e s s i ng d e f e r r ed wh i l e a n o th e r pend i ng I /0 r e q ue s t i s s ta r t ed . • R e s c h e d u l i ng , the r emova l of the c u r rent process f r om e x ec u t i o n and t h e s e l e c t i o n o f a n e w p r o c e s s fo r ex ec u t i o n , i s i mpl em e n t ed a s a s o f twa r e i n t e r r up t s e rv i c e r o u t i n e . • Th e AST d e l i v e r y i n t e r r up t i s t h e o n l y so f twa r e i n t e r r up t t h a t i s t r e a t ed a s a p r o c e s s - sp e c i f i c i n t e r r up t r a th e r t h a n a s ys t em -w i d e e v en t . T a b l e 4 - 1 l i s t s a l l t h e so f twa r e i n t e r r up t l ev e l s used by VAX/VM S . Ta b l e 4 - 1 So f t wa r e I n t e r r up t Lev e l s Us e d b y VAX/VM S I PL 4. 2. 1 Use Stack 1 5-1 2 Unused I n t e r r up t 11 I PL = l l Fo r k D i s pa t c h i ng In t e r r up t 10 I PL = l O Fo r k D i s pa t c h i ng In t e r r up t 9 I PL = 9 Fo r k Di s pa t c h i ng I n t e r r upt 8 I PL=8 Fo r k D i s pa t c h i ng In t e r r upt 7 So f t wa r e T i m e r Se r v i c e Ro u t i n e I n t e r r upt 6 I PL = 6 Fo r k D i spa t c h i ng I n t e r r up t 5 Us ed to En t e r XD E LTA I n t e r r upt 4 I /0 Po s t p r o c e s s i ng In t e r r up t 3 R e s c hed ul i ng In t e r r up t Ke r n e l 2 A S T De l i v e r y In t e r r up t Ke r n e l 1 Unused -- Fo r k P r o c e s s i ng One u s e o f so f twa r e i n t e r r up t s i s fo und i n t h e m e c h a n i sm c a l l ed fo r k p r o c e s s i ng empl o ye d b y d ev i c e d r i v e r s . Th e i n t e r r up t n e s t i ng s c h em e d e f i n ed b y t h e VAX a r c h i t e c t u r e i s n o t g o i ng to wo r k c o r r e c t l y i f a n i n t e r r up t s e rv i c e rout ine l o we r s I P L b e l ow t h e l ev e l a t wh i c h the i n t e r r up t o c c u r r ed . Howe v e r , d ev i c e d r iver i n t e r r up t s e rv i c e r o u t i nes , i n i t i a l l y e n te r ed o r i nvo k e d a t d ev i c e I P L ( typ i c a l l y 2 0 to 2 3 d e c i m a l ) , o f t e n mus t pe r fo rm l e ng t h y p r o c e s s i ng th a t d o no t r e qu i r e d ev i c e i n t e r r up t s to b e b l o c k e d , t h e us ua l r e a so n fo r m a i n t a i n i ng h i g h 4-4 S OFTWARE INTERRUPTS I PL . Som e mech a n i sm i s r e qu i r ed t o a l l o w d ev i c e d r i v e r s to l owe r w i tho u t d e s t r o y i ng the i n t e r r up t n e s t i ng s c h eme . I PL S e v e r a l I PL v a l u e s ( 6 , a n d 8 to 1 1 ) and th e i r a s so c i a t ed SCB s l o ts a r e u s ed b y d ev i c e d r i v e r s t o a l l o w t h em t o c o n t i n ue t h e i r e x e c u t i o n a t l o we r I PL , a s s o - c a l l ed fo r k p r o c e s s e s . Th e r e a r e a l s o six q u a d wo r d l i s th e a d s a ssoc i a ted wi th the fo r k I PLs . ( Be c a us e I PL 7 s o f twa r e i n t e r r up t s a r e used by t h e s o f twa r e t i me r , t h i s l i s th e a d i s n o t u s ed by the f o r k p r o c e s so r b u t m e r e l y s e rv e s a s a p l a c e s a v e r so th a t c o n t e x t i nd ex ed ad d r e s s i ng c an b e used b y t h e fo r k p r o c e s so r a nd the f o r k d i s pa t c h e r wi th the I P L v a l ue a s a n i nd ex . ) Th e queue e l em e n t s t h a t d e sc r i b e e a c h i nd i v i d ua l o pe r a t i o n th a t m u s t b e pe r fo rmed at l o we r I P L a r e c a l l ed fo r k b l o c k s a nd a r e u s ed to pa s s c o n t ex t b e t we e n d r iver i n t e r r up t service r o u t i n e s a nd the fo r k l ev e l s o f twa r e i n t e r r up t s e rv i c e r o u t i n e s . A f o r k b l oc k ( p i c t u r ed i n F i g u r e 4 - 2 ) i s o f t en pa r t o f a l a rg e r s t r uc t ur e s u c h a s a un i t c o n t r o l b l o c k . Fork Queue Forward Link Fork Queue Backward Link Fork IPL Size Type Saved PC Figure 4-2 Saved R3 Saved R4 L a yo u t o f Fo r k B l o c k Wh en a d r i v e r wi she s t o l o we r i t s I P L ( by c r e a t i ng a fo r k p r o c e s s ) , i t calls rout i ne E XE $ F ORK wi th R S c o n t a i n i ng t h e a d d r e s s o f t h e f o r k b l ock . Th a t r o u t i n e s a v e s t h e d r i v e r c o n tex t ( R 3 , R 4 , a nd s a v ed PC ) in the fo r k b l o c k , i n se r t s the fo r k b l oc k i n to the a pp r o p r i a t e fo r k q ue ue , a nd r e que s t s a so f twa r e i n t e r r up t a t the r eque s ted I P L l ev e l (if the q u e ue wa s p r ev i o u s l y emp t y ) . Th e a c t ua l i n s t r uc t i o n s i n r o u t i n e EXE $ FORK t h a t pe r f o rm these f un c t i o n s a r e l i s t ed here to i l l u s t r a t e how wo r k que ue s a nd so f twa r e i n t e r r up t r e que s t s a re m a n ag e d . E XE $ F ORK : : R 3 , FKB $ L F R 3 ( R 5 ) MOVQ F KB $ L FPC ( R S ) POPL MOVZ B L FKB $ 8-F I PL ( R S ) , R4 W� SW I $G L F QF L- < 6 * 8 > [ R 4 ] , R 3 M OVAQ ( R S ) , @ 4 ( R3 ) I N S QUE 1 0$ BNEQ S OF T INT R 4 RSB 1 0$ : 4-5 SOFTWARE INTERRUPTS The fo r k d i s pa tch e r , wh i c h i s the so f t wa r e i n t e r r up t s e rv i c e r o ut i n e that executes in r e s po n s e to the r e q u e s t ed i n t e r r up t , ex ecutes a pp r o x i m a te l y th e fo l l o w i ng s e que n c e o f i n s t r uc t i o n s th a t r em ov e s e a c h queue e l em e n t in t ur n f r om t h e a � s o c i a t ed q u e ue a n d p r o c e s s e s i t . Th i s p r o c e s s i ng c o n t i n u e s un t i l t h e q u e ue i s emp t y , a t wh i c h t i m e the s o f twa r e i n t e r r up t i s d i sm i s s ed w i th an RE I • AL IGN E XE $ F ORKD S PTH : : PUS HR M F PR 10$: M OVAQ REMQUE BVS M OVQ M OVL • LONG i � M< R O , R l , R 2 , R 3 , R 4 , R S > i P R $ I PL , R O W � SWI$G L F QF L- < 6 * 8 > [ R O ] , Rl @ ( R l ) + , RS 20$ F KB $ L F R 3 ( R 5 ) , R 3 F KB $ L=F PC ( R S ) , R l JSB (Rl) BRB 10$ 20$ : P O PR REI i A M< R O , Rl , R2 , R 3 , R 4 , R S > 4.2.2 S o f twa r e T i m e r Mo s t o f t h e t i me r o pe r a t i o n s i n VM S e x ec u t e i n r e s po n s e t o a so f twa r e i n t e r r up t at I PL 7 . Th e s e o pe r a t i o n s a r e d e s c r i b ed i n d e t a i l i n Ch a p t e r 1 0 . Th e u s e o f s o f twa r e i n t e r r upts by the t imer s uppo r t r o u t i n e s i s d e sc r i b ed h e r e . Wh e n t h e h a rdwa r e c l o c k i n te r r up t serv i c e rout i ne ( e x e c u t i ng at I PL 2 4 ) d e te rm i n e s th a t f u r th e r s e r v i c e i s r eq u i r e d ( d ue t o q u a n t um e x p i r a t i o n o r b e c a u s e t h e f i r s t e l em e n t i n the c l o c k q u e ue h a s c om e d ue ) , i t r e qu e s t s a so f twa r e i n t e r r up t a t I P L 7 ( I P L $ T I M E R ) . Un l i k e the f o r k que ue d e sc r i b e d i n t h e p r ev i o us s e c t i o n , q u e ue e l em e n t s a r e n o t p l a c ed i n to t h e t imer q u e u e b y a n i n t e r r up t s e r v i c e r o u t i n e . Ra the r , t h e y a r e u s ua l l y p l a c ed t h e r e by one o f the timer r e l a t ed s ys tem s e rv i c e s ( s uch a s $ S E T I M R o r $ S C HDWK ) . Th e k e y to th e t i m e r que ue i s th a t th e q u e ue e l em e n t s a r e o rd e r ed by e x p i r a t i o n time so that only the f i r s t TQE has t o b e e x a m i n ed b y t h e h a r d wa r e c l o c k s e rv i c e r o u t i ne . Th e s o f twa r e i n t e r r up t s e r v i c e r o u t i n e r e c h e c k s f o r q u a n t um e x p i r a t i o n a nd t a ke s action i f n e c e s sa r y . After a n y r e q u i r ed q ua n t um end p r o c e s s i ng h a s o c c u r r ed , the so f twa r e t i m e r s e rv i c e r o ut i ne e x am i n e s the t imer q u e u e fo r a n y t i m e r r eq ue s t s t h a t h a v e e x p i red . An y t i m e r que ue e l em e n t th a t h a s a n e x p i r a t i o n t i m e earl i e r than the c ur rent s ys tem t ime is then r em o v e d f r om the t imer que ue a nd se r v i c ed . B e c a u s e o f t h e t i me o r d e r i ng o f t h e t i m e r q u e ue , th i s r em o v a l takes pl ace f r om t h e b eg i nn i ng of the l i st . Wh e n n o m o r e e x p i r ed t i m e r q u e ue e l em e n ts r em a i n ( th e e x p i r a t i o n t i m e o f t h e f i r s t TQE in the q u e ue is l a t e r than t h e c u r r e n t s y s t em t i m e ) , the s o f t wa r e i n t e r r upt i s d i sm i s s e d . No t e th a t a s e c o nd d i f fe r e n c e b e twe e n th i s s o f twa r e i n t e r r up t s e rv i c e rout i ne a nd f o r k p r o c e s s i ng i s th a t th e so f twa r e ( th e o n e s th a t t i m e r s e rv i c e r o u t i n e m a y l e a v e t im e r q u e u e e l em e n t s h av e n o t ye t ex p i r ed ) i n t h e que ue wh e n i t d i sm i s s e s t h e i n t e r r up t . 4-6 S OFTWARE INTERRUPTS 4.2. 3 I /O Po s tpr o c e s s i ng Wh e n a d ev i c e d r i v e r o r FDT r o u t i ne d e tec t s tha t a pa r t i c u l a r I /0 r equest i s c ompl e t e , i t c a l l s a r o u t i n e tha t p l a c e s the I /0 r e que s t pa c k e t ( po i n t ed t o b y R 3 ) a t t h e t a i l o f t h e I /0 po s t p r o c e s s i ng que u e ( l o c a t ed th r o ug h g l o b a l po i n t e r I OC $G L P S B L ) a n d r e que s t s a s o f twa r e i n t e r r u p t a t I P L 4 ( I P L $ I O POS T ) i f t h e que u e wa s p r ev i o u s l y empt y . Th e fo l l o w i ng s e t o f i n s t r uc t i o n s ( f r om r o u t i n e I OC $ R E QC OM i n m od u l e I O S UB N PAG ) shows the s i m i l a r i t i e s b e twe e n the s o f twa r e i n t e r r up t ( Othe r r o ut i n e s r e que s t s fo r f o r k p r o c e s s i ng a nd I /0 po s t p r o c e s s i ng . t h a t r e que s t a n I P L $ I O PO S T s o f twa r e i n t e r r upt , $ Q I O c o mpl e t i o n c o d e a nd ACP r o u t i n e s , e xec u t e s i m i l a r i n s t r uc t i o n s . ) 10$ : I N S Q UE ( R 3 ) , @ WA I O C $G L P S B L BNEQ 1 0$ S O FT INT # I P L $ I O PO S T Th e I /0 po s t pr o c e s s i ng so f twa r e i n t e r r upt s e r v i c e r o u t i n e r emov e s e a c h IRP in t ur n f r om t h e b eg i nn i ng o f t h e queue ( l o c a ted th r o ug h g l o b a l po i n t e r I OC $G L P S F L } a n d p r o c e s s e s i t . Wh e n t h e que ue i s empt y , the I PL 4 s o f twa re i n t e r r u p t i s d i sm i s s e d . Th e s i m i l a r i t i e s b e twe e n f o r k p r o c e s s i ng a nd I /0 po s t p r o c e s s i ng a r e a l s o fo und i n the i r r e spec t i ve so f twa r e i n t e r r up t s e r v i c e r o u t i n e s . Th e fo l l o w i ng i n s t r uc t i o n s f r om mod u l e I OC I O PO S T i l l u s t r a t e these s i m i l a r i t i e s . I O C $ I O PO S T : : M OVQ MOVQ M OVQ I O PO S T : REM QUE BVC M OVQ MOVQ M OVQ RE I R4 , - ( S P) R2 , - ( SP) RO , - ( S P ) @WA I O C $G L P S F L , R S 10$ ( S P ) + , RO ( S P ) + , R2 ( S P ) + , R4 10$ : Compl e t e p r o c e s s i ng o f th i s r e q u e s t B Rx 4. 2. 4 I O PO S T Re s c h ed u l i ng I n t e r r up t Th e r o u t i n e tha t r em o v e s a p r o c e s s f r om e x ec u t i o n a nd s e l ec ts the h i g h e s t pr i o r i t y p r o c e s s fo r execution is i nv o k e d a s a s o f t wa r e i n t e r r up t s e rv i c e r o u t i n e a t I P L 3 ( I P L $ S C HED ) b y t h e r o u t i n e th a t makes a p r o c e s s c om p u t a b l e . Wh e n e v e r th e s t a t e o f a p r o c e s s b e c o m e s c ompu tab l e a nd i t s pr i o r i t y i s g r e a t e r th a n o r e q u a l to the p r i o r i ty o f t h e c u r r e n t p r o c e s s , t h i s s o f twa r e i n t e r r up t i s r eq u e s t e d . Because s ev e r a l p r o c e s s e s c o u l d a l l b e c o m e c om p u t a b l e a t e f f e c t i v e l y t h e s a m e t ime , there could b e m u l t i pl e r eq ue s t s fo r th i s s o f twa r e i n t e r r up t s e rv i c e r o u t i n e . 4-7 S OFTWARE INTERRUPTS Th e r e sc h ed u l i ng i n te r r up t is not to ta l l y i nd e pend e n t o f process c o ntex t l i ke the f o r k p r o c e s s i ng a nd I /O p o s t p r o c e s s i ng i n t e r r up t s . Th e S C B e n t r y f o r t h i s i n t e r r up t ( Ta b l e 4 - 1 ) i nd i c a t e s th a t i t sho u l d b e s e r v i c ed o n t h e k e r n e l s t ac k . I n f a c t , i t s f i r s t o pe r a t i o n i s to r emove the c u r r e n t p r o c e s s f r om e x e c u t i o n w i t h a SVPC TX i n s t r uc t i o n . Howeve r , that i n s t r uc t i o n pe r fo rm s a s t ac k s w i t c h f r om t h e ke r n e l s t ac k t o t h e i n te r r up t s t a c k s o t h e r e s t o f t h e r e s c h e d u l i ng i n t e r r up t s e rv i c e r o u t i n e i s pe r fo rmed i n s y s t em c o n t e x t . Th e o pe r a t i o n o f t h e s c he d u l e r , i nc l ud i ng a d e ta i l ed d e sc r i pt i o n o f the r e sched ul i ng i n te r r up t , i s d i sc u s s ed i n Ch a pt e r 8 . U n l i k e f o r k p r o c e s s i ng o r I /0 p o s t p r o c e s s i ng r e q ue s t s , the re is no n e ed to c o un t r e que s t s f o r the r e s c h ed u l i ng i n t e r r up t b e c a u s e o n l y o n e p r oc e s s c a n b e c u r r en t a t a g i v e n t i me . Th e so f twa r e p r i o r i t i e s of t h e c omp u t a b l e p r oc e s s e s d e te rm i n e wh i c h o f them i s c ho s en f o r e x ec u t i o n . Th e s c h ed u l e r wi l l s e l e c t t h e p r oc e s s w i th the h i g h e s t s o f twa r e p r i o r i ty . Th e rest of the p r o c e s s e s wi l l r ema i n i n the c omputa b l e s t a t e un t i l some s ys t em event o c c u r s that a l te r s the s c h e d u l i ng b a l a n c e o f t h e sys t em and c a u s e s one of these p r o c e s s e s to be s e l e c t ed f o r ex e c u t i o n . Fo r e x ampl e , i f a h i g h e r p r i o r i t y p r o c e s s we r e t o b ecome c om p u t a b l e , an I PL 3 s o f twa r e i n t e r r up t wo u l d b e r eque s t ed . ( I f t h e c u r r e n t p r o c e s s we r e to enter a wa i t s t a t e , a d i f f e r e n t pa th i s t a k e n th r o ug h t h e s c h ed u l e r , o n e th a t bypa s s e s the s o f twa r e i n t e r r up t r eq u e s t a nd e x e c u t e s the code c o n t a i n ed in the s e co nd h a l f o f the r e s c h ed u l i ng i n te r r up t s e rv i c e r o u t i n e . ) 4 . 2. 5 AST De l i v e r y I n t e r r up t Th e so f t wa r e i n t e r r up t t h a t i nd i c a t e s t h a t th e r e i s a n AST to del iver d i f f e r s i n s ev e r a l r e s p e c t s f r om t h e o t he r s o f twa r e i n t e r r up t s . • • • Th e A S T d e l i v e r y i n t e r r up t is a s s o c i a t ed wi th a spec i f i c p r o c e s s a nd i s s e r v i c ed o n the k e r n e l s t ac k o f th a t p r o c e s s . Th e i n t e r r up t r e q u e s t i s m a d e i n two s t eps . Ro u t i n e s that r e c og n i z e tha t the r e is a n A S T t h a t c a n b e d e l i v e r ed to a p r o c e s s i n d i c a t e t h a t b y wr i t i ng th e a c c e s s m o d e a s s o c i a t ed w i th the A S T i n to a pe r - p r o c e s s p r i v i l eg e d r eg i s t e r c a l l ed t h e A S T l e v e l r eg i s t e r ( PR $ A S T LVL ) . Th e . RE I i n s t r uc t i o n c ompa r e s th e c o n ten ts o f th i s r eg i s t e r wi th t h e a c c e s s m o d e t h a t i t i s r e s to r i ng to d e t e rm i n e wh e th e r to r e q ue s t an I P L 2 s o f twa r e i n t e r r up t . As th i s m e c h a n i sm s ug g e s t s , I P L 2 s o f twa r e i n t e r r up t s h a v e s e c o nd d i m e n s i o n a s so c i a t ed wi th t h em , n am e l y a c c e s s mo d e . Th e u s e o f ASTs i n VM S i s so i mpo r t a n t th a t t h e y a r e s e pa r a te c h a pt e r ( Ch a p t e r 5 ) . 4-8 d e sc r i b ed in a a CHAPTER 5 AST D E L I VE RY A s yn c h r o n o u s sys t e m t r aps ( ASTs ) a r e a m e c h a n i sm fo r s i g n a l l i ng a s ynch r o no u s e v e n t s to a process . Spec i f i c a l l y , a p r o c ed u r e ( o r r o u t i n e ) d e s i g n a t ed b y e i th e r the p r o c e s s o r the s ys t em executes in the contex t of the p r o c e s s . ASTs a r e c r e a t ed i n r e s po n s e to s y s t em s e rv i c e s s uc h a s $QIO, $ S E T IM R , a nd $ DC LA S T . Ad d i t i o n a l l y , u n r e que s ted ASTs o c c u r a s i m p l i c i t r e s u l t s o f o t h e r o pe r a t i o n s s uc h a s I /0 c om p l e t i o n , p r o c e s s s u spe ns i o n , a n d o b t a i n i ng i n fo rm a t i o n about a n o th e r p r o c e s s w i th the $G E TJ P I s ys tem s e r v i c e . Th e r e a so n th a t A STs a r e u s e d fo r the s e o p e r a t i o ns i s t h a t i t i s ne c e s s a r y f o r a p i ece of c od e to execute i n the c o n tex t o f a s p e c i f i c p r o c e s s . ASTs f u l f i l l th i s n e ed . AST e n q u e u i ng i s a s ys t em e v e n t t h a t m a y r e sul t in a r e s c h ed u l i ng A S T d e l i v e r y o c c u r s i n the c o n t e x t o f t h e p r o c e s s th a t i s i n ter r upt . t o a c t ua l l y r e c e i v e t h e A S T . Th i s c h a p t e r d i sc us s e s how ASTs a re e nque ued and d e l i v e r ed to a p r o c e s s . Se v e r a l e x amp l e s o f h o w A S Ts a r e u s ed b y VM S a r e a l s o i n c l ud ed . 5. 1 HARDWARE ASS I STANC E TO AST D E L I VE RY The d e l i v e r y o f A S Ts i s o n e e x am p l e o f t h e VAX h a r d wa r e p r o v i d i ng a s s i s t a n c e to VM S . Th r e e h a r d wa r e c om po n e n t s o r m e c h a n i s�s c o n t r i b u t e to AST d el ivery : • th e RE I i n s t r u c t i o n , • th e PR$ _A S T LVL p r o c e s s o r r eg i s te r , and • the I P L 2 s o f t wa r e i n t e r r upt . Th e f i r s t t wo f e a t u r e s a r e d i sc u s s ed in th i s sec t i o n . Th e i n t e r r u p t s e r v i c e r o u t i n e , AS TDE L , i s d i s c u s se d i n Sec t i o n 5 . 3 . 5. 1 . 1 I PL 2 RE I I n s t r uc t i o n Th e r e t u r n f r om except i o n o r i n t e r r upt rout i ne i n s t r uc t i o n , RE I , p rov i d e s the initial s t ep in the d e l i v e r y o f a n A S T t o a p r o c e s s . Am o ng t h e o pe r a t i o n s pe r f o rm e d by t h e RE I m i c r o c o d e a r e the fo l l o w i ng . 1. A c h e c k i s m a d e to d e t e r m i n e wh i c h s t a c k w i l l b e a c t i v e a f t e r th e re turn . N o A S Ts a r e d e l i v e r ed i f t h e i n t e r r u pt s t a c k i s ac t i ve . 5-l AAS T D E L I VE RY 2. Th e va l u e i n t h e A S T l ev e l p r o c e s so r r eg i s t e r , PR$ A S T LVL , i s co mpa r e d w i t h the a c c e s s mod e to wh i c h c o n t rol i s b e i ng pa s s ed . I f t h e " d e s t i n a t i o n " a c c e s s m o d e n umb e r i s l e s s t h a n t h e va l u e i n PR $ _A S T LVL , n o A S Ts c a n b e d e l i v e r ed . 3. I f the i n t e r r upt s t a c k i s no t g o i ng to b e u s ed a nd t h e a c c e s s mod e n um b e r i s g r e a t e r t h a n o r e q u a l t o t h e PR $ A S T LVL v a l u e , t h e n a n A S T c a n be d e l i v e r ed . Th e RE I i n s t r uc tio n m i c r o c o d e r e qu e s t s a so f t wa r e i n t e r r upt at I PL 2 . ( No t e th a t t h e r e q u e s t e d I P L 2 i n t e r r upt w i l l n o t a c t ua l l y b e d e l i v e r ed unt i l the I P L d r o p s b e l o w 2 . ) Th e I P L 2 s o f twa r e i n t e r r u pt s e rv i c e ro ut i ne is f o und at g l o b a l location S C H $AS TDE L ( Sec t i on 5 . 3 ) . A S TLVL P r o c e s so r Reg i s t e r 5.1. 2 ( PR $_AS T LVL ) Th e p r o c e s s o r r eg i s t e r , P R $ A S T LVL , i s a pe r - p r o c e s s h a r d wa r e r eg i s t e r i nd i c a t i ng th e d e l i v e r a bTl i t y o f A S Ts to the c u r r en t process . PR $ A S T LVL i s pa r t o f t h e h a r d wa r e c o n t e x t o f t h e p r o c e s s ( l o ad ed b y LDPCTX ) and is r e c o rd ed in t h e h a r d wa r e p r o c e s s c o n t r o l block ( Ch a p t e r 8 ) . PR$ _A S T LVL c a n c o n t a i n t h e f o l l o w i ng v a l u e s : A k e r n e l mod e AS T i s d e l i v e r a b l e . An e x e c u t i v e m o d e A S T i s d e l i v e r ab l e . A s upe r v i s o r m o d e A S T i s d e l i v e r a b l e . A u s e r mod e A S T i s d e l i v e r a b l e . No AST i s d e l i v e r a b l e . 0 1 2 3 4 Th us , i f an AST i s d e l i v e r ab l e , PR$ A S T LVL c o n t a i n s the access mode va l u e fo r the m o d e i n wh i c h t h e AST i s t o e x e c u t e . Th e " n u l l " v a l ue o f f o u r i s c h o s e n so th a t t h e RE I t e s t , d e s c r i b e d a b ov e , wi l l fai l , r eg a r d l e s s of the " d e s t i n a t i o n " a c c e s s m o d e o f t h e RE I i n s t r uc t i o n . I f t h e a c c e s s m o d e o f t h e d e l i v e r a b l e A S T i s a t l e a s t a s p r i v i l eg ed a s the d e s t i n a t i o n a c c e s s m o d e o f t h e RE I i n s t r uc t i o n , t h e A S T d e l i v e r y i n te r r up t w i l l b e r e q u e s t e d . 5. 2 Q U E U ING AN AST TO A PROC E S S ASTs a r e que ued to a proc ess as the c o r r e s po n d i ng events ( I /0 compl e t i o n , t i me r expi ra t i on , and so on) occur . Th e AST q u e ue i s ma i n t a i n ed a s a l i s t s t r uc t u r e o f AST c o n t r o l b l o c k s ( ACBs ) w i th the l i s th e ad c o n t a i n ed in the s o f twa r e p r o c e s s co n t r o l block ( PC B ) ( Fi g u r e 5- l ) . AST C o n t r o l B l o c k 5. 2. 1 Th e A S T c o n t r o l b l o c k d e l i ve r a n AST ( AC B ) d e f i ne s the nec e s s a r y i n f o r ma t i o n • to t h e c o r r e c t p r o c e s s a nd A S T r o u t i n e , • i n t h e c o r r e c t a c c e s s mo d e , a n d • wi t h t h e a pp r o p r i a t e pa r am e t e r pa s s e d t o t h e r o u t i n e . 5-2 to AST DE L I VE RY the { spec i f i c a l l y , Th e AC B i s a l l o c a ted f r om no npag ed d yn am i c memo r y I / 0 r e qu e s t pa c k e t l o o k a s i d e l i s t , d e s c r i b ed i n Ch a p te r 2 5 ) b e f o r e t h e q u e u i ng o f a n AST t o a p r o c e s s i s r e q u e s t ed . r e l ev a n t the F i g u r e 5 - l s h ows the fo rm a t o f a n A S T c o n t r o l b l o c k a nd ACB $ L A S T Q F L a nd A C B $ L_A S T QB L l i n k t h e AC B i n to s o f t wa r e P C B f i e l d s . the is que ue th i s of Th e l i s th e ad th e A S T q u e ue f o r the p r o c e ss . Th e f i e l d PCB $ L A S T QF L a nd PC B $ L A S T QB L . f i elds , of pa i r l o ng wo r d AC B $ B_RMOD p r o v i d e s t h r e e t ype s o f - i n f o rm a t i o n . 1. B i t s 0 a n d 1 ( AC B $ V RMOD ) c o n t a i n t h e va l u e c o r r e s po nd i ng the a c c e s s mod e i n wh i c h the AST r o u t i n e i s to e x e c u t e . 2. the B i t 6 ( AC B $V Q U O TA ) i n d i c a t e s wh e the r the a l l o c a t i o n o f f o r i n the p r o c e s s A S T q uo t a , a c c o un t e d is s t r uc tur e d a ta PC B $W A S TCNT . 3. B i t 7 ( AC B $V KAS T ) i n d i c a t e s t h e p r e s enc e o f a s p e c i a l k e r n e l mod e A S T ( S e c t i o n s 5 . 2 . 3 a n d 5 . 4 ) . to Software Pro c ess Control Blo c k (PCB) I ASTEN I ASTACT ASTQFL ASTQBL ����----------� I AST Control Block (ACB) �::::::::::�A�S�T�Q�F�L��==�:J������ ASTQBL �. SIZE RMOD I TYPE I PID AST ASTPRM KAST I\._ �---------�------------------------� ASTCNT RMOD Bits: 7 6 5 2 1 0 I I C>SJ j U SPARE MODE QUOTA KAST Figure 5-l A S T Co n t r o l B l o c k a nd AST Qu e ue i n So f t wa r e PCB AC B $ L A S T AC B $ L P I D i d e n t i f i e s wh i c h p r o c e s s i s to r e c e i v e t h e A S T . a nd ACB $ L A S T PRM a r e t h e e n t r y po i n t o f the d e s i g n a t ed A S T r o u t i n e a nd AC B $ L KA S T c o n t a i n s t h e e n t r y po i n t th e A S T par am e t e r , r e sp e c t i v e l y . the if mode A S T r o u t i n e k e r nel s p ec i a l sys tem- r e qu e s ted a of AC B $V KAS T b i t o f AC B $ B_RM O D i s s e t ( i t em 3 a bove ) . 5-3 AST DE L IVE RY ACBs a r e c r e a te d by th r e e t ype s o f a c t i o n . 1. Th e p r o c e s s e x p l i c i t l y d e c l a r e s a n A S T . Th e $ DC LAST s ys tem s e r v i c e s i m p l y a l l o c a t e s a n AC B , f i l l s in the ACB i n fo rma t i o n f r om i t s a rg um e n t l i s t , a n d r eq ue s t s t h e q u e u i ng o f t h e ACB . Two c h e c k s a r e m a d e to e n s u r e tha t • • t h e A S T q uo t a f o r t h e p r o c e s s r e q ue s t , a nd is not by the th e a c c e s s m o d e i n wh i c h t h e A S T r o u t i n e i s t o e x e c u t e i s n o mo r e p r i v i l eg ed t h an the a c c e s s m o d e f r om wh i c h t h e s y s tem s e r v i c e wa s c a l l ed . Th e AC B$V Q U O TA b i t i s s e t to i nd i c a t e c o un t e d aga i n s t t h e p r o c e s s AST q uo t a . 2. e x c e e d ed th a t thi s AST is Th e p r o c e s s r e q ue s t s a n AST to b e a s s o c i a t ed wi t h an event s uc h a s th e c om p l e t i o n of a n I /0 r e qu e s t ( $ Q I O o r Upd a t e S e c t i o n s ys t em s e r v i c e ) o r a t i m e r r eq ue s t ( $ S E T IM R s ys t em Sys t em s e r v i c e s s uc h a s th e s e h a v e a r g um e n t s t h a t service) Th e i nc l ud e a n A S T r o u t i n e e n t r y po i n t a nd a n A S T pa r am e t e r . d el ivery o f a n AS T i s a c c o un t ed f o r i n the PC B $W A S TC NT f i eld . Th e c o n t r o l b l o c k ( AC B ) i s a c t ua l l y a r e u s e of the I /0 r e qu e s t pa c k e t ( I R P ) o r t i m e r q u e u e e l em e n t ( TQE ) us ed i n ( Co mpa r e t h e ACB f o rm a t p i c t u r ed in t h e i n i t i a l o pe r a t i o n . F i g u r e 5 - l wi th the TQE f o rma t s h o wn i n Ch a p t e r 1 0 and t h e I R P l a yo u t s h o wn i n App e n d i x A o f t h e VAX/VM S G u i d e to W r i t i ng a Dev i c e D r i v e r . • 3. 5. 2. 2 Th e s y s t em , o r a no th e r p r o c e s s , c a n r e que s t a n A S T to e x e c u t e c od e in th e c o n t e x t o f t h e s e l e c t ed p r o c e s s . E x am pl e s o f t h i s t ype o f a c t i o n i n c l ud e I/0 c o mp l e t i o n , $G ETJ P I f r om a no th e r p r o c e s s , Fo r c ed Ex i t s ys t em s e r v i c e , a nd wo r k i ng s e t a d j us tm e n t a s pa r t o f t h e q u a n t um e nd e v e n t ( Ch a p t e r 8 ) . AST c o n t r o l b l o c k s u s ed in th e s e s i t ua t i o n s a r e not d ed uc t ed f r om the AST q u o t a o f the t a rg e t p r o c e s s b e c a u s e o f the i r i nvo l un t a r y n a t u r e . Acc e s s Mo d e a nd AST Que u i ng Th e ACB $V RMOD b i t s o f t h e AC B $ 8 RMOD f i e l d d e t e rm i n e the i nse r t i on po s i t i o n -o f a n A S T c o n t r o l b l o ck wh e n i t i s que ued to a p r o c e s s . Th e AS T q u e ue i s m a i n t a i ned a s a f i r s t - i n f i r s t - o u t ( F I F O ) l i s t fo r each a c c e s s mo d e . A S T s o f d i f f e r e n t a c c e s s mod e s a r e pl a c e d i n to t h e q u e ue i n a s c end i ng a c c e s s m o d e o r d e r , t h a t i s , k e r n e l m o d e ASTs f i r s t a nd us e r m o d e A S Ts l a s t . Wh e n the s ub r o u t i n e S C H $ QA S T ( i n m o d u l e A S TDE L ) is i nv o k e d , the p r e a l l o c a t ed a n d p r e i n i t i a l i z ed AST c o n t r o l b l o c k i s i n s e r t ed i n to t h e I P L $ _S YNC H . Th e fo l l o w i ng A S T q u e ue o f t h e a pp r o p r i a t e p r o c e s s at s t eps a r e pe r fo rmed . 1. I f t h e p r o c e s s i s nonex i s t e n t , t h e ACB i s d e a l l o c a t ed and t h e A S T e v e n t i s i g n o r ed . A n e r r o r s t a t us c o d e i s r e t u r n ed . 2. I f t h e A S T q u e u e i s emp t y ( th e c o n t e n t s o f PCB $ L ASTQF L a r e e q ua l to i ts ad d r e s s ) , t h e AC B i s i n s e r ted as the f i r s t e l em e n t i n t h e A S T q u e ue . 5-4 AST DE L IVE RY 3. 5. 2. 3 Ot h e r w i s e , t h e que u e e l em e n t s ( AC Bs ) a r e s c anned u n t i l e i th e r t h e end o f t h e q u e u e i s r e a c h e d o r a n ACB i s f o und w i th a n a c c e s s mod e l e s s p r i v i l eg ed t h a n t h e o n e b e i ng i n s e r t ed ( th a t is, t h e A C B $V RMOD v a l u e i s h ig h e r ) . Th e n e w AST c o n t r o l b l o c k i s i n s e r ted a t t h i s po i n t . Th u s , ASTs are f i r s t- i n f i r s t - o u t w i th i n a n a c c e s s m o d e a nd g r o up e d b y a c c e s s m o d e i n d e c r e a s i ng amo u n t o f p r i v i l eg e . Us e r m o d e ASTs a r e a l wa y s p l a c ed a t t h e t a i l o f t h e q u e ue . S p e c i a l Ke r n e l Mo d e ASTs S p e c i a l k e r n e l mode ASTs r e p r e s e n t a f i f t h type o f AST . Th e y a r e ma i nta i ned a s a s e p a r a t e g r o up i n the AST q u e ue . Sp e c i a l k e r n e l m od e ASTs a r e i nd i c a t ed b y t h e ACB$V KAST b i t of t h e ACB $ B RMOD f i e l d . Inse r t i on o f a s pe c i a l k e r n e l -m9d e AST w i l l o c c u r a f t e r -a n y p r e v i o us s pe c i a l k e r ne l mod e ASTs , b u t b e fo r e any " no rm a l " A S Ts o f a n y a c c e s s m o d e ( i nc l ud i ng k e r n e l ) . Th u s , t h e o rg a n i z a t i o n o f t h e A S T que ue i s : l i s th e a d - s p e c i a l - " n o rma l " ..-. e x ec- - s upe r - -- u s e r ( PC B ) ut ive v i so r k e r ne l ke rnel Sec t i on 5 . 4 d i sc us s e s spec i a l k e r ne l s ev e r a l e x am p l e s . 5. 2. 4 ASTs mo r e f ul ly a nd prov i d e s Comput a t i o n o f a New Va l ue f o r ASTLVL An AST c a n be enque ued to a p r o c e s s a t a n y t im e , b e c a u s e the s o f twa r e PC B a n d t h e AST c o n t r o l b l o c k s a r e n e i t h e r pag e d no r swa ppe d . Each t i m e a n A S T c o n t r o l b l o c k i s i n s e r ted i n to t h e q u e u e , the a s s i g nm e n t of a v a l ue to A S T LVL ( p r o c e s so r r eg i s t e r a n d ha r d wa r e PCB f i e l d ) i s a t t em p t ed . Howe v e r , t h e p r o c e s s c a n b e i n a ny o n e o f th ree po s s i b l e s i t ua t i o n s t h a t d e t e rm i n e t o wh a t d eg r e e th e s t a t e o f the AST q u e ue c a n be upd a t ed . • • • I f a p r o c e s s i s o u t s wa pped , t h e A S T LVL c a nno t b e bec a use the process h e a d e r ( i n c l ud i ng t h e h a r d wa r e c o n t r o l b l o c k ) i s no t av a i l a b l e . Wh e n the process r e s i d e n t and compu t a b l e at a later t i m e , ASTLVL c a l c u l a t ed by t h e s wa ppe r ( by i n v o k i ng S C H $ N EWLVL in AS TDE L ) . upd a t e d proc e s s becomes wi ll be mod ul e If the p r o c e s s i s m em o r y r e s i d e n t b u t not cur rently e x e c ut i ng , th e n e w v a l ue fo r A S T LVL w i l l b e r e c o r d ed i n t h e h a rdwa r e PCB f i e l d b u t n o t i n th e p r o c e s s o r r eg i s te r . I f t h e p r o c e s s i s c u r r e n t l y e x e c u t i ng , t h e n e w wi l l be s t o r ed in both the h a r d wa r e PC B p r o c e s s o r r eg i s t e r , PR$_ASTLVL . ASTLVL va l u e f i e l d and the Th e AS T LVL v a l u e i nd i c a t e s the d e l i v e r a b i l i t y a nd a c c e s s mod e o f the f i rst pend i ng AST in the que ue . Th e r e is n o i nd i c a t i o n o f t h e d e l i v e r a b i l i ty o f a n y o t he r pend i ng ASTs . A S T LVL i s c a l c u l a t ed i n t h e f o l l o w i ng s t eps . 1. I f t h e f i r s t p e nd i ng A S T i s a s pec i a l ke r n e l mode a l so S e c t i o n s 5 . 2 . 3 a n d 5 . 4 ) , AST LVL b e c o m e s 0 . 5-5 AST ( see AST DE L I VE RY 2. I f the p r o c e s s a l r e ad y h a s a n a c t i v e A S T a t the same access mo d e a s th e f i rst pend i ng AST , ASTLVL i s s e t t o 4 . Th e e x i s t e n c e o f an a c t i v e AST i n a n y a c c e s s m o d e i s i nd i c a t ed by s e t t i ng t h e c o r r e s po nd i ng bit in the PC B $ 8 A S TACT f i e l d ( Fi g ure 5 - l ) . De l i v e r y o f an AST sets th i s b i t , a nd c ompl e t i o n o f an A S T c l e a r s i t ( S e c t i o n 5 . 3 ) . 3. I f t h e p r o c e s s h a s d i s a b l ed t h e d e l i v e r y o f a n y AST in the a c c e s s mod e of the fi rst p e nd i ng A S T , ASTLVL i s a l s o s e t to 4 . D i s a b l i ng A S T d e l i v e r y f o r a pa r t i c u l a r access mode r equ i res c l e a r i ng t h e c o r r e s po nd i ng b i t o f t h e PC B $ 8 ASTEN f i e ld ( Fi g ure 5- l ) . By d e f a ul t , a l l a c c e s s mod e s a r e enab l ed fo r AST d e l i ve ry . Th e $ S E TA S T s y s tem s e r v i c e s e t s o r c l e a r s t h e PC B $ B _A S T E N b i t c o r r e s po nd i ng t o t h e a c c e s s m o d e o f i ts caller . 4. I f , f o r t h e a c c e s s m o d e o f the f i r s t pe nd i ng AS T , th e r e i s no a c t i v e AST a nd t h e d e l i v e r y o f A S Ts is ena b l e d , then the ASTLVL r e g i s t e r i s l o ad ed w i th t h e v a l u e of tha t a c c e s s m o d e ( a v a l u e f r om z e r o th r o ug h th r e e ) . Th e v a l ue o f ASTLVL p r o d u c e d by th i s a l g o r i thm w i l l b e e x am i n ed each t ime a n RE I i n s t r uc t i o n r e t u r n s c o n t r o l to t h e p r o c e s s f r om i n t e r r up t o r e x c e p t i o n s e r v i c e r o u t i n e s ( s uc h a s t h e s c h ed ul e r and the pag e r ) . Th e r o l e o f the RE I i n s t r uc t i o n wa s d e sc r i b ed i n S e c t i o n 5 . 1 . 5. 3 D E L I VE R ING AN AST TO A PROC E S S A n A S T i s d e l i v e r ed to a p r o c e s s wh e n a n RE I i n s t r uc t i o n d e t e rm i n e s ( f r om t h e d e s t i n a t i o n a c c e s s m o d e a nd t h e PR $ ASTLVL r eg i s te r ) th a t a pend i ng AST i s del ive rabl e ( S e c t i o n s 5 . 1 and 5.2) . A s o f twa r e i n t e r r up t i s r e q ue s ted a t I P L 2 . Th e am o un t o f t i me b e f o r e t h e A S T i s a c t ua l l y d e l i v e r ed i s d e pend e n t upo n t h e i n t e r r upt a c t i v i ty o f the s ys t em . Wh e n I P L f i n a l l y d r ops b e l o w t wo , the AST d e l i v e r y i n t e r r upt s e r v i c e r o u t i n e w i l l b e e x e c u t ed . AST De l i v e r y I n t e r r upt 5. 3. 1 Ro u t i n e S C H$ASTDE L ( i n mod ul e A S TDE L ) i s the I P L 2 i n te r r u pt s e rv i c e rout i ne . I ts f un c t i o n is to r em o v e t h e f i r s t pe nd i ng AST f r om the q u e u e a nd d i s p a t c h to the a pp r o p r i a t e AST r o u t i ne in the correct a c c e s s mod e . S C H $ A S TDE L p e r fo rm s t h e f o l l o w i ng o p e r a t i o n s . l. A f t e r r a i s i ng t h e I P L to SYNC H , t h e f i r s t AST c o n t r o l block is r em o v ed f r om th e A S T q u e ue o f t h e p r o c e s s . I f t h e que ue wa s empt y , the rout ine i mm e d i a t e l y e x i t s wi th an RE I i n s t r uc t i o n . 2. Th e r em o v e d AC B i s t e s t e d fo r a s pe c i a l k e r n e l m o d e AST ( us i ng ACB$V KAST i n ACB $ 8 RM OD ) . If the AST i s a s pe c i a l k e r n e l A S T , a -s h o r tened s e q uenc e o f s t eps o c c u r s : a. I P L i s d r o pped f r om SYN C H t o I P L $ A S TDE L ( I P L 2 ) . 5-6 AST DE L IVERY b. Th e s pe c i a l k e r n e l m o d e r o u t i n e i s d i s pa t c h ed t h r o ug h a JSB i n s t r uc t i o n w i th t h e ACB a d d r e s s i n R 5 a n d t h e PC B add r e s s i n R4 . c. On r e t u r n f r om t h e spec i a l k e r n e l mod e r o u t i n e , ASTLVL i s r e c om p u t e d ( S e c t i o n 5 . 2 . 4 ) , a nd the r e t u r n to th e p r o c e s s o c c u r s t h r o ug h a n R E I i n s t r uc t i o n f r om I P L 2 . 3. I f the A S T r em o v e d f r om t h e q u e ue i s n o t a spec i a l ke r ne l mod e AST , t h e n a c h e c k i s m a d e t o c o n f i rm th a t t h e mod e o f t h e A S T i s a t l e a s t a s p r i v i l eg e d a s the d e s t i n a t i o n of the RE I i n s t r uc t i o n that i n i t i a t ed AST d e l i v e r y . Th i s is a c c ompl i s h ed b y c h e c k i ng the s a ved PS L o n the ke rnel s t ac k . If t h e m o d e o f t h e A S T i s n o t c o r r e c t , t h e AC B i s r e i n s e r t e d a t the h e a d o f t h e q u e u e a nd t h e r o u t i n e ex i ts th r o ug h the RE I i n s t r uc t i o n . S i m i l a r checks a r e mad e fo r a l read y a c t i ve A S Ts and f o r d i sa b l ed access modes . Th e c o r r e s pond i ng AC B $ B_ASTACT b i t i s u n c o nd i t i o n a l l y s e t . 4. I f t h e A S T i s d e l i v e r ab l e , t h en the fo l l o w i ng o p e r a t i o ns p e r fo rmed b e f o r e d i s pa tc h i ng to the AST r o u t i n e . a re a. I f t h e A C B i s a c c o un t ed f o r i n the PC B $W A S TCNT q uo t a , t h e n t h e c o u n t i s i n c r em e n t e d to s h o w d e l ive r y o f t h e A S T a nd d e a l l o c a t i o n o f t h e ACB t o no npag ed po o l . b. A S T LVL i s r ec ompu t ed bec a u s e t h e r emo v a l o f the f i r s t AC B a l t e r s t h e s t a t e o f t h e A S T q ue ue . c. A k e r n e l m o d e AST d o e s n o t r e qu i r e c h a ng i ng a c c e s s m o d e , Fo r and the a pp r o p r i a t e stack is a l read y ac t i ve . the e x e c u t i v e , s upe r v i s o r , a n d u s e r mode ASTs , h o wev e r , i n a c t i v e s t a c k po i n t e r i s o b t a i n ed . d. A n a r g um e n t l i s t ( d e s c r i b ed i n t h e n e x t s e c t i o n ) o n t h e s t a c k o f t h e AS T ' s a c c e s s m o d e . e. Fo r A S Ts fo r t h e o u t e r th r e e a c c e s s m o d e s , a PC/ P S L p a i r o f l o ng wo r d s i s p u s h e d o n to the ke r n e l s t a c k . Th e s to r ed PC i s t h e l o c a t i o n E XE $ A S TD E L , the A S T d i s pa tc h e r . Th e s t o r ed PS L c o n t a i n s t h e a c c e s s m o d e i n wh i c h t h e A S T i s t o b e d e l i v e r ed i n b o th i t s c u r r en t mod e a nd p r ev i o u s mod e f i e l d s . f. Th e AC B i s d e a l l o c a t e d a nd r e t u r n ed to memo r y . g. EXE $AS TDE L e x ec u t e s i n the a c c e s s m o d e o f t h e AS T . Fo r ke r n e l mod e , t h i s me r e l y � e q u i r e s d r o p p i ng t h e I P L t o ze r o . Fo r t h e o th e r a c c e s s mod es , t r ans f e r of control a n d c h a ng e o f a c c e s s m o d e i s a c compl i sh e d th r o ug h a n R E I i n s t r uc t i o n , t h e o n l y wa y t o r each a l e s s p r i v i l eg ed access mode ( Fi g u r e 1-4 ) . ( Th e PC a nd PS L u s e d b y t h e R E I i n s t r uc t i o n a r e d e sc r i b ed a bove i n i t em 4 e . ) A CALLG i n s t r uc t i o n i s e x e c u t ed , t r a n s f e r r i ng c o n t r o l to th e AST p r o c ed u r e , w i t h t h e a rg um e n t po i n t e r ( AP ) po i n t i ng t o t h e a r g um e n t l i s t . 5-7 no npag ed is bui l t d yn am i c AST D E LIVERY 5.3.2 A r g umen t L i s t Us e r-wr i t t e n ASTs a r e p r o c ed u r e s , wh i c h m e a n s th a t t h e y c a n b e w r i t t en I f they a r e w r i t te n i n a s s emb l y l a ng uag e , t h e y m u s t i n a ny l a ng u a g e . b eg i n w i th an en t r y m a s k a nd r e t u r n c o n t r o l to the i r c a l l e r ( th e AST d i s pa t c h e r ) w i th a RET i n s t r uc t i o n . F i g u r e 5 - 2 s h ows the a rg um e n t l i s t pa s s e d to a n AST p r o c ed u r e b y the i n t e r r up t s e rv i c e r o u t i n e , ASTDE L . Th e AS T p a r am e t e r i s o b t a i n e d f r om th e AC B wh e r e it wa s i n i t i a l l y s to r ed by a s ys tem s e rv i c e s uc h a s $ S ETIMR, o r $ DC LAS T . Th e pa r am e t e r wa s o r i g i n a l l y a n a rg um e n t $QIO, t o th a t s ys tem s e rv i c e . Th e i n t e r p r e ta t i o n o f the AST p a r am e t e r is the r e s po n s i b i l i t y o f the o r ig i na l c a l l i ng r o ut i ne a nd t h e AST p r o c ed u r e . ASTPRM SAVED RO SAVED R1 SAVED PC SAVED PSL Figure 5-2 I 5 � AP A r g um e n t L i s t Pa s s ed t o AST by D i s p a tc h e r Th e g e n e r a l pur po s e r eg i s t e r s , R O and R l , a r e s a v e d i n t h e a rg um e n t l i st beca use the p r o c ed u r e c a l l i ng c o n v e n t i o n d o e s n o t p r e s e r v e the v a l u e s o f t h e s e r eg i s t e r s . Th e a s yn c h r o n o u s n a t u r e o f ASTs i mp l i e s t h a t t h e R O a nd Rl c o n t e n t s a r e u n p r e d i c t a b l e a nd c a nno t b e d e s t r o yed . Th e r eg i s t e r s a r e s a v e d a n d r e s to r ed b y t h e AST d e l i v e r y m e c h a n i sm . Th e s a v ed PC a n d PS L v a l u e s a r e the r eg i s t e r c o n t e n t s o r i g i n a l l y s a v ed wh e n the I PL 2 i n t e r r up t wa s i n i t i a t ed by the h a r d wa r e . Th e v a l u e s a r e n o rm a l l y t h e pa i r th a t wa s a b o u t t o b e u s ed b y t h e o r i g i n a l RE I i n s t r uc t i o n r eq ue s t i ng t h e AST d e l i v e r y . 5. 3. 3 AST Ex i t Pa t h Wh e n t h e A S T r o u t i n e i s s ue s t h e R E T i n s t r uc t i o n , c o n t r o l is r e t u r n ed to the l oc a t i o n E XE $ASTRET i n the a c c e s s mod e o f the AST . Th e c a l l f r am e , b u t n o t t h e a rg um e n t l i s t , wa s r em o v e d f r om the c u r r e n t s t ac k Th e a rg um e n t l i s t r ema i n s b e c a u s e a CA LLG by the R E T i n s t r uc t i o n . r a th e r t h a n a CALLS i n s t r uc t i o n wa s u s ed to e x e c u t e the AST r o u t i n e . Th e f o l l o w i ng s t e ps then o c c u r • . 1. Th e a r g um e n t c o un t a nd the AST p a r am e t e r a r e r emoved f r om the s t a c k , l e a v i ng t h e R O , R l , PC , a nd PS L v a l ue s . 2. A C HM K =IJ: A S T E X I T i n s t r uc t i o n i s e x e c u t ed , i nv o k i ng the c h a ng e -mod e - t o - k e r n e l s ys tem s e r v i c e d i s pa t c h e r ( d e sc r i b ed i n Ch a pt e r 3 ) . Th e s e r v i c e c o d e o f z e r o ( A STEX I T 0 ) c a us e s the no r m a l kernel m o d e d i s pa t c h i ng m e c h a n i sm t o b e bypa s s ed . = 5-8 AST D E L IVERY 3. I n s t e ad , wh i l e i n k e r n e l m o d e , e t h e I PL i s r a i s e d to S YN C H , • t h e a pp r o p r i a t e PC B $ B A S TACT b i t i s c l e a r e d t o s i g n a l AST c ompl e t i o n , a n d • t h e ASTLVL v a l u e i s r ec o m p u t e d . Th e s e f i e l d s c a n o n l y be wr i t t e n f r om k e r n e l m o d e . Th i s is wh y i t i s n e c e s s a r y f o r t h e AST d i spa tc h e r to r e e n t e r k e r ne l m o d e a f t e r t h e AS T r e t u r n s c o n t r o l t o t h e d i s pa t c h e r a nd be f o r e t h e AST d e l i v e r y i n t e r r upt i s d i sm i s s ed . 4. An RE I i n s t r uc t i o n , s t i l l i n m o d u l e CMODS SDS P , d r o ps t h e to z e r o , a nd r e t u r n s the a c c e s s m o d e to tha t o f t h e AST . 5. Co d e , i n t h e mo d u l e ASTDE L , r e s um e s a t mo d e a n d I P L 0 by the • r e s to r i ng t h e s a v e d RO and R l va l u e s , a nd • i s s u i ng a n o th e r RE I i n s t r uc t i o n . p r ev i o u s Th i s R E I i n s t r uc t i o n r e t u r n s c o n t r o l to the a c c e s s l o c a t i o n o r i g i na l l y i n te r r up t ed by AST d e l i v e r y . I PL access mod e a nd No te th a t t h e R E I i n s t r uc t i o n s i n CMODS S D S P a nd ASTDE L m a y c a u s e a no t h e r I P L 2 i n t e r r upt t o o c c u r , d e p e nd i ng u po n t h e ASTLVL v a l u e a nd the access mod e t r ans i t i o n s . 5. 4 S PE C IAL KERNEL ASTS S p e c i a l k e r ne l m o d e ASTs a r e d i f f e r e n t f r om " n o rm a l " AS Ts m a j o r wa ys : in seve r a l 1. Th e ASTs r e p r e s e n t un so l i c i te d o r i nv o l un ta r y s ys t e m a c t i o n s th a t m u s t o c c u r i n t h e c o n t e x t o f t h e p r o c e s s . Th e s e a c t i o n s a r e f r e qu e n t l y r e q u e s t ed wh e n t h e p r o c e s s is not c u r r ently e x e c u t i ng . 2. Th e spe c i a l k e r n e l mod e A S T r o u t i n e s a r e d i s pa t c h e d a t I PL 2 and ex ecute at tha t l ev e l o r h ighe r . Syn c h r o n i z a t i o n i s prov i d ed b y the i n te r r up t m e c h a n i sm i t se l f , r a th e r than r e q u i r i ng a d d i t i o n a l PC B $ B A S TACT a nd PC B $ 8 ASTEN b i t s . On l y o n e s pe c i a l k e r n e l m o d e A ST c a n b e a c t i ve a t a n y m o m e n t b e c a u s e t h e AST d e l i v e r y i n t e r r up t i s b l o c k e d . 3. Th e s pe c i a l k e r n e l m o d e A S T r o u t i n e s a r e i nvo k e d by a JSB i n s t r uc t i o n r a th e r than a CALLG i n s t r uc t i o n . Th e r e i s n o a rg um e n t l i s t ( t h e PC B a d d r e s s i s i n R4 a n d th e AC B a d d r e s s is in R5) • 4. Th e AS T r o u t i n e i s r e s po n s i b l e f o r th e d eal locat ion of the AC B ( t o n o n pag ed poo l ) ( Fo r no rm a l ASTs , t h i s d e a l l o c a t i o n i s d o n e b y t h e AST d e l i v e r y r o u t i n e . ) 5. Th e r e t u r n f r om t h e AST r o u t i n e ( w i th a n RS B i n s t r uc t i o n ) pa s s e s c o n t r o l t o a n RE I i n s t r uc t i o n i n mod u l e ASTDE L . Th i s i n s t r uc t i o n a t t emp t s t o p a s s c o n t r o l to the o r i g i na l l y i n t e r r up t e d PC / P S L pa i r . I P L w i l l d r o p f r om two to z e r o a t t h e s am e t i m e . 5-9 AST D E L I VE RY Th e n e x t f o u r s e c t i o n s b r i e f l y d e s c r i b e f o u r ex ampl e s o f k e r n e l mod e A S T m e c h a n i sm . the spec i a l I /O Po s tp r o c e s s i ng i n P r o c e s s C o n t e x t 5.4. 1 Pa r t o f the s equence of c ompl e t i ng an I /0 r e q ue s t i nv o l v e s the d e l i v e r y o f a spec i a l k e r n e l mod e AST t o t h e r e q ue s t i ng p r o c e s s . I /0 p o s t p r o c e s s i ng i s d e s c r i b ed i n the VAX/VM S G u i d e to Wr i t i ng a Dev i c e D r i ve r . Th i s r e q ue s t i s mad e by t h e I PL 4 ( I /O po s t p r o c e s s i ng ) i n t e r r u pt s e r v i c e r o u t i n e b y q ue u i ng t h e fo rme r I /0 r e que s t pa c k e t a s a n ACB . Th e o pe r a t i o n s pe r fo rmed by t h e I /0 c ompl e t i o n AST r o u t i ne a r e tho s e th a t mu s t e x e c u t e i n p r o c e s s c o n t e x t , p a r t i c u l a r l y tho s e tha t r e fe r e n c e process v i r t ua l add r esses . Th e p r i m a r y o p e r a t i o n s { e x e c u t ed a t I PL 2 ) a r e the f o l l o w i ng . 1. Fo r b u f f e r ed r e ad I/0 o pe r a t i o n s o n l y , t h e d a t a i s moved f r om the sys t em b u f f e r to the u s e r b u f f e r , and the sys t em b u f fe r i s d e a l l o c a t e d t o nonpa g e d d yn am i c memo r y . 2. Th e b u f f e r ed o r d i r e c t I /0 c o un t f i e l d o f the p r o c e s s i s i n c r emen t e d f o r a c c o un t i ng i n fo rm a t i o n . 3. I f a u s e r d i ag n o s t i c b u f f e r wa s s pe c i f i ed , t h e d i a g no s t i c i n f o rm a t i o n i s m o v ed f r om the s ys t em d i ag n o s t i c b u f f e r b e f o r e i t i s d e a l l o c a t ed . 4. Th e c h a n n e l c o n t r o l b l o c k { i n the c o n t r o l r eg i o n ) i s upd a t ed t o show I /0 c omp l e t i o n . Th i s may m a k e the c h a n n e l i d l e . 5. I f a n I/0 s ta tus block ( I OSB) wa s s p e c i f i ed , th e wr i t t en f r om i n f o r ma t i o n i n the I /0 r e q u e s t pa c k e t . 6. I f a n AS T wa s s pec i f i ed w i th the $ Q I O r e qu e s t , then the AC B $ V QUOTA b i t wa s set in the I RP . Th e AST p r o c ed u r e a d d r ess a nd t h e o p t i o n a l A S T p a r ame t e r we r e o r i g i n a l l y s to r ed in the I RP { no w a n AC B ) . Th e f o rme r I R P i s que ued to the p r o c e s s a g a i n i n t h e a c c e s s m o d e of the r e q ue s t o r . 7. O t h e r wi s e , t h e I R P/AC B i s m em o r y . d e a l l o c a ted to no n pa g ed header I O SB is d yn am i c P r o c e s s S u spen s i o n 5. 4. 2 Wh e n a $ S US PN D s ys tem s e r v i c e r e que s t spec i f i e s a p r o c e s s o th e r th a n the r eque s to r , t h e s u s p e nd mec h a n i sm r eq u i r e s a s pe c i a l k e r n e l mod e A S T t o e n t e r the c o n te x t o f the t a rg e t p r o c e s s . Wh en the spec i a l k e rne l mod e AST i s d e l i v e r ed , t h e a r e pe r fo rmed . f o l l o wi ng ac t i o n s 1. Th e ACB i s d e a l l o c a t ed to no npag ed d yn a m i c memo r y . 2. Af t e r r a i s i ng I P L f r om A S TDE L { I PL 2 ) to S YNC H , the PC B $V RE S PE N b i t i s c l e a r ed . I f a r e s ume wa s pend i ng , t h e n t h e r e s um e h a s p r e c ed enc e . Th a t i s , t h e A S T r o u t i ne e x i t s w i thout s us p e n d i ng t h e p r o c e s s ( a f te r d r o pp i ng I PL b a c k t o A S TDE L ) • 5-10 AST D E L I VE RY 3. I f no r e s um e wa s p e nd i ng , t h e n th e p r o c e s s i s pl a c e d i n to the SUSP wa i t s t a t e . Th e p r o c e s s h a r d wa r e c o n t e x t i s s a v e d wi th a SVPC TX i n s t r uc t i o n ( d e s c r i b ed in d e t a i l in Ch a p t e r 8 ) . Th e p r o c e s s q u a n t um f i e l d i n t h e p r o c e s s h e a d e r i s c h a r g ed w i th a v o l un t a r y wa i t i n t e r v a l ( d e t e rm i n ed by the spe c i a l s ys t em p a r am e t e r I OTA , d e sc r i b ed i n Ch a pt e r 8 ) . Co n t r o l i s p a s s e d t o t h e s c h ed u l e r a t S C H $ S C H E D t o s e l e c t t h e n e x t p r o c e s s fo r e x e c ut i on . Wh e n t h e p r o c e s s f i n a l l y e x ec u t e s ag a i n ( a f te r a $ R E S UM E s ys t em s e rv i c e c a l l ) , the PC B $V S US P EN b i t i s unc o nd i t i o n a l l y c l e a r e d a nd t h e p r o c e s s i s m a d e c om p u t a ble . P r o c e s s De l e � i o n 5. 4. 3 Th e m a j o r po r t i o n o f t h e s t e ps i nv o l v e d i n p r o c e s s d e l e t i o n o c c u r i n a s p e c i a l k e r n e l m o d e AST r o u t i n e q u e ued i n r e s po n s e to a $ D E LPRC s ys tem s e rv i c e c a l l . A d e t a i l ed e x p l a n a t i o n o f p r o c e s s d e l e t i o n i s p r o v i d ed i n Ch a pt e r 1 9 . Th e use of the s pe c i a l ke r n e l mod e A S T m e c h a n i sm p r o v i d e s t h e f o l l o w i ng ben e f i t s . • Execut i on a s the c ur rent process i s a c c o m p l i s h ed b y AST del ivery . Ne a r l y a l l wa i t i ng p r o c e s s e s a r e m ad e c om p u t a b l e $D E L PRC e n s u r e s the d e l e t i o n o f b y AST d e l i v e r y ( Ch a p t e r 8 ) . a s us p e n d ed p r o c e s s b y i s s u i ng a $ R E S UM E f i r s t . E x e c ut i o n a s the c u r r e n t p r o c e s s is r e q u i r ed fo r p r oc e s s v i r t u a l a d d r e s s t r a n s l a t i o n a nd o th e r o pe r a t i o n s t h a t r e q u i r e p r o c e s s c o n t e x t { pa r t i c u l a r l y i n o b t a i n i ng the i n fo rm a t i o n c o n t a i n e d i n t h e c o n t r o l r eg i o n ) . • Th e d e l i v e r y o f d e l e t i o n ASTs c a nn o t b e p r e v e n t ed by the $ S E TAST s ys t em s e r v i c e . A p r o ces s can o n l y a v o i d d e l e t i on by r a i s i ng I P L t o ASTDE L ( I PL 2 ) o r above to p r ev e n t a l l AST d e l i ve r i e s . B e c a us e I PL c a n o n l y b e e l e v a t ed wh i l e i n k e r n e l m od e , o n l y p r i v i l eg ed p r o c e s s e s , or th e s ys t em a c t i ng on b eh a l f of some p r o c e s s , c a n e x pl i c i t l y p r ev e n t p r o c e s s delet i on . $GETJ P I Sys t em Se rv i c e 5.4.4 Th e $ G E TJ P I s ys tem s e rv i c e i s d e sc r i b ed in Ch a pt e r 2 7 . Wh e n i n fo r m a t i o n is r e q u e s t e d f o r a p r o c e s s o th e r th a n t h e r e q u e s to r , the t a r g e t process mus t execu t e t o e s t a b l i sh p r o c e s s c o n t e x t . In add i t ion , i f the t a r g e t p r o c e s s i s o u t swa pped , t h e e n q u e u i ng o f the s pe c i a l k e r n e l mode A S T w i l l make t h e p r o c e ss an i n s wa p c a nd i d a t e . Th i s a c t i o n b r i ng s i n b o th t h e wo r k i ng s e t a nd t h e p r o c e s s h e ad e r { wh e r e m uc h o f t h e a c c o un t i ng i n fo rm a t i o n i s ma i n t a i n ed ) . I n g en e r a l t e r m s , t h e $ G E TJ P I A S T a c t i v i ty i s a s f o l l o ws . 1. An AC B i s c o n s t r uc t ed f o r a s p e c i a l k e r ne l AST . A s ys tem b u f f e r i s a l so a l l o c a te d and a po i n t e r to i t i s p l a c ed i n the AC B . 5-11 AST DELIVE RY 2. Wh e n t h e s p e c i a l k e r ne l m o d e A S T r o u t i n e ex ecutes in the c o n tex t of t h e t a r g e t p r o c e s s , t h e r eq u e s t ed i n fo rm a t i o n i s m o v ed i n t o t h e s ys t em b u f fe r . ( Th e r eq ue s t s h a d b e e n e n c o d ed in the ACB . ) Th e ACB is t h e n r e s e t to d e l i v e r a s p e c i a l k e r n e l mod e AST t o t h e r e q ue s t i ng p r o c e s s . 3. Th e s e cond s p e c i a l k e r n e l mod e AST m o v e s d a t a f r om th e sys tem buffer i n to a u s e r b u f f e r in t h e r e que s t i ng p r o c e s s . Othe r a c t i o n s i nc l ud e • d e a l l o c a t i ng t h e s ys t em b u f f e r , • s e t t i ng a n e v e n t f l ag , a nd • d e l i v e r i ng an A S T i n t h e a c c e s s m o d e o f r e que s t e d . the cal ler i I f a n AS T i s d e l i v e r ed , t h e ACB i s u s e d f o r t h e th i r d I f no AS T i s d e l i v e r e d , t h e n th e AC B i s d e a l l o c a t e d . 5. 4. 5 if t i me . Po we r Recove r y ASTs A f i na l e x a m p l e o f t h e u s e o f s pe c i a l k e r ne l ASTs o c c u r s in the i mp l em e n ta t i o n o f powe r r e c ov e r y ASTs , a t o o l th a t e n ab l e s p r o c e s s e s t o r e c e i v e n o t i f i c a t i o n th a t a po we r f a i l u r e a nd s uc c e s s f u l r e s ta r t h a v e o c c u r r ed . ( Po we r f a i l u r e a nd powe r r e c ov e r y a r e d e sc r i b ed i n Ch a pt e r 2 3 . ) Wh e n a s uc c e s s f u l po we r r ecove r y o c c ur s , all processes th a t h a v e e s ta b l i s h e d a po we r r e c o v e r y A S T a r e no t i f i ed f i r s t wi th a s p e c i a l k e r n e l AST . Th i s AST r e t r i ev e s i n fo rm a t i o n f r om t h e P l po i n t e r pa g e t h a t a l l o ws the u s e r - r e q u e s t ed A S T t o b e d e l i v e r ed . Th e A S T i s r e q u i r ed b e c a u s e P l s p a c e i n f o rm a t i o n i s o n l y a v a i l ab l e f r om p r o c e s s c o n tex t . 5.4.6 O t h e r Sys t em U s e o f ASTs Th r e e o th e r f e a t u r e s w i th i n the execut ive are i m pl emented th r o ugh AS Ts , but these ASTs a re not s pe c i a l k e r n e l ASTs . Th e a u tom a t i c wo r k i ng s e t ad j u s tm e n t th a t t a k e s pl a c e a t q ua n t um end ( Ch a p t e r s 8 a nd 1 3 ) a n d t h e C PU t i m e l i m i t ex p i r a t i o n a r e bo th i mpl em e n ted wi th no r m a l Th e Fo r c e Ex i t s ys t em s e rv i c e ( Ch a p t e r s 9 and 1 8 ) c a u s e s k e r ne l ASTs . a u s e r m o d e A S T t o b e d e l i v e r ed to t h e t a r g e t p r o c e s s 5. 5 ATTENT I ON AST S Ano th e r c a t eg o r y o f AST u s e i s t h e a t te n t i o n AST m e c h a n i sm . At t e n t i o n ASTs a r e u s ed i n a s s o c i a t i o n w i t h I /0 o p e r a t i o n to no t i f y o n e o r m o r e p r o c e s s e s o r r o u t i n e s o f a s p e c i f i c ( a nd u s ua l l y u n s o l i c i t ed ) ev e n t i n a d ev i c e . 5-1 2 AST D E L I VE RY S e t At t en t i o n Mecha n i sm 5. 5. 1 I n o r d e r to e s t ab l i sh a n a t t e n t i o n AST f o r a p a r t i c u l a r d ev i c e , the user mus t i s s ue a $ Q I O s y s t em s e rv i c e r e q ue s t w i th t h e I /O f un c t i o n I O $ S ETM ODE ( o r I O $ S E TC HAR f o r some d ev i c es ) Th e k i nd o f a ttent i o n AST- r e q u e s ted i s i ndi c a t ed b y a f un c t i o n mo d i f i e r . • Th e f o l l o w i ng s t ep s a r e p r ov i d ed by the r o u t i ne C OM $ S E TATTNAST i n m o d u l e C OMDRVS UB . ( Th i s r o u t i n e r e q u i r e s p r o c e s s c o n tex t a n d so i s c a l l ed o n l y f r om d ev i c e d r i v e r FDT r o u t i n e s . ) 1. I f t h e u s e r AST r o u t i n e ad d r e s s ( t h e $ Q I O P l p a r am e t e r ) is zero , th e r e que s t is i n t e r p r e t ed a s a f l ush a t t e n t i o n AST 1 i s t r e que s t ( S e c t i o n 5 . 5 . 3 ) • 2. An ex pa nd e d ACB ( th a t i s , a n I R P ) i s a l l o c a t e d f r om n o n pa g ed d yn a m i c m em o r y . Th e ACB i s d e d uc t ed f r om t h e p r o c e s s quo t a , PC B $W_A S TCNT . 3. I n f o r ma t i o n f r om t h e I /0 r e que s t pa c k e t ( s uch a s t h e AST rout i ne e n t r y po i n t , AST p a r am e t e r , d e v i c e c h a n n e l n umbe r , a nd p r o c e s s I D ) i s moved i n to t h e AC B . 4. Th e AC B i s l i n k ed t o t h e un i t c o n t r o l block ( UC B ) of the a s s o c i a t ed d ev i c e in a s i ng l y l i n k e d , l a st- i n f i r s t-out ( L I FO ) l i s t . De l i v e r y o f A t t en t i o n ASTs 5. 5. 2 Th e occ u r r e n c e o f a s i t ua t i o n fo r wh i c h a t te n t i o n ASTs h a v e b e e n d e f i ned c a u s e s t h e d e l i v e r y o f a l l s uc h a t t e n t i o n AS Ts . Th e m e c h a n i sm o f d e l i v e r y i s i mpl emented i n t h e rout i ne C OM $ D E LATTNA ST o f m od u l e C OM $ D E LATTNAST is u s ua l l y i nv o k e d by a d ev i c e d r i v e r a t C OMDRVS UB . d ev i c e I PL ( I PL 2 0 th r o ug h 23) , a fte r s pec i f y i ng wh i c h l ist of a t t e n t i o n AST f o r k b l o c k s/ACBs i s to b e u s e d . Ea c h AC B i s o r i g i na l l y f o r m a t t e d a s a fo r k b l o c k w i th t h e AST f i e l d s ( Th e f i r s t s i x l o ng wo r d s o f t h e Un i t l o c a t ed a t d i f fe r ent o f fsets . Co n t r o l B l o c k p i c t u r ed i n Append i x A o f the VAX/VM S G u i d e to Wr i t i ng a t h e m o s t c ommon e x ampl e o f a fo r k b l o c k . ) Th e Dev i c e D r i v e r a r e c o n t r o l b l o c k c o n t a i n s r e l e v a n t a d d i t i o n a l i n fo r m a t i o n s uc h a s s a v ed PC , R 3 , a n d R4 va l u e s , t h e c h a n n e l n um b e r fo r t h e d ev i c e , a nd the I PL v a l u e fo r p r oc e s s i ng t h e AST ( I P L $ Q U E UEAST I PL 6 ) . Du r i ng fo r k p r o c e s s i ng , t h e c o n t r o l b l o c k i s r e form a t ted i n t o a s t a nd a r d ACB . = Wh e n C OM $ D E LATTNAST b eg i n s e x e c u t i o n , t h e CPU i s u s ua l l y e x e c u t i ng at d ev i c e I PL . Th e q ue u i ng o f A S Ts i s a n o pe r a t i o n us i ng I P L $ SYNCH a s a s yn c h r o n i z a t i o n m e c h a n i sm ( Ch a p te r 2 4 ) . Spe c i f i c a l l y , I PL m u s t b e r a ised to SYNC H . T o a c compl i s h c o r r e c t s yn c h r o n i z a t i o n , t h e I P L 6 f o r k d i s pa tc h e r i s u s ed . Th e fo l l o w i ng s t eps s umma r i z e t h e d e l i v e r y o f a t t e n t i o n ASTs . 1. At I PL 2 0 t h r o ug h 23, e a c h a t t e n t i o n AST f o r k c o n t r o l b l o c k/AC B i s r em o v ed f r om t h e a pp r o p r i a t e l i s t i n the r e v e r s e o rd e r o f d ec l a r a t i o n . Ea c h b l o c k i s e n que ued to the I PL 6 f o r k q u e ue l i s t h e ad . 2. Th e r o u t i n e i nv o k e s t h e FORK s ys tem m a c r o to no t i f y t h e d i s pa t c h e r t h r o ug h t h e I P L 6 s o f twa r e i n te r r up t . 5-1 3 fo r k AST D E L I VERY 3. As t h e i n t e r r up t p r i o r i t y l ev e l o f t h e CPU d r o p s be l o w s i x , the fo r k i n te r r up t is ta ken . Th e I P L $ Q U E UEAST f o r k d i s p a t c h e r r emov e s e a c h f o r k c o n t r o l b l o c k f r om i t s q u e u e a nd p a s s e s t h e c o n t r o l b l o c k b a c k to a l o c a t i o n i n C OM $D E LATTNAST a t I PL 6 . 4. At I P L 6 t h e f o r k c o n t r o l b l o c k i s t h e n r e f o r m a t t e d i n to an AC B , r e p r e s e n t i ng a n AST in the access mod e of the o r i g i na l r equesto r . 5. Th e AC B i s t h e n que u e d t o the p r o c e s s th r o ug h S C H $ QAST ( wh i c h w i l l i mmed i a t e l y r a i s e I P L to I P L $_S YNC H ) . 5. 5. 3 Fl u sh i ng a n A t t e n t i o n A S T L i s t Th e l i s t o f a t te n t i o n A S Ts i s f l u s h e d a s t h e r esul t o f a n expl i c i t use r r e q ue s t , a c a n c e l I /0 r e q ue s t , o r a d e a s s i g n c h a n n e l r e que s t f o r t h e a s s o c i a t e d d ev i c e . An e x p l i c i t u s e r r e q ue s t t o f l u s h t h e a t t e n t i o n AST l i s t i s pe r f o rmed as the r esul t o f a s e t a t t en t i o n A S T r e que s t w i th a n AST r o u t i n e add r e s s o f ze ro ( Se c t i on 5 . 5 . 1 ) . C OM $ S E TATTNAST t h e n b r a n c h e s to C OM $ F L U S HATTNS . Dev i c e d r i v e r s c a n r e q ue s t the f l u s h i ng o f t h e a t t e n t i o n AST l i s t b y e i th e r i nvo k i ng C OM $ S E TATTNA S T w i t h a n A S T r o u t i n e a d d r e s s o f z e r o o r by d i r ec t l y i nv o k i ng C OM $ F L USHATTNS w i th t h e channel n um b e r of the d ev i c e i n R 6 . C OM $ F LUS HATTN S pe r fo rm s t h e fo l l o w i ng o pe r a t i o n s . l. Th e I PL i s r a i s ed to t h e h a r d wa r e I P L o f t h e t h r o ug h 2 3 ) d ev i c e ( I PL 2 0 • 2. As e a c h c o n t r o l b l o c k i n t h e a t t e n t i o n AST l i s t i s f o und , t h e process I D o f t h e p r o c e s s r e que s t i ng t h e f l u s h i ng o pe r a t i o n i s c ompa r e d w i th t h e p r o c e s s I D s t o r ed i n t h e c o n t r o l b l o c k . An A S T c o n t r o l b l o c k i s r e t a i n ed i n t h e a t t e n t i o n AST l i s t i f t h e p r o c e s s I Ds d o no t m a t c h . 3. I f t h e p r o c e s s I Ds m a t c h , then the channel n umbe r s m u s t match . On e channel number i s pa s s ed i n R 6 f r om t h e f l ush r e q u e s t , a nd the o th e r i s in the c o n t r o l block f r om the d e c l a r a t i o n o f t h e AS T . I f the c h a n n e l n um b e r s d o n o t m a tc h , t h e n t h e c o n t r o l b l o c k i s r e t a i n e d i n t h e a t t e n t i o n AST l i s t . O t h e r wi s e , the contr o l b l o c k i s r emoved f r om the a t t e n t i o n AST l i st . 4. I PL i s d ro pp e d f r om d ev i c e i n t e r r up t 2 3) l ev e l ( I PL 2 0 t h r o ug h • 5. Th e ASTCNT q uo t a i s i nc r em e n ted to i nd i c a t e the cont rol block . 5-14 d ea l loc a t i on of AST DELIVE RY 5 . 5. 4 6. Th e c o n t r o l b l o c k i s d e a l l o c a t e d to no npag ed d yn am i c memo r y . Th i s o pe r a t i o n r e qu i r e s e x e c u t i o n t h r o ug h t h e fo r k d i spa t c h e r a t I PL $ Q U E UEAST t o e n s u r e p r ope r s yn ch r o n i z a t i o n wi th ! PL . ( Ac t ua l - d e a l l o c a t i o n i s done at I PL 1 1 a s d e sc r i b ed i n Ch a p t e r 2 5 . ) 7. P r o c e s s i ng c o n t i n u e s un t i l the e n t i r e a t t e n t i o n AST l i s t b e en sc anned . has E x a mp l e s i n VAX/VMS Two d ev i c e s tha t c ommo n l y h a v e a t t e n t i o n ASTs a s s o c i a t e d wi th t h em a r e t e rm i n a l s a nd ma i l bo x e s . B r i e f d e sc r i p t i o n s o f the s uppo r t f o r a t te n t i o n ASTs i n t h e s e d ev i c e d r i v e r s c o n c l ud e s t h i s c h a p t e r . 5 . 5 . 4 . 1 Te rm i n a l Dr i v e r a n d C TRL/Y No t i f i c a t i o n - Th e t e rm i n a l I O $ S E TMODE a n d I O $ S E TCHAR f un c t i o n s m a y t a k e I O $M CTRLCAST a nd I O $M C TR LYAS T f un c t i o n mo d i f i e r s . Wh e n a C TRL/C i s -t ype d on a t e rm i n a l , t h e C T R L/C a t t en t i o n AST l i s t i s empt i e d by d e l i v e r i n g e a c h C TRL/C A S T a s so c i a t ed w i th t h e t e rm i n a l . I f n o C TRL/C a t t e n t i o n AST i s d e c l a r ed , t h e n the C TRL/C i s i n te r p r e t ed a s a C TRL/Y a nd th e CTR L/Y A S T l i s t i s s e a r c h ed i n s t e a d . I f a CTR L/Y i s t yped , o n l y the CTR L/Y a t t e n t i o n AST l i s t i s empt i e d . B e c a u s e the l i s t i s empt i e d e a c h t i m e a C TR L /Y o r a CTRL/C is t yped , b o th C TRL/C a n d CTRL/Y a t t e n t i o n ASTs m u s t b e r e e n a b l ed e a c h t i m e th e y a r e d e l i v e r ed to a p r o c e s s . 5 . 5 . 4 . 2 Ma i l bo x D r i v e r - Th e I O $ M READATTN a n d I O $M WRTATTN f unc t i o n m od i f i e r s p r ov i d e n o t i f i c a t i o n- o f ma i l bo x r e que s t s f r o m o th e r processes . I O $M WRTATTN p r o v i d e s n o t i f i c a t i o n o f un so l i c i t ed i n p u t to a m a i l bo x . I O$M R EADATTN n o t i f i e s the e n ab l i ng p r o c e s s wh e n a n y p r o c e s s i s s ue s a r�a d t o a m a i l bo x wh en no m e s s a g e i s a v a i l a b l e . Mu l t i p l e a t te n t i o n ASTs o f e a c h type m a y b e d e c l a r ed by p r o c e s s e s fo r the s am e m a i l bo x . Wh e n a c o nd i t i o n co r r e s pond i ng to an a t t e n t i o n AST o c c u r s i n a ma i l bo x , a l l A S Ts of t h e a pp r o p r i a t e type a r e d e l i v e r ed . On l y t h e f i r s t p r o c e s s to i s s ue a r e s po nd i ng I /0 r e que s t wi l l be a b l e t o compl e t e the t r a n s f e r o f d a t a s i g n a l l ed b y t h e a t t e n t i o n ASTs . Re a d a nd wr i t e a t t e n t i o n ASTs m u s t b e r e e n ab l ed a f t e r d e l i v e r y b e c a u s e the ent i re a t te n t i o n AS T l i s t i s d e l i v e r e d ( a nd r emoved ) a f t e r e a c h o c c u r r en c e o f t h e s pe c i f i e d c o nd i t i o n . 5-1 5 CHAPTER 6 HARDWARE INTERRUPTS VM S i s an i n t e r r upt-d r i v e n o pe r a t i ng s ys tem . I t conta i n s a co l l e c t i on of i n t e r r up t serv i c e rout ines t h a t e x e c u t e i n r e s po n s e to h a r d wa r e i n t e r r u p t s f r om e x t e r n a l d ev i c e s a nd i n te r n a l dev i c e s such as the c l oc k . VM S d o e s n o t h a v e a s o f twa r e - b a s e d c e n t r a l d i s p a t c h i ng mod u l e t h a t r e c e i v e s no t i f i c a t i o n o f a l l s y s t em events ( th a t i s , i n t e r r up t s ) and d ec i d e s wh a t to do nex t . I n s t ead , VM S re l i es o n a h a r d wa r e- c o n t r o l l ed i n t e r r upt d i s pa tch i ng sc heme th a t a l wa ys forces t h e h i g h e s t pr i o r i t y i n te r r upt o n t h e s ys t em to b e se rv i c ed f i r s t . 6.1 HARDWARE INTERRUPT D I S PATC H I NG Th e VAX a r c h i t e c t u r e p r ov i d e s 1 6 h a r d wa r e i n t e r r up t p r i o r i t y l e v e l s ( I PL ) , f r om I PL 3 1 d o wn to I P L 1 6 . Th e t o p 8 l e v e l s a r e fo r u s e by u r g e n t c o nd i t i o n s i n c l ud i ng se r i o u s e r r o r s ( s uch as m a c h i n e chec k ) , the s y s t em c l o c k , a n d powe r f a i l u r e . Th e s e c o nd i t i o n s a r e d i s c u s s e d i n c h a p t e r s 7 , 1 0 , a nd 2 3 r e spe c t i v e l y . Th e l o we r e ight l ev e l s are u s ed b y pe r i ph e r a l d e v i c e s . Wh e n a pe r i ph e r a l d e v i c e g e ne r a t e s a n i n te r r up t , th a t i n t e r r up t is r eque s ted a t a pa r t i c u l a r h a r d wa r e I P L ( f i x ed fo r a g i v e n d e v i c e ) . As i n t h e c a s e o f s o f twa r e i n t e r r u p t s , i f the r e que s t ed I PL v a l u e is h ighe r t h a n the l ev e l a t wh i c h t h e p r o c e s s o r i s c u r r e n t l y r un n i ng ( a s d e t e r m i n ed by PS L < 2 0 : 1 6 > ) , t h e n th e i n t e r r up t s e r v i c e r o u t i n e wh o s e a d d r e s s i s i n t h e s e l e c ted v e c t o r i n t h e Sy s t em Co n t r o l B l o c k ( S C B ) i s e n t e r ed i mmed i a t e l y . Ot h e r w i s e , t h e i n t e r r upt servi�e is d e f e r r ed u n t i l I P L d r o ps b e l o w t h e l ev e l a s so c i a t ed w i th t h e i n t e r r up t . Wh e n a n i n t e r r up t i s s e r v i c ed , t h e c u r r e n t p r o c e s s o r s t a tus mus t be p r e s e rved so th a t the i n t e r r upted th r e a d of executi o n ( e i th e r p r o c e s s - b a s e d c o d e o r a n i n t e r r up t s e r v i c e r o u t i n e ex e c u t i ng a t l o we r I PL } c a n c o n t i n u e no rm a l l y a f t e r the i n t e r r upt i s d i sm i s s ed . Th i s i s a c c ompl i shed ( b y the h a r d wa r e ) by a u tom a t i c a l l y s a v i ng t h e PC and PS L on the s ta c k . Th e s e a r e l a te r r e s t o r e d wi th a n RE I i n s t r u c t i o n th a t d i sm i s s e s t h e i n t e r r up t . O t h e r e l em e n t s o f the p r o c e s s c o n t e x t , s uc h a s g ener a l r eg i s t e r s , m u s t b e s a v e d and r e s to r ed b y t h e r o u t i n e ( s ) h a nd l i ng t h e i n t e r r up t . I n o r d e r to r ed uc e i n t e r r upt ove rhead , no m emo r y m a pp i ng i n fo rma t i o n i s c h a ng ed wh en a n i n t e r r u pt o c c u r s . Th e r e f o r e , t h e i n s t r uc t i o n s a nd d a ta r e f e r e n c ed by an i n t e r r up t s e r v i c e r o u t i n e m u s t b e i n s ys tem ad d r e s s s p a c e . 6-1 HARDWARE INTERRUPTS I n t e r r up t D i s p a t c h i ng 6.1.1 Th e f o l l o wi ng l i s t o u t l i n e s the p r i m a r y s e q u e n c e o f e v e n t s tha t i n i n t e r r upt d i s pa tc h i ng . occur 1. An i n t e r r up t i s r e q ue s ted . 2. Th e c u r r e n t i n s t r uc t i o n f i n i s h e s o r r e a c h e s a we l l d e f i n e d po i n t wh e r e t h e i n s t r uc t i o n s t a t e i s c ompl e t e l y c o n t a i n e d i n t h e g e n e r a l r eg i s t e r s , PC , a nd PS L ( wh i c h h a ppe n s in the ( S ome i n s t r uc t i o n s c a n a l so be s t r i ng i n s t r uc t i o ns ) . i n t e r r up t e d a t we l l d e f i n ed po i n t s s uc h th a t , a f te r the i n te r r upt d i sm i s s a l , they are r e s t a r t ed , r a th e r th a n c o n t i n ued . ) 3. Th e i n t e r r up t s e q u e n c e i s i n i t i a t ed by t h e h a r d wa r e , push i ng t h e c u r r e n t PC s a nd PS L o n the s t a c k . VM S u s e s the i n te r r up t stack fo r all h a rd wa r e i n t e r r up t s e r v i c i ng . Th i s is i nd i c a ted by p l a c i ng a 01 i n b i t s < 1 : 0 > o f e a c h h a r d wa r e i n t e r r upt v e c to r i n the s ys tem c o n t r o l b l o c k ( F i g u r e 6 - 1 ) . Mo s t s o f t wa r e i n t e r r up t s a r e a l so s e r v i c ed o n t h e i n t e r r upt stack . On the o th e r h a nd , the pe r - p r o c e s s i n t e r r upt a s s o c i a t ed w i th AST d e l i v e r y a nd n e a r l y a l l except i ons a r e s e r v i c ed o n t h e pe r - p r o c e s s k e r n e l s t a c k . 31 0 Address of longword-aligned interrupt service routine Code SCB vector Meaning Code 00 Service event on kernel stack u nless currently on interrupt stack; in which case, use interrupt stack. 01 Service event on interrupt stack; if event is an exception, raise IPL to 31 . 10 Service event i n Writable Control Store (WCS), passing bits <1 5:2> to micro code; if WCS does not exist or is not loaded, the operation is UNDEFI NED (the VAX-1 1 /750 and the VAX-1 1 /780 will HALT). 11 Operation i s UN DEFINED {the VAX-1 1 /750 and the VAX-1 1 /780 will HALT). Figure 6-1 Sy s t em Co n t r o l B l o c k Ve c to r Fo rma t 4. A n e w PC i s l o a d ed ( f r om t h e a pp r o p r i a t e S C B v e c to r ) , and a n e w PS L is c r e a ted ( w i th PS L < 2 0 : 1 6 > c o n t a i n i ng the I P L a s s o c i a t ed w i th t h e i n t e r r upt , a nd the p r ev i o u s a c c e s s mo d e , c u r r e n t a c c e s s m o d e , CM , T P , FPD , DV , FU , I V , T , N , z , a nd C b i t s c l e a r e d by t h e h a r d wa r e ) . 5. Th e i n t e r r up t s e r v i c e r o u t i n e i d e n t i f i e d by the PC i n the SCB is exec uted , and ev e n t u a l l y e x i t s w i th a n RE I i n s t r uc t i o n th a t d i sm i s s e s t h e i n te r r up t . 6. Th e PC a n d PS L a r e r e s to r ed by the e x ec ut i o n o f the RE I i n s t r uc t i o n , a nd t h e i n t e r r upted th r ead o f e x e c u t i o n { p r o c e s s o r l e s s i mpo r t a n t i n te r r up t s e r v i c e r o u t i n e ) c o n t i n u e s wh e r e it l eft off . 6-2 HARDWARE INTERRUPTS Unl i k e so f twa r e i n t e r r up t d i spa t c h i ng , th e r e i s not a one- to-one c o r r e sp o nd e n c e b e t we e n h a r d wa r e I PL a nd a n i n t e r r up t s e r v i c e r o u t i n e v e c to r i n the SCB ( F i g u r e 6 - 2 ) . Th e SCB c o n ta i n s the add r esses o f sever a l i n te r r up t s e rv i c e routines fo r a g i v e n d ev i c e ! P L . Al so , t h e r e a r e no r eg i s t e r s c o r r e s po nd i ng to t h e So f t wa r e I n t e r r upt Re qu e s t Reg i s t e r ( PR $ S I RR ) o r S o f twa r e I n t e r r up t S umma r y Reg i s te r ( P R $ S I S R ) . Th e d ev i c e m ust c o n t i n ue to r e q u e s t a n i n t e r r up t un t i l the p r oc e s s o r I PL d r o ps l ow e n o ug h so t h a t t h e i n t e r r up t i s g r a n ted . SCB (System Control Block) 0 .. • SCBB {physical address of start of SCB) • • • . Various exceptions and software Interrupts (Figure 2-1 ) t offsets In SCB • • . . t • 1 0016 IPL 20 interrupts • • . 1 4016 IPL 21 interrupts • . . 1 8016 IPL 22 interrupts . l J1 ) 16 vectors, one for each number TR I 16 vectors ) ) 1 6 vectors ) 1 6 vectors • • 1 C01& IPL 23 interrupts • • • A second SCB page exists on the VAX-11nso for directly vectored UNI BUS device Interrupts Figure 6-2 Sys t em Co n t r o l B l o c k Ve c to r s f o r Ha r d wa r e I n t e r r up t s 6-3 HARDWARE INTERRUPTS 6.1.2 Sys t em Co n t r o l B l o c k Th e Sy s t em Co n t r o l B l o c k ( S C B ) c o n t a i n s t h e v e c to r s u s e d to d i spa tch ( s o f twa r e a nd h a r d wa r e ) i n te r r up t s a nd ex cept i on s . Th e s t a r t i ng ph ys i c a l a d d r e s s o f t h e S C B i s f o und i n t h e Sys t em Co n t r o l B l o c k Ba s e Reg i s t e r ( PR $ S C B B ) . Th e s i ze of t h e S C B v a r i e s d e pend i ng o n p r oc e s s o r t ype: Th e VAX- 1 1 / 7 5 0 s ys t em c o n t r o l b l oc k is t wo pag e s l o ng . Th e VAX- 1 1 / 7 8 0 s ys t em c o n t r o l b l o c k c o ns i s t s o f a s i ng l e pag e . Th e f i r s t pag e o f t h e s y s tem c o n t r o l b l o c k i s t h e o n l y pag e d e f i n e d b y t h e VAX a r c h i t e c t u r e . It conta ins t h e a d d r e s s e s o f s o f t wa r e a nd h a r d wa r e i n t e r r upt s e r v i c e r out ines a s we l l as ex cept i o n serv i c e r o ut i n e s . Th e l a yo u t o f t h e f i r s t S C B p a g e i s p i c t u r ed i n F i g u r e 2 - 1 . Ta b l e 4 - 1 c o n t a i n s mo r e d e t a i l s about the SCB v e c to r s u s ed fo r s o f twa r e i n t e r r up t s . F i g u r e 6 - 2 s h ows h o w t h e s e c o nd h a l f o f t h e f i r s t pag e is d i v i d ed amo ng 1 6 po s s i b l e e x t e r n a l d ev i c e s , e a ch i n t e r r up t i ng a t f o u r po s s i b l e I P L v a l ue s . Th e s e c o nd SCB pag e o n th e VAX- 1 1 /7 5 0 i s u s e d fo r d i r e c t l y v e c t o r ed UN I B U S d ev i c e i n te r r up t s . E a c h v e c to r i n t h e SCB i s a l o ng wo r d th a t i s e x am i n ed by t h e p r o c e s s o r wh e n a n ex c e p t i o n o r i n t e r r up t o c c u r s , t o d e t e rm i n e h o w t o s e r v i c e t h e event . F i g u r e 6 - 1 i l l us t r a t e s t h e f o rm a t o f a v e c t o r i n the SCB , a nd i nd i c a t e s wh i c h stack i s u s e d to s e rv i c e a n ex c e pt i o n o r i n t e r r up t . I n VAX/VM S , a l l h a r d wa r e i n t e r r up t s ( a nd a l l s o f twa r e i n t e r r up t s a b o v e I PL 3) are s e r v i c ed on the s ys t em-w i d e i n t e r r upt s t ac k . Th e r e s c h e d u l i ng s o f twa r e i n te r r up t ( I P L 3 ) m a y b eg i n e x e c u t i o n o n t h e ke rnel s tac k but i mmed i a t e l y c h a ng e s to t h e i n te r r up t s t a c k wh e n i t e x e c u t e s a SVPCTX i n s t r uc t i o n ( Ch a p t e r 8 ) . AST d e l i v e r y ( I PL 2 ) is s e r v i c ed u s i ng a p r o c e s s - s p e c i f i c k e r n e l s t a c k . 6 . 1 . 2 . 1 VAX- 1 1 /7 5 0 E x t e r n a l Ad a pt e r s - Th e b a c kpl a n e i n t e r c o n n e c t o n t h e VAX- 1 1 /7 5 0 , c a l l ed th e CM I ( C PU t o memo r y i n t e r c o n n e c t ) , c o nnec ts Each t h e C P U , memo ry c o n t r o l l e r s , a nd UN I B US or MAS SBUS a d a p t e r s . c o nn e c t i o n to t h e CM I i s i d e n t i f i e d b y i t s s l o t n um be r . Th e r e a r e a t o t a l o f 3 2 s l o t s , t h e f i r s t 1 6 o f wh i c h a r e used fo r the o p t i o n a l wr i t ab l e c o n t r o l store ( WC S ) . Th e n e x t 1 0 s l o t s a r e r e s e r v ed f o r memo r y c o n t r o l l e r s a nd UN I B U S o r MAS S B U S a d a pt e r s . Th e s e 1 0 s l o t s a r e c a l l ed f i x ed s l o t s b e c a u s e t h e m a pp i ng o f c o n t r o l l e r / a d a pt e r to s l o t n umb e r i s f i x ed . Th a t is, a pa r t i c u l a r s l o t c an h a v e onl y a pa r t i c u l a r a d a p te r p l a c ed in it. F i v e o f the t e n f i x ed s l o t s a r e c u r r e n t l y u s e d by e x t e r n a l a d a p t e r s . Th e s e ad apte r s a r e : Memo r y Co n t r o l l e r U p t o th r e e MAS S B U S Ad a p t e r s UN I BUS Ad a p t e r Slot 0 S l o t s 4 th r o ug h 6 Slot 8 Th e l a s t s i x s l o ts a r e r e se rved fo r a d a pt e r s r eg i s t e r s , a nd a r e c a l l ed f l o a t i ng s l o t s . w i th conf ig ura tion E a c h s l o t h a s f o u r SCB v e c to r s i n t h e f i r s t S C B pa g e a s s i g ned to it, one fo r e ach I P L v a l u e f r om 2 0 t o 2 3 . As s h o wn i n F i g u r e 6 - 2 , t h e f i r s t 1 6 v e c to r s a r e a s s i g n e d t o I P L 2 0 a n d s o o n . Th e s e c o nd SCB pag e on t h e VAX- 1 1 / 7 5 0 i s u s ed fo r d i r e c t l y v e c to r ed UN I B US d e v i c e i n t e r r up t s . E a c h S C B v e c to r c o r r e s po nd s to a UN I B US v e c to r in the r a ng e f r om 0 to 7 7 4 ( o c t a l ) . 6-4 HARDWARE INTERRUPTS 6 . 1 . 2 . 2 VAX- 1 1/7 8 0 E x t e r n a l Ad a p t e r s - On the VAX- 1 1 /7 8 0 , the Sync h r o n o u s Ba c k p l a n e Inte r connec t ( SB I ) c o n ne c t s the C PU , m emo r y contro l lers ( i n c l ud i ng MA7 8 0 s ) , DR7 8 0 s , a nd UN I B US or MAS S B US a d a pte r s . E a c h c o n n ec t i o n to t h e S B I i s a s s i g n ed a t r a n s f e r r e q u e s t ( TR ) n um b e r t h a t i d e n t i f i e s i t s S B I p r i o r i t y . T R n um b e r s r a ng e f r om 0 ( h i g h e s t p r i o r i ty ) to 1 5 ( l o we s t p r i o r i ty ) . Th e r e i s a l i m i t o f 1 5 c o n n ec t i o n s t o t h e S B I ( Ta b l e 6 - 1 ) . TR 0 is used fo r a spec i a l pu r po s e o n the S B I a n d h a s n o c o r r e s po nd i ng ex t e r n a l a d a pt e r . Ta b l e 6 - 1 S t a nd a r d SB I Ad a pt e r As s i g nm e n t s o n the VA X- 1 1 /7 8 0 E x t e r n a l Ad a pt e r Type VAX-1 1 /7 8 0 As s i g nm e n t TR 0 F i r s t Memo r y Co n t ro l l e r TR 1 S e c o nd Mem o r y Co n t r o l l e r TR 2 Commen t s Ho l d L i n e fo r n e x t c yc l e Th i s i s t h e h i g h e s t T R l ev e l . ( Th i s TR l ev e l i s no t a s s i g ned to a d ev i c e . ) F i r s t MA78 0 S h a r ed Memo ry Se c o nd MA7 8 0 Sh a r ed Memo r y F i r s t UN IB US Ad a pt e r TR 3 S e c o nd TR 4 UN I B US Ad a pt e r Th i r d UN IB US Ad a pt e r TR 5 Fo u r th UN I B U S Ad a pt e r TR 6 TR 7 F i r s t MASSB US Ad a pt e r TR 8 S e c o nd MAS SB US Ad a pt e r TR 9 Th i rd MAS S B U S Ad a p t e r TR 1 0 Fo u r th MA S S B US Ad a pt e r TR 1 1 DR7 8 0 S B I TR 1 2 In t e r fa c e Re s e r ved TR 1 3 R e s e r v ed TR 1 4 R e s e r ved TR 1 5 Re s e r ved TR 1 6 Th e C PU has i m pl i c i t TR 1 6 . Th i s i s the l owe s t TR l ev e l . An a d a p t e r i s n o t r e s t r i c t ed to h av i ng a spec i f i c TR n um be r . H o we v e r , the r e l a t i v e p r i o r i t i e s o f t h e v a r i o u s a d a pte r s m a y n o t c h a ng e . Th a t i s , a s ys t em c a nno t h av e a n MBA w i th a h i g h e r p r i o r i ty { l o we r TR n umbe r ) than a UBA . Fo r i n s t a n c e , i f a s ys t em h a s t wo l o c a l m em o r y c o n t r o l l e r s a nd a n MA7 8 0 s h a r ed m emo r y c o n t r o l l e r , the f i r s t UN I B US a d a pt e r on tha t sys t em c o u l d h a v e TR n umbe r 4 , w i th t h e MA 7 8 0 h a v i ng TR n um b e r 3 , a nd the m emo r y c o n t r o l l e r s h av i ng TR n umb e r s 1 a n d 2 . 6-5 HARDWARE INTERRUPTS 6 . 1 . 2 . 3 Ad apte r C o n f i g u r a t i o n - O n bo th p r o c e s so r s , the pr esence o f a n ad a p te r a t a pa r t i c u l a r s l o t o r T R n um b e r i s c h e c k e d b y t e s t i ng the f i r s t l o ng wo r d i n the a d a pt e r ' s I /0 r eg i s t e r spa c e , a nd c h e c k i ng fo r n o n e x i s t e n t m emo r y . Th e p r e s e n c e o r a b s e n c e o f a n e x t e r n a l a d a pt e r i s d e t e r m i n ed b y th e p r i m a r y b o o t s t r a p p r og r am VMB ( Ch a p t e r 2 1 ) a s pa r t of that p r og r am ' s m emo r y s i z i ng o pe r a t i o n . S p e c i f i c a l l y , VMB l o ad s t h e m a c h i n e c h ec k v e c to r i n t h e SCB w i t h t h e a d d r e s s o f a spec i a l r o u t i n e wh i l e it is s 1 z 1 ng memo r y a nd d e t e rm i n i ng wh i c h e x t e r n a l a d a pt e r s a r e p r e s e n t . I f a n o n e x i s t e n t memo r y m a c h i ne c h e c k o c c u r s , there is no c o nn e c t ed a d a pt e r at t h e l o c a t i o n b e i ng t e s t e d . Th e r e s u l t o f th i s t e s t i ng is s to r ed in a 1 6 -by t e a r r a y i n a d a ta s t r uc t u r e c a l l ed a r e s t a r t pa r am e t e r b l o c k ( RPB ) . La t e r s t a g e s o f t h e i n i t i a l i z a t i o n u s e t h e i n fo rm a t i o n o b t a i n e d b y VMB a n d s to r ed in the R PB wh e n t h e y c o n f i g u r e s p e c i f i c a d a pt e r s i n to t h e s y s tem . On bo t h t h e VAX- 1 1 /7 5 0 a n d t h e VAX- 1 1 /7 8 0 , o n l y I PL l ev e l s 2 0 t h r o ug h 23 a r e u s ed f o r d ev i c e i n t e r r up t s . W i th i n t h e SCB , v e c to r s a r e r e s e r v ed f o r e a c h I P L l ev e l a v a i l a b l e to e a c h a d a pt e r ( Fi g u r e 6 - 2 ) Wh e n e v e r an ad a p t e r g e ne r a te s a n i n t e r r up t fo r a d ev i c e c o n n e c t e d to i t , t h e s l o t n um b e r o r TR n um b e r o f the a d a p t e r a nd the d ev i c e I PL a r e u s ed by t h e h a r d wa r e to i nd ex i n to the SCB f o r the a pp r o p r i a t e i n t e r r upt s e rv i c e r o u t i ne . S o m e a d a pte r s s uc h as l o c a l m emo r y c o n t r o l l e r s d o n o t g e n e r a t e i n t e r r up t s . • 6.2 VAX/VMS INTERRUPT S E RV I C E ROUT I N E S Th e i n te r r up t s e rv i c e r o u t i n e s u s ed by VM S o pe r a te in th e l i m i t ed s ys t em c o n t e x t o r i n t e r r up t c o n t e x t d e sc r i b ed in Ch a pt e r 1 . Th e s e r o u t i n e s e x e c u t e a t e l ev a t ed I P L o n th e i n t e r r up t s t a c k o uts i d e the contex t o f a process . 6.2.1 Re s t r i c t i o n s I mpo s e d o n I n te r r up t S e r v i c e Ro u t i n e s Th e r e a r e s ev e r a l r e s t r i c t i o n s i m po s ed o n i n t e r r upt service r o u t i nes b y e i th e r t h e VAX a r ch i t e c t u r e o r b y s yn c h r o n i z a t i o n t e c h n i que s used b y VM S . Th e s e r e s t r i c t i o n s r e s u l t f r om t h e l i m i t ed c o n tex t th a t is ava i l ab l e t o any r o ut i ne that executes o uts ide the c o n t e x t o f a process . Th e fo l l o w i ng l i s t o f i t em s i nd i c a t e s some o f the spe c i f i c o pe r a t i o n s a nd d a t a r e fe rences t h a t c a nno t o c c u r i n a n i n t e r r upt s e rv i c e r o u t i ne . Th e d e s c r i pt i o n of i n t e r r upt c o n t e x t in Ch a p t e r 1 c o n t a i n s a m o r e g e n e r a l l i s t o f t h e s e a nd o t he r r e s t r i c t i o n s . • • • • I n t e r r up t s e r v i c e r o u t i n e s sho u l d be v e r y s h o r t , l i t t l e p r o c e s s i ng a s po s s i b l e a t d ev i c e I P L . a nd do as An y r eg i s t e r s u s ed b y a n i n t e r r up t s e r v i c e r o u t i n e mus t f i r s t b e s a ved . Al t h o ug h a n i n t e r r up t s e r v i c e r o u t i n e c a nno t l o we r I PL b e l ow t h e l ev e l i n t e r r up t o c c u r r ed . c an e l ev a t e I PL , it a t wh i c h the o r i g i n a l Th e s i z e o f t h e i n t e r r up t s t a c k , the h a r d wa r e i n t e r r up t s e rv i c e rout ines , S YS B OOT p a r am e t e r I N T S TK PAG E S ( wh i c h h a s in all pa r am e t e r f i l e s d i s t r i b uted p a r ame t e r d e t e rm i n e s t h e amo u n t of s t a c k i n t e r r up t s e r v i c e r o u t i n e s . 6-6 s t a c k u s e d by a l l i s c o n t r o l l ed b y the a v a l u e of two pag es Th i s by D I G I TA L ) . s t o r a g e a v a i l a b l e to HARDWARE INTERRUPTS • • • • • 6.2.2 An y e l em e n t s p u s h ed o n t o t h e s t a c k by an i n t e r r up t serv i c e r o u t i n e m u s t b e r em o v e d b e f o r e the i n t e r r upt i s d i sm i s s e d i n o r d e r t h a t RE I wo r k s c o r r e c t l y . Be c a u s e the l o w two b i ts o f i n te r r u pt s e r v i c e rout i ne add resses in the Sy s t em Co n t r o l Bl o c k a r e u s e d fo r s t a c k s e l ec t i on , i n t e r r up t s e rv i c e r o u t i ne s mus t be l o ng wo r d a l i g ned . No pag e a b l e r o u t i n e s o r d a t a s t r uc t u r e s c a n b e r e f e r e nc ed . No d a t a s t r uc t u r e s th a t a r e s yn c h r o n i z e d by e i th e r e l e v a ted I PL ( I P L $ S YNC H o r fo r k I P L ) o r by m u t e x e s c a n be r e f e r e n c e d by i n t e r rup t service r o ut ines wi tho u t d e s t r o y i ng the s ync h r o n i z a t i o n . No r e f e r e nc e s to p e r - p r o c e s s a d d r e s s sp a c e s pa c e ) a r e a l l owed . (PO s pa c e or Pl S e r v i c i ng UN I B US I n t e r r up t s E a c h d ev i c e o n t h e UN I B US has one (or more) vec to r number ( s ) to i d e n t i f y t h e d ev i c e , and a b u s r e que s t ( B R ) p r i o r i t y to a l l o w the UN I B U S to a r b i t r a t e am o ng d ev i c e s wh en m u l t i pl e i n t e r r up t s o c c u r . Th e r e a r e 4 BR l e v e l s , c a l l ed BR4 , B R 5 , BR6 , a nd BR7 . BR7 h a s the h i g h e s t p r i o r i ty . If m u l t i pl e i n t e r r up t s o c c u r fo r d e v i c e s wi th the s am e BR l ev e l , the d ev i c e e l e c t r i c a l l y c l o s e s t to the UBA has the h i g h e s t pr i o r i ty . Th e d ev i c e I P L u s e d equa l s the BR p r i o r i t y + 1 6 . Fo r e x am p l e , B R 4 c o r r e s po nd s to I P L 2 0 . 6 . 2 . 2 . 1 VAX- 1 1 / 7 5 0 UN I BU S I n te r r up t S e rv i c e Ro u t i n e s - UN I B US i n t e r r up t s on t h e VAX- 1 1 / 7 5 0 a r e d i r e c t l y v e c to r ed th r o ug h the s e c o nd pag e o f t h e Sys t em Co n t r o l B l o c k . Th e Sy s t em Co n t r o l Bl o c k conta i n s s e pa r a t e ad d r e s s e s f o r t h e i n t e r r u pt s e r v i c e r o u t i n e s f o r a l l o f the UN I B U S i n t e r r up t v e c to r l o c a t i o n s . Wh en a un i t is c o n n e c ted ( wi th SYSG E N ) , the a pp r o p r i a t e f i e l d s i n the SCB a r e i n i t i a l i z ed to po i n t to the i n t e r r upt s e r v i c e r o u t i n e s f o r the d ev i c e v e c t o r s . Th e i n t e r r upt s e r v i c e r o u t i n e s e v e n t ua l l y t r a n s f e r c o n t r o l to the a pp r o p r i a t e d e v i c e d r i v e r i n t e r r up t s e r v i c e r o u t i n e s . Th e VAX/VM S G u i d e to Wr i t i ng a Dev i c e D r i v e r d e s c r i b e s the d a t a s t r uc t u r e s i n t h e I /0 d a t a b a s e , a nd c o n t a i n s a m o r e c om p l e t e d i s c u s s i o n o f d r i v e r i n t e r r upt service r o u t i n e s t h a n wh a t i s p r e s e n t ed h e r e . Wh e n a UN I B US d ev i c e g e ne r a t e s a n i n t e r r upt o n i n t e r r up t is v e c to r e d d i r e c t l y th r o ug h the i mm e d i a t e l y t r a n s f e r r e d to a P U S HR the VAX- 1 1 / 7 5 0 , the SCB , and cont r o l i s # A M < R O , R l , R2 , R 3 , R4 , R 5 > i n s t r uc t i o n i n t h e a pp r o p r i a t e d ev i c e c o n t r o l l e r ' s c h a n n e l r e q ue s t b lock ( C RB ) . Th e n e x t i n s t r uc t i o n i n the CRB i s a J S B to the d r i v e r i n te r r up t s e r v i c e r o u t i n e ( F i g u r e 6 - 3 ) . Th e l o n g wo r d f o l l o wi ng the JSB i n s t r uc t i o n c o n t a i n s the ad d r e s s o f a n6 t h e r d a t a s t r uc t u r e ( th e I DB , I n t e r r up t D i spa t c h B l o c k ) . Th i s a d d r e s s i s p u s h e d o n the s ta c k ( a s t h e r e t u r n PC f o r t h e J S B i n s t r uc t i o n ) . Ho we v e r , c o n t r o l i s n ev e r r e t u r n ed t h e r e b e c a u s e t h a t a d d r e s s i s r em o v ed f r om th e s t a c k by the d r i v e r i n t e r r up t s e r v i c e r o u t i n e . 6-7 VAX-1 1/780 SCB Interrupt occurs, _ __. hardware responds to Interrupt - UBA ADP UBA Interrupt Service Routine • Saves RG-RS � • Reads BRRVR register In UBA • Uses vector read as Index 1--- --1 V Executing process Is Interrupted; software response to Interrupt Is Initiated. Into vector table �-------+--"" • .... • JMP vector table contains device CRB addresses ... VAX-1 1 /750 SCB Device CRB PUSHR RG-RS JSB �--�t!-t:::::::::::::::� .. -- lOB pointer 0'\ I co � _.. ._ -....-----------1-�-� In Device Driver Second page Device IDB ' � Device Driver Interrupt Service Routine • Uses lOB address on stack to locate: .. - Device CSR :•�+---!"� UCB address :--�---.... Device UCB Fork Block • R3 • R4 • PC - - Device registers - Device UCB • Restores R3 and R4 from fork block In UCB • Transfers control to PC in • I nterrupted process continues ...,.!�-_.... execution .-__ Figure 6-3 fork block (via JSB) When driver issues RSB, - Restores RG-RS - Issues REI to dismiss the interrupt Co n t r o l F l o w i n S e r v i c i ng a UN I B US I n t e r r up t Device registers HARDWARE INTERRUPTS A f t e r the J S B i n s t r uc t i o n i n the CRB t r an s f e r s c o n t r o l to the i n t e r r up t s e r v i c e r o u t i n e , t h e f o l l o w i ng e v e n t s t a k e pl a c e . dr iver 1. Th e d r i v e r i n t e r r up t s e rv i c e r o u t i n e r em o v e s t h e I DB p o i n t e r f r o m th e stac k , a nd u s e s i t t o o b t a i n the a d d r e s s o f t h e d ev i c e c o n t r o l l e r ' s c o n t r o l / s t a t u s r eg i s t e r ( CSR) , a nd the a d d r e s s o f t h e UC B f o r t h e d ev i c e g en e r a t i ng t h e i n t e r r up t . 2. H a v i ng f o und the UCB , the i n te r r upt s e rv i c e rout i ne d e t e rm i n e s wh e t h e r t h e i n t e r r upt wa s e x pe c t ed o r no t , a nd , i f e x p e c t ed , r e s to r e s t h e d r i v e r c o n tex t s to r ed i n the UC B , a nd t r a n s f e r s c o n t r o l to t h e s a v ed PC . 3. Wh e n t h e d r i v e r f i n i sh e s p r o c e s s i ng t h e i n t e r r up t , i t an RSB . 4. Co n t ro l i s t r a n s f e r r ed b a c k t o the d r i v e r i n t e r r up t serv i ce rout ine , wh i c h r e s to r e s the r eg i s te r s ( R O t h r o ug h R S ) s a v ed by t h e PUS HR i n s t r uc t i o n a nd d i sm i s s e s t h e i n t e r r up t w i th an RE I . i s s ue s I f the i n t e r r up t wa s u n s o l i c i t ed , t h e d r i v e r m a y t a k e some a pp r o p r i a t e action , or s i mpl y d i sm i s s the i n t e r r up t by r e s to r i ng R O t h r o ug h R S , a n d i s s u i ng a n RE I . 6 . 2 . 2 . 2 VAX- 1 1/7 8 0 UN I B US I n te r r up t S e r v i c e Ro u t i ne s - Wh e n a d ev i c e o n t h e UN I B US r e q ue s t s a n i n t e r r up t , t h e U B A c o nv e r t s th a t r e q u e s t i n to a n i n te r r upt o n the S B I . Th e S B I i n t e r r upt i s v e c t o r ed th r o ug h t h e S C B t o a UN I B U S Ad a p t e r i n t e r r up t s e r v i c e r o u t i n e . In the case o f i n t e r r up t s g e n e r a t e d b y a UN I B US d ev i c e o n the VAX- 1 1 / 7 8 0 , the c o r r e s po nd i ng ad a p t e r r e c e i v e s d ev i c e i n t e r r up t s , d e t e rm i n e s wh i c h h a s t h e h i g h e s t p r i o r i t y , a n d g e n e r a t e s a n i n te r r up t o f i t s o wn for the C PU ( o n beha l f o f th e i n t e r r up t i ng d ev i c e ) . It is the adapter i n t e r r up t th a t i s v e c to r ed th r o ug h t h e S C B ( us i ng th e i n t e r r upt i ng d ev i c e ' s IPL, a nd t h e ad a p t e r ' s TR n um b e r ) , t o a n a d a p t e r i n t e r r up t s e rv i c e r o u t i n e . Th e a d a p t e r i n t e r r up t s e r v i c e r o ut i ne saves some ( a d a p t e r - spec i f i c ) r eg i s t e r s , a nd pa s s e s c o n t r o l to an i n t e r r up t s e r v i c e r o u t i n e i n the d ev i c e d r i v e r f o r the i n t e r r up t i ng d ev i c e . Th e d r iver i n te r r upt s e r v i c e r o u t i n e c a n t h e n r e s po nd to the i n t e r r up t i n a d ev i c e-d e pend ent f a sh i o n . Af t e r s e rv i c i ng the i n t e r r up t , the r eg i s t e r s s aved by the a d a p te r i n t e r r upt s e r v i c e r o ut i ne m u s t be r e s to r e d , a nd a n RE I i n s t r uc t i o n i s s ued to d i sm i s s t h e i n te r r up t . Th e r e a r e fo u r i n t e r r up t s e r v i c e r o u t i n e s fo r e a c h UBA , o n e fo r each B R l ev e l a t wh i c h UN I B U S d ev i c e s r e q ue s t i n t e r r up t s . Th e y d i f f e r o n l y i n wh i c h i n t e r n a l UBA r eg i s t e r t h e y r e ad t o d e t e rm i n e wh i c h d e v i c e r e que s t ed the i n t e r r up t . Th e s e i n t e r r up t s e r v i c e r o u t i n e s a r e f o und i n a d a t a s t r uc t u r e d e sc r i b i ng th e UBA ( t h e Ad a p t e r Co n t r o l Bloc k ) , t h a t i s c r e a t ed wh e n the s ys t em i s b o o t s t r a pped ( f r om m o d u l e I N I TAD P ) . UN I B US i n t e r r upt s e r v i c i ng on t h e VAX- 1 1 / 7 8 0 beg i n s UN I B US a d a p te r i n t e r r up t s e rv i c e r o u t i n e s . 1. Th e UBA i n te r r u p t s e r v i c e r eg i s t e r s R O th r o ug h R S . 6-9 r o ut ines in one of ( Figure 6-3 ) fo ur save HARDWARE INTERRUPTS 2. A UBA i n t e r n a l r eg i s t e r ( B RRVR ) is r ead to d e t e rm i ne the i d e n t i ty o f the i n t e r r up t i ng d ev i c e . Each BRRVR r eg i s t e r c o nta i ns t h e v e c to r n um b e r c o r r e spo nd i ng t o t h e d ev i c e i n te r r upt , or a n i nd i c a t i o n th a t the UBA i s i n t e r r up t i ng o n beha l f of i ts e l f , not fo r s o m e d ev i c e . ( Th e r e are four BRRVRs i n t h e UBA , o n e fo r e a c h B R l ev e l . ) 3. I f t h e UBA i s i n t e r r up t i ng o n beha l f o f i tse l f , it is n o rma l l y i nd i c a t i ng a n ad a p t e r e r r o r c o nd i t i o n . Th e s e e r r o r s u s ua l l y r e s ul t wh e n a r e f e r e n c e i s mad e t o a nonex i s tent address in UN I B US I /O space . Th e y m a y i nd i c a t e o n l y a t r a n s i e n t h a rdwa r e e r r o r , o r a b ug i n a d ev i c e d r i v e r . Th e s e errors a r e l og g ed , up t o a m a x i m um o f 3 i n a n y g i v e n 1 5 m i n u t e pe r i o d , a nd t h e i n t e r r up t i s d i sm i s s e d . 4. Fo r a d ev i c e i n t e r r up t , t h e v e c to r n um b e r i s used a s a n i nd ex i n to a v e c to r t a b l e . Th e v e c to r t a b l e c o n t a i n s a po i n t e r to the JS B i n s t r uc t i o n i n s i d e the C RB . Co n t r o l is transfer red to th e J S B i n s t r uc t i o n b y a JM P i n s t r uc t i o n i n the ad a pt e r i n te r r up t s e r v i c e r o u t i n e . ( Th e v e c t o r t a b l e e n t r y po i n t i ng to the CRB , a s we l l as the add ress f i elds in the CRB , a r e f i l l ed i n b y SYSGEN a t t h e t i m e t h e d ev i c e d r i v e r i s l o ad ed i n to the s ys t em w i th a S YS G E N C ONNECT c omma n d . ) At t h i s po i n t , i n t e r r upt d i spa t c h i ng p r o c e e d s e x a c t l y a s i n the case of t h e VAX- 1 1 /7 5 0 . No t e t h a t d ev i c e d r i v e r s n e ed no t concern t h em s e l v e s wi th wh e th e r they a r e on a VAX- 1 1 / 7 5 0 o r VAX- 1 1 /7 8 0 , because the i r i n t e r r upt s e rv i c e r o ut i n e s wi l l be ente r ed in a t r a n s pa r e n t m a n ne r . MAS SBUS I n te r r upt S e r v i c e Ro u t i n e s 6.2. 3 Un l i k e UN I B US i n t e r r up t d i spa tc h i ng , t h e MAS S B U S i n te r r up t s e qu e n c e s f o r the VAX- 1 1 / 7 5 0 a nd t h e VAX- 1 1/7 8 0 MAS S B U S a r e i d e n t i c a l . Wh e n the s ys t em i s b o o t s t r a pped , e n t r i e s a r e mad e in the SCB t o transfer contro l to l o ca t i ons in t h e CRB for the MAS S B US Ad a pt e r . Th e i n s t r uc t i o n s i n t h e MBA C RB a r e a P U S HR f o r R2 t o R S , and a J S B to the MBA i n t e r r up t s e r v i c e r o u t i n e MBA $ I N T ( wh i c h i s pa r t of mo d u l e MBA I NTDS P ) • MBA i n t e r r up t s a r e h a nd l ed d i f f e r e n t l y f r om UN I B US i n te r r up t s , pa r t l y because o n e MBA i n t e r r up t m a y i nd i c a t e tha t m u l t i pl e d ev i c e s o n the a d a p t e r n e ed s e rv i c i ng . Th e MBA i n t e r r up t s e r v i c e rout i ne reads an a ttent i o n s umm a r y r eg i s t e r t o d e t e rm i n e wh a t i t m u s t d o to r e s po nd t o a n i n t e r r up t . I f t h e i n t e r r up t e n ab l e b i t i n the MBA i s s e t , a n MBA i n t e r r upt c a n b e c a u s e d b y a n y o f t h e fo l l o w i ng o pe r a t i o n s . • A d a t a t r a n s f e r c om p l e t e s . • An a t t e n t i o n l i n e i s a s s e r ted wh i l e the MBA i s no t b u s y . • An MBA e r r o r o c c u r s wh i l e the MBA i s n o t b u s y . • Th e powe r i s t u r n ed o n fo r t h e MBA . 6-1 0 HARDWARE INTERRUPTS Dev i c e s on the MASSB US c a n a s s e r t the a t t e n t i o n l i n e • i f a n e r r o r o c c u r s , wh e th e r pl a c e , • wh e n a m e c h a n i c a l mo t i o n s uc h a s a d i s k s e e k o r c om p l e t e s , o r • wh e n a d ev i c e c h a ng e s i t s s t a t e . or not a t r an s f e r is t a k i ng t a pe r e w i nd I n g e n e r a l , MAS S B U S d ev i c e d r i v e r s d o n o t r e que s t own e r sh i p o f t h e MBA un t i l they n e ed i t t o pe r f o rm a t r a n s f e r . Th e MBA i n t e r r u p t s e r v i c e r o u t i n e a s s um e s t h a t i f t h e MBA o wn e r i s e x pe c t i ng a n i n t e r r up t , then the i n t e r r up t c u r r e n t l y b e i ng s e r v i c ed i nd i c a t e s th a t a t r a n s f e r h a s c om p l e ted o r b e e n abo r ted . Th a t i s , wh e n a n MBA i n t e r r up t o c c u r s , MBA$ I NT d i s p a t c h e s to t h e o wn e r o f the MBA f i r s t . I t then c h e c k s Th e UCB l i st wh e t h e r o t h e r d ev i c e s o n t h e MAS S B U S n e ed a t te n t i o n . c o n t a i n ed in the ! DB a l l o ws MBA $ I N T t o a s s o c i a t e UCB ad d r e s s e s w i th d ev i c e s tha t a r e r e que s t i n g s e r v i c e . MBA $ I NT r e s po nd s to an i n t e r r upt i n o n e o f th r e e wa ys ( Figure 6-4 ) . I t m a y p e r fo rm all th r e e o f these act ions to s e rv i c e m u l t i pl e a t te n t i o n r e que s t s i n r e s po n s e to a s i ng l e i n te r r upt . • Fo r an e x p e c t e d i n te r r up t fo r a s i ng l e - un i t c o n t r o l l e r (a d isk) , MBA$ I N T i ssues a JSB i n s t r uc t i o n th a t transfe r s c o n t r o l d i r e c t l y t o the f o r k PC s t o r ed in th e UCB o f the i n t e r r up t i n g d ev i c e . Th e d r i v e r r e t u r n s to MBA $ I NT wh e n i t h a s c ompl e t ed i t s wo r k . • Fo r an u n s o l i c i t ed i n t e r r upt f o r a s i ng l e- un i t c o n t r o l l e r , MBA$ I N T i s s ue s a J S B i n s t r uc t i o n th a t t r a n s f e r s c o n t r o l to a d r i v e r - s upp l i e d u n e x pe c t ed i n t e r r upt s e r v i c e r o u t i n e , wh i c h w i l l r e t u r n t o MBA$ I NT . • Fo r a m u l t i - d ev i c e c o n t r o l l e r ( a mag t a pe ) , MBA$ I NT t r a n s f e r s c o n t ro l to th e C RB f o r t h e d ev i c e c o n t r o l l e r . Th e d ev i c e c o n t r o l l e r CRB d i s p a tc h e s to a c o n t r o l l e r i n t e r r up t s e rv i c e r o ut i ne th a t s a v e s R2 to R S and t r a n s f e r s c o n t r o l t o t h e d r i ve r i n t e r r up t serv i c e rout i ne . Th i s serv i c e r o ut i ne e v e n t u a l l y r e t u r n s c o n t r o l to MBA$ I NT . Th e wa y MBA $ I NT d e c i d e s wh e t h e r a n e n t r y i n the MBA I DB is a UCB ad d r e s s ( s i ng l e- un i t contro l l e r ) , or a po i n t e r i n to a CRB ( m u l t i -d ev i c e c o n t r o l l e r ) i s by c h e c k i ng the l ow o rder bi t o f the entry i n t h e M B A I DB f o r t h e c o n t r o l l e r . I f t h e b i t i s s e t , th e n t h e e n t r y i s f o r a m u l t i - d ev i c e c o n t r o l l e r . If the b i t is c lear , the entry r e pr e s e n t s the UC B a d d r e s s f o r t h e d ev i c e o n a s i ng l e- d ev i c e contro l l e r . UC Bs , l i k e CRBs , a r e a l wa ys l o ng wo r d a l i g ned ( th e low o rde r two b i ts a re c l ea r ) . Wh e n a C RB i s c r e a t e d fo r a m u l t i - d ev i c e c o n t r o l l e r , a nd i t s ad d r e s s s to r ed i n t h e M BA I DB , the ad d r e s s is i nc r em e n t e d b y l s o th e l o w o r d e r b i t w i l l b e se t . Co n t r o l i s a c t ua l l y t r a n s f e r r ed t o the P U S H R i n s t r uc t i o n in t h e m u l t i - d ev i c e c on t r o l l e r C RB v i a a JSB - (RS) i n s t r uc t i o n ( wh e r e R S c o n t a i n s t h e MBA I DB e n t r y ) , so th a t o r d e r b i t i s c l e a r ed b e f o r e c o n t r o l i s a c t ua l l y t r a n s f e r r ed . 6-l l the low � MBA registers Interrupt occurs; � hardware responds 1---,.�-1 to I ... M B A CSR M BA CRB � PUSHR R2-R5 - MBA Interrupt Service Routine ( M BA$1 NT: : ) Executing process is interrupted; software response initiated. Interrupted process continues execution � CASE 1' slngle-un• (disk) controller expecting interrupt JSB - I ••-'� .:,. i:J , � •I 1e...... expectmg mterr�: , •-•----•-• -•-•-•- � ' • • CASE 3: multi-unit (tape) -e,- � • controller JSB - i ..•,. , CASE 2: single-unit (disk) � � con roll r not � _ L.--------------------�· �_. Fork Block • R3 List of CRBs • R4 • PC a nd UCBs for -�---,.._ -----+-----t � -.C:��!!!!._ II. ro-1 M BA IDB &. JSB interrupt to interrupt is Device UCB f or single-unit controller MBA I D B SCB � devices o n ---+------' MASSBUS .-. Device Driver .. .. I n struction awaiting ..., interrupt (PC stored in UCB fork block) •' • -- 1- \- - - - - - - ·� , U n solicited interrupt • routine � 1 • exits with RSB � 1rt-' ,, • - •' _ _ _ _ _ Interrupt service "-• _ _ routine JSB ____, • rest ores R2-R5 • exits with REI � - ,, -. - - ..... , . • .... 'e .... Device UCB for multi-unit - Device CRB PUSHR R2-R5 - :------....Device controller I D B :�-&---' JSB -. Device I D B :---tl-- --. Device CSR • [.;... :+---+---' List of UCBs • for devices on thi s controller controller Fork Block • R3 • R4 • PC controiJer registers Figure 6-4 C o n t r o l F l ow i n S e r v i c i ng a MAS SB U S I n t e r r up t HARDWARE INTERRUPTS MBA $ I N T a l wa ys c h e c k s the MBA a t ten t i o n s umm a r y r eg i s t e r after a dr iver i n t e r r up t s e rv 1 c e r o u t i n e r e t u r n s c o n t r o l to i t to d e t e rm i n e wh e th e r a n o t h e r d ev i c e o n t h e MAS S B U S r e que s ted a n i n t e r r up t wh i l e the MAS S B U S o wn e r wa s t r a n s f e r r i ng d a t a , or wh i l e t h e c u r r e n t i n t e r r up t wa s b e i ng proces sed , b e c a us e d a ta t ransfer f unc t i o n s b l o c k the i n t e r r up t s f r om nontr ans f e r f un c t i o n s un t i l the d ata t r an s f e r c om p l e t e s . DR 3 2 I n te r r up t S e r v i c e Ro u t i ne 6.2.4 DR 3 2 i n t e r r upt d i s pa t c h i ng i s h a nd l ed s i m i l a r l y to MBA i n t e r r up t d i s pa t c h i ng . Wh e n t h e s ys t em i s b o o t s t r a pp e d , e n t r i e s a r e m a d e i n th e S C B t o t r a n s f e r c o n t r o l to l o c a t i o n s i n the CRB for the DR 3 2 . Th e i n s t r u c t i o n s i n the CRB a r e a P U S HR f o r R 2 t o R 5 , a n d a J S B . Th e DR 3 2 I DB a d d r e s s fo l l o ws t h e J S B i n s t r u c t i o n i n the DR 3 2 CRB ( F i g u r e 6 - 5 ) . I n i t i a l l y , t h e J S B i n t h e DR 3 2 C RB t r an s f e r s c o n t r o l to r o u t i n e DR $ I NT i n m o d u l e DR INTHAND . Th i s r o u t i n e s i m p l y 1. c l e a r s t h e a d a p t e r powe r up a nd po we r d o wn c o n t r o l r eg i s t e r , 2. c a l l s o n a c o n t r o l l e r i n i t i a l i za t i o n DR 3 2 ( a nd d i s a b l e DR 3 2 i n t e r r up t s ) , 3. r e s to r e s r eg i s t e r s R 2 t o R 5 , a nd 4. i s s ue s a n R E I i n s t r uc t i o n . b i ts ro u t i ne to in a DR 3 2 reset the Wh e n the DR 3 2 d r i v e r ( XFDR I VE R ) is l o ad ed by SYSG E N (as pa r t o f AUTOCONF I G UR E wh e n the s ys t e m i s b o o t s t r a pped , o r b y a n expl i c i t CONN E C T c ommand ) , t h e J S B i n s t r uc t i o n i s o v e rwr i t t e n to po i n t to the i n t e r r up t s e r v i c e r o u t i n e in t h e d r i v e r . Th i s r o u t i n e 6. 2. 5 1. r e s po nd s to t h e v a r i o us t ype s o f DR 3 2 i n t e r r up t s , 2. r e s to r e s r eg i s t e r s R 2 t o R 5 , a nd 3. i s s u e s a n R E I i n s t r uc t i o n . MA7 8 0 I n te r r up t D i s pa tc h i ng Al tho ug h t h e s t a nd a r d MS 7 8 0 m em o r y c o n t r o l l e r d o e s n o t g en e r a t e i n te r r up t s , t h e sh a r e d m em o r y ( MA7 8 0 ) c o n t r o l l e r d o e s . I n t e r r up t s a r e r e que s t e d b y a d r i v e r o r t h e e x e c u t i v e t o i n te r r up t a n o th e r p r o c e s so r Th i s o c c u r s wh e n e v e r a s h a r ed m em o r y c o n n e c t ed to t h e sh a r ed memo r y . e v e n t f l ag i s s e t , o r a s h a r e d m em o r y m a i l b ox m e s s a g e i s wr i t t e n . 6-13 l"%j 1-'• 1.0 c t; CD 0"\ SCB CASE I Ul () Interrupt DR32 CRB 0 ::s rt t; 0 f--J PUSHR R2-R5 JSB responds to interrupt 1 Path taken until the DR32 DR$1NT: : • Disables DR32 interrupts • Restores R2-R5 • REI l"%j f--J 0 � 1-'• 0"\ ::s f--J Cl.l I � CD t; <: 1-'• () 1-'• Executing process is interrupted; software response to interrupt is initiated • Respond to interrupt; DR32 CSR ::s 1.0 Device UCB 0.1 t:l :::0 Fork Block • R3 • R4 • PC -...J co 0 H DR32 Driver Interrupt Service Routine DR32 lOB Path taken after the DR32 driver is loaded e.g., queue AST to user process to inform L!Ser of interrupt • Restore R2-R5 • REI DR32 registers ::s rt CD t; t; c "0 rt F i gure 6 - 5 Contro l F l ow in Servic ing a DR7 8 0 Interrup t Interrupted process continues execution = > :;cl tj �::0 tzl H z 1-i tzl ::0 c: ., 1-i en :;cl HARDWARE INTERRU PTS Wh e n t h e s y s t e m i s b o o t s t r a pped , m o d u l e I N I TADP p l a c e s e n t r i e s i n to the S C B t o t r a n s f e r c o n t r o l t o l o c a t i o n s i n th e MA7 8 0 ADP wh e n MA 7 8 0 i n t e r r up t s o c c u r ( F i g u r e 6 - 6 ) . Th e l o c a t i o n s i n t h e ADP c o n t a i n a P U S HR i n s t r uc t i o n s av i ng RO to R5 , a nd a JSB i n s t r uc t i o n th a t t r a n s f e r s c o n t r o l t o r o u t i n e MA$ I N T ( i n MAHAN DLER ) . 1. Wh e n MA$ INT o b t a i n s c o n t r o l , i t r em o v e s t h e v a l u e pu s h e d o n to the s tack by t h e J S B i n s t r uc t i o n i n t h e ADP , a nd u s e s i t t o d e t e rm i n e the a d d r e s s o f t h e MA 7 8 0 ' s ADP . 2. I t u s e s f i e l d s i n t h e AD P t o l o c a t e ad a p t e r r eg i s t e r s i n the MA 7 8 0 , and to d e te rm i ne wh i c h po r t r e qu e s t e d a n i n t e r r u p t ( a nd wh a t k i n d o f i n t e r r up t wa s r e qu e s t e d ) . 3. I f t h e i n t e r r up t i s fo r a p r o c e s s o r b e i ng connec ted to the m em o r y , t h e i n te r r up t i s d i sm i s s ed by r e s t o r i ng R O t o R S a n d i s s u i ng a n RE I . 4. Ot h e r w i s e , MA$ I N T s e r v i c e s the i n t e r r up t . 5. An d f i n a l l y , t h e i n t e r r up t i s d i sm i s s ed by r e s t o r i ng R O to R S a nd i s s u i ng a n RE I . MA780 registers SCB MA$1 NT: : MA780 ADP Interrupt MA780 CSR ----4� PUSHR RO-RS • Com putes a d dress of ADP from pointer o n stack responds • Servic es interrupt to interrupt • Restores RO-RS • Exits with REI E xecuti n g process is interrupted; software respo n s e to interrupt i s initiated. I nterrupted process c o nti n u es executio n . Figure 6-6 6.3 Co n t r o l Fl ow i n S e rv i c i ng a MA 7 8 0 I n t e r r u p t C ONNECT-TO- I NTERRU PT MECHAN I SM Th e c o nnec t - t o - i n t e r r up t m e c h a n i sm a l l o ws a pr o c e s s to be no t i f i e d of a UN I B U S d ev i c e i n t e r r up t b y the d e l i v e r y o f a n AST , b y t h e s e t t i ng o f a n e v e n t f l ag , o r b o th . Th e p r o c e s s c a n a l so spec i f y a n i n t e r r up t s e rv i c e r o u t i n e t h a t w i l l r e s po nd to d ev i c e i n t e r r up t s . can A s u i t a b l y p r i v i l eg ed p r o c e s s ( w i th CMKRNL a nd PFNMAP p r i v i l eg e s ) r e s po nd to an i n t e r r upt b y r e ad i ng o r wr i t i ng d ev i c e r eg i s t e r s , a n d po s s i b l y , b y i n i t i a t i ng f u r th e r d ev i c e a c t i v i t y . Howev e r , i n o r d e r t o d i r e c t l y m a n i pu l a te d ev i c e r eg i s te r s , t h e p r o c e s s m u s t f i r s t m a p t h e UN I B U S I/0 pa g e ( s ) c o n t a i n i ng the r eg i s t e r s fo r t h e d ev i c e i n to i ts 6-1 5 HARDWARE INTERRUPTS o wn process s pa c e ( PO or Pl) . Th e VAX/VM S Re a l T i m e U s e r ' s G u i d e c o n t a i n s a d i s c us s i o n o f m a pp i ng the UN I B U S I /0 p ag e , a nd us i ng the c o n n e c t - to - i n t e r r up t c a pa b i l i t y . C h a pt e r 1 3 c o n t a i n s m o r e d e t a i l ed i n fo rma t i o n o n h o w t h e m a pp i ng i s a c t ua l l y pe r f o rmed . No t e tha t t h e phys i c a l a d d r e s s e s o f t h e UN I B US I/0 p a g e d i f f e r o n t h e VAX- 1 1 / 7 8 0 a nd VAX- 1 1 / 7 5 0 . Th e r e f o r e , d i f f e r en t PFNs m u s t b e u s e d wh e n m a ppi ng t h e UN I B U S I /O p a g e . UN I B U S I /O add ress space s ta r ts ( ph ys i c a l l y ) a t 2 0 0 0 0 0 0 0 ( h e x ) fo r t h e VAX- 1 1 / 7 8 0 , a nd F 2 0 0 0 0 ( h e x ) f o r t h e VAX- 1 1 / 7 5 0 . Th e d e t a i l s o f m a pp i ng to the I /0 p a g e a r e d e s c r i b e d i n t h e VAX/VMS Re a l -T i m e Us e r ' s G u i d e . Append i x D c o n t a i n s a l i s t o f s ym bo l s d e f i n ed b y t h e $ I 0 7 5 0D E F a nd $ I 0 7 8 0D E F m a c r o s to make th i s m a pp i ng a s s ym bo l i c a s po s s i b l e . Th e c o nn e c t - to - i n te r r upt f a c i l i t y i s a n e x t e n s i o n o f the i n t e r r up t d i s pa tc h i ng s c h em e . I n o rd e r to u s e i t , t h e c o nn e c t - to - i n t e r r up t d r i v e r ( C ON I NTERR ) m u s t b e a s s o c i a t ed wi th t h e i n t e r r up t v e c to r . Th e a s s o c i a t i o n i s m a d e u s i ng t h e S Y S G E N C ONNE C T c ommand , s pe c i f y i ng • • • a n a m e f o r t h e d ev i c e ( to c o nn e c t s to the i n t e r r up t ) , be the i n t e r r up t v e c to r i n t e r r up t s , a nd wh i c h at u s ed by the the process d ev i c e tha t g ene r a te s t h e C ON I NTERR d r i v e r , wh i c h i n i t i a l l y r e s pond s t o the i n t e r r up t s . d ev i c e Wh e n the d ev i c e g e ne r a t e s a n i n t e r r up t , t h e n o rm a l UN I B US i n te r r up t d i s pa tc h i ng s e que n c e i s f o l l o we d , a s d i sc u s s e d i n s e c t i o n s 6 . 2 . 1 a n d 6.2.2. Ho we v e r , the C ON I NT E RR i n t e r r up t s e rv i c e r o u t i ne t r an s f e r s control t o the u s e r - s uppl i ed i n te r r upt s e r v i c e r o u t i n e ( i f o n e wa s s up p l i ed ) u s i ng a JS B o r CALL i n s t r uc t i o n ( a s r e que s t e d by t h e use r ) . Th i s is i l l us t r a ted i n F i g u r e 6 - 7 . Wh e n the u s e r - s uppl i ed i n t e r r up t s e rv i c e r o u t i n e i s s u e s a n R S B (or RET ) , t h e C ON I N T E RR i n t e r r up t s e rv i c e r o ut i ne r eg a i n s c o n t r o l . Be fo r e r e s to r i ng RO to R 5 a n d i s s u i ng a n RE I , t h e C ON I NT E RR i n t e r r up t s e r v i c e r o u t i n e que u e s a n A S T to the p r o c e s s ( i f r e que s t ed ) t o no t i f y the p r oc e s s th a t a n i n t e r r up t h a s o c c u r r ed ( v i a the AST , o r b y s e t t i ng a n e v e n t f l ag ) • I n o r d e r f o r the p r o c e s s - s uppl i ed i n t e r r up t s e rv i c e r o ut i ne to be access ibl e to t h e C ON INT E RR i n t e r r up t s e r v i c e r o u t i n e , t h e C ON I NT E R R add r e s s s pa c e . Th e d r i v e r d o ub l e maps the u s e r r o u t i n e i n to sys �m d o ub l e m a pp i ng r e q u i r e s e no ugh s ys tem pag e t iO� e e n t r i e s ( r e s e r v ed b y t h e REALT I M E S PTS SYS BOOT p a r am e te r ) t o m a p t he u s e r - s uppl i ed r o u t i n e s ( o t h e r d r i ver r o u t i n e s b e s i d e s a n i n t e r r upt s e rv i c e r o u t i n e m a y b e s pe c i f i ed wh e n c o n n e c t i ng to an i n te r r up t ) . Wh e n the proc ess d i s connec t s f r om t h e i n t e r r upt , t h e S PTs used to m a p t h e r o u t i n e s fo r t h a t p r o c e s s a r e mad e a v a i l a b l e f o r l a t e r u s e b y o th e r p r o c e s s e s . 6-1 6 HARDWARE INTERRUPTS CONINTERR Interrupt Service Routine Device CRB JSB .. - - � • JSB (or CALL) I DB address : • Request delivery Device IDB Device CSR : - Device UCB : + I r � if requested by user .. - of AST to process or set an event flag, if desired by user • Restore RO-RS • Issue an REI to dismiss interrupt Device UCB Fork Block • R3 • R4 • PC Figure 6-7 � This portion of the interrupt dispatch scheme is an explicit example of the general . . UN IBUS mterrupt dispatch scheme illustrated in Figure 6-3 I User-supplied Interrupt Service Routine • Responds to interrupt In device-dependent fashion • Exits with RSB I I I I I This portion of the interrupt dispatch scheme is specific to the connect-to-interrupt driver E x t end i ng I n t e r r upt D i s pa tch Me c h a n i sm wi t h t h e Co n n e c t - to - I n t e r r up t Fa c i l i t y 6-1 7 C HAPTER 7 ERROR HANDL I NG Th e r e a r e s e v e r a l l ev e l s fo r r e po r t i ng s y s t em-w i d e ( Pro c essand imag e-spec i f i c e r r o r s a r e h a nd l ed m e c h a n i sm d e s c r i b ed i n Ch a p t e r 2 . ) • • • 7.1 e r ro r s i n VM S . b y t h e ex c e p t i o n Th e e r r o r l ogg i ng s ub s y s t em a l l o ws d ev i c e d r i v e r s a nd o th e r s ys t em c ompo n e n t s t o r e c o rd e r r o r s a nd o th e r e v e n t s fo r l a t e r i n c l u s i o n i n a n e r r o r l og r e po r t . Th e BUG C HECK m e c h a n i sm i s u s e d by VM S t o s h u t d o wn t h e s y s t em i n a n o r d e r l y f a s h i o n wh e n i n t e r n a l i n c o n s i s t e n c i e s o r o th e r i r r e c o v e r a b l e e r r o r s a r e d e t e c ted . A mach ine check i s an ex cept ion th a t i nd i c a t e s p r o c e s s o r has d e t e c ted some C P U - s p e c i f i c e r r o r . th a t the ERROR LOGG I NG Th e e r r o r l og g i ng s ub s ys t em i s u s e d to r e c o r d d ev i c e e r r o r s , p r o c e s s o r d e t e c t ed c o nd i t i o n s , a n d o th e r n o t e wo r thy e v e n t s s uc h a s v o l um e m o un t s a nd s ys tem s t a r t ups . Ove r v i ew o f t h e E r r o r Log g i ng S ubsys tem 7.1.1 E r r o r l og g i ng o c c u r s in th r e e s t e p s . 1. Co mpo n e n t s s uc h a s d ev i c e d r i v e r s th a t w i s h to l o g an e r ro r c a l l r o u t i n e s i n t h e e x e c u t i v e tha t wr i te e r r o r m e s s ag e s i n to o n e o f t wo b u f f e r s pe rm a n en t l y a l l o c a t e d in the e x ec ut i v e i m ag e . 2. Wh e n t h e b u f f e r a l l o c a t i o n r o u t i n e d e t e c t s th a t a b u f f e r is f ul l , i t a wa k e n s the E RRFMT p r o c e s s s o th a t t h e b u f f e r contents c an be wr i tten to the error l og file [ S YS E RR] E RRLOG . SYS . 3. Th e c o n t e n t s o f t h i s f i l e c a n b e a s s emb l ed i n t o a t h e r e po r t g en e r a to r u t i l i t y SYE . 7-1 r e po r t by E RROR HANDL ING Dev i c e D r i ve r E r r o r s 7.1.2 Th e r e a r e t wo r o u t i n e s i n t h e e r r o r l og s ub s ys tem us ed b y d ev i c e d r ivers . E R L $DEVI C ERR is used to r e po r t d ev i c e- sp e c i f i c e r r o r s . E R L $ D EVI C TM O c a n b e c a l l ed b y a d r i v e r to r e po r t a d ev i c e t i m e o u t . In e i th e r c a s e , 1. a n e r r o r message b u f f e r i s a l l o c a ted , 2. t h e b u f fe r i s l o ad e d w i t h i n fo rm a t i o n o b t a i n e d f r om th e un i t c o n t r o l b l o c k a nd f r om t h e c u r r e n t I /0 r e que s t pa c k e t , a nd 3. t h e d r i v e r i s c a l l ed a t i t s r eg i s t e r d um p r o u t i n e e n t r y po i n t to s t o r e d ev i c e - s p e c i f i c i n f o rma t i o n i n to t h e e r r o r m e s s a g e b u f fe r . O th e r E r ro r Lo g Me s s a g e s 7.1.3 VM S u s e s t h e e r r o r l og s ub s ys t em to r ec o rd o th e r i n fo rm a t i o n b e s i d e s d ev i c e e r r o r s . Th e k i nd s o f i t e m s w r i t t e n t o the e r r o r l og i nc l ud e • • • Co l d s ta r t e n t r i e s . Th e s e s y s tem boo t s t r a p a t t emp t s . entr i es entr i es A l l b ug c h e c k s , f a t a l a nd o th e r w i s e . i n the nex t s ec t i o n . • Ma c h i n e c h e c k o c c u r r e n c e s . • Vo l um e m o u n t s a nd d i sm o un t s . • 7. 1. 4 Wa r m s t a r t e n t r i e s . Th e s e r e c o ve r i e s f r o m powe r f a i l u r e . r ec o r d r e co rd al l Bug c h e c k s a r e s uc c e s s f u l s uc c e s s f u l d e s c r i b ed Any m e s s a g e s wr i t t e n to the e r r o r m e s s a g e b u f f e r by the Send Me s s ag e to Error Log g e r s ys tem s e rv i c e . Th e u s e o f th i s s ys tem s e r v i c e r e qu i r e s BUGC HK p r i v i l eg e . Ope r a t i o n o f t h e E r r o r Lo g g e r Ro u t i n e s E r r o r m e s sag e b u f fe r a l l o c a t i o n o c c u r s a t I PL 3 1 . Th i s a l l o ws a l loc a t i o n r o ut i ne ( E R L $ A L LOC EM B ) to be c a l l ed f r om anywh e r e in s y s t em ( i n c l ud i ng m a c h i n e c h e c k h a nd l e r s , wh i c h ex e c u t e at I PL w i tho ut c a u s i ng I P L p r o b l em s . I P L i s r e s to r ed to the c a l l e r ' s b e f o r e c o n t r o l i s pa s s ed b a c k t o the c a l l e r . the the 31) I PL Th e r e a r e two 5 1 2-by t e b u f f e r s u s e d fo r ho l d i ng m e s s a g e s . A f l i p- f l o p s wi t c h ( E R L $GB_B U F I N D ) i nd i c a t e s wh i c h o f t h e two b u f f e r s i s c u r r e n t l y act ive . Al l o c a t i o n i nv o l v e s f i nd i ng eno ug h f r e e spac e i n t h e b u f f e r i nd i c a t ed b y E R L$GB B U F I N D t o h o l d a m e s sag e . Wh en t h e c u r r e n t b u f f e r i s f i l l ed , t h e swi tch i s th r o wn t o a c t i v a t e t h e o th e r b u f f e r a nd the E RRFMT p r o c e s s i s awa ke ned to wr i t e the f i l l ed b u f fe r t o t h e e r r o r l og file . A f t e r a m e s s ag e b u f f e r is s uc c e s s f u l l y a l l o c a ted , i ts add ress is r e t u r ned t o t h e c a l l e r o f the a l l o c a t i o n r o u t i n e , wh o l o a d s t h e b u f f e r w i th i n fo rm a t i o n spec i f i c t o t h e m e s sa g e b e i ng l o g g ed . Onc e the i n fo rma t i o n h a s been s to r ed , a s e c o nd r o u t i n e ( E R L $ R E LEASEM B ) i s c a l l e d to wr i t e mo r e i n f o rma t i o n i n t o t h e m e s s ag e h e a d e r , i nd i c a t i ng th a t t h e m e s sa g e i s v a l i d . 7-2 E RROR HANDLING 7 . 1 . 4 . 1 Wa k i ng the E RRFMT P r o c e s s - Th e r o u t i n e ERL $WAKE i s c a l l ed a t l e a s t o n c e a s e c ond . Th i s r o u t i n e i s a l s o c a l l ed wh e n o n e o f t h e t wo l og b u f f e r s i s f i l l ed . Th e r o u t i n e d o e s n o t a u tom a t i c a l l y wa k e the ERRFMT p r o c e s s . Ra th e r , i t d e c r em e n t s a c o un t e r ( E R L $G B B U F T I M ) a n d o n l y wa ke s E RRFMT i f th e c o un t e r g o e s to z e r o . I f t h e c o un t e r g o e s to z e r o , i t i s a l s o r e s e t . Th e c u r r e n t s t a r t i ng ( Th i s va l u e i s a n a s s em b l y t i m e v a l ue fo r t h e e r r o r l og t i m e r i s 3 0 . pa r am e t e r , no t ad j us t a b l e wi th S Y S G E N . ) Th a t i s , t h e r o u t i n e c a n b e c a l l ed a m a x i m um o f 3 0 t i m e s b e f o r e E RRFMT i s a wa k e n ed . Th i s m e a n s t h a t a m a x i m um o f th i r t y s e c o nd s c a n e l a ps e wi tho u t ERRFMT ' s b e c om i ng c om p u t a b l e . Th i s f o r c e s e r r o r m e s s a g e s to be wr i t t e n to th e e r r o r l o g f i l e a t r e a s o n a b l e i n t e r v a l s , e v e n o n s ys tems th a t h a v e v e r y f e w e r r o r s o c c u r r i ng . Th i s t i m i ng m e c h a n i sm i s e x p l o i t ed by t h e a l l o c a t i o n a n d d e a l l o c a t i o n rout ines if t h e y w i sh to f o r c e a n a wa k e n i ng o f E RRFMT . E i th e r o f t h e s e r o u t i n e s s i mpl y l o ad s a 1 i n to E R L $ G B BUFT IM . Th e n e x t c a l l to E R L $WAKE ( wh i c h m u s t be d o n e at I P L 7- so c a nno t b e done d i r e c t l y e i th e r b y t h e a l l o c a t i o n o r d e a l l o c a t i o n r o ut i ne ) i s g ua ranteed to wa k e ERRFMT . Th e a l l o c a t i o n r o u t i n e fo r c e s a wa ke wh enev e r i t i s fo r c ed to s wi t c h buf fe r s beca use the c ur rent buffe r is f ul l . Th e b u f f e r r e l e a s e r o ut i n e f o r c e s a wa ke i f t h e c u r r e n t m e s sag e b u f f e r conta i ns 10 or m o r e messag es . C u r so r y Ove r v i ew o f the ERRFMT P r o c e s s 7. 1. 5 Th e ERRFMT p r o c e s s c o p i e s a pr ev i o u s l y f i l l ed e r r o r m e s s a g e b u f f e r t h e e r r o r l og f i l e [ S YS E RR ] E R R L OG . S YS . Th i s o c c u r s i n two s t e ps . to 1. i n to the Th e c o n t e n t s o f t h e m e s s a g e b u f f e r a r e c o p i ed I PL 3 1 space of ERRFMT . Th i s c o pyi ng occ urs a t s yn c h r o n i z e w i th the a l l o c a t i o n s u b r o u t i n e . PO to 2. On c e t h e add ress SYE , the messages 3. I f a p r o c e s s h a s d e c l a r ed a n e r r o r l og ma i l bo x , e a c h m e s s a g e i n t h e e r r o r l og b u f f e r i s a l s o s e n t to th a t m a i l bo x . m e s s ag e b u f f e r c o n t e n t s a r e a c c e s s i b l e in ERRFMT ' s space , t h e y c a n b e put i n to a fo rma t a c c e p t a b l e t o e r r o r l og r e po r t g e n e r a to r . Th e r e f o rm a t t e d error a r e wr i t t e n t o [ S Y S E RR ] E RR LOG . S YS . Af t e r ERRFMT h a s c om p l e t e d i t s h i bernate ( H I B ) s tate . 7.1.6 o u t put ope rat i ons , it r eente r s the E r r o r Log Ma i l bo x Th e e r r o r l og g i ng s ub s ys t em p r o v i d e s t h e c a pa b i l i ty ( c u r r en t l y ava i l ab l e f o r i n t e r n a l u s e by D I G I TA L ) f o r a p r o c e s s to mo n i to r e r r o r l og g i ng a c t i v i t y a s i t i s h a ppe n i ng r a th e r than wa i t fo r off l ine p r o c e s s i ng wi th the f o rma t t i ng p r og r am SYE . Th i s c a pa b i l i t y i s p r ov i d ed th r o ug h a n u n s uppo r t e d s ys t em s e rv i c e c a l l ed De c l a r e E r ro r Lo g Ma i l box ( S YS $ D E R LM B ) . 7-3 E RROR HANDL ING 7 . 1 . 6 . 1 S y s t em S e r v i c e C a l l - A p r o c e s s tha t h a s D I AGNOS E p r i v i l eg e c an c a l l t h e $ D E R LM B s ys t em s e rv i c e w i th a s i ng l e a rg um e n t , t h e un i t n umb e r o f t h e ma i l bo x t o r e c e i v e e r r o r l og m e s s ag e s . I f the e r r o r l og m a i l bo x i s n o t i n u s e ( th e e r r o r l og m a i l bo x d e s c r i p to r E XE $ G Q E R LM B X c o n ta i n s a z e r o ) , t h e un i t n um b e r i s s to r ed i n t h e f i r s t wo rd o f t h e m a i l bo x d e sc r i p t o r a nd t h e P I D o f t h e r e q ue s t i ng p r o c e s s i s s to r ed i n t h e s e c o nd l o ng wo r d . I f th i s s e rv i c e i s c a l l ed w i t h a un i t n um b e r o f z e r o , t h e d e sc r i pt o r i s c l e a r ed , d i s ab l i ng t h e e r r o r l og m a i l bo x f e a t u r e . Th e d e s c r i pt o r i s a l so u n c o nd i t i o n a l l y c l e a r ed by the i m ag e r un d o wn r o ut i ne ( Ch a p t e r 1 8 ) . 7 . 1 . 6 . 2 Ac t i o n o f the E RRFMT P r o c e s s - I f t h e E RRFMT p r o c e s s d e t e c t s tha t the e r r o r l og ma i l bo x f e a t u r e i s e n a b l ed , i s s e nd s e a c h m e s sag e tha t i t ex t r a c t s f r om th e e r ro r l og buf fer to tha t e s t a b l i sh ed m a i l bo x . Th us a p r o c e s s c a n m o n i to r m e s s ag e s th a t t h e E RRFMT p r o c e s s i s wr i t i ng to t h e e r r o r l og f i l e . 7.2 SYSTEM C RASHES ( B UGCHECKS ) Wh e n VM S d e t e c t s a n i n t e r n a l i nc o n s i s t e n c y s uc h a s a c o r r up t e d d a t a s t r uc t u r e o r an unexpe c t ed e x c e p t i o n , i t d e c l a r e s a b ug c h e c k . I f the s ys tem c a n c o n t i n ue r un n i ng , a no n f a t a l b ug ch e c k i s d e c l a r ed , wh i c h r esul ts in an e r ror l og entry . S e r i o us e r ro r s resul t in fatal b ug ch e c k s , t h r o ug h wh i c h t h e s ys tem is s h u t d o wn in a c o n t r o l l ed f a sh i o n . 1. Th e c o n t e n t s o f ph ys i c a l memo r y a r e wr i t t e n to the s ys tem d um p f i l e ( un l e s s i nh i b i t ed by a SYS BOOT f l ag , DUM P B UG ) . 2. Af t e r t h e s y s t em i s h a l t e d , i t may r e s ta r t i ts e l f ( ag a i n a c c o r d i ng t o t h e s e t t i ng o f a SYSBOOT f l ag , BUG R E B O OT ) . B UGCHECK M e c h a n i sm 7.2.1 Th e p a th i n t o th e b ug ch e c k r o u t i n e a ppe a r s in source code as the i nvo c a t i o n o f the B UG C H E C K ma c r o . Th i s m a c r o e x pa n d s i n to o pc o d e A XF F , a b y t e c o n t a i n i ng �XF E , a nd a wo r d c o n ta i n i ng the pa r t i c u l a r b ug c he c k c o d e . Th e e x e c u t i o n o f o pc o d e A X FF results in an r e se rved i n s t r uc t i o n e x c e p t i o n ( S S $ O PC DEC , o pc o d e r e s e r v e d t o D I G I TA L ) , c a us i ng c o n t r o l to be t r a n s f e r red th r o ug h the Sy s t em Co n t r o l Bl o c k to an e x c ep t i o n - s p e c i f i c s e rv i c e r o u t i n e . Th i s r o u t i n e c h e c ks wh e th e r • t h e o pc od e i s A XF F a nd • t h e by t.e fo l l o w i ng t h e r e s e r v ed o pc o d e is e i th e r A XF E o r A XF D . ( A A XF E i nd i c a t e s th a t t h e b ug c h e c k c o d e i s c o n t a i ned in the n e x t wo r d . A A XFD i nd i c a t e s th a t the b ug ch e c k code i s c o n ta i ned in t h e n e x t l o ng wo r d . VM S d o e s n o t c u r r e n t l y u s e l o ng wo r d b ug c h e c k c o d e s . ) 7-4 ERROR HANDLING I f b o t h o f t h e s e c h e c k s s uc c ee d , VMS i n t e r p r e t s th i s e x c e p t i o n as a b ug ch e c k a nd t r an s f e r s c o n t r o l to r o u t i n e EXE $ B UG C H EC K . Oth e r w i s e , t h e i l l eg a l o pc o d e e x c ep t i o n i s t r e a t ed i n t h e u s ual m a n n e r d e sc r i b ed i n Ch a pt e r 2 . Ope r a t i o n o f BUGC HECK Ro u t i n e 7. 2. 2 Th e b ug c h e c k r o u t i n e pe r fo rm s s ev e r a l s t eps , d e pe nd i ng o n t h e access mode i n wh i c h t h e b ug c h e c k o c c u r r ed a nd wh e th e r t h e b ug c h e c k wa s ( Th e f a t a l i ty o f t h e b ug c h e c k i s d e te r m i n ed by the seve r i ty f a ta l . f i eld < 2 : 0> i n t h e b ug ch e c k c o d e . I f t h e B UG C H E C K m a c r o c a l l is i n c l ud e s t h e pa rame t e r FATAL , a c o d e o f S T S $K S EVE R E (v a l ue o f 4) p l a c ed i n to th i s f i eld . O t h e rwi s e , a z e r o- i s p l a c ed th e r e . ) I f t h e SYS B OOT f l ag B UG C H E C KFATAL i s s e t , a l l bug c h e c k s a r e t r e a ted a s f a t a l , i n d e pe nd e n t o f the s e v e r i t y c o d e i n t h e l o w o r d e r th r e e b i t s o f t h e b ug ch e c k c o d e . Th e BUG C H ECKFATAL f l ag i s c l e a r i n a l l pa r am e t e r f i l e s d i s t r i b u t ed by D I G I TA L , wh i c h m e a n s th a t n o n f a t a l b ug ch e c k s d o n o t c a u s e t h e s ys tem t o c r a s h . 7 . 2. 2. 1 B ug c h e c k s f r o m Us e r a nd S up e rv i s o r Mo d e - I f a b ug c h e c k is g en e r a ted f r om e i th e r user o r s upe rv i s o r m o d e , a n d th e p r o c e s s h a s B UG C H E C K p r i v i l eg e , a m e s s ag e ( o f t ype u s e r - g e n e r a ted b ug c h e c k ) is wr i t t e n t o t h e e r r o r l og b u f f e r . • I f t h e b ug c h e c k i s f a t a l , t h e $ E X I T s ys tem s e r v i c e i s c a l l ed w i th the c o d e S S $ B UG C H E C K a s t h e f i n a l i m a g e s t a t us . Wh a t h a pp e n s a s a r e s ul t-o f th i s c a l l d e pend s o n wh e th e r the process is e x e c u t i ng a s i ng l e imag e ( no s up e rv i s o r m o d e t e rm i n a t i o n h a nd l e r h a s b e e n e s t a b l i s h ed ) o r t h e p r o c e s s is a n i n t e r a c t i v e o r b a tc h j o b . I f the proc e s s i s e x e c u t i ng a s i ng l e i m ag e , a fatal b ug c h e c k f r om u s e r o r s upe rv i so r m o d e r e s u l t s i n p r o c e s s deletion. W i th t h e c u r r e n t use of s upe r v i so r m o d e t e rm i n a t i o n h a nd l e r s , a f a t a l b ug c h e c k i s s ue d f r om an i n t e r a c t i v e o r b a t c h j o b c a u s e s t h e c u r r e n t l y ex e c u t i ng i m ag e t o e x i t and control t o b e pa s s e d to the C L I t o r e c e i v e t h e n e x t c omma n d . In e i ther case , t h e o n l y d i f f e r e n c e b e twe e n us e r a nd s upe rv i s o r mo d e is t h a t u s e r m o d e t e rm i n a t i o n h a nd l e r s a r e no t c a l l ed i f a f a t a l b ug c h e c k is i s s ued f r om s upe r v i so r mo d e . • I f t h e b ug c h e c k c o d e i s n o t f a t a l , t h e e x c e p t i o n ( th e i n i t i a l pa th i n to t h e b ug c h e c k code ) i s d i sm i s s ed a nd e x e c u t i o n c o n t i n u e s w i th t h e i n s t r uc t i o n fo l l o w i ng t h e BUG CHECK ma c r o . Th e BUG C H EC KFATAL f l ag h a s no e f f e c t o n b ug c he c k s i s s ue d f r om u s e r or s u pe r v i s o r m o d e . Th e s e v e r i t y f i e l d i n t h e b ug ch e c k c o d e i s u s e d to d e t e rm i n e wh e t h e r a g i v e n b ug ch e c k i s fatal . In add i t i on , n e i th e r u s e r no r s upe r v i so r m o d e b ug c h e c k s c a u s e t h e s ys tem t o s h u t d o wn . 7-5 E RROR HANDL I NG 7 . 2 . 2 . 2 VMS U s e o f B ug c h e c k s - Th e b ug ch e c k s t h a t VM S o wn pu r po s e s a r e i s s ue d f r om e x e c u t i v e o r k e r n e l mo d e . uses fo r i ts If t h e b ug c h ec k i s not fata l a nd the SYSB OOT pa r am e t e r f l ag BUGC H E C KFATAL wa s t u r ned o f f , t h e b ug ch e c k r o u t i n e p r o c e ed s a s i t d o e s f o r n o n f a t a l b ug ch e c k s f o r t h e o u t e r two a c c e s s m o d e s . A m e s sag e is sent t o the e r r o r l og g e r a nd t h e e x c e pt i o n i s d i sm i s s ed , pa s s i ng c o n t r o l b a c k t o t h e c a l l e r a t the i n s t r uc t i o n f o l l o w i ng t h e b ug c h e c k i nv o c a t i o n . A f a t a l b ug c h e c k r e s u l t s i n a n o rd e r l y s h u td own o f t h e s ys t em . Ra th e r t h a n d e sc r i b e e a c h s t e p th a t t h e b ug ch e c k r o u t i n e t a k e s t o ac c ompl i s h th i s s h utd o wn , we w i l l d e sc r i b e s e v e r a l i t em s o f g e n e r a l i n te r e s t in t h e o p e r a t i o n o f t h e o r d e r l y s h utd o wn . • • Al l d i s k I /0 p e r fo rmed by t h e b ug ch e c k r o ut i n e uses the b o o t s t r a p d i s k d r i v e r u s ed b y t h e i n i t i a l i z a t i o n p r og r am s VMB a nd S YS B OOT ( Ch a p t e r 2 1 ) and l o a d ed i n to n o n pag ed po o l by ! N I T ( Ch a p t e r 2 2 ) . Th e u s e o f t h i s d r i v e r a l l o ws a d um p f i l e t o b e wr i t t e n e v e n i f the s ys tem d i s k d r i v e r i s c o r r up t ed . Mo s t o f t h e bug c h e c k r o u t i n e a n d a l l t h e b ug c h e c k c o d e s a nd a s soc i a ted text a re not r es i d ent . Th e y a r e s t o r e d i n the e x e c u t i v e i m ag e S Y S . EXE and read i n to m emo r y ( by t h e b o o t driver) . Th i s c o d e a n d d a t a a r e r e a d i n to s ys tem spa c e o n top o f a r e a d - o n l y po r t i o n o f t h e ex ec u t i v e . G l o b a l l a b e l BUG $ FATA L d e f i n es t h e b eg i n n i ng o f t h e b u f f e r i n to wh i c h t h e b ug ch e c k c o d e a nd d a t a w i l l be r e ad . Th i s l a b e l i mmed i a t e l y p r e c ed e s t h e b l a n k p r og r am s e c t i o n ( n am e d BLANK a nd l o c a t ed at a d d r e s s 8 0 0 0 7 0 6 8 i n Ve r s i o n 2 o f VAX/VM S ) . • Th e c o d e a nd d a t a th a t a r e r e ad i n c l ud e : • i n to m emo r y at th i s t i me t h e b u l k o f t h e b ug c h e c k s e r v i c e r o u t i n e , a t empl a t e fo r t h e m e s s ag e th a t i s t yp e d on t e rm i n a l , the c o n so l e some p r i m i t i v e c o nso l e t e rm i n a l o u t put r o u t i n e s , a nd the t e x t ua l m e s s ag e s . d e sc r i p t i o n of all po s s i b l e b ug c h e c k Th e r e a r e t wo impl i c a t i o n s o f r e ad i ng c o d e i n to memo r y on to p o f e x i s t i ng c o d e . N o n e o f the r o u t i n es d e s t r o ye d by BUG C HE C K is ava i l ab l e for u s e b y t h e b ug ch e c k c o d e . Th i s i s m o s t i mpo r t a n t i n d e c i d i ng h o w t h e n o npa g ed e x e c u t i v e i s l a i d o u t . Po r t i o n s o f t h e d ump m a y l o o k s t r a ng e wh e n i n s pe c t ed b y S DA . Fo r ex ampl e , it i s i m po s s i b l e t o d e t e rm i n e i f a po r t i o n o f t h e i n s t r uc t i o n s t r eam i s c o r r up t e d bec a u s e S DA d i spl a y s b ug c h e c k c o d e a nd d a ta i n s t e ad o f the o r i g i n a l i n s t r uc t i o n s a nd r e ad o n l y d a ta . 7-6 ERROR HANDL ING e A h e a d e r b l o c k f o r t h e d um p f i l e i s c o n s t r uc t e d i n the 512 b yt e s i mm e d i a t e l y p r e c e d i ng the a r ea i n to wh i c h t h e b u g ch e c k c o d e a n d d a t a we r e w r i t t e n . Th i s a r e a conta i ns mo r e r e a d - o n l y po r t i o n s of t h e no npag ed e x e c u t i v e . ( Th e s ys t e m v i r t ua l a d d r e s s r a ng e wh o s e c on t e n t s a r e a l t e r ed b y the o pe r a t i o n of b ug c h e c k , i n c l ud i ng the 5 1 2 b y t e d um p f i l e h e ad e r b l o c k , e x t e nd s f r om 800 06E68 to 8 0 0 0 91 2 3 . Th e s e n um b e r s a r e v a l i d fo r Ve r s i o n 2 o f VM S a n d a r e a l m o s t c e r ta i n t o c h a ng e w i th t h e n e x t m a j o r r e l e a s e o f t h e s ys t em . ) Th e c o n t e n t s o f the d ump f i l e h e a d e r block are l i sted in Ta b l e 7 - 1 . No t e that t h e e r r o r l og e n t r y a s so c i a t e d wi th th i s b ug c h e c k i s wr i t t e n i n to th e h e a d e r to avo i d loss o f i n f o rma t i o n if the e r ro r l og b u f f e r s we r e f u l l wh e n t h e b ug c h e c k o c c u r r e d . Th i s e r r o r l og e n t r y w i l l b e wr i t t e n i n to o n e o f t h e e r r o r l og b u f f e r s by SYS IN I T ( Ch a p t e r 2 2 ) wh e n t h e r e s t o f t h e e r r o r l og m e s s ag e s ( b l o c k s 2 a nd 3 in t h e d um p f i l e ) a r e p u t b a c k i n to t h e b u f f e r s . ( I f t h e r e i s no r o om i n t h e e r r o r l og b u f f e r s , t h e b ug ch e c k e n t r y wi l l neve r b e wr i t t e n t o th e e r r o r l og file, a l tho ug h the entry is p r e s e r v ed i n th e d ump f i l e . ) • • • A sm a l l amo un t o f i n fo rm a t i o n d e s c r i b i ng th e b ug c h e c k is wr i tten to t h e c o n s o l e t e rm i n a l . Th i s i n f o rm a t i o n i n c l ud e s t h e c o n t e n t s o f g e ne r a l r eg i s te r s , t h e k e r n e l a nd ex e c u t i v e s tacks , the c o n t e n t s o f p r o c e s s o r i n t e r n a l r eg i s te r s , a nd a s umm a r y o f t h e r e a so n f o r t h e bug chec k . Th i s o u tput o c c u r s b e fo r e t h e d ump f i l e i s wr i t t e n a nd sho u l d no t b e i n t e r r up t e d b y h a l t i ng t h e VAX p r o c e s so r f r om the c o n s o l e t e rm i n a l . Suc h an i n t e r r upt i o n wo u l d p r ev e n t the d ump f i l e f r om be i ng wr i t t e n . Th e d um p h e a d e r , t h e c o n t e n t s o f the two e r r o r l og buf fe r s , a n d t h e c o n t e n t s o f phys i c a l m em o r y a r e wr i t t e n to the s ys t em d ump f i l e . Th i s step c an be i nh i b i t ed b y c l e a r i ng the S Y S B OOT pa r am e t e r f l ag DUM PB UG . Th e sys tem d um p f i l e i s d e s c r i b ed i n some d e t a i l i n the n e x t s e c t i o n . Th e l a s t s t e p i n t h e b ug ch e c k rout ine r eboo ts the s ys t em . Th i s is a c c om p l i s h e d by w r i t i ng a s p e c i a l c o d e ( A XF 0 2 ) i n to t h e c o n s o l e t r a n sm i t d a t a b u f f e r ( PR $ TXDB ) . ( Th e s pe c i a l u s e s o f t h e c o n so l e r eg i s t e r s a r e d esc r i b ed i n Ch a pt e r 1 5 . ) Af t e r t h e b o o t s t r a p c o d e i s wr i t t e n , a HALT i n s t r uc t i o n is executed th a t a l l o ws c o n so l e m i c r o c o d e to g a i n c o n t r o l a nd p r o c e s s t h e boo t s t r a p c ommand . On a VAX- 1 1 / 7 5 0 s ys t em , t h e bo o t s t r a p d ev i·c e s e l e c to r s w i t c h mus t b e pr o pe r l y s e t a nd t h e s ys t em d i s k m u s t b e un i t 0 i n o r d e r f o r t h e sys tem t o a u t o m a t i c a l l y r e b o o t f o l l owi ng a b ug c h ec k . On a VAX- 1 1 / 7 8 0 s ys t em , t h e c on t e n ts o f the file DE FBOO . CMD o n the c on s o l e f l o ppy m u s t c o n t a i n c omma n d s t o d i r e c t a r eb o o t f r om th e s y s t em d i s k . Th e a u toma t i c r eb o o t f o l l o w i ng a b ug c h e c k c a n b e p r e v e n ted b y c l e a r i ng t h e SYS B OOT p a r am e t e r f l ag BUGRE BOOT . Th i s f l ag i s a l so m a n ua l l y c l e a r ed b y O PC CRASH , t h e p r o g r a m th a t ex e c u t e s a s p a r t o f t h e o rd e r l y s h utd own p r o c e d u r e S H UTDOWN . C OM . Wh e n a u t om a t i c r e bo o t i ng i s i nh i b i ted , t h e s ys t em l o o ps a t I PL 3 1 , wa i t i ng f o r a c ommand to b e e n te r ed a t t h e c o n s o l e t e rm i n a l . 7-7 ERROR HANDL I NG Ta b l e 7 - 1 Co n t e n t s o f Dum p F i l e He a d e r Bl o c k Desc r i pt i on S i ze La st error l og sequence number ( unused ) long wo rd Dump f i l e flag ( Lo w b i t set i f d ump f i l e anal yzed ) Dump f i l e ver s i o n ( Co nta ins 1 if Ver s i o n 2 . 0 fo rmat ) wo rd wo rd Contents o f SBR , SLR , KS P , ESP , SSP, US P , I S P 7 l ongwo rds Quadwo rd memory desc r i pto rs fo r u p t o e ight memo ry contr o l l ers ( each quad wo rd is b ro ken d own as fo l lows : Pag e count TR n umber fo r thi s c ontro l l er Ba se PFN fo r thi s c ontrol l er 8 quadwo rds 2 4 b i ts 8 b i ts 3 2 b i ts System v e r s i o n number longwo rd One ' s complement of prev i o us l ongwo rd longwo rd Er r o r l og ent r y fo r c rash/resta r t ( Se e d e sc r ipt ion bel ow) 1 25 wo rds Co ntents of so ftwa re PCB o f c u r r ent process ( Table D-2 ) 140 bytes ( Co n te n t s o f E r r o r Me ssag e B u f f e r fo r C r a sh / Re s t a r t En t r y) E r r o r Me ssag e Buf f e r Head e r S i ze in bytes o f buffe r Al l oc a t i o n buffer i nd i c a to r E r r o r message val id i nd ic ato r l o ngwo rd wo rd byte byte En try type ( conta ins EMB$K CR wo rd = 3 7 d ec imal } System t ime when c rash occur r ed ( fr om EXE $G Q_SYS T IM E ) quad wo rd E r ro r l og sequenc e number ( l ow o rd e r wo rd of ERL$G L_S EQUENC E ) wo rd Co ntents o f KS P, E S P , SSP, US P , I S P 5 longwo rds Co ntents o f RO t o Rl l , AP , FP , SP, PC , PS L 1 7 long wo rd s Co ntents o f POBR, POLR , PlBR, P lLR , SBR, S LR , PCB B , SCBB , ASTLVL , S IS R , ICCS, ICR, TODR , ACCS 14 long wo rd s Co ntents o f CPU-spec i f i c reg i ste rs 21 long wo rds ( Fo r the VAX- 1 1 /7 5 0 th i s a r ea c onta i n s Tr ansl a t i o n b u f f e r d i sab l e reg i ster ( PR$_TBDR) Cache d i sa b l e r eg i ster ( PR $ CADR } Mac h i n e chec k e r ro r summa r y- ( PR$ MCESR ) Cache e r r o r r eg i ster ( PR$ CAER } CM I e r r o r summary r eg i ster ( PR$_CM I ERR ) long wo rd long wo rd l ong wo rd l ongwo rd long wo rd ( Fo r the VAX-1 1/7 8 0 th i s a rea c onta i n s SB I faul t sta tus ( PR$ S B I F S ) SB I compa r a to r r eg i ster ( PR $ S B I SC ) SB I ma intenanc e reg i ster ( PR$ SB IMT ) SB I e r r o r r eg i ster ( PR$ S B ITA) SB I t i meout add r ess r egTster ( PR $_S B IS ) l o ng wo rd long wo rd long wo rd long wo rd long wo rd Bug chec k c rash code longwo rd Leng th i n byte s of so ftwa r e PCB wo rd The e r r o r l og entry fo r a non f a ta l bug chec k conta i n s the same i n fo rm a t i o n as the entry fo r a fata l bugcheck except fo r the 3 5 longwo rds set a s i d e fo r a rchi tec tural and CPU -spec i f i c proc esso r r eg i ste r s . 7-8 ERROR HANDL ING Sys t em Dump F i l e 7. 2. 3 Th e m o s t i mpo r ta n t o pe r a t i o n t h a t i s pe r f o rmed b y t h e b ug ch e c k r o u t i n e is to wr i t e the c o n t e n t s o f phys i c a l m em o r y a nd o th e r i m po r t a n t i n fo rm a t i o n t o t h e d ump f i l e . I n t h e c a s e o f s ys t em c r a s h e s , t h e d um p file c a n b e e x am i n ed by t h e Sys t em Dump An a l y z e r ( S DA } to d e t e rm i n e t h e r e a so n fo r th e c r a sh . Th e d ump f i l e c o n t a i n s th r e e d i s t i n c t p i ec e s . 1. Th e p r ev i o us l y c o n s t r uc t e d d ump h e a d e r to the f i r s t block in the f i l e . 2. Th e t wo e r r o r l og b u f f e r s a r e wr i t t e n to t h e n e x t two b l o c k s . Th e s e b u f f e r s wi l l be c o p i ed b a c k i n to th e e r r o r l og b u f f e r s i n m emo r y f r om th e d um p f i l e b y SYS I N I T ( Ch a p t e r 2 2 } a s p a r t of the i n i t i a l i za t i o n code . In th i s wa y , n o e r r o r l og i n f o rm a t i o n i s l o s t a c r o s s a s ys tem c r a s h o r an o pe r a to r r e que s t ed s h u td own . 3. Th e r e s t o f t h e d um p f i l e i s f i l l ed wi th t h e c u r r e n t c o n t e n t s of phys i c a l m emo r y . B ug c h e c k u s e s t h e m em o r y d e s c r i p t o r s i n t h e Re s t a r t Pa r am e t e r Block ( RPB } c o n s t r uc t ed by VMB ( Ch a p te r 2 1 } to p r ov i d e an accurate l a yo u t o f ph y s i c a l I f a MA7 8 0 s h a r ed m emo r y a d a p t e r i s present add ress space . o n t h e s y s t em , i ts contents a r e a l s o wr i t t e n t o t h e d ump file. ( Ta b l e 7 - 1 } i s wr i t t e n Th e s i z e o f t h e d um p f i l e m u s t b e f o u r b l o c k s l a rg e r t h e n the n um b e r ( Th e f o u r th b l o c k i s no t c u r r e n t l y of phys i c a l pag e s i n t h e sys t em . u s ed . } I n o r d e r t o i n s u r e th a t a c r a s h d um p c a n b e a n a l y z e d w i th S DA , I f a d ump f i l e i s i t i s i mpo r t a n t tha t t h e d ump f i l e b e l a r g e eno ug h . t o o sm a l l , o n l y t h e ph y s i c a l pag e s th a t f i t i n to the und e r c o n f i g u r ed I n a t yp i c a l VM S c o n f i g u r a t i o n , t h e m o s t d ump f i l e w i l l be wr i t t e n . c r uc i a l c o n t e n t s o f phys i c a l memo r y , t h e s ys tem pa g e tabl e , a re l o c a ted a t t h e l a rg e s t phys i c a l a d d r e s s e s ( Ch a p t e r 2 1 } and w i l l n o t b e wr i t t e n , m a k i ng a pa r t i a l d um p u s e l e s s . Th a t i s , S DA c a nno t b e used t o ex am i n e a d ump f i l e t h a t d o e s n o t c o n t a i n a l l o f ph ys i c a l m em o r y . 7. 3 MAC H INE C HECK M E C HAN I SM A m a c h i n e c h e c k i s a n e x c e pt i o n tha t i s r e po r t e d wh e n t h e C PU o r an e x t e r n a l a d a pt e r d e t e c t s a n i n t e r n a l e r r o r . Th e i n i t i a l pro c e s s i ng o f a ma c h i n e c h e c k e x c e p t i o n i s C P U s p e c i f i c . Th i s s e c t i o n c o n t a i n s an o v e r v i e w o f m a c h i n e c h e c k h a nd l i ng . Co n s u l t t h e VAX H a rdwa r e H a n d bo o k o r o th e r h a r d wa r e- r e l a t e d l i t e r a t u r e fo r i n fo rma t i o n a b o u t a spec i f i c t ype o f m a c h i n e c h e c k . Th e b a s i c ph i l o s o ph y o f a n y o f t h e m a c h i n e c h e c k h a nd l e r s i s to keep as much of t h e s y s t em r un n i ng a s po s s i b l e . Th e r e a r e two impo r t a n t p i e c e s o f i n fo rm a t i o n th a t d e t e rm i n e h o w s e r i o u s a pa r t i c u l a r m a c h i n e check is : t h e n a t u r e o f the m a c h i n e c h e c k i t s e l f a nd the a c c e s s m o d e i n wh i c h t h e m a c h i n e c h e c k o c c u r r ed . • I f the mac h i n e check i s r ecove rab l e , the s impl e a c t io n i s to l og an e r ro r . Th i s s t e p i s t a k e n i nd e pe nd e n t of t h e a c c e s s m o d e i n wh i c h t h e m a c h i n e c h e c k o c c u r r ed . In ad d i t i o n , the e r ro r t ime is r e c o r d ed . I f m a c h i n e c h e c k s s t a r t o c c u r r i ng t o o q u i c k l y ( mo r e th an o n e m a c h i n e c h e c k p e r 1 0 m i l l i s e c o nd i n t e rva l } , t h e n t h e h a nd l e r a s s um e s th a t s o m e th i ng s e r i o u s i s 7-9 ERROR HANDL ING wr o ng a nd t r e a t s a r e c o v e r a b l e m a c h i n e c h e c k in the s a m e wa y t h a t i t t r e a t s an a b o r t . Th e d i s t i n c t i o n b e twe e n r e c o v e r a b l e m a c h i n e c h e c k s a n d a b o r t s i s C P U s pe c i f i c . Th e VAX H a rdwa r e t h e m o d u l e MCHEC K x x x ( MC HE C K 7 5 0 o r MCHEC K 7 8 0 ) Ha n d b o o k o r c o n t a i n s i n fo rma t i o n a b o u t t h e m a c h i n e c h e c k s th a t c a n o c c u r o n a pa r t i c u l a r p r o c e s s o r . • I f t h e m a c h i n e c h e c k h a s p u t t h e sys tem i n to a state f r om wh i c h it c annot r ecove r , the a c t i o n t a k e n by the m a c h i n e c h e c k h a nd l e r d e pend s o n t h e a c c e s s m o d e i n wh i c h t h e m a c h i n e I f t h e p r ev i o u s m o d e wa s s up e r v i s o r o r us e r , c h e c k o c c u r r ed . a m a c h i n e c h e c k e x c e p t i o n i s r e po r t ed to th a t a c c e s s mo d e . ( Un l e s s t h e p r o c e s s h a s t a k e n s pe c i a l a c t i o n , th i s s t e p wi l l r e s u l t i n i m a g e e x i t . ) I f the p r ev i o u s m o d e wa s e x ec u t i v e o r ke rnel , an i r r ec ov e r ab l e mach i n e chec k c a us e s a fatal b ug c h e c k ( wi th t h e b ug c h e c k c o d e BUG $_MAC H I N ECHK ) . VAX- 1 1 /7 5 0 M a c h i n e Ch e c k 7. 3. 1 Wh e n a m a c h i n e c h e c k o c c u r s o n a VAX- 1 1 / 7 5 0 , I P L i s e l e v a t e d t o 3 1 a nd t h e i n t e r r up t s t a c k c o n t a i n s t h e fo l l o w i ng i n fo r m a t i o n . • Th e l e ng th i n byt e s o f the e x c e p t i o n - spec i f i c i n f o rma t i o n p u s h ed o n t h e s t a c k . ( Th i s c o un t d o es n o t i n c l ud e e i th e r th e PC/ P S L pa i r or t h e c o un t l o ng wo r d i tse l f . ) Th e r e are c ur r en t l y 1 0 l o ngwo r d s i n th i s l i s t , wh i c h r e s u l t i n a v a l u e of 2 8 hex o n the s tac k . • Ma c h i n e c h e c k e r r o r c o d e • Vi r tua l a d d r e s s o f t h e l a s t f e t c h o r s t o r e o pe r a t i o n • P r o g r am c o un t e r a t the t i m e o f t h e e r r o r • Mem o ry d a t a o f the l a s t f e tch o r s to r e o pe r a t i o n • S a v e d mod e r eg i s t e r • Re a d l o c k t i m e o u t r eg i s t e r • T r a n s l a t i o n b u f f e r pa r i t y e r r o r r eg i s t e r • Ca c h e e r r o r r eg i s t e r • Bus e r r o r r eg i s t e r • E r r o r s umm a r y r eg i s t e r • PC o f a b o r t e d o pc o d e • PS L a t t h e t i m e o f t h e a bo r t Th e m a c h i n e c h e c k e r r o r c o d e ( t h e s e c ond i t em o n the s t a c k ) d e t e r m i n e s the s pe c i f i c ac t i o n o f t h e m a c h i n e c h e c k h a nd l e r . I f the mac h i ne c h e c k i s a n abo r t ( PC l e f t i n a n i nd e te rm i n a t e s t a t e ) , then r ecovery is i mpo s s i b l e . I n ad d i t i o n , a s ub s e t o f t h e VAX- 1 1 i n s t r uc t i o n ( Th e l i st o f the se o pc o d e s o n t h e VAX- 1 1 /7 5 0 c a n no t b e r e s t a r t ed . i n s t r uc t i o n s c a n b e fo und i n m o d u l e MCHEC K 7 5 0 . ) 7-1 0 ERROR HANDL ING I n a d d i t i o n t o the VAX- 1 1 / 7 5 0 m a c h i n e c h e c k s th a t a ppe a r a s e x c e p t i o n s ( th r o ug h the S C B v e c to r a t o f f s e t 4 ) , t h e r e a r e two m a c h i n e c h e c k s t h a t a ppe a r a s i n t e r r up t s t h r o ug h d e d i c a t ed S C B v e c to r s . Wh e n e i th e r of these occur s , o n l y t h e PC a n d PS L a r e p u s h e d o n to the i n t e r r up t s t ac k . • A " c o r r e c t e d memo r y d a t a " c o nd i t i o n ( CRD ) w i l l i n t e r r upt at I PL 26 t h r o ug h S C B v e c to r 5 4 ( h e x ) . Th i s e x c ept i o n s i m p l y c a u s e s a n e r r o r l o g e n t r y ( i nd i c a t i ng a s o f t m emo r y e r r o r ) to b e wr i t t e n . ( I f e r r o r s o c c u r too q u i c k l y , the CRD i n te r r up t b i t i n t h e memo r y c o n t r o l l e r i s t u r ned o f f by the mach i ne c h e c k h a nd l e r . ) • i n te r r up t a t I PL 29 A " wr i t e b u s e r r o r " c o nd i t io n w i l l th r o ug h S C B v e c to r 60 ( hex ) . Th i s e r r o r i s t r e a t e d a s a n i r r e c o ve r a b l e e r r o r a nd f u r th e r p r o c e s s i ng d e pe nd s o n the p r ev i o us a c c e s s m o d e . VAX- 1 1 /7 8 0 M a c h i n e Ch e c k 7. 3. 2 Wh e n a m a c h i n e c h e c k o c c u r s o n a VAX- 1 1 /7 8 0 , I P L i s e l eva t e d to 3 1 a nd t h e i n t e r r up t s t ac k c o n t a i n s t h e fo l l o w i ng i n fo rm a t i o n � • Th e l e ng th i n by t e s o f the e x c e pt i o n - s p e c i f i c i n f o rm a t i o n p u s h e d o n the s t a c k . ( Th i s c o u n t d o e s no t i n c l ud e e i th e r t h e PC/P S L p a i r or t h e c o un t l o ng wo r d i tse l f . ) Th e r e a re c ur r ently 1 0 l o ng wo r d s i n th i s l i s t , wh i c h r e s u l t i n a v a l ue o f 2 8 hex on the s t ac k . • Ma c h i n e c h e c k s umma r y pa r am e t e r • CPU e r ro r s ta t us • T r a pped m i c r o PC , t h e m i c r o c o de e r r o r l o c a t i o n • Vi r t u a l a d d r e s s a t f a u l t t i m e • C P U D r e g i s te r a t f a u l t t i m e • Tr a n s l a t i o n b u f f e r s t a t us r eg i s t e r 0 • Tr a n s l a t i o n b u f f e r s t a tus r eg i s t e r 1 • Ph ys i c a l a d d r e s s c a u s i ng S B I t i m e o u t • Ca c h e pa r i t y e r r o r s t a t u s r eg i s te r • S B I e r r o r r eg i s t e r • PC o f i n s t r uc t i o n t h a t c a us e d t h e m a c h i n e ch e c k • PS L o f ma c h i n e a t f a u l t t i m e Th e m a c h i n e c h e c k s umma r y pa r am e t e r d e t e rm i n e s t h e spe c i f i c a c t i o n o f I f the m a c h i n e c h e c k i s a n a b o r t ( PC l e f t t h e m a c h i n e c h e c k h a nd l e r . i n a n i nd e t e rm i n a t e s t a t e ) , t h e n r ec o v e r y i s i m po s s i b l e . I n add i t i on , a s ub s e t o f t h e VA X- 1 1 i n s t r uc t i o n o pc o d e s o n t h e VAX- 1 1 / 7 8 0 c a n n o t b e r es t a r ted . ( Th e l i s t o f th e s e i n s t r uc t i o n s c a n b e f o und in modul e MC HEC K 7 8 0 . ) 7-1 1 ERROR HANDLING Th e r e a r e a l so s ev e r a l error c o nd i t i o n s o n the VAX- 1 1 / 7 8 0 g e n e r a t e i n t e r r up t s i n s t e a d o f m a c h i n e c h e c k e x c e p t i o n s . • A " c o r r e c t e d r e a d d a t a " c o nd i t i o n o r a " r e a d d a t a s ub s t i t u t e " c o nd i t i o n i n t e r r up t s t h r o ug h SCB v e c to r 5 4 ( h ex ) a nd r a i s e s I PL t o 2 6 . • An " S B I a l e r t " i n t e r r up t s th r o ug h v e c to r 5 8 a t I P L 2 7 . • An " S B I f a u l t " i n t e r r up t s th r o ug h v e c to r 5 C a t I P L 2 8 . • tha t An " a s yn c h r ono u s wr i t e e r r o r " i s r e po r t ed th r o ug h SCB 60 at IPL 2 9 . v e c to r Th e f i r s t th r e e o f t h e s e e r r o r s r esul t in e r ro r l og entr ies . An a t t empt i s mad e t o c o n t i n ue f r om the e r r o r . Th e a s yn c h r o n o us wr i t e e r r o r c a u s e s a f a t a l b ug ch e c k i f i t o c c u r r ed i n ke r n e l or exec ut i ve mo d e o r i f a n e r r o r o c c u r red wh i l e upd a t i ng a pag e t a b l e . M a c h i ne Ch e c k Re c ov e r y B l o c k s 7. 3. 3 VM S p r o v i d e s a c a pab i l i t y f o r a b l o c k o f k e r n e l mod e c o d e to protect i t s e l f f r om m a c h i n e c h e c k s wh i l e t h e p r o t e c t ed c o d e i s e x e c ut i ng . Fo r e x ampl e , VM S u s e s th i s f e a t u r e i f a n i n t e r r upt i s g en e r a ted f r om a p r ev i o u s l y unco n f i g u r ed adapte r . If the code th a t r ead the c o n f i g u r a t i o n r eg i s t e r we r e n o t p r o t e c t ed a nd the i n t e r r up t wa s spur i o us , t h en the configurat ion r eg i s t e r d o e s n o t e x i s t a nd t h e r e f e r e nc e t o a n o n e x i s t e n t I /0 s p a c e a d d r e s s wo u l d c r a sh t h e sys tem . Th e r e a r e s ev e r a l r e s t r i c t i o ns o n t h e p r o t e c ted c o d e . 1. I t m u s t b e e x e c u t i ng i n k e r n e l m o d e . 2. Th e s t a c k c a nno t be u s ed a c r o s s t h e e n t r y i n to o r the ex i t o ut o f th e p r o t e c t ed code block . Th i s r e s t r i c t i o n e x i s t s b e c a u � e a c o r o u t i n e m e c h a n i sm i s u s ed t o pa s s c o n t r o l b e twe e n the p r o t e c t ed b l o c k a nd t h e VM S r o u t i n e s t h a t e s t ab l i sh t h e p r o t e c ted c o d e . 3. VM S e l ev a t e s I P L to 3 1 s o a l i m i t ed s h o u l d be i nc l ud e d i n the b l o c k . 4. R O i s d e s t r o yed by the m e c h a n i sm . n um b e r of i n s t r uc t i o n s 7. 3. 3. 1 U s i ng t h e Re c o v e r y Mech an i sm - S e v e r a l m a c r o s a r e p r o v i d ed i n the mac ro l ibrary S YS $ L I B RARY : L I B . M LB t o u s e th i s p r o t e c t i o n Th e m a c r o m e c h a n i sm . $ PRTC T I N I LABE L , MAS K d e f i n e s t h e b eg i nn i ng o f the b l o c k . Th e l a b e l a r g um e n t t o the l a b e l a r g um e n t a s so c i a t ed w i th th e m a c ro $ PRTCTEND is ident ical LAB E L t h e m a c r o th a t d e f i n e s t h e e nd o f t h e b l o c k . If no error occur red wh i l e the p r o t e c t e d c o d e wa s e x e c u t i ng , R O c o n t a i n s t h e s u c c e s s c o d e S S $ _NORMA L . Ot h e r w i s e , t h e l o w b i t o f R O i s c l e a r . 7-12 ERROR HANDLING Th e m a s k a rg um e n t a l l o ws t h e b l o c k o f d i ffe rent c la sses o f e r ro r s . Th e d e f i ne d by t h e $ MC HKDE F m a c r o , a r e c od e t o spec i f i c protec t i tse l f f r om t ype s o f p r o t e c t i o n , MCHK$M L OG I nh i b i t e r r o r l og g i ng f o r t h e e r r o r MC HK$M MCK P r o te c t ag a i n s t m a c h i n e c h e c k s MC HK$M_N E XM P r o te c t a g a i n s t n o n e x i s t e n t m em o r y MCHK$M_U B A P r o t e c t ag a i n s t UN I B U S a d a p t e r e r r o r i n t e r r up t s Th e r e a r e two o th e r f e a t u r e s u s ed b y VM S p r o t ec t i o n m e c h a n i sm . Th e m a c ro $ PRTCTEST tha t a re a pa r t of th i s ADDRE S S , MAS K a l l ows VM S to d e t e rm i n e wh e th e r a r e c ov e r y b l o c k i s i n e f f e c t a nd t a ke a c t i o n a c c o r d i ng l y . Th e s t a tus i s r e tur ned i n RO . Th e l ow b i t s e t i nd i c a t e s t h a t a r ec o v e r y b l o c k i s i n e f f e c t a nd th a t t h e s p e c i f i ed m a s k i s b e i ng u s ed . Th e m a c r o $ B UG PRTCT i s used by the m a c h i n e c h e c k h a nd l e r s fo r t h e VAX- 1 1 / 7 5 0 a nd the VAX- 1 1 /7 8 0 b e fo r e i s s u i ng a f a t a l b ug c h e c k . I f no r ec o v e r y b l oc k i s i n e f f e c t , c o n t r o l i s pa s s e d b a c k t o the l o c a t i o n wh e r e th i s m a c r o wa s i nv o k e d , wh e r e a b ug c h e c k i s u s ua l l y i s s ue d . I f a r ec o v e r y b l o c k i s i n e f f e c t , c o n t r o l i s pa s s e d t o the end o f t h e p r o t e c ted b l o c k w i th R O c o n t a i n i ng a n e r r o r c o d e o f S S $ _MCHE C K . 7-1 3 PART I I I S C H EDUL ING AND T I M ER S U PPORT It i s e q u a l l y bad wh e n one s p e ed s on the g u e s t unwi l l i ng to g o , a nd wh e n he ho l d s b a c k o n e who i s h a s t en i ng . Ra the r o n e sho u l d b e f r i e nd t h e g u e s t who i s th e r e , b u t speed h i m wh e n h e w i s h e s Th e Od y s s e y Ho rn e r CHAPTER 8 S C H E DU L I NG S c h e d u l i ng i s c o n c e r n ed w i th t h e o r d e r o f e x e c u t i o n o f p r o c e s s e s a n d the o c c u r rence of ev e n t s o v e r t i me . Th e s c h e d u l e r i d e n t i f i e s a n d e x e c u t e s the h i g h e s t p r i o r i t y , m em o r y- r e s i d e n t p r o c e s s . Th e abi l i ty of a p r o c e s s to be s c h ed ul e d ( o r t h e n a t u r e o f t h e e v e n t o r r e s o u r c e f o r wh i c h t h e p r o c e s s m a y b e wa i t i ng ) i s r e f l e c t ed i n t h e p r o c e s s o r s c h ed u l i ng s t a te of the process . T r a n s i t i o n s f r om o n e s t a t e t o a n o t h e r o c c u r a s t h e r e s u l t o f s ys t em e v e n t s s uc h t h e s e t t i ng of an event f l ag , e n q ue u i ng a n AS T , a Wa k e s ys tem s e r v i c e , a n d s o fo r th . Th i s c h a p t e r d e sc r i b e s the i n t e r a c t i o ns o f so f t wa r e p r i o r i t i e s , process s t a tes , a nd s y s tem e v e n t s , a s we l l a s t h e o p e r a t i o n o f t h e s c h ed ul e r . 8.1 PROC E S S S TATES Th e s t a t e of a p r o c e s s d e f i n e s the r e a d i n e s s o f the process to be s c h ed u l ed fo r execut ion . I n ad d i t i o n , t h e p r o c e s s s t a t e m a y i nd i c a t e wh e th e r t h e p r o c e s s i s m emo r y r e s i d e n t o r o u t swappe d . If a process i s wa i t i ng f o r t h e a v a i l a b i l i t y o f a s ys t em r e so u r c e o r the o c c u r r e n c e o f a n e v e n t , t h e n the p r o c e s s s t a t e i s o n e o f s e ve r a l d i s t i n c t wa i t s ta tes . Th e wa i t s t a t e r e f l e c t s t h e pa r t i c u l a r c o nd i t i o n t h a t m u s t b e s a t i s f i ed fo r t h e p r o c e s s t o b e c om e c om p u t a b l e ag a i n . 8.1.1 Process Control Block Th e ma j o r d a t a s t r uc t u r e d e s c r i b i ng the s tate a nd pr i o r i ty o f a process is the s o f twa r e process control b l o c k ( PC B ) . Figure 8-1 i l l us t r a tes the f i e l d s o f the s o f twa r e P C B t h a t are pa r t i c u l a r l y i m po r t a n t t o s c h e d u l i ng . Th e f i e l d PC B $W_S TATE c o n t a i n s a n um e r i c va l u e a s s o c i a t ed w i th a pa r t i c u l a r p r o c e s s s t a t e . Th e p r o c e s s state is e s t a b l i sh ed b y m o v i ng t h e a pp r o p r i a t e v a l ue i n t o PC B $W S TATE a nd i n s e r t i ng th e PCB i n to t h e c o r r e s po nd i ng s t a t e que ue by m e a ns o f the s t a t e q u e ue l i nk f ields , PCB $ L S QF L and PCB $ L S QB L . Append i x D c o n t a i n s a c om p l e t e d e sc r i pt i o n o f- t h e s o f twa r e PCB� Ta b l e 8 - 1 l ists the process s t a t e n ame s a nd t h e c o r r e s po nd i ng PC B $W S TATE v a l ue s . Ot h e r s o f twa r e PC B f i e l d s d e f i n e t h e s c h ed u l i ng o r s o f twa r e pr i o r i ty of the p r o c e s s a nd i n d i c a t e wh e th e r the p r o c e s s i s i n m emo r y o r o u t s wa pped . Th e l o c a t i o n o f a d a t a s t r uc t u r e c o n t a i n i ng t h e h a r d wa r e con tex t of the proc ess i s a l so s to r ed in the so f t wa r e PC B ( PC B $ L_PHYPC B ) . 8-1 S C HEDUL ING SQFL SQBL Software PCB PRI I PHYPCB STS PRIB I I STATE "� �, T T F i g u r e 8 - 1 P r o c e s s Co n t r o l B l o c k Fi e l d s Us ed i n S c h ed u l i ng Ta b l e 8 - 1 P r o c e s s Sc h e d u l i ng S t a te s S t a t e Na m e Co l l i d ed Pag e Wa i t M i sc e l l a n e o us Wa i t Mu t e x Wa i t Re s o u r c e Wa i t Co mmon Ev e n t Fl ag Wa i t Pa g e Fa u l t Wa i t Lo c a l Ev e n t Fl ag Wa i t ( Re s i d e n t ) Lo c a l Ev en t Fl ag Wa i t ( Ou t s wa pped ) H i b e r n a t e Wa i t ( Re s i d e n t ) H i b e r na t e Wa i t ( Ou t swa pped ) S u s pe nd Wa i t ( Re s i d en t ) S u s pe nd Wa i t ( Ou t swa ppe d ) F r e e Pa g e Wa i t C o mp u t a b l e ( Re s i d e n t ) C o m pu t a b l e ( Ou t swa p pe d ) C u r r en t l y Ex e c u t i ng P r o c e s s 8-2 Mn em o n i c Va l ue C O L PG MWA I T 1 2 C EF PFW LEF LEFO H IB H IB O S US P S US PO F PG C OM C OM O C UR 3 4 5 6 7 8 9 10 11 12 13 14 S C HEDUL I NG 8.1.2 S o f twa r e P r i o r i ty S o f t wa r e pr i o r i t y ( a s d i s t i n c t f r om i n t e r r upt pr i o r i t y , a h a r d wa r e m e c h a n i sm ) i s used i n d e t e rm i n i ng t h e r e l a t i v e p r e c ed e n c e o f p r o c e s s e s f o r ex e c u t i o n a nd m emo r y r e s i d e n c e . So f twa r e p r i o r i t y i s a v a l ue in the r a ng e f r om 0 to 31 . Th e n u l l p r o c e s s e x e c u t e s a t so f t wa r e p r i o r i t y l ev e l 0 , a n d t h e h i g h e s t pr i o r i t y r e a l - t i m e p r o c e s s ex e c u t e s at so f twa r e pr i o r i t y l e v e l 31. Th e r a ng e o f 3 2 s o f t wa r e pr i o r i t y l e ve l s i s d i v i d ed e v e n l y b e twe e n the no rma l pr o c e s s l ev e l s o f 0 to 15 and th e r e a l - t i me pro c e s s l e v e l s o f 1 6 to 3 1 . Th e e x e c ut i o n b e h a v i o r o f a p r o c e s s i s s i g n i f i c a n t l y a f f e c t ed b y t h e type o f p r o c e s s ( no rm a l o r r e a l t i m e ) and t h e a s s i g n ed s o f twa r e pr i o r i t y l ev e l . Two f i e l d s o f the so f t wa r e p r o c e s s c o n t r o l b l o c k d i r ec t l y d e sc r i b e t h e s c h ed u l i ng or s o f t wa r e pr i o r i t y o f the p r o c e s s . Th e f i e l d PC B $ 8 P R I ( F i g u r e 8 - 1 ) d e f i n e s t h e c u r r e n t so f twa r e p r i o r i ty o f the p r o ces s , wh i c h is u s ed t o ma ke s c h ed u l i ng d e c i s i o n s . PC B $ 8 PR I B d e f i n e s t h e b a se pr i o r i ty of the p r o c e s s , f r om wh i c h t h e c u r r e n t pr i o r i t y is c a l c u l a t ed . Fo r no rma l or t i m e s h a r i ng processe s , t h e s e pr i o r i t y v a l u e s a r e some t i m e s d i f f e r e n t , wh i l e r e a l - t i m e pr o c e s s e s a l wa ys h a v e i d e nt i c a l cur rent a nd base pr i o r i t y v a l u e s . Each f i eld may have a v a l u e f r om 0 to 3 1 . Howe v e r , t h e v a l u e s i n these f i elds a re s t o r ed i n te r nal l y i n an i n v e r ted o r d e r . Th a t i s , t h e b a s e a nd c u r r e n t pr i o r i t i e s o f 0 f o r t h e nul l process a r e s to r ed i n terna l l y i n t h e P C B f i e l d s as 31 . Th e h ighest pr i o r i t y p r o c e s s po s s i b l e wo u l d h a v e i n t e r n a l l y s t o r ed s o f t wa r e pr i o r i t y v a l u e s o f 0 . Th us , t h e i n t e r n a l f i eld val ues a re s t o r ed as 3 1 m i n u s the so f t wa r e pr i o r i t y v a l ue . Th i s i n v e r t e d v a l ue c a uses pr i o r i t y p r om o t i o n s o r boosts to be i m pl em ented t h r o ug h s ub t r a c t o r d e c r emen t i n s t r uc t i o n s . Sys tem u t i l i t i e s s uc h a s S DA , D � S P LAY , a n d the DC L c omma n d S H OW SYSTEM i n te r p r e t the se i n v e r t ed v a l u e s a nd d i s pl a y e x t e r n a l v a l u e s , wh e r e 0 i s the l o we s t pr i o r i t y a nd 3 1 i s the h i ghest . Ex te r n a l v a l u e s a r e a l s o r e t u r n ed by the $ G E TJ P I s ys tem s e r v i c e wh e n a pr o c e s s p r i o r i t y i s r e que s t ed . NOTE Al l d i scu s s i ons in th i s m a n ua l abo u t s o f t wa r e pr i o r i t y t r e a t pr i o r i t y a s a n i n c r e a s i ng e n t i t y f r om 0 ( f o r the n u l l p r o c e s s ) to 3 1 ( f o r the h i g h e s t pr i o r i t y rea l-t i me process ) . Pl e a s e take th i s i n to a c c o un t wh e n r e l a t i ng d e sc r i pt i o n s i n th i s m a n u a l t o t h e ac t ua l r o u t i n e s i n the l i s t i ng s , wh i c h m a n i pu l a t e the i nv e r t e d p r i o r i t i e s . 8.1.2.1 Re a l -T i me P r i o r i t y Ra ng e - P r o c e s s e s wi th s o f t wa r e pr i o r i t y l e ve l s 16 t h r o ug h 3 1 a r e c o n s i d e r ed r e a l - t i m e p r o c e s s e s . Th e r e a r e two s c h ed u l i ng c h a r a c t e r i s t i c s th a t d i s t i ng u i s h r e a l - t i m e pr o c e s s e s . 1. Th e s o f t wa r e pr i o r i t y o f a r e a l - t i m e pr o c e s s d o e s n o t c h a ng e over time , un l e s s the r e is a d i r e c t p r o g r a m o r o pe r a t o r r e qu e s t t o c h a n g e i t ( w i t h a Se t Pr i o r i t y s ys t em se r v i c e o r a S E T PROC E S S/ P R I O R I TY c omma nd ) . Th i s i m pl i e s tha t the b a s e p r i o r i t y a nd th e c u r r e n t pr i o r i t y o f a r e a l - t i m e pr o c e s s a re i d ent i c a l , and no dyn am i c pr i o r i t y a d j u s tm e n t ( S e c t i o n 8 . 1 . 2 . 3 ) i s a p pl i e d by VM S . 8-3 S C HED � L I NG 2. A r e a l - t i m e p r o c e s s e x e c u t e s un t i l i t i s e i th e r p r e empted by a h i g h e r p r i o r i t y p r o c e s s o r i t e n t e r s one of the wa i t s t a t e s ( Se c t ion 8 . 1 . 3 . 2 ) . Th u s , a r e al - t ime process is not s u s c ept i b l e to q u a n t um e n d eve n t s ( S e c t i o n 8 . 1 . 2 . 4 ) , a nd i s n o t r em o v e d f r om ex ec u t i o n ( r e s c h ed u l ed ) bec a u s e some i n t e r va l of e x e c u t i o n t i m e h a s e x p i r ed . Ta k e n i n i s o l a t i o n , t h e r e a l - t i m e r a ng e o f VM S s o f twa r e pr io r i t i es p r ov i d e s a s c h ed u l i ng env i r o nm e n t l i k e t r a d i t i o n a l r e a l - t i m e sys tems , p r e em p t i v e , p r i o r i t y -d r i v e n sc h ed u l i ng wi t h o u t t i m e s l i c e s o r q u a n t a . 8 . 1 . 2 . 2 No rma l P r i o r i ty Rang e - No rma l p r o c e s s e s i n c l ud e i n te r a c t i v e t e rm i n a l sess ions , b a tch j obs , a nd a l l sys tem p r o c e s s e s e x c e p t the swa ppe r . Th e s c h e d u l i ng b e h a v i o r o f a no rma l process i s d i f fe r ent f r om th a t o f a r e a l - t i me p r o c e s s . 1. Th e c u r r e n t so f twa r e p r i o r i ty o f the p r o c e s s v a r i e s o v e r t i me wh i l e the b a s e p r i o r i t y r em a i n s c o n s t a n t ( un l e s s a l t e r e d by the Set P r i o r i t y s y s t em s e r v i c e o r by a S E T PROC E S S /PR I OR I TY c o mm and ) . Th i s b e h a v i o r i s t h e r e s u l t o f d yn am i c p r i o r i t y a d j u s tm e n t a pp l i e d by VM S to f av o r I /O-bo und a nd i nterac t i ve processes a t the expense o f c ompute -bo und ( a nd f r e q u e n t l y a l so batch) p r o c e s s e s . Th e m e c h a n i sm o f p r i o r i t y ad j u s tm e n t i s d i sc u s s e d i n the f o l l o w i ng s e c t i o n . 2. No rma l processes r un in a t i m e s h a r i ng e nv i r o nm e n t that a l locates CPU t i me s l i c e s ( o r q ua n t a ) to p r o c e s s e s i n t u r n . Th e r e f o r e , a n e x e c u t i ng no rm a l p r o c e s s wi l l c o n t r o l the CPU unt i l • • • 3. i t i s p r e em p t ed b y a h i g h e r p r i o r i t y , c omputab l e ( s e e Fi g u r e 8 - 2 , e v e n t 5 f o r e x amp l e ) , process i t e n te r s a r e s o u r c e o r e v e n t wa i t s t a t e e v e n t 7 fo r e x amp l e ) , o r ( see F i g u r e 8-2 , th e c u r r e n t qua n t um o r t i m e sl ice F i g u r e 8 - 2 , e v e n t 1 7 f o r examp l e ) . been has used ( see P r o c e s s e s w i th i d e n t i c a l c u r r e n t pr i o r i t i e s a r e s c h ed u l ed o n a r o un d robin ba s i s . Th a t is, each p r o c e s s a t a g i v en s o f twa r e p r i o r i t y l ev e l e x e c u t e s in t u r n b e fo r e a ny o th e r process at th a t l ev e l executes ag a i n . Al tho ug h th i s m ec h a n i sm a pp l i e s t o r e a l -time proc esses a s we l l , it g en e r a l l y h a s n o e f f e c t b e c a use r e a l - t i me p r o c e s s e s a r e u s u a l l y a s s i g ned to un i que s o f twa r e p r i o r i t y l ev e l s a n d the i r p r i o r i t i e s d o n o t c h a ng e . No r m a l p r o c e s s e s d o e x pe r i e n c e r o und r o b i n s c h ed u l i ng b o th b e c a u s e the r e a r e us ua l l y m o r e o f t h em o n a g i v e n s ys t em and b e c a u s e the d e f a u l t b e h a v i o r ( f r om C r e a t e P r o c e s s a r g um e n t s o r f r om the u s e r a u tho r i z a t i o n f i l e ) is to a s s ign a b a s e p r i o r i ty o f fo ur t o a l l user proc esse s . Th u s s o f twa r e p r i o r i t y l ev e l s f o u r th r o ug h n i n e t e nd to be o c c up i ed b y s e v e r a l p r o c e s s e s s i m u l t a ne o us l y . 8-4 S C H EDUL I NG 8.1.2. 3 P r i o r i ty Ad j u s tm e n t - No r ma l processes do no t g en e r a l l y execute at a s i ng l e s o f t wa r e p r i o r i t y l ev e l . Ra t h e r , a p r o c e s s s o f t wa r e p r i o r i t y c h a ng e s o v e r t i m e i n a r a ng e o f ze r o t o s i x s o f t wa r e pr io r i ty l evel s above the base p r o c e s s pr i o r i ty . Two m e c h a n i s m s p r ov i d e t h i s p r i o r i t y ad j us tm e n t . As a c o nd i t i o n fo r wh i c h the process has b e e n wa i t i ng i s s a t i s f i ed o r a n e e d ed r e s o u r c e b e c o m e s a v a i l a b l e , a b o o s t o r pr i o r i t y i n c r em e n t m a y be a ppl i e d to the base pr io r i ty to i mp r o v e the s c h ed u l i ng r e s po n s e fo r the process ( Sec t i on 8 . 2 . 3 ) . Ea c h t i me the process e x e c u t e s wi tho u t f u r th e r s ys t em ev e n t s ( Section 8 . 2 ) or q u a n t um expi r a t i o n ( see the nex t s e c t i o n ) o c c u r r i ng , t h e c u r r e n t pr i o r i t y i s moved t o wa rd the base p r i o r i t y ( o r d em o ted ) b y o n e p r i o r i t y l ev e l ( S e c t i o n 8 . 3 ) . Ov e r t i m e , c o mpu t e - bo und p r o c e s s p r i o r i t i e s t e nd to r ema i n a t t h e i r ba s e p r i o r i t y l e v e l s , wh i l e I / O-bo und a nd i n t e r a c t i v e p r o c e s s e s t e nd to h a v e a v e r a g e c u r r e n t p r i o r i t i e s s o mewh a t h i g h e r than the i r base pr i o r i ty . An e x am pl e o f p r i o r i t y ad j u s tm e n t t h a t o c c u r s o v e r t i me f o r s e v e r a l p r o c e s s e s i s i l l u s t r a t ed i n F i g u r e 8 - 2 . Q UANTUM 8.1.2.4 Quan t um E x p i r a t i o n - Th e SYSBOOT pa r am e t e r d e t e rm i n e s , f o r mo s t process s ta tes , t h e m i n i m um am o un t o f t i m e a p r o c e s s c a n r em a i n i n m em o r y a f t e r an i n swa p o pe r a t i o n , b u t i t i s n o t a n a b s o l u t e g u a r a n t e e o f m emo r y r e s i d e nce . ( Th e swa ppe r ' s u s e o f t h e i n i t i a l q u a n t um f l a g i s d e sc r i b ed i n Ch a p t e r 1 4 . ) Th e qua n t um a l so def i nes the s i z e o f the t i m e s l i c e f o r r o und r o b i n s c h ed u l i ng no r m a l processes . Th e v a l u e o f QUANTUM is the n umbe r of 1 0 m i l l i s ec ond ( c l o c k t i c k s ) i n t h e qua n t um . Th e d e f a u l t QUANTUM v a l u e o f i n te rv a l s 3 0 t h e r e fo r e p r o d uc e s a s c h ed u l i ng i n te r v a l of 3 0 0 m i l l i s e c o nd s . Af t e r each 1 0 m i l l i s e c o nd i n te rva l , t h e ha r d wa r e c l o c k i n t e r r up t s e r v i c e r o u t i n e upd a t e s t h e qua n t um- r ema i n i ng f i eld in the process head er o f the cu r rent process . Wh en th i s v a l ue b e c om e s z e r o , t h e so f twa r e t i m e r r o ut i n e s i g n a l s a qu a n t um end event by i nv o k i ng the s ub r o u t i n e S C H $ Q E ND i n mod ul e R S E . An a d d i t i o n a l d ed uc t i o n f r om t h e QUANTUM i s g o ve r n e d by the s pe c i a l SYSB OOT p a r am e t e r I O TA . Th i s v a l ue ( i n un i t s o f 1 0 m i l l i s e c o nd s ) i s d e d uc t ed f r om t h e r em a i n i ng q u a n t um v a l u e e a ch t i m e a p r o c e s s e n t e r s a wa i t s t a t e .· Th e r e f o r e , the d e fa ul t I O TA v a l ue of 2 cha r g e s 2 0 m i l l i s e c o nd s a g a i n s t the q u a n t um o f t h e p r o c e s s . Th i s m e c h a n i sm is p r o v i d ed to ensur e th a t a l l p r o c e s s e s e x pe r i e n c e q ua n t um end e v e n t s wi th s o m e r eg u l a r i t y . P r o c e s s e s th a t a r e c o m p u t e b o und expe r i ence qu a n t um e nd as a resul t of us i ng a c e r t a i n a m o u n t o f C PU t i m e . P r o c e s s e s th a t a r e I /0 bo und expe r i e n c e q u a n tum end as a resu l t of pe r fo rm i ng a r e a s o n a b l e n um b e r o f I /O r e q u e s t s . Th i s g ua r a n t e e s th a t p r o c e s s e s tha t s pe nd mo s t o f t h e i r t i m e i n some wa i t s ta te c a n a l so a c c ompl i sh u s e f u l wo r k b e fo r e t h e y a r e o u t s wa pped . Th e r o u t i n e S C H $ QEND i s e x e c u t ed at the end of e v e r y q u a n t um , r eg a rd l e ss o f the so f t wa r e p r i o r i t y o f the c u r r e n t p r o c e s s . Fo r r e a l - t i m e p r o c e s s e s , howe v e r , t h e o n l y a c t i o n pe r f o rmed is to r eset t h e p r o c e s s h e ad e r q ua n t um f i eld t o t h e f u l l q u a n t um v a l u e a nd t o clear the init ial qu a n t um bit in the PCB s t a t us v e c to r (bit PC B $V I N QUAN in the f i eld PC B $ L S T S , p i c t u r ed i n F i g u r e 8 - 1 ) . Th e c l e a red i n i t i a l qua n t um b i t m a k es a process mo r e l i ke l y to be o u t swa pped , i f p r o c e s s swa p m o d e h a s n o t b e en d i s a b l ed . 8-5 QUANTUM I I TYPE PROCESS BASE PRIORITY A COMPUTE BOUND 4 1 / 0 BOUND B 4 c REAL TIME 18 � EVENTS 1/0 REQUEST PREEMPTION QUANTUM END 20 18 16 SOFTWARE PRIORITY 1 2 LEVELS [§:] - EwAPPERI - - [§:] - [§:] [§:] - - - - - - m - - 14 (X) "' I 10 8 6 4 2 E VE N TS 0 CD ® ® Figure 8-2 @§) COO)® ® @ @ @ @ @ @ @ @ @ TIME ---+ So f twa r e P r i o r i t i e s a nd Pr i o r i t y Ad j u s tm e n t s - S CHEDUL ING No t e s o n Fi g u r e 8 - 2 (1) P r o c e s s " C " bec om e s c omput a b l e . Pr o c e s s " A" i s p r e empted . (2) " C" h i b e r nate s . l o we r . ag a i n , pr i o r i ty (3) " A" ex pe r i e n c e s qua n t um e n d and i s r e s c h ed u l ed pr io r i ty . " B " i s c om p u t a b l e o u t s wa pped . (4) Th e Swa ppe r p r o c e s s e x e c ut e s t o i n s wa p " B " . f o r ex ec u t i o n . (5) " B " i s pr e em pt ed b y " C " . (6) " B " ex ec u t e s ag a i n , o n e pr i o r i t y l ev e l l o we r . (7) " B " r e qu e s t s an I /O o pe r a t i o n e x ec u t e s a t i t s b a se pr i o r i t y . (8) " A " r e qu e s t s a t e r m i n a l o u t pu t o pe r a t i o n . e x ec ute s . (9) ex e c ut e s " A" pr io r i ty + 3 . (10) " A " i s p r e em p t ed b y (11) " A " e x e c u t e s ag a i n , o n e pr i o r i t y l ev e l l o we r . ( 12) " A" e x pe r i e n c e s qua n t um p r i o r i t y l ev e l l o we r . end (13) " A " i s p r e empted by " B " . a ppl i ed to " B" bec a us e c u r r e n t pr io r i t y . A p r i o r i ty boost o f 2 i s no t the r e s u l t wo u l d b e l e s s t h a n the (14) " B" (15) " B " ex ec u t e s ag a i n , o n e pr i o r i t y l ev e l l o we r . (16) " B " r e qu e s t s a n I /0 o pe r a t i o n . p r io r i t y . ex ec u t e s at i ts b a se (17) " A " e x pe r i e nc e s qua n t um end and i s r e s c h ed u l ed p r io r i t y ( i t s b a s e pr i o r i t y ) . at the same (18) " A" " A" e x ec u t e s ( no t one at " B" I /0 c ompl e t i o n fo l l o w i ng ( Th e a ppl i ed bo o s t wa s 4 . ) i ts b a se i s s c hed u l ed t e rm i n a l Th e l ev e l I /O ) . Nul l at " A" pr o c e s s b a se i ts "C" . and is r e s c h ed u l ed at o ne i s p r e em p t ed by " C " . " A" i s p r e em pted b y " C " . F i g ur e 8 -2 ( Co n t . ) So f twa r e P r i o r i t i e s a nd Pr i o r i t y Ad j u s tm e n t s 8-7 S CHEDUL ING Fo r no rm a l p r o c e s s e s , h o we v e r , t h e o c c u r r e n c e i nv o l v e s s e v e r a l d i f f e r e n t o pe r a t i o n s . of q u a n t um ex p i r a t i o n 1. As w i th r e a l - t ime p r o c e s se s , no r m a l proc e s s e s have the p r o c e s s h e ad e r q u a n t um f i e l d r e s e t a nd t h e i n i t i a l q u a n t um b i t c leared . 2. I f th e r e a r e a ny i n s wa p c a nd i d a t e s ( S C H $G L C OMOQS i s n o n z e r o , i nd i c a t i ng at l e a s t o n e n o n e m p t y C OM O- s t a t e que ue ) , t h e c u r r e n t p r i o r i t y o f t h e p r o c e s s i s s e t to i t s b a s e p r i o r i ty . ( If S C H $G L C OM O QS c o n t a i n s a ze r o , the pr i o r i ty i s l e ft a lone . ) 3. Ro u t i ne S C H $ SWPWAKE i s c a l l ed to d e t e rm i n e wh e th e r s wa pp e r a c t i v i t y i s r e qu i r ed . Th e swa ppe r p r o c e s s i s a wa kened i f • t h e r e i s a t l e a s t o n e c om p u t a b l e o u t swa pped p r o c e s s , • i n d i c a t ed b y mod i f i ed pag e wr i t i ng i s r e q u i r e d as fo r the free uppe r a nd l o we r l im i t th r e sh o l d s m o d i f i ed p ag e l i s t s , • th e r e i s a t l e a s t o n e p r o c e s s h e ad e r o f a d e l e t ed p r o c e s s s t i l l i n the bal ance s l o ts , or • a powe r f a i l r e c ov e r y h a s j u s t o c c u r r ed . the a nd Th e s e c h e c k s a v o i d n e ed l e s s a wa k e n i ng o f t h e s wa ppe r , w i th the a s s o c i a t e d c o n t e x t s w i t c h o v e r h e a d , o n l y to d e t e r m i n e t h a t the s wa pp e r h a s no u s e f u l wo r k t o d o . Th e swa ppe r p r o c e s s d o e s n o t e x e c u t e i mmed i a t e l y b u t m u s t b e s c h ed u l e d fo r exec ut ion . As a c omputab l e ( a f t e r wa k i ng ) r e s i d ent r e a l - t i m e p r o c e s s o f s o f t wa r e p r i o r i t y 16 , the s wa ppe r i s l i k e l y to b e t h e n e x t p r o c e s s s c h ed u l e d . 4. Th e C P U l i m i t f i e l d o f t h e p r o c e s s h e a d e r i s n e x t c h e c ked to d e te rm i n e if a C PU l i m i t has b e e n i m po sed and i f tha t l i m i t I f t h e C PU l i m i t h a s e x p i r e d , e a c h a c c e s s m o d e h a s e x p i red . wi l l h a v e a n i n t e r v a l o f t i m e t o c l e a n u p o r r un d o wn be f o r e t h e i m ag e ex i t s a nd th e p r o c e s s i s d e l e t ed . Th e s i z e o f the wa rn i ng i n t e r v a l g i v e n to each ac c e s s mod e is d e f i n ed by t h e S Y S B OOT pa r am e t e r E XTRACPU . ( Th i s p a r am e t e r has a d e f a ul t v a l u e o f o n e s e c o nd . ) 5. I f no C P U l i m i t ex p i r a t i o n h a s o c c u r r e d , then the a u toma t i c wo r k i ng set ad j u s tm e n t c a l c u l a t i o n s t a k e pl a c e i f t h e y a r e e n ab l ed . Th e SYS B OOT p a r am e t e r WS INC m u s t be z e r o to d i s a b l e a u tom a t i c wo r k i ng s e t ad j u s tm e n t s . Th e s i z e o f the pr o c e s s wo r k i ng set may be e x p a nd ed or c o n t r a c ted by amo u n t s s p ec i f i e d by t h e SYS B O OT p a r am e t e r s WS I NC o r WSDE C . F i ve t h r e s ho l d v a l u e s a pp l y to the a u toma t i c ad j us tm e n t s . • Th i s p r o c e s s m u s t h a v e a c c um u l a t ed AWST IM E u n i t s of CPU t i m e ( e a c h c l o c k t i c k a c co un ts f o r 1 0 m i l l i s e c o nd s ) s i n c e t h e l a s t a d j u s tm e n t fo r a n e w a d j u s tm e n t to t a k e p l ac e . • Th e pag e f a u l t r a t e m u s t b e l a rg e r th a n PFRATH f a ul t s pe r 1 0 s e c o nd s o r l e s s t h a n PFRATL f a ul t s pe r 1 0 s e c o nd s . • Th e wo r k i ng s e t c a nno t c o n t r a c t b e l o w AWSM I N above AWSMAX p a g e s . 8-8 no r ex pand S C HEDULING Au t om a t i c wo r k i ng s e t ad j us tm e n t i s d i sc u s s e d f r om the m em o r y m a n a g em e n t po i n t o f v i e w i n Ch a pt e r 1 3 . 6. 8.1.3 F i n a l l y , a s c h e d u l i ng i n t e r r up t a t I P L 3 w i l l b e r e q u e s t e d to r em o v e the cur rent p r o c e s s f r om ex ec u t i o n and s c h e d u l e t h e h i g h e s t pr i o r i ty , m em o r y r e s i d e n t c ompu t a b l e proc ess fo r execut i on . No te th a t o n a qu i e t sys t em , the c ur r e n t l y e x e c u t i ng p r o c e s s m a y b e s e l ec t ed fo r ex ec u t i o n ag a i n . S t a t e Que ue s Wi th t h e e x c e p t i o n o f t h e s i ng l e p r o c e s s e x e c u t i ng a t a g i v e n mome n t , all processes in the sys t em are in a pr o c e s s wa i t s ta te , the c ompu t a b l e r e s i d e n t s t a t e , o r the c o m p u t a b l e o u t swa pped state . Th e p r o c e s s s t a t e i s i nd i c a t ed by t h e PC B $W S TATE f i e l d and th e l i n k i ng o f t h e p r o c e s s c o n t r o l b l o c k i n to a que ue of s i m i l a r PCBs . Th e l i s th e a d s fo r a l l wa i t que ue s , c omp u t a b l e r e s i d e n t ( C OM ) que ue s , a nd c o m p u t a b l e o u t swa pped ( C OMO ) que ue s , a s we l l a s the po i n te r to the PCB o f the c u r r e n t ( C UR ) p r o c e s s , a r e d e f i n ed i n the m o d u l e SDA T . 8.1.3.1 Compu t a b l e S t a t e s - P r o c e s s e s i n the c om p u t a b l e o r e x e c u t a b l e s tate a r e n o t wa i t i ng fo r e v e n t s o r r e s o u r c e s , o th e r t h a n a c q u i r i ng c o n t r o l o f t h e C P U f o r e x e c ut i o n . Comp u t a b l e r e s i d e n t ( C OM ) p r o c e s s e s a r e pl a c ed i n o n e o f 3 2 p r i o r i t y que ue s , w i th t h e que ue c h o s e n by t h e i n t e r n a l v a l ue fo r the cur rent so f t wa r e pr i o r i t y o f the process ( Figure 8 - 3 ) . Th e r e i s a s i m i l a r s e t o f 3 2 quadwo r d l i s th e a d s f o r the c om p u t a b l e o u t swa pped ( C OM O ) s t a te . Processes in the c om p u t a b l e o u t swa pped s tate a re wa i t i ng f o r t h e swa ppe r p r o c e s s t o b r i ng t h em i n to m em o r y . As c om p u t a b l e r es i d ent processes they c an then be s c h ed u l ed fo r ex e c u t i o n . P r o c e s s e s m u s t b e i n the c om p u t a b l e r e s i d e n t s t a t e t o b e c o n s i d e r ed f o r s c h ed u l i ng . P r o c e s s e s a r e c r e a ted in the c ompu t a b l e o u t swa pped ( C OM O ) s t a t e . De l e t i o n of p r o c e s s e s o c c u r s f r om th e c u r r e n t ( C UR ) s t a t e . 8 . 1 . 3 . 2 Wa i t S t a t e s - Th e l i s t h e a d s f o r the p r o c e s s control block q u e ue s c o r r e s po nd i ng to all p r o c e s s wa i t s t a t e s e x c ept t h e c ommo n e v e n t f l ag wa i t s t a t e ( C E F ) l o o k l i k e F i g u r e 8 - 4 . ( Common e v e n t f l ag wa i t que u e s a r e d e sc r i b ed i n Ch a pt e r 9 . ) Th e f i r s t two l o ng wo r d s a r e t h e l o ng wo r d l i n k s to the PCBs i n th i s q ue ue . Th e S TATE f i e l d o f the que ue h e a d e r c o n t a i n s the n ume r i c a l v a l u e c o r r e s po nd i ng to th e p r o c e s s s tate . Al l PC Bs i n a s t a t e que ue h a v e PC B $W S TATE v a l ue s i d e n t i c a l to the STATE v a l u e o f the wa i t s t a t e q ue ue h e a d e r . Re c o g n i z e d S TATE v a l u e s a nd the c o r r e s po nd i ng s t a t e n am e s a r e s umma r i z e d in Ta b l e 8 - 1 . Th e C O UNT f i e l d o f t h e wa i t s t a t e que ue h e a d e r i s s i mpl y t h e n um b e r o f p r o c e s s c o n t r o l b l o c k s c u r r e n t l y i n th i s s t a t e and q u e ue . 8 . 1 . 3 . 2 . 1 Vo l un t a r y Wa i t S t a t e s Th e r e a r e two process s tates a s s o c i a t ed w i th l o c a l e v e n t f l ag wa i t s . Re s i d e n t pr o c e s s e s wa i t i ng fo r l o c a l ev e n t f l ag s a r e p l a c ed i n to the LEF s t a t e , wh i l e o u t s wa pped p r o c e s s e s o c c upy the LE F O s t a t e . Th e r e a r e s e pa r a t e que ue s m a i n t a i n ed f o r the s e s t a t e s , a nd a n LEF s t a t e p r o c e s s b e i ng o u t swa pped m u s t be r emoved f r om the LE F q u e u e and pl a c ed i n to t h e LEFO s t a t e que ue . P r o c e s s e s e n t e r t h e L E F s t a t e a s a r e s u l t o f i s s u i ng $ WA I TFR , $WFLOR , a nd $WF LAND s ys t em s e rv i c e s d i r e c t l y o r i nd i r e c t l y ( w i th a $ Q I OW s ys tem s e r v i c e c a l l , i s s ue d e i th e r by t h e use r o r o n h i s b e h a l f b y - 8 9 - SC HEDULING s om e s y s tem c om po n e n t s uc h a s RMS ) . Remo v a l f r om t h e L E F o r L E F O s t a t e s t o t h e c om p u t a b l e ( C OM ) o r c om p u t a b l e o u t swa pped ( C OMO ) states c a n o c c u r a s a r e s u l t o f m a t c h i ng t h e e v e n t f l ag wa i t m a s k , e n q ue u i ng a n a s yn c h r o no u s s y s t em t r a p ( AS T ) , o r p r o c e s s d e l e t i o n . For BITS 3 1 State COM 0 : :�L� 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 E��;.�=:�U::::QUEUE) PRIORITIES 31 0 QUEUE 0 PRIORITY 3 1 30 For BITS 3 1 • • I • lilliE • • • QUEUE HEADERS : :SCH$AQ_COMH : :SCH$AQ_COMT State COMO 0 111111111111111111111111111111111 ��:::�g ���: BIT MAP O (CLEAR BIT IMPLIES EMPTY QUEUE) 3t QUEUE HEADERS : :SCH$AQ_COMOH ---1 : :SCH$AQ_COMOT PRIORITIES 0 QUEUE 0 ....,._ PRIORITY 3 1 __ PRIORITY 3 1 :: PRIORITY 30 30 PRIORITY 29 Figur e 8 - 3 Compu t a b l e { Ex e c utab l e ) W a it Queue Forward Link I liE I ,.. Wait Queue Backward Link Count State Figure 8-4 S t a t e Que u e s Fo rma t o f Wa i t S t a t e Q u e ue He a d e r s 8-1 0 S C HEDUL I NG S im i l a r l y , the re a r e sepa rate r e s i d e n t a nd o u t s wa pped states and q u e ue s f o r h i b e r n a t i ng a nd s u s p e nd ed p r o c e s s e s . Th e H i b e r n a t e a n d S u s pe nd s ys tem se rv i c e s c a us e p r o c e s s e s t o enter the r e s i d e n t wa i t s ta te s . H i b e r na t i ng p r o c e s s e s c a n l e a v e the H I B a nd H I B O s t a t e s a n d e n t e r t h e C OM a nd C OMO s t a t e s a s a r e s u l t o f $ WAKE s y s t em s e rv i c e s , A S T e n q ue u i ng , o r pr o c e s s d e l e t i o n . S u s pe nd ed pr o c e s s e s a r e s e n s i t i v e t o o n l y $ R E S UM E s y s t em s e r v i c e s a nd process d el e t ion ( be c a u s e ASTs c a nno t b e d e l i v e r ed to p r o c e s s e s wh i l e t h e y a r e s u s pe nd ed ) . Th e t r a n s i t i o n s b e twe e n s t a t e s a r e d i ag r ammed i n F i g u r e 8 - 5 . 8 . 1 . 3 . 2 . 2 Memo r y Ma n a g e m e n t Wa i t S t a te s - Th r e e p r o c e s s wa i t states E a c h s t a t e i s r e p r e s e n t ed by a a r e a s s o c i a t ed wi th memo r y m a n ag eme n t . s i ng l e queue a nd l i s th e a d of the f o rm s h o wn in Fig ure 8-4 . Di f fe rent iat ion o f r e s i d e n t a nd o u t swa pped pr o c e s s e s i n th e s e s t a te s i s o n l y a c compl i sh e d b y m e a n s o f t h e PC B $V R E S b i t of the PCB $ L S T S f i eld . Th e o u t s wa ppi ng o f p r o c e s s e s i n the se s t a t e s d o e s n o t i nvol v e r em o v a l f r om a nd i n s e r t i o n i n to q u e ue s . Th e PC B $V R E S b i t is s impl y c l e a r ed i n the process c o n t r o l b l o c k . ( Memo r y m ana g e m e n t wa i t s t a t e s a r e d i s c u s s e d f r om a n o th e r po i n t o f v i ew i n Ch a pt e r 1 2 . ) Th e pag e f a u l t wa i t s t a t e ( PFW) i s e n t e r ed wh e n a p r o c e s s r e f e r s to a pag e that i s not in phys i c a l memo r y . Wh i l e the pag e r e ad i s i n p r og r e s s , t h e p r o c e s s i s p l a c ed i n to the PFW s t a t e . Compl e t i o n o f t h e pa g e r e ad , A S T e n q u e u i ng , o r p r o c e s s d e l e t i o n c a n c a u se the p r o c e s s t o b e c ome c ompu t a b l e ( C OM ) o r c ompu t a b l e o u t s wa pped ( C OM O ) , d e pend i ng upo n i t s PC B $V_R E S b i t v a l u e wh e n the s a t i s f y i ng c o nd i t i o n o c c ur s . Th e f r e e pag e wa i t s t a t e ( F PG ) i s e n t e r ed wh en a process r eque sts a pag e to be add ed to i t s wo r k i ng s e t , b u t t h e r e a r e no f r e e pag e s to b e a l l o c a t ed f r om t h e f r e e pag e l i st . Th i s state is essent i a l l y a r e s o u r c e wa i t unt i l t h e s uppl y o f f r e e pag e s i s r e pl e n i s h e d th r o ug h mod i f i e d pag e wr i t i ng , p r o c e s s o u t s wa ppi ng , o r v i r t ua l add r e s s s pa c e deletion . Th e c o l l i d ed pag e wa i t s t a t e ( C O L PG ) u s ua l l y o c c u r s wh e n s ev e r a l processes c a u s e pag e f a u l t s o n t h e s ame sh a r ed pag e a t th e same t i m e . Th e i n i t i a l f a u l t i ng p r o c e s s e n t e r s t h e PFW s t a t e , wh i l e th e second and s u c c eed i ng p r o c e s s e s e n t e r t h e C O L PG s t a t e . Th e C O L PG s t a t e c a n a l s o b e e n t e r ed wh e n a p r o c e s s refers to a pr i v a t e pag e th a t is a l ready i n t r ans i t ion f r om the d i s k . Al l C O LPG p r o c e s s e s a r e m a d e c omp u t a b l e o r c om p u t a b l e o u t s wa pped wh e n the r e ad o pe r a t i o n c ompl e t e s . ( A mo r e d e t a i l ed d i s c u s s i o n o f c o l l i d ed pag e s i s c o n t a i n ed in Ch a p t e r 1 2 . ) 8 . 1 . 3 . 2 . 3 M i s c e l l a n e o u s Wa i t S t a t e ( MWA I T ) - Th e m i s c e l l a n e o us wa i t s ta te ( MWA I T ) i s used t o i nd i c a t e p r o c e s s e s wa i t i ng fo r r e s o u r c e s n o t ma n ag e d by a ny o f t h e o th e r p r o c e s s wa i t s t a t e s . Th e r e is a s i ng l e MWA I T q u e ue fo r memo r y r e s i d e n t a nd o u t swa ppe d p r o c e s s e s . Tab l e 8 - 2 l i s t s t h e r e s o u r c e s a s s o c i a t e d w i th t h e two fo rms o f the MWA I T s t a t e . 8-1 1 S C H E D U L I NG OUTSWAP EVENT, AST, DEL WAIT CEF OUTSWAP OUTSWAP DELETE AST, DEL, MUTEX OR RESOURCE AVAILABLE AST DEL * 0 0 / AST enqueuing Process deletion Transitions from memory-resident walt states to COM are not labeled to avoid cluttering the figure. They are caused by the same events shown for transitions to the COMO state. Represents a process state with a single queue Represents a process state with a multiple queues Fi g ur e 8 - 5 S t a t e T r a n s i t i o n D i ag r am 8-1 2 S C H E D U L I NG Ta b l e 8 - 2 Ty pe s o f MWA I T S t a t e Re a s o n fo r Wa i t Co n t e n t s o f PCB $ L_EFWM Symb o l i c Mu t e x Wa i t s S y s t em Log i c a l Nam e Tab l e G r o up Lo g i c a l Na m e Ta b l e I /O Da t a Ba s e Common E v e n t B l o c k L i s t P a g ed Dyn am i c Mem o r y G l o b a l S e c t i o n De sc r i pto r L i s t S h a r ed Mem o r y G l o b a l Sec t i o n De sc r i p t o r Ta b l e S h a r ed Memo r y Ma i l bo x e s E n que ue/De q u e u e Ta b l e s { No t Cu r r e n t l y U s e d ) K n o wn F i l e En t r y Ta b l e L i n e P r i n t e r Un i t Co n t r o l B l o c k { 2 ) L OG $A L MUT E X I OC $G L MUTE X E XE $G L-C EBMTX EXE $G L-PGDYNMTX E XE $G L-G S DM TX E XE $G L-S HMGSMTX E XE $G L-S HMMBMTX E XE $G L-EN QM TX EXE $ G L-KF IM TX UCB $ L_LP_MUTEX Sym b o l i c Re so u r c e Wa i t s A S T Wa i t ( Wa i t fo r sys t em o r s pe c i a l k e r n e l A S T } Ma i l bo x Fu l l N o n pa g ed Dyn am i c Memo r y Pag e F i l e Fu l l P a g ed Dyn a m i c Memo r y B r e a k t h r o ug h { Wa i t fo r b r o a d c a s t m e s s a g e ) I m a g e Ac t i v a t i o n Lo c k J o b Po o l ed Quo t a ( no t c u r r en t l y u s e d ) R S N $ AS'IWA I T RSN $-MA I LB O X RSN $-N PDYNM EM RSN $-PG F I LE RSN $-PG DYNM EM R S N $-B RKT HR U R S N $-I AC LO C K R S N $=J Q UO TA (1) Th e s ym bo l i c c o n t en t s o f PC B $ L E FWM w i l l p r o bab l y r em a i n the s a m e f r o m r e l e a s e to r e l e a se . Th e n um e r i c c o n t e n t s fo r m u t e x wa i t s a r e a l m o s t c e r ta i n to c h a ng e w i t h e a c h m a j o r r e l e a s e o f t h e o pe r a t i ng s ys t em . {2) Th e m u t e x a s s o c i a t ed w i t h e a c h l i n e pr i n te r un i t d o e s no t have a f i x ed add r e s s l i ke the o th e r m u t e x e s . I t s v a l ue d e pe nd s o n wh e r e the UCB f o r tha t un i t i s a l l o c a t e d . Num e r i c {1) { he x ) 80 0024F4 8 0 0 0 24F8 80002620 80002624 80002628 8 0 0 0 2 6 2C 80002630 80002634 80002638 8 0 0 0 2 6 3C {No te 2 ) Num e r i c ( hex) 00000001 00000002 00000003 0 0 0 0 0 0 04 00000005 00000006 00000007 00000008 Th e m i s c e l l a n e o us r e so u r c e wa i t state is used t o wa i t fo r the ava i l ab i l i ty of a d e pl e t ed or l o c k e d r e s o u r c e . A p r o c e s s may e n t e r a r e s o u r c e wa i t i f the r e s o u r c e r e que s t ed ha s a l r e a d y b e e n a l l o c a ted . Common e x ampl e s a r e t h e d e pl e t i o n o f no npag ed d ynam i c memo r y o r no r o om in ma i l bo x e s . Th e process wi l l b e c ome c omputa b l e wh e n the r e s o u r c e b e c om e s ava i l a b l e ag a i n . Th e n um b e r of the r e so u r c e (a sma l l i n t eg e r d e f i n ed b y t h e $ R SNDEF m a c r o ) is s t o r ed in the PC B $ L E FWM f i e l d ( Ta b l e 8 - 2 ) , and t h e PC B $W S TATE i s c h a ng e d to MWA I T t o i ndTc a t e a m i sc el l aneous r e so u r c e wa i t� Wh e th e r a process can be m a d e e x e c u t a b l e b y t h e e n que u i ng o f a n A S T t o t h e p r o c e s s i s d e pe nd e n t upon t h e i n t e r r up t p r i o r i t y l ev e l of t h e c a l l e r of the r o ut i ne d e c l a r i ng the r e so u r c e wa i t . If the I PL i s t h e s a v e d PS L i n th e h a r d wa r e p r o c e s s c o n t r o l b l o c k i s two o r l a r g e r , t h e p r o c e s s wi l l r e e x e c u t e t h e r e so u r c e wa i t code a nd b e pl a c ed back i n to the MWA I T s t a t e i mmed i a te l y . I f the s a v ed I P L i s sm a l l e r th a n two , an AST d e l i v e r y i n te r r upt w i l l occur , r e s ul t i ng i n t h e e x e c u t i o n o f t h e p r ev i o u s l y e n que u e d AST . Th e S e t Re s o u r c e Wa i t Mo d e s ys tem s e rv i c e ( $ S E TRWM) can fo r c e the i mmed i a t e r e turn of an error s t a t u s c o d e r a th e r th a n p l a c i ng the p r o c e s s in the MWA I T s t a t e . $ S ETRWM d o e s th i s b y s e t t i ng the PC B $V S S RWA I T b i t of t h e PC B $ L STS f i e l d . D i s a b l i ng r e so u r c e wa i t s a f f e ct s m a n y d i r ec t l y r e que s t ed ope r a t i o n s s uch a s I /0 r e que s t s or t imer r e que s t s b u t h a s n o e f f e c t o n a l l o c a t i o n r e qu e s t s b y t h e s y s tem on b e h a l f of t h e us e r . An ex ampl e of th i s s i tua t i o n is the pag e r 8-1 3 S CHEDUL ING r e qu i r i ng a n I /O r e q u e s t p a c k e t t o pe r f o rm a pag e r e ad o pe r a t i o n . If n o npag e d d y n am i c m em o r y i s d e pl e t ed , t h e p r o c e s s w i l l e n t e r the MWA I T s t a te , even i f $ S ETRWM h a d b e e n u s e d t o d i sa b l e r e s o u r c e wa i t s . Th e r e a so n fo r th i s d i s t i n c t i o n is that a process can r e s pond to a d e pl e t ed r e so u r c e e r r o r f r om a s ys t em s e rv i c e c a l l o r an RMS r e q u e s t b u t h a s no m e a n s o f r e ac t i ng t o a s i m i l a r e r r o r i n t h e e v e n t o f an u n e x p e c t ed e v e n t s uc h a s a pag e f a u l t . Sys t em r o u t i n e s tha t a c c e s s d a t a s t r uc t u r e s p r o t e c ted b y m u t e x e s w i l l pl ace a process i n t h e MWA I T s t a t e i f t h e r e q u e s te d m u t e x o wn e r sh i p c a nno t be g r a n t e d ( Ch a pt e r 2 4 ) . Th u s , t h e m u t e x wa i t s t a t e i nd i c a t e s a l o c k ed r e so u r c e a nd n o t n ec e s s a r i l y a d e p l e t e d o n e . Th e l og i c a l n am e s ys tem s e rv i c e s o pe r a t i ng o n t h e sys tem a nd g r o up l o g i c a l name tables a re o n e e x am p l e o f th i s t ype of o pe r a t i o n . Wh e n t h e o wn e r o f t h e r e que s t e d m u t e x rel eases it, t h e r e q ue s t i ng p r o c e s s b e c om e s ( C OM ) a n d r eq ue s t s o wn e r sh i p o f t h e m u tex ag a i n . r e s i d e n t c ompu t a b l e A S T e n que u i ng c a nno t m a k e a m u t e x -wa i t i ng p r o c e s s c om p u t a b l e fo r l o ng because the I PL i n the s to r ed PS L i s I P L $ A S TDE L ( I P L 2 ) , d i s a b l i ng th e A S T d e l i v e r y i n te r r up t . Th e m u t ex wa i t s t a t e i s d i s t i ng u i s h e d f r om t h e r e s o u r c e wa i t s t a t e by s to r i ng t h e s ys t em v i r t ua l ad d r e s s of t h e r e q ue s t e d m u t ex i n t h e PC B $ L E FWM f i e l d . ( Wh e n t r e a t e d a s a s i g n ed i n t eg e r , t h e c o n t e n t s o f t h i s -f i e l d a r e po s i t i v e a nd sm a l l wh e n t h e p r o c e s s i s wa i t i ng f o r a r e so u r c e . Wh en t h e p r o c e s s i s wa i t i ng f o r a m u t e x , t h e c o n t e n t s are n eg a t i v e , a s l i s te d i n Ta b l e 8 - 2 . ) Fo r e x am p l e , i f a p r o c e s s w i sh e s to a l l o c a t e a b l o c k o f pag e d d yn am i c memo r y , i t m u s t f i r s t a c q u i r e the pag ed po o l m u t ex t o a l l o w i t to s e a r c h the l i n k e d l i s t o f a v a i l a b l e b l o c k s ( Ch a p t e r 2 5 ) . I f a n o t h e r p r o c e s s i s a l r e a d y l o o k i ng a t pag ed po o l , th i s p r o c e s s i s put i n to a m u t e x wa i t s t a t e ( w i t h 8 0 0 0 2 6 2 8 , t h e a d d r e s s o f t h e pag ed po o l m u t ex , s to r ed in PC B $ L E FWM ) . On c e the m utex i s avai l ab l e a nd t h e n o wn e d by t h i s p r oce s s , p a g ed po o l i s s e a r c h ed fo r a b l o c k o f t h e r e q ue s t ed s i z e . If the r e i s no block l a rge e no ugh t o s a t i s f y t h e a l l o c a t i o n r e q ue s t , t h e p r o c e s s i s pl a c ed i n to a r e so u r c e wa i t s t a t e ( wi th 0 0 0 0 0 0 0 5 , t h e v a l ue o f RS N $ PG DYNM EM , s t o r ed in PCB $ L E FWM ) . Th e p r o c e s s r em a i n s i n th i s s t ate un t i l a b l o c k o f pag e d pool i s d e a l l o c a t e d . 8 . 1 . 3 . 3 Common Eve n t B l o c k s - P r o c e s s e s wa i t i ng fo r o n e or mo r e c ommo n e v e n t f l ag s a r e e nque ued t o d a t a s t r uc t u r e s c a l l ed c ommo n e v e n t b l oc k s ( CEBs ) Th e s e d a t a s t r uc t ur e s a r e a l l o c a t e d f r o m nonpa g ed d yn am i c m em o r y wh e n p r o c e s s e s c r e a t e c ommon e v e n t f l ag c l us t e r s . Th e c o n t e n t s o f a C E B i n c l ud e t h r e e l o ng wo r d s th a t e x a c t l y c o r r e s po nd to a wa i t s t a t e q u e u e h e ad e r ( F i g u r e 8 - 4 ) . Th e e n t i r e fo rma t o f the c ommo n e v e n t b l o c k i s s h o wn i n Ch a p t e r 9 . • Th e n um b e r o f C E F s t a t e que ue s d e pe nd s upo n th e n umbe r o f c ommo n e v e n t f l ag c l us te r s th a t e x i s t o n a pa r t i c u l a r s ys tem a t a n y g i v e n t i m e . ( Ad d i t i o n a l p r o c e s s e s a s s o c i a t i ng w i t h e x i s t i ng common e v e n t f l ag c l us t e r s d o n o t c r e a t e f u r th e r C E Bs o r C E F q u e ue s . ) O u t s wa pped p r o c e s s e s wa i t i ng f o r c ommo n event f l ag s a r e d i f f e r en t i a t ed f r om s i m i l a r memo ry r e s id ent processes by the PC B $V R E S b i t o f the PCB $ L S T S f i e l d o n l y . I n a d d i t i o n to s a t i s f y i ng t h e-ev e n t f l ag wa i t ma s k ,- the s ys t em c a n a l s o ma ke a C E F p r o c e s s c o m pu t a b l e by AST e n qu e u i ng or pr o c e s s d e l e t i o n . 8-1 4 S CHEDULING 8.2 S YS TEM EVENTS Sys tem e v e n t s a r e o c c u r r e n c e s o f o pe r a t i o n s tha t c h a ng e the s t a t e s o f processe s . A s ys t em e v e n t m a y m a k e a p r o c e s s c om p u t a b l e , m em o r y r e s i d en t L or o u t s wa pped . S y s tem e v e n t s prov i d e t h e t r ans i t i on s b e twe e n t h e p r o c e s s s t a t e s d i ag r ammed i n F i g u r e 8 - 5 . 8.2.1 Sys t em Ev e n t s a nd P r o c e s s S t a t e s A p r o c e s s i n i t i a l l y e n t e r s a wa i t s t a t e f r om th e c u r r e n t s t a t e ( CUR ) . Th a t is , a p r o c e s s e i th e r d i r e c t l y o r i nd i rec t l y ex ecutes a r e q u e s t fo r a s ys tem o pe r a t i o n fo r wh i ch i t. m u s t wa i t . Di rect r eque s t s s uc h a s $ Q I OW , $H IBER , $ S US PN D , a nd $ WA I TFR pl a c e t h e p r o c e s s i n th� v o l un t a r y wa i t s t a t e s L E F , C E F , H I B , a n d S U S P . S u b s e q u e n t o u t s wa pp i ng ( f r om t h e p r o c e s s v i ewpo i n t a n un r e q ue s t ed s ys t em o pe r a t i o n ) m a y m o v e a p r o c e s s t o the LEFO , H I B O , o r S U S PO s t a t e s . 8.2.1.1 P r o c e s s S t a t e Ch a ng e s - I nd i r e c t wa i t r e quests o c c ur as a r e s u l t o f p a g i ng o r c o n t e n t i o n fo r s y s t em r e so u r c e s . A process does n o t r e q ue s t PFW , FPG , C O L PG , or MWA I T t r a n s i t i o n s . Ra t h e r , the t r an s i t i o n s to th e s e wa i t s t a t e s o c c u r b e c a u s e d i r e c t s e r v i c e r e q u e s t s to t h e s ys t em c a n n o t b e c om p l e t ed o r s a t i s f i e d a t t h e mome n t . A p r o c e s s c a n b e come c om p u t a b l e fo r a va r i ety o f reasons . Th e av a i l a b i l i t y o f a r eque sted r e so u r c e o r the s a t i s f a c t i o n o f a wa i t c o nd i t i o n ( s uc h a s a n e v e n t f l ag s e t t i ng o r a $ WAKE s ys t e m s e r v i c e cal l ) w i l l m a k e t h e p r o c e s s c om p u t a b l e . I n a l l p r o c e s s s t a t e s e x c e pt S US P a nd S US PO , the e n que u i ng of a n A S T w i l l m a k e a p r o c e s s c om p u t a b l e even if t h e wa i t c o nd i t i o n i s n o t s a t i s f i ed . ( Be c a u s e p r o c e s s e s a r e u s ua l l y p u t i n to the MWA I T s t a t e a t I PL 2 , t h e A S T i s n o t a b l e to be d e l i v e r ed unt i l t h e m i s c e l l a n eo us wa i t is s a t i s f i ed . Th u s , the t yp i c a l p r o c e s s in an MWA I T s t a t e wi l l not b e c ome c omput a b l e fo r l o ng d ue to the e nq ue u i ng o f a n A S T . In pa r t i c u l a r , p r o c e s s e s wa i t i ng f o r r e s o u r c e s o r m u t e x e s t yp i c a l l y c a nn o t be d e l e t ed . ) Process dele t ion , i m pl e m e n t ed w i th a s p e c i a l k e r n e l m o d e A S T , w i l l m a k e a l l pr o c e s s e s tha t a r e b e i ng d e l e t e d c o m p u t a b l e ( i n c l ud i ng pr o c e s s e s i n t h e S US P o r S U S PO s t a t e s ) b e c a u s e t h e t a rg e t p r o c e s s i s r e s um ed b e f o r e t h e A S T i s que ued . E x c h a ng e s o f p r o c e s s e s b e twe e n the c u r r e n t e x e c u t i ng s t a t e ( C UR ) a nd t h e c om p u t a b l e m em o r y- r e s i d e n t s t a t e ( C OM ) a r e pe r f o rmed by the sched ul e r r o ut i n e ( Se c t i o n 8 . 3 ) . Th e movem e n t o f a p r o c e s s i n to and out o f t h e b a l a n c e s e t i s t h e r e s po n s i b i l i t y o f t h e swa ppe r pr o c e s s ( Ch a pt e r 1 4 ) . 8 . 2 . 1 . 2 Wa i t S t a t e s a nd AST De l i v e r y - On e o f th e r e spon s i b i l i t i e s o f the r o ut i ne s th a t p l a c e p r o c e s s e s i n to wa i t s t a t e s i s to i n s u r e t h a t t h e s e p r o c e s s e s w i l l c o r r ec t l y e n t e r the i r a pp r o p r i a t e wa i t s t a tes a fter s uc c e s s f u l del ivery of a n AS T . Th e r e a r e th r e e d i f f e r e n t t e chn i q u e s u s e d , d e pend i ng o n t h e pa r t i c u l a r wa i t s t a t e b e i ng e n t e r ed . 8-15 S C H E D U L I NG 8.2.1.2. 1 S y s t e m Se r v i c e Wa i t S t a t e s - I n t h e c a s e wh e r e a p r o c e s s i s e n t e r i ng a wa i t s t a t e a s a r e s u l t o f e x e c u t i ng a sys t em se rv i c e ( B I B , L E F , o r C E F ) , t h e wa i t r o u t i n e i s e n t e r e d w i th the PC a n d PS L o f the t h e s ys tem s e r v i c e C HM K e x c ept i o n ( Ch a p t e r 3 ) o n the t o p o f t h e s t a c k . Th e f i r s t i m p l i c a t i o n o f th i s i s th a t the p r o c e s s w i l l wa i t in the a ccess m o d e i n wh i c h t h e sys t em s e r v i c e wa s i s s u ed . Bec ause ASTs a r e e nque ued a nd d e l i v e r ed b a s ed o n a c c e s s m o d e , th i s a l l o ws , f o r e x a m p l e , a s upe r v i s o r m o d e A S T t o b e d e l i v e r e d to a p r o c e s s wa i t i ng o n an e v e n t f l ag a s a r e s u l t o f a $ Q I OW c a l l i s sued f r om u s e r o r s up e rv i s o r mo d e . I n ad d i t i o n , the wa i t c o d e b a c k s up the s a v e d PC by f o u r so th a t it po i n t s to the C HM x i n s t r uc t i o n 1n the s ys t em s e r v i c e v e c to r ( Figure 3-1 ) . I f a p r o c e s s r e c e i v e s a n A S T wh i l e in s uc h a wa i t s tate , t h e AST i s d e l i v e r ed a nd executes . Wh e n t h e AST d e l i v e r y r o u t i n e pa s s e s c o n t r o l bac k to the ma i nl i ne , t h e s ys tem serv ice executes ag a i n , p l a c i ng t h e p r o c e s s r i g h t b a c k i n to t h e wa i t s t a t e i t wa s i n be f o r e the A S T wa s d e l i v e r ed . 8 . 2 . 1 . 2 . 2 Memo r y Manag e m e n t Wa i t S t a t e s - Th e pag e faul t h a nd l e r ( Ch a p t e r 1 2 ) is so l e l y r e s po n s i b l e fo r p l a c i ng p r o c e s s e s i n t o the t h r e e wa i t s t a t e s a s s o c i a t ed w i t h m emo r y m a n ag em e n t ( P FW , FPG , C O L PG ) . Th i s r o u t i n e p l a c e s a p r o c e s s i n to a wa i t s t a t e wi th t h e PC a nd PS L o f t h e pag e f a u l t a s t h e s a v ed p r o c e s s c o n t e x t . On c e a g a i n , b e c a u se the PS L r e f l e c t s the a c c e s s mod e in wh i c h the f a u l t o c c u r r ed , ASTs c a n be d e l i v e r ed f o r th a t a nd all i nn e r access modes . ( No t e th a t th i s r o ut i n e d o e s no t n e ed t o c h a ng e t h e PC t h a t i t f i nd s o n t h e s t a c k b e c a u s e pag e f a u l t ex c ept i o n s are faul ts a nd no t t r aps . Fa u l t s ( Ch a p te r 2 ) c a us e t h e P C o f t h e f a u l t i ng i n s t r uc t i o n and no t t h e PC o f t h e n e x t i n s t r uc t i o n t o b e p u s h ed o n to t h e e x c e p t i o n s t a c k . ) I f a n A S T i s d e l i v e r e d to a nd ex e c u t e s i n s uc h a p r o c e s s , the ma i n l i n e wi l l execute the f a u l t i ng i n s t r uc t i o n ag a i n . I f the r e a s o n fo r the f a u l t has b e en r em o v e d ( a f r e e pag e b e c ame a v a i l a b l e or the pag e r ead c ompl e t ed ) wh i l e the A S T wa s b e i ng d e l i v e r ed o r wa s e x e c u t i ng , t h e p r o c e s s w i l l s i mp l y c o n t i n ue w i th i t s e x e c u t i o n . If , on t h e o th e r h a nd , t h e s i t ua t i o n t h a t c a u s e d th e p r o c e s s t o wa i t s t i l l ex i s t s , t h e p r o c e s s w i l l r e i nc u r t h e pag e f a u l t a nd b e p l a c ed b a c k i n to o n e o f the m emo r y m a n a g em e n t wa i t s t a t e s . ( No t e tha t a process tha t wa s i n i t i a l l y i n a PFW s t a t e wo u l d b e p l a c ed i n to a C O LPG s t a t e by s uc h a s e qu e n c e o f e v e n t s . ) 8 . 2 . 1 . 2 . 3 S p e c i a l C a s e s - Th e two r em a i n i ng wa i t s t a t e s ( S US P a nd MWA I T ) a r e hand l ed i n a s p e c i a l wa y b y t h e wa i t r o u t i n e . A process s u spe n s i o n o c c u r s a s a r e s u l t o f e x e c u t i ng a spec i a l k e r n e l AST . ASTs c a nno t b e d e l i v e r ed t o s u sp e n d ed p r o c e s s e s . Th a t i s , an AST q u e u e d to a s us p e n d ed p r o c e s s h a s i t s AST c o n t r o l b l o c k i n s e r t e d i n to the AST q u e ue in t h e so f twa r e PCB . Ho we v e r , t h e AST e v e n t i s i g no r ed b y the ( I n f a c t , wh i l e a p r o c e s s i s s u s pe nd ed , t h e saved PC i s an s c h ed u l e r . ad d r e s s in t h e s p e c i a l k e rne l AST t h a t c a u s e d t h e p r o c e s s to e n t e r the s us pe nd s t a t e . Th e s a ved PS L i n d i c a t e s ke r n e l mod e a nd I PL 2 . ) Wh e n a p r o c e s s i s p l a c ed i n to a wa i t s t a t e wa i t i ng fo r a m u t ex ( Ch a p t e r 2 4 ) , i t s s av e d PC i s e i th e r S C H $ L OC KR o r S C H $ LOCKW , d e pe nd i ng o n wh e th e r i t i s a t tempt i ng to l o c k t h e m u t ex f o r r e a d a c c e s s o r wr i t e access . Th e s a v ed PS L i nd i c a t e s k e r n e l mo d e a nd I PL 2 , wh i c h i m p l i e s t h a t p r o c e s s e s i n an MWA I T s t a t e wa i t i ng f o r a m u t e x c a nno t rece ive ASTs . 8-16 SCHEDUL I NG A p r o c e s s c a n a l s o be p l a c ed i n to an MWA I T s t a t e wh i l e wa i t i ng fo r an a r b i t r a r y s ys t em r e so u r c e . In th i s c a se , t h e c a l l e r o f S C H $ RWA I T c o n t r o l s t h e PC and PS L t h a t a r e s a v e d wh e n the p r o c e s s i s p l a c ed i n to t h e MWA I T s t a t e . I n pa r t i c u l a r , t h e c u r r e n t a c c e s s m o d e a nd I PL i n t h e s a v ed PS L d e t e rm i n e wh e th e r a n y ASTs c a n be d e l i v e r ed to a pr o c e s s t h a t i s wa i t i ng fo r a r e s o u r c e . 8.2. 2 E v e n t R e po r t i ng E v e n t s a r e r e po r t ed to t h e s c h ed u l e r f r om m a n y s ys tem r o u t i n e s th r o ug h t h e RPT EVT m a c r o , wh i c h g e n e r a t e s t h e fo l l o wi ng c o d e : B S BW . BYTE SCH$RSE EVT $ e v e n t-name wh e r e t h e byte v a l ue s t o r ed d e pend s upo n t h e e v e n t b e i ng d e c l a r ed by the s ys t em r o ut i ne . Th e ad d r e s s o f t h e v a l ue wi l l b e p u s h ed o n the s tac k by the BSBW i n s t r uc t i o n . Ad d i t i o n a l pa r am e t e r s ( pr i o r i ty i n c r em e n t c l a s s and PC B a d d r e s s o f t h e a f f e c t ed p r o c e s s ) a r e pa s s e d i n r eg i s t e r s . Th e r o u t i n e S C H $ R S E ( i n modul e RSE ) pe r fo rm s the fo l l o w i ng o pe r a t i o n s . 1. Th e ev e n t n um b e r i s l o ad e d i n to a r eg i s t e r and the r e t u r n PC v a l ue (on th e s t a c k a s a r e s u l t o f the BSBW i n s t r uc t i o n ) i s a d j u s t e d to po i n t to t h e a d d r e s s a f t e r the s to r ed b y t e event va l ue . 2. Th e s t a t e a nd the event a r e checked fo r a s i gn i f i cant t r an s i t i o n . E a c h ev e n t ( o r s t a t e t r a n s i t i o n ) h a s a b i t m a s k d e f i n i ng wh i c h s t a t e s t h i s e v e n t c a n a f f e c t . Th e state of t h e p r o c e s s i s o b t a i n e d f r om t h e PC B $W_S TATE f i e l d . • • • Fo r ex ampl e , a wa k e event i s o n l y s i g n i f i c ant p r o c e s s e s t h a t a r e h i b e r n a t i ng ( H I B o r H I B O s t a t e s ) . fo r An o u t s wa p e v e n t i s o n l y s i g n i f i c a n t f o r t h e th r e e s t a t e s ( H IB , LEF , and S US P ) wh e r e a wa i t q u e ue c h a ng e i s r e qu i r ed . Th e e n que u i ng o f a n AST i s s i g n i f i c a n t to nea r l y a l l process s tates . On l y if the process i s i n a SUSP o r S US PO s t a t e is the enque u i ng o f a n AST i g no r e d by S C H $ RS E . I f the e v e n t i s no t s i g n i f i c a n t fo r the c u r r e n t pr o c e s s s ta te , the even t is i g n o r ed ( a nd S C H $ R S E s i mpl y i s s u e s a n RSB) . 3. Fo r s i g n i f i c a n t e v e n t s , o n e o f t h e f o l l o wi ng a c t i o n s i s t a k e n . • An o u t s wa p e v e n t p r o d uc i ng an LEF-LE F O , HI B-H IBO , or S US P-S US PO t r ans i t i on s i mpl y r em ov e s t h e PC B o f the p r o c e s s f r om the r e s i d e n t wa i t que u e and i nse r ts it in the c o r r e s po nd i ng o u t swa pped wa i t que ue . Th e c o r r e s po nd i ng wa i t q ue ue h e a d e r c o un t f i e l d s are a l so ad j us t ed . 8-1 7 SCHEDULING • • • 4. An o u t swa p e v e n t p r o d uc i ng a C OM-C OMO t r an s i t i o n r emov e s t h e P C B f r om t h e C OM p r i o r i t y q u e ue co r r e s pond i ng to PCB $ B PR I a nd i n s e r t s it i n to the c o r r e spond i ng C OMO p r i o r Tt y q ue ue . Th e S C H $G L C OMQS s t a t us b i t v e c to r i s a l so mod i f i ed if the C OM q ue u e i s n o w emp t y . Th e a pp r o pr i a t e S C H $ G L_C OM O QS b i t i s un c o nd i t i o n a l l y s e t . Fo r t r a n s i t i o n s f r om t h e L E F ( i mpl i ed res i d en t ) or CEF r e s i d e n t s t a te to the C OM s t a t e , the s a v ed P C i n t h e h a r d wa r e PC B s t o r ed i n t h e p r o c e s s h e ad e r i s i n c r em e n t e d by f o u r to po i n t pa s t t h e C HMx i n s t r uc t i o n . Th i s a l l o ws t h e p r o c e s s to b eg i n e x e c u t i o n immed i a t e l y f o l l o wi ng the s ys tem s e r v i c e c a l l r a th e r than g o i ng th r o ug h a Wa i t f o r Ev e n t Fl ag s ys t em s e rv i c e f o r a f l ag t h a t i s a l r e a d y s e t . Th e r e s i d e n c e c h e c k i s n e c e s s a r y b e c a u s e the s a v e d PC o f n o n r e s i d e n t pr o c e s s e s i s u s ua l l y n o t a v a i l a b l e . ( Th e s av e d P C is s to r ed i n the h a r d wa r e PC B i n the p r o c e s s h e a d e r , wh i c h m a y b e o u t swa pped i f t h e p r o c e s s is not r e s i d ent . ) Fo r t h e r em a i n i ng t r ans i t ions (all o f wh i c h m a k e a p r o c e s s comp u t a b l e ) , t h e p r o c e s s i s r emoved f r om the wa i t q u e ue a n d t h e wa i t que ue h e a d e r c o un t i s d e c r em e n t e d . Th e PC B is i n s e r t ed i n to a COM o r COM O s t a t e que ue d e pend i ng u po n wh e th e r the p r o c e s s i s mem o r y - r e s i d e n t o r o u t swa pped . Th e pa r t i c u l a r p r i o r i t y que ue o f the COM o r COM O s t a t e i s s e l e c t ed f o r i n se r t i o n a fter a pr i o r i t y a d j us tm e n t i s a t t emp t e d ( s e e the fo l l o w i ng s e c t i o n ) . Th e SCH$G L C OMQS o r SC H$G L C OM O QS s umma r y b i t c o r r e s pond i ng to the-s e l e c t ed p r i o r i ty q u e ue i s uncond i t i o n a l l y s e t . Sub s e qu e n t s c h e d u l i ng o r s wa pp i ng a c t i v i t y i s n e c e s s a r y to e x e c u t e o r i n swa p the now c omputab l e proc e s s . Th e swa ppe r i s po s s i b l y a w& k e n ed ( r o u t i n e SCH$ SWPWAKE i s c a l l ed ) i f the n o w c o mp u t a b l e p r o c e s s i s p r e s e n t l y o u t swa pped ( S e c t i o n 8 . 1 . 2 . 4 , i t ern 3 ) • Th e s c h ed u l e r is r e que s t ed , t h r o ugh an I PL 3 so f t wa r e i n t e r r up t , if t h e now c omputa b l e p r o c e s s i s m em o r y- r e s i d e n t a n d h a s a pr i o r i ty g r e a t e r th a n or e qua l to tha t o f the c u r r e n t l y e x e c u t i ng process . Th i s p r i o r i ty c h e c k avo i d s n e ed l e s s c o n t e x t s w i t c h e s wi th the i r a ssoc i a ted overhead , o n l y to d e t e rm i n e th a t t h e p r ev i o u s l y e x e c u t i ng p r o c e s s wi l l ag a i n e x ec u t e . 8. 2. 3 Sys t em Ev e n t s a n d As s o c i a t ed P r i o r i ty Boo s t s Sy s t em r o u t i n e s th a t r e po r t e v e n t s t o t h e s c h ed u l e r no t o n l y d e sc r i b e t h e e v e n t a nd the p r oc e s s t h a t i s r e spo n s i b l e , b u t a l so s p e c i f y one o f f i v e c l a s s e s o f p r i o r i ty i n c r em e n t s o r bo o s ts tha t m a y b e a pp l i ed to the b a se p r io r i t y o f the p r o c e s s . Ta b l e 8 - 3 l i s t s the e v e n t s , t h e p r i o r i t y c l a s s , a n d the po t e nt i a l amo un t o f p r i o r i t y i n c r em e n t a pp l i ed to the proce ss . Th e t a b l e d o e s n o t s h o w AST enqu e u i ng bec a u s e sys t em r o u t i n e s enque u i ng ASTs to a p r o c e s s c a n s e l e c t a n y o f the pr i o r i ty i n c r em e n t c l a s s e s to be a s so c i a t ed wi th the e n que u i ng o f a n AS T . 8-18 S C HEDUL I NG Ta b l e 8 - 3 Sy s t em Ev e n t s a n d As s o c i a te d P r i o r i t y Bo o s t s Sy s t em Ev en t P r i o r i ty Cl ass { * ) Pa g e Fa u l t Re ad Compl e t e Qua n t um End O t h e r Ev e n t s wi t h No Bo o s t 0 0 0 { PR I $_NULL ) 0 0 0 D i r ec t I /0 Compl e t i o n No n t e r m i n a l Bu f f e r ed I /O Compl e t i o n Upd a t e S e c t i o n Wr i t e Compl e t i o n S e t Pr i o r i t y 1 1 1 1 ( PR I $_I OC OM ) 2 2 2 2 Re so u r c e Av a i l ab l e Wa ke a P r o c e s s Re s um e a P r o c e s s De l e t e a Pr o c e s s T i m e r Re que s t Ex p i r a t i o n 2 { PR I $_R E SAVL ) 2 2 2 2 ( PR I $_T IM ER ) 3 3 3 3 3 Te rm i n a l Ou t pu t Compl e t i o n 3 ( PR I $_T OC OM ) 4 Te rm i n a l I n pu t Compl e t i o n Process Creation 4 4 ( PR I $_T I C OM ) 6 6 ( *) P r i o r i ty Bo o s t Ro u t i n e s tha t r e po r t s ys t em even t s pa ss a n i nc r em en t cl ass to the s c h ed ul e r . Th e s c h ed u l e r u s e s t h i s c l a s s a s a b y t e i nd ex i n to a t ab l e of va l ue s { local l ab e l B P I NC i n mod ul e R S E ) t o c om p u t e t h e a c t ua l boo s t . Th e a c t u a l s o f twa r e p r i o r i t y o f f o l l o wi ng s t e ps . the process is d e t e r m i ned by the 1. Th e p r i o r i t y i n c r eme n t f o r the event c l a s s ( Ta b l e 8 - 3 ) a d d ed to t h e b a s e pr i o r i t y o f t h e p r o c e s s { PC B $ B_PR I B ) . is 2. I f the p r o c e s s h a s a c u r r e n t p r i o r i t y h i g h e r th a n t h e r esul t o f s t e p o n e , t h e c u r r e n t p r i o r i t y wi l l b e r e t a i n e d ( s u c h a s o c c ur s i n F i g u r e 8 - 2 , event 1 3 ) . 3. I f the h i g h e r p r i o r i ty o f s t e p s o ne and two i s a b o v e 1 5 , t h e n ( No t e t h a t th i s the base pr i o r i ty o f the process is used . t e s t a c c ompl i s h e s two c h e c k s a t t h e same t ime . Fi rst , all r e a l - t i m e p r o c e s s e s f i t th i s c r i t e r i o n , w i th t h e r e s u l t t h a t r e a l - t i m e p r o c e s s e s d o no t h a v e t h e i r p r i o r i t i e s a d j us t e d in r e s po n s e to s ys t em events . S e c o nd , p r i o r i ty b o o s t s c a nno t m o v e a no rm a l p r o c e s s i n to the r e a l - t i me p r i o r i t y r a ng e . ) A s i d e e f f e c t o f s t e p t h r e e i s tha t r e a l - t i m e p r o c e s s e s a l wa ys e x e c u t e at the i r base pr io r i t i es . Fu r the r , no te tha t no r m a l pr o c e s s e s w i th b a s e p r i o r i t i e s f r om 1 0 to 1 5 wi l l no t a l wa ys r ec e i ve pr i o r i ty i n c r em e n t s a s events occur . As t h e b a s e p r i o r i t y o f a n o r m a l p r o c e s s i s moved c l o s e r t o 1 5 , t h e p r o c e s s wi l l s pe nd a g r e a t e r amo un t o f t i me at i ts base pr io r i ty . P r i o r i ty 14 a n d 1 5 p r o c e s s e s e x p e r i e n c e no p r i o r i ty b o o s t s . Th u s , th i s s t r a t eg y b e n e f i t s tho s e p r o c e s s e s th a t m o s t n e ed i t , I /0 bo und a nd i n te r a c t i v e p r o c e s s e s wi th b a s e p r i o r i t i e s o f 4 th r o ug h 9 . P r o c e s s e s w i th e l ev a t e d base pr i o r i t i es do not r e q u i r e th i s a s s i s t a n c e a s t h e y a r e a l wa ys a t t h e s e l ev e l s . 8-19 S C HEDUL ING 8.3 RESCHEDUL ING INTERRUPT Th e I PL 3 i n te r r up t s e r v i c e r o u t i n e , S C H E D , sc h e d u l e s p r o c e s s e s fo r execut ion . Th e a c t ua l wo r k o f the s c hed ul e r i s pe r f o rm ed at I PL $ S YNC H to b l o c k c o nc u r r e n t access a nd mod i f i c a t i o n o f the s c h ed u l e r ' s d a t a b a s e b y o th e r s y s t em compo n e n t s . Th e p r i n c i pa l p u r po s e o f the s c h e d u l e r i s t o r emove t h e c u r r e n t l y e x e c u t i ng process b y s to r i ng t h e c o n t e n t s o f t h e p r o c e s s p r i v a te p r o c e s s o r ( ha r d wa r e ) r e g i s te r s a nd r e p l a c i ng th e r eg i s t e r contents wi th tho s e o f the h i g h e s t p r i o r i ty c om p u t a b l e r e s i d e n t p r o c e s s . Th i s o pe r a t i o n , k n o wn a s c o n t e x t swi tch i ng , i s a c c om p a n i e d by mod i f i c a t i o n s to the a f f ec ted processes in t e rm s o f p r o c e s s s ta te , c u r r en t p r i o r i t y , a nd s t a t e q u e ue . Ha r d wa r e C o n t ex t 8.3.1 Th e d e f i n i t i o n o f a p r o c e s s f r om t h e v i ewpo i n t o f t h e h a r d wa r e is c o n t a i ne d i n t h e h a r d wa r e c o n t e x t . Th i s c o l l e c t i o n o f d a t a i s t h e s e t o f h a r d wa r e p r o c e s s o r r eg i s t e r s who s e c o n t e n t s a re un i que to the p r oce s s . Th e s e i nc l ud e the f o l l o w i ng c a t eg o r i e s of i n f o rm a t i o n : • • t h e g e n e r a l p u r po s e r eg i s te r s , R O t h r o ug h R l l , t h e a r g um e n t po i n t e r ( AP ) , t h e f r am e po i n t e r ( F P ) , and t h e p r og r am c o u n t e r ( PC ) ; t h e pe r - p r o c e s s a c c e s s mod e s t a c k po i n t e r s fo r ke rnel , e x ec u t i v e , s upe r v i s o r , a nd u s e r s tac k s . One o f th e s e fo u r r eg i s te r s c o n t a i n s t h e c u r r e n t s t a c k po i n te r fo r t h e p r o c e s s , a s i nd i c a t e d by th e c u r r e n t m o d e f i e l d i n th e s a v ed PS L ; • t h e p r o c e s s o r s t a t u s l o ng wo r d • t h e AST l e v e l p r o c e s s o r r eg i s te r • ( PS L ) ; ( ASTLVL ) ; a nd t h e p r o c e s s pag e t a b l e r eg i s t e r s f o r the p r og r am and r eg i o n s ( P O B R , P O L R , P l B R , a nd P l LR ) . contro l W i th the e x c e p t i o n s o f the ASTLVL r eg i s t e r v a l u e a nd t h e c o n t e n t s o f t h e m em o r y m a n ag em e n t r eg i s t e r s fo r t h e p r og r am and c o n t r o l r eg i o n s , t h e c u r r e n t v a l u e s f o r the var ious r eg i s t e r s f o rm i ng the h a r d wa r e c o n te x t o f the c u r r e n t p r o c e s s a r e m a i n t a i n ed o n l y i n t h e p r o c e s so r r eg i s t e r s . Wh en a p r o c e s s i s n o t ex e c u t i ng , t h e c omp l e t e h a r d wa r e conte x t i s c o n t a i n ed in a po r t i o n o f t h e p r o c e s s h e a d e r c a l l ed the h a r d wa r e p r o c e s s c o n t r o l b l o c k . 8-20 S CHEDUL ING Th e h a r d wa r e p r o c e s s c o n t r o l b l o c k ( F i g u r e 8 - 6 ) i s a pa r t o f t h e f i x ed po r t i o n o f the p r o c e s s h e ad e r fo r e a c h p r o c e s s . I t i s r e s i d en t i n m em o r y wh e n ev e r t h e c o r r e s po nd i ng process is i n t h e b a l anc e set . Ac c e s s b y t h e o pe r a t i ng s y s t e m o c c u r s n o rma l l y th r o ug h o f f s e t s f r om t h e s t a r t i ng a d d r e s s o f t h e p a r t i c u l a r p r o c e s s h e ad e r . Howe v e r , d u r i ng c o n t e x t swi t c h i ng o pe r a t i ons t h e h a r d wa r e m u s t a c c e s s th i s d a t a s t r uc t u r e d i r ec t l y w i tho u t a d d r e s s t r a n s l a t i o n . Th i s i s a c c o m p l i shed by u s i ng the c u r r en t v a l u e in the p r o c e s s c o n t r o l b l o c k b a s e r eg i s te r ( PR $ P C B B ) . Th i s r eg i s te r conta ins the phys i c a l add r e s s o f the h a r d wa r e process control b l o c k f o r the c u r r e n t l y e x e c u t i ng p r o c e s s . VM S s t o r e s t h e phys i c a l a d d r e s s o f t h e h a r d wa r e p r o c e s s c o n t r o l block fo r e a c h r e s i d e n t p r o c e s s ( c a l c u l a t e d wh e n the p r o c e s s i s swa pped i n to memo r y ) in the PC B $ L PHYPCB f i e l d of the c o r r e s pond i ng so f twa r e p r o c e s s c o n t r o l b l o c k (F i g u r e 8 - 1 ) . 31 Hardware PCB KSP ESP SSP USP RO R1 R2 R3 R4 RS R6 R7 R8 R9 R 10 R11 FP PC PSL POBR 0 I PR$_PCBB I The process control block base register contains the physical address of this structure for the currently executing process AP 26 25 24 21 XI ��� IX1 1 ><J 2 P1BR Figure 8-6 0 POLR 0 P 1 LR H a rdwa r e P r o c e s s Co n t r o l B l o c k 8-2 1 SCHEDUL ING Remov a l of C u r r e n t P r o c e s s f r om E x e c u t i on 8.3.2 Th e e n t r y po i n t S C H $ R E SC HE D i n the m o d u l e SCHED p e r f o rm s the o pe r a t i o n s of r e sc h ed u l i ng , p r e s e r v i ng the h a r d wa r e c o n t e x t o f t h e c u r r e n t l y e x e c u t i ng p r o c e s s a nd r emov i ng i t f r om e x e c u t i o n . Th i s is a c c ompl i s hed b y t h e f o l l o w i ng s t e p s . 1. Th e h a rd wa r e c o n t e x t o f t h e c u r r en t p r o c e s s i s s av ed b y t h e SVPCTX i n s t r uc t i o n . Th e d e s t i n a t i o n o f t h e d a ta i s t h e h a r dwa r e p r o c e s s c o n t r o l b l o c k wh o s e phys i c a l add r e s s is c o n t a i ne d in the process control block base r eg i s t e r , PR $ PCBB . Ad d i t i o n a l o p e r a t i o n s o f the S VPC TX i n s t r uc t i o n a r e-d e sc r i b ed i n S e c t i o n 8 . 3 . 5 . 1 . 2. Th e a d d r e s s o f the s o f twa r e p r o c e s s c o n t r o l bloc k fo r the c u r r e n t p r o c e s s i s o b t a i n ed f r om t h e po i n t e r S C H $G L CURPC B i n t h e modul e S DAT . ( A s i ng l e l o ng wo r d po i n t e r i s r e qu i r e d fo r t h e c ur r e n t state ( C UR ) , r a th e r t h a n a qua d wo r d l i s th e a d , b e c a us e t h e r e i s o n l y o n e c u r r e n t p r o c e s s a nd no t a que ue of s e v e r a l s uc h p r o c e s s e s . ) 3. Th e c u r r e n t p r i o r i t y o f t h e p r o c e s s i s d e te rm i n ed f r om the PC B $ 8 PR I f i eld . Th i s i s u s ed to d e t e rm i n e wh i c h of the r e s i d en t c omp u t a b l e s t a te que ue s i s to i nc l ud e th i s PC B . Th e p r o c e s s i s i n s e r ted a t t h e t a i l o f t h e c o r r e s po nd i ng p r i o r i t y queue . 4. Th e s t a t e o f the p r o c e s s i s c h a ng ed to upd a t i ng the PC B $W_S TATE f i e l d . At th i s po i n t , the r e i s n o c u r r e n t p r o c e s s , a nd next p r o c e s s to e x e c u t e b eg i n s . 8 . 3.3 comput a b l e ( C OM ) by the for the search S e l e c t i o n o f Nex t P r o c e s s f o r E x e c u t i o n Th e e n t r y p o i n t S C H $ S C HE D b eg i n s t h e po r t i o n o f c o d e th a t s e a r c h e s f o r the next process to be s c h e d u l ed fo r exec ut i o n . Und e r some c i r c um s t a nc e s ( s uc h as s y s t em i n i t i a l i za t i o n , p l a c i ng the p r ev i o u s process i n to a wa i t s t a t e , o r d e l e t i o n o f t h e p r ev i o u s p r o c e s s ) th e r e m a y no t b e a c u r r e n t p r o c e s s t o b e s a v e d b y SCH$RESC H ED . In th e s e c ases , s ys tem rout ines t r ansfe r c o n t r o l d i r e c t l y to SC H $ S C HED f o r p r oc e s s se l ec t i on . ( Th e d i f f e r e n c e b e twe e n t h e two e n t r y po i n t s is d e t e rm i n ed b y wh e th e r the p r ev i o u s p r o c e s s i s s t i l l computab l e . Typ i c a l l y , a p r o c e s s e n t e r i ng a wa i t state wi l l c a use entry a t S C H $ S C H E D wh i l e a h i g h e r p r i o r i ty p r o c e s s b e c o m i ng comput a b l e w i l l c a use e n t r y ( v i a a so f twa r e i n t e r r up t ) a t S C H $ R E SCHED . ) Th e SC H$RE SCHED l o g i c f l o ws d i r e c t l y i n to SC H $ S C HE D . As wi th r e sched u l i ng , the s e a r c h f o r and mod i f i c a t i o n o f the nex t p r o c e s s to be e x e c uted m u s t be pe r fo rm e d at I P L $ S YNC H to b l o c k o th e r po t e n t i a l s y s t em o pe r a t i o n s o n t h e sc h ed u l e r d a ta b a s e . 8-22 SCHEDUL ING Th e fo l l o wi ng ope r a t i o n s a r e i nvo l ved i n s e l e c t i ng a n d next process . 1. e x e c u t i ng the Th e f i r s t s o f twa r e p r o c e s s c o n t r o l b l o c k ( PCB ) i n t h e h i g h e s t p r i o r i t y n o n em p t y c om p u t a b l e r e s i d e n t ( C OM ) s t a t e que ue i s r emoved f r om t h e q u e u e a nd po i n t ed to b y S C H $G L CURPC B a s t h e cur rent process . Co n s i s t e n c y c h e c k s a r e m a d e to e n s u r e tha t the q u e ue r e a l l y h a d a t l e a s t o n e PC B a n d th a t t h e d a t a s t r uc t u r e r emoved wa s a c t ua l l y a PCB . Fa i l u r e o f e i th e r o f t h e s e t e s t s r e s u l t s i n a f a t a l b ug chec k ( BUG $_Q U E UEMPTY ) • 8. 3. 4 2. Th e s t a t e o f t h e pr o c e s s i s m a d e c u r r e n t by i n s e r t i ng the a pp r o p r i a t e v a l ue ( S C H$C_C UR ) i n t o the PC B $W S TATE f i e l d . 3. Th e c u r r e n t p r o c e s s p r i o r i t y i s e x am i n ed a nd po t e n t i a l l y mo d i f i e d . I f t h e pr o c e s s i s a r e a l - t i me p r o c e s s o r i f i t i s a no rma l p r o c e s s a l r e a d y a t i ts b a se pr i o r i ty , t h en the process is s c h e d u l ed a t i t s c u r r ent o r b a s e p r i o r i t y ( th e y a r e t h e s am e ) . If the cur rent process is a no rma l process a b ove i ts base pr i o r i ty , t h en a d e c r e a s e o f o n e so f twa r e p r i o r i t y l evel i s pe r f o rmed b e fo r e s c h ed u l i ng . Th us , p r i o r i ty " d em o t i o n s " a l wa ys o c c u r b e fo r e e x e c u t i o n , a n d a p r o c e s s e x e c u t e s a t the p r i o r i t y o f the q u e u e to wh i c h it wi l l be r e turned ( a nd not the p r i o r i t y o f t h e que ue f r om wh i c h i t wa s r emove d ) . See Figure 8-2 , event 2 fo r an e x ampl e . 4. Th e phys i c a l a d d r e s s o f the h a r d wa r e p r o c e s s con t r o l bloc k for the s c h ed u l ed process is l o ad e d i n to the PR $ PC B B r eg i s t e r f r om t h e so f t wa r e p r o c e s s c o n t r o l b l o c k PC B $ L PHYPC B f i eld and a l o ad process c o n t e x t , LDPC TX , i n s t r uc t i o n i s e x e c u ted ( S e c t i o n 8 . 3 . 5 . 2 ) . 5. Co n t r o l i s p a s s e d to the s c h ed u l ed p r o c e s s by e x e c u t i ng an RE I i n s t r uc t i o n . Th i s is po s s i b l e b e c a u s e the LDPCTX i n s t r uc t i o n l e f t the PC and PS L o f the sched u l ed p r o c e s s o n the k e r n e l s t a c k . Pa s s i ng c o n t r o l to the p r o c e s s t h r o ug h t h e RE I i n s t r uc t i o n u s u a l l y • d r ops t h e i nt e r r up t pr i o r i t y l evel f r om I PL $_S YNC H , • c h a ng e s the a c c e s s m o d e f r om k e r n el to a l e s s one , and p r i v i l eg ed • p e rm i t s t h e po te n t i a l d e l i v e r y o f o n e o r mo r e Ch a p t e r 5 ) . ASTs ( se e S umma r y Lo ngwo rd a nd Comput a b l e S t a t e Que u e s Th e s e a r c q fo r t h e h i g h e s t p r i o r i t y c om p u t a b l e re s i d ent process and the r emova l of i ts PC B f r om the c om p u t a b l e s t a t e ( C OM ) q u e ue i s a c h i e v e d i n th r e e i n s t r uc t i o n s ( F i g u r e 8 - 7 ) . Th e e f f i c i e n c y o f th i s o pe r a t i o n i s d ue to the i n s t r uc t i o n s e t a nd the d e s i g n o f the s c h e d ul e r d a t a b a s e fo r t h e comput a b l e ( C OM ) and compu t a b l e o u t s wa pped ( c OM 0 ) s t a t e s ( F i g u r e 8 3 ) - • 8-23 RESC HEDUL ING INTERRUPT HANDLER SC H$RESCHED R ESCHEDULING INTERRUPT HANDL SCHED V 0 2 -0 0 1 (X) 51 O O O O ' CF 52 08 Al 52 0 0 O O O O ' CF oc 2C A 1 0000 'CF42 53 61 93 I N � 52 OOOO 'CF 53 20 00 3D 0000 'CF42 54 93 3C 06 07 DO 9A E2 BO 7E OE EA 13 7E OF 1D 12 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0003 0004 0009 O O OD 001 3 0017 0 0 1D 0020 0020 0020 0020 0020 0020 0020 0020 0020 0023 0 0 2A 0 0 2C 0032 0035 0037 6 -APR-1 9 8 0 1 9 : 4 4 : 4 1 VAX-1 1 Mac ro V0 2 . 4 5 Pag e 1 -APR - 1 98 0 1 0 : 2 4 : 4 5 _DBB O : [ E XEC . SRC ] SC HED . MAR ; 3 3 (1) SBTTL SCH$RESCHED RESCHEDULING INTERRUPT HANDLER 41 42 ; ++ 43 S CH$R ESCHED - RESCHEDULING INTERRUPT HANDLER 44 THIS ROUT INE I S ENTERED VIA THE I PL 3 RESCHEDULING INTERRUPT . 45 T H E VECTOR FOR THIS INTERRUPT IS CODED TO CAUS E EXE C UT ION 46 ON THE KERNE L STAC K . 47 48 ENVIRONM ENT : 49 I PL=3 MODE=KERNE L I S=O 50 INPUT : 51 O O ( S P ) =PC AT RESC HEDULE INTERRUPT 52 04 ( S P ) =PS L AT INTERRUPT . 53 54 . ALIGN LONG 55 ; RESC HEDULE INTERRUPT HANDLER 5 6 SC H$R ESCHED : : ; S YNC HRON I Z E SC HEDULER W ITH EVENT R E PORT ING S E T I PL # I PL$ SYNC H 57 ; SAVE CONTEXT OF PROC ESS SVPC TX 58 WA SCH$GL C URPCB , R1 ; G ET ADDRESS OF CURRENT PCB MOVL 59 ; C URRENT PR I OR ITY MOVZ BL PCB $8 PRl ( R l ) , R2 60 ; MARK QUE UE NON-EM PTY B B SS R 2 , WASCH$GL C OMQS , 1 0 $ 61 #SCH$C C OM , PC B $W S TATE ( R 1 ) ; S ET STATE TO RES COM PUTE 62 1 0 $ : .l\1 0VW ; C OM PUTE ADDRESS O F QUE UE WA SC H $AQ C OMT [ R 2] , R 3 MOVAQ 63 ; INS ERT AT TA I L OF QUEUE INS QUE ( R 1 ) , @ ( R3) + 64 65 66 ; + SCH$SCHED - SC HEDULE NEW PROC ESS F OR EXEC UT I ON 67 11 8 , 6 9 ; T H IS ROUT INE S E LECTS THE H IGHEST PR IOR ITY EXEC UTABLE PROC ESS 7 0 ; AND PLAC ES IT IN E XECUT ION . 71 ; ; SCHE DULE FOR EXECUT ION 7 2 S C H$SCHED: : ; S YNCHRON I Z E SC HEDULER WITH EVENT REPORT ING S ET I PL # I PL$ SYNC H 73 # 0 , # 32, WA SCH$GL COM QS , R2 ; F IND F IRST F ULL S TATE FFS 74 SCH $ I DLE ;NO EXECUTAB LE PROC ES S ? ? B EQL 75 ; C OM PUTE QUE UE HEAD ADDR ESS WA SC H$AQ C OMH [ R 2 ] , R 3 MOVAQ 76 ; G ET HEAD OF QUE UE REM QUE @ ( R 3 ) + , R4 77 ; BR I F QUE UE WAS EM PTY ( B UG C HE C K ) QEMPTY BVS 78 ; Q U E U E NOT EM PTY BNEQ 79 20$ Figure 8-7 • S c h ed u l e r Ro u t i n e Th a t Se l e c t s Nex t Execut i o n Cand i d a t e 00 O O O O ' CF 52 E5 OA A 4 oc 91 2E 2C A4 OE OOOO 'CF 54 OB A 4 2F A4 08 04 03 OB A4 OB A4 O O O O ' CF OB A4 10 18 A4 12 BO DO 91 13 E1 96 90 DA 06 02 0039 0 0 3F 003F 004 3 0045 004 9 004E 0053 0053 0055 0 0 5A 0 0 5D 0063 0067 0068 0069 0069 0069 80 81 82 83 84 85 86 BBCC 20$ : C M PB BNEQ M OVW M OVL C M PB 87 B E QL 88 89 BBC I NC B 90 91 30$ : M OVB 92 M T PR L D PC TX 93 REI 94 95 9 0 S C H $ I DLE : S E T I PL 97 R 2 , WA SC H $G L C OM QS , 2 0 $ _ ; S E T QU E UE EM PTY ' ; M U S T B E A PR OC E S S C ONTR O L B LOC K # D YN $C_PC B , PC B $B_T Y PE ( R 4 ) ; OT H E RW I S E FATA L E R R OR QEM PT Y # S C H $ C C UR , PC B $W S TATE ( R 4 ) ; S ET S TATE TO C UR R E NT R 4 , WA SCH $G L C UR PCB ; N OTE C UR R ENT PC B LOC PC B $B_PR I B ( R4 ) , PC B $B_PR I ( R 4 ) ; C H E C K F OR B A S E ; PR I OR I T Y=C URR ENT ; Y E S , DONT F LOA T PR I OR I T Y 3 0$ ; DONT F LOAT R EA L T IM E PR I O R I T Y # 4 , PC B $ B P R I ( R 4 ) , 3 0 $ ; M OVE TOWAR D B A S E PR I O PC B $B PRI ( R 4 ) _ PC B $ B PR I ( R 4 ) , WA S C H $G B PR I ; S ET G L O B A L PR I O R I T Y PC B $ L=P H Y PC B ( R 4 ) , # P R $_PC B B ; S E T PC B BAS E PHYS ADDR ; R E S TOR E C ONTEXT ; N ORMAL R ETURN # I P L $ _S C H E D ; N O AC T I VE , E X E C UTAB LE PR OC ES S ; DR O P I PL T O S C HE DU L I NG L E VE L C/l n ti: t'Z'J t:1 c: t""' (X) I 1\.) U1 2! (j') H SCHED V 0 2 -0 0 1 R E S C H E DU L I NG I NT E R R U PT HAND L E R S C H $ R E S C H E D R ES C H E D U L I N G I NT E R R UPT HANDL O O O O ' CF 20 AD 90 11 0 0 6C 0071 0073 0073 0077 0077 F i g u r e 8-7 98 99 1 00 1 0 1 QEM PT Y : 1 02 1 03 ( Co n t . ) M OVB B RB 6 -A PR - 1 9 8 0 1 9 : 4 4 : 4 1 1 -A PR - 1 9 8 0 1 0 : 2 4 : 4 5 # 3 2 , WA SC H $G B_PR I SC H $ S C H E D B UG C HE C K Q U E UEM PT Y , FATA L Pag e VA X - 1 1 Ma c r o V0 2 . 4 5 D B B O : [ E XE C . SRC ] S C HE D . MAR ; 3 _ ; S E T PR I OR I T Y TO - 1 ( 3 2 ) ; AND T R Y AGA I N ; S C HE DU L I NG QU E UE EM PTY . EN D S c h ed u l e r Ro ut i n e Th a t S e l e c t s Ne x t Ex e c u t i o n C a n d i d a t e TO S I GNA L I DL E 4 (1) S CHEDUL ING (1) A f i nd f i r s t s e t ( FF S ) i n s t r uc t i o n wi l l l o c a te the l east s ign i f icant set b i t i n t h e l o ng wo r d S C H $G L COM QS . Th e l o c a t e d b i t po s i t i o n i nd i c a t e s th e h i g h e s t p r i o r it y n o n em p t y computab l e r e s i d e n t s t a t e q u e ue . Th e swa ppe r ' s s e a r c h f o r t h e f i r s t PC B i n th e h i g h e s t p r i o r i ty n o nempty c om p u t a b l e o u t s wa pped ( C OMO ) q u e ue us e s the same o pe r a t i o n s ( Ch a pt e r 1 4 ) . On e r e a s o n f o r s to r i ng t h e so f twa r e p r i o r i t y i n i nv e r t e d or 3 1 -c ompl em e n t fo rm s h o u l d b e o bv i o u s . By m a k i ng bit 0 c o r r e s po nd t o so f twa r e p r i o r i t y 3 1 , a nd so on , the h i ghest p r i o r i t y q u e ue s w i l l be s c anned f i r s t . Conve r s i o n i n t h e v a r i o u s us e r i n t e r f a c e s o c c u r s b e c a u s e s ys t em s a nd use r s g ene r a l l y a s soc i a te h igher p r i o r i t y n um b e r s wi th h i g h e r p r i o r i t y j o b s , t a s ks , o r p r o c e s s e s . (2) Th e l i s t h e a d o f t h e s e l e c t ed comput a b l e r e s i d e n t que ue is f o und by u s i ng t h e no n em p t y q u e ue b i t po s i t i o n a s a n i nd ex i n to t h e c o n t i g uo u s l i s th e ad s . (3) Th e f i r s t PC B i n t h e s e l e c t ed que ue i s r em o v e d by r e f e r e nc e t h r o ug h t h e fo r wa r d l i n k o f t h e l i s th e ad . (4) in t h e q u e ue , the I f t h e r emoved PC B wa s the onl y one c o r r e s po nd i ng SC H$G L C OMQS b i t m u s t n o w b e c l e a r ed b e c a us e t h e q u e ue i s now empty . 8.3. 5 i nd i r e c t Ha r d wa r e As s i s t a n c e i n C o n t e x t S w i t c h i ng Th e VAX a r c h i tec t u r e wa s d e s i g n ed to a s s i s t t h e so f twa r e i n pe r f o rm i ng One ex ampl e i s t h e d e l i v e r y critical , c o mmo n l y p e r f o rmed o pe r a t i o n s . o f a s yn c h r o no u s s y s t em t r aps th r o ug h t h e R E I i n s t r uc t i o n ( Ch a p t e r 5 ) . Th e m e c h a n i sm o f r e p l a c i ng t h e h a r d wa r e c o n t e x t o f t h e c u r r e n t p r o c e s s wi th t h e c o n t e x t o f t h e h i g h e s t p r i o r i t y r e s i d e n t p r o c e s s is a n o th e r e x amp l e o f h a r d wa r e a s s i s ta n c e t o t h e o pe r a t i ng s ys t em . Th e s w i t c h i ng o f h a rd wa r e c o n t e x t i s pe r f o rmed by t wo spec i a l pu r po s e i n s t r uc t i o n s , SVPC TX a nd LDPCTX . 8. 3. 5. 1 S VPCTX I n s t r uc t i o n - Th e s a v e process c o n te x t i n s t r uc t i o n , SVPCTX , p e r fo rm s s e v e r a l o pe r a t i o n s and a s s um e s a spec i a l s e t o f i n i t i a l and f i n a l c o nd i t i o n s . Th e fo l l o wi ng initial c o nd i t i o n s are a s s um ed . 1. Th e c u r r e n t a c c e s s m o d e m u s t b e k e r n e l . 2. Th e p r og r am c o un t e r ( PC ) a n d p r o c e s s o r s t a t u s l o ng wo r d ( PS L ) a r e o n t h e c u r r e n t s t a c k ( e i th e r ke r n e l o r i n t e r r up t s t a c k ) . I f t h e SVPC TX i n s t r uc t i o n th a t ex e c u t e s i s the one in the r e sc h e d u l i ng i n t e r r up t s e r v i c e r o u t i n e , t h e PC a nd PS L a r e o n t h e k e r n e l s t a c k a s a r e s u l t o f t h e I PL 3 s o f twa r e i n t e r r up t . 3. Th e p r o c e s s c o n t r o l b l o c k b a s e r eg i s t e r ( PR $ PC B B ) c o n ta i n s t h e ph ys i c a l ad d r e s s o f t h e h a r d wa r e PC B-f o r t h e c u r r en t p r o c e ss . 4. Th e c u r r e n t v a l u e s o f ASTLVL , P O B R , P O L R , P l B R , a nd P l LR a l r e ady s to r ed i n t h e h a r d wa r e PC B . 8-2 6 are SC HEDULING Th e o pe r a t i o n s o f t h e SVPC TX i n s t r uc t i o n i n c l ud e 1. m o v i ng t h e p e r - p r o c e s s s ta c k po i n t e r s m o d e s t a c k s t o t h e ha r d wa r e PC B , fo r the fo u r access 2. m o v i ng t h e g e n e r a l p u r po s e r eg i s te r s , RO t h r o ug h R l l , the a r g um e n t po i n te r ( AP ) , a nd the f r am e po i n te r ( FP ) to the h a rdwa r e PC B , a nd 3. po pp i ng t h e p r og r am c o un t e r ( PC ) a nd the process s t a t us l o ngwo r d ( P S L ) f r om t h e c u r r e n t s t ac k to th e h a r d wa r e PC B . Fi nal ly , i f the c u r r en t s tac k i s the k e rne l stac k , the S VPC TX i n s t r uc t i o n saves t h e c u r r e n t s t ac k po i n t e r ( S P ) in th e k e r n e l s t a c k f i e l d o f t h e h a r d wa r e process control b l o c k a nd swi t c h e s to the i n te r r up t stac k ( by s e t t i ng t h e PS L$V I S b i t a nd c o py i ng th e PR $ I S P r eg i s t e r c o n t e n t s i n to the S P r eg i s te r ) � Swi tch i ng to the s ys tem-w i d e i n t e r r up t s t a c k i s e s se n t i a l b e c a u s e the r e i s n o c u r r e n t p r o c e s s o n c e t h e i n s t r uc t i o n c om p l e t e s . Th e ASTLVL , P O B R , P O L R , P l B R , a nd P l L R f i e l d s o f t h e h a r d wa r e process control b l o c k a r e n o t c h a ng ed . It is the r e s po n s i b i l i t y o f t h e v a r i o us s ys tem compo n e n t s t h a t a l t e r th e s e f ields to a l wa ys upd a t e b o th t h e h a r d wa r e p r o c e s s c o n t r o l b l o c k f i e l d s a nd the pe r - p r o c e s s p r o c e sso r r eg i s t e r s . AST LVL i s un u s ua l i n th a t i t c a n b e a l t e r e d e v e n wh en the p r o c e s s i s n o t c u r r e n t . I n th a t c a s e , o n l y t h e h a r d wa r e PC B f i e l d i s a l te r ed . Th e p r o c e s so r r eg i s t e r i s no t a l t e r e d b e c a u s e the p r o c e s s d o e s no t o wn t h a t r eg i s te r wh e n i t i s n o t t h e c u r r e n t pr o c e s s . Th e s e f i e l d s d o n o t c h a n g e f r e q ue n t l y c o mpa r ed to the f r equency o f context swi tch i ng . Th e o v e r h e a d of s t o r i ng the s e f i e l d s i n the h a r d wa r e p r o c e s s c o n t r o l b l o c k i s i n c u r r ed o n l y wh e n the f i e l d v a l ue s c h a ng e . Th e SVPC TX i n s t r u c t i o n o c c u r s i n s e v e r a l l o c a t i o n s i n th e e x e c u t i v e . • Th e r e s c h ed u l i ng i n t e r r up t serv i c e rout i ne conta ins the i n s t a n c e o f th i s i n s t r uc t i o n wh e n t h e c u r r e n t p r o c e s s r em a i n s c omp u t a b l e a f t e r i t i s r emove d f r om ex e c u t i o n . • Mo d u l e S YSWA I T c o n t a i n s ano the r ex ampl e o f the i n s t r uc t i o n wh en th e c u r r e n t p r o c e s s i s b e i ng pl a c ed i n to a s c h e d u l i ng wa i t s t a t e . • Th e pag e r ( mo d u l e PAG E FAULT ) i s s ue s a SVPCTX i n s t r uc t i o n d i r e c t l y wh e n it pl aces a p r o c e s s i n t o o n e o f t h e m emo r y m a n a g em e n t wa i t s t a t e s ( P FW , FPG , C O L PG ) . • On e o f t h e l a s t s t e ps o f p r o c e s s d e l e t i o n i nv o l v e s the process b e i ng d e l e t ed f r om ex e c u t i o n wi th i n s t r uc t i o n . r em o v i ng a SVPC TX 8.3.5.2 LDPC TX I n s t r uc t i o n - Th e l o ad process contex t i n s t r uc t i o n , LD PC TX , p e r f o rm s t h e o pe r a t i o n s r e q u i r ed i n e s t a b l i s h i ng the h a r d wa r e c ontext o f the p r o c e s s . As wi th the SVPC TX i n s t r uc t i o n , a s s um p t i o n s a r e mad e abo u t t h e i n i t i a l a nd f i n a l c o nd i t i o n s o f t h e i n s t r uc t i o n . Th e fo l l o wi ng i n i t i a l c o nd i t i o n s a r e a s s um e d . 1. Th e p r o c e s s o r mus t be i n k e r n e l mo d e , u s i ng e i th e r t h e k e r n e l or the i n t e r r up t s t ac k . ( Th e p r o c e s s o r i s a l wa ys o n t h e stack for the one o cc ur r ence of the LDPCTX i n t e r r up t i n s t r uc t i o n i n VM S . ) 8-27 S CHEDUL I NG 2. Th e p r o c e s s c o n t r o l b loc k b a s e r eg i s t e r ( P R $ PC B B ) mus t conta i n t h e phys i c a l ad d r e s s o f t h e h a r d wa r e p r o ce s s c o n t r o l b l o c k to b e u s ed ( f r om t h e PC B $ L PHYPC B f i e l d o f t h e so f t wa r e process control bloc k ) - • Th e LDPCTX i n s t r uc t i o n i nc l ud e s t h e fo l l o w i ng o pe r a t i o n s . 1. Th e pe r - p r o c e s s h a l f of the trans l a t ion buffer is i nva l i d a t e d . Al l o f t h e p r ev i o u s t r a n s l a t i o n b u f f e r e n t r i e s b e l o ng ed to t h e p r e v i o u s p r o c e s s . Th ey a r e i nv a l i d a t e d to p r e v e n t m i s t r a n s l a t i o n o f v i r t u a l add r e s s e s a nd to p r o t e c t t h e d a t a o f t h e p r ev i o u s p r o c e s s . 2. Th e p e r - p r o c e s s a c c e s s m o d e s t a c k po i n te r s ( KS P , ESP, SSP , a nd US P ) a r e l o ad ed f r om t h e h a r d wa r e p r o c e s s c o n t r o l b l o c k . 3. Th e g e n e r a l p u r po s e r eg i s t e r s , R O t h r o ug h R l l , the a r g um e n t po i n te r ( A P ) , a nd t h e f r am e po i n t e r ( F P ) a r e l o ad ed i n to the c o r r e spond i ng p r o c e s s o r r eg i s t e r s . 4. Th e mem o r y m a n a g em e n t m a p p i ng r eg i s t e r s ( P OBR , P OLR , PlBR, a nd P l LR ) are c h e c k e d f o r l eg a l va l u e s a n d l o ad ed f r om the h a r dwa r e p r o c e s s c o n t r o l block . No t e th a t a l tho ug h the S VPCTX i n s t r uc t i o n d o e s not s a v e t h e s e r eg i s te r s , t h e LDPCTX m u s t l o a d t h em . Un t i l t h e y a r e l o ad ed , the v a l ue s in the r eg i s t e r s b e l ong to th e p r ev i o u s p r o c e s s . 5. Th e AS TLVL r eg i s t e r i s l o ad ed . Th i s r eg i s t e r s a v e d by t h e SVPCTX i n s t r uc t i o n . 6. 7. wa s a l so not I f the i n s t r uc t i o n b eg a n e x e c u t i o n u s i ng th e i n t e r r upt s t a c k , t h e n t h e fo l l ow i ng o pe r a t i o n s a r e pe r f o rmed . • Th e c o n t e n t s o f t h e c u r r e n t s t a c k po i n t e r r eg i s t e r (SP) a r e s a v e d i n the i n t e r r upt s t a c k po i n t e r r eg i s te r ( I S P ) . • Th e PS L $V I S b i t i s c l e a r e d to i nd i c a t e the s w i t c h to the ke r n e l s tac k . • Th e c u r r e n t s t a c k po i n te r i s u pd a t ed w i th t h e c o n t e n t s o f t h e k e r n e l s t a c k po i n te r r eg i s t e r ( KS P ) . F i n a l l y , t h e s a v e d p r o g r am c o un t e r ( PC ) a nd p r o c e s s o r s ta t us l o ngwo r d ( PS L ) are pushed onto the k e r n e l s t a c k f r o m the h a r d wa r e p r o c e s s c o n t r o l b l o c k . Th e s e v a l u e s a r e no t s to r ed i n to the a pp r o p r i a t e r eg i s t e r s . Th i s pa r t i c u l a r o pe r a t i o n o c c u r s b e c a u s e t h e n ex t i n s t r uc t i o n ( in the sched ul e r r o ut i n e ) i s e x p e c ted t o b e a n R E I i n s t r uc t i o n . Th e RE I pops t h e two l o ng wo r d s , v e r i f i e s t h e PS L fo rm a t , and i ns e r t s the t wo l o ng wo r d s i n to t h e a pp r o p r i a t e r eg i s t e r s . Th e o n l y o c c u r r e n c e o f a LDPC TX i n s t r uc t i o n i n t h e e n t i r e VM S s ys tem is the one s h o wn i n F i g u r e 8 - 7 , the s e c o nd h a l f of t h e r e s c h ed u l i ng i n te r r up t s e r v i c e r o u t i n e . 8-28 C HAPTER 9 PROC E S S C ONTROL AND C OMMUN I CAT I ON VM S p r ov i d e s m a n y s e r v i c e s that a l l ow mul t i pl e processes to c ommun i c a t e a nd a l low one p r o c e s s t o c o n t r o l th e e x e c u t i o n of a no t h e r . Eve n t f l ag s a r e t h e m o s t p r i m i t i ve cont r o l a nd c ommun i c a t i o n tool ava i l ab l e ( in t e rms o f a m o u n t o f i n f o rm a t i on ) . O th e r c ommu n i c a t i o n t e c h n i que s i nc l ud e l og i c a l names , m a i l bo x e s , g lobal s h a r ed d a t a sect ions , a n d s h a r ed f i l e s . Sys t e m s e r v i c e s a l l o w a p r o c e s s to a l t e r s o m e o f i t s p a r am e t e r s ( s u c h a s name o r p r i o r i t y ) . Oth e r s e rv i ce s a l l o w a p r o c e s s to a f f e c t t h e sc h ed u l i ng s t a t e o f i t s e l f o r a n o t h e r process . A s umma r y o f p r o c e s s c o n t r o l s y s tem s e r v i c e s is l i sted in Tab l e 9 - 1 . 9.1 E VENT FLAG S E RVI C E S E v e n t f l ag s a r e u s ed w i th i n a s i ng l e p r o c e s s fo r synch r o n i z a t i o n o f I /0 r e qu e s t s , $G E TJ P I s y s t em s e rv i c e c a l l s , and t i m e r r e que s t s . Th e y c a n a l s o b e u s ed e i th e r w i t h i n a s i ng l e p r o c e s s or among seve r a l processes in the same g r o up a s a ppl i c a t i o n - s p e c i f i c s yn c h r o n i z a t i o n to o l s . Sys tem s e r v i c e s a re p r ov i d ed to r ead , se t , or clear c o l l ec t i o ns o f event f l ag s . Oth e r s e rv i c e s a l l o w a p r o c e s s t o wa i t fo r one o r a col l e c t i o n o f event fl ags . 9.1. 1 Lo c a l E ve n t F l ag s Each process h a s ava i l ab l e t o i t 64 local { p r o c e s s - s pec i f i c ) event f l ag s a nd 64 s h a r ea b l e event f l ag s ( among p r o c e s s e s i n the s a m e g r o up ) . Th e 6 4 l o c a l e v e n t f l ag s a r e s t o r ed d i r e c t l y i n the so f twa r e PCB , a t o f f s e t s PC B $ L E F C S a nd PC B $ L E FC U ( F i g u r e 9 - 1 ) . Loc a l e v e n t f l ag s 0 to 3 1 a r e l o c a ted i n l o ng wo r d PC B $ L E FCS . Loc a l ev e n t f l ag s 3 2 t o 6 3 a r e l o c a t e d i n l o ngwo r d PC B $ L_E FCU� 9.1.2 Common Eve n t F l a g s Commo n e v e n t f l ag c l us t e r s d o n o t i n i t i a l l y ex i s t . Th e y m u s t b e c r e a ted by the f i rst process th a t c a l l s t h e As s o c i a t e E v e n t F l ag C l u s t e r s y s t e m s e r v i c e fo r a g i v e n c l u s te r . Th i s s e r v i c e a l l o c a t e s a s t r uc t u r e c a l l ed a c ommo n e v e n t b l o c k ( F i g u r e 9 - 2 ) f r om n o n pa g ed po o l a nd l o ad s i t s a d d r e s s i n t o the PC B p o i n t e r f i e l d ( e i th e r P C B $ L E FC 2 P or PCB $ L E FC 3 P ) . Th e c ommo n e v e n t b l o c k i s l i n k e d i n to a s ys tem w i d e l i s t o f commo n e v e n t b l o c k s l o c a t ed b y g l o ba l l i s th e a d S C H $ G Q C E BHD ( Fi g u r e 9 - 3 ) . 9-1 PROC E S S C ONTROL AND C OMMUN ICAT ION Table 9 - 1 Summa ry o f P roce s s Contro l S y stem Serv i c e s Af f e c t O t h e r P r o c e s s e s Pr i v i l eg e Ch ec ks C r e a te Common Ev e n t Fl ag C l u s t e r S a m e g ro up o n l y De l e t e Comm o n Ev e n t Fl ag C l us t e r Same g r o up o n l y PRMCEB ( fo r pe rman e n t c l us t e r s o n l y ) PRMCEB Se r v i c e Name Wa i t fo r S i ng l e Eve n t F l ag Wa i t fo r Log i c a l AND o f E v e n t F l ag s Wa i t fo r Log i c a l O R o f Ev e n t Fl ag s (1 ) No n e G R O U P o r WORLD Hi bernate Wa ke No YES S c h ed u l e Wa k e up C a n c e l Wa k e up YES YES GROUP o r WORLD GROUP o r WORLD S u s pend R e s um e YES YES GROUP o r WORLD GROUP o r WORLD Ex i t Fo r c ed Ex i t No YES No n e GROUP o r WORLD C r ea t e Proc ess YES De l e t e P r o c e s s YES DETAC H fo r o t h e r tha n s ub p r o c e s s e s G R O U P o r WORLD Set Se t Se t Set Se t Se t Set No No YES No No No No Ac c es s Mo d e Ch ec k Ac c es s Mo d e Ch e c k G R O U P o r WORLD No n e No n e PSWAPM Ac c e s s Mo d e Ch e c k A S T En a b l e Powe r Rec ov e r y AST P r i o r i ty P r o c e s s Name Re so ur c e Wa i t Mo d e Swa p Mo d e Sys t em Fa i l u r e Mod e G e t Jo b/ P r o c e s s (1) (2) In fo rm a t i o n (2) (2) ( 2) YES GROUP o r WORLD As pa r t of the C r e a t e P r o c e s s s ys tem s e rv i c e , a pr o c e ss c an spec i fy tha t the p r o c e s s b e i ng c r ea ted h i b e r n a te b e fo r e the spe c i f i ed i m ag e e x ec u t e s . Th e s e t h r e e fea t u r e s c an be spec i f i ed s e rv i c e . as a pa r t o f t h e C r e a t e P r o c e s s system As a d d i t i o n a l p r o c e s s e s a s so c i a t e w i th th i s c l us te r , t h e C E B l i s t is s e a r c hed i n o r d e r t o l o c a t e t h e C E B , t h e e v e n t f l ag c l u s t e r po i n t e r s i n the i r PC Bs a r e u pd a ted , a nd t h e r e f e r e n c e c o un t fo r th a t c l us t e r i s upd a t ed . As p r o c e s s e s d i s a s so c i a t e f r om a c l us t e r ( wi th the $ DAC E FC s y s tem s e rv i c e ) , the r e fe r enc e c o un t i s d ec r em e n t ed . Wh e n the r e f e r e nc e c o un t f o r a t empo r a r y c l u s t e r g o e s to z e r o , t h e c l u s t e r i s a u tom a t i c a l l y d e l e t ed a nd the C E B d e a l l o c a ted . Pe rma n e n t c l us t e r s m u s t b e e x p l i c i t l y d e l e t ed ( $ DLC E FC s ys tem s e r v i c e ) i n o rd e r t o c a u s e the C E B t o b e d e a l l o c a ted wh e n t h e r e f e r e n c e c o u n t goes to ze ro . Al t e r n a t i v e l y , pe rm a n e n t c l us t e r s c a n c o n t i n u e to ex i s t wi tho u t r e q u i r i ng th a t t h e y b e a s so c i a t e d wi th a n y p r o c e s s e s . In f a c t , t h e o n l y o pe r a t i o n pe r fo rmed b y the De l e t e Commo n Even t F l ag Cl u s t e r s ys tem se rv i c e is to t u r n o f f the C E B $V PERM b i t . ( I f the r e f e r e n c e c o un t o f t h e c l u s t e r i s z e r o wh e n the -p e r m a n e n t b i t is t u r n ed o f f , t h e c l u s t e r i s d e l e t ed . ) 9-2 PROC ESS CONTROL AND COMMUN I CATI ON I Software PCB SQFL SQBL I I WEFC STATE - - EFWM /POB EFCS EFCS EFCU EFC2P EFC3P � - � - � - � Figure 9-1 - S o f twa r e PC B F i e l d s Th a t S uppo r t Ev e n t F l ag s 9-3 PROC E S S C ONTROL AND C OMMUN I CAT I ON CEB Forward Link � - - - - - - - - - - - - - - - - - - - - - --· CEB Backward Link Type Status Size Process ID of Creator Event Flags Walt Queue Forward Link Walt Queue Backward Link CEF State Number Walt Count UIC of Creator Reference Count Protection Mask Count Cluster Name (up to 15 characters) (counted ASCII string) Figure 9-2 9.1.3 L a yo u t o f Common E v e n t B l o c k Event F l ag Wa i t S t a t e s P r o c e s s e s a r e p l a c ed i n to e v e n t f l ag wa i t s t a t e s i mp l i c i t l y • • • b y e x ec u t i ng a $ Q I OW s ys t em s e rv i c e , by u s i ng the RM S s e rv i c e s u s ua l wa y t h e y a r e c a l l ed , as s yn c h r o no us o pe r a t i o n s , o r e x pl i c i t l y by e x e c u t i ng o n e o f t h e th r e e e v e n t s e r v i c e s ( $WA I TFR , $WFLOR , $WF LAND ) . 9-4 f l ag the wa i t PROC ESS C ON TROL AND C OMMUN I CAT I ON � SCH$GQ_CEBHD: : CEB Wait Queue ... , .... J PCB 0 +-- +-- +-- 1.._.:. PCB .... J u , PCB 0 CEB Name CEB "" � Wait Queue +-__lo. ,. ., .... CEB "" ,.. W a i t Queue .... --"' ,. PC B 4. +--- +--- PCB .... J u ,. PCB 0 CEB ""' , W a i t Q ueue Figure 9-3 No processes waiting for flags in this common event flag cluster Common Ev e n t F l ag Wa i t Qu e ue s I f t h e f l ag o r f l ag s i n q ue s t i o n a r e a l r e a d y s e t , t h e s ys tem s e rv i c e i mmed i a t e l y r e t u r n s s uc c e s s f u l l y to i ts c a l l e r . O th e r w i s e , the p r o c e s s i s p l a c ed i n to e i th e r a l o c a l o r c ommo n ev e n t f l ag wa i t s t a t e . Th e saved PC i n the h a r d wa r e PC B i s b a c k ed up b y 4 ( Ch a p t e r 8 ) to a l l o w ASTs to be d e l i v e r ed t o th e p r o c e s s wh i l e i t i s wa i t i ng fo r the f l ag ( s ) to be set . Th e e v e n t f l ag c l u s t e r n umbe r ( 0 or 1 f o r l o c a l c l u s te r s a nd 2 o r 3 fo r g l o b a l c l u s te r s ) , i nd i c a t i ng wh i c h f l ag s a r e b e i ng wa i t ed fo r , i s s to r ed i n t h e PC B ( a t o f f s e t PC B $B WE FC ) . Th e l i s t { ma s k ) o f e v e n t f l ag s b e i ng wa i ted fo r is s to r ed - { i n o n e ' s c om p l eme n t fo rm ) i n PC B $ L_EFWM . • If the process i s wa i t i ng fo r a s i ng l e even t f l ag { S YS $WA I T FR ) , the PC B $ L E FWM m a s k c o n t a i n s a 1 i n eve r y b i t e x c e p t t h e b i t n um be r c o rre s po nd i ng to t h e f l ag b e i ng wa i t ed for . 9-5 PROCESS CONTROL AND C OMMUN ICAT I ON • • I f t h e p r o c e s s i s wa i t i ng f o r a n y o n e o f s e v e r a l f l ag s to be set ( S YS $WFLOR ) , th e PC B $ L E FWM m a s k c o n t a i n s t h e o n e ' s c omp l em e n t o f t h e m a s k p ass e d to the SYS $WFLOR s ys t em s e rv i c e . ( Th e $WA I TFR ma s k i s t h u s a spec i a l c a s e of a wa i t fo r a n y o n e o f a g r o up o f f l ag s t o be s e t . ) I f a ny o f the f l ag s in the r e q u e s t e d m a s k i s s e t wh en $WF LOR i s c a l l ed , the p r o c e s s i s not p l a c ed i n to a wa i t s t a t e . Ins tead , the s e r v i c e i mm ed i a t e l y r e t u r n s a s uc c e s s code to i t s c a l l e r . I f a p r o c e s s c a l l s t h e $WFLAND s y s tem s e r v i c e , i nd i c a t i ng a wa i t fo r a l l f l ag s i n a g i ven m a s k to be s e t , the wa i t m a s k i s mod i f i ed s o tha t e v e n t f l ag s t h a t a r e s e t wh en the s e r v i c e I n ad d i t i o n , i s c a l l ed a r e no t r e p r e s e n t ed i n the wa i t m a s k . a bit in the process s t a t us l o ng wo r d ( PC B $ V WA L L in PC B $ L S TS ) is s e t , i nd i c a t i ng t h a t a l l f l ag s r e p r es e n t e d by the mas k mus t b e set b e f o r e the wa i t i s sa t i s f i e d . Th e r e ex i s t two l o c a l e v e n t f l ag wa i t s t a t e s ( L E F a nd L E FO ) and two c o r r e spo nd i ng wa i t que u e l i s t h e a d s ( S C H$ G Q L E FWQ a nd S C H $ G Q L E F OW Q ) f o r t h e e n t i r e s ys tem . O n t h e o th e r h a nd , the r e e x i s t s o n e- c ommo n event f l ag wa i t que ue l i s th e ad f o r e a c h c ommon ev e n t c l u s t e r th a t cur rently ex i sts . E a c h c ommo n event f l ag wa i t q u e u e l i s th e a d is l o c a t ed i n t h e c o r r e spo nd i ng c ommo n e v e n t b l o c k ( F i g u r e 9 - 2 ) and h a s t h e same o v e r a l l s t r uc t u r e a s a ny o f t h e o th e r wa i t que ue l i s theads ( Fi g ur e 8 - 4 ) . S e t t i ng a nd C l e a r i ng Eve n t F l ag s 9.1.4 Ev e n t f l ag s c an b e s e t d i r e c t l y b y a p r o c e s s b y c a l l i ng t h e Se t Ev e n t Fl ag sys t em s e r v i c e . A p r o c e s s c o u l d u s e th i s s e r v i c e a t A S T l ev e l t o c ommun i c a t e w i t h i t s m a i n l i n e c o d e . I t c an a l so s e t common e v e n t f l ag s to c ommun i c a t e wi th o th e r p r o c e s s e s . E v e n t f l ag s a r e a l s o s e t i n r e s po n s e to I /0 c o mp l e t i o n , t i me r e x p i r a t i o n , a nd d e l i v e r y o f a $ G E TJ P I r e que s t . Bo th t h e sys t em s e rv i c e a nd t h e spec i a l pa ths c a l l t h e s am e r o u t i n e ( S C H $ P O S TE F ) to pe r f o rm t h e a c tua l ev e n t f l ag s e t t i ng and ch e c k f o r po s s i b l e sched u l i ng i mp l i c a t i o n s . Th e o pe r a t i o n o f S C H $ PO S TE F d e pend s o n wh a t b e i ng s e t . • • k i nd of event f l ag is I f the ev e n t f l ag th a t i s b e i ng s e t i s l o c a l , a ch e c k i s m a d e to d e t e rm i n e wh e th e r th i s f l ag s a t i s f i e s t h e p r o c e s s ' s wa i t r e ques t . Fo r a $ WF LOR c a l l , th i s f l ag me r e l y h a s to m a t c h one of t h e f l ag s b e i ng wa i ted f o r . Fo r a $WF LAND c a l l , a l l o f the f l ag s be i ng wa i t ed fo r mus t b e s e t i n o r d e r to s a t i s f y t h e p r o c e s s ' s wa i t r e que s t a nd r e po r t a n e v e n t t o the schedul e r . Wh e n a c ommo n ev e n t f l ag i s s e t , t h e l i st of PC Bs in the c ommon ev e n t b l o c k is sc anned to d e t e rm i n e i f any of the p r o c e s s e s wa i t i ng fo r f l ag s in t h i s c l us t e r s a t i sfy the i r wa i t r e que s t a s a r e s u l t o f s e t t i ng th i s f l ag . A s y s t em e v e n t i s r e po r t e d fo r e a c h s uc h p r o c e s s . Al l such p r o c e s s e s a r e mad e c om p u t a b l e . I f the p r i o r i ty o f a n y o n e o f t h em i s g r e a t e r than the p r i o r i t y o f the c u r r e n t l y e x e c u t i ng p r o c e s s , a r e s c h ed u l i ng i n te r r up t i s r e que s t e d . As wi th a l l o th e r c a s e s i n the sys tem wh e r e seve r a l p r o c e s s e s b e c ome c omp u t a b l e a s a r e s u l t o f t h e s a m e s ys t em wi d e event , 9-6 PROC ESS CONTROL AND COMMUN ICAT I ON t h e p r o c e s s w i th the s e l e c t ed fo r e x e c u t i o n . • h ighest s o f twa r e p r i o r i ty wi l l be Fo r commo n e v e n t f l ag s l o c a ted i n sha r ed m emo r y , t h e r e i s o ne mo r e l ev e l o f c ompl i c a t i o n . Th e e v e n t f l ag m u s t b e s e t i n t h e m a s t e r C E B l o c a ted i n s h a r ed m emo r y a nd o th e r p r oc esso r s c o nn e c ted t o th i s s h a r ed m emo r y u n i t m u s t b e no t i f i ed th a t a s h a r ed memo r y c ommo n e v e n t f l ag wa s j us t s e t . ( Sh a r ed memo r y c ommo n e v e n t f l ag d a t a s t r uc t u r e s a r e d i s c u s s e d a t t h e e nd o f th i s chapte r . Oth e r sha r ed mem o r y d a ta s t r uc t u r e s a r e d e s c r i b ed i n Ch a p t e r 1 1 . ) An y o th e r p r o c e sso r c o n n ec ted to the same g l o b a l event f l ag c l us t e r r ec e i ve s init ial not i f i cation th r o ug h a n MA7 8 0 i n te r r up t . Th e i n te r r up t s e r v i c e r o ut i n e d e t e rm i n e s th a t t h e i n t e r r up t wa s d u e to a n eve n t f l ag i n s h a r ed memo r y g e t t i ng s e t , c o p i e s t h e e n t i r e s e t o f e v e n t f l ag s f r om t h e m a s t e r CEB to the s l av e C E B , a nd c h e c k s wh e th e r a n y of t h e p r o c e s s e s wa i t i ng f o r f l a g s i n th i s c l u s t e r a r e n o w c o m p u t a b l e . 9. 1.4. 1 Oth e r Ev e n t F l ag S e r v i c e s - Th e s e r v i c e s i mpl y c l e a r s the e v e n t f l ag • • • C l ea r Ev e n t F l ag s y s t em common event i n t h e s o f twa r e PCB f o r a l o c a l ev e n t f l ag , i n t h e c ommo n e v e n t f l ag b l o c k fo r f l ag , a nd a r eg u l a r i n t h e m a s t e r CEB o n l y f o r c ommo n e v e n t f l ag c l u s t e r s l o c a t ed i n sh a r ed m emo r y . It i s n o t n e c e s s a r y to c o py the s e t o f f l ag s f r om t h e m a s te r CEB t o t h e s l av e CEBs o n o th e r p r o c e s s o r s wh e n a n e v e n t f l ag i s c l e a r ed fo r t h e fo l l o w i ng t wo r e a s o n s . Th e e ve n t f l ag wa i t s e r v i c e s o n l y u s e the m a s t e r CEB wh en c h e c k i ng wh e th e r to p l a c e a p r o c e s s i n to a wa i t s t a t e o r r e t u r n i mmed i a t e s uc c e s s . Th e e v e n t f l ag po s t i ng r o u t i n e co p i e s the m a s t e r set of f l ag s t o t h e l o c a l s l ave CEB b e fo r e t e s t i ng wh e th e r a n y p r o c e s s wa i t r eque s t s a r e s a t i s f i ed . Th e m a s t e r set of f l ag s i s c o p i ed i n to a l l o th e r s l av e CEBs a s a r e s u l t o f no t i f y i ng o th e r p r o c e s so r s tha t a f l ag h a s b e e n s e t . Th e Re a d Ev e n t Fl ag sys tem s e rv i c e i s s i mpl y i n fo rm a t i o na l . I t h a s no e f fec t on the c om p u tab i l i ty o f a n y p r o c ess on a n y p r o c e s s o r . Th e e v e n t f l ag c l u s t e r 1s r ead f r om the same d e s t i n a t i o n s a s tho s e a f f e c ted b y t h e C l e a r Ev e n t F l ag sys tem s e rv i c e . • Lo c a l e v e n t f l ag c l u s t e r s a r e r e a d f r om t h e so f t wa r e PC B . • Reg u l a r c ommo n e v e n t f l ag c l u s t e r s a r e r e ad f r om the CEB . • Common e v e n t f l ag c l u s te r s l o c a t e d i n sha r ed m emo r y a r e f r om t h e ma s te r C E B l o c a t ed i n sha r ed memo r y . 9-7 r ead PROC ESS CONTROL AND COMMUN I CAT I ON 9. 2 AFFECTING THE C OMPUTAB I L I TY OF ANOTHER PROC E S S I n a n y m u l t i p r o c e s s i ng a pp l i c a t i o n , i t i s n e c e s s a r y fo r o n e p r o c e s s t o control wh e th e r a nd wh e n o th e r processes in the a pp l i c a t i o n c a n execute . VMS c o n t a i n s s ev e r a l s e rv i c e s th a t p r ov i d e th i s c o n t r o l . 9.2. 1 Common Ev e n t F l ag s Commo n e v e n t f l ag s d e sc r i b ed i n the p r ev i o u s s e c t i o n a r e o n e m e thod o f s ynch r o n i z a t i o n c on t r o l . On e p r o c e s s c a n r e a c h a c r i t i c a l po i n t i n i ts e x e c u t i o n a n d wa i t o n a g l o b a l ev e n t f l ag . Ano the r process can a l l o w th i s p r o c e s s to c o n t i n u e i t s e x e c u t i o n b y s e t t i ng t h e f l ag i n quest i on . Commo n e v e n t f l ag s a r e a l so u s ed a s s em a ph o r e s f o r mo r e c om p l i c a t e d f o rms of i n t e r p r o c e s s c ommun i c a t i o n tha t use l o g i c a l n a m e s o r g l o b a l sec t i on s . 9.2. 2 P r o c e s s C o n t r o l S e rv i c e s S e v e r a l s ys tem s e r v i c e s a l low o ne p rocess s c h e d u l i ng s ta te o f a no the r p r o c e s s . to d i rectly a l te r th e 9.2. 2.1 Pr i v i l e g e Ch e c k s Al l s ys tem s e rv i c e s th a t pe rm i t one p ro c es s to d i r e c t l y a f f e c t a no the r a l l ow the p r o c e s s to be s pe c i f i ed b y e i th e r p r o c e s s n a m e o r b y p r o c e s s ! D . I n e i th e r c a se , VMS m u s t d e te rm i n e wh e th e r t h e spec i f i ed p r o c e s s e x i s t s a nd wh e th e r t h e c a l l e r h a s the p r i v i l eg e { G R O U P o r WOR LD ) t o a f f e c t the o th e r p r o c e s s . Th i s wo r k i s c en t r a l i z e d i n a r o u t i n e c a l l ed EXE $NAM P I D th a t i s c a l l ed by a l l s uc h s ys t em s e rv i c e s . - I f the spec i f i ed p r o c e s s e x i s t s , a nd t h e c a l l e r i s s u i t a b l y p r i v i l eg ed ( GR O U P o r WORLD ) t o a f f e c t the s pe c i f i ed p r o c e s s , EXE $NAM P I D r e t u r n s s uc c e s s f u l l y { a t I P L 7 ) w i t h the PC B a d d r e s s o f the spec i f i ed process in R4 . No t e th a t th i s r e t u r n c o nd i t i o n a l t e r s t h e c o n t e n t s o f R4 , wh i c h u s ua l l y c o n t a i n s the c a l l e r ' s PC B a d d r e s s . A s e c o nd i mpo r ta n t i t em a s so c i a t ed w i t h EXE $NAMP I D i s th a t i f a p r o c e s s i s d e s i g n a ted by n a m e , and i f a P r o c e s s ID a r g um e n t i s present { th e o n l y c a s e he r e o c c u r s wh e n a z e r o i s pa s s ed b y r e f e r e nc e ) , the P I D o f the spe c i f i e d p r o c e s s w i l l be r e t u r n e d to t h e c a l l e r a t the d e s i g n a t ed l o c a t i o n . 9 . 2 . 2 . 2 P r o c e s s C r e a t i o n a nd De l e t i o n An o bv i o u s f i r s t s t e p in a m u l t i p r o c e s s a pp l i c a t i o n r equi r e s t h a t a c o n t r o l l i ng p r o c e s s c r e a t e o the r p r o c e s s e s fo r d e s i g n a ted wo r k . Th e s e p r o c e s s e s m a y b e d e l e t ed wh e n they have compl e ted t h e i r wo r k o r they may e x i s t in some wa i t s ta t e i n a n t i c i pa t i o n o f a d d i t i o n a l wo r k . Th e d e ta i l ed ope r a t i o n o f p r o c e s s c r ea t i o n i s d e sc r i b ed i n Ch a p t e r 1 7 . Process d el et ion i s d e sc r i b ed i n Cha pt e r 1 9 . - 9-8 PROCE S S CONTROL AND COMMUN ICAT I ON 9. 2. 2. 3 H i be r n a te/Wa k e - Th e r e a r e t wo d i f f e r e n t wa ys tha t a process can be t empo r a r i l y h a l t e d , c a l l ed h i b e r n a t i o n a nd s uspe n s i o n . Th e d i f f e r e nc e s b e twe e n t h e s e t wo wa i t s t a t e s a r e l i s te d i n t h e VAX/VM S Sys tem S e r v i c e s Re f e r e n c e Ma n u a l ( i n T a b l e 7 - 2 i n tha t m a n u a l ) . ( Th a t is , a A p r o c e s s c a n o n l y p u t i t s e l f i n to th e h i b e r n a t e s t a t e . p r o c e s s c a nno t put a n o th e r p r o c e s s i n t o the H I B s t a t e . ) I f the wa k e p e nd i ng f l ag i s n o t s e t ( th i s f l ag ch e c k a l s o c l ea r s the f l ag ) , i nd i c a t i ng th a t a n a s s o c i a t e d wa k e h a s no t p r e c e d ed th e h i b e r n a t e c al l , the process is p l a c ed i n to t h e h i be r na te wa i t s t a te . As d e sc r i b ed i n t h e p r ev i o u s c h a p t e r , t h e s a v ed P C i s b a c k e d u p b y 4 s o t h a t t h e p r o c e s s w i l l b e p u t b a c k i n to t h e h i b e r n a t e s t a t e i n c a s e it ( No t e th a t t h e c h e c k o f t h e r ec e i v e s ASTs wh i l e i t i s h i b e r n a t i ng . wa k e p e nd i ng f l ag b y t h e H i b e r n a t e sys tem s e rv i c e i n c l ud e s the case wh e r e a p r o c e s s f i r s t h i b e r n a t e s a nd th e n i s a wa k e n ed b y a Wa k e c a l l i s s u e d f r om a n A S T . ) A Th e Wa k e sys tem s e rv i c e i s th e c om p l eme n t a r y s e r v i c e to H i b e r n a t e . p r o c e s s m a y a wa k e n i t s e l f ( by c a l l i ng Wa k e f r om an AS T ) o r i t m a y b e a wa k e n e d bec a u s e a no th e r p r o c e s s c a l l ed Wa k e wi th e i th e r t h e n a m e o r the p r o c e s s ID of the ta rg e t process . Th i s s e r v i c e s e t s the wa k e p e nd i ng f l ag i n t h e so f twa r e P C B a nd r e po r t s t h e a wa k e n i ng event to the s c h ed u l e r . Th e p r o c e s s i s r emoved f r om t h e H I B o r H I B O q u e ue a nd p l a c ed i n to the C OM o r C OMO s t a t e i n the q u e ue c o r r e s po nd i ng to i ts ( A Wa k e e v e n t r e s u l t s i n a p r i o r i t y boo s t c l a s s o f upd a te d p r i o r i ty . PR I $_R E SAVL , wh i c h i s e qu i v a l en t to a boo s t o f 3 . ) Th e n e x t t i me t h e p r o c e s s e x e c u t e s , the h i bernate s e rv i c e ex e c u t e s ( because t h e PC wa s b a c k e d up by 4 ) . Be c a u s e the wa k e p e nd i ng aga i n f l ag i s n o w s e t , t h e p r o c e s s r e t u r n s i mm e d i a te l y f r om the h i b e r n a t e cal l ( wi th t h e wa k e pend i ng f l ag n o w c l e a r ) . No t i c e tha t i f the p r o c e s s i s in a n y s t a te o th e r t h a n HIB o r H I B O wh en it is a wa ke n e d , the net r esul t is to l e av e the wa k e p e nd i ng f l ag s e t wi th n o o th e r c h a ng e i n i t s sched u l i ng s t a t e . 9.2.2. 4 S uspend/Re s ume - P r o c e s s s u spe n s i o n is sl ig h t l y mo r e c ompl i c a t ed i n te r na l l y t h a n h i b e r n a t i o n b e c a u s e a process c a n be pl a c ed i n to t h e S U S P s t a t e b y o the r p r o c e s s es . Th e s c h e d u l i ng ph i l o s o ph y o f VM S , i l l u s t r a t ed i n F i g u r e 8 - 5 , a s s um e s tha t p r o c e s s e s e n t e r v a r i o u s wa i t s ta t e s f r om t h e s t a t e o f be i ng t h e c u r r e n t p r o c e s s a nd i n n o o the r wa y . Th i s a s s umpt i o n r e qu i r e s t h a t the p r o c e s s b e i ng s u spe nd ed ( th e ta rg e t ) b e c om e c u r r e n t , r e p l a c i ng the cur rently e x e c u t i ng p r o c e s s , t h e c a l l e r o f t h e Suspe nd sys t em s e rv i c e . VMS a c c ommod a t e s th i s s c h ed u l i ng c o n s t r a i n t by u s i ng a spec i a l ke rne l t h e s ame to o l th a t i t u s e s wh e n i t n e ed s a c c e s s to a po r t i o n o f AS T , process a d d r e s s spac e . I n th i s c a s e , i t i s no t the proce ss a d d r e s s s pa c e tha t is s o impo r ta n t . Ra t h e r , t h e p r o c e s s m u s t f i r s t b e m a d e c u r r e n t b e fo r e i t i s p l a c ed i n to the S US P s t a t e . 9.2.2.4.1 P r o c e s s Suspe n s i on - P r o c e s s s u spe n s i o n o c c u r s in t wo pi eces . Th e po r t i o n o f the s e r v i c e th a t ex e c u t e s i n the c o n t e x t o f t h e c a l l e r s e t s the s u s p e nd p e nd i ng b i t i n the s o f twa r e PCB o f the t a rg e t process a nd q u e ue s t h e spec i a l k e r n e l A S T ( th e r o u t i n e th a t pe r fo rm s the a c t ua l s u s pe n s i o n ) to t h a t p r o c e s s . Th i s impl em e n t a t i o n i nc l ud e s the spec i a l c a s e wh e r e a p r o c e s s s us pe nd s i t s e l f . 9-9 PROC E S S CONTROL AND COMMUN I CATI ON Th r o ug h t h e n o rma l s c h ed u l i ng s e l e c t i o n p r o c e s s , the t a rg e t p r o c e s s e v en t ua l l y e x ec u t e s . Th e spec i a l A S T t h a t pe r fo rm s t h e s u s p e n s i o n e x e c u t e s f i r s t un l e s s t h e r e a r e p r ev i o us l y que ued spec i a l k e r n e l ASTs . Th i s AST f i r s t c h e c k s ( a nd c l ea r s ) the r e s um e pend i ng f l ag i n PCB $ L S T S . ( Th i s c h e c k a vo i d s t h e d e ad l o c k t h a t c o u l d o th e r w i se o c c u r i f t he a s s o c i a t ed Re s um e p r e c ed ed t h e S u s pend . ) I f t h e r e s ume pend i ng f l ag i s s e t , t h e p r o c e s s s impl y c l ea r s the s us p e nd pend i ng bit, r e t u r n s f r om t h e AS T , a nd c o n t i n u e s w i th i t s e x e c u t i o n . O t h e rwi s e , i t i s p l a c ed i n to t h e SUS P wa i t s t a t e . Th e s a v ed PS L c onta ins I PL 2 , p r ev e n t i ng d e l i v e r y o f ASTs wh i l e a process i s s us pe nd ed . ( In add i t ion , t h e AST s y s t em event is i g n o r ed fo r p r ocesses i n e i th e r the S U S P o r the S U S PO s t a t e . ) Th e saved PC i s a n a d d r e s s w i th i n th e s u spend spe c i a l k e r n e l AST . Wh en t h e p r o c e s s is r e s umed ( th e o n l y wa y t h a t a s u s p e nd ed p r o c e s s c a n c o n t i nue w i th i t s e x e c u t i o n ) , i t r e e x e c u t e s the c h e c k o f t h e r e s ume pend i ng f l ag , wh i c h i s now s e t , c a us i ng the p r o c e s s to r e t u r n s u c c e s s f u l l y f r om t h e s pe c i a l AST . 9. 2.2.4. 2 O pe r a t i o n o f t h e Re s ume S y s t em S e rv i c e - Th e Re s ume s ys t em s e rv i c e i s v e ry s i mp l e . Th e r e s um e pend i ng f l ag i n PC B $ L S T S o f the t a rg e t p r o c e s s is s e t a nd ( i f th e t a r g e t p r o c e s s of the Resume is in e i th e r the SUSP o r S US PO s t a t e ) a r e s ume event i s r e po r ted t o the s c hed u l e r . As wi th a l l o th e r sys t em even t s , t h i s r e po r t may r e s u l t i n a r e sched u l i ng pa s s , a r e que s t t o wa k e the swa ppe r p r o c e s s , o r n o th i ng at all . 9 . 2 . 2 . 5 Ex i t a nd Fo r c ed Ex i t - Th e Ex i t s ys t em s e r v i c e t e rm i n a t e s t h e c u r r e n t l y e x e c u t i ng i m ag e . I f the p r o c e s s i s ex ec u t i ng a s i ng l e i m ag e ( i t i s n e i th e r a n i n t e r a c t i v e n o r b a tc h j ob ) , i mag e ex i t usua l l y r e s u l ts i n p r o c e s s d e l e t i o n . A d e ta i l ed d i s c us s i o n o f the Ex i t s ys t em s e rv i c e , i n c l ud i ng the c a l l i ng s e q ue n c e o f t e rm i na t i o n hand l e r s , is d i sc u s s ed i n Ch a p te r 1 8 . Th e Fo r c e E x i t sys t em s e r v i c e i s a t o o l t h a t a l lows o n e p r o c e s s to execute the Ex i t s ys tem s e rv i c e on b e h a l f of a n o the r p r o c e s s . Th e s e rv i c e s i mp l y s e t s t h e fo r c e e x i t pend i ng f l ag in PC B $ L S TS a nd q u e ue s a u s e r mode AST t o the t a r g e t p r o c e s s . Th i s AS T , e x e c u t i ng i n u s e r mod e , c a l l s t h e Ex i t sys t em s e r v i c e a f te r c l e a r i ng the AST a c t i v e f l ag by e x e c u t i ng a C HMK #ASTEXI T i n s t r uc t i o n ( Ch a p t e r 5 } . Th e c a l l to Ex i t i s e x e c uted i n the context of t h e t a rg e t p r o c e s s . E x e c u t i o n p r o c e e d s i n e x a c t l y t h e s ame m a n n e r a s i t wo u l d i f the t a rg e t p r o c e s s h a d c a l l ed Ex i t i t s e l f . 9.2. 3 M i s c e l l an e o u s P r o c e s s A t t r i b u t e Ch a ng e s F i n a l l y , th e r e a r e seve r a l s y s t em s e rv i c e s th a t a l l o w a process to a l te r i ts character i stics , s uc h as i t s r e sponse to s ys t em se rv i c e f a i l u r e s , i t s so f twa r e p r i o r i ty , a nd i t s p r o c e s s n a m e . Some o f these c h a ng e s ( s uc h a s p r i o r i ty e l ev a t i o n or swa p d i s a b l i ng } requ i r e p r i v i l eg e . Th e S e t P r i o r i t y s ys tem s e rv i c e is t h e o n l y se rv i c e d e sc r i b ed i n th i s s e c t i o n tha t c a n b e i s s ued fo r a p r o c e s s o th e r t h a n the c a l l e r . 9-1 0 PROCESS CONTROL AND COMMUN I CAT I ON 9. 2. 3. 1 S e t P r i o r i ty - Th e Se t P r i o r i ty s ys t e m s e r v i c e a l l ows a process to a l te r i t s o wn so f twa r e p r i o r i t y o r the p r i o r i t y o f o th e r p r o c e s s e s tha t i t i s a l l o wed ( th r o ug h GROUP o r WORLD p r i v i l eg e s ) to I f a p r o c e s s h a s the ALTPR I p r i v i l eg e , i t c a n c h a ng e p r i o r i t y a f fec t . to a ny v a l ue b e twe e n 0 a n d 3 1 . A p r o c e s s wi tho u t th i s p r i v i l eg e is r e s t r i c ted t o the r a ng e b e twe e n 0 a n d i t s o wn b a s e p r i o r i t y , i mp l y i ng th a t a n o n p r i v i l eg ed p r o c e s s c a n l o we r b u t no t ra i se i ts s o f twa r e p r i o r i ty . ( Be c a u s e VM S d o e s n o t k e ep a pe rma n e n t c o py o f the p r o c e s s p r i o r i t y o b ta i n ed f r om t h e a u tho r i z a t i o n record , a n o n p r i v i l eg ed process tha t l owe r s i t s s o f twa r e p r i o r i ty c a nno t r a i s e i t bac k to i t s a u tho r i z e d va l ue w i t ho u t l ogg i ng o u t . ) Fo r mo s t s c h ed u l i ng s t a te s ( ev e r yth i ng e x c e p t C OM , C OM O , a nd C UR ) , t h e Se t P r i o r i ty s ys t em s e rv i c e s i m p l y c h a ng e s the b a s e so f twa r e p r i o r i t y i n the so f twa r e PC B ( a t o f f s e t PC B $ B PR I B ) . If a process a l te r s i ts o wn p r i o r i ty , not only i t s b a s e -b u t a l s o i t s c u r r e n t p r i o r i t y ( a t o f f s e t PC B $ B P R I ) i s c h a ng ed . Wh e n the p r io r i ty o f a c ompu t a b l e process ( e i th e r C OM o r C OMO ) i s a l t e r ed , t h e p r o c e s s i s r emoved f r om t h e C OM o r C OM O q u e ue c o r r e s po nd i ng to i t s c u r r e n t p r i o r i t y a nd p l a c ed i n to a C OM o r C OM O q u e u e c o r r e s po nd i ng to i t s n e w p r i o r i t y ( th e n e w b a s e w i th a b o o s t o f 2 ) . I n a d d i t i o n , t h e sched u l e r i s no t i f i ed . If t h e n e w p r o c e s s p r i o r i t y ( n ew b a s e pl us a bo o s t o f 2 ) i s g r e a te r th a n or e q ua l to t h e c u r r e n t pr i o r i ty o f the cur rent process , a r e s c h e d u l i ng i n te r r up t i s r e que s t ed . 9.2.3.2 S e t Pr o c e s s Name - Th e Se t P r o c e s s Name a l l o ws a process to c h a ng e i t s p r oc e s s n am e . Th e new n am e c a nno t c o n t a i n mo r e t h a n 1 5 cha r a c te r s . I f no o th e r p r o c e s s i n the s ame g r o up h a s the same n am e , t h e n e w n ame i s p l a c ed i n to t h e so f twa r e PCB ( a t o f f s e t PC B $ T LNAME ) . ( No t e tha t th i s s e rv i c e a l l o ws mo r e f l ex i b i l i ty in e s t a b l i sh i ng a p r o c e s s n am e than i s ava i l a b l e f r om t h e u s ua l c h a n n e l s , s uc h a s t h e a u tho r i z a t i o n f i l e o r a $ J O B c a r d . Th i s is b e c a use th e r e a r e no r estr ic t i ons i mpo s ed by th i s s e r v i c e o n c h a r a c t e r s tha t c a n m a k e up the p r o c e s s name . ) P r o c e s s Mo d e S e r v i c e s - Th e r e are seve r a l m i sc e l l aneous sys tem s e r v i c e s wh o s e o n l y a c t i o n i s to s e t o r c l e a r a b i t i n some f i e l d i n t h e s o f twa r e PCB . I n pa r t i c u l a r , the so f twa r e PC B c o n t a i n s a s ta tus l o ng wo rd ( no t to be co n f u sed w i th the h a r d wa r e e n t i t y � t h e PS L o r p r o c e s s o r s t a t u s l o ngwo r d ) t h a t r ec o r d s the c u r r e n t s o f twa r e s t a t u s of the proce sso r . Ta b l e 9 - 2 l i s t s e a c h o f t h e f l ag s i n th i s l o ng wo r d , a nd the d i r e c t o r i nd i r e c t wa ys that the s e f l ag s can be se t o r c l e a r ed . 9.2.3.3 Th e Se t Re so u r c e Wa i t Mo d e , S e t Sys t em Se r v i c e Fa i l u r e E x c e p t i o n Mod e , and Set Swa p Mo d e sys tem s e r v i c e s a l l s e t ( o r c l e a r ) b i t s i n th i s s t a t us l o ng wo r d . Th e a b i l i ty t o d i s a b l e swa pp i ng i s p r o t e c t ed b y t h e PSWAPM p r i v i l eg e . Th e o th e r two serv i ces r e q u i r e n o p r i v i l eg e . S e v e r a l o the r sys tem s e r v i c e s ( s uch a s $ D E L PRC , $ FORC E X , $ R E S UM E , or $ S U S PND ) se t o r c l e a r b i t s i n t h e s ta t us l o ng wo r d a s a n i nd i c a t i o n o f the i r pr ima ry ope r a t i o n . Th e S e t AS T s y s tem s e rv i c e sets o r c lea r s ( enab l e s o r d i sab l e s ) d e l i v e r y o f ASTs fo r a g i v e n a c c e s s mo d e . Th e AST e n ab l e f l ag s a r e s to r e d a t o f f s e t PC B $ B ASTEN . Th e u s e o f t h e s e f l ag s i s d i sc us s e d in Ch a p t e r 5 . 9-1 1 Tab l e 9- 2 Mean i ng of F l ag s I \0 .... N S ym bo l i c Name Me a n i ng o f Fl ag PC B $V R E S PC B $V-D E L PEN PCB $V-F ORC PEN PC B $V-I N QUAN PCB $V-PSWAPM PCB $V-R E S PE N PCB $V-S S F E XC PCB $V-S S F E XC E PCB $V-S S F EXC S PC B $V=S S F E XC U in P C B S tatus Longword i f Se t ( PC B $ L STS ) _ Fl ag Se t b y Fl ag Cl ea r ed by P r o c e s s i s r e s i d en t ( i n t h e b a l a n c e s e t ) P r o c e s s d e l e t i o n i s pe nd i ng Fo r c ed ex i t i s pend i ng P r o c e s s i s i n i t s i n i t i a l q ua n t um ( fo l l o wi ng i n s wa p ) P r o c e s s s wa pp i ng i s d i s a b l ed Re s um e i s pend i ng ( s k i p s us pe nd ) En a b l e s y s t e m s e rv i c e e x c e p t i o n s fo r k e r ne l mod e En a b l e s ys t e m s e rv i c e e x c e pt i o n s fo r ex ec u t i v e m o d e En a b l e s ys t e m s e rv i c e e x c e p t i o n s fo r s upe r v i so r mod e E n a b l e s ys t e m s e rv i c e ex c e pt i o n s fo r u s e r mod e Swa ppe r $DE LPRC $ F ORCEX Swa ppe r $S ETSWM , $ R E S UM E $ S ETSFM $ S ETSFM $ S ETSFM $ S ETSFM , Swa ppe r PC B $V S S RWA I T PC B $V-S US PEN PC B $V=WAKE PE N D i s a b l e r e so u r c e wa i t mod e S u s pe nd i s pe nd i ng Wa k e i s p e nd i ng ( s k i p h i b e r na te ) PC B $V WA L L PC B $V-BATC H PCB $V-N OACNT PC B $V-SWPVB N PC B $V-AS TPEN PC B $V-P H DR E S PC B $V-H I B ER PCB $V-L OG I N PC B $V-N E 'IWRK PC B $V=PW RA S T Wa i t fo r a l l e v e n t f l ag s i n m a s k P r o c e s s i s a b a tc h j o b Do n o t wr i te an a c c o un t i ng r e c o rd fo r t h i s p r o c e s s Mo d i f i e d pag e wr i te to t h e swa p f i l e i s i n p r og r e s s A S T i s pend i ng ( No l o ng e r u s ed ) P r o c e s s h e ad e r i s r e s i d en t H i b e r n a t e a ft e r i n i t i a l i m ag e a c t i v a t i o n Log i n w i tho u t r ea d i ng t h e a u t ho r i za t i o n f i l e P r o c e s s i s a n e t wo r k j o b P r o c e s s h a s d ec l a r ed a powe r r ec o v e r y AST $S ETRWM , $CRE PRC $ S US PND $WAKE , e x p i r a t i o n o f s c h e d u l ed wa k e up $WF LAND $CRE PRC $ C R E PRC Mo d i f i ed pa g e wr i t e r PCB $V_N OD E L E T Do no t d e l e t e t h i s p r o c e s s ( No t u s e d ) Swa ppe r $ C R E PRC $ C R E PRC $ C R E PRC $S ETPRA $ C R E PRC $CRE PRC I m ag e and pr o c e s s r und own Qua n t um end ro ut i n e $ S E TSWM S u s pend s pe c i a l AST $S ETSFM , p r o c e s s r un d o wn $S E TSFM , p r o c e s s r un d o wn $S E TS FM , p r o c e s s r un d o wn $S E TS FM , i m ag e and p r o c e s s r un d o wn $ S E TRWM S u s pe nd s pe c i a l AST $ H I B ER Th e n e x t $WFLOR o r $WA I TFR Mod i f i ed pag e wr i t e r Swa ppe r Ro u t i n e tha t q u e u e s r e c o v e r y ASTs , i m ag e a nd p r o c e s s r un d o wn PROCE S S CONTROL AND C OMMUN ICAT I ON 9.3 INTERPROC ESS COMMUN I CAT I ON I n a n y a pp l i c a t i o n i nv o l v i ng mo r e t h a n o n e p r o c e s s , it i s necessa ry f o r d a ta t o b e s h a r ed among the s ev e r a l p r o c e s s e s o r fo r i n fo rma t i o n t o b e s e n t f r om o n e p r o c e s s to a no t h e r . VM S p r o v i d e s s e v e r a l s e r v i c e s t h a t a c c ompl i sh t h i s i n f o rm a t i o n e x c h a ng e . Th e s e r v i c e s v a r y i n th e a m o un t o f i n fo rm a t i o n t h a t c a n be t r a n sm i t t ed , t h e t r a n s pa r e n c y o f t h e t r a n sm i s s i o n , a nd t h e a m o un t o f s yn c h r o n i z a t i o n p r o v i d ed by VM S . 9.3.1 Event F l a g s G l o b a l o r c ommon e v e n t f l ag s c a n b e t r e a ted a s a m e thod fo r seve r a l p r o c e s s e s t o s h a r e s i ng l e b i t s o f i n f o rm a t i o n . I n f a c t , t h e t yp i c a l u s e o f c ommon ev e n t f l ag s i s a s a s yn ch r o n i z a t i o n to o l f o r o th e r m o r e c ompl i c a t ed commun i c a t i o n t e c hn i que s . Th e i nternal o pe r a t i o n s o f c ommo n e v e n t f l ag s a r e d e sc r i b ed i n t h e beg i nn i ng o f th i s c h a p t e r . 9. 3. 2 Ma i l bo x e s Ma i l bo x e s p r o v i d e t h e m o s t t r a n s pa r e n t fo rm o f c omm un i c a t i o n p r ov i d ed Ma i l b o x e s a re I /0 d ev i c e s i n th a t t h e y a r e w r i t t e n to a nd b y VM S . r e a d f r om by t h e no rm a l VM S I /0 s y s t em , e i th e r th r o ug h RM S o r wi th t h e $QIO i n te r fa c e . Al tho ug h p r o c e s s - s p e c i f i c o r s ys t em-w i d e pa r am e t e r s m a y c o n t r o l t h e amo un t o f d a t a th a t c a n b e wr i t t e n to a m a i l b o x i n o n e o pe r a t i o n , there i s n o l i m i t i n t h e t o t a l amo un t o f i n fo rm a t i o n th a t c a n b e pa s s e d th r o ug h a m a i l bo x wi t h a s e r i e s o f r e a d s a nd w r i t e s . Th e r e a r e two f o rms o f s yn c h r on i za t i o n p r ov i d ed fo r m a i l bo x I /0 . B e c a u s e m a i l bo x e s a r e I /0 d ev i c e s , a s i mpl e b u t r e s t r i c t i v e t e c h n i qu e wo u l d h a v e t h e r e c e i v i ng p r o c e s s i s s ue a r e a d f r om the m a i l bo x a nd wa i t un t i l th e r e a d c ompl e t e s . Th i s c o u l d n o t o c c u r un t i l t h e p r o c e s s wr i t i ng t o th e m a i l bo x comp l e ted i ts t r a nsm i s s i o n o f d a t a . Th e l im i t a t i on o f t h i s t e c h n i q u e i s t h a t t h e r e c e i v i ng p r o c e s s c a nno t d o a ny t h i ng e l s e wh i l e i t i s wa i t i ng fo r d a ta . Ev e n if the process i ssues a s yn c h r o no u s I /O r e que s t s , a n I /O r e que s t m u s t b e o u t s t a n d i ng a t a l l t i m e s i n o rd e r to r e c e i v e n o t i f i c a t i o n wh e n some o th e r process w r i t e s t o t h e m a i l bo x . I n some a pp l i c a t i o n s , t h e s e l i m i t a t i o n s m a y b e a c c e p t a b l e a nd s o th i s t e c h n i que c a n b e used . O th e r a ppl i c a t i o n s m a y h a v e a r e c e i v i ng process th a t c a n pe r f o rm d i fferent tasks , d e pe nd i ng on the i n fo r ma t i o n ava i l ab l e to it. Pu t t i ng s uc h a p r o c e s s i n to a wa i t s t a t e fo r o n e t a s k p r e v e n t s i t f r o m s e r v i c i ng a n y o f i t s r e que s t s . Fo r s uc h a ppl i c a t i o n s , VM S p r ov i d e s a s p e c i a l $ Q I O r e que s t c a l l ed S e t At t e n t i o n AST th a t a l l ows a p r o c e s s t o r ec e i v e not i f i c a t i o n t h r o ug h a n A S T wh e n a nyo n e w r i t e s i n to i t s m a i l bo x . Th i s t e c hn i que a l l ows a p r o c e s s to c o n t i nue i t s ma i nl i ne p r oc e s s i ng a nd h a nd l e r e que s t s f r o m o th e r p r o c e s s e s o n l y wh e n s uc h wo r k i s n e ed ed , w i tho u t h av i ng an I / 0 r e que s t o u t s t a nd i ng at all t imes . 9-13 PROCE S S CONTROL AND COMMUN I CAT ION 9.3. 3 Log i c a l Names Log i c a l n am e s ( Ch a pt e r 2 6 ) a r e used e x t e n s i v e l y by VM S t o p r ov i d e t o ta l d ev i c e i nd e pe nd e n c e i n the I /O s y s t em . Howe v e r , l og i c a l n a m e s c a n b e u s ed f o r many o t h e r pu r po s e s a s we l l . Spe c i f i c a l l y , one p r o c e s s c a n pa s s i n f o rma t i o n t o a n o th e r p r o c e s s by c r e a t i ng a l og i c a l n a m e ( i n the g r oup o r s ys t em t a b l e ) wi t h i n fo rm a t i o n s t o r ed in the e q u i v a l enc e s t r i ng . Th e r e c e i v i ng p r o c e s s s i mpl y t r a n s l a t e s the n a m e t o r e t r i ev e t h e d a ta . Al tho ug h some fo rm o f s yn c h r o n i z a t i o n i s p r o v i d ed by a n e r r o r r eturn ( S S $ NOTRAN ) f r om th e T r a n s l a te Log i c a l Nam e sys tem s e rv i c e , p r o c e s s e s u s i ng s uc h a t e c h n i q ue sho u l d use event f l ag s (or a n e qu i v a l e n t m e tho d ) t o synch r o n i z e th i s c ommun i c a t i o n t e c h n i que . O n e u s e o f th i s t ec h n i que wh e r e s yn c h r o n i z a t i o n i s n o t r eq u i r ed o c c u r s wh e n a process c r ea t e s a s ub p r o c e s s or d e ta c h ed p r o c e s s a nd pa s s e s i t d a t a i n t h e e qu i v a l e nc e s t r i ng s f o r SYS $ I N PUT , S YS $ 0 UTPUT , o r SYS $ E RROR . In th i s c a se , t h e r e i s n o po s s i b i l i ty fo r t h e t r a n s l a t i o n to o c c u r b e fo r e the c rea t ion . 9.3.4 G l oba l S e c t i o n s G l o b a l s e c t i o n s p r o v i d e t h e f a s t e s t m e thod f o r o n e p r o c e s s to pa s s i n fo rma t i o n to a n o th e r process . Be c a u s e the two p r o c e s s e s h a v e t h e d a ta a r e a m a pped i n to the i r ad d r e s s s p a c e , n o movem e n t o f d a ta t a ke s p l ac e . I n s t e ad , t h e m e thod p r ov i d e s fo r a sha r i ng o f t h e d a ta . Th e m e thod i s n o t t r a n s pa r e n t i n tha t e a c h p r o c e s s m u s t m a p t h e g l oba l s ec t i on t h a t wi l l be u s e d to sha r e d a t a . I n add i t i on , the processes m us t pe r f o rm th e i r own s yn c h r o n i za t i o n to p r ev e n t t h e r ec e i ve r f r om r e ad i ng d a ta b e fo r e i t h a s b e e n m a d e a v a i l a b l e by the s e nd e r . Common e v e n t f l ag s a r e one m e thod fo r a c c om p l i s h i ng th i s a l tho ug h p r o c e s s e s c o u l d u s e a c c e s s f l ag s i n the s e c t i o n i t s e l f . 9.3.5 I n t e r p r o c e sso r Commun i c a t i o n w i th the MA7 8 0 VM S s uppo r t f o r t h e MA 7 8 0 s h a r ed memo r y un i t p r o v i d e s a t r a n spa r e n t c omm u n i c a t i o n pa th fo r i n t e r p r o c e s s c ommun i c a t i o n e v e n wh e n p r o c e s s e s a r e l o c a t e d o n d i f f e r e n t p r o c e s s o r s c o nn e c ted th r o ug h a s h a r e d memo r y un i t ( MA7 8 0 ) . Th e th r e e c ommun i c a t i o n pa ths p r o v i d ed a r e c ommo n e v e n t f l ag s , ma i l bo x e s , a n d g l o b a l s e c t i o n s . Each o f these ent i t i es is d e sc r i b ed by a name . Wh e n a process c o nn e c t s t o o n e o f t h e m ( w i th the As s o c i a t e Commo n Ev e n t F l ag C l u s t e r s ys te m s e rv i c e , t h e C r e a t e Ma i l bo x s y s tem s e rv i c e , o r t h e C r e a t e a nd Ma p S e c t i o n o r Ma p G l o b a l S e c t i o n s ys t em s e r v i c e s ) , a l og i c a l name t rans l a t i o n i s pe r fo rmed on the name of the o b j e c t . If the e q u i v a l enc e n ame is o f the fo rm s h a r ed -m emo r y- n am e : o b j e c t-name the s e r v i c e m a k e s the a pp r o p r i a t e c o nne c t i o n be twe e n the process a nd t h e d a ta s t r uc t u r e d e s c r i b i ng the o b j e c t th a t ex i s ts i n sha r e d memo r y . I f t h e sha r ed memo r y d a t a s t r uc t u r e d o e s n o t ex i s t , it is c r e a t ed . ( Ma p G l o b a l Se c t i o n d o e s n o t c r e a t e g l o ba l s e c t i o n s t h a t d o no t e x i s t . ) Th e d a t a s t r uc t u r e s th a t VMS u s e s to d e sc r i b e s h a r e d memo r y a re p i c t u r ed in Ch a p t e r 1 1 . In add i t ion , m emo r y m a n ag ement d a ta s t r uc t u r e s , i n c l ud i ng tho s e s t r uc t ur e s t h a t d e sc r i b e s h a r e d memo r y g l o b a l s e c t i o n s , a r e f o und i n th a t c h a p t e r . 9-1 4 PROC E S S CONTROL AND COMMUN I CAT ION • Fo r a c ommo n e v e n t f l ag c l u s t e r i n sha r ed memo r y , the event f l ag c l u s t e r i n the s o f twa r e PC B ( PC B $ L E FC 2 P o r PC B $ L E FC 3 P } po i n ts t o t h e s l av e C E B f o r th i s p r o c e sso r . Th e s l ave C E B c o n ta i n s i n fo rm a t i o n t h a t d e sc r i b e s the m a s t e r C E B t h a t i s l o c a t ed i n t h e s h a r ed m em o r y ( F i g u r e 9 - 4 } . I f t h e s l av e C E B a l r e a d y e x i s ts , s i mpl y po i n t s t h e PC B to t h e C E B . I f the sl ave CEB d o e s not ( th e r e a r e c u r r e n t l y n o th i s C PU } , t h e n a s l av e C E B t h e m a s t e r i s s to r ed i n t h e s l av e i s s to r ed i n th e PC B . the s y s t em se r v i c e ex i s t but the m a s te r does r e f e r e n c e s t o t h i s c l us t e r o n i s c r ea t ed , the address o f s l av e , a nd t h e a d d r e s s o f the I f t h e m a s t e r C E B d o e s no t ex i s t e i th e r , it i s c r e a ted f i rst in the s h a r ed memo r y . Th e n t h e s l av e i s c r e a t e d a nd e x e c u t i o n p r o c e e d s a s d e sc r i bed i n the p r ev i o us c a s e . Th e wa y i n wh i c h c ommon e v e n t f l ag s a r e s e t a nd c l ea red is d e s c r i be d i n the beg i nn i ng o f th i s c h a p t e r . Th e d i f f e r e nc e s b e twe e n s h a r ed memo r y c o mmon e v e n t b l oc k s ( ma s t e r a nd s l av e } and l o c a l memo r y c ommo n e v e n t b l o c k s a r e p i c tured in ( A l o c a l mem o r y c ommo n event b l o c k i s p i c t u r ed Figure 9-5. in Figure 9-2 . ) • Fo r a m a i l bo x i n sha r ed m em o r y , th e r e a r e a l s o th r e e c a s e s . • • • I f t h e m a i l bo x a l r e a d y e x i s t s o n th i s po r t , the Create Ma i l bo x s y s t em s e rv i c e s i mpl y a s s i g n s a c h a nn e l to i t . Th i s m e a n s t h a t the UC B po i n t e r i n a n ava i l a b l e Ch a n n e l Cont r o l Block is l o ad ed wi th the a d d r e s s o f t h e UCB d e s c r i b i ng th i s s h a r ed mem o r y m a i l bo x . I f t h e m a i l bo x i s b e i ng c r e a t e d on th i s node fo r the f i r s t t i m e , a UC B i s a l l o c a ted a nd l o a d ed w i th pa r am e t e r s t h a t d e s c r i b e t h e ma i l box . A bi t is set i n a m a i l bo x d e pend e n t field i nd i c a t i ng th a t th i s ma i l bo x UCB d e s c r i b e s a m a i l bo x in sha r ed memo r y . Final ly, the add ress of the s h a r ed memo r y ma i l bo x c o n t r o l b l o c k i s l o ad ed i n to th e UCB . ( Fi g u r e 1 6-2 ) I f t h e sha r ed memo ry m a i l box c o n t r o l b l o c k d o e s no t e x i s t ( th i s is the i n i t i a l c r e a t i o n o f the ma i l box } , i t i s c r e a t ed b e f o r e the r e s t of the o pe r a t i o n s d e s c r i b ed i n the p r ev i o us s t e p a r e pe r fo rmed . data s t r uc t u r e s are p i c t u r ed in Sh a r ed memo r y ma i l box Ma i l bo x c r e a t i o n i s d e sc r i b ed i n mo r e F i g u r e s 1 6 - 2 and 1 6 - 3 . d e t a i l i n Ch a p te r 1 6 . 9-15 Shared Memory Processor 1 Local Memory SCH$GQ_CEBHD:: �� ,, Slave CEB PCB � .. - - BETA -- u r Local CEB ... PCB - ... PCB - ..., ALPHA - ,. ,, Local CEB ... PCB - I GAMMA - I I I - ... Master CEB for shared memory CEF cluster I I I I I I I - I - BETA J� .. - I I I F igure 9 - 4 � Processor 2 Local Memory Master CEB for shared memory CEF cluster I I - GAMMA I I I I , , Slave CEB - .. - BETA I .... ::SCH$GQ_CEBHD A� - --- ... PCB - PCB ,, Slave CEB ... .. - GAMMA 'l - PCB ,, Local CEB ... - ALPHA - Re l a t ionship Between Ma s ter and S l ave CEB ... PCB - - PCB PROC E S S CONTROL AND COMMUN I CAT I ON The master CEB resides In shared memory Valid and Interlock Bits Unused Type Status Size Unused Event Flags Deletor Port Unused Unused InterNumber Creator of Processes processor Port Lock UIC of Creator The slave CEB resides In processor local memory Protection Mask Unused Count Cluster Name (up to 15 characters) (counted ASCII string) Same as Local Memory Common Event Block VA of Processor 0 Slave CEB VA of Shared Memory Control Block �� �� VA of Processor N Slave CEB Processor 0 Processor 1 Reference Count Reference Count =� Index to Master CEB VA of Master CEB �� Processor N Reference Count Figure 9-5 Processor N-1 Reference Count Sh a r e d Memo ry Commo n E v e n t F l ag Da t a S t r uc t u r e s 9-1 7 PROCE S S CONTROL AND COMMUN I CAT I ON • Fo r a g l ob a l s e c t i o n i n sh a r e d m emo r y , a spec i a l g l obal s e c t i o n d e sc r i pt o r is a l l o c a ted t h a t d e sc r i b e s t h e g l ob a l s e c t i o n i n s h a r ed m emo r y . U n l i k e g l o b a l s ec t i o n s t h a t ex i st in l o c a l memo ry , t h e r e a r e no g l o b a l pag e t a b l e e n t r i e s s e t u p fo r g l o b a l s ec t i o n s i n sh a r e d memo r y . Wh e n a p r o c e s s m a ps to the s h a r ed m emo r y g l o ba l s e c t i o n , i ts p r o c e s s p a g e t a b l e s a r e s e t up c o n t a i n t h e PFNs o f the sh a r ed memo r y pag e s a nd m a r k e d as v a l i d . Such pag e s a r e n o t c o un t ed ag a i ns t the p r o c e s s wo r k i ng s e t . Th a t i s , pag e s i n s h a r ed m em o r y do no t pag e . Th e y a r e a l wa ys v a l i d . Th i s a l l o ws t h em to be d e sc r i b ed w i t h a s i mpl e d e sc r i pto r tha t i s c o n t a i n ed i n t h e g l o ba l s e c t i o n d e sc r i pt o r , r a th e r th a n a set of global pag e table entr i es r e qu i r ed fo r g l o b a l pag e s t h a t e x i s t i n local memo ry . Mem o ry m a n ag em e n t d a ta s t r uc t u r e s a re d e s c r i bed i n Ch a pt e r 1 1 . Th e m emo r y m a n ag e m e n t s ys t em s e r v i c e s a r e d i s c u s s ed i n Ch a pt e r 1 3 . 9-1 8 C HAPTER 1 0 T IMER SUPPORT The r e a r e s e v e r a l a c t i v i t i e s t h a t r eq u i r e e i t h e r t h e t i m e o f d a y a nd d a te or t h e m e a s u r em e n t o f a n i n t e r v a l of t i m e . Th e s uppo r t fo r t i m e - r e l a t ed a c t i v i t i e s i s i m p l em e n te d bo th i n t h e VAX- 1 1 h a r d wa r e a nd i n VA X/VM S . 10. 1 T IMEKE E P I NG IN VAX/VMS Two h a r d wa r e c l o c k s a r e upd a t ed a t r eg u l a r in te r va l s , the i n te rval c lock a nd the t i m e - o f-d a y c l o c k . Th e s e c l o c k s a r e u s e d b y VM S t o m a n ag e two d i f f e r e n t t i m e s , t h e s y s tem t i m e a nd t h e t i m e b e c a u s e the s ys t em wa s l a s t b o o t s t r a pp e d . Ad d i t i o n a l l y , th e s o f twa r e t i me r p r o v i d e s t i m e r s e r v i c e s s uc h a s s c h ed u l ed wa ke ups b y m a i n t a i n i ng a t i m e - o r d e r ed q u e u e o f r e q u e s t s a nd d e l i v e r i ng t h em a s th e e x p i r a t i o n t imes occur . 10. 1. 1 H a r d wa r e C l o c k s Th e h a r d wa r e c l oc k s a r e a s e t o f p r o c e s so r r eg i s t e r s t h a t a r e used or u pd a t e d r eg u l a r l y b y t i m i ng c i r c u i t r y . In i t i al i za t i o n , c a l i b r a t ion , a n d i n t e r p r e t a t i o n o f t h e r eg i s t e r s a r e pe r f o rmed by VM S rout i ne s d u r i ng s y s tem i n i t i a l i z a t i o n a nd no rm a l o pe r a t i o n s . Th e p r o c e s so r r eg i s t e r s that i mp l em e n t the h a r d wa r e c locks are th a t s umma r i z e d in Ta b l e 1 0 - 1 , a l o ng wi th t h e memo r y l o c a t i o ns i mp l em e n t the v a r i o u s s o f t wa r e t i m e v a l u e s . 10. 1.1.1 I n te rv a l C l o c k - Th e i n t e r v a l c l oc k i s i mp l em e n t e d a s a set of th r e e 3 2 -b i t p r o c e s s o r r eg i s t e r s . Th e c l oc k " ticks" a t one m i c r o s e c o nd i n t e r v a l s w i th a n a c c u r a c y o f a t l e a s t 0 . 01% ( l ess than n i ne s e c o nd s pe r d a y ) . Th e f r e q u e nc y a t wh i c h t h e i n t e r v a l c l o c k c a u s e s an i n t e r r upt i s d e t e rm i n e d b y t h e v a l ue i n o n e o f t h e p r o c e s s o r r eg i s t e r s , PR $ _N I CR . Th e t h r e e i n t e r v a l c l o c k r eg i s t e r s 1. ( Ta b l e 1 0 - 1 ) a r e u s e d a s fo l l o ws . Th e i nterval clock c o n t r o l / s ta tus r eg i s t e r ( PR $ I C C S ) contro l s the i n t e r r up t s t a t us o f th e i n t e r v a l c l o c k . Th i s r eg i s t e r i s s e t b y t h e C P U h a rdwa r e and th e n r e s e t b y the h a rdwa r e c l o c k i n t e r r up t s e r v i c e r o ut i n e ( S e c t i o n 1 0 . 2 ) each t i m e t h e i n t e r v a l c l oc k i n t e r r up t s . 1 0-1 Tab l e 1 0 - 1 VAX/VMS Hardware C locks and S o f tware T ime r s f-' 0 I N S i ze ( b i ts) Un i t s Fr eque n c y Upd a ted by 32 1 m i c ro sec o nd 1 m i c r o s e c o nd CPU h a r dwa r e Nex t i n te r v a l 32 1 m i c ro second ( No te 1 ) S y s t e m i n i t i a l i za t i o n PR $ -I C C S Interval clock control/sta tus 32 PR $ T ODR T i m e - o f - d ay c l oc k 32 1 0 m i l l i s ec o nd s 1 0 m i l l i s econd s EXE $G Q_S YS T IM E Sys tem t i m e 64 1 0 0 n a no sec o nd s 1 0 m i l l i s econd s E XE $G L_AB S T IM Sys tem a b so l ut e t ime 32 1 s e c o nd 1 s e co nd EXE $G L_TODR T i m e - o f-y e a r b a s e v a l ue 32 1 0 m i l l i second s ( No t e 2 ) $ S E T I M E s ys t em se rv i c e EXE $G Q_TODCBASE T i m e - o f -y e a r b a s e v a l ue ( i n s y s t em t i m e fo rma t ) 64 1 0 0 n a n o s e c o nd s ( No te 2 ) $ S ET I M E s ys t em s e r v i c e Nam e Use PR $-I C R Interval clock PR $ N I CR c o n t r o l / s t a t us b i ts (1) PR $_N I CR i s wr i t t e n o n l y a t sys t em i n i t i a l i za t i o n t i m e . (2) E X E $G L_T ODR and EXE $G Q_T ODCBASE a r e mod i f i ed onl y wh en • • 1 0 m i l l i s econd s the t i m e - o f - d a y i s c h a ng ed b y a $ S ET I M E s ys tem se rv i c e r eque s t ( e i th e r expl i c i t l y o r a s a n i n teg r a l pa r t o f t h e s ys t em boo t s t r a p o pe r a t i o n ) o r t h e PR$_TODR h a s b e e n l o s t d ue t o a pro l o ng ed powe r fa i l u r e . Ha rdwa r e c l o c k i n t e r r upt serv i c e rout i n e C PU h a r d wa r e , $S ETIME s ys t em se rv i c e Ha r d wa r e c l oc k i n t e r r upt s e rv i c e r o u t i n e , $ S E T IM E s ys t em s e r v i c e Sy s t em i n i t i a l i za t i o n , EXE $T IM E OUT r e pea t i ng s ys t em s ub r o u t i n e TIMER SUPPORT 2. Th e n e x t i n t e r v a l c o un t r eg i s te r ( PR $ N I C R ) d e f i n e s how o f t e n the i n te rv a l c l o c k wi l l c a u s e a h a rdwa r e i n t e r r up t . D u r i ng s ys tem i n i t i a l i z a t i o n , t h e r o u t i n e ! N I T l o a d s th i s p r o c e s so r r eg i s te r wi th a v a l ue o f - 1 0 0 0 0 . Th i s d e f i n e s th� h a r d wa r e c lock i n t e r r up t i nte rva l to be 1 0 m i l l i s e c o nd s ( 10000 m i c r o s e c o nd s ) • 3. Th e i n t e rva l c o un t r eg i s t e r ( PR$ I C R ) is i n c r em e n t e d every m i c r o s e c o nd f r om the PR$ N I CR v a l ue towa r d zero . Wh e n PR$ I C R b e c ome s z e r o , the reg i s te r ove r f l o ws , c a u s i ng the f o llowi ng a c t i o n s . a. Th e PR$ N I C R v a l ue is c o p i ed i n to PR $_I CR to n e x t i nt e r v a l . d e f i ne the b. Th e PR$ I C C S r eg i s t e r i s s e t to i nd i c a te the o v e r f l o w c o nd i t ion . Th i s o pe r a t i o n c a u s e s a h a r d wa r e i n t e r r up t ( I PL 2 4 ) to occur , s e rv i c ed by t h e h a r d wa r e c l oc k i n te r r up t s e r v i c e r o u t i n e . Th e PR$ I C C S i s r e s e t by the ha r d wa r e c l o c k i n t e r r up t s e r v i c e r o u t i n e- to i nd i c a t e s e r v i c i ng o f the i n t e r r upt a nd r e e n a b l i ng o f t h e h a r d wa r e c l o c k . 1 0 . 1 . 1 . 2 T i me - o f -Day C l o c k - Th e t i m e - o f -d a y c l o c k is a h a r d wa r e c ompo n e n t c o n s i s t i ng o f o n e 3 2 -b i t p r o c e s s o r r eg i s t e r a n d a ba t te r y b a c k u p s u pp l y f o r a t l e a s t 1 0 0 ho u r s o f o pe r a t i o n . Th e t i m e-o f-d a y c l oc k h a s a n a c c u r a c y o f a t l e a s t 0 . 0 0 2 5 % ( a b o u t 6 5 s e c o nd s pe r m o n th ) a nd a r e so l u t i o n o f 1 0 m i l l i s e c o nd s . The b a s e t i me fo r the t i m e - o f-d a y c l o c k is 0 0 : 0 0 : 0 0 . 0 0 o ' clock of Ja n ua r y f i r s t o f the Th e t i me - o f - d a y c l o c k o v e r f l o ws a f t e r 4 9 7 d a ys . c u r r e n t ye a r . Th e p r e s e n c e o f the t i m e-o f - d a y c l o c k o p t i o n i s d e te rm i ned a t s ys tem i n i t i a l i za t ion t i me . If the c o n t e n t s of the t i me-o f-d a y c l o c k a r e v a l i d , the i n i t i a l i za t i o n process , SYS I N I T , wi l l no t p r ompt the o pe r a to r fo r the t i me . Va l u e s i n PR$ TODR a r e b i a s e d by 1 0 0 0 0 0 0 0 ( h e x ) . Va l ue s sma l l e r than th i s i nd i c a te l o s s of powe r or t i me - o f - d a y o v e r f l o w , c o nd i t i o n s c a u s i ng t h e t i me-o f -d a y c l o c k t o b e r e s e t b y ope r a to r i n put ( th r o ug h t h e $ S E T I M E s y s t em s e rv i c e } . B e c a u s e the t i m e - o f -d a y c l o c k h a s a b e t t e r a c c u r a c y th a n the i nterval c l oc k , t h e t i me - o f-d a y c l o c k i s u s e d f o r r e c a l i b r a t i ng the sys tem t i m e a t s y s t em i n i t i a l i z a t i o n a n d a t o th e r t i m e s wh e n the $ S E T I M E s ys tem s e rv i c e is c a l l ed ( S e c t i o n 1 0 . 1 . 3 ) . 10. 1. 2 So f twa r e T i me S o f twa r e t i me i s m a n ag e d by VM S r o u t i n e s a s a r e s u l t o f c h a ng e s i n the h a r d wa r e c l o c k s . Th e s y s t em t ime i s d e f i n e d by a q u a d wo r d v a l ue m e a s u r i ng the n umbe r o f 1 0 0 n a no s e c o nd i n te r v a l s s i n c e 0 0 : 0 0 o ' clock , Novemb e r 17, 1 8 58 ( th e t i me b a s e f o r the Sm i th s o n i a n I n s t i t u t i o n a s t r o nom i c a l c a l e nd a r ) . E X E $G Q S Y S T I M E ( Ta b l e 1 0 - 1 ) i s upd a t ed eve r y i n t e r r up t s e r v i c e r o u t i n e 1 0 m i l l i s e c o nd s b y t h e h a r d wa r e c l o c k ( S ec t i o n 1 0 . 2 ) . Th i s q u a d wo r d is the r e f e r e nc e fo r nea r l y a l l t i m e - r e l a t ed so f twa r e activ i t i es in the s ys t em . Fo r e x ampl e , t h e 1 0-3 TIMER S UPPORT $ G E TTIM s ys t em s e r v i c e u s e r -d e f i ned bu f f e r . s impl y wr i tes th i s q u a d wo r d val ue i n to a E XE $G L AB S T I M m e a s u r e s the n umbe r o f o n e s e c o nd i n te r v a l s tha t h a v e e l a p s e d s i nc e th e s y s t e m wa s l a s t boo t s t r a pped . Th i s a bso l u t e t i m e i s u s ed t o pe r i o d i c a l l y c h e c k f o r I / O d ev i c e t i me o u t s a nd i s a l so the v a l ue fo r " s ys t em upt ime " i n t e r p r e ted a nd d i s p l a y e d b y the $ S HOW SYS T EM DC L c omma n d . E X E $ G Q TODCBAS E c o n ta i n s t h e q u a d wo r d sys tem t i m e v a l ue e qu i v a l en t to the ba s e t i me fo r t h e t i me - o f - d a y c l o c k . EXE $G L TODR c o n ta i n s the PR $ TODR v a l ue e q u i v a l e n t to the base t i m e of t h e tTm e - o f - d a y c l o c k . Th e-b a s e t i m e v a l ue s r e p r e s e n t t h e mo r e r ec e n t o f • 0 0 : 0 0 o ' c l o c k o f J a n ua r y 1 o f the c u r r e n t ye a r , o r • t h e l a s t t i m e tha t the t i me - o f -d a y wa s r ed e f i n e d b y $ S E T I M E . E XE $G L TODR ( as 1 0 0 0 0 000 ( h e x ) wi th PR $_TODR ) is b i a s ed by a f a c to r of • 10. 1 . 3 S e t T i me S y s t em Se r v i c e Th e $ S ET I M E s ys t em s e r v i c e a l l ows a s ys tem m a n ag e r o r o pe r a to r to c h a ng e the s ys tem t i m e wh i l e VM S i s r un n i ng . Th i s may be n ec e s s a r y b e c a u s e o f a po we r f a i l u r e l o ng e r t h a n the b a t t e r y b a c k up t i me o f the t i me - o f-d a y c l o c k or b e c a u s e of c h a ng e s b e twe e n s ta nd a r d a nd d a y l i g h t s a v i ng t i m e , fo r e x am p l e . Th e n e w s y s tem t i m e ( a bso l u t e t i me , not r e l a t i v e t i m e ) i s pa s s e d a s t h e o p t i o n a l s i ng l e a rg um e n t o f t h e sys t em s e rv i c e . $S ETIME i s a l so i nv o k e d d u r i ng s ys t em i n i t i a l i za t ion to r e s e t the sys tem t i m e ( a nd po s s i b l y t h e t i m e - o f -d a y c l o c k ) . I f the r e qu e s t i ng p r o c e s s d o e s no t h a v e the p r o c e s s p r i v i l eg e s OPER and LOG I O , the r o u t i n e r e t u r n s w i th a n SS$ NOPR I V e r r o r s t a t us c o d e . I f the i np u t qua d wo r d c a nno t b e r e a d , t h e ro u t i n e r e t u r n s wi th an S S $ ACCVI O e r r o r s t a t u s c o d e . 10 . 1 . 3. 1 $ S ETIME Sys t em T i me Rec a l i b r a t i o n Requ e s ts - I f no a r g um e n t wa s pa s sed to t h e sys t em s e rv i c e o r the t i me a rg um e n t i s a z e r o va l u e , t h e n the r e que s t i s c o n s i d e r ed a r e c a l i b r a t i o n r e q ue s t . Th e fo l l o w i ng a c t i on s take place . 1. Th e nex t s y s t em t i m e , f o l l o wi ng e q ua t i o n : E X E $ G Q_S Y S T I M E = EXE $G Q_S YS T I M E , is computed E X E $G Q TODC BAS E + ( (PR$_TODR - E XE $G L_TODR ) by the * 100000) E XE $G Q_S Y S T I M E a n d EXE $G Q T ODC BAS E a r e q ua d wo r d " s ys t e m " PR $ TODR a nd E X E $G L TODR i n un i t s o f 1 0 0 n a n o se c o nd s . t imes a r e l o ngwo r d " t i me - o f - d a y " t i m e s i n un i t� o f 1 0 m i l l i s e c�nd s . Th e mul t i pl i e r of 100000 repr esents the n umbe r of 1 0 0 n a n o s e c o nd i n t e r v a l s i n 1 0 m i l l i s e c o nd s . 2. Ea c h e l em e n t i n t h e timer queue ( Sec t i on 1 0 . 3 . 2 ) has i ts a bso l ut e expi r a t i o n t i m e ad j u s ted by the d i f f e r e n c e b e t we en the p r e v i o us s ys t em t i m e a nd the n e w s ys t em t i m e . 1 0-4 T I MER S U PPORT Fo r t i me r r e q u e s t s t h a t e x p r e s s ed t h e i r e x p i r a t i o n t i m e a s a n i n t e r va l , th i s r e c a l i b r a t i o n c a us e s e a c h t i m e r r e q ue s t to e x p i r e a f t e r the s ame i n te r v a l as o r i g i na l l y r e q u e s t e d . Fo r t i m e r r e q u e s t s t h a t ex p r e s s ed t h e i r e x p i r a t i o n t i m e a s a n a b so l u t e t i m e , th i s r e c a l i b r a t i o n c a u s e s t h e e x p i r a t i o n t i me t o b e r e a d j us t e d j u s t as the s ys tem t i me wa s r e a d j us t e d . Such r e q u e s t s w i l l e x p i r e a t a d i f f e r e n t t i me t h a n o r i g i na l l y r e q u e s ted . Ho wev e r , the i n t e r v a l b e twe e n the o r i g i n a l sys t em t i me and the o r ig i n a l r e q u e s t t i me is i d e n t i c a l to the i n te r v a l b e twe e n the n ew s y s t em t i m e a nd the new e x p i r a t i o n t i me . 3. Th e ent i re col lection o f s ys tem i nc l ud i ng pa r am e t e r s , i s wr i t t e n bac k to the E XE $G Q TODCBAS E a nd E XE $ G L TODR , sys t em- i m a g e f i l e . 10. 1.3.2 $ S E T IME T i me - o f -Da y Re a d j us tm e n t Re qu e s t s - If a non z e ro t ime v a l ue i s s uppl i ed a s an a r g um e n t to $ S ET IME , then the fo l l o w i ng o pe r a t i o n s o c c u r . 1. Th e i n p u t a r g ume n t , spec i f i e d in " s y s t em t i m e un i t s " of 1 0 0 n a n o s e c o nd s , 1s c o nv e r ted i n to " t i m e -o f-d a y un i t s " ( th e n umb e r o f 1 0 m i l l i s e c o nd i n te r v a l s a f t e r 0 0 : 0 0 o ' c lock o f J a n u a r y 1 o f the b a s e ye a r ) • 10 . 2 2. Th e c o nv e r ted spec i f i ed t i m e i s E XE $ G L_TODR . wr i t t e n i n to 3. Th e unconve r t ed spec i f i ed t ime E XE $G Q_TO DC BASE a n d E XE $G Q_S YST IME . 4. F i n a l l y , the t i m e r q ue ue i s upd a t ed and the new v a l u e s fo r the t i me-o f-d a y c l o c k b a s e a r e wr i t t e n to the sys t em i m ag e f i l e ( a l o ng w i th the sys tem pa r ame t e r s ) . ( S e e s t e ps 2 a nd 3 d e sc r i bed above i n Se c t i o n 1 0 . 1 . 3 . 1 ) . is PR $ TODR wr i t t e n a nd i n to HARDWARE C LOCK INTERRUPT SERV I C E ROUT INE Th e h a r d wa r e c l oc k i n t e r r upt s e r v i c e r o u t i n e , EXE $ HWC L K I N T i n mod u l e T I M E S C HDL , s e rv i c e s the I PL 2 4 h a rdwa r e i n t e r r upt s i g n a l l ed wh e n the i n t e r v a l c l o c k , PR$ I C R , r e a c h e s z e ro . Th e i n te r v a l c lock is set ( th r o ug h PR $_N I C R ) to i n t e r r upt ev e r y 1 0 m i l l i se c o nd s . The h a r d wa r e c l oc k i n t e r r upt s e r v i c e r o u t i n e h a s two m a j o r f un c t i o n s . • • upd a t i ng the sys tem t i me ( a nd po s s i b l y p r o c e s s a c c o un t i ng ) and chec k i ng t h e t i me r que ue fo r t i me r e v e n t s to be now . 1 0-5 r e po r ted T I MER S UP PORT 10. 2.1 S y s t em T i me U pd a t i ng Th e upd a t i ng o f the s y s tem t i me a nd t h e po t e n t i a l upd a t i ng o f a c c o un t i ng f i e l d s r e q u i r e s s e ve r a l d i s t i nc t a c t i o n s . process 1. Th e PR $ I C C S r eg i s t e r i s r e s e t to i nd i c a t e th e s e r v i c i ng t h e i n te r r up t a nd t h e r e e n a b l i ng o f t h e h a r d wa r e c l o c k . of 2. Th e s y s t em t i m e , EXE $G Q S Y S T I M E , i s u pd a t ed by a d d i ng e q u i v a l e n t o f 1 0 m i l l i sec o nd s to t h e q u a d wo r d va l ue . the 3. I f the h a r d wa r e c l o c k i n t e r r u p t s wh i l e a p r o c e s s i s e x e c u t i ng ( th e f o r m e r c u r r e n t s t a c k wa s no t t h e i n t e r r up t s t a c k ) , t h e n t h e a c c umu l a t e d CPU u t i l i z a t i o n a n d q u a n t um va l u e are i n c r emen ted i n t h e p r o c e s s h e ad e r . Th e q ua n t um va l u e i s u s e d to d e t e rm i n e q u a n t um e n d ( S e c t i o n 1 0 . 3 . 1 a n d Ch a p t e r 8 ) . If t h e q u a n t um va l u e r e a c h e s z e r o , a n I PL 7 s o f t wa r e i n t e r r upt , s e r v i c ed by t h e s o f twa r e t i m e r r o u t i n e , is r e q u e s t ed . Th e c h e c k f o r wh e th e r the i n t e r r u pt o c c u r r ed wh i l e a l r e a d y o n th e i n t e r r up t s t a c k p r e ven t s a p r o c e s s f r om be i ng c h a r g ed fo r C PU t i me th a t t h e s y s tem wa s u s i ng to s e r v i c e i n t e r r up t s . 10. 2.2 T i m e r Queue T e s t i ng Th e t i me r q u e ue i s d i s c u s s ed w i th the s o f twa r e t i m e r in the n e x t s ec t i o n . Th e h a r d wa r e c l oc k i n te r r up t s e rv i c e r o u t i ne has the r e s po n s i b i l i t y to d e t e rm i n e i f t h e s o f twa r e t i m e r m u s t b e r e que s t e d t o If t h e f i r s t t i m e r q u e u e e l em e n t h a s a n s e rv i c e the t ime r que u e . e x p i r a t i o n t i me l e s s t h a n o r equa l t o the n ewl y upd a ted s y s tem t i m e , then t h e t i m e r e v e n t i s d ue . Th e s o f twa r e t i m e r r o u t i n e i s r e que s t e d th r o ug h t h e I P L 7 i n t e r r up t . 10. 3 S OFTWARE T IMER INTERRUPT S E RVI C E ROUT INE Th e so f twa r e t i m e r i n t e r r upt s e r v i c e r o u t i n e , E XE $ SWT I M I NT in mod u l e T I M E SC HDL , is i nv o k e d t h r o ug h the I P L 7 s o f t wa r e i n t e r r upt . Th e s o f twa r e t i me r i s r e q ue s t ed bec a use e i th e r the first t imer queue e l em e n t m u s t b e s e r v i c ed o r t h e c u r r e n t p r o c e s s h a s r e a c h ed qua n t um e nd . I f t h e s ys t em t i m e , E XE $G Q S YS T I M E , i s g r e a t e r t h a n o r e q ua l to th e exp i r a t i on t i me o f t h e -f i r s t e l em e n t i n t h e t i m e r q u e ue , then t h e t i m e r e v e n t i s d ue . Th e c ompa r i s o n wi th the s ys tem t i me mus t b e pe r fo rmed a t I P L 2 4 t o b l o c k t h e h a r d wa r e c l o c k i n t e r r up t . I f a t i m e r r e que s t i s d u e , then t h e TQE is r emoved f r om the t imer que u e , the I P L d r o pped bac k t o I P L $ T I MER ( I P L 7 ) , a nd o n e o f th r e e s e q u e n c e s o f c o d e i s p e r f o rm ed ( d epend Tng upon t h e typ e o f r e que s t ) . 10. 3.1 Qua n t um Exp i r a t i o n Th e e x p i r a t i o n o f t h e q u a n t um i n t e r va l for the c u r rent process is d e t e rm i n ed by t e s t i ng the PHD$W Q UANT f i e l d . Th i s f i eld is i nc r emen ted by t h e h a r d wa r e c l o c k s e r vic e rout i ne . A z e r o qu a n t um va l ue i nd i c a t e s qua n t um e x p i r a t i o n . Th e p r o c e s s i ng o f t h e q u a n t um end 1 0-6 T IMER S U PPORT e v e n t i s pe r fo rmed by t h e s c h ed u l e r d e sc r i b e d i n Ch a p t e r 8 . 10. 3.2 in rout ine S C H $ Q E ND , wh i c h is T i me r Q u e u e a n d T i m e r Que u e E l em e n t s T i m e r r e que s t s a r e ma i n ta i n ed i n a d o ub l y l i n ked l i s t th a t i s o r d e r ed by the e x p i r a t i o n t i me o f the r e q ue s t s . E XE$G L T Q F L a nd EXE $G L T QB L a r e a pa i r o f l o ng wo r d s ( d e f i n ed i n the mod u l e SYS C OMMON ) th a t -fo rm th e l i s th e a d of the t i m e r q u e u e . E l em e n t s i n the t i me r que ue a r e d a t a s t r uc t u r e s t h a t a r e g e n e r a l l y a l l o c a t ed f r om no npag ed d yn am i c m emo r y a nd i n i t i a l i zed as a r e s ul t of $ S E T IMR sys tem serv i ce calls ( Sec t i on 1 0 . 4 . 1 ) . Th e a l l o c a t i o n o f t i m e r queue e l em e n t s ( TQEs ) is g o ve r n e d b y the po o l ed j o b quo ta J I B $W_T QCNT . Th e fo rma t o f the t i m e r que ue e l em e n t i s shown in Figure 1 0-1 . Th e l i n k f i e l d s ( T QE $ L T Q F L a nd TQE $ L T QB L ) , the TQE $W S I Z E f i e l d , a nd the TQE $ B TYPE f i eld a r e cha r a c te r i s t i c of s y s t em- d a t a s t r uc t u r e s a l l o c a ted f r om d yn am i c m emo r y . Th e T QE $ 8 RQTYPE f i e l d d e f i n e s the t ype of t i m e r r e que s t ( p r o c e s s t i m e r r e q ue s t , -pe r i od i c s y s tem r o ut i ne r e qu e s t , or process wa k e r e que s t ) a nd wh e the r the r eque s t i s a o n e - t i m e o r r e pe a t i ng r e que s t ( s e e the l i s t o f TQE r eque st t ype s in Figure 1 0-1 ) . Bit 6 o f TQE $ B R QTYPE is set if a n AST i s to be d e l i v e r ed wh e n the t i m e r e v e n t occ u r s . Th i s b i t i s e q u i v a l e n t to the AC B $V_Q U O TA b i t o f the AST c o n t r o l b l o c k d e sc r i b ed in Ch a pt e r 5 . RQTYPE I TQFL TQBL TYPE SIZE P I D / PC AST/FR3 ASTPRM / FR4 I TIME - DELTA - - - - - I I EFN RQPID R MOD TQE $ 8- RQTY PE 3 2 1 0 7 6 5 .______IIIIC 1 Figure 1 0-1 Process timer request System subroutine request Scheduled wake request One-time request Repeat request (not allowed for process timer requests) AS T is associated with timer event L a yo u t of a T i m e r Que ue E l eme n t 1 0 -7 T IMER SUPPORT Th e i n t e r p r e t a t i o n o f the n e x t three l o ng wo rd f i e l d s d e p e nd s upo n wh e th e r the r e que s t is f r om a sys t em s u b r o u t i n e o r a use r p r o c e s s . Fo r s y s t em s ub r o u t i n e r e q ue s ts , t h e f i e l d s c o nta i n the PC , R 3 , a n d R4 r eg i s t e r v a l ue s to b e l o a d ed b e fo r e pa s s i ng c o nt r o l t o the s ub r o u t i n e . Fo r p r o c e s s t i m e r r e qu e s t s , t h e f i e l d s d e f i n e the p r o c e s s ID o f the process t o r e po r t t h e e v e n t , t h e a d d r e s s o f a n AST r o u t i n e to e x e c u t e ( i f r eque s t ed ) , a nd a n o p t i o n a l A S T pa r am e t e r . TQE $ Q T IM E i s the quadwo r d abso l u t e s ys t em t i m e a t wh i c h a pa r t i c ul a r t i me r - e v e n t i s t o occur . TQE $ Q D E LTA i s t h e qu a d wo r d d e l t a t i m e f o r r ep e a t i ng r e que s t s . Th e a c c e s s mod e o f the r e que s t o r i s s to r ed in TQE $ 8 RMO D . Th e event f l ag t o s e t wh e n the t i me r e v e n t o c c u r s i s d e f i ned b y TQE $8 E FN . Th e TQE $ L RQP I D c o n t a i n s t h e p r oc e s s I D o f the p r oc e s s t h a t made the i n i t i a l tTm e r r e q ue s t . ( Th e r e que s t i ng p r o c e s s i s n o t n e c e s s a r i l y t h e s a m e a s t h e t a rg e t p r o c e s s . ) I f a n AST i s r e q u e s t e d , t h e t i m e r que ue e l em e n t wi l l be i nto an A S T c o n t r o l b l o c k ( AC 8 ) wh e n t h e event o c c u r s . 10. 3. 3 r e fo rm a t t ed T i me r Re q ue s t S e rv i c i ng I f t h e TQE i s a p r o c e s s t i m e r r eq ue s t ( c r e a t ed by a $ S E TIMR s y s t em s e rv i c e c a l l and i nd i c a t e d by a TQE $ 8 RQTYPE v a l ue o f z e r o ) , t h e n t h e f o l l o w i ng ope r a t i o n s a r e pe r fo rmed . 1. Th e e v e n t f l a g a s s o c i a te d wi th th i s t i m e r event is s e t by u s i ng the TQE $ L P I D a nd TQE $ 8 E FN f i e l d s a nd i nvo k i ng t h e S C H $ POSTEF r o u t i n e . A s o f twa r e pri o r i ty i nc r em e n t o f th r e e w i l l b e a pp l i ed wh e n t h e p r o c e s s n e x t e x e c u t e s ( Ch a pt e r 8 ) . 2. I f the t a r g e t p r o c e s s i s n o l o ng e r i n the sys t em , t h e TQE s i m p l y d e a l l o c a ted wi t ho u t f u r th e r a c t i o n . 3. O t h e rwi s e , t h e J I 8 $W T QCNT quo t a i s i nc r em e n t e d to i nd i c a t e i m p e nd i ng the d el ivery o f - the t ime r event and the d e a l l oc a t i o n o f the TQE . 4. I f a n AST wa s r e q u e s t e d ( i nd i c a ted by b i t 6 o f TQE $ 8 RQTYPE ) , t h e n t h e TQE $ 8 RMOD f i e l d i s moved to TQE $ 8 RQTYPE to r e f o rma t the TQE- i n to an AST c o n t r o l b l o c k ( AC 8 ) . -Th e AC8 i s t h e n q u e ued to the t a rg e t p r o c e s s , i n the a c c e s s m o d e o f t h e o r ig inal t imer reque s t , by c a l l i ng the rout i ne S C H $ QAST ( Ch a pte r 5 ) . is Wh e n t h e p r o c e s s i ng o f th i s t i m e r que ue e l em e n t h a s b e e n c ompl e ted , t h e s o f twa r e t i m e r r o u t i n e c h e c k s to s e e i f ano th e r TQE e l em e n t c a n b e r emoved f r om the que ue . No t e t h a t p r o c e s s t i m e r r e que s t s a r e s t r i c t l y o n e - t i m e r e que s t s . An y r e pe t i t i o n o f t i m e r r e que s t s m u s t be i mpl em e n ted wi th i n the r e qu e s t i ng process . 1 0 -8 TIMER SUPPORT 10 . 3. 4 Sched u l ed Wa k e up Th e s e c o nd t ype o f t i me r q u e ue e l eme n t i s a s s o c i a t ed wi th a r e que s t fo r a s c h ed u l ed $WAKE t o a h i b e r na t i ng p r o c e s s . Th i s t yp e o f r e q ue s t m a y b e e i th e r o n e - t i m e o r r e pe a t i ng a nd m a y b e r e q ue s t ed by a p r o c e s s o th e r th a n t h e t a r g e t p r o c e s s . Th e f o l l o w i ng o pe r a t i o n s a r e pe r f o rm e d fo r s c hed u l ed wa ke TQE s . 1. Th e t a rg e t p r o c e s s ( i n d i c a te d by TQE $ L P I D ) i s a wa ke ne d by e x e c ut i ng the r o u t i n e SCH$WAKE . If the t a rg e t p r o c e s s i s no l o ng e r in the s y s t em , the PC B $W ASTCNT q uo t a of the Ts r e qu e s t i ng pr o c e s s ( T QE $ L RQP I D ) i nc r em e n t e d a nd �� e c o n t r o l b l o c k i s d e a l l o c a t e d to nonpaged d ynam i c memo r y . 2. I f the r e que s t i s a o n e - t i m e r e que s t ( i nd i c a t ed b y a c l e a r ed T Q E $ V RE PEAT bit in the TQE $ 8 RQTY PE f i e ld ) , then the d e a l loc a t i o n o p e r a t i o n i s t h e s ame as tha t d e sc r i bed in i t em 1 . 3. I f the r eque s t i s a r e pe a t i ng t ype , th en the r e pe a t i nterval ( T QE $ Q D E LTA ) i s a d d ed to the r e que st t i me ( T QE $ Q T I M E ) , a nd t h e t i me r que ue e l emen t i s r e i n s e r t ed i n the t i m e r que ue . Th e so f t wa r e t i me r r o u t i n e t h e n c h e c k s to r e que s t c a n a l s o be pe r f o rmed a t th i s t i m e . 10 . 3 . 5 see if the next t imer Pe r i o d i c Sys t em P r o c ed u r e s Th e th i r d t ype o f t i m e r que ue e l em e n t d e f i n es a s ys tem s ub r o u t i n e A r e que s t o f th i s t ype i s n o t the r e s u l t o f a n y p r o c e s s r e que s t . r e qu e s t , b u t i s a s ys tem- r e q ue s t e d t i m e - d e pe nd e n t eve n t . Th e so f t wa r e t i m e r i n t e r r upt s e r v i c e r o u t i n e h a nd l e s th i s type o f TQE by • TQE $ L FR3 a nd TQE $ L FR4 f i elds l o a d i ng R 3 a n d R 4 f r om the as the TQE $ L_AS T a nd TQE $ L_AST PRM f i e l d s ) ( n o rma l l y d e f i ned a nd • the a JSB u s i ng i n s t r uc t i o n e x e c u t i ng ( no r ma l l y d e f i n ed a s t h e TQE $ L_P I D f i e l d ) . TQE $ L F PC - f i eld On r e t u r n f r om the s ys tem s ub r o u t i n e , the TQE $V RE PEAT b i t i s tested . I f the b i t i s s e t , then the TQE i s r e i n s e r ted i n the t i me r que ue us i ng the TQE $ Q DE LTA t i me f i e l d . I f the r e que s t wa s a n o n r e pe a t i ng one , then the - t i m e r r o u t i n e i mm ed i a t e l y c h e c k s the t i m e r que ue fo r f u r the r TQEs to s e r v i c e . Th e TQE i s n o t d e a l l o c a ted bec a u se the s e r e que s t s d o not u s e d yn am i c m emo r y . Th i s t ype of TQE is d e f i ned in s t a t i c nonpag ed po r t i o n s o f s ys tem s pa c e , s uc h a s the mod ul e SYSCOMMON i n the c a s e of the EXE $T IME OUT s ub r o u t i n e . r e pe a t i ng s ys tem One e x amp l e o f th i s t ype o f r e qu e s t , a execut ion o f the is r e que s t , o n c e - pe r - s e c o nd the E XE $ T I M E O UT . 1. Th e r o u t i n e SCH$ SWPWAK E i s c a l l ed swa ppe r p r o c e s s ( Ch a p t e r 1 4 ) . 1 0-9 to po s s i b l y s ub r o u t i n e s ub r o u t i n e a wa k e n the T IMER S UPPORT 2. Th e E XE $ T I M E OUT s u b r o u t i n e upd a t e s the E XE $G L ABST IM f i e l d to i nd i c a t e t h e pa s s i ng o f o n e s e c o nd o f sys t em upt i m e . 3. Th e r o u t i n e ERL$WAKE i s c a l l ed to po s s i b l y a wa k e n the p r o c e s s ( Ch a p t e r 7 ) . 4. Th i s s ub r o u t i n e s c a n s t h e I /O d a t a b a s e fo r d ev i c e s t h a t h a v e e x c e ed ed the i r t imeout i n terva l s . D r i v e r s f o r s u c h d ev i c e s a r e c a l l ed a t th e i r t i m e o u t e n t r y po i n t s a t d ev i c e I PL . A p a t h th r o ug h t h i s s ub r o u t i n e c h e c k s fo r t e rm i n a l t i med r e a d s t h a t h a v e e x p i r ed . ERRFMT Th e TQE f o r th i s s ub r o u t i n e i s p e rma nen t l y d e f i n ed in the mod u l e SYSCOMMON , a nd t h e t i m e r queue i s i n i t i a l i z ed a t boo t s t r a p t i me wi th t h i s d a ta s t r uc t u r e a s the f i r s t e l emen t i n the que ue . Th e t e rm i n a l d r i v e r a l s o u s e s a r e pe a t i ng sys t em timer r o ut i ne to i m p l em e n t i t s mo d em po l l i ng . Th e c o n t r o l l e r i n i t i a l i z a t i o n r o u t i n e i n t h e t e rm i n a l d r i v e r l o ad s the ex p i r a t i o n t i me f i e l d i n a TQE in the t e rm i n a l d r i v e r wi th t h e c u r r e n t s ys tem t i m e , s e t s the r e pea t b i t , a nd l o ad s t h e r e pe a t i n t e r v a l wi t h t h e SYSBOOT pa r am e t e r TTYS CANDE LTA . Wh e n t h e t i m e r r o u t i n e e x p i r e s , i t po l l s e a c h mod em l o o k i ng fo r s ta t e c h a ng e s . 10 . 4 T IMER S YSTEM S ERVI C E S Two sys tem s e rv i c e s a r e u s ed to i ns e r t e n t r i e s in the t imer queue , S c h ed u l e Wa k e r e que s t ( $ S C H DWK ) a nd Se t T i m e r r e que s t ( $ S ET I MR ) . Bo th of the s e s e rv i ces a r e c o n ta i n ed in the mod u l e SYSSC HEVT . Two c ompl em e n t a r y s e r v i c e s d e l e t e e n t r i e s f r om the t i m e r queue , $CANWAK a nd $ CANT I M . Th e s e s ys t em s e rv i c e rout i n es a r e in the mod ul e SYSCANEVT . 10 . 4 . 1 $ S ETIMR Requ e s t s $ S E T IMR s ys t em s e r v i c e c a l l s p r o d uc e t i m e r que ue e n t r i e s o f the s i ng l e process r e que s t t ype , TQE $ C_TMSNG L . Th e fo l l o w i ng s t eps are pe r fo rmed . 1. Th e e v e n t f l ag spec i f i ed a s a n a rg um e n t to the s ys tem s e r v i c e is c l e a r ed in p r ep a r a t i o n fo r s ub s e que n t s e t t i ng at e x p i r a t i o n t i me . 2. Th e r e que s t i s c h e c k e d t o m a k e s u r e tha t • • • 3. the d e l t a t i me l o c a t i o n i s ac c e s s i b l e by t h e r e que s t o r , the PC B $W A S TCNT o f the r e que s t i ng process is not e x c eed ed { i f a n A S T i s to b e a s soc i a t ed w i th th i s t i m e r r e qu e s t ) , a nd the J I B $W_T QCNT o f t h e r e que s t i ng j o b i s n o t e x c e ed ed . A t i m e r q u e u e e l em e n t i s a l l o c a ted f r om no npag ed d yn am i c memo ry a nd the TQE i s i ni t i a l i z e d f r om the s ys t em s e r v i c e a r g umen t s ( d e l ta t i m e , r e que s t t ype , and p r o c e s s I D ) . 1 0- 1 0 T IMER S U P PORT 4. If the e x p i r a t i o n t i me wa s e x p r e s s ed as an i nterval (a n eg a t i v e a r g um e n t ) , t h e n t h e a b s o l u t e e x p i r a t i o n t i m e o f t h e r e que s t i s c a l c u l a te d by a d d i ng t h e d e l ta t i m e o f the r eq u e s t t o t h e c u r r en t sys tem t i m e , EXE $G Q S Y S T I M E . Th e a b s o l u t e e x p i r a t i o n t i m e i s s t o r ed i n t h e TQE $ Q=T I ME f i e l d . 5. Th e J I B $W T QCNT f i e l d o f t h e po o l ed j ob quo t a s i s d ec r em e n t e d t o i nd i c ate t h e a l l o c a t i o n o f t h e TQE . 6. Th e a c c e s s mod e o f the s y s tem s e rv i c e c a l l e r i s s t o r ed i n t h e TQE $ 8 RMOD f i e l d . If a n AST r o u t i ne wa s s p e c i f i ed a s a n a r g umen t t o t h e $ S E T IMR c a l l , t h e n the p r o c e s s PC B $W ASTCNT i s d e c r em e n t e d to i nd i c a t e the f u t u r e AST d e l i v e r y a nd b i t 6 o f TQE $ B_RMOD i s s e t to i nd i c a t e the AST a c c o un t i ng . 7. Th e AST p a r am e t e r ( r e q u e s t i d en t i f i c a t i o n ) n um b e r a r g um e n t s a r e c o p i ed to t h e TQE . 8. Th e TQE i s t h e n i n s e r t ed i n t o t h e t i m e r q u e ue a nd the r o u t i n e r e turns . a nd ev e n t f l ag Th e $ CANT IM s ys t em s e rv i c e r emo v e s o n e o r mo r e t i me r que u e e l em e n t s b e fo r e expi ra t i on . Two a rg um e n t s , r e que s t i d e n t i f i c a t i o n /AST p a r am e t e r a nd a c c e s s mo d e , c o n t r o l t h e a c t i o n s t a k e n by th i s r o u t i n e . 1. Th e a c c e s s mo d e r e que s t e d i s m a x i m i zed w i t h t h a t o f the caller . ( Th a t is , no r e que s t s c a n be d e l e t ed fo r a c c e s s mod e s mo r e p r i v i l eg ed t h a n t h e c a l l e r . ) 2. E a c h TQE i n t h e t i m e r q u e u e tha t m e e t s a l l o f c r i t e r i a i s r emoved a nd d e a l l o c a t e d . • • • 10 . 4 . 2 the f o l l o w i ng Th e p r o c e s s I D o f the $ C ANT IM s ys tem s e r v i c e t h e same a s the p r o c e s s I D s t o r e d i n the T QE . cal ler Th e a c c e s s m o d e o f t h e c a l l e r i s a t l e a s t a s t h e a c c e s s mod e s to r ed i n the TQE . p r i v i l eg ed as is Th e r e que s t i d e n t i f i c a t i o n/A S T p a r am e t e r a rg um e n t i s the s a m e a s t h a t s to r ed i n t h e TQE . I f the a rg um e n t v a l ue i s z e r o , t h e n a l l TQEs m e e t i ng t h e f i r s t two c r i te r i a are r emoved . S c h ed u l ed Wa k e up Th e l og i c f o r m a n ag i ng s c h ed ul ed wa k e up r eque s t s i s s i m i l a r to tha t fo r $ S ETIMR r e que s t s . Two d i f f e r enc e s a r e the ab i l i t y to s p e c i f y r e pe a t i ng s c h ed u l ed wa k e up r e que s t s a nd the a b i l i t y to sched u l e wa k e up r eque sts f o r a n o th e r p r o c e s s . Th e f o l l o w i ng s t eps c r e a t e a s c h ed u l ed wa k e up r e q u e s t . 1. Th e t a rg e t p r o c e s s I D i s v e r i f i ed f r om a sys t em s e rv i c e a rg um e n t . If t h e t a rg e t p r o c e s s i s n o t i n the sys t em , t h e s c hed u l ed wa k e up r e que s t i s i g no r ed . 2. I f t h e t a rg e t p r o c e s s e x i s t s , a nd i f the c u r r e n t p r o c e s s is s u i ta b l y p r i v i l eg ed ( G ROUP o r WOR LD ) wi th r e s pe c t to i t , t h e n t h e r e pe a t t i m e i s t e s t e d to d e t e rm i n e wh e th e r the r e que s t i s a one- t ime o r r e pe a t i ng s c h ed u l ed wa k e up , TQE $ C WKSNG L o r T QE $ C_WKR E PT o f t h e TQE $ B_RQTYPE f i e l d . 1 0-1 1 TIMER S UPPORT 3. Th e r e q u e s t e d r e pe a t t i m e i s fo rma t t e d f o r i ns e r t i o n in the TQE . I f t h e r e pe a t t i m e i s l e s s t h a n 1 0 m i l l i s e c o nd s , i t i s i n c r e a s e d t o t h a t v a l ue ( th e r e so l ut i o n o f the h a r d wa r e c l o c k i n t e r r up t ) • 4. A T QE i s a l l o c a t e d f r om n o npag ed d yn am i c memo r y . 5. Th e r e pe a t t i m e , r e q ue s t type , i n s e r t e d i n to t h e TQE . 6. I f t h e i n i t i a l s c h e d u l ed wa k e u p t i m e i s e x p r e s s ed as an i nt e rva l , th e the ini tial a b s o l ut e expi r a t i on t ime is c a l c u l a t e d a s i n $ S ET IMR f r om t h e i n i t i a l d e l t a t i m e a nd the c u r r e n t s ys tem t i m e . 7. Th e AS TCNT q uo t a o f the r eq ue s t i ng p r o c e s s i s d ec r em e n t e d a c c o un t f o r th e a l l o c a t i o n of t h e TQE . 8. Th e TQE i s i n s e r te d i n to the t i m e r q u e u e . a nd target process ID are to E x p i r a t i o n t i me wi l l c a us e a p r o c e s s wa k e up to the t a r g e t p r o c e s s ( Sec t i on 1 0 . 3 . 4 } . Dea l l o c a t i o n o f t h e TQE o c c u r s a f t e r d e l i v e r y o f a o n e - t i m e s c h ed u l ed wa k e u p r e que s t o r a s a r e s u l t o f a $ CANWAK s ys t em s e rv i c e c a l l . Th e $ CANWAK s ys t em s e rv i c e c a nc e l s a l l o n e- t i m e a nd r epe a t s c h e d u l ed wa k e up r e que s t s fo r a t a rg e t p r o c e s s . E a c h c a nc e l l ed TQE is d ea l l o c a t e d to n o n pag ed d yn am i c memo r y a nd t h e PCB $W ASTCNT o f t h e i n i tial r e que s t i ng process is i nc r em e n ted to- i nd i c a t e t h e d ea l l o c a t i on . 10-1 2 PART I V MEMORY MANAG EMENT " I c o n s i d e r t h a t a ma n ' s b r a i n o r i g i na l l y is l i ke a l i tt l e empty a t t i c , a nd yo u h a v e to s to c k i t wi th s uc h f u r n i t u r e as yo u c ho o s e . No w , the ski l l ful wo r km a n i s very c a r e f u l i nd e ed a s to wh a t h e t a k e s i n to his b r a i n- a t t i c . H e wi l l h a ve n o t h i ng b u t t h e to o l s wh i c h m a y h e l p h i m i n d o i ng h i s wo r k , but o f t h e s e h e h a s a l a rg e a s s o r tm e n t , a nd a l l i n the m o s t pe r f e c t o r d e r . It is a m i s ta ke to th i n k tha t tha t l i t t l e r o om h a s e l a s t i c wa l l s a nd c a n d i s t e nd t o a n y e x t e n t . De pend upo n i t , t h e r e c om e s a t i m e wh e n f o r ev e r y a d d i t i o n o f knowl edg e yo u f o rg e t s om e t h i ng that yo u knew b e fo r e . It is of h i g h e s t i mpo r ta n c e , th e r e f o r e , n o t t o have u s e l e s s f a c t s e l bowi ng o u t the u s e f u l o n e s . " A S t ud y i n Sc a r l e t S i r A r th u r C o n a n Do y l e CHAPTER 1 1 MEMORY MANAG EMENT DATA STRUCTURES Vi r t ua l memo r y s uppo r t i n VAX/VM S i s impl em e n ted b y s e v e r a l d i s t i nc t p i ec e s o f the e x ec u t ive . Th e t r a n s l a t i o n- no t-va l i d f a u l t h a nd l e r ( pa g e r ) i s t h e e x c e pt i o n s e r v i c e r o u t i n e th a t r e s po nd s t o pag e f a u l ts a nd b r i ng s p r o c e s s v i r t ua l pag e s i n to m emo r y on beha l f o f a p r o c e s s . Th e s wa ppe r p r o c e s s k e e ps t h e h i g h e s t p r i o r i t y c omputa b l e p r o c e s s e s i n phys i c a l memo r y , r emov i ng tho s e p r oc e s s e s th a t a r e b l o c k e d f o r some r e a s o n in f a v o r of n o n r e s i d e n t c ompu t a b l e p r o c e s s e s . Seve r a l s ys t em s e rv i c e s a l low a p r og r am to e x e r c i s e some cont r o l o v e r i t s b e h a v i o r wh i l e i t i s e x e c u t i ng . Th e s ys tem ma i n t a i n s m a n y t a b l e s , s ome process s pe c i f i c a nd o th e r s s ys tem wi d e , t h a t m u s t b e m a n i pu l a t e d b y the ma j o r c ompo n e n t s o f the memo r y ma n a g em e n t s ub s ys t em . B e f o r e we d i sc us s each c ompo ne n t , we wi l l d e sc r i b e the s e t a b l e s . Th e d a t a s t r uc t u r e s a r e p r e s e n t e d i n f o u r s e pa r a t e s e c t i o n s . Th e p r o c e s s - s p e c i f i c d a t a , f o und m o s t l y in the p r o c e s s h e ad e r , i s d e sc r i b ed f i r s t . Th e d a ta th a t i s used to a c c o un t f o r phy s i c a l memo r y , t h e so - c a l l ed PFN d a t a b a s e , i s then p r e s e n t ed . Th e s pe c i a l s t r uc t u r e s that a re u s ed f o r g l o b a l pag e s h a v e the i r p r o c e s s - s pe c i f i c a n a l og u e s b u t a re put i n to a s e pa r a t e sec t ion . Fi nal l y , tho s e s t r uc t u r e s th a t s uppo r t the MA 7 8 0 s h a r ed m emo r y a r e p r e s e n t ed . 11. 1 PROC ESS DATA STRUCTURES ( PROC E S S HEADER ) Th e mo s t i mpo r t a n t p r o c e s s - s pe c i f i c d a ta s t r uc t u r e s th a t a r e used by t h e memo r y m a n a g em e n t s ub s ys t em a r e c o n t a i n ed in th e p r o c e s s h e a d e r ( Fi g ure 1 1 -1 ) . Th e process h e ad e r conta i n s all of the p r o c e ss- spec i f i c d a ta tha t c a n b e r emoved f r om m emo r y wh e n a p r o c e s s i s o u t swa ppe d . Th e a d d r e s s o f t h e p r o c e s s h e ad e r is s to r ed in the s o f twa r e PCB . F i g u r e 1 1 - 1 s h ows the po r t i o n s o f t h e s pe c i a l i n t e r e s t to m emo r y m a n ag em e n t . o f the p i eces o f t h e p r o c e s s h e ad e r p a r am e t e r s sho wn i n t h e f i g u r e . p r o c e s s h e ad e r th a t a r e o f App e nd i x E s h o ws h o w t h e s i ze s a re rel a ted t o the SYSB OOT 1. Th e PO and Pl p a g e t a b l e s a r e the l a rg e s t c o n t r i b u to r to the s i ze of the p r o c e s s h e a d e r a nd c o n t a i n the c om p l e t e d e s c r i pt i o n o f t h e v i r t ua l a d d r e s s s pa c e c u r r e n t l y b e i ng u s e d by t h e p r o c e s s . 2. Th e wo r k i ng s e t l i s t d e sc r i b e s the s ub s e t o f p r o c e s s pag e t a b l e e n t r i e s t h a t a r e c u r r e n t l y v a l i d b u t c a n b e c om e i nv a l i d i n the f u tu r e . PFN-ma pped pag e s a nd pag e s i n sha r ed m emo r y a r e v a l i d f o r t h e e n t i r e t i m e tha t they a r e m a pped a nd d o no t a ppe a r i n t h e wo r k i ng s e t l i s t . 1 1-1 MEMORY MANAG EMENT DATA STRUCTURES 3. Th e p r o c e s s s e c t i o n t a b l e c o n t a i n s i n fo rma t i o n p a g e r wh e n a pa g e r e s i d e s i n a n imag e f i l e . used by the 4. B e c a use t h e s i z e s o f t h e d i f f e r e n t p i e c e s o f the process h e ad e r v a r y f r om s y s t em to sys t em , t h e r e mus t b e s o m e me thod of d e te rm i n i ng wh e r e e a c h p i ec e is l o c a ted . Po i n t e r s o r i nd i c e s i n t h e f i x ed po r t i o n o f t h e p r o c e s s h e ad e r s e r v e th i s p u r po s e . P r o c e s s a c c o un t i ng i n fo rm a t i o n , s om e o f wh i c h is used b y the pag e r o r the swa ppe r , i s a l s o l o c a t e d i n th i s a rea . 5. Th e r e a r e s e v e r a l a r r a ys t h a t c o n t a i n i n fo rm a t i o n abo u t e a c h p r o c e s s h e a d e r pag e . Th i s i n fo rma t i o n i s u s e d b y t h e swa ppe r wh e n i t i s n e c e s s a r y to o u t swa p t h e p r o c e s s h e ad e r . Where Size o f This P ortion is Stored SY S B OOT Parameters Affecting Size of Thi s Portion Fix ed Portion of Process Header PHD$1LLENGTH (not a SYSBOOT parameter) PQLDWSDEFAULT SWP$GW_WSLPTE pages a P ROCSECTCNT Process Section Table Empty Pages WSMAX,PQL_DW S DEFAULT Size in bytes of e ntire proce s s header Arrays f o r Process Header Pages SWP$GW_EMPTPTE p ages SWP$GW_BAKPTE pages PO Page Table • SGN$GL_PTPAGCNT pages VIRTUALPAGECNT P 1 Page Table Figure 1 1-1 11.1. 1 D i sc r e t e Po r t i o ns o f t h e P r o c e s s H e a d e r P r o c ess Pag e Ta b l e s Th e p r o c e s s page t a b l e s a r e t h e f i r s t s t e p i n to mem o r y m a n ag em e n t d a t a s t r uc t u r e s t a k e n b y e i th e r h a r d wa r e o r s o f twa r e . Th e pag e t ab l e e n t r y c o n t e n t s a r e used b y t h e h a r d wa r e t o t r a n s l a t e a v i r t ua l add ress to i ts phys i c a l c o un t e r pa r t . Pag e t a b l e e n t r y c o n t e n t s a r e a l so used by the pag e r wh e n t r a n s l a t i o n f a i l s t o d e t e rm i n e the ph ys i c a l l o c a t i o n o f a n i nv a l i d pag e . 1 1-2 MEMORY MANAG EMENT DATA STRUCTURE S F i g u r e 1 1 - 2 s h ows t h e po r t i o n o f t h e p r o c e s s h e ad e r d ev o ted to the PO a nd P l pag e tabl e s . I t a l s o shows tho s e f i e l d s i n t h e f i x ed po r t i o n t h a t a r e u s ed to l o c a t e d i f f e r e n t p i e c e s o f t h e P O o r P l pag e t a b l e . 1. Th e P O pag e t a b l e c o n t a i n s pag e tab l e e n t r i e s fo r al l pag e s c u r r e n t l y d e f i ned i n P O s pa c e . Th e numb e r o f pag e s i s s to r ed i n o f f s e t PHD $ L_P O LR ( a n d moved i n to PR $ P O LR by LDPC TX wh e n the process is s e l ec ted fo r e x e c u t i on) . Th e v i r t ua l pag e n umb e r o f t h e f i r s t unma pped pag e i n P O s pa c e , the i nd e x of the fi rst nonex i s t e n t POPTE , is s to r ed at o ffset PHD$L FRE P OVA . 2. I n a s i m i l a r m a nne r , t h e P l pag e t a b l e c o n t a i n s pag e t ab l e e n t r i e s f o r the pag e s c u r r e n t l y d e f i n ed i n P l s p a c e . L i ke P l space i tsel f , the Pl pag e t a b l e g r o ws towa r d sm a l l e r add resses . To s i m p l i f y t h e ad d r e s s t r a n s l a t i o n l og i c , t h e P l b a s e r eg i s t e r c o n t a i n s t h e v i r t ua l a d d r e s s o f t h e pag e t ab l e e n t r y t h a t wo u l d m a p v i r t ua l ad d r e s s 4 0 0 0 0 0 0 0 . Th e P l l e ng th r eg i s t e r c o n t a i n s the n umbe r o f Pl pag e t a b l e e n t r i e s tha t d o no t ex i s t . Th e v i r t ua l pag e n um b e r o f t h e h i gh a d d r e s s e nd o f the unm a pped po r t i o n o f P l s pa c e ( F i g u r e 1 1 - 2 ) is s t o r ed a t o f f s e t PHD$ L FR E P lVA . 3. Th e num b e r o f pag e t a b l e e n t r i e s a v a i l a b l e fo r the e x pa n s i o n of e i ther PO space o r Pl s pa c e is s t o r ed i n o f fset PHD$ L FRE PTECNT . Th e n um b e r o f e n t r i e s h e r e d e pe nd s o n the S Y S B OOT p a r am e t e r VI RTUA L PAG E CNT , m i nus t h e c u r r e n t s i z e s o f t h e P O a n d P l pag e t a b l e s . PCB$L_PHD (PHD) Process Header � � � F REPOVA FREPTECNT FREP 1 VA �� These four values are stored i n the H a rdware PCB, a p a rt of the fixed portion of the process h eader POBR Virtual address POBR + 4* POLR (F REPOVA ) (FREP 1 VA ) P 1 BR +4* P 1 LR P 1 BR+(4 * 221 ) Virtual address { to � , � - 1�� POBR POLR P 1 BR I P 1 LR Rest of Fix ed Portion WSL, PST, Empty Pages, PHD page Arrays I PO Page Table (Maps Virtual Addresses from 0 to FREPOVA- 1 ) Room for Expansion of either �� } PO Page Table or P1 Page Table """ ... Fix ed Portion of Process Header 1 P Page Table (Maps Virtual Addresses from (FRE P 1 VA+ 200,J to 7FFFFFFF) F REPTECNT e ntries • End of Process Header F i g u r e 1 1 -2 P r o c e s s Pag e Ta b l e s 1 1-3 POLR entries (2 2 1 - P 1 LR) e ntries MEMORY MANAG EMENT DATA S TRUCTURE S Wh e n a p r o c e s s r e f e r e n c e s a v i r t ua l a d d r e s s tha t i s not val id , it i nc u r s a pag e f a u l t , a n e x c e p t i o n t h a t t r an s f e r s c o n t r o l to the pag e f a u l t h a nd l e r . O n e o f t h e e x c e pt i o n - s p e c i f i c pa r a me t e r s p u s h e d o n to the s t a c k i s t h e i nv a l i d v i r t ua l a d d r e s s . Th i s a d d r e s s e n a b l e s t h e pag e r t o r e t r i e ve t h e pag e tab l e e n t ry fo r the i nv a l i d pag e to d e te rm i n e wh e r e t h e pag e i s l o c a ted . Th e pag e t a b l e e n t r i e s f o r i nv a l i d pag e s a r e s e t up i n s uc h a wa y t h a t t h e y c o n ta i n e i th e r the l o c a t i o n o f the pag e o r a po i n t e r to f u r th e r i n f o rma t i o n about t h e pag e . Figure 1 1-3 s h o ws t h e d i f f e r e n t f o rms tha t a n i nva l i d pa g e t a b l e e n t r y can t a k e . A va l i d pag e t a b l e e n t r y i s i nc l ud ed fo r c om pa r i s o n . No t i c e tha t b i t s <31> ( va l id bit) , < 3 0 : 27 > ( p r o t ec t i o n cod e ) , a nd < 2 4 : 2 3 > ( o wn e r a c c e s s mod e ) h a v e the s am e m e a n i ng in a l l po s s i b l e f o rm s of pag e tab l e entr y . Ta b l e 1 1 - 1 l i s t s t h e s ym bo l i c a nd n um e r i c f o rms o f po s s i b l e p r o t e c t i o n c o d e s . Th e pag e r u s e s b i t s 2 6 a nd 2 2 i n the i nv a l i d pag e tab l e e n t r y to d i s t i ng u i sh the d i f f e r e n t PTE f o rms . ( Be c a us e p r o t ec t i o n c h e c k s a r e mad e b e fo r e the v a l i d bit i s c h ec k e d , PTE < 3 0 : 2 7 > m u s t c o n t a i n a p r o t ec t i o n c od e , e v e n wh e n the v a l i d b i t i s c l e a r . ) Th e va r i o u s f o rms a r e d e s c r i b ed in the f o l l o w i ng pa r ag r a ph s , s t a r t i ng a t the b o t tom o f the f i g u r e . 11. 1.1.1 P r o c e s s S e c t i o n Ta b l e I n d e x - Wh e n a pag e i s l o c a ted i n an imag e file, the pag e t a b l e e n t r y c o n ta i n s a n i nd e x i n to th e p r o c e s s s ec t i o n tabl e . Th i s i nd e x l o c a t e s a proc ess sec t i on tab l e e n t r y , wh i c h c o n t a i n s i n f o rm a t i o n a b o u t wh e r e t h e i m ag e f i l e i s l o c a ted , a nd wh i ch b l o c k i n th e i m ag e f i l e c o n t a i n s the f a u l t i ng pa g e . Co n t r o l b i t s i nd i c a t e wh e th e r t h e s e c t i o n i s a g l o b a l se c t i o n ( p r o c e s s s e c t i o n t a b l e e n t r i e s a l wa ys h a v e th i s b i t c l e a r ) , wh e th e r i t i s wr i t a b l e , a nd wh e the r the s e c t i o n i s c o py o n r e f e r e n c e . Process sec t i on tab l e s a r e d i sc us s e d i n Se c t i o n 1 1 . 1 . 3 a nd f u r th e r i n Ch a pt e r 1 2 . 1 1 . 1 . 1 . 2 Pag e F i l e V i r t u a l B l o c k Numbe r - Wh e n a v i r t ua l pag e r e s i d e s in a pag e f i l e , i t s a s s o c i a t ed page t a b l e e n t r y c o n ta i n s t h e v i r t ua l b l o c k n um b e r wi th i n t h e pag e f i l e wh e r e t h e pag e is l oca ted . Wh i c h pag e file is in u s e b y th i s process is i nd i c a ted by the f i e l d PHD$ B PAG F I L i n t h e p r o c e s s h e a d e r . PHD$ L PAG F I L , a l o ng wo rd f i eld that - c onta ins ove r l a ps ze ro in i ts l o w-o r d e r -th r e e b y t e s a nd PHD $ B PAG F I L i n the h i g h - o r d e r byte , i s t h e o r i g i n a l c o n t e n t s o f any e n t r y t h a t a c q u i r e s a pag e f i l e ba c k i ng s to r e a d d r e s s . A pag e -t ab l e v i r t ua l b l o c k n um b e r o f z e r o i nd i c a t e s th a t a b l o c k i n the pag e file h a s no t ye t b e e n r e s e r v e d . 1 1 . 1 . 1 . 3 G l o ba l Pag e Ta b l e I n d e x - An i nv a l i d p r o c e s s pag e m a pped to a g l ob a l pag e c o n t a i n s an i nd e x i n to the g l ob a l pag e t a b l e , wh e r e an a s s o c i a t ed g l o b a l pa g e t a b l e e n t r y c o n t a i n s f u r the r i n f o rma t i o n used to l oc a t e the pag e . Th e g l o b a l pag e tab l e is d e sc r i b e d in Sec t i on 1 1 . 3 . Pa g e f a u l t s i nv o l v i ng g l oba l pag e s a r e d i s c u s s e d in Ch a p t e r 1 2 . 1 1 -4 .---� M o d i f y B i t 3 1 30 V a lid PTE 1 Protection C o de M 0 0 0 0 � � Different Forms of I nv a l id PTE s 2 5 24 23 22 27 0 Protection Code 1-- 0 (See 0 Table 1 1 - 1 ) 1 0 1 30 27 � X O w ne r Access Mode � � � � X 0 0 Owner Access Mode 1 - S e t by H a rd w a r e o n Write o r Mod i f y Access to P a ge .-....� window B i t - I nd ic a t es Page Ma pped by PFN r./il«� l"'�� 20 1 9 1 8 1 7 1 6 1 5 w 2 5 24 23 Page is Active and V alid P a g e Fra me Number ( PF N ) 3: tz.:l � � 0 1 0 0 Demand Zero Page Invalid Global Page P a g i n g F i l e V i rt u a l B l o c k N u m b e r Page is in Paging File R T D z R 0 c R F Page is in Image F ile Proc e s s S e c t i o n Ta b l e I n d e x ---� TY PO B i t - Low O rd e r Bit of PTE Typ e ....��� TY P 1 Bit - H i g h O rd e r B i t of PTE Type ........ ,. � _ V a l i d B i t - P a g e Table E n t ry V a l i d B i t ....___ .._______ D i f f e r e n t Fo rms o f Pag e Ta b l e En t r y > 2: /��� Global P a g e Table Index w 3 ( J r Pogo Is In Transition P a g e F ra m e N u m b e r ( P F N ) XXX Figure 1 1-3 3 0 � � 0 '=' > � > Ta b l e 1 1 -1 Mem o r y Ac c e s s P r o t e c t i o n Co d e s i n Pag e Ta b l e En t r i e s 1-' 1-' I 0'1 Pro tec t i o n S YM B O L No Ac c e s s Al l owed Re s e r v ed Ke r n e l Wr i t e ( Ke r n e l Re ad } Ke r n e l Re ad ( N O Wr i t e } Us e r Wr i t e ( Us e r Re ad } Ex ec u t i v e Wr i t e { Ex e c u t i v e Re ad } E x e c u t i v e Re ad , Ke r n e l Wr i t e E x e c u t i v e Re ad (NO Wr i t e ) S u p e r v i so r Wr i t e ( S u p e r v i so r Re ad ) S u p e r v i so r Re ad , Ex e c u t i v e Wr i t e S u pe r v i s o r Re ad , Ke r n e l Wr i t e S u pe r v i so r Re ad ( N O Wr i t e ) Us e r Re ad , Supe rv i so r Wr i t e U s e r Re a d , Ex e c u t i v e Wr i t e Us e r Re a d , Ke r n e l Wr i t e Us e r Re ad (NO Wr i t e ) PR T$C NA PR T $ C -R E S ERVE D PRT $C KW PRT$C -KR PRT$C-UW PRT$C -EW PRT $ C -ERKW PRT$C -E R PRT$C -SW PR T$C -S R EW PR T$C -S RKW PRT$C -S R PR T$C =U R SW PR T$C U R EW PR T $ C -URKW PRT$C UR = b i n a r y v a l ue = = = = = = = = = = = = = = = = Pr o t e c t i o n Ma s k 0 000 0001 0010 0011 0100 0 1 01 0110 0111 1 000 1 001 1 010 1 011 1 1 00 i l Ol 1110 1111 PTE $C NA = PT E $ C KW PT E $C -KR PT E $C -UW PT E $ C -EW PT E $C ERKW PT E $ C -ER PT E $C -SW PTE $C -SREW PTE $C-SRKW PT E $C =S R PT E $C URSW PT E $ C UREW PT E $ C =URKW PT E $ C UR = = = = = = = = = = = - = = = 00000000 1 0000000 18000000 20000000 28000000 3 0000000 38000000 40000000 48000000 50000000 58000000 60000000 68000000 70000000 78000000 {1} I f a g i v en ac c e s s mod e ha s wr i te ac c e s s t o a spec i f i c pag e , t h e n tha t a c c e s s mod e a l so h a s r e ad a c c e s s to tha t pag e . (2) I f a g i v en a c c e s s mod e c a n r e ad a spec i f i c pag e , t h e n a c c e s s mod e s c a n r e ad the same pag e . al l mo r e p r iv i l eg ed (3) I f a g i ven ac c e s s mod e c a n wr i te a s pe c i f i c pag e , then a l l a c c e s s mod e s c a n wr i t e the same pag e . mo r e p r iv i l eg ed (4) Ac c e s s t h a t i s i mpl i ed ( r a t h e r than expl i c i tl y p r o tec t i o n nam e ) i s i nc l ud ed i n pa r en the s e s . of a pa r t the s ym bo l i c 3: � 3 " t< 0 3: > z > G'l � 3: � 1-i z 0 > 1-i > (/) 1-i " c () 1-i c " � (/) MEMORY MANAGEMENT DATA STRUCTURES 11. 1. 1. 4 Pag e in Tr an s i t i o n - Th e r e a r e s ev e r a l d i f f e r en t s i t ua t i o n s wh e r e a v i r tua l pag e c a n b e a s s o c i a t e d w i th a ph ys i c a l pag e , a n d ye t t h e pag e i s n o t v a l i d , n o t i n th e p r o c e s s wo r k i ng s e t . Fo r e x am p l e , wh e n a pag e i s r em o v e d f r om a p r o c e s s wo r k i ng s e t , i t i s no t d i sc a r d ed b u t put o n to the f r e e pag e l i s t o r mo d i f i ed pag e l i s t . Such a pag e i s c a l l ed a t r an s i t i o n pag e . Th e p r o c e s s pag e t a b l e e n t r y c o n t a i n s a PFN , b u t t h e v a l i d b i t i s c l e a r . Th e two type b i t s ( PTE < 2 6 > and PTE < 2 2 > ) a r e a l s o c l e a r . Tr a n s i t i o n pag e s a r e d e sc r i b e d by t h e e n t r i e s fo r th e phys i c a l pag e fo und in the PFN d a ta b a s e ( S e c t i o n 1 1 . 2 ) . I n pa r t i c u l a r , t h e PFN S TATE a r r a y d e s i g n a t e s the pa r t i c u l a r t r an s i t i o n s ta te the ph ys i c a l pag e i s i n . 1 1 . 1 . 1 . 5 Demand Z e r o Pag e s - A s pe c i a l fo rm o f the t r a n s i t i o n pag e t ab l e e n t r y fo rma t h a s a z e r o i n t h e PFN f i e l d . Th i s i nd i c a t e s a s p e c i a l fo rm o f pag e c a l l ed d em a n d - a l l o c a t e , z e r o - f i l l o r d em a nd zero fo r sho r t . Wh e n a pag e f a ul t o cc u r s fo r s uc h a pag e , t h e pag e r a l l o c a t e s a phys i c a l p ag e , f i l l s the pag e wi th z e r o s , i n s e r t s the PFN i n to the PTE , s e t s the v a l i d b i t , a nd d i sm i s s e s the e x c e p t i o n . ( Fo r th i s r e a so n , a nd a s e c ond r ea son e x pl a i n e d b e l o w ( Sec t i on 1 1 . 2 . 5 ) , phys i c a l pag e z e r o c a nno t b e u s e d by memo r y manag em e n t . ) 11. 1. 2 Wo r k i ng S e t L i s t Th e wo r k i ng s e t l i s t c o n t a i n s the s ub s e t o f a p r o c e s s ' s pag e tab l e e n t r i e s th a t a r e c u r r e n t l y v a l i d . Th e wo r k i ng s e t l i s t i s u s e d b y the pag e r to d e t e rm i n e wh i c h v i r t ua l pag e to d i sc a r d ( to m a r k i nv a l i d ) wh e n it i s n e c e s s a r y t o t a k e a phys i c a l pag e awa y f r om t h e pr o c e s s . Th e wo r k i ng s e t l i s t i s a l s o used by t h e swa ppe r to d e t e r m i n e wh i c h v i r t ua l pag e s n e ed t o b e wr i t t e n t o t h e swa p f i l e wh e n t h e p r o c e s s i s o u t swa pped . F i g u r e 1 1 - 4 sh ows the wo r k i ng s e t l i s t i n th e p r o c e s s h e ad e r , and the var i o us f i elds in the f i x e d po r t i o n th a t l o c a t e d i f f e r e n t p i e c e s o f the l i s t . E a c h o f th e s e f i e l d s , i n c l ud i ng the quo ta f i e l d s , c o n ta i n s a l o ng wo r d i nd e x ( m ul t i pl y c o n t e n t s by f o u r o r u s e c o n t e x t i nd e x a d d r e s s i ng ) to the wo r k i ng s e t l i s t e n t r y i n que s t i o n . 1 1 . 1 . 2 . 1 D i v i s i o n o f the Wo r k i ng S e t L i s t - Th e wo r k i ng set l i st c o ns i s t s o f th r e e p i e c e s . Th e quo ta f i e l d s d e te rm i ne h o w l a rg e the wo r k i ng set l i s t may g r ow in r e s po n s e t o d i f f e r e n t wo r k i ng set s i ze a d j u s tmen ts . 1. Th e pe rma nen t l y l o c k e d po r t i o n o f the wo r k i ng s e t l i s t ( f rom W S L I S T to WS LOC K ) c o n t a i n s t h e pag es tha t a r e fo r e v e r a pa r t o f the p r o c e s s wo r k i ng s e t . Th e s e i n c l ud e • the k e r n e l s t a c k , • the P l po i n te r p ag e , • th e P l p a g e ta b l e pag e tha t m a ps the k e r n e l s t a c k a nd the P l po i n t e r pag e , 1 1 -7 MEMORY MANAG EMENT DATA STRUCTURE S • • ( the P l p a g e ta b l e p a g e th a t m a ps the p r o c e s s h e a d e r , a nd Pl w i nd o w to the the p r o c e s s h e a d e r pag e s t h a t a r e no t pag e ta b l e p a g e s . Th i s i n c l ud e s the f i x e d po r t i o n , t h e wo r k i ng s e t l i s t , the p r o c e s s s e c t i o n t a b l e , a n d the p r o c e s s h e a d e r pag e a r r a ys . • PCB$ L-PHD (PHD) ) A ll working s et list fields in the f i x e d portion a re longword indice s f rom the top o f the process header P H D + 4*WSLIST WSAUTH WSDY N WSLAST WSLIST WSLOCK WSNEXT DFWSCNT WSOUOTA �� • PHD + 4*WSLOCK Rest of Fix ed Portion of Process Header Fix ed Portion of Process Header �� Pages Permanently Locked in Working Set Pages Locked by User Request ( $ LKWSET ) PHD + 4*WSDY N Working Set List Working Set List Dynamic Space PHD + 4*WSNEXT PHD + 4*WSLAST .., PHD + 4*WSOUOTA .. Room for Ex pansion of WSL , ... Figure 1 1 -4 Rest of Process Header '" Wo r k i ng Se t L i s t 2. Th e po r t i o n o f the wo r k i ng s e t l i s t b e t we e n WS LOC K a nd WS DYN conta ins all pag e s that are l o c k ed by user r e qu e s t , s pec i f i c a l l y w i th th e Lo c k Pag e s i n Wo r k i ng Se t s ys t em service . 3. Th e d yn am i c po r t i o n o f the wo r k i ng s e t i s th e po r t i o n th a t i s u s ed fo r pag e r e p l a c eme n t . It i s d e l i m i t ed b y WSDYN a nd W S LAS T . Th e e n t r y t h a t wa s j u s t put i n to th e tabl e is po i n t ed t o b y WSN E XT . Th e r e p l a c em e n t a l g o r i t hm , expl a i n ed i n d e ta i l i n Ch a p t e r 1 2 , i s a m o d i f i ed f i r s t- i n , f i r s t-out s c h em e . 4. Th e d yn am i c b o t tom o f t h e wo r k i ng s e t l i s t i s WS LAST . Pa r t of the i m a g e r e s e t l og i c , i n vo k e d a t i m ag e e x i t , r e s e t s the end o f the wo r k i ng s e t l i s t to DFWSCNT . 5. Th e max i m um v a l u e th a t WS LAST c a n a t ta i n i s g i ven b y WS QUOTA . WSQ UOTA c a n be a l t e r ed i n i n t e r a c t i v e a nd b a t ch j o bs by the SET WORK I NG S E T/QUOTA c o mmand . Th e m e a n i ng s o f th e va r i o u s wo r k i ng set l i s t q uo t a s a nd l im i ts a r e s umm a r i z e d in Ta b l e 1 3 - 1 . 1 1 -8 Ta b l e 1 1 - 2 PFN Da t a Ba s e Ar r a ys G l ob a l Ad d r e s s o f Po i n t e r to St a r t o f Ar r a y S i ze o f Ar r a y E l em e n t Sys t em V i r t ua l Ad d r e s s o f Pa g e Ta b l e En t r y PFN $A L_PTE Lo ngwo rd Ar r a y Ba c k i ng Sto r e Ad d r e s s PFN $AL_BAK Lo ng wo rd Ar r ay ( Fi g ur e 1 1 -1 0 ) Ph ys i c a l Pa g e S t a t e PFN$AB STATE By t e Ar r a y ( Fi g ur e 1 1 -1 1 ) Pag e Typ e PFN $AB TYPE By t e Ar r a y ( Fi g ur e 1 1 -1 2 ) Fo r wa rd Li n k PFN $AW F L INK Wo rd Ar r a y ( Fi g u r e 1 1 -1 3 ) Ov e r l a ys the SHRCNT a r r a y Ba c kwa r d Li n k PFN $AW B L I NK Wo rd Ar r a y ( Fi g ur e 1 1 -1 3 ) Ov e r l a ys the WSLX Ar r a y Re f e r e n c e Co un t PFN $AW R EFCNT Wo rd Ar r a y G l o b a l Sh a r e Co u n t PFN $AW S HRCNT Wo rd Ar r a y Ov e r l a ys t h e FLINK Ar r a y Wo r k i ng Se t Li s t Ind ex PFN $AW WS LX Wo rd Ar r a y Ov e r l a ys t h e B L I NK Ar r a y Swa p Fi l e Vi r t ua l Bl o c k Num b e r PFN $AW SW PVB N Wo rd Ar r a y Ar r a y E l em e n t Co n t e n t s .... .... I \0 Commen t MEMORY MANAG EMENT DATA S TRUCTURE S Th e f o rma t o f a wo r k i ng set l i st entry i s shown in Figure 1 1-5. No t i c e tha t the v i r t ua l pag e n um b e r i s c o nta i ned i n the uppe r 2 3 b i t s , i n the s a m e l o c a t i o n th a t v i r t ua l pag e n um b e r s a r e f o und i n v i r t ua l add resses . Th i s a l l o ws th e WS L E t o b e pa s s ed t o s e v e r a l u t i l i t y r o u t i n e s a s a v i r t ua l add r e s s , wh e r e the byte o f f s e t b i t s ( WS LE control b i ts ) a r e n o t l ooked a t . Th e m e a n i ng s o f the v a r i o u s c o n t r o l b i t s a r e a s f o l l o ws . 1. Wh e n the v a l i d b i t i s c l e a r , t h e wo r k i ng s e t l i s t entry b e u s ed w i t h o ut r emov i ng a pag e f r om t h e wo r k i ng s e t . 2. Th e type f i e l d ( a d up l i c a t e o f the c o n t e n t s o f the PFN TYPE a r r a y ) d i s t i ng u i sh e s pag e s th a t r e q u i r e d i f f e r e n t ac t i o n wh e n r emoved f r om a p r o c e s s wo r k i ng s e t . 3. Th e PFN L o c k b i t i nd i c a t e s t h a t th i s pag e is locked i n to ph ys i c a l m emo r y wi th t h e Lo c k Pag e s i n Memo r y s ys t em s e rv i c e . S u c h pag e s a r e a l s o l o c k e d i n to the p r o c e s s wo r k i ng set . ( Th e wo r k i ng s e t l o c k b i t i s n o t s e t b u t th e WS LEs a r e m o v ed i n to t h e po r t i o n o f t h e wo r k i ng s e t l i s t th a t c o n t a i n s pag e s l o c k e d b y u s e r r eque s t . ) 4. Th e Wo r k i ng S e t Lo c k b i t i nd i c a t e s tho s e pag e s tha t a r e pe rmane n t l y o r d yn am i c a l l y l o c k e d i n to the p r o c e s s wo r k i ng set . Th e o n l y pag e s t h a t c a n b e d yn am i c a l l y l o c k e d a r e pag e t a b l e pag e s tha t m a p c u r r en t l y v a l i d pag e s . ( Pa g e s th a t a r e p e rma n e n t l y l o c k e d o r l o c k e d by u s e r r e que s t a l so h a v e th i s b i t s e t i n th e i r wo r k i ng s e t l i s t e n t r i e s . ) 9 8 7 6 31 5 4 3 1 0 Virtual Page Number Saved Modify Bit ( G o odpage bit) Keep in WS for One More Pass .,___.. Page Locked in Working Set 4-----.. Page Locked in M emory .,_____.. Page Type .,_______.. WSL Entry Valid •---..,. Code Page Type 0 Process Page 1 System Page 2 Global Read-Only Page 3 Global Read/Write Page 4 Process Page Table Page 5 Global Page Table Page Figure 1 1-5 Fo r m a t o f Wo r k i ng S e t L i s t En t r y 1 1-10 can MEMORY MANAG EMENT DATA STRUCTURES 5. Th e G o o d p a g e b i t i s u s ed b y the swa ppe r to d e sc r i b e the d i f f e r en t type s of wo r k i ng s e t l i s t e n t r i e s f o r o u tswapped processes . I t s use is f u r th e r d e sc r i b e d in Ch a p t e r 1 4 . 6. Th e Mod i f y b i t i n t h e WS L E i s u s e d wh e n th e process is o u t s wa pped t o r e c o r d the l og i c a l OR o f the mod i f y b i t i n the p a g e t a b l e e n t r y a nd th e s av e d mod i f y b i t in th e PFN S TATE a r ray . 11. 1.3 P r o c e s s S e c t i o n Ta b l e Th e p r o c e s s s e c t i o n t a b l e c o n ta i n s p r o c e s s sec t i on tab l e entr ies ( PS TE ) , d a t a s t r uc t u r e s t h a t a r e u s ed t o l o c a t e i m ag e s e c t i o n s wi th i n imag e f i l e s . Th e l o c a t i o n o f t h e p r o c e s s s e c t i o n t a b l e wi th i n the p r o c e s s head e r i s p i c t u r ed in F i g u r e 1 1 - 6 . O f f s e t PH D $ L P S TBAS OFF c o n t a i n s the byte o f f s e t t o the b o t tom o f t h e p r o c e s s s e c t ion tab l e . Al l process sec t ion t a b l e e n t r i e s wi th i n the t a b l e a r e th e n l o c a t e d th r o ug h n eg a t i v e l o ng wo r d i nd i c e s f r om th e b o ttom o f the PS T . Wh e n i t i s n e c e s s a r y t o e x p a nd the wo r k i ng s e t l i s t i n to the a r ea a l r e a d y o c c up i ed b y t h e p r o c e s s s e c t i o n tab l e ( Ch a p t e r 1 2 ) , s pa c e i s a l l o c a ted f r om th e emp t y pag e a r e a ( i f i t ex i s t s ) , the e n t i r e PST is moved i n to the a l l o c a ted spa c e , a nd a n e w v a l ue o f PS TBASOFF i s i n s e r t e d i n to the f i x ed po r t i o n o f the process h e ad e r . Al l o the r r e f e r ences to i nd i v i d ua l p r o c e s s s e c t i o n t a b l e e n t r i e s a r e una f f e c ted b y th i s c h a ng e . Th e f o rm a t o f a process sec t i o n t ab l e entry is p i c t u r ed in F i g u r e 1 1 -7 . Th e i mpo r t a n t f i e l d s i n the PS TE a s f a r a s l o c a t i ng a b l o c k i n a n i m a g e f i l e a r e t h e f o l l o wi ng . 1. Th e WCB po i n t e r l o c a t e s t h e w i ndow c o n t r o l block for the i mag e file. Th e WCB c o n t a i n s the m a pp i ng i n f o rma t i o n tha t r e l a t e s v i r t ua l b l o c k n um b e r s i n a file to l og i c a l block n umb e r s o n a v o l um e . 2. Th e s t a r t i ng v i r t ua l pag e n umbe r fo r the sec t i o n , wh e n s ub t r a c ted f r om t h e v i r t ua l pag e numbe r o f t h e f a u l t i ng pa g e , g i v e s t h e pag e o f f s e t i n to the s e c t i o n . 3. Th e s ta r t i ng v i r t ua l b l o c k n um b e r o f the s e c t i o n i s a d d ed to the d i f f e r e n c e c om p u t ed in s t ep 2 to g i v e the v i r t ua l b l o c k n um b e r o f t h e f a u l t i ng pa g e wi th i n the imag e f i l e . 11 . 1 . 4 P r o c e s s H e a d e r Pag e A r r ay s Wh e n a p r o c e s s h e a d e r is o u t s wa pped , s ome i n f o rma t i o n a b o u t each p r o c e s s h e a d e r pag e mus t b e s t o r e d i n the o u t s wa pped p r o c e s s h e a d e r . Th e p r o c e s s h e ad e r pag e a r r a y s p r ov i d e a n a r e a wh e r e th i s i n fo rm a t i o n c a n b e s to r ed ( F i g u r e 1 1 - 8 ) . Two o f t h e a r r a ys , th e BAK a r r a y a nd the W S L X a r r a y , s a ve i n fo rm a t i o n f r om the PFN d a t a base abo ut each p r o c e s s h e ad e r pag e i n t h e wo r k i ng s e t . Th e o th e r two a r r a ys k e e p s t a t i s t i c s a b o u t e a c h pa g e t a b l e pag e . Th e s e f o u r a r r a ys a r e d e s c r i b ed in g r e a t e r d e ta i l i n Ch a p t e r 1 4 . 1 1-1 1 ( Process Header ) P C B $ L_ P H D ---. (PHD) P S T L A S T a n d PSTF R E E a re b o t h n e g a t i v e l o n g w o rd i n d i c e s f ro m the b o t t o m o f the proce s s sec tion t a bl e PSTL A ST PSTBASOFF PSTF R E E P STB A S M A X Fixed Portion, Working Set List R e s t of .... .... I .... PHD + PSTBASOFF + 4i•IPASTLAST (End of Process Section Table) Room for Expansion of PST Process Section Table IV F i x e d P o r t i o n of Proc e s s H e a d e r Movable Boundary between WSL and PST All proc ess se c tion table entries are located via a (negative) longword index from the base of the PST. I � -·�---� l --"""'i��--Pro c ess Header Page Arrays, PO Page Table, P 1 Page Table PHD 4 •.PSTBASMAX ---�J� "'���41-- The process se c tion table (Longword Ind ex) c annot ex tend beyond this point PHD + PSTBASOFF (Byte I ndex) + F i g u r e 1 1 -6 P r o c e s s S e c t i o n Ta b l e Pointer to Cha nnel Control Block B a c kward Link Index Page Fault Cluster X Forward Link Index Control F l a g s Word in Proce s s / Global Sectio n Table Entry Starting Virtual Page Number (22 bits) I Address of Window Control Bloc k I-' I-' I I-' w Base Virtual Block Number for this Section :><==: Control Flags I I I I I I I I I I I I I I I I I I Global ...._...,. Demand Zero ..____...,. Writable ....,. Shared Memory Global .._ L...--..,. On Delete Pending List (Set) On Normal List (Cieart L---..,. Access Mode for Writing ____ L-----------.... �---� Count of PTEs R eferencing This Section Number of Pages in This Section F i g u r e 1 1 -7 Copy on Reference L a yo ut o f P r o c e s s S e c t i o n Ta b l e En t r y Access Mode of Section Permanent System Global (Set) Group Global (Clear) MEMORY MANAG EMENT DATA STRUCTURES PCB $ L _ PHD ( PHD) WSLX BAK t �� �� PTWSLELCK Fixed Portion of Process Header PTWSLEVAL PHD +4* WSLX ( Longword Index ) • PHD +4* BAK ( Longword Index ) • PHD + PTWSLELCK ( Byte Index ) • PHD + PTWSLEVAL ( Byte Inde x ) • PTCNTVAL PTCNTLCK PTCNTMAX PTCNTACT Rest of Fixed Portion, WSL, PST, Empty Pages �� WSL Index Save Area (One Word for Each Process Header Page) Process Header Page Arrays Backup Address Save Area (One Longword for Each Process Header Page) ( Eight bytes per process header page, rounded up to page boundary ) Locked WSLE Counts Array (One Byte per Page Table Page) (-1 => none) Valid WSLE Counts Array (One Byte per Page Table Page) (-1 => none) IV F i g u r e 1 1-8 11. 2 �� PO and P1 Page Tables IV P r o c e s s He ad e r Pag e Ar r ays PFN DATA BAS E Th e memo r y m a n ag em e n t d a ta s t r uc t u r e s i nc l ud e i n fo rm a t i o n a bo u t the av a i l a b l e pag e s of phys i c a l m emo r y . Th e f a c t th a t th i s i n fo rm a t i o n m u s t b e a v a i l a b l e wh i l e the pag e i s b e i ng u s ed pr e v e n t s th i s i n f o rma t i o n f r om b e i ng s t o r ed i n t h e pag e i t s e l f . I n a d d i t i o n , th e c a c h i ng s t r a t eg y o f the f r e e pag e l i s t a nd mod i f i ed pag e l i s t r e qu i r e s phys i c a l pag e i n f o rm a t i o n t o b e a v a i l a b l e even wh e n pag e s a r e no t c u r r e n t l y a c t i v e a nd v a l i d . A po r t i o n o f the n o n pag ed execut ive is s e t a s i d e f o r th i s a c c o un t i ng d a t a , c a l l ed the PFN d a t a b a s e . A PFN d a t a b a s e e n t r y i s n o t a t a b l e o r i e n t e d s t r uc tu r e , l i ke m a n y o f the o th e r e x e c ut i v e d a t a s t r uc t u r e s . Ra t h e r , th e same i t em o f i n f o rma t i o n abo u t a l l phys i c a l pag e s i s s to r ed i n s uc c e s s i v e e l em e n t s of an a r ra y ( Fi g u r e 1 1 - 9 ) . Th e pag e f r am e n umbe r i s t h e n u s e d a s a n i nd e x i n to e a ch a r r a y . Ta b l e 1 1 - 2 l i s t s e a c h i t em o f i n f o rma t i o n in the PFN d a t a b a s e , i n c l ud i ng th e g l o b a l name o f the po i n t e r to th e b eg i nn i ng o f e a c h a r r a y . 1 1-14 PFN data for Process or Global Page In Process Working Set I p N 1-' 1-' I 1-' U1 A rr a y of L o n g w o rd s A rr a y of Words t A rray of Words t A rr a y of Longwords Array of Words These t w o a rrays a re o v e rl a id Figure 1 1-9 PFN d ata for page on free or m odified page list P F N Da t a Ba s e Ar r ays MEMORY MANAGEMENT DATA STRUCTURES 11. 2. 1 PTE Ar r a y Th e PFN PTE l o ngwo r d a r r a y c o n ta i n s the s ys t em v i r t ua l a d d r e s s of the pag e t a b l e e n t r y t h a t m a ps e a c h ph y s i c a l pag e . PFN PT E a r r a y e l em e n t s f o r g l o b a l pag e s po i n t to t h e g l o b a l pag e t a b l e e n t r i e s . 11. 2. 2 BAK A r r a y Th e PFN BAK l o ng wo r d a r r a y s to r e s the o r i g i na l PTE c o n t e n t s . Wh e n a phys i c a l pag e is r e u s ed , i ts PTE m u s t b e r e s e t to i t s o r i g i n a l contents . Th e PFN PTE a r r a y e l em e n t l o c a t e s th e PTE t h a t m u s t b e Th e BAK a r r ay e l em e n t i nd i c a t e s wh a t g o e s b a c k i n to th e PTE . a l te r ed . F i g u r e 1 1 - 1 0 shows t h e two d i f f e r e n t c o n t e n t s o f a BAK a r r a y e l ement . I n t e rm s o f po s s i b l e pag e t a b l e e n t r y c o n t e n t s ( F i g u r e 1 1 - 3 ) , the o n l y f o rms o f PTE tha t c an g o i n to t h e BAK a r r a y a r e a p r o c e s s s ec t i on t a b l e i nd ex o r a pag e f i l e v i r t ua l b l o c k n um b e r . 31 2 4 2322 2 1 P a ge File Index 0 0 0 Page File Virtual Block Number 24 2322 2 1 31 0 Process PTE < 2 1 :0> 0 2 4 2322 2 1 31 0 0 Global PTE < 2 1 :0 > (This form o n l y appears in IRP while read i s in progress. I t does not a ppear in PFN BAK array element. ) Figure 1 1-1 0 11. 2. 3 Po s s i b l e Co n t e n t s o f PFN BAK Ar r a y E l em e n t STATE A r r a y Th e PFN S TATE a r r a y ( F i g u r e 1 1 - 1 1 ) i nd i c a t e s the phys i c a l s ta t e o f e a ch phys i c a l pag e . Th e l ow th r e e b i t s c o n t a i n the pag e l o c a t i o n c od e . Th e uppe r b i t i n a S TATE a r r ay e l em e n t i s e x t r em e l y impo r ta n t . It i s the s e t t i ng o f th i s b i t th a t d e t e rm i n e s wh e th e r a phys i c a l pag e i s put o n to the f r e e pag e l i s t o r the mod i f i ed pag e l i s t wh e n the pag e i s r e l ea sed . Wh e n a pag e i s r emoved f r om a p r o c e s s wo r k i ng s e t , t h e s e t t i ng o f the mod i fy b i t in t h e pag e t a b l e e n t r y i s l og i c a l l y ORed i n to the saved mod i f y b i t i n the S TATE a r r a y . Th e s e t t i ng of t h e mod i f y b i t in the t ab l e e n t r y i s o n l y o n e wa y i n wh i ch t h e s a v ed mod i f y b i t c a n b e pag e set . Th e e x e c u t i v e r o u t i n e th a t l o c k s d own pag e s f o r d i r e c t I /0 s e t s th i s b i t fo r all pag e s t h a t c o n t a i n r e ad b u f f e r s . Pag e f a u l t s f o r c o py- o n - r e f e r e n c e pag e s c a u s e th i s b i t to b e s e t a s pa r t o f t h e pag e f aul t r eso l ut io n to f o r c e a wr i t e to the pag e f i l e wh e n the pag e i s r emoved f r om the p r oc e s s wo r k i ng s e t . 11-16 MEMORY MANAG EMENT DATA STRUCTURES ..____....� STATE A r ray Element Loc a tion of Page ( See Below) .._---t� D e l e t e PFN Contents When Reference Count Goes To 0 ..._--1� Saved Modify Bit from PTE Code 0 Location Page on Free Page List 1 Page on Modified Page List 2 Page on Bad Page list 3 Release Pending (when reference count goes to 0, put page on free or modified page list) 4 Read Error Occurred While Page Read Was in Progress 5 Write in Progress by Modified Page Writer 6 Read in Progress by Page Fault Handler 7 Page is Active and Valid Figure 1 1-1 1 Co n t e n t s o f PFN S TATE Ar r a y E l em e n t Th e wo r d " d e l e t e " h a s a s pec i a l m e a n i ng wh en r e f e r r i ng to phys i c a l pa g e contents . Wh e n the r e f e r e n c e c o un t o f a phys i c a l pa g e g o e s to ze r o , a l l t i e s w i th a v i r t ua l page ( P FN PTE a r r ay contents ) are d e s t r o yed . Th e phys i c a l pag e i s th e n put a t the f r o n t o f the f r e e pag e l i s t wh e r e i t w i l l b e r e used a s qu i c k l y a s po s s i b l e . 11 . 2 . 4 TYPE Ar r ay Th e PFN TYPE a r r a y ( F i g u r e 1 1 - 1 2 ) d i s t i ng u i sh e s t h e d i f f e r e n t t ype s o f v a l i d pa g e s . Th e r e a s o n f o r th i s d i s t i nc t i o n i s th a t e i t h e r the pag e r o r s wa ppe r m u s t t a k e d i f f e r e n t a c t i o n d ep e nd i ng o n wh a t type o f pag e i s b e i ng a c ted o n . Th e c o l l i d ed pa g e b i t i n th e TY PE a r r a y e l em e n t i s s e t wh e n a pag e f a u l t o c c u r s wh i l e t h e pag e i s a l r e a d y b e i ng read in f r om i t s b a c k i ng s t o r e a d d r e s s . Co l l i d ed pag e s a r e d e sc r i b e d b r i e f l y i n Ch a p t e r 1 2 . 11. 2.5 Fo rwa rd and Bac kwa r d L i n k s Th e th r e e pag e l i s t s ( f r e e pag e l i s t , m o d i f i ed pag e l i s t , a nd b a d pag e l i st ) mus t a l l b e d o ub l y l i n ked l i s t s b e c a u s e a n a r b i t r a r y pag e i s o f te n r emoved f r om t h e m i d d l e o f the l i s t . Howe v e r , t h e l i n k s c a nno t ex i s t in t h e pag e s them s e l v e s b e c a u s e the o r i g i na l c o n t e n t s o f pag e mus t be prese rved . Two wo r d a r r a ys , t h e F L I NK a r r a y a nd th e BLINK a r ra y , c o n ta i n e l em e n t s tha t a r e i n t e r p r e t e d a s t h e ph ys i c a l pag e numbe r s o f the s uc c e s s o r a n d p r ed e c e s s o r to a g i v e n ph ys i c a l p ag e . 1 1-1 7 MEMORY MANAGEMENT DATA STRUCTURES 2 TY P E Arr a y E l e m e n t ----� Page Type ( See below ) ----� Collided Page ( Empty COLPG state when page read completes ) ..._--� Bad Page Bit ( When Reference Count = 0, put page on Bad Page List) ..._ ....� Report Event on 1/0 Completion __________ Code Page Type 0 Process Page 1 System Page 2 Global Read-Only Page 3 Global Read/Write Page 4 Process Page Table Page 5 Global Page Table Page Figure 1 1 -1 2 C o n t e n t s o f PFN TYPE A r r ay E l em e n t A z e r o i n o n e o f t h e l i n k f i e l d s i nd i c a t e s the e n d o f the l i s t ( a nd i s n o t a po i n t e r to ph ys i c a l pag e z e r o ) . Fo r th i s r e a so n , phys i c a l pag e ze r o c a nno t b e u s e d i n a n y d yn am i c f unc t i o n b y VMS b u t m a y b e ma pped by some s y s t em v i r t ua l pag e tha t is a l wa ys r e s i d e n t . Th e u s u a l c o n t e n t s o f phys i c a l pag e zero a re the Re s t a r t Pa r ame t e r Block ( Ch a pt e r 2 1 ) . F i g u r e 1 1 - 1 3 shows a n e x ampl e o f pag e s o n the f r e e l i st , a l o ng wi th the c o r r e s pond i ng F L I N K a nd B L I N K a r r ay e l em e n t s . Th e STATE a r r ay e l em e n t s fo r a l l o f t h e s e pag e s c o n t a i n ze ro , i nd i c a t i ng th a t the phys i c a l pag e s a r e o n t h e f r e e pag e l i s t . 11. 2. 6 REFCNT Ar r ay Th e PFN REFCNT a r r ay c o un t s t h e n um b e r o f r e a so n s wh y a pag e sho u l d no t b e p u t o n to th e f r ee or mod i f i ed pag e l i s t . On e r e a s o n f o r i nc r em en t i ng th e r e f e r e n c e c o un t i s tha t a pag e is in a process wo r k i ng s e t . Pag e s a r e l o c k e d d own f o r d i r e c t I /O b y i nc r emen t i ng the r e f e r e n c e c o un t . I /0 c ompl e t i o n a nd wo r k i ng s e t r e p l a c em e n t u s e the same rout i ne to d e c r em e n t the r e f e r e n c e c o un t . I f the r e f e r en c e c o un t g o e s to ze r o , t h e phys i c a l pag e i s r e l e a s ed to the f r e e o r m od i f i e d pag e l i st a s i nd i c a ted by the s a v ed mod i f y b i t in the PFN S TATE a r r a y . Ma n i pu l a t i o n s o f t h e r e f e r e nc e c o u n t a r e i l l us t r a t ed i n th e d i sc us s i o n o f pag i ng d yn am i c s i n Ch a p t e r 1 2 . 1 1 -1 8 MEMORY MANAG EMENT DATA STRUCTUR E S Head o f Free Page List • • • ::PFN$AW_BLINK ::PFN$A W_FLINK BLINK PFN array J _ FLINK PFN array J ---- 0 0 28 15 5 5 10 15 15 33 11 20 25 5 10 15 20 next 25 5 previous 30 11 40 30 35 35 Tail o f Free Page List STATE ·array J ::PFN$AB_STATE ..._..- 40 • • • Fi g ur e 1 1 -1 3 11.2.7 E x ampl e o f F r e e Pag e L i s t Sh o w i ng L i n kag e Me thod SHRCNT Ar r ay A s e c o nd fo rm o f r e f e r en c e c o un t i s k e p t fo r g l o b a l pa g e s . Th e PFN S HRCNT a r r a y c o un t s the n um b e r of p r o c e s s pag e t a b l e e n t r i e s tha t a r e m a ppe d to a pa r t i c u l a r g l o b a l pag e . Wh e n the S HRCNT f o r a pa r t i c ul a r p ag e g o e s f r om z e r o t o one , the r e f e r e n c e c o un t i s i n c r em e n t e d . Fu r th e r add i t i o n s to th e s h a r e c o un t d o n o t a f f e c t th e refe rence c o un t . As t h e g l o b a l pag e i s r emoved f r om t h e wo r k i ng set o f each process m a pped t o t h e pag e , t h e s h a r e c o u n t i s d e c r em e n t e d . Wh e n t h e s h a r e c o un t f i n a l l y r e ac h e s z e r o , t h e r e f e r e n c e c o un t f o r the pag e i s a l so d e c r e m e n ted . Wh e n a phys i c a l pag e h a s a n o n z e r o s h a r e c o un t , i t c a nno t b e o n o n e o f the pag e l i s t s . Th e f o rwa r d a nd b a c k wa rd l i n k wo r d s a r e n o t n e ed e d . Th e g l oba l sha r e count a r r a y ove r l ays the f o r wa r d l ink a rray . ( PFN$AW F L I N K a n d PFN $AW S HRCNT a r e the s ame g l oba l l o c a t i o n i n s ys t em s p a c e . ) -Th e g l o b a l sh a r e-c o u n t i s o n l y u s ed fo r g l o b a l pa g e s . Th e S H RCNT a r r a y i s u s e d f o r a s e c o nd p u r po s e wh e n t h e ph ys i c a l pag e i n qu e s t i o n i s a p r o c e s s p a g e t a b l e pag e o r a g l o b a l pag e t a b l e pag e . I n e i th e r o f th e s e c a s e s , t h e a r r a y e l ement c o u n t s t h e n umbe r of a c t i ve pag e tab l e e n t r i e s i n the p r o c e s s o r g l o b a l pag e t a b l e pag e . Th i s i s the m e a s u r e th a t , wh e n i t pa s s e s f r om z e r o to no n z e r o , c a us e s p r o c e s s pag e t a b l e pag e s t o b e d yn am i c a l l y l o c k e d i n to t h e p r oc e s s wo r k i ng s e t a nd c a u s e s g l oba l pag e t a b l e pag e s t o b e l o c k e d i n to the s y s tem wo r k i ng s e t . 1 1-19 MEMORY MANAG EMENT DATA STRUCTURES 11. 2. 8 WS LX A r r a y The wo r k i ng s e t l i s t i nd e x a r r a y c o n ta i n s a n i nd ex i n to a process o r s ys tem wo r k i ng ? e t l i s t fo r v a l i d pag e s . Th e c o n t e n t o f a n a r r a y e l em e n t i s a l o ng wo r d i nd e x f r om th e b eg i nn i ng o f t h e p r o c e s s {or sys t e m ) h e ad e r t o th e wo r k i ng s e t l i s t e l em e n t i n que s t i o n . B e c a u s e a phys i c a l pag e th a t i s i n s om e wo r k i ng s e t i s n o t o n o n e o f the pag e l i sts , t h e l i n k wo r d s a r e a v a i l a b l e fo r o th e r us e s . Th e wo r k i ng s e t l i s t i nd e x a r r a y ov e r l ays t h e b a c kwa r d l i nk a r ray . { PF N $ AW B L I NK a nd PFN $AW WS LX a r e the same g l o b a l l o c a t i o n i n s ys t em s p a c e . ) -Th e WS LX a r r a y i s no t used f o r g l o b a l pag e s . 11.2.9 SWPVBN Array Th e swa p v i r t ua l b l o c k � um b e r a r r a y is used to s uppo r t t h e o u t s wa p o f a p r o c e s s wi th I /0 1 n p r og r e s s . Wh e n s u c h a n o u t swa p o c c u r s , t h e v i r t ua l b l o c k n umbe r i n t h e swa p f i l e wh e r e the l o c k e d d o wn pag e wo u l d go is r e c o rd ed i n th e SWPVB N a r r a y . Th e mod i f i ed pag e w r i te r c h e c k s th i s a r r a y f o r n o n z e r o c o n te n t s a nd , i f n o n z e r o , d i v e r ts t h e pag e f r om i ts no rm a l b ac k i ng s to r e ad d r e s s to the d e s i g na t ed b l o c k i n th e swa p file . 11. 3 DATA STRUCTURES FOR G LOBAL PAG ES Th e t r e a tm e n t of g l ob a l pag e s is not a wh o l e lot d i f fe rent f r om p r o c e s s p r i v a te pag e s . Ho we v e r , t h e s ys tem i s r e qu i r ed to k e e p some s ys t em w i d e d a ta base of t h e v a r i o u s g l oba l pag e s in t h e s ys tem . 11 . 3 . 1 G l o b a l Se c t i o n De s c r i p to r Wh e n a g l o b a l se c t i o n i s c r e a t e d , a s t r uc t u r e c a l l ed a g l o ba l section is a l l o c a ted f r om pag e d d yn am i c m emo r y a nd l o ad ed d e sc r i pto r {GSD) w i th i n f o r ma t i o n tha t d e sc r i b e s the sec t ion { Fi g ur e 1 1 - 1 4 ) . Th e i n fo rma t i o n a bo u t the s e c t i o n s to r ed i n the G S D i s o n l y u s e d wh e n the s e c t i o n i s c r e a t ed or d e l e t ed , o r wh en some p r o c e s s a t tempts to map to the s e c t i o n . Th e pag e r d o e s n o t use th i s d a ta s t r uc t u r e . Th e G S D i s l i n k ed i n to o n e o f two G S D l i s t s tha t the s ys t em ma i n t a i n s . Al l sys t em g l oba l s ec t i ons a r e put i n to o n e l i s t . G r o up g l o b a l s e c t i o n s { i nd e pe nd e n t o f g r oup n umb e r ) a r e put i n to the o the r l i st . Th e g l o b a l s e c t i o n ta b l e i nd e x f i e l d con t a i n s an i nd e x t h a t a l l o ws a s e c o nd s t r uc t u r e c a l l ed a g l o b a l s e c t i o n ta b l e e n t r y to be l o c a t ed . 11. 3.2 Th e Sys tem H e a d e r and G l o ba l S e c t i o n Ta b l e En t r i e s Th e s ys tem ma i n ta i n s two d a t a s t r uc t u r e s for i tsel f th a t pa r a l l e l s t r uc t u r e s ma i n ta i ne d f o r e a c h p r o c e s s i n the s ys tem . Th e s ys t em PCB a n d s ys tem h e ad e r a r e u s ed by the pag e r to a l l o w pag e f a u l ts of s ys tem pag e s to be t r e a t ed a l mo s t i d e n t i c a l l y to pag e f a u l t s f o r p r o c e s s pag e s . 1 1-2 0 MEMORY MANAG EMENT DATA S TRUCTURES R e g u l a r G l o b a l S e c t i o n D e s c riptor \ G S D Forw a r d Link \ \ \ \ \ Size \ Ex t e nd e d G l o b a l S e c t i o n D e sc r i p t o r \ UIC o f Creator o f S e c tion UIC of File Owner This portion of a GSD appears in extended GSDs (used for map-by-PFN) and shared memory GSDs (Figure 1 1-27) G lobal Section Table Index Pro tection Mask Global Section ldent count Sec tion Name ( u p t o 15 charac ters ) ( co u n t e d ASCII string) �---�- ! Section Flags I Figure 1 1-1 4 I I I I I I I I for M a p - b y - P F N G lo b a l S e c ti o n s l .,. .., R e g u l a r Global S e c t 1. o n D e s c n. p t o r I B a s e PFN I 1 'r-' N u m ber o f P a g e s i n Section Reference Count L a yo u t of G l o b a l S e c t i o n De s c r i p to r Th e s ys tem h e ad e r ( F i g u r e 1 1 - 1 5 ) c o n ta i n s the wo r k i ng set l i st th a t g o v e r n s pag e r e p l a c em e n t f o r s ys tem pag e s . Th e s e c t i o n t a b l e a r e a i n t h e s y s tem h e a d e r c o n t a i n s s e c t i o n t ab l e e n t r i e s f o r the i m ag e fi les th a t c o n t a i n pag e a b l e s ys tem p ag e s . Th e s e i nc l ud e th e e x e c u t i v e i m a g e SYS . EX E , RMS . E XE , a nd t h e s ys tem m e s s a g e f i l e S YSMSG . E XE . Th e s e c t i o n t a b l e a r e a i n the s y s tem h e ad e r se r v e s a s e c o nd pu r po s e . Wh e n a g l o b a l s e c t i o n i s c r e a t ed , a s e c t i o n tab l e e n t r y th a t d e s c r i b e s t h e g l ob a l i m a g e f i l e i s c r ea t ed a nd p l a c ed i n to the g lobal s ec t i o n tabl e , a s t h i s a r e a i n the s y s t em h e ad e r i s c a l l ed . Th e fo rma t o f a g l ob a l s e c t i o n t a b l e e n t r y ( F i g u r e 1 1 - 1 6 ) i s n e a r l y i d e n t i c a l to the f o rm a t o f a p r o c e s s s e c t i o n t a b l e e n t r y . Th e o n l y d i f f e r e n c e i s th a t the f i r s t l o ng wo rd po i n ts t o the g l o ba l s e c t i o n d e sc r i p to r ( i n s t e ad o f the c h a n n e l c o n t r o l b l o c k ) . G l o b a l s e c t i o n t a b l e e n t r i e s a r e a c c e s sed i n e x a c t l y t h e s ame wa y a s p r o c e s s s e c t i o n ta b l e e n t r i e s , w i th a n eg a t i v e l o ng wo rd i nd e x f r om the b o t tom of t h e g l ob a l s e c t i o n t a b l e . Th e g l oba l s e c t i o n t a b l e i nd ex i n the g l o b a l s e c t i o n d e sc r i p to r i s s uc h a n i nd e x , a s s o c i a t i ng a G S TE wi th a GSD. 11-21 M M G $ G L_SY S P H D ( PHD) --+1 1 ' r' ,r' P S T L A S T a n d PSTF R E E are both negative l o n g w o r d i n d i c e s f ro m the bottom of the g l o b a l s e c t i o n t a bl e PSTFREE �� I PSTLAST Rest o f Fixed Portion, System W o r k i n g S e t List Room f o r E x p a n s i o n of PHD + PSTBASOFF + 4 ' PSTLAST ( E n d of Global Section Table ) , .. .. II( GSTE Table ... , .., j Fix ed Portion of Syste m Header Boundary b e t w e e n System working set l i s t a nd g l o b a l s e c t i o n t a ble Last Allo c a t e d GSTE Section Figure 1 1-1 5 �� Global S e c t i o n Table Global (System ) P H D + PSTB A S O F F ( B yte Index ) l> PST B A S O F F System P a g e T a b l e I All global section t a ble e n t ries a re loc a t e d v ia a ( ne g a t i v e ) long word i n d e x f ro m the b a s e o f the G S T • ,.�, I Th e Sy s t em He a d e r Co n t a i n i ng t h e Sys t em Wo r k i ng S e t L i s t a nd t h e G l o b a l Se c t i o n Ta b l e M EMORY MANAG EMENT DATA S TRUCTURES Global Sec tion Descriptor Address Forward Link Index Starting Virtual Page Number (22 bits) Pointer to Window Control Block (for Virtual to Logical Mapping) Base Virtual Block Number for this Section Control Flags Count of PTEs Referencing This Section Number of Pages in the Section Page Fault Cluster Figure 11-16 11. 3. 3 L a yo u t o f G l o b a l o r Sys t em S e c t i o n Ta b l e En t r y G l oba l Pag e Ta b l e E n t r i e s A t h i r d s e t o f d a t a i s a l so c r e a t ed f o r e ach g l ob a l sec t i on . Each pag e in the g l ob a l s e c t i o n i s d e sc r i b e d by a g l o b a l pag e t a b l e e n t r y i n t h e g l oba l pag e t a b l e { F i g u r e 1 1 - 1 7 ) . Th e pag e r u s e s g l o b a l pag e tab l e entr ies j u s t l i k e p r o c e s s pag e t a b l e e n t r i e s t o l o c a te g l o b a l pa g e s . G l o b a l pag e t a b l e e n t r i e s a r e r e s t r i c t ed to i l l us t r a t ed i n F i g u r e 1 1 - 3 . a s ub s e t of the fo rms 1. Th e g l o ba l pag e t a b l e e n t r y c an b e v a l i d , i nd i c a t i ng t h a t t h e g l o b a l pag e i s i n a t l e a s t o n e p r o c e s s wo r k i ng s e t . 2. Th e g l o b a l pag e t a b l e entry can i nd i c a t e some trans i t i on s ta te . Th e PFN S TATE a r r a y i nd i c a te s wh i c h t r a n s i t i o n s t a t e i n t h e u s ua l m a n n e r . 3. Th e g l o b a l pag e c a n b e i n a g l o b a l i m ag e f i l e , i n wh i c h c a s e the g l o b a l pag e t a b l e e n t r y c o n ta i n s a g l o b a l s e c t i o n t ab l e i nd e x . No t e t h a t g l o b a l d em a n d z e r o pag e s d o n o t c on t a i n a PFN o f zero . Ra t h e r , t h e G PT E c o n t a i n s a G S TX a nd h a s the DZ R O b i t s e t i n the G PT E . S uc h a pag e wi l l n o t r eq u i r e a r e ad a t t h e i n i t i a l faul t . Th e pag e wi l l b e m a r k e d a s mo d i f i ed a nd wr i t t e n b a c k to the g l o b a l imag e f i l e b y t h e mod i f i ed pag e wr i t e r . 1 1 -2 3 MEMORY MANAG EMENT DATA STRUCTURES MMG$GLSYSPHD: =••t---4� System Header MMG$GLSPTBASE: : ··�---�-. System Page Table • • MMG$GLGPTE: : • ··�---.-. Global Page Table • • . Global Page Table Entry GPTE GPTE Global Page Table Entries May Indicate Pages That Are: 1. Valid 2. In Transition 3. In a Global Image File. In this case, the Global Page Table Entry contains an Index into the Global Section Table in the System Header. · Global Page Table Entries are located with a virtual page number from the beginning of the System Page Table. GPTE GPTE GPTE GPTE GPTE • Figure 11-17 11. 3.4 Lo c a t i o n o f G l o b a l Pa g e Ta b l e a t Vi r t ua l End of Sys tem Pag e T a b l e G l oba l Pag e Ta b l e and Sys t em Pag e Ta b l e G l o b a l p a g e t a b l e e n t r i e s a r e l o c a ted i n e x a c t l y t h e same m a n n e r as process or s ys t em pag e table entr i e s . Lo c a t i o n MMG $G L G PTBA S E c o n ta i n s t h e add r e s s o f the base of the g l obal pag e t a b le . Al l r e f e r e nc e s to g l o b a l p a g e t a b l e e n t r i e s use wh a t c a n be tho ug h t o f a s a v i r t ua l pag e n um b e r a s a n i nd e x i n to th e g l ob a l pag e t a b l e . 1 1-2 4 M EMORY MANAG EMENT DATA STRUCTUR E S Th e i n te r e s t i ng th i ng to n o t e about th i s a pp r o a c h i s th a t the b a s e of the g l ob a l page tab l e c o i n c i d e s w i t h the b a s e o f t h e sys tem pag e tabl e . Fu r the r , th e v i r t ua l pag e n um b e r s t h a t a r e used as i nd i c e s i n to t h e g l o b a l pag e t a b l e a r e sys t em v i r t ua l pag e n umbe r s . In fac t , wh e n l o o k i ng a t s y s t em v i r t ua l a d d r e s s s pa c e , t h e g l o b a l pag e tab l e s i mpl y a ppe a r s a s a n e x t e n s i o n t o the s y s tem pag e t a b l e . Th e g l o b a l pag e t a b l e i nd e x a s s o c i a t e d w i th t h e f i r s t g l o b a l pag e i s o n e g r ea t e r th a n t h e l a rg e s t s ys t em v i r t ua l pag e n um b e r fo r a g i v e n c o n f i g u r a t i o n . Th i s l og i c a l e x te n s i o n o f t h e s ys tem p a g e tab l e ex i s t s o n l y wh en l o o k i ng at s ys t em v i r t ua l a d d r e s s s pa c e . Th e g l o b a l pag e t a b l e d o e s n o t e x i s t i n phys i c a l pag e s a d j a c e n t t o t h e sys tem pag e tab l e . Th e s y s tem l e ng th r eg i s t e r o n l y r e co r d s t h e numb e r o f r e a l s y s t e m pa g e t a b l e e n t r i e s , n o t t h e l og i c a l ex t e n s i o n s . I n o th e r wo r d s , global pag e s a r e n o t m a pped i n to sys t em v i r t ua l ad d r e s s s pa c e a n d a r e no t a c c e s s i b l e th r o ugh s y s t em v i r t ua l ad d r e s s e s . Th i s p s e ud o e x t e n s i o n to the s ys tem pag e t a b l e i s o n l y a v a i l a b l e to the so f twa r e r o u t i n e s i n t h e m emo ry m a n ag em e n t s ub s ys t em . F i g u r e 1 1 - 1 8 s h ows how t h e g l o b a l pag e t a b l e relates to the s ys t em pag e t a b l e . I t a l s o shows t h e r e l a t i o n s h i p be twe e n the g l o b a l s e c t i o n d e s c r i p t o r , th e g l ob a l s e c t i o n ta b l e e n t r y , and t h e g l o b a l pag e ta b l e entr ies fo r a g i v e n se c t i o n . Th e r e a r e seve r a l r e l a t i o n sh i ps b e twe e n t h e s e th r e e s t r uc t u r e s . 1. Th e c e n t r a l s t r uc t ur e is the g l oba l sec t i on tab l e entry ( Figure 1 1-16) . Th e f i r s t l o ng wo r d i n t h e G S T E po i n t s t o t h e g l o b a l s e c t i o n d e sc r i p to r . 2. Th e v i r t u a l pag e n um b e r f i e l d ( l a b e l l ed ( B ) i n F i g u r e 1 1 - 1 8 ) c o n t a i n s t h e pse ud o s ys t em v i r t ua l pag e n um b e r t h a t s e r v e s a s a l o ngwo r d i nd e x t o the f i r s t g l o b a l pag e tab le entry that maps th i s sec t i o n . Global Section Table Entry - I I System Header ... ' ® W C B Address System Working Set List GSTE --------------- - I "' � ® ' -------------- - - Base VBN 1 ' I I System Page Table Global Page Table L_ Global Section Desc riptor Section Name Figure 1 1-1 8 GPTE GPTE GPTE GPTE GPTE GPTE Global Page Table Entries R e l a t i o n s h i ps Am ong G l o b a l Se c t i o n Da t a S t r uc t u r e s 1 1-25 MEMORY MANAG EMENT DATA S TRUCTURE S 3. Th e g l o b a l s e c t i o n d e sc r i p to r c o n ta i n s a g l o b a l s ec t i o n t a b l e i nd e x ( l a b e l l e d ( A ) i n the f i g u r e ) t h a t a l l o ws t h e G S T E t o b e l o c a ted f r o m t h e G S D . 4. Th e o r i g i n a l f o rm o f e a c h g l o b a l pag e t ab l e e n t r y is a section ta b l e i nd ex ( i d en t i c a l to the G S T X f o und i n the g l o ba l s e c t i o n d e s c r i pto r ) , e f f e c t i v e l y po i n t i ng to the G S T E . Wh e n a n y g i v e n G PT E i s e i th e r va l i d o r i n t r a n s i t i o n , t h e G S TX i s s t o r ed i n the P F N B A K a r r ay . 11.3.5 P r oc e s s PTEs fo r G l oba l Pag e s Wh e n a p r o c e s s m a ps a po r t i o n o f i t s v i r t ua l a d d r e s s s pa c e t o a g l o b a l section , i ts process pag e t a b l e e n t r i e s tha t m a p the s e c t i o n a r e o f t h e fo rm g l o b a l pag e tab l e i nd ex ( F i g u r e s 1 1 - 3 a nd 1 1-19) . Th e process PTE t h a t m a ps the f i r s t g l ob a l s e c t i o n pag e c on t a i n s the G PTX o f the f i r s t pag e in the g l o b a l s e c t i o n . E a c h s uc c e s s i ve p r o c e s s pa g e t ab l e e n t r y c o n ta i n s the n e x t p s e ud o s y s tem v i r t ua l pag e n um b e r ( G PTX ) , s o tha t e a c h P T E e f f e c t i v e l y po i n t s to the G PT E t h a t m a ps th a t pa r t i c u l a r pag e i n t h e g l ob a l s e c t i o n . Global Page Table MMG$GL_GPTBASE: : ----4,.� + N Entries Global Page Table Entry Proc ess P a ge Table G PTE I I I I r 0 G PT Index GPTE 0 G PT Index GPTE 0 G PT Index G PTE 0 G PT Index G PTE 0 G PT Index G PTE 0 G PT Index G PTE 0 G PT Index 0 G PT Index 1 30 .... _ - - - - - - - - - - - - - - - 27 26 25 24 23 22 2 1 - .... .... _ - - G lobal Page Table Index Figure 1 1 -1 9 Rel a t i o n sh i p B e twe e n P r o c e s s PTEs a nd G l o b a l PT E s 1 1 -26 ._,Q I MEMORY MANAG EMENT DATA STRUCTURES A l l of the d a ta s t r uc t u r e s a s s o c i a t ed w i th g l oba l sec t i ons wi l l be d e sc r i b e d i n d eta i l i n Ch a p t e r 1 2 wh e n pag e f a u l t s fo r g l o b a l pag e s a r e d i sc u s se d . Th e i n i t i a l a l l o c a t i o n o f these s t r uc t u r e s w i l l be b r i e f l y d e sc r i b ed wh e n t h e C r e a t e a nd Ma p S e c t i o n a nd Ma p G l o b a l S e c t i o n s y s t em s e rv i c e s a r e d i sc u s se d . 11 . 4 SWAPP ING DATA STRUCTURES Th e r e a r e th r e e d a ta s t r uc t u r e s t h a t a r e used p r i m a r i l y b y the swa ppe r but i nd i r e c t l y b y t h e p ag e r . Th e SYS B OOT pa r am e t e r BALS E TCNT d e t e rm i n e s t h e m a x i m um n um b e r of c o nc u r r e n t l y r e s i d e n t p r o c e s s e s . In pa r t i c u l a r , i t d e te rm i n e s the amo un t of s y s t em add r e s s s pa c e set a s i d e f o r p r o c e s s h e ad e r s . 11. 4. 1 B a l a n c e S l o ts Wh e n the sys t em i s i n i t i a l i z e d , a n amoun t o f v i r tu a l add ress s pa c e equal to the s i ze o f a p r o c e s s h e a d e r t i m e s BALS ETCNT i s a l l o c a t e d e x c l us i v e l y f o r p r o c e s s h e ad e r s ( F i g u r e 1 1 - 2 0 ) . Each of these process h e ad e r a reas is c a l l ed a b a l anc e s l o t . Th e l o c a t i o n o f t h e f i r s t b a l a n c e s l o t i s s to r ed i n g l o b a l l o c a t i o n SWP$G L BA LBAS E . Th e s i z e o f a process h e ad e r ( in pa g e s ) is s to r ed - i n g l o b a l locat ion SWP $G L B S LOTS Z . Th e c a l c u l a t i o n s pe r f o rmed b y S Y S BOOT t o d e t e rm i n e t h e s i ze o f t h e p r o c e s s h e a d e r a r e d e s c r i b e d i n App e nd i x E . 11.4.2 B a l a n c e S l o t A r r ays Th e s ys t em m a i n ta i n s two wo r d s of i n fo rm a t i o n a b o u t t h e p r o c e s s wh o s e process heade r is s to r ed i n a s p e c i f i c b a l a n c e s l o t ( F i g u r e 1 1 - 2 1 ) . Th e n um b e r o f the b a l a n c e s l o t tha t a r e s i d e n t p r o c e s s o c c up i e s is s to r e d i n the f i x ed po r t i o n o f the p r o c e s s h e a d e r a t o f f s e t PHD $W_PHVIND E X . Th e a r r a y l o c a t ed b y g l o ba l po i n t e r PHV$G L R E FCBAS c o un t s the n umbe r of r e a s o n s wh y t h e p r o c e s s h e a d e r c ann o t be r emoved f r om memo r y . Sp�c i f i c a l l y , th i s a r r a y e l em e n t c o un t s t h e n umbe r o f pag e t a b l e pag e s t h a t c o n t a i n e i th e r v a l i d o r t r a n s i t i o n PT E s . Th e a r r a y l o c a t ed by g l o ba l po i n te r PHV$G L P I XBAS c o n t a i n s a n i nd e x i n to still ano th e r a r ray , th i s o n e lo c a ted b y g l o b a l po i n t e r S C H $G L PCBVE C , th a t c o n t a i n s PCB po i n t e r s . Figure 1 1-2 1 i l l u s t r a te s h o w the ex ecut ive turns the add r e ss o f a p r o c e s s h e ad e r i n t o the a d d r e s s of the PCB f o r t h e s am e p r o c e s s , us i ng the entry in the p r o c e s s i nd e x a r r a y ( l o c a ted th r o ug h PHV$G L_P I XBAS ) . I f the p r oc e s s h e a d e r a d d r e s s i s k n o wn , t h e b a l a n c e s l o t i nd e x c a n b e c a l c ul a t ed ( a s d e sc r i b ed in th e n e x t s e c t i o n ) . B y u s i ng th i s a s a wo r d i nd e x i n to the p r o c e s s i nd e x a r r a y , t h e l o ngwo r d i nd e x i n to the PC B v e c to r is f o und . Th e a r r a y e l em e n t in th e PC B v e c to r i s t h e a d d r e s s o f the PCB ( wh o s e PC B $ L PHD e n t r y po i n t s b a c k to the process h e ad e r ) . A m o r e d e ta i l ed d e scr i pt i o n o f t h e PC B v e c to r c a n b e f o und i n Ch a p t e r 1 7 , wh e r e i t s use b y the C r e a t e P r o c e s s s ys tem s e rv i c e is d i sc u s s e d . 1 1 -27 � �W FNSALPTE PSGLBALBASE Balance Slot 0 Process Header PHVINDEX S V A PT E - I \ Balance Slot 1 \ Working Set List \ Process Section Table .... .... I N 00 �� P T E L o n gw o rd A rr ay in PFN Database \ \ Proce s s H e a d e r Page Arrays �� �� ...._. Balance Slot M t F i g u r e 1 1 -2 0 I PFN P 1 Page Table t I I I I All balance slots are exactly the same size. �� \ PO Page Table } } I �� The size of a balance slot in pages Is stored in global location SWP$GLBSLOTSZ �� Last Balance Slot Ba l a n c e S l o t s Co n t a i n P r o c e s s Head e r s There are BALSETCNT slots ( ( HV$GL_REFCBAS HV$GL_PIXBAS Contents of PHD$W_PHVINDEX are used as a word Index Into each of these arrays ) Ref. Count - BALSETCNT entries In each array Process Index t:HS @SCH$GL_PCBVEC __..... .. �.. 'r + 4*(Process I ndex) PCB of process whose PHD Is In balance slot M .,; GL_PCBVEC Pointer to PCB - .... PCB Vector Figure 1 1-21 � P r o c e s s He a d e r Ve c to r Ar r a ys MAX PROCESSCNT entries MEMORY MANAG EMENT DATA STRUCTURES 11.4.3 Comm e n t on Equal S i ze Ba l an c e S l o t s Th e cho i c e o f e q ua l s i z e b a l anc e s l ots , a t f i r s t s i g h t s e em i ng l y i ne f f i c i en t , h a s some s ub t l e b e n e f i t s t o po r t i o n s o f the memo r y m a n ag em e n t s ub s y s t em . Th e r e a re seve ral i nstanc e s , mo s t n o t a b l y wi th i n t h e mod i f i ed pag e w r i te r , wh e n i t i s n e c e s s a r y to o b t a i n a p r o c e s s h e a d e r a d d r e s s f r om a ph y s i c a l pag e ' s pag e f r a m e n umbe r ( P FN ) . Wi th f i x ed s i ze b a l a n c e s l o t s , th i s o pe r a t i o n i s s t r a i g h t f o r wa rd . Th e c o n te n t s o f t h e PFN PTE a r r ay po i n t to a pag e tab l e entry s omewh e r e in the b a l ance slot a rea . S ub t r a c t i ng t h e c o n t e n t s o f SWP$G L BALBA S E f r om th e PFN PTE a r r a y c o n t e n t s a nd d i v i d i ng th e r e s u l t by the s i z e o f a b a l a n c e s l o t ( th e s i ze o f a p r o c e s s h e ad e r ) i n b y t e s p r o d uc e s t h e b a l a n c e s l o t i nd ex . I f th i s i nd ex i s m u l t i pl i ed by the s i ze of the process head e r in b yt e s a nd a d d ed to the c o n t e n t s o f SWP $ G L BALBAS E , t h e f i n a l r e s u l t i s the a d d r e s s o f t h e p r o c e s s h e a d e r tha t co n t a i n s t h e pag e table e n t r y t h a t m a ps t h e phys i c a l pag e i n ques t i o n . 11.5 DATA STRUCTURES THAT DESCR I BE THE PAG E F I LE S AND SWAP F I LE S Th e pag e a nd swa p f i l e s u s e d b y t h e memo r y m a nag em e n t s ub s ys t em to b a c k u p e i th e r phys i c a l pa g e c o n t e n t s o r p r o c e s s wo r k i ng s e t s a r e d e sc r i b ed by s im i l a r d a ta s t r uc t u r e s . Th e c o n t r o l blocks tha t d e sc r i b e e a ch f i l e a r e a c c e s s ed th r o ug h a c ommon t a b l e , l e ad i ng to a t l e a s t o n e s i m i l a r i ty b e twe e n the two k i nd s o f f i l e s . 11. 5. 1 Pag e and Swa p F i l e Ve c to r F i g u r e 1 1 - 2 2 i l l u s t r a t e s the f i r s t l i nk t o the pag e a nd swa p f i l e contr o l b l oc ks . Lo c a t i o n MMG $ G L PAG SWPVC po i n ts to an a r ray o f l o ng wo rd po i n te r s , o n e f o r e a c h page f i l e o r swa p f i l e i n the s y s t em . Th e n um b e r o f l o ng wo r d s i s e q u a l to the s um o f t h e two a s s emb l y t i m e pa ram e t e r s SGN $ C S FTMAX a nd SGN $ C PAG F I LCNT . Th i s a r r a y i s a l l o c a t ed in mod u l e SWAPF ILE . 11. 5. 2 Pag e F i l e Da ta B a s e Th e l a s t SGN$C PAG F I LCNT l o ng wo r d s in the a r ray ( th e r e a r e two in Ve r s i o n 2 o f- VAX/VM S ) po i n t to pag e file control b l o c ks ( F i g u r e 1 1 - 2 2 ) , a l s o s t a t i c a l l y a l l o c a te d 1 n mod u l e SWAPF I LE . Th e pag e f i l e c o n t r o l b l o c k f o r SYS $ S Y S TEM : PAG E F I L E . SYS i s i n i t i a l i z e d by the SYS I N I T p r o c e s s ( Ch a pt e r 2 2 ) . Th e f i l e is o p e n e d , t h e a d d r e s s o f t h e w i ndow c o n t r o l block is s to r ed , a nd the pag e f i l e b i tm a p i s a l l o c a t ed f r om nonpag ed po o l a nd i n i t i a l i z e d t o a l l b i t s s e t . block Th e l o c a t i o n s o f t h e w i ndow c o n t r o l b l o c k field , t h e v i r t ua l n umbe r f i e l d , a nd t h e pag e f a u l t c l u s te r f a c to r f i e l d a r e i n t h e s ame r e l a t i v e o f f s e t s i n th i s s t r uc t u r e a s th e y a r e in a section table e n t r y ( a nd a l so a s wa p f i l e t a b l e e n t r y ) . Th i s a l l ows I /O r e que s t s to s t r uc t u r e be p r o c e s s e d by c ommo n c o d e , i nd e p e nd e n t o f the d a ta that d e sc r i b e s t h e f i l e b e i ng r e ad o r wr i t t e n . 1 1-3 0 : : M MG$GL_PAGSWPVC Page File Control Bloc k Address of Start of Bitmap (Bit = 1 • Bloc k is Available Starting Byte Offset to Sc an Entry for S HELL (filled in by INIT ) J I I I Entry for SWAPFILE.SY S . 1-' 1-' I ( filled in b y SY SINIT) w 1-' Entry for Second Swap File (filled in by SYSGEN) Longword Array is indexed by page or swap file nu mber (Offset PH D$B_PAGFI L contains index of page file used by process) � Cluster � ( filled in by SYSINIT) ( filled in by SY SGEN) \ l Type 1 Size Pointer to Window Control Block Page Fault I I I Control Block for PAGEFILE.SYS Control Block for Second Page File - Base Virtual Bloc k Number Size in Bytes of Bitmap Count 1 of Pages which may be Allocated Count 1 of Pages which may be Reserved - \ \ \ Figure 1 1-2 2 - Pag e F i l e Da t a Ba s e Page File r Page File Bitmap One Bit per Block in the Page File Bit Set • Block Available MEMORY MANAG EMENT DATA STRUCTURE S A s e c ond pag e f i l e c o n t r o l b l o c k e x i s t s to a l l o w th e c r e a t i o n o f a s e c o nd pag e f i l e w i th the I N S TA LL/PAG E F I LE c omma n d t o the S Y S G E N u t i l i ty . I f a s e c ond pag e f i l e i s i n s t a l l e d , a l l processes c r e a ted f r om th a t po i n t o n u s e the n e w pag e f i l e . No t e th a t th i s c ommand i s t h e o n l y wa y t o p l a c e t h e pag e f i l e o n a vo l um e o th e r than the sys t em d i sk . 11. 5. 3 Swap F i l e Ta b l e En t r i e s Th e f i r s t SGN$C S F TMAX l o ng wo r d s i n t h e a r ray ( th e r e a r e th r e e in Ve r s i o n 2 o f VAX/VM S ) po i n t t o s wa p f i l e t ab l e e n t r i e s ( F i g u r e 1 1 - 2 3 ) . Th e r e a r e t h r e e swa p f i l e t a b l e e n t r i e s s ta t i c a l l y a l l o c a ted i n m o d Ql e SWAPF I LE . Th e f i r st s wa p f i l e t ab l e e n t r y , i n i t i a l i z e d by ! N I T ( Ch a pt e r 2 2 ) , d e sc r i b e s t h e Sh e l l p r o c e s s , a s k e l e to n swa p i m ag e th a t is used wh e n ev e r a process i s c r e a t ed as i ts initial context ( Ch a p t e r 1 7 ) . Th e swa p f i l e t a b l e e n t r y fo r SYS $ S YS TEM : SWAPF I LE . SYS is i n i t i a l i zed b y S YS I N I T . A k e y s t e p i n th i s i n i t i a l i z a t i o n i s t h e d i v i s i o n o f the swa p f i l e i n to equa l s i z e d swa p s l o t s . Th e s i z e of t h e swa p f i l e is Th i s n um b e r i s m i n i m i z e d w i th d i v i d ed b y t h e SYSB OOT pa r am e t e r WSMAX . 1 2 8 , the s i z e o f the b i tm a p i n the s wa p f i l e t a b l e e n t r y . Th e sm a l l e r n um b e r r e p r e s en t s t h e n um b e r o f s l o t s i n th i s swa p f i l e . ( No t e th a t t h e swa p f i l e b i tm a p c o nta i n s o n e b i t pe r s l o t wh i l e the pag e file b i tm a p c o n ta i n s o n e b i t fo r e a c h b l o c k i n th e f i l e . ) Th e n um be r o f swa p s l o t s ( p l u s t wo to a c c o u n t fo r th e two proc e ss e s , SWAPPER a nd N U L L , t h a t n e v e r swa p ) i s a l s o c om pa r ed w i th the n um b e r o f p r o c e s s e s a l l o wed fo r th i s s ys tem ( S C H$GW PROC L I M ) . If the ad j us ted In s wa p s l o t c o un t is sma l l e r , t h e n i t re p l a c e s th e old m a x i m um . o th e r wo r d s , t h e s ys t em wi l l no t a l l o w a p r o c e s s t o ex i s t un l e s s th e r e i s a swa p s l o t fo r i t . Th e s i z e o f the b i tm a p l i m i t s the n um b e r o f p r o c e s s e s th a t a swa p f i l e c a n ho l d a nd , by i m p l i c a t i o n , t h e n um b e r o f p r o c e s s e s tha t the s ys tem wi l l a l low . A s ys tem w i th o n e ( th e s t a nd a rd ) swa p f i l e w i l l a l l o w no more than 1 3 0 p r o c e s s e s . A s ys t em th a t ad d s a s e c o nd s wa p f i l e ( wi th t h e S Y S G E N I N S TA L L/SWAPF I L E c ommand ) c a n s uppo r t a max i m um o f 2 58 p ro c e s se s . VM S c u r r e n t l y r e s t r i c t s the n umbe r o f swa p f i l e s to two ( pl us SHELL) . NOTE A s l i g h t c h a ng e to th i s a l g o r i thm h a s been pa tch ed i n to VM S w i th the Ve r s i o n 2 . 2 b i n a r y upd a t e . Th i s c h a ng e r em o v e s the r e s t r i c t i o n o f 2 5 8 p r o c e s s e s Th e d e t a i l s o f th a t p r e v i o u s l y e x i s t e d . th i s c h a ng e a r e d e sc r i b ed i n Append i x F . 11 . 6 SWAPPER AND MOD I F I ED PAGE WR ITER PAG E TAB L E ARRAYS Th e VAX/VM S I /0 s ys t em a l l o ws d i r ec t I /0 r e que s t s ( DMA t r a n s f e r s ) to v i r t ua l l y c o n t i g uo u s b u f f e r s . Th e r e i s no r e q u i r em e n t th a t pag e s i n t h e b u f f e r b e ph ys i c a l l y c o n t i g uo u s o r even h a v e a n y r e l a t i o n sh i p to e a c h o th e r . 1 1 -3 2 Each swap slot contains WSMAX blocks Swap File Table Entry Slot Count Slot Size Spa re Page F ault Cluster S iz e Pointer to Window Control Bloc k for Swap File Base Virtual Block Number of First Slot S W A P FILE Bitmap ( 1 28 Bits) One Bit per Swap Slot .... .... I w w I 7l I"I PCB ./ index �--�-- c o n t ain virtual block number of beginning of slot alloc a ted to this process ./ non Page Table Process Header pages index into swap and 2) L o w e r t h r e e bytes ./ � � � VBN of slot 1 1 Upper byte contains p a ge file v e c t o r } s L oT Spare PCBSL -WSSWP \ \ \ I I Bit S e t .,. S i o t Available Active Pag e Ta ble s APTC NT Bit PCBSV_RES in PCBSL_srs indicates residency o f pro cess PCB$W_APTCNT pages 1 .. Re s i de n t 0 .. O u tswa ppe d Figure 1 1-23 S wa p F i l e Da t a Ba s e Process Body IPO and P 1 pages I MEMORY MANAG EMENT DATA STRUCTURES 11. 6. 1 D i r e c t I/0 a nd S c a t te r/G a th e r Th e I /O Lo c k i ng mec h a n i sm i nvo k ed a t t h e FDT l ev e l b r i ng s e a c h pag e i n to the wo r k i ng s e t o f t h e r e que s t i ng p r o c e s s , m a k e s i t v a l i d , a nd i n c r eme n t s t h a t pag e ' s r e f e r e n c e c o un t ( in PFN RE FCNT a r r a y ) to r e f l ec t the pe nd i ng r e a d o r w r i te . Th e b u f f e r i s g e ne r a l l y d e s c r i b ed i n t h e I /O r e qu e s t p a c k e t th r o ug h th r e e f i e l d s . • • I R P $ L S VAPTE c o n t a i n s t h e s y s t em v i r t ua l ad d r e s s o f t h e f i r s t PTE tha t m a ps t h e b u f f e r . I R P$W B O F F a nd I R P$W BCNT t o g e th e r d e sc r i b e the b u f f e r s i ze th a t - i s u s e d to c alc u l a t e how m a n y PTE s a r e r e qu i r ed to map the b u f f e r . Wh e n a d r i v e r p r o c e s s e s th i s I /O r e q u e s t , i t a l l o c a t e s the r e q u i r ed n um b e r o f MBA o r UBA ma pp i ng r eg i s t e r s a nd l o a d s th em wi th the pag e f r am e n um be r s f o und i n the pag e t a b l e e n t r i e s . Th e a d a p t e r h a r d wa r e h a nd l e s t h e m a p p i ng f r om i t s a d d r e s s s pa c e t o VAX phys i c a l a d d r e s s e s . The a b i l i ty to t r a n s f e r to d i s c o n t i g uo u s ph y s i c a l pag e s ( th e s o - c a l l ed s c a t t e r - r e ad g a the r - w r i t e c a pa b i l i ty ) i s a b e n e f i c i a l s i d e e f f e c t o f t h i s ma pp i ng . 11 . 6 . 2 Swa ppe r I/O The s wa ppe r i s p r e s e n t ed w i th a m o r e d i f f i c u l t p r o b l em . I t m u s t wr i t e a c o l l e c t i o n o f pag e s to d i s k tha t a r e no t even v i r t ua l l y c o n t i g uo us . I t s o l v e s t h i s p r o b l em e l eg a n t l y . Wh e n the s ys t em is i n i t i a l i z ed , a n a r r a y o f WSMAX l o ng wo r d s is a l l o c a t ed f r om no npag ed po o l f o r u s e a s the swa ppe r ' s I /0 t a b l e . Th e s ta r t i ng ad d r e s s o f t h i s a r r a y i s s to r ed i n g l o b a l po i n t e r SWP $G L MAP . ( Th e add r e s s i s a l so s to r e d in the s a v e d P O b a s e r eg i s t e r i n the s wa ppe r ' s p r o c e s s h e ad e r so the pag e s m a pped by t h i s a r r ay a r e e f f e c t i v e l y th e s wa ppe r ' s R O s pa c e . Th i s u s e i s d i scussed in Ch a pt e r 1 7 . ) Wh e n th e s wa ppe r s c a n s the wo r k i ng s e t l i st o f the p r o c e s s b e i ng o ut swa pped , th e pag e f r am e n umbe r s i n e a c h v a l i d PTE a r e moved to s uc c e s s i v e e n t r i e s in the s wa ppe r ' s I /0 t a b l e . Th e a d d r e s s o f the b a se of the ta b l e i s put i n to t h e SVAPTE f i e l d o f the I R P b y the s wa ppe r b e f o r e the IRP i s pa s s ed o n to the d r i v e r . ( Th e s wa ppe r can exerc i se th i s c o n t r o l because it b u i l d s a po r t i o n o f i t s o wn I R P , r a th e r th a n u s i ng the e n t i r e $ Q I O m e c h a n i sm . ) Th e I /O t a b l e l o o k s j us t l i ke a ny o the r pag e t a b l e t o the m a pp i ng r eg i s t e r s ub r o u t i n e s c a l l ed by t h e d r i v e r . Th e PFNs a r e e x t r a c t ed f r om th i s a r r a y a nd l o ad ed i n to ad a p t e r m a pp i ng r eg i s t e r s . Wh a t the s wa ppe r h a s s uc c e e d ed i n d o i ng i s m a k i ng pag e s th a t a r e no t v i r t ua l l y c o n t i g uo us a ppe a r to b e v i r t ua l l y c o n t i g uo u s to the I /O s ub s y s tem . ( A d i f fe rent i nterpretation is that the pag e s are v i r t ua l l y c o n t i g uo u s i n th e P O s p a c e o f t h e swa ppe r , t h e p r o c e s s tha t i s a c t ua l l y pe r fo rm i ng t h e I /0 . ) At t h e s am e t i me tha t e a c h PTE is b e i ng p r o c e s sed , a n y s pe c i a l a c t i o n s b a s e d o n the t ype o f pag e a r e a l so t a k e n c a re of . Th e who l e o pe r a t i o n o f o u t s wa p , a nd the c ompl em e n t a r y s t e p s t a k e n wh e n the process i s s wa pped back i n to m em o r y , a r e d i s c u s s e d in Ch a p t e r 1 4 . 1 1- 3 4 MEMORY MANAG EMENT DATA STRUCTURES 11.6. 3 Mod i f i ed Pag e Wr i te r PTE Ar ray Th e m o d i f i ed pag e wr i te r , i n i ts a t tempt to wr i t e m a n y pag e s to b a c k i ng s t o r e w i th a s i ng l e wr i t e r eque s t { so -c a l l ed mod i f i ed pag e wr i te c l us t e r i ng ) , i s f a c ed w i t h a p r o b l em s i m i l a r to the swa ppe r ' s p r o b l em , w i th o n e a d d i t i o n a l twi s t . Wh e n the m od i f i ed pag e w r i te r i s b u i l d i ng a n I /0 r e qu e s t , th e r e a r e th r e e fo rms o f pag e tha t i t can e nco un te r . Pag e s th a t a r e b o un d fo r the swa p f i l e ( SWPVBN n o n z e r o ) a r e wr i t t e n i nd i v i d ua l l y . Pag e s t h a t a r e bo und fo r a n i m ag e f i l e a r e a l so v i r t ua l l y c o n t i g uo u s . Ho we v e r , pag e s o n the m od i f i ed pag e l i s t t h a t a r e t o b e wr i t t e n t o a pag e f i l e m a y b e n o t o n l y d i s c o n t i g uo us w i th i n a p r oc e s s ad d re s s s pa c e b u t m a y a l so b e l ong to s ev e r a l p r o c e s se s . Th e m o d i f i ed pag e wr i te r b u i l d s a tab l e o f PTE s in a m a n n e r s i m i l a r to t h e swa ppe r . At i n i t i a l i z a t i o n t i m e ( i n m od u l e I N I T ) , two a r r a y s a r e a l l o c a t e d f r om n o npag e d po o l fo r the m od i f i ed pag e wr i te r ( F i g u r e 1 1 - 2 4 ) . Each a r ray Th e l o ng wo r d a r r a y w i l l be f i l l ed c o nt a i n s M PW WRTC LUS TER e l em e n t s . w i �h pag e tab l e e n t r i e s c o n t a i n i ng PFNs a na l og o us to t h e swa pp e r m a p . Th e wo r d a r r a y c o n t a i n s a n i nd ex i n to the p r o c e s s h e ad e r v e c to r fo r e a c h pag e i n the m a p . I n th i s wa y , e a ch pag e t h a t i s p u t i n to th e m a p a nd wr i t te n to i t s b a c k i ng s t o r e l o c a t i o n i s r e l a t e d to the process h e ad e r c o n t a i n i ng t h e PT E t h a t m a ps th i s pag e . Th e o pe r a t i o n o f the m od i f i ed pag e wr i te r , i n c l ud i ng i t s c l u s te r ed wr i t e s to a pag e fi le , i s d i sc u s s e d i n d e t a i l i n Ch a pt e r 1 2 . 11. 6. 4 N o n r e e n t r a ncy o f Swappe r a nd Mod i f i ed Pag e W r i t e r Th e u s e o f the se a r r a ys to ho l d pag e ta b l e e n t r i e s f o r the I /0 s y s t em makes the swa ppe r a nd t h e m od i f i ed pag e wr i t e r n o t r e e n t r a n t . Th a t i s , t h e swa ppe r p r o c e s s c a n pe r fo rm o n l y two s i m u l t a n e o u s o pe r a t i o n s . • • An i n s wa p o r o u t s wa p o pe r a t i o n t h a t uses the swa ppe r m a p . Th i s a c t i o n i s r e c o r d ed b y s e t t i ng th e swa p i n p r o g r e s s f l ag ( SC H $V_S I P ) i n l o c a t i o n S C H$GB_S I P . A m od i f i ed pag e wr i t e to a pag e f i l e , an i m ag e f i l e , o r a s wa p f i l e VBN . Th e mod i f i ed pag e wr i t e i n p r og r e s s f l ag ( S C H $V MPW ) in s am e g l o ba l l o c a t i o n ( S C H$G B_S I P ) r e c o r d s th i s ac t i o n . 11.7 th e DATA STRUCTURES USED WITH SHARED MEMORY Th e MA7 8 0 s h a r ed memo r y un i t c a n be used as an i n t e r p r oc e s s o r c ommun i c a t i o n pa th wi th c ommo n event f l ag s , m a i l bo x e s , o r g l o b a l secti ons . Th i s VM S s uppo r t r eq u i r e s d a t a s t r uc tu r e s l o ca ted in the sha r ed m emo r y th a t d e sc r i b e the sha r ed m emo r y i tsel f , a nd d a ta s t r uc t u r e s tha t d e sc r i b e the s h a r ed m emo r y c ommo n ev e n t f l ag c l us t e r s , m a i l box e s , o r g l obal s ec t i o n s . I n a d d i t i o n , e a c h p r o c e s s o r c o nn e c t e d t o the sha r ed memo r y r e q u i r e s d a t a s t r uc t u r e s l o c a t e d i n l o c a l memo r y t h a t d e sc r i b e t h e s h a r ed m em o r y d a t a s t r uc t u r e s . 1 1-3 5 SWPSGL _MAP :: • (This address is s to red in the swapper's P 0 base register.) • �� .... .... I w "' MPW$AL-PTE :: • Swapper's 1/0 Page Table Entry Array of Long words • - �� > WSMAX elements (This number is stored in the swapper's PO length register.) Modified Page Writer's 1/0 1� Page Table �� > MPW-WRTCLUSTER elements Entry Array of Longwords · - F i g u r e 1 1 -2 4 .... :: MPWSAW-PHVINDEX - MPW's Pro c ess Header oe � � Ve c tor � � Index Array of Words _ ...._ _ _.... Swa ppe r a nd Mod i f i ed Pag e Wr i t e r PTE Ar r a ys MEMORY MANAGEMENT DATA STRUCTURES 11. 7.1 Sh a re d Memo r y Con t r o l S t r uc t u r e s Th e sha r ed memo r y un i t c o n s i s t s o f a series of pag e s of phys i c a l memo r y . Th e b o o t s t r a p s e qu e n c e r e c o r d s t h e p r e s e n c e o f t h e s h a r ed memo r y un i t b u t d o e s n o t c o n f i g u r e the phys i c a l pag e s i n t o th e sys t em . Th i s a l l o ws t h e u s e r to i n c l ud e s h a r ed memo r y i n a s i t e - s pec i f i c wa y i n s t e a d o f a l l o wi ng VM S to p r ov i d e t r a n s pa r e n t s uppo r t . In e i th e r t h e phys i c a l memo r y pag e s m u s t b e v i r t ua l l y ma pped so th a t t h e y case , a r e a c c e s s i b l e t o p r og r am c o d e ( b e c a u s e memo r y m a n ag emen t i s e n ab l ed ) • I n a ny c a s e , i t i s e x t r em e l y un l i k e l y t h a t t h e v i r t ua l m a pp i ng u s e d b y o n e p r o c e s so r t o a c c e s s s h a r ed memo ry pag e s i s t h e s a m e a s t h e v i r t ua l m a p p i ng u s e d b y a n o th e r processo r . Fo r th i s reaso n , the d a t a s t r uc t u r e s t h a t VMS u s e s to m a n i p u l a t e i t s d a t a s t r uc t u r e s l o c a t e d i n sh a r e d memo r y a r e s e l f - r e l a t i v e q u e ue e l em e n ts . ( Se l f- r e l a t i ve q u e ue e l em e n ts a r e d e s c r i b ed i n the VAX- 1 1 A r c h i t e c t u r e Handboo k . ) I n add i t i on , VM S c a n no t use o ne o f i ts u s ua l s ynch r o n i z a t i o n t e c h n i que s , e l ev a t e d I PL , to contr o l a c c e s s t o sh a r ed m emo r y d a t a s t r uc t u r e s . E l e v a t ed I PL b l o c k s i n t e r r up t s , b u t o n l y o n t h e local I n s t e ad , a l l a c c e s s e s to s h a r ed memo r y d a t a th a t m u s t b e p r o c e s so r . s ync h r o n i z e d a r e d on e w i th o n e o f the i n t e r loc ked i n s t r uc t i o n s p r o v i d ed fo r j us t th i s p u r po s e in t h e VAX a r ch i t e c t u r e . Th e s e i n s t r uc t i o n s a r e : I N S QH I I N S QT I REMQH I REMQT I BB S S I BBCC I ADAWI I n s e r t E n t r y i n to Qu e ue at H e a d , I n t e r l o c k e d I n s e r t �n t ry i n to Q u e ue a t Ta i l , I n t e r l o c ked Remove E n t r y f r om Queue at H e a d , I n t e r l o c k e d R e m o v e En t r y f r om Q u e u e a t Ta i l , I n t e r l o c k e d B r a nch o n B i t S e t a nd S e t I n t e r l o c k e d B r a n c h o n B i t C l e a r a nd C l e a r I n t e r l o c k e d Ad d Al i g n e d Wo r d I n t e r l o c k e d Th e f o u r i n s t r uc t i o n s th a t m a n i pu l a t e s e l f - r e l a t i v e q u e ue s a c t ua l l y p r ov i d e two l ev e l s o f i n t e r l o c k i ng . Because s e l f - r e l a t i v e q ue ue e l em e n t s mus t b e quadwo r d a l i g ned , the l ow th r e e a d d r e s s b i t s ( al l ze r o ) a r e a v a i l a b l e f o r o th e r us e s . Th e l o w o r d e r b i t i n the f o r wa r d l i n k i s used as a s e c o nd a r y i n te r l o c k . Wh e n th i s b i t is set , i n t e r l o c ked access to th e h e a d o r ta i l o f the queue i s d e n i ed . Th i s i n t e r l o c k b i t i s r e ad i n a n i n t e r l o c k ed f a sh i o n th a t i s used b y the o th e r th r e e i n s t r uc t i o n s i n the l i s t ( BB S S I , BBCC I , a nd ADAW I ) . 1 1 . 7 . 1 . 1 Ph ys i c a l Layo ut o f Sh a r ed Memo ry - I f the sha r ed m emo r y is to b e s uppo r t ed b y VM S , i t m u s t b e c o n f i g u r ed i n to the s ys t e m wi th t h e SYSGEN u t i l i ty . Th i s i n s t a l l a t i o n s t e p i s d e sc r i b ed in t h e VAX/VM S Sys tem Ma n ag e r ' s G u i d e . Th e r e s u l t i ng ph ys i c a l l a yo u t o f s h a r ed memo r y i s i l l us t r a ted in Figure 11-2 5 . Th e VMS d a t a a r e a s a re i n i t i a l i z e d wh e n the f i r s t p r o c e s s o r { po r t ) conn e c t s t h e sh a r e d memo r y un i t . As o th e r po r t s m a k e the i r c o nn e c t i o n , t h e i r l o c a l m em o r y d a ta s t r uc t u r e s a r e s i mpl y i n i t i a l i z e d to po i n t to th e sh a r ed s t r uc t u r e s . 11-37 MEMORY MANAG EMENT DATA S TRUCT URES Lowest physical address : ::: Balance of memory available for shared memory global sections �� Global page allocation bit map Pool space Table for shared memory CEBs Mailbox table Table for shared memory GSDs One page reserved for each port Shared memory common data page Figu r e 1 1 - 2 5 Highest physical address Ph ys i c a l La yo u t o f Sha r ed Memo r y 1 1 . 7 . 1 . 2 S h a r ed Memo r y Common Da t a Pag e - Th e sha r ed memo r y pag e wi th the h i g h e s t phys i c a l a d d r e s s i s u s ed b y VMS to c o n ta i n the i n f o rm a t i o n tha t d e sc r i b e s t h i s s h a r ed memo r y un i t . Th i s pag e is c a l l ed the c ommo n d a ta pag e . Because th i s pag e may b e v i r t ua l l y mapped i n d i f f e r e n t wa ys o n e a c h po r t ( a nd m a y n o t even e x i s t a t the s am e phys i c a l a d d r e s s ) , e a c h po i n t e r i n th e c ommon d a ta pag e i s a r e l a t i v e po i n t e r f r om t h e b a s e v i r t ua l a d d r e s s o f th e common d a t a pag e . Th e c o n t e n t s o f t h e c ommo n d a t a pag e a r e l i s t ed i n Tab l e 1 1 - 3 . 1 1 . 7 . 1 . 3 P r o c e s s o r - S p e c i f i c Co n t r o l - As e ac h processo r connec ts i tse l f to t h e s h a r e d mem o r y un i t , a d a ta s t r uc t u r e i n p r o c e s s o r l o c a l memo r y i s i n i t i a l i ze d th a t a l l o ws t h a t p r o c e s so r t o l o c a t e t h e c ommo n d a ta pag e . Th a t s t r uc t u r e a l so c o n t a i n s phy s i c a l pag e i n fo rm a t i o n tha t a l l o ws t h e sha r ed phys i c a l memo r y to b e v i r t ua l l y ma pped on th a t p r o c e s so r . Th e l a yo u t o f the sha r e d m emo r y c o n t r o l b l o c k i s p i c t u r ed i n F i g ur e 1 1 -2 6 . 1 1-38 M EMORY MANAG EMENT DATA S TRUCTURES Table 1 1 - 3 Conten t s o f Shared Memory Common Data P ag e S i ze I t em Mnemon i c S HD $ L MBXPTR S HD $ L-G S DPTR S HD $ L-C EFPTR S HD $ L-G S B I TMAP S HD$ L=G S PAGCNT S HD $ L G S PF N S HD$W-G S DMAX S HD$W-MBXMAX S HD$W=C EFMAX S HD$T_NAM E S HD$Q_I N I T T IM E Re l a t i v e Po i n te r to Ma i l box Ta b l e Re l a t i v e Po i n t e r t o G S D Ta b l e Re l a t i v e Po i n t e r to C EB Ta b l e R e l a t i v e Po i n t e r to Gl o b a l Pag e B i tma p Co u n t o f Pag es Al l o c a ted fo r Gl obal Sec t i o n s Re l a t i v e PF N o f F i r s t G l o b a l S e c t i o n Pag e S i ze o f G S D Ta b l e S i ze o f MB X Ta b l e S i ze o f C E B Ta b l e ( spa r e wo rd fo r a l i g nm en t } Name o f Sh a r ed Memo ry ( Co un t ed A SC I I S t r i ng } I n i t i a l i za t i o n T i m e l o ng wo rd l o ng wo rd l o ng wo rd l o ng wo rd l ong wo rd l o ng wo rd wo rd wo rd wo rd wo rd 16 byt e s quad wo r d Th i s i s the e n d o f t h e c o n s t a n t a r ea o f the sha r ed m emo ry c ommon d a ta pag e . S HD$L C RC S HD$W-G S DQUOTA S HD$W-MBXQUOTA S HD$W-C EFQUOTA S HD$8-PORTS S HD$8-I N I T LC K S HD$8-B ITMAPLC K S HD$8-F LAGS S HD$8-G S DLOCK S HD$8-MBXLOCK S HD$ B=C E F LOCK SHD $W_PR QWA I T S HD$W_POLL S HD$W_R E SWAIT S HD$W_R E SAVA I L S HD$W_R E S S UM S HD$Q PRQ S HD$Q-POOL S HD$Q=PRQWRK 11.7.2 S i ze I t em Mn emo n i c C RC o f F i e l d s i n Co n s t a n t A r e a Co un t o f G S Ds C r ea ted ( o ne pe r po r t } Co u n t o f Ma i l bo x e s C r e a ted ( on e pe r po r t ) Co u n t o f C EB s C r ea ted ( o n e pe r po r t ) Number o f Po r t s Own e r o f I n i t i a l i za t i o n Lo c k Own e r o f G l ob a l Pag e B i tmap Lo c k Fl ag s fo r Lo c k i ng Da t a S t r uc t u r e s Own e r o f G S D Tab l e Lo c k Own e r o f MBX Tab l e Lo c k Own e r o f C EF Ta b l e Lo c k ( spa r e byt e fo r a l ig nm en t ) Po r ts Wa i t i ng fo r In t e r p r o c e s so r Re que s t B l o c k s ( o n e b i t pe r po r t ) Po r t s Ac t i v e l y Us i ng . t h e Memo ry ( o ne b i t pe r po r t ) Po r ts Wa i t i ng fo r a Re s o u r c e ( o ne b i t pe r po r t ) ( o ne wo rd m a s k pe r r e so u r c e ) Po r ts Need i ng t o Re po r t Re so u r c e Ava i l ab l e ( o ne b i t pe r po r t ) ( o ne wo rd m a s k p e r r e so u r c e ) Po r t s w i th Re s o u r c e s to Re po r t ( o ne b i t pe r po r t ) ( 3 s pa r e wo r d s fo r a l i g nmen t ) F r e e I n t e r pr o c e s so r Re qu e s t B l o c k Li s thead Free Po o l B l o c k Li st h e ad I n t e rproc e s so r Reque s t Wo r k Que ue L i s th e ad s ( One l i s t h e ad pe r po r t ) l o ng wo rd 16 wo r d s 1 6 wo r d s 1 6 wo rd s byte byt e byte byte byte byte byte wo rd wo rd 16 wo r d s 1 6 wo r d s wo rd 3 wo rd s quad wo r d qua d wo rd 1 6 quadwo rd s G l ob a l S e c t i o n s i n Sha r ed Memo ry Th e c r e a t i o n a nd m a p p i ng o f a g l o b a l sect ion in s h a r ed memo r y a r e s l i g h t l y d i f f e r en t f r om t h e c o r r e s po nd i ng a c t i o n s f o r l o c a l memo r y g l obal s e c t i o ns . Th e g l ob a l s e c t i o n i s r e cog n i z e d a s a sh a r ed memo r y g l o ba l s e c t i o n b ec a u s e i t s n am e t r a n s l a t e s t o a n e qu i va l e n c e n a m e o f t h e fo rm s h a r e d -memo r y-nam e : s e c t i o n-name 1 1- 3 9 MEMORY MANAGEMENT DATA STRUCTUR E S A shared memory control block resides in local memory. One such structure describes each shared memory. Link to next SHB VA of common data page Flags Type Size Reference count Base PFN for global section pages >< Port number TR number of memory Address past last byte of pool Address of adapter control block Figure 1 1-26 C o n t e n t s o f Sh a r ed Memo r y C o n t r o l B l o c k Th e C r e a t e a nd M a p Sec t i on s ys t em s e rv i c e t h e n s t r uc t u r e s n e c e s s a r y t o d e s c r i b e th i s s e c t i o n . • • • c reates Th e g l ob a l sec t i o n d e sc r i pto r fo r s uc h ( Figure 1 1 -2 7 ) is l oc a ted in sha r ed m emo r y i n f o rma t i o n u s ed t o m a p t h e s e c t i o n . the data a sec t i o n a nd c o n t a i n s On l y th e po r t th a t c r e a t e s t h e g l oba l s e c t i o n h a s a g l o b a l s ec t i on table entry ( in th a t p r o c e s so r ' s l o c a l m emo r y ) d e sc r i b i ng t h e s ec t i o n . Th i s s e c t i o n t a b l e e n t r y i s u s e d by the I NS TA L L u t i l i ty t o l o ad t h e phys i c a l pag e s of the s e c t i o n w i th t h e c o n t e n t s o f the d e s i g na t e d f i l e wh e n the s e c t i o n is c r e a t ed . Th e G S TE i s a l s o us ed i f t h e Upd a t e S e c t i o n sys t em s e r v i c e i s c a l l e d to wr i t e t h e c o n t e n t s o f a wr i ta b l e g l o b a l s ec t i on l o c a t ed i n s h a r ed m em o r y bac k to i t s o r i g i n a l f i l e . ( Th e Upd a t e S e c t i o n s ys t em s e r v i c e wi l l no t h a v e a n y e f f e c t i f i t i s i s s ue d f r om a n y po r t o th e r than t h e c r e a t o r po r t . ) B e c a us e t h e pag e s o f a sh a r ed memo r y g l o b a l sec t ion a r e a l wa ys v a l i d , t h e r e i s n o n e e d f o r g l o b a l pag e t a b l e e n t r i e s f o r the s ec t i on . I n s t e ad , wh e n a p r o c e s s maps t o s uc h a sect i on , i ts p r o c e s s pag e t a b l e e n t r i e s a r e l o a d ed wi th t h e pag e f r am e n um b e r s o f the s h a r ed memo r y s e c t i o n a nd m a r k e d va l id . Th e s e p ag e s a r e n o t c h a rg ed ag a i n s t t h e p r o c e s s wo r k i ng s e t . 1 1 -4 0 MEMORY MANAG EMENT DATA S TRUCTURES Shared memory flags See Figure Rest of regular global section descriptor :� Deletor port ::� Interprocessor lock Number of processor ref. counts Creator port 11-14 Base PFN for section pages - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Number of pages Second base PFN page count pair The assembly time parameter GSD$C_PFNBASMAX (currently 4) defines the number of discontiguous pieces in a single section Thir-d base PFN page count pair = Fourth base PFN page count pair PTE count for first processor One longword for each additional port Figure 1 1-27 C o n t e n t s o f Sha r ed Mem o r y G l o b a l Se c t i o n De s c r i p to r Due to the way th a t VM S u s e s s h a r ed memo r y f o r g l o b a l sec t i o ns , p u t t i ng g l o b a l s e c t i o n s i n to sha r ed memo r y , even wh e n the m emo r y un i t i s not c on ne c t e d to a n o th e r p r o c e s s o r , p r ov i d e s b e t t e r s y s t em uti l i za t ion . E a c h p r o c e s s u s i ng t h e s h a r ed s e c t i o n s i s g e t t i ng a f r e e e x t e n s i o n t o i t s wo r k i ng s e t . Th e r e i s n o d emand pl a c e d o n t h e g l o b a l pag e tabl e . Th e local phys i c a l m emo r y th a t wo u l d o th e r w i s e b e r e q u i r e d to c o n t a i n s uc h e n t i t i e s a s DC L o r t h e Run-T i m e Li bra ry is a v a i l a b l e f o r o th e r u s e s s uc h a s a n e x p a nd ed ph ys i c a l pa g e c a c h e ( f r e e pag e 1 i s t ) • 1 1-4 1 MEMORY MANAG EMENT DATA S TRUCTURE S 11. 7 . 3 Ma i l bo x e s i n Sha r e d Memory Wh e n a m a i l box i s c r e a t ed in s h a r ed m em o r y , it is d e sc r i b ed by a s h a r ed m emo r y m a i l bo x d e sc r i p to r b l o c k ( MB X ) l o c a ted i n the s h a r ed memo r y ( F i g u r e 1 6 - 2 ) . I n a d d i t i o n , e a ch po r t c o n ne c t ed to the s h a r ed memo r y m a i l box h a s a un i t c o n t r o l b l o c k ( UC B ) i n i t s l o c a l mem o r y I /O d a t a b a s e t h a t m a k e s t h e c o nnec t i o n b e twe e n t h e l o c a l I /0 s ys tem a nd t h e s h a r ed memo r y m a i l bo x . Th e r e l a t i o n s h i ps o f s h a r ed memo r y m a i l bo x d a t a s t r uc t u r e s a r e p i c t u r e d i n F i g u r e 1 6 - 3 . 11. 7. 4 Common Event F l a g C l us t e r s i n Sha r ed Memo ry As wi th g l ob a l s e c t i o n s and m a i l bo x e s ( a nd the s h a r e d memo r y i t s e l f ) , th e r e a r e d a ta s t r uc t u r e s i n sh a r ed memo r y a n d o t he r s t r uc t u r e s i n l o c a l memo r y r e q u i r ed to f u l l y d e sc r i b e a c ommo n e v e n t f l ag c l us t e r l oc a ted i n sha r ed memo r y . Th e s h a r ed memo r y d a ta s t r uc t u r e i s c a l l ed a ma s te r CEB ( c ommon e v e n t b l o c k ) a nd c o n t a i n s the o n l y v a l i d set o f event f l ag s . E a c h po r t c o n n e c ted t o th i s c ommon e v e n t f l ag c l us t e r h a s a s l a v e C E B t h a t l o c a t e s th e m a s te r . Th e r e l a t i o n sh i p b e twe e n th e m a s te r CEB a nd th e s l a v e C E Bs i s p i c t u r ed i n F i g u r e 9 - 4 . Th e l a yo uts o f t h e m a s te r a nd s l av e c ommo n event b l o c k s a r e p i c t u r ed in Figure 9-5 . 1 1-42 CHAPTER 1 2 PAG ING DYNAM I C S In the p r ev i o u s c h a p t e r , the v a r i o u s d a t a s t r uc t u r e s th a t a r e ma i n t a i n ed b y m em o r y m a n ag em e n t we r e d e sc r i b ed i n a somewh a t s t e r i l e f a sh i o n , o u t o f the c o n t e x t i n wh i c h they a r e used . Th i s c h a pt e r s h o ws h o w t h e v a r i o u s s t r uc t u r e s a r e m a n i pu l a t ed b y t h e pag e r i n r e s p o n s e t o d i f f e r e n t fo rms o f pag e f a u l t s . Al t h o ug h pag e r a c t i o n i s d e sc r i b ed h e r e , i t i s n o t p r e s e n t ed in a f l o wc h a r t o r d e c i s i o n f a s h i o n . Ra t h e r , the a c t i o n s a r e d e s c r i b ed i n t e rm s o f mod i f i c a t i o n s t o d a t a s t r uc t u r e s . 12. 1 OVERVIEW OF PAG ER OPERAT I ON Be f o r e we b eg i n d i s c u s s i ng how the pag e r r e a c t s to d i f f e r e n t fo rms o f pag e f a u l ts , we wi l l b r i e f l y d e sc r i b e the o v e r a l l o pe r a t i o n o f the pag e r . 12. 1 . 1 Ha r d wa r e Ac t i o n Al l p r og r am r e f e r e n c e s g e n e r a t ed b y t h e C P U a r e v i r t ua l ad d r e s s e s . Each add ress mus t be t r a n s l a t ed to a phys i c a l a d d r e s s b e fo r e a r e f e r e n c e to memo r y ( o r a n I /O s p a c e pag e ) c a n b e m ad e . Th e v i r t ua l add ress ( F i g u r e 1 2 - 1 ) i s used by the a d d r e s s t r a n s l a t i o n m e c h a n i sm to f i nd the pag e t a b l e e n t r y th a t wi l l be used to t r a n s l a t e th e a d d r e s s . I f the pag e t a b l e e n t r y i s v a l i d , i t s c o n t e n t s a r e used to t r a n s l a te the v i r t u a l a d d r e s s to a phys i c a l a d d r e s s a nd e x e c u t i o n c o n t i n u e s . If the pag e table entry is i nv a l i d ( PT E < 3 1 > 0) , then a t r a n s l a t i o n - no t-va l i d f a u l t i s g en e r a ted . F i g u r e 1 2 - 2 shows the s t a t e o f t h e k e r n e l s t ac k f o l l o w i ng a pag e f a u l t . = 12 . 1 . 2 I n i t i a l Pag e r Ac t i o n Be f o r e the pag e r d o e s a n y wo r k , i t pe r f o rm s a c o n s i s t e n c y c h e c k b y d em a n d i ng th a t the I P L b e no h i g h e r t h a n 2 . I f the I PL i s h i g h e r t h a n 2 , a f a t a l b ug c h e c k i s g e n e r a t ed . Th i s c h ec k i s mad e fo r two r e a so n s . • Co d e t h a t i s ex e c u t i ng a t a h i g h e r I P L n e e d s to pe r f o rm a se r i e s o f i n s t r uc t i o n s wi tho u t b e i ng i n t e r r upted . I f a pag e f a u l t h a p p e n s , the f a u l t i ng p r o c e s s m i g h t be r emoved f r om execut i on , a l l o w i ng a n o th e r p r o c e ss to exec ute the same r o u t i n e o r a c c e s s the s ame p r o t e c ted d a t a s t r uc t u r e . 12-1 PAG ING DYNAM I C S • Pag e f a u l t s a r e e x c e p t i o n s tha t h a pp e n to a process . Wh en the sys t em i s e x e c u t i ng at I P L h i g h e r th a n 2 , i t i s o f te n o n t h e i n t e r r upt s t ac k , a c t i ng i n r e s po n s e to an external t r igger . Th e r e is n o t n ec e s s a r i l y a p r o c e s s th a t c a n b e c ha rg ed f o r th e pag e f a u l t . 31 30 29 98 0 Virtual Page N umber Byte Offset P1 Space I ndicator if VA<31 > = 0 '---� System Virtual Address Space Indicator VA<31 : 30> Selects the page table 0 PO Page Table 1 P1 Page Table 2 System Page Table 3 reserved VA<29:9> is used as a longword i ndex i nto the selected table F i g u r e 1 2- 1 Fo rma t o f Vi r t ua l Ad d r e s s Showi ng F i e l d s Us e d to Lo c a t e Pa g e Ta b l e En t ry Th a t M a ps t h e Pag e stack growth Reason Mask � Invalid Virtual Address � PC of Faulting Instruction PSL at Time of Fault State of the Kernel Stack following a Translation not - Valid Fault \ \ \ \ \ \ \ \ \ Reason Mask for Translation Not - Valid Fault \ This Bit is Always 0 for Translation - Not - Valid Faults ,.pTE Reference O....,. V irtual Address Not Valid 1 ....,.A ssociated PTE not Valid ....-----+!Intended A ccess Type O....,. Read Access 1 ....,. M odify or Write Access ....___ F i gu r e 1 2 - 2 S t a t e o f the Ke r n e l S t a c k Fo l l o w i ng a T r a n s l a t i o n-No t-Va l i d F a u l t 1 2-2 PAG ING DYNAM I C S Th e n e x t s te p tha t the pag e r t a k e s i s to r e t r i ev e th e i nv a l i d v i r tual add r e s s f r om t h e k e r n e l s t ac k . I t u s e s th i s a d d r e s s to l o c a t e t h e pag e t ab l e e n t r y th a t m a ps th i s pag e b y p e r f o rm i ng the s a m e o pe r a t i o n s th a t t h e a d d r e s s t r a n s l a t i o n m e c h a n i sm u s e s . 1. Th e u ppe r two b i t s o f t h e v i r t ua l add r e s s ( VA < 3 1 : 3 0 > ) wh i c h pag e t a b l e ( o r wh i c h b a s e r eg i s t e r ) to u s e . 2. Th e v i r t u a l a d d r e s s f i e l d ( VA < 2 9 : 9 > ) i nd e x i n t o t h e pag e t a b l e . i s u s ed as a sel ect l o ng wo r d B e f o r e t h e pag e t ab l e e n t r y i s e x am i n ed , the pag e r d e t e rm i n e s wh e th e r the s ys tem v i r t ua l pa g e c o n t a i n i ng t h e pag e t a b l e e n t r y i s i t s e l f va l id . ( Th i s check avo id s t h e n e c e s s i t y o f ma k i ng the pag e r r ec u r s i v e . ) If not , t h e pag e t a b l e pag e i s mad e va l i d f i r s t . No te th a t t h e pag e r pe r f o rm s th i s c h e c k w i tho u t u s i ng t h e f l ag b i t in the e x c e p t i o n pa r a m e t e r . takes d i ffe r ent Onc e t h e pag e t ab l e e n t r y i s ava i l a b l e , t h e pag e r ( See a c t i o n s d e pe nd i ng o n the n a t u r e o f the i nva l i d pag e ta b l e e n t r y . Th e F i g u r e l l - 3 f o r t h e d i f f e r e n t fo rms o f i nva l i d pag e ta b l e e n t r y . ) next s ev e r a l sect i ons w i l l d e s c r i b e some o f the ma j o r pa th s th r o ug h r e ad and wr i t e t h e pag e r . Ex t r a o rd i n a r y c o nd i t i o n s s uc h a s e r ro rs wi l l o n l y b e m e n t i o ne d i n pa s s i ng . 12 . 2 PAGE FAU LTS FOR PROC E S S PR IVATE PAG ES Th e f i r s t s e t o f pag e faul ts th a t a r e d i s c u s s ed conc e r n proc e s s pr i va te pag e s . Th e d i f f e r en t pa th th r o ug h the pag e r wh e n s h a r i ng i s i nvo l v ed i s d i s c u s s ed i n the n e x t s e c t i o n . Th e r e a r e fo u r c a s e s th a t m u s t b e d e sc r i b ed . • • • 12. 2. 1 Two o f t h e c a s e s i nv o lve a pag e tha t i s o r ig i na l l y f a u l ted f r om a n imag e file . Th e two c a s e s a r e d i s t i ng u i sh e d by wh e th e r o r not t h e s e c t i o n i s c o py on r e f e r e nc e . A th i r d p r i v a t e s e c t i o n c a n c o n s i s t o f z e r o pag e s . a se r i es of d em a nd resul t f r om bo th F i n a l l y , a n i n t e rm e d i a te s t a t e th a t c a n z e r o pag e s h a s the c o py-on- r e f e r e n c e pag e s a nd d em a nd f a u l t i ng pag e r e s i d i ng i n a pag e f i l e . Pag e Lo c a ted i n a n Ima g e F i l e Th e r e a r e two d i f f e r e n t type s o f pag e th a t c a n i n i t i a l l y r e s i d e in a pr i va te i m ag e f i l e . Th e pag e t a b l e e n t r y f o r e a c h c o n t a i n s a p r o c e s s s e c t i o n ta b l e i nd ex . Th e o n l y init ial d i f f e r e n c e b e t we e n t h e two pag e s i s the s e t t i ng o f t h e c o py-on- r e f e r e n c e b i t i n th e pag e t a b l e entry ( Figure 1 1-3 ) . 1 2-3 PAG ING DYNAM ICS 12. 2. 1 . 1 Imag e Pag e Th a t I s No t Copy o n Re f e r en c e - Th e f i r s t t ype o f pag e f a u l t tha t i s d e sc r i b ed i nvo l v e s a pag e i n a n i m ag e f i l e t h a t i s n o t c o py o n r e f e r e nc e . Th e v a r i o u s t r a ns i t i o n s th a t s uc h a pag e can po s s i b l y m a k e a r e i l l u s t r a t ed i n F i g u r e 1 2 - 3 . Th e n umbe r s i n c i r c l e s a r e k e yed t o expl a na t i o n s o f e a c h t r a n s i t i o n th a t a r e l i s t ed b e l o w . ( Fo r s i mpl i c i ty , c l u s t e r ed r e ad s a nd wr i t e s a r e i g no r e d i n th e S e c t i o n 1 2 . 5 d i s c u s s e s a l l a s pe c t s o f pag i ng d i s c us s i o n th a t f o l l o ws . I /0 . ) Th e pag e t a b l e e n t r y i s i n i t i a l l y s e t to th e f o rm i l l u s t r a ted a t th e top o f Figure 1 2-3 . I t c o n t a i n s a p r o c e s s s e c t i o n ta b l e i nd ex ( PS T X ) w i th t h e c o py-on- r e f e r e n c e b i t ( PT E < l 6 > ) c l e a r . (1) A page faul t o cc u r s . Th e pag e r uses the v i r tua l add r e s s e x c e pt i o n p a r am e t e r to l o c a t e the pag e t a b l e e n t r y . Th e f o rm o f the pag e t a b l e entry i s process sec t ion tabl e i nd e x . I n f o rma t i o n c o n t a i n ed in the p r oc e s s s e c t i on tab l e ent r y i n d i c a t e s wh i ch v i r t ua l b l o c k i n t h e i mag e file sho u l d b e r ead . Th e pag e r a l l o c a t e s a phys i c a l pag e f r om the h e a d o f t h e f r e e pag e l i s t . Th e pag e i s a d d ed t o t h e p r o c e s s wo r k i ng set . Th i s s t e p m a y r e q u i r e the p ag e r to r emove a no the r pag e f r om the wo r k i ng s e t i n o r d e r to make r o om fo r the pag e c u r r e n t l y b e i ng a d d ed . Th e PFN a r r a ys a r e i n i t i a l i ze d . Th e S TATE a r r a y e l em e n t i nd i c a t e s th a t a r e ad i s i n p r og r e s s . Th e P T E a r r a y e l em e n t po i n ts to t h e p r o c e s s pag e t a b l e e n t r y . Th e wo r k i ng s e t l i s t i nd e x a r r a y e l em e n t l o c a t e s the wo r k i ng l i s t e n t r y j u s t s e t up . Th e BAK a r r a y e l em e n t is l o ad ed w i th the initial c o n tents o f th e p ag e t a b l e e n t r y , th e p r o c e s s s e c t i o n t ab l e i nd ex . Th e r e f e r e n c e c o un t a r r a y e l em e n t c o n t a i n s a two , o n e for b e i ng in t h e wo r k i ng s e t a nd one fo r t h e r e ad i n p r og r e s s . Th e pag e r b u i l d s a n I /0 r e qu e s t p a c k e t ( Se c t i on 1 2 . 5 ) th a t Th e p r o c e s s i s p l a c e d d e sc r i be s t h e r e ad th a t i s b e i ng d o n e . i n to a pag e f a u l t wa i t s ta t e . (2) Be c a us e mo s t o f the wo r k wa s d o ne i n r e s po n s e to the initial to pag e r e a d l i ttl e f a ul t , l eft do wh e n th e the r e is ( b ut s t a ys i s d e c r em e n t e d c ompl e te s . Th e r e f e r e n c e c o un t The s ta t e o f t h e a bo v e s p e c i a l h a ppe n s ) zero s o n o th i ng F i na l l y , the va l i d pag e i s c h a ng ed to a c t i v e a nd v a l i d . bit set in is p r o c e s s pag e t a b l e e n t r y a nd the p r o c e s s i s th e r emoved f r om t h e pag e f a u l t wa i t s t a t e . Th e n e x t t i me th a t the proces s i s s e l e c t ed f o r e x e c ut i o n , i t wi l l e x e c u t e t h e s am e i n s t r uc t i o n th a t c a used t h e i n i t i a l pag e f a u l t . • ( 3) O n e t r a n s i t i o n tha t a v a l i d pag e c a n und e rg o ( a nd stil l r em a i n v a l i d ) o c c u r s wh e n t h e pag e i s modi f i ed a s a r e s u l t o f i n s t r uc t i o n e x e c u t i o n . Th e h a rdwa r e s e t s the mod i fy b i t in t h e pag e tab l e entr y . Th e c h ang e i s no t n o t ed a t th i s t i m e in the PFN d a ta base . 1 2-4 PAG ING DYNAMI C S PFN Data PTE contains Process Section Table lndex(PSTX) Page NOT in physical memory No PFN data from bottom of page Read in Progress REFCNT - 2 BAK = PSTX - PTE � Transition - in Working Set r- - -. I I I I I �--- - PTE is valid - in Working Set - Modify Bit Clear .,..., 1---{ 3 ,_ __ - PTE is valid - in Working Set - Modify Bit Set -l I I I I _.I _ _ _ 1 I I I I I PTE � Transition I I Saved Modify Bit Set Active and Valid REFCNT > 0 BAK = PSTX Release Pending REFCNT > 0 BAK - PSTX I I I I I -&1 Modified Page List REFCNT 0 BAK PSTX I I I f. I I I -- - - - - _ _ _ I I 4V- --0- PTE � Transition Write in Progress 1 REFCNT BAK PSTX Saved Modify Bit Clear Free Page List REFCNT 0 BAK PSTX PTE > Transition Saved Modify Bit Clear to top of page Figure 1 2-3 Page Fault Transition Other Transitions Figure 1 2-3 S t a t e D i a g r am Sh o w i ng Pag e T r a n s i t i o n s f o r P r i v a t e S e c t i o n Pag e Th a t I s No t C o py o n Re f e r e nc e 12-5 PAG ING DYNAMI C S (4) Wh e n the pag e is r emoved s ev e r a l th i ng s h a ppen . f r om the process wo r k i ng set , a. Th e wo r k i ng s e t l i s t e n t r y i s m a d e a v a i l a b l e . b. Th e WS LX a r r a y e l eme n t i s c l e a r ed . c. Th e mod i f y b i t i n the pag e t ab l e e n t r y i s l og i c a l l y i n to the PFN s t a t e a r r a y e l eme n t . ORed d. Th e VA L I D , TY P O , a nd TY P l b i t s in the c l ea r e d . Th e PFN f i e l d i s l e f t a l o n e . all e. Th e RE FCNT a r r a y e l em e n t i s d e c r em e n t e d . If the refe rence count goes t o z e r o , th e pag e i s put o n to the f r e e or mod i f i ed pag e l i s t , a c c o r d i ng to the s e t t i ng of the s a ved mod i fy b i t i n the PFN STATE a r r a y e l em e n t . Th e new l o c a t i o n o f the pag e is i n se r t ed i n to the S TATE array. PTE are No t e tha t pag e s a r e no t r emoved f r om the wo r k i ng s e t un t i l r o o m i s r e q u i r ed f o r o th e r pa g e s , u n t i l th e v i r t ua l pag e s a r e d e l e t ed , o r i n r e s po n s e t o a $ PURGW S s y s t em s e r v i c e c a l l . (5) I f the r e f e r e n c e c o un t d o e s n o t g o to zero , th i s i nd i c a t e s th a t t h e r e is o u t s t a nd i ng I /O f o r th i s pag e . Th e s t a t e i s c h a ng ed to r e l e a s e pend i ng . Th e u l t i ma t e d e s t i na t i o n f o r the pag e ( f r e e o r mod i f i ed l i s t ) i s r e c o rd ed i n th e s a v ed m o d i fy b i t i n the STATE a r r a y . (6) Th e I /O c o mpl e t i o n r o u t i n e d e c r emen t s r e f e r e n c e c o un t s fo r pag e s tha t a r e l o c k e d d o wn . Wh e n th i s r o u t i n e d e t e c ts t h a t t h e c o un t h a s g o n e to z e r o , i t pl a c e s t h e pag e o n e i th e r the f ree l i st or th e mo d i f i ed l i s t as a pp r o p r i a t e . Th e STATE a r r a y e l em e n t i s c h a ng ed . (7) Th e mod i f i ed pag e wr i te r wi l l ev e n t ua l l y wr i te th i s ph ys i c a l pag e t o i t s b a c k i ng s t o r e a d d r e s s , wh i c h i s l o c a t ed i n the PFN BAK a r r a y . Wr i t a b l e pag e s th a t a r e no t c o py on r e f e r e n c e a r e wr i t t e n b a c k to the i mag e f i l e th a t th e y o r i g i n a l l y c am e f r om . Th e s t a t e o f t h e pag e i s s e t t o wr i t e i n p r og r e s s . Th e s a ved mod i fy b i t i s c l e a r ed . Th e r e f e r e n c e c o un t o f one r e f l e c t s th i s o u t s tand i ng o u t put o p e r a t i o n . I t i s wo r th no t i ng a t th i s t i m e th a t wr i ta b l e p r i v a te pag e s t h a t a r e n o t c o py o n r e f e r e n c e a r e n o t usua l p r od uc t s o f the l i nke r . Such s e c t i o n s must b e c r e a ted manua l l y wi th the C r e a t e a nd Ma p ( P r i v a t e ) S e c t i o n s y s tem s e r v i c e . (8) Wh e n the mod i f i ed pag e wr i te c ompl e t e s , the pag e i s p l a c ed o n the f r e e pa g e l i s t ( by t h e s ame r o u t i n e th a t d ec r ements the r e f e r e n c e c o un t , n o t e s t h a t i t we n t to z e r o , a nd no t e s that the s a v e d mod i f y b i t i s c l e a r ) . (9) Wh i l e the phys i c a l pag e h a s r em a i n e d a t t a c h ed to the p r o c e s s , t h e pa g e ta b l e e n t r y h a s a l wa ys c o n t a i ned a PFN a n d the PFN PTE a r r a y h a s a l wa ys c o n t a i n e d the add r e ss o f the process pag e ta b l e e n t r y . 1 2-6 PAG ING DYNAM I C S Wh e n th e ph y s i c a l pa g e i s r e u s e d f o r a n o th e r pu r po s e , s ev e r a l s t e ps m u s t b e t a k e n t o b r e a k the t i e s b e twe e n the p r o c e s s v i r t ua l pag e a nd t h e phys i c a l pag e th a t is a b o ut to be r e used . Th e p r o c e s s PTE mus t be a l t e r ed to r e f l e c t t h e b a c k i ng stor e add ress o f the pag e . ( Th e PFN PT E a r r a y i s u s e d to l o c a t e t h e pag e t a b l e e n t r y . ) I n th i s c a s e , the PTE i s r e s e t so th a t it conta i ns a p r o c e s s s e c t i o n tab l e i nd e x ( P STX ) , t h e s am e c o n t e n t s t h a t i t h a d b e f o r e t h e i n i t i a l pa g e f a u l t . Th e PFN a r r a y e l em e n t s f o r th i s phys i c a l pag e a r e a l l c l e a r ed b e f o r e t h e pag e i s pa s s e d o n to the new own e r o f the phys i c a l pag e . In pa r t i c u l a r , t h e PTE a r r a y e l em e n t , the o n l y connec t i on f r om t h e PFN d a t a b a s e t o the p r o c e s s pag e t a b l e , i s c l e a r ed . 12. 2. 1. 2 Pag e Fa u l t s o u t o f T r a n s i t i o n S t a t e s - F i g u r e 1 2 - 3 a l so shows t h e t r a n s i t i o n s tha t a pag e m a k e s wh en a pa g e f a u l t o c c u r s wh i l e the phys i c a l pag e i s i n the t r a n s i t i o n s t a t e . Wh i l e the c h a ng e s b a c k to the ac t i ve s t a t e a r e somewh a t s t r a i g h t fo r wa r d , the r e a r e d e t a i l s a bo u t e a c h f a u l t t h a t sho u l d b e m e n t i o n e d . No t e th a t e a c h o f th e s e pag e faul ts r equi res t h a t a n e w wo r k i ng s e t l i s t e n t r y b e a c q u i r e d , wh i c h m a y i nv o l v e t h e r emo v a l o f some o th e r pag e f r om the process wo r k i ng s e t . 1. A pag e f a u l t f r om the f r e e pag e l i s t i s r e s o l v e d by p l a c i ng t h e pag e b a c k i n to the a c t i v e a nd v a l i d s t a t e , r e s e t t i ng th e PTE , a nd i n c r eme n t i ng the r e f e r e n c e co unt . 2. A pag e f a u l t f r om t h e m o d i f i ed l i st has e x ac t l y the s ame e f fec t . Th e fact th a t t h e pag e wa s p r e v i o us l y mo d i f i ed but n e v e r wr i t t e n to i ts b a c k i ng s to r e a d d r e s s is r e f l ec ted p i c to r i a l l y by p u t t i ng t h e pag e b a c k i n to i t s m od i f i e d s t a t e . I n f a c t , t h e mod i f y b i t i n the P T E i s n o t a c t ua l l y t u r ne d on b y th e p ag e r . Ra the r , th e s a v e d mod i fy b i t i n the PFN S TATE a r r a y r e c o r d s the f a c t tha t the pag e has no t been b a c k e d u p . 3. A pag e f a u l t f r om t h e r e l e a s e p e nd i ng s t a t e h a s no spec i a l e f fects . Ag a i n , the s t a t e i s c h a ng ed to a c t i v e , t h e v a l i d b i t i n th e PT E i s t u r ned on , and th e r e f e r e nc e c o un t is i n c r em e n t e d . A l i ttl e artistic l i c en s e is t a ke n in th e f igure to d i f fe rent i a te phys i c a l pag e s t h a t we r e mod i f i ed f r om pag e s th a t we r e no t . Ag a i n , t h e o n l y d i f f e r e n c e b e twe e n t h e t wo pag e s i s t h e s e t t i ng o f t h e s av e d mod i f y b i t i n the PFN S TATE a r r a y , n o t the s e t t i ng of t h e m o d i fy b i t in th e PTE . 4. Th e t r a n s i t i o n tha t d e s e r v e s s pe c i a l c omme n t i s a pag e faul t th a t o c c u r s wh i l e t h e mo d i f i ed pag e wr i t e r i s wr i t i ng the pag e t o i t s b a c k i ng s t o r e a d d r e s s . Th e s a v e d mod i f y b i t is c l e a r ed b e f o r e t h e wr i te b eg i n s s o th a t th e pag e w i l l b e p l a c e d o n t h e f r e e l i s t wh e n the wr i te c om p l e te s . 1 2 -7 PAG ING DYNAM I C S A l thoug h t h e pag e h a s no t ye t b e e n comp l e t e l y b a c k e d u p , th e a s s um p t i o n i s mad e tha t the wr i te w i l l c ompl e te s uc c e s s f u l l y . Pag e f a ul t s c a n th us p u t t h e pag e i n to the a c t i v e but u nmod i f i ed s t a t e . Th e o n l y d i f f i c u l t y o c c u r s i n t h e e v e n t o f a wr i t e e r r o r . Th e I /0 comp l e t i o n r o u t i ne d e t e c t s th i s s ta t e o f a f fa i r s a nd t u r n s t h e s a v ed mod i fy b i t b a c k o n . 1 2 . 2 . 1 . 3 Copy-o n-Re fe renc e Pag e - A mo r e commo n type o f wr i ta b l e p r o c e s s p r i v a t e pag e is c a l l ed c o py o n r e f e r en c e . F i g u r e 1 2-4 i l l u s t r a t e s t h e t r a n s i t i o n s tha t s uc h a pag e m a k e s f r om i ts i ni tial pag e f a u l t un t i l i t i s wr i t t e n to som e b a c k i ng s to r e a d d r e s s . Many o f t h e t r a n s i t i o n s tha t o c c u r h e r e a r e no d i f f e r e n t f r om t h e c a s e j us t d e sc r i b ed . Th i s s e c t i o n wi l l n o t e e a c h t r a n s i t i o n b u t o n l y e l abo r a t e o n tho s e a r e a s t h a t a r e d i f f e r en t . (1) Th e i n i t i a l s e t t i ng o f the pag e t a b l e e n t r y ( S TART-I in the f igure) is ag a i n process s ec t i o n t a b l e i nd ex , but the c o py-on- r e f e r e n c e b i t ( PT E < l 6 > ) i s now s e t . Wh e n a pag e f a ul t o c c u r s , t h e pag e r a g a i n a l l o c a t e s a ph ys i c a l pag e , s e t s i t s PFN i n to t h e PT E , a nd i n i t i a t e s the r e a d . Two i m po r ta n t s teps are taken a t t h i s t i me th a t d i f f e r f r om t h e p r ev i o us case . F i r s t , t h e s a v ed mod i f y b i t i n t h e PFN S TATE a r r a y i s t u r ne d on. Th i s g u a r a n t e e s tha t t h e pag e w i l l b e wr i t t e n t o i t s b a c k i ng s to r e a d d r e s s wh e n r emov e d f r om th e p r o c e s s wo r k i ng set , r eg a r d l e s s o f wh a t i n s t r uc t i o n s o r I /0 o pe r a t i o n s the p r o c e s s c ho o s e s t o e x e c u t e . S e c o nd , t h e BAK a r r a y e l emen t i s s e t to po i n t to th e pag e file, w i th a n i nd i c a t i o n th a t no block has ye t b e e n a l loca ted . At th i s t i m e , a l l t i e s t o t h e o r i g i n a l i m ag e f i l e a r e b r o ke n . Wh e n t h e mo d i f i e d pag e wr i te r wa n t s to wr i te t h i s pag e to i t s b a c k i ng s to r e a d d r e s s ( a s i t c e r t a i n l y w i l l b e c a us e th e s a v ed mod i fy b i t wa s j u s t t u r ned o n ) , i t w i l l a l l o c a t e a b l o c k i n t h e pag e f i l e a nd wr i te t h e c o n t e n t s o f t h e ph y s i c a l pag e t he r e . (2) Wh e n the r e a d c ompl e t e s , the pag e i s v a l i d ( a nd e f f ec t i v e l y mod i f i ed ) . ma r k e d as active a nd (4) Wh e n the pag e i s r emoved f r om th e p r o c e s s wo r k i ng set ( and the r e f e r e nc e c o un t is z e r o ) , the pag e i s un c o nd i t i o n a l l y p l a c ed o n t h e mod i f i ed pag e l i s t . (5) I f the r e f e r e n c e c o un t d i d n o t g o to z e r o wh e n the pag e wa s r emoved f r om th e p r o c e s s wo r k i ng s e t , the ph ys i c a l pag e i s p l a c ed i n to the r e l e a s e p e nd i ng s t a te un t i l th e I /O c ompl e t e s . (6) At tha t t i m e , t h e pag e i s p l a c ed on the mod i f i ed pag e l i s t . A pa g e f a ul t f r om e i th e r the r e l e a s e p e nd i ng s t a te o r f r om th e mod i f i ed page l i s t p u t s t h e pag e b a c k i n to the a c t i v e ( b u t e f f e c t i v e l y mod i f i ed ) s t a te . Th a t i s , t h e s av e d mod i f y b i t i n th e PFN S TATE a r r a y r ema i n s s e t , c a us i ng t h e pag e to b e put b a c k o n the mod i f i ed pag e l i s t wh e n i t i s r emoved f r om t h e wo r k i ng s e t a g a i n . 1 2-8 PAG I NG DYNAM I C S - I PTE contains PSTX,CRF PTE contains GPTX GPTE contains GSTX,CRF - PTE => Transition - In Working Set - Saved Modify Bit Set I PTE => Demand Zero Page The area within doHed lines Is also shown In Figure 1 2-7 Page NOT In physical memory no PFN data Read In Progress REFCNT = 2 BAK = PGFLX,O Active and Valid REFCNT >0 BAK PGFLX,O = PTE => Transition Saved Modify Bit Set P - - - - - - - - - � I PTE => Transition Saved Moj:ilfy Bit Set to Figure 1 2-5 P - .! Release Pending REFCNT >0 BAK = PGFLX,O Modified Page List REFCNT = 0 BAK = PGFLX,O - --®- - � Page Fault Transition Other Transitions Figur e 1 2-4 S t a t e D i a g r am Showi ng Pag e T r a n s i t i o n s fo r P r i v a t e a nd G l o b a l Copy-o n-Re f e r e n c e Pag e s a nd fo r Demand Z e r o Pag e s 1 2-9 PAG I NG DYNAM I C S Th e t r a n s i t i o n f r om th e mod i f i ed pag e l i s t th a t is t a k e n wh e n th e m o d i f i ed pag e wr i t e r wr i tes t h e pag e to i t s b a c k i ng s to r e a d d r e s s ( i n t h e pag e f i l e ) f i t s i n to the t r a n s i t i o n d i ag r am f o r f a u l ts f r om the pag e file ( Figure 1 2 -5 ) . Th e c o n n e c t i o n b e twe e n F i g u r e 1 2 - 4 a nd F i g u r e 1 2 - 5 i s i nd i c a t e d by p a th C i n the two f i g u r e s . 12. 2. 2 Demand Z e r o Pag e s Th e i n i t i a l s e t t i ng o f a pa g e t a b l e e n t r y c a n b e s e t t o d emand z e r o a s a r e s u l t o f a C r e a t e Vi r t ua l Ad d r e s s o r E x p a nd Reg i o n s ys tem s e r v i c e . O n e o f t h e s e s e r v i c e s c a n be i s s ue d e x p l i c i t l y by th e p r o c e s s o r on i ts b e ha l f by t h e s ys t em ( a s pa r t o f i mag e a c t i v a t i o n o r i n the L I B $G E T_VM Run-T i m e L i b r a r y p r o c ed u r e ) . Wh e n the pag e r d e t e c t s a pag e f a u l t f o r a d em a nd z e r o pag e , t h e fo l l o wi ng s t eps . it takes 1. A phys i c a l pa g e i s a l l o c a ted f r om t h e beg i n n i ng o f page l i s t . the free 2. Th e PFN a r r a y e l em e n t s a re i n i t i a l i zed . Th e e l em e n t po i n t s to the p r o c e s s pag e t a b l e e n t r y . PTE a r r ay 3. Th e BAK a r r a y e l em e n t d e no t e s a t h e pag e f i l e . block 4. Th e pag e i s f i l l ed w i th z e r o s . Th i s i s d o ne wi th a MOVC 5 i n s t r uc t i o n tha t u s e s a z e r o - l eng th so u r c e s t r i ng a nd a n u l l f i l l cha r a c te r . 5. Th e r e f e r e nc e c o un t i s i nc r em e n ted , the pa g e i s a d d ed to p r o c e s s wo r k i ng s e t , a nd t h e s t a t e is set to a c t i v e . 6. F i n a l l y , the f a u l t i s d i sm i s s ed a nd c o n t r o l i s p a s s e d bac k to t h e us e r p r o c e s s wi tho ut i n te r r u pt i o n . Th e s e s t e p s a l l t a k e p l a c e po r t i o n o f F i g u r e 1 2 - 4 . 12 . 2 . 3 a l o ng p a th 3 n o t-ye t-a l l o c a ted in the uppe r r ight in the h a nd G l o b a l Co py-on -Re f e r e nc e Pag e s Th e r e i s o n e o the r f o rm o f pag e tha t me r g e s i n to t h e s a m e s e t o f s t a t e t rans i t ions a s p r i v a t e c o py-on- r e f e r e n c e s e c t i o n s a nd d em a nd z e ro pag e s . Th i s fo rm i s a g l oba l c o py-o n- r e f e r e n c e pa g e . Th e d e t a i l s o f g l o b a l pa g e f a u l t r e so l u t i o n a r e d i sc u s s e d i n Sec t i o n 1 2 . 3 . Fo r n o w , l e t us s i mpl y s t a t e tha t g l ob a l c o py-on- r e f e r e n c e pa g e s a r e i n i t i a l l y f a u l ted f r om a g l oba l imag e f i l e b u t , f r om th a t t i m e o n , a r e i nd i s t i ng u i sh a b l e f r om p r o c e s s p r i v a t e pag e s . 12-10 PAG ING DYNAM I C S PTE contains Page File VIrtual Block Number (PGFLVB) Page NOT In physical memory no PFN data from bottom of page Read in Progress REFCNT = 2 BAK = PGFLVB PTE => Transition in Working Set Active and Valid REFCNT >0 BAK = PGFLVB - PTE Is Valid - in Working Set - Modify Bit Set - PTE Is Valid - In Working Set - Modify Bit Clear - � 1-C 1 I Release Pending REFCNT >0 BAK = PGFLVB I I I PTE => Transition Saved Modify Bit Set � - - - - - - - - - - - - - - I p PTE => Transition Saved Modify Bit Clear p _.1 from Figure 1 2-4 Modified Page List REFCNT = 0 BAK = PGFLVB Write in Progress REFCNT = 1 BAK = new PGFLVB Free Page List REFCNT = 0 BAK = new PGFLVB to top of page Page Fault Transition Other Transitions Figure 1 2-5 T r a n s i t i o n s f o r Pag e s Lo c a t ed i n a Pag e F i l e ( Co n t i n ua t i o n o f F i g u r e 1 2 - 4 ) 1 2- 1 1 PAG I NG DYNAM I C S 12.2.4 Pag e Loc a te d i n t h e Pag e F i l e Th e t r a n s i t i o n s tha t a pag e f a u l t ed f r om the pag e f i l e g oes t h r o ug h ( Figure 1 2- 5 ) a r e no d i f fe r en t f r om the t r a n s i t i o n s d e sc r i b ed f o r pag e s t h a t a r e n o t c o py o n r e f e r en c e ( F i g u r e 1 2 -3 ) . Th e o n l y d i f f e r enc e in the PFN d a ta b e twe e n the two f i g u r e s i s th a t the BAK a r r a y e l em e n t i n F i g u r e 1 2 - 5 i nd i c a te s tha t the pag e b e l o ng s i n the pag e file. Th e B A K a r r ay e l em e n t i n F i g u r e 1 2 - 3 c o n t a i n s a p r o c e s s s e c t i o n t a b l e i nd e x . Th e o the r d i f f e r e nc e b e twe e n t h e two f i g u r e s i s the e n t r y po i n t i n to the t r a n s i t i o n d i ag r am . Pag e s c a n s ta r t o u t i n a n i m a g e f i l e ( PT E c o n t a i n s PS TX ) b u t pag e s c a n n ev e r s ta r t o u t in a pag e file. Th e e n t r y i n to F i g u r e 1 2 - 5 i s f r om F i g u r e 1 2 - 4 , f r om o n e o f th r e e i n i t i a l s t a t e s th a t even t ua l l y r e s u l t i n the phys i c a l pag e c o n te n t s be i ng wr i t te n to the pag e f i l e . 12 . 3 PAGE FAULTS FOR G LOBAL PAG E S Th e pag e f a u l t r e s o l u t i o n f o r g l o b a l pag e s c a n b e d e sc r i b e d i n e x ac t l y t h e same wa y a s p r o c e s s p r i v a t e pag e s a r e d e s c r i b e d . Howe v e r , f o l l o w i ng the t r a n s i t i o n o f a g l oba l pa g e t a b l e e n t r y a nd i ts a s so c i a t e d PFN d a t a b a s e e n t r i e s a d d s n o th i ng to the i n f o rma t i o n a l r e a d y p r e s e n ted i n F i g u r e 1 2 - 3 . A m o r e i n te r e s t i ng a pp r o a c h i s to l oo k a t the i n te rac t i on o f the p r o c e s s pa g e tab l e e n t r i e s a nd t h e g l o b a l pag e tab l e e n t r i e s th a t t h e y po i n t to . Th i s wi l l b e d o n e w i th a spec i f i c e x amp l e r a th e r th a n a s a g e n e r a l c a s e , to a l l o w s pe c i f i c n umb e r s to b e used . 12. 3.1 Pag e Fa u l t f o r G l o b a l Re ad-On l y Pag e Figure 1 2-6 i l lustrates the t r an s i t i o n s th a t o c c u r fo r a g lobal r ea d - o n l y pag e t h a t i s ma pped b y two p r o c e s s e s . Th e ma pp i ng i s sho wn s e pa r a t e l y f r om the o pe r a t i o n o f section c reat ion to s i mpl i fy t h e f ig u r e . A s e cond s impl i f i c a t i o n i n t h e f i g u r e i s th a t t h e pag e i s a s s um e d to b e r e ad o n l y . Th e i m p l i c a t i o n s o f a r e a d / wr i te g l o b a l pa g e a r e d e sc r i b ed wi tho u t t h e b e n e f i t o f a f i g u r e . ( S TART ) Wh e n the g l o b a l sect ion is i n i t i a l l y c r e a t ed , the d a ta s t r uc t u r e s d e s c r i b ed i n the p r e v i o u s c h a pt e r a r e a l l s e t u p . Th e g l oba l pag e t a b l e e n t r y fo r the pag e we wi l l fo l l o w c o n ta i n s a g l oba l sect ion tabl e i nd ex , wh i c h l o c a t e s t h e g l o b a l s e c t i o n t a b l e e n t r y c o nta i n i ng i n fo rm a t i o n abo ut t h e g l o b a l i m ag e f i l e . (1) Wh e n P r o c e s s A m a ps to the s e c t i o n , t h e e n t r y conta i ns a g l o ba l pag e tab l e po i n t e r t o the g l o ba l pag e t a b l e e n t r y . (2) Wh e n Pr o c e s s B m a p s to the sect i o n , i t s pag e ta b l e e n t r y c o n t a i n s e x a c t l y t h e s a m e g l o b a l pag e t a b l e i nd ex a s fo und i n P r o c e s s A ' s PTE . 1 2-1 2 p r o c e s s pag e ta b l e i nd e x , e f f ec t i v e l y a PAG ING DYNAM I C S Process A Process B ' I I ..._ L GPTE = GSTX no change 2 - PTE = GPTX I - -- - --- iiO'change ___,r--- 1 _ t No PFN data I ....__ ____, PTE = GPTX - - -, GPTE = GSTX PTE = GPTX __ _ __ No PFN data PTE contains Global Page Table Index (GPTX) r--- 2 Page NOT In physlcel memory no PFN ciN GPTE contains Global Section Table Index (GSTX) _ _ _ _ __ _ _ _ PTE = GPTX _j Read In Progress AEFCNT = 2 SHACNT = 1 BAK = GSTX PTE => GPTE GPTE => Transition I no change - PTE Is Valid - In Working Set PTE = GPTX GPTE Is Valid • E • • • 5 no change - PTE Is Valid - In Working Set f = • ! GPTE Is Valid - PTE Is Valid - In Working Set • • • • • no change ! : PTE = GPTX - PTE Is Valid - In Working Set GPTE Is Valid PTE = GPTX GPTE => Transition I 8 • .c .... Active and Valid AEFCNT = 1 SHACNT = 1 BAK = GSTX PTE => GPTE Active and Valid AEFCNT = 1 SHACNT = 2 BAK = GSTX PTE => GPTE ·Active and Valid AEFCNT = 1 SHACNT = 1 BAK = GSTX PTE => GPTE no change t PTE = GPTX I r---r- ------,- -------no change 11 no change �HPn I I �HPn I I � Free Page List AEFCNT = 0 SHACNT = 0 BAK = GSTX PTE => GPTE __,I I TX GPTE = GS r--- No PFN data L - - - - - - - - - - - -- - - - - - -- - - - - - J F i g u r e 1 2-6 E x am p l e o f Pag e T r a n s i t i o n s Ma d e b y a G l oba l Pag e Mapped by Two P r o c e s s e s 12-13 PAG ING DYNAM I C S (3) P r o c e s s B h a pp e n s to i nc u r a pag e f a u l t o n th i s f i rst . S e v e r a l th i ng s h a ppe n . a. g loba f pag e Th e pag e r n o t e s th a t t h e p r o c e s s PTE c o n t a i n s a G PT X . Th i s is used to l o c a te the g l o b a l pag e t a b l e e n t r y ( G PTE ) • (4) (5) b. Th e G PT E c o n t a i n s a i nd i c a t i ng th a t Ex a c t l y somewh e r e . the r e a d h e r e a s i n g l o b a l s e c t i o n ta b l e i nd ex ( GSTX) , the g l oba l page r e s i d es on d i s k the s am e th i ng s a r e d o ne to i n i t i ate the c a s e o f a p r o c e s s p r i v a t e pag e . c. A phys i c a l p a g e i s a l l o c a ted . d. I t s s t a t e i s s e t to r e a d i n p r og r e s s . e. Th e r e f e r e nc e c o un t i s i nc r em e n ted . f. Th e BAK a r r a y e l em e n t i s l o ad e d w i th the G S TX . g. No te tha t t h e PFN PTE a r r a y e l em e n t i s l o ad ed w i th t h e add ress o f the G PT E , no t t h e add r e s s o f th e p r o c e s s PTE . No t e a l s o th a t , wh i l e t h e r e a d i s i n prog r e s s , the GPTE conta i ns th e t rans i t ion PTE b u t th e p r o c e s s PTE s t i l l c o n t a i n s t h e G PTX . h. Th e r e fe r e n c e c o un t i s t wo , o n e fo r the r e a d i n p r og r e s s and one to r ec o rd th e f a c t th a t th e pag e i s i n some p r o c e s s wo r k i ng s e t ( th e g l o b a l sh a r e co un t i s non z e r o ) . Th e g l o b a l s h a r e c o un t a r r a y e l eme n t c o n t a i n s a one wh i l e th e r e ad i s i n p r og r e s s . S e v e r a l s t eps a r e t a k e n wh e n the r e ad compl e t e s . a. Th e s t a t e o f the pa g e i s c h a ng ed to a c t i v e a nd v a l i d . b. Th e g l oba l pag e t a b l e e n t r y i s s e t to va l i d , to record th e f a c t t h a t th i s pag e i s i n some p r o c e s s wo r k i ng s e t . c. Th e p r o c e s s pag e sto red i n the e x a c t l y t h e s am e w i th the v a l i d b i ts . d. Th e r e f e r e n c e c o un t a nd s h a r e c o un t a r e bo th o n e a t po i n t . t a b l e e n t r y , l o c a ted th r o ug h i t s ad d r e s s I /O r e que s t pa c k e t , i s s e t u p t o c o n t a i n c o n t e n t s a s the g l oba l pa g e t a b l e e n t r y , b i t s e t and the PFN s t o r ed i n the l o w 2 1 th i s Wh e n P r o c e s s A f a u l t s t h e same g l o b a l pag e , t h e i n i t i a l pag e r a c t i on is the s am e as i t wa s i n S t e p 4 , bec a us e the pag e tabl e entry is ag a i n a g lobal pa g e ta b l e i nd e x . Now , h owe ve r , the pag e r f i nd s a v a l i d G PTE . Re so l u t i o n o f th i s pag e faul t i s t r i v i a l . A wo r k i ng s e t l i s t i s c r e a t ed fo r P r o c e s s A . Th e g l o b a l pag e tabl e e n t r y i s s i mpl y c o p i ed to P r o c e s s A ' s pag e t a b l e . Th e s h a r e c o un t i s i nc r em e n ted a nd the f a u l t i s d i sm i s s e d . 1 2- 1 4 PAG ING DYNAM I C S (6) Wh e n t h e g l o b a l pag e i s r emoved f r om P r o c e s s B ' s wo r k i ng s e t , the sh a r e c o un t i s d e c r em e n ted . B e c a u s e t h e s h a r e c o un t i s s t i l l po s i t i v e , n o th i ng d r am a t i c h a ppens t o th e phys i c a l p ag e . A t th i s t i m e , P r o c e s s B ' s pag e t a b l e e n t r y m u s t b e r e s to r e d t o i ts prev i o us s ta t e . ( Th e pag e t ab l e e n t r y d o e s n o t a s s um e s ome t r a n s i t i o n f o rm . ) Th e P T E a r r a y e l em e n t c o n t a i n s the address of the g lobal pag e t a b l e e n t r y s o the g l o b a l pag e t a b l e i nd e x mus t b e r e c a l c u l a t ed . Th e c a l c u l a t i o n i s t r i v i a l . Th e c o n t e n t s o f MMG $G L G PTBAS E a re s ub t r a c t e d f r om the PTE a r r a y e l eme n t , t h e res u l t i s d i v i d ed by four ( to c r e a te a l o ngwo r d i nd e x ) , and the q uo t i e n t s t o r e d in t h e p r o c e s s pag e ta b l e e n t r y in the G PTX f i eld . (7) Wh e n the g l o b a l pag e i s r emoved f r om P r o c e s s A ' s wo r k i ng s e t , t h e p r o c e s s pa g e tab l e entry i s r e s to r e d a s d e s c r i b ed i n Step 7 . Th e s h a r e c o un t i s d e c r emen ted . Now t h e sha r e c o un t r eaches zero so the r e fe rence c ount is a l so d e c r em e n ted . I f we a s s um e th a t t h e pag e is unmo d i f i ed a nd th e r e is no o u t s t a nd i ng I /0 , t h e phys i c a l pa g e is pl a c ed o n t h e f r e e pag e l i st . Th e G PTE c o n ta i n s a t r a n s i t i o n PT E . i nd i c a t e s f ree l i st . Th e o th e r u n c h a ng ed . (8) Th e STATE a r r a y e l em e n t P F N a r r a y e l em e n t s a r e Wh e n the phys i c a l pag e i s r e u s e d , the t i e s mus t be broken b e twe e n t h e phys i c a l pag e a nd , i n th i s c a s e , t h e g l o b a l pag e ( N o n e o f the p r o c e s s e s m a pped to th i s pag e are tabl e entry . a f f e c ted i n a n y wa y b y th i s s t e p . ) Th e c o n t e n t s o f the BAK a r r ay e l em e n t ( a G S T X ) are i ns e r ted i n to th e G PTE l o c a ted b y t h e c o n t e n t s o f t h e PFN P T E a r r a y e l em e n t . Th e PFN PTE a r r ay e l em e n t i s then c l e a r e d , b r e a k i ng t h e c o nn e c t i o n b e twe e n t h e phys i c a l pag e a nd the g l o b a l pa g e tabl e . Th i s puts t h e p r o c e s s a nd g l o b a l pag e ta b l e s b a c k to the s tate they we r e i n fo l l o w i ng S t e p 2 ( a l th o ug h i t i s p i c t u r ed h e r e a s a d i f f e r e n t s t a t e to ma k e the f i g u r e s i mpl e ) . 12. 3.2 G l o b a l Re a d /Wr i t e Pag e s Th e t r a n s i t i o n s th a t o c c u r fo r g l o b a l wr i t ab l e pag e s a r e no d i f f e r en t f r om t h e t r an s i t i o n s f o r a p r o c e s s pr i v a t e pag e t h a t i s n o t c o py o n r e f e r e nc e . Th e o n l y d i f fe r e n c e b e twe e n s uc h t r a n s i t i o n s a nd the t r ans i t i ons i l l u s t r a t ed in F i g u r e 1 2 - 3 i s th a t the g l o b a l pag e t a b l e entry , n o t t h e p r o c e s s pag e t ab l e entry , i s a f fec ted by the t r a n s i t i o n s t h a t th e phys i c a l pag e m a k e s . Th e p r o c e s s pag e t a b l e e n t r y f o r g l o b a l pag e s c o n t a i n s a g l o b a l pag e t ab l e i nd e x up un t i l t h e t i m e th a t the pag e i s mad e v a l i d . On l y t h e n i s a P F N i n se r t ed i n to the p r o c e s s PT E . As soon a s the pag e is r emoved f r om th e p r o c e s s wo r k i ng s e t , t h e p r o c e s s PTE r e v e r t s to the G PTX f o rm . Al l t i e s to the PFN d a t a b a s e a r e mad e th r o ug h the g l o b a l pag e t a b l e e n t r y , wh i c h r e t a i n s t h e PFN wh i l e t h e phys i c a l pa g e i s i n the va r i o us t r ans i t i o n s ta te s . 12-15 PAG ING DYNAM I C S 12 . 3. 3 G l o ba l Copy-o n-Re f e r en c e Pag e s Th e g l o b a l pag e s j u s t d e sc r i b ed a r e a l l s h a r ed pa g e s . One f o rm o f g l o b a l pa g e i s s h a r ed o n l y i n i t s i n i t i a l s t a t e . As soon as the faul t o c c u r s , th e pag e i s t r e a t ed e x a c t l y l i k e a p r o c e s s p r i v a t e pa g e . Th e s e p ag e s a r e g l o b a l c o py-on- r e f e r e nc e pag e s a n d c ommo n l y o c c u r in sha r e ab l e i m ag e s tha t c o n t a i n impu r e d a ta a r e a s . Fo r e x ampl e , a l l o f t h e l o c a l va r i a b l e s i n a F ORTRAN s h a r e a b l e i m a g e wo u l d b e i n a g l o b a l c o py - o n - r e f e r e nc e s e c t i o n . E a c h p r o c e s s th a t u s e s t h e i m a g e wo u l d g e t i t s o wn p r i v a te c o py o f the l o c a l v a r i a b l e s , b u t a l l p r o c e s s e s wo u l d g e t t h e s ame i n i t i a l v a l u e s f o r t h e v a r i a b l e s . F i g u r e 1 2 -7 i l l u s t r a t e s c o py - o n - r e f e r e n c e pag e . r - - - - - - -, : I I I I I I PTE = GPTX - PTE � Transition - In Working Set - Saved Modify Bit Set L_ t r ans i t i o n s I I I I I I I --, G r - _j L � to Figure 1 2-4 tha t occur Process A GPTE contains Global Section Table Index (GSTX),CRF PTE contains GPTE = GSTX, CRF fo r a Page NOT In physical memory no PFN data no change PTE = GPTX GPTE = GSTX, CRF no change no change PTE = GPTX GPTE = GSTX, CRF No PFN data z IL. G. CD c 0 Read In Progress REFCNT = 2 BAK = PGFLX,O PTE .... Process B's page table entry no change z IL. G. - PTE � Transition - In Working Set GPTE = GSTX, CRF - Saved Modify Bit Set c • :» = ;:; Ill to Figure 1 2-4 F i g u r e 1 2-7 g l ob a l No PFN data Global Page Table Index (GPTX) Process B <¥ the E x ampl e o f Pa g e T r a n s i t i o n s f o r G l o b a l C o py-o n-Re f e r e n c e Pag e s 1 2- 1 6 Read In Progress REFCNT = 2 BAK = PGFLX,O PTE .... Process A's page table entry PAG ING DYNAM I C S (1) i d ent ical c o nd i t i o n s a r e to initial Th e th o s e used in Th e s e c t i o n i s c r ea t ed and th e G PT E s c o n t a i n a F i g u r e 1 2-6 . G STX , a l th o ug h h e r e t h e c o py-on- r e f e r e n c e b i t i s s e t . ( 2) P r o c e s s A m a p s the pag e a nd h a s i t s G PTX . ( 3) P r o c e s s B m a p s t h e pag e a nd g e t s the same G PT X N o th i ng i s d i f f e r en t u p t o th i s po i n t . (4) Now wh e n P r o c e s s B i nc u r s a pag e f a u l t , the pag e r f o l l o ws t h e G PTX to th e G PT E , n o t i ng t h a t the pag e i s l o c a t ed i n a g l o b a l i mag e f i l e a n d i s c o py o n r e f e r e nc e . A r e a d i s i n i t i a t e d a nd the f o l l ow i ng mod i f i c a t i o n s a r e m a d e to the p r o c e s s PT E a nd the PFN d a t a b a s e . set PTE to c o n ta i n in i ts a PTE . a. Th e g l o b a l pag e t a b l e e n t r y i s n o t to uc h e d . i t s G S TX c o n t e n t s . b. Th e p r o c e s s pag e t a b l e e n t r y i s s e t to a t r a n s i t i o n PTE . c. Th e s t a t e p r og r e s s . d. Th e BAK a r r a y e l em e n t c o n t a i n s a pag e f i l e i nd ex b l o c k a l l o c a ted ye t ) of the ph y s i c a l pag e is set It to r e ta i ns read in ( w i th n o • e. Th e PT E a r r a y e l em e n t c o n t a i n s the ad d r e s s o f P r o c e s s B ' s PTE . No t e tha t a l l t i e s b e twe e n P r o c e s s B a nd the g l o ba l sect ion are bro ken . Th e pag e i s now t r e a t ed e x a c t l y l i k e a p r i v a t e c o py-on- r e f e r e n c e pag e . Th e two box e s for Process B in Figure 1 2 -7 are the box e s wi th i n the d a sh e d o u tl i ne i n Figure 12-4 . (5) Wh e n P r o c e s s A f a u l ts the same pag e , e x a c t l y the same s teps a r e t a k e n , th i s t i me w i th a to ta l l y d i f f e r e n t phys i c a l pag e . Th u s , bo th P r o c e s s A a nd P r o c e s s B g e t e x a c t l y the s a m e initial c o py o f the g l o b a l pag e f r om the g l o b a l i m ag e f i l e b u t , f r om tha t po i n t o n , e a c h p r o c e s s h a s i t s o wn p r i v a t e c o py o f t h e pag e to mod i f y a s it wi shes . 12 . 4 WORK ING S ET REPLAC EMENT Th e wo r k i ng s e t l i s t r e p l a c em e n t a l g o r i thm th a t VMS u s e s i s a mod i f i e d f i r s t- i n f i r s t- o u t s c h em e . Th e pag e tha t h a s b e en i n th e wo r k i ng s e t l i s t fo r the l o ng e s t t i m e i s t h e f i r s t c a nd i d a te f o r r e p l ac em e n t . 12. 4. 1 Sc a n o f Wo r k i ng S e t L i s t Wh e n the pag e r n e e d s a n empty wo r k i ng s e t l i s t en t r y , i t c a l l s r o u t i n e MMG $ FREWS LE . Th i s r o ut i n e m a n i pu l a t e s the wo r k i ng set l i st ( F i g u r e 1 1 - 4 ) i n t h e fo l l o w i ng f a sh i o n . 1. I f the W S L E i nd ex ed b y PHD$W WSN E XT i s a l r e a d y f r e e a r e z e r o ) , th a t e n t r y i s u s ed . 1 2- 1 7 ( contents PAG ING DYNAM I C S 2. 3. 4. I f n o t , t h e WSNE XT po i n t e r i s i nc r em e n t ed . If the WSNE XT po i n te r e x c eed s the e nd o f the l i s t ( WS LA S T ) , i t i s r e s e t to the beg i nn i ng o f the d yn am i c wo r k i ng s e t l i s t ( WS DYN ) , th u s i mpl em e n t i ng th e wo r k i ng s e t l i s t a s a c i r c u l a r b u f f e r . I f the n e wl y i nd e x ed WS LE i s a v a i l a b l e , u s ed . then it is s impl y I f the n e w WS LE i s l o c k ed i n to the d yn am i c po r t i o n o f the wo r k i ng set l i s t , t h a t e n t r y i s s k i pped . ( Th i s m e a n s g o i ng b a c k to S t e p 2 . ) On l y p r o c e s s pag e t a b l e pag e s c a n b e loc ked i n to t h e d yn am i c po r t i o n of t h e wo r k i ng s e t l i s t . Pag e s l o c k e d b y u s e r r e que s t r e s u l t i n a s h u f f l i ng o f t h e wo r k i ng s e t l i s t ( Ch a p t e r 1 1 a nd Ch a pt e r 1 3 ) . D r o pp i ng th r o ug h t h e p r ev i o us c h ec k s i nd i c a t e s tha t the v i r t oa l pag e i nd i c a t ed by t h e WSLE mus t be r emoved b e fo r e th i s WS LE c a n b e u s e d . I f wo r k i ng s e t l i s t s k i pp i ng ( d e sc r i b ed i n the n e x t sec t i o n ) i s no t e na b l ed , t h e wo r k i ng s e t l i s t e n t r y i s r emoved , wh a t ev e r i t s s t a t e . Fo r g l o b a l pag e s , t h e s h a r e c o un t i s d e c r em e n ted . g o e s t o z e r o , t h e r e f e r e n c e c o un t i s d e c r em e n t e d . I f the sh a r e c o un t Fo r p r o c e s s p r i va te pag e s , th e r e f e r e nc e c o un t i s d e c r em e n ted . I f the pag e i s pl a c ed i n to a t r a n s i t i o n s t a t e , the b a l a n c e s l o t r e f e r e nc e c o un t f o r th i s p r o c e s s h e a d e r i s i n c r em e n ted to p r e v e n t the o u tswa p o f t h e p r o c e s s h e ad e r . 12. 4.2 S k i pp i ng Wo r k i ng S e t L i s t E n t r i e s Th e s pe c i a l SYS B OOT pa r am e t e r S K I PWS L ( d e f a ul t va l u e o f z e r o ) i s u s ed by t h e wo r k i ng set r emov a l r o u t i n e to pe rm i t f r e q ue n t l y r e f e r e nc e d pag e s to r ema i n i n the wo r k i ng s e t . Th i s a l l o ws VM S to mod i f y i t s str ict f i r s t- i n f i r s t - o u t pag e r e pl a c emen t a l g o r i thm wi th some f r eque n c y of u s e i n f o rm a t i o n . Th e m o d i f i ed a l g o r i thm wo r k s i n the f o l l o wi ng m a n n e r . As wo r k i ng set l i st entr i es are sc ann ed , a n y va l i d pa g e is s k i pped o v e r a f t e r c l e a r i ng t h e va l i d b i t i n t h e PT E . Th e pag e r ema i n s i n t h e wo r k i ng s e t l i s t a nd i t s PFN s t a t e i nd i c a t e s a c t i v e and va l i d . Th e r e a r e two po s s i b l e f u t u r e c o u r s e s f o r th i s pa g e , c a l l ed an act ive t rans i t ion pag e . • Th e pa g e wi l l b e r e f e r e nc ed ag a i n , c a u s i ng a pag e faul t because the va l i d b i t i s o f f . Th e pag e r r e so l v e s th i s pag e f a u l t by s i mp l y t u r n i ng th e va l i d b i t bac k on . Th e r e is n o th i ng e l se to d o b e c a u s e the wo r k i ng s e t l i s t s c a n d i d n o th i ng e x c e p t to t u r n the va l i d b i t o f f . Th i s type o f pag e f a u l t i s t h e f a s t e s t pa th th r o ug h the pag e r . Th e ma i n r e a s o n f o r th i s e f f i c i e n c y i s th a t the wo r k i ng set l i st does n o t h a v e t o b e s c anned , l o o k i ng fo r a WSLE t o d i sca r d . Th a t wo r k i ng s e t s c a n i s wh e r e th e pag e r spend s mo s t o f i t s t i m e wh e n r e s o l v i ng pag e f a u l ts f r om the f r e e o r mod i f i ed pag e l i s t s o r wh en a pag e f a u l t o c c u r s f o r a g l ob�l pag e th a t is a l r e ad y in the wo r k i ng set of some o the r process . 12-18 PAG ING DYNAM I C S • Th e pag e w i l l n o t b e r e f e r e nc ed a g a i n s o o n . O n th e n e x t pa s s th r o ug h th e wo r k i ng s e t l i s t , t h e pag e wi l l s t i l l be i nv a l i d ( a c c o r d i ng t o t h e v a l i d b i t i n the PTE ) b u t a c t i v e ( a c c o r d i ng to the PFN S TATE a r r a y ) . On th i s s e c o nd pa s s , the pag e w i l l b e r emoved f r om th e wo r k i ng s e t . Th e S K I PW S L p a r am e t e r is used b y t h e wo r k i ng set l i st scan to d e t e rm i n e how m a n y WS LEs to scan ahead l o o k i ng for a s u i tab l e c a nd i d a t e f o r r emova l b e fo r e a b a nd o n i ng the s e a r c h . B e f o r e the s e a r c h b eg i n s , the f i r s t wo r k i ng l i s t e n t r y t h a t wi l l b e e x am i n ed i s s a v e d f o r po s s i b l e r emov a l i f no a c t i ve t r a n s i t i o n pag e is f o und a nd r emoved . A n um b e r o f wo r k i ng l i s t e n t r i e s up to S K I PWS L i s sc a nn e d u n t i l e i th e r • • a pag e i n a n a c t i v e t r a n s i t i o n s t a t e i s fo und . r emoved f r om the wo r k i ng s e t l i s t . Or • • is S K I PWSL e n t r i e s h a v e b e e n e x am i n ed a nd no ac t i v e t rans i t ion pag e f o und . In th i s c a se , th e f i r s t e n t r y loo ked a t i s r em oved f r om t h e wo r k i ng s e t l i s t , r eg a r d l e s s o f i ts s ta t e . By r emov i ng the f i r s t e n t r y r a th e r th a n a n y o th e r , a pag e i s n o t p r ema t u r e l y r emoved f r om the wo r k i ng s e t by th i s m o d i f i e d a l g o r i thm . Th e fo l l o wi ng pag e s i n t h e m od i f i ed s c a n . • Th i s pag e Pag e s th a t a r e va l i d pag e s . ) set s k i pped ove r in th i s ( Th e va l i d b i t i s t u r n ed off fo r s uc h wo r k i ng are Pag e s t h a t a r e i n t h e r e ad - i n - p r o g r e s s t r a n s i t i o n s t a t e G l o b a l pag e s wh e r e t h e g l o b a l pag e t a b l e e n t r y i nd i c a t e s t r a n s i t i o n s t a t e ( wh i c h m u s t b e r e ad i n p r og r e s s ) a I f no a c t i v e t r a n s i t i o n pag e i s fo und a f t e r S K I PW S L pag e s h a v e been s k i pped , th e f i rst e n t r y l o o k e d a t i s r emoved f r om th e wo r k i ng s e t , r e g a rd l e s s o f i t s s t a t e . Th e d e fa u l t v a l u e o f t h e S K I PWS L s pe c i a l SYSB OOT p a r am e t e r is zero , wh i c h t u r n s o f f th i s e n t i r e mo d i f i c a t i o n o f the wo r k i ng s e t l i s t r e pl a c em e n t a l g o r i thm . I n a d d i t i o n , i f S K I PWSL i s z e r o , then a c t i v e t r a n s i t i o n pag e s w i l l n ev e r ex i s t , b e c a us e th e y o n l y c o m e i n to e x i s t e n c e d u r i ng t h e m o d i f i ed wo r k i ng set l i s t s c a n . Ca r e sho u l d be e x e r c i s e d wh e n us i ng th i s f e a t u r e ( s e t t i ng S K I PW S L t o n o n z e r o ) b e c a u s e c e r t a i n a sp e c t s o f th i s mod i f i c a t i o n d e f e a t t h e o pt i m i za t i o n s a c h i eved b y c l u s t e r ed I /O a nd th e phys i c a l pag e c a c h e s . To o l a rg e a va l ue o f S K I PWS L a l s o c a u s e s m o r e t i m e to b e s pe n t e a c h t i me the wo r k i ng set l i s t i s s c anned l o o k i ng f o r a pag e t o b e r e p l a c ed . 12. 5 IN PUT AND O UTPUT THAT SUPPORT PAG ING Th e r e i s v e r y l i t t l e spec i a l p u r po s e c o d e in the I /O s ub s ys t em to s uppo r t pag e r I /0 a n d s wa ppe r I /0 . Th e pag e r and swa ppe r each b u i l d th e i r o wn I /O r e qu e s t pa c k e t s b u t t h e s e pa c k e t s a r e que ued to the d ev i c e d r i v e r i n the n o rma l f a sh i o n . Th e s e a r e the o n l y d i f f e r e n c e s . • Mo d u l e S Y S Q I OR E Q c o n t a i n s s pe c i a l e n t r y po i n t s f o r pag e r a nd s wa ppe r I /O tha t i n s e r t s pec i a l I /O f unc t i o n cod e s i n to th e I /O r e que s t p a c k e t . 12-19 PAG ING DYNAM I C S • Th e s e c o d e s a r e d e t e c t ed by t h e I /O po s tp r o c e s s i ng s e rv i c e rout i ne . Th e r e a r e spec i a l compl e t i o n pa ths f o r pag e r e a d ( p r o c e s s i s r emoved f r om PFW s t a te a nd mad e c om p u t a b l e ) and f o r o t h e r f o rms o f I /O ( a d d r e s s o f s p e c i a l ke r n e l A S T s t o r ed i n I R P $ L ASTPRM f i e l d i s u s e d to n o t i f y mod i f i ed pa g e wr i t e r o r swa pper th a t I /O h a s c ompl e t ed ) . I n o rd e r to m a k e r e ad i ng a nd wr i t i ng a s e f f i c i e n t a s po s s i b l e , the pag e r s uppo r t s a f e a t u r e c a l l ed c l us t e r i ng , wh e r e i t c h e c k s to s e e wh e th e r pag e s a d j a c e n t t o th e v i r tua l pag e th a t it is r e a d i ng are l o c a ted i n the same file i n ad j a c e n t v i r t ua l blocks . I f so , a m u l t i pl e b l o c k r e ad i s i s s ued a nd s ev e r a l pag e s a r e b r o ug h t i n to the wo r k i ng s e t a t o n e t i me . Th e mod i f i ed pag e wr i t e r a nd t h e Upd a t e Se c t i o n s ys tem s e r v i c e a l so c l us te r t h e i r wr i t e o pe r a t i o n s , b o th to m a k e t h e i r wr i t e s a s e f f i c i e n t a s po s s i b l e a nd t o a l l o w s ub s e q u e n t c l us te r ed r e a d s f o r t h e pag e s tha t a r e b e i ng wr i t t e n . 12. 5 . 1 Page Re ad s Wh e n the pag e r d e t e rm i n e s tha t a r e a d i s r e qu i r ed to sa t i s f y a pag e f a u l t , i t a l l o c a t e s a n I /O r e qu e s t pa c k e t a nd f i l l s i t wi th pa r am e t e r s tha t d e sc r i b e t h e r e a d . Ta b l e 1 2 - 1 l i s t s tho s e f i e l d s tha t a r e used f o r spec i a l p u r po s e s by t h e pag e r . 12. 5 . 1 . 1 Pag e Re ad C l u s te r i ng - Th e pag e r a t tempt s to c reate a c l us t e r o f pag e s to r e a d . Th e m a nne r i n wh i c h th i s c l u s t e r i s f o rmed d e pe nd s on the i n i t i a l s t a t e of the f a u l t i ng pag e ta b l e en t r y . 1 2 . 5 . 1 . 1 . 1 Te rm i na t i ng Co nd i t i o n fo r C l us te r ed Re ad s - The pag e r scans PTEs th a t m a p l a rg e r v i r t ua l add resses , c h e c k i ng f o r mo r e v i r t ua l pag e s tha t a r e l o c a t ed i n t h e s a m e b a c k i ng sto r e loc a t i on , un t i l the d e s i r ed c l us t e r s i ze is r e ached or un t i l one o f th e f o l l o w i ng o the r t e rm i n a t i ng c o nd i t i o n s i s r e a c h ed . • • • • • A pag e t a b l e e n t r y d i f f e r e n t f r om the o r i g i n a l is en c o un t e r e d . f a u l t i ng PTE Th e c l u s t e r s i z e i s r e a c h e d . Th e pa g e t a b l e pag e i s i t s e l f n o t v a l i d . ( S a t i s f y i ng f a ul t wo u l d o f f s e t t h e b e n e f i t s g a i ned by c l u s t e r i ng . ) th i s No mo r e wo r k i ng s e t l i s t e n t r i e s a r e a v a i l a b l e . i n the c l u s te r i s a d d ed to the wo r k i ng s e t . ) pag e { Each No phys i c a l pag e i s a v a i l a b l e . I f , a f t e r sc a n n i ng t h e a d j a c e n t pag e t a b l e e n t r i e s towa r d h i g h e r v i r t ua l add resses , no p ag e s h a v e been c l us te r ed , the p r o c e s s i s r e p e a ted towa r d l o we r v i r t ua l a d d r e s s e s wi th the same t e rm i n a t i ng c o nd i t i o n s . 1 2-2 0 PAG I NG DYNAM ICS Th e s c a n i s m a d e i n i t i a l l y t o wa r d h i g h e r v i r t ua l a d d r e s s e s b e c a us e p r og r am s t yp i c a l l y execute s e qu e n t i a l l y t o wa r d h i g h e r v i r t ua l a d d r e s s e s a n d th e s e pag e s a r e l i k e l y t o b e n e e d ed soon . If the fo rwa r d a t t empt fa i l s , the pag e r a t temp t s to r e ad pag e s a d j a c e n t to the f a u l t i ng pag e on the a s s ump t i o n t h a t even pag e s at l o we r v i r t ua l a d d r e s s e s b u t n e a r t h e f a u l t i ng pag e a r e l i ke l y t o b e n e e d ed so o n . 1 2 . 5 . 1 . 1 . 2 Ma t c h i ng Co nd i t i o n s Wh i l e S c a nn i ng Pag e Ta b l e - Th e m a tc h that is l ooked f o r wh en s c a n n i ng the a d j a c e n t pa g e t a b l e e n t r i e s d e pend s o n t h e f o rm o f t h e i n i t i a l pag e t a b l e e n t r y . • • • I f the o r i g i na l PT E c o n ta i n s a p r o c e s s s e c t i o n t ab l e s uc c e s s i v e PTEs mu s t c o n t a i n e x a c t l y the same PSTX . i nd ex , I f the o r i g i n a l P T E c o n ta i n s a pag e f i l e v i r t ua l block s uc c e s s i v e PTEs m u s t c o n t a i n PTEs w i th s u c c e s s i v e l y n um b e r , i nc r e a s i ng ( o r d e c r e a s i ng ) v i r t ua l b l o c k n umb e r s . I f the o r i g i n a l pag e t a b l e e n t r y c o nta i n s a g l o ba l pag e t a b l e s uc c e s s i ve PTEs mus t c o n t a i n s uc c e s s i ve l y I n c r e a s i ng i nd e x , { o r d e c r e a s i ng ) i nd i c e s . I n a d d i t i o n , t h e g l o b a l pag e t ab l e e nt r i e s mus t a l l conta i n ex a c t l y the s a m e g l o b a l s e c t i o n t a b l e i nd ex . 1 2 . 5 . 1 . 1 . 3 Ma x i m um C l us t e r S i z e f o r Pag e Read - Th e m a x i m um n um b e r o f pag e s tha t c a n b e in a c l us t e r i s d e term i n e d i n s e v e r a l wa ys , d e pend i ng o n the type o f pag e b e i ng r e ad . • • G l o ba l pag e t a b l e p ag e s a r e n o t c l u s t e r ed . Th e c l u s t e r f a c t o r fo r p r o c e s s pag e ta b l e pag e s i s t a k e n f r om o ffset PHD$8 PGTB PFC in the f i x ed po r t i o n of the p r o c e s s head e r . Un l es s some u s e r -wr i t t e n k e r n e l m o d e r o ut i n e h a s mod i f i ed th i s field , t h e v a l u e o f th i s f i e l d i s t a k e n f r om the s pe c i a l S Y S B OOT p a r am e t e r PAGTB LPFC f o r a l l p r o c e s s e s in the s y s tem . Th e d e f a u l t va l u e f o r th i s p a r am e t e r i s two . Th i s v a l ue is chosen to avo i d a n a r t i f i c i a l end to b u i l d i ng a c l us t e r wh e n t h e pag e t a b l e pag e a l s o had to b e f a u l ted . Two pa g e tab l e pag e s a r e g ua r a n t e ed to s p a n 1 2 7 pag e s , r eg a rd l e s s o f the i n i t i a l f a u l t i ng v i r t ua l a d d r e s s . Dec r e a s i ng th i s v a l ue m a y I n c r e a s i ng i t a bove two i s l i ke l y t o d e f e a t c l us t e r ed r e ad s . h a ve n eg l i g i b l e e f f e c t s i n mo s t s y s tems . • Th e c l u s t e r f a c to r f o r pag e f i l e pag e s is ta ken f r om th e P F L $ 8 PFC f i e ld of the pag e file c on t r o l bloc k Th e u s ua l c o n t e n t s o f th i s f i e l d are zero . { F i g ure 1 1 - 2 2 ) . In th a t c a se , the c l us t e r f a c to r is ta ken f r om the PHD$8 D F PFC f i e l d o f t h e p r o c e s s h e a d e r . I n the absence o f u s e r -wr i t t e n mod i f i c a t i o n , t h e v a l ue p l a c ed i n to th i s f i e l d i s t h e S Y S 8 00T pa r am e t e r PFC D E FAU LT . 1 2-2 1 PAG ING DYNAM I C S Ta b l e 1 2 - 1 De s c r i pt i o n o f I /O Reque s t s I s s ue d b y Memo r y Ma n ag em ent � P r i o r i ty P r o c e s s Pag e Read Imag e F i l e ( 1 ) in l. Pag e 2. 3. Pag e i n Pag e F i l e Pag e Ta b l e Pag e Pro c e s s ID I R P $B_PR I I R P $ L_P I D Pr i o r i t y o f Fa ul t i ng Process PID o f Fa ul t i ng Process Sys t em Pag e Re a d Pr i o r i t y o f " Sy s t e m " Process 16 1 . Sys tem Pag e ( 2 ) PID o f " Sy s tem " Process S y s tem V i r t ua l Add r e s s o f PTE AST Add re s s I R P$ L_SVAPTE IRP$L_AST l. P OPT/ P l PT l. 2. 3. P O PT/P l PT S PT 2. 1. S PT l. 0 0 3. 0 0 2. G l oba l Pag e 2. G PT 2. 3. Gl oba l 3. P r o c e s s Pag e Ta bl e 3 . Ma s t e r PTE CRF Pag e S l av e PTE Ad d r e s s ( < O ) Co nten t s ( > O ) 4. 4. G l o b a l Pag e Ta b l e Pag e To To 3. To Swa p Fi l e ( SWPVBN=O ) Upd a t e Sec t i o n Pag e Wr i te ( 4 ) Swa ppe r (1) (2) Po i n t s t o Mod i f i ed Pag e Wr i te r ' s Ma p Pr i o r i ty o f Ca l l e r PI D o f Ca l l e r a . P r o c e s s Pag e Ta b l e b . G l o b a l Pag e Tab l e SWP PR I O PID o f Swa ppe r Po i n t s to Swa ppe r Ma p I /0 O n e f i e l d in the I /0 r eque st pa c k e t sec t i o n is sensi t ive to wh e th e r c a s e s a r e d i s t i ng u i sh e d a s : a. b. 0 PID of Mo d i f i ed Pa g e Wr i te r (PID of Swa ppe r ) Pa g e F i l e I m ag e F i l e ( 3 ) 1. 2. 0 4. MPW P R I O Pag e Wr i te Mo d i f i ed S PT AST Add r e s s ( i f s pe c i f i e d ) 0 ( I R P S L AS TPRM ) fo r pag e r ead s f rom a pr i v a t e t h e s ec t i o n i s c o py o n r e f e r en c e . The se two No t Co py o n Re fe r enc e Co py on Re f e r enc e P ag e a b l e ex ecut i v e r o u t i n e s o r i g i na te in o ne of t h r ee imag e f i l es ( S YS . EXE , RMS . E XE , a nd S YSMSG . EXE ) d e sc r i b ed by t h r e e sys t em s e c t i o n tab l e en t r i e s ( S STE ) l oc a ted i n the s ys t em h e ad e r . The s t a t i c ex e c ut i v e d a ta is a l l l o c a ted in the no npag ed e x ec ut i v e . The onl y pag e ab l e wr i tab l e d a ta is t h e pag ed po o l a r ea , wh i c h st a r t s o u t as a se r i e s o f d emand ze ro pag e s . Pag ed po o l pag e s a r e wr i t t e n to a nd sub s e que n t l y f a u l ted f r om the pag e f i l e . The se two c a s e s a r e d i s t i ng u i sh ed a s : a. b. (3) T h e mod i f i ed pag e wr i te r t a k e s spec i a l n o t e o f wh e th e r b a c k t o a n imag e f i l e a r e pa r t o f a a. b. (4) Pag e a b l e ex e c u t i v e r o ut i n e s Pag ed po o l pag e s tha t are wr i t te n Pr i v a t e s e c t i o n Gl o b a l se c t i o n I n a s i m i l a r m a n ne r , the Upd a te Se c t i o n s ys t em d epend i ng on wh e th e r t h e pag e s a r e pa r t o f a a. b. pag e s Pr i v a t e s e c t i o n G l o b a l se c t i o n 12-22 s e rv i c e beha v e s d i f fe r en t l y PAG I NG DYNAM I C S Ta b l e 1 2 - 1 ( cont . ) De s c r i pt i o n o f I /0 Re q u e s t s I s s ued by Memo r y Ma n ag em e n t A S T Pa r am e t e r Ad d r e s s o f Wi ndow C o n t r o l Bl o c k I R P S L A S TPRM I R P $ L_W IND la . O l b . PSTX 2. 0 3. 0 l. 2. 3. GSTX ( PFN!:V G B LBAK is s e t) 4. 0 Ad d r e s s o f M PW ' s spe c i a l k e r n e l AST ( WR I T EDON E ) A S T Pa ram e t e r ( i f spec i f i ed ) Swa ppe r • s ( I O DONE ) (7) 3. From PFL From P F L ( S ) l. p f c / PFCDEFAULT ( 6 ) 3. PFCDEFAULT PAGTB L PFC 2. Pr io r i t y Bo o s t a t I/O Compl e t i o n Cl ass=O Bo o s t = O KAST l a . From S S TE l b . From P F L 2 . From G S TE 3. la . SYS PFC l b . PFCDEFAULT 2 . p f c / P F CDEFAULT ( 6 ) From G S TE 3. p f c / PFCDEFAULT ( 6 ) 4. From P F L ( S ) 4. a. b. PS TE GSTE S F TE 1. 2. 3. Pa g e Pa g e in Re ad 3. Pag e i n Pa g e Fi l e Pa g e Ta b l e Pa g e I m ag e 1. System Pa g e ( 2 ) 2. Gl obal Pa g e Gl obal CRF Pag e 3. 4. 1 G l o b a l Pag e Ta b l e Pag e Mod i f i ed MPW WRTC LUS TER MPW-WRTC LUSTER l. 2. 3. 1 To To Pag e Wr i te Pag e Fi l e !mag e F i l e ( 3 ) To Swap Fi l e ( SWPVBN=O ) MPW WRTCLUSTER C l ass=l Boost=2 Upd a t e Se c t i o n P a g e Wr i te ( 4 ) No t Appl i c ab l e No ne ( 7 ) swa ppe r P r o c e s s pag e tab l e s a nd g l o b a l pag e t a b l e s o r i g i n a te a r e wr i t t e n to and f a u l ted f r om the pag e f i l e . as d emand zero pag es tha t Th e c l us t e r f a c to r fo r a pr i v a te sec t i o n o r a g l ob a l sec t i o n c an b e spe c i f i ed at l i nk t i m e o r when t h e sec t i o n i s m a pped b y e x pl i c i t l y d e c l a r i ng a c l us te r f a c to r ( pfc ) . In the absen c e o f s uc h a spec i f i c a t i o n , the pag e r u s e s the d e fa ul t s ys tem c l us t e r fac to r d e t e r m i n ed b y t h e SYS B OOT pa r am e t e r PFCDEFAULT. Th e swappe r ( a nd by i mpl i c a t i o n the mod i f i ed pag e wr i te r ) a nd i s t he r e fo r e n o t s ub j ec t to pr i o r i ty b o o s t s . 12-23 is a Fi l e ( l ) Sys tem Pag e Read No ne ( 7 ) l . From PFL 2 a . From PSTE 2b . From G S TE 3 . From S F TE Process l. 2. Cl a s s = O Bo o s t = O 0 (6) From 2. 0 (5) PSTE l. Cl uster Fa c to r r ea l - time proc e s s I/O PAG ING DYNAM I C S • Th e c l us t e r f a c to r f o r p r o c e s s o r g l o b a l sec t i o n s is t a k en f r om t h e SEC$8 PFC f i e l d o f the p r o c e s s o r g l o b a l sec t i o n t a b l e e n t r y { F i gur e s 1 1 - 7 a n d 1 1 - 1 6 ) . Th e se f i e ld s u s ua l l y c o n t a i n v a l ue s o f z e r o , i n wh i ch c a se , t h e d e fa u l t pag e f a u l t { J u s t a s f o r c l us t e r ed r e a d s f r om t h e pag e c l u s t e r i s u s ed . f i l e , t h i s d e f a ul t i s t a k e n f r om t h e PHD $ 8 DFPFC f i e l d i n t h e p r o c e s s h e ad e r , wh i c h i s u s ua l l y e q ua l to the PFCDEFA U LT S YS B OOT p a r am e t e r . ) Th e r e a r e two m e tho d s a v a i l a b l e t o t h e us e r to c l u s te r f a c to r o f p r o c e s s o r g l o b a l s e c t i o n s . the opt i ons l i n e the control By i n c l ud i ng C LUSTER = c l us t e r -n a m e , [ b a s e - ad d r e s s ] , [ p f c ] , f i l e - s p e c [ , • • • ] i n the l i n k e r o p t i o n s f i l e , t h e pag e f a u l t c l us t e r f a c to r in t h e i m a g e s e c t i o n d e sc r i pto r c a n b e s e t t o n o n ze r o c o n t e n t s . S e c t i o n s t h a t a r e m a pped m a n ua l l y by t h e u s e r { wi th a C r e a te a nd Ma p { P r i va te o r G l o ba l ) S e c t i o n s ys t em s e rv i c e ) c a n h a v e t he i r pag e f a ul t c l u s te r f a c to r spec i f i ed b y i nc l ud i ng the o pt i o n a l p f c a rg um e n t i n t h e s ys t em s e rv i c e c a l l . 1 2 . 5 . 1 . 2 Pag e Read Compl e t i o n - Th e pag e r e a d compl e t i o n i s d e te c t ed by t h e I /0 po s t p r o c e s s i ng r o u t i ne { I PL = 4 s o f twa r e i n t e r r up t s e r v i c e r o u t i n e ) b y the spec i a l c o d e i n s e r t ed i n to the I R P b e f o r e t h e r e que s t wa s que ued . Pa g e r e ad c ompl e t i o n i s n o t r e po r ted to the f a ul t i ng process i n the n o rma l f a sh i o n w i t h a s pe c i a l k e rn e l AST b e c a u s e none of the po s t p r o c e s s i ng h a s t o b e pe r f o rmed i n t h e c o n t ex t o f the f a u l t i ng p r o c es s . I n s t e ad , t h e wo r k i s d o ne by th i s s e r v i c e r o u t i n e a nd t h e p r o c e s s m a d e c om p u ta b l e b y r e po r t i ng a pag e r e a d c ompl e t i o n e v e n t to t h e s c h ed u l e r . Th e d e ta i l s tha t t h e s e r v i c e r o u t i n e t a k e s c a r e o f wh en a pag e read s uc c e s s f u l l y c ompl e te s i nc l ud e t h e f o l l o w i ng s teps fo r e a c h pag e . 1. Th e r e f e r en c e c o un t i s d e c r em e n ted , i nd i c a t i ng t h a t t h e i n p ro g r e s s h a s c o mp l e t ed . read 2. Th e phys i c a l pa g e s t a t e i s s e t to ac t i v e a nd v a l i d . 3. Th e va l i d b i t i n t h e pag e t a b l e e n t r y i s s e t . 4. I f t h e pag e i s a g l o ba l pag e , t h e v a l i d b i t s e t i n S t e p 3 wa s in the g l o ba l pag e t a b l e e n t r y . I n th i s c a s e , the p r o c e s s { s l a v e ) P T E m u s t b e l o a d ed w i t h t h e PFN a nd mad e v a l i d . Af t e r the i nd i v i d ua l pag e s h av e b e e n t e nd ed to , the sched u l e r is n o t i f i ed th a t a pag e r e a d h a s c om p l e ted { by r e po r t i ng a pag e f a u l t c om p l e t i o n e v e n t w i th a n u l l p r i o r i ty i nc r emen t ) s o th a t t h e p r o c e s s t h a t wa s p u t i n to a pag e f a u l t wa i t s ta t e wh e n t h e r e a d wa s i n i t i a t ed { I f a n y o f t h e pag e s j us t r e a d we r e c o l l i d ed c a n b e m a d e c om p u t a b l e . pag e s , t h e c o l l i d ed pag e wa i t q u e u e i s a l s o emp t i ed . Th a t i s , a l l p r o c e s s e s i n th a t s t a te a r e mad e c om p u t a b l e . C o l l i d ed pag e s a r e d i sc us s ed i n the n e x t s e c t i o n . ) 1 2- 2 4 PAG ING DYNAMI C S 12. 5. 2 Mod i f i ed Pag e Wr i t i ng Th e mod i f i ed pag e w r i te r a l so a t t em p t s to c l us t e r wh e n wr i t i ng mod i f i ed page s to the i r b ac k i ng s to r e a d d r e s s e s . Th e r e a r e n o t so many s pe c i a l c a s e s h e r e as t h e r e a r e i n t h e pag e r e ad s i t ua t i o n . Th e th r e e d i f f e r e n t c a s e s enco u n t e r ed b y the mod i f i ed pag e wr i t e r d e pend on the th r e e po s s i b l e b ac k i ng s to r e locat ions tha t pag e s on the mod i f i ed pa g e l i s t c a n have . 1 2 . 5 . 2 . 1 Ope r a t i on o f the Mod i f i ed Pag e Wr i te r - Th e mod i f i ed wr i te r p r o c e ed s i n a pp r o x i m a t e l y the f o l l o wi ng f a sh i o n . pag e 1. Th e f i r s t pag e i s r emoved f r om the mod i f i ed pag e l i s t . Its pag e t a b l e e n t r y ad d r e s s i s r e t r i ev ed f r om t h e PFN PTE a r r a y . 2. Ad j a c e n t pag e t a b l e e n t r i e s a r e s c anned ( f i r s t towa r d l o we r v i r t ua l add r esses a nd then towa r d h i g h e r v i r t ua l a d d r e s s e s ) l o o k i ng f o r t r a n s i t i o n pag e t ab l e e n t r i e s th a t m a p pag e s o n t h e mod i f i ed pag e l i s t un t i l e i th e r th e d e s i r ed c l us t e r s i z e i s r e a ch e d o r un t i l o n e o f t h e o th e r t e rm i n a t i ng cond i t i ons i s r e a ch e d . Th i s s c a n beg i n s f i r s t t o wa r d sma l l e r v i r t ua l add r e s s e s fo r the same r e a so n t h a t t h e r e a d c l u s t e r r o ut i n e b eg i n s towa rd l a rg e r a d d r e s s e s . I f t h e p r og r am i s mo r e l i ke l y to r e f e r e n c e t h e mo d i f i ed page wr i t e r d o e s n o t wa n t to h i gh e r add r e s ses , i n i t i a t e a wr i te o pe r a t i o n , o n l y to have the pag e i mmed i a t e l y f a ul ted { and l i k e l y m o d i f i ed ag a i n ) . Th e mod i f i ed pag e wr i t e r c ho o s e s to f i r s t wr i te tho s e pag e s w i th a sma l l e r l i k e l i ho o d o f b e i ng r e f e r e n c ed i n the n e a r f u t u r e . 3. Th e w r i te i s i n i t i a t ed , the s t a t e o f a l l of the pag e s is c h a ng e d to wr i t e i n p r og r e s s , a nd th e i r r e f e r e n c e c o un ts a r e i n c r em e n ted . 4. Th e mod i f i ed pag e wr i te r r e t u r ns to i t s c a l l e r un t i l n o t i f i ed by i ts spec i a l k e r n e l AST t h a t the mod i f i ed pag e wr i t e h a s c ompl e t ed . 1 2 . 5 . 2 . 2 Mod i f i ed Pag e Wr i t e C l u s t e r i ng - Th e t e rm i n a t i ng f o r t h e sc a n o f t h e pag e t ab l e i n c l ud e t h e f o l l o w i ng . • • • • c o nd i t i o n s th e r e Th e pag e ta b l e pag e i s n o t v a l i d . Th i s i mp l i e s t h a t Th e s p e c i a l a r e n o t r a n s i t i o n pag e s i n t h i s pag e ta b l e pag e . c h e c k i s mad e to a v o i d a n unn ec e s s a r y pag e f a u l t . Th e pag e t a b l e e n t r y d o e s n o t i nd i c a t e a t r a n s i t i o n f o rm a t . Th e pag e t a b l e e n t r y i nd i c a t e s a pag e i n t r a n s i t i o n , b u t phys i c a l pag e i s no t on the m od i f i ed pag e l i s t . the Th e phys i c a l page n um b e r i s g r e a t e r tha n the c o n t e n t s o f g l o ba l l o c a t i o n MMG $G L MAX PF N . Th i s c h e c k avo i d s pag e s i n s h a r ed memo r y , wh i c h h a ve n o PFN d a ta a s so c i a t ed w i th them . 1 2- 2 5 PAG ING DYNAM I C S • • • Th e SWPVBN a r r a y e l em e n t m u s t b e z e r o . Pag e s wi th non z e r o SWPVBN c o n t e n t s a r e t r e a ted i n a s pe c i a l wa y by th e mod i f i ed p a g e wr i te r . I f the c o n t e n t s o f t h e BAK a r r a y i nd i c a t e s t h a t th e b a c k i ng store l oc a t i on fo r t h e pag e i s a ( p r i v a t e o r g l o ba l ) i m ag e f i l e , t h e s e c t i o n i nd e x m u s t b e t h e same f o r a l l pag e s i n the c l us t e r . I f the BAK a r r ay e l em e n t i nd i c a t e s tha t th e pag e s a r e to be wr i tten to the pag e f i l e , t h e c o n t e n t s o f the v i r t ua l b l o c k n um b e r f i e l d a r e i g no r ed . Howe v e r , a l l pag e s m u s t c o n t a i n t h e s am e pag e f i l e i nd ex i n t h e i r BAK a r r a y e l em e n t s . 12. 5 . 2 . 3 Bac k i ng S t o r e Add r e s s e s fo r Mod i f i ed Pag e s Th e r e a r e th r e e d i f f e r e n t k i nd s o f b a c k i ng s to r e a d d r e s s tha t t h e mod i f i ed pag e wr i te r e nc o un t e r s a s the mod i f i e d pag e wr i t e r r em ov e s pag e s f r om th e mod i f i ed page l i s t . - • • • I f the SWPVB N a r r a y e l em e n t i s n o n z e r o , th i s i nd i c a t e s th a t the proces s i s o u t s wa pped a nd th i s pa g e r ema i n ed beh i nd , p r o ba b l y d u e to a n o u t s t a nd i ng r e ad r e que s t . Th e mod i f i e d p a g e wr i t e r d o e s n o t a t tempt to c l u s te r . I n s t e ad , a wr i t e o f a s i ng l e pag e t o t h e d e s i g n a t ed b l o c k i n th e swa p f i l e is i s s ue d . A d e sc r i pt i o n o f how t h e SWPVBN a r r a y e l em e n t c a n b e l o a d ed i s f o und i n C h a pte r 1 4 , wh e r e the e n t i r e o u t s wa p o pe r a t i o n i s d i s c u s s e d . I f the ba c k i ng s to r e a d d r e s s i s a s e c t i o n , t h e mod i f i ed pag e wr i t e r c r e a t e s a c l us t e r ( up to th e v a l ue o f t h e SYSBOOT p a r ame t e r M PW WRTC LUSTER ) . An y o f the t e rm i n a t i ng c o nd i t i o n s l i s t ed a b o v e w i l l l i m i t t h e s i z e o f t h e c l us t e r . I f the b a c k i ng s to r e a d d r e s s i s a pag e f i l e , ad j a c e n t pag e s b o und fo r t h e s ame pag e f i l e a r e a l s o wr i tten a t t h e same t i me . Th e mod i f i ed pag e wr i t e r a t tempts to a l l o c a te a n umbe r o f b l o c k s i n t h e pag e f i l e e q ua l t o M PW WRTC LUSTER . Th e d e s i r e d c l u s t e r f a c t o r i s r ed uc ed to the n umbe r o f b l o c k s a c t ua l l y a l l o c a ted . Th e a c t ua l c l u s t e r c r e a t ed fo r a wr i t e to the pag e file c o n s i s t s o f s e v e r a l sm a l l e r c l u s t e r s , e a ch o n e r e p r e s e n t i ng a s e r i e s o f v i r t ua l l y c o n t i g uo u s pag e s ( F i g u r e 1 2 -8 ) . 1. Th e mod i f i ed pag e wr i t e r c r e a t e s a c l u s t e r o f v i r t ua l l y c o n t i g uo u s pag e s , a l l bound f o r th e s ame pag e f i l e . 2. I f t h e d e s i r ed c l u s t e r s i z e h a s n o t ye t b e e n r e a c h ed , the mod i f i ed pa g e l i st is s e a r c hed u n t i l ano th e r ph ys i c a l pag e b o und fo r the s ame pag e f i l e i s fo und . 3. Pag e s v i r t ua l l y c o n t i g uo u s to th i s pag e fo rm the sec o nd m i n i c l us ter that i s a d d ed to the e v e n tua l c l us t e r to be wr i t t e n to the pag e f i l e . 1 2-26 PAG I NG DYNAM I C S 4. Th i s p r o c e s s c o n t i n ue s un t i l e i th e r t h e c l us t e r s i ze is r e a ch e d o r n o m o r e pag e s o n the mod i f i ed pag e l i s t h a v e the d e s i g na t e d pag e f i l e a s the i r b a c k i ng s t o r e a d d r e s s . Th e mod i f i ed pag e wr i t e r i s b u i l d i ng a l a rg e c l u s t e r th a t c o n s i s t s o f a s e r i e s o f s ma l l e r c l u s te r s . Th e l a rg e c l u s t e r o n l y t e rm i n a t e s wh e n t h e d e s i r ed s i ze is r eached or the mod i f i ed page l i s t c o n t a i n s n o mo r e pag e s b o un d to th e pag e f i l e i n qu e s t i o n . E a c h sma l l e r c l us t e r c a n te rm i n a t e o n a n y of t h e c o nd i t i o n s l i s te d a b o v e , o r o n t h e two t e rm i n a t i ng c o nd i t i o n s f o r the l a rg e c l us t e r . Modified Page List SWP$GL_BALBASE : : (Balance Slot Area) I BAK PTE I pgflx gptx PFN D A pgflx B gstx c pgflx D pgflx E pgflx F pgflx G pgflx H pgflx correct pgflx but cluster is full pgflx . . . transition PTE ( free list) 0 PFN H 0 PFN F 0 PFN A MPW$AL_PTE : : (Modified Page Writer's Map) 1 PFN H 1 PFN F PFN A 0 PFN E PFN E PFN ( valid) PFN G process section table Index 0 PFN G 0 PFN B PFN B PFN J PFN D 0 PFN J demand zero PTE Figure 1 2-8 E x amp l e o f C l u s te r e d Wr i t e to a Pag e F i l e 1 2-2 7 J ::J PAG ING DYNAM I C S 12 . 5 . 2 . 4 E x amp l e o f Mod i f i ed Pag e W r i te to a P a g e F i l e - F i g u r e 1 2-8 i l l u s t r a t e s a sampl e c l u s t e r f o r wr i t i ng to a pag e f i l e . Th e mod i f i ed pa g e l i s t ( p i c t u r ed i n t h e uppe r r i g h t h a nd o f t h e f i g u r e } i s s h o wn a s a s e que n t i a l a r r a y t o s i mpl i f y the f i g u r e . 1. Th e f i r s t pag e o n t h e mo d i f i ed pag e l i st is PFN A . By s c a n n i ng b a c kwa r d s , f i r s t P FN F a nd then PFN H a r e l o c a t ed . Th e PTE p r e c e d i ng the o n e th a t c o n ta i n s PFN H i s a l so a trans i t i on PTE b u t the pag e i s o n t h e f r e e pag e l i s t . Th i s pag e t e rm i n a t e s t h e b a c kwa r d s e a r c h . 2. Th e mod i f i ed pag e wr i t e r m� p b eg i n s wi th PFN H , PFN F , and PFN A. Th e s e a rch n o w g o e s i n t h e f o rwa r d d i r e c t i o n , w i th e a c h p a g e b o und f o r the pag e f i l e ad d ed to the map up t o a nd i n c l ud i ng P FN E . Th e n e x t pag e t ab l e e n t r y i s v a l i d so t h e f i r s t m i n i c l u s t e r i s t e rm i n a t ed . 3. Th e nex t pag e o n the m o d i f i ed pag e l i s t , PFN B , l e a d s to the a d d i t i o n o f a s e c o nd c l u s t e r to the ma p . Th i s c l u s t e r b eg i n s Th e b a c kwa r d s e a r c h wa s w i th P F N G a nd e nd s w i th P F N J . t e rm i n a ted wi th a PT E c o n t a i n i ng a s e c t i o n t ab l e i nd ex . Th e f o rwa r d s e a r c h t e rm i n a t e d w i th a d emand z e r o PTE . No te th a t t h i s s e c o nd c l u s t e r c o n s i s t s o f pag e s b e l o ng i ng to a d i f fe r ent proc e s s f r om th e f i r s t c l us te r . Th i s is r e f l ec t e d i n th e wo r d a r r a y e l em e n t fo r e a c h PTE i n the m a p that conta i ns a process h e a d e r vec to r i nd ex f o r e a c h pag e ( Figure 1 1 - 2 4 } . 4. Th e nex t pag e o n the m od i f i ed pag e l i s t i s PFN c . Th i s pag e b e l ongs i n a g l o b a l i m a g e f i l e a nd i s s k i pped ove r d u r i ng the c u r r e n t wr i t e a t t em p t . 5. PFN D l e a d s to a th i r d c l u s t e r th a t wa s t e rm i n a t e d i n the b a c kwa r d d i r e c t i o n w i th a pag e t a b l e e n t r y th a t c o n t a i n s a g l o b a l pag e ta b l e i nd ex . Th e s e a r c h i n the fo r wa r d d i r e c t i o n t e rm i n a ted wh e n the d e s i r ed c l u s t e r s i z e wa s r e a c h e d , even t h o ug h the next P T E wa s b o und to the same pag e file . Th i s s i ze is e i th e r M PW WRTC LUSTER o r a n um b e r o f v i r t ua l l y c o n t i g uo u s b l o c k s a v aTl a b l e i n the pag e file , wh i c h ev e r 1s sm a l l e r . In any c a s e , th i s c l us te r wi l l b e wr i t t e n wi th a s i ng l e wr i t e r e que s t . 6. No t e th a t r e a ch i ng th e d e s i r ed s i z e r e s u l ted i n l e a v i ng some pag e s o n the mod i f i ed pa g e l i s t b o und f o r the same pag e f i l e , s uc h a s PFN I i n the f i g u r e . 1 2 . 5 . 2 . 5 Mod i f i ed Pag e W r i te C ompl e t i on - The mod i f i ed pag e wr i t e r i s n o t i f i ed th a t the wr i te i s c ompl e t e by a s pe c i a l k e rne l AST ( wh o s e ad d r e s s wa s s to r ed i n t h e ASTPRM f i e l d o f t h e I R P wh i l e th e wr i t e wa s i n p r og r e s s ) . Mo d i f i ed pag e wr i t i ng i s r e co rd ed i n the I R P a s a s wa p wr i te t o a l l o w th i s c ompl e t i o n m e tho d t o b e used . Fo r the p u r po s e s o f the I / 0 po s t p r o c e s s i ng r o u t i n e , t h e o n l y f o rm o f pag e wr i t e r e q u e s t i s t h e o n e i s s ue d by th e Upd a t e S e c t i o n s ys tem s e rv i c e . Th i s k e r n e l AST d e c r em e n t s v a r i o u s r e f e r e n c e c o un t s tha t wr i t e in p r og r e s s . I f the r e f e r e n c e c o u n t i s n o w z e r o , pl a c ed o n the f r e e pag e l i s t . I f the n um b e r o f pag e s o n pa g e l i st ( S C H $G L_MFYCNT ) i s s t i l l a b o v e the l o w l i m i t 1 2-28 i nd i c a ted the th e pag e s a r e the mod i f i ed th r e sho l d fo r PAG I NG DYNAM I C S t h e mod i f i ed pag e l ist ( S C H $ G L MFY L O L IM ) , t h e n t h e mod i f i ed pag e wr i te r r em o v e s t h e n ew f i r s t- pag e f r om t h e mod i f i ed pag e l i s t a nd s ta r ts a l l ove r . 12. 5.3 Upd a t e S e c t i o n Sy s t em Se r v i c e Th e Upd a t e S e c t i o n s ys t em s e r v i c e a l l o ws a p r o c e s s t o wr i t e pag e s i n a s ec t i o n to th e i r b a c k i ng s to r e a d d r e s s e s i n a c o n t r o l l ed f a sh i o n , w i tho ut wa i t i ng f o r the mod i f i ed pag e wr i te r to d o the b a c k u p . Th i s s y s tem s e rv i c e i s e spec i a l l y u s e f u l f o r f r e que n t l y a c c e s sed pag e s th a t m a y n ev e r b e wr i t t e n b y t h e m od i f i ed p a g e wr i t e r , b e c a us e they a r e a l wa ys b e i ng f a ul t ed f r om the mod i f i ed pag e l i s t b a c k i n to the wo r k i ng s e t b e f o r e t h e y a r e b a c ked up . Th i s sys tem s e rv i c e i s a c r o s s b e twe e n mod i f i ed pag e wr i t i ng a nd a n o rm a l wr i t e r eq ue s t . L i ke a n y Que u e d I / 0 r e que s t , th i s s e r v i c e c a n r ec e i v e c omp l e t i o n no t i f i c a t i o n w i th a n e v e n t f l ag , a n A S T , o r th r o ug h an I /O s t a t us b l oc k . Th e n um b e r o f pag e s wr i t t e n i s spec i f i ed by t h e a d d r e s s r a ng e pa s s ed a s an i np u t pa r am e t e r to the serv i ce . Th e c l us te r f a c to r i s t h e m i n imum o f M PW WRTC LUSTER a nd th e n um b e r o f pag e s i n t h e i n put r a ng e . Th e d i r ec t i o n o f s e a r c h fo r mod i f i ed pag e s is d e t e rm i n ed b y t h e o rd e r tha t t h e a d d r e s s r a ng e i s spec i f i e d t o the s e rv i c e . 12. 5. 3. 1 Page S e l e c t i o n - I f th e s e c t i o n th a t i s b e i ng b a c k e d up i s a process pr i va te s e c t i o n , o n l y tho s e pag e s tha t h a v e the mod i f i ed b i t s e t i n the pag e t a b l e e n t r y ( o r i n the PFN s t a t e a r r a y f o r t r a n s i t i o n pag e s ) a r e w r i t t e n o u t . I f the s e c t i o n i s a g l o b a l s e c t i o n , then i n f o rm a t i o n a bo ut wh e th e r the pag e i s mod i f i ed i s f o und i n b o th the PFN d a t a base a nd the pag e t a b l e ( Th e mod i f y b i t e n t r i e s o f a l l p r o c e s s e s m a pped t o th i s g l ob a l pag e . in the g l o b a l pag e t ab l e entry is i n a c c e s s i b l e t o h a r d wa r e a nd c o n t a i n s no u s e f u l i n f o rm a t i o n . ) B e c a u s e t h e r e a r e no b a c k po i n t e r s f o r va l i d g l o b a l pag e s , th i s i n f o rma t i o n i s un a v a i l a b l e . Th e r e fo r e , a l l pag e s i n a g l o b a l s e c t i o n a r e wr i t t e n to th e i r b ac k i ng s to r e l o c a t i o n , r eg a r d l e s s o f wh e th e r t h e pag e s h a v e b e e n mod i f i e d . I f the f l ag s pa r a m e t e r p a s s e d to Upd a t e S e c t i o n h a s i t s l ow b i t set , th i s i nd i c a t e s that the caller is the o n l y p r o c e s s c a pa b l e o f mod i f y i ng t h e s ec t i o n . I n th a t c a s e , t h e p r o c e s s pag e tab l e entr i es ( a nd th e PFN d a t a b a s e ) a r e u s e d to s e l e c t c a nd i d a t e pag e s fo r b a c k i ng On l y mod i f i ed pag e s a r e wr i t t e n . up . 1 2 . 5 . 3 . 2 Wr i t e Compl e t i o n - Th e proc e s s tha t i s s ued the Upd a t e Se c t i o n s ys t em s e r v i c e i s f i r s t n o t i f i ed a bo u t wr i t e compl e t i o n wi th a s pe c i a l k e r n e l AS T . Th i s AST f i r s t c h e c k s wh e th e r all the pag e s r e que s t ed b y t h e o r i g i n a l c a l l h a v e b e e n wr i t t e n o r wh e th e r a n o th e r wr i t e i s r eq u i r ed . I f mo r e pag e s h a v e t o b e wr i t t e n , a no the r c l us te r is s e t u p a nd q u e ued . I f a l l r e que s t ed pag e s h a v e b e e n wr i t t e n , the n o rma l I /0 c omp l e t i o n pa th i nvo l v i ng event f l ag s , I /0 s t a t u s b l o c k s , a nd u s e r - r e q ue s ted ASTs i s e n t e r e d a nd th e p r o c e s s no t i f i ed . 1 2-29 PAG I NG DYNAM I C S 12. 6 PAG ING AND SCHEDUL ING Pag e f a u l t h a nd l i ng c a n i n f l ue n c e the s c h ed u l i ng s t a t e o f p r o c e s s e s i n s ev e r a l d i f f e r e n t wa ys . If a r ead i s r eq u i r ed to sa t i s f y a pag e f a u l t , t h e f a u l t i ng p r o c e s s i s p l aced i n to a pag e f a u l t wa i t s ta t e . If a r e so u r c e s uc h a s phys i c a l m emo r y o r pag e f i l e s pa c e i s n o t av a i l a b l e , t h e p r o c e s s i s p l a c ed i n to a n a pp r o p r i a t e wa i t state . Th e r e are s ev e r a l wa i t s ta t e s tha t a p r o c e s s m a y b e p l a c ed i n to a s a r e s u l t o f a pag e f a u l t . 12. 6. 1 P a g e Fa u l t Wa i t S t a t e Th e m o s t o bv i o u s wa i t s ta t e is pag e f a u l t wa i t ( PFW ) , wh i c h is r e q u i r ed i f a r e a d i s r eq u i r ed to r e so l v e t h e fa u l t . Th e p r o c e s s t ha t r eq u i r e s the r e a d to r e so l v e i t s pag e f a u l t i s p l a c ed i n to a pag e f a u l t wa i t s ta t e . Th e I /O c ompl e t i o n r o u t i n e d e te c t s t h a t a pag e r e a d h a s c ompl e t ed a nd r e po r t s a pag e f a ul t c om p l e t i o n ev e n t t o the s c h ed ul e r . Th e s c h ed u l e r r em o v e s the p r o c e s s f r om t h e pag e f a u l t wa i t s t a t e a nd m a k e s i t c om p u ta b l e . Th e r e i s n o p r i o r i t y i nc r e m e n t d ue to pag e f a u l t r e ad c om p l e t i o n so the s c h ed u l i ng d e c i s i o n i s m a d e b a s e d o n t h e p r o c e s s ' s c u r r en t pr i o r i ty . 12. 6. 2 F r e e Pag e Wa i t S t a t e I f the r e i s n o t e n o ug h phys i c a l m emo r y a v a i l a b l e t o s a t i s f y the faul t , t h e p r o c e s s i s p l a c ed i n to a f r e e pag e wa i t s t a t e ( FPG ) . phys i c a l pag e m a n ag e r ( mod u l e A L LOCPFN ) c h e c k s f o r p r o c e s s e s in s ta t e wh e ne v e r pag e s a r e a d d e d to a n empty l i s t . I f the f r e e wa i t s t a t e is not empty , all processes in the state a re c om p u t a b l e . pag e Th e th i s pag e mad e Th e phys i c a l pag e ma n ag e r m a k e s n o s c h ed u l i ng d e c i s i o n a b o u t wh i c h p r o c e s s w i l l g e t the pa g e . Th e r e i s n o f i r s t- i n f i r s t- o ut a pp r o ach to the f r e e pag e wa i t s t a t e . Ra t h e r , a l l p r o c e s s e s wa i t i ng fo r the pag e a r e mad e c om p u t a b l e . Th e n e x t p r o c e s s to e x e c u t e wi l l be cho s e n b y t h e sched ul e r , u s i ng t h e n o rma l a l g o r i thm th a t t h e h i g h e s t p r i o r i t y r e s i d e n t c omputa b l e p r o c e s s e x e c u t e s n ex t . 12. 6 . 3 C o l l i d ed P a g e Wa i t S t a t e I t i s po s s i b l e fo r a pag e f a u l t t o o c c u r f o r a pag e wh i c h is al ready b e i ng r e ad f r om d i s k . S u c h a pag e i s r e f e r r ed to a s a c o l l i d ed pag e . Th e c o l l i d ed b i t ( i n the PFN TYPE a r r a y ) i s s e t a nd t h e pr o c e s s p l ac ed i n to the c o l l i d ed pag e ( C O L PG ) wa i t s t a t e . One o f t h e d e ta i l s th a t th e pag e r e ad c ompl e t i o n r o u t i n e ch e c k s i s t h e c o l l i d ed b i t i n th e TYPE a r r a y e l em e n t fo r t h e pag e . I f the c o l l i d ed b i t i s s e t , the c o l l i d ed pag e wa i t s t a t e i s empt i ed . Th e r e i s no chec k fo r the pag e tha t i s b e i ng wa i t ed f o r by each p r o c e s s as i t i s mad e c omput ab l e . 1 2-30 PAG ING DYNAM I C S Th i s l a c k o f c h e c k h a s two a d v a n ta g e s . • • 12. 6.4 As wa s t h e c a s e fo r f r ee pag e av a i l a b i l i t y , the r e is no s pe c i a l code t o d e t e rm i n e wh i ch pr o c e s s w i l l g e t th e pag e f i rst . Al l p r o c e s s e s a r e m a d e c ompu t a b l e and the n o rm a l s c h e d u l i ng a l g o r i thm s e l e c t s t h e p r o c e s s th a t e x e c u t e s n e x t . Th e p r o b a b i l i t y o f a c o l l i d ed pag e i s sm a l l . Th e p r o b a b i l i t y of two d i f f e r e n t c o l l i d ed pag e s is e v e n sm a l l e r . If a p r o c e s s wa i t i ng fo r ano th e r c o l l i d ed pa g e is s e l e c ted for e x e c ut i o n , th a t p r o c e s s wi l l i n c u r a pag e f a u l t a nd g e t put r i g h t b a c k i n to t h e c o l l i d ed wa i t s t a t e . No th i ng un u s ua l occ u r s and VM S a v o i d s a l o t o f s pe c i a l c a s e c o d e to h a nd l e a s i t ua t i o n th a t r a r e l y i f ev e r o c c u r s . No Ava i l a b l e S pa c e i n the Pag e F i l e Wh e n a n e n t r y f o r a c o py-on- r e f e r e nc e pag e o r a d emand ze ro pa g e is mad e in t h e wo r k i ng s e t , a pa g e m u s t b e r e s e rved i n the pag e f i l e . { Th e a c tua l a l l o c a t i o n o f a s p e c i f i c b l o c k d o e s n o t o c c u r un t i l the m o d i f i ed pa g e wr i t e r b a c k s t h e pag e up . ) If th e r e is no r o om in the pag e f i l e , t h e p r o c e s s i s p l a c ed i n to a r e s o u r c e wa i t s tate { MWA I T ) . Th e pa r t i c u l a r r e s o u r c e b e i ng wa i t ed fo r i s pag e file s pa c e { RS N $_PG F I L E ) . As v i r t ua l a d d r e s s s pa c e i s d e l e t e d { by spec i f i c r e que s t o r a s a side e f fe c t o f i mag e ex i t o r p r o c e s s d e l e t i o n ) , pag e f i l e s pa c e b e c o m e s ava i l ab l e . Th e pa g e f i l e d e a l l o c a t i o n r o u t i n e c h e c k s f o r t rans i t ions f r om th e empty s t a t e a nd no t i f i e s t h e s c h ed u l e r tha t t h e r e so u r c e o f pag e f i l e s pa c e i s n o w a v a i l a b l e . Th e s c h e d u l e r { s p e c i f i c a l l y r o u t i n e S C H $ RAVA I L ) d e t e rm i n e s wh e th e r a ny p r o c e s s e s a r e wa i t i ng fo r th i s r e so u r c e a nd ma k e s them compu t a b l e ag a i n . 1 2-3 1 CHAPTER 1 3 MEMORY MANAG EMENT SYSTEM S ERVI C E S Th e p r ev i o u s two c h a p t e r s d e sc r i b ed t h e d a t a s t r uc t u r e s used by the m em o r y m a nag em e n t s ub s ys t em to d e sc r i b e ph ys i c a l and v i r t ua l memo r y , a nd t h e a c t i o n o f t h e pag e f a u l t h a nd l e r wh e n a pag e wa s r e f e r e n c e d i n wh i c h the v a l i d b i t wa s n o t s e t . Th i s c h a p t e r d e s c r i b e s t h e sys t e m s e r v i c e s a v a i l a b l e to the u s e r ( a n d a l so u s e d i n t e r n a l l y b y VM S ) th a t a l l o c a t e t h e s e s t r uc t u r e s a nd i n i t i a l i z e t h e i r c o n t e n t s . Th e s e r v i c e s a r e d i v i d ed i n to f o u r s e pa r a t e c a t eg o r i e s . 13. 1 1. Some s y s tem s e r v i c e s a r e a s s o c i a t ed spe c i f i c a l l y w i th the l a yo u t o f v i r t u a l ad d r e s s s pa c e . V i r t ua l a d d r e s s s pa c e c a n b e c r e a t ed o r d e l e t ed a l m o s t a t wi l l wi th i n the l im i ta t i on s i mpo s ed b y p r o c e s s quo t a s a nd l i m i t s a nd the c o n s t r a i n t s o f the S Y S B OOT pa r am e t e r s set up wh e n the sys tem wa s i n i t i a l i zed . 2. P r i v a t e and g l o b a l s e c t i o n s c a n b e c r e a t ed th a t a l low the blocks of a file to b e m a pped a s a po r t i o n o f a p r o c e s s add ress spac e . Al th o ug h t h e sec t i o n s e rv i c e s are a l so a s s o c i a t ed w i th t h e l a yo u t o f v i r t ua l a d d r e s s s pa c e , t h e y a r e t r e a t ed i n a s e pa r a t e s e c t i o n b e c a u s e o f the i r a d d e d l ev e l o f c om p l e x i t y . 3. S y s t em s e rv i c e s a l l o w u s e r s t o l o c k po r t i o n s o f the i r wo r k i ng sets i n to m emo r y , a v o i d i ng the o v e r h e a d o f pag e f a u l t s o r a l l ow i ng po r t i o n s o f c o d e to e x e c u t e a t e l ev a ted ! PL . A p r o c e s s c a n a l so d i sa b l e s wa pp i ng , p r eve n t i ng i t s e l f f r om b e i ng r emoved f r om memo r y . 4. Th e r e a r e o th e r m i s c e l l a n e o us o pe r a t i o n s a s s o c i a t e d w i th the m em o r y m a n a g em e n t a v a i l a b l e to a p r o c e s s s u c h a s f o r c i ng t h e c o n t e n t s o f a l l mod i f i ed pag e s to b e wr i t t e n to the i r b a c k i ng s t o r e ad d r e s s e s ( Upd a t e S e c t i o n s ys t e m se r v i c e ) o r p u r g i ng s o m e o r a l l p ag e s f r om th e p r o c e s s wo r k i ng s e t . D I S PATCH METHOD FOR MEMORY MANAG EMENT SYSTEM S E RV I C E S A l mo s t a l l o f t h e m em o r y m a n ag em e n t s y s tem s e rv i c e s spe c i f y a d e s i r ed address r a ng e as an i n put p a r am e t e r . Th e pag e tabl e en t r i e s a s s o c i a t ed w i th t h e s e a d d r e s s e s c o n t a i n a n o wn e r f i e l d ( Fi g u r e 1 1 -3 ) , i nd i c a t i ng wh e th e r t h e c a l l e r o f e a c h s e r v i c e c an m a n i p u l a te t h e pag e s i n t h e d e s i r ed f a sh i o n . An o th e r p e c u l i a r i t y o f t h e m em o r y m a n ag em e n t s ys tem s e rv i c e s is t h a t m a n y o f t h e s e r v i c e s c a n pa r t i a l l y s u c c e e d ( b e c a u s e th e y a r e d o n e o n a pag e- by-p a g e b a s i s ) . Th i s p a r t i a l s uc c e s s is i nd i c a t e d b y r e t u r n i ng an e r r o r code c om b i n ed w i th t h e a d d r e s s 13-1 MEMORY MANAG EMENT S YS TEM S E RV I C E S r a ng e over p a r am e t e r ) . wh i c h the o pe r a t i o n wa s c ompl e t ed ( in A c ommo n d i s pa t c h m e th o d i s used by m o s t o f t h e memo r y s ys t em s e r v i c e s t o r e f l e c t the s i m i l a r i ty o f t h e se r v i c e s . • • 13.2 the RE TADR m a n ag emen t I n fo rma t i o n a bo u t t h e s p e c i f i c s e rv i c e , i nc l ud i ng the i nput pa r ame t e r s , i s pl a c ed on t h e s t a c k f o r l a t e r r e t r i e v a l . Pag e own e r s h i p i s c h e c k e d to i n s u r e t h a t a l e s s p r i v i l eg ed a c c e s s mod e i s n o t a t tem p t i ng t o a l t e r t h e p r o pe r t i e s o f s o m e pag e s o wn e d b y a m o r e pr i v i l eg e d a c c e s s mo d e . • Th e a d d r e s s o f a pag e - by-pa g e r o u t i ne to a c compl i s h the d e s i r e d a c t i o n o f t h e o r i g i n a l s e rv i c e i s pl a c ed i n t o R6 . • A c ommon rout ine i s c a l l ed th a t pe r fo rms g e n e r a l pag e p r o c e s s i ng a n d c a l l s the s i ng l e pag e s e r v i c e - s p e c i f i c r o u t i n e f o r e a c h pag e i n t h e d e s i r ed r a ng e . • Th e a d d r e s s r a ng e a c t ua l l y o pe r a ted on c a l l e r ( i f r e q u e s t ed ) . is r e t u rned to the VI RTUAL ADDRESS C REAT I ON AND D E L E T I ON Th e f i r s t l ev e l o f m em o r y m a n ag em e n t a v a i l a b l e to a process is the c rea t ion or d el et ion of v i r t ua l a d d r e s s s pa c e . Th e s e s e r v i c e s a r e a l s o u s ed by t h e s ys t em wh e n a n i m ag e f i r s t b eg i n s e x e c u t i ng ( th e imag e a c t i v a to r cal l s seve ral se rv i ces to c r e a t e p r o c e s s add r e s s s pa c e ) a n d a s pa r t o f i m a g e e x i t ( t h e i m ag e r e se t r o u t i n e d e l e t e s all of P O s pa c e a nd a sm a l l pa r t o f P l s p a c e ) . Th e memo r y m a n a g em e n t pe r f o rmed b y t h e s ys tem a s pa r t of imag e a c t ivation or process d e l e t i o n i s d e sc r i b ed i n Ch a pt e r 1 8 . 13. 2. 1 Ad d r e s s Sp a c e C r e a t i o n Ad d r e s s s pa c e c r e a t i o n i s e s s e n t i a l l y a s i m p l e o p e r a t i o n . A series of d em a nd ze r o pag e s a r e c r ea t ed , e i th e r a t the end o f the d e s i g n a t ed a d d r e s s s pa c e ( E x p a nd Reg i o n ) or in the spe c i f i e d add ress r a ng e ( C r e a t e Vi r t ua l Ad d r e s s Spa c e ) . I f a ny p a g e s a l r e a d y e x i s t i n the r e que s ted r a n g e , they m u s t be d e l e t ed f i r s t . Th e s e two sys tem s e rv i c e s c a n pa r t i a l l y s uc c e e d . Th a t i s , a n umbe r o f pag e s sm a l l e r than o r i g i na l ly r e que s t ed m a y b e c r e a ted . Onc e the s pe c i f i ed a d d r e s s r a ng e is d e te r m i n ed , t h e d em a nd zero pag e s are c r e a ted o n e a t a t i m e . I t i s po s s i b l e t o r un i n to o n e o f the l i m i t s o n t h e n um b e r o f pag e s th a t c a n b e c r e a ted a f t e r s ev e r a l pag es h a v e a l r e a d y b e en s uc c e s s f u l l y c r e a t ed . Fo r th i s r e a s o n , i t i s e s pec i a l l y i m po r t a n t f o r t h e c a l l e r o f e i t he r $ C R E TVA o r $ E X PREG to l o o k a t the RETADR a r g um e n t to d e t e rm i n e wh e th e r the s e r v i c e ( $ CRETVA or $ E XPREG ) wa s pa r t i a l l y s uc c e s s f u l . 1 3 -2 MEMORY MANAG EMENT SYSTEM S ERVI C E S 13.2.1.1 L i m i t s o n Vi r t ua l Ad d r e s s Spa c e C r e a t i o n - Th e r e a r e t h r e e l im i t a t i o n s o n the amo u n t o f v i r tu a l add ress s pa c e tha t c a n be c r ea t e d . e • Th e S Y S B OOT p a r am e t e r V I RTUA L PAG E CNT c o n t r o l s the total n um b e r o f pag e t a b l e e n t r i e s ( P O PTEs p l u s P l PTE s ) th a t a n y p r o c e s s c a n have i n i ts p r o c e s s h e a d e r . Th e d i v i s i o n o f t h e s e p a g e s b e twe e n PO s p a c e a nd Pl s pa c e is to t a l l y I t i s o n l y t h e s um o f PO a nd a r b i t r a r y a nd p r o c e s s s pe c i f i c . P l p a g e s t h a t i s l i m i t ed b y t h e SYS B O OT p a r am e t e r . ) Th e s i ze o f a p r o c e s s wo r k i ng s e t a l s o c o n t r o l s t h e s i ze of tha t p r o c e s s ' s a d d r e s s s pa c e . Wh e n a p r o c e s s p a g e i s �q l i d , t h e pag e t a b l e pag e f o r th a t pag e i s no t o n l y v a l i d b u t a l so d yn am i c a l l y l o c k e d i n to the wo r k i ng s e t . Fo r sm a l l a d d r e s s s pa c e s , t h e s e t o f v a l i d p r o c e s s pag e s c a n b e r e p r e s e n t e d b y a sm a l l n um b e r o f pag e t a b l e pag e s . As t h e a d d r e s s s pa c e g r ows , t h e p r o ba b i l i ty tha t a g i v e n pag e t a b l e p a g e m a ps m o r e t h a n o n e v a l i d p r o c e s s pag e d e c r e a s e s . ( Th e l i m i t i ng c a s e , o n e t h a t c a n u s ua l l y be r e a c h e d o n l y w i th v e r y l a rg e p r o c e s s ad d r e s s s pa c e s , r e qu i r e s two wo r k i ng s e t l i s t e n t r i e s f o r e a c h v a l i d p r o c e s s pag e . ) I n a n y c a s e , t h e r e is a n i mp l i c i t l i m i t t o the p r o c e s s a d d r e s s spa c e i m po s e d b y t h e p r o c e s s wo r k i ng s e t quo t a s . Th e s p e c i f i c c h ec k t h a t i s m a d e i s wh e th e r the s i ze of the d yn am i c wo r k i ng set l i s t c a n l o c k a l l t h e pa g e t a b l e pag e s n e c e s s a r y t o m a p t h e p r o c e s s a d d r e s s spa c e a nd stil l l eave e no ug h f l u i d wo r k i ng s e t ( PH D $W F LU I D ) to a l l o w t h e p r o c e s s t o pe r fo rm u s e f u l wo r k . I f th i s ch e c k f a i l s , t h e wo r k i ng s e t l ist is e x pa nd ed . I f t h e wo r k i ng s e t i s a t i t s l i m i t , t h e v i r t ua l ad d r e s s c r e a t i o n fa ils wi th the sta tus of S S $ I N S FWS L . • Th e th i r d c o n s t r a i n t o n t h e to t a l s i z e o f t h e p r o c e s s a d d r e s s space is t h e pag i ng f i l e q uo t a . E a c h d em a nd ze r o pag e a n d e a c h c o py-on- r e f e r e n c e s e c t i o n pag e i s c h a r g ed ag a i n s t the j o b ' s pag i ng f i l e q u o ta ( J I B $ L_PG F LCNT ) . 1 3 . 2 . 1 . 2 E x pa nd Reg i o n Sys t em S e r v i c e - Th e Ex pand Reg i o n s y s t em s e rv i c e is a spec i a l c a s e o f the C r e a t e Vi r t ua l Ad d r e s s S p a c e sys t em se rv i c e . Th e r e que s t ed n um b e r o f pag e s i s s i mpl y c o nv e r ted i n to a PO o r P l pag e r a ng e a nd c o n t r o l i s p a s sed t o a pag e c r e a t i o n r o u t i n e th a t i s c ommo n b e twe e n the two s e r v i c e s . 1 3 . 2 . 1 . 3 Au toma t i c Us e r S t a c k E x p a n s i o n - A s p e c i a l fo rm o f P l s pa c e e x pa n s i o n o c c u r s wh e n a r e q ue s t fo r u s e r s t a c k s pa c e e x c e e d s t h e r em a i n i ng s i z e o f the u s e r s t a c k . S u c h a r e que s t c a n b e r e po r t e d by t h e h a r d wa r e as an a c c e s s v i o l a t i o n e x c e pt i o n , o r by s o f twa r e wh e n i n s u f f i c i e n t use r s t a c k s pa c e i s d e t e c ted . ( S o f twa r e d e t e c t i o n is d o ne b y t h e AS T d e l i v e r y r o u t i n e a nd the Ad j u s t S t a c k s ys tem se r v i c e i f t h e r e q ue s t i s fo r u s e r m o d e s t ac k s pa c e ) . Th e r o u t i n e E XE $ E XPANDS TK i s c a l l ed d i r e c t l y by the two s o f t wa r e r o u t i n e s a nd i nv o k e d b y t h e Ac c e s s Vi o l a t i o n e x c e p t i o n hand l e r i f t h e access v i o l a t i on occur red i n user mode . Th i s r o u t i n e c h e c k s th a t a 1 3- 3 MEMORY MANAG EMENT SYS TEM S ERVI C E S l e ng t h v i o l a t i o n ( a s o pp o s e d to a p r o t e c t i o n v i o l a t i o n ) o c c u r r ed a n d t h a t the i n a c c e s s i b l e a d d r e s s i s i n P l s p a c e . If so , Pl space is e x pa nd e d f r om i ts c u r r en t l ow a d d r e s s e nd to the spec i f i ed i n ac c e s s i b l e a d d r e s s . Fo r t h e u s u a l c a s e , one i n wh i c h a p r o g r am r e qu i r e s m o r e use r s t a c k s pa c e than r e q ue s t e d a t l i n k t ime , the e x pa n s i o n typ i c a l l y o c c u r s o n e pag e a t a t i m e . Because t h i s a u toma t i c e x pa n s i o n c a nno t be d i s a b l ed on a p r o c e s s - spec i f i c o r s ys t em-wi d e b a s i s , a r un a wa y p r o g r am ( o n e tha t i s u s i ng s t a c k s pa c e w i tho u t r e t u r n i ng i t ) wi l l no t b e a b o r t e d un t i l it exceeds t h e v i r t ua l add ress s i z e d e t e rm i n ed by t h e VI RTUA L PAG E CNT S Y S B O O T p a r am e t e r ( wh i c h i s i nd i c a t ed by $ C R E TVA r e t u r n i ng an e r ro r s t a t u s o f S S $ VAS F U L L ) . I n a d d i t i o n , a p r og r am th a t m a k e s a r a nd om ( a nd p r o b a b l y i nc o r r e c t ) r e f e r e n c e to an a r b i t r a r y P l a d d r e s s sm a l l e r than the t o p o f t h e u s e r s t a c k w i l l p r o ba b l y c o n t i n u e t o e x e c u t e ( a f t e r t h e c r ea t i o n o f m a n y d em a nd z e r o pag e s ) r a th e r than e x i t i ng w i th some e r r o r s t a t us . I f t h e s ta c k e x pa n s i o n f a i l s f o r wh a te v e r r e a s o n ( th e C r e a t e Vi r t ua l Ad d r e s s s ys tem s e rv i c e c a n f a i l fo r s ev e r a l r e a so n s ) , t h e p r o c e s s i s n o t i f i e d i n a wa y t h a t d e p e nd s o n wh o o r i g i n a l l y c a l l ed E XE $ E XPAND S TK . • • • 13. 2. 2 Th e Ad j u s t S t a c k s ys t em s e rv i c e f o r u s e r m o d e c a n s ev e r a l o f the e r r o r c o d e s r e t u r n ed by $ C RETVA . fa i l w i th An a t t empt to d e l i v e r a n A S T to a p r o c e s s w i th i nsuff i c i ent user stack s pa c e r esul ts i n a n AS T d e l i v e r y s t a c k f a u l t e x c e pt i o n b e i ng r e po r t e d to the p r o c e s s . ( E no ug h i n fo rma t i o n is r em o v e d f r om the s ta c k by the e r ro r ro u t i ne that the e x c e pt i o n d i s pa tc h e r c a n a t l e a s t g e t s t a r t ed in r e po r t i ng the e x c ept i on . ) I f t h e u s e r s t a c k c a nno t b e e x pa nd ed i n r e s po n s e to a Pl space l e ng th v i o l a t i o n , then an a c c e s s v i o l a t i o n faul t i s r e po r t ed t o t h e p r o c e s s . I f the r e i s n o t e n o ug h user s tac k to r e po r t th e e x c e p t i o n , t h e no rma l c o nd i t i o n h a nd l e r s e a r c h i s byp a s s e d a nd t h e e x c e p t i o n i s r e po r t e d d i r e c t l y t o the l a s t c h a n c e h a nd l e r ( Ch a p t e r 2 ) . In the d e faul t c ase , th i s h a nd l e r c a u s e s th e c u r r e n t l y e x e c u t i ng i m ag e t o te rm i n a t e . Ad d r e s s Spa c e De l e t i o n Fo r a c o up l e o f r ea so n s , p a g e d e l e t i o n i s mo r e c ompl i c a t ed c rea t i on . than pag e l. C r e a t i o n i nv o l v e s t a k i ng t h e p r o c e s s f r om o n e k n o wn s ta t e ( ad d r e s s s pa c e d o e s n o t ye t e x i s t ) t o ano th e r k n o wn s t a t e ( t h e pag e t a b l e e n t r i e s c o n t a i n d em a n d ze ro PTE s ) . Pag e d e l e t i o n mus t d e a l w i th i n i t i a l c o nd i t i o n s tha t i n c l ud e a l l t h e po s s i b l e s t a t e s t h a t a v i r tua l p a g e c a n b e i n . 2. Th e s e c o nd r e a so n i s t h a t pag e c r e a t i o n m a y f i r s t r e qu i r e that the s p e c i f i ed pag e s be d e l e te d i n o r d e r t o put the Th a t is , pag e p r o c e s s pag e t a b l e s i n to t h e i r known s t a t e . d e l e t i o n i s o f t en an i n t eg r a l pa r t o f p a g e c r e a t i o n . 1 3-4 MEMORY MANAG EMENT SYS TEM SERVI C E S 13. 2. 2. 1 De l e t e V i r t u a l Ad d r e s s Spa c e Sys t em Se r v i c e - Wh e n a pag e i s d e l e t ed , all process a nd s y s t em r e so u r c e s a s s o c i a t ed w i th t h e pag e mus t b e r e t u r ned . Th e s e i n c l ud e 1. a pag e f r am e f o r v a l i d a nd t r a n s i t i o n pa g e s , 2. a pa g e f i l e v i r t ua l block fo r pag e s wh o s e a d d r e s s i n d i c a t e s an a l r e a d y a l l o c a t ed b l o c k , 3. a wo r k i ng s e t l i s t e n t r y f o r a pag e i n s e t l i s t , a nd 4. p a g e f i l e q uo t a f o r a l l pag e s w i t h a pag e f i l e b a c k i ng s to r e a dd r e s s , i n c l ud i ng pag e s tha t h a v e no t ye t a l l o c a t e d a b l o c k i n t h e pag e f i l e . the b a c k i ng process s to r e wo r k i ng P r i v a t e s e c t i o n pag e s th a t a r e d e l e t e d c a u s e the r e f e r e n c e c o un t the proc ess s e c t i o n t a b l e e n t r y ( F i g u r e 1 1 - 7 ) t o b e d e c r em e n t ed . t h e r e f e r e n c e c o un t g o e s to z e r o , th e PSTE i t s e l f c a n b e r e l e a s ed . in If I n a d d i t i o n , v a l i d o r m o d i f i ed pag e s w i th a s e c t i o n ba c k i ng s to r e add r e s s ( a s o ppo s e d t o a pag e f i l e b a c k i ng s to r e add r e s s ) m u s t h a v e t h e i r l a t e s t c o n t e n t s wr i t t e n b a c k t o the s e c t i o n f i l e . ( Th e c o n t e n t s of p a g e s wi th a pag e f i l e ba c k i ng s to r e a d d r e s s a r e un i mpo r t a n t a f te r the v i r t ua l pag e i s d e l e t ed and d o n o t h a v e to be s a v ed b e fo r e the phys i c a l pag e i s r e u s e d . ) Pag e De l e t i o n a nd Sc h ed u l i ng - Pag e s t h a t have I /O in 13. 2. 2.2 p r og r e s s c a nno t b e d e l e t ed u n t i l the I /0 c ompl e t e s . Such processes a r e p l a c ed i n to a pag e f a u l t wa i t s t a t e ( r e que s t i ng th a t a s ys tem event be r e po r ted wh e n I /0 c ompl e t e s ) un t i l t h e pag e r e a d o r wr i t e c ompl e t e s . Pag e s i n the wr i t e- i n - p r o g r e s s t r a ns i t i o n s t a t e wi l l c a u s e the s am e e f fe c t . Pag e s i n t h e r e a d - i n- p r og r e s s t r a n s i t i o n s t a t e a r e f a u l t ed , wi th t h e i mmed i a t e r e s u l t t h a t t h e p r o c e s s i s p l a c ed i n t o the c o l l i d ed pag e wa i t s t a t e . Sp e c i a l a c t i o n m u s t be t a k e n f o r g l o b a l pag e s wi th I /0 i n p r og r e s s b e c a u s e the r e i s n o wa y to d e t e rm i n e i f the p r o c e s s d e l e t i ng the pag e is a l s o r e s po n s i b l e f o r t h e I /0 . In s uc h c a s e s , th e p r o c e s s i s p l a c ed i n to a m i s c e l l a n e o u s wa i t s t a t e ( MWA I T ) ( I f t h e p r o c e s s h a s no d i r e c t I /0 i n un t i l i t s d i r e c t I /0 c o mpl e t e s . p r og r e s s , t h e p r o b l em d o e s no t arise in the f i r s t pl a c e a nd the d e l e t i o n is a l l o we d t o p r o c eed . ) On c e a l l r e a s o n s f o r k e e p i ng th e pag e a r o und have b e e n t a k e n c a r e o f , t h e pag e is d e l e t ed . De l e t i o n o f a phys i c a l pa g e m e a n s th a t the c o n t e n t s o f t h e PFN PTE a r r ay a r e c l e a r e d , d e s t r o y i ng a l l t i e s b e twe e n the phys i c a l pag e a nd a n y p r o c e s s v i r t ua l add r e s s . I n ad d i t i o n , t h e pag e i s p l a c ed a t t h e h e ad o f t h e f r e e pag e l i s t , c a us i ng it to be u s ed b e f o r e o th e r pag e s wh o s e c o n t e n t s a r e s t i l l u s e f u l . 13 . 2. 2. 3 Co n t r a c t Reg i o n Sys t em S e r v i c e - Th e Co n t r a c t Reg i o n s y s t em se rv i c e is a spec i a l c a s e o f t h e De l e t e Vi r t ua l Ad d r e s s Spa c e s ys t em s e rv i c e . Th e r e q ue s t ed n um b e r o f pag e s i s s i mpl y c o nv e r t e d i n to a PO o r P l pag e r a ng e a nd c o n t r o l i s pa s s e d t o a pag e d e l e t i o n r o u t i n e th a t i s c o mmon b e t we e n t h e two s e rv i c e s . 1 3-5 M EMORY MANAG EMENT SYSTEM S E RVI CES 13. 2. 3 C o n t r o l l ed A l l o c a t i o n of V i r tu a l Memo r y Th e r e i s a s e c o nd l ev e l o f m em o r y m a n ag em e n t a v a i l a b l e t o a process . Th e Ru n - T i m e L i b r a r y p r o c ed u r e s L I B $G E T VM a nd L I B $ F R E E VM p r ov i d e a m e c h a n i sm f o r a l l o c a t i ng sma l l b l o c k s - o f v i r t ua l memo r y in a c o n t r o l l ed f a sh i o n . A l l o c a t i o n f r om t h e f r ee memo r y po o l i s pe r fo r m e d i n m uc h the s am e wa y a s po o l s pa c e i s a l l o c a t e d b y VMS ( Ch a pt e r 2 5 ) . If t h e r e i s n o t a b l o c k o f m emo r y i n t h e po o l l a rg e e n o ug h to s a t i s f y t h e r eq ue s t , P O s pa c e i s e x p a nd ed ( by c a l l i ng $ E XPREG ) a nd t h e po o l i s e x t e nd e d t o i nc l ud e t h e n e wl y c r e a t ed v i r t ua l a d d r e s s s p a c e . 13. 3 PRIVATE AND G L OBAL SECT I ONS A s e c o n d m e thod o f c r e a t i ng a d d r e s s s pa c e i s a v a i l ab l e . Th e Create a nd Ma p S e c t i o n s ys t e m s e rv i c e a l l o ws a p r o c e s s to a s so c i a t e a po r t i o n o f i t s a d d r e s s spac e w i t h a spe c i f i ed po r t i o n o f a f i l e . Th e sec t i on m a y b e s p e c i f i c to a p r o c e s s ( p r i v a t e s e c t i o n ) o r s h a r e d amo ng s e v e r a l processes ( g l obal s ec t i o n ) Th e M a p G l o b a l Sec t i on s ys t em s e r v i c e a l l o ws a p r o c e s s t o m a p a po r t i o n o f i t s v i r tua l a d d r e ss s pa c e t o a n a l r e a d y e x i s t i ng g l o b a l s e c t i o n . Th e s e t wo s e r v i c e s a r e used b y t h e i m ag e a c t i v a to r ( Ch a p t e r 1 8 ) to m a p po r t i o n s o f p r o c e s s a d d r e s s s pa c e t o e i th e r t h e i mag e f i l e o r p r ev i o u s l y i n s ta l l ed g l o b a l s e c t i o n s . • Th e C r e a t e a nd Ma p S e c t i o n sys tem se r v i c e a l so p r o v i d e s t wo spe c i a l opt i ons . Ra the r t h a n m a pp i ng a po r t i o n o f p r o c e s s a d d r e s s s pa c e t o a file, a s u i tab l y p r i v i l eg ed process ( wi th PFNMAP p r i v i l eg e ) can a ssoc i a te ( ma p ) v i r t ua l add r es s e s to s pe c i f i c ph ys i c a l ad d r e s s e s . G l o b a l s e c t i o n s c a n b e c r e a t e d and m a ppe d i n sha r ed m em o r y a s we l l as i n l o c a l memo r y . 13. 3.1 C r e a te a nd M a p S ec t i o n Sys t em S e r v i c e Th e C r e a t e a nd Ma p S e c t i o n s ys t em se r v i c e i s t h e sys t e m se r v i c e th a t ( I n a s e n s e , t h e Ma p G l o b a l S e c t i o n pe r fo rm s a l l o f t h e s e o pe r a t i o n s . s ys tem s e rv i c e i s a spec i a l c a s e o f $ C RMP S C wh e r e t h e s e c t i o n d o e s no t have t o b e c r e a t ed . ) Th e p a r t i c ul a r p a th th a t i s t a k e n th r o ug h t h e s e r v i c e i s d e t e r m i n ed b y t h e c o n t e n t s o f t h e f l ag s a rg um e n t p a s s e d to the s e r v i c e . ( Th e VAX/VM S Sys tem S e r v i c e s Re f e r e n c e Ma n ua l l i s t s tho se f l ag s tha t can be used tog e th e r a nd tho s e tha t a re i nc ompa t i b l e . ) O n e wa y o f l o o k i ng a t t h e a c t i o n o f th i s s e r v i c e i s t o e x am i n e t h e d a ta s t r uc t u r e s t h a t a r e c r e a t e d a s a r e s u l t o f e x e r c i s i ng o n e o f t h e seve r a l o p t i o n s a v a i l a b l e to i t . 13. 3.1. 1 P r i v a t e S e c t i o n C r e a t i o n - Wh e n a p r o c e s s p r i va t e s e c t i o n i s c r e a t ed , a p r o c e s s s e c t i o n t a b l e e n t r y ( F i g u r e 1 1 - 7 ) i s a l l o c a t e d f r om t h e a r e a o f the p r o c e s s h e a d e r se t a s i d e f o r PSTEs . Th e i n fo rm a t i o n tha t a s so c i a t e s t h e v i r t ua l a d d r e s s r a ng e w i t h v i r t ua l b l o c k s i n t h e f i l e i s l o ad ed i n to the P S T E . ( Wh e n the pr ivate sec t i on is b e i ng c r e a t ed a s a pa r t o f i m a g e a c t i v a t i o n a s d e sc r i b ed i n C h a pt e r 1 8 , t h e o r i g i n a l s o u r c e fo r m u c h o f t h e d a ta s to r ed i n t h e P S T E is an imag e s e c t i o n d e sc r i p to r c o n ta i n e d i n t h e i m ag e f i l e . ) I n a d d i t i o n , e a c h p r o c e s s pag e t a b l e e n t r y i n t h e d e s i g n a t e d add r e ss r a ng e is l o ad ed wi th i d en t i c a l c o n tents , n am e l y a p r o c ess sec t i o n tab l e i nd ex ( Figure 1 1-3 ) . 1 3-6 MEMORY MANAGEMENT SYS TEM S ERVI C E S Bec ause of t h e wa y s pa c e is a l l o c a t ed i n the process h e ad e r ( Append i x E ) , it is po s s i b l e th a t the s pa c e t o ho l d a s e c t i o n t ab l e e n t r y m a y e x t end i n to th e wo r k i ng s e t l i s t . Wh en t h i s o c c u r s , the ent i re p rocess sec t ion tabl e c an s l i d e d o wn i n t o o n e o f t h e empty p ag e s set a s i d e in t h e p r o c e s s h e ad e r fo r e x a c t l y th i s p u r po s e . Al l r e f e r e nc e s to p r o c e s s s e c t i o n t a b l e e n t r i e s a r e r e l a t i v e to th e b o t to m ( h i g h ad d r e s s e nd ) of the t ab l e that is loca ted th r o ug h o f f s e t PHD $ L PS TBAS O F F . Th a t is , the ent i re s t r uc t u r e is po s i t i o n i nd e pend e n t . H e a d e r e x p a n s i o n i nvo l v e s m a pp i ng the f i r s t empty p ag e , m o v i ng the ent i r e s t r uc t u r e d o wn one pag e , and c h a ng i ng P H D $ L P S TBAS OFF to l o c a t e t h e n e w b o t tom o f t h e ta b l e . 1 3 . 3 . 1 . 2 G l o b a l S e c t i o n C r e a t i o n - Th e c r e a t i o n o f a g l o b a l sect i on ( l o c a t ed i n l oc a l memo r y ) i s s i m i l a r to t h e c r e a t i o n o f a p r i v a t e s e c t i o n e x c e p t th a t t h e d a t a s t r uc t u r e s a r e located in the s ys t em h e ad e r ( F i g u r e s 1 1 - 1 5 a n d 1 1 - 1 8 ) i n s t e ad o f t h e p r o c e s s h e a d e r . 1. A g l o b a l s e c t i o n d e sc r i p to r ( F i g u r e 1 1 - 1 4 ) i s a l l o c a t e d f r om pag ed d yn am i c memo r y a nd l o a d ed w i th i n fo rma t i o n th a t d e s c r i b e s t h e n am e a nd p r o t e c t i o n a t t r i b u t e s o f t h e s ec t i o n . Th i s d a t a s t r uc t u r e i s u s ed by s ub s e qu e n t Ma p G l o b a l S e c t i o n s ys t em s e r v i c e c a l l s t o d e t e rm i n e wh e th e r th e n am ed sec t i on ex i s ts and to l o c a t e t h e G l o b a l Se c t i o n T a b l e En t r y i n t h e s y s t em h e a d e r t h a t m o r e f u l l y d e sc r i b e s the se c t i o n . 2. A g l obal s e c t i o n tab l e e n t r y ( Figure 1 1-1 6 ) in the header ( Fi g u r e 1 1 -1 5 ) is the a n a l og o u s s t r uc t u r e process sec t i on tab l e entr y . 3. A s e r i e s o f g l o ba l pa g e tab l e entr i e s a re c r e a ted in a v i r t ua l e x t e n s i o n to t h e s ys t em h e ad e r ( F i g u r e 1 1 - 1 7 ) . Th e s e pag e tab l e e n t r i e s co n t a i n i n fo rm a t i o n th a t d e s c r i b e s the c u r r en t s t a t e o f e a c h g l ob a l pag e i n the s e c t i o n . Th e y a r e no t a v a i l a b l e t o th e m emo r y m a n ag em e n t h a r d wa r e b u t a r e u s ed by t h e pag e f a u l t h a nd l e r wh e n a p r o c e s s i n c u r s a pag e f a u l t f o r a g l o ba l pag e . 4. A g l o b a l s e c t i o n c a n b e c r e a ted and m a pped b y a s i ng l e s ys t em s e rv i c e c a l l . Al te r n a t i v e l y , t h e s e c t i o n c a n b e c r e a t e d i n o n e s t e p a n d ma pped l a t e r o n b y e i th e r the c r e a t i ng process or by a n y o th e r p r o c e s s a l l o we d t o m a p t h e s e c t i o n . In any c a s e , m a pp i ng t o a g l o b a l s e c t i o n r e s u l ts i n n o c h a ng e s to the g l oba l d a ta b a se . Ra th e r , t h e p r o c e s s pa g e t a b l e h a s a s e r i e s o f p a g e t a b l e e n t r i e s o f t h e fo rm g l o b a l pag e tab l e i nd e x ( Fi g u r e 1 1 - 1 9 ) a d d ed t o d e s c r i b e the d e s i g na t e d a d d r e s s r a ng e . Th e p r o c e s s pa g e t a b l e e n t r i e s fo r g l o b a l pag e s c a n be i n one o f two states , e i th e r va l i d o r c o n ta i n i ng t h e a pp r o p r i a t e g l o b a l pag e t a b l e i nd e x . s ys t em to t h e 1 3 . 3 . 1 . 3 G l o b a l S e c t i o n s i n S h a r e d Memo r y - G l o b a l s e c t i o n s t h a t a r e l oca ted i n s h a r ed m em o r y a r e t r e a t e d i n a s l i g h t l y d i f f e r e n t f a s h i o n f r om l o c a l memo r y g l ob a l s e c t i o n s . Th e s e c t i o ns a r e c r e a t ed by the I N S TA L L u t i l i ty a f te r s h a r ed m em o r y h a s b e en i n i t i a l i zed . ( See Ch a p t e r 1 1 f o r a d e s c r i p t i o n o f the d a ta s t r uc t ur e s t h a t d e s c r i b e g l o b a l s e c t i o n s i n s h a r e d mem o r y . ) 1 3-7 MEMORY MANAG EMENT SYSTEM SERV I C E S 1. A s pe c i a l g l o b a l s e c t i o n d e s c r i pt o r ( F i g u r e 1 1 - 2 7 ) i s c r e a t e d th a t c o n t a i n s , a m o n g o th e r th i ng s , a l i s t o f t h e ph ys i c a l p a g e s i n s h a r e d memo r y t h a t w i l l c o n t a i n the sec t i on . Th e s e c t i o n i s t empo r a r i l y m a pped by I N STALL a n d e a c h pag e o f t h e s e c t i o n i s l o a d e d f r om t h e i m ag e f i l e . 2. A g l o b a l s e c t i o n t a b l e e n t r y i s c r e a t e d o n l y o n the CPU th a t o r ig i na l l y c r e a t e s the s ec t i o n . Th i s G S T E a l l ows t h e i n i t i a l r e ad t o b e pe r fo r m e d a n d a l l o ws s ub s e q u e n t sec t i o n upd a te s ( w i th S YS $ U PD S E C ) fo r wr i t ab l e sec t i o ns . Pag e s a r e a l s o wr i t t e n b a c k to t h e i m a g e f i l e o n the c r e a t i ng C P U wh e n t h e s e c t i on is d e l e ted . 3. No g l o b a l pag e t a b l e e n t r i e s a r e n e ed ed fo r g l o b a l sec ti ons i n sh a r e d memo r y b e c a u s e t h e s ta t e o f e a c h pa g e i s k n o wn t o be val id . Th e PFN i n fo rm a t i o n n e c e s s a r y to a l low processes to map i n to th i s s e c t i o n i s c o n t a i ned i n t h e sh a r ed memo r y GSD. 4. Wh e n a p r o c e s s m a ps t o t h e s h a r ed memo r y g l o b a l s e c t i o n , the p r o c e s s pa g e table entr i es a r e set to val id wi th the a pp r o p r i a t e p a g e f r am e n um b e r s l o ad ed i n to the PTEs . Th e s e p a g es a r e n o t c o un ted ag a i n s t t h e p r o c e s s wo r k i ng s e t . 1 3 . 3 . 1 . 4 Map by PFN Th e C r e a t e a nd Ma p Sec t i o n s ys t e m s e r v i c e a l l o ws a p r i v i l eg e d process ( o n e wi th PFNMA P p r i v i l eg e ) t o m a p a po r t i o n o f i t s v i r t ua l ad d r e s s s pa c e to s pe c i f i c ph ys i c a l add r ess es . Al t h o ug h the pr ima ry i n te n t i o n o f th i s s e r v i c e i s to a l l o w p r o c e s s a d d r e s s s pa c e to b e m a pped to I /0 a d d r e s s e s , i t c a n a l s o b e used to m a p s pe c i f i c ph ys i c a l memo r y p ag e s . - Wh e n a p r i v a t e PFN-m a pped s e c t i o n i s c r e a t ed , t h e o n l y e f f e c t is to add a s e r i e s of v a l i d PTEs to t h e p r o c e s s pag e t a b l e . Th e PFN f i e l d s i n t h e s e PTEs c o n t a i n the r e que s t e d ph ys i c a l pa g e n um b e r s . Th e PTE $V W I NDOW b i t in the PTE ( Fi g u r e 1 1 - 3 ) is s e t i n e a c h PTE t o i nd i c a t e tha t e a c h o f th e s e v i r t ua l pag e s i s P F N m a pped . Th e s e pag e s a r e n o t c o unted ag a i ns t the p r o c e s s wo r k i ng s e t . In add i t i on , no r e c o rd i s m a i n t a i n ed i n t h e PFN d a t a b a s e tha t s uc h pag e s a r e PFN m a pped . Wh e n a g l o b a l PFN m a p ped s e c t i o n i s c r e a ted , t h e o n l y d a t a s t r uc t u r e c r e a ted t o d e sc r i b e s uc h a m a ppi ng r e que s t i s a spec i a l fo rm o f g l oba l s e c t i o n d e sc r i pto r ( F i g u r e 1 1 - 1 4 ) . Th e r e a r e no g lobal pag e tab l e entr ies no r is the r e a g l o b a l s e c t i o n t a b l e en t r y . Wh e n a p r o c e s s m a ps t o s uc h a s e c t i o n , i t s p r o c e s s pag e table entr i es a r e set to val id , m a pped by PFN ( P F N $ V W I NDOW i s s e t ) , a nd th e PFN f i e l d s a r e f i l l ed i n a c c o r d i ng to t h e- c o n t e n t s of the ex t e n d ed GSD ( Fi g u r e 1 1 -1 4 ) . 13. 3.2 M a p G l o b a l S e c t i o n Sys t em S e r v i c e Th e Ma p G l o b a l S e c t i o n s y s t em s e r v i c e c a n b e c o n s i d e r e d a s p e c i a l c a s e of t h e C r e a t e a nd Ma p ( G l oba l ) S e c t i o n s ys tem s e r v i c e , wh e r e the g l ob a l s e c t i o n a l ready ex i sts . Th i s s e r v i c e us u a l l y has no e f f e c t o n t h e g l oba l d a ta b a se ( o th e r t h a n t o i n c l ud e t h e l a t e s t m a pp i ng i n v a r i o u s r e f e r e n c e c o un t s ) . Ra th e r , t h i s s e r v i c e a l l o ws a r a ng e o f p r o c e s s a d d r e s s e s t o b e c o m e m a pped t o the n amed g l o b a l se c t i o n . 1 3-8 M EMORY MANAG EMENT SYS TEM S E RVI C E S Th e a c t ua l e f f e c t o f th i s s e r v i c e i s t o l o ad e a c h of t h e d e s i g na t ed process PTEs w i th a g l ob a l page tab l e i nd ex ( Fi g ur e 1 1 - 3 , Figure 1 1-1 9 ) . Th e s e g l ob a l pag e t ab l e i nd i c e s a r e e f f e c t i v e l y po i n t e r s t o g l o b a l pag e t ab l e e n t r i e s i n the s ys t em h e ad e r , wh e r e th e c u r r e n t s t a t e o f e a c h g l ob a l pag e i s a c t ua l l y r e c o r d ed . Wh e n a p r o c e s s m a p s to a g l o b a l s e c t i o n i n sha r e d m em o r y o r to a section th a t i s PFN-m a ppe d , t h e r e a r e no g l o b a l pag e t a b l e e n t r i e s to be po i n t e d t o . I n s t e ad , e a c h p r o c e s s pag e t a b l e e n t r y i s s e t to va l i d w i th t h e PFN f i e l d c o n t a i n i ng a ph ys i c a l pag e n um b e r e i th e r i n s h a r ed m emo r y ( f o r sha r ed m emo r y g l o b a l s e c t i o n s ) o r a n ywh e r e i n ph y s i c a l a d d r e s s s pa c e ( a s i nd i c a t ed b y t h e e x t e n d e d G S D f o r PFN-mapped g l o b a l sections ) • De l e t e G l o b a l S e c t i o n Sys t em S e r v i c e 13. 3.3 L i k e t h e De l e t e V i r t ua l Ad d r e s s Spa c e s ys t em s e r v i c e , t h e De l e t e G l obal S e c t i o n s y s tem s e rv i c e i s m o r e c ompl i c a t e d than g l o b a l s e c t i o n c r e a t i o n b e c a u s e t h e s e c t i o n m u s t b e r e d uc ed f r om o n e o f m a n y s t a t e s In ad d i t i o n , g l o b a l wr i t ab l e pag e s m u s t b e wr i t t e n to t o n o th i ng . t h e i r ba c k i ng s to r e ad d r e s s e s b e fo r e a g l o b a l s e c t i o n c an be ful ly d e l e ted . Fo r these r e a so n s , t h e g l obal sec t i on d e l e t i on i s o f ten s e pa r a t ed i n t i m e f r om t h e s ys t em s e r v i c e c a l l . Wh e n t h e De l e t e G l o b a l S e c t i o n s ys tem s e r v i c e i s c a l l ed , t h e named section i s ma r k ed fo r d e l e te . Th i s m e a n s tha t t h e G S D i s moved f r om th e n o rm a l d o ub l y l i nk e d G S D l i s t to t h e d e l e t e pend i ng l i st . Th e d e l ete pend i ng bit in the GSD i s set . I n a d d i t i o n , t h e pe rm a n e n t i nd i c a to r i n t h e G S D i s t u r ned off . Howe v e r , the ac tual sect ion d e l e t i o n c a nno t o c c u r u n t i l t h e r e f e r e nc e i n t h e g l o b a l s e c t i o n t a b l e e n t r y , t h e c o un t o f p r o c e s s pa g e t a b l e e n t r i e s m a pped t o the sec t i on , g o es to zero . Al t h o ug h i t i s po s s i b l e fo r th e r e f e r e n c e c o unt to b e z e r o wh e n t h e s e c t i o n i s m a r ked f o r d e l e t e , t h e m o r e t yp i c a l g l o b a l sect i on d e l e t i o n o cc u r s a s a s i d e e f fec t o f v i r tua l add r e s s d e l e t ion ( wh i c h i t s e l f m i g h t o c c u r as a resul t of imag e ex i t or proc ess deletion) • Wh e n t h e r e f e r e n c e c o un t g o e s to z e r o , th i s i nd i c a t e s th a t no more p r o c e s s pag e t a b l e e n t r i e s a r e m a pped t o t h e s e c t i o n . A t th a t t i m e , t h e d a t a s t r uc t u r e s tha t d e sc r i b e the s ys tem c a n b e d e a l l o c a t ed . • Th e g l o b a l pag e t a b l e e n t r i e s i n the s ys t em h e ad e r a r e f r e ed fo r f u r th e r use . If an e n t i r e pag e of g l o b a l p a g e t a b l e e n t r i e s i s f r e ed , t h a t p a g e c a n b e un l o c k e d f r om th e s ys tem wo r k i ng s e t . • Th e g l o b a l s e c t i o n tab l e entry in the sys tem h e ad e r is r emoved f r om th e a c t i v e l i s t a nd p l a c ed o n t h e f r e e l i s t o f s y s t em s e c t i o n t a b l e en t r i e s f o r po s s i b l e l a t e r u s e . • Th e g l o b a l s e c t i on d e sc r i pt o r i s pl a c ed o n the f r e e l i st o f G S Ds . Wh e n a g l o b a l s e c t i o n i s l a t e r c r e a t e d , th i s l i s t i s c h e c k e d f o r a G S D b e fo r e a n ew s t r uc t u r e is a l l o c a t ed f r om p a g e d d yn am i c memo r y . 1 3-9 MEMORY MANAGEMENT SYSTEM S E RVI CES G l o b a l s e c t i o n s in sh a r ed m emo r y a nd PFN m a pped g l o b a l sect i ons e x e r c i s e s o m e o f t h e s a m e l og i c wh en t h e s e c t i o n s a r e d e l e te d b u t t h e e f fe c t s a r e d i f f e r e n t b e c a u s e n o t a l l o f t h e g l o b a l d a t a s t r uc t u r e s ex i st fo r thes e spec i a l g loba l sections . A PFN m a pped s e c t i o n i s d e sc r i b ed ent i r ely b y a n e x t end e d g lobal sec t i o n d e sc r i pt o r ( Fi g u r e 1 1 - 1 4 ) . In add i t io n , n o r e f e r e n c e c o un ts a r e k e p t f o r s u c h s e c t i o ns so t h e G S D c a n b e p l ac e d on the f r ee l ist o f G S Ds i mmed i a t e l y . Wh e n a s h a r ed memo r y g l ob a l s e c t i o n i s d e l e t e d , t h e r e a r e no global pag e table entr ies to d e l ete . I n ad d i t i o n , a g l ob a l s e c t i o n t a b l e e n t r y o n l y e x i s t s o n t h e po r t f r om wh i ch t h e s e c t i o n wa s c r ea t e d ( to a l lo w the s ec t i o n t o b e l o ad ed wh e n i t wa s i n i t i a l l y c r ea t ed and to a l l o w the Upd a t e S e c t i o n s ys t em s e rv i c e o r De l e t e G l o b a l Sect i on s ys tem s e rv i c e t o p r e se r v e i t s c o n t e n ts ) . 13. 3.4 Upd a te S ec t i on S y s t em S e r v i c e Th e Upd a t e S e c t i o n s ys tem s e rv i c e r e que s t s th a t a spec i f i e d r a ng e of p r oc e s s p r i v a t e o r g l o b a l pag e s b e wr i t t e n t o the i r b ac k i ng s to r e a d d r e s se s . Wh e n a p r i v a t e s ec t i o n i s b e i ng upd a t ed , o n l y t h o s e p a g e s t h a t h a v e b e e n mod i f i ed ( a s i nd i c a t ed e i th e r by t h e PTE $V MOD I FY b i t i n t h e PT E o r b y t h e PFN$V MOD I FY b i t i n t h e PFN S TATE a r r a y ) are wr i tten . W i th g l o b a l pag e s , t h e m o d i f y s t a t e o f a phys i c a l pag e i s t h e l og i c a l OR o f th e PFN S TATE a r r ay m o d i fy b i t a nd th e m o d i f y b i t s in all of t h e p r oc e s s pag e t ab l e e n t r i e s m a pped to t h e s e c t i o n . Bec au s e the r e a r e no b a c k po i n t e r s to a l l of these PTEs , th i s i n fo r ma t i o n i s not ava i l ab l e . I n s t e ad , wh en a g l ob a l s e c t i o n i s u pd a ted , a l l pag e s i n the d e s i g n a t e d a d d r e s s r a ng e a r e wr i t t e n b a c k t o ( Wh e n t h e " e x c l u s i v e wr i t e r " f l ag i s pa s s e d to the g l obal imag e f i l e . t h e Upd a t e S e c t i o n s ys tem s e rv i c e , o n l y tho s e pag e s m o d i f i ed by t h e c a l l e r a r e w r i t t e n . ) Th e i n te r a c t i o n b e twe e n t h e Upd a t e S e c t i o n s ys t em s e rv i c e a nd t h e I /0 s ub s ys t em i s d e sc r i b ed i n Ch a p t e r 1 2 . 13. 4 R E LATED S YSTEM S ERVI C E S O th e r m em o r y m a n ag em e n t s ys tem s e rv i c e s a l l o w a p r o c e s s to c o n t r o l i t s wo r k i ng se t , a l ter pag e p r o t ec t i o n , a nd l o c k pag e s i n to the wo r k i ng s e t o r i n to ph y s i c a l memo r y . 13. 4 . 1 Wo r k i ng S e t S i z e Ad j u s tme n t I t i s po s s i b l e t o m a k e t h e p r o c e s s wo r k i ng s e t e i th e r l a rg e r or sma l l e r , e i th e r m a n ua l l y w i th t h e Ad j us t Wo r k i ng S e t L i m i t s ys t em s e rv i c e o r a u toma t i c a l l y a s a pa r t o f t h e q ua n t um end rout i ne . Wh e n t h e wo r k i ng s e t i s e x pa nd ed , n e w pag e s c an b e a d d e d t o the wo r k i ng s e t w i tho u t r em ov i ng a l r e ad y v a l i d entr ies . Th i s decreases the p r o b a b i l i ty o f a p r o c e s s i n c u r r i ng a pag e f a u l t . I t i s un l i k e l y t h a t a p r o g r am w i l l v o l un t a r i l y r ed uc e i t s wo r k i ng set l i m i t , u n l e s s i t h a s a g o od und e r s t a nd i ng o f i t s pag i ng b e h a v i o r . Th e s ys t em r ed uc e s a p r o c e s s wo r k i ng set as a pa r t o f the a u tom a t i c wo r k i ng s e t a d j u s tme n t . I n a d d i t i o n , a p r o c e s s wo r k i ng s e t l i m i t i s r e s e t t o i t s d e f a u l t v a l ue a s a pa r t o f t h e i m ag e r un d o wn p r o c ed u r e ( Ch a p t e r 1 8 ) th a t is i nvo k e d wh e n a n i m a g e e x i t s . Ta b l e 1 3 - l l i s t s t h e p r o c e s s - s p e c i f i c a n d s ys tem-w i d e wo r k i ng s e t l i s t pa r am e t e r s . 1 3-1 0 MEMORY MANAG EMENT SYSTEM S ERVI CES Tab l e 1 3 - 1 Working Set L i s t s Lim i t s and Quotas De sc r i pt i o n Loc a t i o n or Name Comments Beg i nn i ng o f Wo r k i ng Se t Li st PHD$W_WS L I S T Alwa ys h a s t h e val ue 6 0 ( he x ) ( Th i s i s < PHD$K_LENGTH I 4 > ) Beg i n n i ng of l i st o f pe rman e n t l y l oc k ed entr i e s PHD$W_WS LOCK The same fo r a l l pro c es s e s i n a g i ven sys tem Beg i nn i ng o f d ynam i c po r t i o n o f wo r k i ng set l i st PHD$W WSDYN Iden t i c a l to WS LOC K u n l ess t h i s process h a s c a l l ed SYS $LKWSET or SYS $LC KPAG I nd ex o f m o s t r ec en t l y i nser ted wo r k i ng s e t l i s t e n t r y PHD$W_WSNEXT Upd a ted each t ime an e n t r y i s add ed t o the wo r k i ng s e t E n d o f wo r k i ng se t l i st PHD$W_WSLAST Upd a ted by c a l l ing SYS $ADJWSL a nd at imag e ex i t De f a ul t wo r k i ng set s i ze PHD$W_DFWSCNT S e t by LOG INOUT , a l te r ed by SET WORKI NG_S ET/L IM IT = command Upper l im i t to wo r k i ng set s i ze PHD$W_WSQUOTA Set by LOG INOUT , a l te r ed by SET WOR K ING_S ET/QUOTA= c ommand Upper l im i t to wo r k i ng se t quo ta PHD$W_WSAUTH S e t by LOG INOUT , c anno t be a l t e r ed Lowe r l im i t to s i ze o f d yn am i c wo r k i ng s e t s i ze PHD$W_WSFLUI D Set up by S HE L L , equal to the v a l ue of M I NWSCNT SYSBOOT pa r am e t e r S i ze o f d yn a m i c wo r k i ng s e t a ft e r a l l ow i ng r o o m fo r PHD$W WSFLU I D pr o c e s s pag e entr i e s a nd a r e a so nab l e n umber pag e tab l e pag es PHD$W_ E XT DYNWS Upd a ted each t i me s i ze o f d yn am i c wo r k i ng s e t i s c hang ed Autho r i zed d e fa u l t wo r k i ng s e t s i ze UAF $W_DFWSCNT Lo ad ed i n to PHD$W_DFWSCNT Autho r i zed d e fa ul t wo r k i ng s e t l im i t UAF $W_WSQUOTA Load ed in to bo th PHD$W_QUOTA and PHD$W_WSAUTH System w i d e m i n imum wo r k i ng se t s i ze M INWSCNT SYSBOOT pa rameter Sys tem w i d e max im um wo r k i ng se t s i ze WSMAX S YS B OOT pa rameter Wo r k i ng set s i ze fo r s ys t em pag i ng SYSMWCNT S YS B OOT pa rameter De f a ul t val ue fo r wo rki ng s e t s i ze d e fa ul t ( us e d by SYS $CREPRC ) PQL_DWSDEFAULT SYSBOOT pa r ame t e r M i n imum val ue fo r wo r k i ng s e t s i ze d e fa ul t ( us e d by SYS $C REPRC ) PQL_MWSDEFAULT SYSBOOT pa ram e t e r D e faul t va l ue fo r wo rki ng s e t quo ta ( us ed by SYS $CREPRC ) PQL_DWS QUOTA SYS B OOT pa r ame t e r M i n imum va l ue fo r wo r k i ng s e t quo ta ( us ed by SYS $C R E PRC) PQL_MWSQUOTA SYSBOOT pa rameter 1 3 . 4 . 1 . 1 Ad j us t Wo r k i ng S e t S i z e Sys t e m S e r v i c e - Th e e f fe c t i ve r e s u l t o f a l t e r i ng the p r o c e s s wo r k i ng s e t s i z e i s to c h ang e t h e v a l ue o f the WS LA S T wo r k i ng s e t l i s t po i n te r ( F i g u r e 1 1 - 4 ) . I n th e c a s e o f wo r k i ng s e t l i s t e x p a n s i o n , t h e wo r k i ng set s i ze is l i m i t ed b y t h e wo r k i ng s e t quo t a ( P HD$W WSQUOTA ) . I f the e x pa nd ed wo r k i ng s e t e x t e nd s i n to the p r o c e s s s e c t i on t a b l e ( F i g u r e 1 1 - 1 ) , the 1 3-11 MEMORY MANAG EMENT SYS TEM SERV I C ES p r oc ess sect ion t a b l e i s m o v ed d o wn i n e x a c t l y t h e s am e m a n n e r a s i s d o ne to a c c ommod a t e p r o c e s s s e c t i o n t a b l e e x pa n s i o n . Th e r e i s a l wa ys e n o ug h r o om i n t h e p r o c e s s h e ad e r to a c c ommod a t e t h e e x pand e d wo r k i ng s e t l i s t b e c a u s e t h e p r o c e s s h e a d e r s i z e i s d e te rm i n ed by WSMAX ( a nd PROC S E C TCNT ) a nd the wo r k i ng s e t pa r am e t e r s ( PHD$W WS Q UOTA a nd PHD$W WSAUTH ) a r e m i n im i z e d w i th WSMAX . ( Th e c a l c u l a t i o n-o f the s i z e s o f e ach p i e c e o f t h e p r o c e s s h e a d e r a r e d e sc r i b e d i n Append i x E . ) I n t h e c a s e o f wo r k i ng s e t l i s t c o n t r a c t i o n , t h e wo r k i ng se t c a nno t b e contrac ted b e l o w M I NWSCNT (a S Y S B OOT p a r am e t e r ) . I n a d d i t i o n , the e x t r a d yn am i c wo r k i ng set s i ze ( P HD$W E XT DYNWS ) c a nno t b e r ed uc ed below z e ro . I f t h e PHD$W WS N EXT po i nte r l o c a t e s a n e n t r y b e yo nd the n ew e nd of t h e l i s t , i t i s re s e t to po i n t to the new end . If the r e are any val id entr ies i n t h e po r t i o n o f t h e l i s t th a t i s n o l o ng e r b e i ng u s ed ( b e twe e n t h e o l d a n d t h e n ew PHD$W WS LAST po i n t e r s ) , they a r e moved i n to the d yn am i c po r t i o n o f the l Ts t i n t o the a r e a l o c a t ed b y the PHD$W WSN E XT po i n t e r . ( Th e a t t empt to l oc a t e f r ee slots in wh i c h t o move a n y a c t i v e e n t r i e s c a n c a u s e t h e p r o c e s s t o b e pl a c ed i n to a r e so u r c e wa i t s t a t e , wa i t i ng f o r s pa c e i n th e pag e f i l e . ) 1 3 . 4 . 1 . 2 SET WORK I NG S E T Comm a nd - Th e S E T WORK I NG S E T c omm a n d a l l o ws t h e d e f a u l t wo r k i ng se t s i z e ( P HD$W D FWSCNT ) o r the wo r k i ng s e t quo t a ( P HD$W WSQUOTA ) to b e a l t e r e d a t the-c ommand l ev e l . Ne i th e r the q uo ta no r t he l i m i t can b e s e t to a v a l ue l a rg e r th a n the a u tho r i z e d uppe r l i m i t ( PHD$W_WSAUT H ) . • • I f t h e q uo t a i s a l t e r ed , i t c h a ng e s the uppe r l im i t fo r f u t u r e c a l l s to t h e Ad j u s t Wo r k i ng S e t L i m i t s ys tem s e r v i c e . I f the l im i t ( d e f a ul t s i ze ) i s a l te r ed , i t a f fects the wo r k i ng set l i s t r e s e t o pe r a t i o n pe r f o rmed by the r o u t i n e MMG $ I MG R E S E T i nv o k e d a s a r e s u l t o f i m a g e e x i t . I f the l i m i t i s s e t t o a v a l u e l a r g e r th a n the c u r r e n t quo t a , bo th the q uo t a a nd t h e l i m i t a r e a l te r e d to the new v a l u e . (Note that a u toma t i c wo r k i ng s e t ad j us tm e n t i s d i s a b l ed fo r a n y p r o c e s s th a t h a s i t s q uo t a a nd d e fa u l t ( l im i t ) set to t h e s am e va l ue . ) 1 3 . 4 . 1 . 3 Automa t i c Wo r k i ng S e t S i z e Ad j u s tmen t - I n add i t i o n to manual wo r k i ng s e t ad j u s tm e n t as a resul t of e x p l i c i t c a l l s to S YS $ ADJW S L or as a s i d e e f f e c t o f i m ag e e x i t , VM S a l s o p r ov i d e s a u toma t i c wo r k i ng s e t ad j u s tm e n t t o k e e p a p r o c e s s ' s pag e f a u l t r a t e w i th i n l i m i t s s e t by o n e o f s e v e r a l SYS B OOT pa r am e t e r s ( Ta b l e 1 3 - 2 ) . Al l o f t h e SYS B OOT p a r am e t e r s l i s t ed i n th i s t a b l e a r e d ynam i c a nd c an b e a l t e r e d w i tho u t r e boo t i ng t h e s ys t em . 1 3-1 2 M EMORY MANAG EMENT SYSTEM S E RVI C E S Tab l e l 3 - 2 P ro c e s s and S y s tem Paramet e r s U s ed b y Automatic Working S e t S i z e Adj u s tmen t s De sc r i pt i o n Lo c a t i o n o r Name Comments To tal amoun t of CPU t ime cha rged to th i s proce ss PHD$L_C PU T IM Upd a ted by h a r d wa r e c l o c k s e rv i c e r o u t i n e Amoun t o f CPU t ime when l a st ad j ustment took pl ace PHD$L_T IMREF Upd ated by quantum end ro ut i ne when ad j ustment check is made To tal number o f pag e faul ts fo r thi s pro c ess PHD$L_PAGEFLTS Upd ated each t ime th i s process i nc u r s a pag e faul t Number o f pag e fa ul ts when l ast ad j ustment took pl ace PHD$L_PF LREF Upd ated by quantum end r o ut i n e when ad j ustment check is made Mo st r ec ent pag e fau l t r ate fo r thi s process PHD$L_PFLTRATE Recorded but not used each t ime an ad j ustment chec k is mad e Amoun t o f CPU t ime tha t process mus t accumul a te b e fo re a pag e faul t r a te chec k i s mad e AWST IM E ( S ) Lowe r l im i t pag e faul t rate PFRATL ( S ) Amoun t by wh ich to d ec rease wo r k i ng se t s i ze WSDEC ( S ) Lowe r bound fo r dec r eas i ng wo r k i ng set s i ze AWSM IN ( S ) Uppe r l im i t pag e fa ul t r ate PFRATH ( S ) Amount by wh i ch to inc rease wo r k i ng set s i ze WS INC ( S ) D i sables a utomat i c adj ustment fo r enti re system i f zero Uppe r bound fo r d ec reas i ng wo r k i ng set s i ze AWSMAX ( S ) Do no t ad j ust i f PCB $W PPGCNT i s g reater than o r equal -to th i s val ue (S) Do no t adj ust i f PCB $W PPGCNT i s l ess than o r equal to-th i s val ue These va l ue s a r e SYSBOOT pa rame te rs . Th e a u toma t i c wo r k i ng s e t a d j u s tm e n t t a k e s p l a c e a s pa r t o f the q u a n t um end r o ut i n e ( Ch a p t e r 8 ) . Th i s i s a r e f l e c t i o n o f t h e f a c t th a t a p r o c e s s th a t c a nno t e x ec u t e f o r even a s i ng l e q u a n tum w i l l no t b e ne f i t f r om an i nc r e a s e d wo r k i ng s e t s i z e . ( No t e th a t no ad j us tm e n t t a ke s p l a c e f o r r e a l - t i m e p r o c e s s e s . ) Th e a d j us tm e n t t a k e s p l a c e in seve r a l steps . 1. I f t h e WS I NC pa r am e t e r i s s e t to zero , the ad j u s tm e n t d i s a b l ed o n a s y s tem-w i d e b a s i s s o n o t h i ng i s d o n e . is 2. I f t h e p r o c e s s d e f a ul t wo r k i ng s e t s i z e ( PH D $W D FWSCNT ) e qua l to i t s q uo t a ( PH D $W WSQUOTA ) , t h e n ad j us tm e n t d i s a b l ed f o r th i s p r o c e s s so , -a g a i n , no th i ng i s d o n e . is is 3. I f t h e p r o c e s s h a s n o t b e en e x e c u t i ng l o ng e n o ug h s i nc e the l a s t a d j u s tm e n t ( d i f f e r e n c e b e twe en a c c um u l a t ed C PU t i m e , PHD$ L C PU T I M , and t im e of l ast a d j us tmen t a t tempt , PHD$ L-T I M RE F , i s l e s s t h a n th e SYSB OOT pa r am e t e r AWS T IM E ) , no a d j u stm e n t i s d o ne a t th i s t ime . If the process has a c c um u l a ted e no ug h C PU t i m e , t h e r e f e r e n c e t i m e i s upd a t ed ( P HD$ L C PUT IM i s l o ad ed i n to PHD$ L_T I M REF ) and the r a te c h e c k s- a r e m a d e . 1 3-1 3 MEMORY MANAGEMENT SYSTEM S E RVI C E S 4. Th e c u r r e n t pa g e f a ul t r ate i s c a l c ul a t e d . Th e g u i d i ng ph i l o s o ph y t o t h e a u toma t i c wo r k i ng s e t ad j us tm e n t c o n s i s t s o f two p i e c e s . I f t h e pag e f a u l t r a t e i s to o l o w , t h e s ys tem c an bene f i t f r om a sm a l l e r wo r k i ng s e t s i z e ( b e c a u s e m o r e phys i c a l pag e s b e c o m e a v a i l a b l e ) w i tho u t h a r m i ng t h e p r o c e s s ( by c a us i ng i t t o i n c u r m a n y pag e f a u l t s ) . I f the pag e f a u l t r a te i s too h igh , the p r o c e s s c a n b e n e f i t f r om a l a rg e r wo r k i ng set s i ze ( by i n c u r r i ng f e we r faul ts ) wi tho u t d eg r ad i ng t h e s ys t e m . • • 5. I f t h e c u r r e n t pag e f a u l t r a t e i s t o o h i g h ( g r e a t e r th a n or equa l to PFRATH ) , t h e wo r k i ng s e t i s i n c r e a s e d ( by WS I NC ) . Ho wev e r , i f t h e c o n t e n t s o f PC B $W P PG C NT a r e g reater than o r e q ua l t o AWSMAX , n o ad j ustmen t t a k e s pl a c e . Th e a s s um p t i o n b e i ng m a d e h e r e is th a t the p r o g r am is not we l l b eh a v ed (makes many nonloc a l i zed ad d r e s s r e f e r e n c e s ) a nd w i l l p r o ba b l y n o t b e n e f i t f r om a n y mo r e wo r k i ng s e t . Th e s ys t em w i l l c e r t a i n l y s u f f e r by l o s i ng s t i l l m o r e phys i c a l m em o r y to th i s p r o c e s s . I f t h e c u r r en t pag e f a u l t r a t e i s t o o l o w ( s t r i c t l y l e s s than PFRATL ) , t h e wo r k i ng s e t i s d ec r e a s ed ( by WSDEC ) . Howe v e r , i f t h e c o n t e n t s o f PC B $W P PGCNT a r e l e s s t h a n o r Th i s d e c i s i o n equal AWSM I N , n o a d j u s tm e n t t a kes p l a c e . i s b a s e d o n t h e a s s umpt i o n th a t m a n y o f t h e pag e s i n the wo r k i ng set a r e g l obal pag e s a n d th e sys tem w i l l no t b e n e f i t ( a nd t h e p r o c e s s m a y s u f f e r ) i f the wo r k i ng set i s d ec r ea sed . Th e a c t u a l wo r k i ng s e t a d j u s tm e n t is a c c ompl i s hed by a r eg u l a r k e r n e l AST t h a t e x e c u t e s a n Ad j u s t Wo r k i ng S e t s ys t em s e rv i c e . Th e AS T p a r am e t e r pa s s e d to t h i s AST i s t h e a m o un t o f p r e v i o us l y d e t e rm i n ed i n c r e a s e o r d e c r e a s e . Th i s s t ep i s r e q u i r ed b e c a u s e t h e s ys t em s e r v i c e m u s t b e c a l l ed f r om p rocess context (at I PL 0 ) and t h e qua n t um end r o u t i n e i s e x e c u t i ng i n r e s po n s e t o the I P L 7 s o f twa r e t i m e r i n t e r r up t . 13.4. 1 . 4 Pu r g e Wo r k i ng S e t S y s t em S e r v i c e - Th e Pu r g e Wo r k i ng Set s ys t e m s e rv i c e r e q ue s t s tha t all v i r t ua l pag e s i n t h e s p e c i f i ed a d d r e s s r a ng e th a t h a ppen t o b e i n the wo r k i ng s e t b e r em o v e d f r om t h e wo r k i ng s e t . A p r og r am co u l d u s e t h i s s e r v i c e i f i t r e c og n i z ed t h a t a c e r ta i n set of r o ut i n e s o r d a ta we r e no l o ng e r r e q u i r ed . By v o l un t a r i l y r em ov i ng entr i es f r om t h e wo r k i ng set , a process can e x e r c i s e a l i tt l e control ove r t h e wo r k i ng set l i st r e p l a c em e n t a l g o r i thm , i n c r e a s i ng t h e c h a n c e s fo r f r eq u e n t l y u s ed pag e s t o r em a i n i n t h e wo r k i ng s e t . VM S u s e s th i s s e r v i c e a s pa r t o f the i mag e s t a r t u p s e quenc e ( Ch a pt e r 1 8 ) to i nsure t h a t a p r og r am s t a r t s i t s e x e c u t i o n w i tho u t unn e c e s s a r y p a g e s s uc h a s C L I c o mmand p r o c e s s i ng r o u t i n e s i n i t s wo r k i ng s e t . 13. 4. 2 Lo c k i ng a n d Un l o c k i ng P a g e s Fo r t i me c r i t i c a l a pp l i c a t i o n s a nd o th e r s i t ua t i o n s wh e r e a p r og r am wi s h e s to a c c e s s c o d e o r d a t a wi tho u t i n c u r r i ng a pag e f a u l t , s ys t em s e rv i c e s a r e p r ov i d ed to l o c k pag e s i n to the p r o c e s s wo r k i ng set o r i n to m em o r y . 1 3-14 M EMORY MANAG EMENT SYS TEM SERVI C ES 13. 4.2. 1 Lo c k i ng Pag e s i n the Wo r k i ng Se t - A s e t o f v i r t ua l pag e s c a n b e l o c ked i n to t h e p r o c e s s wo r k i ng s e t t o p r e v e n t pa g e f a u l t s f r o m o c c u r r i ng o n r e f e r e n c e s t o the s e pag e s . Th i s g ua r an t e e s th a t wh e n th i s p r o c e s s is e x e c u t i ng ( i s t h e c u r r e n t p r o c e s s ) , t h e s e pag e s a r e a l wa ys i n the p r o c e s s wo r k i ng s e t . I n a d d i t i o n to the o bv i o u s b e n e f i t of th i s serv i c e , i t c a n a l s o b e u s e d by r o u t i n e s th a t e x e c ute a t e l ev a ted I PL ( a b o v e I PL 2 ) bec a u s e VM S d o e s n o t a l l o w pag e f a ul ts to occu r a bo v e I PL 2. Th e r e i s no i mp l i c a t i o n t h a t the s e pag e s r ema i n r e s i d e n t wh en t h e p r o c e s s i s n o t c u r r e n t b e c a u s e the e n t i r e wo r k i ng se t c an be o u t s wa pped . ( Re s i d e n c y i s gua r anteed by e i th e r a c omb i n a t i o n o f th i s s ys t e m se r v i c e a nd the Set Swa p Mo d e s ys t e m se r v i c e o r by u s i ng t h e Lo c k Pag e s i n Memo r y sys t em se rv i c e . ) Al l pag e s i n the s pe c i f i ed r ang e a r e f a u l ted i n t o t h e wo r k i ng set if they a r e not a l ready val id . Th e wo r k i ng s e t l i s t ( F i g u r e 1 1 - 4 ) mus t be r eo r g a n i z e d s o th a t the l o c k e d pag e s a ppe a r i n t h e l i st f o l l o w i ng Th i s i s a c c ompl i shed by e x c h a ng i ng the l o c k e d the WSLOC K po i n te r . WS L E wi t h t h e e n t r y po i n t e d to by WSDYN , a nd then i nc r emen t i ng WSDYN t o po i n t t o the n e x t e l em e n t i n the l i s t . Th e WS LX PFN a r r a y e l em e n t s fo r t h e two v a l i d p ag e s m u s t a l s o b e e x c h a ng ed . In add i t i on , the WS L $ V_WS LOCK b i t i s s e t i n t h e wo r k i ng s e t l i s t en t r y . A c h e c k i s m a d e to i n s u r e tha t t h e p r o c e s s wi l l be l e f t w i th e no ug h d yn a m i c wo r k i ng s e t a f t e r the s p e c i f i ed numb e r o f pag e s a r e l o c k ed . Eno ug h d yn am i c wo r k i ng s e t m e a n s t h a t t h e e x t r a d yn am i c wo r k i ng set s i ze , t h e s i ze of t h e d y n am i c wo r k i ng s e t a f t e r s pa c e h a s b e e n a l l o c a t ed fo r pag e t a b l e p ag e s a nd a m i n i m um wo r k i ng set s i ze , is g reater than zero . ( L i k e mo s t o f the mem o r y manag em e n t s ys tem s e rv i c e s , th i s s e r v i c e c a n pa r t i a l l y s uc c e ed . In th i s case , the add r e s s r ang e tha t is a c t ua l l y l o c k e d is r e t u r ne d to the c a l l e r by m e a n s of t h e R E TADR a r g um e n t . ) Wh e n a p r o c e s s i s b e i ng o u t swa pped , g l o ba l r e a d /wr i t e pag e s a r e d r o pped f r om t h e p r o c e s s wo r k i ng s e t ( Ch a pt e r 1 4 ) t o avo i d c umbe r so m e a c c o u n t i ng p r o b l em s a b o u t wh e t h e r t h e o u t swa pped pag e c o n t a i n s the mo s t up- to -d a t e i n fo rma t i o n . Fo r th i s r e a so n , g l oba l r e a d /wr i t e pag e s c a nno t b e l oc k e d i n to the p r o c e s s wo r k i ng s e t . ( S u c h pag e s c a n b e loc ked i n to m emo r y b e c a u s e t h e Lo c k Pag e s i n Mem o r y s y s t em s e r v i c e p r e v e n t s o u t s wa p o f e i th e r the p r o c e s s h e a d e r or the loc ked pag e s , a vo i d i ng t h e swa pp i ng s i t u a t i o n a l t og e th e r . ) Th e swa ppe r a l s o pe r fo rm s a n o p t i m i z a t i o n w i t h g l ob a l r e ad - o n l y pag e s b y d r o pp i ng them f r om th e wo r k i ng s e t o n o u t s wa p i f t h e g l o b a l s h a r e c o un t i s l a rg e r th a n o n e . I f s uc h pag e s a r e l oc ked i n to the wo r k i ng s e t , t h e y a r e no t d r o pped f r om t h e wo r k i ng s e t , i nd e p e nd e n t of t h e c o n t e n t s o f the PFN S HRCNT a rray . 13. 4 . 2. 2 Lo c k i ng Pag e s i n Memo r y - Th e Lo c k Pa g e i n Memo r y s ys tem s e rv i c e i s s i m i l a r t o the Lo c k Pa g e in the Wo r k i ng Set s e r v i c e e x c e p t tha t the WS L $ V PFNLOCK b i t i n the WS LE i s s e t a nd t h e p r o c e s s h e a d e r is l o c k ed i n to m em o r y . Th i s s e r v i c e p e r f o rms a n i m p l i c i t wo r k i ng se t l o c k i n add i t i o n t o g ua r a n t e e i ng pe rma n e n t r e s i d e nc y to the spec i f i ed v i r t ua l add r e s s r a ng e . Bec ause t h i s o pe r a t i o n i s pe r m a n e n t l y a l l o c a t i ng a s ys tem r e so u r c e , phys i c a l m emo r y , i t r e q u i r e s a pr i v i l eg e ( P SWAPM ) • 1 3-1 5 MEMORY MANAG EMENT S Y S TEM S ERVI C E S 1 3 . 4 . 2 . 3 Un l oc k i ng P a g e s - Th e c o nve r s e o f e i th e r o f t h e two l o c k i ng s e r v i c e s un l o c k s pag e s f r om e i th e r the wo r k i ng s e t o r phys i c a l memo r y . I n ad d i t i o n , t h e wo r k i ng s e t l i s t e n t r i e s m a y h a v e to b e e x c h a ng ed w i th o t he r l oc ked e n t r i e s to pl a c e t h e u n l o c k e d e n t r i e s b a c k i n to the d yn am i c po r t i o n of t h e l i s t . As w i th the e x c h a ng e a s s o c i a t e d w i th l o c k i ng pag e s , t h e WS LX P FN a r r a y e l em e n t s m u s t a l s o b e e x c h a ng ed . F i na l l y , t h e a pp r o p r i a t e b i t in the WSLE ( WS L $V WS LOCK or WS L$V_PFNLOC K ) i s c l e a r e d . 13. 4. 3 P r o c e s s Swa p Mo d e A p r o c e s s w i th PSWAPM p r i v i l eg e c a n p r ev e n t i t s e l f f r om be i ng r em o v ed f r om mem o r y . Th i s service s i mpl y s e t s t h e PC B $ V PSWAPM b i t i n the s t a t u s l o ng wo r d ( PC B $ L S TS ) in t h e so f twa r e PC B . When t h e swa ppe r is s e a r c h i ng f o r s u i t a b l e-o u t s wa p c a nd i d a t e s , p r o c e s s e s wi th th i s b i t s e t a r e pa s s ed o v e r . 13. 4.4 Al t e r i ng Pag e P r o t e c t i o n I t i s po s s i b l e fo r a p r o c e s s to a l t e r the pag e p r o t e c t i o n o f a s e t o f pag e s in i ts add r e ss r a ng e w i th the S e t P r o t e c t i o n o n Pag e s s ys t em s e r v i c e ( $ S E T PRT ) . I n g e ne r a l , t h e o pe r a t i o n o f th i s service is s t r a i g h t fo r wa rd . Ho weve r , t h e r e i s o n e i n t e r e s t i ng s i d e e f f e c t . If a s e c t i o n pag e f o r a r ea d - o n l y s e c t i o n h a s i ts protec t i o n set to wr i t a b l e , the c o py-on- r e f e r e n c e b i t i s s e t . Th i s w i l l fo r c e the pag e to h a v e i t s b a c k i ng s t o r e add r e s s c h ang ed to t h e pag e f i l e wh e n the pa g e is f a u l ted , p r e v e n t i ng a l a te r a t t empt to wr i t e the mo d i f i ed s e c t i o n pag e s b a c k to a f i l e to wh i c h t h e p r o c e s s m a y b e d e n i e d wr i t e access . Th e s ymbo l i c d e b ug g e r u s e s th i s s e r v i c e to i m pl em e n t i t s wa t c h po i n t f a c i l i ty . Th e pa g e c o n t a i n i ng t h e d a t a e l em e n t i n que s t i o n i s s e t to no wr i t e a c c e s s fo r u s e r m o d e . Wh en the p r og r am a t temp t s to access t h e pag e , an access v i o l a t i on occur s , wh i c h is f i e l d ed by the d eb ug g e r ' s c o nd i t i o n h a nd l e r . Th i s h a nd l e r 1. is the add r e s s c h e c k s wh e t h e r t h e i na c c e s s i b l e wa t c hed and r e po r t s t h e m o d i f i c a t i o n i f i t i s , 2. pa g e sets the mod i f i c a t i o n , 3. s e t s the TB I T i n the PS L to g i v e t h e d e b ug g e r the i n s t r uc t i o n c ompl e t e s , 4. a n d d i sm i s s e s t h e e x c e pt i o n . pro tec t i o n to PRT $ C UW to one b e i ng al low the control after Wh e n t h e i n s t r uc t i o n c ompl e t e s , t h e d e b ug g e r ' s TB I T h a nd l e r g a i n s control , s e ts the pag e p r o t ec t i o n b a c k t o no wr i t e a c c e s s fo r u s e r mod e , a nd a l l o ws t h e p r og r am t o c o n t i n ue i t s e x e c u t i o n . 1 3 -1 6 C HAPTER 1 4 SWA P P I NG VA X/VM S d o e s n o t a l l o w t h e a m o un t o f phys i c a l memo r y to to ta l l y l i m i t the n um b e r o f processes a l l o we d i n the s ys tem . Ph ys i c a l m emo r y i s e f f e c t i v e l y e x tend ed b y k e e p i ng o n l y a s u b s e t o f t h e to t a l n um b e r of a c t i ve p r oc e s s e s r e s i d ent a t a g i ven t ime . Th e r em a i n i ng p r o c e s s e s r e s i d e i n b ac k i ng s t o r e l o c a t i o ns . Th e movemen t o f l ow pr i o r i ty processes to b a c k i ng s t o r e a nd t h e s ub s e q u e n t f i l l i ng o f memo r y w i th h i g h p r i o r i t y c omp u t a b l e processe s i s the r e s po n s i b i l i t y o f the s wa ppe r . 14. 1 SWAPP I NG OVERV I EW B e f o r e we d i sc u s s t h e d e t a i l s o f swa ppe r o pe r a t i o n wh i c h i nv o l v e s m o v i ng a process i n to or o u t o f m emo r y , we w i l l r e v i e w s ome b a s i c s wa ppe r conc e pt s . We w i l l a l s o po i n t o u t t h e spec i f i c u s e s o f e a c h o f t h e m emo r y m a n ag em e n t d a ta s t r uc t u r e s m a n i pu l a t ed b y the swa ppe r . 14. 1.1 Swa pp e r Re s po n s i b i l i t i e s Th e swa ppe r h a s two m a i n r e spon s i b i l i t i e s . • Th e s u b s e t o f p r o c e s s e s t h a t a r e c u r r e n t l y r e s i d e n t s h o u l d represent th e h i g h e s t p r i o r i t y e x e c u t a b l e p r o c e s s e s i n the s y s t em . Wh e n no n r e s i d e n t p r o c e s s e s b e c om e c ompu t a b l e , the s wa ppe r mus t b r i ng them b a c k i n to m emo r y . • Th e swa ppe r i s a l s o r e s po n s i b l e fo r k e e p i ng t h e n um b e r of pag e s o n the f r ee pag e l i s t above the l o w l i m i t th r e sho l d e s t a b l i s h e d b y t h e SYS B OO T pa r ame t e r FRE E L I M . Re qu e s t s for phys i c a l pag e s c om e f r om s e v e r a l s o u r c e s . On e r e que st c om e s f r om t h e pag e r i n r e s o l v i ng a pag e f a u l t fo r a pag e th a t is not cur rentl y i n m emo r y . An o th e r o r ig i na tes wi th the swa ppe r ' s a t t empt i ng to a c q u i r e e n o ug h ph ys i c a l pag e s to i n s wa p a c ompu t a b l e but o u t swa pped p r o c e s s . Th e r e a r e th r e e o pe r a t i o n s t h a t t h e swa ppe r pe r fo rm s t o ful f i l l th i s r e spon s i b i l i t y . 1. P r o c e s s h e ad e r s o f pr ev i o u s l y o u t swa pped process bod i es may be el ig i ble f o r o u t swa p . ( Process headers for a l r e a d y d e l e t e d p r o c e s s e s a r e s i mpl y d e l e t ed . ) 1 4-l SWAPPING 14. 1 . 2 2. Th e swa ppe r w i l l wr i t e m od i f i ed pag e s unt i l t h e n um b e r o f pa g e s o n t h e mo d i f i ed l i st f a l l s b e l o w the l ow l im i t th r e sho l d s t o r e d i n g l o b a l l o c a t i o n S C H $G L_MFYLOL I M . 3. As a l a s t r e s o r t to m a i n t a i n i ng t h e s i ze o f t h e f r e e pag e l i st , the s wa ppe r wi l l s e l e c t a n e l i g i b l e p r o c e s s fo r o u t s wa p a n d r emove t h a t p r o c e s s f r om memo r y . Swa ppe r I mp l em e n t a t i o n Th e swa ppe r i s a s e pa r a t e p r o c e s s i n VAX/VM S . A s s uc h , i t can be f o r e x e c u t i o n j u s t l i ke a ny o th e r p r o c e s s i n t h e s ys tem . It s e l e c t ed a l s o h a s i t s own r e s o u r c e s a nd q uo t a s t h a t a r e c h a r g ed wh e n the swa ppe r d o e s I /0 . By m a k i ng t h e swa ppe r a s e pa r a te p r o c e s s , t h e p i e c e s o f the s ys t em th a t d e tec t a n e ed fo r o n e o f t h e s wa p pe r ' s d u t i e s s i mpl y h a v e to wa k e t h e swa ppe r u p { by i s s u i ng a J S B t o r o u t i n e S C H $ SWPWAKE ) . A s a l r ea d y no ted i n Ch a p t e r 8 , th i s r o u t i n e d o e s n o t s i mp l y wa ke t h e swa ppe r . I n s t e a d , i t pe r f o rms a s e r i e s o f c h e c k s to d e te r m i n e wh e th e r t h e r e is a n e ed fo r s wa ppe r a c t i v i ty . I f s o , t h e swappe r pr o c e s s i s awa k e n ed . I f n o t , t h e r o ut i n e s i mpl y r e t u r n s . By p e r fo rm i ng these checks in th i s r o ut i n e r a th e r than i n t h e s wa ppe r p r o c e s s i t s e l f , t h e ov e r h e a d o f t wo n e e d l e s s c o n t e x t s w i t c h e s i s a v o i d ed . Wh e n the swa ppe r i s the c u r r en t process , it executes ent i rel y in k e r ne l mode . Al l o f t h e swa ppe r c o d e r e s i d e s i n sys t em s p a c e . { Th e swa p pe r m a k e s u s e o f i t s P O s pa c e wh e n it s wa ps a n e wl y c r e a t ed process f r om mod ul e S H E L L in the e x e c ut i v e i m ag e . Th i s o pe r a t i o n i s d e sc r i b ed i n Ch a p t e r 1 7 . ) 14. 1 . 3 Compa r i s o n o f Pag i ng and Swapp i ng VM S u s e s two d i f f e r e n t t e c h n i q ue s to m a k e e f f i c i e n t u s e o f av a i l a b l e phys i c a l m emo r y . Th e a b i l i t y t o s uppo r t p r o g r am s wi th v i r t ua l a d d r e s s s pa c e s l a rg e r t h a n ph ys i c a l memo r y i s t h e r e s po n s i b i l i t y o f t h e pag e r . Th e s wa ppe r a l l o ws a r un n i ng s ys t em to s uppo r t mo r e a c t i v e p r o c e s s e s than c an fit i n to phys i c a l m emo r y a t o n e t i me . Th e swa ppe r ' s r e spons i b i l i t i es a r e mo r e g l o b a l o r s ys tem w i d e t h a n t h e pag e r ' s . Ta b l e 1 4 - 1 c ompa r e s a nd c o n t r a s t s the pag e r a nd swa ppe r i n seve r a l d e ta i l s . 14. 2 SWAP S C HEDUL ING Th e swa ppe r i s a pa r t o f the s ys t em t h a t pe r fo rms b o th m emo r y m a n a g em e n t a nd s c h e d ul i ng f unc t i o n s . Th e s c h e d u l i ng a s pe c t s o f the swa p pe r a r e d i sc u s s ed f r om two po i n t s o f v i e w . Fi r s t , the ac t i ons that the s wa ppe r takes to d e te r m i n e wh e th e r t o i n swa p o r o u t s wa p a pa r t i c u l a r p r o c e s s a r e d i sc u s s e d . Th e n , those s ys t em e v e n t s th a t t r i g g e r s wa ppe r a c t i v i t y a r e m e n t i o n ed . 1 4-2 SWA P P I NG Ta b l e Co m pa r i so n o f 1 4 -1 Pag i ng and Swa pp i ng D i f f e r enc e s P a g i ng Swa pp i ng Pag i ng s uppo r t s p r o g r am s wi th v e r y l a rg e ad d r e s s s pa c e s . Swa ppi ng s uppo r t s a l a rg e n um b e r o f c o nc u r r en t l y a c t i v e processes . Pr o c e s s wi d e c ompo n en t o f tha t ex ec u t i v e i n to a nd out wo r k i ng s e t s . The pag e the Sys t em wi d e c om po n e n t m ov e s pag e s of proc ess f a u l t h a nd l e r is e x ec ut i v e tha t proc esses i n to p h ys i c a l m emo ry . Th e an swa ppe r of the mov e s enti re and out of is a s e pa r a t e e x c ept i o n s e rv i c e r o u t i n e t h a t e x e c u t e s i n t h e c o n t ex t o f the p r o c e s s t h a t i n c u r r ed t h e pa g e fa ul t . pr o c e s s t h a t i s a wa k e n ed f r om h i b e r na t i ng s t a te i ts by c ompo n en t s t h a t d e te c t a n e ed f o r s wa ppe r ac t i v i t y . The un i t of pag i ng is the a l tho ug h t he pag e r pag e , a t t empt s t o r ea d mo r e t h a n o n e pag e wi th a s i ng l e d i s k r e ad . Th e un i t o f s wa pp i ng is the proc e s s (or mo r e ac c u r a t e l y , the p r o c e s s wo r k i ng s e t ) . Pag e r e ad r e q u e s t s fo r p r o c e s s pa g e s a r e q u e u e d to t h e d r i v e r ac c o rd i ng t o t h e b a se p r i o r i t y Swa ppe r I /0 r e que s t s are q u e ued a c c o rd i ng t o t h e v a l u e pa r am e t e r t he SYSB OOT of SWP PR I O . of the p r o c e s s i nc u r r i ng the pa g e faul t . Mo d i f i ed pag e wr i t e r eque s t s a re q u e ued acco rd i ng the S Y S B OOT to pa r am e t e r M PW_PR I O . Simi l a r i ties (1) The pa g e r a nd s wa ppe r wo r k f r om a c ommo n d a ta b a se . i m po r t a n t s t r uc t ur e s that a re u s ed fo r both swa ppi ng a r e the p r o c e s s pag e t a b l e s , the wo r k i ng a nd t h e PFN d a t a b a se . Th e mo s t pag i ng and set l i st , (2) Th e pag e r a nd s wa ppe r d o c o nv e n t i o n a l I /0 . Th e r e are onl y sl ight d i f f e r e nc e s in d e ta i l b e t we e n pag e r I /O a nd swa ppe r I /0 on the o n e hand a nd no rm a l Q u e ued I /0 r e que s t s on the o the r . (3) Bo th c ompo n en t s a t t empt to m a x 1m 1 z e the n um b e r o f b l oc ks r e ad or wr i t t e n w i th a g i v en I /O r e que s t . Th e pag e r a c c ompl i sh e s t h i s w i th r e ad a nd wr i t e c l us t e r i ng . Th e swa ppe r a t t empt s to i n swa p or n um b e r o f ) o u t s wa p the e n t i r e I /O r e que s t ( s ) . wo r k i ng 1 4 -3 set in one (or a sm a l l SWAPPING S e l e c t i o n o f I n swap C a nd i d a te 14. 2. 1 Th e s c h ed u l e r m a i n ta i n s 3 2 q u a d wo r d l i s th e a d s fo r o u t swa pped c ompu t a b l e ( C OMO ) processes , one fo r e a c h s o f t wa r e p r i o r i t y Th e s e q u e u e s a r e i d e n t i c a l to the 3 2 q u e u e s m a i n t a i ned ( Fi g u r e 8 - 3 } . for t h e c om p u t a b l e r es i d ent ( C OM } processes . Th e s t eps tha t the s wa ppe r t a k e s to l o c a t e an i n swa p c a nd i d a t e ( o n c e i t has d e c i d ed tha t an i n swa p c a n b e pe r f o r m e d ) e x a c t l y pa r a l l e l the s t eps tha t the r e s c h ed u l i ng i n te r r up t s e r v i c e r o u t i n e t a k e s ( Ch a p t e r 8 ) to se l ec t the n ex t c a nd i d a t e f o r e x ec u t i o n . 1. the C OM O queue s umm a r y l o ng wo r d A FFS i n s t r uc t i o n o n the h i g h e s t p r i o r i ty no n empty C OMO ( S C H$G L_C OM O QS ) l ocates q u e ue . 2. Th e f i r s t p r o c e s s i n th i s que ue i s r em o v e d and b e i ng s wa pped i n to memo r y . p r e pa r ed fo r F i g u r e 1 4 - 1 s hows t h e p a r a l l e l b e t we e n the i n swa p c a nd i d ate se l ec t ion a nd t h e o pe r a t i o n o f t h e r e s c h ed u l i ng i n te r r up t s e r v i c e r o u t i n e . Th e key i n s t r uc t i o n s in the two r o u t i ne s a r e i d ent i c a l . Th e o n l y d i f f e r e nc e s a re in the g lobal d a ta i tems r e f e r en c ed b y the i n s t r uc t i o n s . A f t e r a p r o c e s s h a s b e en c h o s e n f o r i n swa p , the s wa ppe r chec ks if the r e a re e no ug h pag e s o n the f r ee pag e l i s t to ho l d the i n s wa p c a nd i d a t e a nd l e a v e a t l e a s t FRE E L I M pag e s r em a i n i ng o n the l i s t . If so , the i n swa p p r o c e ed s . I f no t , t h e s wa ppe r a t temp t s t o m a k e mo r e pag e s a v a i l a b l e b y o u t swa pp i ng o n e o r mo r e p r o c e s s e s , wr i t i ng mod i f i ed p ag e s , o r d e l e t i ng p r o c e s s h e ad e r s o f a l r e a d y d e l e t ed p r o c e s s bod i e s . Th e r e i s o n e o p t i m i z a t i o n t h a t the swa ppe r pe r f o r m s tha t m a y p r ev e n t a n o u t swa p . Th e swa ppe r onl y i n swa ps c om p u t e bo und l o w p r i o r i t y p rocesses a t a r a t e d e t e r m i n ed by the s pe c i a l SYSB OOT pa r am e t e r SWPRA T E . Th e d e f i n i t i o n of s uc h a proc ess i s o n e who s e c u r r e n t p r i o r i t y i s e q ua l t o i t s b a se p r i o r i t y , wh i c h p r i o r i t y i s l e s s t h a n o r e qua l t o t h e SYS B OOT p a r am e t e r DEFPR I . If • t h e swa ppe r i s a t t em p t i ng t o i n swa p s uc h a p r o c e s s , • and t h e p r o c e s s w i l l no t f i t , • and t h e SWPRATE i n t e rv a l h a s n o t ye t e x p i r ed , the i n swa p a t t empt is a bandoned . Ea c h t ime tha t the swa ppe r s uc c e s s f u l l y i n swa ps o n e o f t h e s e s o - c a l l ed c r un c h e r p r o c e s s e s , i t r e s e t s i t s i n swa p c l oc k t o c o n t a i n the c u r r e n t t i m e pl us SWPRATE . 14. 2. 2 S e l ec t i o n o f O u t swa p C a nd i d a t e s Wh e n t h e swa ppe r d e t e rm i n e s t h a t i t m u s t o u t s wa p a p r o c e s s ( e i th e r to f r ee up phys i c a l pag e s o r to make r o om fo r a h i g h e r pr i o r i t y c ompu t a b l e b u t o u t swa pped p r o c e s s ) , i t m u s t s e l ec t s uc h a proce ss . Th e o rd e r i n wh i c h po t e n t i a l o u t swa p c a nd i d a t e s a r e e x am i n ed a t t em p t s t o r em o v e f i r s t t ho s e p r o c e s s e s tha t b e n e f i t the l e a s t f r om r em a i n i ng r e s i d en t . 1 4-4 The f i r s t ha l f o f The r o ut i n e SCH$SCHE D t ha t sel ec ts the n e x t e x ecut i o n c and i d a te ha s an ex ac t pa r a l l el in the swappe r . the pa r a l l el shows t he swa ppe r ' s s e l ec t i o n o f the n ex t i n swa p c and i d a te a nd the n e a r l y i d en t i c a l i n s t r uc t i o n s i n the schedul e r . Swa ppe r ' s Se l ec t i o n o f Inswa p Cand i d a te QEM PTY : B UG C HECK QUE UEM PTY , FATAL SWAPS C HE D : DSB INT BBSS FFS BNEQ BBCC ENB INT 5$ : RSB 10$: .... .b I U"1 No t e s PUSHR M OVA Q MOVL CMPB BNEQ U PL $ S YNCH S A t SCH$V S I P , WA SC H $GB S I P , S $ t O , t 3 2 , W�SC H $G L C OMOQS, R2 1 0$ S A t S C H$V_S I P , WA SCH$GB_S I P , 5 $ t A M <R 6 , R7 , R8 , R 9 , R l 0 , R l l , AP , F P > WA SCH$AQ C OM OH [ R 2 ] , R 3 (R 3 ) , R4 tDYN $C PCB , PC B $8 TYPE ( R 4 ) QEM PTY- (1) Sc hed ul e r ' s Se l ec t i o n o f Ex ecut i o n Cand i d a te S C H $ I DLE : S ET I PL MOVB BRB I I PL $ S C HE D 1 3 2 , W�SC H$GB PR I SCH$SC HE D SCH$SCHED : : S ET I PL U PL $_S YNC H (2) FFS B E QL f O , f 3 2 , WA SC H $G L C OM QS , R 2 S C H $ I DLE (3) MOVAQ R EM QUE WA SCH$A Q C OM H [ R 2 ] , R 3 @ ( R 3 ) + , R4 (4) It then t a k e s t he s t e ps n ec e ssa r y to b r i ng th i s p r o c e s s i n to At t h i s po i n t , t h e swa ppe r h a s fo und an i n swa p c a nd i d a te . memo r y . Th e s c hed ul e r , on the o th e r hand , c o n t i n u e s e x ec ut i o n . Th e REM QUE i n s t r uc t i o n shown above fo r the sc hed u l e r i s d upl i c a ted b e l o w to em ph a s i ze tha t , wh i l e a l ong t i me e l a ps e s b e twe en i n swa p c and i d ate se l ec t i o n and compl e t i o n o f the i n swa p , t h e r e is no t i me l a pse fo r ex ec u t i o n se l ec t i o n . (1) I PL i s r a i sed to SYNC H to sync h r o n i ze acc e ss to the sc hed ul e r ' s d a ta b a s e . (2) Th e h i g h e s t pr io r i t y ( c omputa b l e b u t o u t swa pped/computa b l e ) (3) Th e add r e s s o f i t s fo rwa r d po i n t e r i s l o ad ed i n to R 3 . (4) Th e add r e s s o f t h e sel ec ted PCB i s l o ad ed i n to R 4 . que ue i s s e l ec ted . ( continued o n next page ) F i g u r e 1 4 -1 Pa r a l l e l s Be twe e n I n swa p C a nd i d a t e S e l e c t i o n by t h e Swa ppe r a nd E x e c u t i o n Cand i d a t e S e l e c t i o n by t h e S c h e d u l e r Som e t i m e l a t e r , t h e i n swa p o pe r a t i o n c ompl e te s . The swa ppe r r eb u i l d s t h e wo r k i ng se t l i s t and the proc e s s pag e t a b l e s . Th e pa r a l l e l r e s um e s wh en the swappe r c a l l s t h e s c hed u l e r to m a ke the n ewl y i n swapped pr o c e s s c ompu t a b l e . Sta t e Ch a ng e f r om C OM O t o C OM No t e s S t a te Ch ang e f r om Compu t ab l e t o Cu r r en t S C H $ S C HE P : 5$: 1 0$ : I-' � I 0'\ 30$: 40$: (5) R EM QUE ( R 4 ) , Rl BNE Q M OVZW L BBC M OVZ B L B LB C ADDL B BCC M OVB MOVL . 10$ PC B $W S TATE ( R 4 ) , R l R l , E XES TATE , l O $ PC B $ B P R I ( R 4 ) , R l PC B $W-S TATE ( R 4 ) , 5 $ # 3 2 , Rl R l , W"" SC H$G L C OM QS , 1 0 $ R O , PC B $B PRI ( R 4 ) # S C H $C_COM , R l M OVW MOVAQ BBSS I N S QUE RSB R l , PC B $W S TATE ( R 4 ) L "" S C H $A Q-COMT [ R O ] , R l R O , W"" SC HGL C OM QS , 4 0 $ ( R 4 ) ,@ ( R l ) + R EM QUE BVS BNE Q @ ( R 3 ) + , R4 QEM PTY 20$ B B CC R 2 , W"" SC H $G L_C OM QS , 2 0 $ CM PB BNE Q iDYN $C PC B , PC B $8 T Y PE ( R 4 ) QEM PTY- (8) M OVW # S C H $C_C UR , PC B $W_S TATE ( R 4 ) �"'0 (9) MOVL R 4 , W"" SC H $G L_C UR PC B G') (6) (7 ) 20$ : At t h i s po i n t , t h e pa r a l l e l e nd s . I f t h e p r o c e s s j us t m a d e c o m pu t a b l e i s o f h i g h e r pr i o r i ty ·than the swa p pe r , tha t process wi l l be s c h e d u l ed as s o o n a s t h e I PL i s l o we r ed b e l o w 3 a n d t h e r e sc hed u l i ng i n te r r up t o c c u r s . I n o the r c a s e s , t h e p r o c e s s w i l l n o t e x e c u t e u n t i l i t b ec om e s t h e h i g he s t pr i o r i t y c om p u t a b l e p r o c e s s . Th e sched u l e r ' s s e r v i c e rout ine c o n t i n u e s i t s o pe r a t i o n , p l ac i ng t h e s e l e c ted p r o c e s s i n to ex e c u t i o n . (5) Rem o v e the s e l ec t ed PC B f r om i t s fo rm e r s t a t e ( C OM O/ C OM ) . (6) B i a s Rl so tha t i s po i n t s to SC H $G L C OM O QS , t h e s umma r y l o ng wo rd fo r the c o m pu t a b l e b ut o ut s wa pped state . ( Th i s i s n o t a pa r a l l e l s t ep b u t i s m e r e l y no ted so t h e BBCC i n s t r uc t i o n m a k e s s e n s e . ) (7) I f t h e r em ov a l o f t h e PC B empt i ed t h e q u e u e , l o ng wo r d . (8) Lo a d t h e STATE f i e l d (9) F i n a l l y , p l a c e t h e PC B i n to c l ea r i n t h e PC B wi th t h e n e w s ta te the a s so c i a ted ( COM/ C UR ) . pr i o r i t y bit in the o f the proc ess . i t s n e w s c h e d u l i ng q u e u e . F i g u r e 1 4 - 1 { Co n t . ) Pa r a l l e l s Be t we e n I n s wa p C a nd i d a t e S e l e c t i o n b y t h e Swa ppe r a nd E x e c u t i o n C a nd i d a t e S e l e c t i o n b y t h e S c h e d u l e r s umm a r y (J) "'0 H z SWA P PING Th e swa ppe r m a i n t a i n s a t a b l e ( i n m o d u l e OSWPS C HE D ) t h a t d e te rm i n e s t h e o rd e r i n wh i c h the v a r i o us r e s i d e n t s c h e d u l i ng states a re e x a m i n ed . Tab l e 1 4 - 2 s h ows thi s o rd e r a nd m en t i o n s o th e r c o n s i d e r a t i o n s th a t a r e m a d e i n f i nd i ng a s u i t ab l e o u t s wa p c a nd i d a t e . Ta b l e 1 4 -2 O r d e r o f Se a r c h f o r Po t e n t i a l Ou t swa p Ca nd i d a te s Pr o c e s s St a t e S u s pend ed ( Mn emo n i c ) ( S US P ) Lo c a l Ev e n t Fl ag Wa i t H i b e r na t i ng ( H IB ) Commo n Ev e n t Fl ag Wa i t Fr e e Pa g e Wa i t ( CEF) ( F PG ) Co l l i d ed Pag e Wa i t ) Mi sc e l l an e o u s Wa i t ( C OLPG ) ( MWA I T ) Common Ev e n t Fl ag Wa i t Lo c a l Ev e n t Fl ag Wa i t Pag e Fa ul t Wa i t Comput a b l e ( LE F ) ( C OM ) ( PFW) ( CEF) ( LE F ) P r i o r i ty Impo r t a n t In i t i a l Qua n t um Ad d i t i o na l No t e s No No No No No No No No YES No YES No No No YES YE S D i r ec t I /O Co un t Ca n no t Be Z e ro YES YE S D i r ec t I/O Co un t Ca n no t Be Z e r o YES YE S YES YE S D i r ec t I /O Co u n t Mu s t Be Z e r o D i r ec t I /O Co un t Mu s t B e Z e r o (1) The pr io r i ty tha t i s used fo r c om pa r i so n i s fo und in g l obal location SWP $GB I SWPR I . If the pr io r i t y o f the po ten t i a l o ut s wa p c a nd i d a te i s g r ea t e r than ( but not e qua l to ) the p r i o r i ty of the po ten t i a l i ns wa p p r o c e s s , the o ut s wa p c and i d a t e i s bypa s sed . (2) An a s s umpt i o n i s mad e abo ut d i r ec t I /O fo r p r o c e s s e s i n l oc a l o r g l ob a l ev e n t f l ag wa i t s t a te s . Th e a s s umpt i o n i s tha t the event f l ag wa i t wi l l be sa t i s f i ed wh en the d i rect I /O c ompl e te s . Such a p r o c e s s i s pa s s ed ov e r , r a th e r than i n c u r the o v e r he a d of s wa pp 1 ng it, o n l y to h a v e the p r o c e ss b ecome c omputab l e v e r y s o o n , pe r h a ps e v en b e fo r e the o ut swa p i s c ompl e t e . Th e r e a r e th r e e g e ne r a l c o n s i d e r a t i o n s tha t a c c o un t wh en c h e c k i ng e a c h p r o c e s s s ta t e . • the swa ppe r takes i n to Fo r some o f t h e s t a t e s t o wa r d the bo t t om o f t h e l ist ( tho se states l o o k e d at l a s t ) , the swa ppe r t e s t s the s e t t i ng of the i n i t i a l q u a n t um f l ag ( PC B $V I N QUAN i n PC B $ L S T S ) . Pr o c e s s e s r e s i d e n c y -a nd i n o n e o f the in the i r initial q ua n t um- o f s c h e d u l i ng s t a t e s wh e r e the s e t t i ng of th i s f l ag is 1 4 -7 SWAPP I NG s i g n i f i cant wi l l b e b ypa s s ed wh e n l o o k i ng fo r a s u i t a b l e o u t s wa p c a nd i d a t e . Fo r o th e r p r o c e s s s ta t e s , t h e s e t t i ng of t h i s f l ag i s i g n o r e d . Th e s e t t i ng o f t h e i n i t i a l q u a n t um f l ag i s a l s o i g no r ed und e r a d i f f e r ent s e t o f c i r c um s t a nc e s . Th e swa ppe r m a i n t a i n s a f a i l u r e c o un t e r t h a t r ec o rd s t h e n umbe r o f t imes tha t it a t t empt ed to l o c a t e a n o u t s wa p c a nd i d a te a nd f a i l ed . Wh e n t h i s c o un t r e a c h e s a v a l ue e q ua l to the SYS B OOT pa r am e t e r SWPFA I L , th e s wa ppe r b eg i n s i g no r i ng the s e t t i ng o f th i s i n i t i al qu a n t um f l ag fo r po te n t i a l o u t s wa p c a nd i d a t e s , i nd e p en d e n t o f p r o c e s s s ta t e . Th e c o un t e r i s r e s e t e a c h t i m e t h a t a n o u t s wa p c a nd i d a t e is s uc c e s s f u l l y l o c a t e d . ( Th e actual i mp l eme n t a t i o n r e s e t s t h e c o u n t pa r am e t e r to SWPFA I L a nd d e c r em e n t s t h e c o un t fo l l o w i ng e a c h f a i l u r e . Th e i n i t i a l q u a n t um f l ag i s i g n o r ed o n c e the c o un t g o e s t o ze r o . ) • • 14. 2. 3 P r o c e s s e s i n tho s e s t a t e s wh e r e p r i o r i t y i s l i s t ed a s b e i ng i mpo r ta n t a r e o n l y s e l e c t e d fo r o u t s wa p i f the i r p r i o r i t y i s sm a l l e r t h a n o r e q u a l to the p r i o r i t y o f the po t e n t i a l i n s wa p p r o c e s s ( s t o r e d i n g l o b a l l o c a t i o n SW P$GB_I SWPR I ) . Th e swa ppe r d o e s n o t initially r emove proc e s s e s tha t a r e p r e s um a b l y d o i ng d i r e c t I /0 . ( I f a p r o c e s s i s d o i ng d i r e c t I /0 , a n d t h e p r o c e s s i s wa i t i ng o n a n e v e n t f l ag , t h e swa ppe r a s s um e s th a t the even t f l ag wa i t i s a s so c i a t e d wi th t h e d i r e c t I /0 . ) Th e mo t i v a t i o n b eh i nd th i s d e c i s i o n is the d e s i r e to a v o i d t h e o v e r h e a d o f s wa pp i ng t h e p r o c e s s , o n l y to h a v e t h e p r o c e s s ' s s t a t e c h ang e to C OM , e v e n b e fo r e the o u t s wa p c ompl e t e s . Sys t em Eve n t s Th a t T r i g g e r Swappe r Ac t i v i t y Th e swa ppe r s pend s i t s idle t ime i n a h i b e r n a t i ng state . Tho s e c om po n e n t s wh o d e t e c t a n e e d f o r s wa ppe r a c t i v i t y wa ke the s wa ppe r ( by c a l l i ng r o u t i n e SCH$ SWPWAKE ) . Ta b l e 1 4 - 3 l i s t s the s ys t em e v e n t s th a t t r i gg e r a n e ed fo r s wa ppe r a c t i v i t y , t h e mod ul e th a t c o n t a i n s t h e r o u t i n e tha t d e te c t s e ac h n e e d , a nd t h e r e a s o n wh y t h e s wa ppe r n e ed s t o b e i n fo rmed a b o u t th e s e s ys t em eve n t s . Th e s wa ppe r d o e s n o t wo r r y a b o u t " h y i t wa s a wa k e n e d . Eve r y t i me tha t it is a wa ke n ed , it t e nd s to a l l o f i t s r e s po n s i b i l i t i e s . Th e m a i n l oo p o f t h e s wa ppe r l o o k s l i ke the fo l l o w i ng . 1. Th e f r e e pag e c o un t i s b a l a nc ed . Th i s m i g h t r e s ul t in an o u t s wa p of a p r o c e s s i f m o d i f i e d pag e wr i t i ng ( S t e p 2 ) w i l l n o t f r e e e n o ug h phys i c a l pag e s . 2. Mo d i f i ed pag e s a r e wr i t t e n . Ev e r y t i me the s wa ppe r is a wa k e n e d , t h e m o d i f i ed pag e wr i t e r i s c a l l ed . I f the s i ze o f th e m o d i f i ed pag e l i s t exceeds i ts uppe r l im i t th r e sh o l d ( S C H$G L MFY L IM ) , mod i f i ed pag e s w i l l b e wr i t t e n un t i l the s i ze or t h e l i st f a l l s b e l o w the l ow l im i t thr esho l d ( S C H $G L _M FY L O L IM ) . Th e r e a r e t i m e s wh e n the swa ppe r wa n t s to f l ush the en t i r e m o d i f i ed pag e l i st . Th e l og i c o f t h e mod i f i ed pag e wr i t e r r e qu i r e s t h a t bo th o f t h e s e t h r e sh o l d pa r ame t e r s b e z e r o ed for th i s to h a pp e n . Th e l a s t s te p tha t th e m o d i f i ed pag e 1 4-8 SWAPP I NG w r i t e r t a k e s b e fo r e e x i t i ng i s to r e s to r e the two m od i f i e d pag e l i s t t h r e sh o l d s to t h e v a l ue s d e s c r i b e d by t h e SYS B OOT p a r am e t e r s M PW_H I L I M and MPW L O L I M . 3. 4. 5. Th e swa ppe r a t t emp t s to i n swa p a p r o c e s s i n the C OMO s t a t e (if one ex i sts ) . Th i s a t t e m p t c a n f a i l i f t h e r e a r e no t e no ug h ph ys i c a l pag e s t o a c c ommo d a t e th e o u t swa ppe d process a nd none o f th e r e s i d en t processes a r e s u i t a b l e o u t s wa p c a nd i d a t e s . Th e fa c t tha t the swa ppe r i s a s e pa r a te p r o c e s s th a t e x e c u t e s fa i r ly f r e que n t l y (at l e a s t o nc e a s e c o nd ) makes it a c o nv e n i e n t v e h i c l e fo r t e s t i ng wh e th e r a po we r f a i l r ec o v e r y h a s o c c u r r ed and , i f s o , no t i f y i ng a l l p r o c e s s e s th a t h a v e r e que s t ed powe r r e co v e r y AST no t i f i c a t i o n ( wi th the Se t Powe r f a i l Re c o v e r y A S T s ys tem s e rv i c e ) . Th e d e t a i l s o f th i s d e l i v e r y m e c h a n i sm a r e d e sc r i b ed i n Ch a pt e r 2 3 . F i n a l l y , t h e swa ppe r p u t s i t s e l f i n to the h i b e r n a t e state , a f te r c h e c k i ng i t s wa k e p e nd i ng f l ag . I f a n yo n e ( i n c l ud i ng t h e s wa ppe r i t s e l f i n o n e o f i t s t h r e e m a i n s ub r o u t i n e s ) has r e q u e s t e d swa ppe r a c t i v i t y s i n c e t h e swa ppe r beg a n e x e c u t i o n , t h e h i b e r n a t e i s s k i pped a nd the swa ppe r g o e s b a c k t o S t e p 1 . Ta b l e 1 4 - 3 Ev e n t s Th a t Ca u s e t h e Swa ppe r o r Mo d i f i e d Pa g e Wr i t e r t o Be Awa k e n ed Ev e n t Mo d u l e Ad d i t i o n a l Comm en t s P r o c e s s tha t i s o ut swa pped b e c omes c omputab l e RSE Swa ppe r wi l l a t t empt t o m a k e th i s process r e s i dent . Qua n t um End RSE Ou t swa p p r ev i o us l y b l oc ked by i n i t i a l qua n t um f l ag se t t i ng may now b e po ss i b l e . CPU T i me Ex p i r a t i o n RSE Pr oc e s s may be d e l e t ed , a l l o wi ng p r ev i o u s l y b l oc ked i n swa p to o c c u r . Pro c e s s En t e r s Wa i t Sta te SYSWAIT Pr o c e s s tha t e n t e r ed wa i t s t a te may be s u i tab l e o ut swa p c and i d a te . ( Fo r ex ampl e , p r i o r i ty may n o t b e i m po r ta n t fo r th i s wa i t s t a t e . ) Mod i f i ed Pag e Li s t Exc eed s Uppe r Li m i t Th r e sho l d A LLOCPFN Mo d i f i ed pag e wr i t i ng by s wa ppe r . Fr e e Pag e Li s t Dr o ps Be l ow Lo w L i m i t Th r e sho l d A L LOC PFN Swa ppe r Mus t Ba l anc e F r e e Pag e Co un t b y : i s pe r fo rmed 1 . Wr i t i ng mod i f i ed pag e s 2. 3. Swa pp i ng h e ad e r s o f p r ev i o us l y o ut swapped pr o c e s s b od i e s Swa pp i ng mo r e pr o c e s s e s Fr e e Pag e L i m i t Exc eed s H i g h Li m i t Th r e s ho l d A LLOC PFN Pr o c e s s tha t co u l d no t b e i n swa pped d ue to l ac k of phys i c a l pag e s may n o w f i t . Ba l anc e S l o t o f De l e ted Pr o c e s s Becomes Ava i l abl e SYS DE LPRC Pr ev i o u s l y b l oc ked i n swa p m a y now b e po s s i b l e . P r o c e s s Head e r Re fe r en c e Co un t Go e s t o Z e ro PAGEFAULT P r o c e s s h e ad e r c an now b e o ut swa pped to j o i n pr ev i o us l y o u t swa pped p r o c e s s bod y . Sys t em Ti m e r Sub r o u t i n e Ex ec u t e s T IMESCHDL Th e swa ppe r i s a wa ke n ed ev e r y s ec o nd to c h e c k i f t h e r e i s a n y wo r k t o b e d o ne . 1 4-9 SWAPPING 14 . 3 SWAPPER ' S U S E OF M EMORY MANAGEMENT DATA STRUCTURE S I n Ch a pt e r 1 1 , t h e m em o r y m a n ag em e n t d a ta s t r uc t u r e s tha t a r e used b y bo th the pag e r a nd t h e swa ppe r we r e d e sc r i b ed . We wi l l r ev i e w tho s e s t r uc t u r e s h e r e , a nd a d d d e sc r i pt i o n s o f tho s e s t r uc t u r e s tha t a r e u s ed e x c l u s i v e l y by the s wa ppe r . 14 . 3 . 1 P r o c e s s H e ad e r Th e b u l k o f i n fo r m a t i o n t h a t the s wa ppe r u s e s i n m a n ag i ng the d e t a i l s o f e i th e r i n swa p o r o u t s wa p a r e c o n t a i n ed i n the p r o c e s s h e a d e r . Th e p r o c e s s pag e ta b l e s c o n t a i n a c ompl e te d e sc r i pt i o n o f the add r e s s s pa c e f o r a g i v e n p r o c e s s . Th e wo r k i ng s e t l i s t d e sc r i b e s tho s e PTEs tha t a r e v a l i d . Th i s l i s t is c r u c i a l f o r the swa ppe r b e c a us e i t i s o n l y the p r o c e s s wo r k i ng s e t tha t wi l l be wr i t t e n t o b ac k i ng s t o r e wh e n th e p r o c e s s i s o u t swa pped . In a s i m i l a r f a sh i o n , wh e n i t i s t i m e fo r a p r o c e s s to be i n swa pped , t h e wo r k i ng s e t l i s t i n the p r o c e s s h e a d e r i n the s wa p image of a p r o c e s s d e sc r i b e s wh a t the r e s t o f the swa p i m a g e l o o k s l i k e . 1 4 . 3 . 1 . 1 Wo r k i ng S e t L i s t - Th e wo r k i ng s e t l i s t d e s c r i b e s the s ub s e t of a p r o c e s s v i r t ua l a d d r e s s s pa c e t h a t m u s t b e wr i t t e n t o t h e swa p f i l e wh e n t h e p r o c e s s i s o ut s wa pped . Th e r e a r e f o u r d i f f e r e n t s ta t e s t h a t a pag e i n t h e p r o c e s s wo r k i ng s e t c an b e i n . 1. Th e pag e i s v a l i d . 2. Th e pag e i s i n t r an s i t i o n b u t the PFN S TATE a r r a y i nd i c a t e s t h a t t h e pag e i s a c t i v e . ( I f the S K I PW S L pa r am e t e r i s ze r o , i t s d e f a ul t v a l u e , t h i s s t a t e c a n n e v e r ex i s t . ) 3. Th e pa g e i s c u r r e n t l y b e i ng r e ad i n to m em o r y . Th e swa ppe r t r e a t s pag e r e ad s l i k e a n y o the r I /O in p r og r e s s wh e n s wa pp i ng a process . Th i s t r e a tm e n t is in d e sc r i b ed Se c t ion 1 4 . 4 . 4. Th e p r o c e s s pag e t a b l e c o n t a i n s a g l o b a l pag e t a b l e i nd e x and the i n d e x ed g l o b a l pag e t a b l e ent r y i nd i c a t e s a t r a n s i t i o n state . Th e s wa ppe r h a nd l e s g l o b a l pag e s i n a spec i a l manne r wh e n o u t swa pp i ng a p r o c e s s . Th i s t r e a tm e n t i s a l s o d e sc r i b ed in S e c t i o n 1 4 . 4 . Th e o pe r a t i o n o f t h e swa ppe r ' s sc a n o f t h e p r oc e s s wo r k i ng s e t l i s t a t o u t swa p i s d i sc u s s e d i n S e c t i o n 1 4 . 4 . 1 4 . 3 . 1 . 2 P r o c e s s P a g e Ta b l e s - Th e wo r k i ng s e t l i s t d o e s no t s upp l y the swa ppe r wi t h a l l t h e i n f o rm a t i o n n ec e s s a r y to o u t s wa p a p r o c e s s . O th e r i n fo rma t i o n i s c o n t a i n e d i n e i the r the v a l i d ( o r t r an s i t i o n ) PTE o r in o n e of the PFN a r r a y e l em e n t s a s s o c i a t ed wi th the ph ys i c a l pa g e . E a c h wo r k i ng s e t l i s t e n t r y e f fe c t i v e l y po i n t s to a d i f f e r e n t p r o c e s s pag e t a b l e e n t r y tha t c o n t a i n s a pag e f r am e n umbe r . Th e (or sys tem ) PTE i s c o p i ed to the s wa ppe r • s I /0 m a p a n d then the c o n t e n t s o f the BAK a r r a y e l em e n t f o r th i s phys i c a l pag e a r e p u t b a c k i n t o the pr o c e s s PTE . Th i s e l i m i n a t e s a n y t i e s b e twe e n a n o u t swa pped p r o c e s s ' s pag e t a b l e s a nd ph ys i c a l memo r y . 1 4-1 0 SWAPP I NG 1 4 . 3 . 1 . 3 P r o c e s s Hea d e r Pag e A r r ays - Th e b r e a k i ng of t i e s b e twe en p r o c e s s PTEs a nd phys i c a l m emo r y i s s t r a i g h t fo r wa r d f o r p r o c e s s pag e s . Th e c o n t e n t s o f t h e BAK a r r ay e l em e n t i s s i mpl y m e r g e d i n to the PTE . Howe v e r , p r oc e ss h e a d e r p ag e s a r e a l s o a pa r t o f t h e p r o c e s s wo r k i ng se t . Th e s e pag e s r e s i d e i n s ys tem s pa c e a nd a r e m a pped by s ys t em pag e tab l e entr ies tha t m a p t h e b a l a n c e s l o t i n wh i c h t h e p r o c e s s h e ad e r r es i d es . Th e r e l i n q u i sh i ng o f the b a l anc e s l o t i mpl i e s th a t these S PTEs m us t a l s o b e s u r r e nd e r ed . Th e r e i s no a n a l og o u s wa y t o s to r e the BAK a r r a y c o n t e n t s fo r p r o c e s s h e ad e r pag e s . Th i s i s wh y the process header pag e a r r a ys ( Fi g u r e 1 1 -8 ) ex i s t i n t h e process head e r . Th e r e e x i s t s a n a r r a y e l em e n t fo r e a c h pag e i n t h e p r o c e s s h e ad e r . Wh e n a p r o c e s s i s o u t swa pped , tho s e p r o c e s s h e ad e r pag e s c u r r e n t l y i n t h e wo r k i ng s e t h a v e th e i r BAK ad d r es s e s p u t i n to t h e c o r r e s pond i ng a r r a y e l em e n t s in the p r o c e s s h e a d e r pag e B AK a r r a y . Wh e n the p r o c e s s i s swa pped bac k i n to memo r y , t h e p r o c e s s h e ad e r pag e s c a n be s c anned a nd the BAK c o n t e n t s c o p i ed f r om th e a r r a y b a c k i n to the PFN BAK a r r a y e l emen t s fo r t h e phys i c a l pag e s t h a t c o n t a i n the p r o c e s s h e a d e r . I n a s i m i l a r m a nn e r , i t i s n e c e s s a r y to r emem b e r wh e r e each process head e r pag e f i ts i n to t h e wo r k i ng s e t . Th i s i s d o n e b y s to r i ng the WS LX PFN a r r a y e l em e n t i n t o the c o r r e s po nd i ng p r o c e s s h e a d e r pag e WS LX a r r a y e l eme n t . Th e use of th i s a r r a y wh i l e t h e p r o c e s s h e a d e r i s b e i ng r eb u i l t fo l l o w i ng i n s wa p p r ev e n t s a p r o h i b i t i v e l y l o ng s e a r c h o f t h e wo r k i ng s e t l i s t f o r e a c h p r o c e s s h e ad e r pag e . 14. 3 . 2 Swa ppe r I /O Da t a S t r uc t u r e s L i ke t h e pag e r , t h e swa ppe r u s e s the c o nv e n t i o n a l VM S I /0 s ub s ys tem . I t a l locates i t s o wn I /0 r e q ue s t pa c k e t a n d f i l l s i n some o f the f i e l d s t h a t wi l l b e i nte r p r e ted in a s pe c i a l manner by the I /0 po s t p r o c e s s i ng rout ine . Af t e r t h e s e f i e l d s h a v e b e e n f i l l ed i n , i t j umps to o n e o f t h e swa ppe r I / 0 e n t r y po i n ts i n mod u l e SYS Q I ORE Q ( E XE $ B LD PKTSWPR o r E XE $ B LDPKTSWPW ) th a t fills in a n a pp r o p r i a t e f unc t i o n c od e a nd q u e ue s t h e p a c k e t to the a pp r o p r i a t e d i s k d r i v e r . Tab l e 1 2 - 1 sh ows h o w t h e I /0 r e qu e s t pac k e t i s u s ed by t h e swa pp e r fo r i t s I /0 a c t i v i t i e s . Two o th e r s t r uc t u r e s a r e u s ed by t h e swa ppe r . Th e r e i s a swa p file t ab l e e n t r y f o r each swap f i l e i n the s ys t em . Th e s wa ppe r u s e s a s pe c i a l I /0 a r r a y t h a t a l l o ws i t to r e ad o r wr i t e a p r o c e s s wo r k i ng set , a c o l l ec t i o n o f v i r t u a l l y d i s c o n t i g uo u s pag e s , i n o n e o r a sma l l n umb e r o f I /0 r e q u e s t s . 1 4 . 3 . 2 . 1 Swa p F i l e Ta b l e En t r i e s - F i g u r e 1 1 - 2 2 sh ows t h e l a yo u t o f a swa p file t a b l e e n t r y , t h e s t r uc t u r e t h a t a l l o ws t h e swa p f i l e to be l oca ted on d i sk . No t i c e t h a t t h e w i ndow c o n t r o l b l o c k po i n t e r a nd v i r tua l b l o c k n um b e r f i eld a r e l o c a ted a t th e s a m e o f f s e t s i n swa p f i l e t ab l e entr i e s , page f i l e c o nt r o l b l o c k s , and p r o c e s s o r g l oba l sec t i on tab l e entr ies . Th i s a l l o ws t h e s e d a t a s t r uc t u r e s to b e used by c o mmon r o ut i n e s t h a t need no t d i s t i ng u i sh t h e t ype o f s t r uc t u r e b e i ng u s ed to d e sc r i b e a m emo r y m a n ag em e n t I /0 r e qu e s t . 1 4-1 1 SWA P P ING 14 . 3 . 2 . 1 . 1 Swap F i l e I n i t i a l i z a t i o n - Wh e n the s ys t em i s i n i t i a l i z ed , the S Y S I N I T p r o c e s s i n i t i a l i z e s t h e s wa p f i l e SWAPF I L E . SYS . Th e s i z e o f t h e swa p f i l e i s d i v i d ed b y t h e m a x i m um po s s i b l e wo r k i ng set s i ze ( g o v e r n ed b y SYSB OOT p a r am e t e r WSMAX ) to y i e l d t h e n um b e r o f s l o t s i n the f i l e . ( Th e s l o t s a r e a l l t h e s a m e s i ze , e a c h s l o t c a pa b l e o f h o l d i ng WSMAX n um b e r o f pag e s . ) Th e n um b e r o f ava i l a b l e s l o t s c a n a l s o c a us e the m a x i m um n um b e r of processes that the s ys t em c a n s uppo r t t o d ec r e a s e . Th e s wa p s l o t c o u n t ( p l u s two t o a c c o u n t f o r t h e two p r o c e s s e s , N U L L a nd SWA P PE R , that d o n o t swa p ) i s c ompa r ed to MAXPROC E S SCNT a nd the sm a l l e r i s c ho s e n a s t h e a c t ua l m a x i m um n um b e r o f p r o c e s s e s th a t t h e s ys t em w i l l s uppo r t . I f a s e c o nd s wa p f i l e i s i n s t a l l ed ( w i t h t h e SYSGEN I N S TA L L c omm and ) , i ts S F TE is i n i t i a l i zed . I t i s a l s o pa r t i t i o ned i n to swa p s l o t s o f e q ua l s i z e ( s t i l l WSMAX pag e s ) . Th e ad d i t i o n a l n um b e r of s l o t s c an i nc r e a s e t h e max i m um n umbe r o f p r o c e s s e s t h a t c a n e x i s t i n the s y s tem ( b u t n e v e r m o re than t h e i n i t i a l v a l u e of MAXPROC E S SCNT ) . N O TE A s l i g h t c h a ng e to th i s a l g o r i thm h a s been pa t c h ed i n to VM S w i th the Th i s c h a ng e Ve r s i o n 2 . 2 b i n a r y upd a t e . r em o v e s t h e r e s t r i c t i o n o f 2 5 8 p r o c e s s e s Th e d e ta i l s o f t h a t p r e v i o u s l y e x i s t ed . t h i s c h a n g e a r e d e sc r i b ed i n Appe nd i x F . 1 4 . 3 . 2 . 1 . 2 A l l o c a t i o n o f Swap S l o t s - Th e i nd i c a t i o n o f wh i c h S FTE to use i s c o n t a i n ed i n the so f t wa r e PC B i n f i e l d PC B $ L WS SWP . Th e uppe r b y t e i s a l o ng wo r d i nd e x i n to the a r r a y o f po i n t e r s ( F i g u r e 1 1 - 2 2 ) to S F TEs a nd page f i l e c o n t r o l b l o c k s . Wh e n a pr o c e s s i s f i r s t c r e a t ed , t h i s f i e l d i s c l e a r , wh i c h i mpl i e s v i r t ua l b l o c k z e r o in s wa p f i l e z e r o , the She l l process . Wh e n a p r o c e s s i s s e l e c ted f o r o u t s wa p f o r the f i r s t t i m e , a swa p s l o t is a l l o c a ted fo r it. Th e swa p f i l e n umbe r a nd t h e v i r t ua l b l o c k n umbe r o f t h e beg i nn i ng o f t h e s l o t a r e r ec o r d e d in the PC B . Th i s s wa p s l o t r ema i n s a l l o c a ted to th i s process fo r t h e l i f e o f the proc e s s . 14 . 3. 2 . 2 Swappe r PTE A r r a y - Th e n e ed f o r the swa ppe r PTE a r r a y tha t a l l o ws it to wr i t e pag e s tha t a r e v i r t ua l l y d i s c o n t i g uo u s i n the c o n t e x t o f the p r o c e s s b e i ng s wa pped wa s d e sc r i b ed i n Ch a pt e r 1 1 . Th i s a r r a y c o n ta i n s WSMAX l o ngwo r d s a nd i s used fo r bo th o u t s wa p a nd i n swa p o pe r a t i o ns . At o u t s wa p , the PFN o f e a c h pag e t h a t wi l l be wr i t t e n to the swa p f i l e is l o ad ed i n to the a r r ay . Th i s a r r a y i s t h e n pa s s e d o n to the I /0 s y s t em to p e r f o rm t h e w r i t e . At i n swa p , the swa ppe r a l l oc a tes a n umbe r o f PFNs to ho l d t h e p r o c e s s a nd r e a d s the swa p i m ag e i n to th e s e pag e s . E a c h PFN i s t h e n pl a c ed i n to t h e a pp r o p r i a t e pag e ta b l e a s the wo r k i ng s e t l i st a nd p r o c e s s pag e t a b l e s a r e r e b u i l t . 1 4-1 2 SWAPPING 14. 4 OUTSWAP OPERATI ON O u t sw a p i s d e sc r i b ed b e f o r e i n swa p b ec a u s e i t is i ns wa p i n t e rm s o f wh a t the s wa ppe r p u t i n to s wa ppe r does not r emove processes f r om P r o c e s s e s a r e o n l y r emoved i f i nd i sc r i m i n a t e l y . phys i c a l pag e s by a h i g h e r p r i o r i t y p r o c e s s . 14. 4 . 1 eas i e r to e x pl a i n the swa p f i l e . Th e the bal ance set the r e i s a n e e d f o r S e l e c t i on o f O u t swap Cand i d a t e As we m e n t i o ne d i n S e c t i o n 1 4 . 2 , t h e o u tswa p se l ec t i o n is d r iven by t ab l es tha t c o n t a i n a we i g h t fo r e a c h r e s i d e n t s c hed u l i ng s t a t e . Th e s wa ppe r s e l e c t s t h e p r o c e s s tha t i t j ud g e s w i l l b e ne f i t the l e a s t f r om r em a 1 n 1 ng i n m em o r y . On c e a c and i d a t e is s e l ec te d , t h e swa ppe r p r epa r e s the wo r k i ng s e t o f tha t p r o c e s s f o r o u t s wa p . 14. 4 . 2 Outswa p o f the P r o c e s s Bo d y Th e swa ppe r o u t s wa ps t h e p r o c e s s b o d y ( P O a nd P l pag e s ) s e pa r a t e l y f r om t h e p r o c e s s h e a d e r . Th e r e a r e two r e a s o n s fo r d o i ng th i s . • F i e l d s i n t h e p r o c e s s h e a d e r ( mo s t no t a b l y wo r k i ng s et l ist entr i es and p r o c e s s pag e t a b l e e n t r i e s ) a r e m o d i f i ed a s t h e wo r k i ng s e t l i s t i s p r o c e s s ed : • Th e p r o c e s s h e a d e r m a y n o t b e swa ppa b l e a t th i s • t i m e d ue to o u t s t a nd i ng I /0 , pag e s o n the m o d i f i ed pag e l i s t , o r s o m e o th e r r e a s o n . 14. 4 . 2. 1 S c a n n i ng th e Wo r k i ng S e t L i s t - Th e p r o c e s s body i s p r e pa r ed fo r o u t s wa p by s c ann i ng t h e wo r k i ng set l i st . E a c h pag e i n t h e wo r k i ng s e t l i s t m u s t b e l o o k e d a t to d e t e rm i n e i f a n y s pe c i a l ac t i on is r eq u i r ed . Th e s wa ppe r l ooks a t a c om b i n a t i o n o f the pag e t ype ( f o und in t h e wo r k i ng set l i s t e n t r y as we l l a s the PFN TYPE a r r a y ) a nd t h e v a l i d b i t . Ta b l e 1 4 - 4 l i s t s a l l c om b i n a t i o n s o f pag e t ype a nd v a l i d b i t s e t t i ng tha t t h e swa ppe r e nc o un t e r s a nd the a c t i o n tha t it t a k e s fo r e a c h . Seve r a l c a s e s a r e d i s c u s s e d f u r the r he r e . Th e b a s i c s t ep tha t the swa ppe r m u s t t a k e a s i t s c a n s t h e wo r k i ng set l i st i s t o move e ac h s wa ppa b l e pag e i n to t h e s wa ppe r ' s I /O ma p . Th i s c a u s e s the v i r t u a l l y d i s c o n t i g uo u s pag e s i n the p r o c e s s ' s wo r k i ng set to a ppe a r v i r t ua l l y c o n t i g uo u s t o t h e I /0 s y s t em ( F i g u r e s 1 4 - 3 a n d 1 4-6) Th e s t e p s tha t the swa ppe r t a k e s f o r e a c h pag e a r e t o • 1. l o c a t e t h e pag e t a b l e e n t r y f r om the f i e l d i n t h e wo r k i ng s e t l i s t e n t r y , 2. d e t e rm i n e a n y s p e c i a l ac t i o n b a s ed o n pag e v a l i d i ty a nd t yp e , 3. m o v e the PFN f r om th e pag e t a b l e e n t r y to the s wa ppe r m a p , 4. r e c o r d t h e mod i f y b i t ( l o g i c a l OR o f PTE mod i f y b i t and PFN STATE a r r a y s av e d mod i f y b i t ) i n the wo r k i ng s e t l i s t e n t r y , and 1 4-1 3 v i r t ua l pag e n umbe r pag e SWAPP ING 5. s e t th e De l e t e Co n t e n t s b i t i n the PFN S TATE a r r a y e l em e n t . Th i s w i l l c a u s e t h e pag e to be p l a c ed a t the h e a d o f the f r e e p a g e l i s t wh e n i t s r e f e r e n c e c o un t g o e s t o z e r o ( wh i c h in n o r m a l c i r c um s t a n c e s wi l l be wh e n the s wa p w r i t e c o m pl e t e s ) . No t e t h a t t h e swa ppe r d o e s no t h av e t o e x pl i c i t l y p u t the c o n t e n t s o f Th a t h a pp e n s n a t u r a l l y wh e n the pa g e the PFN BAK a r r a y i n t o e a c h PTE . i s r e l e a s e d { a f t e r t h e s wa p wr i t e c om p l e t e s a nd a l l o th e r r e f e r enc e s t o the pag e a r e e l i m i n a t ed ) . 1 4 . 4 . 2 . 2 Pag e s w i t h D i r e c t I/0 i n P r og r e s s - I f a { mo d i f i ed ) pa g e h a s o u t s t a nd i ng I /0 wh i l e t h e p r o c e s s i s b e i ng o u t swa pped , t h e swa ppe r t a k e s n o t e o f t h i s by l o ad i ng t h e SWPVBN PFN a r r ay e l em e n t wi th th e v i r t ua l b l o c k n umbe r i n the s wa p f i l e wh e r e t h e pag e i s b e i ng wr i t t e n to . Th e pag e i s n ev e r th e l e s s s wa pped a t th i s t i m e to r e s e r v e a p l a c e fo r i t i n t h e swa p f i l e . I f the I /0 o pe r a t i o n i s a r e a d { o r i t i s a w r i te a nd some o th e r a c t i o n h a s c a us ed the pag e t o b e mo d i f i ed ) , t h e phys i c a l pag e wi l l b e p l a c ed o n t h e mo d i f i ed pag e l i s t wh en the I / 0 c ompl e te s . { Th i s o c c u r s b e c a u s e MMG $ R E L PFN , t h e r o u t i n e tha t r e l e a s e s t h e pag e , p u t s pag e s o n t h e m od i f i ed pag e l i s t i f e i th e r t h e m o d i f y b i t i n t h e PFN S TATE a r r a y i s s e t o r i f the PFN SWPVB N a r r a y h a s n o n z e r o c o n te n t s . ) Th e mod i f i ed pag e wr i te r t a k e s s pe c i a l a c t i o n f o r mod i f i ed pag e s w i th n o n z e r o c o n t e n t s in t h e SWPVBN a r r a y . Th a t i s , i t wr i t e s each pag e t o the d e s i g na t ed b l o c k i n t h e swa p f i l e r a th e r than to i t s n o rma l ba c k i ng s t o r e a d d r e s s . I f the I /0 o pe r a t i o n i s a wr i te { f r om memo r y to m a s s s t o r ag e ) and the pag e wa s n o t o th e r w i s e m od i f i e d , t h e c on t e n t s t h a t a r e c u r r e n t l y b e i ng wr i t t en to the s wa p f i l e a r e g o od . Th e pag e wi l l be pl a c ed on the f r e e l i s t wh e n the wr i t e c ompl e t e s . 1 4 . 4 . 2 . 3 G l o ba l Pag e s - G l o ba l pag e s a r e a l s o g i ven spec i a l t r e a tmen t a t o u t s wa p . If t h e g l o b a l pag e i s wr i t a b l e , i t i s d r o pped f r om the p r oc e s s wo r k i ng set b e fo r e the p r o c e s s i s s wa pped to d i s k . Th e task o f r e c o rd i ng wh e the r t h e c o n t e n t s t h a t a r e swapped a r e u p to d a t e wh e n the p r o c e s s i s b r o ug h t bac k i n to m em o r y i s m o r e c ompl i c a t ed than s i mpl y r e f a u l t i ng t h e pag e ( o f t e n w i tho u t I /0 ) wh e n the p r o c e s s i s swa pped bac k i n to memo r y . G l o b a l r e ad - o n l y pag e s a r e o n l y s wa pped i f t h e g l oba l sha r e c o un t { PFN S HRCNT a r r a y ) i s o ne . I n a l l o th e r c a s e s , t h e pa g e is d r o ppe d f r om the wo r k i ng s e t a nd m u s t be r e f a u l ted { mo s t l i k e l y w i tho u t I /0 ) wh e n the process is i n swa ppe d . (Gl obal pag e s tha t a r e e x pl i c i t l y o r i m pl i c i t l y l o c k e d i n to the p r o c e s s wo r k i ng s e t a r e no t d r o pped f r om th e wo r k i ng se t . ) G l o ba l t r a n s i t i o n pag e s a r e a l s o d r o pped f r om the p r o c e s s wo r k i ng s e t . 1 4-1 4 SWAPPING 14. 4.2.4 E x ampl e o f P r o c e s s Bod y O u t swap - F i g u r e s 1 4 - 2 t h r o ug h 1 4-4 s h o w s om e o f t h e s pe c i a l c a s e s e nc o un t e r ed b y t h e swa ppe r wh i l e i t i s s c a n n i ng t h e p r o c e s s wo r k i ng s e t l i s t . As m e n t i o n e d i n c onnec t i o n wi t h Tab l e 1 4 - 4 , t h e k e y i n f o r m a t i o n abo u t e a c h pag e i s a c om b i n a t i o n o f t h e PTE va l i d b i t a nd t h e phy s i c a l pag e t ype . Th e o rd e r of the sc an i s d e te rm i ned b y t h e o rd e r d e f i n ed b y the wo r k i ng s e t l i s t . F i g u r e 1 4 - 2 s h ows t h e p r o c e s s wo r k i ng s e t , t h e p r o c e s s pag e tabl e s , a nd the a s s o c i a t ed PFN d a t a b a s e e n t r i e s b e fo r e t h e swa ppe r beg i n s i t s wo r k i ng s e t s c a n . F i g u r e 1 4 - 3 s h ows t h e m od i f i ed wo r k i ng s e t a nd the swa ppe r m a p a f t e r t h e wo r k i ng s e t l i s t sc an b u t b e fo r e t h e I /0 r e qu e s t i s i n i t i a t ed . F i g u r e 1 4 - 4 s hows t h e s ta t e o f t h e pag e tab l e entr i e s a fter the s wa p wr i t e h a s c omp l e te d and the ph ys i c a l pag e s h a v e b e e n r e l e a sed . 1. Th e f i r s t wo r k i ng s e t l i s t e n t r y i s a g l o b a l r e a d - o n l y pag e . Th e VPN f i e l d o f t h e wo r k i ng s e t l i s t e n t r y l o c a t e s t h e pag e table entry . Th e PFN f i e l d o f t h e PTE l o c a t e s t h e PFN d a t a a s s o c i a t ed w i t h th i s phys i c a l pag e . In pa r t i c u l a r , t h e ( Th i s p r oc e s s is g l o b a l s h a r e c o un t f o r th i s pag e i s o n e . the o n l y p r o c e s s tha t c u r r e n t l y h a s th i s pag e i n i t s wo r k i ng s e t . ) Th e swa ppe r wi l l wr i te th i s pag e o u t a s p a r t o f the s wa p i m ag e f o r th i s p r o c e s s . Th u s , P F N A i s t h e f i r s t pag e i n t h e swa ppe r ' s PTE a r r a y ( F i g u r e 1 4 - 3 ) . Wh e n t h e swa ppe r ' s wr i t e o pe r a t i o n com p l e t e s , t h e pag e wi l l b e d e l e te d . Th a t i s , t h e PTE a r r ay e l emen t w i l l be c l e a r ed a nd t h e pag e w i l l be p l a c ed a t t h e head o f t h e f r e e pag e l i s t ( Fi g u r e 14-4) . 2. The s e c ond wo r k i ng s e t l i s t e n t r y i s a p r o c e s s pag e tha t a l s o h a s I /0 i n p r o g r e s s ( R E FCNT 2) . Th i s pag e wi l l be swa pped . Th i s i s i l l u s t r a ted by t h e i nc l u s i o n o f PFN C i n t h e s wa ppe r map . = I f t h e pag e wa s p r ev i o u s l y mod i f i ed ( e i the r PTE m o d i f y b i t o r s a v e d mod i f y b i t i n S TATE a r r a y was s e t ) , t h e v i r t ua l b l o c k n um b e r i n th e s wa p f i l e w i l l b e l o ad ed i n to t h e SWPVBN a r r a y . Th i s w i l l f o r c e t h e pag e to t h e m od i f i ed pag e l i s t wh e n i t i s r e l e a s ed . I f the p r oc e ss i s s t i l l o u t s wa pped b y t h e t i me tha t t h e m o d i f i ed pag e w r i te r g e ts a r o und to wr i t i ng th i s p ag e , t h e pag e w i l l be wr i t t e n t o the b l o c k r e se r v ed fo r it wh e n t h e p r o c e s s i s f i r s t o u t swa pped . Th a t i s , wh e n the r e f e r en c e Th e p a g e i s m a r k e d f o r d e l e t e . c o un t f o r t h e pag e r e a c h e s z e r o ( d ue t o c ompl e t i o n o f bo th the o u t s ta n d i ng I/0 and the swa ppe r ' s wr i t e ) , the pag e is p l aced at t h e h ea d o f t h e f r e e pag e l i s t a nd i t s PTE a r r a y e l em e n t c l e a r e d . 3. T h e t h i r d wo r k i ng s e t l i s t e n t r y i s a g l o b a l r e ad/wr i t e pa g e . Th e pa g e is d r o pped f r om the p r o c e s s wo r k i ng set ( Fi g u r e 1 4 - 3 ) . Th i s m e a n s tha t t h e p r o c e s s pag e t a b l e entry is r e pl a c ed w i th a g l ob a l p a g e ta b l e i nd e x ( th a t l o c a t e s g l oba l pag e t a b l e e n t r y R ) a nd t h e sha r e c o un t fo r PFN B is d e c r emen ted . No t i c e tha t PFN B i s no t a pa r t o f t h e s wa ppe r m a p , wh i c h c o n t a i n s a l i s t o f t h e phys i c a l pag e s t h a t w i l l b e w r i t t e n t o t h e s wa p f i l e . 4. Th e l a s t wo r k i ng s e t p a g e w i t h no t h i ng t h e s wa ppe r m a p ( P FN Th e d e l e t i o n w i l l o pe r a t i o n c o mpl e t e s . l i s t e n t r y i n th i s e x am p l e i s a process s pe c i a l abo u t i t . Th i s pa g e i s a d d ed t o D ) a nd i t s c o n t e n t s m a r k e d fo r d e l e te . a c t ua l l y o c c u r wh en th e swa ppe r ' s wr i t e 1 4 -1 5 SWA P P I NG Ta b l e 1 4 -4 S c a n o f Wo r k i ng Se t L i s t o n Ou t swa p Th e sc a n o f the wo r k i ng s e t l i s t o n o u t swa p i s k e yed o f f a phys i c a l pag e type ( WS L < 3 : 1 > ) and the v a l i d b i t ( PT E < 3 1 > ) . 1. Type o f Pag e Va l i d P r o c e s s Pag e Tr a n s i t i o n comb i n a t i o n of t he Ac t i o n o f Swa ppe r fo r Th i s Pag e a. ( S TATE = Re a d i n Prog r e s s ) Tr e a t a s pag e wi th I /O i n prog r e s s . Sp e c i a l ac t i o n m a y be t a k e n at i n swa p o r by mod i f i ed pag e wr i te r . b. ( S TATE = Ac t i v e ) Ou t s wa p b u t s e t Go odpag e b i t i n WSLE . Pag e wi l l be put b a c k i n to ac t i v e t r a n s i t i o n s ta te a t i n swa p t i me . c. ( S TATE = Re a d Er r o r ) DR OP f r om wo r k i ng se t . d . No o th e r t r a n s i t i o n s t a t e s a r e po s s i b l e fo r a pag e i n the wo r k i ng se t . 2. Pro c e s s Pag e Va l i d Out swa p pag e . I f the r e i s o u t s t a nd i ng I /0 and t h e pag e is mod i f i ed , l o ad SWPVBN a r r a y e l em e n t wi th b l o c k i n swa p f i l e wh e r e t h e upd a ted pag e c o n t e n t s sho u l d b e wr i t ten wh e n the I /0 com pl e t e s . 3. Sys t em Pa g e 4. G l ob a l Read On l y 5. G l ob a l Re ad On l y 6 . G l ob a l Re ad /Wr i te 7. Pa g e Ta b l e Pa g e Impo s s i b l e fo r sys tem pag e to be i n p r o c e s s wo r k i ng s e t . Swa ppe r g en e r a te s an e r ro r . Trans i t i on Va l i d a. I f the pr o c e ss pag e tab l e e n t r y s t i l l conta i n s a PFN , th i s i s a n ac t i v e t r an s i t i o n pag e . Ou t s wa p t h e pag e b u t s e t the Go od pag e b i t i n t h e WSLE . b. If t h e pr o c e s s pag e tab l e e n t r y c o nta i n s a g l obal pag e ta b l e i nd ex , t he n the g l obal pag e tab l e m u s t c o n t a i n a t r a n s i t i o n PTE . The pag e i s d ro pped f r om the pro c e s s wo r k i ng se t . a. I f S HRCNT = 1 , b. I f S HRCNT > 1 , DRO P f r om wo r k i ng se t . I t i s h i g h l y l i ke l y tha t pr o c e s s c a n faul t pag e l a t e r w i tho u t I /0 . Th i s c h e c k avo i d s m u l t i pl e c o p i e s o f s a m e pag e i n swa p f i l e . t h e n o ut s wa p . DR OP f rom wo r k i ng se t . I t i s ex t r emel y d i f f i c ul t to d e t e r m i n e wh e th e r pag e i n memo ry wa s m od i f i ed a f t e r th i s c o py wa s wr i t ten to the swa p f i l e . No t pa r t o f proc e s s bod y . Ho we v e r , wh i l e s c a n n i ng pro c e s s b od y , VPN f i e l d i n WSL i s mod i f i ed to r e f l ec t o f f s e t f rom beg i nn i ng p r o c e s s h e ad e r b e c a us e pag e ta b l e pag es wi l l p r o b ab l y b e l o c a te d a t d i f f e r en t v i r t ua l a d d r e s s e s fo l l ow i ng i n swa p . 1 4-1 6 Process Header for swapped process WSLX Fix ed Portion Working Set List vpn y GRO w s le 1 vpn PPG wsle 2 z vpn w GRW w s l e 3 vpn X PPG w s l e 4 A B c wsle 2 D wsle 4 PTE BAK gpte R gstx gpte a gstx pte Z pgflx pte X pstx Proce s s Section Table. etc. TYPE STATE � IGR o l l � I I l � I I I � I I other s H RC N T : 1 GRW sHRCNT : PPG REFCNT = 1 41 21 PPG PFN D a t a b a s e A r r a y s PO P a g e T a b l e pte W vpn W .... � I .... -...J vpn X pte X vpn Y pte Y global p a g e t a b l e gpte a SWP$GL -MAP Swapper's 1 / 0 Map :: 1:J gpte R vpn Z P 1 Page Table F i g u r e 1 4 -2 E x amp l e Wo r k i ng Se t L i s t Be fo r e O u t s wa p S c a n til � ttl ttl H 2: C) Process Header for swapped process A Fixed Portion Working Set List y vpn vpn ... · vpn z. . wsle 2 PPG . .•· wsle 1 GAO . / X wsle 3 . • . · ·. ·.. · wsle 4 PPG W S LX PTE gpte 0 gstx R gstx gpte B BAK c w s le 2 pte Z pgflx D wsle 4 pte X pstx Process Sec t ion Table. etc. S T A TE TY PE other I B l cRo l I B I l I �H�QNT: = ff I 2 I B [§] I B I I SHRCNT = 1 GRw REFCNT = PPG P F N D a t a b a se A r r a y s PO Page Table vpn W 0 . �J>t:x JAJ . · ·.. • pte W vpn X 1 pfn D pte X vpn Y 1 pfn A pte Y g l o b a l p a g e t a b le gpte a gpte R vpn Z 1 pfn C v a li d , pfn A �---� SWP$GL-MAP " =j:J S w a p p er's 1/0 M a p v alid, pfn B �---� pte z P 1 Page Table Fi g ure 1 4 -3 E x amp l e Wo r k i ng Set L i s t Af t e r O u t s wa p Sc a n C/l � ., ., 1-t z Cl Process Header for swapped process A Fixed Portion Working Set List vpn vpn vpn B z GRO w sle 1 X PPG w sle 4 y PPG wsle 2 wsle 3 W S LX I BUNK PTE BAK gpte a gstx R gstx gpte C wsle 2 pte Z D BLINK 0 Process Section Table. etc. pgflx STATE TYPE other [�r&�'l 1 GRo I ($,�'�"� +'o�l B I GRW I I SHRCNT 3 1 B I I l �t.,�. Cf.lt==· tl ltreeJ � = PPG PFN D a tabase Arrays PO Page Table vpn W 0 gptx (R) pte W vpn X 0 pstx pte X vpn Y 0 9PJl!. (0) pte Y vpn Z 0 pfn C g l o b a l page ta ble gpte a trans, pfn A gpte R v a li d , p f n B �---� SWP$GL - MA P "==i:] S w a pp e r' s 1/0 Map pte Z P 1 Page Table Figure 1 4-4 P r o c e s s Pag e Ta b l e Ch a ng e s Af t e r Swa ppe r ' s Wr i t e Compl e t e s SWAPP I NG 14 . 4. 3 O u t swap o f P r oc e s s He a d e r Th e p r o c e s s h e a d e r i s n o t o u t swa pped un t i l a f t e r t h e p r o c e s s bod y h a s b e e n s uc c e s s f u l l y w r i t t e n t o t h e swa p f i l e . Th e r ea so n f o r th i s i l l us t r a t e s two o th e r c a s e s th a t c a n keep the process head e r in m em o r y . B e fo r e t h e p r o c e s s h e a d e r c a n b e o u t s wa pped , a l l t i e s t o ph ys i c a l m em o r y tha t e x i s t i n t h e p r o c e s s pag e t a b l e s m u s t b e s ev e r ed . Th i s i nc l ud e s n o t o n l y tho s e pag e s t h a t we r e i n t h e p r o c e s s wo r k i ng s e t a nd wr i t te n to the s wa p f i l e b u t a l so tho s e pag e s th a t a r e i n som e t rans i t i o n s ta t e , m o s t n o t a b l y p a g e s o n t h e f r e e a nd mod i f i ed pag e l i s ts . 14. 4. 3. 1 P a r t i a l Outswa p - Af t e r the p rocess body has been o u t swa pped , t h e p r o c e s s h e ad e r b e c om e s e l i g i b l e f o r o u t s wa p . I n fac t , t h e h e a d e r o f a n o u t s wa pped process is the f i r s t th i ng th a t t h e s wa ppe r l o o k s f o r i n a n a t tempt t o b a l a n c e t h e f r e e pag e l i s t . Th e i nd i c a t i o n tha t t h e p r o c e s s h e ad e r c an n o t be o u t s wa pped y e t is f o und in the p r oc e s s h e ad e r v e c to r r e f e r e nc e c o un t a r r a y ( Fi g u r e 1 1-2 1 ) . Th i s a r r a y c o un t s t h e n um b e r o f r easons ( trans i t i o n pag e s , a c t i v e pag e t a b l e pag e s , a nd s o o n ) t h a t p r ev e n t the p r o c e s s h e a d e r f r om be i ng o u ts wa pped . B e c a u s e t h e o u t swa p o f t h e h e ad e r d o e s n o t h a v e t o i mmed i a t e l y f o l l o w th e b o d y o u t swa p , i t i s po s s i b l e ( ev e n p r o b ab l e ) th a t a p r o c e s s h e a d e r wi l l no t b e swa pped i n t h e t i m e b e twe en wh e n a process body i s o u t swa pped a nd wh e n tha t p r o c e s s i s b r o ug h t b a c k i n to memo r y . Such a s i t ua t i o n i s r e f e r r e d to a s a pa r t i a l o u t s wa p . I t h a s a n o bv i o u s c o u n t e r pa r t , a pa r t i a l i n swa p , wh e r e t h e swa ppe r d o e s no t h av e t o a l l o c a t e a b a l a nc e s l o t a nd b r i ng t h e p r o c e s s h e ad e r i n to m emo r y b e c a u se t h e h e a d e r i s a l r e a d y r e s i d e n t . An i mpo r ta n t sys t e m m a n ag em e n t po i n t is i l l us t r a t ed he re . Process bod i es , wh i c h c o n s um e phys i c a l memo r y , a r e r e l a t i v e l y e a s y t o r em o v e f r om memo r y . P r o c e s s h e ad e r s c o n s um e a sma l l e r amo un t o f phys i c a l memo r y b u t t h e y a l so o c c upy a b a l a n c e s l o t . Th e b a l a n c e s l o t i s n o t f r e e d f o r o th e r u s e u n t i l the e n t i r e h e a d e r i s o u t s wapped . If the S Y S BOOT p a r am e t e r BALS ETC NT i s se t to t o o sma l l a v a l ue , the sys t e m c a n r e a c h t h e un fo r t un a t e s t a t e wh e r e the r e i s mo r e than eno ug h phys i c a l m em o r y b u t c om p u ta b l e p r o c e s s e s c a nno t be b r o ug h t i n to memo r y b e c a u s e the bal ance s l o ts a re sti l l t i ed t o a l r e ad y o u t swa ppe d processes . Th i s s i t ua t i o n c a n be a v o i d ed by s e t t i ng BALS ETCNT to a n ad e q u a t e v a l u e . 1 4 . 4 . 3 . 2 S c a n n i ng t h e F r e e Pag e L i s t - Wh e n t h e swa ppe r loc a te s a p r o c e s s h e ad e r tha t c a n be r emoved f r om i t s b a l a n c e s l o t , i t t a ke s wh a t eve r a c t i o n s a r e r e qu i r e d t o r emove the t i e s th a t b i nd the p r o c e s s head e r to phys i c a l m em o r y . Th e f i r s t s uch s t e p i s t o e l i m i n a t e a n y t r a n s i t i o n PTEs wh e r e t h e phys i c a l pag e i s o n t h e f r e e pag e l i s t . Th i s i s a c c ompl i s hed by s c a n n i ng t h e e n t i r e f r e e pag e l i s t a nd l o o k i ng f o r pag e s wh o s e PTE a r r a y c o n t e n t s l i e wi t h i n t h e PO o r Pl pa g e ta b l e s o f the p r o c e s s h e ad e r b e i ng e x am i n ed . Wh e n e v e r s uch a pag e i s fo und , the process PTE is r eset to the c o n t e n t s o f t h e BAK a r r a y , the r e f e r e n c e c o un t a nd PTE a r r ay e l em e n t s a r e c l e a r ed , a nd the pag e is moved f r om i t s c u r r e n t l o c a t i o n to the h e a d o f t h e f r e e pag e l i s t . 1 4-20 SWAPP ING 14. 4.3.3 Fl ush i ng t h e Mo d i f i ed Pag e L i s t - Be c a us e t h e f r e e pag e l i s t i s o n l y o n e o f s e v e r a l t r an s i t i o n s ta t e s , t h e s c a n o f t h e f r e e pag e l i s t m a y n o t f r e e t h e p r o c e s s h e a d e r f o r r em o va l . Pag e s m a y b e 1n some o th e r t r a n s i t i o n s ta t e . T r a n s i t i o n s ta t e s t h a t r e p r e s e n t s o m e f o rm o f I /O i n p r og r e s s ( r e l e a s e pend i ng , r e ad i n p r og r e s s , wr i t e in p r og r e s s ) a r e l e f t a l o n e b e c a u s e the r e i s n o th i ng th a t the s wa ppe r c a n d o u n t i l t h e I /0 c ompl e t e s . Howe v e r , t h e m od i f i e d pag e l i s t c a n b e m a n i pu l a t e d . Th e d e s i r ed e f fec t is r em o v a l o f a l l pag e s f r om t h e m o d i f i ed pag e l i s t . Th i s i s t r i g g e r e d by s e t t i ng t o z e r o bo th t h e l o we r a nd uppe r l i m i t th r e s h o l d s fo r t h e m od i f i ed p a g e l i s t . C l e a r i ng the uppe r l i m i t g ua r a n t e e s tha t a nonempty l i s t h a s e x c e ed ed i t s th r e sho l d , i n i t i a t i ng a r e q u e s t fo r mod i f i ed pag e w r i t i ng . C l e a r i ng th e l owe r l i m i t c a u s e s mod i f i e d pag e wr i t i ng to c o n t i n ue un t i l t h e l i s t is empty ( be l ow the l ow l im i t t h r e sh o l d ) . 14. 4. 3.4 Out swa p o f t h e P r o c e s s Head e r - O n c e the r e f e r e n c e c o u n t f o r the p r o c e s s h e a d e r r e a c h e s z e r o , t h e h e ad e r c a n b e o u t swa pped and t h e b a l a nc e s l o t f r e ed . Th e o u t s wa p o f t h e process head e r is en t i r e l y a n a l og o us t o t h e o u t swa p o f a p r o c e s s b od y . Th a t i s , the h e a d e r pag e s tha t a r e n o t pag e t a b l e pag e s a nd the a c t i v e pag e t a b l e pag e s a r e sc a n n ed a nd put i n to the s wa ppe r ' s PTE a r r a y t o fo rm a v i r t u a l l y c o n t i g uo u s b l o c k f o r the I /0 s y s t em . Th e r e a r e s e v e r a l d i f f e r e n c e s b e twe e n the o u t swa p o f a pr o c e s s h e a d e r a nd a process body . Wh e n a p r o c e s s b o d y i s o u t s wa pped , t h e h e a d e r tha t m a ps tha t b o d y i s still r e s i d en t . Wh en the swa ppe r ' s wr i t e c ompl e t e s a nd e a c h phys i c a l pag e i s d e l e t ed , t h e c o n t e n t s o f t h e BAK a r r a y e l em e n t f o r e a c h pag e a r e put b a c k i n to the p r o c e s s PT E . P r o c e s s h e a d e r pag e s a r e m a pped by s ys tem pag e t a b l e e n t r i e s f o r tha t bal ance slot . Th e S PT E s a r e not a v a i l a b l e to ho l d th e BAK a r r a y c o n te n t s b e c a u s e the y w i l l b e u s ed b y t h e n e x t o c c upa n t o f th i s One o f the p r o c e s s h e ad e r pag e a r r a ys ( Ch a p t e r 1 1 ) i s bal ance slot . set aside fo r exac tl y th i s p u r po s e . As the p r o c e s s h e ad e r is p r o c e s sed fo r o u t s wa p , t h e c o n t e n t s o f t h e BAK a r r a y fo r e a c h a c t i v e h e a d e r pag e a r e s to r ed i n the c o r r e s po nd i ng p r o c e s s h e ad e r pag e a r ra y e l em e n t . At t h e s ame t i m e , t h e l o c a t i o n o f e a c h h e a d e r pag e wi th i n th e wo r k i ng set l i st is s to r ed in t h e WS LX a r r a y . Th i s a r r a y p r ev e n t s a p r o h i b i t i v e l y l o ng s e a r c h to r eb u i l d the p r o c e s s h e ad e r wh e n the p r o c e s s i s swa pped b a c k i n to m emo r y . On c e t h e h e ad e r i s s uc c e s s f u l l y o u t swa pped , the h e a d e r r e s i d en t b i t ( PC B $ V P HDRE S ) i n th e PC B i s c l e a r ed a nd t h e b a l a n c e s l o t i s ava i l ab l e fo r f urth e r u s e . 14. 5 INSWAP OPERAT I ON The i n s wa p i s e x a c t l y the oppo s i t e o f t h e o u t s wa p o pe r a t i o n . Th e s wa ppe r b r i ng s the p r o c e s s h e a d e r , i n c l ud i ng a c t i v e pag e t a b l e s , a n d t h e p r o c e s s b o d y b a c k i n to phys i c a l m emo r y . I t then u s e s t h e c o n t e n t s of t h e wo r k i ng set l i st to r eb u i l d t h e p r o c e s s pa g e ta b l e s , wh i c h mo s t l y m e a n s upd a t i ng e a c h v a l i d PTE t o r e f l ec t the PFN th a t c o n t a i n s it. At the s a m e t i me tha t e a c h pag e i s b e i ng p r o c e s s e d , t h e s wa ppe r 1 4-21 SWAPPING c a n r e so l v e a n y s pe c i a l o u t swa pped . cases tha t ex i s ted wh e n the proc e s s wa s S e l ec t i o n o f a n I n swa p C a n d i d a te 14. 5. 1 As m e n t i o ne d e a r l i e r i n t h e c h a p t e r , t h e s wa ppe r s e l e c t s a p r o c e s s fo r i n swa p e x a c t l y l i k e t h e s c h ed ul e r s e l e c t s a c a nd i d a t e fo r e x ec u t i o n . Po t e n t i a l c a n d i d a te s fo r i n swa p m a y b e • • • n ewl y c r e a t ed p r o c e s s e s , p r o c e s s e s i n s o m e o u t swa pped wa i t s ta t e t h a t we r e c omp u t a b l e , o r m ad e p r o c e s s e s t h a t we r e o u t s wa pped wh i l e i n th e compu t a b l e s t a t e . Th e h i g h e s t p r i o r i ty p r o c e s s i n t h i s co l l e c t i o n i s for i n s wa p . 14. 5. 2 j us t the one s e l e c ted I n swa p o f t h e P r o c e s s Head e r I f t h e p r oc e s s h e a d e r wa s o u t s wa pped wh e n t h e bod y wa s o u t s wa pped , it m u s t b e b ro ug h t b ac k i n to m emo r y b e fo r e t h e p r o c e s s bod y c a n b e r e con s t r uc t ed . Un l i ke t h e s p e c i a l o pe r a t i o n s tha t too k p l a c e wh e n t h e process wa s o u t s wa ppe d , a n o u t s wa pped p r o c e s s h e a d e r m e r e l y ad d s two d e ta i l s to t h e i n s wa p o pe r a t i o n . 1. I f t h e h e ad e r i s r e s i d e n t , t h e n um b e r o f f r om t h e s i z e o f t h e o u t s wa p s ub t r a c t e d the h e a d e r wh e th e r is is, file. Th a t d e t e rm i n e s t h e to t a l n um b e r o f b l oc k s tha t t h e swa p f i l e a nd t h e v i r t ua l b l oc k n umbe r s h o u l d b eg i n . 2. I f the h e a d e r wa s swa pped , t h o s e p r o c e s s pa r am e t e r s t h a t are t i ed to a spec i f i c b a l a nc e s l o t ( th a t i s , s pec i f i c s y s t em v i r t ua l o r phys i c a l a d d r e s s e s ) m u s t b e a d j us ted to r e f l ec t the new l o c a t i ons i n v i r t ua l o r phys i c a l add r e s s s p a c e . Th e s e i n c l ud e t h e fo l l o w i ng . • • • • h e a d e r pag e s is i m a g e i n the s wa p r e s i dent or no t m u s t b e r e ad f r om wh e r e the r e ad Obv i o u s l y , e a ch S PTE m u s t b e l o a d ed w i th the PFN c o n ta i n s t h e c o n t e n ts o f e a c h p r o c e s s h e a d e r pag e . tha t Th e v i r t u a l a d d r e s s e s o f t h e P O and P l pag e tab l es m u s t b e c a l c u l a t ed a nd l o ad ed i n to the i r l o c a t i o n s i n the h a r d wa r e PCB . Th e phys i c a l add ress o f t h e h a r d wa r e PC B m u s t be l o a d ed and c a l c u l a ted i n to t h e so f t wa r e PC B ( i n f i e l d PC B $ L_P H Y PCB ) . F i n a l l y , t h e P l pag e s t h a t d o ub l e m a p the p r o c e s s h e a d e r pag e s t h a t a r e n o t pag e t a b l e pag e s m u s t b e l o a d ed w i th t h e new pag e f r am e n umbe r s tha t c o n t a i n t h e s e pag es . 14-22 SWAPPING 1 4 . 5 . 2 . 1 Reb u i l d i ng t h e P r o c e s s He a d e r - Wh e n a p r o c e s s h e ad e r is r e ad f r om t h e s wa p i m ag e i n t o a n ew b a l a n c e s l o t , t h e S PTEs t h a t m a p e ac h b a l a n c e s l o t pag e m u s t b e l o ad ed w i t h t h e PFNs f r om t h e s wa ppe r m a p t h a t c o n t a i n e a c h h e ad e r pag e . I n ad d i t i o n , t h e PFN d a t a b a s e m us t b e s e t u p fo r e a c h o f t h e s e phys i c a l pag e s . Th e swa ppe r d o e s a l l th i s wo r k i n a v e r y s i mpl e l o o p t h a t i t e x e c u t e s f o r e a c h h e a d e r pag e . Th e s i mpl i c i t y ( a nd s pe ed ) o f th e l o o p r e s u l t s f r om th e u s e o f the two process head e r pag e a r r a ys tha t ex i s t i n t h e p r oc e s s h e ad e r . Th e s e a r r a y s a l l o w t h e PFN BAK a nd WS LX a r r a ys to be l oaded wi th t he i r p r ev i o u s c o n t e n t s ( b e c a u s e t h e two h e a d e r a r r a y s we r e l o ad ed wh e n the p r o c e s s wa s o u t swa pped ) . 1 4 . 5 . 2 . 2 P 1 W i nd ow t o t h e P r o c e s s He a d e r - A l l o f the p r o c e s s h e a d e r pag e s e x c e p t p r o c e s s pag e t ab l e s a r e d o ub l e ma pped w i th a r a ng e o f P l add r e ss e s . Th i s i s d o n e fo r t h e f o l l o w i ng r eason . Wh e n a process h ead e r is o u t s wa pped a nd s ub s e q ue n t l y i n swa pped , i t p r o b ab l y r e s i d e s i n a d i f f e r e n t b a l ance s l o t . Any r o u t i n e that s to r e s tha t process h e a d e r a d d r e s s i n a r eg i s t e r a nd t h e n r e f e r e n c e s h e ad e r l o c a t i o n s w i th a d i s p l a c e m e n t f r om th i s r eg i s t e r m i g h t b e r e f e r e nc i ng t h e h e ad e r of a no t h e r p r oc e s s if some s c h ed u l i ng a nd swa pp i ng o c c u r r e d b e twe e n o b t a i n i ng t h e h e a d e r b a s e ad d r e s s a nd l a t e r r e f e r e nc e s . To avo i d t h i s p r o b l em , a r a ng e o f P l s pa c e i s s e t up by t h e s wa ppe r to map these s am e h e ad e r p ag e s . Th e P1 pag e s a r e m a pped in s uc h a wa y tha t , even if a n o u t s wa p a nd l a te r i n swa p o c c u r b e t we e n two i ns t r uc t i o n s , t h e P 1 v i r t ua l a d d r e s s e s o f the p r o c e s s h e ad e r pag e s d o n o t c ha ng e . Th e c o n v e n t i o n s tha t VM S o b s e r v e s a b o u t h e a d e r r e f e r e n c e s a re these . • • • An y r e f e r e n c e to t h e p r o c e s s h e a d e r sho u l d u s e t h e P l a d d r e s s ( C T L $ G L PHD c o n t e n t s po i n t to the Pl map of the process h e ad e r ) � Any r e f e r e n c e to t h e s y s t e m s p a c e h e a d e r I P L 7 ( I PL $ _S YN C H ) t o p r e v e n t a swa p . m us t ex ec ute An y r e f e r e n c e t o p r o c e s s pag e t a b l e s m u s t ex ec u t e at b e c a us e t h e pag e t a b l e pag e s a r e n o t d o ub l e mapped . at I PL 7 Th e r e a r e two i mp l i c a t i o n s f o r VM S h e r e . • • Th e s e ph ys i c a l pag e s a r e n o t k e pt t r ac k o f i n a n y wa y t h r o ug h r e f e r e n c e c o un t s or a n y o th e r t e c h n i qu e . Howe v e r , a l l o f t h e s e h e ad e r pag e s a r e a pe r m a n e n t pa r t o f the process wo r k i ng s e t . Th e P l pag e t a b l e pag e t h a t m a ps t h e s e pag e s m u s t a l so p e r m a n e n t memb e r o f t h e p r o c e s s wo r k i ng s e t . 1 4-23 be a SWA P P I NG 14. 5. 3 Re b u i l d i ng t h e P r o c e s s Bo d y Th e pr o c e s s h e ad e r m u s t b e p u t i n to a kn own s t a t e b e f o r e t h e p r o c e s s b o d y c a n b e p u t bac k i n t o t h e a pp r o x i m a t e sh a pe i t wa s i n b e f o r e t h e p r o c e s s wa s o u t swa ppe d . I f t h e h e a d e r wa s n e v e r o u t swapped , t h e r e is v e r y l i t tl e that has t o be done . I f the h e a d e r wa s o u t swa pped , t h e s t e ps j u s t d e sc r i b ed a r e t a k e n t o p u t t h e p r o c e s s h e a d e r ba c k tog e th e r ag a i n . 1 4 . 5 . 3 . 1 Re b u i l d i ng t h e Wo r k i ng S e t L i s t a nd P r o c e s s Pag e Tab l e s Th e r e b u i l d i ng o f t h e p r o c e s s b o d y i nvo l v e s a s i mpl e s c a n o f bo th t h e swa ppe r m a p a nd the p r o c e s s wo r k i ng s e t l i s t . Re c a l l tha t a t o u t s wa p , t h e k e y to e a c h s pe c i a l c a s e wa s t h e c om b i n a t i o n o f phys i c a l pag e t yp e a nd t h e s e t t i ng o f th e v a l i d b i t i n t h e pag e t a b l e e n t r y . On i n swa p , the k e y t o e a c h s p e c i a l c a s e i s t h e c o n t e n t s o f t h e pag e t a b l e e n t r y l o c a t ed b y t h e v i r t ua l pag e n um b e r f ield i n t h e wo r k i ng set l is t ent r y . An a pp r o x i ma t i o n o f s wa ppe r a c t i v i t y f o r e a c h pag e i s a s fo l l o ws . 1. Th e pag e t a b l e e n t r y i s l o c a t ed f r om t h e WSLE . VPN f i eld of the 2. I n the u s ua l c a s e , t h e o r i g i na l c o n t e n t s o f t h e PTE a r e put i nto t h e P F N B AK a r r a y a nd t h e P F N f r om th e swa ppe r m a p i s l o ad ed i n t o t h e n o w v a l i d PTE . 3. I f f o r s o m e r e a s o n a c o py o f the pag e a l r e a d y e x i s t s in memo r y , t h e n t h a t pag e i s p u t i n to t h e p r o c e s s wo r k i ng s e t a nd t h e d u pl i c a t e pag e f r om t h e swa ppe r m a p is rel eased to t h e f r o n t o f t h e f r e e pag e l i s t . Tab l e 1 4 - 5 c o n t a i n s a d e t a i l ed l i s t o f t h e d i f f e r e n t c a s e s tha t the swa ppe r c a n e n c o un te r wh e n r e b u i l d i ng the p r o c e s s pag e t a b l e s . Th r e e o f t h e c a s e s d e s e r v e s p e c i a l c ommen t . 14. 5 . 3 . 2 Pag e s wi t h I / O i n P r og r e s s Wh e n O u t swa p Oc c u r r ed Pag e s tha t h a d I /0 i n p r og r e s s wh en t h e p r o c e s s wa s o u t swa pped we r e wr i t t e n t o t h e swa p f i l e a n ywa y t o r e s e r v e s pa c e . I f t h e pag e wa s p r ev i o u s l y unm o d i f i ed , t h e n i t wo u l d b e p u t o n to the f r e e pag e l i s t wh en bo th t h e s wa p wr i te a nd t h e o u t s t a nd i ng w r i t e o pe r a t i o n c ompl e t ed . I f the pag e wa s p r ev i o u s l y mo d i f i ed , t h e n i t wo u l d be p u t o n to t h e m o d i f i ed pag e l i s t wh e n b o th t h e swa p w r i t e a nd t h e o u t s t a nd i ng wr i t e o pe r a t i o n c om p l e ted ( b e c a u s e t h e c o n t e n t s o f t h e SWPVBN a r r a y we r e n o n z e r o ) - • I n e i th e r c a s e , i t i s po s s i b l e f o r the p r o c e s s to be swa pped bac k in b e f o r e o n e o f t h e s e phys i c a l pag e s wa s r e u s e d . Th e swa ppe r us e s th e phys i c a l p a g e tha t i s a l r e ad y c o n t a i ned in the process PTE ( as a t ra ns i t i on pag e ) and r el eases t h e d upl i c a t e ph ys i c a l pag e f r om th e swa ppe r m a p to t h e f r o n t o f t h e f r e e pag e l i s t . I n t h e c a s e o f a pag e o n t h e f r e e pag e l i s t , t h i s d e c i s i o n i s s impl y o �e o f c o nv e n i e n c e . I n t h e c a s e o f a pag e o n t h e mod i f i ed pag e l i s t , t h e c o n t e n t s o f the pag e i n t h e swa p i m ag e a r e o u t o f d a t e a nd th e swa ppe r h a s no cho i c e b u t to u s e the phys i c a l pag e tha t i s a l r e a d y i n m em o r y . 14-24 SWAPP ING Ta b l e 1 4 - 5 Re b u i l d i ng the Wo r k i ng Se t L i s t and t h e P r o c e s s Pa g e Ta b l e s a t I n swa p At i nswap t ime , the swapper uses the contents o f the page tab l e entry to d eterm i n e wha t a c t i o n to take fo r each pa r ti c ul ar pag e . Type o f Pag e Tab l e Entry 1 . PTE i s v a l id 2. 3. Ac t ion o f Swa ppe r fo r Th i s Pag e Pag e i s l oc ked i n to memo r y and wa s never o utswapped . PTE i nd i cates a tran s i t io n pag e { probabl y d ue to outstand i ng I/0 when proc e ss wa s o utswapped ) Fa ul t tran s i t i o n pag e into proc ess wo r k i ng set . Re l ease d upl i c a te pag e tha t wa s j ust swapped i n . PTE conta ins a g lobal pag e tab l e i nd ex ( G PTX) Swa ppe r ac t i o n i s based o n the contents o f the g l obal pag e tab l e entry ( G PTE ) ( Pag e must b e g lobal r ead -onl y because g lobal read/wr i te pag e s we re d ropped from the wo r k i ng set a t outswap t ime . ) a . I f the g lobal pag e tabl e entry i s val id , add the PFN i n the GPTE to the process wo r k i ng set and rel ease the d upl i c a te pag e . b . I f the g lobal pag e tabl e entry i nd icates a transi tion pag e , make the g lobal pag e tabl e e n t ry val id , add tha t phys i c a l pag e to the process wo r k i ng se t , and rel ease the d upl i c a t e pag e . c . I f the g lobal pag e tabl e entry i nd icates a g lobal sec t i o n tabl e i nd ex , then keep the pag e j ust swapped i n , and make that the maste r pag e in the g lobal pag e tab l e entry as we l l a s t h e s l ave pag e in t h e process pag e tabl e en tr y . 4. PTE cont a i n s a pag e f i l e i nd ex o r a process sect i o n tab l e i nd ex Th i s i s the usual contents fo r pag es tha t d id not have o utstand i ng I /0 or o ther pag e r e fe renc es when the process wa s o ut swapped . The PFN i n the swappe r map i s i ns e r ted i n to the proc ess p�g e tab l e . The PFN a r r ays a r e i n i t i a l i zed fo r that pag e . 1 4 . 5 . 3 . 3 Reso l ut i o n o f G l oba l Re a d -On l y Pag e s - Th e only po s s i b l e g l obal pag e t h a t c o u l d b e i n t h e s wa p f i l e i s a g l o b a l r e ad - o n l y pag e t h a t h a d a sh a r e c o un t o f o n e wh e n the p r o c e s s wa s o u t s wa pped (or a pag e t h a t wa s e x p l i c i t l y l o c k e d ) . Al l o th e r g l o b a l pag e s we r e d r o pped f r om the p r o c e s s wo r k i ng s e t b e f o r e t h e p r o c e s s wa s o u t s wa pped . Th e r e a r e t wo d i f f e r e n t c a s e s tha t the swa ppe r wi l l f i nd wh e n r eb u i l d i ng t h e p r o c e s s pa g e t a b l e s . In e i th e r c a s e , t h e p r o c e s s pag e t a b l e e n t r y c o n t a i n s a g l o b a l pag e table i nd e x so the d e t e rm i n i ng f a c t o r i s t h e c o n t e n t s o f the g l ob a l pag e t ab l e e n t r y . 1. Th e g l ob a l p a g e t a b l e e n t r y c o n t a i n s a g l o b a l sec t i o n tab l e i nd e x . I n t h i s c a s e , t h e phys i c a l pag e f r om t h e swa ppe r m a p i s a d d ed t o t h e g l oba l page t a b l e e n t r y a s we l l as the p r o c e s s pag e t a b l e en t r y . 2. I t i s po s s i b l e t h a t t h e g l ob a l pag e wa s r e f e r e n c ed b y s o m e o th e r p r o c e s s wh i l e t h i s p r o c e s s wa s o u t swa pped . I n tha t c a s e , th e g l o b a l pag e t a b l e e n t r y m i g h t c o n t a i n a t r an s i t i on o r v a l i d PTE . I n e i th e r c a s e · , t h e PFN th a t i s a l r e a d y i n t h e g l obal pag e tabl e entry i s kept . (If t h e G PTE is in t r an s i t i on , it i s m a d e v a l i d . ) Th e d upl i c a t e PFN f r om t h e swa ppe r m a p i s r e l e a s e d t o t h e f r o n t o f t h e f r e e pag e l i s t . 14-25 SWAPP I NG 1 4 . 5 . 3 . 4 Ac t i ve T r a ns i t i o n Pages - O n e o th e r f o rm o f PTE d e s e rv e s no t e . Rec a l l f r om Ch a p t e r 1 2 that it is po s s i b l e t o mod i fy t h e wo r k i ng s e t l i s t s c a n by s e t t i ng the s pe c i a l S Y S B OO T pa r am e t e r S K I PWS L Th e m od i f i ed s c a n o f t h e wo r k i ng s e t l i s t t u r n s o f f t h e to nonz e r o . v a l i d b i t f o r pag e s o n i t s f i r s t pa s s , l e a v i ng the pag e s i n the a c t i v e t r a n s i t i on state . Th e s wa ppe r s i g n a l s s uc h pag e s wh e n a p r o c e s s i s o u t swa pped by s e t t i ng i n th e WSLE f o r the a c t i v e t r a n s i t i o n pag e s . a bit ( WS L $V G OO D PAG E ) Wh e n s uc h pag es a r e e nc o u n te r ed a s pa r t o f the i n s wa p l o o p , th e swa ppe r t r e a t s them e x a c t l y l i k e v a l i d pag e s e x c e p t tha t the v a l i d b i t i n t h e PTE i s n ev e r t u r n e d o n . I n th i s wa y , t h e o cc u r r en c e o f a n o u t s wa p d o es n o t i n t e r f e r e i n a n y wa y w i th t h e m o d i f i ed s c a n o f t h e ( I f S K I PW S L i s s e t to z e r o , i t s d e fa u l t v a l u e , s uc h wo r k i ng s e t l i s t . a c t i ve t r a n s i t i o n pag e s c a n n ev e r e x i s t . ) 14. 5. 3. 5 Ex ampl e o f a n I n swap O pe r a t i o n - To i l l us t r a t e a t l ea s t s o m e of the s pe c i a l c a s e s th a t t h e swa ppe r e n c o un t e r s wh e n a p r o c e s s bod y i s s wa pped bac k i nto memo r y , Figures 1 4-5 t h r o ug h 1 4-7 conta i n an e x ampl e o f a n i n swa p o pe r a t i o n . No t e tha t t h i s e x ampl e i s no t r e l a te d to the o u t s wa p e x am p l e u s ed b e fo r e ( Fi g u r e s 14-2 to 1 4-4 ) . Th i s e x am p l e is t a i l o r ed to i l l u s t r a te the i n t e r e s t i ng c a s e s the swa ppe r c a n e nc o un te r d u r i ng a n i ns wa p o pe r a t i o n . F i g u r e 1 4 - 5 s hows th e s ta t e o f the p r o c e s s h e ad e r a f t e r the p r o c e s s h a s b e e n s e l e c ted a s a n i n swa p c a nd i d a t e . F i g u r e 1 4 - 6 s hows th a t f o u r phy s i c a l pag e s h a v e b e e n a l l o c a t ed to c o n t a i n t h e f o u r wo r k i ng pag e s tha t the e x ampl e i s d e sc r i b i ng . F i g u r e 1 4 - 7 s h o ws the r e b u i l t p r o c e s s pag e t ab l e s a nd t h e P F N d a t a b a s e c h a ng e s tha t r e s u l t f r om r e b u i l d i ng th e wo r k i ng s e t a nd p r o c e s s p a g e t a b l e s . 1. Th e f i r s t wo r k i ng set l i st e n t r y l o c a t e s v i r t ua l pag e Th i s PTE c o n ta i n s a g l o b a l pag e tab l e i nd e x . Th e n um b e r X . r e f e r e nc ed g l o b a l pag e t a b l e e n t r y ( G PTE T ) c o n ta i n s a g l oba l s e c t i on table i nd e x , i nd i c a t i ng th a t th e g l o b a l pag e ta b l e entry i s no t val i d . Th e pag e f r am e n um b e r ( PFN D ) i s put i n to the p r o c e s s pag e tabl e . It i s a l so a d d ed to the g l o b a l pag e d a ta b a s e b y m a k i ng t h e G PTE v a l i d ( F i g u r e 1 4 - 7 ) , p u t t i ng PFN D i n to the G PTE , a nd upd a t i ng the P F N d a t a fo r phys i c a l pa g e D t o r e f l ec t i t s new s t a t e . 2. Th e nex t wo r k i ng s e t l i s t e n t r y i s a p r o c e s s pag e m a pped by PTE W ( Fi g u r e 1 4-6 ) . Th i s PTE c o n ta i n s a p r o c e s s s e c t i o n t a b l e i nd e x . Th e PT E i s u pd a t ed t o c o n t a i n PFN C a nd the PSTX i s s t o r ed in the BAK a r r a y e l emen t f o r th a t pag e ( Fi gu r e 1 4 - 7 ) . O t h e r PFN a r r ay s a r e u pd a ted a c c o r d i ng l y . 3. Th e n e x t wo r k i ng s e t l i s t e n t r y ( th a t l o c a t e s PTE Y ) is e x a c t l y l i ke the f i rst , a s f a r a s the process d a ta i s conce rned . Howe v e r , t h e g l o b a l pag e t a b l e e n t r y ( G PTE S ) is val id , i nd i c a t i ng t h a t a no th e r c o py o f th i s pag e a l r e a d y ex i sts . ( Th i s c o ul d o n l y h a v e h a pp e n e d i f ano the r process f a u l t ed t h e pa g e wh i l e th i s p r o c e s s wa s o u t swa pped . ) Th e d up l i c a te pag e ( PFN E ) i s r e l e a s e d to the f r o n t o f the f ree l i st . Th e p r o c e s s pag e t ab l e e n t r y i s upd a t ed to c o n t a i n th e phys i c a l pag e tha t a l r e a d y e x i s t s ( PFN B) and th e s h a r e c o un t fo r t h a t pag e is i nc r em e n ted ( f r om th r e e to fou r ) 14-26 • SWAPPING 4. Th e f o u r th wo r k i ng s e t l i s t e n t r y l o o k s j us t l i k e the s e c o nd . Howev e r , th e p r o c e s s pa g e t a b l e e n t r y i nd i c a t e s a t r a n s i t i o n pag e . ( Th i s i mp l i e s th a t the h e ad e r in th i s e x am p l e wa s n ev e r o u t swa pped . ) Th e a c t i o n t a k e n h e r e i s s i m i l a r to s t e p 3 , wh e r e a d up l i c a t e g loba l pag e wa s d i sc o v e r ed . Th e pag e j us t r e a d ( PFN F ) i s r e l e a s ed t o th e h e a d o f the f r e e l i s t . Th e t r a n s i t i o n pag e ( PFN A ) is f a ul ted back i n to the p r o c e s s wo r k i ng s e t by r em o v i ng t h e pag e f r om the f r e e l i s t , s e t t i ng i ts s ta te to a c t i v e , and t u r n i ng the v a l i d b i t i n th e PTE b a c k o n . 14. 5. 3. 6 F i n a l P r o c e s s i ng o f t h e I n swa p Ope r a t i o n - A f t e r the wo r k i ng s e t l i st h a s b een s c anned a nd the p r o c e s s pag e ta b l e s r eb u i l t , the p r o c e s s i s r ead y t o h av e i ts s t a t e c h a ng ed f r om c om pu ta b l e but o u t swa pped to c om p u t a b l e a nd r e s i d ent . Seve r a l o th e r s c h e d u l i ng d e ta i l s m u s t be t a k e n c a r e o f b e fo r e the s c h ed u l e r i s no t i f i ed . 1. A n ew v a l u e o f A S T LVL i s c a l c u l a t ed and l o ad ed i n to the h a r d wa r e PC B in the process header . ASTs may have b e e n e n q u e ue d to the p r o c e s s wh i l e i t wa s o u t s wa pped . The h a rdwa r e PC B , wh i c h c o n t a i n s a c o py o f the A S T LVL r eg i s t e r , wa s no t a v a i l a b l e wh i l e the h e ad e r wa s n o t r e s i d e n t . 2. Th e r e s i d e n t b i t a n d the i n i t i a l q u a n t um b i t l o ngwo r d i n th e so f twa r e PC B a r e s e t . 3. A n e w q u a n t um i n t e r v a l i s l o ad ed i n to the p r o c e s s h e ad e r . 4. Finally , the c om p u t a b l e . sc h ed u l e r is 1 4-27 c a l l ed to make in the the s t a t us process Process Header for swapped process Fixed Portion Working Set List A wsle 1 wsle 2 wsle 3 wsle 4 Proc ess S e c t i o n Table. etc. [ I cl ol WSLX BLINK B PTE pgflx gpte s gstx BLINK 0 BLINK 0 • • • STATE BAK pte Z P F N D a t a b a s e A rr a y s TY PE o t her G Ro S HRC N T = 3 � D B I l I � D � D 1 • • • PO Page Table vpn W .... � I 1\.) co pte W vpn X gpte S vpn Y g l o b a l page t a b l e S W P $ G L- M A P "� S w a pp e r' s 1/0 Map gpte T v pn Z Figure 14-5 Wo r k i ng Se t L i s t a nd Swa ppe r Ma p Be fo r e Ph ys i c a l Pag e Al l o c a t i o n Process Header for swapped process Fixed Portion Working Set List vpn X G R O wsle 1 vpn w PPG wsle 2 vpn y G R O wsle 3 vpn z PPG wsle 4 Table. et c . vpn W 0 PO Page Table pstx vpn X 0 gptx (T) pte X 0 gptx ( S ) pte Y pfn A P 1 Page Table pte Z vpn Y vpn Z 0 Figure 1 4-6 pte W PTE pte Z A I BLINK W S LX B c I o[ FI E gpte S gpte T gpte S I I_ 0 0 ,I 0 ,, 0 gstx ST A TE TYPE I free f D valid, pfn B �---� other � I G R ot lsH R CNT :;: 31 D D D D PFN Database A rr a y s global page table gstx pgflx BAK SWP$G L_MAP " Swapper's 1/0 Map l':J �---� Wo r k i ng Se t L i s t a nd Swa ppe r Ma p Af t e r Ph ys i c a l Pag e A l l o c a t i o n Process Header tor swapped process W S LX A Fixed Portion Working Set List vpn vpn �· vpn vpn I-" � I w 0 GRO GRO X w PPG y z PPG wsle 3 wsle 4 c 0 E PO P a g e Table F 1 pfn C vpn X 1 pfn 0 vpn Z wsle 2 B Process Section Table. etc. vpn W vpn Y wsle 1 1 1 .. p fn B pte W .·. pfn A pt e Y ' BAK pgflx gpte s gstx w sle 4 I I I I I I I I 2 I I e¥� w I I I I gpt'J I I I I 0 I I BLINK I I I I w sle BUNK 0 p${� gst.x STATE TY PE tr��t I IPRG] B IGRol global page t able gpte S v a l i d , pfn B �---� gpte T �------�--���� SWP$GL-MAP ''=i:] S w a p pe r s 1/0 Map ' pte Z P 1 Page Table F i g u r e 1 4 -7 other B I PPG) B lGRo J lsHRCNT : 1 1 l rree l D ltr�e l D P F N D a t a b a se A rr a y s pte X � PTE pte z Wo r k i ng S e t L i s t a nd Re b u i l t Pa g e Ta b l e s PART V I N PUT/O UTPUT De l a y no t C a e s a r . Re ad i t i n s t a n t l y . J u l i u s Ca e s a r III , l He r e i s a l e t t e r , r e ad i t a t yo u r l e i s u r e . Me r c h a n t o f Ve n i c e V, l CHAPTER 1 5 VAX/VMS DEVI C E DR I VERS A VAX/VM S d ev i c e d r i v e r i s a c o l l e c t i o n o f t a b l es a nd r o u t i n e s u s e d to c on t r o l I /0 o pe r a t i o n s o n a pe r i ph e r a l d ev i c e . Th e VAX/VM S Gu i d e to W r i t i ng a D e v i c e D r i v e r d e s c r i be s t h e g e ne r a l s t r uc t u r e o f a d r i v e r , a nd I n t r o d uc e s t h e s ys t em r o u t i n e s c ommo n l y c a l l ed by d ev i c e d r i v e r s . Th i s c h a p t e r h i g h l i g h t s v a r i o u s t e c h n i q u e s used by s e l e c ted s ys t em d r ive r s , a nd d oc um e n t s s ome of the d ev i c e - s pe c i f i c p r o c e s s i ng pe r f o rmed b y t h e m . Th e i n t e n t i s to p r e s e n t tho s e t e c h n i q ue s th a t a r e hel pful in und e r s t a nd i ng the VAX/VM S I /0 s ub s y s t em b u t a r e no t d e sc r i b ed i n t h e VAX/VM S G u i d e to Wr i t i ng a De v i c e Dr i v e r . No a t t e m p t i s m a d e to d i sc u s s e a c h VAX/VM S d ev i c e d r i v e r , no r i s e v e r y f e a t u r e o f a pa r t i c u l a r d r i v e r d e s c r i b ed . Fo r d e t a i l ed d e sc r i p t i o n s o f the f e a t u r e s a nd c a pa b i l i t i e s p r ov i d ed by e a ch s uppo r t ed d ev i c e d r i v e r , s e e the VAX/VM S I /O Us e r ' s G u i d e . 15. 1 D I S K DR I VERS D i s k s a r e r a nd om a c c e s s ma s s s to r ag e d ev i c e s pl a c ed e i th e r o n the MAS SBUS ( RM 0 3 , RM 0 5 , RM 8 0 , RP0 6 ) o r on the UN I B US ( R L 0 2 , RX0 2 , RK 0 6 / 7 ) . Th e d r i v e r s wr i t t e n fo r t h e s e d ev i c e s a r e d e s i g n ed to • t a ke a d v a n tag e of the h a r d wa r e e r r o r r e c o v e r y a nd co r r e c t i on c a pa b i l i t i e s s uc h a s d a ta c h e c k i ng , o f f s e t r e c o v e r y , a nd e r ro r c o d e c o r r ec t i o n ( ECC ) , • o p t i m i z e c o n t r o l l e r o p e r a t i o n s by o ve r l a pp i ng s e e k t r a n s f e r o pe r a t i o n s , • pe r f o rm dynam i c b a d b l o c k h a nd l i ng , • s u ppo r t o n- l i n e d i ag no s t i c s a nd e r r o r l og g i ng , a nd • s u ppo r t I /0 r e qu e s t s a t t h e l og i c a l and phys i c a l l e v e l s , c o o pe r a t e wi t h a n An c i l l a r y Co n t r o l Processo r ( AC P ) s uppo r t v i r t ua l I/O r e que s t s . a nd d a ta a nd to Th e VAX/VM S I /0 Us e r ' s G u i d e c o n t a i n s a g e n e r a l d i s c u s s i o n o f some o f t h e d i s k d r i v e r c h a r a c t e r i s t i c s l i s t e d above . Th e fo l l o w i ng s e c t i o n s s uppl em e n t t h e i n f o rma t i o n p r e s e n t e d th e r e . 1 5- 1 VAX/VMS DEVI C E DRIVERS 15. 1. 1 ECC E r r o r Re c o v e r y E C C e r r o r s o c c u r on l y o n r e ad o pe r a t i o n s ( r e ad d a t a , r e ad h e ad e r a nd d a ta , wr i t e c h e c k d a t a , a n d w r i t e c h e c k h e ad e r and d a t a ) . Th ey a r e c o r r e c ted by a pp l y i ng a h a r d wa r e- s p e c i f i ed c o r r e c t i o n ma s k to the a pp r o p r i a t e memo r y d a t a . Th e transfer i s then c o n t i n u e d a s i f a n e r r o r n e v e r o cc u r r e d . Th e a c t u a l e r r o r c o r r e c t i o n c o d e c o n s i s t s o f 1. an 1 1 -b i t m a s k tha t mus t a pp r o p r i a t e memo r y d a t a , a nd be e x c l us i v e 2. a b i t n umb e r w i t h i n t h e s e c to r tha t s pe c i f i e s t h e e r ro r b u r s t . ORed the wi th s ta r t the of D i s k d r iv e r s c al l rout ine I OC $ A P P LY E C C ( i n mod ul e I O S UB RAM S ) to I OC $APP LYECC r eq u i r e s t h e u s e o f a a c t ua l l y a pp l y the ECC c o r r e c t i o n . s y s tem p a g e t ab l e e n t r y ( S PT E ) . Dev i c e d r i v e r s th a t s uppo r t ECC r e c o v e r y s pe c i f y the DPT$V SVP f l ag i n the f l ag s a rg um e n t t o the DPTAB mac ro . Wh e n th i s f l ag i s se t , the S Y S G E N C ONN E C T c omma nd a l l o c a te s a n S PTE f o r e ac h un i t a nd s to r e s t h e s ys tem v i r t ua l pag e n umb e r i n f i e l d UC B $ L S VPN i n t h e un i t c o n t r o l b l o c k . Th e s y s tem pag e ta b l e e n t r y is u s e d - t o d o ub l e m a p a b y t e t o b e c o r r e c t ed . Th e d r i v e r mus t a l s o s pe c i fy t h e n um b e r o f byt e s tha t we r e t r a n s f e r r ed i n to m emo r y ( up t o , b u t n o t i nc l ud i ng , t h e b l o c k to b e c o r r e c t ed ) . Th i s c a n be c a l c u l a t ed by a d d i ng the r ema i n i ng byte c o un t ( l o a d ed b y the d r i v e r f r om a MAS S B U S a d a p t e r c on t r o l r eg i s t� r , MBA $ L B C R , i n to t h e un i t c o n t r o l b l o c k , i n f i e l d UC B $W B C R ) t o t h e t r a n s f e r -b y t e c o un t ( UC B $W BCNT ) . Th e f o l l o w i ng s t eps are pe r f o rmed to a pp l y t h e c o r r e c t i o n . 1. Th e t r a n s f e r r ed b y t e c o un t i s d e c r em e n ted , a nd t h e n ANDed w i t h A X l F F to c a l c ul a t e the b y t e o f f s e t f r om t h e s t a r t of the b u f f e r to t h e b l o c k tha t c o n t a i n s t h e d a t a to be c o r r e c ted . 2. Th e s t a r t i ng b i t n umb e r o f t h e e r r o r b u r s t ( a n umb e r i n the r a nge f r om 1 to 4096) i s d ec r em e n t e d to c o nv e r t i t to a r e l a t i v e b i t n umb e r , a nd the r e s u l t i s s e pa r a t e d i n to a b y t e o f f s e t wi th i n b l o c k a nd a ma s k s h i f t c o un t . 3. Th e by t e o f f s e t w i th i n b l o c k i s ad d ed to the b y t e o f f s e t f r om buffer c a l c u l a t ed i n s tep 1 . Th e r e s u l t i s the b y t e o f f s e t w i th i n bu f f e r t o t h e s t a r t o f t h e e r r o r b u r s t . 4. Th e e x c l us i v e OR pa t t e r n m a s k i s s h i f t ed s h i f t c o un t c a l c u l a t ed i n s t e p 2 . left by the mask At th i s po i n t t h e l o ng wo r d e x c l u s i v e OR pa t t e r n and the byte o f f s e t w i th i n b u f f e r t o t h e f i r s t b y t e to be c o r r e c t ed have be e n c a l c u l a t ed . A l l th a t r ema i n s i s to d o ub l e m a p the d a t a b l o c k t o b e c o r r ec t ed , a nd e x c l u s i v e OR t h e pa t t e r n m a s k w i th memo r y . Ho we v e r , t h e fo l l o w i ng c o n s i d e r a t i o n s m u s t b e mad e . a. Th e t r a ns f e r m a y h a v e b e e n s a t i s f i ed pa r t wa y t h r o ug h t h e l a s t b l o c k , a nd t h e e r r o r c o r r e c t i o n i s o u t s i d e the d a t a � f i n te r e s t . Fo r e x am p l e , t h e b y t e c o un t t e rm i n a t ed a f te r 20 byt e s i n to the s e c to r , a nd the c o r r e c tab l e d a t a s t a r t s a t byt e 3 5 . 1 5- 2 VAX/VMS DEVI C E DR I VERS b. Th e t r an s f e r m a y h av e b e e n s a t i s f i ed l a s t b l o c k , a nd t h e e r r o r c o r r e c t i o n p a r t l y o u t s i d e t h e d a ta o f i n t e r e s t . byt e c o un t t e rm i n a t ed a f t e r 2 0 byt e s t h e c o r r e c t a b l e d a ta s t a r t ed a t byt e pa r t wa y t h r o ug h i s pa r t l y i n s i d e Fo r ex ampl e , i n to t h e s e c t o r , 19. the and the a nd Th u s , t h e c o r r e c t i o n m u s t b e a pp l i ed one byte a t a t ime . S t e ps 5 t h r o ug h 7 a r e r e pe a t ed f o u r t i m e s , i f n e c e s s a r y . 5. Th e o f f s e t t o t h e n e x t b y t e t o b e c o r r e c t e d i s c ompa r ed wi th the t r a n s f e r by t e c o un t . I f the o f f s e t byt e c o un t i s g r e a t e r than or e qua l to the t ransfer byt e c o un t , r em a i n i ng c o r rect i ons a r e o uts i d e the a rea o f i nte r e s t . Step 8 i s e x e c u t ed n e x t . 6. Th e b y t e to b e c o r r e c t e d i s d o ub l e m a pped u s i ng the s ys t em v i r t ua l pag e n um b e r s to r ed i n UC B $ L SVPN , a n d t h e t r a n s l a t i o n b u f f e r i s i nva l i d a t e d f o r tha t pag e� 7. Th e n e x t by t e ( l o we s t ) o f the l o ng wo r d pa t t e r n ma s k is e x c l us i v e ORed w i t h t h e m emo r y d a t a , t h e o f f s e t i n b u f f e r i s i nc r em e n t e d , a n d t h e pa tte r n m a s k i s r i g h t sh i f t ed 8 b i ts . If a l l f o u r c o r r e c t i o n b y t e s h a v e n o t b e e n a pp l i ed , s t e ps 5 , 6 , a nd 7 a r e r e p e a t ed . 8. Th e t r a n s f e r i s c o n t i n ued by r e ex e c u t i ng the a pp r o p r i a t e f un c t i o n a f t e r upd a t i ng t h e c u r r e n t t r a n s f e r pa r am e te r s ( by t e c o un t , d i s k ad d r e s s , a nd s y s t em v i r t ua l a d d r e s s o f the nex t pag e t a b l e e n t r y t h a t m a ps t h e t r a n s f e r ) . 15. 1.2 O f f s e t Re cove r y Of f s e t r ec o ve r y i s a t e c h n i q ue wh e r e by t h e d r i v e r e ad head s a r e moved in sma l l i n c r em e n t s ( us ua l l y 2 0 0 to 4 0 0 m i c r o i nc h e s ) f r om the t r a c k c e n t e r l i n e i n a n a t t empt t o p i c k u p a s t r o ng e r r e ad i ng s ignal . Th e t ec h n i q u e i s pe r fo r m ed o n l y f o r r e a d o pe r a t i o n s s uc h a s r e a d h e ad e r a nd d a t a , w r i t e c h e c k d a t a , a nd wr i t e c h e c k h e ad e r a nd d a t a . Upo n e nc o un t e r i ng an error tha t m a y be c o r r ec tabl e us i ng r ec o v e r y , t h e fo l l o w i ng s t eps a r e t a k e n b y a d i s k d r i v e r . o ffset 1. Th e r e a d h e a d s a r e r e t u r n ed to t h e c en t e r l i n e . 2. Up to 16 a t t emp t s c e n t e r l i ne . 3. Th e h e a d s a re o f fs e t an i nc r em e n t , a nd 2 retr ies are p e r fo rmed a t t h a t o f f s e t . Th i s p r o c ed u r e i s r e pe a t ed up to 6 t imes . 4. I f a f te r 2 8 a t t emp t s ( 1 6 a t the c e n t e r l i n e , a nd 2 a t e a c h o f 6 o f f s e t po s i t i o n s ) t h e d a ta s t i l l c a nno t b e r e t r i e v e d , a f a i l u r e i s r e turned . a re mad e 1 5-3 to r e ad the d a ta at the VAX/VMS DEV I C E DR I VERS 15. 1.3 Dynam i c Bad B l o c k Ha nd l i ng Dyn a m i c bad b l o c k h a nd l i ng i s i mp l em e n te d as a c o o pe r a t i v e e f f o r t b e twe e n d r i v e r FDT r o u t i ne s , I /O po s tp r o c e s s i ng r o ut i n e s , a nd AC Ps . FDT r o u t i ne s f o r I O $ R EADVB LK a nd I O $ WR I TEVB LK c o n s t r uc t an I /0 packet ( IRP) , a nd se t the v i r t ua l bit in the I R P s t a t u s wo r d ( I RP $ V V I RTUA L i n I R P $W S TS ) . Th e I /0 po s tp r o c e s s i ng rout i nes ( in m od u l e I OC I O PO S T ) d i scov e r t r a n s f e r e r r o r s o n v i r t ua l I /O f un c t i o n s , a nd r o u t e t h e I R P to the a pp r o p r i a t e AC P . Th e AC P , u s i ng i n fo rm a t i o n in the I RP , ca lcul ates the b a d b l o c k address , a nd stores tha t i n f o rm a t i o n . In add i t i on , a b i t i s s e t i n t h e f i l e c o n t r o l b l o c k ( FC B ) th a t c a us e s the e n t i r e c l us t e r c o n t a i n i ng t h e b ad b l o c k to be r ec o r d ed i n t h e bad b l o c k f i l e ( [ O , O ] BADB LK . SYS ; l ) wh e n t h e f i l e i s d e l e t ed . No te th a t a bad b l o c k i s n o t d i sc o v e r ed u n t i l i t i s a l r e a d y pa r t o f a f ile , a nd i s n o t r e c o r d ed a s b ad u n t i l tha t f i l e i s d e l e t ed . Wh e n a b ad block i s d i s c ov e r ed wh i l e wr i t i ng a file , t h e bad block i n fo rm a t i o n i s r ec o rd e d , a b i t i s s e t i n the FCB f o r the f i l e , a nd a n e r r o r i nd i c a t i o n i s r e t u r n ed t o t h e r eq ue s t i ng p r o c e s s . B a d b l o c k s uppo r t i s r e s t r i c t ed to v i r t ua l I /O f un c t i o n s ( th a t is, file I /0 ) . Pr o c e s s e s pe r f o rm i ng l og i c a l o r phys i c a l I /O f unc t i o n s m u s t p r o v i d e the i r o wn b a d b l o c k h a nd l i ng . 15. 1.4 Mul t i p l e - B l o c k Nonc o n t i g uo u s V i r t u a l I /0 Wh e n a r e a d o r wr i t e v i r t ua l I /0 f u n c t i o n i s p r o c e s s e d by the $QIO s ys tem s e rv i c e ( by r o u t i n e EXE $ Q I O i n mo d u l e S YS Q I ORE Q ) , a n a t tempt i s m a d e to pe r f o rm t h e t r a n s f e r w i tho u t the i n te r v e n t i o n o f a n AC P . C o n v e r s i o n o f v i r t ua l b l o c k n um b e r s to l og i c a l b l o c k n umbe r s i s a c c ompl i shed us i ng m a pp i ng i n fo rm a t i o n c o nta i ned i n a d a t a s t r uc t u r e c a l l ed a Wi n d o w Co n t r o l B l o c k ( WC B ) th a t wa s p r ev i o u s l y c r ea t ed by a n A C P wh e n t h e c o r r e s pond i ng f i l e wa s f i r st accessed . If t h e WCB c o n ta i n s e no ug h m a pp i ng i n fo rm a t i o n t o c o nv e r t the e n t i r e v i r t ua l r a ng e o f t h e t r a n s f e r i n to c o r r e s po nd i ng l og i c a l b l o c k n umbe r s on the t h en the v i r t u a l I /0 t r a n s f e r w i l l be h a nd l ed d i r e c t l y by the v o l ume , d r i v e r a nd I / 0 c ompl e t i o n r o u t i n e s , even i f t h e t r a n s f e r cons i s ts of seve ral n o n c ont i g uo u s p i ec e s . If t h e WC B d o e s n o t c o n t a i n e n o ug h i n fo rma t i o n t o e n t i r e l y m a p t h e v i r t ua l r a ng e o f t h e transfe r , the i n te rven t i on of a n AC P w i l l be r eq u i r ed a t some t i me in o r d e r to c ompl e t e t h e t r a n s f e r . 1 5 . 1 . 4 . 1 Mapp i ng I n f o rma t i o n The WC B i s po i n t ed to by the Ch a n n e l Co n t r o l B l o c k ( CC B ) , wh i c h i s e s t a b l i shed b y t h e As s i g n Ch a n n e l sys t em s e rv i c e ( a s d e sc r i b ed i n Ch a p t e r 1 6 ) . Th e WCB c o n t a i n s a b a s e v i r t ua l b l o c k n um b e r a nd a va r i a b l e n umb e r o f m a p e n t r i e s ( c o n t r o l l ed b y t h e /W I NDOW S =n q u a l i f i e r to the I N I T IA L I Z E DC L c omma nd , and by the ACP WI NDOW S Y S B OOT pa r am e t e r f o r d i s k s m o un ted / S Y S T EM ) . Th e m a p e n tri e s f o rm a s ub s e t o f t h e f i l e r e t r i e v a l i n fo rm a t i o n f o r t h e file. E a c h m a p e n t r y c o n s i s t s o f a n e x t e n t s i z e a nd a s t a r t i ng l og i c a l b l o c k n umbe r . Th e m a p e n t r i e s r epr esent a v i r t u a l l y c o n t i g uo u s set of b l oc k s t h a t a r e n o t nec e s s a r i l y phys i c a l l y c o n t i g uo u s o n t h e d i s k . - Wh e n a v i r t ua l r e a d or f i elds t wo i n i t i a l i ze wr i t e r e que s t is the I RP t h a t in 1 5-4 s pe c i f i e d , FDT r o u t i n e s wi l l be u s ed by t h e I /0 VAX/VMS DEV I C E DR I VERS po s t pr o c e s s i ng r o u t i n e s . Th e t o t a l byte c o un t i n the o r i g i n a l r e q ue s t is s to r e d i n t h e o r i g i na l b y t e c o un t f ield ( I R P $W OBCNT ) . Th e a c c um u l a t ed byte c o u n t f i e l d ( I R P$W_ABCNT ) , a c o un t o f byte s a c t ua l l y t r a n s f e r r ed , i s s e t t o z e r o . Ro u t i ne I OC $MAPVB LK i s t h e n c a l l ed to c o nve r t the v i r t ua l r a ng e s pe c i f i ed i n t h e t r a n s f e r to a l og i c a l b l o c k r a ng e , u s i ng i n fo rma t i o n i n t h e WC B . Th e r e a r e th r e e po s s i b l e c a s e s tha t c a n o c c u r h e r e . • • • Th e v i r t ua l r a ng e is l og i c a l l y c o n t i g uo u s a nd m a pp i ng i n f o rma t i o n i s c o n t a i n ed i n t h e w i ndow c o n t r o l b l o c k . Th e w i n d o w c o n t r o l b l o c k c o n t a i n s m a pp i ng i n fo r m a t i o n f o r t h e b eg i n n i ng of t h e v i r t ua l r a ng e b u t the v i r t ua l r a ng e i s no t v i r t ua l l y c o n t i g uo u s . Th e ma p p i ng i n fo rm a t i o n tha t m a ps the f i r s t v i r t ua l b l o c k t h e r a ng e t o i t s l og i c a l c o un te r pa r t i s no t i n the WC B . in 15. 1.4.2 No AC P I n t e rve n t i o n - I n e i the r o f the f i rst t wo c a s e s , I OC $MAPVB LK r e t u r n s a n o n z e r o n um b e r o f b y t e s m a pped , a nd a s t a r t i ng l og i c a l b l o c k n umbe r . Th e s e a re l o a d ed i n to the IRP (at f i elds I RP$W BCNT a nd I RP $ L M E D I A r e s pe c t i v e l y ) a nd the I /0 r e que s t pac k e t i s q ue u ed to the d r i v e r� Fu r th e r p r o c e s s i ng o f th i s r e que s t t a k e s place in the I /0 po s t p r o c e s s i ng r o u t i n e s . Th e s e ro ut i n e s ( f o und i n m o d ul e I OC I O PO S T ) p r o v i d e t h e a d d i t i o n a l p r o c e s s i ng ne c e s s a r y to e f fec t the tota l t r a n s fe r . Th ey a r e r e s po n s i b l e fo r a c c um u l a t i ng t h e to ta l n um b e r o f b y t e s t r a n s fe r r e d , a nd fo r p r o pag a t i ng f u r th e r p r o c e s s i ng o f the r e q u e s t , i f n e c e s s a r y . Wh ene v e r t h e I /0 po s t p r o c e s s i ng c od e e n c o unte r s a n I / 0 r e que s t p a c ke t ( IRP) w i th t h e v i r t ua l bit set ( I R P $ V V I RTUAL i n I R P$W ST S ) , i t upd a t e s t h e a c c um u l a t ed b y t e c o un t ( s t o r ed Tn I R P $W ABCNT ) by a d d i ng the n umb e r o f byt e s j us t t r a n s f e r r ed ( I RP $W BCNT ) . Th i s upd a t ed a c c um u l a t ed byte c o un t i s then c ompa r ed w i th the or i g i n a l byte c o un t ( s to r ed in I R P $W OBCNT ) . If th e t wo n umbe r s ag r e e , the r e q u e s t i s c om p l e ted e x a c t l y li ke o th e r d i r e c t I /0 r e que s t s ( a s d e s c r i b ed in Ch a p t e r 1 6 ) . O t h e r w i s e , t h e r ema 1 n 1 ng b y t e c o un t i s p l a c ed i n to I R P $W BCNT , a nd t h e s eg m e n t s t a r t i ng v i r tual b l o c k n um b e r ( I RP$ L S EGVBN ) - i s r e t r i e v ed . Ro u t i ne I OC $MAPVB LK i s ag a i n c a l l ed to m a p the r ema 1 n 1 ng v i r t ua l I f the m a p p i ng i s s uc c e s s f u l ( a n o n z e r o c o un t o f t h e n um b e r o f r a ng e . by t e s m a pped i s r e t u r n ed ) , t h e I R P$W BCNT a nd I R P $ L MEDIA f i e l d s a re upd a ted a nd t h e I R P i s a g a i n q u e ued to t h e d r i v e r� I n th i s wa y , t h e v i r t ua l r e que s t c o n t i n u e s un t i l i t c ompl e t e s o r un t i l a v i r t ua l r a ng e tha t c a n n o t b e m a pped by i n fo r m a t i o n i n t h e WCB i s e n c o un t e r e d . 1 5 . 1 . 4 . 3 AC P I n t e r v e n t i o n - I f r o u t i n e I OC $MAPVB LK c a nno t c o nv e r t a v i r t ua l r a ng e to i ts l og i c a l c o un t e r pa r t , t h e f i l e s AC P a s s o c i a t ed w i th the v o l ume i nvo l v ed i n the t r a n s f e r m u s t be c a l l ed upo n t o o b t a i n the r eq u i r ed m a pp i ng i n fo rm a t i o n . No t e th a t th i s f a i l u r e c a n b e d e t e c t ed by F D T r o u t i n e s a t t h e b eg i nn i ng o f the t r an s f e r o r by the I /O po s t p r o c e s s i ng rout ines a f te r the r e que s t h a s b e e n pa r t i a l l y s a t i s f i ed . I n e i th e r c a s e , t h e I RP i s pl a c ed i n to a wo r k q u e u e a nd the a s s o c i a t ed ACP i s a wa k e n ed . 1 5-5 VAX/VMS DEVI C E DR I VERS Wh e n the AC P p r o c e s s e s th i s I RP , i t r e a d s the f i l e h e a d e r to obta i n t h e m a pp i ng i n fo rma t i o n n e c e s s a r y f o r t h e t r a n s f e r i n q u e s t i o n . Th i s i n fo rma t i o n i s s to r ed i n the WCB , pe rh a ps r e pl a c i ng o th e r m a pp i ng i n fo rma t i o n a l r e a d y c o n t a i n ed th e r e . Th e AC P t h e n upd a te s t h e B CNT a nd M E D I A f i e l d s i n the I RP i n o r d e r t o t r a n s f e r the f i r s t p i ece of the r em a 1 n 1 ng v i r t ua l r a ng e , a nd queues the I R P t o the d r i v e r to c o n t i n u e the t r a n s f e r . Wh e n t h e I /O po s tp r o c e s s i ng r o u t i ne r ec e i v e s t h i s pac k e t , i t w i l l u s ua l l y f i nd t h a t t h e r em a i n i ng v i r t ua l r a ng e c a n b e ma pped , a l l o wi ng the r e que s t t o c ompl e t e wi tho u t f u r th e r AC P i n t e rv e n t i o n ( ev e n tho ug h s e v e r a l d i sc r e t e t r a n s f e r s may s t i l l b e r e q u i r ed ) . Th e o n l y t i m e th a t m o r e t h a n o n e AC P i n t e rv e n t i o n , a s o - c a l l ed w i ndow t u r n , o c c u r s i s wh en a f i l e i s s o bad l y f r agmen ted that i t c a n n o t be m a pped by t h e n umbe r of r e t r i ev a l po i n t e r s e s t a b l i shed f o r th i s v o l um e . 15. 2 MAGNE T I C TAPE DR I VERS M a g n e t i c t a pe s a r e s equent i a l a c c e s s m a s s s to r ag e d ev i c e s pl a c ed e i th e r o n t h e MAS S B U S ( T E 1 6 , T U 4 5 , TU 7 7 ) o r o n the UN I B U S ( TS l l ) . Up to e i g h t TE 1 6 or T U 4 5 t a pe d r i v e s o r up t o f o u r TU7 7 t a pe d r i v e s m a y b e p l a c ed o n e a c h TM 0 3 mag n e t i c t a pe c o n t r o l l e r ( a l th o ug h d i f f e r e n t d r i v e s c a nno t b e c o nn e c t ed to the s ame contro l l e r ) . I n o rd e r to p e r fo rm d a ta t r a n s f e r o pe r a t i o n s , t h e MAS S B U S mag n e t i c t a pe d r i v e r ( i n TMD R I VE R ) h a s to o b t a i n o wn e r s h i p o f b o t h t h e TM 0 3 c o n t r o l l e r ( pr i m a r y c h a nne l ) a nd the MAS S B US Ad a p t e r ( s e c o nd a r y c h a nn e l ) b y i s s u i ng the R E Q PC HAN a nd REQSC HAN m a c r o s , r e s pe c t i v e l y . At t i me s , the s e co nd a r y c h a nn e l m a y b e r e l e a s e d ( u s i ng t h e R E LSCHAN m a c r o ) s o th a t o th e r d i s k s m a y u s e t h e MASSB U S . Appe nd i x F o f t h e VAX/VMS G u i d e t o Wr i t i ng a Dev i c e D r i ve r conta i n s i n f o rm a t i o n o n ho w d r i v e r s a r e wr i t t e n fo r d ev i c e s o n t h e MAS S B US . The VAX/VM S I /0 Us e r ' s G u i d e d e sc r i b e s the f e a t u r e s a nd c a pa b i l i t i e s p r o v i d ed b y t h e m ag n e t i c t a pe d r i v e r s , a nd d i sc us s e s the g e n e r a l e r r o r r ec o v e r y a nd d a t a c h e c k l og i c empl o yed b y them . Th e s pe c i f i c a l g o r i t hm us ed t o c o r r e c t NRZ I ( no n- r e t u r n- t o - z e r o - i nv e r ted ) r e ad e r r o r s i s t h e fo l l o w i ng . 1. I f the e r r o r o c c u r r ed wh i l e r e a d i ng i n the fo r wa rd d i r e c t i o n , t h e t a pe i s b a c k s pa c ed , a nd the r ec o rd i s r e ad a g a i n . 2. I f a n e r r o r o c c u r s wh i l e r e ad i ng i n the r e v e r s e d i r e c t i o n ( a s the resul t o f a r e a d ph ys i c a l b l o c k r ev e r s e f unc t i o n ) , t h e f o l l owi ng s t e ps a r e t a k e n . a. Th e r e c o rd i s r e a d i n t h e f o r wa r d d i r e c t i o n to s e t up the e r r o r c o r r e c t i o n in t h e h a r d wa r e . b. Th e t a pe i s b a c k s pa c ed o v e r the r ec o rd j us t r e ad . c. Th e r e c o rd i s r e r e ad i n the fo r wa r d the e r ro r c o r rec t i o n . d. Th e t a pe i s b a c k s pa c ed ov e r the r ec o rd to po s i t i o n the t a pe p r o p e r l y ( b e c a u s e t h e i n i t i a l r e que s t wa s fo r a r e a d i n t h e r ev e r se d i r ec t i o n ) . A m a g n e t i c t a pe AC P i s c a l l ed f r om va r i o us pe r fo rm f un c t i o n s l i ke wr i t i ng t a pe l ab e l s . 1 5-6 d i r ec t i o n d river FDT to a pp l y r o ut i nes to VAX/VMS DEVI CE DR IVERS 15. 3 TERMINAL DR I VER Th e t e rm i n a l I /O s y s t em i s a c o l l ec t i o n o f rout ines ( i n s e p a r a te m od u l e s ) t h a t p r ov i d e a f l ex i b l e a pp r o ac h to te rm i n a l i nput a nd o u tput Th e l og i c a l VAX/VM S I / O Us e r ' s G u i d e ) . ( a s d e sc r i b ed in the c ompo n e n t s o f t h e t e rm i n a l I /O s y s t em a r e i l l us t r a t ed i n F i g u r e 1 5 - 1 . ( Th e c o n s o l e i n t e r f a c e i s d i sc ussed in a l a te r s ec t i o n o f th i s c h a p te r . ) I User Issues $QIO request I ,, Terminal Independent FDT Routines (module TTYFDT) I Terminal r -- -------- - Driver - - - - - - - - - - -, I I Device and Terminal I ndependent Routines Executing at Fork and Interrupt IPLs. (modules: TTYCHARI , TTYCHARO,TTYDRVDAT, TTYSTRSTP, TTYSUB ) Device-Dependent Interrupt Level Routines for DZ-1 1 Interface Device-Dependent Interrupt Level Routines for Console Interface (module TTZINTDSP) (module CONINTDSP ) - - ---- - terminal interrupt F i g u r e 1 5-1 15. 3. 1 - - - - - - - - - - I I I I I I I I I � console interrupt Te rm i n a l I /0 Sys tem A l t e r n a te Te r m i n a l D r i v e r s Wh e n the sys t em i s b o o t s t r a pped , mo d u l e I N I T r e a d s t h e t e rm i n a l d r i v e r ( wh i c h mus t b e c o n t i g uo u s ) i n to n o n pag ed po o l . Th e t e rm i n a l i m ag e d r i v e r i m ag e i s a s e pa r a t e , l o ad ab l e i m ag e . I t i s n o t l i n k ed w i th t h e execut i ve . Th e r e f o r e , c h a ng e s c a n b e mad e to th e t e rm i n a l d r i v e r m od u l e s , a nd tho s e mo d u l e s c a n then b e a s s em b l ed and l i n ked i nd e pend e n t o f the e x e c u t i v e ( F i g u r e 1 5 - 2 ) . 1 5-7 Comm a n d Bu i l d Ph a s e Ma c ro L i b r a r y C r e a t i o n $ L I B RARY/CREATE/MAC R O S YS $S YS TEM : TTYL I B SYS $ S YS TEM : TTYU C B DEF . MAR As s em b l y Ph a s e $ MAC RO/ L I S T=S YS $ S YS TEM : ' mod u l e ' /OBJECT=S YS $ S YS TEM : ' mod ul e ' S YS $ S YS TEM : ' mo d ul e ' + SYS $ L I B RARY : L I B / L �B RARY+ SYS $ S YS TEM : TTYL I B/ L I B RARY $! $! $! $! $! $! $! $! $! 1-' U1 I co L i n k Ph a s e Th i s i s d o n e fo r e a c h o f the fo l l owi ng mod ul e s TTYS UB TTYF DT TTYDRVDAT TTYC HAR I TTYC HARO TTYS TRS T P TTZ I N T DS P $ L I N K / S HARE=S YS $ S YS TEM : TTDR I VE R/ C ONT IGUOUS/MAP=S YS $S YS TEM : TTDR I VER/ FU L L /CROS S S YS $ S YS TEM : TTYDRVDAT , TTYF DT , TTYS TRS TP , TTYC HAR I , TTYC HARO , TTYS UB 1 TTZ I N T DS P , S YS $ S YS TEM : SYS . S TB/ S E LEC T I VE S EARC H , S YS $ S YS TEM : O PT IONS/ O PT I ONS $! $! $! Figure 1 5-2 wh e r e the f i l e OPT I ONS . OPT c o n t a i n s t h e s i ng l e l i n e BAS E = 0 Comma n d s th a t As s emb l e a nd L i n k the Te rm i n a l D r i v e r VAX/VMS DEVI C E D R I VERS Wh e n the s y s t em i s r e b o o t e d , t h e n e w t e rm i n a l d r i v e r can be t e s t e d . A r e bo o t is nec e s sa ry to u s e t h e new t e rm i n a l d r i v e r o n , f o r e x ampl e , a u to c o n f i g u r ed D Z l l s b e c a u s e the SYSGEN R E LOAD c omma nd wi l l n o t r e l o ad a d r iver wh i l e a d ev i c e un i t s e r v i c ed by t h e d r i v e r i s b u s y , a nd the t e rm i n a l f r om wh i c h the R E LOAD c omma nd i s b e i ng i s s ued is a l wa ys b u s y . Th e f a c t t h a t the t e rm i n a l d r i v e r i s l o ad ed by I N I T h a s i m pl i c a t i o n s fo r a n yo n e wh o wr i t e s a n e w t e rm i n a l d r i v e r . A s ys t em d i s k w i t h t h e o r i g i n a l t e rm i n a l d r i v e r m u s t b e k e pt a r o und to r e bo o t the s ys t em in the event tha t t h e m o d i f i ed t e rm i n a l d r i v e r c o n t a i n s e r r o r s th a t pr e v e n t t h e s ys t em f r om c ompl e t i ng i t s i n i t i a l i z a t i o n s e q u e n c e . (or r e pl a c ed ) No rma l l y , t h e o n l y mo d u l e t h a t w i l l n e ed to b e a l t e r ed i s TTZ I N TDS P to p r ov i d e t h e d ev i c e d e pend e n t pr o c e s s i ng fo r a s p e c i f i c d ev i c e ( s u c h a s a D L l l ) . I f the d ev i c e i s t o o pe r a t e i n a DMA ( d i r e c t m em o r y a c c e s s ) mo d e , t h e n t h e e n t i r e d r i v e r i n t e r f a c e m a y h a v e t o b e c h a ng ed . TTZ I NTDS P c o n t a i n s t h e d r i v e r p r o l o g ue t a b l e ( wh i c h h a s some n o n s t a nd a r d , but r e q u i r ed , CRB i n i t i a l i za t ion i n s t r uc t i o n s i n the RE INIT s e c t i o n to p r ov i d e l i n k ag e s to the d ev i c e i nd e pend e n t p r o c e s s i ng r o u t i n e s ) , a n d some s e l f - r e l a t i v e o f f s e t s wh i c h a r e u s e d b y I N I T t o l o ad t h e d r i v e r . 15. 3.2 Fu l l Dup l e x Ope r a t i o n Th e t e rm i nal d r iver i m p l eme n ts ful l d u p l ex o pe r a t i o n ( un l e s s s pe c i f i c a l l y a s ke d to o pe r a t e i n h a l f d up l e x mod e f o r a pa r t i c u l a r t e r m i n a l ) b y ut i l i z i ng a n a l t e r n a t e s ta r t I /0 e n t r y po i n t ( s pe c i f i ed as the A L T S TART pa r am e t e r to the DDTAB mac r o ) . Wh e n e v e r a wr i t e r e q u e s t i s i s s u ed t o a f u l l d upl e x t e rm i n a l , t h e wr i t e FDT rout i ne ( TTY$ FDTWR I T E i n TTYFDT ) a l l o c a t e s a nd i n i t i a l i z e s a wr i t e b u f f e r pa c k e t t o d e sc r i b e t h e wr i te r eq u e s t , a nd c a l l s r o u t i n e E XE $ALTQUE PKT ( i n S YS Q I OR E Q ) to e n t e r the a l te r n a t e s ta r t I /0 r o u t i n e o f the d r i v e r . I n t h e h a l f d up l e x c a s e , r o u t i n e EXE $ Q I ODRVP KT , a l s o i n SYS Q I OR E Q , is c a l l ed . No rma l l y , FDT r o u t i n e s c a l l on EXE $ Q I ODRVPKT to i nv o k e the s ta r t I /0 r o u t i ne o f t h e d r i v e r , i f t h e un i t i s n o t b us y , o r to q u e ue t h e I R P t o t h e UC B i f t h e un i t i s b u s y . E XE $ A LT QU E PKT d i f f e r s f r o m EXE $ Q I ODRVPKT i n s ev e r a l r e s pe c t s . 1. No c h e c k i s mad e t o s e e i f t h e UC B i s b u s y ( UC B $V B S Y in UC B $W STS ) . Th e r e f o r e , th e r e q ue s t i s n ev e r q u e ued t o the U C B by EXE $ A LTQU E PKT . Th i s i s d e s i r a b l e bec a u s e t h e r e may c u r r en t l y b e a r e a d r e q ue s t i n p r og r e s s , a nd i f t h e I R P we r e q u e ue d u n t i l t h e r e ad r e que s t f i n i shed , a nd the bus y b i t c l e a r e d , f u l l d u p l e x ope r a t i o n wo u l d no t be po s s i b l e . 2. Th e c a nc e l a n d t i m e o u t b i t s in the UCB ( UC B $V CANC E L a nd UC B $V T I MO U T in UC B $W S TS ) a r e una f f e c ted ( not c l e a r ed ) b e c a use t h e y m a y b e b e i ng u s ed by t h e c u r r e n t I R P , i f t h e UC B i s bus y . 3. Th e SVA PT E , BCNT , a nd B O F F f i e l d s a r e n o t c o p i ed f r om t h e I R P to th e UC B b e c a u s e t h i s wo u l d effect the cur rent I /0 o pe r a t i o n i f t h e UC B i s b u s y . 4. Th e a l t e r n a t e s t a r t I /0 r o u t i n e i n the d r i ve r ( r a th e r t h a n t h e r eg u l a r s t a r t I /O r o u t i n e ) . 1 5- 9 is e n t e r ed VAX/VMS DEVI C E DR IVE RS TTY $WRTSTART I O ( i n TTYS TRS T P ) i s th e a l t e r n a t e s t a r t I /0 r o ut i n e e n t r y po i n t . Th i s e n t r y po i n t i s a l s o u s ed by t h e b r o a d c a s t s ys t em s e rv i c e , as d e s c r i b ed i n Ch a p t e r 1 6 . Th i s r o u t i n e r a i s e s I PL to d ev i c e I PL to b l o c k d ev i c e i n t e r r up t s f r om the c u r r e n t I /0 o p e r a t i o n , i n c a s e the d ev i c e is b u s y , a nd p r o c e s s e s the pac k e t as f o l l o ws . 1. I f a wr i t e i s c u r r e n t l y i n p r og r e s s , t h e wr i te b u f f e r i s q u e ued . pac k e t 2. I f a r e ad i s o c c u r r i ng , b u t t h e b uf f e r h e ad e r s pe c i f i e s wr i t e b r e a k th r o ug h , t h e wr i t e i s s t a r t ed . 3. I f a r e a d i s o c c u r r i ng , b u t no c h a r a c te r s h a v e b e e n ye t , the wr i t e i s s t a r t ed . 4. O t h e r w i s e , t h e w r i t e b u f f e r i s q ue u e d . r ec e i v ed I n o rd e r to c ompl e t e wr i te I /0 r e q ue s t s f o r f ul l d up l e x o pe r a t i o n , t h e d r iver e x i t s b y c a l l i ng r o u t i n e C OM $ P O S T ( i n C OMDRVS U B ) r a th e r t h a n i s s u i ng t h e R E QC OM ma c r o . C OM $ P O S T p l a c e s t h e I / 0 r e que s t pa c k e t in the po s t p r o c e s s i ng q u e u e , r eq ue s t s a n I P L $ I O PO S T s o f twa r e i n t e r r upt i f t h e queue wa s p r ev i o u s l y em p t y ( Ch a p t e r 4 ) , a nd returns . Ro ut i n e I OC $ R E QC OM is a v o i d ed s o th a t the n e x t I R P que ued to the UC B ( wh i c h m u s t b e a r e a d r e q ue s t ) i s n o t i n i t i a t ed ( be c a u s e the c ur rent r e ad r e qu e s t , i f a n y , h a s n o t ye t t e rm i n a t ed ) . Al so , the s t a t u s o f the UCB b u s y b i t i s un a l te r e d b y C OM $ P O S T . Al l r e ad r eq u e s t s , h o wev e r , are t e rm i n a ted by i nvo k i ng t h e R E Q C OM m a c r o , s o th a t t h e nex t r e a d r e q u e s t m a y b e p r o c e s s ed i n t h e no rm a l f a sh i o n . I n f u l l d upl ex o pe r a t i o n the d ev i c e c an b e e x pe c t i ng mo r e than one i n t e r r upt at a t i me ( one fo r a r e ad r e q ue s t , a n d o n e fo r a wr i t e r e q ue s t ) . Th e r e fo r e , t wo f o r k PC s m u s t be s to r ed . ( Us u a l l y d r i v e r s o n l y e xpect o n e i n t e r r up t at a t ime , a nd s to r e t h e fo r k PC i n UC B $ L F PC . ) Th e te rm i n a l d r i v e r s to r e s m o r e t h a n o n e f o r k P C by a l t e rTng t h e v a l u e o f R S ( wh i c h no r ma l l y po i n t s to the UC B ) , to po i n t t o the w r i te b u f f e r pac k e t o r t h e I RP b e f o r e f o r k i ng ( by i nv o k i ng the F ORK m a c r o ) . A fork b l o c k i s t h e r e f o r e f o rmed i n t h e wr i t e buf f e r pa c k e t o r i n t h e I RP ( c o n t a i n i ng R 3 , R 4 , a nd t h e f o r k PC ) . Th e fo rk block i n t h e UC B i s n o t u s e d f o r r e a d o r wr i t e r e que s t s , a l tho ug h i t i s u s e d a t o the r t i m e s , s uc h a s wh e n a l l o c a t i ng a type - a h e a d b u f f e r o r wh e n h a nd l i ng un so l i c i t e d d a t a . Th e t e c h n i q u e o f a l t e r i ng R S b e fo r e fo r k i ng c a n e a s i l y be e x t e nd ed by any d r iv e r to a l l o w mo r e than o ne o u t s t a nd i ng i n t e r r up t fo r a pa r t i c u l a r d ev i c e , p r ov i d ed the d r i v e r c a n d i s t i ng u i sh wh i c h i n te r r upt is a s s o c i a t ed w i th wh i c h fo r k b l oc k . Th e r e f o r e , a n y n umbe r o f o u t s t a nd i ng I /O r e q ue s t s m a y b e h a nd l ed b y a d r i v e r e n t e r ed a t the a l t e r n a te s ta r t I /0 e n t r y po i n t . O f c o u r s e , the d r i v e r m u s t m a i n t a i n que ue s f o r o u t s t a nd i ng I /0 r e q ue s t s , a nd s yn c h r o n i ze I /0 o pe r a t i o n s . Th � d r i v e r shQu l d o pe r a t e a l mo s t e x c l u s i v e l y a t d ev i c e I PL ( a s t h e t e rm i n a l d r i v e r d o e s ) , t o b l o c k o u t d ev i c e i n t e r r up t s in o rd e r to a c h i e v e s yn c h r o n i z a t i o n w i th m u l t i pl e I /0 r e q ue s t p r o c e s s i ng . 15. 3. 3 Channe l s a nd th e DZ l l The DZ l l h a s no c o n t r o l l e r c h a n n e l c o n c e p t . Th e r e fo r e , the t e rm i n a l d r i v e r n ev e r r eq u e s t s or r el ea s e s a c o n t r o l l e r c h a n n e l ( wi th t h e Th e l oc a t i o n s n o rm a l l y u s e d i n the C RB R E QC HAN a nd R E LC HAN m a c r o s ) as l i s th e ad s fo r the c o n t r o l l e r c h a n n e l wa i t que ue ( CRB $ L_WQF L a nd • 1 5- 1 0 VAX/VMS DEVI C E DR I VERS C RB $ L WQB L ) are i ns tead u s ed i n f o r ma t i o n ( a nd are r e named C RB $ 8 TT E X P E C by TTZ I NTDS P ) . 15. 3 . 4 to to c o n t a i n m o d em c on t r o l s ta t u s C RB $ L_TT_D I A L , CRB $ B_TT_ATTN , a n d Type -Ah e a d B u f f e r A t ype- a h e ad bu f f e r i s a l l o c a ted f r om n o np a g e d po o l fo r e a c h t e rm i n a l . Ev e r y c h a r a c t e r t yped i s p l a c ed i n to the b u f fe r , even i f a read I f t h e b u f f e r i s w i th i n 8 c h a r a c t e r s o f b e i ng f u l l r eque s t is a c t i v e . a nd the t e rm i n a l is i n h o s t - s yn c m o d e , t h e d r i v e r s e nd s a n XOF F c h a r ac t e r t o t h e t e rm i n a l t o t e l l i t to s to p s e nd i ng d a ta . A n XON c h a r ac t e r i s n o t s e n t to the t e rm i n a l t o t e l l i t t o s t a r t s e nd i ng d a t a un t i l t h e b u f f e r i s empt i ed . Us i ng th i s t e c hn i que p r ev e n t s c h a r a c t e r s f r om b e i ng l o s t i n b l o c k I /0 t r a n sm i s s i o n s f r om h i g h - s pe ed t e rm i na l s . 15. 4 PS EUDO DEVICE DR I VERS VM S s uppo r t s d r i v e r s fo r d e v i c e s th a t do no t ph y s i c a l l y e x i s t ( ps e ud o d ev i c e s ) , i n c l ud i ng t h e n u l l d ev i c e ( N L : ) , the n e t wo r k d ev i c e ( N ET : } , a nd m a i l bo x e s ( MB : ) . U s e r s c a n a s s i g n c h a n n e l s to t h e s e d ev i c e s a n d i s sue I /0 r eque s t s , j us t as t ho ug h t h e y we r e r e a l d ev i c e s . Th e f o l l o w i ng s e c t i o n s h i g h l i g h t s o m e o f the features o f t h e s e p s e ud o d ev i c e d r i v e r s . 15. 4 . 1 N u l l Dev i c e D r i ve r Th e n u l l d ev i c e d r i v e r ( i n N L DR I VE R } i s a s s embl e d and l i n k e d w i th the s ys t em i ma g e ( S YS . E XE } . I t i s a v e r y s i mpl e d r i v e r , c o ns i s t i ng o f two FDT r o u t i n e s ( o n e to h a nd l e r e a d r e q ue s t s , a nd o n e to h a nd l e wr i t e r eque s ts } . Th e FDT r o u t i n e s i n t h e n u l l d r i v e r r e spond to r e a d r e que s t s b y r e t u r n i ng a n S S $ ENDOF F I LE s t a t us c o d e t o the use r , and t h e y r e s po nd to wr i t e r e que sts by r e t u r n i ng a n S S $ N O RMAL s t a t u s c o d e . No d a ta i s t r a n s f e r r ed , n o r a r e a ny p r i v i l eg e o r quo ta c h e c k s m ad e . 15.4.2 N e t wo r k Dev i c e D r i v e r Th e n e t wo r k d ev i c e d r i v e r ( i n N E TDR I VE R } i s used t o i m pl eme n t s o m e o f the DECn e t i n t e r p r o c e s so r c ommun i c a t i o n p r o t o c o l s ( s e e the VAX/VM S DECne t-VAX U s e r ' s G u i d e a n d D E Cn e t-VAX S y s t em Ma n ag e r ' s G u i d e } . Th i s d r iver i s not a pa r t o f t h e s ys t em i m ag e . I t m u s t b e ex pl i c i t l y l o ad e d w i th a C ONNECT c ommand , u s ua l l y a s a pa r t of DECn e t i n i t i a l i za t i o n . Al l D E Cn e t u s e r s a s s i g n a c h a n n e l to d ev i c e NE T O , a t wh i c h t i me a n e t wo r k UC B i s c r ea t ed to d esc r ibe the l og i c a l l i n k f o r m ed wi th a no th e r p r o c e s s on a n o th e r CPU , a nd th a t UCB is g i v e n a un i que n umbe r , s uc h a s N E Tl O O . Th e c h a nn e l n umbe r r e t u r ned to the u s e r po i n t s to t h e n ewl y c r e a t ed UC B , wh i c h w i l l b e d e l e t ed wh en the use r no l o ng e r d e s i r e s t h e l og i c a l l i n k . Al l r e a d a nd wr i te r e que s t s ( f r om a l l D E Cn e t u s e r s ) a r e pa s s e d to N E T DR I VE R . N E TDR I VE R c ons i s ts p r ima r i l y o f FDT r o u t i n e s th a t p r e p r o c e s s t h e I /0 r e q ue s t , a nd q u e u e the I R P t o a s e pa r a t e p r o c e s s , 1 5-1 1 VAX/VMS DEVI C E DR I VE RS N ETAC P ( th e n e two r k AC P ) , by c a l l i ng routine EXE $ Q I OAC PPKT ( in S YS Q I O R E Q ) . NE TAC P h a s a c h a n n e l a s s i g n ed to the r ea l c omm un i c a t i o n d ev i c e (a DMC - 1 1 ) , and i ssues I /0 r e q ue s t s to the r e a l d ev i c e on b eh a l f o f the u s e r , wh i c h a r e p r o c e s s ed by the real d ev i c e d r i v e r XMDR I VE R is t h e n am e o f t h e d ev i c e d r i v e r fo r the ( Fi g u r e 1 5-3 ) . DMC - 1 1 . Responds to user $QIO for network operations Figure 1 5-3 XMDRIVER N ETACP N ETDRIVER .. Issues $QIOs on behalf of user to real device ... - Controls the real device DMC-1 1 Ro l e o f N E TDR I VER i n P r o c e s s i ng Netwo r k I /0 Reque s t s Th e c omm un i c a t i o n d ev i c e ( DMC - 1 1 ) i s no rma l l y a n o n s h a r e a b l e d ev i c e , a nd t h e r e f o r e o n l y o n e p r o c e s s c a n have a c h a n n e l a s s i g n ed to i t . In o rd e r to i m p l em e n t DECn e t p r o t o c o l s , NETAC P mu s t a s s i g n a channel to the d ev i c e . Oth e r p r o c e s s e s , th e r e fo r e , c a n no t a s s i g n c h anne l s to the d ev i c e , b e c a u s e a s s i g n i ng a channel to a nonsha r ea b l e d ev i c e i mpl i c i t l y a l l o c a t e s t h e d ev i c e , a s d e sc r i b ed i n Ch a p t e r 1 6 . Th e p s e u d o d ev i c e N E T i s th e r e f o r e u s e d to a l l o w m a ny u s e r proc e s s e s to i s s u e I/O r e q ue s t s f o r the n e t wo r k , wh i c h may be pa s s ed to NETAC P , a nd eve n t u a l l y t o the d r i v e r fo r t h e n o n sha r e a b l e c ommun i c a t i o ns d ev i c e ( i n e ffec t , m a k i ng t h e d ev i c e sha r eab l e ) . N E TAC P a nd N E TDR IVE R a r e r e s p o n s i b l e fo r manag i ng a l l of the l og i c a l l i nks e s tabl i shed by use r s , a nd r e t u r n i ng st atus i n fo rma t i o n to the a pp r o p r i a t e us e r r eg a r d i ng e a c h I /0 r e q ue s t . 15. 4 . 3 M a i l b ox D r i v e r Ma i l box e s a r e so f t wa r e - impl eme n t ed d e v i c e s tha t c a n pe r f o rm r e ad and wr i t e o p e r a t i o n s . No rm a l l y , ma i l b ox e s a r e used fo r c o mmun i c a t i o n b e t we e n p r o c e s s e s . Al though m a i l bo x e s t r a n s fe r i n fo rma t i o n i n much the s am e wa y tha t o th e r I /0 d e v i c e s d o , t h e y a r e not a c tua l d e v i c e s . Th e fo l l o w i ng s e c t i o n s d e sc r i b e ho w t h e m a i l bo x d r i v e r ( i n MBDR I VE R , a mod ul e i n t h e s ys t em i m ag e ) b u f f e r s m e s s a g e s wr i t t e n to ma i l bo x e s , a nd s e r i a l i z e s m a i l box r e ad r e q u e s t s . 15. 4. 3 . 1 P r o c e s s i ng S e t Mo d e Requ e s t s - A process may r e que s t not i f i c a t i on of a ma i l bo x r e ad o r wr i t e r e que s t b y i s s u i ng a $ Q I O r e q u e s t w i th a n I O $ S E TM ODE f unc t i o n c o d e ( a nd an I O $ READATTN o r S e e th e VAX/VMS I / O- Us e r ' s G u i d e I O $ WRTATTN f un c t i on c o d e mo d i f i e r ) . f o r -d e t a i l s . Th e m a i l bo x d r i v e r ' s FDT r o ut i nes r e s pond to the se r e que s t s b y 1. v e r i f y i ng tha t t h e p r o c e s s m a y a c c e s s the m a i l bo x , 1 5-1 2 VAX/VMS DEVI C E DR I VE R S 2. r·eque s t que ue i ng th e to the a pp r o p r i a t e l i s th e a d wr i t e ( UC B $ L MB W AST fo r r e q ue s t s , o r UC B $ L MB R A S T f o r r e a d re quest s ) by c a l l i ng r o ut i ne on C OM $ SETATTNAS T in C OMDRVS UB ( wh i c h a l l o c a t e s , i n i t i a l i z e s , and que ue s a n AST s p e c i f i ed c o n t r o l b l o c k to the l i s t head , a s d e s c r i bed in Ch a p t e r 5 ) ' a n d 3. r a i s i ng I P L to I P L $ MA I LBOX ( I P L 1 1 ) , a n d c h e c k i ng to s e e if t h e no t i f i c a t i o n c ond i t i o n r e q u e s ted i s p r e s e n t ( c u r r e n t r e a d o r wr i t e r e que s t o u t s t a nd i ng ) . I f so , r o u t i n e C OM $ D E LATTNAST in C OMDRVS UB i s c a l l ed to queue the a t te n t i o n AST t o the r e q u e s t i ng p r o c e s s ( Ch a p t e r 5 ) . Oth e r w i s e , t h e a t te n t i o n AST r eque s t r ema i n s q u e ued to t h e m a i l bo x UC B , b u t the I /0 r e q u e s t i s c o mp l e t e d by c a l l i ng EXE $ F IN I S H I OC . Th e a t te n t i o n AST w i l l be que ued to the process wh en a r e ad o r wr i t e r e q u e s t , a s a pp r o p r i a te , i s i s s ued f o r t h e m a i l bo x . No t e th a t m a i l bo x e s use fo r k I PL $ MA I L BOX ( I PL 1 1 , the h i g h e s t f o r k I P L ) , to avo i d po s s i b l e syn c h r o n i z a t i o n p r o b l ems w i t h o t h e r d r i v e r s th a t r e f e r e n c e ma i l bo x e s wh i l e at the i r r e s pe c t i v e fo r k I PLs ( f o r ex ampl e , to s e nd a " d ev i c e i s o f f l i n e " me s s ag e to t h e o p e r a to r ' s ma i l box ) . 15. 4. 3.2 P r o c e s s i ng a Ma i l bo x Re a d Reque s t Wh e n a use r i ssues a r e ad m a i l bo x $QIO, t h e m a i l bo x d r i v e r FDT r o u t i n e s pe r fo r m t h e fo l l o w i ng g e n e r a l f unc t i o ns . - l. Th e us e r r e qu e s t i s va l i d a ted to ma ke sure th e r e qu e s t i ng process ' s UIC i s g i ven access to the ma i l bo x , th a t t h e m e s s a g e s i z e r e q u e s t ed i s a l l o wed fo r t h e m a i l bo x , a nd th a t t h e u s e r h a s wr i t e a c c e s s t o the b u f f e r s pe c i f i e d ( i n to wh i c h t h e ma i l bo x me s s ag e w i l l be pl a c ed ) . 2. Th e a d d r e s s o f t h e s pe c i f i ed b u f f e r , i n to wh i c h the m e s s a g e w i l l b e wr i t ten , i s s a v ed i n I R P$ L M E D I A . 3. Th e I R P $ V MB X I O b i t i n I RP $W S T S is set so th a t the I /0 po s t p r o c e s s i ng r o u t i n e s w i lT r ec og n i z e a ma i l bo x I /0 r e que s t c ompl e t i o n a n d a n n o u n c e t h e av a i l a b i l i ty o f t h e RS N $ MA I LB OX resource . 4. I f t h e I O $M N OW f u nc t i o n c od e mo d i f i e r wa s n o t spec i f i e d in the $ Q I O ca l l , t h e r e que s t i s que ued t o the d r i v e r ' s s t a r t I /0 r o u t i n e . 5. I f t h e I O $M N OW mo d i f i e r wa s s pe c i f i ed , I PL is r a i sed to I P L $ MA I LBOX ( I PL 1 1 ) , and i f a n y m e s s ag e s a r e a v a i l a b l e ( UC B$W M SGCNT i s n o n ze ro ) t h e r equest is q ue ued to the d r i v e rTs sta r t I /0 r o ut i ne . O t h e rwi s e , t h e S S $ ENDO F F I L E m e s s a g e i s r e t u r n ed to the u s e r , and the I /O o pera t i o n is compl e t ed . ma i l bo x Th e ma i l bo x d r i v e r ' s s t a r t I /0 r o u t i n e pe r f o rms th e fo l l o w i ng s t e ps . 1. I t f i r s t t r i e s to d e que ue a m e s sa g e wr i t t e n to ( me s s a g e s a re que ued to the UC B , w i th UCB $ L_MB_MSG Q ) . 1 5 -1 3 the ma i l bo x l i s th e a d at VAX/VMS DEVI C E DR I VERS 2. I f no me s s a g e i s fo und , a ny pend i ng r e a d a t te n t i o n ASTs a re q u e ue d to th e i r p r o c e s s ( e s ) ( by pa s s i ng the l i s th e a d a d d r e s s , UC B $ L MB R A S T , to C OM $D E LATTNAS T , as d e s c r i b ed in C h a p te r 5) :- 3. Th e m a i l bo x UC B r em a i ns " b u s y " ( th e UC B $V B S Y b i t i s s e t in UC B $W_S T S ) , a l tho ug h n o f u r th e r p r o c ess i ng o c c u r s un t i l a w r i t e r e qu e s t i s i s s ue d . S u b s e q u e n t r ea d r e q u e s t s w i l l wa i t t o en te r the s ta r t I /0 r o ut i ne ( a l th o ug h t h e y w i l l be p r e p r o c e s s e d by FDT r o u t i n e s ) , bec a u s e the busy b i t is set . As soon as th i s r ea d r eque s t t e rm i n a t e s , t h e nex t r e a d r e q ue s t wi l l b e p r o c e s s ed by the s ta r t I /0 r o u t i n e . 4. I f a me s s ag e wa s fo und ( o r a wr i te r e q u e s t o c c u r s a nd a read r e q u e s t i s o u t s t a nd i ng , a s d i sc u s s e d i n s t ep 3 ) , t h e n spec i a l a c t i on i s t a ke n . a. Th e ad d r e s s o f t h e m e s s a g e b l o c k b u i l t by t h e wr i t e FDT routine ( Fi g u r e 1 5-4 ) i s p l a c ed i n I R P $ L S VA PTE i n the r e ad request ' s I R P so th a t the I /0 po s t p r o c e s s i ng r o u t i ne s c a n l oc a t e t h e m e s sag e a nd c o py i t i n to th e u s e r ' s buf fe r . pointer to start of data pointer to user buffer mailbox IPL block type -._. -- lll.. , size of block saved packet address (low word) size of message in bytes process ID of sender (low word) saved packet address (high word) MAILBOX MESSAGE DATA F i g u r e 1 5 -4 L a yo u t o f Ma i l bo x Me s s ag e B l o c k 1 5- 1 4 VAX/VMS DEVI C E DR I VERS b. Th e f i r s t t wo l ong wo r d s i n the m e s sag e b l o c k a re i n i t i a l i ze d to c o n ta i n v a l ue s e x pe c t ed by the I/0 po s t p r o c e s s i ng r o u t i ne s . ( Th e f i r s t l o ng wo r d po i n t s to the m e s s ag e d a t a , s to r ed i n the m e s sa g e b l o c k , a nd the s e c o nd l o ngwo r d po i n t s t o t h e us e r b u f f e r , wh e r e th e d a t a w i l l be c o p i ed by t h e I /O c ompl e t i o n spec i a l k e r n e l AS T . ) Th e a d d r e s s o f t h e u s e r ' s b u f f e r i s r e t r i eved f r om th e I RP $ L_M E D I A f i e l d i n t h e r e a d r e qu e s t ' s I RP . c. Th e o u t s tand i ng m e s s ag e m a i l bo x i s d e c r em e n t e d . d. p l a c ed is in r eque s t the r ead ID of process Th e become the h i gh-o r d e r i t wi l l ( so tha t I RP $ L M E D I A+ 4 l o ngwor d o f t h e I O S B f o r t h e wr i te r eq u e s t $ Q I O ) , a n d t h e S S $ N O RMAL s uc c e s s c o d e i s p l aced i n t h e l o w- o r d e r wo r d o f th e I O S B ( I RP $ L_M ED I A ) c o un t ( UC B $W_M SGC NT ) fo r the • e. Ro u t i n e C OM $ P O S T ( i n C OMDRVS UB ) i s c a l l ed to i n s e r t the wr i te r e que s t ' s I R P on the I /0 po s t p r o c e s s i ng queue . Th i s r o u t i n e i s c a l l ed , r a th e r than i s s u i ng the R E QC OM mac ro , so th a t a n o t h e r I RP i s n o t d e q u e ued ( b e c a us e o n l y r e a d r e que s t I RPs a r e q ue ued to the UC B wa i t i ng to enter the start I /0 routine) . A l s o , t h e b u s y s t a t us o f t h e un i t i s no t c h ang e d ( UC B $V_B SY i n UCB $W_S TS ) . f. Wh e n C OM $ PO S T r e t u r n s c o n t r o l , the process ID o f the wr i t e r e que s t ' s I RP i s pl a c ed in Rl ( a nd w i l l even t ua l l y b e c om e t h e h i g h - o r d e r l o ng wo r d o f the r e ad r e que s t ' s I OS B ) , and the R E QC OM m a c r o i s c a l l ed to compl e t e the r ead r eque s t . Th e n ex t r e ad r e que s t ( i f any) wi l l a u toma t i c a l l y b e d eq u e ued , and t h e s t a r t I /0 s e q uenc e r e pea t e d . I f no r e ad r e que s t i s o u t s t a nd i ng , the busy b i t w i l l be c l e a r ed . 15. 4 . 3. 3 P r oc e s s i ng a Ma i l bo x Wr i t e Reque s t - Wh e n a us e r i ssues a wr i t e m a i l bo x $QIO, t h e ma i l bo x d r i ve r FDT r o u t i n e s pe r f o rm the fo l l o wi ng g e n e r a l f unc t i o n s . 1. Th e s a m e va l i d a t i o n c h e c k s t h a t we r e mad e i n s t e p s 1 a n d 2 o f the r ead $ Q I O F DT r o u t i n e s a r e pe r fo rmed h e r e , e x c e pt th a t t h e b u f f e r c o n t a i n i ng t h e d a t a t o b e wr i t t e n i s c h e c k e d fo r r e ad a c c e s s i n s t e a d o f wr i t e a c c e s s . 2. A m e s s a g e b l o c k i s a l l o c a t e d f r om no npa g ed po o l ( by routine E XE $ A LONON PAG E D ) , a n d i n i t i a l i z e d ( a s s h o wn i n F i g u r e 1 5 - 4 ) . Th e d a t a t o be wr i t t e n to t h e m a i l box i s c o p i ed i n to the message block . Th e r e a r e 22 byt e s of o v e r h e a d ( no t m e s sag e d a t a ) i n th e me s s a g e b l o c k . 3. I P L i s r a i s ed to I P L $ MA I LB OX , a n d the m a i l bo x i s e x am i ned to see i f t h e r e i s e no ugh r oom f o r the m e s s ag e . I f n o t , I PL i s r e s to r e d , t h e me s s ag e b l o c k i s d e a l l o c a t ed , a nd the r e qu e s t is p l a c ed in a r e s o u r c e wa i t s t a t e ( wa i t i ng fo r the R S N $_MA I LBOX r e s o u r c e ) • 4. Th e m e s sa g e b l o c k i s i n s e r t e d o n the que ue o f m e s sag e s w i th l i s th e a d UCB $ L MB M S G Q+ 4 ( un l e s s the r e 1 s a r e a d r e que s t o u t s t a n d i ng , i n-whTc h c a se c o n t r o l i s t r an s f e r r ed to s tep 4 i n t h e s t a r t I /0 r o u t i n e , d i s c u s sed i n the p r ev i o u s s e c t i o n ) . 1 5 -1 5 VAX/VMS DEVI C E DRIVERS 5. An y q u e ued w r i t e a t t e n t i o n A S Ts a r e d e l i v e r ed ( by pa s s i ng the l i s th e a d ad d re s s , UC B $ L MB W A S T , to COM $ D E LATTNAS T , as - - d e s c r i b ed i n Ch a p t e r 5 ) . 6. I P L i s l o we r ed to wh a t i t wa s b e fo r e s t e p 3 wa s e x ec u t ed , a nd a c h e c k i s m a d e to s e e i f the I O $ M N OW f un c t i o n c o d e mo d i f i e r wa s s pe c i f i ed i n t h e $ Q I O c a l l . 7. I f s pec i f i e d , t h e wr i t e I /O r e qu e s t i s c ompl e t e d ( by c a l l i ng E XE $ F I N I S H I OC ) . Oth e rwi se , t h e p r o c e s s i ng o f t h e wr i t e I /0 r e q u e s t i s s u s p e n d ed ( un t i l a r e a d r eq u e s t is i s s u ed ) , a nd control i s pa s s e d t o EXE $ Q I ORETURN , s o some o th e r p r o c e s s i n t h e s y s tem m a y r e s um e ex e c u t i o n . 15. 5 C ONSOLE INTERFAC E Th e c o n s o l e i n t e r f a c e , t h e po r t i o n o f t h e p r o c e s s o r th a t i n i t i ates a b o o t s t r a p o pe r a t i o n a nd pe rm i t s m i c r od i ag no s t i c s to e x e c u t e , i s n o t s p e c i f i ed by t h e VAX a r c h i te c t u r e b u t is C PU s pe c i f i c . Th e VAX Ha r d wa r e Ha nd b o o k c o n t a i n s m o r e d e ta i l s a b o u t the c o n so l e i n te r f aces fo r each CPU . 15. 5. 1 VAX- 1 1 /7 5 0 Conso l e I n t e r f a c e Th e c o n s o l e i n t e r f a c e o n t h e VAX- 1 1 / 7 5 0 c o n s i s t s o f a t e rm i n a l , a TU 5 8 cartr idge d ev i c e , a n opt i on a l r emo t e d i ag n o s i s po r t , a nd some m i c r o c o d e i n the VAX- 1 1 / 7 5 0 p r o c e s s o r . Wh e n t h e c o n s o l e p r og r am h a s c o nt r o l ( th e th r e e a ng l e b r a c k e t p r ompt h a s b e en t yped on t h e c o n s o l e t e rm i n a l ) , t h e VAX- 1 1 / 7 5 0 p r o c e s so r i s n o t e x e c u t i ng m a c r o code ( b e c a u s e i t i s e x e c u t i ng t h e c o n s o l e m i c r o c o d e ) . Th e r e a r e e i g h t p r o c e s s o r i n t e r n a l r eg i s t e r s o n t h e VAX- 1 1 / 7 5 0 c ommun i c a t i ng w i t h t h e the t wo c o n s o l e d ev i c e s . In add i t ion , the a r c h i te c t u r e spec i f i e s t h a t t h e PR $ T XDB r eg i s te r i s to be u s ed c ommun i c a t i o n f r om VAX ma c ro c ode to the c o n s o l e s ub s ys t e m . s p e c i a l u s e s o f t h i s r eg i s t e r ( so m e o f wh i c h a r e not u s ed by VAX- 1 1 / 7 5 0 ) a r e l i s t ed i n Tab l e 1 5 - 1 . 15. 5. 2 fo r VAX fo r Th e the VAX- 1 1/7 8 0 Conso l e I n t e r f a c e Th e VAX- 1 1 / 7 8 0 c o n so l e i n te r f a c e c o n s i s t s o f a n LS I - 1 1 m i c r o c om p u t e r , a f l o ppy d i s k , t h e c o n s o l e t e rm i n a l , a nd a n o p t i o n a l r emo te d i a g no s i s po r t ( a s d e sc r i b ed i n t h e VAX Ha r dwa r e Ha nd boo k } Th e c o n s o l e p r og r am e x ec u t e s o n t h e L S I - 1 1 ( u s i ng t h e PD P- 1 1 i n s t r uc t i o n s e t ) Bec a use t h e c o n s o l e p r og r am i s e x e c u t i ng on a s e pa r a t e p r o c e s so r , it is po s s i b l e fo r the c o n s o l e s ub s ys t em t o pe r f o rm a l i m i t ed s e t o f f un c t i o n s w i tho ut h a l t i ng t h e VAX - 1 1 /7 8 0 C P U . • • Th e VAX- 1 1 / 7 8 0 u s e s f o u r p r o c e s so r i n t e r n a l r eg i s t e r s to c ommun i c a t e to the two c o n s o l e d ev i c e s . Th a t i s , u n l i k e the VAX - 1 1 / 7 5 0 , t h e same r eg i s t e r s a r e u s ed to c omm un i c a t e to two d ev i c e s . Th e d ev i c e ID is e nc o d ed i n to the cont r o l b i ts to a l l o w VAX- 1 1 m a c r o c o d e to d i s t i ng u i sh b e twe e n the two d ev i c e s . Al l c o n s o l e d a ta t rans f e r o pe r a t i o n s a r e pe r fo rmed b e twe e n the VAX- 1 1 /7 8 0 C PU a n d th e LS I - 1 1 C PU u s i ng t h e s e fo u r i n t e r n a l p r o c e s s o r r eg i s te r s . Th a t is, no d i rect 1 5- 1 6 VAX/VMS DEVI C E DR IVERS t r a ns f e r s a r e m a d e b e twe e n t h e VAX- 1 1 /7 8 0 CPU a nd t h e c o n so l e t e rm i na l o r f l o ppy d i s k . As w i th t h e VAX - 1 1 /7 5 0 , t h e P R $ TXDB r eg i s t e r i s a l so u s ed fo r c ommun i c a t i o n t o the c o n s o l e p r og r am ( Tab l e 1 5 - 1 ) . Ta b l e 1 5 - 1 Spe c i a l Us e s o f t h e Co n so l e PR $ TXDB Reg i s t e r Re g i s t e r Co nten t s Me an i ng Comments FOl So ftwa r e Do ne Used by the VAX-1 1 /7 8 0 Mem o r y ROM p r og ram t o no t i f y con so l e p r og ram tha t i t h a s l oca ted 6 4 K byt e s o f g ood memo r y F02 Rebo o t the CPU U s ed b y t h e b ug c hec k r o ut i n e t o r eboo t t h e sys tem a f te r a f a t a l bug c h e c k F03 C l ea r Wa rm- sta r t Fl ag Th i s fl ag i s ma i n ta i n ed b y the prog ram . VAX- 1 1 /7 8 0 c o n so l e Th e r e i s no ana l og ue on the VAX- 1 1 /7 5 0 . F04 Cl ea r Co l d -sta r t Fl ag Th i s fl ag i s ma i n ta i n ed by the c onso l e p r og ram on e i th e r p r o c e s so r to pr event nested boo t s t r a p a t tempt s . 15. 5. 3 Da ta T r a n s f e r be twe e n th e VAX- 1 1 CPU a nd Conso l e Dev i c e s Th e i n t e r n a l p r o c e s s o r r eg i s t e r s , PR$ TXC S a nd PR $ R XC S ( a nd PR $ C S R S a nd PR $ C S TS o n t h e VAX- 1 1 /7 5 0 ) a re used f or c o n t r o l a nd s ta t us i n f o rm a t i o n ( to e n a b l e i n te r r up t s a nd to i nd i c a t e tha t a d ev i c e is Th e o th e r two i n t e r n a l r eg i s t e r s , PR $ RXDB a nd PR $ T XDB ( a n d r ea d y ) . PR $ C SRD a nd PR$ C S TD o n th e VAX- 1 1 /7 5 0 ) a r e used t o t r a n sfe r d a t a . Th e - TXxx ( a nd CS Tx ) r e g i s t e r s a r e u s ed f o r t r a n sm i t o pe r a t i o n s ( wi th r e s pe c t to the VAX- 1 1 C PU ) wh i l e t h e RXx x ( a nd C S Rx ) r eg i s t e r s a r e u s ed f o r r ec e i v e o pe r a t i o n s . Mo s t d r i v e r s t r e a t d ev i c e r eg i s t e r s a s i f t h e y we r e memo r y l o c a t i o n s , u s i ng MOVB o r M OVW i n s t r uc t i o n s to r ea d o r w r i te d a t a i n tho s e r eg i s te r s . I n t h e c a s e o f t h e c o n so l e , t h e MTPR a n d MFPR i n s t r uc t i o n s a r e u s e d t o t r a n sm i t a nd r ec e i v e d a ta , r e spec t i v e l y . Fo r e x amp l e , t h e fo l l o w i ng i n s t r uc t i o n s o n t h e VAX- 1 1 /7 8 0 M T PR d a t a , # P R $ _TXDB t r a n sm i t d a t a MFPR # P R $ _RXDB , d a t a r ec e i ve d a t a t r a n sm i t a nd r ec e i ve d a ta . Th e d a ta is sent or r e c e i ve d as a l on g wo r d , w i th b i ts <7 : 0> c o n t a i n i ng th e AS C I I c ha r a c t e r , a nd b i t s < 1 1 : 8 > i d e n t i f y i ng wh i ch c o n s o l e d ev i c e ( t e rm i n a l o r f l o ppy d i s k ) is s en d i ng or r ec e i v i ng t h e d a ta . On t h e VAX - 1 1 /7 5 0 , t h e d i s t i nc t i o n b e t we en d ev i c e s i s m a d e b y c ho i c e o f r eg i s t e r i n s t e a d o f by i nc l ud i ng a d ev i c e c o d e i n a d a t a b u f f e r r eg i s t e r . No t e t h a t a l l d a t a i s pa s s e d a c h a r a c t e r at a t ime , even to the f l o ppy d i s k . Th e r e fo r e , it is r ec omm e nd ed that a sepa rate f i l e s ACP b e r e que s te d t o s e rv i c e t h e c o n so l e b l o c k s to r a g e d ev i c e . 1 5- 1 7 VAX/VMS DEVI C E DRI VERS 15. 5. 4 C o n s o l e I n te r r up t D i spa t c h i ng As t h e p r ev i o u s d i sc u s s i o n o f p r o c e s s o r r eg i s t e r s i nd i c a t e s , the two c o n s o l e d ev i c e s ( t e rm i n a l a nd b l o c k s to r a g e d ev i c e ) a r e t r e a t ed s l i g h t l y d i f fe r e n t l y on the VAX- 1 1/7 5 0 and the VAX- 1 1 /7 8 0 . On the VAX- 1 1 /7 5 0 , t h e b l o c k s to r ag e d ev i c e ( a T U 5 8 c a r t r i d g e ) h a s i t s o wn c o n t r o l r eg i s te r s a nd i t s o wn i n t e r r up t v e c to r s . On the VAX-1 1 / 7 8 0 , the two d ev i c e s a re h a nd l ed mo r e a s a s i ng l e e n t i t y , w i th c ommo n r o u t i n e s d i s t i ng u i sh i ng t e rm i n a l o pe r a t i o n s f rom f l o ppy d i sk o pe r a t i o n s . Th i s d i f f e r e n c e i s a l s o r e f l e c t e d i n th e d i f f e r e n t fo r m s o f i n t e r r upt d i spa tc h i ng o n the two p r o c e s so r s . 15. 5 . 4 . 1 Co n s o l e Te rm i na l I n t e r r up t s - Wh e n the s ys t em is bo o t s t r a pped , t h e Sy s t em Co n t r o l B l o c k ( S C B ) i s i n i t i a l i z ed ( f r om t h e SCB t empl a t e i n S C BVE C TOR ) so tha t t h e two v e c to r s a t o f f s e t s F 8 a nd FC ( h e x ) po i n t to c o n s o l e i n t e r r up t s e r v i c e r o u t i n e s ( CON $ I NTD I S I f o r c o n s o l e i n put a nd C ON $ I NTD I S O f o r c o n so l e o u t pu t ) B o th r o ut i n e s r e s po nd to an i n t e r r up t by s a v i ng r eg i s t e r s R O th r o ug h R 5 , a nd t r a n s f e r r i ng c o n t r o l to r o u t i n e s i n C ON I NTDS P ( C ON $ I N T I N P fo r c o n so l e i n p u t , C ON $ I NTOUT f o r c o n s o l e o u tpu t ) . • C ON $ I NT I N P r e ad s t h e d a ta a nd c o n s o l e d ev i c e i d en t i f i c a t i o n f r om t h e PR $ R XDB r eg i s te r a nd d e te r m i n e s wh e th e r the i n te r r upt wa s f r om t h e c o nso l e t e rm i n a l o r b l o c k s to r a g e d ev i c e . I f t h e i n t e r r up t wa s f r om t h e c o n s o l e t e rm i n a l , t h e n the c h a r a c t e r r e a d o pe r a t i o n i s h a nd l ed by the t e rm i n a l d r i v e r ' s c h a r ac t e r b u f f e r i ng r o ut i ne who s e add ress is s to r ed i n g loba l l o c a t i o n TTY$G L P U TNXTC H . Th e c h a r a c t e r i s a l s o e c h o ed b a c k t o the c o n s o l e t e rm i n a l by b e i ng p l a c ed i n the PR $ _TXDB r eg i s t e r . Ro u t i n e C ON $ I NTOUT t r a n sm i t s d a ta t o the c on s o l e t e rm i n a l th r o ug h the PR $ _TXDB r eg i s te r a nd d e te rm i n e s wh e th e r the r e s u l t i ng i n t e r r up t i s f r om t h e t e rm i n a l or t h e c o n s o l e b l o c k s to r ag e d ev i c e . If the i n t e r r upt wa s c a used by t h e t e rm i n a l , t h e n t h e t e rm i n a l o u tpu t r o u t i n e ( wh o s e ad d r e s s i s s to r e d i n l o c a t i o n TTY$G L G E TNXTC H ) i s c a l l ed to g e t t h e n e x t c ha r a c t e r f o r o u t pu t . No t e t h a t the h a nd l i ng o f c o nso l e t e rm i n a l I /O i s d o n e by the no rma l t e rm i n a l d r i v e r r o u t i n e s . On l y the i n i t i a l f i e l d i ng o f i n te r r up t s a nd t h e d ev i c e r eg i s t e r s th a t a r e r e ad o r wr i t te n d i s t i ng u i sh c o n s o l e t e rm i n a l I /O f r om o pe r a t i o n s t h r o ug h the r eg u l a r te rm i n a l i n te r f a c e . No t e a l s o tha t the c o n s o l e t e rm i n a l a l wa ys i n te r r up t s a t I PL 2 0 ( th e l owe s t d ev i c e I P L u s ed by d r i v e r s ) o n bo th t h e VAX-1 1 /7 5 0 a n d t h e VAX- 1 1 /7 8 0 . 1 5 . 5 . 4 . 2 Conso l e B l o c k S to r a g e Dev i c e I /0 - Th e d ev i c e d r i v e r a nd a s so c i a t e d d a t a b a se fo r t h e c on s o l e b l o c k s to r a g e d ev i c e a r e n o t l o ad ed un t i l a n e x pl i c i t C ONNE C T C ON S O L E c ommand i s i s s u e d to SYSGEN . At t h a t t i me , t h e d ev i c e d r i v e r a nd d a t a s t r uc t u r e s a pp r o p r i a t e to the spec i f i c p r o c e s so r a r e l o a d ed i n to m emo r y a nd i n i t i a l i z e d . A C ONN ECT C ON S O L E c omma nd tha t i s i s s ued to SYSGEN o n a VAX- 1 1 /7 5 0 c a us e s t h e TU5 8 d r i v e r ( c a l l ed DDDR I VE R ) t o b e l o ad ed and d a ta s t r uc t u r e s f o r a d ev i c e c a l l ed C SA 1 to be bui l t . I n a dd i t i on , two d ed i c a t ed v e c t o r s i n the SCB ( a t o f f s e t s F O a nd F 4 h e x ) a r e l o a d ed to po i n t t o i n te r r up t d i s pa tc h c o d e c o n t a i n e d i n t h e CRB f o r CSA1 . 1 5- 1 8 VAX/VMS DEV I C E DR IVERS Th e DDDR IVER t h us r e s po nd s t o c o n s o l e T U 5 8 i n te r r up t s in exa c t l y the s a m e wa y t h a t it r e s p o nd s to i n t e r r up t s g e n e r a t ed b y a T U 5 8 o n t h e UN I B U S . Th e o n l y d i f f e r e n c e b e twe e n the two i n t e r r up t s is tha t conso l e TU58 i n t e r r up t s o c c u r a t I P L 2 3 wh i l e UN I B US T U 5 8 i n t e r r up t s o c c u r a t I PL 2 0 . A C ONNE C T C ON S OLE c omma nd tha t i s i s s ue d to SYSGEN o n a VAX- 1 1 /7 8 0 c a us e s the c o n s o l e f l o ppy d i s k d r i v e r ( c a l l ed DXDR I VE R ) t o b e l o ad ed a nd d a t a s t r uc t u r e s fo r a d ev i c e c a l l ed C SA l to be b u i l t . B e c a u s e the c o n s o l e f l o ppy i n te r r up t s th r o ug h the s a m e vec to r s u s e d b y t h e c o n so l e t e rm i n a l , n o f u r th e r S C B mod i f i c a t i o n i s r eq u i r ed a t th i s t i m e . Wh e n a c o n s o l e d ev i c e i n t e r r upt o c c u r s , t h e i n t e r r up t se r v i c e r o ut ine d e te r m i n e s wh e th e r the i n t e r r up t wa s f r om t h e c o n s o l e t e r m i n a l o r f r om I f the i n te r r up t wa s f r om the b l o c k s to r ag e the b l o c k s to r ag e d ev i c e . d ev i c e , if the c o n s o l e h a s b e en c o n n e c ted ( a UCB e x i s t s f o r d ev i c e C SA l ) , a nd i f the i n t e r r up t wa s e x pe c t ed ( th e UC B $V ! NT b i t i s s e t in the s ta t us wo r d i n t h e UC B ) , t h e n t h e d r i v e r c o n t ext i s r e s t o r ed f r om t h e U C B a nd t h e d r i v e r p r o c e s s i s r e s um e d a t the s a v ed PC ( UC B $ L F PC ) . O th e r w i s e , t h e i n t e r r up t i s c o n s i d e r ed s p u r i o us a nd s i mpl y d i sm i ss e d . 1 5 . 5 . 4 . 3 Do u b l e Ma pp i ng o f Buf f e r Pag e s - One i n t e r e s t i ng f e a t u r e o f the TU58 d r iver a nd t h e f l o ppy d i s k d r i v e r , d r i v e r s tha t t r a n s f e r s d a ta o n e c h a r a c t e r at a t ime , is tha t they use the r o ut i n e s I OC $ F I L S PT , I OC $M OVFRUS E R , a nd I OC $MOVT O US E R ( i n BUFFERC T L ) t o d o ub l e m a p a pag e i n the u s e r ' s d a t a b u f f e r i n to s ys t em ad d r e s s s pa c e ( so tha t d a ta c a n b e t r a n s f e r r ed d i r e c t l y t o a nd f r om the u s e r ' s b u f f e r ) . U s e r b u f f e r pag e s a r e n o t no rm a l l y a c c e s s i b l e b e c a us e d ev i c e d r i v e r s execute i n s ys t em c o n t e x t a nd d o n o t h a v e p r o c e s s a d d r e s s s pa c e ava i l a b l e t o t h em . B y d o ub l e m a pp i ng a b u f f e r pag e i n to a s y s tem add r e s s r a ng e , t h e e n t i r e u s e r b u f f e r c a n be a c c e s s ed by t h e d ev i c e d r i v e r o ne pag e a t a t i m e . Th e sys t em pag e ta b l e en t r y u s e d t o map the pag e is r e s e r v e d i n t h e d r i v e r , b y s e t t i ng the DPT $V S VP b i t i n the F LAG S a r g um e n t to t h e D PTAB m a c r o . By m a k i ng the user buffer i s a c c e s s i b l e th r o ug h s ys t em v i r t ua l add r e s se s , t h e s e two d r i v e r s c a n u s e VM S d i r e c t I /0 , e v e n tho ug h t h e y a r e n o t DMA d ev i c e s . Th i s a l l o ws t h em t o i s s ue v i r t ua l I /0 r e que s t s , call e x i s t i ng A C P FDT r o u t i n e s , a nd u s e the v i r t ua l I /0 c ompl e t i o n r o u t i n e s i n t h e I /0 po s tp r o c e s s i ng c od e . 1 5-19 C HAPTER 1 6 I/0 SYSTEM S ERVI C E S A l l I /0 o p e r a t i o n s pe r f o r m e d o n a d ev i c e a r e r e q u e s t e d u s i ng th e I /0 Som e t im e s , the I /O s y s t em s e rv i c e s a r e c a l l ed o n s ys tem s e rv i c e s . b eh a l f o f a u s e r by s ys t em c ompo n e n t s s uc h a s RM S . Th i s c h a pt e r d e sc r i be s • • • • 16. 1 wh a t m u s t b e d o n e b e fo r e a n I /O r e qu e s t c an b e mad e a s s i g nme n t a nd d ev i c e a l l o c a t i o n ) , ( c h a nne l h o w a n I /O r e q u e s t i s s e n t t o a d ev i c e d r i v e r , h o w a u s e r i s no t i f i ed o f t h e c ompl e t i o n o f a n a nd h o w a u s e r c a n o b t a i n i n f o rm a t i o n abo u t a o r I /O r e q ue s t . I/0 pa r t i c u l a r r e q ue s t , d ev i c e A S S IGN I NG AND D EASS IGN ING CHANN E L S I n o rd e r t o r e q u e s t a n I /0 o pe r a t i o n o n a d ev i c e , a p r o c e s s n e e d s to to t he s ys tem . i d ent i fy the d ev i c e Th e so f twa r e m e c ha n i sm u s ed to l ink a process to a d ev i c e i s c a l l ed a channel . Onc e a use r e s ta b l i sh e s a c h a nn e l to a d ev i c e ( us i ng t h e $ A S S IGN s y s tem s e r v i c e ) , t h e u s e r m a y i s s u e I /O r e q u e s t s ( wi th the $ Q I O s ys t em s e r v i c e ) fo r tha t d ev i c e by s pe c i f y i ng t h e c h a n n e l n um b e r a s s i g n ed to t h e d ev i c e . I f t h e u s e r no l o ng e r wa n ts to u s e t h e d ev i c e , the $ DA S SGN s ys tem s e r v i c e c a n b e u s ed t o d e a l l o c a t e the c h a n n e l a s s i g ne d to the d ev i c e . 16. 1. 1 C h a n n e l As s i g nm e n t A c h a nn e l i s d e sc r i b e d by a Ch a n n e l Co n t r o l B l o c k ( CC B ) , l o c a t e d i n a d ed i c a t ed po r t i o n o f P l s pa c e ( F i g u r e 1 - 7 , Tab l e E - 4 ) . Wh e n a c h a n n e l i s a ss i g ne d t o c e r t a i n n o n s h a r e a b l e d ev i c e s , the u s e r m a y a l so a s s o c i a te a m a i l bo x w i th t h a t d ev i c e t o r ec e i ve s t a t u s i n f o rm a t i o n s uc h a s t h e a r r i v a l o f u n so l i c i t ed i nput f r om a t e rm i n a l . I t is up to t h e d ev i c e d r i v e r for e ac h d ev i c e t o e i th e r u s e o r i g no r e th i s a s s o c i a t ed m a i l bo x . Appe nd i x A o f t h e VAX/VMS G u i d e to Wr i t i ng a Dev i c e D r i ve r c o n t a i n s a c om p l e t e d e sc r i pt i o n o f t h e C C B . Th e $ A S S I G N s ys tem s e r v i c e c a l l s o n I OC $ FFCHAN a n d I OC $ S EARC HDEV ( in I O S UB PAG D ) to f i nd a f r ee I /0 c h a n n e l ( CC B ) , a n d to f i nd t h e Un i t Co n t r o l Bl o c k ( UC B ) f o r t h e d ev i c e t h a t i s b e i ng a s s i gned . Af t e r 1 6-1 I/0 SYS TEM SERVI C E S tha t , one d ev i c e i s of the f o l l o w i ng pa th s i s t a k e n , d e pend i ng on wh e th e r the • a l ocal • a s po o l ed d ev i c e , • th e n e two r k d e v i c e N E T : , o r • a r em o t e d e v i c e { no t a n e t wo r k ) d ev i c e , { a d ev i c e l o c a t ed o n a n o th e r nod e ) . 16. 1.1. 1 Lo c a l Dev i c e A s s i g nment - Th i s i s t h e t h e As s i g n C h a n n e l s ys t em s e rv i c e . 1. n o rma l pa th t h r o ug h Th e DEV$V S HR b i t i n UC 8 $ L D EVC HAR i s c h e c ked to s e e if the d ev i c e i s -a s h a r e ab l e d ev i ce . I f t h e d ev i c e i s n o n s h a r e a b l e , t h e n t h e d e v i c e i s i m pl i c i t l y a l l o c a t ed t o t h e process { by pl a c i ng t h e p r o c e s s I D , f r om PC 8 $ L_P I D , i n to UC 8 $ L_P I D ) . Th e UC8 a d d r e s s i s s t o r ed i n C C 8 $ L U C 8 . Wh e n e v e r the use r i ssues an I /0 r e q u e s t , t h i s po i nte r i s u s e d to i d e n t i f y t h e d ev i c e . I n th i s wa y , t h e d ev i c e c an b e fo und m uc h faster th a n b y r e pe a t ed l y c a l l i ng o n I OC $ S EARC HDE V , wh i c h f i nd s a d ev i c e UC 8 f r om t h e d ev i c e n am e { s uc h a s TT8 3 ) . 2. I f a n a s s o c i a t ed ma i l bo x wa s r e que s t ed , i t i s i d e n t i f i ed by p l a c i ng the UC 8 a d d r e s s { o f the ma i l bo x ) in th e UC 8 $ L AM8 f i e l d of t h e UC B f o r the d ev i c e to wh i c h t h e c h a n n e l i s be i ng a s s i g n ed . Th e UC B $W R E FC f i e l d o f t h e a s s o c i a t ed m a i l bo x i s i n c r eme n t ed , a n d t h e CC 8 $V AM8 f l ag i s s e t i n CC8 $ 8 STS to i nd i c a t e th a t a n a s s o c i a t ed ma i l bo x i s p r e s e n t . No t e-th a t no a s s o c i a t i o n i s mad e i f • e • the d e v i c e i s a f i l e - o r i e n t ed d ev i c e { i d e n t i f i ed P EV$V_F OD b i t i n UC 8 $ L_DEVC HAR ) , t h e d e v i c e i s sh a r e a b l e by the { D EV$V_S HR i n UC 8 $ L_DEVC HAR ) , o r the d e v i c e a l r e ad y h a s a n UC8 $ L_AM8 f i e l d i s n o n z e r o ) . a s s o c i a t ed { UC 8 $W_R E FC ) ma i l bo x { th e 3. Th e d e v i c e r e f e r e n c e c o un t 4. Th e a c c e s s mod e { p l u s o n e ) a t wh i c h the c h a n n e l i s b e i ng a s s i g ned is s to r ed i n C C 8 $ 8 AMOD . I OC $ F FCHAN i d e n t i f i e s a n u n u s e d C C 8 by l o o k i ng i n the CC 8 $ 8 AMOD f i e l d . I f t h e v a l ue s t o r e d th e r e i s a z e r o , t h e C C 8 i s-n o t b e i ng u s ed . 5. An y f l ag s a s s o c i a t ed w i t h the c h a nn e l ( s uch a s C C 8 $V AM8 i nd i c a t i ng th a t an a s s o c i a t ed m a i l bo x i s p r e s e n t ) a r e s tor ed i n C C 8 $ 8_STS . 6. Th e c h a n n e l n um b e r { r e a l l y a n i nd e x i n to the CC8 t a b l e in process P 1 s p a c e , p r ov i d ed b y I OC $ F FC HAN ) i s r e t u r n ed t o the u s e r at the add r e s s s pe c i f i ed in the CHAN a rg um e n t to $ASS I GN . 7. Th e no r m a l s uc c e s s f u l r e t u r n ed to t h e us e r . c ompl e t i o n 1 6-2 i s i n c r em e n t e d . code { S S $_N ORMAL ) is I /0 SYSTEM S ERVI C ES 1 6 . 1 . 1 . 2 Spe c i a l Ac t i o n When As s i g n i ng a Spo o l ed Dev i c e - I f the D E V $ V S PL b i t i n UC B $ L DEVC HAR i s s e t , then the d ev i c e b e i ng a s s i g ne d i s a spo o l ed d ev i c e . The o n l y d i f fe r en c e i n c h a n n e l a s s i g nm e n t fo r s po o l ed d ev i c e s i s tha t the s ta t u s f i e l d i n the c h a nn e l c o n t r o l b l o c k Th e d ev i c e a s s o c i a t ed w i t h the s po o l ed d ev i c e ( C C B $ 8 S T S ) i s c l e a r ed . i ts UC B a d d r e s s s to r ed i n the UC B $ L A M B f i e l d wh e n t h e d ev i c e wa s had Wh e n a n I /0 r e q ue s t i s pa s s ed to a s po o l ed d ev i c e , s e t to s po o l ed . the $ Q I O sys tem s e rv i c e r ec og n i z e s tha t the d ev i c e i s s po o l ed a nd a c t ua l l y pe r f o rm s t h e I /0 r e que s t to t h e a s s o c i a t ed d ev i c e . 1 6 . 1 . 1 . 3 Ass i g n i ng a Ch a n n e l to the Ne two r k Dev i c e - I f the d ev i c e b e i ng a s s i g n ed i s a n e t wo r k d ev i c e ( th a t i s , t h e u s e r i s a s s i g n i ng a channel to t h e N E T d ev i c e , p r obab l y to pe r fo r m t a s k - to - t a s k c omm un i c a t i o n ) , t h e n t h e f o l l o w i ng s t e p s a r e t a k e n . 1. A n e two r k U C B i s c r ea t ed by I OC $ C REATE_U C B ( i n I O S U B PAGD ) . 2. Th e U C B i s mad e t o l o o k l i k e a m a i l bo x UC B t h a t i s ma r k ed f o r d e l e te ( th e UC B $V D E LMBX b i t i n UC B $W DEVS T S i s s e t ) . Wh e n t h e u s e r d e a s s i g n s th e c h a n ne l , t h e UCB-w i l l b e d e l e t ed . 3. Th e u s e r ' s by t e c o un t q uo t a a nd l im i t a r e r ed uced b y t h e s i z e o f the UCB . 4. Fu r th e r p r o c e s s i ng p r o c e ed s n o n s h a r e a b l e d ev i c e . as in the c a se of a l oc a l , 1 6 . 1 . 1 . 4 Dev i c e s Lo c a te d o n Ano th e r Nod e - I f the d ev i c e b e i ng a s s i g n ed i s a r emo t e d ev i c e ( th a t i s , tb e f i l e spe c i f i c a t i o n c o n ta i n s a d o ub l e c o l o n ) , t h e n a m e s s a g e m u s t b e t r a n sm i t ted t o th a t nod e . 1. Th e d ev i c e n ame i s t r a n s l a t e d i n c a s e i t i s a l og i c a l name . 2. An $ A S S IGN i s i s s ued o n d ev i c e . 3. A $ Q I O ( w i t h the I O$ ACCESS f un c t i o n c od e ) is i s s ue d on beha l f of th e u s e r - ( s pec i f y i ng even t f l ag num be r 3 1 ) to e s t a b l i s h a n e two r k c o nn e c t i o n . If the $QIO fa i l s , the c h a n n e l i s d e a s s i g n ed u s i ng t h e $ DA S SGN s y s t em s e r v i c e . 4. Th e c h a nn e l n um b e r to the N E T : use r . 5. Th e S S $ R EMOTE s uc c e s s f u l c om p l e t i o n s t a t u s the u s e r . 16. 1 . 2 beha l f of the d ev i c e use r is to r e t u r ned is the to r e t u r ned NET : the to C h a n n e l De a s s i g nm e n t Th e $ DAS SGN s ys t em s e rv i c e d e a s s i g n s a p r ev i o u s l y a s s i g ned I /O c h a nn e l a nd clears the l i n kag e a nd c o n t r o l i n f o rma t i o n i n the c o r r e s po nd i ng CCB . Th i s i s a c compl i shed w i th the f o l l o w i ng s t eps . 1 6-3 I /0 SYSTEM S ERVI C E S 1. An y o u t s t a n d i ng I /O i s c a nc e l l ed . ( A $ CANC E L s y s tem s e r v i c e c a l l i s i s s ue d f o r t h e c h a n n e l o n b e h a l f o f t h e u s e r . ) 2. I f a f i l e i s o p e n o n t h e c h a nn e l ( i nd i c a t e d by CCB $ L W I N D b e i ng n o n z e r o ) , t h e n t h a t f i l e i s c l o s ed ( by i s s u i ng a $Q I OW w i t h t h e I O $ D EACC E S S f un c t i o n c od e , a nd s pe c i f y i ng eve n t f l ag n um b e r 3 1 ) . 3. I f any I /O i s s t i l l o u t s t a nd i ng ( i nd i c a t ed by CCB $W r oc b e i ng nonze ro ) , the process i s pl a c ed i n to an RSN$ A STwA I T wa i t state ( wa i t i ng fo r the I /0 c ompl e t i o n AST(s ) to be d e l i v e r ed ) . Ch a p te r 8 d i s c u s s e s wa i t s t a t e s i n d e ta i l . 4. Th e c h a n n e l i s a c t ua l l y d e a s s i g ned by c l e a r i ng th e CCB $ B_AMOD f i eld . 5. If th i s wa s the last ( UC B $W R E FC c o n t a i n s a c l e a r ing UC B $ L_P I D ) . 6. I f the d ev i c e i s m a r k e d f o r d i sm o u n t ( th e DEV$V DMT b i t in UC B $ L D EVC HAR i s s e t ) a n d i t wa s m o un ted w i th a-VM S AC P ( th e f o r e i g n b i t D EV$V F O R is c lea r ) , t h e d i sm o un t , m o un t ed ( D EV$V MNT ) , r e a d che c k ( D EV$V RCK ) , wr i te c h e c k ( D EV$V WC K ) , a nd s oftwa r e wr i t e l o c k e d ( D EV$V SWL ) b i t s i n UC B $ L DEVC HAR a re cl ea red . Th e UC B $ L VC B fi e l d i s c l e a r e d , a n d - i f th a t f i e l d wa s n o t z e r o , t h e Volum e Co n t r o l B l o c k po i n t ed t o by tha t f i e l d i s d ea l l o c a ted . Al s o , the vo l um e p r o t e c t i o n m a s k ( UC B $W P RO T ) a n d t h e s o f twa r e vo l um e va l i d bit ( UC B $V VA L I D i n UC BSW_ S T S ) a r e c l e a r ed . 7. Th e a s s o c i a t ed d ev i c e d r i v e r ' s c a nc e l I /0 r o u t i n e i s c a l l ed to pe r fo r m a n y d ev i c e - d epend e n t o pe r a t i o n s ( s e e the VAX/VM S UC B $W R E FC is G u i d e to Wr i t i ng a De v i c e D r i v e r ) , u n l e s s the g re a te r than 1, a n d t h e d ev i c e i s no t a l l o c a t e d ( o r un l e s s t h e d ev i c e i s n o t a l l o c a t e d t o t h e c u r r en t p r o c e s s ) . 8. I f a ma i l b o x wa s a s so c i a t e d wi th t h e d ev i c e wh e n the c ha nn e l wa s a s s i g n e d ( i nd i c a t e d b y C C B $ V A M B i n C C B $ B S T S ) , then t h e l i n kag e wi t h t h e m a i l bo x i s c l e a r ed b y 9. 16 . 2 c h ann e l a s s i g n ed to the d ev i c e 0) , t h e d ev i c e i s d e a l l o c a t e d ( by a. c l e a r i ng UC B $ L_AMB , b. d e c r em e n t i ng UC B $W_R E FC fo r the m a i l bo x UC B , a n d c. c a l l i ng I OC $ D E LM B X ( i n I O SUBNPAG ) to s e e i f t h e m a i l bo x UCB s h o u l d be d e l e t e d ( i n c a s e t h i s wa s the l a s t p r o c e s s r e f e r e n c i ng a t em po r a r y ma i l bo x ) . I f t h e d ev i c e t o wh i c h t h e c h a n n e l wa s a s s i g ne d wa s a m a i l bo x ( i n d i c a t e d b y t h e DEV$V M B X b i t i n UC B $ L DEVC HAR ) , I OC $D E LM B X i s a g a i n c a l l ed to s e e Tf t h a t m a i l bo x sho u l d b e d e l e t e d . DE VI C E A L LOCAT I ON AND DEA LLOCAT I ON A p r o c e s s a l l o c a t e s a d ev i c e ( us i ng the $ A L L OC s ys tem s e r v i c e ) to r e s e r v e t h a t d ev i c e fo r e x c l u s i v e u s e . A p r o c e s s d e a l l o c a te s a d ev i c e ( u s i ng t h e $ DA LL OC s ys t em s e rv i c e ) to r e l i nq u i sh e x c l us i v e o wn e r sh i p . 1 6-4 I / 0 SYS TEM S ERVI C E S Dev i c e Al l o c a t i o n 16. 2. 1 Th e fo l l o w i ng s t e p s a r e t a k e n by E X E $ A L LOC t o a l l o c a te a d ev i c e . 1. Th e p r o c e s s I D ( PC B $ L P I D ) f i e l d ( UC B $ L_P I D ) . is s to r ed in the d ev i c e 2. Th e d ev i c e a l l o c a t e d b i t 3. Th e d e v i c e r e f e r e nc e c o un t 4. Th e a c c e s s m o d e a t wh i c h t h e d ev i c e i s a l l o c a t e d i s p l a c ed i n UCB $ B AMOD . ( D EV$V_A L L i n UC B $ L_DEVC HAR ) ( UC B $W_R E FC ) o wn e r i s set . i s i nc r em e n t ed . An y o f the fo l l o w i ng c o nd i t i o n s wi l l p r ev e n t d ev i c e a l l o c a t i o n . • Th e d e v i c e i s a l r e a d y a l l o c a ted by a n o th e r p r o c e s s is nonze r o ) . • Th e d ev i c e r e f e r e n c e c o un t ( UC B $W_R E F C ) e Th e mo un ted b i t e • 16. 2. 2 ( UC B $ L_P I D i s no n z e r o . ( UC B $V_MNT i n UC B $ L_DEVC HAR ) Th e spo o l e d b i t ( UC B $V S P L i n UC B $ L DEVC HAR ) p r o c e s s d o e s no t have AL L S PO O L p r i vil eg e . i s set . i s s e t , a nd the Th e d e v i c e i s n o n s h a r e a b l e , a nd t h e r e qu e s t i ng process does no t h a v e a c c e s s r i g h t s ( l o c a t ed th r o ug h PC B $ L ARB ) a l l o w i ng i t t o a l l o c a t e the d ev i c e , a s d e t e r m i ned by -the d e v i c e ' s own e r U I C ( U C B $ L_OWNU I C ) . Dev i c e De a l l o c a t i o n A p r o c e s s m a y c h o o s e t o d e a l l o c a t e a s i ng l e d ev i c e , or all d ev i c e s a l l o c a t ed to it. Fo r e a c h d ev i c e tha t is t o be d e a l l o c a ted , E XE $ DA L LOC f i nd s i t s UC B a d d r e s s e i th e r d i re c t l y , f r om the DEVNAM a r g um e n t i n the $ DAL LOC c a l l , o r by e x am i n i ng e a c h UCB i n the s y s tem . E a c h UCB i n the s ys t e m c a n be fo und by f o l l o w i ng a l i n k ed l i st of Dev i c e Da t a Bl o c k s ( D DB s ) , t h a t n am e e a c h d ev i c e c o n t r o l l e r i n the s y s t em ( t h e f i r s t DDB i s po i n t ed t o by g l oba l s ymbo l I OC $G L DEVL I S T ) . E a c h DDB c o n ta i n s a po i n t e r to t h e f i r s t d ev i c e UCB on t h e con t r o l l e r , a nd a l l o f t h e UCBs fo r the d ev i c e s o n a g i v e n c o n t r o l l e r a re l i n ked t o g e th e r . A d ev i c e i s d eal l o c a ted i f 1. t h e UC B $ L P I D f i e l d ma t c h e s p r o c e s s i s s u i ng t h e $ DA L L OC , 2. t h e a c c e s s m o d e a t wh i c h t h e d e a l l o c a t e r e q u e s t i s b e i ng mad e is at l e a s t a s p r i v i l eg ed a s the a c c e s s m o d e a t wh i c h t h e d ev i c e wa s a l l o c a t ed , 3. t h e a l l o c a ted b i t ( D EV$V_A L L i n UC B $ L D EVC HAR ) 4. t h e r e f e r e nc e c o un t ( UC B $W_R E FC ) 1 6-5 the PC B $ L P I D e q ua l s 1 . f i eld of i s s e t , a nd the I /0 S YS TEM S ERVI C E S Th e d ev i c e i s d e a l l o c a t e d b y 1. c l e a r i ng the UC B $ L_D E VC HAR ) , bit ( D EV$V_A L L 2. c l e a r i ng t h e d ev i c e o wn e r p r oc e s s i d f i e l d ( UC B $ L_P I D ) , 3. d e c r emen t i ng t h e d e v i c e r e f e r e n c e c o un t 4. c a l l i ng t h e d e v i c e d r i v e r ' s c a nc e l I /0 r o u t i n e , a nd 5. r e t u r n i ng t h e n o r m a l s uc c e s s f u l c om p l e t i o n c o d e t o i n R O ( S S $ _N ORMAL ) . d ev i c e a l l o c a t ed in ( UC B $W_R E FC ) , the use r $ Q I O SYSTEM S ERVI C E 16. 3 Th e $ Q I O s ys t em s e rv i c e ( i n S YS Q I O RE Q ) p r o v i d e s t h e c a pa b i l i t y f o r a u s e r to i n i t i a t e a n I /0 o pe r a t i on by q ue u i ng a r e que s t to t h e d ev i c e ' s On c e t h e I /0 o pe r a t i on h a s b e en i n i t i a t e d , c o n t r o l a s s o c i a t ed d r i v e r . wi l l be r e t u r ned t o t h e u s e r , wh o c a n s yn c h r o n i z e I /0 c om p l e t i o n i n o ne o f th r e e wa ys . • • • Th e p r o c e s s c a n e n t e r an e v e n t f l ag wa i t s t a t e un t i l the I /O r e q u e s t c o mpl e t e s , wa i t i ng f o r t h e s pe c i f i ed e v e n t f l ag to b e set . Th e add r e s s o f a n AST r o u t i n e tha t w i l l be e x e c u t e d wh en the I /0 c ompl e t e s c a n b e p a s s e d to $QI O . I n th i s c a s e , t h e p r o c e s s c a n c o n t i n u e e x e c u t i ng or wa i t , d e pend i ng on the pa r t i c ul a r m e thod of s yn c h r o n i za t i o n . Th e I /0 s t a t u s b l o c k c a n b e po l l ed f o r a c ompl e t i o n sta tus . Th e s ta tus f i eld i n t h e I O S B i s c l e a r ed by $ Q I O a nd s e t by the s p e c i a l k e r n e l AST t h a t c ompl e te s an I /O r e q ue s t in process contex t . wh i c h is A l te r na t i ve l y , the $ Q I OW s ys t em s e rv i c e may b e u s ed , e qu i v a l en t to the $ Q I O s ys t em s e rv i c e fo l l o wed by a $WA I TFR s y s tem s e rv i c e g ua r a n t e e s tha t the I /O s e rv i c e . Us i ng t h e $ Q I OW s ys t em control i s t r a n s f e r r ed b a c k to the o pe r a t i o n w i l l c ompl e t e b e fo r e us e r . 16. 3. 1 Dev i c e - I nd e pend ent P r e p r o c e s s i ng E XE $ Q I O b eg i n s p r e p r o c e s s i ng an I /O r e q ue s t b y 1. v a l i d a t i ng th e d ev i c e- i nd epend e n t $ Q I O p a r ame t e r s ( ev e n t f l ag n um b e r , channel n umb e r , I /0 f un c t i o n co d e , a nd I /0 s t a tus block) , 2. c h e c k i ng f o r n o n z e r o AS TCNT q uo t a i f an AST a d d r e s s i s pr esen t , 3. c l e a r i ng t h e s pe c i f i ed e v e n t f l ag no e v e n t f l ag wa s s p e c i f i ed ) , 1 6-6 a rg um e n t ( o r e v e n t f l ag n um b e r 0 if I /0 SYS TEM S ERVI C E S 4. c l e a r i ng t h e I /O s t a t u s b l o c k ( i f o n e wa s s pe c i f i ed ) , a nd 5. v e r i f y i ng th a t t h e d ev i c e UC B $W S TS m u s t b e s e t ) is on l i ne ( UC B $V_ON L I N E in • An I /0 r e que s t pac k e t ( I R P ) i s a l l o c a ted f r om n o npag ed po o l . If po s s i b l e , th i s a l lo c a t i on i s d o ne f r om a q u e u e o f p r e a l l o c a ted I R Ps ( po i n t ed to b y I OC $G L I RPF L ) . Othe rwi se , r o u t i ne EXE $A L LOC I R P i n M EM ORYA LC i s c a l l e d to a l l o c a t e a n I R P f r om t h e g en e r a l nonpag ed po o l a r ea . Ob t a i n i ng a n I R P f r om t h e p r e a l l o c a t ed q u e u e takes l ess t ime t h a n c a l l i ng t h e a l l o c a t i o n r o u t i n e . Th e d ev i c e- i nd e p e nd e n t s e c t i o n o f t h e I RP the fo l l o w i ng f i e l d s : is i n i t i a l i ze d , • t h e d ev i c e- i nd ep e nd e n t $ Q I O pa r am e t e r s • t h e p r o c e s s b a s e p r i o r i t y ( f r om PC B $ B_P R I B ) • t h e p r o c e s s I D ( f r om PC B $ L_P I D ) • t h e d e v i c e UC B a d d r e s s • f l ag in t h e I RP $V B UF I O b u f f e r ed - I /0 o pe r a t i o n , o pe r a t i o n ) is I RP $W S T S ( wh i c h a a nd -c l e a r e d for i n c l ud i ng a fo r set d i rect I /0 Th e p r o c e s s ' s p r i v i l eg e s a r e c h e c k e d to g ua r a n t e e t h a t i t m a y pe r f o rm the r e q ue s t e d I /0 f unc t i o n . In the c o u r s e o f c h e c k i ng p r o c e s s p r i v i l eg e s , a r ea d o r wr i te v i r t ua l I /0 r e que s t f unc t i o n c o d e is c o nv e r t e d i n to t h e c o r r e s po nd i ng r e ad o r wr i t e l og i c a l f un c t i o n cod e ( un l e s s t h e v i r t ua l r e que s t i s f o r a f i l e -o r i e n t ed d ev i c e , DEV$V FOD i n UC B $ L_D EVC HAR i s s e t ) - • I f a n A S T wa s r eq u e s t ed , t h e A S T q uo t a ( PC B $W ASTCN T ) i s d e c r em e n ted , a nd t h e AST q uo t a upd a te f l ag ( AC B $V_Q U OTA ) is s e t i n I R P $ B_RMOD . C o n t r o l i s t h e n t r a n s f e r r ed to a f un c t i o n d ec i s i o n t a b l e ( FDT ) r o u t i n e ( by a J S B ) i n the s e l e c t e d d ev i c e d r i v e r . Th i s r o u t i n e i s r e s p o n s i b l e f o r i n t e r p r e t i ng t h e d ev i c e-d e pe nd e n t $ Q I O pa r am e t e r s ( P l t o P 6 ) . If the FDT r o u t i ne returns control to E XE $ Q I O ( by i s s u i ng a n R S B ) , E XE $ Q I O c a l l s a n o th e r FDT r o u t i ne i n the d r ive r ( a nd r e pe a t s th i s p r o c e s s un t i l s ome FDT r o u t i ne ex i t s u s i ng a me thod o th e r th a n RSB ) . 16. 3 . 2 FDT Ro u t i n e s Func t i o n d ec i s i o n t a b l e ( FDT ) r o u t i n e s a r e d ev i c e - sp e c i f i c ex tens i on s to $QIO . Th e i r p r i m a r y p u r po s e i s t o v a l i d a t e t h e d ev i c e - d epend en t $ Q I O pa r am e t e r s ( P l t o P 6 ) . A d ev i c e d r i v e r c a n i nc l ud e c us tom i z e d FDT r o ut i ne s o r u s e some o f t h e g e n e r a l p u r po s e r o u t i n e s t h a t a r e a p a r t o f the s ys t em i m ag e . A l t h o ug h s ome FDT r o u t i n e s a r e i n c l ud ed in a d r i v e r i m ag e , t h e y a r e l og i c a l l y a d ev i c e -d epend e n t ex t e n s i o n o f t h e $ Q I O s y s tem s e rv i c e . FDT r o u t i n e s e x e c u t e i n t h e c o n t e x t o f t h e p r o c e s s th a t i s s ue d the $ Q I O r e que s t . Th e r e f o r e , t h ey h av e a c c e s s to d a t a i n the u s e r ' s P O a nd P l a d d r e s s s pa c e . FDT r o u t i n e s c ommun i c a t e i n f o r ma t i o n abo ut the I /O r e que s t to the d r iver by pa s s i ng i n fo rm a t i o n in th e d ev i c e - d epend e n t s ec t i o n o f t h e I R P . 1 6-7 I /0 SYSTEM SERVI C E S FDT r o u t i n e s f o r d i r e c t I /0 ( I /0 d o n e d i r e c t l y t o a use r buf fe r ) insure tha t e a c h b u f f e r pag e i s v a l i d a nd l o c k e d i n to m emo r y . ( Th i s i s d o ne b y i n c reme n t i ng t h e r e f e r e n c e c o un t i n t h e PFN d a t a b a s e fo r e a c h phys i c a l pag e i nv o l v ed in the t r an s fe r . ) FDT r o u t i ne s fo r b u f f e r ed I /0 o p e r a t i o n s m u s t a l l o c a t e a b u f f e r f r om n o n pa g ed po o l th a t wi l l b e u s ed b y t h e d r i v e r f o r t h e a c t ua l t r an s f e r . I f t h e o pe r a t i o n wr i t te n 1s c o p i ed i nto i s a b u f f e r ed wr i t e , t h e d a t a t h a t i s b e i ng th i s buf f e r . Sys t em s p a c e b u f f e r s a r e r e q u i r ed b e c a u s e the d r i v e r p r o c e s s e s t h e I /0 r e qu e s t i n s y s t em c o n tex t a nd only has access to s ys t em v i r t ua l a d d r e s s s pa c e . FDT r o u t i n e s a r e d e sc r i b ed i n d e t a i l i n the VAX/VM S G u i d e t o Wr i t i ng a De v i c e D r i v e r . 16. 3 . 3 I /O Po s t p ro c e s s i ng A f t e r a d ev i c e d r i v e r c om p l e t e s an I /0 o pe r a t i o n , it i nv o k e s the R E QC OM m a c r o . Th i s m a c r o p l a c e s t h e I R P o n t h e I /0 po s t p r o c e s s i ng q u e u e , a n d r e q ue s t s a so f twa r e i n t e r r upt a t I PL $ I O PO S T ( I PL 4 ) . Th e I / O po s t p r o c e s s i ng r o u t i ne ( I O C $ I O PO S T , i n lOC I O PO S T ) r un s a s a r e s po n s e to the so f twa r e i n t e r r upt . It i mpl em e n t s the d ev i c e - i n d e p e nd e n t facets of I /0 c ompl e t i o n , a nd h a nd l e s pag i ng I /0 c ompl e t i o n a s we l l ( s e e c h a p t e r 1 2 ) . Some o f t h e I /0 po s tp r o c e s s i ng o pe r a t i o n s ( fo r ex ampl e , s e t t i ng event f l ag s , un l o c k i ng b u f f e r pag e s , a nd d e a l l o c a t i ng b u f f e r s ) a r e pe r fo rmed in t h e I /0 p o s t p r o c e s s i ng i n te r r up t s e r v i c e r o u t i ne ( I OC $ I OPOS T ) , wh i l e o th e r o pe r a t i o n s ( s uc h a s wr i t i ng t h e I /0 s t a t u s b l oc k ) a r e pe r f o rmed b y a s pe c i a l k e r n e l A S T r o u t i n e ( wh i c h e x e c u t e s i n process c o n t e x t , a nd th e r e f o r e h a s a c c e s s t o p r o c e s s ad d r e s s s p a c e ) . Wh e n an I RP is r emoved f r om the I /0 po s tp r o c e s s i ng l i sthead I OC $G L P S F L ) , I OC $ I O PO S T f i r s t d e te r m i n e s o pe r a t i o n wa s a buf f e r ed o r d i r e c t r e q ue s t . q u e ue ( w i th if the I/O 16. 3. 3. 1 D i r ec t I / 0 Compl e t i o n P o r t i o n s o f d i r e c t I /0 r e que s t c a n b e c ompl e ted i n the I P L 4 I /0 p o s t p r o c e s s i ng i n t e r r up t s e r v i c e r o u t i n e w i tho u t t h e b e ne f i t o f p r o c e s s c o n t e x t . - 1. Th e p r o c e s s d i r e c t I /0 c o un t i n t h e so f twa r e PC B ( at o ffset PC B $W D I OCNT ) i s i n c r em e n t e d , i nd i c a t i ng o n e l e s s o u ts t a nd i ng d i r e ct I /0 r e qu e s t . 2. Th e b u f f e r po i n t ed to by I RP $ L S VA PT E i s un l o c k e d , u s i ng the I R P $ W B CNT a nd I R P$W B OF F f i e lds to d e t e rm i n e t h e s i z e o f t h e l o c k ed b u f f e r . B u f fe r pag e s a r e un l o c k e d by d e c r eme n t i ng t h e i r a s s o c i a t ed r e f e r e n c e c o un t s i n the PFN d a t a b a s e . Th i s s t e p m a y r e s u l t i n t h e i r b e i ng p l a c ed on the f r e e o r mod i f i ed pag e l i s t . 3. Th e I R P $V E XT E ND b i t i n I R P $W S T S i s c h e c ked . I f tha t b i t i s set , i t - i nd i c a t e s a n I R P ext e n s i o n ( I RPE ) i s po i n t ed to by I R P $ L E XTEND . Th e I R P E m a y c o nta i n up to two l o c k e d b u f f e r s ( po i n t ed t o by I R PE $ L S VA PT E l a n d I R PE $ L SVA PT E 2 , w i th s i z e s d e t e rm i ned b y I R P E $W BOF F l a nd I R PE $ L BCNTl , and I R PE $W B O F F 2 a nd I R PE $ L B CNT2 , res p e c t i v e l y ) . Thes e buf fe r s , i f p res e n t , a r e un l o c k ed , a nd a c h e c k i s mad e to s e e i f t h e I RPE $V E XT E ND bit in I R PE $W S TS is set . If s o , t h e s ame p r o c edu r e i s r e p e a ted , un t i l - t h e l a s t I RPE i n the l i n k e d l ist is f o und , a nd i t s b u f f e r s un l o c k e d . 1 6-8 I /0 SYSTEM S ERVI C E S 4. Th e e v e n t f l ag s pe c i f i ed i n t h e $ Q I O c a l l i s s e t ( by c a l l i ng r o ut i ne S C H $ P O S TE F , wh o s e o pe r a t i o n i s d i sc us s ed in Ch a p t e r 9 ) . 5. Th e d i r e c t I /0 s pe c i a l k e r ne l AST ( D I RPO S T i n I OC I O PO S T ) is q u e ued to t h e p r o c e s s ( u s i ng t h e I R P $ L P I D f i e l d to i d en t i f y t h e p r o c e s s to wh i c h the A S T s ho u l d be que ued ) . Th e I RP is u s ed as the AST c o n t r o l block fo r r o u t i n e S C H $ QA S T ( a s d e sc r i bed i n Ch a p te r 5 ) . Th e r ema i nd e r o f I /0 c om p l e t i o n f o r a d i r e c t I /0 r e q ue s t takes i n p r oc e s s c o n t e x t i n t h e s pe c i a l k e r n e l A S T c a l l ed D I R PO S T . place 1. Th e ac c um u l a t ed d i r e c t I /0 c o un t ( s to r ed i n PHD $ L D I OCNT ) is i n c r em e n ted . Th i s i s a n a c c o un t i ng s t a t i s tTc th a t is r e po r ted to t h e a c c o u n t i ng manag e r ( th e j o b c o n t r o l l e r ) wh e n t h e p r o c e s s i s d e l e t ed . 2. Th e I /0 i n p r o g r e s s c o un t e r ( C C B $ W_ I OC ) i s d e c r emen t e d . 3. I f th i s wa s t h e l a s t I /0 f o r the c h ann e l , a nd th e r e is a d e a c c e s s r e q ue s t fo r t h e c h a n n e l p e nd i ng ( C C B $ L D I RP d o e s n o t e q u a l z e r o ) , tha t d e a c c e s s r e que s t i s queued to - the AC P ( so th a t a f i l e c an be p r o p e r l y c l o s e d o r s ome s i m i l a r o pe r a t i o n pe r f o rme d ) , b y c a l l i ng r o u t i n e I OC $WAKAC P . 4. I f a n I /0 s t a t u s b l o c k wa s r e q u e s ted b y t h e user , it is wr i t t e n us i ng th e q ua d wo r d s t a r t i ng a t I R P $ L I O S T l ( s ame o f f s e t as I R P $ L_ME D I A ) . 5. I f a n y I R PEs we r e u s ed , t h e y a r e d e a l l o c a t e d . 6. I f t h e us e r r e q u e s t ed an A S T f o r t h e $ Q I O c a l l , the IRP i s ag a i n u s ed a s a n AST c o n t r o l b l o c k , a nd i s que ued to the u s e r ( th e I R P w i l l be d e a l l o c a t ed by t h e no rma l AST p r o c e s s i ng s c h eme , a s d i s c u s s e d i n Ch a p t e r 5 ) . 7. I f t h e u s e r d i d n o t r e que s t a n A S T t o be d e l i v e r ed upo n c o mpl e t i o n o f th e $ Q I O c a l l , t h e I R P i s d e a l l o c a t e d . in the channel control bloc k th e 1 6 . 3 . 3 . 2 B u f f e r ed I /O Comp l e t i o n - Th e po r t i o ns o f b u f f e r ed I/O c ompl e t i o n that take place in t h e I PL 4 i n te r r up t s e r v i c e r o u t i n e d i f f e r f r om t h e d i r e c t I /0 c a s e b e c a u s e o f t h e d i f f e r e n c e s i n t h e wa y t h e two k i nd s o f r eq u e s t s a r e p r o c e s s ed . 1. Th e p r o c e s s b u f f e r ed I /0 c o un t { PC B $W B I OCNT ) , t h e c o un t o u t s t a nd i ng b u f f e r ed I /0 o pe r a t i o n s , Ts i n c r em e n t e d . 2. Th e b y t e c o un t q uo t a th a t wa s a l l o c a t ed fo r the s ys tem b u f f e r i s g i v e n b a c k b y a d d i ng I R P $W_B O F F t o J I B $ L_B YTCNT . 3. I R P $W S T S I f t h e I /0 f u n c t i o n wa s a r e ad { b i t I R P$V F UNC in i s s e t ) , t h e B U F P O S T r o u t i n e { i n mod u l e I OC I O PO S T ) i s u s e d a s the spec i a l ke r nel AST r o u t i ne add r e s s . 4. Oth e r w i s e , D I RPOST i s u s ed a s the s pe c i a l k e r n e l AST r o u t i n e add r e s s , a n d t h e b u f f e r u s ed to h o l d the d a t a w r i t t e n to t h e d e v i c e , i f a n y , i s d e a l l o c a t ed ( th e b u f f e r ' s a d d r e s s i s f o un d i n I R P$ L_SVA PT E ) . 1 6-9 of I /0 SYSTEM S E RVI C E S 5. I n e i th e r c a s e , b e fo r e t h e s p e c i a l k e r n e l AST i s q u e u e d , the event f l ag s p e c i f i ed in the $ Q I O c a l l is set ( a s in the d i r e c t I /0 c a s e ) . Th e s pe c i a l k e r ne l A S T c a l l ed B U F P O S T i s u s ed fo r the case of a buf f e r ed r e ad o pe r a t i o n , because t h e d a t a m u s t b e c o p i ed f r om t h e s ys t em bu f f e r t o t h e b u f f e r s p e c i f i ed i n the o r i g i n a l $ Q I O r e q u e s t . 1. Af t e r t h e d a t a i s c o p i ed , t h e s ys t em b u f f e r n e ed ed s o i t i s d e a l l o c a t ed t o n o npag ed po o l . is 2. Th e a c c um u l a t ed b u f f e r ed I /0 c o un t a c c o un t i ng ( s t o r e d i n PHD$ L_B I OCNT) i s i n c r em e n ted . no l o ng e r s tat i st i c Th e r em a i n i ng s t eps tha t t h i s r o u t i n e m u s t p e r fo rm a r e i d en t i c a l to the o pe r a t i o n s p e r fo rm e d by D I RPOST . B UF PO ST c o n t i n u e s a t s t e p 2 i n tha t r o u t i n e . 16 . 4 I /0 CANC E LLAT I ON Th e $ C ANC E L s y s t em s e rv i c e c an c e l s a l l I /O i s s ue d to a d ev i c e f r om a s pe c i f i ed c h a nn e l by s c a n n i ng a l l o f t h e I RPs q u e u e d to th e d ev i c e UC B ( s t a r t i ng a t UC B $ L I O QF L ) . S e v e r a l c ond i t i o n s m u s t h o l d fo r an I /O r e q u e s t t o b e c ancel l ed . • • • Th e r e qu e s t c a n n o t b e a v i r tua l r e que s t ( i nd i c a t e d by t h e s e t t i ng o f t h e I RP $ V V I RTUA L b i t i n I RP $W S T S ) . I n g en e r a l , I /O c a nno t b e c a n c e l led on d i s k o r t a pe d evi c e s . Dr i ve r s fo r t h e s e d ev i c e s i n s u r e tha t t h e I RP $V V I RTUA L b i t i s s e t o n a l l r e q ue s t s t h a t c a nno t b e c a nc e l l ed . Th e r e q ue s t i ng p r o c e s s ID p r o c e s s I D i n I R P $ L _P I D . ( PC B $ L_P I D ) ma tche s the s to r ed Th e r e que s t e d c h a nn e l n umbe r i n the C HAN a rg um e n t t o m a t c h e s t h e s t o r ed c h a n n e l n umb e r i n I R P$W C HAN . $ C ANC E L Th e I /0 i s c a nc e l l ed by 1. c l e a r i ng the b u f f e r ed r e ad b i t ( I R P$V FUNC i n I R P $W S TS ) fo r b u f fe r ed I /0 f un c t i o n s ( i d e n t i fied by I R P $V-B UF I O in I R P $W_ S T S ) , 2. p l a c i ng t h e S S $ C ANC E L f unc t i o n c o d e i n the l o w o rd e r wo rd o f t h e I /0 s t a t us b l o c k , a nd 3. p l a c i ng the IRP in the I /O po s tp r o c e s s i ng q u e ue , and r e q ue s t i ng an I /O po s t pr o c e s s i ng s o f twa r e i n t e r r upt ( at I PL $ _I O POS T ) a f t e r t h e f i r s t I R P i s pl ac ed o n to the que u e . Th e d r i v e r c a nc e l I /0 r o u t i n e i s c a l l e d t o a l l o w t h e d r i v e r to pe r f o rm any d e s i r ed c l e a n up o pe r a t i o n s , a nd to c ancel the I /O r e que s t c u r r e n t l y i n p r og r e s s . I f t h e r e i s a n y o u t s t a nd i ng I /0 , o r AC P - c o n t r o l l ed f i l e a c t i v i ty i n p r og r e s s , E XE $ C ANC E L a l l o c a t e s a nd i n i t i a l i z e s a n I R P o n beha l f o f the u s e r ( a nd c h a rg e s t h e u s e r ' s b u f f e r ed I /O q uo t a , PCB $W B I OC NT , fo r an I/O r eque s t ) . Th e IRP i s que ued to t h e AC P f o r f urth e r p r o c e s s i ng ( us i ng r o u t i n e E XE $ Q I OAC P P KT in SYS Q I OR E Q ) . Th e I R P s pe c i f i e s a 1 6-1 0 I /0 SYSTEM S E RVI C E S f unc t i o n c od e of I O $ A C PC ONTRO L , i nd i c a t e I /0 c ompl e t i o n� 16. 5 a nd u s e s e v e n t f l ag n um b e r 3 1 t o MA I LBOX C R EAT I ON AND D E L ET I ON Ma i l bo x e s a r e v i r t ua l d ev i c e s used fo r i nterprocess c ommun i c a t i o n . Th e y a r e c r e a t ed by t h e $ C REMBX s ys t em s e rv i c e . The r e a r e two k i nd s o f m a i l bo x e s , t empo r a r y a nd p e rm a n en t . Tempo r a r y m a i l bo x e s a r e d e l e t ed a u toma t i c a l l y wh e n no m o r e p r o c e s s e s h a v e c h a n n e l s a s s i g n ed t o them , wh i l e pe rm a n e n t m a i l bo x e s m u s t b e e x p l i c i t l y m a r k e d fo r d e l e t e us i ng t h e $ D E LMBX s y s t em s e r v i c e . ( Af t e r b e i ng ma r k e d fo r d e l e t e , pe rm a n e n t m a i l bo x e s a r e d e l e t e d wh e n no mo r e pr o c e s s e s h a v e c h a nne l s a s s i g ned to th em ) • 16. 5. 1 Ma i l bo x C r e a t i o n Th e $ C R EMBX s ys t em s e rv i c e c r e a t e s a v i r t ua l ma i l bo x d e v i c e named MBn : a nd a s s i g n s a n I /0 c h a n n e l to i t . E XE $ C R EMBX beg i n s b y t r an s l a t i ng t h e l og i c a l n ame s p e c i f i ed by t h e user in the L OGNAM pa r a m e t e r ( i f a n y ) , a nd f i nd i ng a f r e e c h a n n e l ( CC B ) to a s s i g n to t h e m a i l bo x ( u s i ng I OC $ FFCHAN ) . I t a l so ver i f i e s tha t the u s e r h a s the a pp r o p r i a t e p r i v i l eg e ( s ) f o r the type o f m a i l bo x b e i ng c r e a t ed : PRMMBX TM PMBX S HM EM fo r a pe rmanen t m a i l bo x f o r a t empo r a r y m a i l bo x f o r a ma i l bo x i n sha r e d memo r y I f a l og i c a l n a m e h a s b e en s pe c i f i e d , E XE $ C REMBX s e a r c h e s a l l ex i s t i ng ma i l bo x UCBs to s e e i f a ma i l bo x wi th th a t n ame a l r e a d y ex i s t s . If a m a t c h i s fo und , t h e r e f e r e n c e c o un t f o r th a t ma i l bo x ( UC B $W_R E FC ) is i nc r emen ted , a nd a c h a n n e l i s a s s i g n ed by 1. p l a c i ng t h e ma i l bo x UCB a d d r e s s i n C CB $ L_U C B , 2. p l a c i ng th e a c c e s s mo d e a t wh i c h ( p l u s o n e ) i n C C B $ B_AMOD , the 3. r e t u r n i ng the pa r am e t e r , a nd to 4. r e t u r n i ng w i th a n S S $_N ORMAL c ompl e t i o n s ta t us c od e . channel n um be r c h a nn e l the user wa s a s s i g ned in the C HAN If a t empo r a r y m a i l box i s b e i ng c r e a t ed ( th e m a i l bo x d i d no t p r ev i o u s l y ex i st ) , the process b u f f e r ed I /0 b y t e c o un t quo t a ( J I B $ L B YTCNT ) i s c h ec ked to d e te rm i n e i f the p r o c e s s h a s e n o ug h quo t a to s uppo r t the c rea t i on of a m a i l bo x UCB , to buf f e r mes sag e s ( a c c o r d i ng t o the v a l u e s pe c i f i e d i n t h e BUF QUO pa r am e t e r t o $ CREMB X ) , a nd to a l l o w f o r o v e r h e a d ( 2 5 6 byt e s ) i n c a s e o f p r o c e s s d e l e t i o n . If the BUFQU O pa r am e t e r i s not s pe c i f i ed , the SYSB OOT p a r a me t e r DE FMBXB UFQUO ( s t o r ed at I OC $GW MBXB FQ U O ) i s u s ed f o r the amo u n t o f s pa c e r e s e rved t o b u f f e r m e s sa g e s� A l o g i c a l name b l o c k i s a l l o c a t ed , i f r e q u i r ed , wh i c h wi l l c o n t a i n t h e l og i c a l n ame s pe c i f i ed fo r the m a i l bo x by t h e u s e r i n t h e $ C REMBX cal l . 1 6-1 1 I/0 SYSTEM SERVI C ES Ro u t i ne I OC $C REATE UCB ( i n I O S UB PAGD ) i s c a l l ed to a c t ua l l y c r e a t e t h e m a i l bo x UC B . The r o u t i n e a l l o c a t e s s pa c e f o r the UC B f r om n o npag ed po o l , a nd i n i t i a l i z e s f i e l d s i n the UC B ( u s i ng a templ a te UCB f o und th r o ug h M B $ U C B O i n DEV I C EDA T ) . 1. Th e ma i l b o x i s m a r k e d on l i n e UC B $W_S T S ) . 2. Th e r e f e r e n c e c o un t ( UC B $W_R E F C ) 3. Th e U I C o f t h e c r e a t i ng p r o c e s s ( PC B $ L U I C ) i s e s ta b l i shed a s t h e own e r o f t h e m a i l bo x ( by l o ad i ng UCB $ L_OWNU I C ) . 4. Th e UC B i s i d en t i f i ed a s b e i ng a s h a r e a b l e m a i l bo x DEV$V_S HR a n d DEV$V_MBX b i t s a r e se t i n UCB $ L_D E VC HAR ) . ( th e 5. Th e UC B i s l i n k e d i n to th e m a i l b o x c o n t r o l l e r ' s ( v i a UC B $ L_L I N K ) . l ist 6. A u n i t n um b e r i s a s s i g n ed to the UC B ( in UC B $W UN I T ) . Th e n um b e r i s i n t h e r ang e o f 1 t o 6 5 5 3 5 ; wh e n a l l -un i t n um b e r s i n t h e r a ng e h a v e b e e n u s ed , t h e un i t n umb e r s s ta r t ag a i n a t 1. 7. Th e m a i l bo x i nc r em e n t e d . control ler ' s ( th e UCB $V O N L I N E b i t i n s e t i n i s s e t to 1 . d ev i c e c o un t d ev i c e is ( C R B $W_REFC ) Af t e r I OC $ C R EATE UCB r e t u r n s c o n t r o l , E XE $ C REMBX 1. p l a c e s t h e b u f f e r q uo t a c a l c u l a t ed e a r l i e r i n UC B $W_B UFQUO , 2. p l a c e s t h e p r o t e c t i o n m a s k s pe c i f i ed PROM SK pa r am e t e r i n UC B $W_VPROT , 3. c l e a r s t h e d e v i c e own e r p r o c e s s I D f i e l d 4. 5. the user in the ( UC B $ L P I D) I p l a c e s t h e b u f f e r quo t a p l us UCB s i z e i n UC B $W_C HARG E , a n d p l a c e s t h e m a x i m um me s s ag e s i z e s pe c i f i ed b y t h e u s e r i n t h e MAXM SG pa r ame t e r in UC B $W D EVB UF S I Z . ( If MAXM SG wa s no t s p e c i f i ed , t h e S Y S B OOT param e t e r DEFMBXM XM S G , s to r ed at I OC $GW_MBXM XM SG , i s u s ed ) . I f the m a i l bo x is a UC B $W DEVS T S i s set . t empora r y ma i lbox . e by p e rm a n e n t m a i l bo x , t h e UC B $V P RMMBX b i t in Th r e e o th e r s t eps a r e t a k e n i f th e m a i l bo x i s a Th e UC B$V D E LMBX b i t i n UC B $W DEVS T S is set to m a r k the I t w i l l be d e l e t ed wh e n th e l a s t c h a n n e l ma i l bo x for d e l e te . a s s i g n ed t o i t i s d e a s s i g n ed . • Th e pr o c e s s byt e c o un t l i m i t ( J I B $ L_BYTLM ) i s r e d uc ed . • Th e pr o c e s s by t e c o un t quo ta i s r ed uc ed . ( J I B $ L_B YTCNT ) I f a l og i c a l name wa s spec i f i e d f o r the m a i l bo x , a l og i c a l name is c r e a t ed us i ng the l og i c a l name b l o c k a l l o c a t e d ea r l i e r . Th e I f no a s s o c i a t i o n w i th the l og i c a l n ame i s mad e th r o ug h UC B $ L L OGADR . l og i c a l n am e wa s s pec i f i ed , UC B $ L L OGADR i s c l e a red . Fi nal l y , a the m a i l bo x c h a n n e l i s a s s i g n ed to the m a i l bo x i n-t h e s am e wa y a s i f had a l r e a d y e x i s t ed . Th e r e l a t i o n s h i ps among t h e d a t a s t r uc t u r e s a s s o c i a t ed w i th m a i l bo x c r e a t i o n a r e p i c t u r ed i n F i g u r e 1 6 - 1 . 1 6-1 2 I /0 SYSTEM SERVICES Process Z (P1) address space - CCB for Process Z - -- I -- - for Process A CCB Process A (P1) address space I I I I I Static Executive Data Paged Pool Mailbox unit control block 0 (optional) Logical name block Template for other units _MBn: System virtual address space ... - ... - Mailbox message queue � - - - - - ------ -- First message �� Mailbox unit control block n ,, Second message • Nonpaged pool Figure 1 6-1 16.5.2 • D a t a S t r uc t u r e s As s o c i a t e d w i t h Ma i l bo x C r e a t i o n Ma i l bo x C r e a t i o n i n S h a r ed Memo r y No t e tha t a l tho ug h t h e f o rm a t o f a s h a r ed memo r y ma i l bo x UCB is s omewh a t d i f f e r e n t f r om a l o c a l memo r y UC B , t h e g e ne r a l s teps i nv o l v ed i n the c r e a t i o n o f t h e m a i l bo x a r e t h e s ame . Al l of the l og i c is c o n t a i ned w i th i n t h e s a m e m od u l e ( S YSMA I LB X ) . One ex t r a l ev e l o f d a ta s t r uc t u r e i s r eq u i r ed to d e s c r i b e a s h a r ed memo r y m a i l bo x . Th i s s t r uc t u r e , c a l l ed a s h a r ed m emo r y ma i l bo x c on t r o l b l o c k ( F i g u r e 1 6 - 2 ) , i s l o c a ted i n t h e s h a r ed memo r y . Th e UCBs o n e ac h po r t a s s o c i a t ed w i th the sha r ed m emo r y m a i lbox c o n t a i n t h e ( po r t- s p e c i f i c ) v i r tua l a d d r e s s o f t h e MB X . Th e r e a r e th r e e c a s e s t h a t t h e C r e a t e M a i l bo x s ys t em s e r v i c e c a n enc o un t e r wh e n c r e a t i ng a m a i l bo x i n s h a r ed m emo r y . • I f t h e s h a r ed memo r y m a i l bo x c o n t r o l b l o c k ( F i g u r e 1 6 - 2 ) d o e s no t ex i s t ( th i s i s t h e i n i t i a l c r e a t i o n o f t h e ma i l bo x ) , i t i s c r ea t e d f i r s t . Th e n , t h e u n i t c o n t r o l block in local m em o r y i s c r e a ted . A l og i c a l n ame b l o c k i s a l l o c a ted b e c a u s e 1 6-1 3 I /0 SYSTEM S E RVI C ES s h a r ed memo ry s t r uc t u r e s a l wa ys h av e a n a m e a s so c i a t e d w i th t h em . Fi n a l l y , a channel i s a ss i g ned fo r the c r e a t i ng process . • • I f the m a i l bo x i s b e i ng c r e a t e d o n th i s po r t fo r the f i rst t ime , a UC B is a l l o c a ted a nd l o ad ed w i th pa r am e te r s tha t d e s c r i be t h e ma i l bo x . A b i t is set i n a m a i l bo x - d e p e nd e n t f i e l d i nd i c a t i ng t h a t t h i s m a i l bo x UC B d e sc r i be s a m a i l bo x i n s h a r ed memo r y . F i n a l l y , the add r es s o f the sh a r ed m emo r y m a i l bo x c o n t r o l b l o c k i s l o ad ed i n to t h e UC B . I f the ma i l bo x a l r e a d y e x i s t s o n th i s po r t , the Create Ma i l bo x s y s t em s e rv i c e s i mpl y a s s i g n s a c h a n n e l t o i t . Message queue llsthead - - - - - - - - - - - - - - - - - - - - - - - · (Self relative queue) Creator port Unit number Flags Waiting reader Reference flags Waiting write AST Waiting read AST Current message count Maximum message size Protection mask Buffer quota Owner UIC Count Mailbox name (up to 15 characters) (counted ASCII string) Figure 16-2 Co n te n t s o f a S h a r ed Memo ry Ma i l bo x Co n t r o l Bl o c k Th e d a t a s t r uc t u r e s r eq u i r e d t o d e sc r i b e a sh a r ed m emo r y p i c t ur ed i n F i g u r e 1 6 - 3 . 1 6- 1 4 m a i l bo x are Processor 1 Local Memory Processor 2 Local Memory Shared Memory (Creator Port) Logical name block Second Logical name message block (Implicit pointer) (Implicit pointer) First SHMEM:MBn message SHMEM : MBm CCB for Process X Message queue .... m I .... U1 - .... 1 ' I 0 til t< til � 1:1:1 3: I CCB for Process A Shared memory Mailbox unit control block CCB for Process B for Unit n Figure 16-3 mailbox control block I I I I til tzl " < Mailbox unit control .... (") block 1:1:1 til - CCB for Process Z for Unit m D a t a S t r uc t ur e s As s o c i a ted wi th Sha r ed Memo r y Ma i l box C r e a t i o n I /0 SYSTEM S ERVI C E S Ma i l box D e l e t i o n 16. 5. 3 Th e $ D E LMBX s ys t em s e r v i c e i s u s e d t o ma r k a pe rma n e n t ma i l bo x for d e l e t i on . Th e m a i l bo x is a c t ua l l y d e l e te d b y I OC $D E LMBX ( in I O S UB N PAG ) wh e n i t s r e f e r e nc e c o un t ( UC B $W R E F C ) g o e s to ze r o ( a fter t h e l a s t c ha n n e l a s s i g n ed t o i t h a s b e en-d e a s s i g n ed , a s d e s c r i b ed i n s ec t i o n 1 6 . 1 . 2 ) . Th e ma i l bo x to b e m a r k e d f o r d e l e t e i s i d en t i f i ed by t h e C HAN a rg um e n t in the $ D E LMBX c a l l . Th e c ha n n e l n um b e r i s u s e d to l oc a t e the CCB , f r om wh i c h t h e m a i l bo x UCB a d d r e s s c a n b e f o und ( i n CCB $ L_UCB ) . E XE $DE LM B X v e r i f i e s t h a t 1. t h e UC B i s f o r a m a i l b o x U C B $ L_D E VC HAR ) , ( th a t t h e DEV$V_MBX b i t 2. t h e ma i l bo x i s a pe rma n e n t ma i l bo x i s s e t i n UC B $W_DEVS TS ) , a n d 3. t h e pr o c e s s h a s PRMMBX p r i v i l eg e . is set in ( th a t the UCB $V P RMMB X b i t I f the a b o v e c o nd i t i o n s a r e m e t , t h e m a i l bo x i s m a r k e d f o r s e t t i ng t h e UC B $V_D E LM B X b i t i n UC B $W_D EVS T S . d el e t e by I OC $D E LM B X a c t u a l l y d e l e t e s a m a i l bo x b y 1. v e r i fy i ng that t h e d ev i c e t o b e d e l e te d is a ma i l bo x ( D EV$V M B X i s s e t i n U C B $ L D EVC HAR ) , tha t t h e r e f e r e n c e c o un t ( UC B $W-R E FC ) i s z e r o , a nd th a t t h e m a i l bo x h a s b e e n m a r k e d f o r d ele t e ( UC B $V_D E LM B X i s s e t i n UC B $W_DEVS T S ) , 2. r e l i n k i ng t h e o th e r m a i l bo x UC Bs fo r th i s ma i l bo x contro l l er c o n t r o l l e r a r e l i n k e d t og e th e r ) , 3. d e c r em e n t i ng the ( C RB $W_R E FC ) , 4. r emov i ng t h e l og i c a l n am e fo r the m a i l bo x ( i f a n y s pe c i f i e d , via a no n z e r o v a l u e i n UC B $ L_LOGADR ) f r om the l og i c a l name t a b l e , a nd 5. d e a l l o c a t i ng t h e l og i c a l name b l o c k u s e d f o r the ma i l bo x . controller ' s UC B $ L L I N K ( v i a the t h e -UC B s ( because d ev i c e r e f e r enc e f i eld) fo r a c o un t If t h e m a i l bo x wa s a t empo r a r y ma i l bo x ( UC B $V PRMMBX c l e a r in UC B $W D EVS T S ) , th e b y t e c o un t l i m i t ( J I B $ L BYTLM ) and the b y t e c o un t quo t a- ( J I B $ L BYTCNT ) a r e upd a t e d ( b e c a u s e the c r e a t i o n o f a tempo r a r y ma i l bo x r eq uir ed tho s e r e s o u r c e s ) . An y un p r o c e s s ed m e s s ag e s th a t we r e q u e u e d t o t h e m a i l bo x ( a nd a r e s t i l l s to r ed i n no npag ed poo l ) are d eal l o c a ted ( by c a l l i ng E XE $ D EANON PAG E D i n MEMORYA LC ) . Th e UCB fo r t h e ma i l bo x i s d e a l l o c a t ed ( by c a l l i ng E XE $D EANON PAG E D ) . 16. 6 BROADCAST S Y S TEM S E RV I C E Th e $ B RDC S T s y s tem se rv i c e ( E XE $ B RDC S T i n S Y S BRDC S T ) a l l o ws m e s s ag e s to be s en t to one o r m o r e t e rm i n a l s ( e v e n i f a n I /0 o pe r a t i o n i s c u r r e n t l y i n p r og r e s s o n t h e t e rm i n a l ) . 1 6-1 6 I /0 SYSTEM S ERV I C E S A f t e r c h e c k i ng t h e b u f f e r q uo t a ( to m a k e s u r e e n o ug h q uo t a is a v a i l a b l e t o b u f f e r t h e m e s s ag e ) , a b r o ad c a s t d e sc r i pt o r b l o c k ( BRD ) i s a l l o c a t e d a nd i n i t i a l i z e d . ( S e e F i g u r e 1 6 -4 f o r the f o rm a t o f a BRD . ) BRD$L_FLINK Broadcast queue forward link BRD$L_BLINK Broadcast queue backward link BRD$W_SIZE BRD$B_TYPE BRD$L_PCB C>< BRD$L_PID Type Size Requesting process PCB Requesting process PID BRD$W_REFC BRD$W_MSGLENGTH Message length BRD$L_DATA N umber of terminals Broadcast Message F i g u r e 1 6-4 L a yo u t o f a B r o ad c a s t Desc r i pto r B l o c k I f t h e m e s s a g e i s to b e s e n t to a s i ng l e t e r m i n a l , t h e n EXE $ B RDC S T 1. l o c a t e s t h e UC B a d d r e s s f o r t h e t e r m i n a l ( spec i f i ed DEVNAM pa r am e t e r ) b y c a l l i ng I OC $ S EARCHDE V , 2. v e r i f i e s th a t t h e pr o c e s s e i th e r o wn s t h e t e rm i n a l e q u a l s PC B $ L_P I D ) , o r h a s O P E R p r i v i l eg e , 3. in terminal ( D EV$V TRM s e t v e r i f i e s th a t t h e UC B i s f o r a Ts the on l i ne t e rm i na l UC B $ L D EVC HAR ) , and th a t ( UC B $V_ON L I N E i n UCB $W_S T S ) , 4. p l a c e s t h e BRD i n a q u e ue o f B ROs t o be b r o a d c a s t , a n d 5. sta rts a broadca s t . I f the m e s sa g e i s t o b e sent t o a l l t e rm i n a l s , p e r fo rm s s t e ps 3 t o 5 above f o r e a c h t e rm i n a l UCB . then by the ( UC B $ L_P I D EXE $ B RDC S T S t a r t i ng a b r o ad c a s t i nvo l v e s s ev e r a l s t eps . 1. A wr i t e b u f f e r pa c k e t th a t po i n t s to the B RD ( F i g u r e 1 6 - 5 ) a l l o c a t ed a nd i n i t i a l i z ed . is 2. Th e wr i t e b u f f e r p a c k e t i s p a s s e d to the te rm i n a l d r iver ' s a l te rnate start I /0 e n t r y po i n t ( by c a l l i ng r o u t i ne EXE $ALTQUE PKT i n SYS Q I ORE Q ) . Th i s r o u t i n e a c t i v a t e s the d r i ve r r eg a r d l e s s o f wh e th e r or n o t a n I /0 r e q u e s t i s i n p r o g r e s s f o r t h e d ev i c e . 1 6- 1 7 I /0 S Y S TEM S E RVI C ES 3. Th e te rm i n a l d r i v e r then a c c e p t s the b r o a d c a s t m e s sag e , or i nd i c a t e s t h a t t h e m e s s a g e c a n n o t b e b r o a d c a s t ( be c a u s e , f o r e x ampl e , th e u s e r i s s u ed a S E T T E RM I NA L /N O B ROADCAST c ommand ) . 4. I f the m e s s ag e i s n o t a c c e p t e d b u f f e r pa c k e t i s d e a l l o c a t ed . 5. I f t h e m e s s ag e i s a c c e p t ed by the d r i v e r , r e f e r e n c e c o un t i s i n c r emen ted ( B RD $W_R E FC ) . by the TTY$LWB_FLIN K Forward Link TTY$LWB_BLINK Backward Link TTY$W_WB_SIZE TTY$B_WB_TYPE TTY$B_WB_FIPL FIPL the the wr i t e b r o ad c a s t SIZE OF BLOCK TYPE TTY$LWB_NEXT Address of start of data TTY$LWB_END Address of end of data TTY$LWB_IRP 0 Figure 1 6-5 d r iver , L a yo ut o f a Wr i t e Bu f f e r Pa c k e t Wh i l e t h e d r i ve r i s w r i t i ng t h e m e s s a g e t o t h e s pe c i f i ed t e rm i n a l ( s ) , t h e p r o c e s s i s s u i ng t h e $ B RDC S T c a l l i s p l a c ed i n a n RSN$ B RKTHRU wa i t s ta t e . As s o o n a s B RD$W R E FC g o e s t o zero , i nd i c a t i ng -a l l o f t h e b r o a d c a s t m e s s a g e s h a ve b e e n s e n t to t h e s pe c i f i e d t e rm i n a l { s } , th e p r o c e s s i s r emoved f r om t h e wa i t s t a t e , t h e BRD i s d ea l l o c a ted , and the s ys t em s e rv i c e c ompl e te s . 16. 7 I NFORMAT I ONAL S ERVI C ES Appl i c a t i o n p r og r am s f r e q u e n t l y r e q u i r e i n fo rm a t i o n a bo u t pa r t i c u l a r d ev i c e s on the s ys t em . VM S a l l ows a use r t o o b ta i n s p e c i f i c i n f o rm a t i o n abo u t a pa r t i c u l a r d ev i c e u s i ng one o f sever a l system se rv i ce s ( $QIO, $G E TDEV , $ G ETCHN ) . Th e i n fo rma t i o n o b t a i n ed may b e e i th e r c ommo n t o a l l t h e d ev i c e s o n t h e s ys tem ( dev i c e i nd e pe n d e n t ) , o r s p e c i f i c to a pa r t i c u l a r d ev i c e t ype ( d ev i c e d e p e nd e n t ) . 16. 7. 1 Dev i c e - I nd epend e n t I n f o rma t i on Dev i c e - i nd epend e n t i n fo rm a t i o n r e f e r s to i n fo rm a t i o n th a t i s present fo r e a c h d ev i c e o n t h e s ys tem ( s uch a s t h e d ev i c e un i t n umbe r , d ev i c e c h a r a c t e r i s t i c s , a nd t h e d ev i c e t ype ) . It i s o b t a i n ed b y r e ad i ng f i e l d s i n t h e UCB t h a t h a v e t h e s ame i n t e r p r e t a t i o n fo r a l l d ev i c e s o n t h e s ys t em . 1 6-1 8 I /0 SYS TEM S E RVI C E S 1 6 . 7 . 1 . 1 G e t Ch a n n e l /Dev i c e I n f o rma t i o n - Two s ys t e m s e rv i c e s ( $ G E TDEV a nd $ G E TC HN , l o c a t ed i n S Y S G E TDEV) a r e p r o v i d ed to r e t u r n d ev i c e - i nd e pend e n t i n fo rm a t i o n a bo u t a d ev i c e in a u s e r - s uppl i ed b u f f e r ( s e e t h e VA X/VM S Sys t em S e r v i c e s Re f e r en c e Ma n ua l fo r a l i s t i ng o f the f i e l d s r e t u r n ed ) . Two s e t s o f i n f o rm a t i o n a r e o p t i o n a l l y r e t u r n ed , c a l l ed th e pr imary d ev i c e c h a r a c t e r i s t i c s a nd the s e c o nd a r y d ev i c e c h a r a c t e r i s t i c s . Th e s e two s e t s o f c h a r a c t e r i s t i c s a r e i d en t i c a l un l e s s o n e o f the fo l l o w i ng c o nd i t i o n s ho l d s . • • • Th e d ev i c e h a s a n a s s o c i a t ed m a i l bo x ( no n z e r o entry i n U C B $ L AM B ) , i n wh i c h c a s e t h e p r ima r y c h a r a c t e r i s t i c s a r e t h o s e-o f t h e d e v i c e , a n d the s e c o nd a r y c h a r a c t e r i s t i c s a r e t h o s e o f t h e a s s o c i a t ed ma i l bo x . Th e d e v i c e i s s po o l ed ( D EV$V S P L i s se t i n UC B $ L DEVC HAR ) , i n wh i c h c a s e the p r ima r y cha r a c t e r i s t i c s a re tho s e o f the i n t e rm e d i a te d e v i c e , and the s e c o nd a r y c h a r a c t e r i s t i c s a r e t h o s e o f t h e s po o l ed d e v i c e . I f t h e d e v i c e r e p r e s e n t s a l og i c a l l i n k in a n e t wo r k , the s e c o nd a r y c h a r a c t e r i s t i c s c o n t a i n i n f o rma t i o n a b o u t the l i n k . EXE $G E TDEV a nd E XE $G E TC HN d i f f e r o n l y i n h o w they i n i t i a l l y f i nd the d e s i r ed d ev i c e ' s UCB a d d r e s s . In the $ G E TC HN c a s e , the CCB $ L UCB f i e l d for t h e C C B i d e n t i f i ed by the C HAN a r g ume n t is used . I n -the $G ETDEV c a s e , r o u t i n e I OC $ S EARC HDEV i s c a l l ed to f i nd the UCB a d d r e s s f r om t h e DEVNAM a r g umen t . On c e the UCB add ress is f o und , the d ev i c e - i nd e pe nd e n t i n fo rm a t i o n i s c o p i ed f r om th e pr i m a r y UC B t o t h e user b u f fe r ( i f a p r ima ry buffer wa s s pe c i f i ed ) . Af t e r th a t , the d ev i c e - d e pe n d e n t i n fo rm a t i o n i s c o p i ed f r om t h e s e c o nd a r y U C B ( l o c a ted by UC B $ L AMB in the p r ima ry UC B , o r , i f th a t va l ue i s 0 , the pr i m ary UC B i s -a g a i n u s ed ) i n to the u s e r b u f f e r ( i f a s e c o nd a r y bu f f e r wa s s pe c i f i ed ) . 16. 7 . 2 Dev i c e -Depend e n t I n f o rm a t i o n Dev i c e - d epend e n t i n f o rm a t i o n r e f e r s to i n f o rma t i o n th a t i s p r e s e n t fo r a pa r t i c u l a r d ev i c e t ype on the s ys t em , b u t no t fo r e v e r y d ev i c e o n the sys tem . ( Fo r e x ampl e , a un i t c o n t r o l block for a c a rd r e ad e r i nd i c a t e s wh e t h e r t h a t c a r d r e a d e r i s t r a n s l a t i ng c a r d s a c c o rd i ng to the 0 2 6 k e ypunch c o d e o r the 0 2 9 k e yp unch c o d e . ) Dev i c e - d e p e nd e n t i n f o rm a t i o n c a n b e mad e a v a i l ab l e to a us e r process b y pl a c i ng th a t i n f o rm a t i o n i n to t h e h i g h o r d e r l o ng wo rd o f t h e I /0 s ta tus b l o c k fo r a $ Q I O r eque s t . Th e i n fo rma t i o n i s p l a c ed the r e by the d r i v e r ( by p l a c i ng that i n fo rm a t i o n in Rl be f o r e i s s u i ng th e REQC OM m a c r o to c ompl e t e t h e I /0 r e q u e s t ) , and c a n b e a n yth i ng the d r iver wr i t e r fee l s is a pp r o p r i a t e for a pa r t i c u l a r $ Q I O f unc t i o n c od e . Th a t i s , t h e i n f o rm a t i o n p l a c ed the r e c a n take on d i f f e rent me a n i ng s f o r d i f f e r e n t f un c t i o n c o d e s . O f t e n , d ev i c e d r i v e r s s uppo r t s p e c i a l f un c t i o n c o d e s t h a t o n l y r e t u r n d ev i c e - d e pe n d e n t i n fo rm a t i o n in t h e h i g h o r d e r l o ng wo rd o f t h e I /0 s t a t u s b l o c k , a nd tha t d o n o t i n i t i a te a ny d ev i c e ac t i v i ty . Th e f un c t i o n c od e s m o s t f r e q u e n t l y u s ed i n th i s wa y a r e I O $ S EN S EMODE a nd I O $ S E N S E C HAR . Fo r e x ampl e , t h e mag t a pe d r i v e r r e spo nd s to the I O $=S E N S EMODE $ Q I O by r e t u r n i ng t h e t a pe c h a r a c t e r i s t i c s in th e I /0 1 6-1 9 I /0 SYSTEM SERVICES s t a t u s b l oc k . Co r r e spo nd i ng I O $ S E TMODE a nd IO$ S ETC HAR f un c t i o n c o d e s a r e a l s o us ua l l y p r o v i d ed so -tha t the u s e r c an-c h a ng e t h e d ev i c e m o d e o r c h a r a c t e r i s t i c s i f t h e c u r r e n t o ne s a r e n o t a c c e p t ab l e . I n a d d i t i o n , the $ G E TC HN a nd $ G E TDEV s ys t em s e rv i c e s r eturn in the u s e r ' s b u f f e r a d ev i c e - d e p e n d e n t f i e l d ( UC B $ L DEVD E PEND ) , wh i c h can be used f o r d i f f e r e n t p u r po s e s by d i f fe r e n t d evic e s . Th e VAX/VMS I /0 U s e r ' s G u i d e c o n t a i n s c om p l e t e d e sc r i p t i o n s o f ho w t h e i n fo rm a t i o n i n t h a t f i e l d s h o u l d b e i n t e r p r e t ed fo r ev e r y s uppo r t e d d ev i c e t ype . Th a t m a n ua l a l so c o n t a i n s a d e ta i l ed e x p l a na t i o n o f wh a t i n f o rm a t i o n i s r e t u r ne d by t h e I O $ S EN S EMODE a nd I O $ S ENSECHAR $ Q I Os f o r each d ev i c e t h a t s uppo r t s t ho s e f un c t i o n c od e s . - 1 6- 2 0 PART V I PROC E S S C R EAT I ON AND DELET I ON f o r d u s t yo u a r e a nd unto d u s t yo u sh a l l r e t u r n . Genes i s 3 , 1 9 C HAPTER 1 7 PROC E S S C REAT I ON Th e c r e a t i o n o f a n e w p r o c e s s p i ec e s o f the e x ec ut i v e . • • • r equ i r e s the c o o pe r a t i o n C r e a t i o n b eg i n s i n the c o n t e x t o f an e x i s t i ng e x e c u t e s a C r e a t e Pr o c e s s sys tem s e rv i c e c a l l . of sev e r a l process th a t Th e i n i t i a l s c h e d u l i ng s t a t e of the new p r o c e s s is C OM O ( c ompu t a b l e b u t o u t s wa pped ) in a spec i a l swa p i m ag e i n S YS . EXE c a l l ed Sh e l l and s o f u r th e r e x e c u t i o n is s u pp r e s s ed u n t i l t h e Swa ppe r mo v e s the n ew p r o c e s s i n to the b a l a n c e se t . Th e f i n a l s t e ps o f p r o c e s s i n i t i a l i z a t i o n t a k e pl a c e in c o n t e x t of t h e new p r o c e s s in a r o u t i n e c a l l e d PROC S TRT . the Ta b l e 1 7 - 1 s umma r i z e s t h e p i e c e s o f p r o c e s s c r ea t i o n th a t take place i n t h e c o n t e x t o f e a c h o f the th r e e p r oc e s s e s th a t a r e i n v o l v ed . CREATE PROC E S S SYS TEM SERV I C E 17 . 1 Th e C r e a t e P r o c e s s s ys t em s e r v i c e e s t a b l i s h e s the pa r am e te r s o f the n ew p r o c e s s . S o m e o f t h e s e p a r a m e t e r s a r e pa s s e d to t h e se rv i c e by the c a l l e r . O t h e r s a r e t a k e n f r om the c o n t e x t of the c a l l e r ; f r om the PC B , the p r o c e s s h e a d e r , the j o b i n f o rma t i on b l o c k ( J I B ) , o r f r om the c o n t r o l r eg i o n ( F i g u r e 1 7 - 1 ) . Th o s e pa r am e t e r s th a t b e l o ng in the PC B o r the J I B o f the n ew p r o c e s s c a n b e p l a c ed th e r e by the C r e a t e P r o c e s s s ys tem s e rv i c e . Th o s e p a r a m e t e r s tha t b e l ong e i th e r in the proc ess h ead e r or in t h e c o n t r o l r eg i o n of the n e w p r o c e s s m u s t b e s to r ed i n a t em po r a r y s t r uc t u r e un t i l the new process c om e s i n to e x i s te n c e a nd has a v i r t ua l add r e s s s pa c e a nd p r o c e s s h e a d e r th a t c a n be accessed . Th e P r o c e s s Quo t a B l o c k ( P QB ) s e rves the pu r po s e o f th i s t empo r a r y d a t a s t r uc t u r e . I t s c o n t e n t s a r e l i s t ed i n Tab l e 1 7 - 2 . 17. 1 . 1 Co n t r o l F l o w o f C r e a t e P r o c e s s Th e C r e a t e P r o c e s s s ys tem s e r v i c e a l l o c a t e s a PCB , a JIB ( d e t a c h ed process c rea t i on onl y) , and a PQB a n d f i l l s t h e s e th r e e s t r uc t u r e s w i th t h e i mp l i c i t a nd e x p l i c i t pa r am e t e r s pa s s ed t o it. A l i st o f o pe r a t i o ns pe r f o rm ed by t h e s e r v i c e i s l i s t e d h e r e . 1. I f t h e U I C a r g um e n t i s p r e s e n t , t h i s i nd i c a t e s th a t the n e w process wi l l b e a d e t a c h ed p r o c e s s . Th e c r e a t o r m u s t h a v e D E TAC H p r i v i l eg e i n o rd e r f o r t h e s e r v i c e to s uc c e ed . 1 7- 1 PROC E S S CREAT I ON Tab l e 1 7 - 1 P a r t s o f Proc e s s Creat ion That Occur i n D i f f erent Proc e s s Contexts 1. 2. 3. Th e Cr e a t e Pr o c e s s s ys t em se rv i c e , e x ec u t i ng in o f the c r e a to r , pe r fo rms the fo l lowi ng s t e ps . the c ontext a. It m a k e s pr i v i l eg e and quo ta chec k s . b. I t l o ad s the PC B , po s s i b l y the JIB i f c r e a t i ng a d e tac hed pro c e s s , a nd the p r o c e s s quo ta b l oc k wi th expl i c i t SYS $CREPRC a rg uments a nd impl i c i t pa r am e te r s ta ken f r om the c o n tex t o f the c r e a to r . c. I t pl ac e s the n ew p r oc e s s i n to the sched ul e r ' s d a ta base . The fo l l owi ng s t e ps a r e swa ppe r p r o c e s s . pe r fo rm ed in the c o n t ex t of the a. The swa ppe r i nswa ps the templ a te pr o c e s s c o n tex t SHE LL , a po r t i o n o f the ex ec u t i v e i mag e SYS . EXE . f r om b. The process head e r i s b u i l t acco rd i ng to the SYSB OOT pa r amet e r s fo r th i s c o n f i g u r a t i o n . val ues of Th e fo l l owi ng s t eps a r e pe r fo rmed i n the c o ntex t o f the n ewl y c r ea ted process . a. The a rg uments f r om the PQB a r e moved to pl a c e s i n the p r o c e s s h e ad e r and P l s pa c e . the i r prope r b. Th e imag e a c t iva to r i s c a l l ed to ac t i v a te the imag e . c. Th e i mag e i s c a l l ed a t i t s e n t r y po i n t . 2. A PC B a nd PQB a r e a l l o c a ted f r om no npag ed po o l . 3. I f a d e t a c hed p r o c e s s i s b e i ng c re a ted , a J I B must be a l l o c a ted f r om n o npag ed poo l . Th e J I B po i n t e r ( PC B $ L J I B ) i n t h e n e w PC B po i n t s to t h e n ewl y a l l o c a t ed J I B and the i n fo rma t i o n fi elds ( all b u t the 12 b y t e s o f h e ad e r ) a r e c l e a r ed . I f a s ub p r o c e s s i s b e i ng c r e a t e d , t h e J I B po i n t e r i n the PC B po i n t s t o t h e J I B o f the c r e a to r ( wh i c h i s a c t ua l l y the J I B o f t h e m a s te r p r o c e s s o f t h e j o b . ) Th e r e l a t i o n sh i p b e t we e n t h e J I B a nd th e PC B s o f s ev e r a l p r o c e s s e s i n t h e s ame j o b i s p i c t u r ed i n F i g u r e 1 7 - 2 . The p r o c e s s c o un t f i e l d ( i n the JIB) is i n c r eme n t e d a nd c h e c ked to see th a t i t i s s t i l l w i th i n l i m i t s . No t e t h a t t h e PRCCNT f i e l d s w i th i n e ac h PC B ( PC B $W PRCCNT ) c o un t t h e n um b e r of s ubp r o c e s s e s c r e a t ed by th a t pro c e s s . Th e PRCCNT f i e l d w i t h i n the J I B ( J I B $W PRC CNT ) c o un ts t h e t o t a l n umb e r o f s ub p r o c e s s e s i n t h e j o b and mus t b e l e s s th a n o r e q ua l t o t h e c o n t e n t s o f J I B $W_PRC L I M . 17-2 PROC E S S CREAT I ON ( New JIB a lloc ated o nly if creating detached proc e s s ) Cre ator JIB ( Pooled Q u ot a s ) PCB New Process PCB $ C REPRC a rg u m e nts C o n t ro l R e g io n Proc e s s Quota Blo c k ( PQ B ) P ro c e s s Header Figure 17-1 4. S a mpl e Movem e n t o f Pa r am e t e r s i n P r o c e s s C r e a t i o n S e v e r a l f i e l d s i n t h e PC B a r e i n i t i a l i z e d to n o n z e r o v a l u e s . a. Th e AST q u e ue i s s e t up a s empty . b. ASTs a r e e n a b l ed f o r a l l a c c e s s mod e s . c. Th e po i n t e r to t h e Ac c e s s R i g h t s B l o c k i s i n i t i a l i z e d po i n t to the PC B $ Q_P R I V f i e l d o f the PC B . to Th e Ac c e s s R i g h t s B l o c k i s c u r r e n t l y l o c a t ed w i th i n the PC B ( F i g u r e D- 2 ) . Howe v e r , r o u t i n e s s uc h a s AC Ps and d ev i c e d r i v e r s th a t w i sh to check a process ' s access r igh ts u s e t h e ARB po i n t e r t o l o c a t e t h e p r i v i l eg e m a s k a nd U I C s o th a t , i f t h e ARB b e c om e s a n i nd e pend e n t s t r uc t u r e i n a f u t u r e r e l e a s e o f VAX/VM S , tho s e p r o g r ams w i l l c o n t i n ue to wo r k w i tho u t m od i f i c a t i o n . d. Th e un i t n um b e r o f a t e r m i n a t i o n m a i l b o x i s f i l l ed i n . A u n i t n um b e r o f z e r o w i l l i nd i c a t e to t h e p r o c e s s d e l e t i o n r o u t i n e t h a t no t e r m i n a t i o n m e s s a g e i s to be s e n t b a c k to the c r e a to r . e. Th e p r o c e s s pag e c o u n t i s i n i t i a l i z ed pag e s i n t h e S H E L L p r o c e s s . 1 7-3 to the c o un t of PROC E S S CREAT ION Tab l e 1 7 - 2 Content s o f the Proc e s s Quota B l o c k S i ze ( Bytes ) I t em P r i v i l eg e Mas k 8 S i z e o f PQB 2 Type Co d e 1 S t a t u s Fl ag s 1 Im ag e Name 64 Eq u i v a l enc e Name fo r SYS $ ERROR 64 Equ i v a l enc e Nam e fo r SYS $ IN PUT 64 Equ i v a l enc e Name fo r SYS $0UT PUT 64 Equ i v a l ence Nam e fo r SYS $D I S K 64 A S T Lim i t 4 B u f f e r ed I/0 Lim i t 4 B u f f e r ed I/0 By te Li m i t ( N OT US ED ) 4 C PU T i me Li m i t 4 D i r ec t I /0 Li m i t 4 Open Fi l e Lim i t ( N OT US E D ) 4 Pag i ng Fi l e Quo ta ( N OT US ED ) 4 S ubpr o c ess Li m i t ( N OT US ED ) 4 T i m e r Que ue En t r y Li m i t ( N OT US ED ) 4 Wo r k i ng Se t Quo ta 4 ( L im i t ) Wo r k i ng Set De fa ul t 4 U s e r name fo r Subproc e s s 12 Ac c o un t Nam e fo r Subproc ess 8 De fa ul t Di r ec to ry St r i ng 32 1 7 -4 PROC E S S C REAT I ON name w PID 1 0035 2 PRCCNT OWNER J IB name X 0 - name y PID 1 0033 PRCCNT 0 PID OWNER 1 0035 OWNER 1 0035 JIB JIB - name z - 1 . Pro c e s s W cre a t ed bot h X a nd Y 2 . Pro c e s s Y c re a t ed Pro cess Z Figure 17-2 J IB for all processes in this job "" , 1 003 1 1 PRCCNT - · - pooled quotas - - - - - - - MPID : 1 0035 - - - - - - - - - · · PRCCNT 3 1 002E PID PRCCNT 0 OWNER 1 003 1 JIB - Re l a t i o n sh i p Be twe e n J I B a nd PC Bs o f Seve r a l P r o c e s s e s i n t h e Same Jo b 5. Th e p r o c e s s n ame i s l o ad ed i n to the PC B . 6. Th e p r o c e s s p r i v i l eg e s o f the n ew p r oc e s s a r e d e t e rm i ned and l o ad ed i n to the PQB . I f no p r i v i l eg e a rg um e n t i s p r e s e n t , t h e c u r r e n t p r i v i l eg e s o f the c r e a t o r a r e u s ed . ( Ta b l e 1 8 - 1 s umma r i z e s t h e v a r i o u s p r i v i l eg e m a s k s a s so c i a t ed w i th a process . ) I f a p r i v i l eg e a r g um e n t i s p r e s e n t and the c r e a to r h a s S E T PRV p r i v i l eg e , then the p r i v i l eg e a rg um e n t is u s e d w i th n o mod i f i c a t i o n . I f a p r i v i l eg e a rg um e n t i s p r e s e n t and the c r e a to r d o e s n o t have S E TPRV p r i v i l eg e , t h e n the p r i v i l eg e s pa s s e d to the n e w p r o c e s s a r e t h e l og i c a l AND o f the p r i v i l eg e s o f the c r e a to r a nd t h e p r i v i l eg e s s p e c i f i ed i n the a rg um e n t to C r e a t e Pr o c e s s . 1 7- 5 PROC E S S C REAT I ON 7. Th e s o f twa r e p r i o r i ty o f t h e n e w p r o c e s s i s d e t e r m i n ed a nd l oaded i n to t h e PCB i n b o t h t h e b a s e p r i o r i ty f i e l d and the c u r r e nt p r i o r i ty f i e l d . ( Be c a us e th i s a r g um e n t i s pa s s e d by i t i s a l wa ys p r e s e n t , w i th a d e f a u l t va l u e d e t e rm i ned va l ue , by t h e t r e a tm e n t of m i s s i ng a rg um e n t s by t h e l a ng uag e p r o c e s s o r . ) I f t h e c r e a to r h a s A LT PR I p r i v i l eg e , t h e p r i o r i t y s p e c i f i e d i n t h e a rg um e n t l i s t i s used . I f t h e c r e a to r d o e s n o t h a v e ALTPR I p r i v i l eg e , t h e sm a l l e r o f his b a s e p r i o r i t y a nd t h e p r i o r i t y i n t h e a rg um e n t l i s t wi l l b e u s ed . 8. Th e U I C o f the n e w p r o c e s s i s d e te rm i n ed and l o ad ed i n to the PC B . If a UIC a r g um e n t i s presen t , the new p r o c e s s i s a d e t a c hed p r o c e s s a nd the a rg um e n t i s i t s U I C . I f a U I C a r g um e n t i s n o t p r e s e n t , t h en the n e w p r o c e s s is a s ubp r o c e s s . Th e U I C o f the c r e a t o r i s u s e d . In add i t i on , t h e P I D o f t h e c r e a to r i s p u t i n to the PCB $ L OWN E R f i e l d o f the PC B o f the n ew p r o c e s s . Th i s w i ll i nd i c a t e t o the p r o c e s s d e l e t i o n r o u t i n e th a t t h i s is a s ubpr o c e s s fo r wh i c h s p e c i a l a c t i o n mu s t b e t a k e n . 9. A c h e c k i s ma d e to i n s u r e t h a t t h e p r o c e s s name is un i que Th i s i s d o n e by e x am i n i ng th e p r o c e s s n am e w i th i n the g r o up . f i e l d s o f a l l PC Bs i n the s ys t e m w i th the s am e g r o up n umbe r . Rec a l l tha t a p r o c e s s c a n o n l y r e f e r to a n o th e r p r o c e s s by n am e ( Wa k e , S u s pe nd , Re s um e , De l e t e , a nd so o n ) i f the t a r g e t p r o c e s s i s i n t h e s am e g r o up . 10. S e v e r a l t ex t s t r i ng s a r e l o ad ed i n to the PQB . Th e i m a g e name a nd the e q u i v a l e n c e n am e s fo r SYS $ I N PUT , SYS $0UT PUT , a nd SYS $ E RROR a r e t a k e n f r om the a rg um e n t l i s t to C r e a t e P r o c e s s . Th e e q u i v a l e n c e n am e fo r SYS $D I S K i s o b t a i n ed f r om the Trans l a te Lo g i c a l Name s ys t e m s e rv i c e . Th e use r name , a c c o un t n a m e , a nd d e f a u l t d i r e c to r y s t r i ng a r e o b t a i n ed f r om the c o n t r o l r eg i o n o f the c r e a to r . 11. Th e s t a t u s f l ag s f o r the n e w p r o c e s s a r e ex t r a c ted f r om the Create P r o c e s s a rg um e n t l i s t a nd set in the PC B $ L S T S f i e l d i n th e n e w PCB . Some of these f l ag s r e q u i r e -p r i v i l eg e ( Ta b l e 1 7 - 3 ) . Th e pr i v i l eg e m a s k tha t i s c h e c ked i s th a t o f the n ew p r o c e s s . 12. Th e q uo t a s a r e d e te rm i n ed f o r t h e new p r o c e s s a nd l o a d ed i n to the PQB . Th e n e x t s e c t i o n d e s c r i b e s the seve r a l s t eps ta k e n to d e t e rm i n e t h e q uo t a l i s t fo r the new p r o c e s s . At t h i s po i n t , t h e PC B a n d PQB h a v e b e e n l o ad ed r e a d y t o b e a c t i v a t ed . Th i s s impl y means i n s e r t ed i n to t h e s c h ed ul e r ' s d a t a b a s e . 13. Th e a d d r e s s o f t h e PQB the PC B $ L P QB f i e l d . a s t h e e v en t f l ag wa i t ava i l ab l e because the e v e n t f l ag s . a nd the proc ess is t h e PC B w i l l be tha t i s s to r e d i n the PCB ( F i g u r e 1 7 - 1 ) in Th e PQB po i n te r u s e s the s am e l o ng wo r d ma s k f i e l d , PC B $ L E FWM . Th i s f i e l d i s p r o c e s s c a n n o t yet b e wa i t i ng f o r a n y 1 7- 6 PROC E S S CREAT I ON Table 1 7 - 3 F l ag s i n the S tatus Longword i n PCB ( PCB $ L STS ) That Can Be Set at P roce s s Creat ion F l ag i n PC B $ L_S TS B i t Num b e r i n $ C R E PR C A r g um e n t PCB $V_S S RW A I T 0 PC B $V_S S F EXC U 1 PC B $V_PSWAPM 2 I n h i b i t P r o c e s s Swa pp i ng PC B $V_N OACNT 3 S up p r e s s Ac c o un t i ng PCB $V_B ATC H 4 Ba tch PC B $V_H I B ER 5 H i b e r n a t e P r o c e s s B e fo r e Ca l l i ng PCB $V_L O G I N 6 L o g i n W i tho ut Re ad i ng the Au t ho r i za t i o n Fi l e DETAC H PC B $V_N E TWRK 7 P r o c e s s I s a N e two r k Co n n ec t Ob j ec t NETM B X Me a n i ng Pr i v i l eg e R e qu i r ed ( i f Se t ) D i s a b l e Sy s t em S e r v i c e Re so u r c e Wa i t Mo d e No n e E n a b l e Sys t em S e r v i c e E x c e pt i o n s f o r Us e r Ac c e s s Mo d e No n e ( no n i n te r ac t i v e ) NOACNT No n e pr o c e s s Imag e No n e 14. prevent m u l t i p l e to ( I PL 7 ) I P L $ S YNC H to I P L is r a i s ed PC B v e c to r Th e s c h edu l e r ' s d a t a b a s e . the to accesses is ( p i c t u r ed i n F i g u r e 1 7 - 3 a nd d e s c r i b ed i n S e c t i o n 1 7 . 1 . 3 ) s e a r c h ed f o r a n emp t y s l o t . 15. ( contents o f I f the ma x i m um p r o c e s s c o un t h a s b e en e x c e ed ed SCH$GW PROCCNT wo u l d be l a rg e r than SCH $GW PROC L I M ) o r i f n o swa p slo t i s a v a i l ab l e ( c o n t e n t s o f SWP $G L SLOTCNT h a v e g o n e Oth e r wi s e , a p r o c e s s to z e r o ) , t h e n t h e c r e a t i o n i s a b o r ted . I D i s f a b r i c a ted ( S e c t i o n 1 7 . 1 . 4 ) and pu t i n to t h e PC B o f the new p r o c e s s . 16. PC B v e c t o r the in Th e PC B a d d r e s s i s l o ad ed i n to the s l o t I f a d e t a c h e d p r o c e s s i s b e i ng th a t wa s l o c a ted i n s t ep 1 4 . the c r e a t e d , i t s P I D i s l o ad e d i n to the m a s t e r P I D f i e l d o f J I B ( J I B $ L_M P I D ) . 17. ( a nd Th e s c h ed u l e r i s c a l l ed to m a k e th i s pr o c e s s e x e c u t a b l e the b a s e to be g i ven 6 wi l l A boo s t o f o u t swa pped ) . d e t e rm i n e I t i s th i s boo s t ed pr i o r i t y t h a t w i l l pr i o r i ty . wh e n t h e new p r o c e s s i s s wa pped i n f r om S H E LL . 18. s ubpr o c e s s e s I f a s ub p r o c e s s i s b e i ng c r e a t ed , the c o un t o f PCB $W_PRCCNT ) i s field in ( s t o r ed owned b y the c r e a t o r i n c r em e n t e d a t th i s po i n t . I n a d d i t i o n , i f the c r e a to r h a s a no n z e r o C PU t i m e l i m i t ( C PU t i me l i m i t i n e f f e c t ) , t h e amo un t the f r om o f C P U t i m e pa s s e d to the n e w p r o c e s s i s d ed uc t ed c r e a to r . 19. the to r e t u r n ed is new process the Fi n a l l y , t h e P I D o f c r e a t o r ( i f r e que s t e d ) , I P L i s r e s t o r ed t o a l l o w s ys tem ev e n t r e po r t i ng , a n d c o n t r o l i s pa s sed bac k t o t h e c a l l e r . 1 7-7 PROC ESS CREAT I ON :: S C H $ G L _PCBVEC PCB of SWAPPER free slot • • PCB of NULL PROCESS free slot free slot free slot PCB of OPCOM JOR£0NTROL �---� PCB DBAOACP PRTSYMB 1 PCB of PRTSYMB1 Figure 1 7-3 17.1.2 of Job Controller S ampl e PC B Ve c to r E s t a b l i s h i ng Quo t a s f o r t h e New P r o c e s s Th e r e a r e two ta b l e s i n t h e e x e c u t i v e tha t a r e u s ed b y C r e a t e Process wh e n t h e q uo t a s a r e s e t u p fo r the n ew p r o c e s s . Ea c h quo ta o r l i m i t i n the s ys t em h a s a n e n t r y i n bo th the m i n i m um tab l e and the d e f a u l t t ab l e . Th e c o n t e n t s o f t h e m i n i m um t a b l e a r e d e t e rm i n ed by t h e SYSBOOT p a r ame te r s who s e n am e s a r e o f t h e fo rm PQL Mquo t a wh i l e the contents o f the d e f a u l t t a b l e a r e o f t h e fo rm P Q L-D q uo t a . Th e l og i c tha t d e te rm i n e s the v a l u e f o r e a c h q uo ta o r l i m i t tha t i s pa s s ed to t h e n ew p r o c e s s fo l l ows . 1. Th e d e f a u l t v a l ue s fo r e a c h q uo ta a r e put a s s umed i n i t i a l v a l u e s . 2. Ea c h q uo t a t h a t i s i nc l ud ed i n the a rg um e n t l i s t P r o c e s s r e p l a c e s t h e d e f a u l t va l u e i n t h e l i s t . 3. E a c h q uo ta i s f o r c ed to a t l e a s t i t s m i n i m um v a l ue . 1 7-8 i n to the to PQB as Create PROC E S S C REAT I ON 4. A check i s mad e to i ns u r e tha t t h e c r ea to r po s s e s s e s to cover wh a t it i s g i v i ng t o t h e n e w s u f f i c i e n t quo t a process . Th i s c h e c k i s p e r f o rmed i n the fo l l o w i ng wa y . a. I f a d e ta c hed p r o c e s s i s b e i ng c r ea t e d , t h e n no c h e c k is pe r f o rmed . Po o l ed q uo t a s a r e pl a c ed d i r e c t l y i n to the n ewl y a l l o c a ted J I B . b. I f a s ubp r o c e s s i s be i ng c r e a ted and the quo ta i s n e i th e r po o l ed n o r d ed uc t i b l e , t h en t h e s ubp r o c e s s quo t a m u s t b e sm a l l e r t h a n o r e q u a l t o t h e c r e a t o r ' s quo t a . c. Po o l ed q uo t a s r e q u i r e no spec i a l ac t i o n wh e n a s ubp r o c e s s is b e i ng c r e a t e d b e c a u s e they a l r e ad y r e s i d e i n t h e J I B , a s t r uc t u r e tha t i s s h a r ed by a l l p r o c e s s e s in the j ob ( Figure 17-2) . d. I f a s ub p r o c e s s i s b e i ng c rea ted a nd the quo ta is a d e d uc t i b l e q uo ta ( th e o n l y d ed uc t i b l e quo t a tha t i s c u r r e n t l y i m p l eme n t ed i s C PU t i m e ) , t h e n t h e c r e a t o r m u s t r e ta i n a t l east t h e m i n i m um va l u e fo r th i s quo ta a f t e r wh a t i t i s g i v i ng awa y h a s b e en s ub t r a c ted . Ta b l e 1 7 - 4 l i s t s the quo t a s t h a t a r e pa s s ed to a n e w p r o c e s s wh e n it is c r e a t ed , wh e t h e r e a c h q uo ta i s d ed uc t i b l e o r poo l ed , a nd wh e r e t h e l i m i t i s s to r ed i n the c o n t ex t o f the new process . Fu r th e r d i s c u s s i o n o f quo t a s c a n b e fo und i n t h e VAX/VM S S y s t em Ma n a g e r ' s G u i d e and i n t h e VAX/VM S S y s t em S e r v i c e s Re f e r e n c e Ma n ua l . 5. 17. 1 . 3 Th o s e quo t a s a nd wo r k i ng va l u e s ( Ta b l e 1 7 - 4 ) a r e pl a c ed t h e r e . tha t b e l o ng in the PC B Th e PCB Ve c to r Wh e n the sys tem i s i n i t i a l i z ed , a n a r r a y o f MAXPR OC E S SCNT l o ng wo r d s i s a l l o c a ted f r om nonpa g ed d yn a m i c m em o r y . Th i s a r r a y w i l l b e used t o l oc a t e the PC B o f e a c h p r o c e s s i n t h e s ys t em a t a n y g i v e n t i me . Th e f i rst two e n t r i e s i n the t a b l e po i n t to the PC B s o f t h e n u l l p r o c e s s a nd t h e swa ppe r p r o c e s s r e spe c t i v e l y . Al l o th e r e n t r i e s i n t h e tab l e i n i t i a l l y po i n t t o the PCB o f the n u l l p r o c e s s . Th e i nd i c a t i o n o f a n empty s l o t i n th i s t a b l e i s a n e n t r y t h a t po i n t s t o the PC B o f the nul l process b u t h a s n o n z e ro i nd e x . ( Th e e n t r y th a t l o c a t e s t h e PC B o f the n u l l p r o c e s s tha t h a s a n i nd e x o f z e r o i s t h e " r e a l " po i n t e r . ) Th e scan f o r a n empty s l o t b eg i n s a t the bo t tom o f t h e t a b l e so th a t tho s e system processes t h a t a r e c r e a t ed a s a pa r t o f s ys t em i n i t i a l i za t i o n w i l l have t h e i r PC B po i n te r s l o c a ted n e a r th e bo t to m o f t h e tab l e . An ex ampl e o f t h e c o n t e n t s of th i s tabl e is s h o wn on Figure 17-3 . 17 . 1 . 4 Fabr i c a t ion o f Process IDs Th e i nd ex i n to the P C B v e c t o r tha t l o c a t e s t h e PC B o f a p r o c e s s fo rms the l ow o rde r 1 6 b i ts of the process I D . Th e h i g h o rd e r 1 6 b i t s a r e t a k e n f r om a n o t h e r a r r a y ( o f wo r d s ) a l l o c a t e d f r om no npag ed po o l at s ys t e m i n i t i a l i z a t i o n t i m e . Th i s a r r a y o f s e que n c e n um b e r s ( i n i t i a l l y s e t to z e r o ) i s u s e d a s a c o ns i s t e n c y c h e c k to d e t e rm i n e tha t a n umbe r a l l eg ed to be a process I D c o r r e s po nd s to a r e a l p r o c e s s i n t h e s ys tem . 1 7- 9 PROC E S S C REAT I ON Tab l e 1 7 - 4 Sto rage Areas for P ro c e s s Quotas Loc a t i o n o f Ac t i v e Co unt Quo ta/L i m i t Name AST Lim i t Bu f fe r ed I /0 L i m i t Deduc t i b l e Quo t a s PCB $W_ASTCNT PHD$W_ASTLM C/P PCB $W_B I OCNT PCB $W_B I O LM C/C PCB $W_D I O LM C/C No te 2 PHD$W_WSQUOTA /P Wo r k i ng Se t De f a ul t No te 2 PHD$W_DFWSCNT /P PHD$L_C PUTIM PHD$L_CPULIM No t e 3/P PCB $W_D I OCNT C P U T i m e L im i t J I B $L_BYTCNT J I B $ L_BYTLM No te 4 Open Fi l e L i m i t J I B $W_F I LCNT J I B $W_F I LLM No te 4 Pag e Fi l e Pag e L i m i t J I B $L_PGF LCNT J I B $ L_PGF LQUOTA No te 4 B u f f e red Po o l ed Quo ta s ( Sha r ed by a l l processes in the s ame j ob ) Co un t/L im i t Sto r ed by ( No t e 1 ) Wo r k i ng Se t Quo t a Di r ec t I/0 L i m i t No nd ed uc t i b l e Quo ta s Loc a t i o n o f Pro c e s s L i m i t I /0 B y t e L i m i t S ubpr o c e s s L i m i t J I B $W_PRCCNT J I B $W_PRC L IM No te 4 T i m e r Que ue En t r y L i m i t J I B $W_TQCNT J I B $W_T QLM No te 4 W i th the e x c ept i o n of CPU t im e l im i t and subproc e s s c o un t , a l l ac t i ve c o u n t s s ta r t at the i r proc e s s l im i t v a l ue s a nd d e c r ement t o z e r o . An ac t i v e c o un t o f zero ind i c a te s no quo t a rema 1 n 1 ng . An ac t i v e c o un t equa l to the c o r r e s po nd i ng process l im i t i nd i c a te s n o o u t s t and i ng reque s ts . (1) The s l a sh ( /) s e pa r a t e s the c o un t f r om the l im i t . C/ i nd i c a te s tha t the c o unt v a l ue i s s to red by the C r e a t e P r o c e s s s ys t em s e rv i c e . /C i nd i c a tes tha t the 1 im i t v a l ue i s s to red by the C r e a t e P r o c e s s s ys t em s e rv i c e . /P i nd i c a te s tha t the l im i t v a l ue i s s to red by PROC STR T . ( 2 ) Wo r k i ng Se t Li s t quo t a s a r e h a nd l ed d i f f e r en t l y f r om o th e r quo t a s ( Ch a pte r 1 2 ) . ( 3) C PU T i m e s t a r t s a t z e ro and i n c r ements fo r e a c h c l oc k t i c k tha t the proc e s s is c u r rent . If l im i t c hec k i ng i s i n e f fec t ( CPULIM n o n z e ro ) , then C PUT IM m a y no t e x c eed C PU L IM . ( 4 ) Th e c o n t e n t s o f the J I B a r e l oa d ed b y C r e a te P r o c e s s wh en a d e tac hed c r eated . pro c e s s is Subp r o c e s s c r ea t i o n uses an ex i s t i ng J I B . Wh e n an emp t y s l o t i n t h e P C B v e c to r is located , t h e c o r r e s pond i ng e n t r y i n t h e s e q u e n c e v e c t o r ( F i g u r e 1 7 - 4 ) i s i nc r emented a nd u s e d a s t h e h i g h o r d e r 1 6 b i t s o f t h e p r oc e s s I D . S e qu e n c e n umb e r s c yc l e t o 0 a f te r r e a c h i ng 3 2767 . Th i s m e a n s tha t process I Ds a r e a l wa ys po s i t i v e . Th i s i s d o n e to a l l o w a spec i a l f o rm o f I /0 c ompl e t i o n . Th e I /0 po s t p r o c e s s i ng i n t e r r up t s e r v i c e r o u t i n e i n te r p r e t s a n eg a t i ve P I D i n th e I RP $ L P I D f i e l d o f a n I /0 r e qu e s t pa c k e t a s the ( s y s t em v i r t ua l ) a d d r e s s-o f a n i n t e r n a l I /0 c ompl e t i o n r o u t i n e . Wh en a p r o c e s s i s l a te r r e f e r r ed to by p r o c e s s I D , t h e v a l i d i ty o f the P I D c a n be c h e c ked by u s i ng the l ow 1 6 b i t s as a n i nd e x i n to the s e q u e nc e v e c t o r a nd c ompa r i ng t h e v a l u e f o und t h e r e w i th the h i g h o rd e r 1 6 b i ts o f the P I D . W i th t h i s s c h eme , a s e c ond c h e c k m u s t a l so be made . Th e c o r r e s po nd i ng e n t r y i n the PC B v e c to r mus t b e c ompa r ed to the PCB ad d r e s s o f the n u l l p r o c e s s to c h e c k wh e th e r the o l d p r o c e s s h a s g o ne a wa y b u t t h e s l o t n o t y e t r e u s e d . 1 7- 1 0 : :SCH$GL_PCBVEC ....1, , ..._____.____ : N ULL Same index value used to locate array element In either array forms low 16 bits of process 1 0 . SWAPPER O PC O M JOB CONTROL r to PCB o f n e w proc ess F igure 1 7 - 4 sequence no. r index Process ID Fabr i c a tion o f Proce s s I D s : SCH$GL_SE QVEC I PROC E S S C R EAT I ON Th e t wo c o n c ep t ua l c h e c k s d e sc r i b ed in the p r ev i o u s pa r ag r a ph a r e a c t ua l l y p e r fo rmed i n o n e s t e p ( i n r o u t i n e E XE $NAM P I D ) b y u s i ng t h e l ow o r d e r 1 6 b i ts of the PID as a n i nd e x i n to the PCB v e c to r a nd c ompa r i ng the P I D i n the PC B po i nted to by t h e i nd e x ed v e c to r e l em e n t w i th t h e P I D th a t i s b e i ng c h ec k ed . I f the p r o c e s s s p e c i f i ed h a s b e e n ( PC B v e c to r n o w po i n t s t o PCB of n u l l p r o c e s s ) but t h e s l o t d e l e t ed h a s n o t y e t b e e n r e used ( s e q u e nc e n um b e r n o t ye t i nc r em e n ted ) , the s e q u e n c e n umbe r a r r a y e l em e n t w i l l m a tc h t h e h i g h - o r d e r wo r d i n t h e p r o c e s s I D b u t t h e f u l l 3 2 -b i t P I Ds w i l l n o t m a t c h . Fo r e x ampl e , s u ppo se a p r o c e s s h a s b e e n d e l e t ed but i ts PCB vec to r s l o t h a s n o t ye t b e en r e u s e d . Th en t h e c o n t e n t s o f t h e se q u e n c e a r r a y e l em e n t m a t c h e s t h e h i g h o r d e r wo r d o f the process !D . B u t the i nd e x e d PC B p o i n te r l o c a t e s t h e PC B of the n u l l p r o c e s s , wh i c h h a s a p r o c e s s I D o f 1 0 0 0 0 and d o e s n o t m a tch the v a l u e o f the PID in If, o n t h e o th e r h a nd , t h e s l o t h a s b e en r e us e d , then the q ue s t i o n . l ow-o r d e r wo rd of the p r o c e s s I D , t h e p r o c e s s i nd e x , a g r e e s w i th the l o w-o r d e r wo rd o f the p r o c e s s I D . Ho we v e r , t h e h i g h- o r d e r wo r d i n the PC B ( o r the c o n t e n t s of t h e s eq u e nc e a r r a y e l em e n t ) is o ne l a rg e r than the s e quenc e num b e r f i e l d i n the o r i g i n a l p r o c e s s I D . Ag a i n , n o m a tch occur s . 17. 2 THE S HE L L PROC E S S A process c om e s i n to ex i s tenc e in the s c h e d ul i ng s tate C OM O , c om p u t a b l e b u t o u t swa pped . Howev e r , t h e swa p i m a g e o f a n e wl y c r e a t e d p r o c e s s d o e s no t r e s i d e i n t h e s wa p f i l e . I n s t e ad , a spec i a l swa p i m ag e ex i s t s a t t h e e nd o f t h e e x e c u t i v e i m a g e f i l e SYS $ S Y S TEM : SYS . EXE ( Fi g u r e 1 7- 5 ) . Th i s i m ag e c o nta i n s a m i n i m a l p r o c e s s h e a d e r a nd Pl s pa c e . Th e a c t ua l contents of the swa p i m ag e fo und i n Sh e l l a r e l i s t ed i n Ta b l e 1 7 - 5 . Process B is b e i n g created PC B for Process B Swap File Table WSSWP Entry 0 Locates SHELL Entry 1 Locates SWAPFILE. SYS Process X a lready exists and is currently outswapped PCB for Process X • • • SWAPFILE.SYS WSSWP Swap Slot L for Process F i g u r e 1 7- 5 Lo c a t i o n o f Sh e l l P r o c e s s i n t h e E x e c ut i v e Imag e F i l e 17- 1 2 X PROC E S S CREAT I ON Tab l e 1 7 - 5 Conten t s o f the I n i t i a l Swap Image i n the S he l l Proc e s s I t em P r o c e s s Head e r ( Fi x ed + W S L + P S T ) P l Pag e Ta b l e Pag e s S i ze No te 1 2 Perman e n t l y Lo c ked i n Wo r k i ng s e t ? Pag e No . i n SHE L L Yes 1 Yes , 1 Pag e o n l y Yes 2, 3 Ye s , 2 Pag e s I s Pag e Read f r om SHE LL b y SWAPPER Pro c e s s ? 4 P l Po i n t e r Pag e 1 Yes Yes , 1 Pag e Pr o c e s s I /0 Segmen t 1 No 5 Ye s , 1 Pag e Proc e s s Al l oc a t i o n Reg i o n 1 No 6 Yes , 1 Pag e Yes 7,8 Ye s , Fi rst Ke r n e l St a c k 3 Re s t o f P r o c e s s He a d e r No te 1 Yes - No Pag e Ta b l e Pag e Ar r a ys No te 2 Yes - No No te 3 N o te 4 TOTALS 2 Pag e s 8 (1) Th e s i ze of the to p o f the proc e s s header d epend s on the v a l ue s of several SYSB OOT pa r am e t e r s . See Append i x E fo r d e ta i l s on h o w t h e s i ze the p r o c e s s h e a d e r i s c a l c u l a ted b y SYS B OOT . (2) Th e r e a r e e i g h t byt e s pe r proc e s s h e ad e r pag e f o r d e ta i l s . (3) (4) 17. 2. 1 See in t h e s e a r r ays . Append ix E Th e r e a r e s i x P l pag e s , two P l pag e t a b l e pag e s , and a va r i a b l e n um b e r o f pro c e s s h e a d e r pag e s ( no te s 1 a nd 2 ) t h a t c o n t r i b u t e to S H E L L . Th e number o f pe rma n en t l y l oc ked pag e s i s t h e r es ul t i n nonpe rmanent pag e s . No te 3 m i n us the two I n swap f r om S H E LL At sys tem i n i t i a l i z a t i o n t i m e , ! N I T f i l l s i n f i e l d s i n the f i r s t s wa p file tab l e e n t r y so tha t t h e po r t i o n o f the e x e c u t i v e i m a g e th a t c o n t a i n s S H E L L l o o k s l i k e a swa p f i l e . Swa p file table entry zero { Ch a pte r 14) c o n ta i n s the c o r r e c t w i nd o w po i n te r t o l o c a t e th i s pa r t o f the executive on d i sk . A n e wl y c r e a t ed p r o c e s s h a s a z e r o in i ts PCB $ L_WS SWP f i e l d i nd i c a t i ng s wa p f i l e ze r o and v i r t ua l bl o c k n umbe r zero . Th e s e l e c t i o n o f a ne wl y c r e a t ed p r o c e s s fo r i n s wa p a nd the actual i n swa p o pe r a t i o n a re pe r f o rmed by t h e swa ppe r i n e x a c t l y t h e same f a sh i o n as a n i n s wa p o f a pr ev i o u s l y o u t swa pped p r o c e s s f r om a r eg u l a r Sh e l l wa s c o n s t r uc t ed wh e n the e x e c u t i v e i m ag e SYS . EXE wa s swa p f i l e . l i n k e d to l oo k e x a c t l y l i k e a n o u t swa pped p r o c e s s . Howev e r , a pr o c e s s head e r c a nno t b e e n t i r e l y c o n f i g u r ed w i tho ut t a k i ng i n to ac c o un t s ev e r a l SYSB OOT p a r am e t e r s . 17. 2. 2 C o n f i g u r a t i o n o f t h e P r o c e s s He a d e r To a c c ompl i sh the f i n a l c on f i g u r a t i o n o f the p r o c e s s h e a d e r , the swa ppe r m a k e s o ne c h e c k { a f t e r the p r o c e s s h a s b e e n r e ad i n b u t b e f o r e the wo r k i ng s e t i s r eb u i l t ) t o d e t e rm i n e wh e th e r th i s is an i n s wa p f r om S H E L L . I f i t i s , a s p e c i a l s ub r o u t i n e i s c a l l ed t o c o n f i g u r e t h e p r o c e s s h e a d e r b e fo r e t h e f i n a l o pe r a t i o n s o f i n s wa p a r e c ompl e t ed . 1 7-1 3 PROC ESS C REAT I ON Th i s r o u t i n e , a s ub r o u t i n e o f the swa ppe r , does not e x e c ute v e r y o f t en , o n l y as pa r t o f t h e c rea t i on o f a n e w process . To avo i d u s i ng up s pa c e i n the r e s i d e n t e x e c u t i v e , t h e r o u t i n e i s p u t i n to some o f the pag e s tha t a r e r e ad i n f r om S H E L L . Re c a l l f r om Ch a p t e r 1 4 t h a t t h e swapp e r ' s p s e ud o pag e t ab l e ( as fa r as the I /0 s ys t em is c o nc e r n ed ) i s a l so i t s P O pag e ta b l e ( a s f a r a s a d d r e s s t r a n s l a t i o n r o u t i n e s a r e c o nc e r n ed ) . Th i s s pe c i a l s ub r o u t i n e exec utes in PO a d d r e s s e s i n t h e c o n t e x t o f t h e s wa ppe r p r o c e s s . Wh e n t h e n e w p r o c e s s pag e t ab l e s a r e s e t u p , t h e phys i c a l pag e s tha t c o n t a i n th i s cod e w i l l become the k e r n e l s t a c k . Th e d e t a i l s th a t th i s s pe c i a l s ub r o u t i n e m u s t h e re . a t t e nd to are l i s t ed 1. Pag es t h a t a r e a pa r t o f She l l ( a nd a l s o pe rm a n e n t l y l o c k ed i n to th e wo r k i ng s e t ) b u t a r e not r e a d in f r om the c o py o f Th e s e Sh e l l i n t h e e x e c u t i v e i m a g e a r e f i l l ed w i th zeroes . pag es a r e a l l but the f i r s t pag e o f t h e b eg i nn i ng o f the p r o c e s s h e a d e r , one pag e of t h e k e r n e l s t a c k , a nd the pa g e t a b l e pa g e a r r a ys ( Ta b l e 1 7 - 5 ) . No n e o f t h e i n f o rm a t i o n tha t w i l l be p u t i n t h e s e pag e s wa s a s s embl ed i n to the ex ec u t i v e Th e i r c o n t e n t s a r e d e t e rm i ned dynam i c a l l y . image . 2. Th e s y s t em pag e t a b l e e n t r i e s tha t m a p t h e f i x ed po r t i o n o f the p r o c e s s h e ad e r , t h e wo r k i ng s e t l i s t , a nd the p r o c e s s s e c t i o n ta b l e a r e t empo r a r i l y m a pped so th a t th i s r o u t i n e m a y access t h em . Th e i n i t i a l c o n t e n t s o f e a c h S PTE a r e s i mp l y th e c o n t e n t s o f t h e swa ppe r ' s I /0 pag e t a b l e ( F i g u r e 1 1 - 2 4 ) . 3. Th e s y s t em pag e t a b l e e n t r i e s tha t m a p t h e em pty pag e s o f the process header ( us ed fo r wo r k i ng set l i s t e x pa n s i o n , Ch a p t e r 1 1 ) a r e l e f t a s no a c c e s s pag e s . Th e sys tem pag e t a b l e e n t r i e s t h a t m a p t h e pag e ta b l e pag e a r r a ys i n the p r o c e s s h e a d e r ( Ch a p te r 1 1 , Ch a p t e r 1 4 ) a r e a l so t empo r a r i l y m a pped s o th a t th i s r o u t i n e m a y a c c e s s t h em . 4. Th e t r a n s l a t i o n bu f f e r i s i nv a l i d a t ed . 5. Th e b a l a n c e s l o t i nd ex i s s to r ed i n the p r o c e s s h e a d e r . Th i s n umbe r is s uppl i ed t o S H E LL by t h e swa ppe r , wh o r ec o r d s t h e n umbe r o f t h e s l o t tha t h a s j us t b e e n f i l l ed . 6. Th e S YS B OOT pa r am e t e r s t h a t d e te rm i n e the d e f a u l t pag e faul t c l us te r s i ze , th e d e f a u l t pag e f i l e i nd e x , a nd the d e f a u l t pa g e t a b l e pag e f a u l t c l us t e r s i z e a r e s to r ed i n t h e p r o c e s s h e ad e r . 7. Th e i nd e x to t h e b eg i nn i ng of the wo r k i ng set l ist ( P HD$W_W S L I S T ) a n d t h e po i n t e r to t h e e n d o f t h e p r o c e s s s e c t i o n t a b l e ( P HD $ L_P S TBAS O F F ) a r e c a l c u l a ted a nd s to r ed . 8. Th e po i n te r s to t h e fo u r a r r a y s i n t h e pag e t a b l e pag e ar ray po r t i o n o f t h e p r o c e s s h e a d e r ( F i g u r e 1 1 - 8 ) a r e c a l c u l a ted a nd s to r e d . Th e pag e t ab l e pag e a r r a ys ( th a t c o un t v a l i d and l oc ked pag e s in e ac h pag e of pag e t a b l e ent r i e s ) are i n i t i a l i z e d t o - 1 , i nd i c a t i ng n o v a l i d o r l o c k e d pag e s . Th e next to l a s t pag e t ab l e pag e i n P l s p a c e h a s i t s e n t r i e s c o r r e c t ed t o r e f l e c t fo u r l o c k e d pag e s a nd s i x v a l i d pag e s . Th e f o u r l o c k e d pa g e s a r e the P l po i n t e r pag e and t h r e e pag e s o f ke r n e l s t a c k . Th e t wo pag e s t h a t a r e v a l i d b u t no t l o c k e d a r e o n e pag e of p r o c e s s a l l o c a t i o n r eg i o n and one pag e o f p r o c e s s I /0 s egmen t . 1 7-1 4 PROC E S S C REAT I ON 9. Th e f o u r c o un t e r s i n t h e f i x ed po r t i on o f the head e r that c o un t l o c k e d pa g e s , v a l i d pag e s , a c t i v e pag e t a b l e pag e s , a n d tho s e PTEs w i th n o n z e r o e n t r i e s ( F i g u r e 1 1 - 8 ) a r e i n i t i a l i z e d t o t h e n umb e r o f a c t i v e P l pa g e ta b l e e n t r i e s . Th e r e a r e two s uc h pag e s f o r Ve r s i o n 2 . 0 o f VAX/VM S . 10. Th r e e wo r k i ng s e t l i s t po i n t e r s ( WS LOC K , WSDYN , WSN E XT ) are ad j us ted f r om the i r i n i t i a l v a l u e s a s semb l ed i n t o S H E L L t o r e f l e c t t h e ad d i t i o na l pag e s f r om the to p o f th e process h e ad e r tha t a r e a pe r m a n e n t pa r t o f t h e wo r k i ng s e t . Th e wo r k i ng s e t l i s t e n t r i e s f o r t h e two pag e s th a t a r e v a l i d b u t no t l o c k e d ( s t e p 8 ) a r e s l i d d o wn t o m a k e r o om fo r t h e WS L E s f o r t h e p r o c e s s h e a d e r pag e s . 11. Th e pag e s th a t c ompr i s e t h e t o p o f the p r o c e s s h e ad e r ( f i x ed po r t i o n , wo r k i ng set l i s t , p r o c e s s s e c t i o n t a b l e , a n d pag e t a b l e pa g e a r r ay s ) a r e a d d ed t o the p r o c e s s wo r k i ng s e t l i s t . In add i t i o n , t h e PFN a r r a ys fo r the phys i c a l pag e s tha t a r e ma pped a r e u pd a t ed to i nd i c a t e tha t these pag e s a re pag e tabl e pag es ( TY PE a r r a y ) , a c t i v e ( S TATE a r r a y ) , a nd i n t h e p r o c e s s wo r k i ng s e t ( WS LX a r r a y ) . 12. Th e sys t em pag e t a b l e e n t r i e s tha t m a p t h e p r o c e s s pag e t a b l e en t r i e s are i n i t i a l i zed t o d em a nd z e r o pa g e s . Th e t wo P l pag e ta b l e pag e s tha t a r e a pe rm a n e n t pa r t o f the wo r k i ng s e t are a d d ed to the wo r k i ng s e t l i s t . Th e PFN a r r a ys f o r t h e phys i c a l pag e s t h a t t h e y a r e m a pped to are upd a t e d as in s tep 1 1 . Finally , the s ys tem pag e t a b l e e n t r i e s th a t m a p t h e s e P l pag e t a b l e pag e s a r e s e t u p s o tha t the s e pag e s a re acces s i bl e . 13. Th e o f f s e t s f r om t h e b eg i nn i ng o f the p r o c e s s h e a d e r t o the b eg i n n i ng of the P O pag e t a b l e and t h e e nd o f t h e P l p a g e t a b l e a r e c a l c u l a ted , r e f l ec t i ng t h e s i z e o f the beg i n n i ng o f t h e p r o c e s s h e a d e r ( Ch a p t e r 1 1 , Append i x E ) . Th e a d d r e s s o f t h e f i r s t f r e e v i r t ua l a d d r e s s i n P l s p a c e ( s to r ed in the process head e r a t o f f s e t PHD $ L FREP lVA ) and the c o n t e n t s o f t h e c o py o f t h e P l l e ng th r eg i s ter ( s to r ed in the h a r d wa r e PC B in t h e p r o c e s s h e ad e r ) a r e a l s o ad j us t ed to r e f l ec t t h e s i z e o f t h e p r o c e s s h e ad e r , wh i c h i s m a pped i n to P l s pa c e . 14. Th e swa ppe r I /0 p a g e tab l e ( Fi g u r e 1 1 -2 4 ) i s ad j u s t e d to r e f l ec t the cur rent s ta t e of t h e wo r k i ng s e t l i s t . Th e a d d r e s s o f t h e P l w i nd o w to t h e to p o f t h e p r o c e s s h e ad e r is ( Al t h o ug h the c a l c u l a ted and s t o r e d i n l o c a t i o n CTL$G L PHD . s wa ppe r i s the c u r r en t p r o c e s s , i t is a b le to a c c e s s the Pl add ress of the n ewl y c r e a t e d p r o c e s s b e c a u s e i t s pag e s a r e mapped a s swa ppe r P O a d d r e s s e s a s a pa r t o f t h e swa ppe r I /0 page t a b l e . ) Wh e n c o n t r o l i s pa s s ed b a c k to the swa ppe r , t h e c ompl e t i o n o f t h e i n s wa p o pe r a t i o n wi l l r e f l e c t th e correct s ta te of t h e wo r k i ng set l i s t and t h e l o c a t i o n o f t h e P l w i ndow t o t h e p r o c e s s h e ad e r . 15. Th e p r o c e s s h e ad e r i s m a r k e d r e s i d e nt i n PC B $ L_S TS ) . 16. Th e WS Q U OTA a nd WSAUTH po i n te r s a r e i n i t i a l i z e d to the v a l ue of the S Y S B O OT pa r am e t e r WSMAX . Th e WSFLU I D c o un t e r i s i n i t i a l i z e d to t h e v a l u e o f t h e SYS BOOT pa r am e t e r M I NWSCNT . Th e end of the wo r k i ng s e t l i s t ( WS LAS T ) and t h e d e f a u l t c o un t ( D FWSCNT ) i n i t i a l l y r e f l e c t the v a l u e o f t h e S Y S B OOT pa r am e t e r P Q L_DWS DEFAU L T . 1 7 -1 5 ( i n f i e ld PC B $V P HDRES PROC E S S C REATI ON 17. F i n a l l y , t h e PO and P l b a s e r eg i s t e r s a r e ad j us ted to r e f l ec t th e v i r t u a l a d d r e s s o f t h e p r o c e s s h e ad e r . Th e c a l c u l a t i o n s s t ep 13 a d j u s t ed the va l ue s of these two r eg i s t e r s in r e l a t i ve t o t h e b eg i nn i ng o f t h e p r o c e s s h e ad e r . Af t e r th i s f i n a l s t ep , t h e c o p i e s o f t h e s e t wo r eg i s t e r s c o n t a i n the v i r tual a d d r e s s e s o f t h e t h e b eg i nn i ng o f the P O a n d P l pag e t a b l e s , e x a c t l y wh a t i s r eq u i r ed f o r ad d r e s s t r a n s l a t i o n . Th e s p e c i a l s ub r o ut in e i n S H E L L r e t u r n s c on t ro l to t h e swa ppe r ' s m a i n i n swa p r o u t i n e wh e r e the f i na l s t eps o f t h e i n swa p o pe r a t i o n a r e c ompl e ted . Th e o pe r a t i o n o f the swa ppe r process i s d e sc r i be d in Ch a p t e r 1 4 . PROC E S S CREATI ON IN THE C ONTEXT O F THE N EW PROC E S S 17. 3 Th e f i n a l s t eps o f p r o c e s s c r e a t i o n t a k e p l a c e i n t h e c o n t e x t o f t h e n ewl y c r ea t ed p r o c e s s . S H E L L c o n t a i n s a n i n i t i a l h a rdwa r e c o n t e x t fo r the p r o c e s s . I n pa r t i c u l a r , t h e s a v ed PC i n the h a r d wa r e PCB is the add r e s s of a r o u t i ne c a l l ed E XE $ PROCSTRT . Th e s a ved PS L i nd i c a t e s k e r n e l mod e a t I P L 2 . Th us , t h e f i r st code tha t e x e c u t e s in the contex t of a n ew l y c r e a t ed p r o c e s s i s the s ame fo r ev e r y p r o c e s s i n t h e s ys tem . 17. 3. 1 O pe r a t i o n o f PROCSTRT By the t i me tha t PROC S TRT e x e c u t e s , the PC B a nd the p r o c e s s h e ad e r have been p r ope r l y c o n f i g u r ed . I n a d d i t i o n , a l l i n fo rma t i o n p a s s ed f r om t h e c r e a to r th a t b e l o ng s i n t h e PC B h a s a l r e a d y b e e n p u t th e r e . PROC S TRT m u s t ta k e t h e i n fo rma t i o n tha t i s t empo r a r i l y l o c a t ed i n the P r o c e s s Quo t a B l o c k a nd p u t i t i n to i t s p r o pe r pl a c e s in the process h e ad e r a nd in P l s pa c e ( Figure 1 7-6 ) . PROC STRT then p r e pa r e s fo r ex ec u t i o n the i m a g e wh o s e name wa s pa s s e d by t h e c r e a t o r a nd calls tha t i m ag e . Th e s t eps tha t a r e pe r fo rmed by PROC STRT a r e l i s t ed here . PROC STRT b eg i n s e x e c u t i o n i n k e r n e l m o d e a t I P L 2 to p r ev e n t p r o c e s s d e l e t i o n un t i l t h e P QB h a s b e en d e a l l o c a t ed . 1. Th e ad d r e s s o f the RM S d i s pa tc h e r a nd the ad d r e s s o f t h e b a s e of the c o n t r o l r eg i o n ( th e ad d r e ss o f th e P l m a p t o the p r o c e s s h e a d e r , the pa r t of P l s pa c e tha t i s at the l o we s t v i r t ua l a d d r e s s ) a r e p u t i n to t h e P l po i n t e r pag e . 2. Th e Pl s p a c e per-proc ess po i n t to RSB d i s p a t c h i ng Ch a p te r 3 . ) 3. Th e ac c o un t n am e , u s e r name , a nd d e f a u l t d i r ec to r y s t r i ng a r e t a k e n f r om t h e P QB a nd p u t i n to th e i r p r o p e r pl a c e s i n P l spac e . 4. Tho se quo t a s tha t a r e s to r ed i n t h e p r o c e s s h e ad e r ( c ur r e n t l y o n l y C P U t i m e l i m i t a nd A S T l i m i t ) a r e m o v ed f r om t h e PQB to t h e i r p r o pe r pl a c e s i n the p r o c e s s h e ad e r ( Ta b l e 1 7 - 4 ) . v e c to r s fo r u s e r -wr i t t e n s ys t em se rv i c e s a nd or imag e - s pec i f i c m e s s ag e s a r e i n i t i a l i z e d to i n s t r uc t i o n s . ( Th e use o f t h e s e v e c to r s in to u s e r -wr i t ten s ys t em s e r v i c e s i s d i sc ussed i n 1 7- 1 6 PROC E S S C REAT I ON JIB N e w Proc e s s ( N ot i n v o l v e d i n PROCS. TRT operation ) PC B - - ( S a m pl e p a r a m e t er s t h at a r e m o v e d f ro m �� P ro c e s s Q uo t a PQB t o n e w p roces s ) .? � I mage name, Use: : Default Directory Block ( PQB ) Privilege Mask, Working Set Quotas Control Region � Process Header Figure 17-6 Remo v a l o f P r o c e s s Pa r ame t e r s f r om P r o c e s s Quo t a B l o c k 5. Th e wo r k i ng s e t l i s t po i n te r s a r e i n i t i a l i z ed t o r e f l ec t the q uo t a s pa s s e d f r om th e c r e a to r ( a f t e r m i n i m i z a t i o n wi t h the s y s t em-w i d e wo r k i ng set ma x i m um ) . 6. Th e p r o c e s s p r i v i l eg e ma s k i s l o ad ed i n to the f i r s t q u a d wo rd of the process head e r { th e wo r k i ng p r i v i l eg e ma s k ) , the p e rma n e n t p r i v i l eg e ma s k ( a t l o c a t i o n C T L $G Q PROCPR I V in the P l po i n t e r pag e ) , a nd the a u tho r i z e d pr i v i l ege m a s k { i n f i e l d PHD $ Q AUTHPR I V) . Th e us e o f e a c h o f t h e s e p r i v i l eg e m a s k s i s d e s c rTbed i n Ch a p t e r 1 8 . 7. At t h i s po i n t , t h e en t i r e P QB i s c o p i ed to the s t a c k a nd the PQB d e a l l o c a ted to nonpag ed po o l . Th i s step i s t a k e n to g i v e b a c k d yn am i c mem o r y a s q u i c k l y a s po s s i b l e , pa r t i c ul a r l y b e fo r e t h e t i m e - c o n s um i ng p r o c e s s o f l og i c a l n am e c r e a t i o n . 8. Th e l o g i n t i m e i s s aved . 1 7- 1 7 PROC E S S C REAT I ON 9. On c e t h e PQB h a s b e e n d e a l l o c a ted , I PL c a n be l o we r ed to zero , a l l ow i ng t h e p r o c e s s to be d e l e t ed . By k e e p i ng I PL a t 2 u n t i l t h e PQB h a s b e e n g i v e n up , t h e n e ed fo r spec i a l c a s e c o d e i n De l e t e P r o c e s s i s a v o i d ed . Th e r e i s no n e ed t o chec k i n De l e t e P r o c e s s wh e th e r the p r o c e s s b e i ng d e l e t ed is only pa r t i a l l y c r e a t ed a nd s t i l l own s a P r o c e s s Quo t a B l o c k f r om n o npag ed po o l . Ano the r mo r e ph i l o so ph i c a l i n t e r p r e t a t i o n is th a t a t th i s po i n t i n the c r e a t i o n o f a p r o c e s s , we f i n a l l y h a v e som e th i ng th a t i s c a pa b l e o f b e i ng d e l e t ed , a f u l l f l ed g ed p r o c e s s . 10. Log i c a l n am e s a r e c r e a ted fo r SYS $ IN PUT , SYS $0UTPUT , SYS $ E RROR , TT , a n d SYS $D I S K . Th e i ma g e name i s moved to the i ma g e h e a d e r buf f e r fo r s ub s e q u e n t use by the imag e a c t iva to r . Th e PQB c o py i s r emoved f r om th e s t a c k . A t t h i s po i n t , PRO C S TRT h a s moved a l l the i n f o rm a t i o n f r om the c r e a to r to the c o n t e x t o f the n ew p r o c e s s . I t i s now r e ad y to a c t i v a t e the i m a g e tha t w i l l e x e c u t e in the context o f the new p r o c e s s . It p e r fo rms t h e f o l l o w i ng s t eps t o a c c ompl i sh th i s . 11. Ac c e s s m o d e i s c h a ng ed to e x e c u t i v e b y f a b r i c a t i ng a PS L o n t h e s t a c k a nd e x e c u t i ng a n RE I i n s t r uc t i o n . Th e e x e c u t i o n o f a n RE I i n s t r uc t i o n i s the o n l y wa y t o g e t t o a n o u t e r ( l ess p r i v i l eg e d ) a c c e s s m o d e . 12. Th e imag e a c t i v a to r i s c a l l ed to s e t up the pag e t a b l e s a nd pe r fo rm th e o t he r s t eps n ec e s s a r y to a c t i v a t e the i m ag e . Im a g e a c t i v a t i o n i s d e sc r i b ed i n t h e nex t c h a p t e r . 13. An ex e c u t i v e m o d e t e rm i n a t i o n h a nd l e r i s d e c l a r ed t h a t wi l l call RM S $ RUNDWN fo r e a c h o pen f i l e . Th i s h a nd l e r wi l l be i nv o k e d wh en S Y S $ E X I T i s c a l l ed f r om e x e c u t i v e a c c e s s mo d e , wh i c h wi l l u s ua l l y h a ppen wh e n the p r o c e s s i s d e l e t ed . 14. Ac c e s s m o d e i s c h ang ed to us e r by f a b r i c a t i ng a s t a c k and e x e c u t i ng a n RE I i n s t r uc t i o n . 15. Th e f r am e po i n t e r ( F P ) i s c l e a r ed . Th i s g u a r a n t e e s tha t the s e a r c h o f the s t a c k fo r a c o nd i t i o n h a nd l e r by the e x c e p t i o n d i s pa t c h e r w i l l t e rm i n a t e ( Ch a p te r 2 ) . 16. An i n i t i a l c a l l f r am e i s s e t up o n t h e s t a c k by CALLG i n s t r uc t i o n i n l i n e . PS L on e x e c u t i ng the a C A L LG 1 5$ : . WORD 0 n e x t i n s t r uc t i o n ; E n t r y Ma s k Th e ad d r e s s o f a c a t c h a l l c o nd i t i o n hand l e r is e s t a b l i s hed in th i s f r am e a nd a l so i n the l a s t c h a n c e e x c e p t i o n v e c to r f o r us e r mo d e . Th e p u r po s e a nd a c t i o n o f th i s h a nd l e r a re d i scus sed i n the nex t sec t i o n . 17. An a r g um e n t l i s t t h a t i s n e a r l y i d en t i c a l to the o n e used by one o f the c ommand l a ng uag e i n t e r p r e t e r s ( Ch a p t e r 2 0 ) i s b u i l t o n the s tac k . Th i s a rg um e n t l i s t a l l o ws a n i m ag e to e x e c u t e wi th n o c o nc e r n o v e r wh e th e r i t wa s a c t i v a ted f r om Th e a d d r e s s o f a d ummy C L I c a l l b a c k PRO C S TRT o r f r om a C L I . 1 7- 1 8 PROC E S S CREAT I ON r o ut i ne i s p u t i n to th i s a rg um e n t l i s t a nd a l so i n l o c a t i o n C T L $ A L C L I CA LB K . If an imag e tha t wa s a c t i v a t ed f r om PRO C S TRT a t temp t s to c ommun i c a t e w i th a C L I ( wh i c h d o e s no t e x i s t ) , a n e r r o r o f C L I $_I NVR E QTYP w i l l b e r e t u rned . 18. F i n a l l y , t h e i m ag e i s c a l l ed a t i t s i n i t i a l t r a n s f e r add r e s s . If the imag e t e rm i n a t e s w i th a RET ( i n s t e ad o f c a l l i ng SYS $ E X I T d i r e c t l y ) , PR OC STRT c a l l s SYS $ E X I T i tsel f . In g en e r a l , t h e r e i s n o d i f f e r e n c e b e twe e n a n i m ag e t e r m i n a t i ng wi t h a R E T o r wi th a c a l l to S YS $ E X I T . I f t h e p r o c e s s wa s i n i t i a l l y c r ea t ed w i th t h e h i b e r n a t e f l ag , it is pl a c ed i n to h i b e r n a t i o n b e fo r e the i m ag e i s c a l l ed . Wh e n c o n t r o l i s pa s s ed bac k to PROC S TRT f o l l o w i ng i m ag e te rmi nat i on , the h i b e r n a t e f l ag i s ag a i n c h e c ked . I f no e r r o r o c c u r r ed a nd t h e h i b e r n a te f l ag is s e t , the p r o c e s s is p u t b a c k i n to the h i b e r n a t e s ta t e . I n th i s i n s t a n c e , t h e r e i s a d i f f e r e n c e b e twe en RET a nd SYS $ E X I T . If a p r o c e s s w i sh e s to be p u t b a c k to s l e e p fo r f u t u r e a wa k e n i ng s , i t m u s t RET b a c k to PROC STRT r a th e r than t e rm i n a t e w i th a c a l l to SYS $ E X I T . 17. 3. 2 C a t c h Al l Co nd i t i o n H a nd l e r Th i s c o nd i t i o n h a nd l e r i s e s t a b l i shed i n the o u t e rmo s t c a l l f r am e by PR O C S TRT a nd b y the c omma nd l a ng uag e i n t e r p r e t e r s b e f o r e a n i mag e i s c a l l ed . An y c o nd i t i o n tha t i s r e s i g n a l l ed ( n o t p r o pe r l y h a nd l e d ) by o th e r h a nd l e r s (or un f i e l d ed bec a use no o th e r h a nd l e r s have b e en e s t a b l i shed ) w i l l ev e n t ua l l y b e pa ssed to th i s h a nd l e r . Th e h a nd l e r wi l l i s sue a m e s sag e us i ng the SYS $ P U TM SG s e r v i c e and , d e pend i ng on t h e s e v e r i t y l e v e l of the c o nd i t i o n , f o r c e i m ag e ex i t . The d e t a i l s o f the c a tc h a l l c o nd i t i o n h a nd l e r a r e l i s t ed h e r e . 1. I f the c o nd i t i o n i s S S $ S S FAI L , t h en sys tem s e rv i c e fa i l ure e x c e p t i o n mod e is d i sa b l ed t o avo i d a n i n f i n i t e l o o p i ng s i t ua t i o n . 2. I f the e x c e p t i o n wa s g e n e r a t ed b y a c a l l t o L I B $ S IGNAL , ( th a t is, th e e x c e p t i o n d i d no t p a s s th r o ug h t h e mod ul e EXC E PT I ON i n the e x e c u t i v e ) , t h e a rg um e n t l i s t i s ad j us ted to conta i n o n l y tho s e a r g um e n t s pa s s ed t o L I B $ S IGNAL a nd no t the PC a nd PS L f a b r i c a t ed i n to the s i g na l a r r a y by t h a t p r o c ed u r e ( Ch a p t e r 2 ) . 3. SYS $ P UTM SG i s c a l l ed to wr i t e an e r r o r m e s s ag e to SYS $ 0 UT PUT ( a n d to SYS $ E RROR i f d i f f e r e n t f r om SYS $ 0 UT P UT ) . Th e s e r v i c e SYS $ P UTMSG i s d e sc r i b ed in the Se r v i c e s VAX/VM S Sys tem Re f e r e nc e Ma n ua l a n d i n t h e VAX- 1 1 Run-T i m e L i b r a r y Re f e r e n c e Th e i n t e r n a l o p e r a t i o n o f the Put Me s s ag e sys t em Ma n ua l . s e r v i c e i s d i s c u s sed i n Ch a p t e r 2 7 . 1 7-1 9 PROC E S S CREAT I ON 4. I f th i s h a nd l e r wa s c a l l ed th r o ug h the l a s t c h a n c e v e c to r ( i nd i c a t ed by a d e pth o f - 3 ) , o r i f the e r r o r l ev e l i s s eve r e or g reate r , t h e n a n exc ept ion s umm a r y is wr i t t e n to SYS $ 0 UTPUT by the rout ine E XE $ E XCMSG . Th i s r o ut i n e is d e sc r i b ed i n Ch a p t e r 2 7 . ( by I n a l l o th e r c a s e s , t h e i mag e i s a l l o wed to c o n t i nue the e x c e pt i o n r e t u r n i ng a s t a t us of S S $_C ONT INUE to d i spa tch e r ) . 1 7- 2 0 CHAPTER 1 8 I MAG E ACT IVAT I ON AND TERM I NAT I ON to p r e pa r e s t e ps Be fo r e a n i mag e c a n e x e c u t e , VM S m u s t ta k e s e v e r a l the i mag e fo r execut ion . P r o c e s s pag e ta b l e s a nd o th e r d a ta s t r uc t u r e s m u s t be s e t up to l o c a t e the c o r r e c t imag e f i l e on d i sk . Th e c a pab i l i t y o f i nv o k i ng a d eb ug g e r m u s t b e i n c l ud ed . At imag e e x i t , t e rm i n a t i o n h a nd l e r s d e c l a r ed by th e user or by VM S must be c a l l ed . I f the i m a g e i s e x e c u t i ng i n a b a tc h o r i n t e r a c t i v e e nv i r o nme n t , a l l t r ac e s o f t h e i ma g e m u s t be el i m i n a te d so tha t the next i m ag e c a n b eg i n e x e c u t i o n w i th no s i d e e f fec t s f r om the e x e c u t i o n o f the p r e v i o u s i m ag e . 18 . 1 I MAG E IN I T IAT I ON VM S c o n t a i n s no s pe c i a l c od e to r e ad i m a g e s i n to memo r y fo r initial execut ion . I n s t e ad , t h e pag i ng mech a n i sm th a t b r i ng s i n pag e s f r om a n i m ag e f i l e o n d em a nd i s u s e d wh e n a n imag e i n i t i a l l y e x e c u t e s a s we l l a s l a te r on . I n o rd e r fo r th i s s c h em e to wo r k , t h e p r o c e s s pag e t a b l e s m u s t be p r o p e r l y s e t up to r e f l ec t the s ta t e o f a l l t h e pag e s Th i s s e t u p i s pe r f o rmed by the i m a g e a c t i va to r . i n the i ma g e f i l e . Th e a c t ua l t r a n s f e r o f c o n t r o l to the i m ag e a l s o t a k e s p l ac e th r o ug h VM S s o tha t ho o k s c a n b e i n s e r t e d t o a l l o w l a t e r i nc l us i o n o f e i th e r a d e b ug g e r o r the t r a c e b a c k f a c i l i ty . Th i s pa th th r o ug h VM S , c a l l ed t h e d e b ug boo t s t r a p , a l wa ys e x e c u t e s un l e s s e x pl i c i t l y e x c l ud ed a t l i n k t i m e w i th a /NOTRAC EBAC K q u a l i f i e r t o t h e L I NK c ommand . I m ag e Ac t i va t i o n 18. 1 . 1 Th e mod u l e tha t c o n t a i n s t h e i m a g e ac t i v a to r ( S YS I MGAC T ) i s o n e o f t h e l a rg e s t m od u l e s in the e x ec u t i ve . Al t h o ugh t h e c o n c e p t o f i mag e a c t i v a t i o n i s v e r y s i mp l e , t h e r e a r e s e v e r a l a l t e r n a t e pa th s th r o ug h the i m ag e a c t i v a to r th a t t a k e i n to a c c o u n t the m a n y s pe c i a l c a s e s o f i m ag e a c t i va t i o n . Some o f the s e c a se wi l l b e d i sc u s s ed expl i c i t l y . Ot h e r s wi l l onl y b e m e n t i o ne d i n p a s s i ng . Th e t ype s o f i nc l ud e : • i m ag e a c t i va t i on tha t wi l l be d i s c u s s ed Ac t i va t i o n o f a " s i mpl e " i m ag e , o n e th a t c o n t a i n s secti ons . 1 8-1 expl i c i tl y no g lobal I MAG E ACT I VAT I ON AND TERM INAT I ON Th i s i s a n a r t i f i c i a l s e pa r a t i o n f r om t h e n e x t c a se , s impl y t o i l l us t r a t e t h e d i f f e r e n c e i n c a l l s to t h e i mag e a c t i v a to r . • Ac t i v a t i o n o f a n i m a g e t h a t c on t a i n s g l oba l s e c t i o n s . B e c a use a l mo s t eve r y h i g h l ev e l l a ng uag e p r o c e s s o r inc l ud e s l i b r a r y r o u t i n e s , th i s c a se i nc l ud e s eve r y i m a g e e x c e p t tho s e wr i t t en e n t i r e l y i n VAX- 1 1 MACRO w i t h no e x p l i c i t s h a r i ng of g loba l sec t i ons . • I n i t i a l a c t i va t i o n o f k n o wn i m ag e s . Wh e n th e I N S TA L L u t i l i ty e x e c u t e s to make p r i v i l eg ed or sha r eable i m a g e s k n o wn t o the s ys tem , the i m a g e a c t i v a to r i s c a l l ed w i th a n o a c t i v a t e o p t i o n , o n l y p r e pa r i ng the i m ag e fo r l a ter a c t ivat ion . • La t e r a c t i v a t i o n o f k n o wn i m ag e s . Th e a c t i v a t i on o f images th a t h a v e b e e n i n s t a l l ed is s t r e aml i n e d by t h e d a ta s t r uc t u r e s tha t we r e c r e a t ed wh e n the i m a g e wa s i n i t i a l l y i n s t a l l ed . • Ac t i v a t i o n o f c ompa t i b i l i ty mod e i m ag e s . Wh e n th e i m ag e a c t i v a to r i s a s k e d to a c t i v a t e a c ompa t i b i l i t y mod e i m a g e , i t a c t ua l l y a c t i v a t e s the RSX- l l M AME a nd pa s s e s t h e c ompa t i b i l i ty mo d e i mag e n am e to t h e AME f o r f u r th e r p r o c e s s i ng . Th e r e a r e s ev e r a l o th e r opt i o n s t h a t t h e i m a g e a c t i v a to r m u s t c h e c k Th e s e wi l l o n l y b e m e n t i o n ed i n the spec i f i c pa r t s o f i m ag e fo r . a c t i v a t i o n wh e r e t h e y c a u se s pe c i a l a c t i o n t o b e ta ken . Th ey i n c l ud e : • I m ag e a c t i v a t i o n a t s ys t em i n i t i a l i z a t i o n t i me . Du r i ng i n i t i a l i z a t i o n o f the s ys tem , two i m ag e f i l e s m u s t b e o pe n ed w i tho u t t h e s uppo r t o f e i th e r RM S o r the d i s k AC P . Th e s e i m ag e s a r e SYS I N I T a nd t h e s ys tem d i s k AC P i t s e l f . Th e i m a g e a c t i v a t o r c a l l s t h e s pe c i a l c o d e i n the ex e c ut i v e th a t p e r fo rms th e s i mpl e r AC P o pe r a t i o n s w i tho ut a c t ua l l y us i ng t h e AC P . Th e s e r o u t i n e s a r e b r i e f l y d e sc r i b ed a l o ng w i th the r e s t of s y s t em i n i t i a l i z a t i o n in Ch a p te r s 2 1 a nd 2 2 . • Me r g e d i m a g e a c t i v a t i o n . Th i s i s t h e t e c h n i qu e th a t the e x ec u t i v e u s e s f o r m a pp i ng a d e b ug g e r , the t r a c e b a c k h a nd l e r , or a c ommand l a ng uag e i n t e r pr e t e r i n t o a n u n u s e d a r ea o f P O o r Pl spac e . Ra th e r th a n us i ng t h e v i r t u a l a d d r e s s d e sc r i pto r s fo und i n t h e i m ag e h e a d e r o f t h e m e rg ed i m ag e , t h e i m ag e a c t i v a t o r s i mpl y u s e s th e n e x t a v a i l a b l e po r t i o n o f P O o r P l s pa c e . Th e u s e r s t a c k a n d i m a g e I /0 s e gme n t a r e no t m a pped fo r a m e r g ed i m ag e . Th e RM S i n i t i a l i za t i o n r o u t i n e s a r e n o t c a l l ed e i th e r bec a u se a n i m a g e i s a l r e a d y e x e c u t i ng a nd h a s RM S c o n tex t tha t c a nno t b e d e s t r oyed . 1 8-2 I MAG E ACTIVATI ON AND TERM I NAT I ON • P O -o n l y i m ag e s . i mag e s tha t c o nta i n a l l t empo r a r y Th e l i n k e r c a n p r o d uc e the user s t ac k a nd the I /O i m ag e I /O s t r uc t u r e s i n c l ud i ng Th e i m a g e a c t i va to r m u s t r e c og n i z e th i s s egmen t i n P O s p a c e . t ype o f a n i m a g e s o tha t the t wo s t r uc t u r e s u s ua l l y l o c a t e d of P1 s pa c e are c o r r ec t l y i n t h e l owe s t ad d r e s s po r t i o n ma pped . P O - o n l y i m ag e s a r e u s ed wh e n e v e r i t i s n ec e s s a r y t o e x t e n d t h e pe r ma n e n t p a r t o f t h e l ow a d d r e s s e nd o f P 1 s p a c e . Fo r e x ampl e , t h e S E T M E S S AG E c omma nd causes a P O -on l y i m ag e c a l l ed S E T P O . EXE t o ex e c u t e . Th i s i m ag e m a p s t h e i nd i c a t e d m e s s a g e s e c t i o n i n to the l o w a d d r e s s e nd of P1 s pa c e a nd a l te r s l oc a t i on CTL$G L C T LBASVA to r e f l ec t the new b o und a r y b e twe e n t h e t empo r a r y a nd pe rm a n e n t pa r t s o f P l s pa c e . Th i s last step i s c r i ti cal i f t h e m e s sa g e s e c t i o n i s t o r em a i n ma pped wh e n l a t e r i m ag e s t e rm i n a t e . • P r i v i l eg ed s h a r e a b l e i m ag e s . Th e s e i n c l ud e pr i v i l eg ed s h a r e a b l e s e c t i o n s u s e d to i m p l emen t u s e r -w r i t t e n s y s t em se rv i c es a nd the a b i l i ty to add pe r -p r o c e s s or i ma g e - s p e c i f i c ent r i e s to the m e s s ag e f ac i l i ty . • Imag e s tha t d o n o t r e s i d e o n a d ev i c e . r a nd om access mass s t o r ag e Th e i mag e a c t i v a to r c a n ac t i vate i mag e s f r om s e qu e n t i a l d ev i c e s ( ma g t a pe ) and i m a g e s tha t a r e l o c a t ed o n a no th e r nod e o f a n e two r k . An a d d r e s s s pa c e l a rg e e no ug h to conta i n th e e n t i r e i m a g e i s f i r s t c r e a t ed . Th e i m ag e i s then c o p i ed i n to th i s add r e s s spac e . Th i s c a u s e s a l l i m ag e pag e s , i n c l ud i ng r e a d -o n l y pa g e s , t o be s e t up a s wr i t a b l e , a nd d e s t i ned fo r t h e pa g e f i l e wh e n t h e y a r e r emoved f r om ph y s i c a l m em o r y . 18. 1 . 1 . 1 Imp l emen t a t i o n o f t h e Imag e Ac t i va to r - Th e i m ag e a c t i va to r is i m pl eme n t e d as a s ys t em s e rv i c e , a l tho ug h i t i s n o t m e a n t to b e c a l l ed d i r e c t l y by us e r s . Th e r e a s o n f o r th i s f o rm o f i m pl em e n t a t i o n is tha t the i m ag e a c t i v a to r w i l l be i nd i r ec tl y c a l l ed by u s e r s , bo th th r o ug h a CLI wh e n r unn i ng a n i m a g e wi th some c omm and , a nd th r o ug h th e I N S TA L L u t i l i ty , wh e n the s ys t em m a n ag e r o r some o th e r p r i v i l eg ed u s e r i s i n s t a l l i ng p r i v i l eg ed o r sh a r e ab l e i m ag e s . s ys t em se rv i c e Th u s , t h e i m a g e a c t i v a to r h a s i t s o wn slot in the vec to r a r e a a nd is i m p l em e n t ed as a p r o c ed u r e . Th e r e a r e s e v e n Th e y a r e : a rg um e n t s tha t c a n b e pa s s ed to the i m ag e a c t i v a to r . nam e S t r i ng d e s c r i pt o r o f i m ag e tha t i s b e i ng a c t i v a t ed d f l n am S t r i ng d e s c r i pt o r f o r d e f a u l t f i l ename hd r b u f Ad d r e s s of 5 1 2 byt e bu f f e r in wh i c h the i m ag e h e ad e r a nd i ma g e f i l e d e s c r i p to r a r e r e t u r n ed . Th e f i r s t two l o ngwo r d s i n t h e b u f f e r a r e the add r e s s e s ( wi t h i n th e buffer ) of the i m ag e head e r a nd the i m ag e file d e s c r i pto r r e spec t i v e l y . 18-3 I MAG E ACT I VAT I ON AND TERM I NAT I ON i mg c t l Image ac t i va t i o n c o n t r o l pa r am e t e r s . Th e s e f l ag s contro l the fo rm t h a t the ac t i va t i o n wi l l take . Th e po s s i b l e o p t i o n s a r e : Bit Me a n i ng 0 N OACT , s e t i f n o t a c t i v a t i ng the i m ag e . Th i s f l a g i s u s e d by th e I N S TA L L u t i l i ty t o c o mpl e t e t h e i n s ta l l a t i o n o f known f i l e entr ies . 1 WRI TAB L E , s e t i f i mag e i s s uppo sed to b e wr i tabl e . 2 S HAREAB L E , set if the image is a shareable imag e tha t i s b e i ng a c t i v a t ed a s a p i e c e o f an e x e c u t a b l e i m ag e . Th i s f l a g i s o n l y u s e d i n a r e c u r s i v e c a l l to the i m ag e a c t i v a to r . 3 PR IVI L E G E , s e t i f e x e c u t a b l e imag e h a s ampl i f i ed p r i v i l eg e s . Th i s f l ag r e qu i r e s th a t t h e sha r e a b l e i mag e tha t a c t i v a t ed be i n s t a l l ed a s a i s b e i ng k nown f i l e . I t a l so r e qu i r e s tha t the S HAREABLE b i t be s e t . 4 M E RG E , set i f m e r g i ng o n e e x ec ut a b l e i mag e i n to t h e a d d r e s s s pa c e o f a n o the r . Th e s e t t i ng o f th i s b i t c a u s e s the us e r s tack , the i m ag e I/O segme n t , a nd the p r i v i l eg e ampl i f i c a t i o n to be i g no r ed . Th i s bi t mus t be set if the i m ag e a c t i v a to r i s c a l l ed f r om us e r mod e . 5 E XPR E G , s e t i f t h e i n ad r a r g um e n t ( see next i t em ) d o e s no t g i v e a n a c t ua l a d d r e s s r a ng e b u t m e r e l y i nd i c a t e s i n to wh i c h a d d r e s s s pa c e ( PO s pa c e or Pl Th i s s pa c e ) t h e i m ag e i s to b e m a pped . f l ag i s o n l y u s ed d u r i ng a m e r g ed i m ag e a c t i v a t i on . i nad r the v i r t ua l a d d r e s s o f a 2 - l o ng wo r d a r r a y c o nta i n i ng add ress r a ng e i n to wh i c h t h e i mag e i s t o be m a pped . Th i s a r g um e n t i s u s ua l l y om i t ted , i n wh i c h c a s e the add r e s s r a ng e s d e s i g n a t ed by th e i m ag e s e c t i o n d e s c r i p t o r s i n t h e i m ag e h e ad e r a r e u s e d . r e ta d r a d d r e s s o f a 2 - l o ng wo r d a r r a y to r ec e i ve the s t a r t i ng a nd end i ng a d d r e s s e s i n to wh i c h the i ma g e wa s a c t ua l l y mappe d . ident a d d r e s s o f a q ua d wo r d c o n t a i n i ng the v e r s i o n n umb e r a nd m a t c h i ng c r i t e r i a fo r a sha r e a b l e i ma g e . Th e l a s t th r e e a rg um e n t s a r e s i m i l a r t o the i n put a r g um e n t s f o r v a r i o us o th e r memo r y m a n ag em e n t sys t em s e r v i c e s th a t a r e d e sc r i b ed i n Ch a p t e r 1 3 . 1 8-4 I MAG E A C T I VAT I ON AND TERM I NAT I ON 1 8 . 1 . 1 . 2 Ove r v i ew o f Ima g e Ac t i v a t i o n - Th e r e a r e essent i a l ly two s t eps t h a t the i m a g e a c t i v a to r pe r f o rms e a c h t i m e th a t i t a c t i v a t e s a n i m ag e . F i r s t , i t o p e n s t h e i m ag e f i l e , wh i c h a l l o ws the s ys tem to pe r fo rm a l l o f i ts f i l e protec t i o n chec ks . Th e n t h e i m ag e h e a d e r i s r e a d a nd t h e i m a g e th a t i s d e sc r i b ed the r e i s m a pped i n to the user ' s v i r tua l add r e s s s pa c e . Th e mo s t i m po r ta n t c o n t e n t s o f the imag e h e a d e r a r e a s e r i e s o f i m a g e s e c t i o n d e s c r i p to r s , o n e fo r e a c h s e c t i o n in the imag e . E a c h o f the s e s t r uc t u r e s d e sc r i b e s a po r t i o n o f t h e i m a g e ' s v i r t ua l add r e s s s pa c e , a nd the i r c o n t e n t s wi l l b e u s ed by t h e image a c t i va to r a s i n put pa r am e t e r s to o th e r m emo r y m a n ag emen t sys tem s e r v i c es . Th e ov e r a l l s t r uc t u r e of a n imag e h e a d e r is p i c t u r ed in Figure 1 8-1 . Th e g e n e r a l f o rm o f a n i m ag e sec t i o n d e sc r i pt o r i s p i c t u r ed i n F i g u r e 1 8 - 2 . 1 8 . 1 . 1 . 3 Ac t i va t i o n o f a n Imag e w i th No G l o b a l S e c t i o n s - Mo s t o f t h e c ommo n o pe r a t i o n s tha t a r e pe r f o rmed by t h e i m a g e a c t i v a to r w i l l b e d e sc r i b ed i n the a c t i v a t i o n o f a n i m ag e tha t does no t c o n t a i n a n y g l o ba l sec t i ons . Th i s s e c t i o n c a n b e i n t e r p r e t ed a s t h e g e ne r a l f l o w th r o ug h t h e i m ag e a c t i v a to r . O th e r f o r m s o f a c t i v a t i o n wi l l be e x p l i c i t l y d e sc r i b ed i n l a te r s e c t i o ns b u t wi l l b e m e n t i oned i n th i s s e c t i o n wh en a pp r o p r i a t e . 1. Th e i m a g e a c t i v a t o r sc r a tc h a r e a i n P l s pa c e i s i n i t i a l i z e d . 2. Th e i m ag e f i l e i s o pe n ed a s a p r o c e s s pe rm a n e n t f i l e . 3. I f t h e i m ag e i s b e i ng a c t i v a t ed f r om a sequen t i a l d ev i c e ( ma g t a pe o r ac ross a n e two r k ) , then the a d d r e s s r a ng e i s c r ea t ed a n d t h e e n t i r e i mag e r e ad f r om th e s e q ue n t i a l file i n to v i r t ua l a d d r e s s s pa c e . Al l f ut u r e pag e f a u l ts w i l l b e r e s o l v ed f r o m t h e pa g e f i l e . 4. Th e f i r s t b l o c k o f t h e i m ag e h e a d e r i s r e a d i n to memo r y . At t h i s po i n t , the c h e c k f o r a c ompa t i b i l i t y mod e i m ag e is mad e . Th e c o n t e n t s o f t h e l a s t wo r d o f t h e f i r s t b l o c k o f the i mag e h e ad e r i nd i c a t e e i th e r a n i m ag e p r od uc ed by t h e VAX- 1 1 L i n k e r ( - 1 ) o r a n i m a g e p r od uc ed by s ome o th e r l i n k e r ( 0 o r po s i t i v e contents) • At p r e s e n t , o n l y o n e t ype o f c om pa t i b i l i t y mod e i m ag e is s u ppo r t ed . An i m ag e p r od uc ed by t h e RSX- l l M t a s k b u i l d e r h a s a z e r o i n th e c o d e wo r d a nd wi l l cause the a c t i va t ion o f SYS $ S YS TEM : RSX . EXE . Fu r th e r d e t a i l s a b o u t the a c t i v a t i o n o f a c o mpa t i b i l i t y m o d e i m a g e a r e fo und i n S e c t i o n 1 8 . 1 . 1 . 7 . 5. A t th i s po i n t , t h e i m ag e a c t i v a to r b eg i n s i t s mo s t i mpo r ta n t wo r k , th e s e t t i ng u p o f t h e p r o c e s s pag e t a b l e s t o r e f l ec t t h e a d d r e s s s pa c e p r od uc ed b y t h e l i n k e r . I t pe r f o rms th i s wo r k by r e a d i ng e a c h i mag e s e c t i o n d e sc r i pt o r c o n t a i n ed i n the i mage h e ad e r ( F i g u r e 1 8 -2 ) , d e t e rm i n i ng the type o f s e c t i o n th a t i s b e i ng d e s c r i b ed , a nd c a l l i ng the a pp r o p r i a t e m emo r y m a n a g eme n t s y s tem s e rv i c e to pe r f o rm th� a c t ua l m a pp i ng . 1 8- 5 � , Image Header 1-' 00 Image Itself I 0'\ Debug a n d Other Symbol Tables Image File ...,. , , , ,,' ® ® � \ \ \ \ \ ® \ \ \ ® Fixed Portion of Image Header Transfer Address Array Debug and Global Symbol Table Offsets .. \ Image Section I'� D e s c p to rs \ \ ._________ n_-________ :r Image Header Spare Offset to @ Offset to @ minor ID \ �lr Spare \ \ Patch Data (only found in patched images) I'� Size of Header � Image Name and JOENT S t ri n g s '\® Offset to @ \ \ Offset to © major 1 0 Privilege Mask Requested \ \ \ - \ \ \ \ Image 1/0 Segment Pages Image Flags \ \ - 1/0 Global Section 10 \ ' Image Header Header Blocks Channels System Version Number (if linked with SY S.STB ) Fixed Portion o f Image Header F igure 1 8 - 1 Contents of I image type n u m ber of pages in this section page fault c luster size of ISO (in bytes) I mage Section Flags s t a rt i n g v i r t u a l p a g e number for this sec tion type o • norm a l s e c t i o n f la g s end of demand ' 253 • user s t a c k • t------.... 7 ze r o s e c t i o n d e s c r i p t or --.. base v irtual block number -t ---------- e n d o f pro c e s s p r i v a t e s e c t i o n d e s c ri p t o r � in image file for this section ....-----------------1 ident for global section I-' CX) I -..J count - global section name Bit Meaning 0 Global 1 Copy on Reference 2 Demand Zero 3 Writable 4-6 Match Control Field 7 Last Cluster i n PO Space 8-1 6 Spare 17 Vector Contained in I mage Section 18 I m age Section is Protected - - e n d o f glo b a l s e c t i o n d e s c rip t o r ---- ..�• '---_. F igure 1 8 - 2 General Form of Image S ec tion D e s c r iptor t-1 3: > G'l tz:l (') > 1-i t-1 �1-i t-1 0 2! > 2! t:l 1-i tz:l " 3: t-1 2! > 1-i t-1 0 2! I MAG E ACT I VAT I ON AND TERM INAT I ON a. Th e mo s t c ommo n f o rm o f i m ag e s e c t i o n d e sc r i pto r tha t occurs in a " s i mpl e " i m ag e d e s c r i b e s a p r i v a te se c t i o n . Th i s t ype o f sec t i o n may be e i th e r r ead-on l y or r e a d/wr i t e , d e pend i ng o n t h e a t t r i b u t e s o f the p r og r am s e c t i o n s th a t mad e up e a c h s uc h i m ag e sec t i o n . Ini tial pag e f a u l t s fo r e a c h pag e i n th i s t ype o f s ec t i o n w i l l b e s a t i s f i e d f r om t h e a pp r o p r i a t e b l o c k s i n t h e i mag e f i l e . Wh e n t h e i m a g e a c t i v a to r e nc o un t e r s a n image sec t i o n d e sc r i pto r th a t d e sc r i b e s a p r i v a t e se c t i o n , i t us e s t h e c o n tents o f the i m ag e s e c t i o n d e sc r i pt o r as i nput a r g um e n t s t o the C r e a t e a nd Ma p ( P r i va t e ) S e c t i o n s ys t em service ( Fi g ur e 1 8 - 3 ) . Th i s r e s u l t s i n a s e r i e s o f pag e ta b l e entr i es th a t a r e p r o c e s s s e c t i o n t a b l e i nd i c e s . Th e n um b e r o f PTEs i s e q ua l to t h e pag e c o un t c o n t a i n e d in th e ISD. No t i c e tha t a l l o f t h e PT E s i nd ex t h e s a m e process sec t i o n . b. Ano th e r fo rm o f i m a g e s ec t i o n d e sc r i pto r that may be fo und in a n imag e 1 s a d emand z e r o s e c t i o n . Th e l i n k e r p r o d uc e s s uc h a s e c t i o n wh ene v e r t h e r e a r e f i v e ( o r some u s e r - s p e c i f i ed d e f a u l t n um b e r o f ) c o n s e c u t i ve pag e s i n t h e i m a g e f i l e tha t c o n t a i n a l l z e r o e s . Th e i m ag e file does no t c onta i n tho s e pag e s , b u t me r e l y a n i nd i c a t i o n ( i n t h e I S D ) tha t a c e r t a i n r a ng e o f v i r t ua l add r e s s s pa c e c o n t a i n s a l l z e r o e s . Wh e n th e i m a g e ac t i v a to r e n c o u n t e r s s uc h an i m a g e s e c t i o n d e sc r i p t o r , i t uses the c ontents o f the I SD a s i nput a r g umen t s t o the C r e a t e Vi r t ua l Ad d r e s s Spa c e s ys t em service ( Fi g ure 1 8 -4 ) . Th i s r e s u l t s i n a s e r i e s o f pag e ta b l e e n t r i e s tha t i nd i c a t e d em a nd ze ro pag e s . Th e n umbe r of PTEs i s e q ua l to the pag e c o un t c o n t a i n ed i n the I S D . No te tha t o n e s uc h s e c t i o n i s the a rea in Pl sp a c e that conta ins the us e r stac k . Th e l i n ke r d i f f e r e n t i a t e s th i s s pe c i a l d em a nd ze r o sect i on f r om o th e r s by a spec i a l c o d e b y t e i n the t ype d e s i g na to r i n the I S D . Th e i m ag e a c t i v a to r p u t s o f f t h e m a pp i ng o f t h e us e r s t a c k u n t i l l a te r i n t h e a c t i v a t i o n . c. 6. Th e th i r d f o rm o f i m ag e s e c t i o n d e sc r i p to r tha t the i m a g e a c t i v a to r m a y f i nd i nd i c a t e s tha t a r a ng e o f v i r t u a l a d d r e s s s p a c e i s to b e m a pped to a n e x i s t i ng g l o b a l sec t i on . Wh e n t h e i mage a c t i v a to r enco un t e r s s uc h a n i m ag e s e c t i o n d e sc r i pto r , i t cal l s i ts e l f r ec u r s i v e l y , r e q u e s t i ng th a t the g l o b a l i m ag e f i l e c o n t a i n i ng t h e r e q u e s t e d g l o ba l s e c t i o n b e a c t i v a t ed a s a pa r t o f the ac t i va t i o n o f a no r ma l e x e c u t a b l e i m ag e . Th e d e t a i l s o f th i s a c t i va t i o n w i l l b e d e sc r i b ed i n the n e x t s e c t i o n . A f t e r t h e i m ag e a c t i v a to r h a s p r o c e s s e d a l l the i m a g e s e c t i o n d e s c r i p t o r s , i t c a l l s the C r e a t e V i r t ua l Ad d r e s s Spa c e s ys t em s e r v i c e to c r e a t e the i m ag e I /O s egme n t . Th e s i ze of th i s a rea i s d e t e r m i ned by t h e s pe c i a l SYS B OOT pa r am e t e r IMG I OCNT ( d e f a u l t v a l ue o f 3 2 ) but may b e o v e r r i d d e n wi th a n I O S EGM ENT = n [ , [ N O ] P OBUFS ] entry i n a l i nk e r opt ions f i l e . I f a P O - on l y i m a g e i s b e i ng a c t i v a t ed , t h i s a r e a i s l o c a t ed a t t h e h i gh a d d r e s s end o f P O s pa c e w i th a n E x pa nd Reg i o n sys t e m s e r v i c e . 1 8-8 N u mber of P a g e s Pro c e s s S e c t i o n T a b le i n Process Header I S ize = • 16 • , • P a g e F ault C l us t e r B a se V irtual Page Number Type Section Flags Backw ard Link P r o c e s s S e c ti o n Page Fault Cluster Table Entry Base Virtual Block Number PO P a g e Table Image S e c tion D escriptor for Process Priv a t e Section 0 I \.0 0 N u mber of Pages Protection Owner Proc ess Section Table Index 3 1 30 2 726 24 23 22 15 II Base VPN 0 PSTX PSTX PSTX Base Virtual Block Number \ spare \ \ I Control Flags Count of PTEs ' Number of Pages ' 0 Protection is either UR or UW F i gure 1 8 - 3 I Forward Link Ptr. to W indow C ontrol Block in Image File .... 00 Ptr. to Channel Control Block I S D a n d P a g e Tab le Entr i e s for P roc e s s P r ivate S e c t ion N umber of Pages Page F a ult Cluster l Size = 32 GPTX Base VIrtual Block Number GPTX 0 G PTX 0 GPTX 0 GPTX Minor 10 I count Image Section Description for Global Section - -- Owner I t><J Pro tection 0 2 7 26 -- -- U _.. 1 I ..- 1 24 23 2 2 2 1 Protection is either U R or UW F igure 1 8 - 4 ...- ..- ..- "" , G PTX 0 Image Section Name 3 1 30 0 0 Major 10 : 1--' CX) I 1--' 0 ""' Base VPN Section Flags Type Global Page Table PO Page Table 0 GPTX 0 G PTX ""' ,III" "" , ""' ,. ""' ,. "" ,. ""' , "" , Global Page Table Entry GPTE GPTE GPTE GPTE GPTE GPTE GPTE I I Global Page Table Index 0 Global page table entries can take one of three forms. • GPTE Is valid. • GPTE Indicates a transition state. • GPTE contains a Global Section Table Index. I S D and Page Tab l e Entr i e s for Demand Z ero S e c tion IMAGE ACT IVAT I ON AND TERM INAT I ON 7. F i n a l l y , t h e ad d r e s s s pa c e t h a t i s to c o n ta i n the u s e r s ta c k i s c r e a t€d ( wi t h a n E x pa nd Reg i o n s ys t em s e rv i c e ) . Th e u s ua l l o c a t i o n o f t h e u s e r s t ac k i s a t the l ow a d d r e s s e nd of Pl spac e , wh e r e t h e a utom a t i c s ta c k e x pa n s i o n f a c i l i ty o f t h e e x c e p t i o n d i s pa t c h e r c a n a d d u s e r s t a c k s pa c e a s n e ed ed . Th e l o c a t io n o f t h e u s e r s ta c k i n P O -o n l y i m ag e s i s a t the h i g h a d d r e s s e n d o f the P O i m ag e . Th e d e f a ul t s i z e o f the u s e r s t ac k i s 2 0 p ag e s . c a n b e o v e r r i d d e n w i th a n S TACK = Th i s v a l ue n ent ry i n a l i n k e r opt ions f i l e . 8. Th e i n i t i a l v a l u e o f the u s e r s ta c k po i n t e r is s to r ed in the Pl s p a c e po i n t e r pag e a nd l o ad ed i n to t h e p r o c e s s o r r eg i s t e r PR$ USP. Th i s v a l ue w i l l b e l o ad ed i n to g e n e r a l r eg i s t e r 14 ( SP) wh e n a n RE I i n s t r uc t i o n r e t u r n s the p r o c e s s to us e r mod e , wh i c h u s u a l l y o c c u r s f o l l o w i ng the return f r om the i m a g e a c t i v a to r . 9. Th e p r i v i l eg e s th a t wi l l b e i n e f f e c t wh i l e t h i s i mag e is e x e c u t i ng a r e c a l c u l a t ed . Th e l og i c a l AND o f the p r i v i l eg e m a s k f o und in the i m ag e h e ad e r ( c u r r e n t l y e n a b l i ng all p r i v i l eg e s a n d s o e f fec t i vel y unused ) w i th the proce s s pe rma n e n t p r i v i l eg e mask ( fo und at g l oba l loc a t i on C T L $ G Q PROCPR I V i n th e P l po i n t e r pag e ) i s t h e n ORed wi th t h e p r i v i leg e e nh a n c em e n t s f o r a p r i v i l eg ed known i m ag e . Th e r e s ul t is l o a d ed i n to the p r o c e s s p r i v i l eg e m a s k i n t h e PCB ( PC B $ Q P R I V ) and i n to two p r i v i l eg e m a s k s i n the p r o c e s s h e a d e r� a t o f f s e t PHD $ Q PR I VMSK ( th e m a s k t h a t i s ac t ua l l y c h e c k e d by o t h e r r o u t i n e s- i n the sys t e m ) a nd at o ffset PHD $ Q I MAG PR I V . Th e u s e s o f t h e va r i o u s pr i v i l eg e ma s ks by the sys t em i s d e sc r i b ed S e c t i o n 1 8 . 4 . 10. A c h e c k i s m a d e to d e te rm i n e wh e th e r the i m ag e wa s l i n k ed w i th the sys t em s ymbo l t a b l e SYS $ S YS TEM : SY S . S TB . If s o , a c h e c k i s mad e t o d e t e rm i n e th a t the v e r s i o n o f t h e s ymb o l tabl e a g r e e s w i th t h e c u r r e n t l y r unn i ng s ys t e m v e r s i o n . If t h e v e r s i o n n um b e r s d i s ag r e e , CMKRN L and CMEXEC p r i v i l eg e s are t u r n ed o f f i n t h e c u r r e n t p r i v i l eg e m a s k . Th i s p r e v e n t s m a n y d i f f e r e n t s p u r i o u s e r r o r s tha t c a n o c c u r i f t h e o u td a t e d i m a g e we r e t o e x e c u t e . 11. At th i s po i n t , t h e i m ag e a c t i v a to r h a s f i n i sh ed i t s wo r k . It l oad s a f i na l s t a t us i n to R O and returns t o i ts cal l e r ( e i th e r PROC STRT o r a C L I ) t o a l l o w t h e i m a g e i tse l f t o be c a l l ed . 1 8 . 1 . 1 . 4 Ac t i v a t i o n o f I m a g e C o n t a i n i ng G l o ba l S e c t i o n s - As m e n t i o n ed i n the p r ev i o u s s e c t i o n , wh en the i m ag e a c t i v a to r e n c o un t e r s a n i m a g e se c t i o n d e sc r i p to r tha t d e sc r i b e s a g l o b a l s e c t i o n , i t c a l l s i tsel f r ec ur s i ve l y , a l tho ug h a d i f f e r e n t i mag e f i l e i s i nd i c a t e d o n t h e r e c u r s i v e c a l l a nd d i f f e r e n t f l ag s a r e s e t . Th e pu r po s e o f t h e r e c u r s i v e c a l l i s to p r ev e n t a n o n p r i v i l eg ed user wh o h a s l i nked his i m ag e to a p r i v i l eg ed sha reab l e i mag e f r om a c q u i r i ng una utho r i z e d p r i v i l eg e . Put s i mp l y , VM S d o e s n o t t r u s t the 1 8-1 1 I MAG E ACT IVAT I ON AND TERMINAT ION s e c t i o n d e sc r i p to r s tha t it f i nd s i n t h e us e r ' s i m a g e f i l e i ma g e b e c a u s e t h e u se r c a n p u t a lm o s t a ny t h i ng h e p l e a s e s th e r e . Th e i m a g e a c t i v a to r wo u l d l i k e to r ea d t h e o r i g i na l i m ag e s e c t i o n d e sc r i pt o r tha t is f o und in the s h a r e a b l e i mag e f i l e , p r e s um a b l y p r o t e c t e d f r om w r i t e a c c e s s b y n o n p r i v i l eg ed us e r s . Th e s i mpl e s t wa y to a ccompl i sh th i s i s to h av e t h e i m a g e a c t i v a to r c a l l i t s e l f , wh i c h w i l l r e s u l t i n the sha r e a b l e i m ag e f i l e b e i ng o pe n e d , b u t w i th a n i mp l i c i t p r o t ec t i o n c h e c k b e i ng p e r fo rmed f o r t h e c u r r e n t u s e r . Wh e n t h e i m ag e a c t i v a to r p r o c e s s e s t h e i m ag e s e c t i o n d e s c r i pto r s fo r e ac h sec t i on i n t h e sha r e a b l e i m ag e , i t a l s o maps e a c h s e c t i o n i n to t h e u s e r ' s a d d r e s s s pa c e w i th a Ma p G l o b a l Sec t i on s ys t em s e rv i c e ( Fi g u r e 1 8- 5 ) . Any v e r s i o n c h e c k i ng ( to i n s u r e th a t t h e i n s t a l l ed s h a r e a b l e i m a g e i s c ompa t i b l e w i th t h e s h a r e a b l e i m ag e th a t wa s l i n k e d i n to the u s e r ' s e x e c u ta b l e imag e ) i s pe r f o rmed by t h e Ma p G l o b a l S e c t i o n s y s t e m s e r v i c e a nd no t d i r e c t l y b y t h e i m ag e a c t i v a to r . One b e n e f i c i a l s ide effect o f the r ec u r s i v e c a l l to the i m ag e a c t i va t o r fo r sha r e a b l e imag e s is tha t t h e y d o no t h a v e to b e fo r ( I n f a c t , t h e i m a g e a c t i v a to r o n l y a l l o ws th i s o pt i o n i n s t a l l ed . r ea d - o n l y s h a r e a b l e i m ag e s . ) In t h e c a s e th a t the r e q u e s ted g l o b a l s e c t i o n d o e s no t e x i s t , t h e i m a g e a c t i v a to r pe r fo rms a C r e a t e a nd Ma p ( Pr i va t e ) S e c t i o n s ys t em s e rv i c e . In the c a s e o f an i n s t a l l ed s h a r e ab l e i m ag e , a C r e a t e ( Bu t Do No t Ma p ) Global S e c t i o n s ys tem s e rv i c e wa s p r ev i o u s l y e x e c u ted b y t h e i m ag e a c t i v a to r a s a pa r t o f t h e i n i t i a l i ns ta l l a t i o n o f a known s h a r e a b l e i m ag e . 18. 1. 1. 5 I n i t i a l Ac t i va t i o n o f Known Ima g e - Known i m ag e s two m a i n p u r po s e s i n VAX/VM S . • • ex i s t fo r Imag e s th a t r e q u i r e e n h a n c ed pr i v i l eg e s b u t mus t e x e c u t e in n o n p r i v i l eg ed p r o c e s s c o n t e x t ( s uc h a s MOUNT , S E T , and S HOW ) m u s t h a v e some me thod f o r a c q u i r i ng the i r e l eva t ed pr i v i l eg e s b e f o r e th e imag e e x e c u t e s a nd r e s t o r i ng p r o c e s s pr i v i l eg e s wh e n th e i m a g e t e rm i n a t e s . Sh a r e a b l e i m a g e s ( e spec i a l l y tho s e tha t i n c l ud e pr i v i l eg ed s e c t i o n s a nd tho se th a t e x i s t i n sh a r ed memo r y ) m u s t a l so b e m a d e k n o wn t o t h e sys t em . Th e I N S TA L L u t i l i ty i s u s e d to r e q u e s t the i n i t i a l ac t i va t i o n o f known i m ag e s . It cal ls t h e i m ag e a c t i v a to r w i th the NOAC T I VATE f l ag s e t , t e l l i ng t h e i ma g e a c t i v a to r to go th r o ug h the mo t i o n s o f i m ag e a c t i v a t i o n b u t no t to a c t ua l l y a l t e r the a d d r e s s s pa c e o f the p r o c e s s i n wh i c h I N S TA L L i s ex e c u t i ng . Th e c r uc i a l s t ep tha t t h e i m ag e a c t i v a to r pe r f o rms wh e n it f i rst acti vates a kn own i mag e i s t h e c r e a t i o n o f a d a ta s t r uc t u r e c a l l ed a k n o wn f i l e e n t r y ( F i g u r e 1 8 - 6 ) i n the known f i l e e n t r y l i s t . On l a t e r o pe n s of th i s f i l e , RMS w i l l r e t u r n t h e a d d r e s s o f th i s s t r uc t u r e t o t h e i m a g e a c t i v a to r , i nd i c a t i ng t h a t a k n o wn i m a g e i s b e i ng ac t i v a ted . 1 8-12 Process Page Table Size Number of Pages = 12 Page Fault Cluster Base VIrtual Page Number Type Section Flags .... (X) I m a g e S e c t i o n D e s c ri p t o r f o r Demand Z ero Section I .... w Number of Pag es 0 Demand Z e ro 0 Demand Z e ro 0 Demand Z ero 0 Demand Z e r o 0 Demand Z e ro 0 Demand Z e ro 0 Demand Z e ro 0 Demand Z e ro 0 Demand Z ero 0 Demand Z eJ"o , , Protec t ion Owner All Z eros 31 30 27 26 24 23 2 2 F igure 1 8 - 5 20 0 I S D and P age Tab l e Entr i e s for G l ob a l S e c tion K n o w n File H e a d e r ( K F H ) K n o w n F il e E n t ry ( K F I ) � ' Known File Queue Forward Link Known File Queue Backward Link C o n t rol Bits 1-zj ..... I.Q c 1"1 ro .... 00 I 0'\ .... 00 I .... � Byte Offsets within Structure to. . . File File D;•ecto•y Name Name KFI KF I Sequence Q -Number Number Globel Section C o unt - 1 Address of A ss o c i a t e d K F I Spare � De•;ce Name Reference Count Known Image Flags - I Type I Size of KFH Image Header of Known File that was Installed /HEADER._RESIDENT �� �� Usage C o unt e r Pointer to WCB if file opened File ID/ Sequence Number if not 0 Hl I"%J ..... .... ro I Size of KFI Type I"%J 0 1"1 9 Ill rt :;:.;: :;:3 0 � :;:3 Type Address o f End o f KFH -- Image Header Address if Header Resident - Privileged Image Privilege Mask tzl :;:3 rt 1"1 "< AME Code Number f ro m Image Header S p a re One of these I n Paged Pool for each known file lnstalled/HEADER_RESIDENT - 1 Match Control Global Section Identification ,� Counted Strings for Device Name. Directory. File Name. File T YP e One of these for each Installed Image F i gure 1 8 - 6 l" v y Format o f Known F i le Entry L � IMAGE ACT IVATI ON AND TERM INATI ON Th e r e i s a t h i r d b e n e f i t to m a k i ng i m ag e s known to t h e sys t e m . Th e i r a c t i v a t i o n m a y b e f ac i l i ta t e d b y o n e o f s e v e r a l o p t i o n s g i v e n wh e n t h e i m a g e i s i n s ta l l ed . 1. At th e v e r y l e a s t , t h e i mag e a c t i v a to r s a v e s the f i l e I D a nd s equenc e n umbe r wh e n i t o r i g i n a l l y a c t i v a t e s t h e i m ag e s o t h a t f u t u r e o pe n s m a y b e b y f i l e I D r a t h e r than by f i l e n a m e . 2. Th e i m a g e f i l e c a n be i n s t a l l ed / O PEN , wh i c h wi l l l eave the In th i s c a se , t h e a c t ua l O PEN c a l l to RMS i s f i l e o pened . e s s e n t i a l l y a n u l l o pe r a t i o n . 3. Th e /H EADER R E S I D ENT o p t i o n c a n b e spe c i f i ed to the I N S TA L L u t i l i t y , whTch d i r e c t s t h e i m ag e a c t i v a to r t o k e e p t h e e n t i r e i ma g e h e ad e r r e s i d e n t i n pag e d d yn am i c m emo r y . Th i s saves the add i t i o nal r e ad s tha t a r e r eq u i r ed to b r i ng th e h e a d e r i n t o memo r y e a c h t i m e t h a t t h e i m ag e i s a c t i v a t ed . 18. 1.1.6 La t e r Ac t i v a t i o n o f Known Imag e - Wh e n a known i m ag e is a c t i va t ed , the i m ag e a c t i v a to r is i n f o rmed by RM S , wh o pl a c e s t h e a d d r e s s o f t h e k n o wn f i l e e n t r y i n t h e CTX f i e l d of the FAB . Of c o u r se , t h e o pe n m a y h a v e b e e n e a s ed by o n e o f t h e o p t i o n s m e n t i o n ed in the p r ev i o u s s e c t i o n . Th e a c t i v a t i o n o f a k n o wn i m ag e r eg u l a r i m ag e , a l tho ug h some o f pe r f o rm i n the r eg u l a r c a s e c a n k n o wn i m ag e t h a t h a s i t s h e a d e r b e c a u s e the I /0 o v e r h e a d c a n b e p r o c e e d s i n muc h t h e s am e wa y a s a the wo r k t h a t the imag e a c t i v a to r m us t be a v o i d ed here . I n pa r t i c u l a r , a r e s i d e n t c a n be ac t i va ted mo r e q u i c k l y avo i d ed . In a ny c a se , t h e i m ag e s e c t i o n d e sc r i p to r s m u s t s t i l l be p r o c e s s e d and the pag e tab l e entr i e s set up s o tha t the i m ag e m a y e x e c u t e . In ad d i t i o n , the i m ag e ac t i v a t o r m u s t upd a t e t h e u s a g e stat i st i c s ( F i g u r e 1 8 - 6 ) f o r th i s known i m ag e . 18. 1 . 1 . 7 Ac t i v a t i o n o f Compa t i b i l i ty Mo d e Imag e s - Wh e n the i m ag e a c t i v a to r d e t e rm i n e s th a t i t i s a t temp t i ng to a c t i v a t compa t i b i l i t y mod e i m a g e , i t d o e s a c h a ng e o f c o u r s e a nd a c t i v a t e s an AM E th a t is d e s i g n a t e d b y t h e c o d e wo r d i n t h e l a s t wo rd o f t h e f i r s t b l o c k o f t h e i m ag e h e a d e r . At the present t ime , there is only one fo r m o f c ompa t i b i l i ty m o d e imag e a nd o n e AM E s uppo r t ed . Th e R S X- l l M AM E ( S YS $ S YS TEM : RSX . EXE ) wi l l be a c t i v a t ed wh eneve r an i ma g e h e a d e r c o n t a i n s a ze r o i n the c o d e wo r d . u An AME i s i t s e l f a n a t i v e m o d e i m a g e t h a t i s r e s po n s i b l e f o r m a pp i ng the c omp a t i b i l i t y m o d e image i n to the add r e s s r a ng e be t we en 0 a n d 1 0 0 0 0 ( h e x ) ( F i g u r e 1 - 8 ) , p a s s i ng c o n t r o l to th a t i mag e wh i l e t u r n i ng o n the c ompa t i b i l i t y mod e b i t ( w i th a n RE I i n s t r uc t i o n ) , a nd f i e l d i ng all c om pa t i b i l i ty m o d e a nd o th e r e x c e pt i o n s g e n e r a ted by the c om pa t i b i l i ty m o d e i m ag e . F r om th e po i n t o f v i e w o f i m a g e a c t i v a t i o n , o n c e t h e i mage a c t i v a to r d e te rm i n e s that it i s a c t i v a t i ng a c ompa t i b i l i t y mod e i m ag e , i t c o n t i n u e s wi th a c t i v a t i o n , b u t a c t i v a t i o n o f t h e AME a nd no t the c ompa t i b i l i t y m o d e i m ag e . Th e n a m e o f t h e c ompa t i b i l i t y m o d e i m a g e i s s to r ed i n the c om pa t i b i l i ty mod e pag e ( at g l obal location C T L $ AG C M E DATA ) i n P l s p a c e wh e r e i t wi l l be r e t r i ev ed by t h e AME a nd m a pped - i n to the l o we s t 6 4 K b y t e s o f P O s pa c e . 18-1 5 IMAGE ACTI VATI ON AND TERM INAT ION 18 . 1 . 2 Imag e S t a r t up A f t e r t h e pag e t ab l e s h a v e b e en s e t up b y t h e imag e a c t i va to r , the i m ag e i s c a l l ed a t i t s t r a n s f e r a d d r e s s . De pend i ng o n ho w the i mag e wa s l i n k e d , t h e i n i t i a l t r an s f e r o f c o n t r o l m a y be to a d eb ug g e r , to a u s e r - s uppl i ed i n i t i a l i z a t i o n p r o c ed u r e , o r to t h e u s e r i m a g e i t s e l f . 18. 1. 2. 1 T r a n s f e r Ve c to r Ar r a y - I n add i t i o n to the i m ag e sec t i on d e sc r i p to r s d i s c u s s e d i n the p r ev i o u s s ec t i o n , the l i nk e r a l so i nc l ud e s a d a ta s t r uc t u r e c a l l ed a t r a n s f e r v e c to r a r r a y i n the imag e Th i s a r r a y c o nta i n s t h e use r s upp l i ed t r a n s f e r a d d r e s s a nd h e ad e r . a l s o the m e a n s f o r i nc l ud i ng a d eb ugg e r o r a t r a c eb a c k h a nd l e r i n the u s e r imqg e . Th e f o r m a t o f the t r an s f e r v e c t o r a r r a y i s p i c t u r ed i n Figure 1 8-7 . I f a d eb ug t r ans f e r a d d r e s s i s spec i f i ed o r i mpl i ed , i t appe a r s f i r s t in the l ist . An i ma g e - s p e c i f i c i n i t i a l i za t ion p r o c ed u r e , if s pe c i f i ed , o c c u r s n ex t . Th e l a s t e n t r y i n the l i s t i s the t r a n s f e r a d d r e s s o f t h e u s e r i m ag e , e i th e r the a rg um e n t o f a . END d i r e c t i v e f o r a VAX- 1 1 MACRO p r o g r am or t h e f i r s t s t a t e m e n t o f t h e m a i n p r o g r am wr i t t e n i n a h i g h l ev e l l a ng u a g e . A f o u r th s l o t c o n t a i n i ng a z e r o is the e nd o f l i s t i nd i c a t i o n , n o m a t te r wh a t o p t i o n s we r e pa s s ed to t h e l i nke r . SYS$1MGSTA Transfer address of user image I 0 I - - - I 1 0 no entries in PSECT LIB$1NITIALIZE - LIB$ INITIALIZE - - - - Transfer address of user image I 0 I I $LINK or $LINK/DEBUG or $LINK/DEBUG filespec = 0 I I 0 0 Transfer address of user image I Transfer address of user image - LIB$ INITIALIZE I 0 - SYS$1MGSTA - - - - - $LINK/NOTRACEBACK non-zero c ontribution to PSECT LIB$1NITIALIZE Figure 1 8-7 0 T r a n s f e r Ve c to r Ar r a y Th e i n i t i a l i za t i o n t r a n s f e r a d d r e s s i s d e sc r i b ed i n Appe nd i x E o f the VAX - 1 1 Run - T i m e L i b r a r y Re f e r en c e Ma n ua l a nd w i l l no t be d i s c u s s ed here . 1 8- 1 6 IMAGE ACT I VAT I ON AND TERM INAT I ON I f the /D E B UG= f i l e s pec o p t i o n i s i nc l ud ed a s a q ua l i f i e r to the L I NK c omma n d , the l i n k e r p l a c e s t h e t r a n s f e r a d d r e s s f o und in f i l e s pec i n t h e f i r s t e l em e n t i n t h e t r a n s f e r v e c t o r a r r a y . I f the /NOTRAC EBAC K o pt i o n is i nc l ud ed { and no t o v e r r i d d e n i mp l i c i t l y by i nc l ud i ng a n e xp l i c i t / D E B UG o pt i o n ) , t h e n t h e r e i s n o d eb ug t r a n s f e r a d d r e s s . In a l l o th e r c a se s , t h e l i n k e r p l a c e s t h e a d d r e s s o f SYS $ IMG S TA ( fo und i n t h e sys t e m s e r v i c e v e c to r a r e a ) i n t h e f i r s t e l ement o f t h e transfer v ec t o r a r r a y . I m a g e S t a r t up S y s tem S e rv i c e - Un l e s s e x p l i c i t l y s upp r e s s e d ( w i t h t h e /N OTRAC E BAC K q ua l i f i e r ) , all imag es e x ec ute t h e Imag e S t a r t up s ys t e m s e rv i c e , s om e t i m e s c a l l ed t h e d e b ug g e r boo t s t r a p . Th i s p r o c ed u r e e x am i n e s the v a r i o us l i nk a nd C L I f l a g s a nd d e t e r m i n e s wh e t h e r t o s ta r t the user i mag e d i r e c t l y o r m a p t h e d e b ug g e r ( s pec i f i ed b y t r an s l a t i ng t h e l og i c a l n a m e L I B $DE BUG ) i n to t h e u s e r ' s P O s pa c e a nd t r a n s f e r r i ng c on t r o l t o i t . 18. 1. 2. 2 I n a n y c a s e , a c o nd i t i o n h a nd l e r i s e s t a b l i shed i n t h e c u r r e n t c a l l f r am e th a t w i l l e v e n t ua l l y g a i n c o n t r o l o n s i g n a l s t h a t t h e u s e r d o e s n o t hand l e d i r e c t l y . On e o p t i o n tha t th i s h a nd l e r c a n ex e r c i s e i s t o map the t r a c ebac k f a c i l i ty t h a t w i l l p r i n t a s ym bo l i c d um p o f the e x c e pt i o n . 1. Imag e S t a r t up f i r s t p u r g e s the e n t i r e proc e s s wo r k i ng s e t o f all P O and P l p a g e s . Th i s h a s t h e e f f e c t o f e l i m i n a t i ng C L I p a g e s a n d o th e r pa r t s o f t h e a d d r e s s s p a c e t h a t w i l l no t b e n e ed ed b y th e i m ag e t h a t i s a bo u t t o e x e c u t e . 2. Th e nex t s t e p t h a t Imag e S t a r t up pe r fo rm s i s a po t e n t i a l m a p of a d e b ug g e r i n to P O s pa c e . Th i s m a p wi l l o c c u r und e r two d i f f e r e n t c o nd i t i o n s . a. I f t h e p r og r am wa s l i nk e d L I NK/D E B UG a nd s i mpl y r un i s , n o t r un w i th a RUN/NODEBUG c omma nd ) . ( tha t b. If t h e p r og r am wa s r un w i th a RUN/D E B UG c omma n d , i nd e pend e n t o f wh e th e r the d eb ug g e r wa s r e q u e s t ed a t l i n k t i me . Th e d e bug g e r w i l l n o t b e m a pped i f t h e i m ag e i s r un w i th a R UN/N ODE B UG c omma n d o r i f t h e / D E B UG o pt i o n wa s o m i t te d f r om b o th th e L I N K c o mma n d a nd the RUN c omma nd . 3. F i n a l l y , a c o nd i t i o n h a nd l e r i s e s t a b l i sh e d i n the c ur rent c a l l f r am e , t h e a r g um e n t l i s t i s a l te r ed to po i n t to t h e n e x t a d d r e s s i n t h e t r a n s f e r v e c to r a r r a y , a nd c o n t r o l i s pa s s ed to the nex t t rans fer address . Th i s w i l l be e i th e r the Run - T i m e L i b r a r y p r o c ed u r e LI B $ I N I TIALI Z E o r th e t r ansfer a d d r e s s o f t h e u s e r i m ag e . 18. 1.2. 3 Except i o n Ha nd l e r fo r T r a c eb a c k - Th e c o nd i t i o n h a nd l e r th a t wa s e s ta b l i sh e d b e fo r e t h e imag e wa s c a l l ed h a s two p u r po s e s . • • I t i n vo k e s a d e b ug g e r i f a DEBUG c omma nd i s i ma g e i s i n t e r r up t ed w i th a C TRL/Y . t yped after I t i nvo k e s t h e t r a c e ba c k h a nd l e r to prod uc e a s ymbo l i c d ump i f a n u n f i e l d ed c o nd i ti o n o c c u r s . 1 8- 1 7 an s tac k I MAGE ACT I VATION AND TERM INAT I ON I f a n o n p r i v i l eg ed i m ag e i s i n t e r r up t e d w i th a CTRL/Y , and a DEBUG c omma nd i s e x e c u t ed , t h e DC L ( o r M C R ) c omma nd i n t e r p r e t e r g e ne r a t e s a s i g n a l o f the f o rm S S $ D E B UG . ( P r i v i l eg ed i m a g e s a r e s i mpl y r un d o wn in r esponse to a C TRL/Y . ) As s um i ng t h a t any hand l e r s e s t a b l i shed b y the i m ag e r es i g na l the S S $ DEBUG e x c e pt i o n , t h i s h a nd l e r wi l l e v e n t ua l l y g a i n c o n t r o l . I t s re s po n s e to a S S $ D E B UG s i g na l i s to m a p t h e d eb ug g e r s pe c i f i ed b y t h e l og i c a l n a m e L I B $DE BUG (if it is no t a l r e a d y ma pped ) a n d t r a n s f e r c o n t r o l to i t . No t i c e th a t a n i ma g e th a t wa s n e i th e r l i nk ed no r r un w i th the d eb ug g e r c a n s t i l l b e d eb ug g ed ( a l b e i t w i tho u t a d eb ug s ymbo l t a b l e ) i f t h e p r og r am r e a c h e s some ug l y s ta t e s uc h a s a n i n f i n i t e l o o p . Th e s e c o nd p u r po s e o f th i s h a nd l e r i s t o f i e l d any e r ro r c o nd i t i o n s ( wh e r e t h e s eve r i t y l ev e l i s WARN I NG , ERROR , o r S E VE R E ) a n d pa s s them on t o the t r aceba c k f ac i l i ty . Th i s r eq u i r e s th a t the f ac i l i ty ( d e n o ted by the l og i c a l n am e L I B $ TRAC E ) be m a pped i n to the us e r P O s pa c e . An y c o nd i t i o n s t h a t h a v e a s ev e r i t y l ev e l o f e i th e r NORMAL o r I NF O a r e r e s i g n a l l ed , wh i c h i mp l i e s t h a t th e y w i l l b e h a nd l ed by t h e c a t c h a l l c o nd i t i o n h a nd l e r e s t a b l i s h e d by e i th e r PROC STRT o r the C L I t h a t c a l l ed t h e i m a g e . I MAGE EXIT 18. 2 Wh e n a n i ma g e wi s h e s to pa s s c o n t r o l b a c k t o VM S a f t e r i t has i t s wo r k , i t c a l l s S YS $ E X I T e i th e r d i r e c t l y o r by r e tu r n i ng c om p l e t ed t o i t s c a l l e r ( e i th e r PROC S TRT o r some c ommand l a ng uag e i n t e r p r e te r ) who executes the c a l l to SYS $ E X I T . Th e p r o c ed u r e SYS $ E X I T s i m p l y c a l l s wh a t eve r t e r m i na t i o n h a nd l e r s h a v e b e e n d ec l a r e d by t h e pr o c e s s a nd th e n d e l e te s t h e p r o c e s s . Te r m i n a t i o n h and l e r s a l l o w a n i m ag e to pe r fo rm i m a g e - s p e c i f i c c l e a n up o pe r a t i o n s b e fo r e the i mag e g oe s a wa y . Th e y a l so a l l o w i m a g e s t o e x e r t s om e c o n t r o l o v e r wh e th e r a nd wh e n they w i l l t e rm i n a t e . Th e u s e of a s upe r v i s o r m o d e t e rm i n a t i o n h a nd l e r by t h e VM S c omma nd l ang ua g e i n t e r p r e t e r s t o p r ev e n t p r o c e s s d e l e t i o n f o l l o w i ng imag e ex i t is d i sc us s ed i n Ch a pt e r 2 0 . 18. 2.1 Co n t r o l Fl ow o f the Ex i t Sys tem S e r v i c e Th e s t e ps l i s ted b e l o w s h o w h o w t h e Ex i t s y s t e m s e r v i c e , a p r o c ed u r e t h a t exec utes i n k e r n e l m od e , calls a s uc c e s s i o n o f t e rm i n a t i o n h a nd l e r s f o r a g i v e n a c c e s s mod e a nd i l l us t r a t e s h o w t e rm i n a t i o n h a nd l e r s c a n b e u s ed to p r ev e n t i m ag e e x i t . Th e VAX/VMS Sys tem S e r v i c e s Re f e r enc e Ma n ua l d e s c r i b e s h o w t e rm i n a t i o n h a nd l e r s a r e d ec l a r ed a nd t h e a rg um e n t l i s t tha t w i l l be pa s s ed to t h e h a nd l e r s wh e n t h e y a r e c a l l ed b y t h e E x i t s y s t e m s e rv i c e . 1. Th e f i n a l s t a t u s o f t h e i m ag e ( th e s i ng l e a rg um e n t to the E x i t s y s tem s e rv i c e ) i s s to r ed i n t h e P l po i n t e r pag e f o r po s s i b l e i n s e r t i o n by De l e t e P r o c e s s i n to a t e rm i na t i o n m a i l bo x . Th e f o r c e e x i t p e nd i ng f l ag i n t h e s t a t us l ong wo r d ( PC B $ L_S TS ) i n t h e P C B i s c l e a r ed . 2. I f SYS $ E X I T wa s c a l l ed f r om k e r n e l m o d e , t h e n the p r o c e s s is s i m p l y d e l e t ed . I f SYS $ E X I T wa s c a l l ed f r om any o th e r a c c e ss mod e , t h e n t h e t e rm i n a t i o n h a nd l e r l ist ( Fi g ur e 1 8-8 ) is s e a r ch e d f o r h a nd l e r s th a t h a v e b e en d ec l a r ed , b eg i nn i ng wi th the a c c e s s m o d e o f the c a l l e r a nd p r o c e ed i ng towa r d i nn e r ( mo r e p r i v i l eg e d ) a c c e s s m o d e s . 18-18 I MAG E ACT I VATI ON AND TERM INAT I ON On c e a n o n z e r o l i s t po i n t e r i s f o und , a c c e s s mod e is r a i s ed ( p r i v i l eg e l o we r ed } w i t h a n RE I a nd t h e l a s t t e rm i n a t i o n h a nd l e r t h a t wa s d e c l a r ed i s c a l l ed . Wh e n ( i f } tha t h a nd l e r r e turns to S YS $ E X I T � t h e n e x t h and l e r i n the l i s t i s c a l l ed a nd so o n un t i l t h e l i s t i s e x h a u s t ed . 3. SYS $ E X I T a v o i d s a n i n f i n i te l o o p by s to r i ng the l i s t po i n t e r in a r eg i s t e r a nd c l e a r i ng t h e l i s t po i n te r i t s e l f . Wh e n t h i s l i s t po i n t e r i s n e x t e x am i n ed ( s te p 4 ) , the l i s t w i l l b e emp t y . 4. On c e a l l t h e t e rm i n a t i o n h and l e r s fo r a g i ven a c c e s s m o d e have been p r o c essed , SYS $ E X I T m u s t g e t bac k to a mo re p r i v i l eg ed a c c e s s m o d e . I t a c c om p l i sh e s th i s by c a l l i ng i tse l f . I f none of the e x i t h a nd l e r s i n the l i s t j us t p r o c e s s e d h a v e d o n e a ny t h i ng e x t r a o r d i n a r y ( s uc h a s d e c l a r i ng a no t h e r t e rm i n a t i o n h a nd l e r } , t h e n the l og i c d e s c r i b ed i n s t e p 3 w i l l f i nd the l i st emp t y a nd p r o c e ed to the n e x t i nn e r a c c e s s mo d e i n i t s s e a r c h fo r m o r e t e rm i n a t i o n h a nd l e r s . E x ampl e o f T e rm i n a t i o n Hand l e r L i s t P r o c e s s i ng 18. 2 . 2 To i l l u s t r a te the p r o c e s s i ng o f t e rm i n a t i o n h a nd l e r s , s uppo se th a t a process has i ts t e rm i n a t i o n h a nd l e r l i sts set up a s s h o wn in Figure 1 8-8 . Wh e n the i m ag e c a l l s SYS $ E X I T f r om us e r mod e , the fo l l o w i ng s t eps a r e t a k e n . 0 (ex ec) (exec) E F (declared first) (declared second) 1---1 0 ( super) D , (user) A ( declared first, called last address in which to store reason for exit <!! � additional arguments J.� (user) B (declared second) F i g ur e 1 8-8 : : CTL$GL_THSUPR forward link exit handler address 0 0 1. , : : CTL$ GL_THEXEC I N S amp l e Te rm i n a t i o n Hand l e r L i s t s use r Th e t e rm i n a t i o n h a nd l e r l i s t i s s e a r c h e d beg i nn i ng w i th the mod e . A nonze ro l i s th e a d is fo und , po i n t i ng to the l ast t e rm i n a t i o n h a nd l e r c o n t r o l b l o c k f o r p r o c e d u r e C , t e rm i n a t i o n h a nd l e r d e c l a r ed f o r u s e r mode . 18-19 I MAGE ACTIVAT I ON AND TERMINAT I ON 2. Th i s a d d r e s s i s s to r ed i n RO a n d t h e l i s th e ad fo r u s e r mod e i s c l e a r ed . Ac c e s s m o d e i s r a i s e d to u s e r a nd p r o c ed u r e C i s c a l l ed . Wh e n C r e t u r n s , p r o c ed u r e B a n d f i n a l l y p r o c e d u r e A a r e c a l l ed . Wh en A r e t u r n s , SYS $ E X I T d e t e rm i n e s th a t t h e l i s t f o r us e r mod e i s e x h a u s t e d ( be c a us e i t s fo r wa rd po i n t e r conta i ns a z e r o ) . SYS $ E X I T i s c a l l ed ag a i n f r om us e r m od e . 3. As i n s t e p 1 , t h e s e a r c h f o r t e rm i na t i o n h a nd l e r s b eg i n s wi th u s e r mo d e but th i s l i s t is n o w emp t y . Th e s e a r c h c o n t i n ue s t o s upe r v i s o r mod e wh e r e t h e s i ng l e t e rm i n a t i o n hand l e r D h a s b e e n d e c l a r ed . Th e s upe r v i so r l i s th e a d i s c l e a r ed , a c c e s s mod e i s r a i s ed to s upe r v i so r , a nd p r o c ed u r e D i s c a l l ed . Wh e n D r e turns , SYS $ E XI T i s a g a i n c a l l ed , th i s t i m e f r om s upe rv i s o r mo d e . 4. Now t h e s e a rch fo r t e rm i n a t i o n h a nd l e r s b eg i n s wi th s upe rv i s o r mo d e , wh o s e l i s t is empty . Th e l i s t fo r e x e c u t i v e mod e c o n t a i n s two t e r m i n a t i o n h a nd l e r s , F a nd E , wh i c h wi l l b e c a l l ed in turn f r om e x e c u t i v e a c c e s s mod e . Wh e n th e y r e tu r n , SYS $ E X I T wi l l ag a i n b e c a l l ed , th i s t ime f r om e x ec u t i v e a c c ess mod e . Th e s e a r c h th a t n o w beg i n s wi th the e x e c u t i v e mod e l i s th e ad wi l l f a i l a nd the process wi l l be d e l eted . Th e l og i c i l l u s t r a t e d h e r e shows h o w a proc ess c an prevent i mag e t e rm i n a t i o n th r o ug h the u s e o f t e rm i n a t i o n h a nd l e r s . Fo r e x am p l e , i f a ny o f t h e hand l e r s c a l l ed i n s upe r v i so r m o d e we r e to d e c l a r e a ( fo r s upe r v i so r mod e ) , t h e s e a r c h th a t i s b eg un t e rm i n a t i o n h an d l e r a f te r SYS $ E X I T i s c a l l ed f r om s upe r v i so r mode wi l l l o c a t e the h a nd l e r j u s t d e c l a r ed t h a t , wh e n c a l l ed , wi l l d ec l a r e ano t h e r h a nd l e r a nd s o I n f a c t , t h i s i s j u s t t h e m e c h a n i sm u s ed by DC L a nd o n a d i n f i n i t um . MCR to a l l o w m u l t i pl e i m ag e s to e x e c u t e , o n e a f t e r ano th e r , i n t h e same process . Th i s m e c h a n i sm i s d i s c u ssed i n mo r e d e t a i l in Ch a p t e r 2 0 . No t e th a t a t e rm i na t i o n h a nd l e r tha t i s d e c l a r e d l a t e r ( wh i ch i mpl i e s tha t i t wi l l b e c a l l ed earl ier ) c a n p r ev e n t p r ev i o us l y d e c l a r e d h a nd l e r s f o r t h e s a m e a c c e s s m o d e f r om e v e n b e i ng c a l l ed by s i mpl y i s s u i ng a c a l l to SYS $ E XI T . I n the e x ampl e d e s c r i b e d above , p r o c ed u r e C c o u l d p r ev e n t t e rm i n a t i o n h a nd l e r s B a nd A f r om be i ng c a l l ed b y c a l l i ng SYS $ E X I T i t s e l f . 18 . 3 IMAGE AND PROC E S S RUNDOWN In a n i n t e r a c t i v e o r b a tc h e nv i r o nm e n t t h a t a l l o ws m u l t i pl e images to exec ute one a f ter ano t h e r , s ev e r a l s t eps m u s t b e t a k e n to p r e v e n t a l a te r i m ag e f r om i nhe r i t i ng e i th e r e nh a n c em e n t s ( s uch a s e l ev a t ed p r i v i l eg e s ) or d eg r ad a t i o n s ( s uch as a r ed uc ed wo r k i ng s e t ) f r om a p r ev i o u s i m ag e . I n a d d i t i o n , wh e n a p r o c e s s i s d e l e t ed , a l l t r a c e s o f i t m u s t b e e l i m i n a t ed f r om t h e s y s t e m t a b l e s a nd a l l r e us a b l e r e so u r c e s r e t u r ned t o the sys t em . Th e p r o c ed u r e SYS $ R UNDWN a c c ompl i sh e s m u c h o f the wo r k f o r bo th o f t he s e p u r po s e s . I t d i s t i ng u i sh e s b e twe e n i m ag e r undown a nd p r o c e s s r und own b y i t s s i ng l e i np u t pa r a m e t e r , a c c e s s m o d e . ( Th i s f l e x i b i l i t y r e qu i r e s t h a t SYS $ R UNDWN e x e c u t e i n k e r n e l mod e . ) SYS $RUNDWN i s c a l l ed wi t h an a r g ume n t o f u s e r by b o th DC L a nd MCR ( Ch a pt e r 2 0 ) to c l e a n up a fter an imag e t h a t h a s j us t t e rm i n a t e d a nd b e f o r e the nex t i m ag e i s a c t i va ted . SYS $ R UNDWN i s a l s o c a l l ed f r om the De l e t e Process s ys t em 1 8-2 0 I MAG E ACT I VAT I ON AND TERM I NAT I ON s e r v i c e ( Ch a p t e r 1 9 ) wi th a n a r g umen t o f k e r n e l mod e to c l e a n up a f t e r a p r o c e s s tha t i s b e i ng d e l e t ed . Much o f t h e a c t i v i ty pe r f o rmed by Rund own i s a c c ompl i shed wi t h sys tem s e rv i c e s . Rund own s i mpl y pa s s e s i t s i n put a rg um e n t to th e s e s e r v i c e s to a l l o w them t o d e t e rm i n e h o w much wo r k t o do . Fo r e x am p l e , the De l e t e Log i c a l Name sys tem s e r v i c e ( Ch a pt e r 2 6 ) c a n b e c a l l ed wi th an a c c e s s mod e a rg um e n t a nd the i mpl i c i t i n s t r uc t i o n to d e l e te all l og i c a l names f o r th i s a nd o u t e r a c c e s s mod e s . I f Rund own i s c a l l ed f r om us e r m od e , t h e c a l l to De l e t e Log i c a l Name wi l l o n l y d e l e t e user mode ( imag e a s s o c i a t ed ) l og i c a l nam e s . I f Rund own i s c a l l ed f r om k e r n e l mo d e , t h e n a l l p r o c e s s l og i c a l names wi l l be d e l e t ed . 18 . 3 . 1 C o n t r o l F l o w o f Rund o wn Th e fo l l o w i ng s t eps d e t a i l the wo r k pe r fo rmed by S Y S $ R UNDWN . Th e a c c e s s mod e a rg um e n t i s m a x i m i z e d wi t h t h e acc e s s mod e o f t h e c a l l e r ( by r o u t i n e E XE $MAXAC MODE ) . Th a t i s , t h e l e s s p r i v i l eg ed a c c e s s mod e is used . Th e ph r a s e " ba s e d o n a c c e s s mod e " m e a n s " pe r f o r m th i s o pe r a t i o n fo r th i s a c c e s s mod e a nd a l l o u t e r ( l e s s p r i v i l eg ed ) access mod e s . " Tho s e o pe r a t i o n s tha t a r e pe r f o rmed b y s y s t em s e r v i c e s h a v e the n a m e o f the s e r v i c e i n c l ud ed . 1. I f a powe r f a i l e l imi n a t ed . AST h ad been p r ev i o u s l y d e c l a r ed , it is 2. Th e i m a g e c o un t e r tha t to an i ma g e tha t h a s th i s syn c h r o n i z a t i o n $G ETJ P I s y s t em s e r v i c e 3. Th e f o u r P l spa c e vec to r s f o r u s e r -wr i t t e n s ys t em se r v i c e s a nd i m ag e - s p e c i f i c me s s a g e s e c t i o n s ( F i g u r e 3 - 8 ) a r e r e s e t t o c o n t a i n R S B i n s t r uc t i o n s . 4. Al l c h a n n e l s wi tho u t o pe n f i l e s a r e d ea s s i g ned ( S Y S $DASSGN ) , b a s e d o n a c c e s s mod e . Th e a c c e s s mode c h e c k p r e ven t s p r o c e s s p e r ma n e n t f i l e s f r om b e i ng c l o s ed wh e n a n i m ag e is b e i ng r und own ( i n put a r g um e n t i s u s e r mod e ) . Oth e r channe l s tha t w i l l no t be d e a s s i g n ed a t th i s s t a g e o f i mag e r un d o wn i n c l ud e the image f i l e a nd a n y o th e r f i l e tha t i s m a pped to a r a ng e o f v i r t ua l add resses . 5. Th e i m ag e pag e s a r e r e s e t ( by c a l l i ng MMG $ I MG R E S E T ) . Th i s r o ut i ne pe r fo rms a l l the i m ag e c l ea n up t h a t i s a s s o c i a t e d w i t h mem o r y m a n ag em e n t . Th e s t eps pe r fo rmed by th i s r o u t i ne a r e l i s t ed h e r e . p r ev e n t s t h e d e l i v e r y o f $ G E TJ P I ASTs t e rm i n a t ed i s i n c r em e n ted . Th e use o f t e chn i q ue i n t h e o pe r a t i o n o f the is d e sc r i b e d i n C h a pt e r 2 7 . a. Al l o f P O s p a c e i s d e l e t ed . Th i s w i l l f r e e up the i mag e file a nd a ny o th e r f i l e th a t i s m a pped . Ph ys i c a l pag e s wi l l b e r e l e a s e d a nd b l o c k s i n the pag e file wi l l be d e a l l o c a ted . b. Th e no n pe rm a n e n t p a r t o f P l s p a c e i s d e l e t ed . Th e two pa r t s o f P l s pa c e tha t a r e d e l e t ed by t h i s o pe r a t i o n a r e t h e us e r s t a c k a nd the i m ag e I /O s egme n t ( Fi g ur e 1 8-9 ) . In add i t i on , a ny e x pa n s i o n s to Pl s pa c e ( a t sm a l l e r vi r tual add resses than the use r s ta c k ) that we r e pe r fo rmed b y the u s e r a r e a l s o d e l e t e d . 1 8- 2 1 IMAGE ACT I VAT I ON AND TERM INAT I ON d i rection of g rowth Cre ated by Image Activator for Each - !!'l!g !. C re a ted a s P a rt of Process Creation � User Stack ( De f ault S ize of 20 Pages) Image 1/0 Segment ( D ef ault S ize of 3 2 Pages) -+---t- CLI Image and Data, Other Stacks, etc. • • • De leted at Image Ex it by Image R_!S_!t_ Ex ists for Life of the Process - � : :CTL$GL_CTLBASVA Location CTL$GL._CTLBASVA contains the address of the boundary between the temporary and permanent parts of P1 space . Figure 1 8 -9 Low Ad d r e s s End o f P l Sp a c e Th a t Is De l e t ed a t Imag e Ex i t c. Th e wo r k i ng s e t i s r e s e t to i t s d e fa u l t v a l ue , und o i ng any e x pa n s i o n o r c o n t r a c t i o n o f the wo r k i ng s e t a s a r e s u l t o f a c a l l to SYS $ADJW S L ( e i th e r e x p l i c i t l y o r a s a resul t o f the a u toma t i c wo r k i ng s e t s i z e ad j u s tm e n t ) . Wo r k i ng s e t s i z e c h a ng e s a r e d e s c r i b ed i n Ch a p te r 1 3 . d. Th e p r o c e s s pr i v i l eg e ma s k i n the f i r s t q u a d wo rd o f the p r o c e s s h e ad e r is r e s e t to i t s pe rm a n e n t va l ue , fo und at l o c a t i o n C T L$G Q PROC PR I V . Th i s s t e p e l i m i n a t e s any pr i v i l eg e e n h anc em e n t s to the p r o c e s s d ue to the e x e c u t i o n of a p r i v i l eg e d k n own i mag e . 6. Th e same c h a nne l d e a s s i g nm e n t l o o p pe r fo rmed i n s te p 4 is e x e c ut ed . Howe v e r , b e c a us e the i m a g e f i l e a nd o th e r m a pped f i l e s h a v e now b e e n d i s a s s o c i a t ed f r om v i r t ua l add r e s s s pa c e , t h e c h a nn e l s a s so c i a t ed wi t h tho s e f i l e s wi l l a l so be d ea s s ig ned . As in s tep 4 , th i s d e a s s i g nm e n t is based on a c c e s s mo d e , i m p l y i ng t h a t p r o c e s s pe r m a n e n t f i l es a re u n a f f e c t e d by i m a g e r und own . 7. Al l d e v i c e s a r e d e a l l o c a ted a c c e s s mo d e s . 8. Al l t i me r r e q u e s t s a r e c a n c e l l ed o u t e r a c c e s s mo d e s . ( S YS $CANT I M ) fo r 9. Common eve n t f l ag c l uste r s i nd e pend e n t o f a c c e s s mo d e . a nd d i s a s s o c i a t ed , ( S YS $DA LLOC ) 2 3 fo r th i s are a nd th i s o uter a nd 10 . Th e nex t s e v e r a l s t eps m u s t e x ec u t e a t I P L $ S YNC H ( I PL 7 ) b e c a u s e sys t em wi d e d a t a s t r uc t u r e s a r e b e i ng man i pu l a te d . 11 . I f th i s p r o c e s s h a s d e c l a r ed a n e r r o r l og m a i l bo x , it is e l i m i n a t ed . Th e me thod fo r d e c l a r i ng a n e r r o r l og ma i l bo x i s d e s c r i b e d i n Ch a p t e r 7 . 18-22 I MAGE ACT IVAT I ON AND TERM INAT I ON 12. A l l p e nd i ng A S T c o n t r o l b l o c ks a r e r emoved f r om the l i s t { in the PC B ) a n d d e a l l o c a ted to n o npag ed po o l b a s e d on a c c e s s mo d e . Th i s i s a c compl i s hed b y s t a r t i ng a t t h e ta i l of the l i st a nd p r o c e ed i ng towa rd the h e a d o f t h e l i s t un t i l a n AST control block i s f o und w i t h a m o r e p r i v i l eg ed ( sm a l l e r ) a c c e s s mo d e than the Run d own a rg um e n t , o r u n t i l t h e AST p e nd i ng q u e u e i s emp t y . ( Re c a l l f r om Ch a pt e r 5 t h a t ASTs a r e e n que ued i n o r d e r o f i n c r e a s i ng a c c e s s mode . ) 13. Any c h a ng e mod e h a nd l e r s f o r th i s a nd o u t e r a c c e s s mod e s a r e e l i m i n a t ed . B e c a us e ch a ng e mod e h a nd l e r s o n l y e x i s t fo r u s e r a nd s upe rv i s o r mod e s , t h i s s t ep r e s u l ts i n e l i m i n a t i o n o f a c h a ng e mo d e to u s e r h a nd l e r eve r y t i me a n i m a g e e x i t s a nd t h e e l i m i n a t i o n o f a c h a n g e mod e to s upe r v i s o r h a nd l e r wh e n the p rocess is d e l e t ed . 14 . Any t e rm i n a t i o n h a nd l e r s fo r t h i s a nd o u t e r a c c e s s mod e s a r e c a nc e l l ed . Te r m i n a t i o n h a nd l e r s c a n e x i s t fo r e x e c u t i v e , s upe r v i s o r , a nd us e r m o d e s . 15. E x c e p t i o n h a nd l e r s fo und i n the p r i ma r y , s e c o nd a r y , a nd last c h a n c e ve c to r s are e l im i n a ted fo r th i s a nd o u t e r a c c e s s mo d e s . 16. Th e AST a c t i v e b i t s fo r th i s a nd o ute r a c c e s s mod e s a r e c l e a r ed . Th e A S T e n a b l e b i t s fo r t h i s a nd o u t e r a c c e s s mod e s a r e se t . 17. S y s t em s e rv i c e f a i l u r e e x c e p t i o n s a r e d i s a b l e d fo r o u t e r a c c e s s mod e s . 18. that h a s Any c ompa t i b i l i t y m o d e h a nd l e r e l i m i n a ted , i n d e pe nd e n t o f the access Rund own . 19. rout ine SCH$N EW LVL ) A n e w va l u e o f A S TLVL i s c a l c u l a t ed { by r e s u l t i ng f r om to ref l ec t t h e c h a ng e in t h e AST q u e ue s tep 1 2 . 20 . Th e fo rc e e x i t pend i ng f l ag in the PC B i s c l e a r ed . Th i s is t h e l a s t s t e p t h a t mus t b e pe r f o rmed a t I P L $ S YNC H , so I PL i s l owe r ed to i t s p r ev i o u s va l u e . 21. The l a s t s t e p t h a t Rund own pe r f o rm s b e fo r e r e t u r n i ng to i ts c a l l e r i s to d e l e t e a l l p r o c e s s l og i c a l nam e s b a s e d on a c c e s s mod e . A t i mag e e x i t , a l l l og i c a l names c r e a t ed f r om wi t h i n the imag e ( w i t h a c a l l t o SYS $ C R E LOG ) a nd a l l l og i c a l n am e s c r e a ted wi t h t h e AS S IGN/U S E R c omma nd wi l l b e e l im i n a t ed . At p r o c e s s d e l e t i o n , a l l p r o c e s s l og i c a l nam e s w i l l be d e l e t ed . 18 . 4 been mode th i s d e c l a r ed a rg ume n t a nd is to PROC E S S PR IVI L EG E S O n e o f t h e c o n t r o l s e x e r c i s ed b y VM S to p r ev e n t un a u tho r i zed use the s ys tem is the set o f process p r i v i l eg e s . O n e o r mo r e o f t h e s e p r i v i l eg e s i s r e q u i r ed to pe r f o rm m a n y o f t h e sys tem s e r v i c e s , e x e c u t e c e r t a i n c ommand s , o r u s e p r i v i l eg ed u t i l i t i e s . 18-2 3 IMAGE ACT I VAT I ON AND TERM INAT I ON 18 . 4 . 1 P r o c e ss P r i v i l eg e M a s k s VM S m a i n t a i ns s ev e r a l p r i v i l eg e m a s ks ( Ta b l e 1 8 - 1 ) fo r e a c h p r o c e s s . 1. Th e f i r s t q u a dwo r d of the p r o c e s s h e ad e r ( PH D $ Q P R I VM S K ) conta ins the wo r k i ng p r i v i l eg e m a s k , t h e o n e c he c ked by a l l VM S s e r v i c e s t h a t r eq u i r e p r i v i l eg e . Th i s m a s k m a y b e a l t e red each t ime a n i m ag e e x e c u t e s , c a n be a l t e r ed b y t h e Se t P r i v i l eg e s y s tem s e rv i c e , a nd is r eset to the p r o c e s s - p e rma n e n t p r i v i l eg e m a s k ( C T L $ G Q PROC PRI V ) a s a pa r t o f i ma g e r und own . 2. Th e p r o c e s s p r i v i l eg e m a s k i n the Ac c e s s R i g h t s B l o c k ( ARB ) ( PC B $ Q P R I V ) is a l wa y s a n e x a c t d up l i c a t e o f the p r i v i l eg e m a s k i n t h e p r o c e s s h e ad e r . Th e Acc e s s R i g h t s B l o c k is c u r r en t l y a pa r t o f the so f twa r e PC B . 3. Th e p r o c e s s -pe r ma n e n t pr i v i l eg e m a s k i s l o c a t ed in the Pl po i n te r pag e a t g l ob a l l o c a t i o n C T L$G Q PROC PR I V . Th e c o n t e n t s o f th i s l o c a t i o n a r e wr i t t e n to the- PHD p r i v i l eg e mas k ( and a l so t h e ARB o r PC B p r i v i l eg e m a s k ) a s a pa r t o f i ma g e e x i t b y t h e i ma g e r e s e t r o u t i n e ( MMG $ IMGRESE T ) . Th i s f i e l d i s i n i t i a l i z e d wh e n the p r o c e s s i s c r e a t ed . 4. Th e a u th o r i zed pr i v i l eg e m a s k in the process h e ad e r i s u s ed by t h e S e t Pr i v i l eg e sys t em s e r v i c e ( P HD$ Q AUTHPR I V ) to a l l ow a n o n p r i v i l eg ed p r o c e s s ( a p r o c e s s w i tho ut SETPRV p r i v i l eg e ) to r emove o n e o f i t s p e r m a n e n t pr i v i l eg e s a nd l a t e r r eg a i n th a t p r i v i l eg e . Th i s f i e l d i s a l so i n i t i a l i z ed wh e n t h e p r o c e s s i s c r e a t e d . 5. Th e i m ag e p r i v i l eg e mas k in the pr o c e s s h e ad e r ( P HD$Q I MAG PR I V ) co n t a i n s t h e p r i v i l eg e m a s k fo r a pr i v i l eg ed Th i s m a s k is a k n own Tm a g e wh i l e t h a t i m a g e i s e x e c u t i ng . c o nv e n i e n t to o l u s ed by the S e t Pr i v i l eg e s y s t e m s e r v i c e tha t a l l ows i ma g e s i n s t a l l ed w i th p r i v i l eg e to i s s ue the Se t Pr i v i l eg e s y s t em s e rv i c e w i tho u t l o s i ng p r i v i l eg e s . 18 . 4 . 2 S e t P r i v i l eg e Sys t em S e rv i c e Th e Se t Pr i v i l eg e s ys t e m s e r v i c e a l l o ws a process to a l te r i ts i m ag e - spec i f i c ( P HD$Q P R I VM S K a nd PC B $ Q PR I V ) o r p r o c e s s - pe rman e n t ( C T L $G Q PROC PR I V ) p r i vil eg e ma s ks , g a i n i ng -o r l o s i ng pr i v i l eg e s a s a r e s u l t . - In ad d i t i o n , t h e s e r v i c e c a n r e t u r n the p r ev i o us s e t t i ng s o f e i the r the i ma g e - s pe c i f i c or p r oc e s s - pe r ma n e n t pr i v i l eg e s , if r e que s t ed . Th e d i s a b l e p r i v i l eg e pa th r e q u i r e s no s pec i a l p r i v i l eg e a nd clears the r e que s t ed p r i v i l eg e b i t s i n t h e i m ag e - s pe c i f i c ( a nd o p t i o n a l l y t h e p r o c e s s -pe rma n e n t ) p r i v i l eg e m a s ks . 18-24 Tab l e 1 8 - l Proc e s s P r iv i lege Ma s k s (X) I N I-' Sym bo l i c Na m e Lo c a t i o n Us e o f Th i s Ma s k Mo d i f i ed by Re f e r e n c ed b y P H D $ Q_PR I VM S K P r o c e s s He ad e r Th i s i s t h e wo r k i ng pr i v i l eg e mask tha t is t e s t ed by all system s e r v i c e s t h a t r eq u i r e p r i v i l eg e . PR OC STRT LOG I N OUT Imag e Ac t i v a to r $S ETPRV A l l sys t em s e r v i c e s t h a t r e qu i r e pr i v i l eg e PCB $Q_PR I V S o f t wa r e PC B { Ac c e s s Ri g h t s Bl oc k ) Th i s m a s k i s a n ex ac t d up l i c a t e t h e p r o c e s s h e ad e r m a s k . Same a s fo r PHD$Q_PR I VM S K Dev i c e d r i v e r s a n d AC Ps C T L $G Q_PR OC PR I V P l Po i n t e r Pa g e Th i s m a s k r ec o rd s the pe r m a n e n t l y e n a b l ed pr i v i l eg e s fo r t h e p r o c e s s . Th e wo r k i ng p r i v i l eg e m a s k i s r e s e t to t h i s v a l ue ev e r y t i me tha t an i m ag e e x i t s . PR OC STRT LOG I N O UT $ S ETPRV Imag e Ac t i v a t o r MMG $ I MGR E S E T S E T U I C c ommand PHD$Q_A UT H PR I V P r o c e s s Head e r the pr i v i l eg e s r ec o rd s Th i s m a s k t h a t t h i s p r o c e s s i s a l l o we d to use i ts a c c o rd i ng a u t ho r i za t i o n to r ec o rd . PR OC STRT LOG I N O UT $S ETPRV PHD$Q- I M AG PR I V P r o c e s s Head e r Th i s mask r ec o r d s the pr i v i l eg e m a s k fo r a n imag e tha t i s i n s t a l l ed wi t h e n h a n c ed pr i v i l eg e s . Imag e Ac t i v a t o r $ S E T PRV UAF $Q_PR I V A u t ho r i za t i o n R e c o rd Th i s m a s k r e c o rd s the pr i v i l eg e s tha t th i s u s e r i s a l l o wed to u s e . AUTHOR I Z E LOG I N O UT KF I $Q_PROC PR I V Known Fi l e En t r y fo r pr i v i l eg ed i n s t a l l ed i m a g e Th i s m a s k r ec o r d s the add i t i o nal pr i v i l eg e s r e q u i r ed by an i m ag e tha t i s i n s t a l l ed wi th pr i v i l eg e . I N S TA L L I m ag e Ac t i v a t o r I HD $ Q_PR I VR E QS Imag e He ad e r o f a n y i m ag e Th i s m a s k i s c u r r e n t l y unused . c o n ta i n s all ones , e n ab l i ng p r i v i l eg e s • Li nker I m ag e Ac t i v a to r U1 of It all IMAGE ACTIVAT I ON AND TERMINAT I ON Th e e na b l e p r i v i l eg e pa th r e qu i r e s n o p r i v i l eg e if the r e q u e s ted p r i v i l eg e is i nc l ud ed i n the l i s t o f p r i v i l eg e s a u tho r i z e d fo r th i s p r o c e s s ( PHD$ Q AUTHPR I V ) . I f a p r o c e s s w i she s a pr i v i l eg e tha t i s n o t in i t s a u tho r i z ed l i st , one of two c o nd i t i o ns m u s t h o l d o r t h e r e q u e s t ed p r i v i l eg e i s n o t g r an ted . • Th e p r o c e s s m u s t h a v e S E TPRV p r i v i l eg e . A p r o c e s s wi th th i s p r i v i l eg e c a n a c q u i r e a n y o the r p r i v i l eg e wi th e i th e r the Se t P r i v i l eg e s y s t em s e r v i c e o r the $ S E T PROC E S S/ P R I VI LEG E S = ( p r i v i l eg e [ , • • • ] ) c ommand . • Th e sys tem s e r v i c e wa s c a l l ed f r om e x ec u t i v e o r k e r n e l mo d e . Th i s m e c ha n i sm i s a n e sc a pe tha t a l l o ws e i th e r VM S o r u s e r -wr i t t e n s y s t em s e r v i c e s t o a c qu i r e wh a te v e r pr i v i l eg e s t h e y n e ed w i tho u t r eg a r d f o r wh e th e r t h e c a l l i ng p r o c e s s h a s S E TPRV p r i v i l eg e . S u c h p r o ced u r e s m us t o f c o u r s e d i s a b l e p r i v i l eg e s g r a n t ed i n t h i s f a sh i o n a s pa r t o f th e i r r e t u r n p a th . No t e t h a t the i mp l em e n ta t i o n o f the S e t P r i v i l eg e sys tem s e r v i c e d o e s not r eturn an e rro r if a n o n p r i v i l eg ed process a t t empts t o add un a u tho r i z e d p r i v i l eg e s . I n such a c ase , the serv i c e c lears all un a u tho r i z e d b i t s i n the r eque s t ed p r i v i l eg e m a s k , l o ad s the mod i f i ed p r i v i l eg e m a s k , a nd r e t u r n s s uc c e s s . 18-26 C HAPTER 1 9 PROC E S S DELETION Th e De l e te P r o c e s s s y s tem s e rv i c e a l l o ws a p r o c e s s to d e l e t e i t s e l f o r a ny o the r proc e s s i n the s ys t em tha t i t h a s t h e p r i v i l eg e t o a f f e c t ( a c c o rd i ng t o wh e th e r i t h a s GRO U P o r WORLD p r i v i l eg e ) . Th e d e l e t i o n i s a c c ompl i shed i n t wo s te p s . Th e p r o c e s s i s m a r ke d fo r d e l e t i o n i n the c o n t e x t o f t h e p r o c e s s i s s u i ng the De l e t e P r o c e s s s ys t em se rv i c e . I n ad d i t i o n , a s p e c i a l k e r n e l A S T i s qu e ued to the t a rg e t pr o c e s s . Th i s AST e x e c u t e s i n t h e c on t e x t o f t h e p r oc e s s b e i ng d e l e t ed a nd pe r fo rm s the a c t ua l d e l e t i o n ope ra t i on . P r o c e s s d e l e t i o n r e qu i r e s tha t s ev e r a l o pe r a t i o n s b e pe r f o rmed . • Al l t r a c e s o f t h e p r oc e s s mus t be r emoved f r om the sys t e m . • Al l sys t em r e so u r c e s m u s t b e r e t u r ned . • • • 19. 1 Ac c o un t i ng i n fo rma t i o n mus t m a n ag e r , t h e j o b c o n t r o l l e r . be pa ssed to the a c c o un t i ng I f t h e p r o c e s s b e i ng d e l e t ed i s a s ubp r o c e s s , a l l quo t a s a nd l im i ts t a ke n f r om the c r e a to r wh e n the p r o c e s s wa s c r e a t e d mus t b e r e t u r n ed . F i n a l l y , i f t h e c r e a to r r eque s t ed not i f i c a t i o n o f d e l e t i o n t h r o ug h a t e r m i n a t i o n m a i l bo x , s uc h a m e s s a g e m u s t b e s e n t . PROC E S S DELET ION IN C ONTEXT OF CALLER The i n i t i a l ope r a t i o n o f the De l e t e P r o c e s s s ys t em s e rv i c e t a k e s p l a c e i n t h e c o n t e x t o f t h e p r o c e s s i s s u i ng t h e s ys t em s e rv i c e c a l l . Th i s pa r t o f the o pe r a t i o n pe r f o rms a s i mpl e s e t o f p r i v i l eg e c h e c k s a nd then que u e s a s pe c i a l kernel AST t h a t w i l l c a u s e the d e l e t i o n to c o n t i n ue i n the c o n t e x t o f the p r o c e s s a c t ua l l y b e i ng d e l e t ed . 19. 1. 1 De l e te P r o c e s s Sys t em S e r v i c e Th e De l e te P r o c e s s s y s t em s e rv i c e i n i t i a l ly calls the s ub r o u t i n e EXE $NAMP I D to c o nv e r t e i th e r a p r o c e s s n ame o r a P I D to the a d d r e s s o f the PC B o f the p r o c e s s b e i ng d e l e t ed . Th i s s ub r o u t i n e c h e c k s tha t the n ame or PID c o r r e sp o nd s to a n a c t ua l p r oc e s s . In add i t i o n , i t v e r i f i e s t h a t the p r o c e s s i s s u i ng the d e l e t e h a s the pr i v i l eg e to d e l e t e the spec i f i ed p r o c e s s . 1 9- 1 PROCE S S DE LET I ON The De l e t e P r o c e s s s ys t em s e rv i c e t h e n p e r fo rm s the fo l l owi ng s t e p s . 1. Th e ta r g e t p r o c e s s i s m a r k e d f o r d e l e te . I f i t wa s a l r e a d y ma r ked fo r d e l e t e , t h e s ys t em s e r v i c e s i mp l y r e t u r ns t o the cal ler . 2. Th e t a rg e t p r o c e s s i s r e s um e d i n c a se i t wa s s uspend ed . If the pr o c e s s we r e t o r em a i n s uspe n d ed , n o AST , i nc l ud i ng the d e l e t e s p e c i a l k e r ne l AST , c o u l d b e d e l i v e r ed t o i t . 3. An AST c o n t r o l b l o c k i s a l l o c a t e d a nd i n i t i a l i ze d w i t h the P I D of the t a rg e t p r o c e s s a nd the a d d r e s s o f t h e s p e c i a l k e r n e l A S T ( D E LETE ) th a t w i l l pe r fo rm the a c t ua l process deletion . 4. Th e AST i s que ued to the t a r g e t p r o c e s s , b o o s t o f 3 t o i t s so f twa r e p r i o r i t y . wi th a po t e n t i a l I n o th e r wo r d s , v e r y l i t t l e e x c e p t the q ue u i ng o f a n AST t o the t a rg e t p r o c e s s i s p e r fo rmed i n the c o n t e x t o f t h e p r o c e s s i s s u i ng t h e d e l e t e . 19. 2 PROC E S S DE LET I ON IN C ONTEXT OF PROC E S S BEING DE LETED A l mo s t the e n t i r e o pe r a t i o n o f p r o c e s s d e l e t i o n t a k e s p l a c e in the c o n t e x t o f the p r o c e s s b e i ng d e l e ted . Th e que u i ng of the spec i a l AST t o th i s p r o c e s s m a k e s i t c om p u ta b l e a nd c a us e s the p r o c e s s to be eventua l l y s e l e c ted fo r e x ec u t i o n b y t h e s c h ed u l e r . As s um i ng th a t the r e a r e n o o th e r p e nd i ng s p e c i a l k e r n e l A S Ts , t h e d e l e t e spec i a l AST be the f i r s t c o d e t o e x ec u t e in the c on t e x t o f the p r o c e s s b e i ng wi l l d e l e t ed . process d elet ion i n proc ess c o n tex t , the t a rg e t By pe r fo rm i ng process ' s address s pa c e a nd p r o c e s s h e a d e r a r e r e ad i l y a c c e s s i b l e . Sys tem s e rv i c es s uc h a s $ D E LTVA a nd $ D E L LOG a nd RM S c a l l s s uc h a s SYS $ RM S RUNDWN c a n a l s o b e used . Spe c i a l c a s e s s u c h a s the d e l e t i o n o f a p r o c e s s t h a t i s o u t s wa pped s i mpl y d o n o t e x i s t . 19. 2. 1 S p e c i a l K e r n e l AST f o r P r o c e s s Del e t i o n T h e s t e p s tha t a r e pe r f o rm ed by t h e he r e . spec i a l ke r n e l AST are l i s t ed 1. Re s o u r c e wa i t mod e i s e na b l ed . 2. RM S $ R UNDWN i s c a l l ed f o r e a c h o pe n file . Th i s p r o c ed u r e i nsures th a t a l l RM S I/0 a c t i v i t y i s c ompl e te , c l o s e s a l l f i l e s , a nd r e s e t s t h e i n t e r n a l FAB a n d RAB t a b l e s . 3. I f the p r o c e s s o wn s a ny s ub p r o c e s s e s , t h e s e s ubp r o c e s s e s mus t b e d e l e t ed b e fo r e d e l e t i o n o f t h e o wn e r c a n con t i nue . Th e l o g i c th a t i s pe r fo rmed a t th i s po i n t is l i s t ed h e r e . An e x ampl e o f p r o c e s s d e l e t i o n wh e n s ubp roc e s s e s a r e i nv o l v ed i s f o und i n t h e n e x t s e c t i o n . a. Th e PC B v e c to r i s sc anned un t i l a l l the PC Bs wi t h the P I D of t h e c r e a to r i n the i r o wn e r f i e l d s a r e fo und . Ea c h o f t h e s e p r o c e s s e s i s m a r ked fo r d e l e t e . Th a t i s , a De l e te 1 9-2 PROCE S S DE LETI ON P r o c e s s s y s t em s e rv i c e c a l l i s made fo r each o f these p r o c e s s e s , r e s u l t i ng i n the que u i ng o f t h e d e l e t e spec i a l AST t o e a c h o f t h em . b. Th e c o un t o f o wn e d s ubp r o c e s s e s ( i n f ield PC B $W PRCCNT ) of t h e pr o c e s s c u r r en t l y b e i ng d e l e t ed i s c he c k ed to s e e i f i t h a s r e a c h ed z e r o . If not , the process is p l a c ed i n to the r e s o u r c e wa i t s ta t e ( MWA I T ) . Th e p r o c e s s w i l l b e c ome comp u t a b l e ag a i n wh e n the spec i a l k e r n e l AS T t h a t r e t u r n s quo t a s f r om o n e o f t h e s ubpr o c e s s e s i s e nque ued . c. Th e d e l i v e r y o f t h e spec i a l AST tha t r e t u r n s d ed uc t i b l e quo t a s ( C P U t i me l i m i t o n l y ) f r om o n e o f t h e s ub p r o c e s s e s wh e n i t i s d e l e t ed w i l l r emove t h e p r o c e s s f r om t h e wa i t state , a t wh i c h t i me the c h e c k i n S t e p 3 b wi l l be r e p e a ted . 4. Th e p r o c e s s i s r un d own f r om k e r n e l m od e . SYS $RUNDWN i s d e s c r i b ed i n Ch a p t e r 1 8 . 5. Th e v i r t ua l pag e s a s so c i a t ed wi th a n y s e c t i o n s a r e d e l e t ed . 6. Al l p r o c e s s p r i va t e vo l um e s a r e d i sm o un t ed . 7. Al l a l l o c a t e d d ev i c e s a r e d e a l l o c a t e d . 8. I f th i s p r o c e s s i s i ts e l f a s ubp r o c ess ( PC B $ L OWN ER f i e l d nonzero ) , t h e n a l l r em a i n i ng quo t a s m u s t b e r etu r n ed to the o wn e r p r o c e s s . Th e l og i c o f r e t u r n i ng quo t a s to the own e r o f a s ubp r o c e s s i s l i s ted h e r e . 9. Th e p r o c ed u r e a. Th e c o un t o f o wn e d s ubp r o c e s s e s i n the PC B $W PRCCNT f i e l d I f t h e own e r Ts a l s o be i ng of t h e own e r i s d ec r em e n ted . d e l e t ed , t h e n t h e o wn e r i s c u r r e n t l y in a wa i t s ta t e , wa i t i ng fo r t h e c o n t e n t s o f t h i s f i e l d to b e c o m e z e r o . b. An I /O r e q u e s t pac k e t i s a l l o c a ted fo r u s e a s a n AST control b l oc k . Th e e x t r a s pa c e a t the b o t tom of the IRP w i l l b e us e d t o ho l d the q uo t a s be i ng r e turned to the own e r . c. Th e a d d r e s s o f the r e t u r n q uo t a spec i a l AST ( RETQUOTA ) a nd t h e P I D o f t h e own e r a r e put i n to t h e AST c o n t r o l b l oc k . d. Th e unused q uo ta s a r e put i n to the b o t tom o f the IRP. Th e o n l y quo t a t h a t m u s t b e r e tu r n ed to t h e c r e a t o r i s u n u s ed C P U t i m e . A l l o th e r quo t a s a r e e i th e r po o l ed or n o nd ed uc t i b l e ( Ch a p t e r 1 7 ) . e. F i n a l l y , t h e s pe c i a l AS T i s queued to the c r e a t o r , g i v i ng i t a p r i o r i ty b o o s t o f 3 . A t e rm i n a t i o n m e s s a g e i s c o n s t r uc ted on t h e s t a c k t o s end to the j ob c o n t r o l l e r in i t s r o l e as a cc o un t i ng m a n ag e r . Th i s m e s s a g e w i l l a l wa y s b e s e n t un l e s s e xp l i c i t l y p r e v e n t e d by Th e c o n te n t s o f t h e NOACNT f l ag at p r o c e s s c r e a t i o n t i m e . t h i s me s sag e a r e l i s t ed i n Ta b l e 1 9 - 1 . 1 9- 3 PROC E S S DE LET I ON Ta b l e 1 9 - 1 Co n t e n t s o f Te rm i n a t i o n Ma i l box Me s s ag e Se n t to Ac c o un t i ng Ma n ag e r and to Pr o c e s s C r e a to r F i e l d i n Me ssag e Bl o c k So u r c e o f In fo rma t i o n No t e s No t e 1 Me s s ag e Type M SG $ DE LPR OC F i n a l Ex i t St a t us C TL $G L_F INALS TS P r o c e ss ID PC B $ L_P I D Jo b I D 0 fo r now Lo g o u t T i m e E XE $G Q_S YS T IM E Ac c o un t Nam e C TL $G T ACC O UNT Us e r Nam e C T L $G T U S ERNAME C PU T i m e PHD$L C PUT IM No t e 3 N um b e r o f Pa g e Fa ul t s PH D$L PAG E F LTS No t e 3 P e a k Pag i ng Fi l e Us a g e 0 f o r now Pe a k Wo r k i ng Se t S i z e C T L $G L_WS PEAK B u f f e r ed I /O Co un t PHD$L B I OC NT No te 3 D i r ec t I /O Co un t PH D$L D I OC NT No t e 3 Co un t o f Mo un t ed Vo l um e s C T L $G L_VOLUM ES Log i n T i m e C T L $G Q_L OG I N P I D o f OWn e r PC B $ L_OWNER Mo s t o f the i n fo rm a t i o n a b o u t the d e l e ted pr o c e s s i s fo und in the P l po i n t e r pag e at the g l ob a l locatio ns i nd i c a t ed in the s e c o nd co l um n . Th e e x c e pt i o n s a r e the s e . (1) MSG$ DE L PR OC i s a c o n s t a n t i nd i c a t i ng tha t t h i s- i s a p r o c e s s t e rm i n a t i o n m e s s ag e . (2) PCB $ L P I D a nd PC B $ L OWNER a r e o f fs e t s i n to the PCB o f t h e proces s b e i ng d e l e t ed . (3) Names o f t h e fo r m PHD$L name a r e o f fs e t s i n to t h e p r o c e s s h e ade r o f t h e pro c e s s b e i ng d e l e ted . 1 9- 4 No te 2 No t e 2 PROC E S S DELET ION 10. Th e s a m e m e s s a g e wi l l b e s e n t to the c r e a to r o f a s ubp r o c e s s if a t e rm i n a t i o n m a i l bo x m e s s a g e wa s r e que s t ed wh e n the p r o c e s s wa s c r e a t ed . 11 . Th e r em a i nd e r o f P l s p a c e i s d e l e t ed . { Th e a c t ua l pa r am e te r s p a s s e d t o $ D E LTVA a r e 4 0 0 0 0 0 0 0 t o 7 FFFFFFF . ) Some o f P l s pa c e i nc l ud i ng t h e us e r s t a c k m i g h t h a v e a l r e ad y b e e n d e l e t ed a s a r e s u l t o f a p r ev i o us i m ag e r e s e t c a l l . 12. At th i s po i n t , t h e p r oc e s s m u s t b e r emoved f r om the schedul e r ' s d a ta base . To avo i d m u l t i pl e a c c e s s e s to th i s d a t a , t h e r e s t o f the c o d e i n the d e l e t e spec i a l ke rnel AST e x e c u t e s at I P L$ S YNC H . Th e process i n s t r uc t i o n ) is r emoved f r om execut ion { w i th a S VPC TX • 13. Th e a d d r e s s o f the PCB o f the n u l l p r o c e s s i s put i n to g l o b a l l oc a t i o n SC H$G L C URPCB { ma k i ng t h e n u l l p r o c e s s t h e c u r r e n t p r o c e s s ) a n d a l so i n to the s l o t i n the PC B vec to r fo r m e r l y o c c up i e d b y the p r o c e s s b e i ng d e l e t ed { th us f r e e i ng th i s s l o t f o r f u r the r us e ) . 14 . Th e pag e s t h a t we r e pe rmanen t l y l o c k e d i n to the wo r k i ng set but are n o t s ys t em pag e s ( k e r n e l s t a c k , P l po i n t e r pag e , e t c . ) a r e d e l e t ed and p l a c ed a t t h e beg i nn i ng o f the free pag e l ist . Th e p r o c e s s h e ad e r pag e s th a t a r e a pe rma n e n t p a r t o f t h e wo r k i ng s e t wi l l b e d e l e t ed by the swa ppe r wh e n t h e p r o c e s s h e ad e r i s d e l e t ed . 15. An y r em a i n i ng AST c o n t r o l b l o c k s a r e r emoved q u e ue a nd d e a l l o c a t ed to n o npag ed po o l . 16. Th e p r o c e s s swa p s l o t i s d e a l l o c a t e d . 17. Th e p r o c e s s c o u n t f i e l d in the j ob i n fo rm a t i o n b l o c k is d e c r eme n t ed . If th i s i s n o t the d e l e t i o n o f a s ub p r o c e s s , t h e n t h e J I B mus t be d e a l l o c a t ed . ( Th i s c h e c k i s mad e by c ompa r i ng the PID of the process b e i ng d e l e t ed wi t h t h e m a s te r P I D f i e ld of the J I B . ) 18. Th e PCB i s d e a l l o c a ted to n o n pa g ed po o l . 19. Th e num b e r o f p r o c e s s e s i n the s ys tem a nd the p r o c e s s e s i n the b a l a n c e s e t a r e d e c r em e n ted . 20 . Th e swa ppe r i s a wa k e n ed a nd i n fo rmed th a t th e r e i s a p r oc e s s h e a d e r to b e r emoved f r om t h e b a l a n c e s l o t a r e a { Ch a pte r 1 4 ) . 21 . Fi n a l l y , t h e d e l e t e s p e c i a l k e r n e l AST e x i t s by j um p i ng to the s c h ed u l e r ( a t e n t r y SCH$ S C HED ) to s e l ec t the n e x t p r o c e s s f o r e x e c u t i o n ( Ch a p t e r 8 ) . 19. 2. 2 f r om the n um b e r PC B of D e l e t i o n o f a P r o c e s s Th a t Own s S u b p r o c e s s e s Wh e n a p r o c e s s o wn s s ubpr o c e s s e s , t h e d e l e t i o n o f t h e own e r p rocess m u s t b e d e l a yed un t i l a l l s ub p r o c e s s e s o wn ed b y i t a r e d e l e t ed . Th i s mus t b e d o ne to i n s u r e tha t a l l quo t a s t a ken f r om the c r e a t o r are r e t ur ned . 19-5 PROC ESS DELET ION D u r i ng t h e e x e c u t i o n o f t h e d e l e te spec i a l A S T , a c h e c k i s made to d e t e rm i n e wh e th e r the p r o c e s s b e i ng d e l e ted o wn s any s ubp r o c e s s e s . If i t d o e s , t h e s e p r o c e s s e s mus t b e l oc a t e d and m a r ked fo r d e l e te . M a r k i ng a process f o r d e l e t e s i m p l y m e a n s i s s u i ng a De l e te P r o c e s s s ys tem s e rv i c e fo r i t . As F i g u r e 1 9 - 1 sh ows , t h e r e a r e n o f o rwa r d po i n t e r s i n the PCB o f a n o wn e r p r o c e s s t o i nd i c a t e wh i c h s ub p r o c e s s e s i t h a s c r e a t e d . Th e o n l y i nd i c a t i o n t h a t a p r o c e s s h a s c r e a t e d s ub p r o c e s s e s i s a n on z e r o e n t r y in the PCB $W PRC CNT f i e l d . Th e se p r o c e s s e s c a n o n l y b e l o c a ted by s c a nn i ng a l l the PC Bs in t h e s ys t em un t i l t h e r e q u i r ed n umbe r of PCBs a r e l o c a ted w i th the P I D o f the c r e a to r in the own e r f i e l d . name name OTG name B ERT F i g u r e 1 9- 1 ERNIE S ampl e Jo b to I l l u s t r a te P r o c e s s De l e t i o n w i t h S ub p r o c e s s e s Af t e r e a c h o wn ed s ub p r o c e s s i s m a r k ed fo r d e l e t i o n , t h e c r e a to r p r o c e s s e n t e r s a wa i t s t a t e u n t i l the c o un t o f own e d s ub p r o c e s s e s g o e s to zero . Th e a c t u a l wa i t s t a t e tha t i s e n t e r ed i s r e so u r c e wa i t s t a t e ( MWA I T ) . Th e pa r t i c u l a r r e so u r c e th a t i s b e i ng wa i t ed fo r i s the s pe c i a l A S T u s ed b y the s ub p r o c e s s to r e t u r n d e d uc t i b l e quo t a s to the o wn e r . 19. 2. 3 E x a mp l e o f P r o c e s s D e l e t i o n wi t h S ubpro c e s s e s Th e d e t a i l s o f th i s s i t ua t i o n c an b e b e s t i l l us t r a t ed w i th a n e x am p l e . F i g u r e 1 9 - 1 s hows a p r o c e s s ( PID 1 0035 NAME = O TG ) t h a t own s t wo s ub p r o c e s s e s ( PID = 1 0033 , NAM E = B ERT ) a nd 1 9-6 ( PID 1 003 , NAME E RN I E ) . PROC E S S DELET I ON Ne i the r o f the s e s ub p r o c e s s e s o wn s a n y f u r the r s ub p r o c e s s e s . We wi l l l i st the s teps tha t o c c u r as a r e s u l t o f t h e p r o c e s s OTG b e i ng d e l e ted . We w i l l a s s um e tha t the pr i o r i t i e s a re s uch tha t the p r o c e s s e s ex e c u t e i n the o rd e r OTG , BE RT , a nd f i na l l y E RN I E . 1. Th e d e l e t i o n o f p r o c e s s OTG p r o c e ed s no rm a l l y un t i l it is d e t e r m i n ed th a t th i s p r o c e s s h a s c r e a t e d two s ubpro c e s s e s . Th e PC B v e c to r i s s c a nned un t i l the two PC B s w i th 10035 in the own e r f i e l d a r e l o c a ted . Th e s e two p r o c e s s e s a r e m a r k ed for deletion . Th i s m e a n s tha t the d e l e t e spec i a l AST i s n o w q u e ued to th e two s ubp r o c e s s e s a nd they a r e now c ompu t a b l e . P r o c e s s OTG i s pl a c ed i n to a wa i t s t a t e be c a u s e the c o u n t o f own ed s ubp r o c e s s e s i s non z e r o ( a c t ua l l y 2 a t th i s po i n t ) . 2. Th e a s s umpt i o n a bo u t pr i o r i t i e s i mpl i e s th a t p r o c e s s B E RT wi l l e x ec u t e n e x t . I t s d e l e t i o n p r o c e e d s pa s t the po i n t wh e r e p r o c e s s OTG s t o pped b e c a u s e i t o wn s n o s ubproc e s s e s . Howe v e r , t h e n e x t s t e p i n the d e l e t e s pe c i a l AST d e t e rm i n e s th a t p r o c e s s B E RT i s a s ub p r o c e s s a nd m u s t r e t u r n quo t a s to i ts own e r . As l i s t ed a bove , t h i s i s a c c ompl i shed wi th t h e q ue u i ng o f a s p e c i a l A S T ( R ETQU OTA ) t o p r o c e s s OTG , c h a ng i ng i ts state back to c om p u t a b l e . Howe v e r , t h e c o un t o f own ed s ubpr oc e s s e s i s s t i l l no t z e r o ( d own to 1 n o w ) so p r o c e s s OTG i s put r i g h t b a c k i n to the r e so u r c e wa i t s t a t e . ( Th e co un t o f o wned s ubp r o c e s s e s wa s d e c r em e n t ed as a pa r t o f the r o u t i n e th a t s e nd s the RE TQUOTA AST to the own e r . ) 3. O u r a s s um p t i o n a b o u t pr i o r i t i e s i nd i c a t e s tha t p r o c e s s B E RT wi l l co n t i n u e to e x e c u t e u n t i l i t d i s a ppe a r s e n t i r e l y f r om P r o c e s s E RN I E now b eg i n s e x e c u t i o n o f the d e l e t e the s y s t em . spec i a l AST . Ag a i n , t h e che c k fo r o wn ed s ubpro c e s s e s i nd i c a t e s n o n e b u t the chec k tha t th i s is a s ubp r o c e s s i nd i c a t e s tha t it is . Th e RETQUOTA A S T i s ag a i n que ued to p r o c e s s OTG a n d the c o un t o f owned s ub p r o c e s s e s d e c r em e n t e d ( f i n a l l y to z e r o ) . 4. Now p r o c e s s OTG w i l l r e s ume e x ec u t i o n a s a resul t o f the d e l i v e r y o f t h e RE TQU OTA AST a nd f i nd tha t the c o un t o f o wn ed s ubp r o c e s s e s h a s g o ne to z e r o . In fac t , process OTG w i l l con t i nue to b e d e l e t ed a t th i s po i n t , e v e n tho ug h p r o c e s s Th i s i s s i mp l y a r e s u l t ERN I E h a s n o t b e e n e n t i r e l y d e l e t e d . o f o u r a s s umpt i o n a b o u t so f twa r e pr i o r i t i e s and h a s no e f f e c t o n a n yth i ng . Th e i mpo r ta n t po i n t i s th a t the quo t a s g i v en t o p r o c e s s ERN I E h a v e b e en r e t u r n ed t o the own e r . On c e th a t A S T i s q u e ued , i t i s i r r e l ev a n t wh i c h p r o c e s s e x e c u t e s n e x t . I n the g e ne r a l c a s e o f a s e r i e s o f s ub p r o c e s s e s a r r a ng ed in a t r ee s t r uc t u r e , i f s om e a rb i t r a r y process i s d e l e t ed , a l l s ubp r o c e s s e s f u r the r d o wn i n the t r e e wi l l b e d e l e t ed f i r s t . 1 9-7 C HAPTER 2 0 INTERAC T I VE AND BATCH JOBS T h e p r ev i o u s t h r e e c h a p t e r s h av e d e sc r i b ed the c r e a t i o n a nd d e l e t i o n o f a p r o c e s s tha t e x e c u t e s a s i ng l e i m ag e . Th i s c h a p t e r d e sc r i b e s t h e s pe c i a l a c t i o n s t h a t m u s t b e t a k e n to a l l o w s e ve r a l imag e s to exec ute c onsec ut i v e l y in t h e c o n t e x t o f t h e s ame p r o c e s s . Bec a use th i s mode o f o pe r a t i o n o c c u r s i n a l l i n te r ac t i ve a nd ba t c h j o bs , i t m e r i ts s p e c i a l d i sc u s s i o n . Howeve r , t h e to t a l o pe r a t i o n o f a VAX/VM S c omma nd l a ng uag e i n te r p r e t e r w i l l n o t b e d i sc u s s ed . 20 . 1 THE JOB C ONTROLLER AND UNS O L I C I TED INPUT T h e j o b c o n t r o l l e r is t h e p r o c e s s t h a t c o n t r o l s the c r e a t i o n o f n e a r l y all i n te r a c t i v e a nd batc h j o bs . I n t e r ac t i ve j o bs are u s ua l l y i n i t i a t ed by un so l i c i t e d t e rm i n a l i np u t . Batch j obs a r e u s ua l l y i n i t i a t ed t h r o ug h t h e S UBM I T c omma nd , a l tho ug h un so l i c i t ed c a r d r e ad e r i nput wi l l a l s o r e s u l t i n the c r e a t i o n o f a b a tc h j o b . Th e c r uc i a l s t ep t h a t i s pe r fo rmed by the j ob c o n t r o l l e r is the c r e a t i o n o f a p r o c e s s t h a t e x e c u t e s t h e imag e LOG INOUT . Th i s i mag e i s a c t i v a t ed a nd c a l l ed e x a c t l y l i k e a ny o th e r imag e a s d e sc r i b ed 1n Ch a p t e r s 1 7 a nd 1 8 . T h e ac t i o n s t h a t i t t a k e s , e s pec i a l l y t h e mappi ng of a c omma nd l a ng ua g e i n te r p r e t e r i n to Pl s pa c e , are wh a t d i f f e r e n t i a t e i n t e r a c t i v e a nd b a t c h j o bs f r om the s i ng l e i m ag e p r o c e s s d e sc r i b ed i n the p r ev i o u s t h r e e c h a p te r s . Th e c r e a t i on o f an i n te r a c t i v e j ob is p i c t u r ed s c h em a t i c a l l y i n F i g u r e 2 0 - 1 . Th e c r e a t i o n o f a b a t c h j o b i s p i c t u r ed i n F i g u r e 2 0 - 2 . 20 . 1 . 1 Unso l i c i ted Te rm i n a l Input Th e t e rm i n a l i n te r r upt s e r v i c e r o u t i n e p e r fo rm s s pec i a l a c t i o n wh e n a n unex pe c t ed i n te r r up t o cc u r s . A c h e c k i s mad e t o d e t e rm i n e wh e th e r t h e d ev i c e i s o wn ed . I f the o wn e r p r o c e s s h a s r eque s t ed no t i f i c a t i o n o f un so l i c i t ed i n te r r up t s , it w i l l b e n o t i f i ed . O t h e rw i s e , the c h a r a c t e r s wi l l b e pl a c ed i n to a type - a h ead buf f e r . I f the d ev i c e i s n o t o wn ed , t h e j o b c on t r o l l e r i s no t i f i ed th r o ug h i t s m a i l bo x t h a t a n un o wn e d t e rm i n a l h a s r ec e i v ed an un e x p e c t ed i n te r r up t . I n a s e n s e , t h e j o b c o n t r o l l e r i s t h e d e fa ul t own e r o f a l l o th e r wi s e unc l a i m e d t e rm i n a l s . 20-1 Termin.a l Driver TTcu : Job Controller Job Controller's Mailbox Creates Process Contex t of Job Controller Process Conte x t of Newly Created Process SY SSINPUT [\) 0 I [\) SYSSOUTPUT SYSSERROR SYSSCOMMAND TTcu : LOGIN OUT. E X E 1) Verify Usern a m e / Password a g a inst record in the a uthorization file 2) Alter process characteristics according to authorization record. Set up process permanent flies for SYS$1NPUT, SYS$0UTPUT, SYS$ERROR, and SYS$COMMAND 3) Map requested CLI into P 1 space, stack login c ommand file, a nd pass control to CLI in supervisor mode ( Figure 20-4) F i g u r e 2 0-1 S t e p s I n vo l ve d i n I n i t i a t i ng a n I n t e r a c t i v e Job INTERACT I VE AND BATCH JOB S Job Controller's Mailbox Job Controller D ri v e r Creates Input Symbiont Process C o n t e x t of Job Con t r o l l e r Proc e s s Conte x t o f Input S y m b i o n t P roc e s s Context of Requesting Process Job Controller- m a k e s entry i n response t o $SNDSMB f rom either input symbiont o r SUBMIT utility ....------.... $ S U B M IT X . C O M CLI a c t i v a t e s S U B M IT u t i l i t y SUBMIT u t i l i t y notif ies Job Controller of r e q u e s t ed b a tch job I S SNDSMB Job Controller C re a t e s proce s s S o m e t i m e l a t e r . job con troller removes q ueue entry and c re a t e s reques ted p r o c e s s with specif ied charac teristics SY S $ 1 NPUT SY S $ C O M M A N D The two chief differences between batch and interactive jobs are: No user name/password verification has to occur 2) SYS$1NPUT and SYS$0UTPUT are different 1) SY S $ 0 UTPUT SY S $ ERROR X . LOG Figure 2 0-2 There is only a trivial difference between batch jobs initiated with a SUBMIT command and batch jobs read from the card reader. This is the method of creating the batch command file. The remaining operations performed by LOGINOUT for batch jobs are the same as those performed by interactive jobs P roces s c ha racter lsti c s a ltered accord i ng to authorization record __ _. 2) Map CLI and pass control to it. ..•••••••••-•••.•••••••-.••••••• �����·-·-1•) S t e ps I n v o l v ed i n I n i t i a t i ng a Ba t c h Jo b Th r o ug h a S UBM I T Comma nd a nd Th r o ug h a C a r d Re a d e r 2 0-3 INTERACT I VE AND BATCH JOBS The j o b c o n t r o l l e r r o u t i n e t h a t r e spo nd s to u n so l i c i t e d t e rm i n a l input s i mpl y c r e a t e s a p r o c e s s w i th the pa r a m e t e r s P r o c e s s Name TTc u : UIC [10, 40] Imag e Name SYS $ S Y S TEM : LOGI NOUT . E XE S YS $ I N P U T TTc u : S YS $ 0 UT PUT TTc u : S YS $ ERROR TTc u : Ba s e P r i o r i ty DEFPR I ( S YS B OOT Pa r am e t e r ) P r i v i l eg e Ma s k Al l P r i v i l eg e s wh e r e TTc u i nd i c a t e s t h e c o n t r o l l e r/ un i t o f t h e t e rm i n a l wh e r e the u n so l i c i t e d i np u t wa s t yped . No t e t h a t a l l i n t e r a c t i v e j o b s beg i n w i th a name i nd i c a t i ng the i r i np u t/o u t put d ev i c e a nd the i m ag e LOG INOUT a s th e i m a g e tha t w i l l e x ec u t e ( F i g u r e 2 0 - 1 ) . 20 . 1 . 2 Th e S UBM I T Command Wh e n the S UBM I T c omma nd i s e x e c u t ed , a m e s s ag e i s s e n t to the s ym b i o n t m a n ag e r ( th e j ob c on t r o l l e r ) , wh i c h p l a c e s the r eq u e s t ed j o b i n o n e o f i ts j o b q u e u e s . Wh e n the n umb e r o f a c t i ve j o bs i n o n e o f t h e b a tc h q u e u e s d r o p s b e l o w i t s m a x i m um va l ue , t h e j o b c o n t r o l l e r s e l e c t s the h i g h e s t p r i o r i ty p e nd i ng j o b f r om o n e o f i t s q ue ue s a nd c rea tes a p r o c e s s w i th the s pe c i f i e d ba tch s t r e a m a s SYS $ I N PUT a nd a l og f i l e i n a n a pp r o p r i a t e d i r e c to r y a s SYS $ 0 UTPUT ( F i g u r e 2 0 - 2 ) . Th e i m a g e tha t wi l l execute is LOG I NOUT , wh i c h a l l o ws the l a ng uag e o f t h e i n p u t s t r e am to b e a c omma nd l a ng uag e b e c a u s e LOG I NO UT w i l l m a p t h e a pp r o p r i a t e C L I i n t o the p r o c e s s P l s pa c e . 20. 1 . 3 U n so l i c i te d C a rd Re a d e r I nput An a l t e r n a t i v e m e t hod f o r s t a r t i ng ba tc h j o bs u t i l i z e s the s o - c a l l ed ho t c a r d r ea d e r feature tha t is a p a r t o f the c a rd r e a d e r d r i v e r i n t e r r upt s e r v i c e rout ine . L i ke the t e rm i n a l d r i ve r ' s i n t e r r up t s e rv i c e r out i ne , t h e c a rd r ea d e r d r i v e r i n f o rm s t h e j o b c o n t r o l l e r tha t a n u n ex p e c t ed i n te r r up t h a s o c c u r r ed o n a n un own ed d ev i c e . Th e j ob c o n t ro l l e r c rea tes a p r o c e s s s i m i l a r to the p r o c e s s c r e a t ed i n r e spo n s e to un so l i c i t e d t e rm i n a l i np u t e x c e p t tha t the i m ag e I N PSMB . E XE , the i np u t s ym b i o n t , e x e c u te s i n p l a c e o f LOG INO UT . Th e p r o c e s s pa r a m e t e r s tha t a r e p a s s e d by t h e j o b c o n t r o l l e r to t h e C r e a t e P r o c e s s s y s t e m s e rv i c e a r e 2 0-4 INTERACT IVE AND B ATCH J O B S P r o c e s s Name C Rc O : UIC [10, 40] Im a g e Name SYS $ S YS TEM : I N PSMB . E XE SYS $ I N PUT C Rc O : S YS $ 0 UTPUT C Rc O : S YS $ E RROR C Rc O : Ba s e Pr i o r i t y DE FPR I P r i v i l eg e Ma s k Al l P r i v i l eg e s { S YS B OOT Pa r am e t e r ) Th e f a c t tha t t h i s p r o c e s s h a s a c a rd r e a d e r fo r i ts o u t p u t d ev i c e i r r e l ev a n t b e c a u s e i t d o e s n o wr i t i ng t o e i th e r SYS $ 0 UT PU T SYS $ E RROR . is or Th e i n p u t s ymb i o n t r e ad s t h e $JOB a nd $ PAS SWORD c a rd s a nd pe r f o rm s a val i d a t i on s im i l a r to the one pe r f o rm ed b y LOG INOUT . Af t e r d e t e rm i n i ng the u s e r ' s d e fa u l t d i r e c to r y f r om t h e a u th o r i z a t i o n r ec o rd , the i n put s ymb i o n t o pe n s a f i l e i n tha t d i r e c t o r y a nd r e ad s t h e r e s t o f t h e j o b c a r d s i n to tha t f i l e . Te rm i n a t i ng c o nd i t i o ns of th i s r e ad a r e a n e nd o f f i l e , a n $ E OJ c a r d , o r ano t h e r $ J O B c a r d . On c e t h e i n p u t s t r e a m h a s b e e n r e ad i n to the u s e r ' s d i r ec t o r y , the s ymb i o n t s e nd s a m e s sag e to the j ob c on t r o l l e r , a nd t h e i nput o pe r a t i o n p r o c e ed s f r om t h i s po i n t i n e x a c t l y t h e s am e m a n n e r as fo r the S UB M I T c omma nd . Th a t is , the j o b c o n t r o l l e r w i l l ev e n t ua l l y c r ea t e a p r o c e s s wi th t h e c a r d f i l e a s S YS $ I N PUT , s ome l og file as SYS $ 0 UTPUT , a n d LOG IN OUT { wh i c h wi l l m a p a C L I ) a s the i m ag e t h a t w i l l e x ec ute { F i g u r e 2 0 - 2 ) . 20 . 2 THE LOG INOUT IMAG E Th e LOG INOUT i mag e i s r e s p o n s i b l e f o r v e r i f y i ng that the use r is a u tho r i z ed t o u s e t h e s ys t em , r e ad i ng h i s r e c o r d i n t h e a u th o r i z a t i o n f i l e , a nd a l t e r i ng t h e p r o c e s s chara c te r i s t i c s to r e f l e c t wh a t is f o und ther e . Th e m o s t i mpo r ta n t s te p tha t t h i s i m ag e pe r f o rm s i n a l t e r i ng t h e p r o c e s s i s t o m a p a c omm a nd l a ng uag e i n t e r p r e t e r i n to i t s r e s e rved pl a c e in P l s pa c e { p i c t u r ed i n F i g u r e 1 - 7 a nd l i s t ed i n Ta b l e E- 4 ) . 20 . 2 . 1 I n t e r a c t i ve Jobs Wh e n LOG INOUT e x e c u t e s in r e s p o n s e t o u n so l i c i t ed t e rm i n a l i np u t , it m u s t v e r i f y t h a t t h e u s e r h a s a c c e s s t o t h e s ys t em b e fo r e i t p r o c e e d s wi t h t h e r e s t o f i t s o pe r a t i o n s . I t d o es t h i s b y pe r fo rm i ng the fo l l o wi ng s t e p s . 1. A Ch a ng e Mo d e to Ex ec u t i v e s ys t em s e rv i c e i s e x e c u t ed . LOG INOUT pe r f o r ms all o f i t s o pe r a t i o n s i n e x e c u t i v e m o d e , b e c a u s e i t mus t wr i t e p r o t e c t ed d a t a s t r uc t u r e s . Th e PC a nd PS L p a i r t h a t a r e p u s h e d o n the s ta c k i n r e s po n s e to t h e C HM E e x c e p t i o n w i l l a l so b e t h e v eh i c l e tha t w i l l be u s ed to t r a n s f e r c o n t r o l to t h e C L I i n s upe rv i so r m od e . 2 0-5 I N TERAC T I VE AND BATCH J O B S 2. A n e x e c u t i v e m o d e e x c e p t i o n h a nd l e r i s e s t a b l i sh e d in the p r i m a r y e x c e p t i o n v e c to r t o s e r v i c e a n y e x c e p t i o n s th a t o c c u r wh i l e L OG I N O UT i s e x e c u t i ng . I f t h i s h a nd l e r i s i nv o k ed , it wi l l c a l l SYS $ RMSRUNDWN f o r e a c h o pe n f i l e , a nd then c a l l S YS $ E X I T f r o m e x e c u t i v e m o d e . Th i s w i l l result i n the e v e n t ua l d e l e t i o n o f t h e p r o c e s s . 3. Th e l o g i c a l n am e s S YS $ I N PUT , S Y S $ 0 UTPUT , a nd SYS $ E RROR a r e t r a n s l a t ed a n d t h e r e s u l t a n t s t r i ng s a r e s a v ed f o r l a te r u s e . 4. Th e p r o c e s s I /0 s egme n t in P l s pa c e is i n i t i a l i ze d . S YS $ I N PUT is o pe n ed . Because a n i n t e r a c t i v e j o b i s b e i ng c r e a t ed , th i s i mp l i e s t h a t SYS $ 0 UT PUT a n d SYS $ E RROR a r e a l r e a d y o pe n ed . RAB s a r e c o n n e c t ed to the FAB s o th a t RMS o pe r a t i o n s m a y p r o c e ed . 5. Th e u s e r n a m e a nd pa s swo r d a r e p r om p t e d fo r a nd r e a d f r om t h e r e q u e s t i ng t e rm i n a l . Th e r e c o r d a s s o c i a t ed w i t h th i s u s e r i s read f r om t h e a u t ho r i z a t i o n f i le and the pa s s wo r d is v e r i f i ed . 6. I f the pa s s wo r d i s c o r r e c t a n d the i n te r a c t i v e j o b c o un t h a s n o t b e e n e x c e ed ed , t h e l og i n o pe r a t i o n wa s a s uc c e s s . Th i s s uc c e s s i s i nd i c a t ed by t h e a nno u n c em e n t m e s sag e We l c om e to VAX/VM S Ve r s i o n V 2 . 2 7. Fo u r by t e s c o n t a i n i ng RM S i n fo rm a t i o n a r e a d d ed to the b eg i n n i ng o f t h e r e s u l t a n t s t r i ng s f o r SYS $ I N PUT , SYS $ 0 UT PU T , a nd SYS $ E RROR . Th e s e fo u r by t e s a r e < e s c a pe > , < n u l l > , and a wo r d c o n t a i n i ng t h e i n te r n a l f i l e i d e n t i f i c a t i o n ( I F I ) o f t h e SYS $ I N PUT . New l o g i c a l n am e s a r e c r e a ted fo r SYS $ I N PU T , SYS $0UTPUT and SYS $ E RROR u s i ng t h e mod i f i ed r e s u l ta n t s t r i ng s . Wh e n RMS r e c e i v e s s uc h a m o d i f i e d name a s a resu l t o f l o g i c a l n am e t r a n s l a t i o n , i t u s e s t h e I F I a s a n i nd e x i n to one of i t s i n t e r n a l t a b l e s . A l o g i c a l name i s a l s o c r e a t ed fo r SYS $ C OMMAND , us i ng the s am e trans l a t i on as ex i s ts fo r SYS $ I N PUT . SYS $COMMAND i s t h e n i d e n t i c a l t o the z e r o th l ev e l SYS $ I N PUT . ( No te th a t t h e l og i c a l name SYS $ C OMMAND i s a p r o d uc t o f LOG I N O UT a nd d o e s no t ex i s t f o r p r o c e s s e s tha t d o no t e x e c ute tha t i m ag e . ) Wh e n RM S pe r fo rms l o g i c a l n ame t r a n s l a t i o n o f o n e o f t h e s e l og i c a l nam e s , the two b y t e c omb i n a t i o n i nd i c a t e s th a t t h e n e x t wo r d o f th e r e s u l t a n t s t r i ng i s a n i nd e x i n to o n e o f i t s tables . Th i s a l l ows e x t r em e l y f a s t a c c e s s to the se c ommon l y used f i l e s . 8. Th e c omm a nd l a ng uag e i n te r p r e t e r i s m a pped i n to the l ow a d d r e s s end o f P l space ( Fi g u r e l-7 ) . Th i s i s a c compl i sh e d by a m e r g ed i m a g e ac t i v a t i o n of the se l e c ted CLI . ( Th e p r o c ed u r e L I B $ P l M E RGE f i r s t m e r g e s t h e C L I i n to P O s p a c e to d e t e rm i n e i t s s i z e , d e l etes the PO spa c e , a nd maps the c o r r e c t amo u n t o f P l s pa c e . G l o b a l l o c a t i o n C T L $G L C T LBASVA i s a l t e r ed to r e f l e c t the n e w l o w a d d r e s s e nd o f Pl spa c e . ) 2 0-6 INTERACT I VE AND BATCH JOBS 9. 10 . Th e c ommand l a ng u a g e i nd e pend e n t d a ta a rea , i nc l ud i ng the s ymb o l tabl es , is i n i t i a l i zed . P l s pa c e is e x pa nd ed by a n umb e r o f p a g e s e q ua l to the S YS B OOT pa r am e t e r C L I S YMTB L t o a c c ommo d a t e t h e C L I s ymbo l t a b l e . Th e s e s ym bo l t a b l e s h a v e the s a m e s t r uc t u r e a s t h e l og i c a l n a m e t a b l e s d e sc r i b e d in Ch a p t e r 2 6 . Ma ny o f the a u tho r i z a t i o n o v e r wr i t i ng the Th e s e c r ea ted . process a tt r ibutes e x t r a c ted f r om the file a re put i n to t he i r p r o pe r pl a c e s , a t t r i b u t e s p l a c ed the r e wh en the pr o c e s s wa s i n c l ud e • De f a ul t D i r e c t o r y S t r i ng • Us e r Name • Ac c o un t Name • De f a ul t P r i v i l eg e Ma s k • P r o c e s s Quo t a s ( b e c a us e th i s i s a d e t a c h e d p r o c e s s ) • Ba s e S o f t wa r e P r i o r i t y • UIC LOG INOUT a t t emp t s to c h a ng e t h e p r o c e s s n ame f r om TTc u : to the us e r n a m e . Th i s wi l l f a i l i f ano the r p r o c e s s Tn t h e s a m e g r o u p a l r e a d y h a s the s am e n a m e . ( Th e mo s t c ommon o c c u r r e n c e of th i s i s wh e n t h e s ame u s e r i s l ogg ed i n a t mo r e th a n o n e t e rm i n a l . ) I n t h e c a s e o f fa i l u r e , t h e p r o c e s s wi l l r e ta i n the n a m e o f _TTc u : , g ua r a n t e ed to b e un i que f o r a g i v e n s ys tem . 11. Th e l og i n c ommand f i le ( e i ther LOG I N . C OM i n t h e d e fa u l t d i r e c to r y o r an a l t e r n a t e f i l e i nd i c a ted i n the a u th o r i z a t i o n r e co rd ) i s o pe n ed a nd s e t u p a s the n e x t l ev e l S YS $ I N PUT . Wh e n t h e C L I i s f i r s t e n t e r ed , i t i s a c t ua l l y o n e l ev e l d e e p i n i n d i r e c t f i l e s , e x t r a c t i ng i t s c omma nd s f r om t h e l og i n c ommand file. Wh e n the e nd o f th i s f i l e i s r e a c h e d , c o n t r o l pa s s e s b a c k t o t h e z e r o th l ev e l , t h e te rm i n a l o n wh i c h the p r o c e s s wa s o r i g i n a l l y c r e a t e d . 12. At th i s po i n t , LOG INOUT h a s f i n i shed i t s wo r k a nd pa s s e s contro l to t h e a l r e ad y m a pped C LI . Th i s transfe r is a c compl i s hed by a l t e r i ng the C HM E e x c ept i o n PC to po i n t to the l o we s t ad d r e s s in the C L I , a nd a l t e r i ng the m o d e f i e l d s i n t h e e x c e p t i o n PS L t o i nd i c a t e tha t the p r ev i o u s mod e a nd the c u r r e n t mod e are s upe r v i so r . Th e return f r om the e x e c u t i v e m o d e p r o c ed u r e g o e s bac k to the s ys t em se rv i c e d i s pa t c h e r , but the RE I t h a t d i sm i s s e s the CHME e x c ept i o n d o e s no t pa s s c o n t r o l b a c k to the sys tem s e r v i c e vec to r a r e a . Ra the r , the RE I p a s s e s c o n t r o l to the f i r s t add r e s s i n the ma pped C L I , e x e c u t i ng in s upe r v i s o r mo d e . 2 0-7 I NTERACT IVE AND BATCH JOBS 20 . 2 . 2 LOG I NOUT O pe r a t i o n f o r B a t c h Jobs Many o f t h e o pe r a t i o n s pe r fo rmed by LOG INOUT f o r i n t e r a c t i v e j o b s m u s t a l s o o c c u r wh e n a b a tc h j o b i s b e i ng c r e a t ed . Fo r ex ampl e , i t i s s t i l l n ec e s s a ry t o o pe n the i np u t a nd o u tp u t s t r eams a nd m a p t h e CLI . Howe v e r , pa s s wo r d ve r i f i c a t i on i s n o t n e c e s s a ry , e i th e r b e c a u s e the i np u t s ym b i o n t a l r e a d y d i d i t o r b e c a u s e i t i s not n e c e s s a r y i n the c a s e of a S UBM I T c omm a nd . Ra t h e r t h a n d e s c r i b e t h e s t e p s pe r f o rmed by LOG INOUT s i mpl y l i s t tho s e d i f f e r e n c e s fo r b a tc h j o b s . aga i n , we wi l l 1. Th e f i r s t i nd i c a t i o n t h a t LOG INOUT h a s tha t i t i s c r e a t i ng a b a tc h j ob is that t h e r e s u l t a n t s t r i ng s f o r SYS $ I N PUT a nd S YS $0UTPU T a r e d i f f e r e n t . Th i s m e a n s tha t i t m u s t o pe n two f i l e s a s p r o c e s s pe r m a n e n t f i l e s r a th e r th a n o n e a nd p r e s e r v e t wo I F i s f o r l a t e r u s e . 2. Th e p r o mp t ed r e ad fo r u s e r n am e a nd pa s swo rd a nd the a n n o un c em e n t of t h e s ys t em a r e s k i pped b e c a u s e th i s s t e p i s unnece s sa ry . 3. New l o g i c a l n am e s a r e aga i n c r e a t ed fo r SYS $ I N PUT , S YS $0UTPUT , SYS $ E RROR a n d SYS $C OMMAND . Bec a u s e two f i l e s a r e i nvo l v ed , d i f f e r e n t I F i s w i l l b e ad d ed t o t h e b eg i n n i ng of t h e r e s u l t a n t s t r i ng s b e fo r e C r e a t e Log i c a l Name i s c a l l ed . One I F I i s u s ed fo r S YS $ I N PUT a nd SYS $ C OMMAND . Th e o th e r I F I i s u s e d f o r SYS $ 0 UT PU T a nd SYS $ E RROR . 4. Th e r e wr i t e o f p r o c e s s a t t r i b u t e s f r om the a u th o r i z a t i o n f i l e c a n a l s o b e sk i pped . B e c a u s e the j o b c o n t r o l l e r knows m uc h mo r e a b o u t a b a tc h j o b t h a n a n i n te r a c t i v e j o b wh e n i t c al l s C r e a t e P r o c e s s , mo s t o f t h e s e a t t r i b u t e s a r e a l r e a d y i n p l a c e a nd n e e d no t b e wr i t t e n b y LOG INOUT . Th e m a pp i ng o f t h e C L I a nd t h e t r a n s f e r o f c o n t r o l to i t h a ppen in e x a c t l y t he s am e wa y a s t h e y d o fo r a n i n te r a c t i v e j o b . Th u s i n bo th c a s e s , the f i r s t c omma nd s t h a t e x e c u t e a r e the c ommand s in t h e use r ' s l og i n c omma nd file. I f a l o g i n c ommand f i l e i s spec i f i e d a s pa r t o f t h e u s e r ' s a u tho r i z a t i o n r e c o rd , t h e n tha t f i l e i s u s e d . I f no t , then the f i l e LOG I N . COM i n t h e u s e r ' s d e f a u l t d i r ec t o r y i s u s ed . 20 . 2 . 3 Th e Log o u t Ope r a t i o n Th e same i m a g e t h a t pe r f o rms t h e i n i t i a l i z a t i o n o f a n i nterac t i ve or b a tch j ob is u s ed t o c a u s e the ev e n t u a l d e l e t i o n o f s uc h a p r o c e s s . Th e i nd i c a t i o n t h a t a l og o u t i s r e qu i r e d i s th a t the f i l e SYS $ I NPUT i s a l r e a d y o pe n ed . LOG IN OUT t a k e s wh a t e v e r s pec i a l a c t i o n i s r e q u i r e d b e f o r e c a l l i ng d e l e t e p r o c e s s , wh i c h w i l l c o n t i n ue w i th tho s e pa r t s o f process d e l et ion t h a t a r e i nd e pe nd e n t o f t h e k i nd o f p r o c e s s th a t i s b e i ng d e l e t ed . 1. Th e l o g o u t m e s s ag e i s s e n t to SYS $ 0 UTPUT , e i th e r the user ' s t e rmi na l fo r a n i n t e r a c t i v e j o b o r the b a t c h l og fo r a b a tc h j ob . 2. SYS $ 0 UTPUT i s c l o s e d . I f th i s i s a b a tc h j ob , t h e n S YS $ I NPUT i s d i f f e r e n t a nd m u s t a l s o b e c l o s ed . 2 0-8 INTERAC T I VE AND BATCH JOBS 20 . 3 3. SYS $ RMSRUNDWN i s c a l l ed fo r e a c h o pe n f i l e . 4. F i n a l l y , S YS $ E X I T i s c a l l ed f r om e x e c u t i v e m od e . As we d i s cus sed i n Ch a p te r 1 8 , t h e se a r c h fo r t e r m i n a t i o n h a n d l e r s w i l l o n l y l o o k a t the e x ec u t i ve mode l i st , b ypa s s i ng the s upe r v i s o r mo d e te rm i n a t i o n h a nd l e r e s t a b l i s h e d by the C L I to p r e v e n t p r o c e s s d e l e t i o n f o l l o w i ng i mag e e x i t . 5. A f t e r the e x e c u t i v e m o d e t e rm i n a t i o n hand l e r h a s pe r fo rmed i t s wo r k , the Ex i t s ys t em s e rv i c e wi l l c a l l De l e te P r o c e s s , wh i c h w i l l c a u s e the l og g e d o u t p r o c e s s to d i s a pp e a r f r om the s y s t em . C OMMAND LANGUAG E INTERPRETERS AND I MAG E EXECUT I ON O n c e the c omma nd l a ng uag e i n te r p r e t e r g a i n s c o n t r o l , i t pe r fo r m s some i n i t i a l i za t ion a nd then r e ad s a nd p r o c e s s e s s uc c e s s i v e r e co r d s f r om SYS $ I N PUT . S e v e r a l of t h e s e o p e r a t i o ns i nv o l v e fancy comm a nd l a ng uag e features . We a re onl y i n te r e s t ed i n tho s e c ommand s th a t r e s u l t i n j o bs wi th s i mpl e i m ag e e x e c u t i o n , t o co n t r a s t i n te r a c t i v e a nd batch p r o c e s s e s d e sc r i b ed i n p r ev i o u s c h a p t e r s . VAX/VM S s u ppo r ts two c omma nd l a ng u ag e i n t e r pr e t e r s , DC L and MCR . Th e c h i e f d i f f e r e nc e b e t we e n the s e c ommand l a ng uag e s l ies in the i r t r e a tm e n t o f i nd i r e c t f i l e s , a to p i c tha t d o e s n o t a f f e c t i m ag e execut ion . In fact , t h e s t e p s t a k e n by e i the r C L I i n a c t i v a t i ng a n i m a g e a r e n e a r l y i d e n t i c a l . W e w i l l d e sc r i b e the o pe r a t i o n o f DC L in d e t a i l , a nd o n l y m e n t i o n MCR wh e r e i t d i f f e r s f r om DC L . Th e m o s t i mpo r t a n t s t e p tha t th e C L I pe r fo rms a s f a r a s the " l i f e o f a process " is c o nc e r n ed is the d ec l a r a t i o n o f a s upe r v i so r mod e t e rm i n a t i o n h a nd l e r . I t i s th i s h a nd l e r tha t w i l l prevent proc ess delet ion f o l l o w i ng i m ag e e x i t a nd a l l o w t h e s uc c e s s i v e e x e c u t i o n o f m u l t i pl e i mag e s wi th i n t h e s ame p r o c e s s . A s i mpl i f i e d f l o w o f c o n t r o l t h r o ug h t h e C L I i s p i c t u r ed i n F i g u r e 2 0 - 3 . 20 . 3 . 1 C L I I n i t i a l i za t i o n Th e f i r s t c o d e t h a t e x e c u t e s i n DC L pe r fo rms seve r a l i n i t i a l i za t i o n s t eps b e fo r e i t e n t e r s the ma i n comm a nd p r o c e s s i ng l o o p . 1. SYS $ R UNDWN i s c a l l ed w i th a n a rg umen t o f u s e r mod e to r und own the L OG INOUT i m a g e . 2. A c h a ng e m o d e to s upe r v i so r h a nd l e r i s e s t a b l i s h e d ( by u s i ng the $DC LCMH s ys tem s e r v i c e ) . Th i s h a nd l e r a l l ows DC L to g e t b a c k t o s upe r v i s o r mod e f r om u s e r m o d e wh e n i t n e ed s t o wr i t e p r o t e c t ed d a t a s t r uc t u r e s . One i n s tance wh e r e th i s is r e q u i r e d i s i n s ymbo l d e f i n i t i o n , b e c a u s e DC L ' s s ymbo l t a b l e s a r e p r o t ec t ed f r om wr i t e a c c e s s b y u s e r mode . 3. A C ONTRO L/Y AST i s d e c l a r ed so c o n t r o l wh e n C TR L/Y i s typed . 4. F i n a l l y , c o n t r o l i s pa s s ed to the f i r s t i n s t r uc t i o n o f the m a i n command p r o c e s s i ng l o o p ( a t g l oba l l a b e l DC L $ RE S TART o r M C R $ R E S TART ) . 2 0-9 tha t DC L a l wa ys r ece ives CLI Initialization Code ....�------ from LOGINOUT Establish CH M S handler to Exception Dispatcher Rundown LOGINOUT Image DEBUG Command l Generate SS$_DEBUG signal �---� r---�� Beginning of CLI Command Processing Loop -·--�-- STO P Command (Close all flies, rundown Image, and get next command) Determine whether command executes Internally or requires external Image .... . Internal Routine [\.) 0 I .... 0 � External �Image � � command and Service Internal � CONTINUE Command go back to top of main loop. If CO NTINUE, STOP, EXIT, or DEBUG, go there. (If previously executing Image was Interrupted with iCTRLIY then return control) I L t-·------Rundown previous Image Redeclare supervisor mode termination handler r+' $EXIT System Service 1-- -------Ralse access mode to supervisor Call supervisor mode termination handler .,_I- Activate the Image Raise access mode to user CTRL/Y AST .,_ • (Save context of Interrupted Image and .. get next command) Set up call frame and condition handler transfer-address: : EXIT Command Portion of CLI that activates and calls external Images RET Image Code 11,... � ��������; ::: M n dler Declared by Cl.l 1--------Ciose all open flies Purge Input stream of data records Rundown Image Restore stack to known stack Go back to top of main loop .... Build argument list CALL Imago CALL SYS$EXIT ... 1- Call SYS$EXIT ...-+--------------------------� Figure 20-3 S i mp l i f i e d Co n t r o l F l o w Th r o ug h a Command La ng u a g e I n t e r p r e t e r INTERACT I VE AND BATCH JOBS 20. 3. 2 Command P r o c e s s i ng Lo o p Th e ma i n c ommand p r o c e s s i ng l o o p r e ad s a r e c o rd f r om SYS $ I N PUT a n d t a k e s wh a t e v e r a c t i o n i s d i c t a ted by t h e c ommand . Some a c t i o n s c a n b e pe r fo rmed d i r e c t l y by DC L { o r MCR ) . O t h e r s r e qu i r e the e x e c u t i o n o f a s e pa r a t e i m ag e . Ta b l e 2 0 - 1 l i s t s t h e g en e r a l ope r a t i o n s pe r fo rmed by DC L { o r MCR) a nd i nd i c a t e s tho s e a c t i ons tha t r equ i r e an external imag e . Ta b l e 2 0 - 1 G e n e r a l Ac t i o n s Pe r fo rmed by a Comma nd La ng ua g e In te r pr e te r Ge n e r a l C L I Op e r a t i o n s Sampl e Co mma n d s Co mma nd s tha t Re qu i r e Ex t e r n a l Imag e s C OPY LINK So me S E T Comma nd s Some S H OW Command s Command s tha t Re qu i r e In t e r n a l Pr o c e s s i ng and an Ex t e r n a l Imag e LOGOUT MCR RUN Fo r e i g n Comma nd s s t r i ng : = = " $ imag e- f i l e - s pe c " Oth e r Ope r a t i o n s tha t De s t r o y an .Im ag e STOP EXIT Inv o k i ng a Comma nd Pr o c ed u r e CTR L/Y i n te r r up t i ng a p r i v i l eg ed i m ag e Command s tha t C L I Ca n Ex e c u t e I n t e r n a l l y E XAM INE , S E T DE FAULT { Ta b l e 2 0 -2 ) Oth e r I n t e r n a l Op e r a t i o n s Sym b o l De f i n i t i o n I f t h e r e c o r d t h a t i s r e ad f r om t h e i nput s t r e am is a r e c og n i z e d c omm a nd , DC L ( o r MC R ) m u s t a l so d e t e rm i n e wh e th e r i t c a n p e r fo r m t h e r eq u e s t e d a c t i o n i t s e l f o r a c t i v a t e a n e x t e r n a l i m ag e . Tab l e 2 0 - 2 l i s t s t ho s e c omma nd s tha t c a n b e e x e c u t e d b y DC L o r MCR wi tho u t ( Sp e c i a l c omm and s u s ed by t h e d e s t ro y i ng a c u r r e n t l y e x e c u t i ng i ma g e . M C R i nd i r e c t c omm a nd f i l e p r o c e s s o r a r e n o t i n c l ud ed i n t h e t a b l e . ) Any o th e r c ommand e i th e r r e qu i r e s a n i m ag e i n o rd e r to execute ( s uch as C O PY or L I NK ) or d i r e c t l y a f f e c t s the c u r r en t l y e x e c u t i ng i m ag e ( s uch a s STO P ) . 2 0-1 1 INTERACT I VE AND BATCH JOBS Ta b l e 2 0 - 2 Comma nd s Ha nd l ed b y C L I I n t e r n a l Pr o c ed u r e s Command De sc r i pt i o n ALLOCATE ASS IGN C LO S E C ONT INUE DEA LLOCATE DEA S S IGN DEBUG $DECK DEF INE DE POS IT DELETE/ SYMBOL $ E OD EXAM I N E EXI T Al l oc a t e a d ev i c e C r e a t e a l og i c a l name C l o se a process pe rman ent f i l e Re s um e i n t e r r upted i m ag e Dea l l oc a te a d ev i c e De l ete a l og i c a l name Invoke the symbo l i c d eb ug g e r Del im i t t h e beg i nn i ng o f a n i n put str eam C r e a te a l og i c a l name Mod i fy a memo ry l ocat i o n De l e te a symbol d e f i n i t i o n Del im i t t h e end o f an i n put s t r e am E x am i n e a memo ry l o c a t i o n Ex i t a c ommand proced u r e Rundown an imag e a ft e r i nvo k i ng t e rm i n a t i o n hand l e r s Tr a n s f e r c o n tro l w i th i n a command p r oced u r e Co nd i t i o n a l command ex ec ut i o n I n t e r a c t i v e l y a s s i g n a v a l ue to a symbol De f i n e c o nd i t i o n a l ac t i o n Open a pr o c e s s pe rmanent f i l e Read a r ec o rd i n to a symbol (D) (D ) (D) (D ) (D) (D) GOTO IF I N QU I R E ON O PEN R EAD Some S E T SET SET SET SET SET (D) (D ) Commands [ N O ] C ONTROL-Y DEFAULT [ N O ] ON PROTEC T ION UIC (D) (D) De t e rm i n e C TRL/Y a c t i o n De f i n e d e fa ul t d i r ec to ry s t r i ng De t e rm i n e e r ro r proc e ss i ng De f i n e d e f a u l t f i l e pro tec t i o n Ch a ng e p r o ce ss U IC a n d d e fa ul t d i r ec to ry s t r i ng De t e rm i n e echo i ng of command p r o c ed u r e c ommands S E T [ NO ] VE R I FY Some SHOW SHOW SHOW SHOW SHOW SHOW SYMBOL S HCM TIME SHOW TRANS LAT I ON S TOP WAI T WR I T E (D) Command s DE FAULT PROTEC T I ON QUOTA STATUS (D) (D) Di spl a y d e fa ul t d i r ec to ry s t r i ng Di spl a y d e fa ul t f i l e pro tec t i o n Di spl ay c u r rent d i sk f i l e usag e Di spl a y s ta tus o f cur rentl y e x ec ut i ng i mag e Di spl a y v a l ue o f s ymbol ( s ) Di spl a y c ur r ent t ime Sho w t r an s l a t i o n of s i ng l e l og i c a l name Rundown a n imag e bypa ss i ng t e rm i n a t i o n hand l e r s Wa i t fo r spec i f i ed i n te rval to e l a pse Wr i te the v a l ue of a symbol to a f i l e Th e s e c omma nd s a r e ava i l a b l e i n t h e DC L b ut n o t i n the MCR c ommand i n t e r p r e t e r . 20. 3 . 3 c ommand i n t e r pr e te r I m ag e I n i t i a t i o n by DC L I f o n e o f the o pt i o n s t h a t r eq u i r e s a n e x t e r n a l i mag e wa s d e t e c ted , DC L f i r s t pe r fo rms some c omma nd - s pec i f i c s t e ps . I t then ente r s a c ommo n r o u t i n e to fo rma l l y a c t i v a t e a nd c a l l the 1 m ag e . Th e s t e ps tha t i t t a k e s a r e n e a r l y i d e n t i c a l to the s teps pe r f o rmed by PR OCSTRT t h a t a r e d e sc r i b ed i n C h a p t e r 1 7 . 2 0- 1 2 INTERACT IVE AND BATCH JOB S 1. Th e p r ev i o u s i m ag e ( i f any ) i s r und own by c a l l i ng SYS $ R UNDWN . Th i s c a l l r emo v e s any t r a c e s o f a p r ev i o u s l y e x e c u t i ng i m ag e b e f o r e a n o t h e r i m ag e i s a c t i v a ted . In the case wh e r e the p r e v i o u s i m a g e t e rm i n a t ed n o rm a l l y , th i s c a l l i s unnec e s s a r y . Ho we v e r , a CTR L/Y f o l l o we d b y a n e x t e r n a l c ommand bypa s s e s t h e no rma l i m a g e t e r m i n a t i o n pa th , r e q u i r i ng th i s e x t r a s t e p t o i n s u r e t h a t a pr ev i o u s i m ag e i s e l i m i n a t ed b e f o r e a no th e r i s a c t i va ted . 2. Th e s upe r v i s o r m o d e t e r m i n a t i o n h a nd l e r tha t w i l l a l l o w DC L to r eg a i n control at i mag e ex i t i s d ec l a r ed . Re c a l l f r om Ch a p t e r 18 th a t an ex i t h a nd l e r m u s t b e r e d e c l a r e d a f te r e a c h use . 3. The i m ag e i s a c t i v a t ed by c a l l i ng SYS $ I MGAC T ( Ch a p te r 1 8 ) . 4. Ac c e s s mod e i s r a i s ed to u s e r . 5. Th e c a l l f r ame c h a i n i s t e rm i n a t e d by c l e a r i ng F P . 6. An i n i t i a l c a l l f r ame i s c r e a ted o n the us e r stac k . Th e add ress o f the c a tc h a l l c o nd i t i on h a nd l e r i s pl a c ed i n to t h i s f r ame a n d a l s o i n to t h e l a s t c h anc e e x c e p t i o n v e c t o r . 7. Th e a r g um e n t l i s t ( F i g u r e 2 0 - 4 ) th a t wi l l be pa s s e d to the i m ag e ( a nd to a n y i n te r v e n i ng p r o c ed u r e s s uc h a s SYS $ I MG S TA ) i s b u i l t o n th e u s e r s t a c k . I 6 Address of Transfer Address Array Address of C LI Utility Dispatcher Address of Image Header Add ress of I m a ge File Descriptor Link Flags from Image Header CLI Flags ( 0 from PROCSTRT) Figure 2 0-4 8. Arg um e n t L i s t Pa s s ed to an Imag e by PROC S TRT o r a C L I Th e i m a g e i s c a l l e d a t t h e f i r s t add r e s s in the transfer add ress a r r a y d e s c r i b ed i n C h a p t e r 1 8 . As men t i o n ed i n t h e d i s c u s s i o n o f Imag e S t a r t up , t h i s wi l l u s ua l l y be t h e a d d r e s s of t h e d e b ug bo o t s t r a p t h a t wi l l e s ta b l i s h t h e t r a c e b a c k e x c e p t i o n h a nd l e r a n d m a p t h e d eb ug g e r i f r e q u e s t e d . 2 0-1 3 INTERAC T I VE AND BATC H JOBS 9. 20 . 3 . 4 Th e i n s t r uc t i o n fo l l o w i ng the c a l l to the i mag e i s a c a l l to S YS $ EX I T . Un l i k e the c h e c k m ad e in PR OC S TRT , the cod e pa th t h r o ugh DC L m a k e s i t i r r e l ev a n t wh e th e r a n imag e t e rm i n a t e s w i th a R E T o r a c a l l t o S YS $ E X I T . Othe r r e a so n s , d e s c r i b ed i n Append i x E of the VAX- 1 1 Run- T i m e L i b r a r y Re f e r en c e Ma n ua l , s t i l l m a k e t h e R E T i n s t r uc t i o n t h e p r e f e r r ed m e th o d o f i mag e t e rm i n a t i o n . Imag e Te rm i na t i o n Wh e n a n i m a g e i n a n i n t e r a c t i v e o r b a tc h j ob t e rm i n a t e s , the Ex i t s e rv 1 c e w i l l e v e n t ua l l y c a l l the s upe r v i so r mod e t e rm i n a t i o n s y s t em h a nd l e r e s t a b l i shed by DC L b e fo r e the i m ag e wa s c a l l ed . Th i s t e rm i n a t i o n h a nd l e r pe r fo rms s ev e r a l c l e a n up s t eps b e f o r e pa s s i ng c o n t r o l to the b eg i nn i ng o f t h e m a i n c omma nd loop to a l l o w DC L to p r o c e s s the n ex t c omma nd . 1. An y f i l e s l e f t o pe n by t h e i mag e SYS $ RMSRUNDWN f o r e a c h o p e n f i l e . 2. An y d a t a r e c o r d s i n the i nput s t r eam ( r ec o r d s tha t d o n o t beg i n w i th a d o l l a r s i g n fo r DC L o r a r i g h t a ng l e b r a c k e t fo r MCR ) a r e d i s c a r d ed a nd a wa r n i ng m e s s ag e i s s ued . 3. Th e i m ag e tha t j us t t e rm i n a t ed is r und own SYS $ R UNDWN w i th an a r g um e n t of u s e r m od e . 4. F i n a l l y , c o n t r o l i s pa s s e d to the b eg i nn i ng of the ma i n c ommand l o o p so tha t DC L c a n read a nd p r o c e s s the nex t c ommand . Th i s i s a c compl i s hed by r e s to r i ng the s upe rv i s o r s ta c k po i n te r to a known state ( w i t h the add ress o f DC L $ R E S TART o n t h e t o p o f the s t a c k ) and i s s u i ng a n RSB . 20 . 3 . 5 a re c l o s ed by by c a l l i ng c a l l i ng Abno rma l Imag e T e r m i n a t i o n Wh e n a n i m ag e t e r m i n a t e s no rma l l y , i t i s r undown a s a pa r t o f DC L ' s t e rm i n a t i o n h a nd l e r a nd c o n t r o l i s pa s s e d to DC L a t the s t a r t o f i t s c ommand l o o p . An i m ag e c a n a l s o b e i n te r r upted by t yp i ng a CTR L/Y o r b y us i ng the C OB O L o r F ORTRAN p a u s e c a pa b i l i ty . Fu r th e r ex e c u t i o n o f the i m a g e d e pend s o n the s e q u e n c e o f c omm a nd s tha t e x e c u t e wh i l e the i m ag e i s i n te r r upted . 2 0 . 3 . 5 . 1 CTRL/Y P r o c e s s i ng - Wh e n a C TRL/Y ( o r po s s i b l y a C TR L/C ) is typed a t the t e r m i n a l , c o n t r o l i s p a s s e d by the te rm i n a l d r i v e r to the AS T t h a t wa s e s t a b l i sh e d b y DC L a s a pa r t o f i t s i n i t i a l i z a t i o n . Th e f i rst s t e p pe r fo rmed by t h i s AST i s to r ed e c l a r e i t s e l f . Th i s wi l l c a u s e f u t u r e C TR L/Ys to be pa s s e d to the same AST . The p r ev i o u s mod e of t h e PS L i s then c h e c ked . I f the p r ev i o u s mode wa s s upe r v i so r , DC L c h e c k s wh e th e r a S E T NOC ONTRO L Y c omma nd h a s b e en e x e c uted . If so , the i n te r r up t is s i mpl y d i sm i s s ed . I f n o t , DC L i s r e s to r ed to i t s i n i t i a l s t a t e ( w i th no n e s t i ng o f i nd i r e c t l ev e l s ) and control is pa s s e d t o the beg i n n i ng o f t h e m a i n c ommand l o o p . 20-1 4 INTERACTIVE AND BATCH JOBS If the p r ev i o us m o d e wa s u se r , t h e n an i m ag e wa s i n t e r r upted . If the i n t e r r up t ed i mag e is i n s t a l l ed w i th e nh a n c ed p r i v i l eg e s , t h e n t h e i ma g e i s r un d o wn , p r ev e n t i ng t h e u s e r f r om b e n e f i t t i ng f r om p r i v i l eg e s t o wh i ch h e i s n o t e n t i t l ed . A s i d e e ff e c t o f th i s pro tec t i o n check p r e v e n t s i n te r r up t e d p r i v i l eg ed imag e s f r om b e i ng c o n t i n ued a ft e r a CTRL/Y . 2 0 . 3 . 5 . 2 The P a u s e Capab i l i ty - Th e VAX- 1 1 C OB O L a nd VAX- 1 1 F ORTRAN l a ng uag e s p r ov i d e t h e c apa b i l i ty to i n te r r upt a n i m ag e und e r p r og r am c o n t ro l . E i t h e r o f t h e Run-T i me L i b r a r y p r o c ed u r e s i mpl emen t i ng th i s f e a t u r e c o u l d a l so b e c a l l ed f r om a n y o th e r l ang uag e . • Th e C O B O L s t a t em e n t STOP l i t e r a l g e n e r a t e s a c a l l t o the Run-T i m e L i b r a r y p r o c ed u r e C OB $ PAUS E , wh i c h s e nd s t h e m e s sag e " l i t e r a l " to SYS $ 0 UTPUT a nd p a s s e s c o n t r o l t o t h e C L I a t t h e b eg i nn i ng o f i t s m a i n c omma nd l o o p . e Th e FORTRAN s t a t em e n t PAUS E [d i sp] g e n e r a t e s a c a l l to the Run-T i m e L i b r a ry pr o c ed u r e FOR$ PAU S E , wh i c h s e nd s t h e m e s sag e " d i sp " to SYS $ 0 UTPUT a n d pa s s e s c o n t r o l t o t h e C L I a t t h e b eg i nn i ng o f i t s m a i n c omm and l o o p . If the " d i sp " a rg um e n t i s o m i t ted , FOR $ PAU S E s end s t h e d e f a ul t m e s s a g e F ORTRAN PAUS E to S Y S $ 0 UTPUT . 2 0 . 3 . 5 . 3 Th e S t a te o f Inte r r upted Imag e s - I f a n o n p r i v i l eg ed imag e wa s i n t e r r upted , t h e i mag e c o n t e x t i s s a v ed a nd c o n t r o l i s p a s s e d to the b eg i nn i ng of t h e m a i n c omma nd l o o p t o a l l o w t h e use r to e x ec u t e c ommand s . I f DC L c a n p e r fo rm t h e r eque s t ed action i n te r n a l l y ( Ta b l e 2 0 - 2 ) , t h e n the i mag e c an po ten t i a l l y be c o n t i n u e d . Howe ve r , a ny c omma nd t h a t r e qu i r e s a n e x t e r n a l i m ag e wi l l d e s t r o y t h e c ontex t of t h e i n t e r r upted i mag e . In add i t ion , i f the use r ex e c u t e s a n i nd i r ec t c omm and f i l e wh i l e a n i mag e i s i n t e r r up t e d , t h a t i mag e is d e s t r o ye d , even tho ug h t h e c omm a n d s i n the i nd i r e c t c omma nd f i l e c an b e pe r fo rm ed i n te r na l l y by DC L . Fo u r c omma nd s t h a t the u s e r c a n ex e c u t e h a v e spec i a l i m po r ta n c e i f a n i mag e h a s b e en i n t e r r up t e d b y C TRL/Y . Th e s e c ommand s a r e C ONT IN U E , D E B UG , E X I T , a nd S TO P . 2 0 -1 5 INTERAC T I VE AND BATCH JOBS 2 0 . 3 . 5 . 4 CONT INUE Command - I f a C ON T INUE c omma nd i s typed wh i l e a t C ONTRO L/Y AST l ev e l a nd t h e p r ev i o u s mod e wa s us e r , the AST i s d i sm i s s e d a nd c on t r o l i s p a s s e d b a c k t o t h e i m a g e a t the po i n t wh e r e i t wa s i n t e r r upted . 2 0 . 3 . 5 . 5 DEBUG Command - As d e s c r i b ed i n Ch a pt e r 1 8 , a DE B UG c ommand c a use s DC L to g e n e r a t e a SS$ D E B UG s i g n a l th a t wi l l e v e n t ua l l y be f i e l d ed b y t h e c o nd i t i o n h a nd l e r es t a b l i s h ed by Imag e S t a r t up . Th i s h a nd l e r wi l l r e spo nd t o the S S $ D E B UG s i g n a l b y m a pp i ng the d eb ugg e r to it. Th i s ( i f i t i s n o t a l r e a d y m a pped ) a nd -t r a n s f e r r i ng c o n t r o l techn i que a l l o ws t h e d eb ugg e r to b e u s e d , even wh e n the imag e wa s no t l i nk ed w i t h the / D E B UG q u a l i f i e r . ( I n o rd e r fo r th i s c a pa b i l i t y t o wo r k , the i mag e c a nno t b e l i nk e d w i th t h e /NOTRAC EBAC K qua l i f i e r . Th a t qua l i f i e r p r ev e n t s Imag e S t a r t u p f r om e x ec u t i ng , wh i c h m e a n s tha t the h a nd l e r tha t d yn am i c a l l y m a ps the d eb ug g e r n ev e r g e t s e s t a b l i sh e d . ) 20. 3 . 5. 6 E X I T Command - Th e EXI T c omma n d c a u s e s a n Ex i t s ys tem s e rv i c e t o b e i s s u e d f r om u s e r mode . Te r m i n a t i o n h a nd l e r s a r e c a l l ed a nd the i m a g e i s r und o wn . 20 . 3 . 5. 7 STOP Command - Th e S T O P c omma n d pe r fo rm s e s sen t i a l l y the s am e c l e a n up o pe r a t i o n s tha t o cc u r f o r a no rma l l y t e rm i n a t i ng i m ag e . Howe ve r , S TOP d o e s i t s o wn wo r k a nd d o e s n o t c a l l SYS $ E X I T . Th i s me a n s t h a t use r m o d e t e rm i n a t i o n h and l e r s a r e n o t c a l l ed wh e n a n i mag e t e rm i n a t e s wi th a C TR L/Y S TO P s e quenc e . Th e STOP c omma nd p r o c e s so r f i r s t d e te rm i n e s wh e th e r an imag e o r a proc ess i s b e i ng s t o pped . ( Th e v a r i o u s po s s i b l e STOP c omma nd s a r e d e sc r i b ed i n the VAX/VMS C omma nd La ngu ag e U s e r ' s Gu i d e . ) I f an i mag e i s b e i ng s to pped , a l l o pe n f i l e s a r e c l o s ed by c a l l i ng SYS $ RM S RUNDWN . Th e i m a g e i t s e l f i s t h e n r und o wn ( by c a l l i ng SYS $ R UNDWN ) . Fi nal ly , c o n t r o l i s pa s s e d t o the b eg i nn i ng o f the m a i n c omma nd l o o p . No t e t h a t STOP p e r fo rm s nea r l y i dent i c a l o pe r a t i o n s to t h e DC L t e rm i n a t i o n h a nd l e r , i nv o k e d a s a r e s u l t o f a c a l l to SYS $ E X I T o r a n EXI T c omma nd . Th e o n l y d i f f e r e n c e b e twe e n e i th e r E X I T s e qu e n c e and the S T O P c omma nd i s t h a t u s e r m o d e t e rm i n a t i o n h a nd l e r s a r e no t c a l l ed f i rs t . Th us i n most c ases , the STOP a nd EXI T c ommand s are i n t e r c h a ng e ab l e . On e us e f u l a s pec t o f t h e STOP c ommand i s t ha t i t c a n b e u s ed to e l i m i n a t e a n i m ag e t h a t c on t a i n s a u s e r m o d e t e rm i na t i o n h a nd l e r tha t is p r ev e n t i ng that i mag e f r om compl e te l y g o i ng awa y , e i th e r i n t e n t i o n a l l y o r a s a r e s u l t o f a n e r r o r . 20-1 6 PART VI I SYSTEM I N I T IALI ZAT I ON a n t e ma r e e t t e r r a s e t q uo d t eg i t omn i a c a e l um u n u s e r a t to to n a t u r a e v u l t u s i n o r b e , q uem d i x e r e Ch a o s Me t amo r pho s e s Ov i d C HAPTER 2 1 BOOTS TRAP PROC EDURES Be fo r e a VAX/VM S s y s t em c a n ope r a t e , s ome i n i t i a l i z a t i o n p r og r am s (or b oo t s t r a p p r og r ams ) m u s t e x e c u t e t o c o n f i g u r e t h e sys tem and r e a d th e P a r t s o f the b o o t s t r a p o pe r a t i o n a r e spec i f i c e x e c u t i v e i n to m emo r y . to one t ype o f VAX C PU . O th e r s a r e c ommo n a c r o s s a l l VAX f am i l y membe r s . Ta b l e 2 1 - 1 s umma r i z e s the p r og r ams th a t e x e c u t e a nd the f i l es tha t a r e r e f e r e n c ed in o rd e r to i n i t i a l i z e a VAX/VM S s y s t em . Th i s c h a p t e r d e sc r i b e s a l l ph a s e s o f t h e bo o t s t r a p o pe r a t i o n tha t o c c u r b e fo r e c o d e c o n t a i n ed i n the e x ec u t i v e imag e ( S YS . EXE ) ex ec u t e s . 21 . 1 PROC ESS OR-S PEC I F I C IN I T IAL I Z AT I ON The i n i t i a l s t eps t h a t o c c u r i n the i n i t i a l i z a t i o n o f a VAX/VM S s y s t em d e p e nd on the pa r t i c u l a r VAX p r o c e s s o r t h a t i s b e i ng u s ed . The n e x t s e c t i o n s b r i e f l y d e sc r i b e the p r o c e s s o r - s pe c i f i c s t eps tha t o c c u r befo re t h e p r ima r y b o o ts t r a p p r og r am VMB g a i n s c o n t r o l and b eg i n s execut ion . Th e mo s t o bv i o u s p r o c e s so r - s pe c i f i c i t em t h a t a f f e c t s the boo t s t r a p o pe r a t i o n is t h e c o nso l e co n f i g u r a t i o n . An o v e rv i e w o f t h e c o n so l e s ub s ys t em fo r a s p e c i f i c VAX- 1 1 f am i l y mem b e r c a n b e fo und i n the VAX Ha r d wa r e Ha n d bo o k . 21 . 1 . 1 VAX- 1 1 / 7 5 0 I n i t i a l Boo t s t r a p Ope r a t i o n Th e c o n s o l e p r og r am on t h e VAX- 1 1 / 7 5 0 resides in r e a d - o n l y m emo r y wi t h i n t h e C P U . Wh en the C P U i s i n c o n so l e mod e , th i s p r og r am ( a n d n o t h i ng e l s e , s uc h a s a u s e r p r og r am or VM S i tsel f ) 1s e x e c u t i ng . Wh e n a VAX- 1 1 /7 5 0 s y s t em i s i n i t i a l i z e d , the c o n s o l e prog r am i s t h e f i r s t in a se r i e s of p r og r ams th a t e x e c u t e b e fo r e the pr ima r y Th e s e p r o g r ams i nc l ud e boo ts t r a p p r og r am VM B e x e c u t e s . 1. the c o n so l e s u b s y s t em , wh i c h i n i t i a l i z e s the C PU , locates a byte b l o c k o f g o od m emo r y , a nd pa s s e s c o n t r o l to a d ev i c e - s p e c i f i c ROM p r og r am , 2. a d e v i c e ROM , wh i c h r e a d s l og i c a l b l o c k n umb e r 0 ( LBN 0 , the s o - c a l l ed bo o t b l o c k ) f r om the boo t s t r a p d ev i c e i n to t h e f i r s t pag e o f t h e g o od memo r y b l o c k , a nd 3. the bo o t b l o c k p r o g r am , wh i c h r e ad s a f i l e f r om the b o o t s t r a p d e v i c e i n to memo r y . Wh en a VM S s ys t em i s b e i ng boo t s t r a pp e d , th i s f i l e w i l l u s ua l l y be VM B , t h e pr ima r y b o o t s t r a p p r og r am . 64K 2 1-1 BOOTSTRAP PROC EDURES A l i s t o f the p r og r ams t h a t e x e c u te d u r i ng th e initial pha s e o f i n i t i a l i za t i o n i s c o n ta i n e d i n T a b l e 2 1 - 1 . C PU-d epend e n t 2 1 . 1 . 1 . 1 VAX- 1 1 / 7 5 0 Con so l e P r og r am - Th e c o n so l e p r og r am on a VAX- 1 1 /7 5 0 i s s to r ed i n r e a d - o n l y m em o r y w i th i n the C PU . Th i s p r og r am c a n i n i t i a t e a b oo t s t r a p s eq u e n c e fo r f i v e d i f f e r e n t r e a s o n s . • • • • Th e s y s tem i s powe r ed o n a nd the po we r - o n s e l e c to r swi t c h i n t h e b o o t s t r a p po s i t i o n . Th e B ( Bo o t ) mod e . c o mmand i s typed wh i l e t h e sys t em i s i n A HA LT i n s t r uc t i o n i s e x e c u t ed a nd s w i t c h i s i n t h e boo t s t r a p po s i t i o n . the powe r - o n is c onso l e s e l ec to r Th e i n s t r uc t i o n M T PR i s e x e c u t ed . Th e VM S b ug c h e c k r o ut i ne u s e s th i s mecha n i sm o n all C PU s to a u toma t i c a l l y r e boo t the sys tem a f t e r a f a t a l s o f t wa r e c r a s h . ( Th i s a u toma t i c r eb o o t c a pa b i l i ty c an b e i nh i b i t ed b y c l e a r i ng t h e B UG R E B OOT SYS BOOT f l ag . ) • An a t tempt t o r e s ta r t the s ys t em a f te r a po we r fa i lure r e c o ve r y d o e s n o t s uc c e ed , a nd t h e po we r - o n s e l e c to r s w i t c h i s i n t h e r e s t a r t/bo o t s t r a p po s i t i o n . No te tha t the i mp l em e n t a t i o n o f the VAX- 1 1 / 7 5 0 p r e v e n t s una t t e n d ed ( th e l a s t th r e e o p t i o n s ) un l e s s t h e sys t em d ev i c e i s un i t 0 r esta r ts o n the f i r s t c o n t r o l l e r o f a g i v e n type s uc h a s the f i r s t MAS S B US a d apte r . Th e i mpo r ta n t s te p s t h a t a r e pe r f o rmed by t h e c o nso l e p r og ram i n c l ud e • • • • l o c a t i ng 6 4 K b y t e s o f c o n t i g uo u s e r r o r - f r e e pag e- a l i g n ed memo r y to be u s ed b y l a t e r s tag e s o f the boo t s t r a p , l o ad i ng t h e f i r s t 1 2 8 m a p r eg i s t e r s i n the UN I B US a d a p t e r to add ress t h i s b l oc k o f m emo r y , ( a s t ep n o t t a k e n wh e n us i ng t h e c o n so l e b l o c k s to r ag e d ev i c e a s a boo t s t r a p d ev i c e ) , l o ad i ng the g e n e r a l r eg i s t e r s wi th p a r am e t e r s to be l a t e r s t ag e s o f the b oo t s t r a p , a nd pa s s i ng c o n t r o l to the d ev i c e ROM s e l ec ted by d e v i c e s e l e c t o r swi tch . the u s ed by boo t s t r a p ROM p r og r am 2 1 . 1 . 1 . 2 Dev i c e - S p e c i f i c ROM P r og r am - Th e d ev i c e c o ns i s t s o f two m a i n p i e c e s , a co n t r o l r o u t i n e a nd a d ev i c e - s pec i f i c s ub r o u t i n e . Th i s p r og r am s i m p l y r e ad s t h e b o o t b l o c k ( LBN 0 ) of the s e l e c t ed d ev i c e i n to the fi rst pag e of t h e g ood mem o r y b l o c k a nd pa s s e s c o n t r o l to i t ( a t a n add r e s s 1 2 b y t e s pa s t the beg i n n i ng o f the p r og r am ) . 2 1-2 Ta b l e 2 1 - 1 P r o g r am s a nd Fi l e s Used Du r i ng Bo o t s t r a p Se quenc e ( C PU - I nd epend e n t Bo o t s t r a p S e q u e n c e ) P r og ram Ex ec u t i ng ( pr oc e s s cont e x t ) Pu r po s e of Th i s Prog ram Fi l e s VM B . EXE ( N o t e 1 ) ( s tand a l o n e prog r am) P r i m a r y Bo o ts t r a p Prog ram SYSBOOT. EXE SYSBOOT . EXE ( C ) ( s tand a l one prog r am) S e c o nd a r y Boo t s t r a p Prog ram co n f i g ur e s system and reads exec u t i v e i n to memo ry Pa r am e t e r F i l es Created by SYSGEN SYS . EXE ( C ) TTDR IVER . EXE ( C ) SYSLOAx x x . EXE ( C ) yyDR I VE R . E X E ( C ) E xecut i v e TTDR IVER . E X E ( C ) SYSLOAx x x . EXE ( C ) yyDR IVER . EXE ( C ) Loaded Loaded Loaded Fi r s t P r o c e s s S e l ec ted f o r Ex ec u t i o n SYS I N I T . EXE Image Spec i f i ed SYS I N I T . EXE ( C ) ( S YS I N I T p r o c e s s ) Co n t i nue I n i t i a l i za t i o n i n P r o c e s s Co n t e x t RMS.EXE (C) [ S YSMSG ] S YSMSG . EXE PAGEF I LE . SYS ( C ) SWAPF I L E . SYS ( C ) DUMPF I L E . SYS ( C ) Fl l z AC P . E X E ( C ) JOB C T L . EXE ERRFMT. EXE OPCOM. EXE STARTU P . COM LOGINOUT . EXE LOGINOUT . EXE ( S TARTUP P r o c e s s ) I n i t i a l I m a g e tha t Ex ecutes i n I n t e r a c t i v e Job DC L . EXE ( No te 2 ) Mapped i n to P l Spa c e o f STARTUP Pr o c e s s wi th Me r g e d Image Ac t i v a t i o n I N S TA L L . EXE ( S TARTUP Proc e s s ) Ins t a l l Pr i v i l eg ed and Sh a r eab l e Imag es Al l Pr i v i l eg ed , Sh a r eab l e , and o the r wi se I n s ta l l ed Images Al l I n s t a l l ed Imag es a r e S e t up a s Known Imag es SYSGE N . EXE ( S TARTUP P r o c e s s ) Autoc o n f i g u r e I /O Dev i c e s , Load Dr i v e r s , a nd C r eate I /O Data Ba se Al l Dev i c e Dr i v e r s Loaded as a Re s u l t o f AUTOCONFIGURE A L L Dr i v e r s for Al l Co n f i g ur ed Dev i c e s a r e Loaded i n to Nonpaged Po o l RMSSHAR E . EXE ( S TARTUP P r o c e s s ) Al l oc a t e B l o c k of Paged Po o l fo r F i l e Sh a r i ng none SYS . EXE (Mod ul e IN IT ) ( no p r o c e s s ye t ) (C) SYS . EXE (Mod ul e SWAPPER) ( SWAPPER proc e s s ) (C) (C) Th e se (1) VMB must b e c o n t i g uo us beca use o n the VAX- 1 1 /7 8 0 . (2) In i t i a l i za t i o n Used by Th i s Prog ram U s e of Opened a n d Read ( C) (C) (C) (C) Used i s l oaded b y e i the r i n to Memo ry to Co n f i g u r e System Opened and Opened Opened Opened Read i n to Mem o r y i n to Memory i n to Memory i n to Memory to Create Pr o c e s s Mapped a s Pag e ab l e S ys t e m Sec t i o n Mapped a s Pag eab l e System Sec t i o n Opened and In i t i a l i zed Opened and In i t i a l i zed Opened and In i t i a l i zed Imag e that Ex ecutes i n DxcuACP Process Image that Ex ec u t e s i n JOB CONTROL P r o c e s s I m a g e Spec i f i ed to C r e a t e ERRFMT Proc e s s Im a g e Spec i f i ed to C r e a t e OPCOM Proc e s s SYS $ I N PUT f o r STARTUP Pr o c e s s Im a g e Spec i f i ed to Cr e a t e STARTUP P r o c e s s f i l es m ust be c o n t i g uo us becaus e they a r e l oaded b y t h e pr i m i t i v e AC P r o u t i n e s th a t a r e it Th i s Fi l e pa r t o f t h e e x ecut i v e imag e . the b o o t b l o c k prog ram o n the VAX- 1 1 / 7 5 0 o r the c o n so l e prog ram CONS O L . SYS The autho r i za t i o n f i l e i s n o t used b y LOGINOUT h e r e beca use the STARTUP p r o c e s s i s c r ea ted wi t h a f l ag t ha t d i c t a t e s tha t a utho r i za t i o n sho u l d be s k i pped . Th i s is done to a l l o w t o ta l l y a utoma t i c i n i t.i a l i za t i o n and to e l i m i n a t e the need fo r an i n i t i a l i za t i o n account in the autho r i za t i o n f i l e . (continued o n ne xt page ) Ta b l e 2 1 - 1 ( cont . ) P r o g r ams a nd Fi l e s Used Du r i ng Bo o t s t r a p S e qu e n c e ( Initial Bootstrap Programs for VAX-11/7 5 0 ) Al l prog rams e x ec u t e i n t h e VAX-1 1/7 5 0 C PU , The r e i s no f r o n t e n d processo r pe r fo rm i ng any o f t h e boo t s t r a p o pe r a t i o n s . Prog r am Ex ec u t i ng Wh e r e Prog ram C onso l e Prog r am ( ex ec u t e s m i c rocod e ) Re a d-only m em o r y in VAX-1 1 /7 5 0 C PU Dev ic e-Spec i f i c Prog ram i n ROM Re a d-only memory in a d d res s s pa c e o f VAX-1 1 / 7 5 0 C PU Boot B l o c k Log i c a l B l o c k Number o f System Dev i c e Loc a te Pr i m a r y Bo o ts t r a p Prog ram o n system dev i c e (or c o n so l e sto r ag e d ev i c e ) l og i c a l bl oc k number and pa ss c o n t r o l to i t VM B . EXE Spec i f i c Log i c a l Bl o c k N u m b e r o n syst em dev i c e ( S ee f i r s t pa r t o f tabl e ) BOOT 58 ( no t used d u r i ng no rma l bo o t s t r a p ) Spec i f i c Lo g i c a l Bl o c k Number o n c o n so l e b l o c k sto rag e d e v i c e U s e Ind i r ec t Command Fi l es o r enhanced c o n so l e commands P r og ram Ex ec u t i ng Wh e r e Prog r am i s Lo c a ted LS I - 1 1 ROM Bo o t s t r a p ROM Fl o ppy Bo o t Bl ock Prog ram is Loc a ted ( In i t i a l Pu r po se o f Th i s Prog r am Locate b l o c k o f g ood mem o r y D e t e r m i n e a c t i o n to be ta ken and pa s s c o n t r o l to d ev i c e-spec i f i c prog r am I/O Load boot b l o c k ( LB N 0) o f d e s i g nated d ev i c e i n to memo ry and pa s s c o n t r o l to Bo o t s t r a p Prog rams for it by VAX-1 1 /7 8 0 ) CPU Used by Prog r am P u r po s e o f Th i s Prog r am LS I - 1 1 Read f l oppy boot b l o c k i n to memo ry and execute code c o nta i n ed the r e Log i c a l B l o c k 0 o n Co n so l e Fl oppy LS I-1 1 L o c a t e CONSOL . S YS , r ead i t i n to mem o r y , and pa ss c o n t r o l to i t CONS O L . SYS Somewh e r e o n Co n so l e Fl o ppy , an RT- 1 1 d i r ec to ry s t r uc t u r ed d ev i c e LS I - l l Put VAX- 1 1 / 7 8 0 i n to known s t a t e , l oad g e n e r a l r eg i s t e r s , a nd i nvoke mem o r y s i z i ng prog r am Good Memo r y Lo c a t e r R OM i n f i r s t mem o r y c o nt r o l l e r o n SB I VAX- l l / 7 8 0 L o c a te error LS I - 1 1 L o a d V M B i n to VAX mem o r y a nd t r a n s f e r c o n t r o l to i t VAX- 1 1 /7 8 0 ( Se e Prog ram in LS I - 1 1 CONSOL . SYS ( a f t e r wa i t i ng fo r memo r y ROM p rog ram to compl ete ) VMB . EXE Conso l e Fl o ppy I /0 Spa c e 64K byte b l o c k o f f r ee mem o r y f i r st pa r t o f t a b l e ) B OOTSTRAP PROCEDURES 2 1 . 1 . 1 . 3 Bo o t B l o c k P r og r am - Th i s boo t b l o c k p r og r am has a s i ng l e p u r po s e , wh i c h d e pe nd s o n the t ype o f b o o t s t r a p d ev i c e spec i f i ed to the c o n so l e p r og r am . Wh e n a po t e n t i a l sys t em d ev i c e is spec i f i ed , the boo t b l o c k p r og r am l o a d s t h e p r i m a r y b o o t s t r a p p r og r am VMB i n to m emo r y a nd pa s s e s c o n t r o l t o i t . Wh e n t h e c o n s o l e b l o c k s to r ag e d ev i c e is s e l e c t ed , the b o o t b l o c k p r og r am c a n p a s s c o n t r o l to a n e nh a n c ed c omm and p r o c e sso r c a l l ed B O OT 5 8 . Th e b o o t b l o c k p r og r am d o e s no t conta i n a ny I / 0 s uppo r t . I t u s e s the d r i v e r s ub r o u t i n e c o n t a i n e d i n the d ev i c e ROM p r og r am . Th e r e a r e t h r e e l o ng wo r d s o f h e a d e r i n fo rm a t i o n b e f o r e the bod y o f the boo t b l o c k p r og r am . Th e s e l o ng wo r d s c o n t a i n 1. t h e s i ze o f the p r i m a r y b o o t s t r a p p r og r am , 2. t h e s t a r t i ng l og i c a l b l o c k n umbe r o f p r og r am , and 3. a r e l a t i v e o f f s e t i n to the b l o c k of g o od p r og r am i s t o b e l o a d ed . the pr ima ry memo r y boo t s t ra p wh e r e th i s Th e s e l o ng wo r d s a r e l o ad ed b y t h e p r og r am WR I T EB OOT wh en the boo t b l oc k 1 s wr i t t e n . No t i c e tha t the b o o t b l o c k h a s the LBN o f the p r ima r y b o o t s t r a p p r og ram h a rd c od ed i n to the b l o c k . If the po s i t i o n o f t h e p r ima r y b o o t s t r a p p r og r am o n t h e vo l ume c h a ng e s , WR I TE B OOT m us t b e e x e c u t ed t o r ewr i t e the b o o t b l o c k wi th n e w i n f o rm a t i o n . No te tha t the l o c a t i o n o f VM B by t h e VAX- 1 1 /7 5 0 bo o t b l o c k p r o g r am is the o n l y s i t ua t i o n in all o f VAX/VM S wh e r e a f i l e i s l o c a t e d by a l og i c a l b l o c k n um b e r c od ed i n to a no t h e r p r og r am . Th us , VMB o n a VAX- 1 1 / 7 5 0 s y s t em d i s k is t h e o n l y f i l e tha t i s n o t f r e e to move wi tho u t some e x t e r n a l i n t e r v e n t i o n ( r unn i ng WR I T E B OOT ) to prese rve s ys tem i n teg r i t y . 2 1 . 1 . 1 . 4 BOOT 5 8 - Th e c o n s o l e b l o c k s to r ag e d ev i c e o n the VAX- 1 1 /7 5 0 ( T U 5 8 c a r t r id g e ) i s not used d u r i ng a no rma l boo t s t r a p o pe r a t i o n . ( Th i s i s i n c o n t r a s t to the VAX- 1 1 /7 8 0 boo t s t r a p , wh i c h a l wa ys r eads VMB a nd a c omm a nd f i l e f r om t h e c o nso l e f l o ppy . ) Howe v e r , t h e r e i s a n a l t e r n a t e b o o t s t r a p pa th th a t u s e s t h e TU 5 8 tha t p r o v i d e s • i nd i r e c t c omma nd f i l e c a pa b i l i ty , • a n e n h a n c ed c o nso l e c ommand l a ng u ag e , a n d • t h e a b i l i t y to boo t s t r a p a s ys t em i n t h e e v e n t b l o c k b e c ome s c o r r upted . tha t a boo t A s t and a l o n e p r og r am c a l l ed BOOT 5 8 i s a n e nha n c ed c o n s o l e c o mmand processo r l o a d ed f r om the T U 5 8 t h a t p r ov i d e s the s e f e a t u r e s . BOOT 5 8 i s l o ad ed b y s e l e c t i ng t h e c o n s o l e b l o c k s to r ag e d ev i c e ( DDA O : ) a s the boo t s t r a p d ev i c e , e i th e r b y the d ev i c e s e l e c t o r swi tch or wi th a > > > B OOT DDA O : c omma nd . Th e b o o t b l o c k o n the T U 5 8 c o n t a i n s a p r og r am j us t l i k e the boo t b l o c k p r og r am o n a s y s t em d ev i c e . Th i s prog r am c o n t a i n s the LBN o f BOOT 5 8 ( b e c a u s e i t wa s put t h e r e b y WR I TE B OOT ) . On q e BOOT 5 8 p r i n t s i t s p r om p t , c omma nd s o r i nd i r e c t c omm a nd f i l e s p e c i f i c a t i o n s c a n b e e n t e r ed . 2 1-5 BOOTSTRAP PROC EDURES 21. 1 . 2 VAX- 1 1 /7 8 0 I n i t i a l Boo t s t r a p Ope r a t i o n Th e c o n so l e s ub s ys t em o n t h e VAX- 1 1 /7 8 0 c o ns i s t s of a s e pa r a t e processo r , a n LS I - 1 1 wi th i t s o wn m a s s s to r ag e d e v i c e ( RX O l f l o ppy d i s k) and t e rm i n a l . Th e fac t th a t the c onso l e s ub s ys t em on a VAX- 1 1 /7 8 0 i nc l ud e s i t s o wn p r o c e s s o r i m p l i e s tha t the c o n so l e sys t em c a n pe r f o rm c e r t a i n ( b u t no t a l l ) o pe r a t i o n s wh i l e the VAX- 1 1 /7 8 0 C PU i s pe r f o rm i ng i t s o wn o pe r a t i o n s . Th e i n i t i a l boo t s t r a p p r og r am s ( Ta b l e 2 1 - 1 ) t h a t e x e c u t e i n o r d e r to i n i t i a l i ze a VAX/VM S s ys tem o n a VAX- 1 1 /7 8 0 a r e PD P- 1 1 p r og r ams e x e c u t i ng i n the LS I - 1 1 . Th i s m e a ns th a t the s e p r og r am s ( C ON S O L . S YS a nd the b o o t b l oc k p r og r a m ) e x ec u t e PD P- 1 1 i n s t r uc t i o n s a s o ppo s e d to VAX- 1 1 i n s t r uc t i o n s ( wh i c h a r e e x e c u t ed by t h e r e s t o f VM S a n d a l so by t h e VAX- 1 1 / 7 5 0 boo t s t r a p p r og r am s ) . 1. Th e f i r s t p r og r am th a t e x e c u t e s i n the LS I - 1 1 i s a b o o t s t r a p p r o g r am loca ted in r e a d - o n l y memo r y ( ROM ) th a t c a u s e s a p r og r am l o c a te d o n l og i c a l b l o c k n um b e r z e r o o f the c onso l e f l o ppy ( s e c to r s 1 , 3 , 5 , a n d 7 ) t o b e l o a d ed i n to LS I m emo r y . 2. Th i s p r og r am i s a c o py o f t h e boo t s t r a p p r og r am u s e d b y the RT- 1 1 o p e r a t i ng s ys t em . Th e RT- 1 1 boo t s t ra p , wh i c h u n d e r s t a n d s t h e RT- 1 1 f i l e sys tem , l o o k s f o r a spec i f i c file ( th e mo n i t o r ) , l o a d s i t i n to memo r y , a nd t r a n s f e r s c o n t r o l to it. ( Th e RT- 1 1 d i r e c to r y s t r uc t u r e a nd boo t s t r a p p r og r am a r e d e sc r i b e d i n t h e RT- 1 1 S o f twa r e S u pp o r t Ma n ua l . ) Th e boo t s t r a p p r og r am t h a t i s fo und o n t h e VAX- 1 1 /7 8 0 c o n so l e f l o ppy d i s k e t t e l o o k s f o r a p r og r am c a l l ed C ONSOL . SYS . 3. Th e c o n s o l e p r o g r am l o a d s the f i l e WC Sxxx . PAT f r om the f l o ppy d i s k e tte i n to the VAX- 1 1 /7 8 0 d i ag no s t i c c o n t r o l s to r e a nd t h e n pr i n t s i t s pr ompt >>> o n the c o n so l e t e rm i n a l . If the r e is a v e r s i o n m i sm a tch b e twe e n t h e WC S a nd e i th e r the PC S o r the F P LA , a n e r r o r m e s s a g e i s d i s p l a ye d o n the c o n s o l e t e rm i n a l . 4. Th e r e a r e many c omma n d s tha t the c on s o l e c ommand l a ng uag e u n d e r s t a nd s . Al l t h r e e c ommand s tha t c a us e a VM S s ys t em to be boo t s t r a pp e d ex e c u t e c ommand f i l e s l o c a t e d o n the conso l e f l o ppy . Th e c o mm a n d s a nd th e i r a s s o c i a t e d c ommand f i l e s a r e Command Command F i l e BOOT B OO T d e v @ f i l e spec DE FBOO . CMD d evBOO . CMD f i l e s pe c Th e s e c omma n d f i les i d e n t i f y t h e s y s t e m d i s k a nd o th e r c h a r a c t e r i s t i c s o f t h e b o o t s t r a p o pe r a t i o n by l o ad i ng g e n e r a l r eg i s t e r s R O th r o ug h R 5 wi th pa r ame t e r s tha t w i l l be i n te r p r e t e d by the p r i m a r y b o o t s t r a p p r og r am VMB . 2 1-6 BOOTSTRAP PROC EDURES 5. Th e y a l s o c o n t a i n the f o l l o w i ng command s : S TART 2 0 0 0 3 0 0 0 WA I T Th e s e two c o mmand s c a u s e a p r og r am l o c a ted in r e ad - o n l y m emo r y i n t h e f i r s t memo r y c o n t r o l l e r o n t h e S B I to e x e c u t e . Th e c o mmand f i l e wa i t s un t i l the m emo ry ROM p r og r am compl e t e s ( Th e memo r y R OM p r og r am b e fo r e e x e c u t i ng i t s n ex t c ommand . s i g n a l s t h e c o n so l e p r og r am th a t i t i s d o ne b y wr i t i ng the " s o f twa r e d o n e " s ignal i n to one o f the c o n s o l e r eg i s t e r s w i th a n MTPR i n s t r uc t i o n . Th e p r o g r am i n the m em o r y c o n t r o l l e r ROM pe r f o rm s a pr im i t i v e memo r y s i z i ng o pe r a t i o n i n a n e f fo r t t o l o c a t e 6 4 K byt e s o f e r r o r - f r e e c o n t i g uo u s pag e - a l i g n ed phys i c a l memo r y t h a t c an b e u s e d by t h e r e m a i n i ng boo t s t r a p prog r am s . Th e o u t p u t o f th i s p r og r am i s an add r ess 200 ( hex ) b yt e s b e yo nd t h e b e g i n n i ng o f t h e f i r s t g o od pag e . Th i s a d d r e s s i s l o a d e d i n to S P . ( I n a t yp i c a l s ys t em , o n e wi th n o e r r o r s in t h e f i r s t 6 4 K b y t e s , the c o n t e n t s o f S P a r e 2 0 0 . ) 6. Th e n e x t th r e e c o mma n d s EXAM I N E S P LOAD VMB . EXE / S TART : @ S TART @ c a u s e t h e pr i m a r y b o o t s t r a p p r og r am VMB to be l o ad ed f rom the f l o ppy d i s k i n to the g o od 6 4 K byte b l o c k o f VAX memo r y , l e a v i ng the f i r s t pag e f r e e . Th i s pag e wi l l c o n t a i n a d a ta s t r uc t u r e c a l l ed a r e s ta r t pa r am e t e r b l o c k ( R P B ) th a t i s u s e d b y bo th VMB a nd b y the r e s t a r t r o u t i n e s i n the event o f a powe r f a i l or o th e r s ys t em fa i l ure . The S TART c ommand t r a n s f e r s c o n t r o l to VMB at i t s f i r s t l o c a t i o n . 21 . 2 PRIMARY BOOTSTRAP PROGRAM Th e f i r s t p r og r am tha t i s c ommo n to a l l VM S s ys tem s , i nd e pe nd en t o f CPU t ype , i s t h e p r i m a r y b o o t s t r a p p r og r am VMB . Th e o n l y d i f fe r e nc e b e twe e n the i n i t i a t i o n o f VMB o n a VAX- 1 1 /7 5 0 s ys t em and o n a VAX- 1 1 /7 8 0 s ys tem i s t h e so u r c e o f t h e p r og r am ( sys tem d i s k o n a 7 5 0 s ys t em v e r s u s the c o n s o l e f l oppy o n a 7 8 0 s ys t em ) and the l o c a t i o n o f t h e p r og r am th a t pa s s e s c o n t r o l t o VMB ( bo o t b l o c k VAX- 1 1 p r og r am o n a VMB p e r fo rms two 7 5 0 v e r s u s t h e c o n s o l e PDP- 1 1 p r og r am o n a 780) . ma j o r s t e p s . • • I t d e t e rm i n e s t h e amo u n t o f phys i c a l memo r y o n the sys tem and the p r e s enc e of o th e r e x t e r n a l ad a p t e r s . I t l o c a t e s t h e s e c ond a r y b o o t s t r a p p r o g r am , memo r y , a n d t r a n s f e r s c o n t r o l to i t . 2 1-7 l o ad s it i n to BOOTSTRAP PROC EDURES 21 . 2 . 1 Mo t i v a t i o n f o r Two Boo t s t r a p P r og r am s VMB a n d the s e c o n d a r y boo ts t r a p p r og r am SYSBOOT a r e c o n c e pt u a l l y o n e p r og r am . Th e VAX- 1 1 /7 8 0 i n i t i a l i za t io n ( i n i t i a l l y i mpl em en ted f o r Ve r s i o n 1 . 0 o f VM S ) r e q u i r ed tha t t h e i n i t i a l boo t s t r a p p r og r am r e s i d e on the c o n s o l e f l o ppy . Ra t h e r t h a n i m po s e a r t i f i c i a l r e s t r i c t i o n s o n the s i z e o f the b oo t s t r a p p r og r am , i t wa s d i v i d ed i n to two p i e c e s : • • a p r ima r y p i e c e , wh i c h r e s i d e s o n t h e f l o ppy d i s k a nd wh o s e o n l y r e a l p u r po s e i s to l o c a t e the sec o nd a r y p i e c e , a n d a s e c o nd a r y p i e c e tha t r e s i d e s o n the s ys t em real l im i ts on i ts s i ze ) th a t pe r f o rms boo t s t r a p o pe r a t i o n . d i sk ( w i th n o the b u l k o f t h e On c e th i s d i v i s i o n wa s a c h i e v ed , VM B b e c am e a mo r e f l ex i b l e to o l th a t c o u l d be u s ed t o l o ad p r og r am s o th e r than t h e s e c o nd a r y boo t s t r a p p r og r am SYSB OOT . I n o rd e r t o p r e s e r v e th i s f l e x i b i l i t y a nd m a i n t a i n a s m u c h C P U i n d e pend e n c e a s po s s i b l e in the l a t e r s t ag e s o f the bo o t s t r a p , t h e d i v i s i o n of the bo o t s t r a p i n to p r i m a r y a nd s e c o nd a r y p i e c e s wa s p r e s e r v ed a nd e nh a n c ed f o r Ve r s i o n 2 . 0 o f VAX/VM S . VMB t h us b e c o m e s a g en e r a l p u r po s e boo t s t r a p p r og r am tha t c a n be used for seve r a l o p t i o n s o the r than i n i t i a l i z i ng a VM S s ys t em . Th e r e a r e th r e e o pt i o n s c u r r e n t l y a v a i l a b l e i n add i t ion to i n i t i a l i z i ng a VAX/VM S s y s t em by l o ad i ng S YS B OOT . e • Th e d i a g no s t i c s upe r v i so r l o a d ed i n p l a c e o f SYSBOOT . [ S YSMA I NT ] D I AGBOOT . E XE c an be VMB c a n be d i r e c ted to so l i c i t f o r the n a m e o f a n y s t a nd a l o n e p r o g r am to be l o ad ed i n to VAX memo r y . Th i s p r og r am m i g h t b e a s t a nd a l o n e d i ag no s t i c p r og r am , an al ternate s e c o nd a r y boo t s t r a p , o r e v e n a n o th e r o pe r a t i ng s ys t em . Th e f i l e s ys tem r o u t i n e s a nd c o n t r o l t r an s f e r mech a n i sm u s ed by VMB p l a c e some r e s t r i c t i o n s o n th i s f i l e . Th e vo l ume ( th e sys t e m d i s k ) c o n ta i n i ng the f i l e tha t VMB wi l l l o a d m u s t b e a F i l e s - 1 1 v o l um e ( S t r uc t u r e Lev e l 1 o r 2) • Th e f i l e c o n t a i n i ng t h i s p r og r am mus t b e co n t i g uo us . I t s t r a n s f e r a d d r e s s m u s t be the f i r s t locat ion i n the ( I f t h e f i l e i s l i n ked a s a sys t e m i m a g e wi th a p r o g r am . base add r e s s o f z e r o , i ts t r an s f e r a d d r e s s mus t b e a t locat ion zero . ) Th e c o d e i n the p r og r am m u s t b e po s i t i o n i nd epend e n t . • VMB c a n l o ad the c o n t e n t s of a b o o t s t r a p b l oc k f r om the sys t em d i s k a nd e x e c u t e the p r og r am t h a t i t f i nd s th e r e . In g e n e r a l , t h i s bo o t b l o c k i s l og i c a l b l o c k n umbe r z e r o o n t h e vo l ume . Th e VAX- 1 1 /7 8 0 boo t s t r a p s e q u e n c e a l l o ws an a l t e r n a t e bo o t b l o c k n um b e r to b e p a s s e d t o VMB i n R 4 . Pa s s i ng co n t r o l to a boo t b l o c k p r og r am i s t h e feature tha t m a k e s VMB a n e x t r em e l y f l ex i b l e to o l . One po s s i b l e us e fo r a boo t s t r a p p r og r am i s s uppo r t f o r a file s ys t em o th e r than F i l e s- 1 1 . 2 1-8 BOOTSTRAP PROCEDURES Th e bo o t b l o c k o p t i o n i s o n l y u s e f u l on a VAX- 1 1 /7 8 0 . Th e VAX- 1 1 /7 5 0 b o o t s t r a p s e q ue n c e a l l o ws c o n t r o l to b e pa s s ed d i r e c t l y f r om t h e c o n so l e prog r am to a boo t block p r og r am wi thout us i ng VMB a t a l l . Th a t i s , i f a s p e c i a l bo o t s t r a p t h r o ug h a b o o t b l o c k p r og r a m wa s r e q u i r ed , t h e no rma l VAX- 1 1 /7 5 0 s e qu e n c e c o u l d be u s ed b u t the s p e c i a l VAX- 1 1 /7 8 0 o pt i o n wo u l d b e r eq u i r ed . I f none o f these o p t i o n s i s s e l e c t ed by s e t t i ng t h e c o r r e s po nd i ng f l ag s i n R5 , VM B e n t e r s i t s d e f a u l t p a th , wh i c h l o ad s the VM S s e c o nd a r y b o o t s t r a p p r o g r am S Y S B O O T i n to mem o r y a nd t r a n s f e r s c o n t r o l to i t . 21. 2.2 Ope r a t i o n o f VMB VMB d e t e rm i n e s the t ype of b o o t s t r a p tha t i s b e i ng pe r fo rmed , a nd the i d e n t i ty o f the s ys t em d i s k , b y the c o n t e n t s o f r eg i s t e r s R O t h r o ug h R5 . T a b l e 2 1 - 2 s umma r i ze s t h e i n p u t pa r am e t e r s tha t a re pa s s e d to VMB . Th e s e pa r am e t e r s a r e s a v ed by VM B i n a d a t a s t r uc t u r e c a l l ed a Re s t a r t Pa r am e t e r B l o c k ( Ta b l e 2 1 - 3 ) f o r u s e by l a t e r p r o g r am s i n the b o o t s t r a p s e quenc e . 1. The f i r s t s te p th a t VMB t a k e s i s to s e t up a Sys t em Co n t r o l B l o c k wi t h a l l i n t e r r up t a nd e x c e pt i o n v e c to r s e x c e p t TB I T a nd B PT e x c e p t i o n s po i n t i ng to a s i ng l e s e r v i c e r o u t i n e . Th e v e c to r s fo r TB I T a nd B PT e x c e p t i o n s a r e l o ad ed w i th the ad d r e s s e s o f e x c e p t i o n s e r v i c e r o u t i n e s in XDE LTA , l i n k ed as a pa r t o f t h e VMB i m ag e . F i g u r e 2 1 - 1 i l l u s t r a t e s t h e l a yo ut o f VMB h a s s e t up i t s S C B . phys i c a l m emo r y o nc e 2. VMB then r ea d s the p r o c e s so r I D r eg i s t e r ( PR $ S I D ) to d e t e rm i n e the C PU t ype . VMB uses the C P U type as th e b a s i s o f d e c i s i o n s a b o u t wh i c h p i ec e o f C PU-d e pe nd e n t c o d e to execute . A s im i l a r s t e p i s p e r fo rmed l a t e r by SYS B OOT f o r t h e u s e o f b o th SYSB OOT a nd the e x e c ut i v e . 3. I f t h e b o o t s t r a p b r e a k po i n t f l ag ( RPB $V B OOB PT , R5< 5 > ) is set , VM B e x e c u t e s a B PT i n s t r uc t i o n , wh i ch t r a n s f e r s c o n t r o l to XDE LTA , l i nked as a pa r t o f t h e VMB i m ag e . Th i s b r e a k po i n t i s u s e f u l i n l oc a l i z i ng h a r d wa r e p r o b l ems t h a t a r e p r e v e n t i ng a s y s tem f r om b e i ng s t a r ted . 4. Th e i n put pa r am e t e r s to VMB a r e Pa r ame t e r B l o c k ( Ta b l e 2 1 - 3 ) . 5. A b i tm a p i s s e t up th a t d e sc r i b e s a l l ph ys i c a l memo r y . Th i s m a p i n c l ud e s a b i t tha t i s s e t fo r eve r y phys i c a l memo r y pag e i n t h e s y s tem t h a t i s f r e e f r om e r ro r s . Th e r o ut i ne that t e s ts fo r memo r y e r ro r s i s C P U s pec i f i c . A s id e e ffect of the C PU - s p e c i f i c memo r y t e s t i ng s ub r o u t i ne causes all e x t e r na l ad a p te r s t o b e i d en t i f i ed . Th e i r c o d e s a r e s to r ed i n t h e 1 6 -byte a r r ay in the RPB t h a t b eg i n s a t o f f s e t R PB $ 8 C ONFREG . 6. Th e bus a d a pt e r f o r t h e b oo t s t r a p d ev i c e i s i n i t i a l i z e d C PU-spec i f i c f a s h i o n ) . 2 1 -9 l o ad ed i n to the Re s t a r t ( in a BOOTSTRAP PROC EDURES Ta b l e 2 1 - 2 Reg i s te r In put to VMB ( P r i m a r y Bo o t s t r a p Prog r am ) ( Reg i s t e r Co n t e n t s ) Co n te n t s Reg i st e r boo tstr a p d ev i c e type c o d e RO < 3 1 : 1 6 > typ e - s pec i f i c i n fo rm a t i o n MASSBUS : MBZ UN IBUS : o pt i o n a l v e c to r add re s s 0 => use d e fa ul t v ec to r <1 5: 8> MBZ <7 : 0> boo ts t r a p d ev i c e type c od e 0 1 2 3-6 3 64 MASSB US d ev i c e ( RM 0 3/S , RP 0 4 / 5 /6 , RM 8 0 ) RK 0 6/7 R L 0 1 /2 R e s e rved fo r UN IB US d ev i c e s C o n so l e b l o c k s to rag e d ev i c e boo ts t r a p d ev i c e ' s bus a d d r ess R1 1 1/7 8 0 < 3 1 : 4> < 3 : 0> MBZ T R n um b e r o f a d a pt e r 1 1/7 5 0 < 3 1 : 24> MBZ < 2 3 : 0> a dd r e ss o f the I /O pag e fo r the b o o t d ev i c e ' s UN I B US boo t s t r a p d ev i c e c ont r o l l e r R2 i n fo rm a t i o n UN I B US : <3 1 : 1 8 > MBZ < 1 7 : 0> UN I B US a d d ress o f the d ev i c e ' s C SR MASSBUS : <3 1 : 4> < 3 : 0> MBZ ad a p t e r ' s c o n t r o l l e r / fo rm a t te r n umber R3 bo o t d ev i c e un i t n um b e r R4 l og i c a l b l oc k n umber o f b o o t b l o c k R5 s o ftwa r e boo t c o n t r o l ( VAX-1 1 /7 8 0 o n l y ) f l ag s Th e ha r d wa r e o r the C ONS OLE p rog r am se t s up the n ex t 3 r eg i st e r s a fter a s ys tem c ra sh o r po we r f a i l ur e . Th e se r eg i st e r s a r e no t used by VM B . RlO Rll AP h a l t PC h a l t PS L h a l t c od e The memo ry ROM prog r am r e t u r n s i n fo rma t i o n abo ut a b l o c k o f m em o r y in S P . SP <ba se-add r e s s + g ood A X 2 0 0 > o f 6 4Kb o f g ood m emo r y { cont inued o n next page ) 2 1-1 0 BOOTSTRAP PROC EDURES Ta b l e 2 1 -2 ( co nt . ) Reg i s t e r I n pu t t o VMB ( P r i m a r y Bo o t s t r a p P r o g r am ) ( Bo o t s t r a p Co n t r o l F l ag s i n R S } Bi t Po s i t i o n Mean i ng 0 RPB$V_CONV Conve r sa t i o nal boo t . At v a r i o us po in t s in the system boo t p r o c ed ur e , the boo t s t r a p cod e sol i c i ts pa r a m e te r s a nd othe r i nput f rom the c o nso l e term inal . 1 RPB $V_DEBUG Debug.. XDELTA s ys tem . 2 RPB $V_I N IB PT In i t i a l b r ea kpo i n t . BPT i n s t r uc t ion in mapping . If th i s f l ag i s s e t , VMS d ebug g e r i n to the system If maps the cod e · fo r the page tabl e s of the r un n i ng RPB$V DEBUG i s se t , VM S e x ec ut e s modul e IN I T immed i a tel y a f t e r a enabl i ng 3 RPB $V_B B LOCK Second a r y boot from boot b loc k . Second a r y b oo t s t r a p s i ng l e 5 1 2 -byte b l oc k , whose LBN i s spec i f i ed in R 4 . 4 RPB $V_D IAG Di agnost i c boot . Second a r y [ S YSMA INT ] D IAGBOOT . EXE . 5 RPB $V_B OOBPT Bootstrap b r ea kpo i n t . Stops the pr i m a r y and second a r y boo t s t r aps wi th b r ea kpo i n t i n s t r uc t i o n s b e fo r e te st i ng memo r y . 6 RPB $V_HEADER Image head e r . Ta k e s t h e t r a n s f e r a d d r e s s o f the second a r y boots t r a p i mag e f rom that file ' s imag e head e r . If RPB$V HEADER i s n o t s e t , t r an s f e r s control to the f i r s t byte of the second a r y boot f i l e . RPB $V_NOTEST Memo ry t e s t i nh i b i t . Se t s a b i t i n the PFN b i t map fo r each Do e s no t t e s t the memo r y . pag e of mem o ry pr esen t . RPB $V_S O L I C T File name . VMB bootstrap f i l e . RPB $V_HALT Ha l t b e fo r e t r a n s fer . Ex ecutes a HALT i n st r uc t i o n t r an s f e r r i ng con t r o l t o t h e second a r y bootst r a p . RPB $V_N O PFND N o PFN d e l e t i o n ( no t c u r r entl y u s ed ) . Intended t o t e l l VMB not to read a f i l e from the boo t d ev i c e tha t i d en t i f i e s bad or r e s e rved memory p ag e s , so tha t VMB d o e s not ma r k these pag es a s v a l i d i n the PFN b i tm a p . 9 10 7. Symbo l i c Name p rompts boo t s t r a p fo r the name is of image a is a c a l l ed second a r y b e fo r e Th e s e c o nd a r y b o o t s t r a p i m ag e i s i d en t i f i ed ( by R S f l ag s a nd , o p t i o na l l y , i n fo rm a t i o n so l i c i t ed f r om the c o n so l e t e rm i n a l } . Th e o r d e r o f p r e c ed enc e i n c ho o s i ng a s e c o nd a r y boo t s t r a p i m ag e i s t h e f o l l ow i ng . a. I f t h e R S f l ag c a l l ed RPB $V B B LOCK i s s e t , a b o o t b l oc k p r o g r am is r ea d f r om t h e s y s t em d i s k . R 4 c o n ta i n s t h e l og i c a l n um b e r of t h e d i s k b l oc k t h a t c o n ta i n s the ( Th i s f un c t i o n i s u s e d o n l y s e c o nd a r y b o o t s t r a p i m ag e . o n t h e VAX- 1 1 /7 8 0 p r o c e s so r . } b. I f t h e R S f l ag c a l l ed RPB $V S O L I C T i s s e t , t h e nam e o f t h e s e c o nd a r y b o o t s t r a p imag e i s expl i c i tl y r eques ted f ro m t h e c o nso l e t e r m i na l . c. I f t h e R S f l ag c a l l ed RPB $V D I AG i s s e t , t h e d i a g no s t i c s up e r v i so r i s l o ad ed . This o pt i o n c a u s e s a f i l e c a l l ed [ S YSMA IN T ] D IAGB OOT . EXE t o b e used as the s e c o nd a r y b o o t s t r a p i mag e . d. Th e a b s e n c e o f a n y o f t h e th r e e o pt i o n s (a, b, or c) c a us e s [ S YS EXE ] S YS B O OT . EXE t o b e used a s t h e s e c o nd a r y boo t s t r a p p r og r am . Th i s i s t h e n o r m a l p a t h o f e x e c u t i o n wh e n a VM S s ys t em i s b e i ng i n i t i a l i zed . 2 1-1 1 Ta b l e 2 1 - 3 Co n t e n t� o f Re s t a r t Pa r am e t e r Bl o c k Mnemo n i c R PB $L_BASE .... I .... N S i ze i n Byt e s Ph ys i c a l Ba se Ad d r e s s of 6 4 K B l oc k R PB $ L_RESTART Ph ys i c a l Ad d re s s o f RESTART Ro u t i ne RPB $L_C HKS UM Ch e c k s um o f Fi r s t R PB $ L_RSTSTFLG Re s t a r t R PB $L HALT PC R PB $L-HA LTPS L RPB $L -HALTCODE R PB $L-BOOTRx R PB S L:::: I OVEC N Item 31 Longwo r d s o f RESTART Ro u t i ne in Prog r e s s F l ag PC a t HALT/Re sta r t PS L a t HALT/Re s ta r t Cod e De sc r i b i ng Re a so n fo r Re sta r t Saved Bo o t s t r a p Pa r ame te r s ( R O t h r o ug h R S ) Add re ss o f $ Q I O Vec to r in Boo t s t r a p Dr i v e r R PB $ L_I S P S i ze ( i n b yt e s ) o f Boo ts t r a p $ Q I O Ro u t i n e Log i c a l B l o c k Number o f Second a r y Bo o t s t r a p Fi l e S i ze ( i n b l o c k s ) o f Second a r y Bo o t s t r a p Fi l e Desc r i pto r o f PFN B i tm a p S i ze ( i n byt e s ) o f P F N B i tmap Phys i c a l Ad d r e s s of Sta r t o f PFN B i tm a p Co un t o f Ph ys i c a l Pag es Sys tem V i r tua l Add r e s s of Sys tem Pag e Ta b l e Ph ys i c al Ad d r e s s o f UBA Dev i c e CSR Vi r t ua l Add re s s of UBA Dev i c e CSR Ph ys i c al Ad d re s s o f Ad a pt e r Co n f i g u r a t i o n Reg i st e r Vi r t ua l Add re s s o f Ad a pt e r Co n f i g ur a t i o n Reg i st e r De sc r i pto r o f Bo o t s t r a p Dev i c e Un i t Num b e r Dev i c e Type Cod e S l av e Un i t Num b e r S e c o nd a r y Boo ts t r a p Fi l e N a m e ( Co un ted ASC I I S t r i ng Byte Ar r a y o f Ad a p t e r Types Co unt of Head e r Pag es in Second a r y Bo o ts t r a p Imag e s pa r e ( to p r e s e r v e n a t u r a l a l i g nmen t ) Powe r fa i l Inte r r upt Stack Po i n t e r R PB $L_PCBB Saved Pr o c e s s Co n t r o l B l o c k Ba s e Reg i s t e r R PB $L_SBR Saved Sys tem Ba se Reg i s t e r R PB $ L_SCBB Saved Sys t em Co n t ro l R PB $L I OVEC S Z R PB $L-F I LLBN R PB $L-F I LS I Z R PB $Q::::P FNMAP RPB $ L PFNCNT RPB $ L-SVA S PT R PB $L-C SRPHY RPB $L-C SRV I R RPB $L-ADPPHY R PB $L::::A DPVI R RPB$W U N I T RPB $B-DEVTYP R PB $B-SLAVE RPB $T-F I LE RPB $B-C ONFREG RPB $B::::H DRPGCNT B l o c k Ba s e Reg i st e r R PB $L_S I SR Saved So ftwa r e I n t e r r upt Summa r y Reg i s t e r RPB $L_SLR Saved Sys t em Leng th Reg i s t e r RPB SL_MEMDSC Lo ngwo rd A r r a y o f Mem o r y De sc r i pto r s 4 4 Lo a d ed by Spec i a l VMB Used t o Loc a t e RPB ( Co n t e n t s�Add r e s s ) Used to Loc a te RESTART Ro ut i n e Co n s i s t e n c y Che c k o n RPB and RESTART Ro u t i n e Prevent Ne s ted Re sta r t I N IT 4 I N IT 4 S e t by Ha rdwa r e 4 4 4 24 4 Cl e a r ed by I N I T C l e a red by RESTART VMB VMB VMB VMB VMB , IN IT 4 4 4 8 (4) (4) 4 4 4 4 4 4 4 (2) (1) (1) 40 16 1 3 4 4 4 4 4 4 48 Us e s Us ed b y BUGC HEC K to d ump phys i c a l mem o r y VMB VMB VMB VMB VMB ! N IT VMB INIT VMB ! N IT VMB U s e d by RESTART VMB VMB VMB Powe r Fa i l Ro ut i n e Powe r Fa i l Ro u t i ne I N I T , Powe r Fa i l Ro ut i ne I N I T , Powe r Fa i l Ro u t i ne Powe r Fa i l Ro u t i ne I N I T , Powe r Fa i l Ro u t i ne VMB Re s t o r ed by RESTART Ro u t i n e Re sto r ed b y RESTART Ro u t i n e Re s t o r ed b y RESTART Ro ut i n e Re sto r ed b y RESTART Ro u t i n e Re sto r ed b y RESTART Ro ut i n e Re sto r ed by RESTART Ro ut i n e Us ed b y BUGCHECK to d ump phys i c a l mem o r y S P ---.. Physical State Physical State after VMB Begins Execution after SYSBOOT Begins Execution Restart Parameter Block (RPB) Restart Parameter Block (RPB) (Loaded by VMB) ( Primary Bootstrap Program VMB ( PR$_SCBB __,. System Control Block (SCB) for VMB N 1--' I 1--' w ( R1 0 contains HALT PC R1 1 contains HALT PSL AP contains HALT code RO through RS contain initial bootstrap parameters. These are loaded i nto RPB by VMB. (See Table 21-2) Primary Bootstrap Program \ ) Read i nto m emory by console program \ } Set up by first few instructions in VMB ( Filled in by VMB to reflect presence of each physical page .-- R1 1 VMB ) ) System Control Block (SCB) for VMB PFN Bitmap (4 Pages) Bootstrap Stack Used by both VMB and SYSBOOT (3 Pages) � S P , R1 0 ( Read i nto m emory by VMB ( ) Set u p by first few i nstructions in SYSBOOT Figure 2 1 -1 Secondary Bootstrap Program SYSBOOT ) .,..._ PR$_SCBB System Control Block (SCB) for SVSBOOT Ph ys i c a l Memo r y L a yo u t s U s e d by VMB a nd SYSB OOT BOOTSTRAP PROCEDURES Th e i m ag e i s r e a d i n to m emo r y ( F i g u r e 2 1 - 1 ) and co n t r o l is p a s sed to i t at i ts t r a n s f e r ad d r e s s . Th i s a d d r e s s i s n o rma l l y t h e f i r s t b y t e i n the i m ag e . Ho we v e r , s e t t i ng the f l ag R PB $V H EADER in R S d i r ec t s VMB to use the t r a n s f e r a d d r e s s s t ored i n the i m ag e h e a d e r o f the s e c o nd a r y boo ts t r a p p r og r am . ( Th i s o f c o u r se a s s um e s t h a t the s e c o nd a r y b o o ts t r a p i m ag e wa s p r o d uc e d by t h e VAX- 1 1 L i nke r . ) 21. 2. 3 Boo t s t r a p D r i v e r and I/0 S ub ro ut i ne s VMB c o n t a i n s a s ke l e to n Q u e u e I /O Reque s t r o u t i n e a nd d ev i c e d r i v e r t o pe r fo rm i ts I /0 . Th i s d r i v e r a nd r o u t i n e a r e l o a d ed i n to nonpag e d po o l b y I N I T f o r po s s i b l e l a t e r u s e b y t h e b ug ch e c k c o d e ( Ch a p t e r 7 ) . Th e VMB i m ag e a c t ua l l y c on t a i n s s i mp l e d r i v e r s f o r a l l po s s i b l e sys t e m d ev i c e s . On c e i t h a s d e te rm i ned t h e n am e o f t h e boo t s t r a p d ev i c e ( f r om r eg i s t e r c o n t e n t s ) , VM B mov e s t h e d r i v e r c od e fo r the s e l ec t e d d ev i c e so tha t i t i s a d j a c en t to the $ Q I O r o ut i n e . ( Th i s a l l o ws t h e e nt i re boo t s t r a p I /0 s y s t em to b e moved w i t h a s i ng l e MOVCx i n s t r uc t i o n . ) Th e l o c a t i o n a nd t h e s i z e o f t h e $ Q I O r o ut i ne pl us t h e s e l e c t ed d r i v e r a r e l o a d ed i n to the Re s t a r t Pa r am e t e r B l o c k fo r later u s e b y IN I T . Th i s s i mpl e o pe r a t i o n by VMB p r ev e n t s n o npag ed po o l f r om b e i ng l oad ed wi t h a s e t o f b o o t s t r a p d ev i c e d r i v e r s t h a t a r e n eve r u s e d . Th a t i s , t h e o n l y boo ts t r a p d r i v e r t h a t i s p r e s e r v ed f o r the l i f e o f a VM S s ys tem i s the boo t s t r a p d ev i c e d r i v e r s e l e c t e d t h r o ug h i n put to VM B . Al l o th e r b o o t s t r a p d r i v e r s a r e l i n ked i n to t h e VM B i m ag e b u t d i s a pp e a r a l ong w i th t h e r e s t o f VM B wh e n VM S i s f i na l l y i n i t i a l i z ed . 21 . 2. 4 F i l e Ope r a t i o n s On e o f the p r o b l em s th a t m u s t b e so l v ed i n a n y b o o t s t r a p o pe r a t i o n i nvo l v e s l oc a t i o n o f f i l e s b e f o r e the f i l e sys t e m i t se l f i s i n f u l l ope r a t i on . In a VM S s ys tem , t h e p r o b l em is f a c e d wi th eve r y f i l e o pe r a t i o n t h a t m u s t b e pe r f o rm ed b e f o r e the sys t em d i s k AC P (Anc i l l a r y Co n t r o l P r o c e s s o r ) i s c r e a t e d . VM S s o l ve s th i s p r o b l em by i nc l ud i ng two spec i a l o b j ec t mod u l e s ( F I L ER EAD a nd F I LERW I O ) i n th e e x e c u t i v e i m ag e . Th e mod u l e s c o n s i s t o f a ser ies o f s ub r o u t i n e s tha t c a n pe r f o rm some p r i m i t i v e file o pe r a t i o n s o n a F i l e s- 1 1 vo l ume . On e o f the se m o d u l e s ( F I LE READ ) i s a l s o l i nked i n to b o th the VM B a nd S YS B OO T imag e s . I n o rd e r to keep these s ub r o u t i n e s r el a t ive l y sm a l l , s ev e r a l r e s t r i c t i o n s a r e i m po s ed o n f i l e s t h a t c an b e a c c e s s ed wi th them . • • • Th e vo l um e c o n t a i n i ng the f i l e m u s t b e a F i l e s- 1 1 vo l ume . c a n u s e e i th e r S t r uc t u r e L ev e l 1 o r 2 . It Th e f i l e m u s t b e c o n t i g uo u s . I f th e vo l um e u s e s S t r uc t u r e Lev e l 2 , t h e f i l e m u s t r e s i d e i n a r o o t d i r e c to r y . Th e s ub r o u t i n e s c a nno t fo l l o w s ubd i r e c to r y spe c i f i c a t i o n s . F i l e s tha t mus t b e c o n t ig u o u s i nd i c a t ed i n T a b l e 2 1 - 1 . beca use 21-14 of the s e res t r i c t i ons a re BOOTSTRAP PROCEDURES 21 . 3 S ECONDARY BOOTSTRAP PROGRAM ( SYSBOOT ) Th e s e c o nd a r y b o o t s t r a p p r og r am SYSB OOT e x e c u t e s wh e n VMB i s d i r e c t ed to l o ad a VM S s y s t e m . Mo s t o f t h e o pe r a t i on s t h a t a r e pe r fo rmed by c od e t h a t e x e c u t e s b e f o r e VM S e x i s ts a r e pe r fo rmed by SYSBOOT . VMB h a s a l ready t e sted ph ys i c a l m em o r y , r e ad SYSBOO T i n to m emo r y , a nd t r a n s f e r r ed c o n t r o l to i t . S Y S B O OT p e r fo rm s th r e e m a j o r f un c t i o n s . • • Th e s y s t em a d j us t a b l e s y s t em o r a bo o t s t r a p ) d e pe nd on c a l c u l a t ed . i s c o n f i g u r ed . Th i s m e a n s that a set of S Y S B O OT pa r am e t e r s ( e i th e r the o n e s f r om the l a s t s e t e x p l i c i t l y s e l e c ted th r o ug h a c o nv e r s a t i o n a l is l o ad ed . O t h e r s ys t em pa r am e t e r s wh o s e v a l u e s t h e v a l ue s o f the a d j us tab l e pa r am e t e r s a re A po r t i o n o f s ys t em c o n f i g u r a t i o n t h a t d e s e r v e s s e pa r a te m e n t i o n i nvo l ve s t h e m a p p i ng o f s ys tem v i r t ua l add r e s s spac e . Th e s i z e s o f m a ny o f t h e p i e c e s o f s ys t em add r e s s s pa c e d e pe nd o n th e v a l ue s o f o n e o r mo r e S YS B OO T p a r am e t e r s . Th e c a l c u l a t i o n s t h a t SYSB OOT p e r fo rm s a nd the r e s u l t s o f the s e c a l c u l a t i o n s a r e d e ta i l ed i n Append i x E . I n a d d i t i o n t o s i z i ng t h e p i e c e s o f s y s t em spac e , SYS B OOT a l so s e t s up the s ys t e m pag e t a b l e to map many o f the p i e c e s o f t h e no npag ed a n d pa g ed execut ive . In a r e l a ted s te p , S YS B OOT p r e pa r e s a P O pag e table tha t a l l o ws m emo r y m a n ag em e n t t o b e t u r n ed o n . ( Th i s l a s t s te p i s d e sc r i b ed in Ch a pt e r 2 2 . ) • Th e l a s t ma j o r s t e p th a t S YS B OOT p e r fo rm s i s to l o c a te the e x ec ut ive ( S YS . EXE ) a n d r e ad the v a r i o u s po r t i o n s of i t i n to t h e ( ph y s i c a l ) pag e s s e t a s i d e wh e n the sys t e m pag e t a b l e wa s set up . Oth e r f i l e s ( Ta b l e 2 1 - 1 ) a r e a l so l o c a t e d and the i r l o c a t i o n s pa s s ed on to !NIT in g ene r a l r eg i s t e r s ( Ta b l e 2 1 - 4 ) . Th e r e i s l i t t l e C PU -d e pend e n t c o d e in SYS BOO T . Mo s t d e pe nd e nc i e s h av e a l r e a d y b e en t a k e n c a r e o f by VMB . 21. 3.1 of the CPU De t a i l e d Ope r a t i on o f SYS BOOT SYS B OOT b eg i n s o pe r a t i o n w i th the phys i c a l m emo r y l a yo u t p i c t u r ed in Figure 21-1 . R l l po i n t s t o t h e b eg i nn i ng o f t h e Re s t a r t Pa r am e t e r Block . 1. S YS B OO T i mmed i a t e l y a l l o c a t e s a phy s i c a l pag e a n d s e t s up a s ys t em c o n t r o l b l o c k w i th a l l vec t o r s c o n ta i n i ng the a d d r e s s o f a s e r v i c e r o u t i n e i n SYS B OOT . Th e v e c to r s for TB I T a nd B PT a r e r e d i r e c ted to e x c e p t i o n s e r v i c e r o u t i n e s i n XDE LTA , l i n ked a s a pa r t o f t h e SYS B OOT i ma g e . Th e m a c h i n e c h e c k v e c to r i s mod i f i e d t o po i n t t o a c u s tom i z ed e x c ept i o n s e r v i c e r o ut i ne . 2. I f the boo t s t r a p b r ea k po i n t f l ag ( RPB $V B O O B PT , RS<S> ) is set , S Y S B OOT e x e c u t e s a B PT i n s t r uc tTo n , wh i c h t r a n s f e r s c o n t r o l t o XD E LTA , l i nk ed a s a pa r t o f t h e SYSB OOT i mag e . No t e t h a t t h e same f l ag c o n t r o l s b r ea kpo i n t e x e c u t i o n i n bo th VM B a nd SYS B OOT . Th i s f l ag c an be used i n l o c a t i ng a h a rdwa r e p r o b l em o r o th e r p r o b l em t h a t i s p r e v en t i ng s ys t em i n i t i a l i za t i o n . 21-1 5 BOOTSTRAP PROC EDURES Ta b l e 2 1 - 4 Reg i s t e r I n put to !N I T f r om S YSB OOT Reg i s te r Co n te n ts RO Ph ys i c a l Ad d r e s s o f EXE $ I N I T R2 Log i c a l R3 S i ze ( i n byt e s ) o f Te r m i n a l Se r v i c e R4 S i ze ( i n b l o c ks ) o f Ex e c u t i v e I m ag e R5 Log i c a l Bl o c k Num b e r o f Ex e c u t i v e Imag e R6 Log i c a l Bl o c k Num b e r o f Sys t em D i s k Dr i v e r R7 S i ze R8 Log i c a l R7 S i ze Rll Phys i c a l Ad d r e s s o f R PB SBR Ph ys i c a l Ad d r e s s o f Ba s e o f Sy s tem Pag e Tab l e S LR Le ng th o f Sy s t em P a g e Tab l e POBR Se t u p s o tha t pag e c o n ta i n i ng EXE $ I N I T m a pped a s a P O v i r t ua l pag e ( Fi g u r e 2 2 -1 ) is P OL R C o n ta i n s t he v a l ue o f t h e PFN t� E XE $ I N I T 3. Bl o c k Num b e r o f Te rm i n a l ( i n byt e s ) Se r v i c e ( S YS . E XE ) o f Sys t em D i s k D r i v e r Bl o c k Numb e r o f Lo ad ab l e C P U C o d e ( i n byt e s ) ( TTDR I VER . EXE ) ( S YS LOAx x x . EXE ) o f Lo ad a b l e C P U C o d e c o n t a i n i ng i d en t i c a l l y p l us Th e PR $ S I D r eg i s t e r i s r e ad to d e t e r m i n e the C P U t ype . Th i s t ype i s s to r ed f o r l a te r u s e by c o d e wh o s e e x e c u t i o n d e pend s o n the s p e c i f i c C P U t ype . Th i s v a l ue , s to r ed i n g loba l l o c a t i o n E XE $G B_C PUTYPE , i s u s ed i n s ev e r a l wa ys . • • I t wi l l d e t e rm i n e wh i c h p i e c e s o f C PU-d epend e n t c o d e wi th i n SYSB OOT e x e c u t e . Fo r e x ampl e , t h e r e i s a c h e c k wh e th e r t h e h a r d wa r e E C O s t a tus i s a t the l ev e l r equ i r ed to s u ppo r t a VAX/VMS s y s tem . On a VAX- 1 1 /7 5 0 , the h a rdwa r e ECO l ev e l a nd m i c r o c o d e r ev i s i o n l ev e l a re the va l u e s th a t a r e c h e c k ed . On a VAX- 1 1 /7 8 0 , th i s t e s t r e q u i r e s c ommun i c a t i o n w i th t h e c o n s o l e p r og r am t o o b t a i n the v e r s i o n n um be r s o f t h e PC S , WCS , a nd FPLA . Th e C PU t yp e w i l l d e t e rm i n e the n a m e o f the s e pa r a t e i m ag e f i l e ( S YS LOA7 5 0 . EXE o r SYS LOA7 8 0 . EXE ) t h a t c o n t a i n s C PU-d e pend e n t r o u t i ne s . Th i s i m ag e i s o pe n e d ( l ocated ) by SYSBOO T a nd r e ad i n to no n pag e d po o l by !N I T . 2 1- 1 6 BOOTSTRAP PROC EDURE S • • Tho s e po r t i o n s o f C PU-spe c i f i c cod e th a t a r e s e l e c t e d a t e x ec u t i o n t ime ( wi th sui table test a nd b ranch i n s t r uc t i o n s ) w i l l u s e t h e C P U t ype a s t h e o b j e c t o f the t e s ts . Th e s i z e o f t h e s ys tem c on t r o l block , a pa r t o f t h e s 1 z 1 ng ove r a l l e f fo r t o f s y s t e m add r e s s s pa c e d e s c r i b ed i n s t e p 7 a nd Append i x E , d e pend s on the C PU t ype . Th e d i f f e r e n t s t r a t eg i e s tha t a r e used to d e pend e n c i e s a r e d e sc r i b ed i n the n e x t c h a p t e r . h a nd l e C PU 4. Th e e x e c u t i ve i ma g e i s o pened . I t s l oc a t i on ( l og i c a l bloc k n umb e r ) on the s ys t em d i s k i s s to r ed f o r l a t e r use . Th e po r t i o n o f t h e ex ec u t i v e i mag e th a t con t a i n s pa r am e te r s is r e ad i n to SYSBOOT ' s wo r k i ng t a b l e . Th e l a s t se c t i o n o f t h e next chapter d e s c r i be s i n mo r e d e ta i l the movem e n t o f pa ram e t e r i n fo rma t i o n d u r i ng the i n i t i a l i za t i o n se que nc e . 5. Seve r a l o th e r f i l e s a r e o pened a nd Th e s e f i l e s i n c l ud e the i r l oc a t i on s • t h e sys t em d i s k d r i v e r , • t h e t e rm i n a l d r i v e r , a n d • t h e i m a g e c o n t a i n i ng the C PU-d e pend e n t mod u l es . s to r e d . Th e a d d r e s s e s o f the s e f i l e s a r e pa s s ed to ! N I T so tha t t he i r conten t s c a n be r e ad i n to a p p r o pr i a t e pl a c e s i n s y s t em add r e s s s p a c e a f t e r m emo r y m a n ag emen t i s t u r ned on . 6. At th i s po i n t , SYS BOOT d e t e rm i n e s i f the ope r a to r r e que s t ed a c o nv e r s a t i o n a l bo o t s t r a p b y s e t t i ng t h e RPB $V C ONV f l ag , R 5 < 0 > , a s i n p u t to VMB . I f s o , S Y S B OOT w i l l p r ompt to a llow I n a n y c a se , i n t e r a c t i v e a l t e r a t i o n o f t h e pa r am e te r v a l ue s . S YS B OOT e n t e r s t h e n e x t ph a s e wi t h some s e t o f ad j us t a b l e pa r am e t e r s . 7. Th e s i ze o f t h e p r o c e s s h e ad e r a nd the s i ze s o f p i e c e s o f s ys t em a d d r e s s s p a c e a r e c a l c u l a t ed . I n pa r t i c u l a r , t h e s i z e o f t h e s y s t em pag e tab l e i s c a l c u l a ted . Th e d e ta i l s o f t h e s e c a l c u l a t i o n s a r e d e sc r i b ed i n Append i x E . 8. Th e f i r s t pag e o f the s ys t em co n t r o l b l o c k , f o und o n b o t h t h e VAX-1 1 /7 5 0 a nd th e VAX-1 1/7 8 0 , i s l o ad ed w i t h the c o n t e n t s o f mod u l e S C BVECTOR , wh i c h c o n t a i n s t h e e n t r y po i n t s fo r the i n te r r up t a nd e x c ept i o n s e r v i c e r o u t i n e s l o c a ted i n S YS . EXE . 9. Th e s y s t em h e ad e r i s c o n f i g u r ed . Al l e n t r i e s i n t h e s y s t em h e ad e r wh o s e c o n t e n t s d epend on c o n f i g u r a t i o n pa r am e t e r s a r e f i l l ed i n a t t h i s t ime . Th i s s t e p i s a n a l og o u s to the p r o c e s s h e ad e r c o n f i g u r a t i o n tha t i s p e r fo rmed b y c o d e i n S H E LL a s a pa r t o f p r o c e s s c r ea t i o n ( Ch a pt e r 1 7 ) . 10. P i eces o f the e x ec u t i v e tha t n ev e r pag e ( Ta b l e E - 3 ) are ma pped i n to the h i g h e s t po r t i o n o f phys i c a l m emo r y . Th e s e phys i c a l pag e s wi l l n o t b e a c c o un ted fo r i n t h e PFN d a ta b a s e b e c a u s e t h e i r s t a te w i l l neve r c h a ng e . 21-17 BOOTSTRAP PROC EDURES 11. Th e pag e ab l e po r t i o n s o f SYS . E X E ( th e sys tem s e rv i c e v ec to r s a nd t h e pag e a b l e ex e c u t i v e r o u t i n e s ) a r e a l so m a pped t o a l l o w t h e e x ec u t i v e t o b e r e a d i n to memo r y . I f t h e SYS PAG I NG f l ag i s s e t ( i t s u s ua l s t a t e ) , t h e phys i c a l pag e s t h a t c o n t a i n the pag e a b l e e x ec u t i ve w i l l b e r e l e a s ed to the f r e e l i s t b y !N IT . 12. Th e e x ec u t i ve i m ag e i s r ead i n to m em o r y . B e c a use memo r y m a n a g em e n t has not yet been e n a b l ed , none o f the c ompl i c a t i o n s o f sc a t t e r ed r e ad s i n to memo r y a r e a pp l i c a b l e here. 13. Th e c o n t e n t s o f SYSB OOT ' s i n t e r n a l p a r ame t e r t ab l e a r e c o p i ed to the po r t i o n o f t h e m emo r y i mag e o f the e x e c u t i v e tha t c o n ta i n s a l l t h e a d j u s ta b l e pa r am e t e r s . Th i s s t e p p r e s e r v e s t h e c u r r e n t pa r am e t e r s e t t i ng s ( be c a us e SYSB OOT i s g o i ng a wa y ) u n t i l t h e y c a n be wr i t t e n b a c k to the d i s k i m ag e o f the e x ec u t i ve by SYS I N I T ( Ch a p t e r 2 2 ) . 14. SYS B OOT l o ad s the b a s e a nd l eng t h r eg i s t e r s fo r the PO and s y s t em pag e tab les s o tha t !NIT c an t u r n m emo r y m a n ag em e n t on . E n a b l i ng memo r y m a n ag em e n t i s d e sc r i b ed i n mo r e d e t a i l i n t h e n e x t c h a pt e r . 15. F i n a l l y , SYS B O OT t r a n s f e r s c on t r o l to e x e c ut i v e . Th i s t r a n s f e r mus t be d o ne b ec a us e m emo r y m a n ag em e n t h a s n o t b een d e s c r i pto r s a nd o th e r i n f o rm a t i o n t h a t a r e s t o r ed i n r eg i s t e r s ( Ta b l e 2 1 -4 ) . memo r y i s p i c t u r ed i n F i g u r e 2 1 - 2 . 2 1-1 8 !N I T in the mod u l e to a phys i c a l l o c a t i o n e n a b l ed ye t . Th e f i l e SYSB OOT p a s s e s to ! N I T Th e s t a t e o f phys i c a l BOOTSTRAP PROC EDURES 0 ""' I"' MMG$GL_MAXPFN _,. (Physical Page N umber) ( Dynamic Pages Process Working Sets System Working Set, Free Page List, Modified Page List ' ) 1 .... � These pages are described by entries In the PFN data base. PFN Database Nonpaged Executive Code and Data Nonpaged Dynamic Memory The PFN database contains no Information about the physical pages containing a ny of these pieces of the executive. Interrupt Stack PR$_SCBB (Physical Address) System Control Block System Header PR$_SBR (Physical Address) System Page Table Largest PFN (Physical Page N umber) __.. F i g u r e 2 1 -2 Ph ys i c a l Memo r y La yo u t Used by the E x ec u t i v e 2 1-1 9 CHAPTER 2 2 O PERAT ING SYSTEM I N I T IALI ZAT I ON Th e s e c o nd ma j o r ph a s e o f s y s t em i n i �ia l i z a t i o n i s pe r fo rmed • • by c o d e t h a t i s a pa r t o f the e x e c u t i v e ( modu l e ! N I T ) a n d by a s p e c i a l p r o c e s s ( S YS I N I T ) t h a t i s c r e a ted t o compl e t e tho s e p i e c e s o f i n i t i a l i za t i o n t h a t r e qu i r e pr o c e s s c o n t e x t i n o r d e r to e x e c u t e . ! N I T t u r n s o n m emo r y m a n ag emen t a nd sets up tho s e d a t a s t r uc t u r e s wh o s e s i ze or c o n t e n t s d e pend o n S Y S B OO T pa r am e t e r s . SYS I N I T o pe n s s ys tem f i l e s , c r e a t e s s ys t em p r o c e s se s , m a ps RM S a nd t h e m e ssag e f i l e , a nd c r e a t e s t h e p r o c e s s tha t i nvo k e s the s ta r tup c ommand f i l e . 22. 1 I N I T IAL E XECUT I ON OF THE EXECUT IVE ( IN I T ) Th e f i n a l i n s t r uc t i o n in SYSBOOT t r a ns f e r s c o n t r o l to ( ph ys i c a l ) ad d r e s s EXE $ I N I T , an add r e s s i n m o d u l e !N I T . ! N I T t u r n s o n m emo r y m a n ag em e n t , config ures the I /0 adapte r s , i n i t i a l i ze s seve r a l s c h ed u l i ng a nd memo r y m a n ag em e n t d a ta s t r uc t ur e s , a nd f i na l l y r e l e a s e s t h e pag e s tha t i t o cc up i e s s o tha t c o d e t h a t ex e c u t e s o n l y o n c e d u r i ng t h e l i f e o f t h e s ys t em d o e s n o t c o n s ume s ys t em r e so u r c e s . 22. 1. 1 Tu r n i ng on Memo ry Manag ement Th e f i r s t ( a nd pe rh a ps m o s t i m po r ta n t ) s t e p tha t ! N I T t a k e s t u r n s o n m emo r y m a n ag emen t . Be fo r e SYSBOOT t r a n s f e r s c o n t r o l t o ! N I T , i t s e t s u p the s ys tem pag e t ab l e t o m a p t h e e x e c u t i v e a nd d yn am i c d a ta s t r uc t u r e s . In a d d i t i o n , a P O pag e t a b l e i s c o ns t r uc ted so tha t t h e ph ys i c a l pag e c o n ta i n i ng E XE $ I N I T i s m a pped a s a P O v i r t ua l pag e wh e r e t h e v i r t ua l p ag e n um b e r is i d en t i c a l t o the phys i c a l pag e n um be r . Th i s m e a n s tha t E XE $ I N I T c a n b e r e f e r e n c ed a s a PO v i r tua l address tha t is i d en t i c a l l y eq ua l t o t h e phys i c a l ad d r e s s o f EXE $ I N I T . Th e r e a so n tha t P O s pa c e i s used f o r th i s d o ub l e m a pp i ng i s t h a t t h e PO s pa c e add r e s s r a ng e f r om 0 t o 4 0 0 0 0 0 0 0 i s t h e same a s t h e m a x i m um ph ys i c a l add r e s s r a ng e p e rm i t ted by t h e VAX a r c h i t e c t u r e . Th a t i s , n o m a t t e r h o w m u c h phys i c a l memo r y i s p u t o n a VAX p r o c e s so r , the r e w i l l a l wa ys b e a P O a d d r e s s r ang e w i th i d en t i c a l a d d r e s s e s . 22-1 OPERAT ING SYSTEM I N I T IALI ZAT I ON 2 2 . 1 . 1 . 1 Do ub l e Mapp i ng o f ! N I T by SYSBOOT - Th i s PO pag e t ab l e is c o n s t r uc t ed b y l o ad i ng the P O b a s e a nd l eng t h r eg i s t e r s wi th v a l ue s th a t a c c e s s a po r t i o n o f t h e sys t em pag e t ab l e { F i g u r e 2 2- 1 ) . I f we a s s um e t h a t E XE $ I N I T i s l o c a t ed i n PFN n , t h e n P O LR i s l o ad ed wi th n + 2 a nd POBR i s l o ad ed w i th a sys tem v i r t ua l a d d r e s s tha t is n l o ngwo rd s sma l l e r t h a n t h e s ys tem v i r t ua l add r e s s o f t h e sys tem pag e t ab l e e n t r y th a t maps E XE $ I N I T . System Page Table PR$_SBR contains physical address of this SPTE SPTE for zeroth SVP • • • ( EXE$1NIT Is contained In system virtual page VI and In physical page PI ) I 1-----------------i • • ,._ PR$_POBR contains the virtual address of this longword This longword becomes the PO PTE for the zeroth POVP The relative sizes of PI and VI deter mine whether the longword pointed to by POBR lies within the sysJem page table • • PI 5 VI => within system page table PI > VI => outside the system page table Pt-1 ( SPTE for virtual page VI This system virtual page contains EXE$1NIT ) Valid, PROT, etc. I Whether this longword lies within the system page table Is of no concern to address translation. PI PFN = PJ Pt+1 P1+2 ( POPTE for PO virtual page that contains EXE$1NIT. This Is the P1th PO page table entry ) PR$_POLR Is loaded with P1 + 2 There are PI + 1 longwords Inclusive from the longword located by POBR to the SPTE that maps I N IT. By put ting PI + 2 Into POLR, EXE$1NIT can extend Into a second page. • • • SPTE for last SVP F i g u r e 2 2 -1 Do ub l e U s e o f Sys t em Pag e Ta b l e En t r i e s by IN I T Th e n e t r es u l t of all th i s m a pp i ng is t h a t t h e ph ys i c a l pa g e c o n t a i n i ng E XE $ I N I T c a n ( a nd w i l l ) b e a c c e s s e d i n th r e e d i f f e r e n t wa ys ( F igure 2 2-2 ) . Th e s e d i f f e r e n t m a pp i ng s a r e l i s t ed h e r e in o rd e r of m a pp i ng c om p l i c a t i o n , a nd n o t i n the o rd e r i n wh i c h th e y a r e used . EXE $ I N I T c a n b e a c c e ssed 2 2- 2 OPERATING SYSTEM IN I T IALIZATION • • • a s a p h ys i c a l add r e s s , a s a s y s t em v i r t ua l a d d r e s s ( 8 0 0 1 2F F 8 i n Ve r s i o n 2 ) m a pped by t h e s y s t em pag e t a b l e , tha t is o r a s a P O v i r t ua l a d d r e s s t h a t i s l o c a ted by t h e s u b s e t o f t h e s y s tem pa g e ta b l e tha t i s a l so u s ed a s a P O pag e t ab l e . 22 . 1 . 1 . 2 I n s t r uc t i o n s Tha t Tu r n on Memo ry Managem e n t - Wh e n INIT b eg i n s e x ec u t i o n , m emo r y manag em e n t i s d i s ab l ed . Th e PC c o n t a i n s t h e phys i c a l add r e s s o f EXE $ I N I T . (1) Th e f i r s t i n s t r uc t i o n MOVL RPB $ L_B OOTRS ( R l l ) , FP e x e c u t e s i n phys i c a l s pac e . I t s e f fe c t t u r n i ng mem o r y m a n ag em e n t o n . (2) is no t r e l a te d to Th e s e c o nd i n s t r uc t i o n MTPR a c t ua l l y t u r n s memo r y m a n a g em e n t o n . Th a t is , all add r e s s r e f e r enc e s f r om t h a t po i n t o n m u s t b e t r a n s l a te d . No t e t h a t t h e i n s t r uc t i o n d o e s n o t c a use a t r a n s f e r o f c o n t r o l . Th e PC is s i mpl y i n c r em e n t ed b y th r e e , the numb e r o f byt e s i n t h e i n s t r uc t i o n . Ho we v e r , the next PC r e f e renc e wi l l be t r a n s l a t e d b e c a use memo r y ma n ag emen t has b e en e n a b l ed . Be c a us e o f t h e m a pp i ng s e t up b y S YSB OOT , the i nc r em e n t ed ( ph y s i c a l ) PC ( th e add r e s s o f t h e JM P i n s t r uc t i o n ) , wh e n t r a n s l a t e d us i ng t h e P O pag e t a b l e , y i e l d s t h e phys i c a l a d d r e s s o f t h e JMP i n s t r uc t i o n . (3) Th e th i rd i n s t r uc t i o n JMP @#10$ i s t h e o n l y i n s t r uc t i o n tha t e x e c u t e s wi th a P O p r og r am counte r . Th i s i n s t r uc t i o n i mmed i a t e l y t r a n s f e r s co n t r o l to a sys t em v i r t ua l a d d r e s s th a t wa s c a l c u l a ted wh en the e x e c u t i v e wa s l i nked . Wh e n th i s s ys tem v i r t ua l add r e s s i s t r a n s l a t ed , i t r e s u l t s i n t h e phys i c a l add r e s s o f the n e x t i n s t r uc t i o n i n the phys i c a l pa g e c o n t a i n i ng E XE $ I N I T . Th e th r e e i n s t r uc t i o n s f r om MTPR to MOVL E XE $G L_INTSTK , S P execute in th r e e d i f f e r e n t m a pp i ng contexts ( so l i d l i ne in Figure 2 2-2 ) . Ho we v e r , the m a ppi ng tha t wa s s e t up b y SYSB OOT r e s u l t s i n a s e l e c t i o n o f s uc c e s s i v e i n s t r uc t i o n s f r om the s am e ph ys i c a l pag e . 2 2- 3 OPERAT ING SYSTEM IN I T IA L I ZAT I ON from SYSBOOT PO Space I ....---� I I I I I I I I I I } I MOVL RPB$LBOOTR5(R1 1 ),FP ' MTPR # 1 ,S- # MAPEN / I I I System I I I I I I I I I I I I I I I I 1. Instructions that execute with physical (no) mapping 2. Instruction that executes from PO space 3. Instructions that execute from system virtual address space Space F i gure 2 2 - 2 Addr e s s Space Changes a s Memory Management is Enabled by I N I T 2 2- 4 OPERATING S YSTEM I N I T I AL I Z AT I ON 22. 1 . 2 I n i t i a l i za t i o n o f t h e E x e c u t i ve Onc e !N I T h a s s uc c e ed ed i n t u r n i ng o n memo r y manag emen t , i t i s f r e e t o make r e f e r e nc e s t o s ys t em a d d r e s s e s . I n pa r t i c u l a r , it is now po s s i b l e t o i n i t i a l i z e d yn am i c d a ta s t r uc t u r e s tha t h a v e the i r l i sthead s s to r ed i n s t a t i c g l o b a l l o c a t i o n s i n s y s t em spa c e . Some o f t h e s e s te p s i nvo l v e a l l o c a t i o n f r om no npag ed d y n am i c m emo r y . ( Th e n o npag ed po o l s pac e a l l o c a t ed b y ! N I T , a nd t h e SYSB OOT pa r am e t e r s t h a t c o n t r o l t h e amoun t o f a l l o c a ted s pa c e , a r e l i s t ed i n Tab l e 2 2 - 1 . ) Th e d e t a i l ed s t eps t h a t ! N I T t a k e s o nc e mem o r y m a n ag em e n t h a s b e e n t u r n e d o n a r e l i s t ed h e r e . 1. Th e f i l e d e sc r i p to r s a n d o th e r a rg um e n t s tha t we r e pa s s e d to !NIT f r om SYSBOO T i n r eg i s t e r s a r e s a v e d in co r r e s po nd i ng g loba l l o ca t i o ns . 2. Th e swa p f i l e t ab l e entry fo r the Sh e l l process is i n i t i a l i z e d t o po i n t to the e x e c u t ive i mag e ( F i g u r e s 1 1 - 2 2 , 1 1-2 3 , and 1 7- 5 ) . 3. Th e Sy s t em Co n t r o l B l o c k Ba s e Reg i s t e r i s l o ad ed w i th the phys i c a l ad d r e s s o f the SCB that c o n t a i n s the add r e s s e s o f e x c e p t i o n a n d i n t e r r up t s e r v i c e r o u t i n e s in the e x e c u t i v e . Th i s b l o c k wa s a l l o c a t e d a nd i n i t i a l i z ed by SYSBOOT . 4. or E x e c u t i v e d e b ug g e r s up po r t is e i th e r i n i t i a l i z ed e l i m i n a ted , a c c o rd i ng to the s e t t i ng of t h e d e bug f l ag ( R PB $V_D E B UG , R 5 < 1 > ) o n i n put t o VM B . a. I f d e b ug s uppo r t i s s e l ec t ed , t h e B PT a nd TB IT v e c to r s a r e l o ad ed wi th the ad d r e s s e s o f s e r v i c e r o u t i n e s w i th i n XDE LTA . b. I f d e bug s uppo r t i s n o t s e l e c t ed , t h e B PT i n s t r uc t i o n in !NIT ( a t add r e s s IN I $ BRK ) i s c o nve r ted to a NO P . In a d d i t i o n , the pag e s c o n t a i n i ng XDE LTA ( s e e App e nd i x E ) are i nc l ud ed i n t h e l i s t o f p a g es tha t ! N I T w i l l r e l e a s e t o t h e f r e e pag e l i s t a s pa r t o f i t s ex i t r o ut i n e . except i o n except i on 5. Th e a nno unc em e n t m e s sag e i s p r i n t ed on the c o nso l e t e rm i na l . No t e t h a t t h i s i mpo r ta n t m i l e s to n e , wh i l e no t v e r y f a r i n to ! N I T , i nd i c a t e s t h a t the e x e c u t i v e h a s b e e n r e a d i n to m emo r y a n d memo r y m a n a g eme n t t u r ned o n , b o th s i g n i f i c a n t s t e p s i n b r i ng i ng the s y s t em o n the a i r . 6. No n pag ed po o l i s i n i t i a l i z ed 7. I f t h e i n i t i a l b r e a kpo i n t f l ag ( RPB $V I N I BPT , R S < 2 > ) wa s set o n i n pu t to VMB , t h en ! N I T e x e c u t e s a B PT i n s t r uc t i o n a t t h i s po i n t . 8. I f the SYSPAG I NG S YSB OOT f l ag i s s e t , i nd i c a t i ng that the pag e a b l e ex e c u t i v e r o u t i nes a r e g o i ng to pag e , t h e n t h e phys i c a l pag e s o c c up i ed by t h i s pa r t o f the e x ec u t i v e are r e l e a s ed t o t h e f r e e pag e l i s t a nd the S PTEs fo r th e s e pag e s are se t up to c o n ta i n s ys t em sect ion tab l e i nd i c e s . In a d d i t i o n , t h e f i r s t s ec t i o n t a b l e e n t r y i n t h e sys tem s e c t i o n t a b l e ( F i g u r e 1 1 - 1 5 ) i s i n i t i a l i z e d to po i n t to the e x e c u t i ve i mag e SYS . EXE . 2 2- 5 ( Ch a p t e r 2 5 ) . Tab l e 2 2 - 1 U s e o f Nonpaged Pool by Modu l e I N I T G l ob a l Ad d r e s s o f Po i n te r Fa c to r s Th a t Af f e c t S i ze R e a l -T i m e B i tm a p E XE $G L_R TB I TMAP RBM $K L E NGTH + 4 *R EALT I M E S PT S ( but o n l y pr e se n t wh e n REA LT I M E_S PTS n o n ze r o ) Ad a pt e r Co n t r o l B l o c k s f o r I /O Ad a pt e r s I OC $G L ADPL I S T Num b e r and Type o f Ex t e r n a l Ad a pt e r s ( Ta b l e 22-2 ) (NH) PCB Ve c to r and Se q u e n c e Ve c to r SC H $G L PCBVEC SC H $G L=S E QVEC 6 * ( MAXPROC E S S C NT + l ) ( No te 1 ) (NH ) P r o c e s s He ad e r Ve c to r s PHV$G L P I XBAS PHV$G L=R EFCBAS 4 * ( BA LS E TC NT + l ) (No te 2 ) (NH ) Swa ppe r Ma p SWP$G L_MAP 4 *WSMA X + 4 ( No te 3 ) (NH ) Mo d i f i ed Pag e Wr i t e r Ar r a ys M PW $A L PTE M PW $AW P HVI N DE X 6 * M PW WRTC LUSTER (NH ) Bo o t s t r a p I /O Ro ut i n e s R PB $ L_I OVE C S i z e o f Dr i v e r (NH ) C PU -De pend e n t Co d e E XE $ A L_L OAVEC Log i c a l Nam e Bl o c k s fo r S YS $D I S K a nd SYS $ S YS D I S K LOG $G L_S LTF L Te rm i n a l Dr i v e r a nd I t s As s o c i a ted Da ta S t r uc t u r e s ( N o te 7 ) S i ze o f Imag e TTDR I VE R . EXE Sy s tem D i s k Dr i v e r a nd I t s As s o c i a ted Da ta St r uc t u r e s ( No t e 7 ) S i ze o f d i s k d r i v e r Item ( No te 4 ) ( No t e 5 ) (No te 6 ) Itsel f S i ze o f I m ag e SYS LOAx x x . E XE constant ( No te 6 ) i m ag e OPERATING SYSTEM IN I T IAL I Z ATION Ta b l e 2 2 - 1 ( cont . ) U s e o f No n pag ed Po o l by Mo d u l e !N I T ( No t e s ) (NH ) Th e s e s t r uc t u r e s a r e a l l o c a t ed w i tho ut a 1 2 byt e head e r tha t conta ins a s i ze a nd t ype f i eld . Th i s i s no t a pro b l em bec a use the se s t r uc tu r e s a r e n ev e r d e a l l o c a ted . Ho wev e r , an i n te r e s t i ng s i d e e f fe c t o f t h i s ab s e nc e o f a h e a d e r i s tha t S DA i n te r pr e t s d a ta a s s t r uc t u r e s i ze a nd i nco r r ec t l y d um ps the b eg i nn i ng o f n o n pag ed po o l . (1) On e ex t r a s l o t i n e a c h a r r a y fo r s ys tem p r o c e s s h a s p r o c e s s i nd ex o f MAXPR OC ES SCNT . PCB . (2) On e ex t r a s l o t i n e a c h a r r a y fo r s ys t em h e a d e r ha s b a l a n c e sl o t i nd ex of BALS ETCNT . h e ad e r . (3) Ex t r a l o ng wo r d conta i n s a ze r o , a n e nd o f l i s t i nd i c a to r . (4) Th e boo t s t r a p I /O r o ut i n e s a r e l o c a t ed thro ug h a n the Re s t a r t Pa r ame t e r B l o c k . (5) Lo a d a b l e r o u t i n e s a r e JM P to a rg um e n t s ( Fi g u r e 22- 3 ) . (6) Th e l og i c a l name b l o c k s a r e c o n s t a n t b ec a use the s i ze s o f b o th the l og i c a l name s t r i ng s ( S YS $D I S K a nd SYS $ S YS D I S K ) and the equ i v a l enc e name s t r i ng s ( D Dc u : ) a r e c on stan t . Th e l og i c a l name b l o c k s a r e l i n k e d - i n to the s ys t em l og i c a l name tab l e in the u s ua l m a n ne r . (7) Dev i c e d r i v e r s a nd the i r a s so c i a t ed d a ta s t r uc t u r e s a r e l i n ked i n to the I /O d a t a b a s e i n s ev e r a l wa ys . Se e t h e VAX/VM S Gu i d e to Wr i t i ng a Dev i c e Dr i v e r fo r d e ta i l s . c o nnec ted to i n s t r uc t i o n s 2 2-7 the in " Sy s t em " Sys tem o ffset in ex ec u t i v e th r o ug h modul e S YS LOAVEC OPERAT ING SYSTEM IN I T IAL I Z AT I ON 9. Th e f i e l d s i n the r e s t a r t pa r am e t e r b l o c k u s e d by t h e r e s t a r t r o u t i n e ( Ch a p t e r 2 3 ) a r e i n i t i a l i z e d . 10. Th e phys i c a l pag e s r e p r e s e n t e d by t h e PFN b i tm a p s e t up by VMB a r e p l a c ed o n t h e f r e e pag e l i s t . ( No t e th a t the pag e s t h a t c o n ta i n t h e PFN b i tm a p m u s t b e m a pped v i r t ua l l y b e fo r e t h e y c a n b e a c c e s s ed . ) 11. Th e s y s t em pag e t a b l e e n t r i e s f o r pag ed d yn am i c m emo r y a r e s e t up . I f pag e d poo l i s g o i ng t o pag e ( th e POO L PAG ING SYSBOOT f l a g i s s e t ) , t h e n the S PTEs a r e s e t up to conta i n d emand z e r o f o rma t PTEs . I f po o l pag i ng i s t u r n ed o f f , then phys i c a l pag e s a r e a l l o c a ted , t h e i r PFNs a r e l o ad ed i n to the S PTEs , the p r o t e c t i o n c od e s ( URKW ) a r e l o a d ed , a nd the v a l i d b i t s a r e t u r ned o n . 12. Th e p r e a l l o c a t ed I /0 r e que s t pa c k e t s a re r emoved f r om n o n pag ed po o l and l i n ked tog e the r . ( Th e I R P l o o k a s i d e l i s t i s d e sc r i bed i n Ch a p t e r 2 5 . ) 13. I f the SYS B OOT p a r am e t e r REALT IME S PTS i s set to non z e r o , t h a t n um b e r o f S PT E s is t a k e n f r om the l i s t o f a v a i l a b l e S PTEs { Append i x E ) a nd d e s c r i b ed in a r e a l - t i m e b i tm a p c o n t r o l b l o c k , a l l o c a t ed f r om n o npag ed po o l . 14. Th e a d a pte r m a pped . Th e e x t e r n a l I / O a d a pt e r s a re r e co r d ed i n the c o n f i g u r a t i o n wa s d e te rm i n ed by VMB a nd r e s ta r t pa r am e t e r b l o c k . Th e r e a r e two d i s t i n c t s t e ps to i n i t i a l i z i ng e a c h a d a p t e r : • • c r e a t i ng sys t em v i r t ua l pag e s tha t map t h e ph ys i c a l pag e s c o n t a i n i ng ad a p t e r ad d r e s s e s a nd i n i t i a l i z i ng r eg i s te r s . the Ad a p te r i n i t i a l i z a t i o n s ec t i on . con ten ts is of d i sc u s s ed the s e now f u r th e r access i bl e in the nex t 15. The PC B v e c to r a nd s e q u e n c e n umbe r vec to r ( Ch a pt e r 1 7 ) are a l loca ted f r om nonpa g ed po o l a nd i n i t i a l i z e d . Al l s e q u e n c e n umbe r s a r e i n i t i a l i z e d to z e r o . Al l PC B v e c to r slots are s e t u p t o po i n t t o the PC B o f the n u l l p r o c e s s . No te th a t Th e o n e e x t r a e n t r y i s a l l o c a t ed a t the end o f e a c h a r r a y . e x t r a e n t r y i n the PC B v e c to r po i n t s to the sys tem PCB . ( Th e s y s tem PCB i s d e f i n ed i n mod u l e PDAT . I t s d ynam i c contents a r e l o ad ed by !N I T . ) 16. Th e s c h e d u l e r i s c a l l ed to m a k e c om p u ta b l e the two proc esses tha t are a s sem b l ed as a pa r t o f t h e e x e c u t i v e i m ag e , the s wa ppe r a n d the n u l l p r o c e s s . 17. Th e p r o c e s s h e a d e r vec to r s ( Ch a p t e r 1 1 ) a r e i n i t i a l i zed fo r e a c h b a l a n c e sl o t . Th e r e f e r e nc e c o un t a r r a y i s i n i t i a l i z ed to c o n t a i n a neg a t i v e one in e ac h a r r a y e l em e n t . Th e p r o c e s s i nd e x a r r a y i s i n i t i a l i z ed to c o n t a i n z e r o s , i nd i c a t i ng f r e e ba l ance s l o ts . 2 2-8 OPERAT ING SYSTEM IN I T IALI ZATION ( Th e n u l l p r o c e s s i s the p r o c e s s wi t h z e ro . Be c a u s e t h e n u l l p r o c e s s d o es r e qu i r e a ba l an c e s l o t . Th i s a l l o ws a n u s ed fo r a n o the r p u r po s e , n ame l y to s l o ts . ) a proc ess i nd ex of n o t swa p , i t d o e s n o t i nd ex o f z e r o to be i nd i c a t e f r ee b a l a n c e As Append i x E i l l u s t r a t e s , the s ys tem head e r and sys t em pa g e tabl e i mmed i a t e l y f o l l o w t h e ba l a nc e s l o t a r e a i n sys t em a d d r e s s spa c e . I n f a c t , po r t i o n s o f the m emo r y manag em e n t s ub s y s t em t r e a t the s y s t em h e ad e r a s t h e o c c upa n t o f a n a d d i t i o n a l ba l a nc e s l o t , o n e w i th a s l o t n um b e r e q ua l t o t h e S YS B OOT pa r am e t e r BALS ETCNT . Th e t wo p r o c e s s head e r vec to r a r r a ys h a v e o n e e x t r a e n t r y a t the end to r e f l ec t th i s f e a t ur e . 18 . Th e swa ppe r m a p ( Ch a pt e r s l l a nd 14) i s a l loca ted f r om n o n pag ed po o l . I t s add ress i s s to r e d i n g l o b a l l o c a t i o n SWP $G L MAP a n d a l s o i n t h e swa ppe r ' s P O b a s e r eg i s t e r . Pag e s th a t appe a r i n t h e swa ppe r m a p a r e a c c e s s i b l e a s P O v i r t ua l pag e s wh e n t h e swa ppe r i s the c u r r e n t pr o c e s s . 19 . Th e mod i f i ed pag e wr i t e r a r r a ys a l l o c a t e d f r om no npag ed po o l . 20 . Th e boo t s t r a p I /O r o u t i n e s tha t a r e a pa r t o f VMB a r e c o p i ed to no n pag ed po o l . { As wi t h the PFN b i tm a p , the pa g e s th a t c o n ta i n these r o ut i nes mus t be t empo r a r i l y ma pped t o ma ke t h em a c c e s s i b l e to IN I T , wh i c h i s wo r k i ng w i th m emo r y m a n a g em e n t e n a b l ed . ) S o m e mo r e pa r am e t e r s tha t wi l l be u s ed by t h e r e s ta r t r o ut i ne ( Ch a pt e r 2 3 ) are l o a d ed i n to the r e s t a r t pa r am e t e r b l o c k . 21 . Th e C PU-d epend e n t c o d e i s l o ad ed i n to po o l . Th e v e c to r ed l i nkage to th e se r o u t i n e s , d e sc r i b ed i n a l a t e r sec t i o n o f t h i s c h a p t e r , i s e s t a b l i shed . 22 . Log i c a l name bloc ks fo r SYS $D I S K and SYS $ S Y S D I S K are a l l oca ted f r om n o npag ed po o l , even tho ugh a l l o th e r l og i c a l name b l o c k s f o r s ys t em o r g r o up l og i c a l n a m e s a r e a l l o c a t ed f r om pa g ed po o l . Th i s i s b ec a u se pag e d po o l a l l o c a t i o n i s n o t po s s i b l e above I PL 2 . Th e two l og i c a l n ame b l o c k s a r e l i n k ed i n to t h e sys tem l og i c a l name t a b l e . 23 . Th e t e rm i n a l d r i v e r ( S YS $ S YS TEM : TTDR I VER . E XE ) i s l o ad ed i n to n o n pag ed po o l . Th e e n t r y po i n t s o f t h e d r i v e r a r e l o a d ed i n to t h e d e v i c e d a t a b l o c k ( DDB ) fo r th e c o n so l e t e rm i n a l ( O PA O ) . Th e d a t a s t r uc t u r e s f o r add i t i o n a l t e rm i n a l s wi l l be e s t a b l i shed a s a r e s u l t of the AUTOC ONF I G URE ALL c omm and th a t i s pa s s e d to SYSGEN a s pa r t o f t h e c ommand f i l e STARTU P . COM . 24 . Th e d r i v e r fo r th e sys t em d ev i c e i s l o ad ed i n to n o n pa g ed po o l . Fi e l d s in i ts a s s o c i a t ed d a t a s t r uc t u r e s ( DDB , UC B , CRB , I DB , AD P ) a r e l o a d ed wi th i n fo rm a t i o n tha t d e pend s o n wh i c h spec i f i c un i t a nd c o n t r o l l e r l oc a t e t h e sys t em d i s k . 25. On c e the s ys t em d ev i c e c o n t r o l l e r a nd un i t d e s i g na t o r s a r e d e t e rm i n ed , the equi va l en c e n am e s fo r SYS $D I S K a nd SYS $ S YS D I S K a r e s t o r ed in the i r r e spe c t i ve l og i c a l n ame bl ocks . 2 2-9 ( Ch a pt e r s l l a nd 12) are OPERATING SYSTEM I N I T IALI ZAT I ON 26. Th e d r i v e r p r o l o g ue ta b l e s f o r the th r ee d ev i c e s { ma i l bo x , n u l l d ev i c e , a nd c o n s o l e t e rm i n a l ) th a t a r e l i n ked w i th SYS . EX E , a nd a l so the D PTs f o r the t e rm i n a l d r i v e r a nd the s y s tem d i s k d r i v e r , a re l i n k ed i n to t h e d r i v e r d a t a b a s e { l o c a t e d th r o ug h l i s thead I O C $G L_D PTL I S T ) . 27. A p ag e o f phys i c a l memo r y { th e so -c a l l ed b l a c k h o l e pag e o r r a bb i t ho l e pag e ) i s r e s e r v e d fo r UN I B US a d a p t e r po we r f a i l o n t h e VAX- 1 1 /7 8 0 . Wh e n powe r fa i l ure occurs on a UN I B US ad apte r , a l l v i r t ua l pag e s m a pped to UBA r eg i s te r s o r UN I BUS I/0 s p a c e { 2 4 p a g e s i n a l l ) a r e r ema pped to th i s phys i c a l p ag e . Th i s p r even t s d r i v e r s fo r UN I B US d ev i c e s f r om g e n e r a t i ng mul t i pl e m a c h i n e c h e c k s wh i l e the powe r i s o f f f o r t h e UBA . Powe r f a i l o p e r a t i o n s a r e d i s c u s s ed i n mo r e d e ta i l i n Ch a pte r 2 3 . Ma c h i n e c h e c k o pe r a t i o n i s b r i e f l y d i sc us s e d i n Ch a p t e r 7 . 28 . Th e m a x i m um a l l o wa b l e n e c es s a ry) to r e f l ec t memo r y . wo r k i ng set is r e ad j us ted {if the amoun t o f a v a i l ab l e phys i c a l Spe c i f i c a l l y , t h e n um b e r of phys i c a l pag e s u s ed b y the execut ive { Append i x E) i s s ub t r a c ted f r om a v a i l a b l e phys i c a l memo r y . Sy s t em usage i n c l ud e s n o t o n l y nonpaged c o d e a nd d a ta b u t a l s o the s ys t em wo r k i ng s e t , M PW L O L IM IT pag e s o n f r e e pag e the mod i f i ed pag e l i s t , a nd FRE E L IM pag e s o n t h e l i s t { b u t n o t t h e pag e s used by !N I T ) . Th e v a l ue o f WSMAX i s t h e n m i n im i zed w i t h th i s d i f f e r enc e . 29 . Two f l ag s used by t h e r e s ta r t c od e { Ch a pte r 2 3 ) a r e c l ea r ed . 30 . F i na l l y , ! N I T f r e e s up t h e pag e s tha t i t o c c up i ed a nd j umps to the sched u l e r . Th i s m e a n s tha t the p r o t e c t i o n f i e l d s fo r t h e s e s y s t em v i r t ua l pag e s a r e s e t to No Ac c e s s i n the sys t em page t a b l e and the phys i c a l pag e s a r e pl ac e d o n to the f r e e page l i st . ! N I T a c c ompl i sh e s th i s by c o pyi ng a sma l l r o ut i n e i n to nonpag e d po o l and t r an s f e r r i ng c o n t r o l to th a t r o u t i n e . Th e r o u t i n e i t s e l f v a n i sh e s a s a r e s u l t o f the f i rst a l locat i on f r om po o l , because the u s e o f th i s b l o c k o f po o l wa s no t r e co r d e d a n ywh e r e . 22. 1 . 3 I /0 Ad a pt e r I n i t i a l i za t i on Wh e n VMB p e r fo rmed i t s m emo r y s i z i ng , i t a l so i d e n t i f i ed t h e p r e s e n c e a nd i d en t i t y o f e x t e r n a l a d a p t e r s . T h e r e s u l t s o f th i s o pe r a t i o n we r e s to r e d i n a 1 6 byte t ab l e i n the Re s t a r t Pa r ame te r Bl o c k { at o f fset RPB $ B C ONFREG ) . !N I T u s e s th i s i n f o rm a t i o n t o i n i t i a l i ze e a c h o f the a d a p ter s f o r l a te r u s e by SYSGEN ' s c o n f i g u r a t i o n o pe r a t i o n s . { Some o f the r o u t i n es c a l l ed b y !N I T a r e fo und i n so u r c e mod ul e I N I TADP , a l og i c a l ex t e n s i o n o f t h e cod e c o n t a i n ed i n m od u l e ! N I T . ) 2 2-1 0 OPERATING SYSTEM INITIAL I Z ATION Al t h o ug h some o f t h e i n i t i a l i z a t i o n th a t I N IT p e r fo r m s d e pend s o n t h e nature of t h e ex t e r n a l I /0 a d a pt e r , the r e a r e two g en e r a l s te p s th a t a r e t a k e n fo r e ac h a d a pt e r . • • An a d a p t e r c o n t r o l b l o c k tha t i d en t i f i e s the a d a pt e r and conta ins i n fo rm a t i o n a bo u t h o w t h e a d a p te r ' s i n t e rn a l r eg i s t e r s a r e m a pped i s a l l o c a te d f r om no npag ed poo l and l o a d ed . Sys t em v i r t ua l spac e i s s e t u p to m a p to the I /O space add resses fo r i n t e r n a l a d a pt e r r eg i s te r s a nd o th e r I /O s pa c e a s s i g nm e n t s . Ta b l e 2 2 - 2 l i s t s the d i f f e r enc e s i n ADP s i z e a nd m a pp i ng fo r e a c h o f t h e po s s i b l e e x t e r n a l a d a pte r s . 22 . 1 . 4 r e qu i r emen t s C PU-Depend e n t Ro u t i ne s Th e r e a r e two d i f f e r e n t type s o f C PU-d e p e nd e n t c o d e th a t a ppe a r in Ve r s i o n 2 o f VM S a nd two c o r r e spond i ng m e tho d s th a t VMS u s e s f o r i nc o r po r a t i ng the c od e . • • Wh e n th e r e a r e o n e o r two i n s t r uc t i o n s o r d a t a r e fe renc e s th a t d e pend o n the s pe c i f i c typ e o f C PU th a t i s b e i ng u s e d , the s y s tem u s ua l l y i nc l ud e s the c o d e o r d a t a s e q u e n c e f o r a l l C PUs i n l i n e a nd u s e s the c o n t e n t s o f l o c a t i o n EXE $G B C PUTYPE ( Th i s t o d e t e rm i n e wh i c h p i e c e o f the c od e or d a t a to use . l o c a t i o n wa s p r ev i o u s l y l o ad ed by SYSB OOT f r om the c o n t e n t s o f t h e PR $_S I D r eg i s t e r . ) In the c a s e o f e n t i r e r o u t i n e s ( s uch a s the p u r g e d a t a pa th rout ine , I OC $ P URGDATAP ) or e n t i r e mod u l e s ( s uc h a s the m a c h i n e c h e c k h a nd l e r ) th a t a r e C PU-d e pend e n t , a v e c to r ed e n t r y po i n t t e c hn i que i s u sed . Th e v e c to r ed e n t r y po i n t m e thod wo r k s in the fo l l o wi ng wa y . Each r e f e r e n c e w i th i n t h e execut i ve i m ag e t o a C PU-d e pend e n t r o u t i n e i s d i spa tc h ed to a JMP i n s t r uc t i o n i n m o d u l e SYS LOAVE C l i n k ed wi t h t h e execut i ve i m ag e SYS . EXE . Th e C PU-d e pe n d e n t r o u t i n e s ( on e r o u t i n e f o r e a c h C PU ) a r e l i n k ed tog e th e r i n to a s e r i e s o f CPU-depend e n t i mag e s wi th n am e s o f the fo rm SYS LOAx x x . EXE ( S YS L OA7 5 0 . EXE o r SYS LOA 7 8 0 . EXE ) . ! N IT u s e s the C PU t ype to l o ad the c o r r e c t C PU -d e pend e n t image SYS LOAx x x . EXE i n to n o n pa g ed po o l a s a pa r t o f s ys t em i n i t i a l i z a t i o n . An o th e r v e c to r mod u l e c a l l ed LOAVE C ( a c t ua l l y the same mod u l e as SYS LOAVE C w i th a d i f f e r en t s e t t i ng o f a c o nd i t i o n a l a s s em b l y f l ag ) , l i n k ed i n to e a c h C PU-d e pe nd e n t i mag e SYS LOAx x x . EXE , c o n t a i n s a n o f f s e t i n to the l o ad a b l e i mag e f o r e a c h o f t h e C PU -d epend e n t s u b r o u t i ne s . ! N I T us e s the i n fo rm a t i o n i n th i s t a b l e to ad j us t the a rg um e n t s o f t h e JM P i n s t r uc t i o n s ( i n mod ul e SYS LOAVEC ) so th a t they po i n t to t h e c o r r e c t r o u t i n e s i n SYS LOAx x x . EXE . Th e i n i t i a l d e s t i na t i o n s o f a l l the JMP i n s t r uc t i o n s is EXE $ L OAD ERROR , a g l o b a l a d d r e s s o f a HA LT i n s t r uc t i o n w i th i n m od u l e SYS LOAVEC - i n SYS . EXE . If a ny of th e s e C PU-d e pe nd e n t rout i n e s is r e fe r enced b e fo r e ! N I T h a s c ompl e t ed i t s i n i t i a l i za t i o n , the s ys t em wi l l h a l t . 2 2- 1 1 OPERATING SYSTEM I N IT IALI ZAT I ON Ta b l e 2 2 - 2 Ex t e r n a l Ad apte r I n i t i a l i za t i o n Ad apt e r Type S i ze o f Ad apt e r Co n t r o l B l o c k ( byt e s ) Number o f Sys t em Vi r tua l Pag e s Ma pped fo r Ad a pt e r Lo c a l Memo ry No n e ex i s t s On e Pag e MA7 8 0 Sh a r ed Memo r y ( VAX- 1 1 /7 8 0 o n l y ) 112 + 4*16 (No te 1 ) UN I B US Ad a pt e r (VAX- 1 1/7 5 0 ) (VAX-1 1 /7 8 0 ) = One Pag e 1 76 8 + 16 112 1 1 2 + 1 48 + 4*128 ( No te 2 } = 772 = 24 (No te 3 ) MAS SBUS Ad ap t e r 20 8 Pag e s DR 7 8 0 I n t e r fa c e ( VAX- 1 1 /7 8 0 o n l y ) 20 4 Pag e s Un o c c up i ed Ne xus Sl o t No n e Ex i s t s On e Pag e t o Al l o w Ac c es s (1} Th e r e a r e 1 1 2 byt e s i n t h e bod y o f the ADP pl us spa c e fo r v ec to r s . 16 l o ng wo rd (2) Th e VAX- 1 1 /7 5 0 ADP c o nta i n s 1 1 2 byt e s o f d a ta a nd no th i ng el s e . UN I B US v ec to r s a r e c o n t a i n ed i n the sec ond pag e o f the sys tem con t r o l bloc k . the i n te r r upt serv i c e Th e VAX- 1 1 /7 8 0 ADP c o n ta i n s 1 1 2 byt e s o f d a ta , r o ut i n e fo r t h e UBA wh i c h i s 1 4 8 byt e s l o ng ( i n Ve r s i o n 2 . 0 ) , and 1 2 8 l o ng wo rd v ec to r s , c o r r e spo nd i ng to UN IBUS v ec to r s f r om 0 to 774 ( oc ta l ) . (3} E i g h t pag e s m a p t h e UBA i n te r nal r eg i s t e r s s u c h a s mapp i ng r eg i s t e r s , d a t a pa th r eg i s t e r s , a nd the l i ke . S i x t e en pag e s map the UN IBUS I/0 pag e to a l l o w v i r t ua l ac c e s s to d ev i c e CSRs , d a ta r eg i s t e r s , a nd so o n . 2 2- 1 2 OPERATING SYSTEM I N ITIAL I ZATION Th e c o s t o f s e pa r a t i ng o u t C PU-d e pend e n t r o ut i ne s f r om the s ys t em i m ag e , o ne e x t r a l ev e l o f i nd i r ec t i o n , i s f a r o utwe i g h ed b y t h e b en e f i t s , f ewe r ex ec u t i o n t i m e d ec i s i o n s a nd no n e ed fo r sepa r a te e x e c u t i ve i mag e s fo r e a c h C PU . Th e l i n ka g e tha t i s e s ta b l i sh ed b y INIT f o r C PU-d e pe nd e n t r o u t i n e s i s i l l us t r a t ed i n F i g u r e 2 2 -3 . 22. 2 IN I T IAL I ZATION IN PROC ESS CONTEXT F u r the r s t eps i n s ys t em i n i t i a l i z a t i o n r equ i r e tha t th e y be pe r fo rmed Sys tem s e rv i c e s c an o nl y b e c a l l ed wh i l e ex e c ut i ng i n by a process . p r o c e s s c o n te x t b ec a u s e the q uo t a a nd p r i v i l eg e c h e c k s a r e m a d e ag a i nst p r o c e s s d a ta s t r uc t u r e s . A c omma nd l a ng uag e i n t e r p r e te r c an e a s i l y b e ma pped i n to P l s p a c e , a pe r - p r o c e s s po r t i on o f v i r tu a l ad d r e s s s pa c e tha t i s o n l y a v a i l ab l e wh en e x ec u t i ng i n process c o n t ex t . Th e p r o c e s s ph a s e o f s y s t em i n i t i a l i za t i o n i s d i v i d ed i n to two p i e c e s , t h a t pe r fo rmed by a s p e c i a l p r o c e s s c a l l ed SYS INIT a nd the s te p s pe r fo rmed by t h e c omma nd f i l e STARTU P . C OM . SYS IN IT P r o c e s s 22 . 2 . 1 Wh e n the s c hed u l e r exec utes , i t s e l ec t s t h e h ighest p r i o r i ty c omputa b l e process fo r e x ec u t i o n . Bec ause the r e a r e o n l y t wo p r o c e s s e s i n e x i s t e n c e a t th i s t i m e , the s wa ppe r process i s a l wa ys s e l e c ted ( be c a u s e i t has a p r i o r i ty o f 1 6 and the n u l l p r o c e s s h a s a p r i o r i ty o f 0 ) . Th e swa pp e r i mmed i a t e l y c r ea t e s a n o the r proce s s , c a l l ed S YS I N I T , t h a t p e r f o r m s tho se a spe c t s o f s ys t em i n i t i a l i za t i o n t h a t r equ i r e p r o c e s s c o n t ex t . In o ne s e n s e , S YS INIT i s a n e x t e n s i o n o f the swa ppe r p r o c e s s . Howe ve r , the i n i t i a l i za t i o n c o d e i s i so l a t ed to p r e v e n t e n c umbe r i ng t h e swa pp e r w i th c od e tha t o n l y e x ec u t e s o nc e d u r i ng the l i fe of a s ys t em . ( Th i s i s o ne o f s ev e r a l techn i que s u s ed d u r i ng s ys t em i n i t i a l i za t i o n a nd p r o c e s s c r e a t i o n to c a us e s e l d om u s ed cod e to d i s a ppe a r a f te r it is used . A l i s t o f s uc h techn i qu e s a pp e a r s i n Append i x A . ) Th e m a j o r f un c t i o n s tha t SYS INIT pe r fo rms c a n be g ro ups . • • • g ro u pe d i n to th r e e Th e pa g e f i l e , s wa p f i l e , a nd d um p f i l e a r e all o pened a nd the i r l o c a t i o n s o n d i s k s to r ed i n r e spec t i ve d a ta s t r uc tu r e s . RMS a nd th e s ec t i o n s . s ys t em m e s sag e file Sys t em p r o c e s s e s ( d i s k ACP , Jo b f o rma t t e r , a nd O PC OM ) a r e c r e a ted . 2 2- 1 3 a re m a pped Co n t ro l l e r , as s ys t em the error SYS.EXE JSB / G " IOC$PURGDATAP SYSLOAxxx.EXE (This linkage Is established at link time to vector In module SYSLOAVEC.) (vector for purge datapath routine .LONG IOC$PURGDATAP - .) module SYSLOAVEC Each vector In SYSLOAVEC Initially contains a JMP (with absolute addressing) to an Internal error routine. If a loadable routine were called before the linkage Is estab lished, that error routine will halt. (vector for purge datapath routine) IOC$PURGDATAP: ( ··---�· this linkage dynamically established by INIT JMP @ # ....._____.. } ( Each vector In LOAVEC con tains a self relative displace ment (offset) to the routine In question. IOC$PURGDATAP: : real purge datapath routine RSB Modules LOAVEC and SYSLOAVEC are produced from the same source with alternate settings of an assembly time parameter I N IT modifies the destina tions of the JMP Instructions after It loads SYSLOAxxx.EXE. F i gure 2 2 - 3 module LOAVEC L inkage and Contro l F l ow Examp l e for CPU-Dependent Routines ) OPERATING SYSTEM IN I T IAL I Z ATION 2 2 . 2 . 1 . 1 Po o l Usag e by SYS INIT S Y S I N I T , l i ke ! N I T , c o ns um e s l a rg e amoun t s o f n o npag ed po o l a nd s ome pag ed po o l . Howe v e r , t h e s i z e s o f v a r i o u s b l o c k s a r e n o t d i r e c t l y r e l a t ed t o SYS BOOT pa r am e t e r s . In add i t i o n , w i th o n e e x c e p t i o n , all b l o c k s a l l o c a ted d i r e c t l y o r i nd i r e c t l y b y SYS IN IT i n c l ud e a 1 2 b y t e head e r tha t c o n t a i n s a s i ze f ield a nd un i q ue ident i f i e r fo r e ac h s t r uc t u r e . A s am p l e l i s t o f s t r uc t u r e s tha t a r e a l l o c a ted f r om n o npag ed po o l a s a resul t o f the e x e c u t i o n o f S YS I N IT i n c l ud e - • • • • s o f twa r e PC Bs a nd J I B s fo r s ys t em p r o c e s s e s , f i l e c o n t r o l b l o c k s a nd wi n d o w c o n t r o l b l o c k s fo r a l l f i les , ope ned a vo l um e co n t r o l b l o c k f o r the sys t em d i s k , a nd Th e s e s t r uc t u r e s ma i l bo x e s fo r the Jo b C o n t r o l l e r a nd O PC OM . a r e a c t ua l l y c r e a t ed as a r esul t o f exec ut i on o f the p r o c e s s - s p e c i f i c i m ag e s . The o ne b l o c k of n o npag ed poo l a l l o c a t ed by SYS INIT th a t does no t c o n t a i n a t ype c od e i s the pag e f i l e b i tm a p . Th i s s t r uc t u r e i s e a s i l y i d en t i f i a b l e i n a n S DA d ump a s a l a rg e b l o c k o f UN KNOWN t ype tha t h a s a n umbe r o f b i t s equa l to the s i z e i n b l o c ks o f PAG EF I L E . SY S . 2 2 . 2 . 1 . 2 De ta i l ed Ope r a t i o n o f SYS I N I T S YS I N I T t a k e s a r e l i s t e d h e r e . 1. Th e d e t a i l ed s t e ps that Sys tem l og i c a l n am e s a r e c r e a t ed fo r SYS $ S YS T EM a nd SYS $ S HARE . Th e c r e a t i o n o f the se name s c a nno t be d e l a yed u n t i l the c r e a t i o n of the S TARTUP p r o c e s s b e c a use th e s e names a r e n e e d ed a s a pa r t of t h e c r ea t i o n of th a t p r o c e s s . • • 2. - Th e n am e o f t h e i mag e tha t is p r o c e s s i s S YS $ S YS TEM : LOG INOUT . pa s s ed to the STARTUP Th e LOG INOUT i ma g e pe r fo rm s a m e rg ed i mag e a c t i v a t i o n ( Ch a p t e r 1 8 ) to ma p t h e DC L c ommand l a ng uag e i n t e r pr e t e r i n to P l spa c e . Th e i m a g e a c t i v a to r uses l og i c a l n am e SYS $ S HARE to loca te the sha r e a b l e i m ag e DC LTAB LES . E XE t h a t c o n t a i n s the c ommand d a t a b a s e fo r the DC L c ommand l a ng u a g e i n t e r p r e t e r . Th e s y s t em t i m e i s c a l c u l a t ed a nd s to r ed . I f t h e S E TT IM E f l a g wa s pa s s ed to SYSB OOT , o r i f t h e c o n t e n t s of t h e TODR r eg i s t e r i nd i c a t e tha t i t c o n t a i n s a m e a n i ng l e s s n um b e r ( Ch a p t e r 1 0 ) , t h e n a n e w v a l ue fo r t h e sys t em t i m e is so l i c i t ed f r om the c o n so l e t e rm i n a l . In any case , the c a l c ul a te a n ew copi es t h e cur rent m emo r y t o t h e d i s k Set Time s y s t e m se rv i c e i s c a l l ed to s ys t em t i me . I n ad d i t i o n , t h a t s e r v i c e pa r a m e t e r s e t t i ng s f r om t h e i r l o c a t i o n s i n i m ag e o f the e x e c ut i v e ( S YS . E XE ) . 2 2-1 5 OPERAT ING SYS TEM IN I T IAL I ZAT I ON 3. I f t h e UAFALTERNATE SYSBOOT f l ag is set , then a s ys t em l og i c a l n am e c a l l ed SYS UAF i s c r ea t ed wi th the eq u i v a l en c e n am e SYS UAFALT . Th i s f e a t u r e a l l o ws • • 4. s e l e c t i o n o f a n a l t e r n a t e a u tho r i za t i o n f i l e i f a log i c a l n ame c a l l ed SYS UAFALT is c r e a ted l a te r in the i n i t i a l i za t i o n s eque n c e tha t t r a n s l a t e s to th i s a l te r n a t e file , or a u toma t i c l og i n w i th s ys tem m a nag e r p r i v i l eg e s to a n yo n e i f no l og i c a l n a m e c a l l ed SYSUAFALT i s c r e a t ed . Th i s po s s i b i l i t y i s u s e f u l i f the sys tem m a n ag e r f o rg e t s h i s p a s swo r d . { U s e o f th i s c apa b i l i ty sho u l d be a c compa n i ed by a spec i a l pa rame t e r f i l e o r s ta r t up c ommand f i l e tha t p r ev e n t s un r e s t r i c t ed a c c e s s to the sys t em . ) Th e fo l l ow i ng f i l e s a r e o pe n e d by t h e AC P r o u t i n e s l o c a t ed i n t h e execut ive : [ S YS E XE ] PAG E F I L E . SYS [ S YS EXE ] S YS DUM P . DM P [ S YS EXE ] SWAPF I L E . S YS [ S YS E XE ] RM S . EXE [ S YSMSG ] S YSMSG . EXE 5. Th e pag e file is i n i t i a l i z ed . Th i s r eq u i r e s tha t the i n f o rm a t i o n o b t a i n ed in t h e p r ev i o u s s te p b e l o ad ed i n to a w i n d ow c o n t r o l b l o c k t h a t d e sc r i b e s t h e pag e file . Th e a d d r e s s o f t h a t WCB i s s to r e d i n the pag e f i l e c o n t r o l b l o c k { F i g u r e 1 1 - 2 2 ) fo r th e i n i t i a l pag e file { th e b l o c k w i th i nd e x 3 ) . I n a d d i t i o n , a b i tm a p t h a t d e sc r i b e s the av a i l a b i l i ty o f e a c h b l ock in t h e pag e f i l e i s a l l o c a ted f r om nonpa g ed po o l a nd i n i t i a l i z ed to a l l o n es to i nd i c a t e tha t a l l b l o c ks a re a va i l a b l e . 6. Th e a d d r e s s { l og i c a l b l o c k n umbe r ) a nd s i z e o f t h e d ump a r e s t o r ed { a t g l o b a l l o c a t i o n EXE $G Q_S YSDM P ) . f i le 7. Th e s wa p f i l e i s i n i t i a l i z e d . As wa s d o ne fo r the pag e f i l e , a w i n d o w c o n t r o l b l o c k i s a l l o c a ted f r om nonpag ed po o l . Its a d d r e s s i s s t o r ed i n the swa p f i l e t a b l e e n t r y { Ch a pt e r 1 1 ) f o r th e f i r s t swa p f i l e { th e o ne wi th i nd ex 1 ) . Th e swa p f i l e i s d i v i d ed i n to equa l s i z e s wa p s l o t s , each s l o t equa l in s i ze to the SYSB OOT pa r am e t e r WSMAX . Th e n um b e r o f s l o t s i n the f i l e ( m i n im i zed wi th 1 2 8 , t h e m a x i m um n um b e r o f s l o ts i n a s i ng l e swa p f i l e ) i s r ec o r d ed i n t h e S FTE . I n a d d i t i o n , t h e m a x i m um n um b e r o f p r o c e s s e s t h a t the s ys tem c a n s uppo r t { s to r ed i n g l o b a l l o c a t i o n S C H$GW PROC L I M ) i s t a k e n a s t h e m i n imum o f s wa p f i l e s l o t c o u n t -a nd the i n i t i a l MAXPROC ES SCNT SYS BOOT p a r am e t e r . ( Th e c o n t e n t s o f S C H $GW PROC L I M c a n b e i n c r e a sed l a t e r b y i n s t a l l i ng a s e c o nd s wa p fTl e . ) A s l i g h t c h a ng e to th i s i n i t i a l i z a t i o n , r emov i ng the l i m i t o f 1 2 8 o n t h e s i z e o f the b i tm a p , h a s b e e n a d d e d to Ve r s i o n 2 . 2 o f VAX/VM S . Th i s c h a ng e i s d e sc r i bed i n Append i x F . 2 2-1 6 O P E RATING SYSTEM IN ITIAL I Z AT I ON 8. RM S a n d the s ys t em m e s s a g e f i l e a r e s e t up a s pag e a b l e s y s t em sec t i ons . Th e sec t i on t ab l e e n t r i e s t h a t d e s c r i be t h e s e s ec t i ons a r e i n i t i a l i zed as the second a nd th i r d sec t i on tabl e entr i e s in the s ys t em h e ad e r . ( Th e f i r s t s ys t em sec t i on tab l e e n t r y , the one t h a t d e sc r i b e s the e x e c u t i ve i mag e i t s e l f , wa s s e t up by IN I T . ) 9. Th e s e c o nd a n d th i r d b l o c k s o f t h e d um p f i l e c o n ta i n the c o n t en t s of t h e e r r o r l og bu f f e r s i f t h e s ys t em j u s t c r a sh e d . Th e s e b u f f e r s we r e wr i t t e n to the d ump f i l e by t h e b ug c h e c k c o d e ( Ch a p t e r 7 ) s o t h e i r c o n t e n t s wo u l d no t b e l o s t . I f the sys t em is r e b o o t i ng a f t e r a c r a sh , SYS I N I T c o p i e s the s e c o nd a nd th i r d b l o c k s o f t h e d ump f i l e b a c k to the e r r o r l og b u f f e r s so t h e i r contents wi l l e v e n t ua l l y be wr i t t e n to [ S YS ERR ] ERRLOG . S Y S . Th e bug c h e c k r o u t i ne i nc l ud ed the e r ro r l og e n t r y th a t d e s c r i be s t h e r e a so n f o r the c r a sh i n the f i r s t b l o c k o f the d um p f i l e as pa r t of t h e d um p f i l e h e a d e r b l o c k . Th i s wa s d o n e to avo i d the l o s s o f t h i s d a ta i n the even t th a t th e two e r r o r l og bu f f e r s we r e f ul l a t the t i me o f t h e c r a sh . If t h i s wa s t h e c a se wh e n the s ys t e m c r ashed , SYS I N I T w i l l b e u n a b l e to c o py t h i s e r r o r l og e n t r y to o n e o f t h e e r r o r l og In tha t c ase , t h e e r r o r l og e n t r y th a t ac t ua l l y buffe r s . d e s c r i b e s t h e c r a sh wi l l n ev e r a ppe a r i n a n e r r o r l og r e po r t . Howev e r , in a l l c a s e s i nc l ud i ng t h i s r a r e o c c u r r e n c e o f t wo f ul l e r r o r l o g bu f f e r s , t h e r e a so n f o r the s ys t em c r a sh is c o n t a i n e d i n t h e d um p f i l e . 10. Th e s y s tem d i s k i s m o un t ed . A d i r e c t r es u l t o f th i s c r e a t i o n of the d i s k AC P f o r the s ys tem d i s k . is the F r om t h i s po i n t o n , t h e AC P i s ava i l ab l e f o r f i l e o pe r a t i o n s . Th e p r i m i t i v e AC P r o u t i n e s tha t a r e a pa r t o f SYS . EXE a r e n o l o ng e r r e qu i r ed a nd w i l l d i s a ppe a r in t i m e d ue to s ys t em wo r k i ng set r e pl a c em e n t . Th e pa r t i c u l a r c o n s t r a i n t th a t i s r emoved i s t h a t f i l e s a c c e s s ed f r om th i s po i n t o n a r e no t r e qu i r ed to b e c o n t i g uo us a nd c a n r e s i d e i n s ubd i r e c to r i e s . 11 . Th r e e mo r e sys t em p r o c e s s e s J o b C o n t r o l l e r ( J OB C ONTRO L ) Ope r a to r Commun i c a tTo n P r o c e s s ( O PC OM ) E r r o r Log B u f f e r Fo rma t P r o c e s s ( E RRFMT ) a r e c r e a t ed . 12. 22 . 2 . 2 F i n a l l y , a p r o c e s s c a l l ed STARTU P i s c r ea t ed . Th e i mpo r ta n t po i n t a b o u t th i s p r o c e s s is tha t it e x e c u t e s the i m a g e LOG INOUT , wh i c h m a ps a c omma nd l a ng uag e i nterpreter ( Ch a pt e r 2 0 ) . Th e S TARTUP P r o c e s s Th e S TARTU P process c rea ted by SYS I N I T c ompl e te s s ys t em i n i t i a l i za t i o n . Th i s p r o c e s s i s the f i r s t p ro c e s s i n t h e sys t em tha t i nc l ud e s a c omma nd l ang uag e i n t e r p r e te r . Th e i nc l us i o n o f DC L a l l ows the o pe r a t i o n o f th i s p r o c e s s to be d i r e c ted by s i mpl e c omma nd s . 2 2-17 OPERAT ING SYSTEM IN I T IAL I ZAT I ON 2 2 . 2 . 2 . 1 S TARTUP . COM - Th e m a j o r s t eps tha t a r e pe r f o rmed by c ommand s i n t h i s f i l e c an b e d i v i d ed i n to th r e e m a j o r s t eps . 1. S e v e r a l s ys t em l o g i c a l nam e s a r e c r e a t ed . • Th e s e i nc l ud e : VM S - s pe c i f i c n am e s S YS $ L I B RARY SYS $ M E S SAG E SYS $ H E L P • • • Log i c a l n am e s u s ed by t h e s ymbo l i c d e b ug g e r Name s r e qu i r ed b y l ang uag e r un- t i m e sys tems C O B O L- 7 4 a nd VAX- 1 1 PASCAL fo r VAX- 1 1 Lo g i c a l names r eq u i r ed by c ompa t i b i l i ty mod e u t i l i t i e s 2. Th e INSTALL u t i l i ty is i nv o k e d to s h a r e a b l e i m a g e s k n o wn to the s ys tem . make 3. Th e SYSGEN u t i l i t y i s i nv o k e d to a utoma t i c a l l y c on f i g u r e e x t e rna l I /O d ev i c e s . ( If a us e r -wr i t ten d r i v e r m us t be l o ad ed b e fo r e n o rm a l VM S d r i v e r s , S TARTU P . C OM s h o u l d be m od i f i ed to i n c l ud e LOAD a nd CONNEC T c omma nd s b e fo r e the AUTOC ONF IGURE ALL c omma nd to S YSGEN . ) 4. Th e RM S S HARE u t i l i ty e x e c u t e s a nd a l l o c a t e s a b l o c k o f pag ed po o l { d e fa u l t o f 2 0 pa g e s ) to c o n t a i n the d a ta s t r uc t u r e s f o r s h a r ed f i l e s . 5. F i n a l l y , a s i t e - s pe c i f i c c omma nd i s i n vo k e d . file p r i v i l eg ed [ S YSMGR ] S YSTARTUP . C OM 2 2 . 2 . 2 . 2 S i t e- S p e c i f i c S t a r t up Comma nd F i l e - Th e c ommand f i l e tha t i s d i s t r i b u t ed w i th VM S i s emp t y . used to : s i t e - spec i f i c Th i s f i l e c a n be • S t a r t ba t c h a n d p r i n t que u e s • Se t t e r m i n a l s p e ed s a nd o th e r d ev i c e c h a r a c t e r i s t i c s • C r e a t e s i t e - s p e c i f i c sys tem l og i c a l n am e s • I n s t a l l mo r e p r i v i l eg e d a nd s h a r e ab l e i m ag e s • Lo ad us e r -wr i t t e n d ev i c e d r i v e r s • Mo un t vo l um e s o th e r than t h e s ys t em d i s k • • • Lo ad the c o n so l e b l o c k s to r ag e d r i v e r C ONNECT C ONSOLE c omma nd to SYSGEN m ed i um a nd (if a nd d e s i r ed ) wi th a m o un t t h e c o n s o l e S t a r t D E Cn e t { i f p r e s e n t o n the s ys tem ) Run SDA t o p r e s e rv e the p r ev i o u s d um p f i l e i n c a s e the sys t em c r a shed 2 2-1 8 OPERAT ING SYSTEM I N I T IALI Z ATION • P r o d u c e a n e r r o r l og r e po r t • An n o un c e s y s t em av a i l ab i l i ty 22. 3 THE SYSGEN PROGRAM Th e SYSGEN p r og r am un r e l a te d wa ys . e • f i ts i n to the i n i t i a l i za t i o n I t i s i nv o k e d d i r e c t l y by S TARTUP . COM e x t e r n a l I / O d ev i c e s . to s e q u e nc e in two AUTOCON F IGURE the I t i n t e r a c t s i nd i r ec t l y by p r od uc i ng pa r am e te r f i l e s tha t m a y b e u s e d by SYS B OOT f o r f u t u r e boo t s t r a p o pe r a t i o n s . Th e r o l e o f SYSGEN i n a u t o c o n f i g u r i ng the I /O s ys tem i s d e s c r i b ed in the VAX/VM S Gu i d e to Wr j t i ng a Dev i c e D r i v e r . Th i s s e c t i o n b r i e f l y c ompa r e s a nd c on t r a s t s the o p e r a t i o n s tha t SYSBOOT a nd S YSGEN pe r f o rm o n pa r a m e t e r f i l e s . Ta b l e 2 2 - 3 s umma r i z e s th i s c om pa r i s o n . 22. 3. 1 C o n t e n t s o f Pa r am e t e r B l o c k A c ommo n mod ul e c a l l ed PARAMETER i s l i nk e d i n to bo th t h e SYS B OOT a nd S YSGEN i m ag e s . Th i s mod u l e c o n t a i n s i n fo rma t i o n abo ut e a c h a d j us ta b l e pa r am e t e r ( Ta b l e 2 2 - 4 ) . Th i s d a ta n ev e r c h a ng e s . I n ad d i t i o n , e ac h pa r am e t e r o c c up i e s a c e l l i n a tab l e o f wo r k i ng v a l u e s . I t is th i s t ab l e tha t i s • d i s pl ayed by S H OW pa r am e t e r - name c ommand s , • a l t e r e d by S E T pa r am e t e r - name va l u e c ommand s , a nd • o v e rwr i t t e n by a USE c ommand Th e r e i s a l so a c o py o f the wo r k i ng tab l e l i n k ed i n to the e x ec u t i ve ( Th i s ta b l e i s p r od uc ed f r om the same so u r c e m od u l e i ma g e , SYS . EXE . a s PARAMETER w i th a d i f f e r e n t s e t t i ng o f a c o nd i t i o n a l a s s em b l y pa r am e t e r . Th e r e s u l t a n t mod u l e i s c a l l ed SYSPARAM . ) 22. 3. 2 Us e o f Pa r ame t e r F i l e s by SYSBOOT F i g u r e 2 2 - 4 s hows the f l ow o f pa r a m e te r v a l ue d a t a d u r i ng a boo t s t r a p Th e n umbe r s i n the f i g u r e d e sc r i b e the s i g n i f i c a n t s t e ps o pe r a t i o n . i n s e t t i ng v a l ue s o r m ov i ng d a t a . (1) Th e f i r s t s t e p tha t SYSB OOT p e r fo rm s is to l o c a te the execut i v e i m ag e a nd r e ad the pa r amete r s e t t i ng s f r om the e x e c u t i v e i ma g e i n to i t s wo r k i ng t a b l e . In the l a ng uag e o f SYS BOOT a n d S YSGEN c omma nd s , t h i s s t ep i s a n i m p l i ed U S E C URRENT c o mmand . Th i s o pe r a t i o n c a u s e s the sys tem to be i n i t i a l i z ed wi th the pa r am e t e r s e t t i ng s used d u r i ng th e p r e v i o us c o n f i g u r a t i o n o f the sys t em ( d ue to step 5 ) . 2 2 -1 9 OPERAT ING SYSTEM I N I T IA L I ZAT I ON Table 2 2 - 3 Compar i so n o f SYS BOOT and SYSGEN SYSGEN SYSB OOT Pu r po s e SYSB OOT SYSGEN has us i ng t he s ys tem c o n f i g u r es t h e e x ec u t i v e i m ag e o r fi l e . pa r am e t e r s f r om f r om a pa r am e t e r • • It in • It Sy s t em p u r po s e s . c r e a t e s pa r am e t e r f i l e s fo r f u t u r e boo t s t r a p o pe r a t i o n s . l o ad s d ev i c e d r ivers a nd s t r uc t ur e s . It i n s ta l l s c r e a te s a nd a nd use pa rame t e r s in wi t h the WRITE a s s o c i a t ed d a ta page in un r e l a t ed d yn am i c I t mod i f i e s system r unn i ng the ACTIVE command . • Use fo u r the i r a d d i t i o nal s wa p f i l es . I n i t i a l i za t i o n o c c up i e s The o nl y pl ac e tha t SYSGEN in se quenc e is r e l a ted i n i t i a l i za t i o n the is It to i t s d r i v e r func t i o n . i nv o ked t o AUTOCONF IGURE a l l I /0 d ev i c e s . the SYSB OOT boo t s t r a p is s e c o nd a r y but VM B tha t executes a ft e r p r og r am to the is pa s s ed be fo r e control ex e c u t i v e . Env i ronmen t SYSGEN executes in the n o rmal a u t i l i ty prog r am . of e nv i r o nm ent Th e d r i v e r and swap/pag e f unc t i o n s r e qu i r e A ( CMKRN L ) . WRITE p r i v i l eg e ACTIVE c ommand a l so r e qu i r e s CMKRNL pr i v i l eg e . Th e pa r am e te r file o pe r a t i o n s are SYSB OOT r un s in a s t a nd a l o n e env i r o nment wi t h no f i l e system , m em o r y manag emen t , any o th e r or c o ntex t , proc e s s env i r o nm e n t prov i d ed by VM S . p r o t e c ted Va l i d t h r o ug h t h e f i l e s ys tem . Command s USE US E U S E f i l es pe c US E CURRENT US E DEFAULT U S E ACTIVE US E f i l e s pec U S E CURRENT USE DEFAULT no equ i v a l ent c ommand S ET S ET SHOW CONTINUE ( E X I T ) no equ i v a l en t c ommand S H OW E X I T ( C ONT INUE ) WR ITE no eq u i v a l en t c omma nd s Comma nd s As s o c i a ted wi th Dev i c e no equ i v a l en t comma nd s Command s As s o c i a ted a nd Swa p Fi l e s wi th Ad d i t i o n a l In i t i a l Cond i t i o n s Impl i e d Impl i ed U S E ACTIVE US E CURRENT c ommand command 2 2-2 0 Dr i v e r s Pag e OPERATING SYSTEM I N I T IAL I Z ATION Tab l e 2 2 - 4 I n formation S tored for E ach Ad j u stable P a r ameter by SYSBOOT and SYSGEN ( Th i s s t r uc t u r e i s d e f i n ed in b o th SYS B OOT SYSGEN by i nvo k i ng t h e $ PRMDEF m a c r o . ) I t em Ad d r e s s o f Pa r am e t e r a nd S i ze o f I t em ( i n SYS . EXE ) L o ng wo rd De f a ul t Va l ue o f Pa r am e te r Lo ngwo r d Mi n imum Va l ue Th a t Pa r am e t e r Ca n As s um e Lo ng wo r d Ma x imum Va l ue Th a t Pa r am e t e r C a n As s um e Lo ng wo r d Pa r am e t e r Fl ag s Wo rd DYNAM I C Pa r am e t e r S TA T I C Pa r am e t e r SYSGEN Pa r am e t e r AC P Pa r am e t e r JBC Pa r am e t e r RMS Pa r am e t e r S Y S Pa r am e t e r S PEC I A L Pa r am e t e r D I S PLAY Pa r am e t e r C ONTROL Pa r am e � e r MAJOR Pa r am e t e r PQL Pa r am e t e r N E G Pa r am e t e r S HOW /DYN S HOW S HOW S HOW S HOW S HOW S HOW /GEN /ACP /JO B /RM S / S YS / S PEC I A L S HOW /MAJOR S H OW /PQL S i ze o f Th i s Pa r am e t e r Byt e B i t Po s i t i o n i f Pa r am e t e r i s Fl ag Byte Nam e S t r i ng fo r Pa r am e t e r 1 6 Byt e s Nam e S t r i ng fo r Un i t s 1 2 By t e s Wo r k i ng Va l ue o f Pa r am e t e r Lo ngwo r d The wo r k i ng va l ue o f e ac h pa r a m e t e r i s fo und no t onl y i n i n te r n a l tab l es i n SYSB OOT a nd SYSGEN but a l so i n the e x ec u t i v e i t s e l f . I n f ac t , t h e pa r a m e t e r a d d r e s s ( f i r s t i tem ) s to r ed fo r each pa r am e t e r l oc a te s t h e wo r k i ng v a l ue o f e ac h pa r am e t e r in the m emo r y i mag e of the execut ive . (2) I f a c o nv e r s a t i o n a l boo t s t r a p wa s se l ec t ed ( R S < O > wa s s e t a s i n p u t t o VM B ) , t h e n SYSBOOT w i l l p r ompt f o r c ommand s t o a l t e r c u r r e n t pa r ame t e r se t t i ng s . A USE c o mmand to SYSB OOT 1 s p r ompt r e s u l t s i n the wo r k i ng t a b l e be i ng o v e rwr i t t e n wi th a n e n t i r e s e t o f pa r am e t e r v a l u e s . Th e r e a r e t h r e e po s s i b l e s o u r c e s o f t h e s e v a l ue s . • U S E f i l e spec d i r e c t s SYSB OOT to the f i l e f o r a n ew s e t o f v a l ue s . 2 2-21 i nd i c a t e d pa r am e t e r II USE CURRENT Default SYSBOOT Table Parameter Settings Internal to N N N N I SYSBOOT USE DEFAULT of Working I Values Parameter Settings SYSBOOT action I n Memory Image of SYSINIT action Executive USE filespec II F i gure 2 2 - 4 @ USE SET CONTI NUE (EXIT) Movement of P arameter Data by SYS BOOT and SYS I N I T OPERATING SYSTEM I N I T IAL I Z ATI ON • • Th e r e s e rved n am e DE FAU LT c a us e s the wo r k i ng table in S Y S B OOT t o b e f i l l ed wi th the d e f a u l t v a l ue s fo r e a c h p a r am e t e r . Th e r e s e r v ed n am e C URRENT c a u s e s the pa r am e t e r v a l ue s in the execut ive i m a g e t o b e l o ad ed i n to SYSB OOT ' s wo r k i ng tabl e . ( A U S E C URRENT c ommand i s r ed und a n t i f i t i s the f i r s t command pa s s e d to SYSBOOT . ) (3) Onc e the i n i t i a l c o nd i t i o n s h ave b e e n e s ta b l i shed , i nd i v i d ua l pa r ame t e r s can be a l t e r ed w i th S E T c ommand s . Th e c o nve r s a t i o n a l ph a s e o f SYSB O OT i s t e rm i n a t ed w i th a C ONT INUE ( o r EXI T ) c ommand . (4} Af t e r SYSB OOT h a s c a l c u l a t ed the s i z e s o f the v a r i o us p i e c e s of s y s tem spa c e , b u t b e f o r e i t t r an s f e r s c o n t r o l t o I N I T , i t c o p i e s t h e c o n t e n t s o f i t s wo r k i ng t a b l e to the c o r r e s po nd i ng t a b l e i n t h e m emo r y i m a g e o f the e x e c u t i v e . ( 5} One o f t h e f i r s t s t eps pe r f o rmed by the SYS I N I T p r o c e s s copi es the pa ramete r t ab l e f r om t h e m emo r y i m a g e o f t h e e x ec u t i v e to i t s d i s k i m ag e . B e c a u s e SYSB OOT a l wa ys d o e s an i mp l i e d US E C URRENT a s i t s f i r s t s t ep , t h i s g ua r a n t e e s t h a t a l l s ub s e qu e n t bo o t s t r a p s w i l l u s e the l a t e s t pa r am e t e r s e t t i ng s , e v e n i f no c o n v e r s a t i o n a l boo t s t r a p i s se l e c t ed . 22. 3. 3 U s e o f P a r ame t e r F i l e s by SYSGEN S YSGEN ' s i n t e r a c t i o n w i th p a r am e t e r f i l e s i s not a n i n t eg r a l pa r t the boo t s t r a p o pe r a t i o n . Ho we v e r , i ts action , p i c t u r ed F i g u r e 2 2 - 5 , c l o se l y p a r a l l e l s t h a t o f SYSBOOT . ( 1} Th e i n i t i a l c o n t e n t s o f S YSGEN ' s wo r k i ng t a b l e are the v a l ue s t a ken f r om t h e m emo r y image of the e x e c u t i v e . d a t a movemen t p i c t u r ed i n F i g u r e 2 2 - 5 i s a movem e n t f r om m emo r y a r e a to ano t h e r r a the r than t h e r e s u l t o f an o pe r a t i o n . of in the Th e one I /O I n a n y e v e n t , SYSGEN beg i n s i t s e x e c u t i o n wi th a n impl i ed US E AC T I VE c omma nd , a SYSB OOT ' s SYSGEN a nd i m ag e o f exec ut i ve ) ( 2} s e t o f i n i t i a l cond i t i o n s tha t wo u l d d i f f e r f r om initial s t a te o n l y i f som e o n e had a l r e a d y r un wr i t t e n pa r am e t e r s to e i the r C URRENT ( the d i s k t h e ex e c u t i v e ) o r AC TIVE { th e m emo r y i m ag e o f t h e • S YSGEN c a n c ho o s e i n i t i a l s e t t i ng s f o r i t s wo r k i ng e x a c t l y the s am e f a sh i o n a s SYSB OOT . ta b l e in Th e r e i s a n a d d i t i o n a l r e s e r v e d f i l e s pec a v a i l a b l e to SYSGEN . A US E AC T I VE c omma nd c a us e s t h e pa r am e t e r t a b l e f r om the m emo r y i m ag e o f the e x e c u t i v e to be c o p i ed i n to SYSGEN ' s wo r k i ng t a b l e . 2 2-2 3 § Parameter Settings I n Memory Image of Executive implied USE ACTIVE § ., 0 J:ll:l ::0 SYSGEN Table of Working Values N N I N � > t-3 1-1 0 z Cl til t< til t-3 tzl 3 1 WRITE filespec G) Default Parameter Settings Internal to SYSGEN v USE SET WRITE EXIT(continue) F igure 2 2 - 5 1-1 Movement of P arame ter Data by S YSGEN z 1-1 t-3 1-1 Parameter Settings In Memory Image of Executive t"" > 1-1 N > t-3 1-1 0 z O PERAT ING SYSTEM I N I T IA L I ZAT I ON (3) S E T c om ma nd s c a n b e used to a l ter i nd i v i d ua l pa r am e t e r v a l ue s . Typ i c a l l y , a n EXI T ( o r C ONTINUE ) c ommand wo u l d n o t be u s ed un t i l t h e f i na l s e t t i ng s we r e p r e s e rved wi t h a WR I T E c omma nd . (4) Th i s i s the s te p tha t wo r k i ng t a b l e . • • • prese rves the contents of S YSGEN ' s WR ITE f i l e spec c r e a t e s a new p a r ame t e r f i l e tha t c o n t a i n s t h e c o n t e n t s o f SYSGEN ' s wo r k i ng t a b l e . WR I TE C URRENT a l t e r s the c op y o f the pa r am e t e r tabl e in the d i sk i m ag e o f the execut i ve . Th e nex t boo t s t r a p o pe r a t i o n wi l l u s e the se v a l ue s a utoma t i c a l l y ( ev e n wi t h o u t a c o nv e r s a t i o n a l bo o t s t r a p o pt i o n ) . Se v e r a l pa r am e t e r s d e te rm i n e the s i ze o f po r t i o n s o f s y s tem add r e s s s pa c e . O th e r pa r ame t e r s d e t e rm i n e t h e s i z e o f b l oc k s o f p o o l s pac e a l l o c a t ed by !N I T . Th e s e pa r am e t e r s c a nno t b e c h a ng ed in a r unn i ng s y s tem . Ho we v e r , m a n y pa r am e t e r s a r e n o t used i n c o n f i g u r i ng the s y s t em . Th e s e p a r am e t e r s a r e d e s i g n a t ed a s DYNAM I C ( Ta b l e 2 2 - 4 ) • s e t t i ng s o f A WRITE ACTIVE c ommand to SYSGEN a l te r s the d yn am i c pa r am e t e r s o n l y in the m emo r y i m a g e o f t h e execut i ve . A wo rd o f c a u t i o n i s i n o rd e r h e r e . B e f o r e e x pe r i m e n t i ng wi th a new c o n f i g u r a t i o n , t h e pa r a me t e r s f r om a wo r k i ng sys tem sho u l d b e s a v ed i n a pa r am e t e r f i l e . I f the new c o n f i g u r a t i o n c r e a t e s a sys tem th a t is unusab l e , the s ys t em c a n b e r e s t o r e d to i ts p r e v i ous s t a t e by d i r ec t i ng SYSB OOT t o u s e the s aved pa r am e t e r s . 2 2 -2 5 C HAPTE R 2 3 POWERFAI L RECOVERY Powe r f a i l r e co v e r y s uppo r t a l l o ws s u i t a b l y e q u i pped VAX/VM S s ys tems to s u r v i v e po we r f l uc t ua t i o n s a nd powe r o u t ag e s o f sho r t d u r a t i o n w i th no l o s s of o p e r a t i o n . Th e s uppo r t i s p r o v i d ed by h a r d wa r e f e a t u r e s a nd VM S s o f t wa r e r o u t i n e s . VM S s o f t wa r e s uppo r t i n c l ud e s a po we r f a i l ur e serv i c e routine tha t s av e s t h e vo l a t i l e s t a t e o f the m a c h i n e b e f o r e the po we r f a i l s , a po we r r e c o v e r y r o u t i n e th a t r e s to r e s t h a t s t a te , a n d d ev i c e - spec i f i c c o d e wi th i n m a ny VAX/VM S d ev i c e d r i v e r s . Some d r i v e r s a r e a b l e to r e s ume I /0 o p e r a t i o n s tha t we r e in p r og r e s s wh e n the po we r f a i l ed . O th e r s s i mpl y a b o r t the r eque s t th a t wa s i n p r og r e s s . VM S a l so p r ov i d e s p r o c e s s no t i f i c a t i o n by m e a n s o f po we r r ec o v e r y ASTs . 23 . 1 POWERFA I L S EQUENCE Wh e n a f l uc t ua t i o n or d r o p i n o pe r a t i ng vo l t ag e o c c u r s , the CPU g e n e r a t e s a po we r f a i l i n t e r r u p t . Th i s i n t e r r up t c a u s e s c o n t r o l to b e p a s s e d to t h e r o u t i n e wh o s e ad d r e s s i s s to r ed in o f f s e t 12 in the Sys t em Co n t r o l Block , at t h e s am e t i m e r a i s i ng I P L to 3 0 . Th e fac t t h a t po we r f a i l i s a n i n t e r r up t w i th a f i n i t e I P L a s soc i a t ed w i th it a l l o ws po we r f a i l i n t e r r up t s to b e b l o c ked f o r a sho r t s e qu e n c e o f i n s t r uc t i o n s , a v o i d i ng m a n y po t e n t i a l s yn c h r o n i z a t i o n pr o b l em s . Th e VM S powe r f a i l i n t e r r up t s e r v i c e r o u t i n e s ave s t h e vo l a t i l e m a c h i n e s ta t e ( tho s e r eg i s te r s wh o s e c o n t e n t s a r e � o t p r e s e r v ed by s om e so r t o f b a t t e r y b a c k up ) i n m a i n m em o r y ( wh i c h 1 s p r e s e r v ed b y b a t t e r y b a c k up) , e i th e r o n the i n t e r r up t s t a c k o r i n the Re s t a r t P a r am e t e r Bloc k . A l i s t o f the r eg i s t e r s p r e s e r v e d by the po we r fa i l s e rv i c e rout i ne a nd r e s t o r ed b y t h e r e s t a r t r o u t i n e i s f o und i n T a b l e 2 3 - 1 . Th e s e r v i c e r o u t i n e then wa i t s i n a t i g h t l o o p 10$ : BRB 10$ u n t i l t h e h a r d wa r e g e n e r a t e s a HALT o pe r a t i o n . ( Th e BRB i n s t r uc t i o n wa s c h o s e n o v e r a n e x p l i c i t HALT i n th e so ftwa r e s e r v i c e r o u t i n e to avo i d c o n f u s i ng the r e s t a r t l og i c b y t r i g g e r i ng a r e s t a r t t o o s o o n . ) 23. 2 P OWER RECOVERY Th e powe r r e co v e r y s e q u e n c e pe r f o rm s v a r i o u s v a l i d i t y c h e c k s in a C PU - d e pe nd e n t f a sh i o n a nd t h e n pa s s e s c o n t r o l to th e VM S r e s t a r t rout i ne . Th i s r o u t i n e r e s to r e s the saved s t a t e of the mach i ne and then no t i f i e s each d ev i c e d r i v e r in the s ys tem th a t po we r has f a i l ed so t h a t the d r i v e r s c a n t a k e d ev i c e - spec i f i c a c t i on to r e s to r e i n te r r upted I /0 r e q ue s t s . 2 3 -1 POWERFAI L RECOVERY Ta b l e 2 3 - 1 D a t a Sa v ed b y Po we r fa i l Ro u t i n e a nd Re s t o r ed Du r i ng P o we r Re c ov e r y The fo l l owi ng e l em e n t s a r e l i sted i n the o rd e r r e sto r ed b y t h e powe r r ec ov e r y r o u t i n e . that they are Th e s e f i r s t e l em e n t s a r e r e s t o r ed b e fo r e memo r y m a n ag ement r e enab l ed . The Resta r t Pa r am e t e r B l o c k i s a c c e s sed t h r o ug h phys i c a l ad d r e s s . is i ts E l em e n t Wh e r e Sto r ed System Ba s e Reg i s t e r Sys tem Leng t h Reg i s t e r So ftwa r e I n t e r r upt Summa r y Reg i s t e r Sy s t em Co n t r o l B l o c k Ba se Reg i s t e r Pr o c e s s Co n t r o l B l o c k Ba s e Reg i s t e r In t e r r upt Sta c k Po i n t e r Re s t a r t Pa r am e te r Re s t a r t Pa r am e te r Re s t a r t Pa r am e t e r Re s t a r t Pa r am e te r Re s t a r t Pa r ame t e r Re s t a r t Pa r ame t e r The fo l l owi ng e l em e n t s a r e l i st e d i n t h e o rd e r that they are r e sto r ed by t h e powe r r ec ov e r y r o u t i n e . Th i s i s d o n e t o m a k e t h i s l i s t ag r e e w i t h t h e o rd e r o f e l em e n t s t h a t a r e s to r ed on t he s t a c k . Th e s e e l em e n t s a r e a l l r e sto r e d a fter m em o r y ma nag ement has b e e n r e enab l ed , wh i c h a l l o ws t h e i n t e r r upt s t a c k to b e a c c e s sed t h r o ug h i t s no rma l s y s t e m v i r t ua l add r e s s . E l emen t Wh e r e Sto r ed C PU -Spec i f i c P r o c e s so r ( S e e Be l ow ) Reg i s t e r s In t e r r upt St a c k P r o c e s s -Spe c i f i c P r o c e s so r Reg i s t e r s P l Leng t h Reg i s t e r P l B a s e Reg i s t e r P O L e ng t h Reg i s t e r P O B a s e Reg i s t e r Pe r fo rmanc e Mo n i to r Enab l e AST Level Reg i s te r In t e r r upt Stack Fo u r I n t e r r upt Stack Pe r - P r o c e s s Stack Po i n t e r s T h e fo l l owi ng e l ements a r e n o t r e cov e r y s t eps d e sc r i b ed in powe r fa i l i n te r r upt d i sm i s sed . The PC / PS L pa i r are r e s t o r ed d i sm i s s e s the i n t e r r upt . r e s t o r ed un t i l the o th e r powe r the tex t a r e pe r fo rmed and the by El em e n t Ge n e r a l the REI i n s t r uc t i o n that Wh e r e Sto r ed Reg i s t e r s I n t e r r upt P C a nd (RO t h r o ug h FP) PS L ( C PU-Spec i f i c Reg i s t e r s S a v ed The fo l l owi ng C PU -spec i f i c p r o c e sso r r e sto r ed f r om the i n te r r upt s t a c k . Stac k In t e r r upt Stack by Powe r fa i l Ro u t i n e ) r eg i s t e r s a r e saved C PU E l em e n t T r a n s l a t i o n Bu f f e r Memo r y Ca c h e I n t e r r upt Di s a b l e Reg i s t e r Di s a b l e Reg i s t e r VAX- 1 1 /7 5 0 VAX-1 1 /7 5 0 VAX-1 1 /7 8 0 S B I Ma i ntenanc e Reg i s t e r 2 3-2 on and Bloc k B l oc k B l oc k Block Block B l oc k POWERFA I L REC OVE RY 23 . 2 . 1 I n i t i a l S t e p i n Powe r Re c ov e r y Th e i n i t i a l s t e p i n r ec o v e r y f r om a powe r fai l ure i s pe r f o rmed by Th e g e n e r a l e i th e r h a r d wa r e o r m i c r o c o d e a nd is CPU-d e pe nd e n t . p u r po s e o f a n y o f t h e s e r o u t i n e s i s to • v e r i f y t h a t t h e c o n t e n t s o f m emo r y s u r v i v ed the po we r o u ta g e , • l o c a t e t h e powe r r e c o v e r y r o u t i n e , a nd • pa s s c o n t r o l to tha t r o u t i n e . 23. 2. 1 . 1 Powe r Re c o ve r y o n t h e VAX- 1 1 /7 5 0 - Th e conso l e p r og r am ( Ch a p t e r 2 1 ) i s the f i r s t p r og r am t h a t e x e c u t e s i n r e s po n s e to a po we r r e co v e r y o n the VAX- 1 1 /7 5 0 . Th i s p r og r am f i r s t c h e c k s the s e t t i ng of the Po we r - o n Ac t i o n s w i t c h . I f the s w i tch i s i n e i th e r the HALT o r If B OOT po s i t i o n , the c o n s o l e p r og r am pe r f o r m s the d e s i g n a t ed ac t i o n . the swi tch i s i n e i t he r the RESTART/ BOOT o r RESTART/ HA LT po s i t i o n , t h e c o n so l e p r og r am a t temp t s a r e s t a r t . On l y i f th e r e s t a r t f a i l s i s the s e cond o p t i o n ( B OOT o r HALT ) u s ed . Th e c o n s o l e p r og r am then a t temp t s to locate the Re s t a r t Pa r ame t e r Block . A t t h e s ame t i me , t h e c o n t e n t s o f m emo r y a r e t e s t ed to d e t e r m i n e wh e th e r m emo r y s uc c e s s f u l l y s u r v i v ed the po we r o u t ag e . Th i s t e s t c an i d e n t i f y two d i f f e r e n t c o nd i t i o n s , e i the r o f wh i c h p r e v e n t s s uc c e s s f u l r e cov e r y . Th e s e c o nd i t i o n s a r e • • a s y s t em t h a t d o e s n o t h a v e b a t t e r y bac k up , i n wh i c h c a se , t h e c o n t e n t s o f memo r y we r e l o s t wh e n the po we r fa i l ed , o r a s i t ua t i o n wh e r e the po we r wa s o f f fo r l o ng e r than ten m i n u t e s , t h e amo un t o f t i me tha t b a t t e r y b a c k u p i s c a pa b l e o f p r e s e r v i ng the c o n t e n t s o f memo r y . { Th i s t i m e d e pend s o n the amo un t of memo r y p r e s e n t b u t is not sho r ter than ten mi nutes . ) Th e o pe r a t i o n a l d e f i n i t i o n o f a r e s t a r t pa r ame t e r bloc k is a pag e a l i g ned b l o c k o f ph ys i c a l mem o r y wh o s e f i r s t fo u r l o ng wo r d s c o n t a i n 1. the phys i c a l a d d r e s s o f the RPB add ress o f l o c a t i o n ) , ( c o n te n t s o f l o c a t i o n 2. the ph ys i c a l ad d r e s s o f the r e s t a r t r o u t i n e , 3. a c h e c k s um o f t h e f i r s t 3 1 l o ngwo r d s i n the r e s t a r t a nd 4. a wa rm r e s t a r t f l ag . equa l s r o u t i ne , I f a va l i d RPB c a n n o t b e l o c a t ed , o r i f the r e s t a r t f l ag i s s e t , the r esta r t a t t empt h a s f a i l ed a nd t h e c o n so l e p r o g r am t a k e s i ts a l t e r na t i v e o p t i o n . I f a v a l i d RPB i s l o c a t e d , t h e c o n so l e prog r am t r an s fe r s c o n t r o l to the r e s t a r t r o u t i n e wh o s e a d d r e s s wa s s to r ed i n the Re s t a r t Pa r ame t e r B l o c k . 2 3-3 POWERFA I L R E C OVE RY 23 . 2. 1 . 2 Powe r Re c o v e r y on the VAX- 1 1 /7 8 0 - Wh e n po we r i s r e s to r ed on the VAX- 1 1 /7 8 0 , t h e c o n so l e s ub s ys t em ( L S I - 1 1 ) g o e s th r o ug h the same s e qu e nc e tha t it d o e s wh e n a s ys t em i s b e i ng i n i t i a l i z ed ( Ch a p t e r 2 1 ) . I f po we r i s a l s o b e i ng r e s to r e d o n the LS I - 1 1 , CONS O L . SYS i s l o aded f r om the c o n so l e f l o ppy . No s t a t e fo r the LS I - 1 1 i s p r e s e r v ed across a po we r fa i l u r e . The c o n s o l e p r og r am then p r o c eed s wi th i t s n o rm a l powe r o n a c t i o n s . I f t h e a u to r e s t a r t swi tch o n the f r o n t o f the p r o c e s s o r c a b i n e t i s i n the OFF po s i t i o n , o r i f t h e wa rm s t a r t i nh i b i t f l ag ma i n t a i n e d b y the c o n so l e p r og r am i s s e t , the c o n s o l e p r og r am s i mp l y p r i n t s i t s p r ompt on the c o n so l e t e rm i n a l a nd wa i t s fo r i nput . ( No te th a t the a uto r e s t a r t swi tch on the f r o n t p a n e l sho u l d be swi tched o f f wh en f i r s t t u r n i ng o n a VAX- 1 1 /7 8 0 s y s t em to a v o i d a n unnec e s s a r y r e s t a r t a t tempt . ) I f the a u to r e s ta r t s w i t c h i s i n the ON po s i t i o n a nd the wa rm start i nh i b i t f l ag is c l ea r , t h e c o n s o l e p r og r am u s e s t h e c o n t e n t s o f the Be fo r e RESTAR . CMD c ommand f i l e R E S TAR . CMD t o d i r e c t f u r th e r ac t i o n . execut e s , t h e d i ag no s t i c c o n t r o l s to r e c o n t e n t s a r e r e l o a d e d f r om the c o n s o l e f l o ppy ( f rom f i l e WC Sx x x . PAT ) . Th e c o n t e n t s o f WC S we r e no t p r e s e rved by t h e b a t t e r y b a c k up t h a t p r e s e rved the c o n te n t s o f ma i n memo r y . No t e tha t r e l o a d i ng WC S ma k e s po we r r e c ove r y o n the VAX- 1 1 / 7 8 0 somewha t s l o we r than in the VAX- 1 1 /7 5 0 , wh e r e I/O i s no t an i n teg r a l pa r t of po we r r e c o v e r y . Th e f i l e RESTAR . CMD c a n c o n t a i n a ny v a l i d c omma nd s . Th e RE S TAR . CMD tha t i s d i s t r i b u t e d wi th VMS c o n t a i n s c omma nd s d e s i g ned to r e s t a r t a r unn i ng VM S s ys tem . ( On s y s tems wi t h mo r e than t wo m emo r y control l e r s , t h e UN I B US a d a p t e r i s not l o c a t ed a t T R 3 . On s uc h s ys t e m s , RESTAR . CMD mus t be a l t e r ed s o tha t R l i s l o ad ed wi t h t h e TR n umbe r o f the UN I B US a d a p t e r . ) HALT INIT D E PO S I T/ I 1 1 2 0 0 0 3 8 0 0 DE PO S I T R O 0 DE PO S I T R l X X X D E PO S I T R2 0 DEPO S I T R3 0 D E PO S I T R4 0 DE PO S I T R S 0 DE PO S I T F P 0 S TART 2 0 0 0 3 0 0 4 Ha l t p r o c e s s o r I n i t i a l i ze proc e s so r Se t a d d r e s s o f S C B b a s e C l e a r un u s ed r eg i s t e r TR n umbe r fo r UN I B US a d apte r C l e a r un u s e d r eg i s t e r C l e a r un u s e d r eg i s t e r C l e a r u n u s ed r eg i s t e r C l e a r u n u s ed r eg i s t e r No m a c h i n e c h e c k e x pe c ted Sta r t res t a r t refe ree Th e START c omma n d p a s s e s c o n t r o l to t h e s am e p r o g r am tha t i s used d u r i ng s y s t em i n i t i a l i za t i o n , e x c e p t t h a t the p r og r am is e n t e r ed at i t s r e s ta r t e n t r y p o i n t . Th e m emo r y ROM p r og r am a t temp t s to l o c a t e the Re s t a r t Pa r am e t e r B l o c k , a pag e a l i g ned b l o c k o f phys i c a l m emo r y wh o s e f i r s t fo u r l o ngwo r d s conta i n 1. t h e ph y s i c a l a d d r e s s o f the RPB add ress o f loca tion) , 2. t h e ph y s i c a l add r e s s o f the r e s t a r t r o u t i n e , 3. a s i mp l e c h e c k s um o f the f i r s t 3 1 l o ng wo r d s r o u t i n e , a nd 4. a wa rm r e s t a r t f l ag . 2 3-4 ( contents o f loc at i o n in the e q ua l s r e sta r t POWERFAI L RECOVERY I f a v a l i d R PB c a nno t b e fo und , o r i f t h e wa rm r e s t a r t f l ag i n t h e RPB is c l ea r , the ROM p r og r am r e t u r n s c o n t r o l to th e c o n so l e pr og r am , wh i c h a t t e m p t s a c o l d s t a r t ( bo o t s t r a p ) . Th i s i nd i c a t i o n i s a c t ua l l y m a d e by t h e m emo r y ROM p r og r am wr i t i ng a " r e boo t " s i g n a l i n to o n e o f t h e c o n so l e r eg i s t e r s wi t h a MTPR i n s t r uc t i o n . O t h e r w i s e , t h e m em o r y ROM p r og r am pa s s e s c o n t r o l to the r esta rt routine ( wh o s e add r e s s i s s t o r ed i n t h e RPB ) . Th e s p e c i a l u s e s o f t h e PR $ TXDB r e g i s te r fo r commun i c a t i o n f r om t h e VAX C PU to t h e c o n s o l e p r og r am a r e d e sc r i b ed i n Ch a p t e r 1 5 . 23. 2. 2 Ope r a t i o n o f t h e Re s t a r t Ro u t i n e Th e VM S r e s ta r t r o u t i n e r e c e i v e s c o n t r o l • i n k e r n e l mo d e , • o n t h e i n t e r r up t s t ac k , • w i th m emo r y m a n ag em e n t d i s a b l e d , e at IPL 31 . Th e s e i n i t i a l c o nd i t i o n s a r e s i m i l a r to t h e e n t r y to VM B , e x c e p t th a t t h e RPB h a s a l r e a d y b e en l o ad ed . On e m o re s i m i l a r i t y b e t we e n t h e e n t r y to t h e r e s t a r t r o u t i n e a nd VM B i s t h a t S P po i n ts 2 0 0 ( h e x ) byt e s pa s t t h e RPB . Th i s s e r v e s two p u r po s e s . Th e c o n t e n t s o f S P a r e u s e d to l o c a t e t h e R PB . Th e last s ev e r a l l o ngwo r d s in the pa g e th a t conta i ns the RPB w i l l b e u s e d a s s t a c k s pa c e by t h e r e s t a r t r o u t i n e u n t i l t h e s av ed i n t e r r upt s t ac k po i n t e r i s r e s to r ed . Th e r e s t a r t r o u t i n e f i r s t c l e a r s two wa rm s t a r t i n h i b i t f l ag s . On e o f these f l ag s i s C PU-d e pe nd e n t and i s c l e a r ed b y wr i t i ng a s p e c i a l cod e i n to the c o nso l e t r a n sm i t d a t a b u f f e r r eg i s t e r . MT PR Th e o th e r f l ag i s l o c a ted in the Re s t a r t Pa r am e t e r B l o c k a nd is c l e a r ed wi th a BICL i n s t r uc t i o n . Th e use o f these s o - c a l l ed l o o pb r e a k e r f l a g s i s d i sc u s s e d f u r th e r a t t h e e nd o f t h i s c h a p t e r . Al l i n fo rm a t i o n s t o r e d i n the RPB by t h e po we r f a i l s e rv i c e r o u t i n e i s r e s t o r ed n ex t ( Ta b l e 2 3 - 1 ) . Mo s t o f th i s i n f o rma t i o n i s n e c e s s a r y to t u r n mem o r y m a n ag em e n t b a c k o n . A d ummy PO pag e ta b l e is s e t up ( j u s t l i ke the o n e s e t u p b y SYS BOOT ) s o th a t t h e pag e c o n t a i n i ng t h e r estart rout ine i s m a pped as a P O v i r t ua l add r e s s th a t , wh e n t r a n s l a t ed , yi elds t h e i d e n t i c a l phys i c a l add r e s s . Ch a p t e r 2 2 s h o ws h o w t h e c o n t e n t s o f P O B R a r e d e t e r m i n ed to prod uc e th i s i d en t i ty m a pp i ng . Af t e r the PO p a g e t a b l e i s s e t up , m emo ry m a n ag em e n t i s e n a b l e d t h e same two i n s t r uc t i o n s used by I N I T . 1 0$ : MTPR JM P ( De t a i l s o f Ch a p t e r 2 2 . ) u s i ng # l , # P R $ MAPEN @# 1 0 $ th i s t e c h n i que c an be 23-5 fo und in the b eg i nn i ng of POWERFAI L RECOVERY O n c e memo r y m a n ag em e n t h a s b e en e n a b l ed , the r e s t a r t r o u t i n e i s ab l e to r e s to r e the d a t a t h a t wa s s a v e d o n t h e i n t e r r upt s t a c k . Be fo r e t h i s h a ppe n s , a c h e c k i s m a d e to d e t e rm i n e wh e th e r the r e s t a r t wa s i n i t i a t ed a s a pa r t o f r e c o v e r y o r i n r e s po n s e to some o th e r r e s t a r t c o nd i t i o n d e tec t ed by t h e c o n so l e l og i c . Al l o th e r r e a so n s for r estart a re errors . Th e VM S r e s t a r t routine s i mpl y i ssues a r e a s o n - s pec i f i c b ug c h e c k ( wh i c h w i l l r es u l t in a cold star t , a boo tst r a p , i f the SYS B OOT f l ag BUGRE BOOT is set) . By c a us i ng a b ug c h e c k , VM S h o pe s to m a k e mo r e i n f o rm a t i o n a v a i l a b l e abo u t the e r r o r c o nd i t i o n th r o ug h a c r a s h d ump t h a n i s no rma l l y p r ov i d ed b y h a r d wa r e a l one . Tab l e 2 3 -1 i nd i c a t e s the i n fo rm a t i o n tha t is r e s to r ed f r om the i n t e r r up t s t a c k . Th e r e s t a r t r o u t i n e d o e s not u s e S P to r e s to r e th i s d a ta . Ra th e r , i t u s e s a sc r a tc h r eg i s t e r ( R 6 ) to t r a ve r s e the stack to prevent the d a t a o n t h e s tac k f r om b e i ng ove rwr i t t e n i n c a s e a no th e r powe r f a i l u r e o c c u r s wh i l e t h e d a ta i s b e i ng r e s to r ed . Th i s a l l o ws the r e s t a r t r o u t i n e to b e r e pe a t ed a s m a n y t i m e s a s n e c e s s a r y w i tho u t t a k i ng a n y s pec i a l a c t i o n . Af t e r e v e r yth i ng e x c e p t t h e g e n e r a l r eg i s t e r s h a s b e e n r e s t a r t r o u t i n e t a k e s t h e fo l l o w i ng s t eps . r e s t o r ed , the 1. A n e w s y s t em t i m e i s c a l c u l a t ed . ( Th e t i me -o f -y e a r clock k e p t r un n i ng wh i l e the po we r wa s o f f . Its contents a re used to r e c a l i b r a t e E XE $G Q_S YS T IME . ) 2. Th e t i m e r q u e u e i s s c a n n e d . Al l t i me r q u e u e e l em e n t s th a t h a v e e x p i r ed h a v e t h e r ec a l i b r a t e d t i m e s ub s t i t u t e d fo r the i r abso l ut e d ue t im e . Th i s i s d o ne to a l l o w pe r i o d i c t imer r e que s t s to r e e s t ab l i sh i n t e r n a l s yn c h r o n i z a t i o n . To i l l u s t r a t e the p u r po s e of th i s s tep , s uppo s e th a t a pe r i o d i c t i mer r e q u e s t wa s d e c l a r ed wi th a pe r i od o f o n e m i n u te a n d t h e po we r wa s o f f for th r e e m i n u t e s . W i th n o a d j u s tm e n t of the a b s o l u t e d ue t i me , t h r e e r e q u e s t s wo u l d ex p 1 r e i mmed i a t e l y f o l l o wi ng po we r r ecove r y . Th e r e ad j us tm e n t c a u s e s o n e r e que s t to come d u e i mmed i a t e l y , wi th the n e x t r e que s t no t o c c u r r i ng un t i l one m i n u t e l a t e r . No t e th a t r e l a t i v e s yn c h r o n i z a t i o n b e twe e n s e v e r a l r eque s t s m a y b e l o s t a s a r e s u l t o f a po we r f a i l u r e . Fo r e x ampl e , i f o n e r e que s t i s d ue to ex p i r e i n two m i n u t e s , a s e c o nd i s d ue to e x p i r e i n f i v e m i n u t e s ( o r th r e e m i n u t e s a f te r the f i r s t ) , a nd the powe r i s o f f f o r m o r e t h a n f i v e m i n u t e s , then bo th r eque s t s w i l l be d e l i v e r ed at the s ame t ime . A powe r r e c o v e r y AST m i g h t be u s ed to a l l o w m u l t i pl e r e que s t s to r e e s t a b l i sh t h e i r r e l a t i ve s yn c h r o n i z a t i o n . 3. A powe r r e c o v e r y e n t r y i s m a d e i n the e r r o r l og . 4. Ex t e r n a l a d a pt e r s a r e i n i t i a l i z e d . 5. Al l e x t e r n a l d ev i c e s a r e n o t i f i ed th a t a po we r f a i l u r e a nd r e c o v e r y s e q ue n c e h a s o c c u r r e d . Th i s s t e p i s d e t a i l ed i n the next s e c t i o n . 23 6 - POWE RFA I L RECOVERY 6. Fi nal l y , • • • • 23. 2. 3 S P i s s e t up to po i n t t o t h e s a v ed g e n e r a l t h e i n t e r r up t s t a c k , r eg i s t e r s on t h e l a s t s a n i t y c h e c k f l ag , EXE $G L PFA I LT I M , _ i s c l ea r ed , t h e g e n e r a l r eg i s t e r s a r e r e s t o r e d , a n d the po we r fa i l i n s t r uc t i o n . i n te r r u pt is d i sm i s s ed w i th an RE I Dev i c e No t i f i c a t i o n Ex t e r n a l d e v i c e s a r e no t i f i e d t h a t a po we r f a i l u r e h a s o c c u r r e d i n two s t ag e s . Wh i l e t h e powe r r e c o v e r y r o u t i n e i s e x e c u t i ng ( at I PL 31 so tha t a no t h e r po we r f a i l i n t e r r upt c a nno t o c c u r ) , e a c h d r i v e r i s c a l l ed a t i t s c o n t r o l l e r i n i t i a l i z a t i o n r o u t i n e f o r e a c h c o n t r o l l e r an d at i ts un i t i n i t i a l i za t ion rout ine fo r each un i t . Th e powe r fa i l b i t UC B $ V POW E R i n t h e UC B s t a t u s wo r d UC B $W S T S i s set to al low each d r i v er r o u t i n e to d i f f e r e n t i a t e b e t ween po we r r e c o v e r y a n d o r d i n a r y i n i t i al i za t ion . I n ad d i t i o n , t h e e n t i r e I /0 d a t a b a s e i s s c a n n e d , l o o k i ng fo r un i t s tha t a r e e x p e c t i ng i n t e r r up t s . Th e po we r r e c o v e r y r o u t i n e c l e a r s t h e i r i n t e r r u pt- e x pe c ted b i t s , s e t s t h e i r t i m e o u t - e x pe c t ed b i ts , a nd sets the i r d ue t i m e s to z e r o . Th i s c a u s e s e a c h d e v i c e to a ppe a r t o h a v e t i med o u t . Th e c h e c k f o r d ev i c e t i m e o u t o c c u r s a s a r e sul t o f the s ys t em s ub r o u t i n e th a t e x e c u t e s o n c e a s e c ond . Th a t r o u t i n e w i l l not execute unt i l 1. t h e h a r d wa r e c l o c k d r o pped b e l o w 2 4 ) 2. a nd t h e so f twa r e t imer executes a s pa r t o f t h e s ys t em s ub r o ut i ne th a t h a s p r o b a b l y e x p i r ed wh i l e t h e po we r wa s d o wn . ( Th i s w i l l n o t h a ppe n u n t i l t h e I P L i s l o we r ed below 7. ) i n te r r u p t s ( wh i c h means that I PL has Th u s , e a c h d ev i c e t h a t wa s e x pe c t i ng an i n t e r r upt w i l l a ppe a r to have t i med out . A d r iver ' s t ime o u t r o u t i n e c a n d i f f e r e n t i a t e b e twe e n g e n u i ne t i m e o u t a nd po we r f a i l u r e b y c h e c k i ng the UCB $V_POWER b i t . I n a VM S s ys t em , t h e m a j o r i t y o f t h e wo r k d o n e to r e c o v e r f r om a po we r fa i l u r e o c c u r s i n d r i ve r s . VM S d i s k d r i v e r s a nd mag ne t i c t a p e d r i v e r s a r e c a pa b l e o f r e s t a r t i ng wh a t ev e r r e que s t t h e y we r e p r o c e s s i ng wh e n t h e powe r f a i l ed in s uc h a wa y t h a t t h e po we r f a i l u r e i s to t a l l y t r a n spa r e n t t o t h em . ( I f a m a g n e t i c t a pe un i t l o s t v a c u um , o pe r a t o r i ntervent ion is r eq u i r ed to r e e s tab l i sh t h e v a c uum and r e w i nd t h e t a pe . Onc e t h a t i s d o n e , t h e d r i v e r a u tom a t i c a l l y r e s t a r t s the I /0 r e q u e s t t h a t wa s i n p r og r e s s wh e n t h e powe r f a i l e d . ) 2 3 -7 POWE RFA I L R E C OVERY 23. 2. 4 P r o c e s s No t i f i c a t i o n VMS a l so a l l o ws p r o c e s s e s to b e no t i f i ed , by r e c e 1 v 1 ng a n AST , th a t a powe r fa i l ure a nd s ub s eque n t r e c o v e r y h a pp e n e d . A p r o c e s s r e que s t s th i s no t i f i c a t i o n b y us i ng t h e S e t Powe r Re c o v e r y A S T s ys t em s e r v i c e . 23 . 2 . 4 . 1 $ S ETPRA S y s tem S e r v i c e - Th e S e t Po we r Re c o ve r y AST s ys t em s e r v i c e i s an e x t r eme l y s i m p l e s e r v i c e t h a t pe r fo rm s two s t e p s . • • t h e AST is s to r ed i n g l oba l location Th e a d d r e s s o f in t h e P l po i n t e r pag e . Th e a c c e s s mod e i n C T L $G L POWERAST b e d e l i v e r ed is s to r ed i n l oc a t i on wh i c h th e AST w i l l C T L $G B PWRMODE . Th e powe r AST f l ag { PC B $V PWRAS T ) i n the s t a tus l o ng wo r d in the PC B is set . Th i s-f l ag w i l l b e u s e d by t h e swa ppe r i n s c ann i ng t h e PC B v e c to r f o l l o wi ng powe r r e c o v e r y . Th e e f f e c t o f th i s s y s t e m s e rv i c e i s e l i m i n a t ed a s a r e s u l t r und own { Ch a pt e r 1 8 ) . of i m ag e 2 3 . 2 . 4 . 2 De l i v e r y o f Powe r Re c ove r y ASTs - Th e d e l i v e r y o f t h e s e ASTs o c c u r s i n s eve r a l d i s t i nc t s t e p s . l. Th e po we r r ec o v e r y r o u t i n e s to r e s the d u r a t i o n o f t h e powe r fa i lure in loc a t i on EXE $G L PFAT I M . { Th i s is s i m p l y the c u r r e n t c o n t e n t s of PR $ TODR mi n u s EXE $G L P FA I LT I M , t h e t i me at wh i c h the po we r f a i l ed . ) N o n z e r o c o n tent s in t h i s l o c a t i o n a c t a s a t r i g g e r t o the swa ppe r the nex t t i me th a t i t r un s . No t e th a t no s p e c i a l a c t i o n i s t a k e n a t th i s po i n t to wa ke up the swa ppe r . In f a c t , b e c a u s e th i s r o u t i n e is r un n i ng at I P L 3 1 , t h e s wa ppe r c o u l d no t h a v e i t s sc h e d u l i ng s t a te c h a ng ed wi tho ut po t e n t i a l s ynch r o n i z a t i o n p r o b l em s . 2. A pa r t o f t h e swa ppe r ' s m a i n l o o p o f e x e c u t i o n { Ch a pte r 1 4 ) c a l l s r o u t i n e E XE $ POWE RAST i f l o c a t i o n EXE $G L PFAT I M c o n t a i n s no n ze r o . Th i s s ub r o u t i n e s c a n s the PC B v e c tor and d e l i v e r s a s pe c i a l k e r n e l AST to e a c h p r o c e s s th a t h a s the PC B $V PWRAST f l ag se t . Th a t f l ag i s c l e a r e d to p r ev e n t m u l t i p l e ASTs if m u l t i pl e powe r f a i l u r e s o c c ur b e f o r e t h e p r o c e s s ex e c u t e s . 3. Th e spec i a l ke r ne l AST i s r e q u i r e d b e c a u s e the a d d r e s s { a nd a c c e s s mo d e ) of the r ec o v e r y AST a r e s to r ed in the Pl s pa c e o f th e r e que s t i ng p r o c e s s . Th e spec i a l k e r nel A S T s i mpl y loads th e ad d r e s s a nd access mode f r om the i r P l s pa c e l o c a t i o n s i n to t h e A S T Co n t r o l B l o c k a nd que ue s t h e r e cove r y A S T to t h e r e qu e s t i ng p r o c e s s . 4. Fi nal l y , the r e c o ve r y AST i tsel f i s d e l i v e r ed to the r e que s t i ng p r o c e s s . Th e AST p a r am e t e r i s the d u r a t i o n of the powe r f a i l u r e , in 10 msec un i t s . 2 3 -8 POWERFA I L R E C OVE RY 23 . 3 M U LT I PLE POWER FA I LURES A c omb i n a t i o n o f h a r d wa r e a nd s o f twa r e f l ag s ex i sts to prevent i n f i n i te l o o p i ng or r e l a t ed p r o b l em s i n r e s po n s e to a po we r fa i l u r e t h a t o c c u r s wh i l e e i th e r the powe r f a i l se r v i c e r o u t i n e i s e x e c u t i ng o r wh i l e t h e r e s t a r t r o u t i n e i s e x e c u t i ng . 23 . 3 . 1 Ne s ted Powe r Fa i l I n t e r r up t s O n e o f t h e f i r s t s t eps t a k e n by t h e powe r f a i l se r v i c e routine saves the c ontents of the PR $ TODR r eg i s te r i n l o c a t i o n EXE $G L PFAI L T I M . Th i s l o c a t i o n r e t a i n s n o n z e ro c o n t e n t s un t i l j u s t b e f o r e th e r e s t a r t r o ut i ne i s s ue s i ts RE I i n s t r uc t i o n , d i sm i s s i ng the po we r fa i l i n t e r r up t . I f a po we r f a i l i n t e r r upt o c c u r s wh i l e t h i s l o c a t i o n c o n t a i n s n o n z e r o ( i nd i c a t i ng that a no th e r f a i l u r e / r e co v e r y i s a l r e a d y i n p r og r e s s ) , t h i s l a te r i n t e r r u pt i s i g no r ed . Some m a c h i n e s t a t e wa s saved as a r e s u l t o f the f i r s t po we r f a i l i n t e r r u pt . Th a t s t a t e wi l l be r e s t o r ed e v e n t u a l l y by the r e s t a r t r o u t i n e . Th e p r e v i o u s s t e p i s a n e x ampl e o f e x t r eme c a u t i o n tha t i s n ec e s s a r y wh e r e powe r fa i l u r e i s c o nc e r n e d . A n a i v e und e r s t a nd i ng o f the wa y i n te r r up t s a r e d e f i n ed i n the VAX a r c h i t e c t u r e i nd i c a t e s t h a t a s e c o nd powe r fa i l i n te r r u pt c a nno t o c c u r wh i l e I PL i s a t o r a bo v e 3 0 . Bec ause I PL is not l o we r ed un t i l the po we r fa i l i n t e r r upt is d i sm i s s ed , I PL s e em s to c o v e r th i s s i t ua t i o n . Th e EXE $G L PFA I L T I M c h e c k , a n e x t r a s a n i ty c h e c k t h a t i s to t a l l y und e r t h e c o n t r o l o f the s o f t wa r e , p r ev e n t s n e s ted powe r f a i l i n t e r r upts o n a s ys t em th a t i s e x pe r i enc i ng some o b sc u r e beh a v i o r th a t wo u l d o th e r w i s e b e e x t r em e l y d i f f i c u l t t o d i a g no s e . 23 . 3 . 2 P r eve n t i o n o f N e s ted Re s t a r t s Th e p r e v i o u s two c h e c k s c o v e r a l ong t i m e a nd a r e d e s i g n ed to prevent a s e c o nd powe r f a i l i n t e r r upt wh i l e a f i r s t i s b e i ng s e r v i c ed . Th e r e i s a l s o a f l ag d e s i g n ed t o p r e v e n t n e s t e d r e s t a r t a t t empts . Th i s f l ag i s l o c a ted i n the Re s t a r t Pa r am e t e r Block , i s c l ea red by INIT a nd by t h e r es ta r t r o ut i ne , a nd s e t by the C PU - s p e c i f i c ROM r o u t i n e th a t l o o k s fo r a v a l i d RPB . I f the R PB s e a r c h r o u t i n e l o c a t e s a n o the r w i se v a l i d RPB wi th t h e RPB $ L RS TRTF LG s e t , i t a s s um e s th a t t h e Re s t a r t Pa r am e t e r Block is in e r ro r a nd abo r ts the r e s ta r t a t tempt . On t h e VAX- 1 1 / 7 5 0 , f u r th e r a c t i on i s c o n t r o l l ed by t h e s e t t i ng o f t h e po we r o n a c t i o n s w i tch o n the front pa ne l . On the VAX- 1 1 /7 8 0 , the c o nso l e p r og r am a bo r t s t h e r e s t a r t a t t empt a nd p r i n t s i t s p r ompt o n t h e c o n s o l e t e rm i n a l . A s e c o nd f l ag , l o c a t ed wi th i n the c o nso l e l og i c o n the VAX - 1 1 / 7 8 0 , I t i s s e t by h a r d wa r e a t t h e b eg i n n i ng f unc t i o n s i n a s i m i l a r mann e r . o f t h e r e s t a r t a nd c l e a r ed by t h e r e s t a r t r o u t i n e by e x ec ut i ng a MTPR i n s t r uc t i o n . I f the r es ta r t r o ut ine d e tects that th i s f l ag is set wh i l e a t tempt i ng a r e s t a r t , i t a bo r t s the r e s t a r t a nd t a k e s the s a m e p r o c e s s o r - s pec i f i c a c t i o n a s i t wo u l d i f the r e s t a r t pa r am e t e r block f l ag we r e s e t . ( Th e r e i s no a n a l og ue t o th i s f l ag on the VAX - 1 1 / 7 5 0 . Th e C PU m i c r o c od e t u r n s th i s pa r t i c u l a r MTPR i n s t r uc t i o n i n to a nul l ope r a t i o n . ) 2 3 -9 POWERFA I L RECOVERY One m o r e b i t of c a u t i o n i s e v i d e n t i n the m a nne r in wh i c h t h e r e c o v e r y r o ut i n e r e s to r e s d a t a f r om t h e i n t e r r up t s t a c k . A s c r a tc h r eg i s t e r ( R 6 ) i s u s e d to t r a v e r s e t h e s t a c k . I f a n o the r po we r fa i l i n t e r r up t we r e t o o c c u r wh i l e d a t a wa s b e i ng r e s to r ed , no d a t a w i l l b e l o s t d ue to t h e p u s h o f t h e PC a n d PS L o n to the i n t e r r upt s tack because SP po i n t s to the e nd of t h e pag e c o n t a i n i ng the R PB a n d no t i n to t h e m i d d l e o f t h e d a t a b e i ng r e s to r ed . Dev i c e D r i v e r Ac t i o n 23. 3. 3 Dr i v e r s d o not h a v e t o c o nc e r n t h em s e l v e s d i r ec t l y w i th t h e m u l t i pl e E v e n th o ug h t h e b u l k o f d r i v e r r e c o v e r y i s d o ne i n r es ta r t p r ob l em . r e s po n s e t o a n I P L 7 so f twa r e i n t e r r up t wh e n a s e c o nd powe r f a i l u r e i s po s s i b l e , d r i v e r s a r e p r o t e c t e d b y o n e o f t h e fo l l o w i ng s i t ua t i o n s . • • • • Th e d r i v e r c o n t r o l l e r a nd un i t i n i t i a l i za t i o n rout i ne s a r e c a l led a t I P L 3 1 b e f o r e EXE $ G L PFAI LT IM i s c l e a r ed . D r i ve r s a r e p r o t e c t e d h e r e b y t h e s am e sa n i t y c h e c k s t h a t VM S uses fo r i ts el f . I f t h e d r i v e r d o e s n o t g e t c a l l ed a t i t s t i m e o u t e n t r y po i n t b e fo r e t h e powe r fa i l s ag a i n , t h e p r e s e r v ed d r i v e r s t a t e i nd i c a t e s a un i t t h a t h a s a l r e a d y t i med o u t . Wh e n po we r is f i na l l y r e s to r ed pe rm a n en t l y , t h e d r i v e r w i l l b e c a l l ed a t i t s t i m e o u t e n t r y po i n t . it I f t h e d r i v e r i s i n the m i d d l e o f i t s t i me o u t r o ut i ne , s t i l l a ppea r s to t h e s ys tem a s a un i t th a t h a s t i m e d o u t . It w i l l be c a l l e d a t i t s t i m e o u t e n t r y po i n t ag a i n wh e n t h e mach i ne f i na l ly stabi l i zes . I f t h e d r i v e r s uc c e ed s i n r e t u r n i ng con t r o l to the o pe r a t i ng s y s tem w i th , f o r ex ampl e , o n e o f t h e fo l l o w i ng c a l l s , WF i x x C H I O FORK RE QC OM t h e r e q u e s t h a s e i th e r b e e n c ompl e t ed o r th e d r i v e r i s back i n t o a s t a t e ( s uch a s e x p e c t i ng a n i n t e r r upt ) wh e r e t h e po we r r e co v e r y l o g i c wi l l c a u s e t h e d r i v e r to be c a l l ed a t i t s t i me o u t e n t r y p o i n t wh e n the powe r i s f i na l l y r e s t o r e d . 23 . 4 POWER FA I L URE ON THE UN I B US UN I B U S powe r f a i l u r e is h a nd l e d d i f f e r e n t l y o n the VAX- 1 1 / 7 5 0 a n d the VAX- 1 1 / 7 8 0 . Th e UN I B US is an i n t eg r a l pa r t of the VAX- 1 1 / 7 5 0 processo r . Th e UN I B U S o n a VAX- 1 1 /7 8 0 i s c o nnec ted to the S B I t h r o ug h a UN I B U S a d apte r ( DW 7 8 0 ) • 2 3 -1 0 P OWERFA I L RECOVERY 23. 4. 1 UN I B US Po we r F a i l u r e o n t h e VAX- 1 1/ 7 5 0 Th e UN IBUS o n the VAX- 1 1/7 5 0 c a n n o t e x pe r i e n c e i nd e pend e n t po we r fa i l ur e . I f po we r f a i l s o n the VAX- 1 1/7 5 0 U N I B U S , i t h a s a l s o fa i l ed on the p r o c e s so r . As a r e s u l t , a po we r f a i l i n te r r up t i s g e ne r a ted . 23. 4. 2 UN I B US Powe r F a i l u r e o n t h e VAX- 1 1 / 7 8 0 Bec a us e a UN IBUS f a i l u r e d o e s n o t n e c e s s a r l i y i nd i c a t e th a t the en t i r e s ys tem is i n e r r o r , VM S a l l ows UNIBUS e r r o r s , i n c l ud i ng UN I B US p o we r f a i l u r e c a u s e d by t u r n i ng o f f t h e powe r to th e UBA o r t h e BA- l l K , to o c c u r wi tho u t c r a sh i ng the e n t i r e s ys tem . Wh e n s uc h a n e r r o r o c c u r s , t h e UBA i n te r r up t s o n beha l f o f i tsel f ( bi t < 3 1 > of the a pp r o p r i a te BRRVR i s s e t ) . Th e i n t e r r upt s e r v i c e r o u t i n e fo r the a f f ec t e d UBA d e t e c t s tha t a UBA i n t e r r up t ( a s o ppo s e d t o a UN IBUS d ev i c e i n t e r r up t ) h a s o c c u r r ed a n d t r a n s fe r s c o n t r o l to a n e r ro r rout i n e that • • • c h e c k s t h a t t h e i n t e r r upt i s d u e to the po we r f a i l u r e o f U B A o r UN I B US , the wr i t e s an e r r o r l og e n t r y , r em a p s t h e s ys t em v i r t ua l add r e s s e s tha t p r ev i ous l y ma pped t h e UBA i t s e l f a nd the UN IBUS I /O page ( 2 4 p a g e s in a l l ) s o t h a t t h e s e pag e s n o w po i n t to t h e s o - c a l l ed b l a c k ho l e pag e r e s e r v ed a t i n i t i a l i z a t i o n t i me . Th i s m a pp i ng t e ch n i que p r ev e n t s s ub s eque n t m a c h i n e c h e c k s or r e l a t ed e r r o r s f r om d ev i c e d r i v e r s tha t r e f e r e n c e the UBA o r d ev i c e r eg i s t e r s wh i l e the UBA o r UN I B US powe r i s o f f . I f the UN I B US ha s g o n e a wa y e i th e r bec a u s e t h e powe r wa s t u r ned o f f o r fo r s om e o th e r r e a so n , d e v i c e s tha t we r e wa i t i ng f o r I /0 compl e t i o n wi l l t ime o ut . Th e p r og r am t h a t i s s ued the i n i t i a l I /0 r e que s t w i l l ( Th i s a s s um e s p r e s um a b l y r e c e i v e a n a ppr o p r i a t e e r r o r no t i f i c a t i o n . tha t no d r i v e r i s s i t t i ng i n a t i g h t l o o p a t d ev i c e I PL wa i t i ng fo r a s ta t us b i t to c h a ng e s t a t e . ) Wh e n the po we r i s r e s to r ed , t h e s ys tem v i r t ua l pag e s a r e r em a pped to po i n t to the UBA r eg i s te r s a nd the UN I B U S I/O pag e . If any d ev i c e s we r e r emoved wh i l e t h e powe r wa s t u r ned o f f , t h e y wi l l be m a r k e d off l i n e a s pa r t o f t h e po we r r e c o v e r y o pe r a t i o n . Th i s f e a t u r e , new w i th Ve r s i o n 2 o f VM S , h a s i m pl i c a t i o n s fo r peo p l e a t t em p t i ng to d e b ug d e v i c e d r i v e r s . I n v e r s i o n 1 o f VM S , a r e f e r en c e to a non e x i s t e n t C S R o r o th e r s uc h e r r o r c a us e d t h e s y s t em to bug c h e c k , a d rastic but i mmed i a te n o t i f i c a t i o n tha t a n e r r o r h a d occur red . Th e r e commend ed m e t ho d fo r d eb ug g i ng UN I B U S d ev i c e d r i v e r s o n a Ve r s i o n 2 VMS s ys tem is to p l a c e a n XDE LTA b r e a kpo i n t a t g l o b a l l o c a t i o n EXE $DW7 8 0 INT ( a t locat ion 8 0 0 0 2B C 6 i n Ve r s i o n 2 ) . Th i s t e c h n i que a l so a l lo ws i mmed i a t e e r r o r n o t i f i c a t i o n wi tho u t ta k i ng t h e s ys tem d o wn and wi t ho u t t h e wa i t f o r the s ys t em to r e boo t i t s e l f . Of c o u r se , the e r r o r l og c a n a l s o b e l o o k e d a t t o o b t a i n i n f o rm a t i o n a bo u t the e r r o r . 2 3 -1 1 PART VI I I M I S C E L LANEOUS TOP I C S Of s h o e s - a n d s h i ps - a n d s e a l i ng wa x Of c a bbag e s - and k i ng s And wh y t h e s e a i s b o i l i ng h o t And wh e th e r p i g s h a v e w i ng s . Th r o ug h t h e Lo o k i ng G l a s s Lewi s Ca r r o l l C HAPTER 2 4 SYNCHRON I ZATION TECHN I QUES One o f the mo s t i mpo r t a n t i s s u e s i n the d e s i g n o f an o pe r a t i ng sys tem is s ynch r o n i za t i o n . Espec i a l l y i n a s ys t em tha t i s i n t e r r up t d r i v e n , c e r ta i n s eque n c e s o f i n s t r uc t i o n s m u s t b e a l l owed to e x e c u t e w i tho ut i n t e r r up t i o n . VM S u s e s spec i a l I PL v a l ue s to b l o c k c e r ta i n i n t e r r up t s d u r i ng t h e e x e c u t i o n o f c r i t i c a l cod e pa t h s . An y o pe r a t i ng s y s t e m m u s t a l so t a k e p r ec a u t i o n s to i n s u r e tha t sh a r ed d a ta s t r uc tu r e s are not b e i ng s i m u l t a ne o u s l y mod i f i ed by s ev e r a l r o u t i n e s o r b e i ng r ead by one r o u t i ne wh i l e a n o the r r o ut i ne is mod i fy i ng the s t r uc t u r e . VM S u s e s a c om b i n a t i o n o f s o f t wa r e t e c h n i que s a nd f e a t u r e s o f t h e VAX h a r dwa r e t o s yn c h r o n i z e access to s h a r e d d a ta s t r uc t u r e s . Th e t e c hn i q u e s d e sc r i b ed i n th i s c h a pt e r a r e 24 . 1 • t h e u s e o f I P L a s a s ynch r o n i z a t i o n to o l , • se r i a l i za t i o n o f a c c e s s , a nd • mu t ua l ex c l us i o n sema pho r e s , c a l l ed m u t e x e s . E LEVATED I PL Th e p r i m a r y p u r po s e fo r r a i s i ng I PL i s to block i n t e r r up t s at the s e l e c t ed I PL v a l ue a nd all l o we r v a l u e s of I PL . Fo r e x ampl e , by r a i s i ng I PL t o 2 3 , a l l d ev i c e i n t e r r u p t s a r e b l o c ked ; but the cloc k , wh i c h i n t e r r upts a t I P L 2 4 , c a n s t i l l c a us e i n te r r upt s . VM S a l s o u s e s s e l e c t ed I P L v a l u e s fo r pe r fo rm i ng c e r t a i n a c t i o n s o r fo r a c c e s s i ng c e r t a i n s t r uc t u r e s . I PL Th e I PL , s to r e d i n P S L < 2 0 : 1 6 > , i s a l t e r ed by wr i t i ng the d e s i r ed v a l ue to the p r i v i l eg ed r eg i s t e r PR $ I P L w i th the MTPR i n s t r uc t i o n . Th i s i s u s ua l l y a c c ompl i shed i n VM S w i th o n e o f t wo m a c r o s , SET I PL o r DS B IN T , who s e m a c ro d e f i n i t i o n s a r e l i s t ed i n Fi g u r e 2 4 - 1 . Th e DSB I NT m a c r o i s u s ua l l y used wh en a l a te r s e qu e n c e o f c o d e w i s h e s to r e s to r e the I PL t o t h e s a v e d va l ue ( wi t h t h e ENB I NT mac r o ) . Th e S E T I P L m a c r o i s u s ed wh en the I P L wi l l l a t e r be e x pl i c i t l y l owe r ed w i th a n o the r S E T I P L o r s i mpl y a s a r e s u l t o f e x ec u t i ng a n RE I i n s t r uc t i o n . Th a t i s , t h e v a l ue o f the s aved I PL i s n o t i mpo r ta n t t o the r o u t i n e th a t i s us i ng the S E T I PL m a c r o . Th e s uc c e s s f u l u s e o f I P L a s a s yn c h r o n i za t i o n to o l r e qu i r e s th a t I PL be r a i sed { no t l owe r ed ) to t h e a pp r o p r i a t e s ync h r o n i z a t i o n l ev e l . Lowe r i ng I PL d e f e a t s a n y a t tempt a t s yn c h r o n i z a t i o n a nd r un s t h e r i sk o f a r e s e r v ed o pe r a n d f a u l t wh e n a n RE I i n s t r uc t i o n i s l a t e r ex e c u t ed . { An RE I i n s t r uc t i o n tha t a t t emp t s to e l ev a t e I P L c a us e s a r e s e rved o pe r a nd f a u l t . ) 2 4-1 SYNCHRON I ZATION TECHN I QUES Th e S E T I PL m a c r o c h a ng e s I PL t o the s pe c i f i ed v a l ue . i s p r e s e n t , I PL i s e l ev a te d to 3 1 If no a rg um e n t • • MAC RO S ET I PL I PL = #31 M T PR I PL , S "' # PR $_I PL . ENDM S E T I PL Th e DS B INT m a c r o f i r s t s a v e s t h e c u r r en t I PL b e fo r e e l ev a t i ng I PL to the s p e c i f i ed v a l ue . I f no a l t e r n a t e d e s t i n a t i o n i s s pe c i f i ed , t h e o l d I PL i s s a v ed o n the s t a c k . Th e d e fa u l t I PL v a l ue i s 3 1 • MAC RO DS B INT MFPR S "' ft PR $ I PL , DS T M T PR I PL , . ENDM DSB INT • I PL = 31 , DS T = - (SP) S "' # PR $_I PL Th e ENB INT m a c r o i s the c o un te r pa r t to the DS B INT m a c r o . It s e t s I PL t o the v a l ue tha t i t f i nd s i n the d e s i g na t ed so u r c e a rg um e n t the • • MAC RO ENB INT SRC = (SP) + M T PR SRC , S "' # PR $_I PL . ENDM ENB INT Th e SAVI PL m ac r o d o e s n o t a l te r the c u r r en t I PL v a l ue i n the d e s i g n a ted d e s t i n a t i o n a rg um e n t but d o es • . SAVI PL DS T MFPR S "' # PR $_I PL , DS T . ENDM SAVI PL = Figure 24-1 - (SP) M a c r o s Us ed by VM S to Ch a ng e I P L 24-2 s to r e i ts SYNCHRON I ZAT I ON TECHN I QUES 24 . 1 . 1 Use of I PL $ SYNCH _ A s po i n t ed out i n Ch a p t e r 4, I PL 7 ( I P L$ SYNC H ) is used as the i n t e r r up t l ev e l f o r the s o f twa r e t i m e r r o ut i n e s , tho se r o u t i n e s th a t I PL 7 is s e r v i c e t i me r q ue ue e n t r i e s a nd h a nd l e qua n t um e x p i r a t i o n . a l so u s ed a s t h e l ev e l t h a t I P L m u s t be r a i s ed to fo r a n y r o u t i n e to a c c e s s a s ys t em-w i d e d a ta s t r uc t u r e . By r a i s i ng I PL t o 7 , all o th e r r o u t i ne s tha t might acce s s t h e s am e sys t em-w i d e d a t a s t r uc t u r e a r e b l o c k ed f r om e x e c u t i o n un t i l I P L i s l owe r ed . Wh i l e the p r o c e s s o r i s e x e c u t i ng a t I P L 7 , c e r t a i n sys t em-wi d e e v e n t s s uc h a s s c h e d u l i ng a nd I /O po s t p r o c e s s i ng a r e b l o c ked . Ho we v e r , o th e r m o r e impo r ta n t o pe r a t i o n s s uc h a s h a r d wa r e i n t e r r up t s e r v 1 c 1 ng a nd d ev i c e d r i v e r f o r k p r o c e s s i ng c an c o n t i n ue . Th u s , t h e amo un t o f t i me t h a t VMS s pe n d s at I P L 7 d o e s not a ffect more i mpo r ta n t a c t i v i t i e s s uc h a s s e rv i c i ng external d ev i c e s . Th e f a c t t h a t I / O p r o c e s s i ng i nc l ud i ng fo rk p r o c e s s i ng i s mo r e i mpo r ta n t t h a n o th e r s y s tem o pe r a t i o n s ( s uch as s a t i s f y i ng a pag e f a u l t ) r e f l ec t s o n e of the und e r l y i ng ph i l o so ph i e s of VM S , t o k e ep e x t e r n a l d ev i c e s as b u s y a s po s s i b l e . 24 . 1 . 2 Othe r I PL Leve l s Used fo r Synch ro n i za t i o n T a b l e 2 4 - 1 l i s t s seve r a l I PL l ev e l s tha t a r e used fo r s yn c h r o n i za t i o n p u r po s e s b y VM S . Some o f t h e s e l ev e l s a r e used to c o n t r o l a c c e s s to s h a r ed d a ta s t r uc t ur e s . O t h e r s a r e used to prevent c e r ta i n events , s uc h a s a c l o c k i n t e r r upt o r p r oc e s s d e l e t i o n , f r om o c c u r r i ng wh i l e a b l o c k o f i n s t r uc t i o n s i s e x e c uted . Ta b l e 2 4 - 1 Common I PL Va l ue s Used by VA X/VM S fo r Syn c h r o n i za t i o n Va l ue ( d ec i m a l ) Nam e Me a n i ng I PL $ P OWER 31 D i s a b l e a l l i n t e r r up t s I PL $ HWC L K 24 B l o c k c l oc k a nd d ev i c e i n t e r r upts - UC B $B D I PL (*) 2 0 -2 3 B l o c k i n te r r up t s f r om s pe c i f i c d ev i c e s UC B $B F I PL (*) 8 -1 1 Dev i c e d r i v e r fo r k l ev e l s - I PL $ S YNC H 7 Syn c h r o n i ze a c c e s s to a n y s ys t em-w i d e d a ta s t r uc t ur e s I P L $_QUE UEAST 6 bev i c e d r i v e r fo r k I PL t h a t a l l o ws d r i v e r s to el ev a te I PL to 7 I PL $ AS TDE L 2 B l o c k d e l i v e r y o f ASTs ( P r ev e n t p r o c e s s d e l e t i o n � - (*) Th e s e s ym bo l s a r e o f f s e t s i n to a d ev i c e un i t c o n t r o l b l o c k . 24-3 SYNC HRON I Z AT I ON TECHN I QUES 24 . 1 . 2 . 1 I PL 31 - Ro u t i n e s i n VM S wi l l r a i s e I PL t o 31 to block i n te r r up t s fo r a sho r t pe r i o d of t i me ( u s ua l l y l e s s tha n i n s t r uc t i o n s o nc e the s ys t em i s i n i t i a l i z ed ) . • • • all ten Th i s i s d o ne by d ev i c e d r i v e r s j us t b e fo r e they c a l l I OC $WF i x x C H t o p r e v e n t a po we r f a i l i n t e r r up t f r om o c c u r r i ng . Th e e n t i r e boo t s t r a p s e q ue nc e o pe r a t e s a t I PL 3 1 for a in o rder t o put t h e s ys t em i n to a known s t a t e b e f o r e a l l o wi ng i n t e r r up t s to o c c u r . Bec a u se t h e e r r o r l og g e r r o u· t i n e s c a n be c a l l ed f r om a nywh e r e in the execut i ve , i n c l ud i ng faul t service r o u t i n e s th a t e x e c ute a t I P L 3 1 s uc h a s m a c h i n e c h e c k h a nd l e r s , a l locat i on of an e r ro r l og buffe r c a n onl y exec ute a t I PL 3 1 . A c o r r o l a r y o f th i s r e q u i r em e n t d em a nd s th a t the E RRFMT p r o c e s s e x e c ute a t I PL 3 1 wh e n i t i s c o py i ng t h e e r r o r l og b u f f e r t o t h e e r r o r l og f i l e . ( As d e sc r i b ed i n Ch a p t e r 7 , th i s c o py i ng i s done i n two s t eps . Th e e r r o r l og b u f f e r c o n t e n t s a r e c o p i ed t o t h e ERRFMT p r o c e s s P O s pa c e a t I PL 3 1 . Th e n I PL i s l owe r ed t o ze r o , t h e m e s sag e s a r e fo rm a t ted , a nd they a r e wr i t t en t o the e r r o r l og f i l e . ) 24 . 1 . 2. 2 I PL 2 4 - Wh e n I PL i s r a i s ed to 2 4 , t h e l ev e l a t wh i c h t h e h a rd wa r e c l o c k i n te r r upts , c l o c k i n te r r upts a r e b l o c ked . Th e so f t wa r e t i m e r i n te r r upt s e r v i c e rout i ne uses th i s I PL l ev e l wh e n it is c om pa r i ng two q ua d wo r d s y s t em t i m e v a l ue s . Th i s p r e v e n ts t h e sys t em t i m e f r om b e i ng u pd a t ed wh i l e i t i s b e i ng compa r ed to some o th e r t i me va l ue . ( Th i s 1s r e qu i r ed b ec a u se the VAX a r ch i t e c t u r e d o e s n o t c o n t a i n a CMPQ i n s t r uc t i o n . ) 24. 1 . 2. 3 Dev i c e I PL - De v i c e d r i v e r s wi l l r a i s e I PL to the l ev e l at wh i c h the a s so c i a t ed d ev i c e i n t e r r up t s t o p r ev e n t d ev i c e i n t e r r up t s wh i l e d ev i c e r eg i s te r s a r e b e i ng r e ad o r wr i t t e n . Th i s s t e p u s ua l l y p r e c ed e s the f u r the r e l ev a t i o n o f I PL t o 3 1 j u s t d e sc r i bed . 24 . 1 . 2 . 4 Fo r k I P L - Fo r k I P L ( a v a l ue spec i f i c to e a c h d ev i c e t ype ) i s used by VM S to s yn c h r o n i z e a c c e s s to e a c h un i t c o n t r o l b l o c k . Th e s e b l o c k s a r e a c c e s s e d b y d ev i c e d r i v e r s a nd b y p r o c ed u r e b a s e d c od e s uc h as the compl e t i o n pa th o f the $ Q I O s y s tem s e r v i c e a nd t h e Ca n c e l I /0 s y s tem s e rv i c e . Dev i c e d r i v e r s a l s o use the i r a ss o c i a t ed fo r k I PL a s a synch r o n i za t i o n l ev e l wh e n a c c e s s i ng d a t a s t r uc t u r e s tha t c o n t r o l sha r ed r e so u r c e s , s uc h a s m u l t i - u n i t c o n t r o l l e r s , o r d a ta pa th r eg i s t e r s or map r eg i s t e r s . I n o rd e r fo r t h i s s yn c h r o n i za t i o n to wo r k p r o pe r l y , a l l d ev i c e s s ha r i ng a g i v e n r e s o u r c e m u s t use the same fo r k I P L . Th e use o f f o r k I P L t o synch r o n i ze a c c e s s to un i t c o n t r o l b l o c k s wo r k s the s am e wa y tha t e l ev a t i ng I PL to 7 d o e s . Th a t i s , o n e p i e c e o f c o d e e l e v a t e s I PL to the spec i f i ed fo r k I PL ( fo und a t o f f s e t UC B $ B_F I PL ) a nd b l o c k s a l l o the r po t en t i a l a c c e s s e s to the UC B . Fo r k p r o c e s s i ng , the t e c h n i q ue wh e r eby d ev i c e d r i v e r s l o we r I PL b e l o w d ev i c e i n te r r up t l ev e l in a man n e r c o n s i s t e n t wi th the i n te r r up t n e s t i ng sc h em e , a l so u s e s t h e s e r i a l i z a t i o n t e c h n i que d e sc r i b ed i n the n e x t s e c t i o n . 2 4-4 SYNC HRON I ZAT ION TECHN I QUES 24 . 1 . 3 I PL$ QUEUEAST _ Pe r h a ps the e x ampl e tha t b e s t i l l u s t r a t e s the sync h r o n i za t i o n rules fo l l o wed b y VM S i s the u s e o f I P L 6 ( I PL $ QUE UEAST ) b y d ev i c e d r i v e r s . The r e a r e i n s t a nc e s wh e r e d ev i c e d r i v e r s f i nd i t nec e s s a r y to i n t e r a c t wi t h t h e s c h ed u l e r . Fo r e x ampl e , t h e t e rm i n a l d r i v e r n o t i f i e s a r e que s t i ng p r o c e s s a bo u t u n so l i c i t ed i np u t o r a CTRL/Y th r o ug h a n AST ( Ch a p t e r 5 ) . Th e m a i l bo x d r i v e r a l s o c a n no t i f y r e que s t i ng p r o c e s s e s a b o u t r e a d s o r wr i t e s to a m a i l bo x . Th e e nq u e u i ng o f a n AST m u s t o c c u r at I PL$ S YNC H , to s yn c h r o n i z e a c c e s s t o the sched u l e r ' s d a t a b a s e . As a l r e aay po i n ted o u t , I PL mus t b e e l ev a t e d ( no t l owe r ed ) to 7 to a c h i ev e th i s s yn c h r o n i za t i o n . Th e fo r k I PL a t I PL 6 a l l o ws d ev i c e d r i v e r s tha t e x e c u t e a t fo r k I PL ( I PL 8 t h r o ug h I PL 1 1 ) to m a ke the s e s c h e d u l i ng r e q ue s t s . Spec i f i c a l l y , the d r i v e r c a l l s a r o u t i n e c a l l ed C OM $DE LATTNAS T tha t c r e a t e s a n I PL 6 f o r k r e q ue s t . Th a t i s , a fo r k b l o c k i s p l a c ed i n to the I P L 6 f o r k que ue a nd an I P L 6 s o f twa r e i n t e r r up t r e que s t ed . Wh e n tha t i n t e r r upt o c c u r s , t h e fo r k b l oc k i s u s e d a s a n AST c o n t r o l block a nd p a s s e d t o S C H $ QAST , wh o wi l l e l e v a t e I P L t o 7 , i n k e e p i ng wi th the r u l e tha t I P L mus t b e r a i s ed to I P L $ S YNC H to prese rve p r o pe r i n t e r r up t n e s t i ng . An o bv i o u s que s t i o n i n r e s po n s e to the a bo v e d e s c r i p t i o n is wh y t h e I PL 7 fork i n te r r upt c a nno t b e u s e d to a c h i eve t h e s am e r e s u l t . Th e a n s we r i s tha t i f the I P L 7 so f twa r e i n t e r r upt we r e n o t b e i ng used fo r a no t h e r p u r po s e , t h a t wo u l d be a pe r f e c t l y a c c e p t a b l e so l u t i o n . Ho we v e r , the so f twa r e t i m e r s e r v i c e r o u t i n e i s e n t e r ed a s a r e s u l t o f the I P L 7 s o f t wa r e i n t e r r upt . So th i s s ynch ron i z a t i o n t e c h n i que u s e s the f i r s t f r e e I P L b e l ow 7 , the I P L 6 s o f t wa r e i n t e r r u p t c a l l ed I PL $_Q U E U EAST . I PL 6 i s used i n a s e c o nd i n s t a n c e b y d ev i c e d r i v e r s th a t i n te r a c t wi th t h e sche d u l e r . As d e sc r i b ed i n t h e n e x t c h a p t e r , n o npag ed po o l c anno t b e d e a l l o c a ted f r om c od e e x e c u t i ng i n r e spo n s e t o a n i n t e r r up t a bo v e I PL 7 , b e c a u s e n o n pag ed po o l i s a s ys t em-w i d e r e s o u r c e wh o s e a v a i l a b i l i ty mus t be r e po r ted to the schedul e r . Ro u t i n e C OM $ DRVD EALM EM c reates an I PL 6 fo r k proc ess tha t a l l o ws the d e a l l o c a t i o n to t a k e p l a c e i n r e spo n s e to a n I P L 6 s o f twa r e i n t e r r up t , a l l o w i ng the s c h ed u l e r to p r o pe r l y s yn c h r o n i z e i t s d a t a b a s e a c c e s s e s . Th e a c t ua l po o l m a n i pu l a t i o n t a k e s p l a c e a t I PL 1 1 to s ync h r o n i z e wi th the a l l o c a t i o n r o u t i n e . 24 . 1 . 4 I PL 2 Th i s i s t h e l ev e l a t wh i c h the so f twa r e i n t e r r up t a s s o c i a ted wi th AST del ivery occur s . Wh e n s ys t em s e rv i c e p r o c ed u r e s r a i s e I PL to 2 , t h e y a r e b l o c k i ng the d e l i v e r y o f a l l ASTs , b u t pa r t i c u l a r l y t h e spec i a l In o th e r wo r d s , i f a p r o c e s s ke rnel AST tha t c a uses process d e l e t i o n . i s e x e c u t i ng a t I P L 2 ( o r abov e ) , th a t p r o c e s s c a nno t b e d e l e t ed . Th i s t e ch n i q u e i s used i n s eve r a l p l a c e s to p r ev e n t proc e s s d e l e t i on b e twe e n t h e t i me tha t s ome sys t em r e so u r c e ( s uc h a s s ys tem d yn am i c m emo r y ) i s a l l o c a t ed a nd t h e t i me t h a t own e r sh i p o f t h a t r e so u r c e is r ec o rd ed ( s uch a s t h e i n s e r t i o n o f a d a t a s t r uc t u r e i n to a l i s t ) . Fo r e x a m p l e , the $ Q I O s y s tem s e rv i c e e x e c u t e s a t I P L 2 f r om th e t i me tha t an I /0 r e que s t pac k e t i s a l l o c a ted f r om no npag ed d yn am i c memo r y u n t i l t h a t pa c k e t i s que ued to a un i t c o n t r o l b l o c k o r pl a c ed i n to the I /0 po s t pr o c e s s i ng queue . 24-5 SYNCHRON I Z AT I ON TECHN I QUES I PL 2 a l so has s i g n i f i c a n c e fo r an e n t i r e l y d i f fe r e n t r e a so n . Th i s i s the h ighest I PL l ev e l a t wh i c h pag e f a u l t s a r e pe rm i t te d . I f a pag e f a u l t o c c u r s a t I PL a b o v e 2, a fatal b ug ch e c k ( BUG $ PG F I PLH I ) is i s s ue d . If the r e is a ny po s s i b i l i ty t h a t a pag e f aul t c a n o c c u r , b e c a us e e i th e r the c o d e tha t is e x e c u t i ng or the d ata tha t it r e f e r e nc e s i s pag e ab l e , then t h a t c o d e c anno t ex e c u t e above I PL 2 . Th e c onv e r s e o f th i s c o n s t r a i n t i s tha t a n y c o d e tha t e x e c u t e s above I PL 2 , a nd a l l d a ta r e f e r en c ed b y s uc h c od e , must be l o c k ed i n to memo r y i n some wa y . Append i x A s hows some o f t h e techn i qu e s th a t VMS uses to d yn am i c a l l y l o c k c o d e o r d a ta i n to memo r y s o t h a t I PL c a n b e e l eva t ed a b o v e I P L 2 . 24 . 2 S ER IAL I Z ED ACC E S S Th e s o f t wa r e i n te r r up t c apab i l i ty d e sc r i b ed in C h a p t e r 4 p r o v i d e s no m e thod f o r c o un t i ng t h e n um b e r of r e que s t ed so f t wa r e i n te r r up t s . VMS u s e s a c om b i na t i o n o f s o f twa r e i n t e r r up t s a nd d o ub l y l i n ke d l i sts to c ause s ev e r a l r eque s t s fo r the s am e d a ta s t r uc t u r e or p r o c e d u r e to b e s e r i a l i zed . Th e mo s t i m po r ta n t e x ampl e o f th i s i n V M S i s the use o f f o r k p r o c e s s e s b y d ev i c e d r i v e r s . Th e I /0 po s tp r o c e s s i ng s o f twa r e i n t e r r up t i s a s e c o nd e x amp l e o f s e r i a l i ze d a c c e s s . 24 . 2 . 1 Fo r k Proc e s s i ng Fo r k p r o c e s s i ng i s t h e t ec h n i q ue tha t a l l o ws d ev i c e d r i v e r s to l owe r I PL i n a m a n n e r c o n s i s t e n t w i th t h e i n t e r r up t n e s t i ng s c h eme d e f i n ed Fo r k p r o c e s s i ng i n VM S i s e x p l a i n ed by f i r s t by the VAX a r ch i t ec t u r e . d e sc r i b i ng how i t wo r k s a nd then i l l u s t r a t i ng the s i t ua t i o n tha t i t i s d e s i g n ed t o av o i d . Wh en a d ev i c e d r i v e r r ec e i v e s c o n t r o l i n r e s po n s e i t pe r fo rm s wh a t eve r s t eps a r e n ec e s s a r y to to a d ev i c e i n t e r r upt , se rv i c e the i n t e r r upt at d ev i c e I PL . Fo r exampl e , any d ev i c e r eg i s te r s who s e c o n t e n t s wo ul d b e d e s t r o yed b y ano th e r i n t e r r upt mus t b e r e ad b e f o r e d i sm i s s i ng the d ev i c e i n t e r r upt . Us u a l l y , t h e r e i s some p r o c e s s i ng t h a t c an be d e f e r r ed . Fo r DMA d ev i c e s , a n i n te r r up t s i g n i f i e s e i th e r c ompl e t i o n o f t h e o pe r a t i o n o r a n e r ro r . Th e c o d e tha t d i s t i ng u i sh e s t h e s e two c a s e s a nd pe r f o rms e r ro r p r o c e s s i ng i s u s ua l l y l e ng t h y a nd to e x e c ute at d ev i c e I PL f o r e x t e nd ed pe r i od s o f t i me wo u l d s l ow d own the sys t em . Fo r n o n DMA d ev i c e s tha t d o n o t i n t e r r upt a t too r ap i d a r a te , i n te r r up t p r o c e s s i ng c an b e d e f e r r e d i n favo r o f o the r mo r e i mpo r ta n t d ev i c e s e r v i c i ng . I n e i th e r c a se , t h e d r i v e r s i g n a l s tha t i t wi s h e s to d e l a y f u r th e r p r o c e s s i ng un t i l the I PL i n t h e s ys t em d ro ps b e l o w a p r ed e t e r m i ned v a l u e , the fo r k I P L a s s o c i a t ed wi t h th i s d r i v e r . Th i s s i g n a l l i ng is a c c om p l i s hed b y c a l l i ng a rout i ne i n the e x e c u t i ve tha t s a v e s the ad d r e s s of the nex t i n s t r uc t i o n in the d r i v e r in a d a ta s t r uc t u r e c a l l ed a fo r k b l o c k ( F i g u r e 4 - 2 ) . Th e fo r k b l o c k i s t h e n i n s e r t e d a t t h e e nd o f t h e fo r k q u e u e fo r tha t I PL va l ue . If t h e que ue wa s p r e v i o u s l y empt y , a s o f twa r e i n te r r up t a t the a pp r o p r i a t e I PL i s r e que s t e d . ( I f t h e que u e wa s n o t p r ev i o u s l y emp t y , the r e que s t h a s a l r e a d y b e en mad e a nd t h e ove r h e a d a s soc i a t ed wi th a n e e d l e s s so f twa r e i n t e r r up t r e que s t c a n b e avo i d ed . ) 2 4 -6 SYNCHRON I Z ATION TECHN I QUES 24 . 2 . 2 I/O Po s tproc e s s i ng Upo n c ompl e t i o n o f a n I /O r e qu e s t , t h e r e a r e a s e r i e s o f c l e a n up s te ps t h a t m u s t b e p e r fo rmed . Th e e v e n t f l ag a s s o c i a t ed wi t h t h e r e qu e s t must be set . A s pec i a l k e r n e l A S T t h a t wi l l p e r fo rm f i n a l c l e a n up 1n t h e c o n tex t o f t h e p r o c e s s tha t i n i t i a l l y i s s ued the $ Q I O c a l l m u s t b e que ued to the p r o c e s s . Th i s c l e a n up m u s t b e c omp l e ted fo r o ne I /0 I n o th e r wo r d s , I/O po s tp r o c e s s i ng r e qu e s t b e fo r e a no th e r i s h a nd l ed . m u s t b e s e r i a l i z ed . Th i s s e r i a l i z a t i o n i s a c c om p l i shed by pe r fo rm i ng the po s t p r o c e s s i ng o pe r a t i o n a s a so f t wa r e i n t e r r up t s e r v i c e r o u t i n e ( a t I PL 4 ) . Wh e n a r e que s t i s r ec og n i zed a s b e i ng c om p l e te , t h e I /0 r e que s t pa c ke t is p l a c ed a t t h e t a i l o f t h e I /O po s tp r o c e s s i ng q ueue ( a t g l o b a l l i s th e a d I OC $G L P S B L ) . If th i s pac ke t i s the f i r s t in the l i st , a so f t wa r e i n te r r up t at I P L 4 i s r e que s t ed . Wh en t h e d ev i c e d r i v e r r ec og n i z e s t h a t a n I /O r e que s t h a s c om p l e ted ( e i th e r s uc c e s s f u l l y o r un s uc c e s s f u l l y ) , i t c a l l s r o ut i n e I OC $ R E QC OM , wh i c h m a k e s t h e I PL 4 s o f twa r e i n t e r r up t r e que s t a t fo r k I PL ( I PL 8 to I PL 1 1 ) , a nd s o the po s t p r o c e s s i ng i n te r r up t i s d e f e r r ed un t i l the I PL d rops b e l ow 4 . Some I /O r e q ue s t s d o n o t r eq u i r e d r i v e r a c t i o n . Wh en the $ Q I O s y s tem s e rv i c e o r d ev i c e - sp e c i f i c FDT r o u t i n e s d e t e c t t h a t t h e r e que s t c a n b e c ompl e t ed w i tho u t d r i v e r i n t e r v en t i o n , o r if they d e t ec t an e r ro r , they c a l l o ne of the r o u t i ne s EXE $ F IN I SH I O o r E XE $ F I N I S H I OC . Th e s e t wo r o u t i ne s execute at I PL 2 and so the r e q ue s t ed s o f twa r e i n t e r r up t i s t a k e n i mmed i a t e l y . AC Ps a l so p l a c e I /O r e que s t pac k e t s d i r e c t l y i n to t h e po s t p r o c e s s i ng q u e u e a nd r e qu e s t t h e I PL 4 s o f twa r e i n t e r r up t . 24 . 3 MUTUAL E XC LUS ION S EMAPHORES ( MUTEXE S ) Th e s yn ch r o n i z a t i o n t e c h n i qu e s d e sc r i b ed so far all execute at e l eva t ed I PL , t h us b l oc k i ng c e r t a i n o pe r a t i o n s s uc h a s a r e sc h ed u l e f r om t a k i ng p l a c e . Th e r e a r e s ome sha r ed d a ta s t r uc t u r e s tha t m u s t b e p r o t e c ted f r om m u l t i pl e a c c e s s wh e r e e l ev a t ed I PL i s a n un a c c ept a b l e t ec h n i que fo r s yn c h r o n i za t i o n , b e c a u s e the p r oc e s so r wo u l d have to r ema i n a t an e l ev a ted I P L f o r a n u n s pe c i f i ed l eng t h o f t i me . Fo r e x ampl e , t h e s ys t em l og i c a l n ame t ab l e c anno t h a v e two proc esses m a k i ng entr i es at the s am e t i m e . Howev e r , t h e sys t em l og i c a l n ame t ab l e c a n b e v e r y l o ng , a nd the s e a r c h o f the t ab l e fo r d up l i c a te n am e s c a n b e v e �y t i m e c o n s um i ng . A s e c ond s i t ua t i o n wh e r e e l ev a ted I PL i s n o t a c c e p ta b l e a s a s yn c h r o n i za t i o n too l o cc u r s wh e n t h e d a t a s t r uc tu r e t h a t i s b e i ng p r o tec t ed i s pag ed . Th e memo r y m a n ag em e n t s ub sys t em d o e s n o t a l l o w pag e faul ts to occur wh e n I PL i s above 2 . Th u s , a n y pag e ab l e d a ta s t r uc t u r e c a nn o t b e p r o t e c t e d b y e l ev a t i ng I PL to 7 . Fo r these two r easons , a n o th e r mech a n i sm is r eq u i r ed fo r c o n t r o l l i ng acc e s s to sh a r e d d a ta s t r uc tu r e s . VM S u s e s m u t e x e s , m u t ua l e x c l us i o n s em a pho r e s , for th i s pu r po se . M u t ex e s a r e e s s e n t i a l l y f l ag s tha t i nd i c a te wh e th e r a g i v e n d a ta s t r uc t u r e i s b e i ng e x am i n ed o r mod i f i ed b y o n e o f a g r o up o f c o ope r a t i ng processes . Th e i m p l em e n ta t i o n a l l o ws e i th e r mul t i pl e Ta b l e 2 4 - 2 l i s ts those r e ad e r s o r o n e wr i te r o f a d a ta s t r uc t u r e . d a ta s t r uc t u r e s i n VM S t h a t a r e p r o t ec t ed b y m u t ex e s . 2 4-7 S YNCHRON I Z AT ION TECHN I QUES Ta b l e 2 4 - 2 L i s t o f Da t a S t r uc t u r e s P r o tec ted b y Mu t e x e s Da t a St r uc t u r e Gl o b a l Ad d r e s s o f Mu t e x { No t e 1 } Va l ue i n Ve r s i o n 2 . 0 {No te 1 } Sy s t em Lo g i c a l Nam e Ta b l e LOG $AL MUT E X 8 0 0 0 2 4F 4 G r o up Lo g i c a l Nam e Ta b l e 8 0 0 0 2 4F 8 I OC $G L MUT E X 80002620 Commo n Ev e n t B l o c k L i s t E XE $G L C EBM TX 80002624 Pag ed Dyn am i c Mem o r y EXE $G L PGDYNM TX 80002628 G l ob a l Sec t i o n De sc r i p to r L i s t E XE $G L G S DM TX 8 0 0 0 2 6 2C S h a r ed Mem o r y Gl o b a l Sec t i o n De sc r i pto r Ta b l e E XE $G L_S HMG S MTX 80002630 Sh a r ed Mem o r y Ma i l box De sc r i pto r Ta b l e EXE $G L S HMMBMTX 80002634 E n qu e ue/Dequeue Ta b l e s ( No t Cu r r e n t l y Us ed ) E XE $G L_E N QM TX 80002638 Known F i l e En t r y Ta b l e E XE $G L K F IMTX 8 0 0 0 2 6 3C L i n e Pr i n t e r Un i t Co n t r o l Bl o c k { No te 3 ) UC B $ L LP MUT EX (No te 3 ) I /0 Da ta Ba s e { No te 2 } {1) Wh e n a pr o c e s s i s p l a c ed i n to a n MWA I T s t a te wa i t i ng fo r a m u t ex , the add r e s s o f t h e m u t ex i s pl a c ed i n to the PC B $ L E FWM f i e l d of the PC B . Th e s ym bo l i c contents o f PC B $ L-E FWM w i l l p r o b ab l y r em a i n t h e same f r o m r e l e a se to r e l e a se . Th e n ume r i c c o n te n t s a r e a lmost c e r ta i n to c h a ng e wi t h e a c h m a j o r r e l e a se o f the o pe r a t i ng sys t em . (2) Th i s m u t e x i s used by t h e As s i g n Ch a n n e l a nd Al l o c a t e Dev i c e s ys t em se rv i c e s wh en s e a r c h i ng t h r o ug h the l i n k ed l i s t o f d ev i c e d a ta b l o c k s fo r a d ev i c e wi t h a g i v en I t i s a l so used by the MOUNT u t i l i ty a nd the f i l e n am e . s ys t em AC Ps to l o c k the f i l e s ys t e m d a ta s t r uc t u r e s . {3) Th e mutex a s so c i a t e d wi t h e ac h l i n e p r i n t e r u n i t d o e s no t have a f i x ed ad d r e s s l i ke the o th e r m u t ex e s . I t s v a l ue d e pe nd s o n wh e r e t h e UC B fo r tha t un i t i s a l l o c a ted . Th e m u t e x i t se l f c on s i s t s o f a s i ng l e l o ng wo r d th a t c o n t a i n s the n um b e r of o wn e r s of t h e m u t ex { MT X $W OWNC NT ) in t h e low o r d e r wo r d and s t a t u s f l ag s { MTX$W S T S ) i n t h e h i g h o rd e r wo r d { Fi g ur e 2 4 -2 ) . Th e o wn e r c o un t b eg i ns a t - 1 s o th a t a m u t e x w i t h a z e r o i n t h e l o w o r d e r wo r d h a s o ne o wn e r . Th e o n l y f l ag cur r en t l y i mp l eme n ted i nd i c a t e s wh e th e r a wr i te o pe r a t i o n i s e i th e r i n p r og r e s s o r pend i ng fo r th i s m u t e x { MTX$ V_WRT ) . 2 4-8 SYNC HRON I Z AT I ON TECHN I QUES 31 1 7 1 6 15 Status Figure 24-2 24.3 . 1 jI L 0 O w n e rship Count W r i t e - in- Progress or Write P e n d i ng Flag Fo rma t o f Mu t ua l E x c l u s i o n Sema pho r e ( MUT E X ) Loc k i ng a Mu t e x fo r Read Ac c e s s Wh e n a p r o c e s s w i shes to g a i n r ea d a c c e s s to a d a t a s t r uc t u r e tha t is p r o t e c t ed b y a mutex , i t p a s s e s the a d d r e s s o f t h a t m u t ex to a r o u t i n e c a l l ed S C H $ L O C KR . I f the r e i s n o wr i t e o pe r a t i o n e i th e r i n prog r e s s or pend i ng , t h e o wn e r c o un t o f th i s m u t e x ( MTX$W OWNCNT ) is at i nc r emen t ed , t h e c o un t o f m u t e x e s o wn ed by th i s p r o c e s s - ( s to r ed o f fset PC B $ L M TXCNT in the so f twa r e PC B ) i s a l so i n c r emented , a nd c o n t r o l i s p a ss e d bac k to the c a l l e r , un l e s s th i s i s the onl y mutex o wn e d by th i s p r o c e s s . I f t h e m u tex c o un t fo r th i s p r o c e s s ( PC B $W MTXCNT ) i s o n e , i nd i c a t i ng that the p r o c e s s o wn s no o th e r m u t ex e s , t h e c u r r e n t a nd base p r i o r i t i e s a r e s to r ed i n t h e u ppe r two b y t e s o f PC B $ L WT I M E , a field in the s o f twa r e PC B t h a t i s n o l o ng e r u s ed b y VM S . - I n a d d i t i o n , i f the p r o c e s s i s n o t a r e a l - t i me p r o c e s s ( p r i o r i t y sm a l l e r than 1 6 ) , t h e s o f twa r e p r i o r i t y ( bo th c u r r e n t p r i o r i t y and b a s e p r i o r i t y ) o f t h e p r o c e s s i s e l ev a t ed to 1 6 . Th i s i s d o ne to i n s u r e th a t the mutex wi l l b e o wn ed fo r a s l i t t l e t i m e a s po s s i b l e . No t i c e t h a t the chec k o n t h e n um b e r o f own ed m u t ex e s p r ev e n t s a p r o c e s s that g a i n s o wn e r sh i p o f two o r m o r e m u t ex e s f r om r e c e i v i ng a pe rma n e n t pr i o r i t y e l ev a t i o n i n t o the r e a l - t ime r a ng e . ( Th e p r i o r i t y a l t e r a t i o n a l g o r i thm d e s c r i b ed h e r e i s a pa r t o f a b i n a r y upd a t e a nd d o e s n o t ag r e e e n t i r e l y w i th the l i s t i ng o f mod u l e MUTEX i n the e x e c u t i v e m i c r o f i c h e . ) Ro u t i n e S C H $ LOCKR a l wa ys r e t u r n s s uc c e s s f u l l y i n the s e n s e th a t i f t h e mutex is c u r r e n t l y un a v a i l a b l e , t h e p r o c e s s i s p l a c ed i n to a m u t ex wa i t s ta t e ( MWA I T ) un t i l t h e m u t ex i s f r e ed up . At t h e t i me tha t the process even t ua l l y g a i n s o wn e r sh i p o f the m u t ex , c o n t r o l wi l l th e n b e p a s s e d b ac k . I PL i s s e t t o I PL $ A S TDE L ( I PL 2) to p r ev e n t p r o c e s s d e l e t i o n wh i l e t h e m u t ex i s o wn ed b y t h i s p r o c e s s . Th i s m u s t b e d o n e b e c a use t h e De l e t e P r o c e s s sys t em s e r v i c e h a s no internal chec k s o n wh e the r t h e p r o c e s s b e i ng d e l e t ed own s a n y m u t e x e s . I f the del etion s uc c e ed ed , t h e l o c k ed d a ta s t r uc t u r e wo u l d b e l o s t t o the sys t em . 24 . 3 . 2 Loc k i ng a Mu t e x f o r Wr i te Ac c e s s A p r o c e s s wi sh i ng to g a i n wr i t e a c c e s s to a pro t e c t ed d a ta s t r uc t u r e pa s s e s t h e a d d r e s s of t h e a pp r o p r i a t e mutex to a r o u t i n e c a l l e d S C H $ LOCKW . Th i s r o u t i n e r e t u r n s c o n t r o l to the c a l l e r wi th the m u t e x l o c k ed fo r wr i t e access if the mutex is c u r r e n t l y unowned . In ad d i t i o n , b o th m u t e x c o un t s ( MTX$W OWNC NT a nd PCB $ L MTXCNT ) are i nc r em e n t e d , the process s o f twa r e pr i o r i t y i s po s s i b l y-a l te r e d , a n d I PL i s s e t to 2 . A n a l t e r n a t e e n t r y po i n t , S C H $ LO C KNOWA I T , returns control t o t h e c a l l e r w i th R O < O > c l e a r ed ( i nd i c a t i ng f a i l u r e ) i f t h e r e q u e s ted m u t ex i s a l r e a d y own ed . 24-9 SYNCHRON I Z AT I ON TECHN I QU E S Fo r the r � g ul a r e n t r y po i n t ( S C H $ L OC KW ) , i f th i s m u t e x i s o wn e d , the process 1s p l a c ed i n to t h e m u t ex wa i t s ta t e ( MWA I T ) . Howe v e r , the wr i t e pend i ng b i t i s set so tha t f u t u r e r e que s t s fo r r e a d a c c e s s wi l l I n a s e n s e , t h i s s c h em e i s p l a c i ng r e que s t s fo r wr i t e a l so b e d en i ed . a c c e s s a h e a d o f r e que s t s f o r r e ad access . Howeve r , all that th i s c h ec k is r e a l l y d o i ng is p r ev e n t i ng a c o n t i n uo u s s t r e am o f r e a d a c c e s s e s k e e p i ng the m u t ex c o un t ( MTX$W OWNCNT ) no n z e r o . Wh e n t h e m u t ex c o un t g o e s to - 1 ( no o wn e r s ) , i t i s d ec l a r e d ava i l a b l e a nd t h e h i g h e s t p r i o r i t y p r o c e s s wa i t i ng f o r the m u tex i s the o n e tha t wi l l g e t f i r s t a c c e s s t o the m u t ex , i nd e pend e n t o f wh e th e r i t i s r e q ue s t i ng a r e ad a c c e s s o r a wr i te a c c e s s . 24 . 3 . 3 Mutex Wa i t S t a te Wh e n a p r o c e s s is p l a c ed i n to a m u t ex wa i t s t a t e , i t s s t a c k i s set up so tha t the saved PC is the e n t r y po i n t of e i th e r the r e ad - l o c k r o u t i ne o r t h e wr i te- l o c k r o u t i n e . ( I n the l a t t e r c a s e , the PC po i n t s to a b r an c h to SCH$ LOCKW . ) The PS L i s ad j us ted so tha t t h e saved I PL is 2. Th e add r e s s o f the m u t e x th a t i s b e i ng r e qu e s t ed i s p l a c ed i n to the s o f twa r e PC B a t o f f s e t PC B $ L E FWM . ( Be c a us e the p r o c e s s i s n o t wa i t i ng o n a n ev e n t f l ag , t h i s f i e l d i s a v a i l ab l e fo r o th e r p u r po s e s . ) Ta b l e s 8 - 2 a nd 2 4 - 2 l i s t the c o n t e n t s o f the PC B $ L E FWM f i e l d fo r e a c h MWA I T s t a te . 24 . 3 . 4 Un l o c k i ng a Mutex A p r o c e s s r e l i nq u i sh e s o wn e r sh i p o f a m u t e x b y p a s s i ng the a d d r e s s o f the m u t ex to be r e l e a sed to a r o u t i n e c a l l ed S C H $ UN LOC K . Th i s r o u t i ne d e c r em e n t s the n umber o f m u t e x e s o wned by th i s p r o c e s s r eco r d ed i n i t s PC B . If this p r o c e s s d o e s n o t own a n y mo r e m u t e x e s ( PC B $W MTXCNT c o n t a i n s z e r o ) t h e s av ed b a s e a nd c u r r e n t pr i o r i t i e s ( in f ields PC B $ L WT I M E + 2 a n d PC B $ L WT IME + 3 ) a r e e s t a b l i sh e d a s t h e p r o c e s s ' s I f t h e r e a r e c omputa b l e ( C OM ) c u r r e n t p r i or i t i e s . n ew b as e a nd p r o c e s s e s w i th h i gh e r pr i o r i t i es than th i s p r o c e s s ' s n ew c u r r en t p r i o r i t y , a r e sc h ed ul i ng i n t e r r up t i s r eque s t ed . S C H $ UN LOC K a l s o d e c r em e n t s t h e n um b e r o f own e r s o f t h i s m u t e x ( MTX $W OWNCNT ) . If the o wn e r c o un t o f th i s m u t e x d o e s n o t g o to - 1 , t h e r e a r e o th e r o u t s t a nd i ng own e r s o f t h i s m u tex so c o n t r o l i s s imply p a s s ed b a c k to the c a l l e r . I f the c o un t d o e s b e come - 1 , th i s i nd i c a t e s tha t t h i s mu tex is c u r r e n t l y unown ed . If t h e wr i te- i n-prog r e s s b i t i s c l e a r , t h i s i nd i c a t e s t h a t t h e r e a r e n o p r o c e s s e s wa i t i ng o n th i s m u t e x , and contro l i s pa s s ed back to the c a l l e r . ( A wa i t i ng wr i te r wo u l d s e t th i s b i t . A po t en t i a l r e ad e r i s o n l y b l o c k ed i f the r e i s a c u r r e n t o r pend i ng wr i t e r . ) I f th e r e a r e o th e r p r o c e s s e s wa i t i ng fo r t h i s m u t ex , t h e y a r e a l l mad e c omputa b l e . Th i s i s a c compl i shed by s c a nn i ng the MWA I T q u e ue fo r all p r o c e s s e s wh o s e PC B $ L E FWM f i e l d m a tc h e s the a d d r e s s o f the u n l o c ked m u t ex . I f the p r i o r i t y o f a ny o f t h e p r o c e s s e s r emoved f r om the m u tex wa i t s ta t e i s g reater than the p r i o r i ty o f the cur rent process , a r e s c h e d u l i ng pa s s wi l l o c c u r tha t wi l l select the h i g h e s t pr i o r i ty p r o c e s s fo r exe c u t i o n . As n o t ed a bove , the r e i s no d i f f e r e n c e b e twe e n p r o c e s s e s wa i t i ng fo r r e a d a c c e s s a nd p r o c e s s e s wa i t i ng fo r wr i t e a c c e ss . Th e c r i t e r i o n tha t d e te rm i n e s who w i l l g e t f i r s t c h a n c e a t o wn e r sh i p o f the m u t e x i s s o f twa r e p r i o r i ty . 24-10 SYNCHRON I ZATI ON TECHN I QUES 24 . 3. 5 Re s o u r c e Wa i t S t a te Th e r o u t i n e s t h a t pl a c e a p r o c e s s i n to a r e so u r c e wa i t s t a t e a nd m a k e r e so u r c e s a v a i l ab l e sha r e some c od e w i th t h e m u t e x l o c k i ng and un l oc k i ng r o u t i n e s a nd wi l l be b r i e f l y d e sc r i b ed here . De t a i l s o f r e so u r c e s t h a t a r e c o n t e s t ed fo r among p r o c e s s e s c a n b e fo und i n Ch a p t e r 8 . Wh e n a p r o c e s s r eq u i r e s a r e s o u r c e t h a t i s unav a i l a b l e , i t i s p l a c ed i n to a r e so u r c e wa i t s t a t e , wh i c h s h a r e s the same s t a t e n umbe r a n d wa i t que ue h e a d e r w i th t h e m u t ex wa i t s t a t e . Th e r e so u r c e n umbe r is s to r ed i n the PC B ( a t o f f s e t PC B $ L E FWM ) i n s t ead o f the m u t e x a d d r e s s ( Ta b l e 8 - 2 ) . I n a d d i t i o n , a b i t c orr e s po nd i ng t o th i s r e so u r c e i s s e t in a r e so u r c e wa i t m a s k ( fo und a t g l ob a l l o c a t i o n S C H $ G L RE SMAS K ) . Th e s a v ed PC a nd PS L a r e d e t e rm i ned by the c a l l e r of r o u t i n e S C H $ RWA I T . Wh e n a r e so u r c e b ec ome s a v a i l a b l e , t h e a pp r o p r i a t e b i t i n the r e s o u r c e wa i t m a s k i s c l e a r ed . I f t h e b i t wa s p r ev i o u s l y s e t , t h i s i nd i c a t e s t h a t t h e r e a r e o th e r p r o c e s s e s wa i t i ng o n th i s r e so u r c e . The same r out ine tha t f r ee s up p r o c e s s e s wa i t i ng o n a mutex is e n t e r ed at th i s po i n t . O f f s e t PC B $ L E FWM n o w c o nta i n s a r e so u r c e n umbe r i n s t e a d o f a m u t e x a d d r e s s b u t thTs i s a c o nc e p t ua l d i f f e r ence th a t i s i nv i s i b l e to t h e cod e tha t is a c t ua l l y e x e c u t i ng . Th e MWA I T s t a t e q u e u e i s s c a n n ed fo r a l l p r o c e s s e s wh o s e PC B $ L E FWM f i e l d m a tc h e s t h e n um b e r o f the r ec e n t l y f r e ed r e so u r c e . Al l s uc h p r o c e s s e s a r e mad e c om p u ta b l e . I f the n ew p r i o r i t y o f a n y o f these processes is l a rg e r than t h e p r i o r i t y o f the c u r r e n t l y e x ec u t i ng In any event , all p r o c e s s , a r e s c h ed u l i ng i n te r r upt i s r eq u e s ted . p r o c e s s e s wa i t i ng fo r t h e n o w a v a i l a b l e r e s o u r c e wi l l compe te fo r th a t r e s o u r c e b a sed o n so f twa r e p r i o r i t y . 2 4-1 1 CHAPTER 2 5 DYNAM I C MEMORY AL LOCAT I ON Th e s ys tem m a i n t a i n s th r e e s e pa r a t e a r e a s f o r s to r ag e . • • • d yn am i c a l loc a t i on of Th e p r o c e s s a l l o c a t i o n r eg i o n ho l d s d a t a s t r uc t u r e s tha t o n l y r e q u i r ed by a s i ng l e p r o c e s s . a re Pa g ed d yn am i c memo r y c o n t a i n s d a t a s t r uc t u r e s tha t a r e used by s e v e r a l p r o c e s s e s but a re not r e q u i r ed to b e memo r y r e s i de n t . Th e nonpa g ed poo l c o n t a i n s d a t a s t r uc t u r e s and c o d e th a t is by t h e po r t i o n s o f VM S th a t a r e n o t p r o c ed u r e b a s e d , used such a s i n t e r r u p t s e r v i c e r o u t i n e s a nd d ev i c e d r i v e r s . Th e s e po r t i o n s o f VM S c a n o n l y u s e sys tem v i r t ua l add r e s s spa c e a nd u s ua l l y e x e c u t e a t e l ev a ted I PL , r e qu i r i ng nonpa g ed po o l spa c e r a th e r t h a n pag ed po o l s pa c e . Th e n o n p a g e d po o l a l s o c o n ta i n s d a ta s t r uc t u r e s a nd c o d e t h a t are sh a r ed by s eve r a l p r o c e s s e s a nd m us t n o t be pag ed . Th i s r e q u i r em e n t i s us ua l l y d i c ta t ed by t h e f a c t tha t pag e fa u l t s a r e n o t p e rm i t t ed a b ove I P L 2 . 25 . 1 AL LOCAT I ON S TRATEGY AND IMPLEMENTAT I ON E a c h o f the three po o l a re a s h a s the s am e s t r uc t u r e so c ommo n a l l o c a t i o n a nd d ea l l o c a t i o n r o u t i n e s c a n b e u s ed . Th e f i r s t two l o ngwo r d s o f e ac h un used b l o c k i n o n e o f t h e po o l a r e a s a r e used to d e sc r i b e the b l o c k . As i l l u s t r a t ed in F i g u r e 2 5 - 1 , the f i r s t l o ng wo r d i n a b l oc k c o n ta i n s t h e v i r t ua l a d d r e s s o f t h e n e x t un us ed b l o c k in the l i st . Th e s e c o nd l o ngwo r d con ta i n s the s i ze i n b y t e s o f the unused b l oc k . E a c h s uc c e s s i v e un u s e d b l o c k i s f o und at a h igher v i r t ua l add r e s s . Th u s , e a ch po o l a r e a fo rms a s i ng l y l i n k e d mem o r y o rd e r e d l i s t . 25. 1.1 Al l oc a t i o n o f Dyn am i c Memo ry Wh e n the a l l o c a t i o n r o u t i n e is c a l l ed , i t s e a r c h e s f r om the b eg i n n i ng o f the l i s t u n t i l i t e n c o un t e r s the f i r s t un u s e d b l o c k l a r g e e n o ug h t o s a t i s f y the r eq ue s t . I f the f i t is exac t , the a l l o c a t i o n rout ine s i mpl y a d j us t s t h e p r ev i o us po i n t e r t o po i n t t o t h e nex t f r e e b l o c k . I f the f i t i s n o t ex a c t , i t s ub t r a c t s t h e a l lo c a ted si ze f r om the o r i g i na l s i ze of the b l o c k , puts the n e w s i z e i n to t h e r em a i nd e r o f 2 5- 1 DYNAM I C MEMORY ALLOCATI ON t h e b l o c k , a nd a d j u s t s the p r ev i o u s po i n t e r to po i n t to the of the b l o c k . Th e two po ss i b l e a l l o c a t i o n s i t ua t i o n s i n ex a c t f i t ) a r e i l l u s t r a t ed i n F i g u r e 2 5 - 2 . r ema i nd e r ( ex a c t a nd Beginning of P ool Area (Filled in When System is Initialized) 0 Address of First Free Blo c k (Modified b y Allocation and Deallocation Routines) (Zero in Pointer Signifies End of List) Figure 25-1 25. 1 . 2 L a yo u t o f Unused Ar e a s i n Dyn am i c Memo r y Poo l s Dea l l o c a t i o n o f Dynam i c Memo ry Wh e n a b l o c k i s d e a l l o c a te d , i t m u s t be pl a c ed b a c k i n to the l i st in i t s p r o pe r p l a c e , a c co r d i ng to i t s add r e s s . Th i s i s a c compl i shed by f o l l o wi ng the unused a r e a po i n t e r s un t i l an add r e s s l a rg e r than the ad d r e s s o f the b l oc k t o b e d e a l l o c a t e d is e nc o un t e r ed . If the d e a l l o c a ted b l o c k is a d j a c e n t to ano th e r un used b l o c k , the two b l o c ks a r e me rged i n to a s i ng l e un used a r e a . Th i s m e r g i ng , o r agg l om e r a t i o n , c a n o c c u r a t the e nd o f the p r e c ed i ng unus ed b l o c k o r a t the beg i n n i ng of the f o l l o wi ng bloc k (or bo th ) . Th r e e samp l e d e a l l o c a t i o n s i t ua t i o n s , two o f wh i c h i l l u s t r a t e m e rg i ng , a r e shown i n F i g u r e 2 5 - 3 . B e c a u s e m e r g i ng oc c u r s a u tom a t i c a l l y a s a pa r t o f d e a l l o c a t i o n , t h e r e i s n o n e ed f o r a ny e x t e r n a l l y t r i g g e r ed g a r b a g e c o l l ec t i o n r o u t i n e s . Th e d e a l l o c a t i o n r o u t i n e a s s umes t h a t the wo rd a t o f f s e t 8 conta ins the s i ze o f t h e b l oc k b e i ng d e a l l o c a ted . Al l o f t h e d yn am i c a l l y a l l o c a t ed b l oc k s use b y VM S adhe r e t o th i s c o nv e n t i o n . Th e t ype code l o c a ted in the b y t e at o f f s e t 1 0 i s a l s o u s ed by the d e a l l o c a t i o n r o u t i n e t o d i s t i ng u i sh b e twe en s t r uc t u r e s a l l o c a ted f r om l o c a l m emo r y ( type cod e is po s i t i v e ) a nd s t r uc t u r es a l l o c a t ed f r om sh a r ed m emo r y ( type cod e i s n eg a t i v e ) . 2 5-2 DYNAM I C MEMORY ALLOCATI ON Th i s s i z e wo r d , a s we l l a s t h e type c o d e s to r ed i n the ad j a c e n t b y t e at o f fs e t 10, a l l ow S DA to c o r r ec t l y i n te r pr e t t h e po r t i o n s o f n o npag ed po o l t h a t a r e c u r r e n t l y i n use . S ev e r a l d a t a s t r uc t u r e s a l l o c a t ed d u r i ng the i n i t i a l i za t i on s eq uenc e a nd me n t i o ned in Ch a p t e r 2 2 d o no t h a v e a 1 2 byte h ead e r th a t a l l o ws th i s s i ze a nd type i n fo rm a t i o n to be s to r ed . As a r e s u l t , SDA i n t e r p r e t s a c t ua l d a t a a s h e ad e r i n fo rma t i o n a nd i n co r r ec t l y i n te r p r e t s t h e b eg i nn i ng of n o npag ed po o l e Th i s m i s i n t e r p r e t a t i o n w i l l a ppe a r a s s t r uc t u r e s o f UN KN OWN t ype a nd u n u s u a l s i z e s . I n t h i s ex ampl e , t h e pag ed po o l i n i t i al l y has the s t a te sho wn Al l oc a ted b l o c k s o f m em o r y a r e i nd i c a t ed onl y a s t h e to t a l he r e . n um b e r o f b yt e s b e i ng u s e d , i g no r i ng e i th e r the n um b e r o r s i z e o f t h e i nd i v i d ua l d a ta s t r uc t u r e s . MMG $G L PAG E DYN : : . ADDRESS X E XE $G L PAGED : : . ADDRESS . LONG X + 1 76 0 ; L i s t h e ad - 1 7 6 byt e s i n u s e X: X+l 7 6 : X+2 0 8 : X+3 0 4 : X+3 6 8 : X +4 3 2 : UN US E D B LOC K Ne x t S i ze X+3 0 4 32 9 6 b yt e s i n u s e UN US ED B LOC K Ne x t S i ze X+4 3 2 64 6 4 b yt e s i n u s e UNUS E D B LOC K Ne x t S i ze X +4 8 0 : 2 0 8 byt e s i n u s e X +6 8 8 : e tc . F i g u r e 2 5-2 X+6 8 8 48 � J J J ; Ad d r e s s o f n e x t b l oc k ; S i ze o f t h i s b l oc k ; Ad d r e s s o f n e x t b l o c k ; S i ze o f t h i s b l ock ; Ad d r e s s o f n ex t b l o c k ; S i ze of th i s b l o c k ( co n t i nued o n n ex t page ) Ex ampl e s o f Al l oc a t i o n f r om Dyn am i c Memo r y 2 5-3 DYNAM I C M EM ORY A LL OC AT I ON Fo l l owi ng a l l o c a t i o n o f a b l oc k o f 6 4 byt e s { a n e x a c t s t r uc t u r e o f t h e pag ed po til no w l o o k s l i ke th i s . fit) , the f r om l i s t h e ad 1 7 6 byt e s i n u s e �_ _ _ _ UN US ED B LOC K X+l 7 6 : Ne x t S i ze X: __ X+2 0 8 : __ 2 2 4 byt e s i n use X+4 8 0 : 2 0 8 byt e s i n u s e X+6 8 8 : e tc . X+4 3 2 32 I � ; Po i n t e r h a s c hang ed { 2 2 4 =9 6 +6 4 +6 4 ) UNUS E D B LOC K Nex t S i ze X+4 3 2 : __, __ ________ __ __ X+6 8 8 48 - -- If i ns t e ad , an a l l oc a t i o n r eque s t o f 4 8 byt e s wa s m ad e , the f i nal s t a te of the po o l wo u l d look l i k e t h i s . Th e 4 8 byt e s a r e t a k e n f r om the f i r s t empt y b l oc k l a rg e eno ug h to ho l d i t s o the fit is no t exac t . No t i c e tha t a l l oc a t i o n i s d o ne f r om the l ow a d d r e ss e n d o f t h e un used b l oc k . f r om l i s t head X: 1 7 6 byt e s i n us e UN US ED B LOC K Nex t S i ze X+l 76 : X+2 0 8 : 1 4 4 byt e s i n use X+3 6 8 : _J ; Po i n t e r ha s c h a ng ed { 1 4 4 = 9 6 +4 8 ) UNUS E D B LOC K Nex t S i ze X+3 52 : X+3 5 2 32 X+4 3 2 16 - ; B l oc k now b eg i n s h e r e ; S i ze i s now 1 6 byt e s 6 4 byt e s i n u s e UN US E D B LOC K Nex t S i ze X +4 3 2 : X +4 8 0 : 2 0 8 byt e s i n use X +6 8 8 : e tc . F igure 2 5 - 2 { cont . ) X+6 8 8 48 - - E xamp l e s of A l l o c at ion f rom Dynamic Memory 2 5- 4 DYNAM IC MEMORY ALLOCAT ION I n th i s ex ampl e , t h e pag ed po o l i n i t i a l l y h a s the s t a te sho wn here . Th r e e c o n t i g uo us l og i c a l name b l o c k s a r e fo und somewh e r e i n the m i d d l e o f the po o l . Th r e e po s s i b l e ex ampl e s o f d e al l oc a t i o n a r e i l l us t r a t ed b y d e l e t i ng o n e o f the t h r e e l og i c a l nam es . f r om p r ev i o us b l o c k o r f r om l i s th e a d UNUS E D Ne x t S i ze Y: Y+ 6 4 : Lo g i c a l Na m e Bl o c k 48 S i ze Log i c a l Na m e AB C Y+ l l 2 : Lo g i c a l Na m e Bl o c k S i ze 80 Log i c a l Name JKL Y+ l 9 2 : Lo g i c a l Na m e Bl o c k S i ze 64 Log i c a l Na m e XY Z Y+ 2 5 6 : UN US E D Ne x t S i ze Y+2 5 6 64 -...- Y+? ? ? 176 I -... ; Ad d r e s s o f n e x t b l o c k ; S i ze o f t h i s b l o c k ; Ad d r e s s o f n ex t b l o c k ; S i z e o f th i s b l oc k ,� Y+4 3 2 : e t c . I f the l og i c a l name AB C wa s d e l e t ed , t h e i n i t i a l s t r uc t u r e o f t h e po o l wo u l d b e a l t e r ed s o tha t i t l o o k s l i ke th i s . I n th i s c a se , the d e a l l o c a t ed b l o c k i s ad j ac en t to the h i g h add r e s s end o f an unused b l o c k . On l y the s i z e o f t he un used b l o c k i s d i f fe r en t t h a n i t wa s b e fo r e d e a l l oc a t i o n . f r om pr ev i o us b l o c k o r f r om l i s t h e ad UN US E D Ne x t S i ze Y: Y+l l 2 : Lo g i c a l Na me Bl o c k S i ze 80 Log i c a l Name J K L Y+l 9 2 : Lo g i c a l Na m e Bl o c k S i ze 64 Log i c a l Nam e XYZ Y+ 2 5 6 : UN US E D Nex t S i ze Y+2 5 6 112 Y+? ? ? 1 76 Y +4 3 2 : e tc . -- I ; On l y s i ze i s a l t e r ed -,, ( co n ti nued o n n e x t page ) F i g u r e 2 5 - 3 E x ampl es o f De a l l o c a t i o n to Dyn am i c Mem o r y 25-5 DYNAMI C MEMORY ALLOCATION I f t h e l og i c a l name JKL wa s d e l e t ed i n s t e ad , the po o l wo u l d be a l te r ed to the fo rm i l l us t r a t ed h e r e . In th i s c a se , the d e a l l o c a ted b l o c k i s n o t ad j a c en t to an unused b l oc k a t e i th e r end . Th e pr ev i o us po i n t e r m u s t b e a l te r ed t o l oc a t e the n ew unused b l o c k . f r om p r ev i o us b l oc k o r f r om l i s th e ad UN US E D Ne x t S i ze Y: Y+l 1 2 64 Y +6 4 : Lo g i c a l Nam e Bl o c k S i ze 48 Log i c a l Nam e AB C Y+ l l 2 : UN US E D Nex t S i ze Y+l 9 2 : Lo g i c a l Nam e Bl o c k S i ze 64 Lo g i c a l Name XYZ Y+2 5 6 : UN US E D Next S i ze Y+2 5 6 80 Y+? ? ? 176 - I - ; Po i n t e r i s a l te r ed ; No w a n un used b l o c k - ,, Y+4 3 2 : e tc . Fi n a l l y , i f l og i c a l name XY Z wa s d e l e t ed , t h e po o l wo u l d l o o k l i ke th i s . In th i s c a se , the d e a l l o c a ted b l o c k i s a d j a c e n t to the l o w add r e s s e nd o f an u n used b l o c k . Bo t h t h e i n i t i a l ad d r e s s o f t he block a nd i ts s i ze a r e d i ffe r en t than t h e y we r e b e fo r e dea l l oc a t i o n . f r om p r ev i o us b l oc k o r f r om l i s t h e ad UNUS E D Next S i ze Y: Y+l 9 2 64 Y+6 4 : Lo g i c a l Nam e Bl o c k 48 S i ze Log i c a l Nam e AB C Y+l l 2 : Lo g i c a l Nam e B l o c k 80 S i ze Log i c a l Name JKL Y+l 9 2 : UN US E D Nex t S i ze Y+? ? ? 240 I ; Po i n te r h a s c hang ed - ; S i z e ha s c ha ng ed , Y+4 3 2 : e tc . F igure 2 5 -3 - ( cont . ) Examp l e s o f Dea l lo ca t ion to Dynamic Memory 25-6 DYNAMI C M EMORY ALLOCATI ON 25. 1 . 3 Synch r on i za t i o n S o m e me thod i s r e q u i r ed to s yn c h r o n i z e a c c e s s t o the po o l areas to avo id s ev e r a l p r o c e s s e s o r ex e c u t i v e r o u t i n e s s e a r c h i ng o n e of t h e s e l i s t s s i m u l ta neo u s l y . Th e r e i s n o l o c k i ng m e ch a n i sm c u r r e n t l y used f o r e i t h e r the process a l loca t i on r eg i o n o r a ny o f t h e l i s t s ( s uch a s t h e p r o c e s s l og i c a l n am e t a b l e o r the moun ted p r i v a t e v o l um e l i s t ) f o und th e r e . Howev e r , t h e a l l o c a t i on r o u t i n e e x e c u t e s i n k e r n e l mod e a t I PL 2 , e f f e c t i v e l y b l o c k i ng any o the r m a i n l i n e o r AST c o d e f r om e x ec u t i ng a nd pe r h a ps a t tempt i ng a s i m u l t a neo us a l locat ion f r om the p r o c e s s a l l o c a t i o n r eg i o n . Pag ed po o l i s p r o t e c ted by a m u t ex . Be f o r e a b l o c k o f m emo r y is e i th e r a l l o c a ted o r d e a l l o c a t ed f r om the pag ed po o l , t h i s m u t e x , f o und at g l oba l l ab e l E X E $ G L_PG DYNMTX , i s l o c k ed fo r wr i t e a c c e s s . E l eva t ed I PL i s � s e d to c o n t � o l a l l o c a t i o n o f nonpag e d po o l . Th e I PL tha t is used 1 s s to r ed 1n the l ong wo r d immed i a t e l y p r ec ed i ng the ( Ta b l e 2 5 - 1 ) . po i n t e r t o the f i r s t unused b l o c k i n the n on pag ed po o l Th e a l l o c a t i o n r o u t i n e fo r n o n pag e d po o l r a i s e s I PL t o the v a l ue fo und h e r e b e f o r e p r o c e ed i ng . Wh i l e the system i s r un n i ng , thi s l o ng wo rd us ua l l y c o nta i n s an 11. Th e v a l u e o f 1 1 wa s c ho s e n b e c a u s e d ev i c e d r i v e r s r un n i ng a t f o r k l eve l f r eq ue n t l y a l l o c a te d y n am i c s to r ag e a nd I PL 1 1 r e p r e se n t s the h ighest f o r k I PL c u r r en t l y u s ed i n VM S . ( An i m p l i c a t i o n o f th i s s yn c h r o n i z a t i o n I PL v a l ue i s tha t d ev i c e d r i v e r s m u s t n o t a l l o c a t e n o n pag ed po o l wh i l e exe c u t i ng i n r e s po n s e t o a d ev i c e i n t e r r upt . ) D u r i ng i n i t i a l i za t i o n , t h e c o n t e n t s o f t h i s l o ng wo r d are set to 31 b e c a use the r es t o f t h e c o d e i n ! N I T e x ec u t e s a t I PL 3 1 t o b l o c k a l l i n te r r up t s . Ch a ng i ng the c o n t e n t s o f t h i s l o ng wo r d avo i d s l o we r i ng I PL a s a s ide e f f e c t o f a l l o c a t i ng s pa c e f r om no npa g ed po o l . Th e v a l ue i s r e se t to 1 1 a f t e r ! N I T h a s f i n i sh ed i t s a l l o c a t i o n b u t b e f o r e !N I T pa s s e s c on t r o l to t h e s c h ed ul e r . I P L i s a l s o a c o n s i d e r a t i o n fo r d e a l l o c a t i o n o f nonpa g ed po o l , b u t f o r a d i f f e r e n t r e a so n . Al t h o ug h n o n p a g e d poo l c a n be a l l o c a ted f r om fo r k p r o c e s s e s r un n i ng a t I PL l ev e l s u p to I PL 1 1 , i t c a n n o t b e d ea l l o c a t ed as a r e s u l t o f an i n t e r r up t a bove I PL 7 . Th e r e a so n f o r th i s i s t h a t n o n pag ed po o l i s a s ys t em-wi d e r e so u r c e that processes m i ght be wa i t i ng fo r . Th e d e a l l o c a t i o n r o u t i ne n o t i f i e s th e s c h ed u l e r t h a t a r esource i s ava i l ab l e . Th e s c h ed u l e r in turn checks wh e th e r any processes a r e wa i t i ng fo r the n o n pag ed po o l r e so u r c e . Al l o f t h i s s c h ed u l i ng mus t t a k e p l a c e a t I PL$ S YNC H , a nd the i n te r r up t n e s t i ng s c heme r e q u i r e s tha t I PL n ev e r b e lowe r ed b e l o w the I PL v a l ue a t wh i c h t h e c u r r e n t i n t e r r up t o c c u r r ed . Th i s r ul e d i c t a t e s t h a t a l l po o l be d e a l l o c a t ed a t I PL 7 o r l o we r . Th e r e ma y be i n s ta nc e s wh e r e c o d e e x e c u t i ng above I P L 7 mus t use some m e c h an i sm f o r d e a l l o c a t i ng n o npag ed po o l . Ro ut i ne C OM $DRVD EALMEM e x i s ts f o r th i s p u r po s e . Th i s r o u t i n e t a k e s the b l o c k t h a t i s to be d e a l l o c a t ed , t u r n s i t i n to a f o r k b l oc k ( F i g u r e 4 - 2 ) , a nd r eque s t s a n I PL 6 f o r k p r o c e s s . Th e c o d e t h a t exec u t e s a s t h e f o r k p r o c e s s ( th e saved PC i n t h e f o r k b l oc k ) s i mpl y i s s u e s a J M P to EXE $ D EANON PAG E D t o d e a l loca te the bloc k . Ho we v e r , b e c a u s e E XE $D EANON PAG E D i s e n t e r ed at I PL 6 a nd no t a t f o r k I PL , t h e syn ch r o n i zed acc e s s to t h e s c h ed u l e r ' s d a t a b a s e i s p r e s e r v ed . Th i s t ec h n i que i s s i m i l a r to the o n e used by d e v i c e d r i v e r s t h a t n e ed to i n t e r a c t wi th the sched u l e r by d e c l a r i ng ASTs . Th e a t te n t i o n AST m e c h a n i sm i s b r i e f l y d e sc r i b ed i n Ch a p t e r 2 4 a nd d i s c u s s ed i n g r ea t e r d e ta i l i n Ch a p t e r 5 . 25 7 - DYNAM I C MEMORY ALLOCAT ION Table 2 5 - 1 Global L i s theads for Each Poo l Area Poo l Area Global Add ress o f Po i n t e r S i ze Nonpaged Poo l EXE$G L_NONPAG�D 3 longwo rds Sta t i c or Dynam i c ( 1 ) Use o f These F i e l d s l o ngwo rd l o ng wo rd l o ngwo rd Synchron i za t i o n I PL for nonpaged pool a l l oc a t i on Add ress o f nex t ( f i r s t ) free b l oc k Dummy s i ze ( o f ze ro ) fo r l i s thead to speed up a l l oca t i o n rout i n e Dynamic Dynam i c Sta t i c Nonpaged Pool MMG$GL_N PAGEDYN l o ngwo rd Add ress o f poo l a r ea nonpaged Sta t i c Nonpaged Pool EXE $G L_S PLITADR l ongwo rd Add,ress o f bound a r y between g en e r a l nonpaged po o l a r ea and looka s i d e l i st Sta t i c Looka s i d e L i s t IOC$GL_I RPFL l ongwo rd IOC $GL_IRPB L l o ngwo rd EXE $G L_PAGED 2 longwo rds Paged Poo l MMG$G L_PAGEDYN l ong wo rd Process Al l oc a t i o n Reg i o n CTL$G Q_ALLOCREG 2 l o ngwo rds l o ngwo rd l o ngwo rd (2) Dynam i c Dynam i c Add ress o f nex t ( f i r s t ) f r e e b l o c k Dummy s i ze ( o f ze ro ) fo r l i sthead to speed up a l loc a t i on rout i n e Dynam i c Sta t i c Add ress o f beg inn ing o f paged a r ea Sta t i c po o l Add ress of nex t ( f i r s t ) free b l o c k Dummy s i ze ( o f ze ro ) fo r l i sthead to speed up a l loca t i o n rout i n e The r e i s no g lobal po i nter l oc a tes the beg i n n i ng of process a l loc a t i o n reg ion . Process Al loca t i on Reg i o n (1) of Fo rwa rd l i nk fo r l ooka s i d e l i st . IRPs a r e a l loca ted f rom th i s end of the l i s t . Backwa rd l ink f o r l ooka s i d e l i st . IRPs a re d eal loca ted to th i s end of the l i st . l o ngwo rd l o ngwo rd Paged Poo l beg inn i ng Dyn am i c Sta t i c tha t the Sta t i c po inters a r e loaded at i n i t i a l i za t i o n t ime . The contents o f these l oc a t i o ns do no t chang e d u r i ng the l i fe of the s ys tem . Dynam i c po in t e r s gene r a l l y change the i r conten ts each t i me a block is a l l oc a ted f rom or d ea l l oc ated to a po o l a r ea . The synchro n i za t i o n I PL i s changed to 3 1 b y INIT wh i l e i t i s exec ut i ng but, i s reset rema i n s a t that val ue fo r the l i fe o f the sys tem . 25-8 to 11 and (2) DYNAM IC MEMORY ALLOCATI ON 25. 1 . 4 G r a n ul a r i ty o f Al l o c a t i o n Th e a l l o c a t i o n r o u t i n e s fo r bo th pag ed a nd nonpag ed po o l r o und the r eq ue s te d s i ze u p t o t h e n e x t m u l t i pl e o f 1 6 byt e s . Th i s i s d o n e t o i mpo s e a g r a n u l a r i ty o n bo th t h e a l l o c a ted a nd unused a r e a s . Be c a u s e bo th po o l a r e a s a r e i n i t i a l l y pag e a l i g ned , t h i s r o und i ng c a us e s e v e r y s t r uc t u r e a l l o c a t ed f r om o n e o f the two sys t em-wi d e po o l a r e a s t o b e a t l e a s t quadwo r d a l i g n ed . Th e r e i s n o g r a n u l a r i ty i mpo s ed o n the a l l o c a t i o n s i ze fo r t h e p r o c e s s a l loca tion r eg 1 o n . Howev e r , t h e two s t r uc t u r e s a l l o c a ted f r om t h i s po o l b y t h e sys t e m { l og i c a l name b l o c k s fo r proc e s s l og i c a l name s a nd moun ted vo l um e l i s t e n t r i e s fo r p r i v a te v o l umes ) a r e bo th a n i n t e g r a l numbe r o f qua d wo r d s l o ng . Th i s i m p l i e s tha t any b l o c k a l l o c a t ed f r om the process a l l oc a t i on r eg i o n i s qua d wo r d a l i g n ed . I t a l so i m p l i e s tha t the sma l l e s t po s s i b l e s i ze o f a n un a l loc a t ed b l o c k is e ight bytes . Any us e r -wr i t ten p r i v i l eg ed p r og r am tha t a l l o c a t e s s pa c e f r om the p r o c e s s a l l o c a t i o n r eg i o n sho u l d i ns u r e tha t i t r eq ue s t s a n i n teg r a l n um b e r o f q u a d wo r d s t o k e e p th i s r eg i on quadwo r d a l i g ned . 25. 2 PREALLOCATED I /0 REQUES T PACKETS Wh i l e mo s t of the s t r uc t u r e s fo und i n the n o n pag ed po o l a r e a l l o c a t ed a nd d e a l l o c a ted i n f r e que n t l y , I /0 r e que s t pa c ke t s a r e c o n s t a n t l y b e i ng a l l o c a ted a nd d e a l l o c a t ed . To avo i d the o v e rhead o f s e a r c h i ng for blocks o f f r e e m emo r y o f s u f f i c i en t s i z e to a c c ommod a t e I R Ps , a po r t i o n o f the n o npag ed po o l { c a l l ed the l o o k a s i d e l i s t ) i s d ed i c a t e d to the a l locat i on a nd d e a l l o c a t i o n o f I /O r e que s t pa c k e t s a n d any o th e r s t r uc t u r e t h a t is t h e s am e s i z e o r sma l l e r than a n I RP . Spec i f i c a l l y , a t i n i t i a l i z a t i o n t i m e , a pe r c en tag e o f nonpaged po o l { l a r g e eno ug h t o a c c ommod a t e I RPC OUNT I /0 r e que s t pa c k e t s b u t n o t m o r e t h a n h a l f the to t a l spac e ) i s r emoved f r om t h e h i g h a d d r e s s e nd o f t h e po o l a nd pa r t i t i o ned i n to a s e r i e s o f e l em e n t s 9 6 b y t e s l o ng . Th e s e e l emen ts a r e then e n t e r ed i n to a d o ub l y l i n ked l i s t { wi th t h e I N S QU E i n s t r uc t i o n ) so tha t t h e l oo ka s i d e l i s t i s a d o ub l y l i n k e d l i s t o f f i x ed s i z e l i s t e l em e n t s . A s e c ond l o o ka s i d e l i s t h a s b e e n a d d ed to VAX/VMS a s a pa r t o f the Ve r s i o n 2 . 2 b i n a r y upd a t e . Th i s a d d i t i o n i s d e sc r i b ed i n App e nd i x F . 25. 2. 1 Al l o c a t i o n f r om the Loo k a s i d e L i s t Wh e n a r o u t i ne { s uc h a s the $ Q I O s ys tem s e rv i c e ) n e ed s a n I /0 r e qu e s t pac ket , i t s impl y i ssues a REMQUE f r om t h e b eg i nn i ng o f t h i s l i s t { fo und th r o ug h g l ob a l l ab e l I OC $G L I RPF L ) . On l y i f t h e l i s t i s empty { i nd i c a ted b y t h e V-b i t in the PSW s e t ) wo u l d the mo r e g en e r a l a l l oc a t i on r o ut i ne have to b e c a l l ed . Be c a u s e a l l o c a t i o n a nd d ea l loc a t i on f ro m t h e l oo ka s i d e l i s t a r e so m uc h mo r e e f f i c i e n t than t h e g ene r a l r o u t i n e s tha t a l l o w a n y s i z e b l o c k t o b e a l l o c a t e d or d ea l l o c a ted , a s pe c i a l c h e c k i s b u i l t i n to the g en e r a l nonpag e d po o l a l l o c a t i o n r o u t i n e t o d e t e rm i ne wh e th e r the r eque s t e d b l oc k c a n b e a l l o c a t ed f r om t h e l oo ka s i d e l i s t . Th e l og i c o f th i s r o ut i n e i s a pp r o x i m a t e l y t h e fo l l owi ng . 2 5- 9 DYNAM IC MEMORY ALLOCAT ION 1. Th e a l l o c a t i o n s i z e i s r o unded up t o the n e x t m u l t i pl e o f 1 6 . 2. I f the r o un d e d s i z e i s L E QU t h e r o unded s i z e o f a n IRP (96 by t e s ) a nd the l oo k a s i d e l i s t i s no t empty , then the f j r s t I R P i s r emoved f r om t h e l i s t a nd r e t u rned to the c a l l e r . 3. I f the r e qu e s t e d b l o c k i s too l a rg e , o r i f the l o o ka s i d e l i s t is emp t y , t h e n t h e g ene r a l a l l o c a t i o n r o ut i n e i s c a l l ed to s e a r c h f o r the f i r s t f r e e b l oc k l a rg e eno ug h to a c c ommod a t e t h e r e qu e s t . No te tha t b ec a u se a l l o c a t i o n i s d o ne wi th a s i ng l e i n s t r uc t i o n , the r e i s n o n eed fo r a ny o th e r s yn c h r o n i za t i o n than t h a t p r o v i d ed b y t h e REMQUE i n s t r uc t i o n . Th e o th e r c onc e r n o f t h e g e ne r a l a l loca t i on r o u t i ne s , t h e b l o c k g r a nu l a r i t y , i s a l s o i r r e l ev a n t h e r e b e c a u se a l l b l o c ks o n the l oo k a s i d e l i s t a r e the same s i ze . 25. 2. 2 Dea l l oc a t i o n t o the Lo o k a s i d e L i s t Wh e n the r o u t i n e t o d e a l l o c a t e a b l o c k o f n o npag ed po o l i s c a l l ed , it f i r s t c h ec k s wh e th e r the b l o c k wa s a l l o c a t e d f r om t h e m a i n po r t i o n o f the po o l o r f r om t h e l oo k a s i d e l i s t . Th i s c he c k is a c compl i shed by c ompa r i ng the add r e s s o f the b l o c k to b e d e a l l o c a t ed wi th t h e c o n t e n t s o f g l o b a l l o c a t i o n EXE $G L S PL I TADR , wh i c h c o n ta i n s the add r e s s o f the b o und a r y b e twe en the ma i n pa r t o f t h e po o l a nd the l oo ka s i tl e l i s t . Th i s a d d r e s s wa s f i l l ed i n by ! N I T wh en the l o o ka s i d e l i s t wa s i n i t i a l i ze d . F i g u r e 2 5 - 4 s h o ws the r e l a t i o n sh i p o f the l o o ka s i d e l i s t to the r e s t o f n o npag ed po o l . <111�--· : : MMG$GL-NPAGEDYN Rest of Non paged Pool : : EXE$GL-NONPAGED e first unused block ••• : : IOC$GL-IRPFL Lookaslde List Figure 2 5-4 : : IOC$GL-IRPBL P r e a l l o c a ted I /O Re que s t Pac ke t s 2 5-10 DYNAM I C MEMORY ALLOCAT I ON I f the b l o c k wa s o r i g i n a l l y a l l o c a te d f r om the l o o ka s i d e l i s t , it is r e t u r ned the r e b y i n se r t i ng i t a t t h e e nd o f the l i s t ( a t g l o b a l l ab e l I O C $G L I R PB L ) w i t h a n I N S QU E i n s t r uc t i o n . No te th a t b y a l l o c a t i ng pa c k e ts f r om o n e e nd o f t h e l i s t a nd p ut t i ng them bac k a t the o th e r e nd , a t r a n s a c t i o n h i s to r y a s l o ng a s t h e l i s t i t s e l f i s m a i n ta i ned . If t h e b l o c k wa s o r i g i n a l l y a l l o c a t ed f r om the g en e r a l poo l a r ea , t h e g e n e r a l d e a l l o c a t i o n r o u t i n e i s c a l l ed . Th e d i f f e r e nc e s b e twe e n the l o o k a s i d e l i s t a nd the g ene r a l n o npag ed po o l a r e s umma r i z e d i n Ta b l e 2 5 - 2 . Al thoug h the a l l o c a t i o n f r om the l oo ka s i d e l i s t r eq u i r ed no add i t i o n a l synch r o n i z a t i o n i n add i t i o n to the REMQUE i n s t r uc t i o n , d e a l l oc a t i o n m u s t b e d o ne a t I P L 7 o r be l o w f o r the r e a so n a l r e a d y s t a t ed , n am e l y t h a t n o n pag ed po o l i s a r e so u r c e who s e a v a i l a b i l i ty m u s t b e r epo r t ed to t h e s c h ed u l e r wh o wi l l e l ev a t e I PL to 7. Al l d ea l l o c a t i o n to n o n pag ed po o l i s d one t h r o ug h t h e r o u t i n e E XE $ DEANON PAG E D , wh i c h sho u l d n o t b e c a l l ed a bove I P L 7 . 25. 3 U S E OF DYNAMI C M EMORY A l mo s t a l l o f t h e d a ta s t r uc t u r e s tha t a r e d yn am i c a l l y c o n f i g u r ed are pl a c ed i n e i th e r the n o npag ed o r pag ed poo l a r e a s . On l y t h e PFN d a ta b a s e , t h e g l o b a l a nd s ys t em pag e t ab l e s , t h e sys t em h e ad e r , a nd the i n t e r r up t s ta c k h av e s e pa r a t e v i r t u a l add r e s s spa c e a l l o c a t e d . Mo s t pe r - p r o c e s s d a t a s t r uc t u r e s , o n the o th e r hand , a r e a s s i g ne d to d ed i c a t ed a r ea s o f Pl s pa c e , as d e f i ned in t h e mod u l e S H E L L a nd i l l us t r a ted i n F i g u r e 1 - 7 a nd l i s t ed i n Ta b l e E - 4 . One pe r - p r o c e s s d a ta s t r uc t u r e , t h e p r o c e s s h e ad e r , r e s i d e s i n t h e a r e a o f s ys t em s pa c e c a l l ed t h e b a l a nc e s l o t a r e a . 25. 3 . 1 P r o c e s s Al l o c a t i o n Reg i o n Th e p r o c e s s a l l o c a t i o n r eg i o n i s c u r r en t l y 4 6 pag e s l o ng . I t s s i ze i s f i x ed b y a n a s semb l y t i m e pa r am e t e r i n mod u l e S H E LL . I t s p r o tec t i on i s s e t to UREW . Th a t i s , i t c an be w r i t te n f r om e x e c u t i v e a nd ke rnel mod e s a nd r ead f r om a ny a c c e s s mod e . On l y t h e p r o c e s s l og i c a l name t ab l e a nd the m o un ted vo l um e l i s t fo r p r i va te vo l um e s a r e f o un d in t h e p r o c e s s a l l oc a t i o n r eg i o n . Th e r e is e no ugh r o om i n the p r oc e s s a l l o c a t i o n r eg i o n f o r p r i v i l eg ed a pp l i c a t i o n s o f t wa r e t o a l l o c a t e r e a s o na b l y s i ze d p r o c e s s - s p e c i f i c d a ta s t r uc t u r e s . 25. 3.2 Pag ed Dynam i c Memo r y S e v e r a l d a ta s t r uc t u r e s a r e l o c a t ed i n the pag ed po o l a r e a . • • Bo th t h e g r o up a nd th e r e . s ys t em l og i c a l name tabl es are fo und G l o b a l s e c t i o n d e sc r i p to r s , r e qu i r ed o n l y wh e n a se c t i o n m a pped o r unmapped , a r e a l s o l o c a ted i n pag ed po o l . 2 5-1 1 is Tabl e 2 5 - 2 Compari son o f D i f f erent Poo l Are a s Poo l Area Al l oc a t i on Qua n t um Type of Li s t ( No te s 1 a nd 2 ) Synchron i za t i o n Techn i que Typi c a l St r uc tu r e s Al loc a ted He r e Nonpag ed Poo l 1 6 byt e s Va r i a b l e s i ze ( No t e 1 ) El evated I PL B u f f e r ed I /0 b u f f e r (GTRU 96 byt e s ) Dr i v e r Prolog ue Tab l e ( D r i v e r S t r uc tu r e ) Job In fo rma t i o n Block Netwo r k Da ta St r uc tu r e s Process Con t r o l Bl oc k Pr ocess Quo ta Bl ock Un i t Con t r o l Block ( D r iver St r uc tu r e ) Loo ka s i d e Li st 9 6 byte s Fi x ed s i ze b l oc ks ( 9 6 byt e s ) ( No te 2 ) No ne requ i red Bu f fe r ed I /0 b u f f e r ( LE QU 96 byte s ) Channel Request B l o c k (Dr iver St r uc tu r e ) Common Event Bl o c k Dev i c e Da ta Block ( D r i v e r St r uc tu r e ) Fi l e Co ntrol Bl ock I /0 Request Pac k e t Inte r r upt Di s pa tch Bl oc k ( D r iver St r uc t ur e ) Timer Queue El ement Vo l um e Con t r o l Bl ock Wi ndow Co ntrol Bl ock Pag ed Pool 16 byt e s Va r i abl e s i ze ( No t e 1 ) Mutex Global Sec t i o n De sc r i pto r s Known Fi l e En t r i e s Known Fi l e Head e r s Log i c a l Nam e Bl oc ks fo r g ro up and system log i c a l names Mo un ted Vo l ume L i s t En t r y fo r vol um e s mounted /SYSTEM o r /GROUP Process Al l oc a t i o n Reg ion none Va r i abl e s i ze ( No t e 1 ) Acc e s s mode Log i c a l Nam e Blocks fo r process l og i c a l names Mo un ted Vo l ume Li st En t r y fo r pr i v a te v o l um e s ( /S HARE OR /NOSHARE ) (1) The l oo ka s i d e l i st has e x t r emel y e f f i c i en t ( s i ng l e i n s t r uc ti o n ) a l l o c a t i o n and d ea l l oc a t i o n r o ut i nes . Bec ause the b l o c ks a r e f i x ed s i ze , i n te rnal f r agmenta t io n ( un us ed spa c e wi thi n ind i v i d ua l bl oc k s ) can resul t . (2) The g e n e r a l poo l a reas a l l o w v a r i a b l e s i zed al l oc a t i o n r eque s t s ( and conta i n v a r i a b l e s i zed empty a r ea s ) . The a l l o c a t i o n and d eal l oc a t i o n r o ut i n e s must search a t l ea s t a po r t i o n o f the empty l i st . Ex te r nal f r agmenta t i o n ( un used blocks equa l to the a l l oc a t i o n qua n t um ) near the beg i nn i ng o f the l i s t can r es u l t from th i s type o f a l l o c a t i o n scheme . DYNAM I C MEMORY ALLOCAT ION • Th e I N S TALL u t i l i ty a l l o c a t e s the d a ta s t r uc t u r e s r equ i r ed to d e s c r i be k n o wn i m a g e s f r om pag e d d yn am i c memo r y . An y i m ag e th a t i s i n s t a l l ed h a s a known f i l e en t r y c r e a t ed t o d e sc r i b e it. Some f r e que n t l y a c c e s s ed known i m ag e s a l so have the i r imag e h e ad e r s p e rma n e n t l y resident . Th e s e d a ta s t r uc t u r e s a r e d e sc r i b ed i n mo r e d e ta i l i n Ch a p t e r 1 8 . • F i n a l l y , t h e mo u n t ed vo l ume l i s t fo r vo l um e s th a t a r e among s eve r a l p r o c e s s e s i s f o und i n pag ed po o l . s h a r ed Th e s i z e o f pag ed d yn am i c m emo r y i s d e te rm i ned by the S Y S B OO T pa r am e t e r PAG E DYN . I t s p r o t e c t i o n i s s e t to URKW . Th e pag e s o f pag ed d yn a m i c m em o r y u s ed by RMS f o r the sha r ed f i l e d a ta base have the i r p r o t e c t i o n a l t e r ed to EW ( e i th e r r e ad o r wr i t e a c c e s s f r om ex e c u t i v e o r k e r n e l mod e ) by RM SSHARE , the i m ag e tha t e x e c u t e s a s pa r t o f STARTU P . C OM to i n i t i a l i ze the s h a r ed f i l e d a ta b a s e . 25. 3 . 3 Nonpaged Dyn am i c Memo ry No n pa g ed po o l s e rv e s s e v e r a l p u r po s e s . At i n i t i a l i z a t i o n t i me , data s t r uc t u r e s wh o s e s i ze a nd c o n t e n t s d epe nd on SYSB OOT pa r am e t e r s wi l l b e a l l o c a t ed f r om n o npag ed po o l a nd i n i t i a l i z ed . Th e s e s t r uc t u r e s i nc l ud e t h e P C B v e c to r a nd s eque n c e v e c to r , t h e swa ppe r ' s I / 0 pag e t a b l e , t h e pag e f i l e b i tm a p , mod i f i ed pag e wr i te r a r r a ys , a nd the ada pte r c on t r o l b l o c k s f o r a l l e x t e r n a l a d a p t e r s l o c a ted at boo t s t r a p t i me . The d e t a i l ed use of n o npag ed po o l by t h e ini tial i zat ion r o u t i n e s i s d e s c r i b ed i n Ch a p t e r 2 2 . A s e c ond g e ne r a l somewh a t s ta t i c u s e o f n o n pag ed po o l i s t o conta i n d ev i c e d r i v e r c od e a nd a s so c i a t ed d a t a s t r uc t u r e s fo r a l l d ev i c e s tha t a r e e i th e r l o c a t ed t h r o ug h t h e a u to c o n f i g u r e pha s e o f SYSGEN o r a re expl i c i t l y l o ad ed w i th a LOAD o r C ONNECT S YSGEN c ommand . Th e d e t a i l s o f t h e s e s t r uc t u r e s a r e d e sc r i b ed i n the VAX/VMS Gu i d e to Wr i t i ng a Dev i c e D r i ve r . Th e r e a r e m a n y d a ta s t r uc t u r e s tha t a r e a l l o c a t ed d yn am i c a l l y f r om Ta b l e 2 5 - 2 c o n t a i n s a r e p r e s e n t a t i v e l i s t o f i t ems no n pag ed po o l . c o n t a i n e d the r e . Wh i l e t h i s l i s t i s not e x h a u s t i v e , i t g i v e s a n idea o f t h e many s t r uc t u r e s that a r e c o n s t a n t l y b e i ng a l l o c a t e d and d e a l l o c a t ed . Th e s i ze o f n o n pag ed d yn am i c memo r y , i nc l ud i ng the a rea d ev o t ed t o the l oo k a s i d e l i s t , i s d e te rm i n ed b y t h e SYS B OO T pa r am e t e r N PAG E DYN . Th e f r ac t i o n o f t h i s s pa c e tha t i s d ed i c a t e d to the l o o ka s i d e l i s t is d e t e rm i n ed by t h e SYS B OOT pa r am e te r I R PC OUNT ( an d Th e impl i c i t l y by t h e r o und ed s i z e o f a n I RP , c u r r en t l y 9 6 b y t e s ) . pag e p r o tec t i o n o f b o th t h e l oo k a s i d e l i s t a nd the g en e r a l n o n pag ed po o l a r e a is set to ERKW . 2 5- 1 3 C HAPTER 2 6 LOG I CAL NAMES Log i c a l n am e s prov i d e a po we r f u l to o l fo r a s i ng l e pr o c e s s o r seve r a l processes t o u s e a s a c ommun i c a t i o n t o o l . Log i c a l nam e s a l s o a l l o w t h e s ys tem a n d a pp l i c a t i o n p r og r am s to i m pl eme n t a t r a n s pa r en t fo rm o f d ev i c e i nd e pe nd e nc e a nd I /O r e d i r ec t i o n . Th i s c h a pt e r d e s c r i b e s the i n t e r n a l impl em e n ta t i o n of l og i c a l nam e s . 26. 1 LOG ICAL NAME TABL E S Wh e n a l og i c a l name is c r ea t ed , the l og i c a l name s t r i ng a nd i ts e qu i v a l e n c e n ame s t r i ng a r e p u t i n to a d a ta s t r uc t u r e c a l l ed a l og i c a l name b l oc k . Th i s s t r uc t u r e i s then i n s e r t ed i n to o n e o f th r e e d o ub l y l i nked l i s ts , d e pend i ng o n wh e th e r the l og i c a l name i s b e i ng i n se r ted i n to the p r o c e s s , g r o up , or s ys t em l og i c a l name t a b l e . Th e p r oc e s s l og i c a l name t a b l e i s l o c a ted i n the p r o c e s s a l l o c a t i o n r eg i o n i n P l s p a c e . Th e g r oup a nd s ys tem l og i c a l name t a b l e s a r e bo th al l o c a ted f r om pag e d d y n am i c memo r y . Th e l i s the ad s fo r the th r e e tables a re l o c a ted t h r o ug h t h e l o ng wo r d a r r a y a t g l obal l oc a t i o n LOG $AL L OGTBL . Ea c h o f t h e l o ngwo r d s i n t h i s a r r a y po i n t s to the q ua d word l i s t h e ad fo r one of t h e th r e e l og i c a l nam e t a b l e s . Th e th r e e l og i c a l n ame t ab l e s a nd t h e i r l i s t h e a d s a r e p i c t u r ed i n F i g u r e 2 6 - 1 . 26. 1 . 1 Log i c a l Name B l o c k Th e c o n t e n t s o f a l og i c a l name block a r e p i c tur ed in Figure 2 6- 2 . Bo th the l og i c a l n am e a nd the e q u i v a l e nc e n am e m a y be up to 6 3 c h a r a c t e r s i n l eng th . B e fo r e t h e m emo r y b l oc k i s a l l o c a t e d , t h e s i ze r eq u i r ed f o r the s um o f the two s t r i ng s p l us the f i x ed s i z e i s r o und ed up to the n ex t qua d wo r d so t h a t , a l tho ug h l og i c a l name b l o c k s a re o f v a r i ab l e l eng th , t h ey a r e a l wa ys a n i n teg r a l numbe r o f qua d wo r d s i n l e ng th . Th e a c c e s s m o d e f i e l d i s o n l y u s e d wh e n a l og i c a l name b l o c k a ppe a r s in the proc e s s l og i c a l n am e t a b l e . Wh e n a proc e s s l og i c a l name i s c r e a t ed , i t s l og i c a l name b l oc k i s i n s e r ted i n to the process l og i c a l name t a b l e i n o rde r o f d ec r e a s i ng a c c e s s mo d e . I n o the r wo r d s , a u s e r m o d e l og i c a l name XYZ a ppe a r s i n t h e l i s t b e f o r e a s upe r v i s o r mod e l og i c a l n ame XYZ . Wh e n l og i c a l n am e XY Z i s t r a n s l a t ed , t h e us e r mod e e q u i va l e n c e n ame i s r e t u r ned . 26-1 LOG I CAL NAMES LOG$ALLOGTBL: : Array of Logical Name Table Listhead Pointers LOG$GLGLTFL: � ::_-__ .. � ==== Group Logical Name Table LOG$GLGLTBL: Group Logical Name Table Listhead LOG$GLSLTFL: : .. � ::::== System Logical Name Table LOG$GLSLTBL: System Logical Name Table Listhead (defined in module SYSCOMMON) CTL$GLPLTFL: : System Space System Space (Paged Dynamic Memory) P1 Space (P1 Pointer Page) P1 Space (Process Allocation Region) • 4 r-------�--�� � ==== Process Logical Name Table CTL$GLPLTBL: : Process Logical Name Table Llsthead (defined In module SHELL) F igure 2 6 - 1 Glob a l L i stheads for Log i c a l Name Tab l e s 26-2 .. � ------- LOG I CAL NAM E S Logical Name Table Forward Link Logical Name Table Backward Link Table [X Type Size Access Mode Creator's Group Mailbox UCB Address Logical Name String �� count (up to 63 characters) �� Equivalence Name String .... L,., count ':' "' ( u p to 63 characters Table N umber Table 0 System Name Table Group Name Table Process Name Table 2 Figure 2 6 -2 Log i c a l Name B l o c k Th e g r oup f i e l d i s o n l y r e l ev a n t wh en the l og i c a l name b l o c k a ppe a r s i n the g r o up l og i c a l name t a b l e . Th e r e i s o n l y o n e g r o up l og i c a l name t ab l e fo r the e n t i r e s ys t em a nd a l l g r oup l og i c a l name b l o c k s a r e pl a c ed i n to th i s l i st . An o pe r a t i o n tha t s e a r c h e s the g r o up l og i c a l name t ab l e l oo k s fo r a m a tch b e twe en the g ro up cod e in the l �g i c a l name b l o c k a nd t h e g r o up n umbe r o f t h e c a l l e r o f the sys tem se r v i c e . Th e a s s o c i a t ed m a i l bo x f i e l d i s u s ed wh en the l og i c a l name i s c r e a t ed as a pa r t o f ma i l bo x c r e a t i o n . In add i t i o n , the MOUNT u t i l i ty u s e s th i s f i e l d wh en i t c r e a t e s a l og i c a l n a m e i n c o n n e c t i o n wi th mo un t i ng a vo l ume . 26 . 2 LOG I CAL NAME SYSTEM S ERVI C E S Th e r e a r e th r e e s ys t em s e rv i c e s ava i l a b l e fo r l og i c a l n am e man i pu l a t i o n . Log i c a l n am e s c a n b e c r e a t ed , t r an s l a t ed , o r d e l e t ed . Pr i v i l eg e s c o n t r o l a c c e s s to b o th the g ro up a nd sys tem l og i c a l n am e tabl es . B e fo r e d i sc u s s i ng t h e i nd i v i d u a l s e r v i c e s , s ome c h e c k s t h a t a r e c ommo n to m o r e than o ne o f the s e rv i c e s a r e d e sc r i b ed . 2 6-3 LOG I CAL NAM E S 26 . 2 . 1 P r i v i l eg e a nd P r o tec t i o n Ch e c k s L i k e a n y o the r s ys t em s e rv i c e s t h a t u s e a c c e s s mod e a s a n a rg um en t , t h e l og i c a l name sys t e m s e rv i c e s c a l l the r o ut i n e EXE $ MAXACMODE t o m a x i m i z e the m o d e p a s s ed a s a n a rg um e n t w i th t h e a c c e s s mod e of the ( f o und i n the p r ev i o u s m o d e f i e l d o f t h e PS L ) . A p r o c e s s th a t caller wi s h e s to c r e a t e o r d e l e te a g ro up o r s ys t em l og i c a l name m u s t h a v e t h e a p p r o p r i a t e p r i v i l eg e , GRPNAM o r SYSNAM r e spec t i ve l y . Seve r a l a c c e s s c h ec k s m u s t b e mad e b y the s e s e rv i c es . Because a l l th r e e s e r v i c e s p a s s a t l e a s t o ne s t r i ng d e sc r i pto r a s a n a rg um e n t ( C r e a t e Log i c a l Name h a s two ) , t h e r ead a c c e s s i b i l i ty o f bo th t h e s t r i ng d e sc r i p to r a nd the s t r i ng mus t b e c h e c ked . T r a n s l a te Log i c a l Name m u s t c hec k w r i te a c c e s s i b i l i ty o f the a rg um e n t s th a t a r e used to pa s s i n fo rma t i o n b a c k to the c a l l e r . 26 . 2 . 2 Log i c a l Name Tab l e Mute x e s Bo th t h e g r o up a nd s y s t e m l og i c a l n am e t ab l e s a r e p r o t e c ted f r om s imul t aneous a cc e ss by m u t e x e s ( Ch a pt e r 2 4 ) . The Tr a n s l a te Log i c a l Name sys tem s e rv i c e l o c k s t h e t ab l e tha t i s c u r r e n t l y b e i ng sea rched fo r r e ad access . Th i s d o e s n o t p r ev e n t o th e r p r o c e s s e s f r om r e ad i ng Log i c a l ( t r a n s l a t i ng ) l og i c a l nam e s i n the s am e l og i c a l name tabl e . name c r e a t i o n a nd d e l e t i o n b o th r e q u i r e tha t the t a b l e b e i ng mod i f i ed b e l o c k ed f o r wr i t e a c c e s s . Th i s p r ev e n t s o th e r p r o c e s s e s f r om e v e n r e a d i ng the l oc k e d tab l e wh i l e the t a b l e i s b e i ng mod i f i ed . 26 . 2 . 3 Log i c a l Name C r e a t i on Af t e r the p r e l i m i n a r y c h e c k s h a v e b e e n ma d e , t h e C r e a t e Log i c a l Name s ys t em s e rv i c e a l l o c a t e s a b l o c k of m emo r y fo r the l og i c a l name b l o c k . Th e b l o c k i s a l l o c a t e d f r om t h e p r o c e s s a l l o c a t i o n r eg i o n f o r proc e s s l og i c a l n am e s a nd f r om p a g e d d yn am i c memo ry fo r g ro up a nd sys t em l o g i c a l n am e s . Th e s i z e o f t h e b l o c k i s the s um o f the l eng ths o f t h e l og i c a l a nd e qu i v a l e n c e s t r i ng s p l u s the s i ze o f the c o n s t a n t pa r t o f a l og i c a l name b l o c k . B e fo r e t h e a l l o c a t i o n r o u t i n e is c a l l ed , the s i ze i s r o und e d to a n i n teg r a l n um b e r o f qua d wo r d s . Af t e r a l l the pa r am e t e r s h a v e b e e n p l a c ed i n to the a l l o c a ted b l o c k , i t is i n s e r t ed i n to the a pp r o p r i a t e t ab l e , u s ua l l y a t the end . I f an i d en t i c a l l og i c a l n a m e a l r e a d y e x i s t s , the o l d n am e i s f i r s t d e l e t ed a nd the s ta t u s o f S S $ S U PE R S EDE i s r e t ur ned to the c a l l e r . I f the l og i c a l n ame is b e i ng p u t- i n to the p r o c e s s l og i c a l name t a b l e a nd an i d en t i c a l n a m e i s fo und wi th a d i f f e r e n t a c c e s s mo d e , the l og i c a l name b l oc k i s i n s e r t e d i n to the t ab l e i n s uc h a wa y as to pl a c e the h i g h e s t ( l e a s t pr i v i l eg ed ) a c c e s s m o d e c l o s e s t to t h e b eg i nn i ng o f the tab l e . 26. 2. 4 Log i c a l Name De l e t i o n Af t e r the u s ua l s e t o f p r i v i l eg e a nd p r o tec t i o n c h e c k s a r e pe r f o rmed , t h e De l e te Log i c a l Nam e s ys tem s e rv i c e chec k s wh e th e r th i s o pe r a t i o n If all sys t e m i s d e l e t i ng a s i ng l e l og i c a l name o r a g r oup o f n am e s . n am e s a r e to b e d e l e t ed , they a r e . I f a l l g r o up n am e s a r e to b e d e l e te d , t ho s e l og i c a l n am e s tha t h a v e the s ame g r o up c o d e as the caller a r e d e l e t ed . If all p r o c e s s n am e s a r e to b e d e l e te d , a l l 2 6- 4 LOG I CAL NAMES l og i c a l n ame s f o r t h e spec i f i ed a c c e s s mode a nd a c c e s s m o d e s a r e d e l e t ed . all l ess p r i v i l eg ed Th e d e l e t i o n o f a s i ng l e l og i c a l n ame r e q u i r e s tha t the a pp r o p r i a t e t ab l e b e s e a r ch ed . I f the l og i c a l n ame i s i n the p r o c e s s t a b l e , a n a c c e s s m o d e c h e c k i s pe r f o rm ed . Th e a c t ua l d e l e t i o n o pe r a t i o n fi rst r emoves the l og i c a l name b l o c k f r om the l i s t , c l e a r s the UC B $ L LOGADR f i e l d i n a n a s s o c i a t ed UCB i f t h e L OG $ L MBXUCB in the l og i c a l f Te l d i s nonze r o , a nd f i na l l y d e a l l o c a t e s t h e bl o c k t o the a pp r o p r i a t e m emo r y po o l . 26. 2. 5 Log i c a l Name T r a n s l a t i o n Log i c a l n ame t r an s l a t i o n h a s s ev e r a l s pe c i a l opt i o n s t h a t i t mus t c h ec k fo r i n a d d i t i o n to the usua l p r i v i l eg e a nd p r o t e c t i o n c h e c k s . I f the l og i c a l name b eg i n s w i th the und e r s c o r e cha r a c t e r ( ) , t h e n the e qu i v a l e n c e s t r i ng that i s r e t u r ned i s s i mpl y the l og i c a l -name s t r i ng wi th the und e r s c o r e r emoved . I n ad d i t i o n , t h e c a l l e r c a n spec i f y t h a t the s e a r c h o n l y o c c u r i n some o f t h e t a b l e s . As s um i ng t h a t none o f the t ab l e s h a s b e en e l i m i n a t ed , the se r v i c e s e a r c h e s f o r a m a t c h i n f i r s t t h e p r o c e s s t a b l e , then the g r o up t a b l e , a nd f i n a l l y t h e s ys t em t a b l e . Th e r e i s n o a c c e s s mod e c h e c k m a d e fo r the proc ess tab l e . I f a p r o c e s s h a s the same l og i c a l name w i th mo r e t h a n o n e a c c e s s mod e , t h e n a m e a s so c i a t ed w i th t h e l e a s t pr i v i l eg ed ( l a r g e s t ) a c c e s s m o d e i s r e t u r n ed . Th e s e a r c h of the g r o up t a b l e d o e s r e q u i r e t h a t t h e g r o up n umbe r s m a tc h . As e a c h l o g i c a l name b l o c k i s p r o c e s s ed , a c h ec k i s f i r s t mad e to see if the s t r i ng l eng t h s o f the l og i c a l n a m e b e i ng s e a r c hed fo r a nd the l og i c a l n am e i n the b l oc k a r e i d e n t i c a l . If they a r e no t , th i s b l o c k i s pa s s ed ove r a nd t h e s e a r c h c o n t i n ue s wi tho ut the c o s t l y ove r h e a d o f a CMPC i n s t r uc t i o n t h a t i s b o und t o f a i l . 2 6- 5 CHAPTER 2 7 M I SCE LLANEOUS SYSTEM SERVI CES Th i s c h a p t e r i nc l ud e s b r i e f d i s c u s s i o n s of the s ys tem se rv i c es not in the p r ev i o u s c h a p t e r s . Th e s e s e r v i c e s d o n o t g e n e r a l l y m e n t i o n ed _ma k e i n t e n s i v e u s e o f the i n t e r n a l s t r uc t u r e s and m e c h a n i sm s o f VM S . De t a i l ed d i sc u s s i o n s o f t h e a rg um e n t s , r e t u r n s t a tus cod e s , r e q u i r ed p r o c e s s p r i v i l eg e s , a nd sys tem s e rv i c e o p t i o n s c a n be fo und in the VAX/VMS S y s t em Se r v i c e s Re f e r enc e Ma n ua l . 27 . 1 COMMUN ICAT I ON W I TH SYS TEM PROC ES S E S Some of t h e o pe r a t i o n s o f t e n a s s o c i a t ed wi th an o pe r a t i ng sys tem are pe r f o rmed i n VAX/VM S b y i nd e pend e n t n o rm a l pro c e s s e s , r a the r th a n by code in t h e l i n ked sys tem i m ag e . Ex am p l e s of th i s type of s y s t em a c t i v i ty i n c l ud e • g a th e r i ng o f a c c o un t i n g i n fo rm a t i o n abo u t ut i l i z a t i o n o f s ys tem r e s o u r c e s , • manag i ng pr i n t and b a t c h j o b s a nd queue s , • c ommun i c a t i ng w i th o n e o r mo r e sys t em o pe r a to r s , a nd • r e po r t i ng d ev i c e e r r o r s . Fo u r s ys tem s e rv i c e s a r e d e f i ned i n the mod u l e SYS SNDM SG c ommun i c a t i o n s wi t h t h e a pp r o p r i a t e sys tem p r o c e s s e s . 27 . 1 . 1 Ac c o un t i ng Ma n ag e r to the prov i d e ( Jo b Co n t ro l l e r ) The a c c o un t i ng m a n ag e r i s a pa r t o f the j ob contro l l er ( pr o c ess J O B C ONTRO L r un n i ng imag e J O B C T L . E XE ) . It is r e s po n s i b l e fo r r e co rd i ng the u t i l i z a t i o n o f s y s tem r e so u r c e s i n the a c c o un t i ng f i l e . Re que s t s to the a c c o un t i ng m a n ag e r are sent th r o ug h the j ob c o n t r o l l e r ' s ma i l box by t h e $ S NDACC s ys tem s e rv i c e . E x p l i c i t $ SNDACC r e que s t s c a n b e i s s ued by u s e r s t o r eque s t a c t i o n s no rma l l y a v a i l a b l e t h r o ug h the S E T ACC OUNT I NG c omma nd . 2 7-1 M I S C E L LANEOUS SYSTEM S E RVI C E S Th e $ SNDACC s ys tem s e r v i c e r o u t i ne pe r fo rms t h e fo l l o w i ng ope r a t i o ns . 1. Th e me s s a g e t yp e i s d e f i n ed a s MSG $ SNDACC a n d th e m a i l bo x i s d e f i ne d a s t h e j ob c o nt r o l l e r ' s m a i l bo x d e f i n ed i n mo d u l e DEVI C EDAT) t a rg e t ( MBAl : , • 2. Th e r e que s t i s c h e c k e d fo r po s s i b l e e r r o r s s uc h a s t o o l a rg e a m e s s ag e , i n s u f f i c i e n t p r i v i l eg e s , o r a c c e s s v i o l a t i o n s . 3. Th e me s s a g e b u f fe t i s a l l o c a t e d o n t h e c u r r e n t s t a c k e x e c u t i v e mod e s t a c k ) , a nd the b u f f e r i s f i l l ed wi th • • 4. 27 . 1 . 2 ( th e the me s s ag e type , the r ep l y m a i l bo x c h a nn e l a rg um e n t ) , ( i f spec i f i ed as an opt i onal • the p r i v i l eg e m a s k , U IC , u s e r n am e , a n d a c c o un t n am e , • the p r o c e s s b a s e p r i o r i t y ( Ch a pt e r 8 ) , a n d • the u s e r -d e f i ned m e s s a g e t ex t ( a r e qu i r ed a rg um e n t ) . Th e me s s ag e i s wr i t te n k e r ne l m od e . Symb i on t Ma nag e r to the m a i l bo x a f te r c h a ng i ng to ( Jo b Co n t r o l l e r ) Th e s ym b i o n t manag e r i s a l s o pa r t o f t h e j ob c o n t r o l l e r p r o c e s s . It is r e s po n s i b l e fo r t r a n s a c t i o n s t o and f r om the q u e ue f i l e i nc l ud i ng t h e c r e a t i o n and d i s pa t c h i ng o f b a tc h a nd p r i n t que u e s a nd j o b s . Re que s t s to the sym b i o n t m a n ag e r a r e sent to the j ob contro l l e r ' s ma i l bo x b y the $ SNDSMB s y s tem s e rv i c e . Expl i c i t $ SNDSMB r e que s t s c a n b e i s s ued by use r s to r e que s t a c t i o n s n o rm a l l y ava i l a b l e th r o ug h the f o l l o w i ng DC L c omma nd s : S ET DEVI C E/ S POOLED S E T QUEUE S TART/QUEUE S T O P/ABORT S T O P/QUEUE S T O P/REQUEUE S UBM I T AS S IGN/MERGE AS S IGN/QUE UE DEAS S I GN/Q U E U E DE LETE/ENTRY DE LETE/QU E UE I N I T I ALI Z E/QUEUE PR INT Th e $ S NDSMB sys tem s e rv i c e pe r fo rms e x a c t l y t h e s am e o pe r a t i o n s ( c ommon c od e ) as the $ SNDAC C s ys tem s e rv i c e ( a s d e s c r i b ed i n the p r ev i o u s s e c t i o n ) , e x c e p t tha t the m e s s ag e type is d e f i ne d to b e MSG $ S NDSMB . 27-2 M I SC E LLANEOUS SYS TEM S E RVI CES 27 . 1 . 3 Ope r a to r Commun i c a t i on s Ope r a to r c ommun i c a t i o n s a r e h a nd l ed b y a s y s t em p r o c e s s ( p r o c e s s O PC OM r un n i ng i m a g e O PC OM . EXE ) . O PC OM h a s the r e s po n s i b i l i t i e s o f • d e f i n i ng wh i c h t e rm i n a l s a r e o pe r a to r t e rm i n a l s a n d fo r wh a t cl ass of a c t i v i ty ( s uch a s d i s k o r t a pe o pe r a t i o n s ) th e s e t e rm i n a l s w i l l r e c e i v e m e s s a g e s , • r e p l y i ng t o o r c a n c e l i ng a u s e r r eque s t to a n ope r a to r , a nd • m a n a g i ng t h e o pe r a to r l og f i l e . Re qu e s t s to O PC OM a r e s e n t t h r o ugh O PC OM ' s m a i l bo x b y t h e $ S NDO PR s y s tem s e rv i c e . E x p l i c i t $ S NDOPR r e que s t s c a n be i s s ued by u s e r s t o r eq ue s t a c t i o n s n o rma l l y a va i l a b l e th r o ugh th e D C L us e r c ommand REQUEST a nd the ope r a to r c omma nd RE PLY . Wi t h e x c e p t i o n s o f a d i f f e r e n t m a i l bo x ( MBA2 : , d e f i ned i n the mod u l e DEVI C EDAT ) a nd a d i f f e r e n t m e s sag e t ype ( MSG $ O PRQS T ) , $ S NDO PR s h a r e s c ommo n c o d e wi t h $ SNDACC a nd $ S NDSMB ( d e s c r i b ed i n S e c t i o n 2 7 . 1 . 1 ) . E r r o r Log g e r 27 . 1 . 4 A s d e sc r i b ed i n Ch a pt e r 7 , t h e e r r o r three pi eces . • • • l og g i ng s ub s ys t em cons i s ts of Th e ke r n e l i t s e l f c o n t a i n s r o u t i n e s tha t m a i n t a i n a set o f e r r o r m e s s ag e b u f f e r s . Th e s e r o u t i n e s a r e c a l l ed b y t h e k e r n e l a nd d ev i c e d r i v e r s i n o rd e r th a t e r r o r m e s s a g e s c a n b e wr i t t e n to some a v a i l a b l e spa c e i n o n e o f t h e s e b u f f e r s . Th e e r r o r f o rma t t i ng p r o c e s s ( pr o c e s s ERRFMT r un n i ng i mag e E RRFMT . EXE ) i s a wa k e n ed wh e n it i s n ec e s s a r y t o c o py t h e f o rma t t ed c o n t e n t s o f t h e s e e r r o r message b u f fe r s to the e r r o r l og f i l e f o r s u b s e q ue n t a n a l ys i s . Th e SYE p r o g r am r e a d s the e r r o r m e s sa g e s in the e r r o r l og f i l e a nd p r od uc e s a n e r r o r l og r e po r t , b a s e d on the c o n t e n t s o f t h e e r r o r l og f i l e a nd t h e o p t i o n s s e l e c ted wh e n S Y E wa s r un . No rma l i n t e r a c t i o n s wi th t h e e r r o r l og g i ng rout ines i n the k e rne l occur i n d ev i c e d r i v e r s b y i s s u i ng d ev i c e e r r o r o r d ev i c e t i m e o u t r e que s t s . Us e r s c a n a l s o s e nd m e s sag e s to the e r ro r l og g e r ( pu t me s s ag e s i n to o ne o f the e r r o r m e s sag e b u f f e r s ) fo r l a t e r t r a n sm i s s i o n to t h e e r r o r l og f i l e . b y i s s u i ng a $ S NDERR s ys tem s e rv i c e ( th i s r e qu 1 r e s the B UGC HK p r i v i l eg e ) . Unl i ke the $ SNDAC C , $ SNDSMB , a n d $ S NDOPR s ys tem s e rv i c e s , t h e $ S NDERR s ys t em s e r v i c e • • e x e c u t e s i n k e r n e l mo d e ( r a th e r t h a n exec u t i v e mod e ) , a nd a l l o c a t e s a n e r r o r m e ssag e m a i l bo x me s s ag e ) • 27-3 b u f fe r ( r a th e r th a n s e nd i ng a M I S C E LLANEOUS SYS TEM SERVI CES Th e $ SNDERR s ys tem s e r v i c e r o u t i n e pe r fo rms these a c t i o n s . 1. Th e r e qu e s t i s c h e c ked fo r a c c e s s a nd p r i v i l eg e v i o l a t i o n s . 2. A b u f f e r i s a l l o c a t ed f r om t h e e r r o r l og g e r ' s m e s s ag e po o l . 3. Th e m e s s a g e b u f f e r is f i l l ed wi t h the m e s s ag e t ype ( EM B $ C S S ) , the m e s s a g e s i z e , and t h e m e s sag e t e x t . An e r r o r l og s equen c e n um b e r a nd t h e c u r r e n t t i me a r e a l s o a pa r t o f e v e r y e r r o r m e s s ag e . 4. Th e bu f f e r i s r e l e a s ed to the e r r o r l ogg i ng s ub s e qu e n t o u t p u t to t h e e r r o r l og f i l e . r o ut i nes Ch a pte r 7 co n ta i n s a d i sc u s s i o n o f the e r r o r l og r o u t i n e s a nd a d e sc r i p t i o n o f the E RRFMT p r o c e s s . 27 . 2 fo r bri ef SYSTEM MESSAG E F I LE SERVI C ES VAX/VM S Ve r s i o n 2 . 0 p r o v i d e s t h r e e l ev e l s o f m e s s a g e f i l e c a pa b i l i t y . Th e c r e a t i o n a nd d e c l a r a t i o n o f i m ag e- s p e c i f i c a nd p r o c e s s - pe rma n e n t m e s s ag e f i l e s a r e d i s c u s sed i n t h e VAX- 1 1 U t i l i t i e s Re f e r en c e Ma n u a l Th e sys tem m es s a g e La nguag e Us e r ' s G u i d e . a nd t h e VAX/VMS C omma nd f i l e ( S YSMSG . EXE ) i s ma pped i n to s ys tem a d d r e s s s pa c e a s a p ag e a b l e s ec t i o n . Th i s i n i t i a l i za t i on i s pe r fo rmed b y SYS I N I T d u r i ng sys t em i n i t i a l i z a t i o n ( Ch a pt e r 2 2 ) . Two sys t em s e rv i c e s p r o v i d e t h e a b i l i t i e s to • • s e a r c h f o r a m e s s ag e t e x t c o r r e s p o nd i ng c o d e ( $G E TM SG ) , a nd to a g i ven s t a t us wr i t e o n e o r mo r e m e s sag e t e x t s to S Y S $ 0UT PUT ( $ PUTM SG ) . A th i rd p r o c ed u r e ( E XE $ E XCMSG ) d o e s n o t u s e t h e va r i o us m e s sag e f i l es but is a l so o n e o f t h e m e s s ag e o u t pu t p r o c ed u r e s th a t c a n b e i nv o k ed E XE $ E XCMSG i s c a l l ed by L I B $S IGNAL a nd a s p a r t o f c o nd i t i o n h a nd l i ng . E XC E PT I ON to wr i te t h e c o n t e n t s o f t h e g e ne r a l r eg i s t e r s to SYS $0UTPUT i f a c o nd i t i o n is n o t h a nd l ed in any o the r wa y . 27 . 2 . 1 G e t Me s sag e Sys t em S e r v i c e Th e Ge t Me s s ag e sys t em s e rv i c e ( $G E TM SG ) e x e c u t e s i n e x e c u t i v e mod e . It s e a r c h e s e a ch o f t h e th r e e l ev e l s o f me s s ag e f i l e s fo r a ma t c h to t h e s t a t us c od e p r o v i d ed a s a n a rg um e n t . 27-4 MISCELLANEOUS SYSTEM SERVI CES 27 . 2 . 1 . 1 F i nd i ng the Me s sag e Fi l e s - Th e f i r s t s tep of the r e t r i ev a l of a m e s sa g e i nv o l v e s d e t e rm i n i ng wh i ch type s o f m e s s ag e f i l es h av e b e e n d e f i ned . 1. I f an i mag e mes sag e sec t i o n h a s b e e n d e f i ned , then it has been i nco rpo r a t ed as a p r og ram reg i o n i mag e s e c t i o n . Th e c o n t r o l r eg i o n l o c a t i o n CTL$G L G E TM SG po i n ts to th e pe r- i mag e mes sag e s ec t i o n vecto r i n the c o n t r o l reg i on ( Append i x E ) . Th e v e c t o r i s i n i t i a l i z ed wi th a va l ue c o r re spond i ng to an RSB i n s t r uc t i o n . If an im ag e h a s d e f i ned a ny message s ec t i o n s , t h e n th i s v e c to r i s ch ang ed by the imag e ac t i va to r to the c od e s e que n c e JSB JSB @ t < P O - l o c a t i on 1 > @ # < P O - l o c a t i on 2 > JSB RSB @ # <PO-loca t i on n> _ = Each P O l o c a t i o n i s in a d i f f e r e n t me s sag e sec t i o n ( up to a max imum o f 4 2 d i s t i nc t me s s a g e s e c t i o ns i n a g i ve n imag e ) and c o n ta i n s a JSB ( RS ) i n s t r uc t i o n . Th i s i nvo ke s the v e c t o r s e a r c h r o u t i ne f o r the i mage me s s ag e s e c t i on d e s c r i b ed b e l ow b e c a u se R S wa s l o ad ed wi th the r o u t i n e ' s s t a r t i ng add r e s s . 2. I f no ma tch i s f o und i n the f i r s t sec t i o n , the f i r s t mes sag e d i spa t c h e r i ssues an RSB b a c k to the Pl space v e c to r , wh i ch i s s ue s a J S B to the s econd m e s sag e d i spa tc h e r and so o n . 3. I f no i mag e me s s a g e s ec t i on h a s been d e f i n ed or the i nput s t a tus v a l ue c o u l d not be fo und in a ny i mag e m e s s a g e s ec t i o n , then a t e s t i s mad e fo r a p r o c e s s- pe rma n e n t m e s sag e s ec t i o n ( e s t a b l i sh e d by the SET MESSAG E c omma nd ) . Th e a b s e n c e o f a p r o c e s s-pe rma n e n t m e s s a g e s e c t i o n i s i nd i c a ted by a zero in the control r eg i o n l oc a t i on , CTL$G L PPMSG . If a p r o c e s s-pe rma n e n t m e s sag e sect ion has been d e f i ned , CTL$G L PPMSG po i n t s to a control reg i o n ad d r e s s in a p r o c e s s-pe rma n e n t s e c t i o n vecto r ( Append i x E ) . Th e l oc a t i o n c o n ta i ns t h e e q u i v a l e n t o f a JSB ( RS ) i ns t r uc t i o n . Th i s i n s t r uc t i on i nv o k e s the v e c to r search rout i ne fo r the p r o c e s s -pe rm a n e n t mes sag e sec t i o n in a s i m i l a r f a sh i o n a s fo r the i mag e sec t i on c a s e abov e . 4. I f a p r o c e s s-pe rma n e n t m e s s ag e s e c t i o n h a s no t b e en d e f i ned or the i n put s ta t u s v a l ue could no t be fo und in the p r o c e s s-pe rman e n t me s s a g e se c t i o n , then the sys t em me s s ag e file is s e a r c h ed . Th e l o ca t i o n EXE $G L SYSMSG po i n ts to a sys tem l o c a t i on i n a sys tem sec t i on v e c to r . Th e l oc a t i o n co nta i n s t h e e qu i v a l ent o f a JSB (RS) i n s t r uc t i o n . Th i s i n s t r uc t i on i nv o k e s r o u t i ne f o r the s ys t em m e s s a g e f i l e . 2 7- 5 the v e c to r sea rch M I SC E LLANEOUS SYS TEM SERVI C ES I f no m e s sag e f i l e i s fo und o r none o f t h e d e f i ne d m e s s a g e f i l es c o n ta i n s the s p e c i f i ed s t a t u s c o d e , then t h e s t a tus c o d e i s i n s e r t ed i n to a d e f a u l t m e s s ag e tex t a nd the s e rv i c e r e t u r n s w i t h t h e S S $_MSGNOTFND c od e . 2 7 . 2 . 1 . 2 Search i ng a Lo ca ted Me ssag e Sec t i on - Wh e n a m e s s ag e s e c t i o n is l o ca t e d , t h e s ta r t i ng ad d r e s s a nd l eng t h o f t h e m e s s a g e s ec t i o n i nd ex a re c a l c u l a ted . A b i na ry s e a r c h o f t h e m e s s a g e s e c t i o n i nd e x i s t h e n pe r fo rmed t o d e t e rm i n e i f t h e spec i f i ed s t a t us c o d e i s i nc l ud ed . I f no m e s sag e i s d e f i n ed wi th i n the s ec t i o n fo r the spec i f i ed s t a t us If code , a c h ec k i s m a d e in o th e r m e s s ag e s e c t i o n s o f t h e s a m e type . is then c o n t r o l n o f u r the r m e s s a g e s ec t i o n s o f t h e s am e type e x i s t , r e t u r n ed to t h e $ G E TM SG m a i n l i ne th r o ug h a s e r i e s o f RSB i n s t r uc t i o n s . sys t em $G E TMSG t h e n c h e c k s t h e n e x t type o f m e s s a g e s e c t i o n un t i l the me s s ag e f i l e h a s b e en s e a r ch ed . I f a m e s s ag e c o r r e spo nd i ng to t h e s pe c i f i ed s t a t us c o d e is l o c a t ed w i t h i n a m e s s ag e s e c t i o n , t h e n t h e i n fo rma t i o n se l e c t e d b y t h e $ G E TM SG F LAGS a rg um e n t i s c o p i ed i n to t h e u s e r -d e f i ned b u f f e r . Th e s e a r c h r o u t i ne r e t u r n s c o n t r o l ( w i th a n R E T i n s t r uc t i o n ) t o the c a l l e r o f t h e $G E TMSG s y s t em s e rv i c e . 27 . 2 . 2 Put Me s sag e Sys t em S e r v i c e Th e $ PU TMSG s ys t em s e rv i c e p r ov i d e s t h e a b i l i ty to wr i te o ne o r mo r e e r r o r m e s s ag e s t o SYS $ E RROR ( a nd SYS $0UT PUT i f i t i s d i f fe r e n t f r o m SYS $ E RROR ) . I t e x e c u tes i n the a c c e s s m o d e o f i t s c a l l e r , a nd us e s $G E TMSG t o r e t r i ev e t h e a s s o c i a t ed t ex t f o r a pa r t i c u l a r s t a t u s c o d e . Th r e e a rg um e n ts a r e p r ov i d ed to $ P U TMSG : 1. a m e s sag e a rg um e n t v e c to r d e sc r i b i ng the m e s sag e s i n t e rms o f s t a tus codes , m e s s ag e f ield s e l e c t i o n f l ag b i t s , a nd $ FAO a rg um e n t s ( S e c t i o n 2 7 . 4 . 2 ) , 2. a n o p t i o n a l a c t i o n r o u t i n e to be c a l l ed m e s s a g e t ex t s , a nd 3. a n o p t i o n a l f a c i l i ty n am e to be m e s s ag e wr i t ten . b e fo r e a s so c i a ted wi th wr i t i ng the the fi rst Th e c o n s t r uc t i o n o f the m e s sag e a rg um e n t v e c to r i s . d i sc u s s e d i n the VAX/VMS Sys t em S e r v i c e s Re f e r en c e Ma n ua l . O th e r u s e s o f the $ PUTM SG s y s t em s e rv i c e a r e d e sc r i bed i n t h e VAX- 1 1 Run- T i me L i b r a r y Re f e r en c e Ma n ua l . Ea c h a rg um e n t o f the m e s sag e a rg um e n t v e c to r i s p r o c e s s ed a s fo l l o ws . 1. Th e f a c i l i ty c o d e o f the r e que s t i s d e t e r m i ned to be a s y s t em , RM S , or s ta nd a rd f a c i l i ty c o d e . Sys t em a nd RMS f a c i l i ty c o d e s d o n o t use a s s o c i a t ed $ FAO a rg um e n t s in the m e s s ag e a rg um e n t v e c to r . S t a nd a rd f a c i l i ty c o d e s r equ i r e s uc h $ FAO a rg um e n t s . 2. $G E TMSG i s c a l l ed w i th t h e s ta t u s c o d e a nd f i eld s e l ec t i o n s ( ba s ed upo n t h e se l ec t i o n b i t s a nd $ FAO a rg umen t s ) . 2 7- 6 M I SC E LLANEOUS SYSTEM SERV I C E S 3. $ FAOL i s c a l l ed to a s semb l e a l l t h e po r t i o n s o f the message to b e wr i t t e n ( s uppl i ed f a c i l i t y c o d e , opt i o n a l l y s pe c i f i ed d e l i m i t e r s , o u t p u t f r om $ G E TM SG ) . 4. Th e u s e r ' s a c t i o n r o u t i n e i s c a l l ed , i f o ne wa s s pe c i f i ed . 5. I f the a c t i o n r o u t i n e r e t u r n s a n e r r o r s t a t us , the m e s s a g e i s not wr i t t e n . O th e rwi s e , t h e fo rma t ted m e s sag e i s wr i t t e n to SYS $ E RROR b y a n RM S $ P UT r e que s t . I f SYS $ 0UTPUT i s d i f f e r e n t f r om SYS $ E RROR , t h e n t h e f o rm a t t ed m e s s ag e i s a l so wr i t t e n to SYS $ 0 UTPUT . Wh en a l l o f t h e a rg um e n t s i n the m e s sa g e a rg um e n t vec to r have p r o c e s s ed , t h e $ P UTMSG s y s t em se rv i c e r e t u r n s t o i t s c a l l e r . 27 . 2 . 3 been P r o c ed u r e E XE $ E XC M SG Th i s p r o c ed u r e i s used i n t e r n a l l y by the c a t c h a l l c o nd i t i o n h a nd l e r a nd L I B $ S IGNAL t o r e po r t a c o n d i t i o n tha t h a s no t b e e n p r o pe r l y h a nd l ed b y a n y c o nd i t i o n h a nd l e r s f a r th e r u p the c a l l s t a c k . Th e two i n p u t a rg um e n t s to th i s p r o c ed u r e a r e the add r e s s o f a n ASC I Z s t r i ng and the add r e s s o f the a rg um e n t l i s t pa s s ed to the c o nd i t i o n h a n d l e r s ( Ch a p t e r 2 ) . Th e p r o c ed u r e wr i tes a fo rm a t t ed d ump o f the g e ne r a l r eg i s te r s and the s ignal a r r a y , a s we l l as the c a l l e r ' s m e s s a g e tex t to SYS $ 0 UTPUT ( a nd to SYS $ ERROR i f d i f f e r e n t f r om SYS $ 0UTPUT ) . Th i s m e s sag e a pp e a r s fo r all f a ta l e r r o r s t h a t o c c u r i n imag e s t h a t we r e l i n k e d wi tho u t the t r a c eb a c k h a nd l e r . Al th o ug h th i s p r o c ed u r e h a s a n a s so c i a t ed en t r y po i n t in the s ys t em s e rv i c e vec t o r a rea , i t c a nno t b e c onven i e n t l y c a l l ed f rom any l a ng uag e s ex c e p t VAX- 1 1 MAC RO a n d VAX- 1 1 B L I S S - 3 2 . Th i s restr i c tion i s i m p o s ed b y t h e s pe c i f i c a t i o n o f the s e c o nd a rg um e n t , wh i c h r eq u i r e s a c c e s s t o the g en e r a l r eg i s t e r AP , a c a pa b i l i ty d e n i ed to most h igh l ev e l l a ng uag e s . 27 . 3 PROC E S S I N FORMAT I O N ( $G E TJ P I ) Th e $ G E TJ P I s ys t em s e rv i c e p r o v i d e s s e l ec t ed i n fo rma t i o n a bo u t a s pec i f i ed p r o c e ss ( wh i ch m a y no t n e c e s s a r i l y be the p r o c e s s r e que s t i ng t h e $ G ETJ P I s e r v i c e ) Th e a rg umen t s to $ G E TJ P I i n c l ud e • • • • • the e v e n t f l ag num b e r t o s e t wh e n t h e s e r v i c e h a s c ompl e ted , the p r o c e s s I D o f the p r o c e s s f r om wh i c h i n fo rma t i o n i s to b e c o l l ec ted , the p r o c e s s name o f the t a rg e t p r o c e s s , the ad d r e s s o f a n i tem l i s t t h a t i nc l ud e s ( fo r e a c h r e que s t e d i t em ) wh i c h i t em o f i n fo rma t i o n i s to b e r e t u r ned , t h e s i z e a nd a d d r e s s o f the b uf f e r to hold the i n fo rma t i o n , a nd a l o c a t i o n to i n s e r t the s i z e o f t h e r e t u r n ed i n f o rm a t i o n , 2 7-7 M I S C E LLANEOUS SYSTEM SERVI C E S • • an I /0 s t a t u s b l o c k i n fo rma t i o n , a nd ( I OS B ) to r ec e i ve f inal s t atus t h e e n t r y po i n t a nd pa r am e t e r fo r a n AS T r o u t i ne i nv o ked wh e n t h e sys tem s e rv i c e h a s c om p l e ted . to be A d e ta i l ed d i sc us s i o n o f t h e fo rma t a nd s pe c i f i c a t i o n o f the i t em l i s t i s d e sc r i b ed i n t h e VAX/VMS Sys t em Se r v i c e s Re f e r e n c e Ma n ua l . 27 . 3 . 1 Ope r a t i on o f the $G ETJ P I Sys t em Se rv i c e Th e $G E TJ P I s ys t em s e rv i c e , e x e c u t i ng i n f o l l o w i ng o pe r a t i o n s . ke r n e l mod e , pe r fo rms 1. Th e I OS B , i f s pe c i f i ed , a nd t h e eve n t f l ag a r e c l e a r ed . 2. Each i t em in c o nd i t i o n s . • • the l i st is c h ec k e d Th e b u f f e r d e sc r i pto r mus t b e wr i t a b l e . fo r r ea d a b l e the a nd the f o l l o w i ng th e buffer Th e r e q u e s ted i t em mus t b e a r ec og n i zed o n e . 3. I f these cond i t i o n s a r e m e t , t h e n t h e r e q ues t e d i t em c a n b e r e t r i ev e d . Al l d a ta a b o u t t h e c u r r e n t p r o c e s s a nd PCB a nd J I B d a ta a b o u t a no the r process c an be o b t a i ned wi tho u t e n t e r i ng the context of the t a rg e t p r o c e s s . Al l s uc h i n fo rma t i o n i s m o v e d to t h e u s e r -d e f i ned b u f f e r s f o r e a c h c o r r e s po nd i ng i tem . 4. I f no i n f o rm a t i o n r ema i n s to b e g a th e r ed , s e r v i c e r e t u r n s to the c a l l e r a f t e r 5. then • s e t t i ng t h e s pec i f i ed eve n t f l ag , • d e c l a r i ng the r e que s ted AST i f spec i f i ed , a nd • wr i t i ng t o t h e I OS B i f s uppl i ed . th e s y s t em I f the r e i s r ema i n i ng i n fo rm a t i o n t h a t c o u l d no t b e r e t r i eved b y s t e p 3 a bo v e , then the i n fo rma t i o n • • i s a bo u t a p r o c e s s o th e r t h a n t h e c a l l e r , a nd i s s to r ed i n e i th e r the c o n t r o l h e ad e r . r eg i o n or the process Th i s i n fo rma t i o n m u s t b e r e t r i ev ed b y e x e c u t i ng i n the c o n tex t of the t a r g e t p r o c e s s . To d o th i s a spec i a l ke r n e l mo d e AST ( Ch a p t e r 5 ) i s queued to the t a rg e t p r o c e s s . Two d a t a s t r uc t u r e s a r e a l l o c a t ed f r om n o npag ed d yn am i c memo r y . • • An e x t end e d AST c o n t r o l b l o c k i s b u i l t t o c o n t a i n the no r m a l f i e l d s p l u s d e sc r i p to r s of a l l of the un sa t i s f i ed r e q u e s t s t h a t mus t b e r e t r i ev ed b y e x e c u t i ng i n the c o n t e x t o f the o th e r p r o c e s s . A b u f f e r i s c r e a t ed to r e c e i v e t h e r e t r i eved fo r t r a n sm i s s i o n to the r eq ue s t i ng p r o c e s s to t h e J I B $ L_BYTCNT q uo t a ) • 2 7 -8 i n fo rma t i o n ( a nd cha rg ed M I S C E LLANEOUS SYST EM S E RVI CES Th e AC B i s then q u e ue d to the t a rg e t p r o c e s s un l e s s i t no l o ng e r ex i sts , or i t i s i n t h e s u s pe nd ed ( S US P ) , s us pend e d o u tswa pped ( S U S PO ) , o r t h e m i sc e l l a neous wa i t ( MWA I T ) states ( Ch a p t e r 8 ) . If any of these c o nd i t i o n s ho l d s , t h e t wo b l o c k s o f n o n pag e d po o l a r e d e a l l o c a t ed and a n e r r o r return i s pa s s ed b a c k to t h e c a l l e r . Th e s ta t u s o f S S $ S US PENDED i s r e t u r n e d f o r the t h r e e l o ng wa i t s t a te s o f S US P , S U S PO , a nd MWA I T . I f t h e p r o c e s s h a s b e en d e l e t e d o r i s i n t h e p r o c e s s o f b e i ng d e l e t ed ( h a s t h e d e l e t e pend i ng b i t s e t i n the PCB s t a t us l o ngwo r d ) , a s t a tus o f S S $ NON E XPR i s pa s s ed b a c k t o the c a l l e r . No t e t h a t the c om p l et i o n m e c ha n i sm s a r e all t r i g g e r ed i f one o f these e r ro r s occur s . Tha t i s , the e v e n t f l ag i s s e t , a use r - r e qu e s ted AST i s que ued , a nd a n IOSB is wr i t t e n w i t h the f a i l u r e s t a t u s . On e f i n a l p i e c e o f i n f o rm a t i o n i s ad d ed to the ex t e nd ed AST control block . Th e r e is an image c o un t e r s t o r ed i n t h e p r o c e s s h e a d e r ( a t o f f s e t PHD $ L I MGCNT) th a t is i nc r e m e n t e d each t ime th a t a n i mag e is r und own ( Ch a p t e r 1 8 ) . Th i s c o un t e r p r e v e n t s o n e i m a g e f r om r eq ue s t i ng i n fo rma t i o n a b o u t a no the r process a nd t h e n ex i t i ng , o n l y to h a v e a n AST d e l i v e r ed o r an I OS B wr i t t e n l a t e r o n to the r e que s t e d PO a d d r e s s e s i n a no th e r i m ag e . 6. 27. 3 . 2 F i n a l l y , t h e sys tem s e r v i c e r e t u r n s to t h e c a l l e r wh o can e i th e r wa i t f o r the i n fo rm a t i o n t o b e r e t u r n ed o r c o n t i n u e p r o c e s s i ng . $G E TJ P I Spe c i a l Ke r n e l ASTs I f some o f the i n fo r ma t i o n abo u t the t a rg e t ( o the r than the c a l l e r ) resides i n the p r o c e s s h e ad e r o r i n the P l s pa c e o f the t a r g e t , t h e n c od e mus t e x e c u t e i n tha t t a rg e t ' s c o n tex t to ac c e s s the i n fo rma t i o n . Onc e the i n fo rma t i o n h a s b e en r e t r i ev e d , i t mus t b e pa s s ed b a c k t o t h e c a l l e r so tha t i t c a n b e wr i t t e n to t h e c a l l e r ' s ad d r e s s s p a c e . VMS u s e s s pe c i a l ke r n e l ASTs f o r bo th p i e c e s o f th i s t r i p . A s umma r y o f t h e o pe r a t i o n s pe r fo rmed by t h e s e spec i a l k e r n e l ASTs l i s t ed h e r e . is 1. Wh e n t h e spec i a l k e r n e l mod e AST m a ke s the t a rg e t p r o c e s s c ompu t a b l e , t h e r eque s ted i n fo rma t i o n i s d e t e rm i n ed f r om t h e e x t e n d e d AC B a nd s t o r ed i n t h e a s so c i a t ed s y s t em b u f fe r . Th e c omp l e t i o n o f the s pe c i a l k e r ne l mod e AST r o u t i ne o c c u r s a f te r t h e e x t e nded ACB i s r e f o rm a t ted t o d e l i v e r a s e c o nd s pe c i a l k e r ne l mo d e AST , t h i s t i m e to the r e que s t i ng p r o c e s s . 2. Th e s e c o nd k e r n e l mo d e AST r o u t i n e e x e c u t e s i n the c o n t e x t o f the r e ques t i ng p r o c e s s . If the image c o un t e r s do n o t a g r e e , then the r e q ue s t i ng image h a s g o ne awa y . I n th i s c a se , the t wo b l o c k s o f n o npag ed po o l a r e d e a l l o c a t ed , t h e p r o c e s s BYTCNT q uo t a i s r e s to r ed , a nd the s pe c i a l k e r ne l A S T s i mpl y r e turns . I f t h e i m ag e c o un t e r i n the p r o c e s s h e a d e r ag r e es w i t h i m ag e c o un t e r in t h e e x t e nd ed A S T c o n t r o l b l oc k , r e t r i ev ed d a t a i s moved f r om th e sys t em bu f f e r i nto v a r i o u s u s e r -d e f i ned b u f f e r s . 27-9 the the the M I S C E L LANEOUS SYS TEM SERVI C E S 3. Th e sys t em b u f f e r is d e a l l o c a t e d , t h e ev e n t f l ag is s e t , a nd the I O SB is wr i t t e n if i t wa s s pe c i f i e d . No te t h a t the a s yn c h r o n o u s n a t u r e of th i s a sp e c t of the sys tem serv i c e r e qu i r e s th a t the I O SB be p r o bed ag a i n fo r wr i te a c c e s s i b i l i ty . Th i s c h e c k i n s u r e s tha t the o r i g i na l cal ler of $G E TJ P I h a s no t a l t e r ed the p r o t e c t i o n o f the I O SB i n the i n t e r v a l b e twe e n the c a l l to $G E TJ P I and the d e l i v e r y o f the r e t u r n s p e c i a l k e r n e l AST . 4. I f a n AST wa s r e que s t ed then t h e AST c o n t r o l block i s u s ed fo r t h e t h i r d t i me to q u e u e an AST to the r eq u e s t i ng p r o c e s s i n t h e a c c e s s mo d e o f t h e c a l l e r . Othe r w i se , t h e ACB is d e a l l o c a t e d t o n o npag ed m emo r y . 27 . 3 . 3 W i l d Ca r d S uppo r t i n $ G E TJ P I Th e $ G E TJ P I a l so p r ov i d e s so- c a l l ed w i l d c a rd s uppo r t , th e a b i l i ty t o o bta i n i n fo rma t i o n about a l l p r o c e s s e s i n t h e s ys tem . A wi ld c ard r e que s t i s i nd i c a t e d b y p a s s i ng a n eg a t i v e p r o c e s s I D t o t h e $ G E TJ P I s ys t em s e rv i c e . Th e i n t e r n a l r o u t i ne i n $G E TJ P I t h a t d e te rm i n e s t h e i d e n t i t y o f the t a r g e t p r o c e s s r e c og n i z e s a wi l d c a rd r eque s t a n d pa sse s i n fo rm a t i o n b a c k to the c a l l e r a bo u t the f i r s t p r o c e s s i n t h e PCB v e c to r a f te r the s wa ppe r a nd t h e n u l l p r o c e s s ( Ch a p t e r 1 7 ) . I n a d d i t i o n , t h e p r o c e s s i nd e x f i e l d o f t h e c a l l e r ' s P I D a r g um e n t is a l t e r ed to c o n ta i n t h e p r o c e s s i nd ex o f t h e t a rg e t p r o c e s s . Wh e n the c a l l e r of $ G E TJ P I i s s u e s a s e c ond c a l l , the n eg a t i v e sequence n umbe r ( i n t h e h i g h o r d e r wo r d o f t h e p r o c e s s I D ) i nd i c a t e s t h a t a w i l d c a r d o pe r a t i o n i s i n p r og r e s s b u t a po s i t i v e p r o c e s s i nd ex i nd i c a te s wh e r e in the PCB v e c to r t h e s e a r c h sho u l d c o n t i n ue . No t e t h a t the u s e r p r og r am w i l l no t wo r k c o r r e c t l y i f the c a l l e r a l t e r s the v a l ue o f the p r o c e s s ID a r g ume n t b e twe en c a l l s t o $G E TJ P I . Th e use r c o n t i n u e s to i s s ue c a l l s to $G E TJ P I u n t i l a s t a t us c o d e o f S S $ N OMOREPR OC is r e t u r n ed , i nd i c a t i ng that the PC B vec to r s e a r c h r o ut i n e h a s r ea c h ed t h e e n d o f t h e PC B v e c to r . An ex ampl e o f t h e w i l d c a rd use of the $G E TJ P I s ys t em s e rv i c e i s c o n t a i n ed i n the VAX/VMS Sys tem Se r v i c e s Re f e r e n c e Ma n ua l . 27 . 4 FORMATTING S UPPORT fo r T h e f i n a l g r o up o f s ys t em s e rv i c e s p r ov i d e s c o nve r s i o n s uppo r t I/O o f ASC I I c h a r a c t e r t i m e - r e l a t ed r eq u e s t s a nd fo r fo rm a t ted s t r i ng s . 2 7-1 0 M I S C E LLANEOUS SYS TEM S ERVI CES 27 . 4 . 1 Time Co nve r s i on S e rv i c e s Th e t i m e c o nv e r s i o n s ys tem s e rv i c e s a r e d e f i ne d in t h e mod u l e SYS CVRT IM . Th e $ N UMTIM s ys t em s e rv i c e e x e c u t e s i n e x e c u t i ve mod e a nd c o nv e r t s a b i na r y quad wo r d t i m e v a l u e i n s y s tem t i m e f o rm a t ( d e sc r i b e d i n Ch a pt e r 1 0 ) i n to s e v e n n um e r i c a l wo r d l e ng th f i e l d s : y e a r s s i nc e 0 m o n th o f ye a r d a y o f m o n th ho ur o f d a y m i n u t e o f ho u r s ec o nd o f m i n ut e h und r ed t h s o f s e c ond A po s i t i v e t i m e a rg umen t i s c o nv e r t e d i n to the c o r r e s pond i ng a bso l u t e s y s tem t ime . A z e r o - v a l u ed t i m e a rg um e n t r eque s t s t h e c o nv e r s i o n o f t h e c u r r e n t s ys tem t i me . A n eg a t i v e t i m e a rg um e n t i s i n t e r p r e ted a s a t i m e i n t e rv a l f r om the c u r r e n t s ys tem t i m e . Th e $ A S C T IM s y s t em s e rv i c e e x e c u t e s i n the a c c e s s mod e o f the c a l l e r a nd c o nve r t s a sys tem t i m e fo rma t quadwo r d i n to a n ASC I I c h a r a c t e r s t r i ng . Th e i n put b i na r y t i m e a rg um e n t i s pa ssed t o $ N UMT I M . Th e s ev e n f i elds r e t u r n ed f r om $ N UM T I M a r e then c o nve r t e d i n to ASC I I c h a r a c t e r f i e l d s wi th t h e s e l ec t i o n d e t e rm i ned by wh e th e r the i np u t t i m e wa s a n a b s o l u t e o r d e l t a t i m e a nd wh e th e r c o n v e r s i o n f l ag wa s s e t , i nd i c a t i ng conve r s i o n o f d a y a nd t i m e o r on l y t h e t i me po r t i o n . Th e $ FAO s ys tem s e rv i ce ( d e sc r i b ed i n the n e x t s e c t i o n ) i s u s ed to c o n c a t e n a t e a nd fo rm a t the s t r i ng compo n e n t s b e fo r e r e t u r n i ng the s t r i ng to the c a l l e r . Th e $ B INTIM s ys t em s e r v i c e e x e c u t e s i n the a c c e s s mod e o f the c a l l e r a nd c o nv e r t s a n ASC I I t i me s t r i ng i n to a quadwo r d a b s o l u t e o r d e l t a t ime . I f the i np u t s t r i ng e x p r e s s e s a n a b so l u t e t i m e , then the cur rent s ys t em t i me is c o nv e r t ed by $NUMTIM t o s u pp l y a n y f i e l d s om i t t ed i n ASC I I s t r i ng . E a c h ASC I I f i eld is t h e n c o nv e r ted to n um e r i c a l v a l u e s a nd s to r ed i n th e s e v e n wo rd f i e l d s u s e d b y $NUMTIM . Th e s e v e n wo r d f i e l d s a r e th e n comb i ned i n to a b i n a r y q ua d wo rd v a l ue . Th e r e s u l t i ng va l u e i s n eg a ted i f a d e l t a t i me wa s s p e c i f i ed i n t h e AS C I I s t r i ng . 27 . 4 . 2 Fo rma t ted ASC I I Ou tput Th e $ FA O a nd $ FAOL s ys tem s e r v i c e s p r ov i d e fo rma t t i ng a nd c o nv e r s i o n fac i l i t i e s f r om b i na r y a nd ASC I I i n p u t pa r ame t e r s t o a s i ng l e ASC I I o u t p u t s t r i ng . Th e t wo s y s tem s e rv i c e s e x e c u t e i n t h e a c c e s s m o d e o f the c a l l e r a nd use c ommo n c od e . Th e o n l y d i f f e r e n c e b e t we e n them i s wh e th e r the pa r am e t e r s a r e pa s s ed a s a l i s t o f a rg um e n t s ( $ FAO ) o r a s t h e ad d r e s s o f t h e f i r s t pa r am e t e r ( $ FAOL ) . Th e c o n t r o l s t r i ng i s pa r s ed c h a r a c t e r b y c h a r a c t e r . I n fo rm a t i o n th a t i s n o t p r ec e d ed b y the control cha r a c te r , ! , i s c op i ed i n to t h e o u tput s t r i ng wi tho u t f u r th e r a c t i o n . Wh en a control c h a r a c t e r a nd o pe r a t i o n c o d e a r e e n c o un t e r ed in the control s t r i ng , t h e n t h e a pp r o p r i a t e c o nve r s i o n r o u t i n e i s e x e c u t ed to process zero , one , or two of the i np u t pa r am e t e r s to the s ys t em s e rv i c e . Wh e n t h e co n t r o l s t r i ng h a s b e e n c om p l e t e l y pa r s ed , the s e r v i c e r e t u r n s to the c a l l e r w i t h a no r m a l s tatus code . If the o u tput s t r i ng l eng t h i s ex c e ed ed , a b u f f e r ove r f l o w e r ro r s t a t us i s r e t u r ned . Th e d e sc r i pt i o n o f t h e $ FAO s ys t em s e rv i c e in t h e VAX/VMS Sys tem Se r v i c e s Re f e r en c e Ma n ua l con t a i n s d e t a i l s a b o u t how t o s pe c 1 fy S FAO r e que s t s . 2 7- 1 1 APPEND I C E S Wh e n t h o u h a s t d o n e , t h o u h a s t n o t d o n e , Fo r I h a v e mo r e . A Hymn e to G o d t h e Fa th e r Jo h n Do n n e On t h e t a b l e i n the l i g h t o f a b i g l amp w i t h a r ed s h ad e h e s p r e a d a p i e c e o f pa r c hm e n t r a t h e r l i k e a ma p . " Th e r e i s o n e po i n t tha t yo u haven ' t n o t i c ed , " s a i d t h e w i za rd , " a nd th a t i s t h e s e c r e t ent r anc e . Yo u s e e t h a t r un e on the We s t s i d e , a nd t h e h a nd po i n t i ng to i t f r om t h e o th e r r un e s ? " Th e Ho bb i t , o r Th e r e a nd Ba c k Ag a i n J . R . R . To l k i e n APPEND I X A U S E OF L I S T ING AND MAP F I LES Th i s m a n ua l has p r e s e n t ed a d e t a i l ed o v e r v i ew of the VAX/VM S e x ec ut i ve . Howe v e r , the u l t i m a t e a u th o r i t y on how the e x e c u t i v e o r a n y o th e r compo n e n t o f t h e s ys t em wo r k s i s t h e so u r c e cod e fo r tha t c ompo n e n t . Th i s a pp e nd i x shows how t h e l i s t i ng and m a p f i l e s p r o d uc ed b y t h e l a ng uag e p r o c e s s o r s and t h e VAX- 1 1 L i nk e r can be used wi th o the r too l s to und e r s t a nd how a g i ven c ompo n e n t wo r k s o r wh y t h e s ys t em i s ma l f un c t i o n i ng . A. l H I NTS IN READ I NG THE EXEC UT I VE L I S T I NG S Th e so u r c e s fo r the VAX/VM S o pe r a t i ng s ys t em are av a i l ab l e in t wo Th e sourc e l i s t i ng k i t i n c l ud e s m i c r o f i c h e l i s t i ng s fo r a l l fo rms . b und l ed c ompo n e n t s e x c e p t c e r t a i n c ompa t i b i l i t y mod e u t i l i t i e s . Th i s kit is i nc l ud ed w i th e a c h VAX/VM S s y s t em . So u r c e f i l e s and comm a nd p r o c ed u r e s a r e a l s o d i s t r i b u t ed on m a g n e t i c t a pe fo r c u s t ome r s who p u r c h a s e a so u r c e l i c e n s e . Th e i d e a s e x p r e s s ed i n t h i s a pp e nd i x a r e g e a r e d towa rd r e ad i ng the mod u l e s tha t m a k e up t h e e x e c u t i v e a nd the i n i t i a l i z a t i o n ro u t i n e s , a l l o f wh i c h a r e wr i t t e n i n VAX- 1 1 MACRO . A. l . l St r uc t u r e o f a MACRO L i s t i ng F i l e Th e mod u l e s t h a t m a k e u p t h e e x e c u t i v e a r e a l l wr i t t e n f r om a c ommo n t em p l a t e th a t i n c l ud e s a mo d u l e h e a d e r d e s c r i b i ng e a c h r o u t i n e i n t h e mod u l e . Th e g e ne r a l fo rm a t of a VAX- 1 1 MACRO l i s t i ng file is Fe a t u r e s d e s c r i b ed in the VAX- 1 1 MAC RO La ng u ag e Re f e r e nc e Ma n ua l . t h a t a r e pec u l i a r t o l i s t i ng s i nc l ud ed i n the s o u r c e l i s t i ng kit are d e s c r i b ed h e r e . A. l . l . l $ x y z D E F Ma c r o s - One o f t h e f i r s t pa r t s o f e a c h mod u l e tha t r e qu i res e x pl a n a t i o n is the i nv o c a t i o n o f a s e r i e s o f ma c r o s t h a t d e f i n e symbo l i c o f f s e t s i n to d a t a s t r uc t u r e s r e f e r e nc ed i n t h e mod u l e . Th e g e n e r a l f o rm o f t h e s e mac r o s i s $ xy z D E F wh e r e x y z r e p r e s e n t s t h e d a t a s t r uc t u r e wh o s e o f fsets a re r e q u i r ed . Fo r e x am p l e , a mod u l e t h a t d e a l s w i th t h e I / 0 s ubsys t em w i l l p r o ba b l y i nvo k e t h e $ I R PDEF a nd $ UC BDEF mac r o s t o d e f i n e o f f s e t s i n to I /0 A- 1 U S E OF L I S T I NG AND MAP F I L E S R e qu e s t Pa c k e t s a nd Un i t Co n t r o l B l o c k s . S o m e o f the $ xy z DEF ma c r o s s uc h a s $ S S DE F , $ I ODEF , a nd $ PRDEF d e f i n e constants ( s ys t em s e r v i c e s ta tus returns , I/0 f unc t i on c od e s a nd mod i f i e r s , a nd p r o c e s s o r r eg i s t e r d e f i n i t i o n s ) r a th e r than o f f s e t s i n to d a ta s t r uc tu r e s . S t r uc t u r e s a nd c o n s t a n t s t h a t a r e used i n s ys tem s e r v i c e s h a v e th e i r $ x y z D E F ma c r o s d e f i n ed i n S TARL E T . M LB , t he d e fa u l t m a c r o l i b r a r y t h a t is a u tom a t i c a l l y s e a r c h ed by the a s s embl e r . Mo s t o f t h e d a ta s t r uc t u r e s used by the e x e c u t i v e h av e the i r m a c r o d e f i n i t i o n s c o n t a i n ed i n a spec i a l m a c r o l i b r a r y c a l l ed L I B . ML B . Th e d i s t i nc t i o n b e t we e n the s e two m a c r o l i b r a r i e s i s d i s c us s e d i n Append i x D , wh e r e m a n y o f the d a t a s t r uc t u r e s d e sc r i b ed i n t h i s m a n u a l a re l i s t ed . On e wa y to o b t a i n t h e s ymbo l d e f i n i t i o n s r e s u l t i ng f r om t h e s e ma c r o s i s t o l oo k a t t h e s ymbo l t a b l e tha t a ppe a r s a t the end o f t h e a s semb l y l i s t i ng . Howe ve r , t h e i n fo rma t i o n p r e s e n t e d t h e r e i s o f t e n i nc ompl e t e or no t i n a s u i t a b l e f o rm . An a l t e r n a te r e p r e s e n t a t i o n o f t h e d a t a c a n be o b t a i n e d f r om t h e f o l l o wi ng s e q u e n c e o f DC L command s . $ CREATE x y z D E F . MAR $ xy zD E F G LO BAL . END Az $ MAC RO x y z DEF+SYS $ L I BRARY : L I B . MLB/ L I BRARY $ L I NK/NOEXE/MAP/ F U L L x y zDEF $ PRINT x y z DE F . MAP Th i s c omma nd s e q u e n c e p r o d uc e s a s i ng l e o b j e c t mod u l e t h a t c on t a i n s all t h e s ymbo l s p r od u c e d by the $ xy zD E F m a c r o . Th e a r g um e n t G LOBAL ma k e s a l l the s ymbo l s p r od uc ed by the m a c r o g l o ba l . ( Th i s a rg um e n t must a ppe a r 1n uppe r c a se to b e p ro p e r l y i n te r p r e t e d by the a s s em b l e r ' s m a c r o p r o c e s so r . } Th a t i s , t h e s ym bo l names a nd v a l ue s a r e pa s s ed f r om the a ssembl e r to the l i nker so tha t t h e y a ppe a r o n wh a t e v e r m a p t h e l i n k e r p r o d uc e s . Th e f u l l ma p c o n t a i n s t wo l i st s o f s ymbo l d e f i n i t i ons , one i n a l ph a b e t i c a l o rd e r a nd o n e i n n ume r i c o rd e r . A . l . l . 2 The Ro u t i n e Body - I n g e n e r a l , t h e r o u t i n e s tha t m a ke e x ec u t i v e we r e c o d ed a c c o rd i ng to s t r i c t s ta nd a rd s tha t r e s u l t th a t i s e a s i l y m a i n ta i n e d . One s i d e e f f e c t o f t h e s e s ta n d a r d s the code is e a sy t o read fo r som e o n e a t t empt i ng to l e a r n wo r k s . S e v e r a l i t ems a b o u t t h e i n s t r uc t i o n s t h a t a ppe a r i n a r e wo r th d e s c r i b i ng . • the up t h e i n cod e i s th a t how VM S mod u l e bod y Da t a s t r uc t u r e r e f e r e nc e s a r e u s ua l l y mad e us i ng d i s p l a c em e n t mod e a d d r e s s i ng . Fo r e x ampl e , t h e i n s t r uc t i o n MOVL R 3 , UC B $ L_I R P ( R 5 ) l o a d s the c o n t e n t s o f R 3 ( p r e s um a b l y the a d d r e s s o f a n I /O r e que s t pa c k e t ) i n to the I RP po i n t e r f i e l d ( a l o ng wo r d ) i n a un i t c o n t ro l b l o c k po i n t e d to by R S . Suc h i n s t r uc t i o ns a r e p r a c t i c a l l y s e l f d o c um e n t i ng . Th e o v e r a l l a r r a ng ement o f d a t a i n a pa r t i c u l a r s t r uc t u r e d o e s n o t n e ed t o b e known in o r d e r t o und e r s t a n d s uc h i n s t r uc t i o n r e f e r en c e s . A- 2 U S E OF L I S T ING AND MAP F I LE S • Wh e n e v e r a s e q u e n c e o f i n s t r uc t i o ns m a k e s a n a s s ump t i o n a b o u t the r e l a t i ve l oc a t i o n s of f i e l d s wi t h i n a d a ta s t r uc t u r e , t h e r e i s a po s s i b i l i ty o f f a i l u r e i f the s t r uc t u r e s h o u l d Two i n s ta n c e s wh e r e s uc h a s s umpt i o n s m i g h t be u s e d c h a ng e . a r e t h e f o l l ow i ng . • • Two ad j a c e n t l o ngwo r d f i elds s i ng l e MOVQ i n s t r uc t i o n . c o uld A s t r uc t u r e c o ul d be t r a v e r s ed a u tod ec r em e n t a d d r e s s i ng . be us i ng l o a d ed wi th a a uto i nc r emen t or Th e AS S UM E ma c r o { l i s ted i n [ E XEC . SRC ] S YSMAR . MAR a nd d e f i n ed in SYS $ L I BRARY : L I B . MLB ) i s o f ten used to i mmed i a t e l y d e t e c t these fa i lures by i s s u i ng a n a s s emb l y t i me e r ro r . Fo r if a d ev i c e d r i v e r wa n t ed to c l e a r a d j a c e n t f i e l d s ex ampl e , i n a un i t c o n t r o l b l o c k , t h e fo l l o w i ng i n s t r uc t i o n a nd m a c r o s e que n c e s e q u e n c e wo u l d p r ev e n t f u t u r e s ub t l e e r r o r s i f the l a yo u t of the un i t c o n t r o l b l o c k c h a nged . C LRQ ASSUM E ASSUM E UC B $ L SVAPTE { R S ) UC B $ L B OFF E Q <UCB $ L SVAPTE + 4 > UC B $ L=B CNT E Q <UC B $ L=SVAPTE + 6 > Th e o p t i o ns a v a i l a b l e wi th t h i s m a c r o c a n b e d e te rm i ned by e x am i n i ng i ts defini t ion in the m i c r o f i c h e l i s t i ng in the E XE C c ompo n e n t . • Th e r e a r e some c ommo n l y u s e d i n s t r uc t i o n s e q u e nc e s tha t o c c u r so f r e quen t l y t h a t t h e a u tho r o f a m o d ul e u s e d a n a s s e m b l y t i me ma c r o to r epresent the i n s t r uc t i o n s e q u e nc e . Othe r i n s t r uc t i o n s e quenc e s , p a r t i c ul a r l y tho s e t h a t r e a d o r wr i t e t h e i n t e r n a l p r o c e s so r r eg i s t e r s , a r e mo r e r e a d a b l e i f h i d d e n in a ma c r o d e f i n i t i o n . Howeve r , b e c a u s e m a c r o s a r e r a r e l y e x pand ed a s a pa r t o f t h e a s s embl e r l i s t i ng , t h e r eade r o f l i s t i ng f i l e s mus t b e a b l e t o l o c a t e the m a c r o d e f i n i t i o n s . Th e r e a r e VAX/VM S . th r e e l eve l s at wh i c h ma c r o s a re d e f i n ed in I n th i s c a se , the A m a c r o m a y be l o c a l to a mo d u l e . m a c r o d e f i n i t i o n a ppe a r s as p a r t of the mod u l e h e a d e r . Such mac r o s a r e o f te n used to g e ne r a t e d a ta t a b l e s used by a s i ng l e m o d u l e . A m a c r o m a y b e a p a r t o f a spec i f i c f ac i l i ty , s uc h a s DC L or the RSX- l lM AME . Th e m a c ro s th a t a r e a pa r t o f a spec i f i c f a c i l i ty a r e i nc l ud ed a s p a r t o f the m i c ro f i c h e l i s t i ng fo r th a t f ac i l i t y . Fo r ex ampl e , the DC L m i c r o f i c h e i n c l ud e s n o t o n l y a l l mod u l e s t h a t m a k e up the DC L i m ag e s but a l so the ma c r o s tha t a r e u s ed t o a s s embl e tho s e mod u l e s . A m a c r o m a y b e used by m a ny c omponen t s o f VMS . In th i s case , th e m a c r o d e f i n i t i o n i s fo und o n e i th e r the E XEC m i c r o f i c h e { fo r e x ampl e , in SYSDEF . MDL o r SYSMAR . MAR ) or the VMS L I B m i c r o f i c h e { fo r e x ampl e , i n STARDE F . MDL o r S SMSG . MDL ) . Mo s t o f the ma c ro d e f i n i t i o n s in th i s c a t eg o r y a r e d a t a s t r uc t u r e d e f i n i t i on s , b u t t h e r e a r e many c ommo n i n s t r uc t i o n s equenc e s a ppe a r i ng i n seve r a l c ompo n e n t s tha t a re d e f i n ed i n the f i l e c a l l ed SYSMAR . MAR . A- 3 USE OF L I STING AND MAP F I LES Th e d e f in i t i o n s of a l l s y s t em ma c r o s tha t a re used in b u i l d i ng VMS are i nc l ud ed i n the m a c r o l ibrary SYS $ L I BRARY : L I B . M LB t h a t i s s uppl i ed a s a pa r t o f the VAX/VMS b i na r y d i s t r i b u t i o n k i t . App l i c a t i o n s s uc h a s us e r -wr i t t e n d ev i c e d r i v e r s o r u s e r -w r i t t e n s y s t em se r v i c e s can a l so u s e th i s m a c r o l i bra ry . Such appl i c a t i o n s m u s t b e r ea s s e m b l e d or r ecomp i l ed wi th e a c h new r e l e a s e of L I B . MLB , wh i c h u s ua l l y o c c u r s w i th e a c h m a j o r r e l e a s e o f VAX/VM S . Th e d e f i n i t i o n s o f a l l m a c r o s tha t a r e i n t end e d fo r use in nonpr i v i l eg ed a pp l i c a t i o n s s uc h a s sys t em s e r v i c e cal l s can be f o und in the macro l ibrary SYS $ L I BRARY : S TARL E T . MLB that i s a l s o s upp l i ed a s a pa r t o f the VAX/VM S b i n a r y d i s t r i b u t i o n kit . Th i s ma c r o l ibrary i s a u to m a t i c a l l y s e a r c hed by t h e a s s emb l e r to r e s o l ve und e f i ned ma c r o s . Append i x D conta i ns a d e s c r i p t i o n o f the d a t a s t r uc tu r e s d e f i ned i n STARDEF . MDL a nd SYSDE F . MD L . • Ano th e r s e a r c h t ha t the r e ad e r o f l i s t i ng s h a s to emba r k o n i nv o l v e s l o o k i ng fo r d e s t i na t i o ns o f i ns t r uc t i o n s tha t t r a ns f e r c o n t r o l o r r e f e r e nc e s t a t i c d a ta l o c a t i o n s . If the d e s t i na t i o n or d a ta l ab e l i s o u t s i d e the mod u l e c u r r e n t l y b e i ng l o o k ed a t , t h e s ym bo l a ppe a r s i n t h e s ym bo l tab l e at t h e e n d o f t h e a s sembl e r l i s t i ng a s a n und e f i n ed g l o b a l . Th e m o d u l e tha t d e f i n e s t h a t s ymbo l c an b e d e t e r m i ned wi th the m a p f i l e fo r tha t c ompon e n t ( S e c t i o n A . 2 ) . Symbo l s tha t a r e l o c a l to a m od u l e a r e u s ua l l y e a s y to f i nd b e c a us e mo s t o f t h e mod u l e s t h a t ma ke up the e x e c u t i v e o r a n y o th e r c o mpo n e n t a r e n o t v e r y l a rge . Howe v e r , the l i s t i ng f i l e s fo r some mo d u l e s a r e l o ng e r tha t 5 0 pag e s . Th e r e a r e a c o upl e o f s t e ps th a t c a n b e t a k e n b e fo r e the r ea d e r scans e v e r y pag e of the l i s t i ng , l o o k i ng fo r the p l a c e wh e r e t h e s ym bo l i s d e f i n ed . Th e symbo l i n q u e s t i o n o r s ome tex t ua l refe rence to may app e a r i n the t a b l e o f c o n t e n t s fo r th i s mod u l e . it Th e va l ue o f the s ym bo l appe a r s i n the s ym bo l tabl e . B e c a use the a s sem b l e r i nc l ud e s the v a l ue o f the c u r r e n t l o c a t i o n c o un t e r i n eve r y l i ne o f t h e l i s t i ng , t h e r e ad e r c a n d e t e rm i n e a pp r o x i m a t e l y wh e r e in the l i s t i ng the symbo l is d e f i n ed . ( Th i s t e c h n i que i s n o t fo o l p r o o f . Th e va l ue o f the s ymbo l th a t a ppe a r s i n t h e s ym bo l tab l e i s r e l a t i v e t o t h e beg i nn i ng of the PSECT i n wh i c h the symbo l is d e f i n ed . Mo d u l e s w i th mo r e than o n e r e l o c a t a b l e PSECT m a y have to be sea r c h ed mo r e c a r e f u l l y . ) A. l . 2 Th e VAX- 1 1 I n s t r uc t i o n S e t a nd Ad d r e s s i ng Mod e s O n e o f t h e d e s i g n g o a l s o f t h e VAX- 1 1 i n s t r uc t i o n s e t wa s tha t it c o n ta i n u s e f u l i ns t r uc t i o n s wi th a n a t u r a l numbe r o f o pe r a nd s . Th us , the r e a r e two a nd t h r e e o pe r a nd f o rms o f the a r i thme t i c i n s t r uc t i o n s ADD , S UB , MUL , a nd D I V . Th e r e a r e a l s o b i t m a n i pu l a t i o n i n s t r uc t i o n s , A-4 U S E OF L I STING AND MAP F I LES a c a l l i ng s t a nd a rd , c h a r a c t e r s t r i ng i n s t r uc t i o n s , a nd s o o n . Al l of t h e s e a l l o w t h e a s s e mb l y l a ng uag e p r og r amme r t o p r o d uc e cod e tha t i s n o t o n l y e f f i c i en t b u t a l s o h i g h l y r e ad a b l e . Howe v e r , the r e a r e c e r t a i n p l a c e s i n the e x e c u t i v e wh e r e the mo s t o bv i o us c ho i c e o f i n s t r uc t i o n o r a d d r e s s i ng mod e wa s n o t used , b e c a u s e a sho r t e r o r f a s t e r a l t e r n a t i ve wa s a v a i l a b l e . I n t e r r upt serv i c e r o u t i n e s , r o u t i n e s tha t e x e c u t e a t e l ev a ted I PL , a nd c ommo n l y e x ec u t e d cod e pa ths s uc h a s the s ys t em s e rv i c e d i spa tc h e r a nd the ma i n pa t h s i n the pag e r are all e x ampl e s wh e r e c l a r i t y o f the s o u r c e c o d e wa s s a c r i f i c ed fo r e x e c u t i o n s p e ed . One que s t i o n tha t mus t b e a n swe r ed a t t h i s po i n t i s wh y the r e is a conce rn ov e r i ns t r uc t i o n l eng th o n a mach i n e wi th p r a c t i c a l l y un l i m i ted v i r t ua l add r e s s spac e . Th e r e a r e a t l e a s t a n s we r s two to tha t q ue s t i o n . Mo s t of the a r e a s wh e r e i n s t r uc t i o n s i z e is an i s s u e a r e wi th i n the pe rma n en t l y r e s i d e n t e x e c u t i ve . Th i s po r t i o n o f the sys t e m c o n s um e s a f i x ed pe r c e n t ag e o f the phys i c a l m emo r y t h a t i s pr e s e n t in the con f i g u ra t i on . Ke e p i ng i n s t r uc t i o n s i ze sma l l i s o n e of t h e e f fo r t s tha t c a n be m ad e to k e e p th i s r e a l memo r y c o s t to a m i n i m um . the VAX - 1 1 /7 8 0 m a k e A s e c o nd an swe r i s tha t bo th the VAX- 1 1 /7 5 0 a nd use of an i n s t r uc t i o n l o o k a h e a d b u f f e r tha t c o n t a i n s t h e n e x t e i g h t b yt e s i n t h e i n s t r uc t i o n s t r e am . If the buffe r emp t i e s , the next i n s t r uc t i o n o r ope r a nd c anno t b e ev a l ua t ed unt i l the b uf f e r i s r e p l e n i shed . By k e e p i ng i n s t r uc t i o n s sma l l i n k e y a r e a � , th i s wa i t c a n b e avo i d ed a nd the i n s t r uc t i o n b u f f e r c a n b e f i l l ed i n pa r a l l e l wi th o the r C P U o pe r a t i o n s . A . l . 2 . 1 Tech n i qu e s fo r I n c r e a s i ng I n s t r uc t i o n Spe e d - Th i s s ec t i o n i s a l i s t o f s ome o f the t e c hn i q u e s emp l oyed to r ed uc e i n s t r uc t i o n s i z e o r i nc r e a s e e x e c u t i o n spe ed . Th e l i s t i s h a rd l y e x h a u s t i v e b u t a pa t t e r n eme r g e s h e r e tha t c an be a pp l i ed to o th e r mod ul e s i n the e x e c u t i v e tha t a r e n o t e x pl i c i t l y m e n t i o ned h e r e . Each l i st e l em e n t cons i s ts of a g ene r a l t e c hn i que a nd m a y a l s o c o n t a i n a spec i f i c e x ampl e , i n c l ud i ng the n ame o f the mod ul e wh e r e th i s t ec h n i que is empl o y ed . • Th e MOVAx and PUS HAx i n s t r uc t i o n s c ombi ned wi th d i spl a c em e n t mod e ad d r e s s i ng a r e eq u i v a l e n t to an ADDLx i n s t r uc t i o n wi th the ad d i t i o n b e i ng pe r fo rmed i n o rd e r to c a l c u l a t e the e f fe c t i ve add r e s s of t h e o pe r and . Fo r e x ampl e , the i n s t r uc t i o n PUS HAB 1 2 (R3 ) i s e q u i v a l e n t to ADD L 3 # 1 2 , R3 , - ( S P ) b u t i s o n e byte sho r t e r t h a n the ADD L3 i n s t r uc t i o n faste r . A- 5 a nd a l so U S E OF L I ST ING AND MAP F I LE S • Th e us e o f MOVAx a n d PUS HAx d e sc r i b ed i n the p r ev i o us i tem c a n be comb i n ed w i th i nd ex ed mod e add r e s s i ng to a c compl i sh a m u l t i pl y by 2 , 4 , o r 8 . Fo r e x am p l e , t h e i n s t r uc t i o n MOVA L @#4 [Rl] , Rl mul t i pl i e s the co ntents of Rl by 4 , add s 4 to the p r o d uc t , a nd pl a c e s the r e s u l t b ac k i n to R l . Th i s i ns t r uc t i o n i s used b y the c h a ng e mo d e d i spa t c h e r s ( i n mod ul e CMODS SDS P ) to c a l c u l a te the l e ng th of an a rg um e n t l i s t f r om the n um b e r o f a rg umen t s . • Th e i n s t r uc t i o n MOVAB ( R O ) + , R2 f o und i n r o u t i ne EXE $AL LOCATE i n mo d u l e MEMORYALC p e r fo rm s t wo s t e ps a t o nc e . I t s o s t e n s i b l e p u r po s e i s t o p l a c e t h e a d d r e s s o f t h e a l l o c a te d b l o c k o f memo r y i n to R 2 wh e r e it w i l l be p i c k ed up b y t h e c a l l e r . Howeve r , b e c a us e t h e a l l o c a t ed b l o c k i s a l wa ys a t l e a s t q ua d wo r d a l i g ned , the b y t e c o n t e x t o f t h e i n s t r uc t i o n f o r c e s a n i nc r em e n t o f R O by o n e , s e t t i ng t h e l o w b i t o f R O . Th i s w i l l be i n t e r p r e ted as a s uc c e s s i nd i c a to r by t h e c a l l e r . • Wh e n two s uc c e s s i ve wr i tes to memo r y o c c u r , t h e s e c o nd wr i te m u s t wa i t fo r the f i r s t to c om p l e t e . I f s uc c e s s i ve wr i te o pe r a t i o n s c a n b e ove r l a pped w i th r eg i s t e r - t o - r eg i s te r o pe r a t i o n s , i n s t r uc t i o n s t r eam r e f e r e nc e s , or o th e r o pe r a t i o n s th a t d o n o t g e ne r a t e wr i t e s to memo r y , then s o m e o th e r i n s t r uc t i o n c a n b eg i n e x ec u t i o n wh i l e the m emo r y wr i te i s c ompl e t i ng . Th e r e a r e th r e e p l a c e s i n the e x ec u t i v e wh e r e th i s t e c h n i qu e is u s ed . Th e y a r e among t h e m o s t c ommo n l y e x e c u t ed c od e p a th s i n t h e en t i r e sys tem . Th e pa g e f a u l t h a nd l e r s a v e s R O t h r o ug h RS w i th s e pa r a t e M OVQ i n s t r uc t i o n s i n t e r s pe r s ed i n s t r uc t i o n s th a t d o no t wr i te to memo r y . th r e e among Th e i n t e r r up t se r v i c e r o u t i n e fo r the VAX- 1 1 /7 8 0 UN I B U S ad a p t e r a l so s a v e s RO t h r o ug h R S w i th th r e e MOVQ i n s t r uc t i o n s . He r e , the wr i te s to memo r y a r e ove r l a pped wi th r e f e r e nc e s to I /O s pa c e a d d r e s s e s , spec i f i c a l l y UBA i n t e r n a l r eg i s t e r s , as we l l a s r eg i s t e r m a n i pu l a t i o n s . Th e c h a ng e mod e d i spa tc h e r s fo r e x e c u t i ve a nd ke r n e l mod es b u i l d c us tom i z ed c a l l f r am e s o n t he i r s t a c k s . As F i g u r e 3 - 4 i l l u s t r a t e s , t h e wr i te s to memo r y ( th e s ta c k o pe r a t i o n s ) a r e ove r l a pped w i th r eg i s t e r a nd i n s t r uc t i o n s t r e am r e f e r e nc e s . • Wh e n i t i s n e c e s s a r y t o i nc l ud e a t e s t a nd b r a n c h o pe r a t i o n , a dec i s i on as to wh i c h s e n s e o f the t e s t to b r a n c h o n a n d wh i c h s e n s e to a l l o w t o c o n t i n ue i n l i ne is r eq u i red . On e bas i s fo r th i s d ec i s i o n is to a l l o w the c ommo n ( us ua l l y e r r o r - f r e e ) c a s e t o c o n t i n ue in l i ne , o n l y r e q u i r i ng th e ( s l owe r ) b r a nc h o pe r a t i o n i n unus u a l c a s e s . A- 6 U S E OF L I S T ING AND MAP F I LES A . l . 2 . 2 Un u s ua l I n s t r uc t i o n a nd Ad d r e s s i ng Mod e U s a g e - Th e r e a re s e v e r a l i n s ta nc e s i n the e x e c u t i v e wh e r e the pu r po s e o f a n i n s t r uc t i o n i s n o t a t a l l o bv i o u s . Th i s l i s t i nc l ud e s the mo s t c ommo n o c c u r r en c e s o f u n u s ua l u s e o f t h e i n s t r uc t i o n s e t a nd a d d r e s s i ng mo d e s . • Th e r e a r e m a n y i n s t a n c e s o f the i n s t r uc t i o n s e q u e n c e 10$ : BBSS b i t a r g um e n t s , 1 0 $ wh e r e the i n i t i a l s e t t i ng o f the b i t h a s no e f fec t o n the f l ow o f control . Th i s s e q ue nc e i s used wh ene v e r the b i t to b e set ( o r c l e a r ed wi th a n e q u i v a l e n t s e quenc e us i ng BBCC ) i s i d e n t i f i e d by b i t numbe r o r b i t po s i t i o n . I n o r d e r to s e t ( o r c l e a r ) t h e b i t wi th a B I Sx (or ( B I Cx ) i n s t r uc t i o n , a m a s k mus t f i r s t b e c r e a ted wi th a 1 i n the d e s i g n a t ed po s i t i o n , r e q u i r i ng e i th e r two i n s t r uc t i o n s or an i mmed i a t e ma s k that m i g h t occ upy a l o ng wo r d . ( Th e o n l y e x c e p t i o n t o th i s i nv o l v e s a b i t i n the f i r s t s i x po s i t i o n s , wh e r e t h e ma s k c a n be c o n t a i n ed i n a sho r t l i t e r a l c o n s t a n t . ) No t e th a t a BBC S i n s t r uc t i o n i s equ i v a l en t to a BBSS i n s t r uc t i o n wh e n the b r a nch d e s t i n a t i o n is the n e x t Th e r e a r e some o c c u r r e nc e s o f BBCS wh e r e a B B S S i n s t r uc t i o n . s e ems to a c c ompl i s h the s am e p u r po s e . P r o b a b l y , t h e cho i c e wa s mad e by l o o k i ng a t the u s ua l s e n s e o f the b i t i n que s t i o n befo re the i n s t r uc t i o n a nd c ho o s i ng the i n s t r uc t i o n t o a v o i d the b r a nch i n t h e us ua l c a se . • Th e r e are seve r a l i ns tances o f a u to i nc r em e n t defer red a d d r e s s i ng wh e r e t h e n e ed f o r the i nc r em e n t o f t h e r eg i s t e r i s no t a ppa r en t . Fo r e x ampl e , the i n s t r uc t i ons I N S QU E ( R l ) ,@ ( R 3 ) + REMQUE @ ( R 3 ) + , R4 a nd o c c ur i n the r e s c h ed u l i ng i n te r r upt se r v i c e r o u t i n e i n mod ul e S C HED . In bo th c a s e s , R3 conta ins the add r e s s o f the l i s th e a d of s o m e d o ub l y l i n ked l i s t b e fo r e i n s t r uc t i o n e x e c ut i o n . I t s c o n te n t s a f t e r the i n s t r uc t i o n i s ex e c u t ed a r e i r r e l ev a n t . I n f a c t , th e i nc r em e n t i s t o t a l l y unne c e s s a r y . Al l th a t is n e e d ed i s d o ub l e d e f e r r a l f r om a r eg i s t e r . I n o th e r wo r d s , the a d d r e s s i ng mo d e @ O ( R 3 ) wo u l d be equa l l y a pp r o p r i a t e if the c o n t e n t s o f R 3 a r e n o t i mpo r ta n t . Howe v e r , d e f e r r e d b y t e d i spl a c emen t a d d r e s s i ng c o s t s an extra byte to ho l d the d i spl a c eme n t . In th i s c ommo n l y e x e c u t ed c o d e pa th , t h e s a v i ng s o f a byte wa s ex t r em e l y impo r ta n t . I t i s wo r th n o t i ng t h a t the r e i s no s i m i l a r p r o b l em wh e n a s i ng l e l ev e l o f d e f e r r a l f r om a r eg i s t e r i s r e qu i r ed . Th e a s s emb l e r is sma r t e n o ug h to g e ne r a t e s i mpl e r eg i s t e r d e f e r r ed mod e ( c o d e 6 ) wh e n i t enc o un t e r s byte d i s p l a c em e n t ( O ( r eg ) ) i n t h e so u r c e mod e wi th a d i s pl a c emen t o f z e ro c od e . A-7 U S E OF L I STING AND MAP F I LES • Th e pe rma n e n t s ymbo l t a b l e o f t h e VAX- 1 1 MACRO a s sem b l e r r e c o g n i ze s t h e mnemo n i c P O PL even tho ug h t h e r e i s n o POPL i n s t r uc t i o n s e t . i n s t r uc t i o n i n th e VAX- 1 1 Th e g en e r a ted code for a POPL dst ps e ud o i n s t r uc t i o n i s i d e n t i c a l t o a MOVL ( S P) + , d st i n s t r uc t i o n . Th a t i s , t h e mnemo n i c g e ne r a tes two b y t e s ( fo r i n s t r uc t i o n o pc o d e a nd source o pe r a nd spe c i f i e r ) pl us wh a t eve r i s r e qu i r ed to spec i f y t h e d e s t i n a t i o n ope r a nd . Fo r ex ampl e , t h e p s e ud o i n s t r uc t i o n POPL RO the f i r s t i n s t r uc t i o n i n the c h a ng e -mod e - to-k e r n e l d i spa t c h e r i n mo d u l e CMODS S DS P r emov e s t h e c h a n g e m o d e c o d e f r om the s t a c k ( so th a t RE I wi l l wo r k c o r r ec t l y ) and l o ad s i t i n to R O . A c omb i n a t i o n o f t h i s i n s t r uc t i o n w i th a n u n u s ua l a d d r e s s i ng mod e occ u r s in the except i on d i spa t c h e r fo r c h a ng e -mod e - to - s up e r v i s o r a n d c h a ng e -mod e - t o - u s e r except i ons wh e r e i t i s n e c e s s a r y t o r emove t h e s e c o nd l o ng wo r d f r om the stack . Th e a c t ua l i n s t r uc t i o n , POPL (SP) h a s th e e f f e c t o f r emov i ng the n e x t - to - l a s t i t em f r om the s ta c k a n d d i s c a r d i ng it, l e av i ng the s t a c k i n the s t a t e p i c t u r ed i n F i g u r e A- 1 . • The i n s t r uc t i o n MOVQ R O , RO f o l l owed by s ome c o nd i t i o na l b r a n ch i n s t r uc t i o n pe r fo rms e x a c t l y the same f unc t i o n a s a T S TQ i n s t r uc t i o n , wh i c h d o e s n o t ex i s t . Th i s c u r i o us i n s t r uc t i o n is f o und i n mod u l e SYSSCH EVT , wh e r e the Se t T i m e r Requ e s t a nd Sched u l e Wa k e up s y s tem s e r v i c e s a r e i mp l em e n ted . A. l . 3 U s e o f t h e RE I I n s t r uc t i o n Th e o n l y p e rm i s s i b l e m e a n s o f r e a c h i ng a l e s s p r i v i l eg ed a c c e s s mode f r om a mo r e pr i v i l eg ed mod e is t h r o ug h the R E I i n s t r uc t i o n . Th e r e a r e two s l i g h t l y d i f f e r e n t t e c h n i q ue s th a t a c compl i sh t h i s . A- 8 USE OF L I S T ING AND MAP FILES POPL dest = MOVL(SP)+,dest after POPL (SP) before POPL (SP) X: X: X+4: ... X +8: c X + 1 2: B X + 1 2: X + 1 6: A X+1 6: SP X+8: C (or Indeterminate) SP A Direction of stack growth F i g u r e A- 1 S t a c k Mo d i f i c a t i o n Due to PO P L { S P ) Ps e ud o I n s t r uc t i o n Th e m o s t g en e r a l t e c h n i qu e o f e l ev a t i ng a c c e s s mod e a l l o ws the f l o w o f e x e c ut i o n t o b e a l t e r ed a t the s am e t i me . Th i s s ame t e c hn i que i s a l so u s ed by the RSX- l l M AM E to get i n to c ompa t i b i l i ty m od e . Th e i n s t r uc t i o n s e quenc e PUSHL PUSHL RE I new- P S L n ew-PC a c c ompl i s h e s the d e s i r ed r e s u l t . No te tha t the many p r o t e c t i o n c h ec k s bui l t i n to t h e RE I i n s t r uc t i o n p r ev e n t th i s techn i que f r om be i ng used b y a n o n p r i v i l eg ed us e r to g e t i n to a mo r e p r i v i l eg ed a c c e s s mod e o r t o e l ev a t e I PL , two o pe r a t i o n s tha t wo u l d a l lo w s uc h a u s e r t o d am ag e the sys t em . A- 9 US E OF L I S T ING AND MAP F I LE S A s e c o nd t e c hn i qu e c an b e u s e d wh e n i t i s only necessa r y to change a c c e s s m od e . N o a c compa n y i ng c h a ng e i n c o n t r o l f l ow i s r e q u i red . Th e i ns t r uc t i on seque nce l i s t ed h e r e ( pa t t e r ned a f t e r c o d e c o n t a i n ed in mod u l e PROC S TRT ) shows t h i s s e c o nd t e c h n i que . PUS H L BSBB e x e c u t i v e -mod e-PS L DORE I ; Do p r o c e s s i ng i n ; execut ive access mode PUSHL BSBB u s e r -mod e - P S L DORE I ; Do p r o c e s s i ng i n ; u s e r a c c e s s mod e DORE I : REI A. l . 4 Reg i s t e r Conve n t i o n s ; R E I u s e s pushed PS L a n d PC ; th a t B S B B p u t o n s t a c k E a c h o f the m a j o r s ub s ys t em s o f t h e e x e c u t i ve u s e s a s e t of r eg i s t e r c onve n t i o n s in i ts ma i n rout ines . Th a t i s , t h e same r eg i s t e r s a r e used t o h o l d the same c o n t e n t s f r om r o u t i n e t o r o u t i n e . Some o f the mo r e c ommo n c o nv e n t i o n s a r e l i s t ed h e r e . • • • R4 u s ua l l y c o n ta i n s the a d d r e s s o f the PC B o f the c u r r en t process . Nea r l y a l l s ys tem s e rv i c e s a nd the s c h ed u l e r us e th i s c o nve n t i o n . I n f a c t , a s i l l us t r a ted i n F i g u r e 3 - 4 , the c h a ng e -mod e - to - k e r n e l sys tem s e r v i c e d i spa t c h e r l o ad s the PC B of the c a l l e r i n to R4 be f o r e p a s s i ng c on t r o l to the s e r v i c e - s pec i f i c p r o c ed u r e . Wh en i t is n e c e s s a· r y to s t o r e a PHD add r e s s , RS i s u s ua l l y c h o sen . ( E x c e pt fo r the swa ppe r a nd c e r t a i n memo r y m a n ag em e n t c od e tha t e x e c u te s a t I PL 7 , R S c o n t a i n s t h e add r e s s o f t h e P l w i ndow to t h e p r o c e s s h e a d e r . ) Th e memo r y m a n a g em e n t s ub s ys t em u s e s R 2 to c o n t a i n a n i nv a l i d add r e s s a nd R 3 t o c o n t a i n the sys tem v i r t ua l add r e s s o f the pag e t a b l e e n t r y th a t m a ps the pag e . Wh en a ph ys i c a l pag e i s e v e n t ua l l y a s s o c i a t e d wi t h the pag e , t h e PFN i s s to r ed i n R O . Th e I /O sys t em us e s t wo n e a r l y i d en t i c a l c o n v en t i o n s , d e pend i ng o n wh e th e r i t i s e x e c u t i ng i n p r o c e s s c o n t e x t ( i n the $ Q I O sys tem s e r v i c e o r i n d ev i c e d r i v e r FDT r o u t i n e s ) or in r e sponse t o a n i n t e r r up t . Th e mo s t c ommo n r eg i s t e r c o n t e n t s a r e t h e c u r r e n t I R P a d d r e s s s to r ed i n R 3 a nd t h e UC B add ress i n RS . I n p r o c e s s c o n t ex t , R4 c o n t a i n s t h e a d d r e s s of the PCB o f the r eque s t i ng process . W i th i n i n t e r r up t service r o ut i n e s , R 4 c o n t a i n s the v i r t ua l add r e s s t h a t m a ps o n e o f t h e C SRs o f t h e i n te r r upt i ng d ev i c e . A mo re c ompl e t e l i s t of r eg i s t e r u s ag e b y d ev i c e d r i ve r s a nd the I /0 s ub s y s t em c a n b e f o und i n the VAX/VM S G u i d e to Wr i t i ng a Dev i c e D r i v e r . A- 1 0 U S E OF L I ST ING AND MAP F I LE S A. l. S E l i m i n a t i o n o f S e l d om - U s e d Cod e Th e r e a r e s e v e r a l d i f f e r e n t techn i q ue s tha t a r e u s e d t o e l i m i n a t e c o d e o r d a ta tha t i s no t used ve ry o f ten . Fo r e x ampl e , n o n e o f t h e p r og r a m s u s e d d u r i ng t h e i n i t i a l i z a t i o n o f a VMS s ys tem r ema i n s a f t e r i t s wo r k i s a c c om pl i s h e d . P r o c e s s c r e a t i o n i s a n e x ampl e o f a com pl ex sys t em s e r v i c e tha t d o e s n o t e x e c u t e o f te n d u r i ng the l i fet ime o f a typ i c a l sys t em . VMS u s e s s e ve r a l t e c h n i q ue s tha t a l l o w the s e r o u t i n e s to d o the i r wo r k a s e f f i c i e n t l y a s po s s i b l e a nd ye t e l i m i n a t e them a f t e r the y h a ve d o n e the i r wo r k . A. l . S . l E l i m i n a t i ng the Bo o t s t r a p P r o g r ams - Th e fo l l owi ng l i st i l l ustrates some o f the techn i q ue s used to r emove the bo o t s t r a p p r og rams f r om t h e sys t em a f t e r the y h a v e d o n e the i r wo r k . 1. Bo t h VMB and S Y S B OOT e x ec u te i n phys i c a l pag e s tha t a r e n o t r e c o r d ed a n ywh e r e . Wh e n mod ul e I N I T pl a c e s a l l phys i c a l pag e s e x c e pt tho s e o c c up i ed b y t h e pe rman e n t l y res ident e x e c u t i v e o n t o t h e f r e e pag e l i s t , t h e pag e s u s e d b y VMB a nd SYS B OO T a r e i n c l ud ed . Th e i r c o n t e n t s a r e o v e r wr i t t e n the f i r s t t i me th a t e a c h phys i c a l pag e is u s e d . 2. Th e mod u l e IN I T i s a pa r t o f the l i n k ed e x e c u t i v e a nd c a n no t be e l i m i n a t ed qu i t e so e a s i l y . Ch a pt e r 2 1 d e sc r i b e s how I N I T p u t s t h e phys i c a l pag e s tha t i t o c c up i ed o n to t h e f r ee pag e l i s t a f t e r i t s wo r k wa s d o ne . • • 3. Th e r o u t i n e th a t puts the phys i c a l pag e s o n the f r e e pag e l i s t pe r f o rms a s t r a i g h t f o rwa r d f un c t i o n . Th e un u s ua l pa r t o f t h i s s t e p i s tha t th i s r o u t i n e wa s f i r s t co p i ed to a n u n u s e d po r t i o n o f n o npag ed po o l , b u t t h e po o l spac e wa s n o t fo rm a l l y a l l o c a t e d . Wh e n the rout i ne has a c c ompl i shed i t s wo r k a nd r e t u r n ed , the c o d e r em a i n s u n t i l t h e po r t i o n o f po o l tha t it o c c upi ed is used later on , wh e n the l ast traces of INIT a re e l i m i n a t e d f r om the s y s t e m . No t e tha t t h i s t ec h n i que a s s um e s th a t n o po o l a l l o c a t i o n t a k e s pl a c e un t i l i t i s done . Th e f a c t tha t I PL r em a i n s a t 3 1 wh i l e INIT e x e c ute s i n s u r e s tha t n o s uc h a l l o c a t i o n o c c u r s . Th e sys t em i n i t i a l i z a t i o n tha t t a k e s pl a c e i n p r o c e s s c o n t e x t c a n be th o ug h t o f a s a pa r t o f t h e swa ppe r p r o c e s s b e c a u s e t h e swa ppe r c r e a t e s SYS I N I T , wh o i n t u r n c r e a t e s t h e START U P process . Bec a u s e b o th SYS I N I T a nd S TARTUP a r e s e pa r a t e p r o c e s s e s , howe v e r , they d i s a ppe a r a fter the y a r e d e l e t e d ( wh e n they h a v e c ompl e t ed the i r wo r k ) . by A . l . 5 . 2 S e l d om-Used Sys t em Ro u t i n e s - Th e s i mpl e s t t e c h n i que used the sys tem to prevent s e l d om- u s ed c o d e f r om pe rm a n e n t l y o c c upy i ng memo r y i s to put i t i n to t h e pag ed e x e c u t i v e . Th e n o rm a l ope r a t i o n o f s ys tem wo r k i ng s e t r e pl a c em e n t wi l l e v e n t ua l l y f o r c e tho s e pag e s tha t a r e r e f e r en c ed o nc e a nd n e v e r ag a i n o u t o f t h e s ys tem wo r k i ng s e t . Th i s t e c h n i que i s used by s ev e r a l sys t em s e rv i c e s tha t a r e no t c a l l ed very o ften , s uc h a s the Se t T i m e sys tem s e rv i c e , wh i c h c h a ng e s the sys t em t i m e . P r o c e s s c r ea t i o n a nd d e l e t i o n a r e a l s o events tha t d o A- l l U S E OF L I STING AND MAP F I LE S no t occur v e r y o ften . B e c a u s e p r o c e s s c r e a t i o n i s s p r e a d th r o ug h o u t t h e s ys t em , seve r a l t e c hn i que s a r e emp l o yed t o e l i m i n a t e t h e cod e f r om t h e sys tem a f t e r the p r o c e s s i s c r ea t ed . A. l . 6 1. Th e r o u t i n e s i n t h e C r e a t e P r o c e s s s y s t em s e rv i c e ( and a l so · t h e De l e t e P r o c e s s sys t em s e rv i c e a nd i t s a s s o c i a t ed spec i a l ke r n e l AST ) a r e l o c a ted i n the pag e d ex e c u t i ve . 2. Th e swa ppe r h a s a spec i a l s ub r o u t i n e th a t i t c a l l s wh en it i n s waps a n e wl y c r e a t ed p r o c e s s f r om S h e l l . Th i s s ub r o u t i n e i s l o c a t e d i n two o f the pag e s t h a t the swa ppe r j us t r ead i n to mem o r y . Be c a use o f t h e wa y t h a t the swa ppe r d o e s i t s I / 0 , t h e s e pag e s a r e ma pped a s PO pag e s i n the swa ppe r ' s add ress spac e . Th e s e pag e s b ecome t h e k e r n e l s t a c k o f t h e n e w p r o c e s s ( wh i c h c a nno t e x e c u t e un t i l the swa ppe r m a r k s t h e process as C OM , a fter it is f i n i s h ed wi th t h e spec i a l s ub r o u t i n e ) . Th e swa ppe r has s uc c e ed ed i n e x e c u t i ng two pag es wo r th o f cod e ( th a t a r e o n l y u s e d the f i r s t t i me th a t a p r o c e s s i s i n swa pped ) wi tho u t r e q u i r i ng a n y phys i c a l memo r y . 3. Th e f i n a l s t e ps o f p r o c e s s c r e a t i o n t a k e p l a c e i n the c o n t e x t of th e new p r o c e s s i n r o u t i n e EXE $ PROCSTRT , l o c a t ed i n t h e pag ed e x e c u t i ve . Dynam i c a l l y Loc k i ng Cod e o r Da t a i n to Memo r y Th e f r e q u e n c y o f u s e i s n o t t h e o n l y c r i t e r i o n t h a t i s used t o d e c i d e wh e t h e r to put a r o u t i n e i n to the pag ed o r no npag ed ex ec u t i v e . Th e pag e f a u l t h a nd l e r a s s um e s tha t i t w i l l nev e r i nc u r a pag e f a u l t above I PL 2 . ( Th i s a s s um p t i o n i s e n fo r c ed by i s s u i ng a f a t a l b ug c hec k i f i t i s v i o l a t ed . ) S e v e r a l sys tem s e rv i c e s t h a t a r e n o t used ve r y o f ten ( i nc l ud i ng C r e a t e P r o c e s s a nd De l e t e Process ) m u s t e l ev a t e I PL to 7 to synch r o n i ze a c c e s s to the s c h e d u l e r ' s d a t a b a s e . Th e r e a r e seve r a l d i ffe rent t e c h n i q u e s used t o m i n i m i z e the c o n t r i b u t i o n t h a t t h e s e r o u t i n e s m a k e to t h e nonpag ed e x e c u t i v e . A. l . 6 . 1 Lo c k i ng Pag e s i n E x t e r n a l Imag e s - Th e s i mpl e s t t echn i que fo r l o c k i ng d own pag e s wh i l e e x e c u t i ng a t I P L 7 i s used by p r i v i l eg ed u t i l i t i e s t h a t use the $ CM KRN L sys t em s e r v i c e . Th e s e prog r ams c a n use the $ L KWSET s ys t em s e rv i c e to l o c k d o wn the code a nd d a t a pag es tha t a r e r e f e r e n c ed wh i l e I PL i s e l ev a t ed a bove 2 . Th i s t ec h n i que is not a v a i l a b l e to exec u t i v e r o u t i n e s o r u s e r -wr i t t e n sys tem se rv i c e s . A . l . 6 . 2 P l a c i ng C o d e i n t h e No npag ed E x e c u t i v e - Th i s techn i que puts the sm a l l e s t po s s i b l e b l o c k of code i n to the n o n pag ed exec ut i v e a nd pl a c e s the r e s t o f the r o u t i n e i n to the pag ed e x e c ut i v e . A con t r o l t r a n s f e r a l l o ws t h e n o n pag ed cod e t o e x ec ute . Th e fo l l owi ng v a r i a t i o n on a r o u t i n e w i th i n t h e $ G E TJ P I s y s tem s e rv i c e i l l ustr ates the t e c h n i que . Th e reason tha t the ent i re r o u t i n e c a nno t ex i s t i n pag e ab l e pag e s i s b e c a use r o u t i n e EXE $NAMP I D r e t u r n s a t I P L 7 . A- 1 2 U S E OF L I S T ING AND MAP FI LES . PS EC T Y E XE PAG ED . ENAB LE LOCAL B LO C K P r o c e s s i ng beg i n s i n pag ed c o d e JSB 25$ . SAVE P S E C T 25$ : . PS ECT JSB SE T I P L RSB AE XENON PAG E D EXE $NAM P I D #0 Th i s i s o n l y nonpag ed p i e c e . RE S TORE P S E C T P r o c e s s i ng c o n t i n ue s i n pag ed c o d e A . l . 6 . 3 Dynam i c Lo c k i ng o f Pag e s - Th e p r e c ed i ng p i e c e o f code onl y contr i butes t e n b y t e s to the n o n pag ed e x e c ut i v e . Th e C r e a t e P r o c e s s a nd De l e t e Pr o c e s s sys tem s e r v i c e s mus t e x e c ute m a n y mo r e i n s t r uc t i o n s at I PL 7. Th e y empl oy a t e c h n i que th a t d yn am i c a l l y l o c k s o n e o r two pag e s i n to mem o r y . ( Th e s y s t em c a nno t use the $ L KWSET s ys t em s e r v i c e to l o c k pag e s i n to the s ys t em wo r k i ng s e t . ) Th i s t e c h n i que i s a l s o n e c e s s a r y f o r us e r -wr i t t e n s ys t em s e r v i c e s t h a t m us t execute a bove I PL 2 bec a u se t h e y m u s t a l s o l o c k pag e s i n to memo r y a nd , in g e n e r a l , c a nno t use the $ L KWS E T sys tem s e r v i c e . Th i s t e chn i que r e l i e s on the a s s ump t i o n tha t once I PL i s e l eva ted to I PL $_S YNC H , no ev e n t s r e l a t ed to pag e f a u l t i ng o c c u r , pa r t i c u l a r l y r emov i ng a pag e f r om t h e p r o c e s s o r sys tem wo r k i ng s e t . ; P r o c e s s i ng beg i n s i n pag ed cod e B EG I N LOC K : DSB INT LOCK I P L No pag e f a u l ts wi l l o c c u r he r e ENB INT Pa g e f a u l ts c an o c c u r ag a i n LOC K I P L : . LONG END L OC K : I P L$ SYNC H AS S UME < E ND LOCK-BEG IN L OCK> L E 5 1 2 The k e y to th i s t e c h n i que i s tha t the DS B I NT m a c r o MTPR ( wh i c h e x pa nd s to a s r c , # PR$ I P L i n s t r uc t i o n ) c a nno t s uc c e s s f u l l y c ompl e t e unt i l bo th the pag e c o n t a i n i ng the i n s t r uc t i o n a nd t h e pag e c o n t a i n i ng the so u r c e o p e r and A- 1 3 U S E OF L I ST ING AND MAP F I LES a r e va l i d . Onc e t h e i n s t r uc t i o n c ompl e t e s ( i m pl y i ng t h a t b o th pag e s a r e v a l i d ) , I PL i s s e t a t 7 , p r eve n t i ng f u r th e r pag i ng a c t i v i t y un t i l t h e I P L i s l owe r ed ( w i th the ENB I N T m a c r o ) . Th e A S S UM E mac r o i s n ec e s s a r y to m a k e s u r e tha t t h e D S B INT m a c r o and source o p e r and a re no t mor e than o ne pag e a pa r t , p r eve n t i ng the po s s i b i l i ty of a n i nv a l i d p a g e b e twe e n the t wo val id pag e s , an o c c u r r e nc e tha t wo u l d s ub v e r t t h i s t e c h n i que . An y e x amp l e o f th i s t ec h n i que a l so h a s some i n s t r uc t i o n tha t t r a n s f e r s c o n t r o l s o th a t the l o n g wo r d c o nta i n i ng I PL $_S YNC H i s not i n t e r p r e t ed as an i n s t r uc t i o n . A n a t u r a l que s t i o n a t t h i s po i n t i s wh y t h e f i r s t t e c h n i que , t h e one u s ed b y $G ETJP I , is n e c e s s a r y a t a l l . It s e ems that the c a l l s i t e to EXE $NAM P I D c o u l d b e l o c ked d own u s i ng th i s t e c h n i que . Th e a n swe r to I t a c c e s s e s the t h i s i s th a t E XE $NAM P I D c a n n o t be c a l l ed above I PL 2 . c a l l e r ' s a rg um e n t l i s t , a d a ta r e fe r e n c e tha t c o u l d po t e n t i a l l y c a us e a pag e f a u l t , a nd pag e f a u l t s a r e n o t a l l o we d above I PL 2 . A.2 U S E O F MAP F I LE S O n e i nd i spens a b l e to o l f o r r e ad i ng the e x e c u t i ve l i s t i ng s i s the map file SYS . MAP f o und i n d i r e c to r y SYS $ S YS T EM . Th i s f i l e wa s p r o d uc ed wh e n t h e e x ec u t i v e i m ag e wa s l i n k ed a nd c o n t a i n s the s ys t em v i r t ua l add resses o f a l l g l o b a l s ymbo l s i n t h e e x e c u t i v e . Mo r e impo r ta n t l y f r om t h e po i n t o f v i e w o f r e ad i ng t h e l i s t i ng s , i t c o n ta i n s a c ross r e f e r ence l i s t i ng of mod u l es tha t d e f i n e a nd r e f e r e n c e e a c h g l o b a l sym bo l . Th e t e c h n i q ues tha t a r e d e sc r i b ed fo r us i ng th i s f i l e a r e a l so a pp l i c a b l e to o th e r m a p f i l es . M a p f i l e s f o r d ev i c e d r i v e r s a r e Th e m a p f i l e s fo r RM S n e c e s s a r y wh en d eb ug g i ng a n ew d ev i c e d r i v e r . a nd DC L a r e a l s o d e sc r i b ed b ec a u se th e s e imag e s d o no t e x e c u t e i n the u s ua l s e n s e but r a th e r a r e m a pped i n to s ys t em o r p r o c e s s v i r t ua l a d d r e s s s pa c e . A. 2 . l Th e Exec u t i ve M a p SYS . MAP Th e r e are two ma i n uses fo r the s ys tem m a p f i l e . One of th e s e o c c u r s wh e n t h e sys tem c r a s h e s . Th e a d d r e s s e s tha t a r e r e po r ted o n e i th e r t h e c o n so l e t e rm i n a l o r i n t h e s ys tem d um p f i l e m u s t b e r e l a t ed to r o u t i n e s i n s ys t em a d d r e s s spa c e . Th e po r t i o n o f the m a p tha t a c t ua l l i s t s i n a sc e nd i ng o rd e r a l l p r og r am s e c t i o n s tha t c o n t r i b ute to the exec u t i ve is use f u l here . Th e a d d r e s s i n que s t i o n i s c ompa r ed wi th e a c h P S E C T c o n t r i b u t i o n un t i l the mod u l e tha t d e f i n e s the s ymbo l is f o und . Th e b a s e a d d r e s s o f th i s mo d u l e i s s ub t r a c ted f r om the a d d r e s s th a t i s b e i ng exam i n ed t o p r o d uc e a n o f f s e t i n to t h e c o r r e c t mod u l e . Th i s o f f s e t c a n be used w i t h the a s s embl e r l i s t i ng to l o c a te the i n s t r uc t i o n or d a t a r e f e r e n c e th a t c a used the e r r o r . Such a n e r r o r s i t ua t i o n c o u l d a r i s e a s a r e s u l t o f a b ug i n VM S b u t mo r e l i k e l y i s d u e to s o m e us e r -wr i t t e n mod i f i c a t i o n t o t h e e x ec ut i v e s u c h a s a d ev i c e d r i v e r , a c u s tom i z ed s ys te m se r v i c e , or s i mpl y a p r o c ed u r e th a t i s c a l l ed t h r o ug h the Ch a ng e Mo d e to Ke r n e l o r Ch a ng e Mo d e to E x e c u t i v e s y s t em s e r v i c e . Th e o n l y l i m i t a t i o n to t h e u s e o f the map in th i s wa y o c c u r s wh e n a sys t em v i r t ua l a dd r e s s i s l a rg e r t h a n t h e h ig h e s t a d d r e s s in the execut ive i m ag e . Th i s p r o b ab l y i nd i c a t e s th a t t h e a d d r e s s i s f o und i n a r o u t i n e t h a t i s d yn am i c a l l y A- 1 4 U S E OF L I S T ING AND MAP F I LES l o ad ed , s uc h as RM S , a d ev i c e d r i v e r , or C PU - d e pend e n t rout i ne s . Ta b l e E-2 l i s ts the g l ob a l po i n t e r s th a t l o c a t e e a c h d ynam i c a l l y m a pped po r t i o n o f s ys t em a d d r e s s s pa c e . B y e x am i n i ng t h e c o n t e n t s o f t h e s e l o c a t i o n s , t h e c ompo n e n t th a t c o n t a i n s the o f f e nd i ng add r e s s c an b e d e t e r m i n ed . Th e s e c o nd u s e o f SYS . MAP o c c u r s wh e n r e ad i ng p r a c t i c a l l y a n y r o u t i n e in the e x ec ut i ve . Due to the m o d u l a r c o n s t r uc t i o n o f VM S , m a n y r o u t i n e s th a t a r e r e f e r e nc ed b y t h e r o u t i n e t h a t is c u r r e n t l y b e i ng l o o ked a t a r e fo und i n some o th e r mod u l e . Th e s i mpl e s t wa y to l o c a t e t h e s e e x t e r n a l s ymbo l s i s to l o o k i n t h e a l ph a b e t i c a l c r o s s r e f e r ence map fo r the e x t e r n a l s ymbo l n ame . Th e f i r s t i t em o f i n fo rma t i o n i s t h e name o f t h e m od u l e th a t d e f i n e s th i s s ym bo l . Al l mod ul e s tha t r e f e r e n c e th i s s ymbo l a r e l i s t ed i n s uc c e ed i ng co l umns . A. 2. 2 RM S . MAP a nd DC L . MAP The s ame c r o s s r e f e r e n c e c a pa b i l i t y me n t i o n ed fo r SYS . MAP o bv i o u s l y a pp l i e s t o a n y c ompo n e n t o f VM S t h a t c o n t a i n s many mod u l e s . Wh i l e r e ad i ng a mod ul e i n DC L fo r e x ampl e , t h e r e ma y be a r e fe rence to an exte rnal s ub r o u t i n e . Th e mo d u l e c o n t a i n i ng that s u b r o u t i n e can be d e t e rm i n ed wi th the c r o s s r e fe r e n c e l i s t i ng in the map f i l e DC L . MAP . RM S a nd the c ommand l a ng uag e i n t e r p r e t e r s p r e s e n t a s e c o nd p r o b l em to a nyo n e a t t emp t i ng to r e l a te code o r d a ta i n v i r t ua l m emo r y wi th r e f e r e n c e s in an a s sembl e r l i s t i ng or i n a m a p f i l e . Bo th i m ag e s a r e m a pped i n to a v i r t ua l add r e s s r a ng e th a t i s n o t known un t i l the m a pp i ng o c c u r s . Th e m a p s m e a nwh i l e c o n t a i n a d d r e s s e s b eg i n n i ng at 0 . Th e t e c h n i q ue to r e l a t e m a p add r e s s e s t o v i r t ua l m emo r y l o c a t i o n s for e i th e r of the s e i m ag e s i s a s fo l l o ws . De s p i te t h e f a c t th a t RM S i s m a pped i n to s ys t em v i r t ua l ad d r e s s s pa c e a nd DC L i s m a pped i n to Pl s pa c e , t h e t e c h n i que em pl oye d i n e a c h c a s e i s the s ame . Wh e n RM S i s m a pped by SYS I N I T , t h e b a s e add r e s s o f the RM S i m ag e is s to r ed i n g lobal l o c a t i o n MMG $G L RM SBAS E . ( Th e c o n t e n t s o f t h i s l o c a t i o n a r e c o p i ed t o l o c a t i o n C T L$ GL RM S BAS E i n the P l po i n t e r pag e by PROC STRT wh e n a proc ess i s c rea t ed . ) Th e b a s e a d d r e s s o f a n y Comma nd La ng uag e I n t e r p r e t e r i s s to r ed i n the f i r s t l o ng wo rd a t g l o b a l l o c a t i o n C T L $AG C L IMAG E . Be c a u s e b o th RM S a nd DC L a r e l i n ked a s the se two s ys tem i m ag e s wi th a b a s e ad d r e s s o f z e r o , t h e c o n t e n t s o f l o c a t i o n s c a n be used a s s i mpl e o f f s e t s to r e l a t e an a d d r e s s e x t r a c ted f r om the map to a v i r t ua l add r e s s i n a r unn i ng sys tem . Fo r e x ampl e , i f a n e r r o r o c c u r r ed a t l o c a t i o n X i n sys t em s pa c e , a nd X wa s l a rg e r than the c o n t e n t s o f MMG $G L RM SBAS E , d eno ted by Y , t h e n the r e l a t i v e o f f s e t i n to the RM S i m a g e is s impl y Y X. ( Obv i o u s l y , if th i s d i f fe r ence is l a rg e r than the s i z e o f the RM S i m a g e , then a d d r e s s Y i s no t in RM S . ) - To g i v e an e x amp l e tha t g o e s i n t h e o th e r d i r e c t i o n ( f r om a r e l a t ive a d d r e s s on an a s s em b l e r l i s t i ng to a v i r t ua l m emo r y l o c a t i o n ) , s uppo s e t h a t w e wi s h to l o c a t e a s p e c i f i c i n s t r uc t i o n 1 n mod ul e DC Labc x y z , p a r t o f t h e DC L i m ag e . Th e r e l a t i v e o f f s e t i n the a s s e m b l y l i s t i ng i s a d d ed to the b a s e add r e s s o f mod u l e DC Labcxyz ( ta k e n f r om DC L . MA P ) to f o rm the o f f s e t i n to t h e DC L i m ag e . Th i s s um is a d d ed to t h e c o n t e n t s o f g l o b a l l o c a t i o n C T L $ AG C L IMAG E t o fo rm t h e P l v i r t u a l add r e s s o f t h e i n s t r uc t i o n . A- 1 5 USE OF LI S T I NG AND MAP F I LES A.2. 3 Dev i c e Dr i v e r Map F i l e s Dev i c e d r i v e r s a r e l o ad ed i n to n o n pag ed po o l b y t h e SYSGEN u t i l i t y . Th e S H OW /DEVI C E c omma nd t o th i s u t i l i ty d i s pl ays among o th e r p i e c e s o f i n f o rma t i o n t h e add r e s s r a ng e i n t o wh i c h t h e d r i v e r image is l o ad ed . Th e s um o f t h e s ta r t i ng a d d r e s s f r om SYSGEN a nd t h e s i z e o f t h e $ $ $ 1 0 5 PROLOGUE p r o g r am s e c t i o n f r om the d r i v e r m a p g i v e s t h e b a s e ad d re s s t ha t i s u s e d to t r a n s fo rm b e twe e n a d d r e s s e s o n t h e a s semb l y l i s t i ng and sys t em v i r t ua l a d d r e s s e s . De bug g i ng d ev i c e d r i v e r s is d i sc u s s ed i n m o r e d e ta i l i n t h e VAX/VMS Gu i d e to Wr i t i ng a Dev i c e Dr i ve r . A. 2. 4 C PU-Depe n d e n t Ro u t i n e s Th e b a s e ad d r e s s o f t h e C PU-d e pe n d e n t c od e ( Ch a pte r 2 2 ) c a n b e fo und in the f o l l o w i ng wa y . Lo c a t i o n EXE $AL L OAVEC i s the a d d r e s s of the f i r s t v e c to r tha t i s l o ad ed b y !N I T , t h e ma c h i ne c h e c k h a nd l e r . Th a t v ec t o r c o n t a i n s a JMP i n s t r uc t i o n t o the C PU-d e pe nd en t ma c h i n e c h e c k h a nd l e r i n nonpag ed po o l . B e c a us e a b s o l u t e a d d r e s s i ng is used wi th the JM P i n s t r uc t i o n , t h e c o n t e n t s o f EXE $AL L OAVE C + 2 a r e the sys t em v i r t ua l add r e s s o f EXE $MCHK . By s ub t r a c t i ng -t h e a d d r e s s o f EXE $MCHK o b ta i ned f r om t h e map f i l e ( S YS LOA7 5 0 . MAP o r SYS LOA7 8 0 . MAP ) , t h e b a s e a d d r e s s o f the C PU -d e pend e n t i mag e i s d e t e rm i ned . A. 2. 5 O th e r Ma p F i l e s A l l o th e r m a p f i l e s c a n a l so be used for the c r o s s r e f e r en c e I n a d d i t i o n , m o s t o th e r compo n e n t s o f c a pa b i l i t i e s a l r e a d y men t i o n ed . VM S e x e c u t e a s r eg u l a r i m ag e s , a nd s o n o b a s e a d d r e s s e s h a ve t o b e u s ed t o l o c a t e a d d r e s s e s i n v i r t ua l add r e s s s pa c e . Th e a d d r e s s e s o n t h e m a p c o r r espo nd t o the v i r t ua l a d d r e s s e s tha t a re used wh e n t h e i m ag e e x e c u t e s . Th e o n l y e x c e p t i o n s to th i s a r e s h a r e a b l e i m ag e s . Howe v e r , t h e m a p f i l e f r om a n e x e c u t a b l e i m ag e t h a t i nc l ud e s a g i v e n sha r ea b l e i mag e c a n b e u sed t o d e t e rm i n e the base address of a s h a r e a b l e i mag e i n a s pe c i f i c i n s ta nc e . A. 3 T H E SYS TEM DUMP ANALY Z ER ( SDA ) Be c a u s e some o f the r o u t i n e s a nd mo s t o f the d a t a s t r uc t u r e s used by VAX/VMS a r e l o a d ed o r c o n s t r uc ted d y n am i c a l l y , t h e m a p f i l e i s l i m i t ed In i n i t s a b i l i ty to r e l a te a d d r e s s e s to d a ta s t r uc t u r e s o r r o u t i n e s . add i t i on , t h e ma p f i l e c an o n l y s upp l y a d d r e s s e s o f s ta t i c d a ta s to r ag e a r e a s i n VM S , and n o t the i r conten t s . Th e s ys t em d ump a na l yz e r i s a to o l th a t o v e r c ome s t h e se l i m i t a t i o n s of the m a p f i l e s . Th e u s e o f the s ys tem d ump a na l y z e r i s d e sc r i b ed i n the VAX/VMS Sys t em Dump Ana l y z e r Re f e r e n c e Ma n ua l . Th i s s e c t i o n m e n t i o n s s e v e r a l o f t h e m a n y S DA c ommand s t h a t a r e e spec i a l l y u s e f u l wh en s t ud y i ng h o w VM S wo r k s . A- 1 6 U S E OF L I STING AND MAP F I LE S A. 3 . 1 G l o b a l Loc a t i on s Ma n y o f t h e d yn am i c d a t a s t r uc t u r e s , l o c a te d i n pa r t s o f s ys te m ad d r e s s spa c e tha t a r e b e yo nd t h e l a s t a d d r e s s i n t h e e x e c u t i ve i m ag e , a r e l o c a t ed th r o ugh g l o b a l po i n te r s in the s t a t i c pa r t o f t h e e x e c ut i v e ( th e pa r t f o und in the i mag e SYS . EXE ) . Th e s e s t a t i c l o c a t i o n s a r e l o ad ed wh e n t h e s t r uc t u r e s i n que s t i o n a r e c r e a t e d o r mod i f i ed , e i the r as a pa r t o f s ys t em i n i t i a l i za t i o n o r some o th e r l o a d i ng m e c h a n i sm . By us i ng t h e SHOW SYMBOLS /ALL c ommand to S DA , n o t o n l y the a d d r e s s e s but a l so the c ontents o f a l l g lobal loca t i ons in the e x ec u t i v e a r e put i n t o SDA ' s o u t put f i l e . Th i s l i s t , t og e the r w i th t h e m a p f i l e SYS . MAP , enab l e s any d a t a s t r uc t u r e t o b e l oc a ted i n sys tem ad d r e s s s pa c e i f t h e g l ob a l name o f the l i s t h e a d tha t l o c a t e s t h e s t r uc t u r e i s known . Append i x B c o n ta i n s a c ompl e t e l i s t o f t h e s t a t i c d a t a l o c a t i o n s used b y VM S . A. 3 . 2 La yo u t o f Sys t em V i r t ua l Ad d r e s s Spa c e A s e c ond use f u l a ppl i c a t i o n o f S DA i nvo l v e s c r e a t i ng a p i c ture o f As F i g u r e 1 - 6 s h ows , m a n y o f the p i e c e s o f s ys tem add r e s s s pa c e . s ys tem a d d r e s s s pa c e a r e c o n s t r uc ted at i n i t i a l i za t i o n t i me . Th e s i zes o f the v a r i o u s p i e c e s a r e d e t e r m i ned by SYS B OOT pa r a m e t e r s ( Append i x E ) . By i s s u i ng the SHOW PAGE_TABLE / S YS TEM S DA c omma nd , the c o n t e n t s o f the en t i r e sys tem pa g e t a b l e a r e l i s ted . Th i s l i s t i ng , the s ym bo l t a b l e p r o d uc ed i n the p r ev i o u s e x ampl e , a nd the exec u t i v e m a p f i l e SYS $ S Y S T EM : SYS . MAP a l l ow a n a c c u r a t e p i c t u r e o f s ys tem v i r t ua l add r e s s s pa c e to b e d r a wn . I n f a c t , t h i s t ec hn i qu e wa s used to g e ne r a t e F i g u r e 1 - 6 , F i g u r e E - 1 , a nd Ta bl e E - 2 . A. 3 . 3 L a yo u t o f P l S p a c e S DA c a n a l s o b e used to o b t a i n the l a yo ut o f P l s pa c e . Mo s t of the pi eces of Pl s pa c e ( F i g u r e 1 - 7 , Tab l e E - 4 ) a r e f i x ed s i z ed p i e c e s . Th e Pl pag e ta b l e s d e f i n ed i n mod u l e S H E LL d e te rm i n e the s i ze s o f the s e p i e c e s . Oth e r p i e c e s m a y n o t even ex i s t fo r some p r o c e s s e s . In a n y c a se , the S DA c omm a nd S HOW PROC ESS/PAG E_TAB L E S p r o d uc e s a c ompl e t e l a yo u t o f P l s pa c e . g e n e r a t e F i g u r e 1-7 a nd Ta b l e E - 4 . A. 4 Th i s t e c h n i q ue wa s used to INTERPRET ING MDL F I L E S Th e r e a r e v e r y many d a t a s t r uc t u r e s a nd o th e r sys t em wi d e c o n s t a n t s u s e d by t h e exec ut i v e a nd o th e r sys tem componen ts . Th e s e s t r uc t u r e s a r e d e f i n ed wi th a s pe c i a l s t r uc t u r e d e f i n i t i o n l a ng uag e c a l l ed MDL . Th i s l a ng uag e a l l ows d a t a s t r uc t u r e s to be d e f i n ed f r om a s i ng l e so u r c e b u t used i n e i t he r VAX- 1 1 MACRO o r B L I S S - 3 2 . A- 1 7 U S E OF L I S T ING AND MAP F I LE S Wh e n a VM S s ys tem i s b u i l t f r om so u r c e , a p r e p r o c e s s i ng p r o g r am c a l l ed MDL r e ad s a l l s y s t em d a ta s t r uc t u r e d e f i n i t i o n s ( f r om the t wo f i l e s [ E XEC . S RC ] S YS DE F . MD L a nd [ VM S L I B . SRC ] S TARDE F . MDL ) a nd p ro d u c e s two o ut p u t f i l e s fo r each i nput f i l e . One o f t h e s e o u t p u t f i l e s c o n t a i n s mac r o d e f i n i t i o n s f o r u s e b y VAX - 1 1 MACRO . Th e o th e r o u t p u t file is used b y t h e B L I S S c om p i l e r t o p r od uc e B L I S S m a c r o d e f i n i t i o n s . Th i s s ec t i o n i s no t a n e x h a u s t i v e d i sc u s s i o n o f e v e r y MDL d i r e c t i ve . Ra t he r , i t a t t em p t s to show how t h e MDL d e s c r i p t i o n o f a d a t a s t r uc t u r e c an b e r e l a ted to e i th e r a p i c t u r e o f the s t r uc t u r e o r the r e s u l t i ng VAX- 1 1 MACRO o r B L I S S - 3 2 d e f i n i t i o n s . A. 4 . 1 S ampl e S t r uc tu r e De f i n i t i o n s Th e s i m p l e s t wa y t o i l l u s t r a t e t h e wa y t h a t a s t r uc t u r e i s d e f i ne d is to l o o k a t t h e r e s u l t a n t symbo l d e f i n i t i o n s . One wa y t o a c c ompl i sh t h i s i s to c ompa r e the MDL d e f i n i t i o n o f a g i ven s t r uc t u r e w i th the r e s u l ta n t VAX- 1 1 MACRO o r B L I S S - 3 2 s ym bo l s . Th e s e s ym bo l s can be fo und in a ny l i s t i ng tha t uses the s t r uc t u r e in q ue s t i o n . A l t e r na t i ve l y , t h e c omma nd p r o c ed u r e l i s t ed i n the b eg i n n i ng o f th i s a ppend i x c a n b e u s ed . Th e r e a r e th r e e t ab l e s l i s ted h e r e to show the r e s u l t s o f s i m p l e MDL d i r ec t i ves . Ind i v i d ua l MDL c omma nd s a r e b r i e f l y d e sc r i b ed in the fo l l o w i ng s e c t i o n s . Tab l e A - 1 shows the r e s u l t of the c ompl e t e MDL d e f i n i t i on of the l og i c a l n ame bloc k ( p i c t u r ed in F i g u r e 2 6 - 2 ) . No t i c e tha t the s t r uc t u r e h a s a v a r i ab l e l eng th . Th e s ymbo l LOG$K L ENGTH o n l y r e p � e s e n t s the l eng t h o f the f i x ed s i z e po r t i o n o f t h e s t r uc t u r e , e x c l ud i ng t h e s to r ag e a r e a s fo r the l og i c a l name a nd equ i v a l e n c e name c o un ted s t r i ng s . Ta b l e A- 2 i l l u s t r a t e s the s ev e r a l uses o f the S d i r e c t i ve , us i ng ex c e r p t s f r om the d e f i n i t i ons fo r the PC B ( Ta b l e D- 2 ) , the p r o c e s s head e r ( Ta b l e D- 3 ) , a nd the t i m e r q ue ue e l emen t ( Fi g u r e 1 0-1 ) . Ta b l e A- 3 i l l us t r a t e s the even t ua l r e s u l ts o f u s i ng MDL t o d e f i n e v a r i a b l e l eng th b i t f i e l d s . Th e AST c o n t r o l block i s p i c t u r ed in Figure 5 -l . Th e s pe c i f i c f i e l d s wi t h i n a v i r t ua l add r e s s a r e p i c t u r ed i n F i g u r e 1 2 -1 . A. 4 . 2 Common l y U s ed MDL Comm a nd s Th i s s e c t i o n d e sc r i b e s the MDL d i r e c t i v e s c ommo n l y u s ed i n d e f i n i ng s t r uc t u r e s used by VMS . Emph a s i s i s o n r e ad i ng the MDL f i l e s used by Ra th e r , the VM S . A c ompl e t e s yn ta x of each c omma nd is not g i v e n . f e a t u r e s of e a c h d i r ec t i v e tha t a r e used b y VMS a r e emph a s i zed . A. 4 . 2. 1 $ STRUCT D i r ec t i v e - E a c h s t r uc t u r e d e f i n i t i o n b eg i n s wi th a $ S TRUC T s t a teme n t . Th i s s t a t eme n t d e f i n e s t h e p r e f i x c h a r a c t e r s i n e a c h s ymbo l d e f i n i t i o n . Fo r e x ampl e , $ S TRUCT PC B d e f i ne s the PC B s t r uc t u r e , wh e r e e a c h s ym bo l d e f i n i t i o n b eg i ns wi t h t h e c ha r a c t e r s PCB . In t h e d e fa u l t c a s e ( us e d by VMS ) , the n e x t c h a r a c t e r i n e a c h r e s u l t a n t s ym bo l name i s the c u r r en c y s ymbo l ($) . Co n s t a n t d e f i n i t i o n s c a n h a v e a n u nd e r s c o r e ( ) , a C , o r a K a s t h e F i e l d d e f i n i t i o n s h a v e a cha r a c t er ( B , W , L, o r Q ) n e x t c ha r a c t e r ( s ) . tha t r ep r esents the s i ze o f t h e f i e l d . Th e n am i ng conven t i o n s t h a t MDL s ymbo l s a d h e r e to a r e l i s te d i n App e nd i x c . A- 1 8 Tab l e A- 1 MDL D e s c r iption and Re sul tant Symbo l D e f in iti ons for Log i c a l Name B lo ck MDL D i r ec t i v e M e a n i ng o f D i r ec t i v e Re s u l t a n t Sym bo l Nam e $ S TR UC T LOG B eg i n LOG s t r uc t u r e defini tion Lo ng wo r d f i e l d Lo ng wo rd f i e l d Wo r d F i e l d Byt e f i e l d By t e f i e l d Wo rd F i e l d Byt e f i e l d S k i p o n e s pa r e b yt e LOG $ L L T F L LOG $ L L T B L LOG $W S I Z E LOG $B TYPE LOG $ 8 T.AB LE LOG $W G R OU P LOG $ B=.AM OD none F F F F F F F F L TF L , L L TB L , L S IZ E , W T Y PE , B T.AB LE , B G R OU P , W .AM OD , B ,B F L M B XUC B , L L E NGTH F Sym b o l Va l ue ( d ec i m a l ) 0 4 8 10 11 12 14 E f f e c t o n I n t e r na l Co un t e r Va l ue I n c r e a se b y 4 I nc r e a se b y 4 I n c r ea s e b y 2 I nc r e a s e b y 1 I n c r e a se b y 1 I n c r e a se b y 2 I n c r e a se b y 1 Inc r e a s e b y 1 ( ev en tho ug h no s ym b o l d e f i n ed ) I n c r e a se b y 4 none none n o n e ( bec a us e s i ze i s ze r o ) N.AM E , T , O Lo ng wo rd f i e l d De f i n e s t r uc t u r e l eng th t o t h i s po i n t A t e x t s t r i ng b eg i n s h e r e LOG $ L MBXU C B LOG $C L ENGT H LOG $ K L E NGTH LOG $ T=N.AME 16 20 20 20 c c c S Y S TEM , O GR O U P , l PR OC ES S , 2 D e f i n e a c on s t a n t D e f i n e a c on s t a n t D e f i n e a c on s t a n t 0 1 2 none n o ne none c N.AM LENGT H , 6 4 LOG $C S YS TEM LOG $C G R OU P LOG $ C=P R OC E S S D e f i n e a c o n s ta n t LOG $C_N.AM LENGTH 64 none E Te rm i n a t e s t r uc t u r e definition USE OF LIST ING AND MAP FI LES Tab l e A- 2 Examp l e s of the S D i rect ive Resul tant Symbol Name Symbol Val ue (dec imal ) Ef fect on Internal Coun ter Val ue PCB$L ARB PCB$L-U IC PCB$W=MEM 1 32 136 136 PCB$W_GRP 1 38 PCB$C LENGTH PCB$K=LENGTH 140 140 Increase by 4 Inc rease by 4 none ( se t subfi eld counter to 2 ) none ( se t subfield counter to 4 ) none Longwo rd Field Byte Subfi eld wi th o r i g i n o f 3 Longwo rd Field PHD$L PAGFIL PHD$B=PAGF IL 28 31 Increa se by 4 none PHD$L_PSTBASOFF 32 Inc rease by 4 Longwo rd Field Byte Sub f i eld wi th o r i g i n o f 3 Longwo rd Field PHD$L P OLRASTL PHD$B=ASTLVL 200 203 Inc rease by 4 none PHD$L_P 1BR 204 Inc rease by 4 TQE$L PID TQE$L-FPC TQE$L-AST TQE $L-FR3 TQE$L-ASTPRM TQE $L-FR4 TQE$Q=T IME 12 12 16 16 20 20 24 Inc rease by 4 none Increase by 4 none Increase by 4 none Inc rease by 8 MDL Di recti ve Mean ing of Di rec tive $STRUCT PCB Beg in De f i n it ion o f PCB Struc ture . . s ARB , L UIC , L MEM , O , W s GRP, 2 , W L LENGTH F F Longwo rd Fi eld Longwo rd Fi eld Wo rd Subfi eld wi th o r i g i n o f 0 Word Sub f i eld wi th o r i g i n o f 2 De f ine Length o f PCB E Terminate PCB De f i n i t ion $STRUCT PHD Beg in Def i n i t ion of PHD Struc ture . F . s F PAGF I L , L PAGF I L , 3 , B PSTBASOFF, L . s F POLRASTL ASTLVL , 3 , B F P lBR, L E Terminate PHD De f i n i tion $STRUCT TQE Beg in De f i n i t ion of TQE Struc tur e PID, L FPC , , L AST, L FR3 , , L ASTPRM , L FR4 , , L TIME , Q F s F s F s F E . Longwo rd Fi eld Sub f i eld wi th same val ue Longwo rd Fi eld Sub f i eld wi th same val ue Longwo rd Field Sub f i eld wi th same val ue Quad wo rd Fi eld Terminate TOE De f i n i tion A- 2 0 Table A- 3 S amp l e Var i ab l e Length B i t F i e l d Def initions MDL Di r ec t i v e Mean i ng of Di r ec t iv e $S TRUCT ACB Beg i n De f i n i t i o n o f ACB S t r uc tu r e F Byte F i e l d Beg i n Bi t F i e l d De f i n i t ions B i t Field o f S i ze 2 and Or ig i n 0 RMOD , B V< M ODE , 2 ,4 QUOTA , , , M KAST F > PID, L S k i p 4 Spa r e B i ts S i ng l e B i t F i e l d wi th Ma s k De f i n i t i o n S i ng l e Bi t F i e l d E n d Bi t F i e l d De f i n i t i o n s Longwo rd F i e l d E Te rm i nate ACB De f i n i t i o n $STRUC T VA Beg i n VA B i t F i e l d De f i n i t i ons v < BYTE , 9 , , M Beg i n Bi t F i e l d De f i n i t i o ns B i t Fi e l d o f S i ze 9 and Or ig i n 0 VPN , 2l , , M B i t F i e l d of S i ze 2 1 and Or ig i n 9 Pl, , ,M S i ng l e Bi t Fi e l d at Bi t 3 0 S YS TEM , , , M S i ng l e B i t Fi e l d a t Bi t 3 1 > v < > E ,9 VPG , 2 3 , , M End Bi t F i e l d De f i n i t i ons Beg i n New Se t of B i t Fi e l d De f i n i t i o n s Sk i p o v e r t h e F i r s t N i n e B i ts B i t Field of s i ze 23 a nd Or ig i n 9 End Second Set o f Bi t De f i n i t i o n s Te r m i n a te VA De f i n i t i o n Resul tant Symbol Names Symbol Va l ue { d ec imal } ACB $B_RMOD 11 ACB $V MODE ACB $S=MODE 0 2 ACB $V QUOTA ACB$M-QUOTA ACB $V=KAST 6 0 0 0 0 0 0 4 0 {hex } 7 ACB $L_PI D 12 VA$V BYTE VA$S-BYTE VA$M-BYTE VA$V-VPN VA$S-VPN VA$M-PFN VA$V-P l VA$M-P 1 VA$V-SYSTEM VA$M=SYSTEM 0 9 O O O OO lF F 9 21 3FFF F E O O 30 40000000 31 80000000 VA$V VPG VA$S-VPG VA$M=VPG 9 23 FFFFF E O O (hex } { hex } {hex } {hex } ( hex } In t e r nal Bi t Co un ter { be fo re } { a f te r } 0 2 2 6 6 7 7 beyo nd l im i t 0 9 9 30 30 31 31 32 9 32 U S E OF L I S T ING AND MAP F I LE S A . 4 . 2 . 2 F D i r ec t i ve - F i e l d s i n a d a t a s t r uc t u r e a r e d e f i n ed w i t h the F d i r ec t i ve . Th e n am e of e a c h f i e l d is the f i r s t a rg um e n t of the f i e l d d e f i n i t i o n a nd f o rm s the b a l a n c e of a s ym bo l name . Th e v a l ue o f the s ymbo l name i s s e t e qua l to a n i n t e r n a l c o un t e r . As e a c h f i e l d d e f i n i t i o n i s p r o c e s s ed , t h e i n t e r n a l c o un t e r va l ue is i nc r e a s ed b y t h e s i ze o f t h e f i e l d ( 1 , 2 , 4 , o r 8 ) . Th e d e fa u l t s i ze o f a f i e l d i s f o u r , r ep r e s e n t i ng a l o ng wo rd . Th i s d e fa u l t c a n b e ov e r r i d d en b y i nc l ud i ng a s ec o nd p a r ame t e r to the F d i r ec t i ve . Leg a l c h a r a c t e r s a r e B , W , L , Q , a nd T . Th e f i r s t f o u r po ss i b i l i t i e s c o r r e spo nd to the l og i c a l or i n teg e r VAX- 1 1 d a t a t ype s . Th e T a rg um e n t i nd i c a t e s a t e x t s t r i ng , wh o s e s i ze a ppe a r s a s t h e th i r d a rg um e n t . ( A c o un t ( th i rd ) a rg umen t f o r a ny f i e l d t ype i nc r e a s e s th e i n t e r n a l po i n t e r v a l ue b y t h e s i ze o f t h e f i e l d m u l t i pl i ed b y t h e c o un t . ) A . 4 . 2 . 3 L D i r ec t i ve - Th e L d i r ec t i v e i s used to c r e a t e a l ab e l a t a spec i f i ed po i n t in a d a ta s t r uc t u r e . VMS u s e s the L d i r e c t i v e to d e f i n e the l eng th o f a s t r uc t u r e b y g i v i ng the r e s u l t a n t n am e the s u f f i x LENGTH . A . 4 . 2 . 4 E D i r ec t i ve - Th e s t r uc t u r e d e f i n i t i o n i s t e rm i n a ted wi th E d i r ec t i ve . an A. 4 . 2. 5 S D i r ec t i ve - I t i s o f t e n d e s i r ab l e to g i v e a f i eld two n am e s . I n add i t i o n , s ub f i e l d s wi th i n a f i e l d o f t e n ex i s t . Th e S d i r ec t i ve d e f i n e s a s ym bo l w i th the i nd i c a t ed name a nd a v a l ue d e r i v ed f r om the i n te r na l po i n t e r wh en the c u r r e n t F d i r ec t i v e wa s i s s ued . Th e s e c o nd a rg umen t i nd i c a t e s how f a r i n to the c u r r e n t f i eld the s ub f i e l d ex i s t s . Th e th i r d a rg umen t i nd i c a t e s the s i ze of the s ub f i e l d . Fo r e x ampl e , t h e fo l l o w i ng l i n e s f r om the PC B s t r uc t u r e d e f i n i t i on F S S UIC , L MEM , O , W GR P , O , W r e s u l t i n a symbo l PCB $W MEM th a t h a s the s am e v a l ue a s PC B $ L U I C and a s ec o n d s ymbo l PC B $W-GRP t h a t is two l a rg e r th a n the oth e r two s ym bo l s . Ta b l e A-2 shows s ev e r a l ex ampl e s o f the s d i r e c t i v e . A . 4 . 2 . 6 C D i r ec t i ve - Th e C d i r ec t i v e a l l o ws a c o n s t a n t o r a se r i es of cons tan t s t o b e d e f i ned . Depend i ng o n wh a t o th e r pa r am e t e r s a r e s uppl i ed , t h e C d i r ec t i v e prod uc e s symbo l s o f t h e f o rm x y z $C n am e , x y z $K name , o r x y z $ name . Th e e x amp l e i n Ta b l e A- 1 i l l us t r a tes o ne u s e o f t h e c d i r ec t i ve . Th e r e a r e s eve r a l o th e r ex ampl e s o f cons t a n t d e f in i t i ons in e i th e r SYS DE F . MD L o r STARDE F . MDL , such as the d e f i n i t i o n s of t h e DYN $ symbo l s th a t d e sc r i b e d yn am i c a l l y a l l o c a ted s t r uc t u r e s o r the J P I $ s ymbo l s , t h e c od e s t h a t d e sc r i b e a n i n f o rm a t i o n l i s t to the $G E TJ P I s y s t em s e r v i c e . A- 2 2 U S E OF L I ST ING AND MAP F I LE S A . 4 . 2 . 7 M a nd P D i r e c t i v e s - Th e M a nd P d i r e c t i v e s a r e u s ed tog e th e r to al low the s am e f i el d s i n a d a ta s t r uc t u r e to have d i f f e r e n t d e f i n i t i o n s d epend i ng o n t h e c o n t e x t i n wh i ch t h e y a r e u s ed . Fo r e x am pl e , the UCB d e f i n i t i o n c o n t a i n s f i e l d d e f i n i t i o n s a t the e n d o f t h e s t r uc t u r e tha t d e pend o n the d ev i c e tha t i s d e sc r i b ed b y a g i v e n UC B . Th e M d i r ec t i v e ( fo l l owed by a n ume r i c a rg um en t ) ma r k s a s pe c i f i c po s i t i o n ( i n t e r n a l byte c o un t e r va l ue ) i n t h e s t r uc t u r e . Th e P d i r ec t i v e ( fo l l owe d by a n um e r i c a rg umen t ) r e s to r e s the v a l ue o f t h e i n t e rna l c o un t e r to t h e v a l ue a s s o c i a t ed wi th tha t n umbe r e d ma r k po s i t i o n . A. 4 . 3 B i t F i e l d De f i n i t i o n s - Th e V D i r ec t i ve B i t f i e l d s r e qu i r e two n um b e r s to c ompl e te l y d e sc r i b e t h em , a bit po s i t i o n a nd a s i z e . MDL a l wa ys d e f i ne s a b i t po s i t i o n ( i nd i c a t ed b y a V i n t h e s ym bo l nam e ) . Th e s i z e o f a f i e l d ( i nd i c a ted b y S in the s ymbo l n am e ) i s a l wa ys d e f i ned wh e n t h e f i e l d s i z e i s d i f f e r en t f r om I t i s o f t e n c o n v e n i e n t to d e f i n e a ma s k s ymbo l ( i nd i c a t ed b y M one . in the s ym bo l n ame ) t h a t h a s o ne s i n e a c h b i t po s i t i o n d e f i n ed b y t he b i t f i e l d a nd zeros e l s e wh e r e . MDL d e f i n es s uc h s ymbo l s i f so r e q u e s ted . Bec a use th i s s e c t i o n i s n o t t r y i ng to e x pl a i n the e n t i r e MDL s yn t a x but r a th e r s h o w wh a t sym bo l s r e s u l t f r om a g i v en M D L d e f i n i t i o n , t h e s i mpl e s t wa y t o d e sc r i b e t h e b i t f i e l d s yn t a x i s w i th s o m e e x am p l e s . Ta b l e A-3 i nc l ud e s MDL d i r e c t i v e s ex t r a c ted f r om t h e d e f i n i t i o n o f t h e AST C o n t r o l B l o c k ( AC B ) t h a t i s p i c t u r ed in Figure 5-l . No t e tha t o n l y the q uo t a f i e l d h a s a ma s k s ymbo l d e f i n ed . Ta b l e A-3 a l so c o n t a i n s t h e MDL d e sc r i pt i o n o f the b i t f i e l d s w i th i n a v i r t ua l ( Fi g u r e 1 2-1 ) . Th e d e f i n i t i o n s o f t h e PS L b i t f i e l d s a nd t h e add r e s s S T S b i t f i e l d s ( bo th l o c a t e d in STARDE F . MD L ) a r e m o r e c ompl i c a t e d i l l us t r a t i o n s o f the s yn t a x tha t t h e s e e x am p l e s d e sc r i b e . A- 2 3 APPENDI X B EXECUT IVE DATA AREAS Th e wr i t ab l e execut ive cons i s ts of seve r a l d yn am i c a l l y a l l o c a t e d t a b l e s a s we l l a s s t a t i c a l l y a l l o c a ted d a t a s t r uc t u r e s t h a t a r e a pa r t o f the e x e c u t i v e imag e SYS . EXE . Th i s a ppend i x s umma r i z e s a l l o f t h e s e d a t a a r e a s , w i th a n emph a s i s o n t h e s t a t i c e x e c u t i v e d a t a b a s e th a t i s r e l a t ed to o th e r m a t e r i a l i n th i s m a n ua l . Th e i n fo rm a t i o n p r e s e n t ed in th i s a ppend i x wa s a c c um u l a t ed by i n co r po r a t i ng data f r om t h e sys tem m a p ( S YS . MAP ) wi th c o n te n t s o f s pe c i f i c s o u r c e mod ul e s . I n fo rma t i o n o u t s i d e th e sc o pe o f t h i s m a n u a l Th e r e i s no a t tempt to i nc l ud e ev e r y g l o b a l is s i mpl y s umma r i z ed . symbo l i n SYS . E XE i n th i s a ppend i x . Da t a b l o c k s ( s uch a s un i t c o n t r o l blocks or t im e r queue e l em e n t s ) a r e r e f e r e nced as s i ng l e en t i t i e s . G l o b a l l a b e l s wi th i n such s t r uc t ur es are i g no r ed . Global l abe l s a s so c i a t ed w i th b a c kwa rd l i n k po i n t e r s o f d o ub l y l i nked l i s t s a r e a l so om i t ted . Nam e s th a t a ppe a r i n t h e " G l o b a l Symbo l " co l umn in l o we r c a se r epresent local s ymbo l s , n ame s th a t a r e o n l y u s e d w i th i n t h e m o d u l e i n wh i c h t h e y a r e d e f i n ed . B. l STAT I CALLY AL LOCATED EXECUT IVE DATA Th e c e l l s t h a t c o n t a i n the d a ta d e sc r i b ed i n th i s s e c t i o n can be i d e n t i f i ed wi th s p e c i f i c s o u r c e m o d u l e s i n t h e e x ec u t i v e . Th o s e c e l l s t h a t c a n b e a d d r e s s ed d i r e c t l y wi t h a g l o b a l name a r e so i nd i c a t ed . P r og r am s e c t i o n nam e s ( . PS EC T n ame s ) a r e i n c l ud ed i n e a c h s e c t i o n t i t l e t o a l l o w e a sy l o c a t i o n o f a g i v e n d a t a a r e a . P r o g r am sec t ions of zero l e ng th d e c l a r ed i n mod u l e MDAT f o r t h e pu r po se o f d e f i n i ng g l o b a l l a b e l s th a t s e p a r a t e m a j o r s e c t i o n s o f SYS . E XE a r e no t i n c l ud ed he re . Th e y a r e l i s t ed . i n Ta b l e E - 2 a n d c a n a l s o be fo und by e x am i n i ng SYS . MAP . B.l. l Sys t em Se r v i c e Ve c to r Ar e a ($$$000) Th e f i r s t th r e e pag e s o f s y s tem v i r t ua l add ress spa c e c o n t a i n the sys t em s e rv i c e v e c t o r s . Th e s e p ag e s a r e r e ad o n l y . Th e g l o b a l l ab e l MMG $A ENDVE C , d e f i n ed i n mod ul e MOAT , r e pr e s e n t s t h e h i g h -ad d r e s s end o f the sys t em se rv i c e v e c to r pag e s . B-1 EXECUTIVE DATA AREAS Pi l e System Pe r fo rmance Mo n i to r Da ta ( $ $ $ 0 0 0 PMS ) B.l.2 Th i s a r e a c o n s i s t s o f two b l o c ks , e a ch 7 0 l o ng wo r d s l o ng , t o d e sc r i b e t h e c um u l a t i v e b e h a v i o r of t h e f i l e ACPs s e rv i c i ng bo th S t r uc t u r e Lev e l 1 a nd S t r uc t u r e Lev e l 2 . G l o b a l Symbo l Modul e S i ze De s c r i p t i o n o f D a t a PMS $G L F C P PMSDAT 7 0 l o ngwo r d s PMS $G L F C P 2 PM S DA T 7 0 l o ng wo r d s F i l e s y s t em s t a t i s t i c s L ev e l 1 AC P . F i l e sys t em s ta t i s t i c s L ev e l 2 ACP B.l.3 M i sc e l l aneous Bug c h e c k I n fo rma t i on Mod u l e B UGC HECK ma i n t a i n s two l o ng wo r d s p r og r e s s . G l o b a l Symb o l Mod u l e f a t a l_s psav B UGC HECK l o ng wo r d E XE $G L B UGCHECK B UG C H E C K l o ng wo r d B.l.4 S i ze for for ($$$025) about a fatal b ug chec k in De s c r i p t i o n o f Da t a Fa t a l b ug ch e c k i n p r og r e s s s ta c k po i n t e r Saved f a ta l b ug ch e c k c o d e D a t a St r uc t u r e s fo r Dr i ve r s L i nked wi th VMS ($$$100 ) Mod u l e DEV I C EDAT c o n ta i n s d a t a s t r uc t u r e s fo r the d ev i c e s th a t a r e Th e s e d ev i c e s a r e l i n k ed a s a pa r t of the e x e c u t i v e imag e SYS . E XE . • the n ul l d ev i c e , • a ma i l bo x , a nd • the c onso l e t e rm i n a l . Th e d a ta s t r uc t u r e s fo r d ev i c e O PA O are a s s emb l ed i n to VAX/VM S . Th e t e rm i n a l d r i v e r i ts e l f ( TTDR I VE R . EXE ) i s l o aded by I N I T . Th e r e a r e un i t c o n t r o l blocks fo r th r e e m a i l bo x e s s e t a s i d e i n DEV I C E DAT . Un i t c o n t r o l b l o c k ze r o i s a s k e l e to n UC B tha t i s c o p i ed i n to a n y o th e r UCB wh e n a ma i l bo x i s c r e a t ed . Th e Job Co n t r o l l e r ' s m a i l bo x a nd O PC OM ' s ma i l bo x a l s o u s e p r e a l l o c a t e d UCBs . S i ze G l oba l Symbo l Mod u l e I OC $G L D EVL I S T DEV I C EDAT l o ng wo r d I OC $G L ADPL I S T DEVI C E DAT l o ng wo r d I OC $G L_D PTL I S T DEV I C EDAT q uadwo r d SYS $G L_B OOTDDB DEV I C EDAT 5 2 byt e s SYS $G L_B OOTUCB DEVI C E DAT 2 0 4 byt e s B-2 De s c r i p t i o n o f Da t a L i s th e a d o f DDBs o f a l l d ev i c e s i n the sys t em L i s th e a d o f a l l Ad apte r Con t ro l Blocks L i s th e a d o f D r i v e r Pro l og u e Tabl es Dev i c e Da t a B l o c k fo r sys t em d i sk Un i t Co n t r o l B l o c k f o r s y s t em d i s k ( 2 2 e x t r a l o ngwo rd s ) EXECUT IVE DATA AREAS G l o b a l Sym bo l Mo d u l e O PA $G L_DDB DEV I C EDAT 5 2 by t e s O PA $ U C B O DEV I C E DAT 2 1 2 bytes TTY$G L_G E TNXT C H DEVI C EDA T l o ngwo r d TTY $G L P UTNXTC H DEVI C EDAT l o ng wo r d TTY$G L U C B S E T U P DEVI C EDAT l o ng wo r d O PA $ CRB DEVI C EDAT 6 8 bytes opa$ idb DEVI C E DAT 3 2 byt e s MB $G L DDB DEVI C EDAT 5 2 byt e s MB $ UC B O DEVI C EDAT 1 1 6 bytes SYS $G L J OBC TLMB DEV I C EDAT 1 1 6 bytes S Y S $G L_O PRMBX DEVI C EDAT 1 1 6 byte s N L $G L D DB DEVI C E DA T 52 bytes NL$GL UCBO DEVI C EDAT 1 1 6 bytes NET$WC B DEV I C EDA T 3 6 by t e s s ys_c r b DEVI C E DAT 5 6 bytes B.l . 5 Dr i v e r P r o l og ue Tab l e s S i ze De s c r i p t i o n o f Da t a Dev i c e Da t a B l o c k f o r c o n so l e t e rm i n a l Un i t C o n t r o l B l o c k f o r c o n so l e t e rm i n a l { 2 4 e x t r a l o ng wo r d s ) Ad d r e s s wi th i n t e rm i n a l d r i v e r o f r o u t i n e t o r e ad the next cha r a c t e r Ad d r e s s wi t h i n t e r m i n a l d r i v e r o f r o u t i n e to wr i t e the n e x t c h a r a c t e r Ad d r e s s wi t h i n t e rm i n a l d r iver o f r o ut i ne t o s e t u p UCB Ch a nne l Re que s t B l o c k f o r c o nso l e d ev i c e I n t e r r up t D i spa tch B l o c k f o r c o n so l e d ev i c e Dev i c e Da t a B l o c k fo r ma i l bo x Un i t Co n t r o l B l o c k Temp l a t e u s ed i n ma i l bo x c r e a t i o n ( Th i s UC B i s no t l i n k e d i n to ma i l bo x DDB ' s UCB 1 ist) Un i t Con t r o l B l o c k f o r J o b Co n t r o l l e r ' s Ma i l b o x { Un i t 1 ) Un i t Co n t r o l B l o c k f o r Ope r a to r ' s Ma i l bo x ( Un i t 2 ) Dev i c e Da t a B l o c k f o r n u l l d ev i c e Un i t Co n t r o l B l o c k f o r n u l l d ev i c e Wi ndow Con t r o l B l o c k f o r n e two r k ps e ud o d ev i c e Ch a nn e l Re que s t B l o c k f o r ma i l bo x d ev i c e s ( $ $ $ 1 0 5 PROLOGUE ) _ Th e d r i v e r p r o l og ue t a b l e s fo r th e s e d r i v e r s a r e a l so a s s em b l ed a nd l i nked i n to the ex e c u t i v e i m ag e . Th e c o n t r i b u t i o n s to th i s pa r t o f t h e wr i ta b l e e x ec u t i ve c om e f r om t h e th r e e d r i ve r mod u l e s { MB DR I VE R , NLDR I VE R , a nd C ON I NTDS P ) th a t a r e l i n k ed wi th SYS . EXE . G l o b a l Symbo l Mo d u l e MB$DPT MBDR IVE R 40 bytes NL$ DPT N LDR I VE R 4 0 bytes O P $DPT C ON INTDS P 4 0 bytes S i ze B-3 D e s c r i pt i o n o f Da t a D r i ve r P r o l og ue Ta b l e f o r ma i l bo x d r i v e r D r i ve r P r o l og ue Ta b l e f o r n u l l d ev i c e d r i v e r D r i v e r P r o l og ue Ta b l e f o r c o nso l e t e rm i n a l d ev i c e d r iver EXECUT IVE DATA AREAS 8.1.6 L i n k e d Dr i ve r Co d e ( $ $ $ 1 1 5_DRIVE R ) Th e r e i s a r e ad o n l y s e c t i o n ( 5 pag e s l o ng ) th a t c o n t a i n s the d r i v e r code fo r t h e s e d r i v e r s as we l l as c od e fo r t h e MA7 8 0 s h a r ed m emo r y , t h e DR7 8 0 i n t e r f a c e , a n d i n te r r up t d i spa tc h c o d e fo r the MASS8US l abe l s a d a pt e r . Th i s sec t i o n i s b o un d ed b y t h e two g l o b a l MMG $AL_8 EGDR I VE a nd MMG $ A L_ENDDRIVE , d e f i n ed i n mod u l e MOAT . 8. 1 . 7 M em o r y Ma nag eme n t Da t a ($$$210) Th e m emo r y m a n ag em e n t d a ta c o n s i s t s dyn am i c a l l y a l l o c a ted s t r uc t u r e s . ma i nl y S i ze of l i s th e a d s fo r De sc r i p t i o n o f Da t a G l o b a l Symbo l Mod u l e PFN$AW H EAD A L LOC PFN 6 wo r d s p f n $ a l_co un t AL LOC PFN 3 l o ngwo r d s PFN$G L PHYPGCNT A L LOC PFN l o ng wo r d PFN$AL H I L I M I T A L LOC PFN 3 l o ngwo r d s PFN $AL_LOL IM I T A L LOC PFN 3 l o ngwo r d s S C H $G L MFYL IMSV A L LOC PFN l o ngwo rd S C H $G L MFYLOSV ALLOC PFN l o ng wo rd PAG E FAU LT 1 5 l o ngwo r d s Pa g e f a u l t s t a t i s t i c s fo r D I S PLAY M PW$AL PTE WRTM FY PAG l o ngwo rd M PW$AW PHVI NDEX WRTMFY PAG l o ngwo rd Po i n t e r to mod i f i ed pag e wr i t e r PTE a r r a y Po i n t e r t o p r o c e s s h e a d e r vec to r i nd ex a r r a y u s ed by the mod i f i ed pag e wr i t e r MMG $G L I AC LOCK S YS IMGACT l o ngwo rd Imag e Ac t i v a to r I n t e r l o c k MMG $G L_PFNLOCK S YS LKW S E T l o ng wo r d Down c o un te r o f pag e s r em a i n i ng th a t m a y b e l o c k ed i n memo r y 8-4 L i s th e a d s f o r t h e f r e e , mod i f i ed , a n d b a d pag e l i s t s ( 3 fo rwa rd l i n k wo r d s fo l l owed b y 3 b a c kwa rd l i n k wo r d s ) Co un t o f pag e s o n e a c h o f the three l i s t s Co un t o f a v a i l ab l e phys i c a l pag e s H i g h l im i t th r esho l d s fo r e a ch o f the th r e e l i s t s Lo w l i m i t t h r esho l d s f o r e a c h o f the th r e e l i s ts Saved h i gh l i m i t t h r e sho l d o f mod i f i ed pa g e l i s t Saved l o w l i m i t th r e sho l d o f mod i f i ed pag e l i s t E XECUT I VE DATA AREAS B.l.8 Pag e Fa u l t Mo n i to r Da t a ($$$215) Th e pag e f a u l t mo n i to r s ub sys t em m a i n t a i n s 3 l o ngwo r d s o f i mpu r e d a t a . G l o b a l Symbo l Mod u l e PFM $G L S I Z E PFM $G L PMBLST SYS S ET PFM SYSSETPFM SYSSE T PFM B. l . 9 Si ze l o ng wo r d l o ng wo r d l o ngwo r d De s c r i p t i o n o f Da ta S i z e of a l l o c a t ed b l o c k Po i n t e r t o PMB l i s t Co un t o f p r o c e s s e s us i ng mo n i to r Schedul e r Da t a ( $ $ $ 2 2 0 ) Th e s c h e d u l e r ' s d a t a b a s e i s d e f i n ed p r i ma r i l y i n mod u l e S DAT . Th i s mod ul e conta i ns t h e queue h e ad e r s f o r e a c h o f the s c h ed u l i ng s t a t e s a nd r e l a t ed c o u n t e r s . Seve r a l o th e r m o d u l e s ( ma i n l y SWAPPER a nd SWAPF I LE ) a l s o co n t r i b u t e to th i s p r og r am s e c t i o n . G l o b a l Symbo l Mo d u l e S i ze S DAT quadwo r d S C H $AQ_C OMH S DAT 3 2 q ua d wo r d s SC H$AQ_C OMOH SDAT 3 2 q u a d wo r d s S C H $AQ_WQH DR S DAT 1 3 2 bytes ( 1 32 1 1*12) = S C H $G L C URPC B SDAT l o ngwo r d SC H $G L_C OM QS SDAT l o ngwo r d SC H $G L_C OMOQS S DAT l o ngwo r d S C H $G B S I P S DAT byte SCH$V S I P SCH$V SWP S C H E D SCH$V-MPW bit bit bit SCH$V DG B L S C bit S C H $GW PROCCNT S DAT byte wo r d S C H $GW PROC L IM SDAT wo r d SC H $G Q_C EB HD S DAT wo r d q u adwo r d B-5 De s c r i p t i o n o f Da ta Spa r e quadwo r d to t e rm i n a t e o u t s wa p s c h e d u l i ng s c a n L i s th e ad s fo r c om p u t a b l e s t a t e s fo r a l l 3 2 so f twa r e p r i o r i ty l ev e l s L i s th e a d s f o r c omputa b l e o u t swa pped s t a t e s f o r a l l 3 2 so f twa r e p r i o r i ty l ev e l s Wa i t que ue h e ad e r s fo r 1 1 wa i t s t a t e s ( Wa i t q ue ue h e ad e r fo r CEF s t a t e i s no t u s ed ) Ad d r e s s o f PCB o f c u r r e n t process Que ue s umma r y l o ng wo r d fo r C OM s t a te Que ue s umma r y l o ng wo r d fo r C OM O s t a t e Swa p i n p r og r e s s f l ag s Swa p i n p r og r e s s Swa p sched u l e t r i g g e r Mo d i f i ed pag e wr i t e r i s active Gl o b a l s e c t i o n s n e e d t o b e d e l e t ed Spa r e fo r a l i g nm e n t Cu r r e n t n um b e r o f p r o c e s s e s wh i ch r e q u i r e swa p f i l e ( d o e s no t c o un t NU L L o r SWAPPER ) Ma x i m um n um b e r o f p r o c e s s e s th a t th i s s ys tem a l l o ws Spa re fo r a l i g nm e n t L i s th e a d fo r commo n e v e n t bl ocks EXECUT IVE DATA AREAS G l o b a l Symbo l Mod u l e S C H$GW_C E B CNT S DAT wo r d S C H $GW D E L PHDC T S DAT wo r d SWP $G L S H E L L SWP $G L I N PC B S DAT S DAT l o ngwo r d l o ng wo r d SWP $ G L I S PAGCNT SWP $GW= I BALS E TX S DAT S DAT l o ngwo r d wo r d SWP $G B I SWPR I S DAT SWP $ G L I SWPC NT SWP $G L O SWPCNT SWP $G L H O SWPCNT SWP $G L H I SWPCNT S C H $G L R E SMASK S C H $G B P R I S DAT S DAT S DAT S DAT S DAT S DAT byte byte l o ng wo r d l o ng wo r d l o ng wo r d l o ngwo r d l o ng wo r d byte 3 by t e s SWP $G L S WT IM E OSWPS C HE D l o ngwo r d E a r l i e s t t i m e fo r n e x t e x chang e swa p E XE $G L PWRDONE POWERFA I L l o ng wo r d E XE $G L PWR INTVL POWERFA I L l o ng wo r d End t i m e fo r po we r r ec o v e r y i nterval Al l owa b l e r e c o v e r y i n t e r v a l i n 1 0 ms e c un i t s SWP $G L S FTBAS SWAPF I L E 4 0 byt e s SWAPF I L E 4 0 bytes SWAPF I L E 4 0 by t e s SWAPF I L E 3 2 by t e s SWAPF I LE 3 2 bytes SWAPF I L E l o ngwo rd SWAPF I L E 36 b y t e s MMG $A PAG F I L MMG $G L PAGSWPVC S i ze 1 6 by t e s l o ng wo r d l o ngwo r d l o ngwo r d l o ng wo r d l o ngwo r d B-6 De s c r i p t i o n o f Da t a Num b e r o f c ommo n event b l ocks Num b e r o f p r o c e s s h e ad e r s o f a l r e a d y d e l e ted p r o c e s s e s She l l p r o c e s s swa p a dd r e s s PC B a d d r e s s o f p r o c e s s b e i ng s wa pped i n to memo r y I n s wa p pag e c o un t Ba l an c e s l o t i nd e x fo r i nswa p p r o c e s s P r i o r i ty o f i n s wa p p r o c e s s Spa r e fo r a l i g nm e n t C o un t o f i n swa ps pe r fo rmed Co un t o f o u t swaps pe r fo rmed Co un t of h e ad e r o u t s wa ps C o u n t o f h e a d e r i n s wa ps Re so u r c e wa i t mask v e c to r P r i o r i ty o f c u r r e n t p r o c e s s Spa r e fo r a l i g nm e n t Swa p f i l e t a b l e e n t r y fo r S h e l l p r o c e s s i n SYS . E XE Swa p f i l e t a b l e en t r y f o r SWAPF I LE . SYS Spa c e fo r swa p f i l e t a b l e e n t r y fo r s e c o nd swa p f i le Pag e f i l e c o n t r o l b l o c k fo r PAG E F I LE . SYS Spa c e fo r pag e f i l e c o n t r o l b l o c k fo r s e c o nd pag e file Ad d r e s s o f a r r a y ( wi th i n po i n te r c o n t r o l b l o c k ) o f a d d r e s s e s o f S FTEs and P F Ls Po i n t e r Co n t r o l B l o c k to S FTEs and PFLs H e a d e r of po i n t e r c o n t r o l block Ad d r ess o f S FTE fo r She l l process Ad d r ess o f S F T E f o r SWAPF I LE . SYS Ad d r e s s of spa r e S FTE Ad d r ess of PF L fo r PAGE F I LE . SYS Ad d r e s s of spa re PF L EXECUT I VE DATA AREAS G l o b a l Sym bo l Mod u l e i o rout i ne SWAP PER l o ngwo r d i oea r ws swp SWAPPER SWAPPER l o ngwo r d l o ngwo r d r sv a pte SWAP PER l o ngwo r d r pg c n t o s wppg s o swppc b SWAP PER SWAPPER SWAP PER wo r d wo r d l o ngwo r d SWP $GW_BA LCNT SWAP PER wo r d S C H $GW SWPFCNT SWAPPER wo r d B. l. lO S i ze De s c r i p t i o n o f Da t a Ad d r e s s o f p r o pe r ( r e a d o r wr i t e ) bu i l d pac k e t r o ut i ne I /O end a c t i o n r o u t i n e Rem a i n i ng wo r k i ng s e t swa p address Rem a i n i ng s ys tem v i r t ua l a d d r e s s o f pag e t a b l e entr i es Rema i n i ng pag e c o un t Ou t s wa p pag e c o un t Ad d r e s s o f PC B o f o u t s wa p process Co un t o f p r o c e s s e s i n b a l a n c e s e t ( Swa ppe r a nd Nu l l p r o c e s s e s n o t c o un t ed ) Co un t o f s uc c e s s i v e o u t s wa p sched u l e f a i l u r e s Memo r y Ma n ag em e n t Da t a ( $ $ $ 2 2 2 ) Th i s p r og r am s e c t i o n c o n t a i n s t h e d a t a c e l l c o n t r i b u t i o n o f mod ul e MOAT to the e x e c u t i ve . MOAT a l s o d e f i n es g l o b a l l a b e l s tha t s e pa r a t e d a t a a r e a s f r om r e a d - o n l y s ec t i o n s , a nd s e pa r a t es pag e a b l e c o d e f r om n o npa g e d rout i nes . In a d d i t i o n , MOAT a l l o c a t e s pa tch a r e a s fo r the execut i ve . G l o b a l Symbo l Mod u l e PHV$G L_P I XBAS MOA T l o ngwo r d PHV$G L_REFCBAS MOA T l o ngwo r d MMG $ A L_S B IC ONF MOAT 1 6 l o ng wo r ds MMG $G L_RM SBAS E MOA T l o ngwo r d B.l.ll S i ze De s c r i p t i o n o f Da t a Ad d r e s s o f p r o c e s s i nd e x a r ray Ad d r e s s o f p r o c e s s h e a d e r r e f e r ence count a r r a y Ar r a y o f po i n t e r s t o sys t em v i r t ua l ad d r e s s o f co n f i g u r a t i o n r eg i s t e r fo r a d a p t e r Po i n t e r to b a s e a d d r e s s o f RM S i ma g e P r o c e s s Da ta fo r Sy s tem P r o c e s s e s ( $ $ $ 2 3 0 ) Two p r o c e s s e s e x i s t a s a pa r t o f the s ys t em i m ag e . Th e y a r e the s wa ppe r a nd the nul l pr o cess . I n ad d i t i o n , t h e r e ex i s t s a sys tem h e ad e r c o n t a i n i ng the s ys tem pag e t a b l e ( Ch a p t e r 1 1 a nd Appe nd i x E ) a nd a sys tem PCB t o s uppo r t sys tem pag i ng . B-7 EXE C UT IVE DATA AREAS Mo d u l e S i ze PDAT 3 2 l o ng wo r d s PDAT 1 6 0 l o ngwo r d s n u l phd PDAT 384 byt es SC H $G L N U L L PC B PDAT PDAT PDAT 1 4 0 byte s l o ng wo r d 3 8 4 byte s MMG $AL S YS PC B S C H $G L-PCBVE C PDAT PDAT PDAT PDAT 1 4 0 byte s 1 o ng wo r d 1 4 0 b yt e s l o ng wo r d SC H$G L MAXP I X PDAT l o ngwo r d S C H $ G L_S E QVE C PDAT l o ng wo r d G l o b a l Sym bo l swpphd SC H $G L SWPPC B B. l . l2 C o n so l e I n te r r up t D i spa tch Da t a D e s c r i p t i o n o f Da t a Ke r n e l s t a c k f o r the n u l l process Ke r n e l s t a c k f o r the swa ppe r process M i n im a l p r o c e s s h e ad e r { f i x ed po r t i o n o n l y ) fo r nul l process PCB for nul l process Spa r e fo r a l i g nm e n t M i n im a l p r o c e s s h e ad e r { f i x ed po r t i o n o n l y ) f o r swappe r p r o c e s s PC B f o r swa ppe r p r o c e s s Spa r e f o r a l i g nm e n t Sys tem PC B Add r e ss o f PCB v e c to r o f l o ngwo r d s Ma x im um p r o c e s s i nd e x f o r th i s s y s tem Ad d r e s s of s e q u e n c e vec to r o f wo r d s { $ $$ 2 50 ) Th e c o n so l e d ev i c e d r i v e r m a i n t a i n s a sma l l amo un t o f i mp u r e s t o r ag e . G l o b a l Symbo l B. 1 . 13 Mod u l e S i ze C ON I NTDS P byte C ON I NTDS P C ON I NTDS P byte wo r d De s c r i p t i o n o f Da t a Cu r r e n t un i t e x pe c t i ng o u tp u t comp l e t i o n Nex t un i t a wa i t i ng o u t p u t Ne x t d a t a fo r o u t p u t SYSCOMMON - Mi s c e l l a n e o u s E x ec u t i ve Da t a ($$$260) Mo d ul e SYSC OMMON c o n t a i n s mo s t o f t h e m i sc e l l a n e o us l i s t h e ad s , c o un t e r s , s emaph o r e s , a nd o th e r d a ta t h a t i s no t d i r e c t l y t i ed to o ne o f t h e m a j o r s ub s ys t ems . Mod u l e E RROR L OG a l s o m a k e s a s i gn i f i cant c o n t r i b u t i o n to t h i s p r og r am s e c t i o n . G l ob a l Symbo l Mo d u l e E XE $G Q_S TAREXE SYSC OMMON EXE $G Q_S Y S DM P S Y S C OMMON S i ze Desc r i p t i o n o f Da t a 2 l o ngwo r d s De sc r i p to r o f e x e c u t i v e i m ag e SYS . EXE l o ngwo r d l o ngwo r d S i z e of f i l e in pag e s S t a r t i ng l og i c a l b l o c k n umbe r o f f i l e 2 l o ng wo r d s Desc r i p to r o f s ys tem d um p f i l e SYSDUM P . DM P l o ngwo r d l o ngwo r d S i ze o f f i l e i n pag e s S t a r t i ng l og i c a l b l o c k n um b e r o f f i l e B-8 EXECUTIVE DATA AREAS G l o b a l Symbo l Mo d u l e E XE $G Q_SWAPF SYSCOMMON S i ze De s c r i p t i o n o f Da t a 2 l o ng wo r d s De sc r i pto r o f swa p f i l e SWAPF I L E . SYS l o ngwo r d l o ngwo r d E XE $G L DM PCHK SYSCOMMON l o ngwo rd EXE $G L F LAG S SYSCOMMON l o ngwo r d E XE $G Q_E R LMBX S YS C OMMON q u a dwo rd wo r d wo r d l o ngwo r d E XE $G L U S RCHMK S YS COMMON l o ngwo r d E XE $G L U S RC HME SYSCOMMON l o ngwo rd SW I $G L_F QFL SYSCOMMON 6 quadwo r d s LOG $A L LOG TB L S YS COMMON 3 l o ng wo r d s LOG $AL MUTEX S YS COMMON 4 wo r d s l o g $ g l_g l t f l SYSCOMMON q u ad wo r d LOG $G L S LTFL SYS COMMON q u a d wo r d E XE $G L S Y S UCB F I L $G T-DDDEV SYSCOMMON S Y S C OMMON l o ngwo r d 1 2 byt e s I OC $G L P S F L S YS COMMON q u adwo r d I OC $G L_I R PF L S Y S COMMON q u a d wo rd I OC $G L AQB L I S T I OC $G Q=MOUNT LST SYSCOMMON SYS COMMON l o ngwo r d q u ad wo r d I O C $G Q_BRDC S T SYS COMMON q u ad wo r d EXE $G L G S DGRPF L S YS COMMON q u a d wo r d EXE $G L G S DSYS F L SYS COMMON q u a d wo r d EXE $G L G S DFREFL S Y S COMMON q u a d wo r d B-9 S i ze of f i l e in pag e s S t a r t i ng l og i c a l b l o c k n umbe r o f f i l e Ch e c k s um fo r s ys t em d um p file Sys tem f l ag s l o ng wo r d ( S e e SYS PARAM d e s c r i pt i o n ) De sc r i p to r o f e r r o r l og ma i l bo x Un i t n um b e r ( 0 = > no n e ) Spa r e f o r a l i g nm e n t Process I D of a s s i g n e r Ad d r e s s o f s ys t em-w i d e u s e r -wr i t t e n c h a ng e -mod e- to -k e r n e l d i spa tc h e r Ad d r e s s o f s y s t em-wi d e u s e r -wr i t t e n c h a ng e-mo d e- to-ex e c u t i v e d i spa tc h e r Fo r k q u e ue l i s t h e a d s f o r I P L l e v e l s 6 to 1 1 ( I P L 7 i s u s ed o n l y a s a p l a c e ho l d e r ) Ad d r e s s e s o f l i s th e a d s f o r sys t em , g r o up , and p r o c e s s l o g i c a l name tab l e s Mutex e s fo r s ys tem and g r o up l o g i c a l name t ab l e s L i s th e a d fo r g r o up l og i c a l name t a b l e L i s th e ad fo r s ys t em l o g i c a l n am e t a b l e Ad d r e s s o f s ys t em d i s k UC B Co un t e d ASC I I s t r i ng f o r d e f a u l t d ev i c e L i s th e a d fo r I /0 po s tp r o c e s s i ng que ue L i s th e ad fo r I R P l o o k a s i d e l i st AC P Qu e ue B l o c k l i s th e a d Sy s t em-w i d e mo un t ed vo l ume l i st Te rm i n a l b r o ad c a s t m e s sag e l i s th e a d L i s th e a d fo r g r o up g l o b a l s e c t i o n d e s c r i pto r l i s t L i s th e a d fo r sys t em g l o b a l s e c t i o n d e s c r i pto r l i s t L i s th e a d fo r g l o b a l s e c t i o n d e s c r i p to r b l o c k loo ka s i d e l i s t EXECUT I VE DATA AREAS G l o b a l Symbo l Mod u l e E XE $G L G S DDE LFL SYSCOMMON q u a dwo r d E XE $G L_WCBDE LFL S YS C OMMON q u a d wo r d EXE $G L S YSWC B F L S YS C OMMON q u a d wo r d E XE $G L S YSWCB SYS C OMMON 4 2 byt e s PM S $G L_K E RNE L SYSCOMMON 6 l o ngwo r d s EXE $G L AB S T IM SYS C OMMON l o ng wo r d E XE $G Q_S YS T I M E S Y S C OMMON q u a dwo r d E XE $G L PFA I LT IM SYSCOMMON l o ngwo r d EXE $G L PFAT IM SYSCOMMON l o ngwo r d E XE $G L_T QF L SYSCOMMON SYSC OMMON q u a d wo r d 4 0 byt e s SYS C OMMON 3 2 by t e s I OC $G L MUT E X E XE $G L-C E BMTX S Y S C OMMON S YS C OMMON 2 wo r d s 2 wo r d s E XE $G L PG DYNMTX EXE $G L-G S DMTX S YS C OMMON S YS C OMMON 2 wo r d s 2 wo r d s E XE $G L_S HMG S MTX S Y S C OM MON 2 wo r d s E XE $G L S HMMBMTX S Y S C OMMON 2 wo r d s EXE $G L E N QMTX EXE $G L-KF IMTX E XE $G L-KNOWN F I L SYS C OMMON S YS C OMMON SYSCOMMON 2 wo r d s 2 wo r d s l o ngwo r d KF I $G L_F l lAAC P SYSCOMMON l o ngwo r d E XE $G L G PT SYSCOMMON l o ng wo r d SYS C OMMON l o ngwo r d SYS $G Q_VE RS I ON S YS C OMMON q u a d wo r d SYS $GW I JOBCNT SYSCOMMON 3 wo r d s E XE $G L S YS M SG SYSCOMMON l o ng wo r d S i ze 3 wo r d s B-1 0 D e s c r i p t i o n o f Da t a L i s thead f o r g l o b a l s e c t i o n d e sc r i p to r b l o c k d e l e t e p e nd i ng l i s t L i s thead f o r w i nd ow c o n t r o l b l o c k d e l e t e que ue f o r G S D w i nd ows L i s thead fo r sys t em wi nd o w control block l i st Wi ndow c o n t r o l b l o c k ( wi th one r e t r i ev a l po i n te r } f o r s y s t em i m ag e SYS . E XE T i m e r s ta t i s t i c s f o r t i m e s p e n t i n e ac h a c c e s s mo d e , o n th e i n te r r up t s t a c k , a nd i n c ompa t i b i l i t y mod e Ab s o l u t e t i me i n s e c o nd s ( fo r d ev i c e d r i v e r t i m eo u t } Sys t em t i me i n un i t s o f 1 0 0 n a n o s e c o nd s Co n t ents o f PR $ T ODR a t l a st po we r f a i l u r e Du r a t i o n o f m o s t r e c e n t powe r f a i l u r e ( i n un i t s o f 1 0 m i l l i s econd s } T i m e r q u e u e l i s th e ad T i m e r q u e ue e l em e n t f o r s ys tem s ub r o u t i ne Pe rma n a n t l a s t e n t r y i n t i me r que ue I /O d a t a b a s e mutex Common event b l o c k l i s t mutex Pag ed d yn am i c memo r y mutex G l o b a l s e c t i o n d e s c r i pto r l i s t m u t ex Sha r ed m emo r y g l o ba l s e c t i o n d e sc r i p to r l i s t m u t ex Sh a r ed memo r y m a i l bo x l i s t mutex Enque ue/d equeue t a b l e s m u t ex Kno wn f i l e t a b l e m u t e x Ad d r e s s o f known f i l e l i s t v e c to r Ad d r e s s o f KF I fo r sys tem d i s k AC P Ad d r e s s o f f i r s t f r e e g l o b a l pag e t a b l e e n t r y Dummy co u n t o f n umb e r o f G PTEs i n l i s th e a d ASC I I s t r i ng th a t c o n t a i n s sys tem v e r s i o n n um b e r C u r r e n t c o un t s o f i n te r a c t i v e , n e two r k , a nd b a tch l og i n s Ad d r e s s o f s y s tem wi d e m e s s ag e s e c t i o n Spa r e fo r a l i g nm e n t EXECUT IVE DATA AREAS S i ze G l o b a l Symbo l Mo d u l e E X E $G L_NONPAG E D S YS COMMON l o ng wo rd SYSC OMMON l o ng wo r d SYSCOMMON l o ngwo r d EXE $G L_S P L I TADR SYSCOMMON l o ngwo r d EXE $G L PAG E D S YS COM MON l o ngwo r d SYSCOMMON l o ngwo r d RM S $G L S FDBAS E SYSCOM MON l o ngwo rd EXE $G L S HB L I S T SYSCOM MON l o ngwo r d EXE $G L RTB I TMAP S YS COM MON l o ngwo r d MCH K $G L_MASK SYSCOMMON l o ng wo r d MCHK$G L_S P SYSCOMMON l o ng wo r d I O $ G L U BA I N T O E XE $G L B LAKH OLE S Y S C OM MON l o ngwo r d SYSCOMMON l o ng wo r d EXE $G L_S I TE S PE C SYSCOMMON l o ngwo r d De s c r i p t i o n o f Da t a I PL a t wh i c h n o npag ed po o l a l l o c a t i on w i l l o c c u r Ad d r e s s .o f f i r s t f r e e b 1 o c k o f no npag ed po o l Dummy s i z e o f z e r o fo r l i s th e a d Ad d r e s s o f b o und a r y b e twe e n r eg u l a r no npag ed po o l a nd l oo ka s i d e l i s t Ad d r e s s o f f i r s t f r e e b l o c k o f pag ed po o l Dummy s i z e o f z e r o fo r l i sthead Ad d r e s s o f s h a r ed f i l e d a t a base Ad d r e s s o f sh a r ed memo r y control block l i st Ad d r e s s o f r e a l t i me S PT E b i tm a p Func t i o n m a s k f o r c u r r e n t m a c h i ne c h e c k r e co v e r y b lock Saved s t a c k po i n t e r f o r r e t u r n a t end o f r ec o v e r y Co un t o f UBA i n t e r r up t s t h r o ug h v e c to r 0 Phys i c a l pag e u s ed to r em a p a d d r e s s e s o f ad a pt e r s t h a t h a v e e x pe r i e n c ed powe r f a i l u r e Longwo r d th a t i s a va i l ab l e t o p r i v i l eg ed us e r s Mod u l e ERRORLOG ma k e s a s i g n i f i c an t c on t r i b u t i o n t o p r og r am s ec t i o n Mo s t o f t h e s p a c e i s o c c up i ed b y two 5 1 2 -byte e r r o r m e s s a g e $$$260. b u f fe r s . S i ze G l o b a l Symbo l Mo d u l e E R L $AL_B UFADR E RRORLOG ERROR LOG ERROR LOG 5 1 2 byt e s 51 2 bytes 2 l o ngwo r d s ERL$GB B UF IND E RROR LOG byte ERL$GB B U F F LAG ERL$GB=BUFPTR E RRORLOG E RROR L OG byte byte E R L $G B BUFTIM E R L $G L-E R L P I D E RROR L OG E RRORLOG byte l o ng wo r d ER L $G L_S E QUENCE E RRORL OG l o ng wo r d B- 1 1 De s c r i p t i o n o f Da t a F i r s t e r r o r l og bu f f e r S e c o nd e r r o r l o g b u f f e r Ad d r e s s e s o f two e r r o r l og buf f e r s Cu r r en t b u f f e r a l l o c a t i o n i nd i c a to r Bu f f e r s t a tus f l ag s Fo rma t p r o c e s s ( E RRFMT ) b u f f e r i nd i c a to r Fo rma t p r o c e s s wa ke u p t i m e r P r o c e s s I D o f e r r o r f o rma t process Un i v e r s a l e r r o r s eque n c e n umb e r E XECUT IVE DATA AREAS 8 . 1 . 14 S ta t i s t i c s Used by D I S PLAY ( $ $ $ 2 7 0N P ) Mo d ul e PM S DAT c o n t a i n s m o s t o f t h e d a t a tha t is p resen ted by the D I S PLAY u t i l i ty . M a n y o f t h e c e l l s d e f i n ed i n th i s m o d u l e , e sp e c i a l l y tho s e a s so c i a t ed w i th the t e rm i n a l d r i v e r , a r e n o t c u r r e n t l y u s ed b u t we r e i n s e r t ed w i th po s s i b l e f u t u r e pe r fo r m a n c e m o n i to r i ng i n m i nd . G l o b a l Symbo l Mod u l e S i ze PM S $G L D I R I O PM SDAT l o ng wo r d PMS $G L B U F I O PM SDAT l o ngwo r d PM S $G L L OGNAM PM SDAT l o ngwo r d PM S $G L MBREADS PMSDAT l o ngwo r d PMS $G L MBWR I T E S PM S DAT l ongwo r d PMS $G L TREADS PMS DAT l o ng wo r d PM S $G L_TWR I T E S PMS DAT l o ngwo r d PMS $G L_I O PFMPDB PMS DAT l o ng wo r d PMS $G L_I O PFM S E Q PM S DAT l o ng wo r d PMS $G L_PAG E S PMS DAT l o ng wo r d PMS $GW BATC H PMS $GW- I NTJOBS PMS $A L-R EADTB L PMS DAT PMS DAT PM SDAT wo r d wo r d 1 0 l o ngwo r d s PM S $A L_WR ITETB L PM SDAT 1 0 l o ng wo r d s PM S $G L_R EADC NT PMS DAT l o ng wo r d PM S $G L_WRTCNT PM SDAT l o ng wo r d PM S $G L PAS SALL PM SDAT l o ng wo r d PM S $G L RWP PMSDAT l o ng wo r d PM S $G L LRGRWP PM SDAT l o ng wo r d PM S $G L RWPS UM PM SDAT l o ng wo r d PM S $G L N O S TDTRM PMSDAT l ong wo r d PM S $G L RWPNO S TD PMSDAT l o ng wo r d PM S $G L_LDPCTX PMSDAT l o ng wo r d B-1 2 De s c r i p t i o n o f Da t a Numbe r o f d i r e c t I /O o pe r a t i o n s Numb e r o f b u f f e r ed I /O o pe r a t i o n s N umbe r o f l og i c a l name t r an s l a t i o n s Numbe r o f m a i l bo x r ea d o pe r a t i o n s Numbe r o f m a i l bo x wr i t e o pe r a t i o n s Numbe r o f t e rm i na l r e a d o pe r a t i o n s Numbe r o f t e rm i na l wr i t e o pe r a t i o n s Ad d r e s s o f p e r fo rmanc e d a t a b l oc k Ma s t e r I /O p a c k e t s e q u e n c e n umbe r Num be r o f phys i c a l pag e s o f m em o r y i n c o n f i g u r a t i o n Num b e r o f c u r r en t b a tch j o bs Num b e r of i n t e r ac t i v e us e r s 1 0 c e l l h i s tog r am t o c o un t n umb e r o f c h a r a c t e r s pe r t e rm i n a l r e a d o pe r a t i o n 1 0 c e l l h i s tog r am to c o un t n umbe r o f c h a r a c t e r s pe r te rm i n a l wr i te op e r a t i o n To t a l n umbe r o f t e rm i na l c h a r a c te r s r e ad s i nc e bo o t s t r a p To t a l numbe r o f t e rm i n a l c h a r a c te r s wr i t t e n s i nc e bo o t s t r a p Numbe r o f r e ad s i n PAS SALL mod e Numbe r o f r e a d - w i th-prompt r eads Num b e r o f r e a d -w i th-pr om p t r e ad s o f mo r e than 1 2 c h a r a c te r s To t a l numbe r o f c h a r a c t e r s r e ad i n p r ompt mode Numbe r of r e ad s no t us i ng s t a nd a r d t e rm i n a l s Numbe r o f r e a d -w i th-prompt r e ad s not us i ng s ta nd a r d te rm i n a l s Numbe r o f LDPC T X i n s t r uc t i o n s EXECUT IVE DATA AREAS G l o b a l Symbo l Mo d u l e Si ze PM S $G L SWITCH PM S DAT l o ng wo r d PMS $G L T URN PM S $G L-S PL I T PM S DAT PMS DAT l o ngwo r d l o ngwo r d PMS $G L H I T PMS DAT l o ng wo r d PMS $G L O P EN PM S DAT l o ngwo r d PMS $G L O PENS PM S $G L-D O S TATS PM SDAT PMS DAT l o ngwo r d byte 3 byt e s B. l . l5 De sc r i pt i o n o f Da t a Num b e r o f sw i tc h e s f r om t h e c ur rent process Numb e r o f wi n d o w t u r n s Num b e r o f s p l i t I /0 t r an s f e r s Num b e r o f t r an s f e r s n o t r e qu i r i ng w i nd o w t u r n s Num b e r o f c u r r en t l y o pe ned f i l es To t a l n umbe r o f f i l e o pe n s F l ag to t u r n s t a t i s t i c s c o d e on and o f f Spa r e fo r a l i g nm e n t E n t r y Po i n t s f o r C PU-De pend en t Ro u t i ne s ( $$$500 ) Mod ul e S Y S LOAVEC c o n ta i n s e n t r y po i n t s fo r e a c h C PU -d e pe nd e n t r o u t i n e . Each entry po i n t conta ins a JMP i n s t r uc t i o n ( w i t h a b so l ut e a d d r e s s i ng ) . Th e d e s t i n a t i o n o f e a c h JMP i s a l t e r ed b y !N I T t o po i n t t o the a pp r o p r i a te r o u t i n e i n the C PU-d epend e n t i mag e SYS LOAx x x . EXE ( S YS LOA 7 5 0 . E XE o r SYS LOA7 8 0 . E XE ) th a t is l o ad ed i n to no npag e d po o l by !N I T . Th e r e a r e two t ype s o f r o u t i n e s h e r e . Tho s e r o u t i n e s t h a t a r e e n t e r ed th r o ug h t h e sys t em c o n t r o l b l o c k m u s t h a v e th e i r e n t r y po i n t s l o ng wo r d a l i g ned . Each o f these rout ines has two spa r e b y t e s to prese rve the six b y t e JM P O th e r r o ut i n e s can have l o ngwo r d a l i g nm e n t . i n s t r uc t i o n s p a c k e d tog e t h e r . G l o b a l Symbo l Mod u l e E XE $W N UMALGVE C S YS LOAVE C wo rd EXE $W N UM PKDVE C S YS LOAVE C wo rd S YS LOAVE C 4 0 byt e s Si ze Num b e r of l o ng wo r d a l i g n ed vec to r s Num b e r of p a c k e d vec to r s E XE $MC HK 8 bytes E XE $ I NT 5 4 8 bytes E XE $ I N T 5 8 8 bytes E XE $ I NT S C 8 by t e s E XE $ I NT6 0 8 bytes SYS LOAVE C De s c r i p t i o n o f Da t a 5 4 byt e s ECC $ RE ENAB LE 6 byt e s E XE $ADP I N I T 6 bytes E XE $ D UM PC PUREG 6 bytes B-1 3 F i v e l o ngwo r d a l i g n e d vec to r s Ma c h i ne c h e c k e x c e p t i o n s e rv i c e r o u t i n e I n t e r r upt s e rv i c e r o u t i ne fo r SCB vec to r 5 4 I n t e r r upt s e rv i c e r o u t i ne fo r S C B v e c to r 5 8 I n t e r r upt s e rv i c e r o u t i n e f o r SCB vec to r 5 C I n t e r r upt s e rv i c e r o ut i n e fo r SCB vec to r 6 0 N i n e pa c k ed v e c to r s Re e n a b l e m emo r y e r r o r t imers I n i t i a l i z e a d a pt e r fo r s y s t em d i s k Dump C PU-spec i f i c r eg i s t e r s t o e r r o r l og b u f f e r EXECUT IVE DATA AREAS G l o b a l Symbo l Mo d u l e S i ze E XE $REGRES TOR 6 byt e s EXE $REG SAVE 6 byt e s EXE $TEST C S R 6 by t e s I OC $ PURGDATAP 6 byt e s E X E $DW7 8 0 I NT 6 byt e s E X E $MC HK_ERRCNT 6 byt e s E XE $ L OAD_E RROR B . l . l6 SYS LOAVEC byte De s c r i p t i o n o f Da t a Re s to r e C PU-spec i f i c r eg i s t e r s o n po we r r ec o v e r y Save C PU-spec i f i c r eg i s t e r s a t powe r f a i l ur e Te s t UN I B US C S R f o r e x i s te n c e Pu r g e UN I BUS b u f f e r ed d a t a pa th DW7 8 0 UBA a d a pt e r e r r o r i n te r r up t r o ut i n e Po i n t e r t o e r ro r c o un te r s i n mach i n e c he c k routine HALT i n s t r uc t i o n . Ini tial d e s t i n a t i on o f JMP i n s t r uc t i o n s in v e c to r s Ta b l e o f Ad j us t a b l e SYS BOOT Pa r am e te r s ($$$917 ) As d e sc r i b ed i n Ch a pt e r 2 2 , t h e e x ec u t i v e imag e c o n t a i ns a c o py o f t h e wo r k i ng v a l ue of e a c h SYSB OOT p a r ame t e r . Th i s t ab l e o f v a l ue s i s w r i t t e n i n to t h e memo r y i m a g e o f t h e e x e c u t i v e b y SYSB OOT a nd cop i ed back to the execut ive d i sk i mag e by SYS I N I T . G l oba l l abel MMG $A SYS PARAM , d e f i n ed i n mod u l e MOAT , l o c a t e s t h e t h e b eg i nn i ng o f t h e pa r ame t e r a rea . G l o ba l l a b e l E XE $A S Y S PARAM , d e f i ned i n mod u l e S YS PARAM , h a s the s ame v a l ue . I n t h e f o l l o w i ng l i s t , t h e n am e o f e a c h pa r am e t e r p a r t o f i t s d e sc r i p t i o n . G l o b a l Symbo l Mo d u l e E XE $G Q_TODCBAS E SYS PARAM q ua d wo r d E XE $G L TODR SYS PARAM l o ng wo r d S GN $GW_DF PFC SYS PARAM wo r d SGN$G B_PG TB PFC SYS PARAM byt e SGN$G B_S YS PFC SYS PARAM byte S G B $ G B_KF I LSTCT SYS PARAM byte SGN $GW G B LS ECNT SYS PARAM byte wo r d S GN $G W MAXG PGC T .S GN$GW-MAXPRC CT SYS PARAM SYS PARAM wo r d wo r d S i ze B-1 4 is i nc l ud ed as a De sc r i p t i o n o f Da t a Ba s e v a l u e o f t i me-o f -d a y c l o c k i n sys t em t i me fo rma t ( no t a pa r am e t e r ) Ba s e v a l ue i n t i me-o f -ye a r c l o c k ( no t a pa r a m e t e r ) De f a u l t pag e f a u l t c l us t e r s i ze ( PFCDEFAULT ) De f a u l t pag e t a b l e pag e f a u l t c l us t e r s i z e ( PAGTB LPFC ) Pag e f a u l t c l us t e r f a c to r f o r sys t em pag i ng ( S YS PFC ) Num b e r o f known f i l e l i s t s ( K F I LSTCNT ) Spa r e fo r a l i g nment G l o b a l sec t i o n c o un t ( G B LSECT I ONS ) G l o b a l pag e c o u n t ( G B LPAG E S ) Ma x i m um p r o c e s s c o un t ( MAXPROC E S SCNT ) E X E C U T I VE DATA AREAS S i ze G l o b a l Symbo l Mod ul e SGN $GW MAXP S TCT SYS PARAM wo rd SGN $GW MINWSCNT SYS PARAM wo rd SGN $GW_PAG F I LCT S YS PARAM wo rd SGN $GW P F L I BAS SYS PARAM wo rd SGN $GW S FTMAX S YS PARAM wo rd SGN $G L PG F L S I Z SYS PARAM 2 byt e s l o ng wo r d SGN $GW S YS DWSCT SYS PARAM wo rd SGN $GW I S PPGCT SYS PARAM wo rd SGN$GB DE FPG F L S YS PARAM byte SGN $ G L BALS E TC T SYS PARAM SYS PARAM 3 bytes l o ng wo r d SGN $ G L I R PC NT SYS PARAM l o ng wo r d SGN $ G L MAXWSCNT SYS PARAM l o ngwo r d SGN $ G L N PAG E DYN S YS PARAM l o ng wo r d SGN $G L PAG E DYN S YS PARAM l o ngwo r d SGN $G L MAXVPGCT SYS PARAM l o ng wo r d SGN $G L_S PTRE Q S YS PARAM l o ngwo r d SGN $G L E XU S R S TK S YS PARAM l o ng wo r d S GN $GW PC HANC NT SYS PARAM wo r d SGN $GW I MG I OCNT S YS PARAM wo rd S C H$GW_QUAN SYS PARAM wo rd MPW$GW MPWPFC SYS PARAM wo rd MPW$GW H I L I M SYS PARAM wo rd MPW$GW L O L I M SYS PARAM wo rd B-1 5 D e s c r i pt i o n o f Da t a Pr o c e s s s e c t i o n c o un t ( PROC S ECTCNT ) M i n i m um wo r k i ng s e t s i z e ( M I NWSCNT ) Num b e r o f pag e f i l e s ( PAGF I LCNT ) Ba s e v a l ue fo r pag e f i l e i nd ex ( no t a pa r am e t e r ) Num b e r o f swa p f i l e s ( SWPF I LCNT ) Spa r e fo r a l i g nm e n t S i z e o f pag i ng f i l e ( PAGE F I LS I Z E ) S i ze o f s ys t em wo r k i ng s e t c o un t ( S YSMWCNT ) S i z e i n pag e s o f i n t e r r up t s t a c k ( I NTS TKPAG E S ) De f a u l t pag i ng f i l e i nd ex ( no t a SYSB OOT pa r am e t e r ) Spa r e fo r a l i g nm e n t Ba l a n c e s e t c o un t ( BALS ETCNT ) Co un t o f p r e a l l o c a t e d I/0 r e que s t pa c ke t s ( I R PC OUNT ) Ma x i m um s i ze o f p r o c e s s wo r k i ng s e t ( WSMAX ) Num b e r o f byt e s o f n o npag ed po o l ( N PAG E DYN ) ( T r un c a ted to pag e b o und a r y by SYSB OOT ) Num b e r o f b yt e s o f p a g ed po o l ( PAGE DYN ) ( T r un c a t ed t o pag e bo und a r y b y SYSBOOT ) Max i m um v i r t ua l pag e c o un t ( VI RTUA LPAG E CNT ) Num b e r o f add i t i o n a l S PTEs t o a l l o c a t e ( S PTRE Q ) Ex t r a us e r s t a c k s pa c e ( i n b y t e s ) a l l o c a t ed by i ma g e a c t i v a to r ( E XUSRS TK ) Pe r m a n e n t I /0 c h a nn e l c o un t ( C HANNE LCNT ) De f a ul t n umbe r o f pag e s m a pped fo r i m a g e I /O s egme n t ( I MG I OCNT ) Leng th ( i n 1 0 m s e c u n i t s ) o f q ua n t um ( QUANTUM ) Mod i f i ed pag e wr i t e r c l us t e r f a c to r ( MPW WRTC LUSTER) High l i m i t th resho l d o f m od i f i ed pag e l i s t ( MPW H I L I M ) Low l i mT t t h r e sho l d o f m od i f i e d pag e l i s t ( MPW_LOLIMI T ) EXECUTIVE DATA AREAS G l o b a l Symbo l Mod u l e S i ze MPW $ G B PR I O S Y S PARAM byte SWP $G B PR I O SYS PARAM byte SGN$GW WS LMXS K P S Y S PARAM wo r d MMG $G L P HYPGCNT S YS PARAM l o ngwo r d S C H $G L P FRAT L S YS PARAM l o ngwo rd S C H$G L PFRATH SYS PARAM l o ng wo rd S C H$G L PFRATS S YS PARAM l o ngwo rd S C H $G L WS INC SYS PARAM l o ngwo r d S C H $G L WSDEC SYS PARAM l o ng wo r d S C H $GW AWSMIN SYS PARAM wo rd S C H $GW AWSMAX S YS PARAM wo rd S C H $G L AWS T I M E SYS PARAM l o ngwo r d S C H$G L SWPRATE SYS PARAM l o ngwo rd S C H$GW I OTA SYS PARAM wo rd S C H $GW SWPFA I L SYS PARAM wo r d S G N $G L E XTRAC PU SYS PARAM l o ngwo rd E XE $G L S YS U I C SYS PARAM l o ngwo r d I OC $GW MAXBUF SYS PARAM wo rd I OC $GW_MBXBFQUO SYS PARAM wo rd I OC $GW M B XMXM SG S YS PARAM wo rd I OC $GW MBXNMMSG SYS PARAM wo rd B- 1 6 Des c r i pt i o n o f Da t a P r i o r i t y a t wh i c h mod i f i ed pag e wr i t e s w i l l b e q u e ued ( MPW PR I O ) P r i o r i t y a t wh Tc h swa ppe r I /0 r e q u e s t s wi l l b e q u e ued ( SWP PR I O ) Numbe r o f wo r kTng s e t l i s t entr ies t o skip i n mo d i f i ed s c a n o f WS L ( S K I PWS L ) Max i m um n um b e r o f phys i c a l pag e s t o u s e ( PH Y S I CALPAG E S ) Low l i m i t pag e f a u l t r a te th r e sho l d ( PFRATL ) H i g h l i m i t pag e f a u l t r a te th r e sho l d ( PFRATH ) Pag e f a ul t r a te th r e sho l d f o r sys t em pag i ng ( PFRATS ) Wo r k i ng s e t i nc r em e n t ( WS INC ) Wo r k i ng s e t d e c r em e n t ( WSDEC ) M i n i m um v a l ue o f a utom a t i c o r k i ng s e t ad j us tm e n t ( AWSM IN ) Ma x i m um va l u e o f a u tom a t i c wo r k i ng s e t ad j us tmen t ( AWSMAX ) Wo r k i ng s e t m e a s u r em e n t i n te rva l ( i n 1 0 m s e c un i t s ) ( AWST IM E ) Swa p r a t e f o r c ompu t e bo und j o b s ( SW PRATE ) Amo un t o f t ime ( i n 1 0 m s e c un i t s ) t o c h a rg e ag a i n s t q u a n t um wh e n p r o c e s s g o e s i n to wa i t s ta te ( I OTA ) Numb e r o f o u tswa p f a i l u r e s t o h a ppe n b e f o r e mod i fy i ng s e l ec t i o n a l go r i thm ( SWPFA I L ) E x t r a C PU t ime a f t e r C PU t ime exp i r a t i on ( E XTRAC P U ) Max i m um g r o up c o d e fo r s ys t em U I C ( S Y S U I C ) Ma x imum b u f f e r ed I /O r e que s t s i ze ( MA XB U F ) D e f a u l t b u f f e r quo t a f o r ma i l bo x c r e a t i o n ( D E FMBXB UFQUO ) D e f a u l t m a x i m um m e s s a g e s i z e f o r ma i l bo x c r e a t i o n ( DE FMBXM XMSG ) D e f a u l t n um b e r o f m e s s ag e s fo r ma i l bo x c r e a t i o n ( D E FMBXN UMMSG ) EXECUTIVE DATA AREAS G l o b a l S ymbo l Mod u l e S GN $G L FRE E L I M S YS PARAM l o ng wo r d E XE $G L_LOCKRTRY S YS PARAM l o ng wo r d I OC $GW XFMXRATE I OC $GW=LAMAPREG S YS PARAM S YS PARAM wo r d wo r d E XE $G L_RT I M E S PT S YS PARAM l o ngwo r d E XE $G L C L I TAB L SYS PARAM l o ngwo r d E XE $G L_D E F F LAG S S YS PARAM l o ng wo r d S i ze E XE $V_C RDENABLE bit E XE $V B UGDUM P bit E XE $V FATA L B UG E XE $V M U LTAC P bit E XE $V_N OAUTOCNF bit E XE $V N OC LOC K bit E XE $V N OC LU S TER bit E XE $V_POO LPG ING bit E XE $V S B I E RR bit E XE $V S E TT I M E bit E XE $V S HR F l lAC P bit E XE $V S YS PAG I NG bit E XE $V S YS UAFA LT bit E XE $V S YSWRTAB L bit E XE $V RESALLOC bit - bit TTY$G L DE LTA S Y S PARAM l o ngwo r d TTY$GB D I A LTY P S YS PARAM byte De s c r i p t i o n o f Da t a Low l im i t t h r e sho l d o f f r e e pag e l i s t ( FREE L I M ) N umbe r o f r e t r i e s wh e n a t temp t i ng t o l o c k a m u l t i pr o c e sso r d a t a s t r uc t u r e ( LOCKRETRY ) Max i m um DR 7 8 0 d a ta r a t e Numbe r o f UN I B US m a p r eg i s t e r s t o p r e a l �o c a t e fo r LPA l l ( LAMAPREG S ) Numbe r o f p r e a l l o c a ted S PT E s fo r c o n n e c t to i n t e r r up t ( REALT I M E S PTS ) Numbe r o f page s f o r C L I s ym b o l t a b l e ( C L I SYMTB L ) Sys tem f l ag s l o ng wo r d ( no t a pa r am e t e r i t s e l f ) CRD e r r o r e n a b l e ( CRDENAB LE ) Wr i t e sys t em d um p o n b ug c h e c k ( D UM PB UG ) Ma k e a l l b ug ch e c k s f a t a l ( B UG C H ECKFATA L ) C r e a te s e pa r a t e AC P f o r e a c h vo l um e ( AC P MULT I P L E ) I nh i b i t-a u t o c o n f i g u r a t i o n o f I /0 d ev i c e s ( N OAUTOCONF I G ) Do no t s t a r t i n t e rv a l t i m e r ( N OC LOC K ) I n h i b i t pag e r e a d c l us t e r i ng ( NOC L U S T E R ) Ena b l e pag i ng o f pag e d po o l ( POOLPAG I NG ) E n a b l e d e t ec t i o n o f S B I e r r o r s ( S B I E RRENAB LE ) P r ompt fo r sys tem t i m e i n SYSBOOT ( S E TT IM E ) Enab l e s h a r i ng o f f i l e AC P ( AC P S HARE ) Enab l e pag i ng o f pag e ab l e s y s t em c o d e ( S Y S PAG ING ) Se l e c t a l t e r n a t e a u tho r i z a t i o n f i l e ( UAFALTERNATE ) Leave e n t i r e e x e c u t i v e wr i ta b l e ( WR I TAB LE SYS ) Enab l e r e s o u r c e a l l o c a t i o n c h e c k i ng ( RE SALLOC ) Del ta t i me fo r d i a l up t i m e r s c a n ( TTYS CANDE LTA ) D i a l up f l ag s ( D I ALTYPE ) (1 > Un i ted K i ng d om , > e l s e wh e r e ) 0 = = B 17 - EXECUT IVE DATA AREAS S i ze G l oba l Symbo l Mod ul e TTY$G B_D E F S PE ED S Y S PARAM byte TTY$GW_D E FBUF SYS PARAM wo r d TTY$G L_D E F C HAR S Y S PARAM l o ng wo r d TTY$GW_TYPAHD S Z S Y S PARAM wo r d TTY$GW_PR OT S Y S PARAM wo r d TTY$G L_OWN U I C S Y S PARAM l o ng wo rd S YS $G B_DFMBC S Y S PARAM byte S Y S $G B_DFMB FSDK S Y S PARAM byt e S YS $G B_DFMBFSMT S Y S PARAM byte S Y S $G B DFMB F S UR S Y S PARAM byte S YS $ G B_DFMBFRE L S YS PARAM byt e S Y S $G B_DFMB F I DX S Y S PARAM byte SYS $ G B_DFMB FHSH S Y S PARAM byte PQL$AL_D E FAULT + 4 S Y S PARAM byte 1 2 l o ng wo r d s P Q L $AL_M I N + 4 S Y S PARAM 1 2 l o ng wo r d s PQL$AB_FLAG + 1 S YS PARAM 1 2 bytes AC P$GW_MAPCAC H E S Y S PARAM wo r d AC P$GW_HDRCAC H E S Y S PARAM wo rd AC P$GW_D I RCACHE S Y S PARAM wo rd AC P$GW_WORKS ET SYS PARAM wo r d AC P$GW_F I DCACHE SYS PARAM wo rd AC P$GW_E XTCACHE SYS PARAM wo r d AC P$GW_E XT L I M I T S Y S PARAM wo r d B-1 8 De s c r i pt i o n o f D a ta De f a ul t s pe ed f o r t e rm i na l s ( TTY S PE E D ) De f a ul t-t e rm i na l l i n e w i d th ( TTY B U F ) De f a u l t-te rm i n a l c h a r a c te r i s t i c s ( TTY D E FC HAR ) S i z e o f-t ype - a h e ad b u f f e r ( TTY TYPAHDS Z ) De f a u l t-t e rm i na l a l l oc a t i o n p r o t e c t i o n ( TTY PROT ) De f a ul t te rm i n a l own e r U I C ( TTY OWN E R ) De f a u l t-mul t i b l o c k c o u n t ( RM S DFMB C ) De f a ul t-mul t i bu f f e r c o un t fo r s e que n t i a l d i s k I /O ( RM S DFMBFSDK ) De f a u l t-mul t i b u f f e r c o un t f o r mag tape I /0 ( RM S DFMB FSM T ) De f a u l t-mu l t i b u f f e r c o un t fo r un i t r e co r d d ev i c e s ( RM S DFMBFS UR ) De f a ul t-mul t i b u f f e r c o un t fo r r e l a t i v e f i l e s ( RMS DFMBFRE L ) De f a u l t-mul t i b u f f e r c o un t fo r i nd e x ed f i l e s ( RM S DFMBF I DX ) De f a u l t-mul t i b u f f e r c o un t h a sh ed ( RMS DFMBFHS H ) Spa r e fo r a l i gnme n t Tab l e o f p r o c e s s quo ta l i s t d e f a u l t v a l ue s ( Ta b l e 1 7 - 4 ) Ta b l e o f p r o c e s s quo ta l i s t m i n imum va l ue s ( Ta b l e 1 7 - 4 ) Ta b l e o f p r o c e s s quo ta l i s t f l ag s Numb e r o f b l o c ks i n b i tmap c a che ( AC P MAPCACHE ) Numb e r o f b l ock s i n f i l e h e ad e r c a c h e ( AC P HDRCAC HE ) Numbe r of b l oc ks i n f i l e d i r e c to r y c a c h e ( AC P D I RCAC H E ) AC P wo rki ng s e t s i z e ( AC P WORKS E T ) Numbe r of c a c h ed i nd e x f i l e s l o ts ( AC P F I DCACHE ) Num b e r o f c a ched d i s k e x te n t s ( AC P E XTCACHE ) Fr a c t i o n o f d i sk to c ac h e ( AC P_E XT L I M I T ) EXECUTIVE DATA AREAS S i ze G l o b a l Symbo l Mod u l e ACP $GW_Q U OCAC HE S Y S PARAM wo r d ACP $GW_S YSACC S Y S PARAM wo r d AC P$G B_MAXREAD S Y S PARAM byt e ACP$G B WI NDOW S YS PARAM byte AC P $G B WR ITBACK S YS PARAM byte AC P $G B DATAC HK S Y S PARAM byte Numbe r o f quo t a f i l e e n t r i e s to c a c h e ( AC P QUOCAC H E ) De f a u l t a c c e s s for s ys t em vo l um e s ( AC P S YSAC C ) Ma x i m um n um b e r of b l o c k s t o r e a d a t o n c e fo r d i r e c to r i e s ( AC P MAXREAD ) De f a u l t w i nd ow s i z e - f o r s y s t em vo l um e s ( AC P W INDOW ) Enab l e de fe r r ed c a c h e wr i t e b a c k ( AC P WR I T E BACK ) AC P d a t a c h e ck e n ab l e f l ag s ( AC P_DATAC H E C K ) bit bit AC P$V READC HK AC P $V=WR I TE C HK AC P$GB_BAS E PR I O S Y S PARAM byt e ACP$GB SWAPF LG S S YS PARAM byt e bit AC P$V SWAPG RP bit AC P$V SWAP PRV bit AC P$V_SWAPMAG bit SYS PARAM byte S YS $GB D E FPR I S YS PARAM byte S YS $GW_I JOB L IM S YS PARAM wo r d S Y S $GW BJOB L IM SYS PARAM wo r d SYS $GW_NJOB L IM SYS PARAM wo r d Do d a t a c h e c k o n r e a d s D o d a t a c h e c k o n wr i t e s A C P b a s e so f twa r e p r i o r i t y ( AC P BAS E PR I O ) AC P s wap f l ag s ( AC P_SWAPF LGS ) AC P$V_SWAPS YS SYS $GB MXPRTSYM De s c r i p t i o n o f Da t a Swa p ACPs f o r /SYSTEM vo l um e s Swa p AC Ps f o r /G ROUP vo l um e s Swa p AC Ps f o r p r i v a t e vo l um e s Swa p mag t a pe AC Ps Max i m um n umb e r o f p r i n t s ymb i on t s ( MAXPR I NTSYMB ) De f a u l t p r i o r i ty f o r j o b i n i t i a t i o n s ( DE FPR I ) ( a l so uppe r l i m i t o n " c r un c h e r " p r o c e s s p r i o r i ty ) L i m i t f o r i n t e r a c t i v e j o bs ( I JOB L I M ) L i m i t f o r b a tc h j o b s ( BJOB L I M ) L i m i t fo r n e two r k j o b s ( NJOB L I M ) 8-1 9 E XECUTIVE DATA AREAS Th e r e s t o f m o d u l e SYS PARAM c o n s i s t s o f o th e r sys tem wi d e pa r ame te r s who s e v a l ue s a r e n o t d i r e c t l y a d j us tab l e w i th SYSB OOT o r SYSGEN b u t wh i c h d e pe nd d i r ec t l y o n the v a l ue s o f o n e o r mo r e ad j us ta b l e pa r am e t e r s . G l o b a l Symbo l Mod u l e S i ze SWP $G L_S H E L LS I Z S Y S PARAM l o ng wo r d SWP $GW BAKPTE SYS PARAM wo rd SWP $GW EMPTPTE S Y S PARAM wo r d SWP $GW WS LPTE S Y S PARAM wo rd SWP $G B S H L P l PT S Y S PARAM byte SWP $G L_B S LOTS Z SYS PARAM byte l o ng wo r d SWP $G L MAP S YS PARAM l o ng wo r d SWP $G L PHDBASVA S Y S PARAM l o ng wo r d SGN $G L PHDAPCNT SGN $G L=PHDLWCNT S Y S PARAM S Y S PARAM l o ng wo r d l o ngwo r d SGN $G L P l LWCNT S Y S PARAM l o ng wo r d SGN$G L PHDPAG C T S Y S PARAM l o ng wo rd SGN$G L P T PAGCNT MMG $G L=C T LBASVA S Y S PARAM S Y S PARAM l o ng wo r d l o ng wo rd E XE $AL_S TACKS SYS PARAM 2 l o ngwo r d s l o ngwo r d EXE $G L I NT S TK l o ng wo r d MMG $G L_G PTBAS E S Y S PARAM l o ngwo r d MMG $G L G PT E S Y S PARAM l o ngwo r d MMG $G L MAXG PTE MMG $G L=MAXSYSVA S YS PARAM S Y S PARAM l o ngwo r d l o n g wo r d MMG $G L_S PTBAS E S Y S PARAM l o ng wo r d MMG $G L S PT LEN MMG $G L-SYS PHD S Y S PARAM S YS PARAM l o ng wo r d l o ng wo r d 8-2 0 De s c r i p t i o n o f Da t a Pag e s r e qu i r ed fo r Sh e l l process Numbe r o f p r o c e s s h e a d e r pag e s f o r p r o c e s s h e ad e r pag e a r r a ys Numbe r of emp t y p r o c e s s h e ad e r pag e s f o r wo r k i ng s e t l i s t expans i o n Numbe r o f p r o c e s s h e ad e r pag e s f o r f i x ed a r e a , wo r k i ng s e t l i s t , a nd p r o c e s s s e c t i o n t ab l e Numbe r o f P l pag e t a b l e pag e s r e q u i r ed fo r Sh e l l Spa r e f o r a l i g nm e n t S i z e ( i n p ag e s ) o f b a l a n c e slot Ad d r e s s o f swa ppe r ' s I /0 pag e t a b l e Ba s e a d d r e s s o f p r o c e s s h e a d e r w i ndow C o un t of Sh e l l he ad e r pag e s C o un t o f l o ng wo r d s i n p r o c e s s h e ad e r Co u n t o f l o ng wo r d s t o e nd o f P l pag e t a b l e C o u n t o f a l l p r o c e s s h e ad e r pag e s e x c l ud i ng pag e t a b l e pag e s Co un t o f p a g e t ab l e pag e s I n i t i a l l o w a d d r e s s e nd o f P l s pa c e Ar r a y o f k e rne l mod e sys tem spa c e s t a c k s Ad d r e s s o f swa ppe r ' s ke rnel stack Ad d r e s s o f i n t e r r up t s ta c k Ba s e a d d r e s s o f g l o b a l pag e table Ad d r e s s o f f i r s t G PTE { ps e ud o S PTE ) at e nd o f s ys t em pag e t a b l e H i g h e s t G PTE a d d r e s s H i g h e s t s y s tem v i r t ua l a d d r e s s { pl us one ) Ba s e v i r t u a l add r e s s o f sys t em pag e t a b l e Leng th o f sys tem pag e t a b l e V i r t 4a l ad d r e s s o f sys tem h e ad e r EXE C UT I VE DATA AREAS Si ze G l o b a l Symbo l Mo d u l e MMG $G L S YS PHD LN S Y S PARAM l o ng wo rd SWP$G L_BALBAS E S YS PARAM l o ngwo rd SWP$G L_BALS PT SYS PARAM l o ng wo rd MMG $ G L S B R SYS PARAM l o ng wo rd MMG $G L_N PAG EDYN SYS PARAM l o ngwo rd MMG $G L_PAG E DYN S YS PARAM l o ng wo rd MMG $G L MAXPFN SYS PARAM l o ng wo r d EXE $G L_R PB SYS PARAM l o ng wo r d B OO $G L_S PTFREL S YS PARAM l o ng wo rd BOO$G L S PTFREH SYS PARAM l o ngwo r d E XE $G L S C B SYS PARAM l o ng wo r d EXE $GB C PUTYPE SYS PARAM PFN $A BAS E SYS PARAM byte 3 byt e s 8 l o ng wo r d s PFN $ A L P T E PFN $AL-BAK l o ngwo r d l o ngwo r d PFN$AW_R E FCNT l o ngwo r d PFN$AW_F L I NK , PFN$AW_S HRCNT l o ngwo r d PFN$AW_B L INK , PFN$AW_WS LX l o ngwo r d PFN$AW SWPVBN l o ngwo r d PFN$AB S TATE l o ngwo r d PFN$AB TYPE l o ngwo r d E XE $GT S TART UP S YS PARAM 3 3 bytes B-2 1 De s c r i p t i o n o f Da t a S i ze ( i n b y t e s ) o f s ys tem h e ad e r Base v i r tua l add r e s s o f ba l ance s l o t a rea Ba s e v i r t u a l a d d r e s s i n s y s tem pag e t a b l e f o r m a pp i ng b a l a n c e s l o t s Phys i c a l a d d r e s s o f sys tem pag e t a b l e ( Dupl i c a t e s c o n t e n t s o f PR $ S B R ) V i r t u a l add r e s s o f-b eg i nn i ng o f no np� g e d po o l V i r t ua l ad d r e s s o f beg i nn i ng o f pag ed po o l Ma x i m um PFN a c c o un t ed fo r i n PFN d a t a b a s e V i r t u a l add r e s s o f r e s t a r t pa r ame t e r b l o c k V i r t u a l pag e numbe r o f l o we r e nd o f po o l o f un u s ed S PT E s Vi r t u a l pag e n um be r o f uppe r end o f po o l o f unused S PT E s V i r t u a l add r e s s o f sys tem c o n t ro l b l o c k C PU t ype r e ad f r om P R $ S I D Spa r e fo r a l i g nm e n t Ad d r e s s e s o f e i g h t PFN d a t a b a s e a r r a ys Ad d r e s s o f PTE a r r a y Ad d r e s s o f b a c k i ng s t o r e add r e s s a r r a y Ad d r e s s o f r e f e r e n c e c o un t a r r a y o f wo r d s Ad d r e s s o f c omb i n e d f o r wa r d l i n k /g l o b a l sha r e c o un t a r r a y o f wo r d s Ad d r e s s o f comb i n e d b a c kwa r d l i n k/wo r k i ng s e t l i s t i nd ex a r r a y o f wo r d s Ad d r e s s o f swa p i m ag e v i r t ua l b l o c k n umbe r a r r a y o f wo r d s Ad d r e s s o f STATE a r r a y o f byt e s Ad d r e s s o f TYPE a r r a y o f bytes C o un t ed ASC I I s t r i ng o f n a m e o f s t a r t up c ommand f i l e EXEC UT IVE DATA AREAS 8 . 1 . 17 Rema i nd e r o f Ex e c u t i ve Imag e Th e r e s t o f t h e e x e c u t i ve imag e c o n s i s ts o f r ead-onl y code a r eas , r e ad - o n l y tables , a nd pa tch spac e . Al l o th e r d a ta a reas a re d yn am i c a l l y c r e a t ed a s a pa r t o f s y s tem i n i t i a l i za t i o n . G l ob a l l abel MMG $ FRSTRONLY , d e f i n ed i n mod u l e MOAT , locates the b eg i nn i ng of the n o n pag ed e x e c u t i v e r o u t i ne s . Th e pag ed e x e c u t i v e i s a l so d e l i m i t ed by the l a b e l s MMG $AL PGOC OO a nd MMG $AL_PGDC OOEN , d e f i n ed i n MOAT . 8.2 DYNAM I CALLY ALLOCATED EXECUT IVE DATA M a n y o f t h e d a ta s t r uc t u r e s a nd a r e a s o f s y s t em ad d r e s s s p a c e a r e n o t a pa r t o f the e x e c u t i ve i ma g e b u t i n s t e a d a r e c o n s t r uc ted wh e n the sys tem is i n i t i a l i z e d . Th e s i z e s o f some of t h e s e a r e a s d e pe nd o n the v a l u e s o f S YS 8 00T p a r am e t e r s . O th e r a r e a s d e pe nd o n t h e pa r t i c u l a r phys i c a l c o n f i g u r a t i o n . 8.2. 1 Re s ta r t Pa r am e t e r B l o c k Th e r e s ta r t p a r am e te r b l o c k i s f i l l ed i n a t i n i t i a l i z a t i o n t i me w i th b o o t s t r a p pa r am e t e r s . Th e powe r f a i l u r e i n t e r r up t s e rv i c e r o u t i n e l o ad s the v o l a t i l e m a c h i n e s t a t e i n to th e R PB b e fo r e the sys t em h a l t s . Du r i ng powe r r e c o v e r y , t h e r e s ta r t pa r am e t e r b l o c k a l l o ws t h e c o n so l e l og i c to d e t e rm i n e wh e th e r memo r y c o n t e n t s s u rv i v ed t h e powe r o u t ag e . Th e u s e o f t h e r e s ta r t pa r am e t e r b l o c k i s d i sc us s ed i n Ch a p te r s 2 1 a nd 23. 8.2. 2 PFN Da t a Ba s e Th e PFN d a t a b a s e c o n s i s t s o f s eve r a l a r r a ys who s e c o n t e n t s d e sc r i b e t h e s t a t e o f e a c h pag e i n phys i c a l memo r y . ( To s a v e memo r y , pag e s tha t c o n t a i n the pe r m a n e n t l y r e s i d en t €X e c u t i v e a r e no t a c c o un ted fo r in the PFN d a t a b a s e . ) Th e PFN a r r a ys a r e d e sc r i b ed i n Ch apte r 1 1 . Th e i r u s e d u r i ng pag e f a u l t r e so l u t i o n i s d i sc us s ed i n Ch a p t e r 1 2 . PFN a r r a y m a n i pu l a t i o n d u r i ng s wa ppe r o pe r a t i o n s i s d i s c us s ed i n Ch a p t e r 1 4 . 8.2.3 P a g ed Dyn am i c Memo r y Pag ed dyn am i c memo r y c o n ta i n s a l l s y s t em-w i d e d ynam i c a l l y a l l o c a ted s t r uc t u r e s that do not h av e to b e pe rma n e n t l y r e s i d e n t . Typ i c a l s t r uc t u r e s a l l o c a ted f r om pag ed d yn am i c m emo r y a r e l i s ted in Ch a p t e r 2 5 . 8- 2 2 EXECUT I VE DATA AREAS B.2.4 No n pa g ed Dyn am i c Mem o r y No n pag ed po o l c o n ta i n s a l l d yn am i c a l l y a l l o c a ted s t r uc t u r e s tha t mus t b e r e s i d en t a t a l l t i m e s . Th e s e s t r uc t u r e s m a y c o n t a i n e i th e r cod e o r Th e no rma l n o n pag ed d a ta . Th e r e a r e a c t ua l l y t wo po o l a r e a s h e r e . po o l uses t h e same a l l o c a t i o n r o u t i n e as is u s e d fo r pag ed po o l . Th i s po o l a r e a c a n h a v e b l o c k s o f a ny s i z e a l l o c a ted f r om it. A s e co nd po o l a r ea c o n ta ins f i x ed s i ze blocks ( c u r r en t l y 9 6 byt e s ) l i nk e d tog e th e r so t h a t a b l o c k m a y b e i n s e r ted o r r emoved wi th t h e I N S QU E a n d REMQU E i n s t r uc t i o n s . Th i s s e c o nd a rea i s o f t e n c a l l ed the l o o ka s i d e l i s t . Th e u s e of n o n pag ed po o l is d e s c r i b ed in Ch a pt e r 2 5 . B. 2. 5 I n t e r r up t S t a c k Th e i n t e r r up t s t a c k i s u s e d to s e r v i c e a l l h a r d wa r e i n t e r r up t s a nd a l l so f twa r e i n t e r r up t s e x c e p t AST d e l i v e r y . B.2.6 Sys t em Co n t r o l B l o c k Th e sys tem c o n t r o l b l o c k i s s t r i c t l y s pe a k i ng no t a wr i t a b l e d a t a s t r uc t u r e a l tho ug h e n t r i e s a re some t i me s mo d i f i ed by the e x e c u t i v e d eb ug g e r XDE LTA . B.2.7 Ba l an c e S l o t Ar e a Th e b a l a n c e s l o t a r e a i s d evo ted e x c l u s i v e l y t o p r o c e s s h e ad e r s . An y r e s i d en t p r o c e s s h a s i t s p r o c e s s h e ad e r i n o n e o f the b a l a n c e s l o t s . Ba l anc e s l o t s a r e d e sc r i b ed i n Ch a pt e r 1 1 . Th e i r u s e by the swa ppe r i s d i s c u s s ed i n Cha p t e r 1 4 . B.2.8 Sys t em He a d e r Th e s ys t em h e ad e r i s a sys tem a n a l og u e t o p r o c e s s h e ad e r s th a t a l l o ws s y s t em c o d e to be pag e ab l e . Th e s t r uc t u r e s w i th i n the sys t em h e ad e r tha t a r e o f t e n a l t e r ed a r e t h e sys t em wo r k i ng s e t l i s t a nd the s y s t em s e c t i o n tab l e tha t c o n t a i n s g l ob a l s e c t i o n t a b l e en t r i e s . B. 2.9 Sys t em P a g e Tab l e Th e po r t i o n o f the sys tem pag e t a b l e tha t und e rg o e s the m o s t c h a ng e i s O th e r ope r a t i o n s c a n c a u s e tha t pa r t th a t m a ps t h e b a l a n c e s l o t a r e a . o the r a r e a s o f t h e sys t em pa g e t a b l e t o c h a ng e . 8 . 2. 10 G l o ba l Pag e Ta b l e Th e g l o b a l p a g e t ab l e i s a p s e ud o e x t e n s i o n o f t h e sys tem pag e t a b l e tha t a l l ows G PT E s to b e a c c e s s ed w i th SVPNs . Th e g l o b a l pag e t ab l e i s a l t e r ed wh en g l oba l s e c t i o n s a r e c r e a ted and d e l e t ed . In ad d i t i o n , G PTEs c a n c h a ng e a s a r e s u l t o f pag e f a u l t s . B- 2 3 EXE C UT I VE DATA AREAS B.3 PROC ESS-SPEC I F I C EXECUT IVE DATA S ome p r o c e s s - s pe c i f i c d a t a i s s to r ed i n t h e p r o c e s s h e a d e r . Th a t d a t a i s a c c e s s i b l e ( s ub j e c t to s yn c h r o n i za t i o n c o n s i d e r a t i o n s ) wh e n ev e r th e process i s res ident . Mo s t o f t h e p r o c e s s - s p e c i f i c d a t a i s f o und i n P l space . P l s pa c e i s o n l y a d d r e s s a b l e wh e n the p r o c e s s i s t h e c u r r e n t process . Th e e x e c u t i v e us e s ASTs t h a t e x e c u t e i n p r o c e s s c o n t e x t wh e n it is n e c e s s a r y to a c qu i r e o r mod i f y s uc h d a ta f r om some o th e r proc e s s . B.3.1 Pl Po i n te r Pag e Th e P l po i n t e r pag e i s a pe rm a n e n t m em b e r o f the p r o c e s s wo r k i ng Th e e n t i r e po i n t e r pag e i s d e f i n ed i n e x e c u t i v e mod u l e S H E L L . G l o b a l Sym b o l Da t a Ar e a S i ze C T L$GW NM I OC H CT L$G W-C H INDX CTL$G L-RM S P P P l Po i n t e r Pag e P l Po i n t e r Pag e P l Po i n t e r Pag e wo r d wo r d l o ng wo rd CT L$G L RM S I P P l Po i n t e r Pag e l o ng wo r d P l Po i n t e r Pag e l o ng wo rd P l Po i n t e r Pag e l o ng wo r d P l Po i n t e r Pag e l o ng wo rd P l Po i n t e r Pag e l o ng wo rd P l Po i n t e r Pag e l o ng wo r d C T L$G L P L T F L P l Po i n t e r Pag e l o ng wo r d CTL$G L P LTBL P l Po i n t e r Pag e l o ngwo rd CTL$G L CMS UPR P l Po i n t e r Pag e l o ng wo r d C T L$G L C MUS ER P l Po i n t e r Pag e l o ng wo r d CTL$G L C M HANDLR P l Po i n t e r Pag e l o ng wo r d CTL$AQ_E XCVE C P l Po i n t e r Pag e 8 l o ng wo r d s C T L $ G L_TH E XE C P l Po i n t e r Pag e 3 l o ng wo r d s CTL$AL S TAC K B-24 set . D e s c r i pt i o n o f Da t a Num b e r o f I /0 c h a nn e l s Ma x i m um cha n n e l i nd ex Po i n t e r to RM S p r o c e s s I /0 s egm e n t Po i n t e r t o RM S i m ag e I /O s egmen t Ma x i m um e x t e n t ( l ow ad d r e s s l i m i t ) o f ke rnel s ta c k I n i t i a l v a l ue o f k e r n e l s t a c k po i n t e r I n i t i a l v a l ue o f e x ec u t i v e s t a c k po i n t e r I n i t i a l v a l ue o f s up e r v i s o r s t a c k po i n t e r I n i t i a l v a l ue o f us e r s t a c k po i n t e r L i s th e ad ( fo r wa rd l i n k ) fo r p r o c e s s l og i c a l name t a b l e Ba c kwa rd l i n k f o r p r o c e s s l og i c a l n a m e ta b l e Ad d r e s s o f chang e -mod e- to s upe r v i s o r h a nd l e r Ad d r e s s o f chang e -mod e - to-us e r h a nd l e r Ad d r e s s o f compa t i b i l i t y mod e h a nd l e r Ad d r e s s e s o f p r i m a r y a nd s e c o nd a r y e x c e p t i o n h a nd l e r s f o r e a c h o f t h e f o u r a c c e s s mod e s Te r m i n a t i o n h a nd l e r l i s th e ad s f o r e x e c ut i v e , s upe r v i so r , a nd us e r a c c e s s mod e s EXECUT I VE DATA AREAS G l o b a l Symbo l Mo d u l e S i ze C T L $ G Q_C OMMON P l Po i n t e r Pag e quad wo rd C T L $ G L G E TMSG Pl Po i n t e r Pag e l o ng wo rd C T L $AL S TACKS I Z P l Po i n t e r Pag e 4 l o ngwo r d s C T L $ G L C T LBASVA P l Po i n t e r Pa g e l o ng wo r d C T L $ G L I MG HDRBF P l Po i n t e r Pag e l o ng wo r d C T L $ G L RUNDNFLG P l Po i n t e r Pa g e l o ng wo rd RND $V IAC LOCK Desc r i pt i o n o f Da t a D e s c r i p to r ( s i z e a nd add r e s s ) o f pe r - p r o c e s s c ommo n a rea Ad d r e s s o f pe r - p r o c e s s m e s s ag e d i spa t ch e r S i ze o f s tac k fo r e ach a c c e s s mod e Lo w a d d r e s s e nd o f pe r m a n e n t pa r t o f P l sp a c e Ad d r e s s o f i ma g e a c t i v a to r ' s imag e h e ad e r b u f f e r Imag e r und own c o n t r o l f l ag bit Imag e a c t i v a to r l o c k mus t be r e s e t Ad d r e s s o f P l wi ndow th a t d o u� l e maps the p r o c e s s h e ad e r pag e s th a t a r e n o t pag e t a b l e pag e s L i s th e a d fo r t h e p r o c e s s a l l o c a t i o n r eg i o n L i s th e a d fo r the p r o c e s s p r i v a t e mo unted vo l um e l i st Ex i t s t a t u s o f l a t e s t imag e t o execute Pe a k v i r t ua l s i z e f o r process Pe a k wo r k i ng s e t s i z e f o r p r oc es s C o unt o f mo un ted vo l um e s Us e r name f o r p r o c e s s ( b l a n k - f i l l ed ASC I I s t r i ng ) Ac c o un t n ame fo r p r o c e s s ( b l a n k - f i l l e d ASC I I s t r i ng ) Pe r m a n e n t p r o c e s s p r i v i l eg e m a s k Ad d r e s s o f pe r - p r o c e s s c h a ng e -mo d e - to - k e r n e l d i spatche r Ad d r e s s o f p e r - p r o c e s s ch ang e-mo d e - to e x e c u t i v e d i spa tc h e r Ad d r e s s o f powe r r e c o v e r y AST f o r p r o c e s s Ac c e s s m o d e fo r po we r r e cove r y AST Spa r e f o r a l i g nm e n t C T L $ G L PHD Pl Po i n t e r Pa g e l o ng wo rd C T L $ G Q_A LLOCREG P l Po i n t e r Pag e quad wo r d C T L $ G Q_MOUNT LST P l Po i n t e r P a g e q u a d wo rd C T L $G L F I NALS TS P l Po i n t e r Pa g e l o ng wo r d C T L $G L V I RTPEAK P l Po i n t e r Pag e l o ng wo rd C T L $G L WS PEAK P l Po i n t e r Pag e l o ng wo rd C T L $G L VO LUM E S C T L $ T US ERNAM E P l Po i n t e r Pag e P l Po i n t e r Pag e l o ng wo r d 1 2 byt e s C T L $ T ACCOUNT P l Po i n t e r Pag e 8 byt e s C T L $ G Q_PROC PR I V P l Po i n t e r Pag e quad wo r d C T L $G L U S RC HMK P l Po i n t e r Pag e l o ng wo r d C T L $G L U S RC HM E P l Po i n t e r Pag e l o ng wo r d C T L $G L POWERAS T P l Po i n t e r Pag e l o ng wo rd C T L $G B PWRMODE P l Po i n t e r Pag e byte 3 by t e s B-2 5 EXECUTIVE DATA AREAS G l o b a l Symbo l Mod u l e S i ze C T L $ G Q _L OG I N P l Po i n t e r Pag e q uad wo rd C T L $ A L F I NA L E XC P l Po i n t e r Pag e 4 l o ngwo r d s C T L$G L_C C 8 8AS E P l Po i n t e r Pa g e l o ng wo rd C T L $ G Q_D8GAREA P l Po i n t e r Pag e q uad wo r d CTL$G L RM S8ASE P l Po i n t e r Pag e l o ng wo rd C T L $G L_P PM SG P l Po i n t e r Pag e l o ng wo r d C T L $ G 8 MSGMASK P l Po i n t e r Pag e byte C T L $ G 8_D E F LANG P l Po i n t e r Pag e byte 2 byt e s 8.3.2 De sc r i pt i o n o f Da t a Sys t em t i me at p r o c e s s c reat ion Ad d r e s s o f l a s t c h a n c e e x c ep t i o n h a nd l e r s fo r each o f the four a c c e s s mod e s Ad d r e s s of b a s e o f I /0 c h a nn e l a r e a Desc r i pto r { s i z e a nd add r e s s ) f o r d eb ug s ymbo l t a b l e Po i n t e r to b a s e o f RM S image Ad d r e s s o f p r o c e s s-pe rma n e n t m e s s a g e s ec t i o n De f a ul t m e s s ag e d i s p l a y f l ag s De f a ul t m e s s ag e l a ng uag e Spa r e fo r a l i g nm e n t Oth e r P l S p a c e Da t a A r e a s Th e l a yo u t o f P l s pa c e is p i c t u r ed i n Ch a pt e r 1 a nd d e ta i l ed in Ta b l e E - 4 l i s t s the g l o b a l l a b e l s tha t d e l im i t e ac h a r e a App e nd i x E . i n P l s pa c e . Th e r em a i nd e r o f th i s a ppe nd i x s umma r i z e s d a t a l o c a t i o n s in s p e c i f i c P l a r e a s tha t a r e d e f i n ed i n modul e SHE L L . Th e a r e a s a r e p r e s e n t ed i n o r d e r o f d e c r e a s i ng P l v i r t ua l add r e s s e s . Th a t is , the CLI d a t a pag e s a r e p r e s e n t ed f i r s t a nd o c c upy the h i g h e s t P l a d d r e s s r a ng e . Th e p r o c e s s I /0 s e gme n t o c c up i e s t h e l o we s t P l address r a ng e o f t h e a r e a s p r e s e n ted he r e a nd i s l i s t e d l a s t . 8 . 3 . 2 . 1 Da ta Pag e s fo r Command Language I n t e r p r e t e r - Mo d u l e s e ts a s i d e a n a r e a fo r the g e ne r i c C L I d a t a pag e s . G l o b a l Symbo l Da t a A r e a C T L $AL_C L I CALBK Gene r i c CLI Da t a Pag e s Gene r ic CLI Da t a Pa g e s Gene r i c CLI Da t a Pag e s C T L $AG C L IMAG E C T L $ AG_C L I DATA S i ze SHELL De s c r i p t i o n o f Da t a 2 l o ng wo r d s C a l l b a c k v e c to r fo r C L I 2 l o ng wo r d s V i r t ua l ad d r e s s r a ng e i n to wh i c h C L I i s m a pped Re s t o f C L I d a t a a r e a B- 2 6 EXEC UT IVE DATA AREAS 8.3. 2. 2 Process Al locat i o n Reg i o n - Th e p r o c e s s a l l o c a t i o n a r e a i s a p e r - p r o c e s s po o l a r e a c o n s t r uc t ed e x a c t l y l i ke pag ed a nd nonpa g ed d yn am i c m em o r y . I t i n i t i a l l y r e q u i r e s t wo l o ngwo rd s . On e l o ng wo r d d e sc r i b e s the i n i t i a l s i ze o f t h e b l o c k . Th e o th e r c o n t a i n s a z e r o , i nd i c a t i ng t h a t th e r e a r � n o o th e r u n u s e d b l o c k s i n the po o l . G l o b a l S ymbo l Da t a Ar e a P r o c e s s Al l o c a t i o n Reg i o n P r o c e s s Al l o c a t i o n Reg i o n Si ze l o ng wo r d l ong wo r d De s c r i p t i o n o f Da t a I n i t i a l fo r wa rd l i n k ( co n t a i n s z e r o ) I n i t i a l s i z e o f r eg i o n 8.3. 2. 3 Compa t i b i l i ty Mo d e Co n t ex t Pag e - Ano th e r P l d a ta area that modul e S H E LL d e f i n e s s ymbo l s fo r i s t h e pag e used b y t h e c ompa t i b i l i ty mod e e x c e p t i o n s e r v i c e r o u t i n e . G l o b a l Sym b o l Da t a Ar e a C TL$AL_CMCNTX Compa t i b i l i ty 1 0 l o ng wo r d s Mo d e Co n t e x t Pag e S i ze 7 l o ngwo r d s 1 l o ngwo r d 2 l o ngwo r d s Compa t i b i l i ty r e s t o f pag e Mo d e Co n t e x t Pa g e De sc r i p t i o n o f Da t a G en e r a l r eg i s t e r c o n t e n t s s to r ed by e x c ept i o n s e rv i c e rout i ne Saved RO th r o ug h R6 Saved c ompa t i b i l i t y mod e e x c ept i o n c o d e S a v ed e x c e p t i o n P C a nd PS L Used by c ompa t i b i l i t y mode em u l a to r 8.3. 2. 4 Process I/0 Segment - Th e p r o c e s s I /O s egme n t i s used to h o l d all o f t h e RM S c o n t e x t t h a t e x i s t s fo r t h e l i fe o f t h e p r o c e s s . Th i s i nc l ud e s a l l i n fo rma t i o n a b o u t p r o c e s s p e rma n e n t f i l e s , a s we l l as po i n t e r s i n to the i mag e I /0 s egmen t , t h e RMS c o n tex t a r e a t h a t o n l y e x i s t s wh i l e a n imag e i s a c t i v e . Th e r e i s a s e c o nd a rea i n Sh e l l c a l l ed t h e p r o c e s s I /O s egmen t . Th i s po r t i o n o f P l s pa c e i s n o l ong e r u s ed . B- 2 7 EXECUTIVE DATA AREAS G l o b a l Symbo l Da ta Area P I O $G L_FMLH P r o c e s s I /O Segment P r o c e s s I /O Segment P r o c e s s I /0 S e g me n t P r o c e s s I /O Segment P r o c e s s I /O S e g me n t P r o c e s s I /O Segme n t P r o c e ss I /O S e g me n t P I O $G L I I OF S P L H P I O $GW S TATUS P I O $G T ENDSTR P I O $GW_DFPROT P I O $G B DFMBC P I O $G B_DFMBFSDK S i ze 2 l o ng wo r d s wo r d F r e e m emo r y l i s th e a d f o r p r o c e s s I /O s egme n t F r e e memo r y l i s t h e a d f o r i mag e I /O s egment RM S ov e r a l l s t a tus 16 bytes End of d a ta s t r i ng wo r d De f a u l t f i l e p r o t e c t i o n byt e byte De f a u l t m u l t i b l o c k c o un t ( RM S DFMBC ) De f a u l t-m u l t i b uf f e r c o un t f o r s e q u e n t i a l d i s k I /0 ( RMS D FMBFSDK ) De f a u l t-m u l t i b uf f e r c o un t fo r m ag t a pe I /0 ( RMS DFMBFSMT ) De f a ul t-m ul t i bu f f e r c o un t fo r un i t r eco r d d e v i c e s ( RMS D FMBFS UR ) De f a ul t-m u l t i b uf f e r c o un t fo r r e l a t i ve f i l e s ( RMS D FMB FRE L ) De f a ul t-m ul t i b u f f e r c o un t fo r i nd ex ed f i l e s ( RM S DFMB F I D X ) De f a ul t-m u l t i b uf f e r c o un t h a shed ( RMS DFMBFHS H ) Spa r e fo r a l i g nm e n t 8 4 byt e s De f a u l t d i r e c to r y s t r i ng 2 l o ngwo r d s D i r e c to r y c a c h e l i s th e a d l o ng wo r d F r e e l i s t f o r d i r e c to r y c a c h e nod e s ( s i ng l y l i nked ) P r o c e s s I /O Segmen t contex t a r ea Imag e I /O Segme n t contex t a r ea RM S t e rm i n a t i o n h a nd l e r con t r o l block F r e e a r e a th a t f i l l s r e s t o f pag e 2 l o ngwo r d s byte P I O $ G B DFMB FSMT P r o c e s s I /O S e g me n t byt e P I O $ G B DFMBFSUR P r o c e s s I/O Segment byte P I O $ G B DFMBFRE L P r o c e s s I /O S e g me n t byte P I O $ G B D FMBF I DX P r o c e s s I /O Seg m e n t byte P I O $GB_DFMBFHS H P r o c e s s I /O S e g me n t P r o c e s s I /O Segment P r o c e s s I /O Segment P r o c e ss I /0 Segment P r o c e s s I /O Segme n t byte P I O$GT DDSTR I NG P I O$G L D I RCAC H E P I O $G L D I RCFRHL P I O $GW_P I O IMPA P I O $GW_I I O IM PA P I O $AL RMS EXH P r o c e s s I /0 Segment P r o c e s s I /O S e g me n t P r o c e s s I /O S e g me n t P r o c e s s I /O S e g me n t Desc r i pt i o n o f Da t a 3 5 l o ngwo r d s 4 1 l o ngwo r d s 4 l o ngwo r d s 1 3 l o ngwo r d s B- 2 8 APPENDI X C NAM I NG C ONVE N T I ONS Th e c o nve n t i o n s d e sc r i b ed i n th i s a ppe nd i x we r e i mp l emento r s i n p r od uc i ng m e a n i ng f u l p ub l i c nam e s . a l l names tha t a r e g l o b a l { k nown to the l inke r ) or pa r am e t e r o r m a c r o d e f i n i t i o n f i l e s . d e r i v ed to a id Pub l i c n a m e s a r e th a t a pp e a r in Th e s e pub l i c n am e s a r e a l l c o n s t r a i n ed to f o l l o w t h e s e r u l e s f o l l o w i ng r e a s o n s . • • • • fo r the Us i ng r e s e rved n am e s i n s u r e s tha t c us tom e r -wr i t ten so f t wa r e wi l l no t b e i nv a l i d a t ed b y s ub s e q ue n t r e l e a s e s o f D I G I TA L p r o d u c t s tha t a d d n ew s ym b o l s . Us i ng d e f i n i t e pa t t e r n s f o r d i f f e r e n t u s e s a l l o ws the r e ad e r to j ud g e the type o f o b j e c t tha t i s b e i ng r e f e r e n c ed . Fo r e x am p l e , t h e f o rm o f a m a c ro n am e i s d i f f e r e n t f r om tha t o f a n o f f s e t , wh i c h i s d i f f e r e n t f r om that o f a s t a t u s c o d e . Us i ng c e r t a i n c o d e s wi th i n a p a t t e r n a s s o c i a t e s the s i ze of a n o b j e c t w i th i t s name . Th i s i n c r e a s e s the l i ke l i ho o d tha t r e f e r e n c e to th i s o b j e c t w i l l u s e the c o r r e c t i n s t r u c t i o n s . Us i ng a f a c i l i t y c o d e i n s ym b o l d e f i n i t i o n s g i v e s the reader an i n d i c a t i o n o f wh e r e the s ym b o l i s d e f i ned . S e pa r a t e g r o ups o f i mp l emen to r s a r e a l l o we d t o c h o o s e f a c i l i t y c o d e n am e s th a t w i l l n o t c o n f l i c t w i th o n e a no th e r . To f u l l y c o n f o rm wi th t h e s e s ta nd a rd s , l o c a l syn o n ym s sho u l d n e v e r be d e f i n ed fo r p ub l i c s ym bo l s . Th e f u l l p ub l i c sym bo l sho u l d b e u s e d i n ev e r y r e fe r e n c e t o g i ve m a x i m um c l a r i t y t o the r e ad e r . �� S YMBOL PATTERNS A l l D I G I TAL s ymbo l s c o n t a i n a c u r r e n c y s i g n . Th u s , c u s tom e r s a nd a pp l i c a t i o n s d ev e l o pe r s a r e s t r o ng l y a d v i sed to use u nd e r sc o r e s i n s t e a d o f c u r r en c y s i g n s to avo i d f u t u r e c o n f l i c t s . Pub l i c symbo l s sho u l d be c o n s t r uc t ed to c o nvey a s m uch i n f o rm a t i o n a s po s s i b l e a b o u t the ent i t i es t h e y n am e . F r e qu e n t l y , pr i v a t e n a m e s fo l l o w a s i m i l a r c o nv e n t i o n . Th e p r i v a t e n am e c o nvent i o n i s t h e n the same a s the p ub l i c one w i th t h e und e r s c o r e r e p l ac i ng t h e c u r r e n c y s i g n i n s ymbo l nam e s . Pr i v a t e n a m e s a r e u s ed bo th wi th i n a mod u l e , a nd g l o b a l l y b e twe e n m od u l e s o f a f a c i l i t y t h a t i s n ev e r i n a l i b r a r y . A l l nam e s th a t m i g h t eve r b e b o und i n to a u s e r ' s p r og r am mus t f o l l o w the r ul es f o r p ub l i c n am e s . In the c a s e o f i n t e r n a l nam e s , a d o ub l e C-1 NAM ING CONVENTI ONS c u r r e n c y s i g n c onv e n t i o n c a n fo l l o w i ng l i s t . 1. be u s ed as s h o wn in i tem 5 in the Sys tem s e r v i c e m a c r o n am e s a r e o f the f o rm : $ s e r v i c e -name A t r a i l i ng S o r G d i s t i ng u i sh e s the s t a c k f o rm f r om th e s e pa r a t e a rg um e nt l i s t fo rm . De t a i l s a b o ut the nam e s o f s y s tem s e r v i c e m a c r o s c a n b e f o und i n the VAX/VMS Sys tem S e r v i c e s Re f e r en c e Ma n ua l . Th e s e n am e s a ppe a r in the s y s tem mac ro l ibrary SYS $ L I B RARY : S TARL E T . MLB a nd r e p r e s e n t a c a l l t o one o f t h e VAX/VM S s y s t em s e r v i c e s o r RM S s e r v i c e s . Ex ampl e s o f th i s f o rm o f s ym bo l n am e a r e : $AS C E FC S $ C LO S E $ TRN LOG G 2. As so c i a t e Common E v e n t F l ag C l us t e r C lose a Fi l e T r a n s l a t e Log i c a l Name Fa c i l i t y- s p e c i f i c publ i c m a c ro n a m e s a r e o f t h e fo rm : $ f a c i l i t y_m a c r o n ame Th e e x e c u t i v e d o e s n o t u s e any s ymbo l n am e s of th i s fo rm . 3. Sys t em m a c r o s us i ng l o c a l s ymbo l s o r m a c r o s a l wa ys use o f the f o rm : n am e s $ f a c i l i t y $m a c r o n ame Th i s i s t h e fo rm to be used bo th f o r s ymbo l s g en e r a ted by a macro and i n c l ud ed i n c a l l s to i t , a nd f o r i n t e r n a l m a c r o s th a t a r e n o t d o c umen t ed . Th e e x e c u t i v e d o e s n o t use a ny s ym bo l names o f th i s fo rm . 4. S t a t us c o d e s a nd c o nd i t i o n v a l ue s a r e o f the fo rm : f a c i l i t y $_s t a t u s Ex ampl e s o f th i s f o rm o f s ymbo l name a r e : RM S $ FNF S S $ IL L E FC S S $ -WAS C LR 5. F i l e No t Fo und I l l eg a l Ev e n t Fl ag Cl us t e r F l ag Wa s P r ev i o us l y C l e a r G l oba l e n t r y po i n t n am e s a r e o f the f o rm : f a c i l i t y $ e n t r y-name Ex ampl e s o f th i s fo rm of s ym bo l n ame a r e : EXE $ALOPAG E D I OC $WF I KPCH MMG $ PAG E FAULT A l l o c a t e Pag e d Dyn am i c Memo r y Wa i t fo r I n t e r r upt and K e e p Ch a nne l Pag e F a u l t E x c ept i o n H a nd l e r G l o ba l e n t r y po i n t nam e s tha t a r e i n t e nd ed for use onl y w i th i n a set o f r e l a t ed p r o c ed u r e s b u t no t by a n y c a l l i ng p r og r ams o u t s i d e t h e s e t a r e o f the fo rm : C-2 NAM ING CONVENTIONS f a c i l i t y $ $ e n t r y-name Th e e x e c u t i v e d o e s not use s ym bo l names o f th i s f o rm . Ho we v e r , the Run - T i m e L i b r a r y c o n t a i n s s ev e r a l ex ampl e s o f s ymbo l nam e s th a t f o l l o w th i s c o nv e n t i o n , s uc h a s : BAS $ $N UM ! N I T FOR $ $ S I GNAL S TO O TS $ $G E T LUN 6. I n i t i a l i z e the BAS I C NUM f unc t i o n S i gnal a FORTRAN e r r o r a nd cal l L I B $ S TO P G e t Log i c a l Un i t Numbe r G l o b a l e n t r y po i n t nam e s th a t h av e e n t r y po i n t nam e s ) a r e o f the fo rm : no n s t a nd a rd calls (JSB f a c i l i t y $ e n t r y-name_Rn wh e r e Rn i nd i c a t e s t h a t RO t h r o ug h Rn a r e n o t p r e s e r v e d by the r ou t i n e . No te tha t the c a l l e r o f s uc h an e n t r y po i n t m u s t i n c l ud e a t l e a s t r eg i s t e r s R 2 th r o ug h R n in i ts own e n t r y ma s k so tha t a s t a c k unwi nd wi l l r e s t o r e a l l r eg i s te r s p r ope r l y . The e x e c u t i v e d o e s no t use th i s c o nv en t i o n f o r i t s J S B e n t r y po i n ts b u t t h e Run - T i m e L i b r a r y c o nta i n s seve r a l e x am p l e s o f i t s u s e , s uc h a s : C O B $ CVTFP R 9 MTH$ S I N R4 S TR $ C O PY DX R 8 7. C o nve r t F l o a t i ng to Pa c k ed S i ng l e P r e c i s i o n S i n e Func t i o n J S B e n t r y to g e ne r a l s t r i ng c o py i ng r o ut i ne G l o b a l v a r i a b l e n a m e s a r e o f the fo rm : f a c i l i ty$G t_v a r i a b l e-name Th e l e t t e r G i nd i c a t e s a g lobal va r i a b l e . Th e l e t te r r e pr e s e n t s the t yp e o f va r i a b l e a s d e f i n ed i n Se c t i o n C . 2 t Ex amp l e s o f th i s f o rm o f sym bo l n ame a r e : C T L $ G Q PROC PR I V EXE $G L-NONPAG ED S C H$G L-C UR PC B 8. P r o c e s s P r i v i l eg e Ma s k F i r s t F r e e Bl o c k i n No npag ed Po o l Ad d r e s s o f PC B o f C u r r e n t P r o c e s s Ad d r e s s a b l e g l o b a l a r r ays u s e t h e l e t t e r A l e t t e r G ) and a r e of t h e f o rm : ( i nstead of the f a c i l i t y $At_a r r a y- n ame Th e l e t t e r A i nd i c a te s a g l o b a l a r ray. Th e l etter t i nd i c a t e s t h e t yp e o f a r r a y e l em e n t a s d e f i n e d i n Se c t i o n C . 2 Ex ampl e s o f th i s f o rm o f s ym bo l n am e a r e : C T L$AQ_E XCVE C L OG $A L LOG T B L PFN$AW F L I NK A r r ay o f Pr i ma r y a nd S e c o nd a r y E x c e p t i o n Ve c to r s A r r ay of Log 'i c a l Name Ta b l e L i s th e a d s A r r ay o f Fo r wa r d Li nks fo r PFN Li sts C-3 NAM I NG C ONVENT I ONS 9. I n the a s s emb l e r , p ub l i c s t r uc t u r e o f fs e t n am e s f o rm : a re of the s t r uc t u r e $ t f i e l d - n ame Th e l e t t e r t i nd i c a t e s t h e d a ta type of the f i e l d a s d e f i n e d in Sec t i o n C . 2 . Th e v a l ue o f t h e p ub l i c sym bo l i s the b y t e o f f s e t to t h e s t a r t o f t h e d a ta e l em e n t i n t h e s t r uc t ur e . Ex ampl e s o f th i s fo rm o f sym bo l n am e a r e : C E B $ L E FC GS D$W G S TX PC B $ B PR I 10. E v e n t Fl ag C l us t e r ( i n Common E v e n t Block) I nd e x G l obal Sec t i on Tab l e ( in G l o b a l S e c t i o n De s c r i pto r ) Pr i o r i ty Cur r en t ( in Process So f twa r e PC B ) I n the a s s em b l e r , p ub l i c s t r uc t u r e s i ng l e b i t nam e s a r e o f t h e fo rm : bit f i el d o f f s e ts a nd s t r uc t u r e $ V f i e l d -n ame Th e va l u e of the p ub l i c s ymbo l i s the b i t o f f s e t f r om th e s t a r t o f t h e f i e l d t h a t c o n t a i n s the d a t um ( a nd no t f r om the s t a r t of t h e c o n t r o l b l o c k ) • Ex ampl e s o f th i s f o rm o f symbo l name a r e : AC B $V Q UOTA PS L$V-C URMOD UCB $V-CANC E L 11. Ch a rg e A S T to P r o c e s s AST Quo t a C u r r e n t Ac c e s s Mo d e C a n c e l I /0 o n th i s u n i t I n the a s s emb l e r , p ub l i c s t r uc t u r e b i t f i e l d s i z e o f the fo rm : names are s t r uc t u r e $ S f i e l d - n ame Th e va l ue of the pub l i c s ymbo l i s the n umb e r o f b i t s f i eld . in the Ex ampl e s o f th i s fo r m o f s ymbo l name a r e : AC B $ S MODE PS L $ S -C URMOD PTE $ S -PROT 12. Ac c e s s Mo d e of Re q u e s to r ( 2 b i t s ) C u r r e n t Ac c e s s Mo d e ( 2 b i t s ) M emo r y P r o te c t i o n o n Pag e ( 4 b i t s ) Fo r B L I S S , t h e f unc t i o n s o f the symbo l s i n the p r ev i o u s th r e e i t ems are c omb i n ed i n to a s i ng l e name u s ed t o r e f e r e n c e a n a r b i t r a r y d a t um . Names a r e o f t h e fo rm : s t r uc t u r e $ x_f i e l d - n am e wh e r e x i s t h e s am e a s t fo r s t a nd a rd s i z e d d a t a (B, w, L, a nd Q ) a n d x s t and s f o r V f o r a r b i t r a r y a nd b i t f i e l d s . Th e m a c ro i n c l ud e s t h e o f f s e t , po s i t i o n , s i z e , a nd s i g n ex t e n s i o n C-4 NAMING C ONVENTI ONS s u i t a b l e f o r use i n a R E F B LOC K s t r uc t ur e . t h i s n a m e i s d e f i na b l e a s MAC RO s t r uc t u r e $ V f i e l d - n ame s t r uc tur e $ t f i e l d-nam e , s t r uc t u r e $ V- f i e l d - n am e , s t r uc t u r e $ S-f i e l d - n am e , < s i g n e x t e ns i o n > % ; Mo s t t yp i c a l l y , = 13. ! a s s em b l e r m e a n i ng Pub l i c s t r uc t u r e m a s k n am e s a r e o f the fo r m : s t r uc t u r e $ M f i e l d -name Th e va l u e of t h e pub l i c s ymbo l is a mask w i th b i ts set fo r e a ch b i t in the f i el d . Th i s m a s k i s n o t r i g h t j us t i f i ed . Ra the r , i t h a s s t r uc t u r e $V_f i e l d - n ame ze r o b i t s o n the r i g h t . Ex ampl e s o f th i s fo r m o f s ym bo l name a r e : C EB $M VA L I D PS L $ M-C URMOD PTE $M-PROT 14. Sh a r ed memo r y m a s t e r CEB i s v a l i d C u r r en t Ac c e s s Mo d e Memo r y P r o tec t i o n o n Pag e Pub l i c s t r uc t u r e c o n s t a n t n am e s a r e o f t h e f o r m : s t r uc t u r e $ K c o n s t a n t - n am e E x ampl e s o f th i s fo r m o f s ym bo l n a m e a r e : PC B $ K L ENG TH S RM $ K-FLT OVF F S T S $ K-S EVERE - Leng th ( i n by t e s ) o f So f t wa r e PCB Cod e fo r F l o a t i ng Ov e r f l ow Fa u l t F a t a l E r r o r Cod e Fo r h i s to r i c a l r e a s o n s , m a ny o f the cons t a n t s u s e d b y the e x e c u t i v e h a ve the l e t t e r C i n s te ad of a K t o i nd i c a t e tha t t h e o b j e c t d a t a type i s a c o n s t a n t . E x amp l e s o f th i s fo rm o f s ymbo l n am e a r e : DYN $ C PCB E XE $ C-CMSTKS Z PT E $ C URKW S t r uc t u r e Type i s S o f twa r e PCB S i z e of S t a c k S pa c e Ad d e d b y Ch a ng e Mo d e H a nd l e r P r o t e c t i o n Cod e o f Use r Read , Ke r n e l Wr i t e C-5 NAM ING C ONVENTIONS 15. . PS ECT n a m e s a r e o f t h e fo rm : f a c i l i t y $mnemo n i c a nd wh e n put i n to a l i b r a r y f a c i l i t y $mnem o n i c E x ampl e s o f s ymbo l s o f the f i r s t k i nd a r e : C O PY $ C O PY F I L E F i l e c o py i ng m a i n r o u t i n e p r og r am s ec t i on sec t i on sec t i o n th a t P r og r am c o n ta i ns most code fo r the DC L c ommand i n t e r p r e te r P r og r am s e c t i o n c o n t a i n i ng the Job Co n t r o l l e r ' s m e s sag e o u tput r o u t i ne DC L $ Z C ODE J B C $MSGOUT Th i s c o nv e n t i o n i s n o t a d h e r ed to a s s t r i c t l y a s t h e o the r n am i ng c o nv e n t i o n s b e c a us e . PS EC T n am e s c o n t r o l the wa y t h a t t h e l i n k e r a l l o c a t e s v i r t ua l a d d r e s s spac e . Nam e s wi l l o f ten b e cho s e n to a f f e c t t h e r e l a t i v e l o c a t i o n s of r o u t i n e s a nd t h e d a t a th a t they r e f e r e n c e . Some s am p l e . PS EC T n am e s f r om the e x ampl e s o f t h e s e c ond c o nve n t i o n . L I B $ C ODE Run - T i m e Li b r a r y show General Library ( Re ad-On l y ) Code Sec t i on Da t a S e c t i o n i n Ma them a t i c s L i b r a r y Lang uag e Po r t i o n of Cod e I n d e pe nd e n t Suppo r t L i b r a r y MTH$DATA -O TS $ C ODE Th e e x e c u t i v e d o e s n o t u s e th i s c o nv e n t i o n wh e n fo r m i ng i ts . PS ECT n am e s . Ra th e r , i t use s n a m e s th a t c a use the d e s i r ed s e c t i o n s to b e pl a c ed i n the c o r r e c t pa r t s o f sys t em spa c e . Fo r e x ampl e , . PS E CT n ame s c o n t r o l tho s e p i ec e s o f the e x e c u t i v e t h a t a r e pag e ab l e . I n a d d i t i o n , . PS E C T names a l l o w d a ta a r e as a nd c o d e t h a t r e f e r en c e s th a t d a t a to b e p l a c ed w i th i n 6 4 k byt e s s o tha t wo rd d i spl a c em e n t a d d r e s s i ng ( r a the r t h a n l o ngwo r d d i s p l a c em e n t ) can be u s e d to r e f e r e nc e the d a ta . Some e x ampl e s o f . PS E C T n ame s tha t a r e u s ed i n the ex ec a r e : $$$220 On e of the f i r s t d a ta p r og r am s e c t i o n s i n the e x e c u t i v e No npag ed Ex ec u t i v e Co d e Pag e a b l e Ex e c u t i v e Ro ut i ne s $AE XENONPAG ED Y E XE PAG E D 16. Mo d u l e n am e s a r e o f t h e fo rm : f a c i l i ty $mnemo n i c Th e mod u l e is " f a c i l i t ymnemo n i c " fac i l i ty . s to r ed in a C-6 in wi th a file f i l ename to the d i r e c to r y c o r r e s po nd i ng NAM ING CONVENTI ONS Ex ampl e s o f th i s c o nven t i o n a r e : Mo d u l e : Fi l e : Mo d u l e : Fi l e : L I B $ S I GNA L [ R T L . S RC ] L I B S IGNAL . MAR MTH $ S INCOS [ RT L . SRC ] MTHS INCOS . MAR Cond i t i o n Gene r a t i o n P r o c ed u r e s a nd S i ne Func t i o n s Co s i n e Th e e x ec u t i v e i nc l ud e s the f a c i l i t y p r e f i x S Y S i n som e o f i t s mod u l e nam e s ( u s ua l l y mo d u l e s tha t i n c l ud e the s ys t em s e rv i c e s ) a n d om i t s i t i n o th e r s . No n e o f the mod u l e s i n the e x e c u t i v e h a s a c u r r en c y s i g n in i t s n ame . Some e x am p l e s o f e x ec u t i v e m o d ul e n am e s a nd a s so c i a t ed f i l e s a r e : Mo d u l e : Fi l e : Mo d u l e : Fi l e : 17 . I O S UBNPAG [ E XE C . S RC ] I O S UBNPAG . MAR S Y S S E T PRV [ E XE C . SRC ] S YS S E TPRV . MAR I /0 No n pag ed Ro u t i n e s Dr i v e r Set Sys c em P r i v i l eg e Service Publ i c s t r uc t u r e d e f i n i t i o n m a c ro names a r e o f the fo rm : $ f a c i l i t y_s t r uc t u r e DEF I nvo k i ng th i s m a c r o s t r uc t u r e $ x x x x x x . d e f i nes all symbo l s of the fo rm Mo s t of t h e pub l i c s t r uc t ur e d e f i n i t i o n s used b y VM S do no t i nc l ud e t h e f a c i l i ty i n the m a c ros tha t d e f i n e s t r uc t � r � o f f s e ts . Ra t h e r , m a c ros o f t h e f o rm : $ s t r uc t u r e D E F a r e used to d e f i n e s t r uc t ur e $ x x x x x x sym bo l s . E x ampl e s o f t h e s e m a c r o s a r e : $ LOG D E F $ PC BDE F $ S S DE F O f f s e t s i n to Log i c a l N a m e B l o c k Of f s e t s i n to So f twa r e Process Co n t r o l B l o c k Sys tem S e rv i c e S t a tus Cod e s C-7 NAM ING C ONVE N T I ONS C.2 OBJ E C T DATA TYPE S Th e fo l l o w i ng a r e the l e t t e r s used f o r the v a r i o us d a t a type s r e s e rved fo r the f o l l o w i ng p u r po s e s : Le t t e r A B c D E F G H I J K L M N 0 p Q R s T u v w X y z or are Da t a Type o r U s a g e Ad d r e s s By t e I n t eg e r S i ng l e Ch a r a c t e r � Do ub l e P r e c i s i o n F l o a t i ng Re s e rved to D I G I TAL S i ng l e P r e c i s i o n F l o a t i ng G e n e r a l Va l ue I n t eg e r Va l ue fo r Co un t e r s Re s e r v e d fo r I n t eg e r E x t e n s i o n s Re s e r v ed to C u s tome r s f o r E s c a pe to Oth e r Co d e s Co n s t a n t Lo ngwo r d I n t eg e r F i e l d Ma s k Nume r i c S t r i ng ( Al l By t e Fo rms ) Re se r v ed to D I G I TAL a s an E s c a pe to O th e r Cod e s Pa c k e d S t r i ng Quadwo r d I n t eg e r Re s e rved fo r Re co r d s ( S t r uc t u r e ) Fi e l d S i ze Te x t ( Ch a r a c t e r ) S t r i ng Sm a l l e s t Un i t o f Ad d r e s s a b l e S t o r ag e F i e l d Po s i t i o n ( VAX- 1 1 MACRO ) ; F i e l d Re f e r e n c e ( B L I S S ) Wo r d I n t eg e r C o n t e x t De pend e n t ( G e n e r i c ) Co n t e x t Depend e n t ( G e n e r i c ) Un spe c i f i ed o r No n s t a n d a rd � I n many of the s ymbo l s used by VAX/VMS , C i s used a s a s ynonym fo r K. Al tho ug h K i s the p r e f e r r ed i nd i c a to r fo r c o n s t a n t s , mo s t c o n s t a n t s used i n VM S a r e i nd i c a t ed by a C i n t h e i r n ame . Some c o n s t a n t s , s uc h a s l e ng ths o f d a t a s t r uc t u r e s , h a ve b o th a C f o rm a nd a K fo r m . N , P , a n d T s t r i ng s a r e t yp i c a l l y v a r i a b l e l e ng t h . I n s t r uc t u r e s o r I /0 r eco rds , t h e y f r e que n t l y c o n t a i n a byte- s i zed d i g i t o r c h a r a c t e r c o un t p r e c ed i ng t h e s t r i ng . I f so , t h e l o c a t i o n o r o f f s e t i s to the c o un t . Co un t ed s t r i ng s c a nno t b e pa s s e d i n p r o c ed u r e c a l l s . I n s t e ad , a s t r i ng d e s c r i pto r m u s t b e g e n e r a t ed . C- 8 NAM ING CONVENT I ONS C.3 FAC I L I TY PREF I X TAB LE Fo l l o w i ng is a l i st o f f a c i l i ty p r e f i x e s f o r D I G I TAL- s uppl i ed so f twa r e . Th i s l i s t wi l l g r o w o v e r t i m e a s n e w f a c i l i ty pr e f i x e s a r e chosen . No o n e sho u l d u s e a n e w c o d e w i tho ut r eg i s t e r i ng it in a c ommo n pl a c e . No t e tha t b i t < 2 7 > , the c u s tome r f a c i l i t y b i t , i s c l e a r i n a l l o f the f a c i l i ty c o d e s l i s ted here . Cu s tome r s a r e f r e e to use a n y o f the f a c i l i ty codes l i s ted h e r e , p r ov i d ed th a t th e y set b i t < 2 7 > . Th e d e f a u l t a c t i o n o f the me s s ag e c omp i l e r i s to s e t th i s b i t . Th e l o c a t i o n o f t h e f a c i l i t y c o d e w i th i n a s t a tus c o d e , as we l l a s the me a n i ng of the o th e r f i elds in the s t a t us c o d e , is d e sc r i b ed i n Ch a p t e r 8 o f t h e VAX- 1 1 U t i l i t i e s Re f e r e n c e Ma n ua l . P re f i x Condi t ion F ac i l i ty D e s c r iption < 27 : 16> Nuc l eu s and Sys tem Proce s s e s S YS T EM RM S D E B UG CLI JBC O PC OM RSX ERF TRACE Sys tem S e rv i c e S t a t u s Cod e s RMS I n t e r n a l s a nd S t a t u s Co d e s S ymbo l i c De b ug g e r Comma nd La ng uag e I n t e r p r e t e r s Jo b Co n t r o l l e r Ope r a to r Commun i c a t i o n RSX- l l M Ap pl i c a t i o n M i g r a t i o n Ex e c u t i v e E r r o r Logg e r Fo rma t P r o c e s s T r a c e b a c k Fac i l i ty 0 1 2 3 4 5 6 8 9 Run - T i m e L i b r a r y Compo n e n t s BLI LIB MTH OTS FOR C OB BAS B32 S ORT C74 PLI XPO PAS C OR S TR LBR FDV SCR B L I S S T r a n s po r t a b l e Run - T i m e L i b r a r y G e n e r a l Pu r po s e L i b r a r y ; G l o b a l S e c t i o n s Ma thema t i c s L i b r a r y Lang u a g e I n d e pe nd e n t Obj ec t T i m e Sys t em VAX- 1 1 FORTRAN Run-T i m e L i b r a r y VAX- 1 1 C O B O L Ru n - T i m e L i b r a r y VAX- 1 1 BAS I C Run-T i m e L i b r a r y B L I S S - 3 2 S p e c i f i c Run - T im e L i b r a r y VAX- 1 1 S ORT C OBOL- 7 4 S p e c i f i c Run - T i m e L i b r a r y P L / I Run - T i m e L i b r a r y T r a n s po r t a b i l i t y Su ppo r t L i b r a r y VAX- 1 1 PAS CAL Run - T i m e L i b r a r y C ORA L - 6 6 Run-T i m e L i b r a r y S t r i ng Ma n i pul a t i o n P r o c ed u r e s L i b r a r i a n Su b r o u t i n e Pa c k a g e FMS - 3 2 Fo rms D r i v e r L i b r a r y S c r e e n Fo rma t t i ng Pa c ka g e C-9 20 21 22 23 24 25 26 27 28 29 30 32 33 34 36 38 41 44 NAM ING C ONVENTI ONS Pr e f i x F a c i l i ty De sc r i pt i o n Cond i t i o n <27: 16> U t i l i t i e s and Compi l e r s L I NK CREF DS U P C O PY B TRAN S Y S M SG F ORT C OB 7 4 DIFF PAT C H PAX B LS 3 2 APPEND MOUNT D I SM UETP !NIT HELP SET S H OW D I RE C T AUT HOR INS SYSGEN MAC RO MA I L DSM PAS CAL C ORAL COBOL S UM E DT L I B RAR P L IG BAS I C FED FUT C OB 7 4 T RENAM E C R EATE UN LOC K DE LETE P URG E TYPE R UNOFF M E S SAG E C LE D I T VAX- 1 1 L i n k e r C r o s s Re f e r e nc e Fa c i l i t y D i ag n o s t i c S u p e r v i so r C O PY Ut i l i t y AME Ba c k T r a n s l a to r Sys tem Me s s ag e Ma ke r VAX- 1 1 FORTRAN Comp i l e r VAX- 1 1 COB O L - 7 4 Comp i l e r F i l e Di f f e r e nc e s Ut i l i t y VAX- 1 1 Imag e F i l e Pa t c h Ut i l i t y VAX- 1 1 Ob j e c t Mo d u l e Pa tch Ut i l i t y VAX- 1 1 B L I S S - 3 2 Comp i l e r A P PE ND Ut i l i t y Vo l um e Mo u n t Vo l um e D i smo un t Us e r Env i r o nm e n t Te s t Pa c k ag e Vo l ume I n i t i a l i z a t i o n H e l p Fa c i l i t y S ET Ut i l i t y S HOW Ut i l i t y D I R EC TORY U t i l i t y Us e r Autho r i z a t i o n Ma n ag e r I NS TALL U t i l i t y Sys tem G e n e r a t i o n a nd Dr i v e r Lo a d e r Ut i l i t y VAX- 1 1 MAC RO As s emb l e r VA X/VM S MA I L U t i l i t y D I G I TAL S t and a rd MUMPS VAX- 1 1 PAS CAL Com p i l e r C ORAL - 6 6 Comp i l e r C OBO L- 7 9 Comp i l e r So u r c e Upd a t e M e r g e U t i l i t y DEC S t a nd a r d Ed i t o r VAX- 1 1 L i b r a r i a n VAX- 1 1 P L/ I Le v e l -G Com p i l e r VAX- 1 1 BAS IC Com p i l e r Fo rms Ed i t o r Fo rms Ut i l i t y C OBOL - 7 4 to VAX C OB O L T r a n s l a to r RENAME Ut i l i ty C REAT E Ut i l i t y UN LOC K U t i l i ty DE LETE Ut i l i ty PURG E Ut i l i ty TYPE Ut i l i t y DEC S t a nd a rd RUNOFF Sys tem Me s s ag e Comp i l e r C L I Da t a Ba s e Ed i to r C- 1 0 100 101 102 103 1 04 105 106 107 108 109 110 111 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 132 133 1 34 135 137 139 140 143 144 145 146 147 148 149 150 1 51 155 NAM I NG C ONVE N T I ONS Fa c i l i ty D e s c r i p t i o n Prefix Co nd i t i o n <27 : 16> Ne two r k S u ppo r t U t i l i t i e s NET DAP FAL NCP NIC DLE B SC P T P H LD REM DECn e t AC P a nd N S P Pr o to c o l ; DTS/DTR D E Cn e t DAP P r o c e d u r e s a nd P r o to c o l DEC n e t F i l e Ac c e s s L i s t e n e r a nd P r o to c o l D E Cn e t Ne two r k Co n t r o l P r o g r am a nd P r o to c o l D E Cn e t N I C E P r og r am a n d P r o t o c o l D E Cn e t D i r e c t L i n e Ex ec u t i v e 2 7 8 0 / 3 7 8 0 B I SYNC Po i n t to Po i n t Em u l a to r D E Cn e t Ho s t Lo a d Pr o to c o l DECn e t Rem o t e Te r m i n a l ACP a nd P r o t o c o l 501 502 503 504 505 506 507 508 510 Te s t Fa c i l i t i e s SYSTST RMS TS T S y s tem Te s t s RM S Te s t s 1000 1001 I nd i v i d ua l p r o d uc t s s uc h a s c omp i l e r s a l s o g e t un i q ue f ac i l i ty c od e s fo rmed f r om t h e p r o d uc t n ame . Th ey m u s t b e s i g n ed o u t i n the a b o v e l i st . Fa c i l i t y p r e f i x e s sho u l d b e cho s e n t o avo i d con f l i c t w i th file type s . S t r uc t u r e name p r e f i x e s a r e typi c a l l y l o c a l to a f a c i l i t y . Re f e r to the i nd i v i d ua l f a c i l i t y d o c um e n t a t i o n f o r i t s s t r uc t u r e n ame p r e f i x e s . a nd Th i s d o e s no t c a u s e p r o b l em s b e c a u s e t h e s e n a m e s a r e no t g l o b a l , are th e r e f o r e n o t k n o wn to the l i n k e r . Th ey b e come known a t a s s e m b l y o r c omp i l e t i m e o n l y b y e x p l i c i t l y i nvo k i ng t h e m a c r o d e f i n i ng the f a c i l i ty s t r uc t u r e . codes tha t Fo r e x ampl e , t h e m a c r o $ F ORDE F d e f i n e s a l l o f the s tat us Th e f a c i l i t y c a n b e r e t u r n e d f r om the VAX- 1 1 F ORTRAN s u ppo r t l i b r a r y . the status c o d e o f 2 4 i s i nc l ud ed i n t h e uppe r 1 6 b i t s o f e a c h o f c o d e s d e f i n ed wi th th i s m a c r o . NOTE D I G I TAL d o e s no t p r ov i d e a r eg i s t r a t i o n s e r v i c e f o r t h e c u s tom e r f a c i l i t y c o d e s . C-1 1 APPEND I X D DATA S TRUCTURE DE F I N I T I ONS Th i s m a n ua l has d e sc r i b ed VM S p r im a r i l y in te r m s of the d a t a s t r uc t u r e s tha t a r e u s e d by t h e v a r i o u s c ompo n e n t s o f the e x e c u t i ve . Th e d a ta s t r uc t u r e s u s e d by VM S a r e d e f i n ed i n a l a ng uag e c a l l ed MDL ( Append i x A) in one of two f i l e s . Th e s e f i l e s a l s o d e f i n e mo s t o f the s ymbo l i c c o n s t a n t s m e n t i o n ed th r o ug h o u t t h i s m a n ua l . • e • A f i l e c a l l ed [ E XEC . SRC ] S YS D E F . MDL c o n t a i n s a l l s t r uc t u r e a nd constant d e f i n i t i ons u s e d i n t e r n a l l y by VM S . Th e r e s u l t a n t mac r o d e f i n i t i o ns a r e s to r ed i n t h e spec i a l m a c r o l ib r a ry SYS $ L I BRARY : L I B . M LB used to a s sem b l e a l l c ompo n e n t s o f VM S a nd a v a i l a b l e to user s for s pec i a l a ppl i c a t i o n s s uc h a s u s e r -w r i t t e n d ev i c e d r i v e r s a nd s ys t em s e r v i c e s . A f i l e c a l l ed [ VM S L I B . S RC ] S TARDE F . MD L c o n t a i n s a l l s t r uc t u r e a nd cons tant d e f i n i t i ons tha t a r e ava i l ab l e fo r g e n e r a l a ppl i c a t i o n s ( s u c h a s s ys tem s e r v i c e c a l l s . ) The resul tant mac r o d e f i n i t i o n s a r e s to r ed i n t h e d e f a u l t m a c ro l i b r a r y SYS $ L I BRARY : S TAR LE T . MLB ( a s we l l as L I B . M LB ) . i n th i s m a n u a l M i s c e l l a n e o u s d e f i n i t i o n s me n t i o n ed d e f i n ed in o th e r f i l es . In pa r t i c u l a r , the [ VM S L I B . SRC ] S SMSG . MDL d e f i n e s a l l the symbo l s o f S S $ name . are file f o rm Th e d i s t i nc t i o n b e t we e n the two f i l e s SYS DE F . MDL a nd STARDEF . MDL is tha t s t r uc t u r e s a nd c o n s t a n t s d e f i n ed i n STARD E F , b e c a u s e the y a r e s to r ed i n the l i b r a r y S TARL E T . M LB a nd a r e u s ed i n c o n j un c t i o n w i th s ys t em s e rv i c e s , wi l l p r o b a b l y n o t c h a ng e f r om r e l e a s e to r e l e a s e . S t r uc t u r e s a nd c o n s t a n t s d e f i n ed i n SYSDEF ( a nd s t o r ed in L I B . M LB ) c a r r y no s uc h g ua r an t e e , r e q u i r i ng t h a t p r og r am s tha t u s e s uc h s t r uc t u r e d e f i n i t i o n s m u s t b e r e a s s embl ed a nd r e l i n k ed w i th e a c h m a j o r r el ease o f VAX/VM S . Th e u s e o f L I B . MLB i n a s s em b l y l a ng uag e s o u r c e p r og r am s ( o r L I B . L 3 2 i n B L I S S - 3 2 p r og r am s ) i s i n th i s wa y a n a l og o us t o p r og r ams l i n ked w i th SYS $ S YS TEM : SYS . STB t h a t m u s t b e r e l i n k ed w i th e ac h m a j o r r e l e a s e of VAX/VM S . Th i s a ppe nd i x s umma r i ze s the p r i m a r y d a t a s t r uc t u r e s used by t h e c ompo n e n t s d e sc r i b ed i n th i s m a n ua l . A s omewh a t a r b i t r a r y d i v i s i o n o f d a t a s t r uc t u r e s i s mad e i n o rd e r t o k e e p the s i ze of th i s a ppend i x m a n ag e a b l e . Ta b l e D - 1 l i sts a l l the d a ta s t r u c t u r e s a nd c o n s t a n t s d e f i n ed i n SYSDEF a nd S TARDE F , showi ng how t h i s a r b i t r a r y d i v i s i o n is m ad e . On l y the f i r s t two c l a s s e s a r e d e sc r i b ed i n a ny d e t a i l i n th i s a ppe nd i x o r e l sewh e r e i n th i s m a n u a l . D-1 Ta b l e D-1 Summa r y o f A r b i t r a r y D i v i s i o n o f Da t a S t r uc t u r e s in Th i s Append i x Th e fo l l ow i ng ac ro nyms i nd i c a te c o n s t a n t s o r d a ta s t r u c t u r e s tha t � r e d e f i ned i n t h e f i l e [VM S LIB . SRC ] STARDE F . MDL . Sys tem Wi d e Da ta S t r u c t u r e s ACC DMP IAC PLV PS L SEC STS Symbo l ic Co nst a n t s JPI M SG PQL PR PRT PRV S t r uc tu r e s Used by t h e I /O Subsys t em S t r u c t u r e s Used by the Fi l e System M i s c e l l aneo us Da ta S t r uc tu r e s CR DC DEV DIB IO LA LP MT PCC TT ATR FIB FID C LI C L I S ERV C L I VERB DJI OPR SJH SMQ SM R SQH SQR SYM TPA XA XF XM Th e fo l l owi ng a c ronyms i nd i c a te c o n s t a n t s o r d a ta s t r uc tu r e s that a r e d e f i ned i n t h e f i l e [ EXEC . SRC ] SYS DEF . MD L . Sys tem Wi d e Da ta S t r uc t u r e s MBX ACB MCHK ARB MPM BRD C EB MTX C HF PCB EMB , CRDEF PFL EM B , HDDEF PFN PHD FKB GSD PQB PRM IFD PTE I HA PTR IHD RBM !HI IHP RPB S FT IHS S HB ISO SHD JIB KFH TQE KF I VA KF P WQH LOG WSL Symbol i c Co nstants BTD CA DYN ! 07 5 0 !0780 I PL NDT PR I RSN SGN STATE S t r uc tu r e s Used by the I / O Subsys tem S t r uc tu r e s Used by the Fi l e System Mi scel l aneous Da ta St r uc tu r e s ADP AQB CCB CRB D DB DDT DPT ! DB IRP I R PE MBA TTY UBA UB I UCB VEC AIB BBS CXB EOl E02 E03 FCB HDl HD2 HD3 MT L MVL NMB RVT RVX VCA VCB VL l WCB ABD ACF C IN EMB , BCDEF EMB , DVDEF E M B , E TDE F EMB, MCDEF EMB , SBDEF EMB , SEDEF EMB , SSDEF EMB , SUDEF EMB , TSDEF EMB , UEDEF EMB , UIDEF EMB , VMDEF ERL IHX I P PBH PDB PIB PMB PRQ RDP UAF M DATA STRUCTURE DEFIN I T IONS Th e f i v e c l a s s e s o f s t r uc t u r e s tha t a r e l i s t ed h e r e a r e : • Da ta s t r uc t u r e s u s ed by m em o r y m a n ag em e n t , t h e sched ul e r , a nd m i s c e l l a n e o us c om po n e n t s . Th e r e i s a t l e a s t o ne fi g u r e o r t a b l e i n th i s m a n ua l tha t d e sc r i b e s each o f · t h e s e s t r uc t u r e s . • Co n s t a n t s s uc h a s c o nd i t i o n c od e s , d a ta s t r uc t u r e t ype s , a nd so o n . • s ta t e codes , Da ta s t r uc t u r e s a n d d ev i c e - s p e c i f i c c o ns t a n t s used by t h e I/0 s y s t em , i nc l ud i ng d ev i c e d r i v e r s . • Da ta s t r uc t u r e s u s ed by the f i l e c on t r o l r e l a t ed u t i l i t i e s s uc h a s MOUNT a nd IN I T . • D. l sched u l i ng p �o c e s s e s a nd M i s c e l l a n e o u s d a t a s t r uc t u r e s a nd c o n s t a n t s . Some o f t h e s e a r e d e f i n ed i n o th e r m a n ua l s i n t h e VMS d o c um e n t a t i o n s e t . EXECUT IVE DATA S TRUCTURES Th i s f i r s t sec t i o n me n t i o n s e a c h d a ta · s t r uc t u r e tha t i s d e sc r i be d in th i s m a n ua l , i nc l ud i ng a b r i e f s umma r y o f t h e s t r uc t u r e a nd r e f e r e n c e s t o a mo r e c ompl e t e d e s c r i pt i o n e l s e wh e r e i n the m a n ua l . Th r e e d a t a s t r uc t u r e s , the s o f twa r e PC B , the P r o c e s s Head e r , a nd t h e Jo b I n fo rma t i on B l o c k a r e pa r t i a l l y d e sc r i b ed i n seve r a l pl a c e s t h r o ug h o u t the tex t . Th e y a r e d e sc r i b ed h e r e i n th e i r en t i r e t y , wi th r e f e r en c e s to o th e r pa r t i a l d e sc r i pt i o n s . D. l . l ACB - AST Co n t r o l B l o c k Pu r po s e : Us ua l Lo c a t i o n : Al l o c a ted f rom : Re f e r e n c e s : Spec i a l No t e s : D. l . 2 De sc r i b e s pend i ng AST f o r a p r o c e s s A S T q ue ue w i th l i s t h e ad i n so f twa r e PC B No n pag ed po o l Figure 5-l ACBs a r e u s ua l l y a pa r t o f a l a rg e r s t r uc t u r e , an I /0 r e que s t pa c k e t ( IRP) or a t i me r q u e ue e l emen t ( T QE ) . ACC - Acco un t i ng and Te rm i na t i o n Me s sa g e Blo c k Pu r po s e : Us ua l Lo c a t i o n : Re f e r e n c e s : Us ed to s e nd t e rm i n a t i o n m e s s a g e to the j ob c o n t r o l l e r wh e n a p r o c e s s i s d e l e te d . Th e s am e m e s s a g e i s a l s o s en t to t h e t e rm i n a t i o n ma i l bo x of th e c r e a to r o f t h e p r o c e s s . Th e s t r uc t u r e i s a l so u s ed i n t h e Send Me s s a g e t o the Ac c o un t i ng Ma n ag e r sys t em s e rv i c e . Th e t e rm i n a t i o n m e s sag e resides on the kernel s t ac k . Ta b l e 1 9 - 1 o f th i s m a n ua l , Pa r t I I o f the VAX/VMS Sys t em Se r v i c e s Re f e r en c e Ma n u a l D- 3 DATA STRUCTURE DE F IN I TI ONS D. l . 3 ARB - Ac c e s s R i g h ts B l oc k Th e a c c e s s r i g h t s b l o c k c u r r en t l y c o ns i s t s o f the p r i v i l eg e m a s k a nd U I C l o c a te d a t t h e e nd o f the so f twa r e PCB . Th a t i s , t h e ARB i s c u r r e n t l y a pa r t o f t h e so f twa r e PC B . Th e ARP po i n t e r ( PC B $ L_ARB ) c u r r e n t l y po i n t s to t h i s o ve r l a i d d a ta s t r uc t u r e . F i g u r e D-2 s h o ws a n ARB w i t h i n a so f twa r e PC B . F i g u r e D-1 s hows tha t the fi rst fo u r l o ng wo rd s i n a J I B c a n a l so b e c o n s i d e r e d a n ARB . Prog r am r e f e r e nc e s tha t u s e t h e ARB po i n t e r i n t h e so f twa r e PC B t o l o c a t e t h e ARB o r any f i e l d s w i th i n t h e ARB s uc h a s a pr i v i l eg e ma s k wi l l c o n t i n u e t o wo r k wi tho u t m od i f i c a t i o n sho u l d t h e ARB b e c om e a n i nd e pe nd e n t d a ta s t r uc t u r e in a f u t u r e r e l e a se of VAX/VM S . De f i n e s p r o c e s s a c c e s s r ig h t s a nd p r i v i l eg e s C u r r e n t l y a p a r t o f t h e so f twa r e PC B T a b l e 1 8 - 1 , Fi g u r e s D- 1 and D-2 Pu r po s e : Lo c a t i o n : Re f e r e nc e s : D. l . 4 BRD B r o a d c a s t Me s s ag e Desc r i pto r B l ock Pu r po s e : Us ua l Lo c a t i o n : Al l o c a t ed f r om : Re f e r e nc e s : D. l . S l ist ( l i s th e a d C EB - Common E v e n t B l o c k Pu r po s e : Lo c a t i o n : Al l o c a t ed f r om : Re f e r e n c e s : D. l . 6 C o n t a i n s b r o ad c a s t m e s s ag e b r o ad c a s t t e rm i n a l In I OC $G L B RDC S T ) No n pag ed pool F i g u r e 1 6-4 C o n t a i n s d e sc r i pt i o n a nd wa i t que ue f o r c ommo n e v e n t f l ag c l u s t e r In c ommo n event block l i st ( l i s th e ad S C H $ G Q C EB HD ) . ( Ma s t e r C EBs a r e l o c a ted i n s h a r ed m emo r y-a nd po i n ted to b y a f i e l d i n the s l av e CEB l o c a t ed in t h e c ommo n event b l o c k l i s t o n e a c h processo r . ) N o n pa g ed po o l . ( Ma s t e r CEBs a r e a l l o c a ted f r om a C EB t a b l e l o c a ted i n s h a r ed memo r y . ) F i g u r e s 9 - 2 , 9 - 3 , 9 - 4 , a nd 9 - 5 CHF - Cond i t i o n Hand l e r Argumen t L i s t Ar r ays P u r po s e : Us u a l Lo c a t i o n : Re f e r e n c e s : Spec i a l No t e s : D e s c r i b e s c o nd i t i o n o r e x c e p t i o n to cond i t i o n h a nd l e r O n s ta c k o f a c c e s s m o d e i n wh i c h e x c e pt i o n o r c o nd i t i o n o c c u r r ed F i g u r e s 2 - 2 a nd 2 - 4 o f th i s m a n ua l , Ch a pt e r 9 o f t h e VAX/VMS Sys t em S e r v i c e s Re f e r en c e Ma n ua l , Ch a p t e r 6 o f the VAX- 1 1 Run -T i m e L i b r a ry Re f e r en c e Ma n ua l Th e $ C HFDEF m a c r o d e f i n e s o f f s e t s i n to no t o n l y t h e p r ima r y a rg um e n t l i s t b u t a l so t h e s i g n a l a n d m e c h a n i sm a r r a y s . 0- 4 DATA STRUCTURE DEF I N I T I ONS D. l . 7 DMP - Head e r B l o c k o f Sys t em D u mp F i l e De sc r i b e s c o n t e n t s o f d um p f i l e F i r s t v i r t ua l b l o c k o f SYS $ SYS T EM : SYS DUMP . DM P a n y o th e r d um p f i l e Ta b l e 7 - 1 Pu r po s e : Loc a t i o n : Re f e r e nc e s : D. l.8 or E M B - E r r o r Log Me s s ag e B l o c k De sc r i b e s a pa r t i c u l a r e r r o r l og e n t r y i n o n e o f the e r ro r l og buf fe rs . Th e r e are sever a l Th e y a r e a l l d i f f e r en t f o rms o f e r r o r m e s s ag e . i nv o k e d wi t h t h e $ EMBDE F m a c r o wi th o n e o f s e ve r a l s e c o nd pa r am e t e r s . Fo r e x am p l e , the f o l l ow i ng i nvoc a t i o n f r om mod ul e ERROR LOG Pu r po s e : $ EMBDEF <DV, S U , TS , U I > d e f i n e s s ym bo l s o f the fo rm EMB $ x DV a b c EMB $ x-S U-a b c EMB $ x-T S-a b c EMB $ x-U I -a bc Almo s t a l l o f t h e e r r o r me s s a g e fo r m a t s a r e r e l a t ed t o a s pe c i f i c type o f e r r o r . On l y o n e e r ro r t yp e of e r r o r m e s s ag e buffe r , the c r a s h/ r e s t a r t e r r o r m e s s ag e a s s o c i a t ed wi th a f a t a l b ug c h e c k , i s r e f e r e n c ed i n th i s m a n ua l . D. l . 8 . 1 EMB , CR - C r a s h/Re s t a r t E r ro r Log E n t ry Fo r m a t De f i n e s o f f s e t s f o r e r r o r l og e n t r i e s a s s o c i a t ed b ug c h e c k s ( No n f a t a l f a ta l b ug c h e c k s . wi th ent r y , r e s ul t i n a s l i g h t l y d i f fe r e n t f o rm o f d e s i g n a t e d by BC i n s t e ad of C R . ) Ta b l e 7 - 1 Pu r po s e : Re f e r en c e s : EMB , HD - Lo ngwo rd Hea d e r f o r Al l En t r i e s - Th e f i r s t l o ng wo rd D. l.8.2 i n all r ec o rd . error Pu r po s e : Re f e r enc e s : D.l.9 l og entr ies i s a h e ad e r tha t d e f i n e s t h e r e s t o f t h e De sc r i b e s t h e r e s t o f the e r r o r l og e n t r y Ta b l e 7 - 1 FKB - Fo r k B l o c k P u r po s e : U s u a l Lo c a t i o n : A l l o c a t e d f r om : S t o r e s m i n i m um c o n t e x t fo r d r i v e r p r o c e s s o r s ys tem t i m e r s ub r o u t i n e F i r s t s i x l o ng wo r d s o f d ev i c e un i t c o n t r o l block o r t i m e r q u e ue e l em e n t o f s y s t em s ub r o u t i n e No npag ed po o l ( e x c e pt f o r st a t i c a l l y a l l o c a t ed TQE o r UCB ) D-5 DATA STRUCTURE DEF IN IT I ONS Re f e r e nc e s : Spec i a l No t e s : D. l . lO F i g u r e 4 -2 fo r g ene r a l l a yo u t , Figure 1 0-1 fo r f o r k b l o c k c o n ta i n ed 1 n TQE , Append i x A o f the VAX/VM S G u i d e to Wr i t i ng a Dev i c e D r i v e r fo r I /0 f o r k b l o c k Th e o n e u s e o f a sys tem t i m e r s u b r o ut i ne i n VMS i s a s ta t i c a l l y a l l o c a t ed t i m e r que ue e l em en t . GSD - G l oba l Sec t i o n Desc r i pto r Pu rpo s e : Us ua l Lo c a t i o n : Al l o c a t ed f r om : Re f e r e nc e s : S p e c i a l No t e s : C o n t a i n s i d en t i f y i ng i n fo rma t i o n a b o u t a g l o b a l s ec t i on . G r o up o r sys t em G S D l i s t . ( Sh a r ed memo r y G S Ds a r e l o c a t e d i n sha r ed m emo r y . ) Pag ed po o l . ( Sh a r ed memo r y G S Ds a r e a l l o c a t e d f r o m pag e s in sha r ed m emo r y s e t a s i d e fo r s h a r ed m emo r y G S Ds . ) F i g u r e s 1 1 - 1 4 , 1 1 - 1 8 , a nd 1 1 - 2 7 Th e r e a r e t h r e e d i f f e r e n t fo rms o f G S D : • • • D. l . ll Us ua l Lo c a t i o n : Re f e r en c e s : D e s c r i b e s a c t i v a t i o n o p t i o n s to Imag e Ac t i v a t i o n s y s tem s e r v i c e Fo u r th a rg um e n t i n a rg um e n t l i s t t o sys tem s e r v i c e Sec t io n 1 8 . 1 . 1 I FD - Imag e F i l e D e s c r i p to r B l o c k Pu r po s e : U s u a l Lo c a t i o n : Re f e r e nc e s : D. l . l3 Re t u r n s i n fo rma t i o n a b o u t i m ag e f r om i m ag e a c t i v a to r to i t s c a l l e r I n a d d r e s s s pa c e o f c a l l e r o f i m ag e a c t i va to r Sec t i o n 1 8 . 1 . 1 I Hx - Imag e H e a d e r F i e l d s Th e imag e h e ad e r c o n t a i n s s e v e r a l r ec o r d s tha t f u l l y d e sc r i b e imag e . Th e I Hx s t r uc t u r e s d e f i n e the f i e l d s wi th i n e a c h r ec o r d . D. l . l3. 1 in IAC - Imag e Ac t i v a t i o n C o n t r o l F l a g s Pu r po s e : D. l . 12 No rma l g l o b a l s e c t i o n d e sc r i pto r De s c r i pto r fo r PFN-ma pped s e c t i o n De s c r i pto r fo r sec t ion tha t r e s i d es s h a r ed m emo r y I HA - Imag e H e ad e r T r a n s f e r Ad d r e s s A r r a y Pu r po s e : Re f e r e nc e s : De f i n e s t r a n s f e r add r e s s ( e s ) Figure 18-7 D-6 fo r i m ag e the DATA S TRUCTURE DEF IN IT I ONS D. l . l3 . 2 I HD - Imag e He a d e r Rec o rd De f i n i t i on s - Th i s is the fi rst r ec o r d in the i m a g e h e a d e r . Amo ng o the r th i ng s , t h i s po r t i o n o f the image h e ad e r c o n t a i n s o f f s e t s to the o th e r r e c o rd s . Pu r po s e : Re f e r e n c e s : De sc r i b e s t h e r e s t o f the imag e h e ad e r F i g u r e 1 8-1 D. l . l3 . 3 IHI Imag e H e ad e r I d en t i f i c a t i o n S e c t i o n - Th i s s e c t i o n c o n t a i n s s uch i n fo rm a t i o n a s the i mag e n am e a nd the d a te a nd t i m e tha t the l i n k wa s pe r fo rmed . D. l . l3 . 4 I H P - Imag e Head e r Pa t c h S e c t i o n - Th i s the p a t c h l ev e l o f t h e i m ag e . s ec t i o n d e sc r i be s D. l . l3 . 5 I HS - Imag e He ad e r Symbo l Tabl e a nd De b ug S e c t i o n - Fo r e x e c u ta b l e i mag e s t h a t h ave i nc l ud ed DEBUG s uppo r t , th i s s e c t i o n l o c a te s t h e d eb ug s ymbo l t a b l e w i th i n t h e i m a g e f i l e . Fo r sha r e a b l e i m ag e s , t h i s s ec t i o n l o c a t e s t h e un i v e r s a l s ymbo l t ab l e a t t h e e n d o f t h e i m ag e f i l e . D. l . l4 I S D - Imag e S ec t i o n Desc r i pt o r Pu r po s e : Lo c a t i o n : Re f e r e n c e s : D. l . lS D e s c r i b e s v i r t ua l add r e s s r a ng e a nd c o r r e s po nd i ng i n fo rma t i o n { v i r t ua l bloc k r a ng e , g l o ba l s e c t i o n n am e ) to i mag e ac t i v a to r Imag e h e a d e r F i g u r e s 1 8-2 to 1 8-5 J I B - Job I n fo rma t i o n B l o c k Th e Jo b I n fo rm a t i o n B l o c k a ppe a r s i n s ev e r a l f i g u r e s i n th i s m a n ua l . F i g u r e D-1 sh ows all of the f i e l d s c u r r en t l y d e f i ned in th i s s t r uc t u r e . Some o f t h e s e f i e l d s a r e n o t c u r r e n t l y u s e d . Pu r po s e : Lo c a t i o n : Al l o c a t ed f r om : Othe r Re f e r e n c e s : D. l . l6 C o n t a i n s quo t a s po o l ed by a l l processes same j o b . Po i n t ed to b y PC B $ L J I B f i e l d o f a l l PC B s s ame j o b . No n pag ed po o l F i g u r e 1 - 1 , F i g u r e s 1 7 - 1 , 1 7 - 2 , a nd 1 7 - 6 in the in the KFH - Known F i l e He a d e r Pu r po s e : Usua l Lo c a t i o n : Al l o c a t ed f r om : Re f e r e n c e s : C o n t a i n s i mag e h e a d e r f o r any k n o wn i mag e th a t is i n s t a l l ed /H EADER RE S I DENT Lo c a t ed th r o ug h KF I $L I MG HDR po i n t e r i n KF I fo r t h a t known i mag e Pag ed po o l F i g u r e 1 8-6 D-7 DATA STRUCTURE DE F I N I T I ONS Job I nformation Block (JIB) Only the shaded fields within the J I B are currently used USE RNA ME F i g u r e D- 1 D . l . l7 (JIB) K F I - Known F i l e En t r y Pu r po s e : U s ua l Lo c a t i o n : Al l o c a ted f r om : Re f e r e nc e s : D . l . l8 De t a i l ed L a yo u t o f Jo b I n fo rma t i on B l o c k De sc r i b e s a n imag e t h a t h a s b e e n m a d e known to the s ys t em wi t h the INSTA L L u t i l i ty I n o n e o f t h e k nown f i l e l i s t s . Th e r e i s o n e l i s t fo r e a c h d i r ec to r y tha t h a s i mag e s i n s t a l l ed f r om i t . Pag ed po o l F i g u r e 1 8-6 K F P - Known F i l e Po i n te r B l o c k Pu r po s e : U s u a l Lo c a t i o n : A l l o c a t ed f r om : Ac t s a s l i s t h e ad f o r a l l KF i s i n a g i v e n d i r e c to r y I n known f i l e l i s t ( l i s thead EXE $G L_KNOWNF I L ) Pag ed po o l D-8 DATA S TRUCTURE DEFIN I T I ONS 0. 1 . 19 LOG - Log i c a l Name B l o c k P u r po s e : U s u a l Lo c a t i o n : Al l o c a t ed f r om : Re f e r e nc e s : 0 . 1 . 20 MBX - S h a r e d Memo r y Ma i l bo x C o n t r o l B l oc k Pu r po s e : U s ua l Lo c a t i o n : Re f e r e nc e s : 0 . 1 . 21 De s c r i b e s e a c h m a i l bo x th a t e x i s t s i n sha r ed memo r y m a i l bo x Pag e s in sha r ed m emo ry d ed i c a t ed to con t r o l b l ocks F i g u r e s 1 6 - 2 and 1 6 - 3 MCHK - M a c h i ne Chec k E r ro r Ma s k B i t De f i n i t i o n s P u r po s e : Re f e r e nc e s : 0. 1 . 22 C o n t a i n s l og i c a l and e qu i v a l en c e n am e s t r i ng s fo r a g i v e n l og i c a l n ame I n one o f th r e e l og i c a l name tabl e s : process , g r o up , o r sys t em Pag ed po o l f o r g r o up a nd s ys t em l og i c a l names , P r o c e s s a l l o c a t i on r eg i on f o r process l og i c a l n am e s F i g u r e s 1 6 - 1 a nd 1 6 - 3 , F i g u r e s 2 6 - 1 a nd 2 6 - 2 D e s c r i b e s pa r t i c u l a r s e t o f m ac h i n e c h e c k e r r o r s th a t a b lock of ke r n e l mod e cod e wi sh e s to p r o t e c t i t s e l f ag a i n s t Sec t ion 7 . 3 . 3 MPM - M u l t i pa r t Memo ry Ad a p t e r Reg i s t e r s Lo c a t i o n : S ym bo l i c n am e s fo r r eg i s te r s tha t o pe r a t i o n o f MA7 8 0 mul t i pa r t m emo r y I / 0 pag e s s e t a s i d e fo r t h i s a d a p t e r D . l . 23 ( Mu t u a l Exc l u s i o n S em apho r e ) Pu r po s e : MTX - M u t e x P u r po s e : U s u a l Lo c a t i o n : Re f e r enc e s : D . l . 24 cont r o l M u t e x e s c o n t r o l p r o c e s s a c c e s s to p r o t e c t ed d a ta s t r uc t u r e s S t a t i c a l l y a l l o c a ted l o ng wo r d s i n mod u l e SYSC OMMON F i g u r e 2 4 - 2 , Ta b l e 8 - 2 , Ta b l e 2 4 - 2 PCB - P r o c e s s C o n t r o l B l o c k Th e t e r m p r o c e s s c o n t r o l b l o c k c a n r e f e r to two d i f f e r e n t s t r uc t u r e s i n t h e VAX l i te r a t u r e . Al l so f twa r e d o c umen t a t i o n i n c l ud i ng th i s m a n ua l r e f e r s to the s o f twa r e p r o c e s s c o nt r o l blo c k a s s i mp l y PC B a nd a l wa ys p r e f i x e s the h a r d wa r e p r o c e s s c o n t r o l b l o c k w i t h the wo rd " h a r d wa r e " . D-9 DATA STRUCTURE DEFIN I T I ONS 0. 1 . 24 . 1 So f twa r e P r o c e s s Con t r o l B l o c k - Th e s o f twa r e PCB a ppe a r s i n s ev e r a l f ig u r e s i n t h i s m a n ua l . Howeve r , e a c h o f the s e f i g u r e s o n l y s h o ws tho s e f i e l d s r e l a te d to the p u r po se o f the pa r t i c u l a r f i g ur e . Th e s o f twa r e PCB i s i l l us t r a te d i n F i g u r e D- 2 . Th e m e a n i ng o f e a c h f i e l d i s l i s t ed i n Tab l e D - 2 . Pu r po s e : Lo c a t i o n : Al l o c a t e d f r om : O th e r Re f e r enc e s : D . l . 24 . 2 Ha rdwa r e P r o c e s s Con t r o l B l o c k Pu r po s e : Lo c a t i o n : Re f e r en c e s : 0. 1 . 25 C o n t a i n s h a r d wa r e c o n t e x t o f a p r o c e s s wh i l e i t i s no t e x ec u t i ng Pa r t o f the f i x ed po r t i o n o f t h e p r o c e s s h e ad e r . Figure 1-1 , Figure 8-6 PFL - Page F i l e Con t r o l B l o c k Pu r po s e : Al l o c a ted f r om : Re f e r e nc e s : D . l . 26 C o n t a i n s a l l t h e p e rmanen t l y r e s i d en t i n f o rma t i o n a bo u t a p r o c es s . On e o f t h e s c h ed u l i ng s t a t e q u e ue s . Al s o po i n ted t o by one o f the PCB ve c to r e l em e n t s . No npag ed poo l F i g u r e 1 -1 , F i g u r e 5 - l , F i g u r e 8 -1 , Figures 9-1 , 9-3 , and 1 9- 4 , F i g u r e 1 1-2 1 , Fig ures 1 7-1 , 1 7 - 2 , 1 7 - 3 , a nd 1 7 - 6 , F i g u r e 1 9- 1 C o n t a i n s d a ta n ee d ed by pag e r to r ea d f r om pag e f i le and by mod i f i ed pag e to wr i t e �o pag e file. S t a t i c a l l y a l l o c a t ed i n m od u l e SWAPF I LE F i g ur e 1 1- 2 2 PFN - PFN Da t a B a s e De f i n i t i o n s Th e $ P FNDE F mac r o d e f i ne s f i e l d s i n t h e e l emen t s . Pu r po s e : U s u a l Lo c a t i on : Re f e r enc e s : STATE , TYPE a nd BAK a r r ay PFN d a ta b a s e d e sc r i b e s d ynam i c phys i c a l pag e s S e pa r a t e a r e a i n s ys t em add r e s s s pa c e F i g u r e s 1 1 -9 to 1 1 -1 3 D- 1 0 DATA S TRUCTURE DEFIN I T IONS Software Process Control Block (PCB) SQFL SQBL PRI I TYPE SIZE MTXCNT ASTEN ASTQFL J ASTACT ASTQBL PHYPCB OWNER WSSWP STS WTIME PRIB - J WEFC STATE TMBU APC NT PPGCNT GPGCNT BlOC NT ASTCNT DIOCNT BIOLM PRCCNT DIOLM r- TERMINAL PRCCNT D IOLM TERMINAL EFWM/PQB - EFCS EFCU EFC2P .... )- EFC3P PID PHD r- LNAME r- ARB contained within PCB F i g u r e D-2 JIB PRIV ARB --- UIC De t a i l ed L a yo u t o f So f twa r e Pr o c e s s Co n t r o l B l o c k ( PC B ) D- 1 1 Ta b l e D-2 Of f s e t s i n to So f t wa r e P r o c e s s Co n t r o l Bl o c k F i g u r e o r Ta b l e Re f e r en c e s i n Th i s Ma nua l Th i s F i e l d Symbo l i c Name S i ze o f F i e l d Use of PCB SL_S QF L l o ng wo rd S c h e d u l i ng PCB $ L S QB L PCB $W-S I Z E PCBSB-TYPE PC B $ B-PR I PCB $B-ASTACT PCBSB-ASTEN PCB $W-MTXCNT PC B $ L-ASTQFL P C B $ L-ASTQBL PCB $L-PHYPCB P C B $ L O WNER l o ng wo rd wo rd byte byte byte byte wo rd 1 o ngwo rd l o ng wo rd l o ng wo rd l o ng wo rd PCB $ L WSSWP PCB $ L-STS PC B $ L-WT I M E PCB $W-S TATE PCB $B-WEFC PCB $B-P R I B PCB $W-A PTCNT PCB $W-TM BU PCB $W-G PGCNT PCB $W-P PGCNT PCB $W-ASTCNT P C B $W-B IOCNT PCB $W-B I O LM PCB $W-D I OCNT PCB $W-D I O LM PCB $W-PRCCNT PCB $T-TER M IN AL PCB $ L E FWM l o ngwo rd 1 o ngwo rd l o ng wo rd wo rd byte byte wo rd wo rd wo rd wo rd wo rd wo rd wo rd wo rd wo rd wo rd 8 byt e s l o ngword S c h ed ul i ng s t a t e q u e ue b a c kwa rd l i n k S i ze of s o f twa r e PCB S t r uc t u r e type c o d e ( DYN $C_PCB ) Cu r r en t so f t wa r e p r io r i ty Ac c e s s m ode s wi th a c t i v e ASTs Access mod e s wi th ASTs e n ab l ed Co unt of owned m u t e x e s A S T q u e u e fo rwa rd l i n k A S T q u e u e b a c kwa rd l i n k Ph ys i c a l add r e ss o f h a r d wa r e PCB P r o c e s s I D o f own e r p r o c e s s i f s ub p r o c e s s ( ze r o i m p l i e s n o t a subproc e s s ) Swa p f i l e d i s k a d d r e s s So f t wa r e s t a tus f l ag s l o ngwo rd Time a t s t a r t of wa i t ( no l ong e r used ) Cur r en t s c h ed ul i ng s t a t e cod e Wa i t i ng event f l ag c l us t e r B a s e so ftwa r e pr i o r i t y Ac t i v e pag e tab l e c o u n t Te r m i n a t i o n m a i l box un i t n um b e r G l o b a l pag e c o un t i n wo r k i ng s e t Pro c e s s pag e count i n wo r k i ng s e t A S T count r ema i n i ng Bu f f e r ed I /O c o u n t r ema i n ing Bu f fe r ed I /O l i m i t Di r e c t I /0 c o u n t r ema i n i ng Di r ec t 1 /0 l im i t Co unt of owned s ub proc e s s e s Te rm i n a l d e v i c e n am e s t r i ng fo r i n t e r ac t i v e j obs E v e n t f l ag wa i t m a s k :::: :::: s t a t e queue fo rwa rd l in k Figure 8 - 1 , Figure 8-3 , Figure 8-4 , Figure Fig ure 9 - 4 S a m e a s fo r wa r d l i n k 9-3 , Figure 8-1 Figure 5 -1 Figure 5 -1 Figure 5 -1 Figure 5 -l Figure 1-1 , Figure 8-1 Figure 17-2 , Figure 1 9-1 , Ta b l e 1 9 - 1 Figure 11-23, Figure 17-5 F i g u r e 8 -1 , Ta b l e 9 - 2 Figure 8-1 Figure 9-1 F i g u r e 8 -1 F i g u r e 5 - l , Ta b l e 1 7 -4 Ta b l e 1 7 -4 Ta b l e 1 7 -4 Ta b l e 1 7 -4 Ta b l e 1 7 -4 F i g u r e 1 7 -2 , F i g u r e 1 9 - 1 Figure 9 -1 Figure 1 7- 1 , S am e l o ngwo rd ho l d s r eso u r c e number o r m u t e x ad d r e s s w h e n p r o c e s s i s i n MWA I T s t a te PCB S L_PQB S am e l o ngword ho l d s add r e s s o f P r o c e s s Quo t a B l o c k d u r i ng p r o c e s s c r e a t i o n PC B $ L E F C S PCB $ L-EFCU P C B $ L=EF C 2 P l o ngword l o ngwo rd l ongword Lo c a l event f l ag c l us t e r ( sy s t em ) Lo c a l event f l ag c l us t e r ( us e r ) Ad d r e s s o f g l o b a l c l us t e r 2 l ong wo rd Ad d r e s s o f g l o b a l PCB S L_P I D l o ngword Process PCB$L_EFC3P c l us t e r 3 ID PCB $ L_PHD l o ngwo rd Ad d r e s s o f p r o c e s s h e a d e r PC B $ T LNAME PC B $ L=J I B 16 byte s l o ngwo rd Pro c e s s name Ad d r e s s o f Jo b P C B $ Q PR I V PCB $ L-ARB PCB $ L U I C quadwo rd l o ngwo rd l o ngwo rd Cu r r en t p r o c e s s pr i v i l eg e m a s k Ad d r e s s of a c c e ss r ig h t s b l o c k Us e r i d e n t i f i c a t i o n c od e o f p r o c e s s = PCB $W MEM PCB$W G R P :::: wo rd wo rd In fo rma t i o n B l o c k Membe r cod e of U IC G r o up code o f U I C Fig u r e 1 7-6 F i g u r e 9 -1 Figure 9-1 F i g u r e 9 -1 , F i g u r e 9 - 3 , F i g u r e 9 -4 F i g u r e 9 -1 , F i g u r e 9-3 , Fig ure 9 - 4 F i g u r e 1 7 - 2 , F i g ur e 1 9- 1 , Ta b l e 1 9 - 1 Fig ure 1-1 , Figure 1 7 - 1 , F i g ur e 1 7 -6 F i g u r e 1 7 - 2 , F i g u r e 1 9- 1 F i g ur e 1 - 1 , F i g u r e 1 7 - 1 , F i g u r e 1 7 - 2 , F i g u r e 1 7 -6 Ta b l e 1 8 - 1 DATA STRUCTURE DEF I N I T I ONS D . l . 27 PHD - P r o c e s s He a d e r Th e p r o c e s s h e ad e r c o n t a i n s p r o c e s s - s pe c i f i c m emo r y m a n ag em e n t d a t a a nd o th e r p r o c e s s c on t e x t tha t c an b e s wa ppe d . Of f s e t s i n to t h e f i x ed po r t i o n o f t h e p r o c e s s h e ad e r a r e d e f i ne d wi th the $ P HDDEF m a c r o a nd l i s t ed i n Ta b l e D - 3 . Pu r po s e : Us u a l Lo c a t i o n : Re f e r e n c e s : O t h e r Re f e r e n c e s : D. l . 28 PLV - P r i v i l eg ed L i b r a ry Ve c to r Pu r po s e : Us u a l L o c a t i o n : Re f e r e n c e s : D. l . 29 ( co n ta i n i ng Desc r i b e s p r i v i l eg ed sha r e a b l e i mag e to imag e sys t em user wr i t t e n s e rv i c e s ) a c t i v a to r i m ag e , Pa r t o f p r i v i l eg ed shar eab l e u s ua l l y r e s i d i ng i n PO s pa c e F i g u r e 3 - 9 , Ch a p t e r 6 o f t h e VAX/VM S Re a l - T i m e U s e r ' s Gu i d e --�--------------- PQB - P r o c e s s Quo ta B l o c k Pu r po s e : Us u a l Lo c a t i o n : Al l o c a t ed f r om : Re f e r e n c e s : D. l . 30 Th e p r o c e s s h e a d e r c o n ta i n s a l l process conte x t t h a t mus t r es i d e in sys t em s pa c e b u t c a n b e o u t swapped . P r o c e s s h e ad e r s a l wa ys r e s i d e i n the b a l a n c e s l o t a r ea i n s ys tem spac e . P r o c e s s h e ad e r pag e s t h a t a r e no t pag e t a b l e pag e s a r e d o ub l e mapped b y a r a ng e of Pl space a d d r e s s e s . Th e e n t i r e f i x ed po r t i o n o f t h e p r o c e s s h e ad e r a ppe a r s n o wh e r e i n t h i s m a n ua l . Ta b l e D - 3 s umma r i z e s t h e f i x ed po r t i o n o f the proc e s s h e ad e r . F i g u r e 1 - 1 , Fig u r e s 1 1-1 , 1 1-2 , 1 1-4 , 1 1-6 , 1 1-1 5 ( Sy s t em He a d e r ) , 1 1 -1 8 ( Sy s t em He a d e r ) , a nd 1 1-20 Us ed d u r i ng p r o c e s s c r e a t i o n to s to r e pa r ame t e r s f o r n ew p r o c e s s tha t b e l o ng i n p r o c e s s h e a d e r a nd i n P l s pa c e u n t i l tho s e a reas a re accessible Po i n ted t o b y l o ng wo r d ( PC B $ L_E FWM f i e l d ) in the PCB Nonpag ed po o l Ta b l e 1 7 - 2 , F i g u r e s 1 7 - 1 a nd 1 7 - 6 PRM - Pa r ame t e r Desc r i pto r B l o c k Pu r po s e : Us u a l L o c a t i o n : Re f e r e n c e s : Used by SYSB OOT a nd SYSGEN to f u l l y d e s c r i b e a d j us t a b l e pa r am e t e r Ad d r e s s s pa c e o f SYSB OOT o r SYSGEN p r og r am Ta b l e 2 2 - 4 D- 1 3 each Ta b l e D- 3 Of f s e t s i n to Fi x ed Po r t i o n o f t h e P r o c e s s He ad e r S i ze o f F i e l d Use of Th i s F i e l d PHD$Q PR IVMSK PHD$W-WS L I S T PHDSW-WSAUTH PHD$W-WSLOCK PHD$W-WSDYN PHD$W-WS LAST P H D S L-REFERFLT PHD$W=WSQUOTA quad wo rd wo rd wo rd wo rd wo rd word l o ngwo rd wo rd P r o c e s s pr i v i l eg e m a s k Ind ex to beg i nn i ng o f Wo r k i ng Se t Li s t ( WS L ) Ma x i mum autho r i zed WS L i nd e x Index to beg i n n i ng o f d ynam i c a l l y l oc ked WSLEs Ind ex to d yn a m i c WSL Index to c u r rent end o f W S L Re f e r ence Fa ul t Co unt Ma x imum i nd e x that SADJWSL can reach PHD$W_DFWSCNT wo rd De f a u l t WS L i nd e x P H D S L_PAGF I L l o ngwo rd Longwo rd whose upper byte c o n ta i n s pag e f i l e i nd ex PHD$B_PAGF I L PHDSL PSTBASOFF PHD$W-PSTLAST PHD$W-PS TFREE PHDSL-F R E P OVA PHDS L=FREPTECNT 0 I-' � I F i g u r e or Ta b l e Re fe r ences i n Th i s Ma nua l Symbo l i c Name byte l o ng wo rd wo rd wo rd 1 ongwo rd l o ngwo rd PHD$L_F R E P 1 VA l o ngwo rd PHD$8 D F PF C PHD$8-PGTBPFC PH D$W=F LAGS byte byte wo rd PHD$V PFMFLG PHDSV-DA LCSTX PHDSV=WS PEAKCHK bit bit bit r e s t o red by Imag e Rundown O f f s e t to upper byte of tha t l ongword Byte o f f s e t to high a d d ress end o f process sec t i o n tab l e Ind ex ( n eg a t i v e f rom PSTBASOFF) o f l a st PSTE Ind ex ( neg a t i ve from PSTBASOFF) o f f i r s t ava i l ab l e PSTE Fi r s t f r ee v i r t ual ad d r e ss at end of PO space Co unt o f free PTEs between the ends of t h e P O and P l page t a b l es F i r s t f r ee v i r t ua l ad d re s s a t ( l ow a d d r e s s ) end o f P l space De faul t page faul t c l us t e r fo r process pag e s De faul t p a g e faul t c l us t e r fo r p r o c e s s head e r pages Fl ag s wo rd PHDSL_CPUTIM l o ng wo rd Ac c um u l a ted CPU t i m e ( i n 10 msec un i t s ) wo rd wo rd wo rd wo rd wo rd PHD$W_WS LX wo rd Ac c umul a ted C P U t ime s i nc e l a st quantum expi r a t i o n Subpr o c e s s 1 i m i t AST 1 i m i t P r o c e s s h ead e r vecto r i n d e x Longwo rd i n d ex t o bac kup a d d r e s s v e c to r fo r process header pag e s Longwo rd index to W S L X s a v e a r e a f o r process h e a d e r pag es PHDSW_PSTBASMAX wo rd P H D S L_PTWSLELC K l o ngwo rd l o ngwo rd l o ngwo rd l ong wo rd l o ngwo rd b yte 3 bytes l o ngwo rd PHD$L_PTWSLEVAL l o ngword PHD$W_PTCNTLCK wo rd PHDSW_PTCNTVAL wo rd PHD$W PTCNTACT PHD$W-PTCNTMAX PHD$W-WSF L U I D PHD$W=E XTDYNWS wo rd wo rd wo rd wo rd PHD$L PAGEFLTS P H D $ L-PG F L T I O PHD$L-DIOCNT PHD$L-B IOCNT PHD$B=CPUMODE P H D $ L-C P U L I M 18-1 1 3- 1 , Fig ure 1 3 - 1 , Figure 13-1, Figure 1 3- 1 , F i g u r e 1 3 -1 , F i g u r e 1 1 -4 1 1 -4 1 1 -4 1 1 -4 1 1 -4 Ta b l e 1 3 -1 , F i g u r e 1 1 - 4 , Ta b l e 1 7 - 4 Ta b l e 1 3 - 1 , F i g u r e 1 1 -4 , Ta b l e 1 7 - 4 Figure 1 1-22 Figure Figure Figure Figure Figure 1 1 -6 1 1 -6 1 1 -6 1 1 -2 1 1 -2 F i g u r e 1 1 -1 5 F i g u r e 1 1 -2 Ta b l e 1 2 -1 Tab l e 1 2 -1 Page fa u l t mon i to r ing enab l ed Need to d eal l oc a t e sec t i o n i nd i c e s Ch eck f o r new peak wo r k i ng s e t s i ze PHDSW QUANT PHD$W-PRCLM PHD$W-ASTLM P HDSW-PHVINDEX PHD$W=BAK Tab l e Ta b l e Ta b l e Ta b l e Ta b l e Ta b l e Synonym fo r l a st e n t r y ( a l so end of empty pag e a r e a ) C o u n t o f a c c umul a t ed p a g e f a ul ts Co unt of pag e f a ul t I/0 o pe ra t i o n s Co unt o f d i rec t I / 0 o pe r a t i o n s Co un t o f b u f fe r ed I / O o pe r a t i o n s CPU t i me l im i t fo r p r o c e s s Ac c e s s mode to no t i fy on CPU t i m e l im i t expi r a t i o n spa r e B y t e o f fs e t to a r r a y o f c ounts o f l o c ked WSLEs in this page tab l e pag e Byte o f fs e t to a r ray of c o un t s of v a l i d WSLEs i n th i s page tab l e page Co un t of page table pages conta i n i ng o ne or m o r e l oc ked WSLEs Count of page tabl e pages c onta i n i ng o n e or mo r e va i l d WSLEs Co u n t of a c t i v e page tab l e pages Maxi mum count of page tabl e pages that have nonze r o PTEs Gua r a n teed number of f l u i d wo r k i ng set l i st entr i e s E x t r a dynam i c WSLEs above r equi red WSFLUID m i n imum Ta b l e 1 3 -2 , Ta b l e 1 7 - 4 , Ta b l e 1 9- 1 Table 1 7 - 4 F i g u r e l l -2 0 F i g u r e l l -8 F i g u r e 1 1 -8 Fi g ur e 1 1 -6 Tab l e 1 3 -2 , Ta b l e 1 9- 1 Table 1 9-l Ta b l e 1 9 -1 Ta b l e 1 7 -4 F i g u r e 1 1 -8 F i g u r e 1 1 -8 F i g ur e 11-8 F i g u r e 1 1 -8 F i g u r e 1 1 -8 F i g u r e 1 1 -8 Table 1 3-1 Table 1 3-1 (continued o n next page) Ta b l e D- 3 ( cont . ) Of f s e t s i n to Fi x ed Po r t i o n o f t h e Pr o c e s s He ad e r the Th e n e x t 2 4 l o n g wo rd s c o n ta i n t h e h a r d wa r e PC B : c o p i e s o f t h e g en e r a l r eg i s t e r s , The pe r p r o c e s s s t a c k po i n t e r s , a nd t h e m em o r y m a n ag em e n t a nd ASTLVL r eg i s t e r s . fo u r fo r each o ffse t s Symbo l i c h a r d wa r e PC B i s t r e a t ed i n t h e t a b l e a s a s i ng l e e n t i t y . i nd i v i d ua l e l em e n t a r e n o t i n c l ud ed i n t h e ta b l e . S i ze o f F i e l d Us e o f Th i s F i e l d PHDSL PCB 2 4 l o ng wo r d s Co n t a i n s h a r d wa r e p r o c e s s c o n t e x t wh e n p r o c e s s i s n o t c u r r e n t l y e x e c u t i ng Ad d i t i o na l p r o c e s s - s p e c i f i c d a ta PC B . 0 I 1--' Ul F i g u r e o r Tab l e Re f e r en c e s i n Th i s Ma n ua l Sym bo l i c Na m e i s fo und i n the proc e s s h ead e r Fig ur e bel ow the Symbo l i c Na m e S i ze o f Fi e l d Us e o f Th i s F i e l d P H D $W EM PT PG PHD $W-R E S PGCNT PHD $W-R E QPGCNT PHD $W-C W S L X P H D S Q A UT H PR I V P H D $ Q I M AG PR I V PHD S L R E S LS TH P H D $ L I MG C NT P H D S L-P F LTRATE P H D $ L-P F LR E F P H D $ L-T I M REF wo rd wo rd wo rd wo rd q u a d wo r d q u ad wo r d 1 o ng wo rd 1 o ng wo r d l o ng wo rd l o ng wo rd l o ng wo rd l o ngwo rd Co un t of empty p r o c e s s h e a d e r pag e s Re s i d e n t pag e c o un t Re q u i r ed pag e c o un t Co n t i n ua t i o n WS LX Pr i v i l eg e s m a s k f r o m a u t ho r i za t i o n f i l e P r i v i l eg e s m a s k f o r i m a g e i n s t a l l ed w i t h p r i v i l eg e s pa r e Re s o u r c e l i s t h e a d ( no t u s e d ) Imag e c o un te r i n c r em e n t e d by i m ag e r und o wn Pag e f a u l t r a t e ( fo r a ut om a t i c wo r k i ng s e t a d j u s tmen t ) Num b e r of pag e f a u l t s a t e n d o f l a s t i n t e r v a l Time at end of l a s t i n te r v a l = 31 l o ng wo r d s s pa r e 1-1 , Figure 8 -6 h a r d wa r e F i g u r e o r Tab l e Re f e r en c e s i n Th i s Ma n ua l Tab l e 1 8 -1 1 8-1 Ta b l e Tab l e 1 3-2 Ta b l e 1 3-2 Ta b l e 1 3-2 DATA S TRUCTURE DE F IN I T I ONS D. l . 31 PS L - P r o c e s s o r S t a tus Longwo r d Pu r po s e : Lo c a t i o n : Re f e r e nc e s : D. l . 32 Re f e r en c e s : Us ua l Lo c a t i o n : Al l o c a ted f r om : Re f e r e nc e s : De s c r i b e s s t a t e a nd l o c a t i o n o f e a c h v i r t ua l pag e P r o c e s s h e a d e r c o n t a i n s P O a nd P l pag e ta b l e s t h a t d e sc r i b e p r o c e s s a d d r e s s s pa c e . Th e s ys t em pag e t a b l e i n the sys tem h e ad e r c o n t a i n s the s y s t em pa g e t a b l e . Fig ure 1 1-3 Ac t s a s b l oc k h e ad e r fo r a r b i t r a r y d a t a s t r uc t u r e . VM S u s e s o n e to c o n ta i n the a r r a y o f po i n t e r s to swa p file table e n t r i e s a nd pag e file con t r o l blocks . A s e cond i s u s e d to c o n t a i n t h e a r r a y o f po i n t e r s t o e a c h known f i l e l i s t . Depend s o n i t s u s e Th e pag e f i l e a nd swa p f i l e v e c to r is s ta t i c a l l y a l l oca ted i n m od u l e SWAPF I LE . Th e known f i l e l i s th e a d i s a l l o c a t ed f r om no npag ed po o l by SYS I N I T . Impl i c i t r e f e r e n c e s i n F i g u r e 1 1 - 2 2 RBM - Re a l -T i me B i tmap Pu r po s e : Us u a l Lo c a t i o n : Al l o c a t ed f r om : Re f e r e nc e s : D. l . 35 Sys tem PTR - P o i n t e r C o n t r o l Bl o c k Pu r po s e : D . l . 34 VAX/VMS PTE - Pag e Ta b l e En t r y Fo rma ts Pu r po s e : Us u a l Lo c a t i o n : D. l . 33 De s c r i b e s s t a t e o f p r o c e s so r P r o c e s so r i n t e r n a l r eg i s t e r VAX- 1 1 A r c h i t e c t u r e Hand boo k , S e r v i c e s Re f e r e n c e Ma n u a l D e s c r i b e s a v a i l a b l e S PT E s fo r conn e c t- to- i n te r r up t dr iver Po i n ted t o b y E XE $G L R TB I TMAP No n pag ed poo l Ta b l e E-2 RPB - Re s t a r t P a r am e t e r Bl o c k Pu r po s e : Us u a l Lo c a t i on : Re f e r e nc e s : U s e d by powe r f a i l a nd r ec o v e r y r o u t i n e s to save vo l a t i l e p r o c e s so r s t a t e . Us ed b y b ug ch e c k to l o c a t e b o o t s t r a p I /0 d r i v e r a nd a s so c i a t ed s ub r o u t i n e s Ph ys i c a l pag e z e r o o n s ys t em wi th no b ad m emo r y i n the f i r s t 6 4 K bytes T a b l e 2 1 - 3 , Tab l e 2 3 - 1 D- 1 6 DATA S TRUCTURE DE F I N I T I ONS D. l . 36 S EC - S e c t i on Ta b l e E n t r y Pu r po s e : U s ua l Lo c a t i o n : Re fe r e n c e s : D. l . 37 U s u a l Lo c a t i o n : Al l o c a t ed f r om : Re fe r e nc e s : U s ua l Lo c a t i o n : Re f e r e n c e s : D e sc r i b e s s h a r ed m emo r y c o nn e c t e d to s pe c i f i c p r o c e s so r I n l i s t o f s h a r ed memo r y c o n t r o l b l o c k s ( l i s th e a d EXE $G L S HB L I ST ) i n p r o c esso r l o c a l memo r y Nonpag ed po o l Figure 1 1-26 I n i t i a l d e sc r i p t i o n o f a spec i f i c sh a r ed m emo r y control le r ( I ts La s t phy s i c a l pag e o f sha r ed memo r y . p r o c e s s o r - s pec i f i c v i r t ua l a d d r e s s i s s to r ed i n t h e s h a r ed memo r y c o n t r o l b l o c k o n e a c h po r t c o n n e c ted t o the sha r ed memo r y . ) Table 1 1- 3 STS - Re t u r n S t a tus F i e l d De f i n i t i on s Pu r po s e : Re fe r e n c e s : D. l . 41 F u l l y d e s c r i b e s e a c h swa p f i l e i n t h e sys t em S t a t i c a l l y a l l o c a ted i n modul e SWAPF I LE F i g u r e s 1 1 - 2 2 a nd 1 1 - 2 3 , F i g u r e 1 7 - 5 S HD - Sha r ed Memo r y Da ta Pag e Pu r po s e : D. l . 40 the SHB - Sh a r ed Memo r y Con t r o l B l o c k Pu r po s e : D . l . 39 fo r SFT - Swa p F i l e Ta b l e En t r y Pu r po s e : U s ua l Lo c a t i o n : Re f e r e n c e s : D . l . 38 D e s c r i b e s p r o c e s s , g l oba l , o r s ys t em s e c t i o n I n p r o c e s s o r s ys tem h e ad e r i n a r e a a l l o c a ted sec t i o n table entr i e s F i g u r e s 1 1 -6 , 1 1 -7 , a nd 1 1-1 6 , Pa r t I I o f VAX/VM S Sys t em Se r v i c e s Re f e r e nc e Ma n u a l De sc r i b e s r e t u r n s t a t us f r om p r o c ed u r e ( i nc l ud i ng De sc r i b e s c o nd i t i o n name to s y s t em s e r v i c e ) . c o nd i t i o n h a nd l e r . C h a pte r 8 of the VAX/VM S U t i l i t i e s Re f e r en c e Ma n ua l , Append i x C o f t h e VAX-1 1 Run-T i m e L i b r a r y Re f e r e n c e Ma n ua l TQE - T i m e r Queue El ement Pu r po s e : Lo c a t i o n : Al l o c a t ed f r om : Re f e r e n c e s : De sc r i b e s p e nd i ng t i me r or sched u l ed r e que s t I n t i me r queue ( 1 i s thead EXE $G L_T QF L ) N o n pag ed po o l F i g u r e 1 0-1 D- 1 7 wa k e up DATA S TRUCTURE DE F I N I T I ONS D. l . 42 VA - Vi r tua l Add r ess F i e l d De f i n i t i o n s Pu r po s e : Re f e r e nc e s : 0. 1. 43 WQH - Sched u l e r Wa i t Que ue He ad e r P u r po s e : Usua l Lo c a t i o n : Re f e r e nc e s : 0. 1 . 44 L i s thead fo r al l PC Bs o f p r oc e s s e s sched ul i ng s ta te S t a t i c a l l y a l loca ted in mod u l e SDAT Figure 8 - 4 in g i ven WS L - Wo r k i ng Se t L i s t En t ry F i e l d De f i n i t i ons Pu r po s e : U s u a l Lo c a t i o n : Re f e r e nc e s : D. 2 pag e n umbe r fo r S e l e c t s pag e t a b l e and v i r t ua l and pag e f a ul t add ress t r a n s l a t i o n m e c han i sm h a nd l e r F i g u r e 1 2 -1 D e s c r i b e s v i r t u a l pag e t ha t i s a m embe r o f p r o c e s s o r s y s t em wo r k i ng s e t I n wo r k i ng s e t l i s t i n p r o c e s s o r sys tem h e ad e r F i g u r e s 1 1 - 4 a nd 1 1 - 5 C ONSTANTS s ym bo l i c c o d e s Th e f i l e s SYSDEF a nd S TAROEF d e f i ne many s ys tem-w i d e r e so u r c e s , quo ta s , p r i o r i t i e s , a nd s o on . tha t i d en t i f y s t r uc t u r e s , Many o f t h e s e c o n s t a n t s a r e l i s t ed i n e i th e r the VAX/VMS Sys tem Se r v i c e s R e f e r e nc e Ma n u a l o r the VAX/VM S I /O Us e r ' s Gu i d e . Tho s e tha t a r e m o s t c l o s e l y t i ed t o the m a t e r i a l p r e s e n t ed in t h i s m a n ua l are l i sted h e r e . 0. 2. 1 BTD - Boo t s t r a p Dev i c e Cod e s Th e boo t s t r a p d ev i c e c od e s a r e u s ed to i n t e r p r e t t h e c o n t e n t s o f RO t o VMB , t h e p r ima r y bo o t s t r a p p r og r am . B TD $ K MB BTD$K-DM B TD $ K-D L B TD $ K=C ONSOLE 0 1 2 64 MAS S B US Dev i c e R K 0 6 / RK 0 7 R L0 2 Co n so l e B l o c k S to r ag e Dev i c e Th e boo t s t r a p d ev i c e t ype cod e s a r e l i s t ed in Tab l e 2 1 - 2 . D. 2. 2 CA - Co nd i t i o n a l As s em b l y Pa rame t e r s Th e c o nd i t i o na l a s s emb l y p a r a m e t e r s c o n t r o l wh e th e r c e r t a i n c o d e is i nc l ud ed wh e n c om po n e n t s o f VM S a r e a s s em b l ed . Th e s e pa r ame t e r s we r e i mpo r ta n t d u r i ng t h e i n i t i a l d ev e l o pm e n t o f VM S b u t a r e n o l o ng e r us ed . Al l s i m u l a to r cod e h a s b e en r emoved . Al l m e a s u r em e n t c o d e ( u s ed b y D I S PLAY ) i s a l wa ys i nc l ud ed . D- 1 8 DATA STRUCTURE DEFIN I T I ONS CA$ S IMULATOR CA$ M EASURE CA$ MEASURE I OT - D.2. 3 1 2 4 VMS Runn i ng on S i m u l a to r Ac c um u l a t e Sta t i s t i c s f o r D I S PLAY C o un t I /0 T r a n s a c t i o ns f o r D I S PLAY DYN - Da t a S t r uc t u r e Type De f i n i t i ons Al l s t r uc t u r e s a l l o c a t e d f r om no npag ed and pag ed d ynam i c m em o r y have a un i q u e c od e i n a t ype f i e l d ( a t o f f s e t x y z $ B TYPE = 1 0 ) . SDA u s e s the c o n t e n t s o f t h i s f i e l d in d ump i ng po o l a nd i n a utoma t i c f o r m a t t i ng of a d a ta s t r uc t u r e wi th t h e F ORMAT c ommand . Th e r e s u l t s o f i nv o k i ng th e $ DYNDEF ma c ro a r e s umma r i ze d i n Ta b l e D-4 . D. 2. 4 I 0 7 x x - I /0 Spa c e Ad d r ess Spec i f i c a t i o n s Th e d i v i s i o n o f phys i c a l add r e s s b e twe en ma i n m emo r y a d d r e s s e s and I / O s pa c e add r e s s e s i s C PU d e pe nd e n t . D. 2 . 4 . 1 I 0 7 5 0 - VAX- 1 1 / 7 5 0 Phys i c a l Add r ess Spa c e De f i n i t i o n s Phys i c a l add ress s pa c e o n the VAX- 1 1/7 5 0 i s d e f i n ed by a 2 4 -b i t a d d r e s s a nd i s e v e n l y d i v i d ed b e twe e n m a i n m emo r y ( Phys . Ad d r . < 2 3 > 0) a nd I /O s pa c e a d d r e s s e s ( Ph ys . Ad d r . < 2 3 > = 1 ) . Ten o f t h e s i x t e e n s l o t po s i t i o ns a r e f i x ed . Th u s i t i s po s s i b l e t o i d en t i f y t h e ad d r e s s s pa c e fo r UB I O r eg i s t e r s a nd MASS BUS 0 r eg i s t e r s . = I 0 7 5 0 $AL I OBASE F20000 ( hex ) I 0 7 5 0 $AL MBBAS E F 2 8 0 00 ( hex ) I 0 7 5 0 $AL UBBASE F 30000 (hex ) I 0 7 5 0 $AL NNEX I 0 7 5 0 $AL PERNEX 16 2000 (d ec ) ( hex ) I 0 7 5 0 $AL UB O S P FCO O O O (hex ) Ba s e Ad d r e s s o f Reg i s t e r S pa c e fo r Sl o t 1 6 Reg i s t e r B a s e Ad d r e s s o f S pa c e fo r MAS S B U S 0 Reg i s t e r B a s e Ad d r e s s o f Spa c e fo r UN I B US 0 Numbe r o f Ad a p t e r s S i z e o f Reg i s t e r Spa c e fo r E a c h Nexus Ba s e Ad d r e s s o f UN I B US 0 Ad d r e s s Spa c e Ad a pt e r a s s i g nm e n t s fo r t h e f i r s t t e n s l o t s a r e f i x ed . c o n s ta n t s d e sc r i b e the s e a s s i g nm e n t s . I 0 7 5 0 $C S L M EM O - I 0 7 5 0 $C S L M PM O - I 0 7 5 0 $ C S L M PM 1 - I 0 7 5 0 $ C S L M PM 2 - I 0 7 5 0 $ C S L MB O - I 0 7 5 0 $ C S L MB 1 - I 0 7 5 0 $ C S L MB 2 - I 0 7 5 0 $ C S L MB 3 - I 0 7 5 0 $ C S L UB O - I 0 7 5 0 $ C S L UB 1 0 1 2 3 4 5 6 7 8 9 Memo r y Co n t r o l l e r M u l t i pa r t Memo r y 0 M u l t i pa r t Memo r y 1 Mul t i pa r t Memo r y 2 MAS SBUS 0 MAS SBUS 1 MAS S B US 2 MAS SB US 3 UN I B US 0 UN I B US 1 D- 1 9 Th e fo l l owi ng DATA STRUCTURE D E F IN I T I ONS Ta b l e D - 4 Dyn am i c Da t a S t r uc t u r e Type Cod e s St r uc t u r e Type Symbo l i c Nam e Co d e DYN $C ADP DYN $C ACB DYN $C AQB DYN $C C EB DYN $C C RB DYN $C DDB DYN $C FCB DYN $C FRK DYN $C I DB DYN $C I R P DYN $C LOG DYN $C PCB DYN $C P QB DYN $C RVT DYN $C T QE DYN $C UCB DYN $C VC B DYN $C WCB DYN $C B UF I O DYN $C TYPAHD DYN $C G S D DYN $C MVL DYN $C N E T DYN $C KF I DYN $C MTL DYN $C B RDC S T DYN $C C XB DYN $C NDB DYN $C S SB DYN $C D PT DYN $C J PB DYN $C PB H DYN $C PDB DYN $C P I B DYN $C PF L DYN $C S F T DYN $C PTR DYN $C K F H DYN $C RVX DYN $C E XTGSD DYN $C S HMGS D DYN $C S HB DYN $C MBX DYN $C I R PE DYN $C S LAVCEB DYN $C S HM C EB DYN $C J I B DYN $C TWP DYN $C RBM DYN $C=VCA 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 32 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 Ad a pt e r Co n t r o l Bl o c k AST Co ntr o l Bl oc k ACP Que ue B l o c k Common Ev e n t Bl oc k Channe l Reque s t Bl oc k Dev i c e Da t a B l o c k F i l e Co n t r o l B l o c k Fo r k B l oc k I n te r r upt D i s pa tch Bl o c k I /O Re que s t Pac ke t Log i c a l Name B l o c k So ftwa r e P r o c e s s Co n t r o l Bl oc k P r o c e s s Quo ta Bl o c k Re l a t i v e Vo l ume Ta b l e T i m e r Que ue El emen t Un i t Co n t r o l Bl oc k Vo l um e Co n t r o l B l o c k W i ndow Co n t r o l Bl o c k Bu f fe red I /O Bu f f e r Te r m i n a l Type-Ah e ad Bu f f e r G l o b a l Sec t i o n De sc r i pto r Mag ne t i c Ta pe Vo l um e Li s t N e two r k Me s sag e B l o c k Known Fi l e En t r y Mounted Vo l um e L i s t En t r y B r o ad c a s t Me s sag e B l o c k Compl e x Cha i n ed Bu f f e r N e two r k No d e De sc r i pto r Bl o c k Log i c a l L i n k Subcha nnel Sta t us B l oc k Dr i v e r Pro l og ue Tab l e Job Pa ram e t e r Bl o c k Pe r fo rmanc e Bu f f e r He ad e r Per fo rm anc e Da ta B l o c k Pe r fo rman c e I n fo rma t i o n B l oc k Pag e F i l e Co n t r o l Bl oc k Swa p F i l e Tab l e En t r y Po i n t e r Co n t r o l Bl o c k Known Fi l e Imag e He ad e r R e l a t i v e Vo l um e Tab l e Ex tens i o n Ex tend ed G l obal Sec t i o n De sc r i pto r Sha r ed Mem o ry G l o b a l Sec t i o n Desc r i pto r Sha r ed Mem o ry Co n t r o l Bl oc k Ma i l bo x Co n t ro l B l o c k Ex tend ed I /O Reque s t Pa c k e t S l ave Common Ev e n t B l o c k Sh a r ed Mem o ry Ma s t e r Common Ev e n t B l o c k J o b In fo rma t i o n B l o c k Te rm i n a l D r i v e r Wr i te Pa c ke t ( $ TTYDEF) Real T i m e S PT B i tm a p D i s k Vo l um e Ca che Bl oc k DYN $C S PEC IAL DYN $C S HRBUF I O 128 1 28 Cod e tha t d e f i n e s b eg i nn i ng o f s pec i a l cod e s Sh a r ed Mem o ry Bu ffe r ed I/O Bu f fe r D- 2 0 DATA STRUCTURE DEF IN I T I ONS 0. 2. 4 . 2 I 07 8 0 - VAX- 1 1/ 7 8 0 Phys i c a l Add r e s s S pa c e De f i n i t i o n s Ph ys i c a l add r e s s s pa c e o n t h e VAX- 1 1 / 7 8 0 i s d e f i ned by a 3 0 -b i t 0) a d d r e s s a nd i s eve n l y d i v i d ed b e twe e n m a i n memo r y ( Phys . Ad d r . < 2 9 > a nd I /O spa c e a d d r e s s e s ( Ph ys . Ad d r . < 2 9 > 1) . = I 0 7 8 0 $AL I OBAS E 20000000 (hex ) I 0 7 8 0 $A L NNEX I 0 7 8 0 $AL-P E RNE X 16 2000 ( d ec ) ( h ex ) I 0 7 8 0 $A L UB OS P 20100000 (hex ) 0. 2 . 5 Ba s e Ad d r e ss o f Reg i s t e r Spa c e fo r TR 0 N umbe r o f Ad a pt e r s ( N e x u s ) S i z e o f Reg i s t e r S pa c e f o r Each N e x u s Ba s e Ad d r e s s o f UN I B US 0 Ad d r e s s Spa c e I PL - P r o c e s s o r P r i o r i ty Leve l De f i n i t i o n s I PL l ev e l s tha t a r e u s e d f o r s yn c h r o n i za t i o n a nd o th e r pu r po s e s by VM S a r e g i ven s ymbo l i c n a m e s . I P L $ ASTD E L I P L$ -S C H E O I PL $- I O PO S T I PL $ -Q U E UEAST I PL $-S YN C H I PL $-T IM E R I PL $-MA I LB OX I PL $-HWC LK I PL $=POWER 2 3 4 6 7 7 11 24 31 AST De l i v e r y I n t e r r up t R e s c h e d u l i ng I n t e r r up t I /O · Po s t p r o c e s s i ng In t e r r up t Fo r k L e v e l Used fo r AST Que u i ng S y s t em Wi d e Syn c h r o n i za t i o n Lev e l S o f twa r e T i m e r I n t e r r up t Fo r k I PL f o r Ma i l box D r i v e r H a rdwa r e C l o c k I n t e r r up t B l o c k Po we r Fa i l I n t e r r up t A powe r fa i l i n te r r upt c a u s e s I P L to be r a i s ed to 3 0 , no t 3 1 . Ra i s i ng I PL to 31 b l o c k s a l l i n te r r up t s a nd s e r i o u s c o nd i t i o n s un t i l I PL i s l owe r ed . Th e I PL va l ue s u s e d f o r s yn c h r o n i z a t i o n a r e l i s t ed i n Tab l e 2 4 - 1 . Th o s e v a l u e s tha t c o r r e s po nd to s o f twa r e i n t e r r upt I PL v a l u e s a r e a l so l i s t ed i n Ta b l e 4 - 1 . 0. 2 . 6 J P I - $GETJ P I Da t a I d e n t i f i e r De f i n i t i on s Th e $ J P I DE F m a c r o i s u s e d i n a rg umen t l i s t s to the $G E TJ P I s ys tem s e rv i c e to i d en t i f y tho s e d a t a e l em e n t s t h a t a r e be i ng r e q u e s t ed . Th e s ym bo l i c n ame s d e f i n ed by th i s m a c r o a r e l i sted i n Pa r t I I o f the VAX/VM S Sys t em Se r v i c e s Re f e r enc e Ma n ua l . 0. 2 . 7 MSG - Sys t em Wi d e Ma i l bo x Me s s a g e Types Th e $MSG D E F m a c ro d e f i n e s codes t o i d en t i f y m a i l bo x m e s s ag e s . Th e s ymbo l i c n ame s d e f i n ed by th i s m a c r o a r e l i s t ed i n Append i x A o f the VAX/VMS Sy s t em S e rv i c e s Re f e r enc e Ma n ua l . 0- 2 1 DATA STRUCTURE DEF IN I T I ONS D. 2. 8 NDT - Nexus ( Ad a pt e r ) Dev i c e Type Ea c h e x t e r n a l a d a p t e r h a s an a s s o c i a t ed c o d e that is used by VMB , IN I T , a nd the powe r r ec o v e r y r o ut i ne to d e t e rm i ne wh i c h e ac h a d a pte r - s pe c i f ic ac t i on sho u l d b e t a k e n to ( re ) i n i t i a l i ze adapte r . NDT$ MEM 4N I NDT$-M EM 4 I NDT $-M EM 1 6N I NDT $-M EM 1 6 I NDT $-M B NDT $-UB O NDT$-UB l N DT $-UB 2 N DT$-UB 3 NDT $-DR 3 2 NDT$-M PM O NDT $-M PM l NDT$-M PM 2 NDT$=M PM 3 D. 2.9 8 9 16 17 32 40 41 42 43 48 64 65 66 67 4 K Memo r y - No t I n t e r l e a ved 4 K Memo r y - I n te r l eaved 1 6K Mem o r y - No t I n te r l ea v ed 1 6K Mem o r y - I n t e r l eaved MAS S B US UN I B US 0 UN I BUS 1 UN I B US 2 UN I B US 3 DR 3 2 Mul t i pa r t Mem o r y 0 Mul t i pa r t Memo r y 1 Mul t i pa r t Memo r y 2 Mul t i pa r t Memo r y 3 PQL - P r o c e s s Quo t a L i s t C o d e s Th e $ P QLDEF m a c r o d e f i n e s s ym bo l i c c o d e s t h a t a r e pa s s ed t o t h e C r e a te P r o c e s s s ys tem s e rv i c e . Th e s e s ym bo l s a r e l i s t ed i n Pa r t I I o f the VAX/VM S Sys tem Se r v i c e s Re f e r enc e Ma n ua l . D. 2. 10 PR - P r o c e s so r Reg i s t e r De f i n i t i o n s Th e $ PRDE F ma c r o d e f i n e s sym bo l i c names fo r t h e processo r internal r eg i s t e r s . Some of the s e r eg i s t e r s a r e d e f i n ed a s pa r t o f t h e VAX a r c h i t ec t u r e a nd a r e fo und i n a l l p r o c e sso r s . O th e r s a r e spec i f i c to a s i ng l e C PU . Th e internal p r o c e s so r r eg i s t e r s a r e l i s t ed in Append i x A o f the VAX/VM S Sy s t em S e r v i c e s Re f e r e n c e Ma n ua l . P r o c e sso r r eg i s t e r s a r e d e sc r i b ed i n t h e VAX Ha rdwa r e Ha ndbo o k . D. 2 . 11 PRI - P r i o r i ty I n c r em e n t C l a s s De f i n i t i o n s Th e $ PR I DE F m a c r o d e f i n e s the pr i o r i ty i nc r em e n t c l a s s e s . Th e s e c o n s t a n t s a r e t yp i c a l l y l o ad ed i n to R2 b e fo r e S C H $ C HS E o r SC H $ C HS E P i s c a l l ed t o m a k e a p r o c e s s c om p u t a b l e . PR I $ N U L L PR I $- I OC OM PR I $-R E SAVL PR I $-T IMER PR I $ -TOC OM PR I $-T I C OM 0 1 2 2 3 4 No Pr i o r i ty Bo o s t I /O Compl e t i o n Re so u r c e Av a i l a b l e T i m e r Re qu e s t Compl e t e Te rm i n a l Output Compl e t i o n Te rm i n a l Output Compl e t i o n Ta b l e 8 - 3 s hows t h e c o r r e s po nd e n c e be twe en i nc r em e n t c l a s s e s a c t ua l boo s ts . D- 2 2 a nd the DATA STRUCTURE DEFIN I T I ONS D. 2. 12 PRT - P r o t e c t i o n F i e l d D e f i n i t i ons Th e $ PRTDE F m ac r o d e f i n e s the d i f f e r e n t c o n t e n t s o f the p r o te c t i o n f i eld in a pag e t ab l e e n t r y . ( Th e $ PTEDEF m a c r o d e f i n e s s i m i l a r c on s t a n t s , e x c e p t t h a t t h e PRT $ C x x x s ym bo l s a r e v a l u e s i n t h e r a ng e f rom 0 to 1 5 wh i l e t h e PTE $ C-x x x s ym bo l s have sh i f t e d t h e s e v a l u e s i n to b i t po s i t i o n s < 3 0 : 2 7 > . PRT $ C NA PRT $C-R E S E RVE D PRT $C-KW PRT $C-KR PRT $C-UW PRT $C-EW PRT $C-E RKW PRT $C-E R PRT $C-SW PRT $C-S R EW PRT $C-S RKW PRT $C-S R PRT $C-URSW PRT $C-UREW PRT $C-URKW PRT $C-UR 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 No Ac c e s s R e s e rved K e r n e l Wr i t e K e r ne l Re ad U s e r Wr i t e E x e c u t i v e Wr i t e E x e c u t i ve Read , Ke r n e l Wr i t e E x e c u t i v e Re ad S u pe rv i so r Wr i t e S upe rv i so r Read , E x e c u t i v e Wr i te Supe rv i so r Re ad , Ke r n e l Wr i te S upe rv i so r Re ad U s e r Re ad , Supe rv i so r Wr i t e U s e r Read , Ex e c u t i v e Wr i te U s e r Re ad , Ke r n e l Wr i t e U s e r Read Th e p r o tec t i o n c od e s a r e l i s t ed i n Ta b l e 1 1 - 1 . 0. 2 . 13 PRV - P r i v i l eg e B i t De f i n i t i o n s Th e $ PRVOE F ma c r o d e f i n e s s ymbo l i c n am e s f o r all r e c og n i zed VMS p r i v i l eg e s . Th e s ymbo l i c n am e s p r od uc ed by th i s m a c r o a r e d e sc r i b ed i n Pa r t I I o f t h e VAX/VM S Sys tem Se r v i c e s Re f e r en c e Ma n ua l . 0. 2. 14 RSN - R e so u r c e Name De f i n i t i o ns Th e $ RSNDE F m a c r o d e f i n e s c o n s ta n t s tha t i nd i c a t e t h e pa r t i c u l a r r e so u r c e a p r o c e s s i s wa i t i ng f o r wh e n i t i s i n the MWA I T s ta te . Th e r e so u r c e n um b e r i s s to r ed i n the PC B $ L E FWM f i e l d i n t h e PC B . RSN$ A S TWA I T RSN $ -MA I LB OX RSN$-N PDYNMEM RSN$-PG F I L E RSN$ -PG DYNMEM RSN $ -B RKTHRU RS N $- IAC LOCK RSN $ -J QUOTA RSN$=MAX 1 2 3 4 5 6 7 8 9 Wa i t f o r De l i v e r y o f a n AST Wa i t f o r Ma i l b ox Spa c e Wa i t f o r No n pag ed Po o l Spa c e Wa i t f o r Spa c e i n t h e Pag e F i l e Wa i t fo r Pag ed Po o l Spa c e Te rm i n a l B r o ad c a s t I m ag e Ac t i v a t i o n I n t e r l o c k J o b Po o l ed Quo ta Ma x i m um Re s o u r c e Numb e r Re s o u r c e s a r e l i s t ed i n Ta b l e 8 - 2 . 0- 2 3 DATA S TRUC TURE DEF I N I T I ON S D. 2 . 15 S G N - SYSG EN Pa r am e t e r C o n s t a n t De f i n i t i o n s T h e $ SGNDE F m a c r o i s used b y m od u l e s i n t h e ex ec ut i v e fo r pa r a me t e r s t h a t h a v e n o t b e e n mad e a d j us ta b l e b y SYSBOOT . Mo s t o f t h e s ym bo l i c c o n s t a n t s d e f i n ed b y th i s m a c r o o n l y h av e h i s to r i c a l i n t e r e s t a nd are no l ong e r u s ed b y VM S . On l y t h e c o n s ta n t s s t i l l u s ed b y VM S a r e l i sted h e r e . SGN $ C S FTMAX SGN $ C-S YSVE C PG S 3 3 SGN $ C M INWSCNT 10 N umb e r o f Swa p F i l e Tab l e En t r i e s Num b e r o f Pag e s Used f o r Sys t em S e r v i c e Ve c to r s Abso l u t e M i n i m um Wo r k i ng S e t S i z e Two o th e r SGN $ C n am e c o n s t a n t s a r e d e f i ned i n mod u l e SWAPF I L E a nd u s ed by VM S . SGN $ C PAG F I LCNT SGN $ C-PF L I BAS D. 2 . 16 N umbe r o f Pag e F i l e s Ba s e I nd ex f o r Pag e F i l e s 2 3 S S - S y s t em S e rv i c e Compl e t i on Cod e s Th e $ S S D E F m a c r o d e f i n e s a l l s ys t em w i d e s t a t us c o d e s . Append i x A o f t h e VAX/VMS Sys tem Se rv i c e s Re f e r enc e Ma n u a l l i s t s the symbo l i c names o f a l l SS$ name symbo l s . ( Th e s e sym bo l s a r e d e f i n ed in a s e pa r a t e f i l e c a l l ed [ VM S L I B . SRC ] SSMSG . MDL . } D. 2 . 17 S TATE - Sched u l i ng S t a t e s Th e $ S TATEDEF ma c r o d e f i n e s s ymbo l i c n am e s fo r a l l s c h ed u l i ng s ta t e s . No te tha t the pref i x fo r each o f the sym bo l s i s SCH$C_ and no t S TAT E $ C • S C H $ C C O LPG S C H $ C-MWA IT 1 2 S C H $C CEF S C H $C-PFW S C H $ C- L E F S C H $C- L E FO S C H $ C-H I B S C H $ C-H I B O S C H $ C-S U S P S C H $C -S US PO S C H $ C-FPG S C H $ C-C OM S C H $C -C OMO S C H $ C-C UR 3 4 5 6 7 8 9 10 11 12 13 14 Th e sc hed u l i ng Figure 8 - 5 . states are C o l l i d ed Pag e Wa i t M i sc e l l a n e o u s Wa i t ( Re so u r c e Wa i t ) ( Mu t e x Wa i t } C ommon Ev e n t Fl ag Wa i t Pag e Fa ul t Wa i t Lo c a l Ev e n t F l ag Wa i t ( Re s i d en t } Lo c a l Even t Fl ag Wa i t ( O u t swa pped } H i b e r n a t i ng ( Re s i d e n t } H i b e r n a t i ng ( Ou t swa pped } S u s pe nd ed ( Re s i d e n t } S u spend ed ( Ou t swa pped ) F r e e Pag e Wa i t Comput a b l e ( and Re s i d e n t } Comput a b l e ( Ou t s wa pped } C u r r ent Process l i s t ed in D- 2 4 Ta b l e 8 - 1 a nd p i c t u r ed in DATA STRUCTURE DEF IN I T IONS D. 3 DATA STRUCTURES USED BY THE I/0 SYSTEM Th e r e a r e t wo c la sses o f s ymbo l i c d e f i n i t i o n s u s e d by the I /0 s ub s y s tem . Da t a s t r uc t u r e s used by d ev i c e d r i v e r s a r e p i c t u r ed i n ( r e f e r r ed Appe nd i x A o f the VAX/VM S G u i d e t o Wr i t i ng a Dev i c e D r i v e r to a s " Dev i c e D r i v e r s " ) . Symbo l i c d e f i n i t i o n s s p e c i f i c to e a c h d ev i c e c l a s s a r e l i s t ed i n t h e a ppr o p r i a t e c h a p t e r s o f the VAX/VMS I /0 U s e r ' s f unc t i o n c od e s a nd D ev 1 c e I /0 Th e Us e r ' s G u i d e ) . ( " I /O Guide Sys tem S e r v i c e s I n fo rma t i o n B l o c k a r e a l s o d e sc r i b ed i n t h e VAX/VM S Re f e r e nc e Ma n ua l ( " Sys t em S e r v i c e s " ) . Da t a S t r uc t ur e s Us ed by Dev i c e Dr i v e r s ( De f i ned i n S Y S D E F a nd s to r ed i n L I B . M LB ) S t r uc t u r e Name Ad a p t e r C o n t r o l B l o c k A C P Q u e ue B l o c k C h a nne l Co n t r o l B l o c k Ch a n n e l ( Co n t r o l l e r ) Re que s t B l o c k Dev i c e Da t a B l o c k D r i v e r D i s pa tch Ta b l e D r i v e r P r o l og ue Ta b l e I n t e r r up t D i spa tch B l o c k I /0 Re qu e s t Pa c k e t I /0 R e qu e s t Pa c k e t Ex t e n s i o n MAS S B US Ad a p t e r Reg i s t e r O f f s e t s Te rm i n a l D r i ve r Wr i t e Reque s t B l o c k UN I B U S Ad a p t e r Reg i s t e r Of f s e t s UN I B US I n t e r c o n n e c t Reg i s t e r O f f s e t s Un i t C o n t r o l B l o c k C R B I n t e r r up t T r a n s f e r Ve c to r S t r uc t u r e Ac ronym Desc r i bed i n ADP AQB CCB CRB DDB DDT DPT !DB IRP I RPE MBA TTY UBA UB I UC B VE C Dev i c e D r i v e r s Dev i c e Dev i c e Dev i c e Dev i c e Dev i c e Dev i c e De v i c e Dev i c e Dev i c e Dr i v e r s Dr i v e r s Dr i v e r s Dr i v e r s Dr i v e r s Dr i v e r s Dr i v e r s Dr i ve r s Dr i v e r s Dev i c e Dev i c e Dev i c e Dev i c e Dr i v e r s Dr i v e r s Dr i v e r s Dr i v e r s Da t a S t r uc t u r e s Used b y Dev i c e Dr i v e r s ( De f i ned i n S TARD E F a nd s to r ed i n bo t h S TARLE T . MLB a nd L I B . MLB ) Ac r o nym De sc r i bed i n Ca rd Read e r S t a tus B i t s Dev i c e Ad a p t e r , Typ e , a nd C l a s s De f i n i t i o n s Dev i c e Ch a r ac te r i s t i c s Dev i c e I n fo rma t i o n B l o c k CR DC I /0 Us e r ' s G u i d e I /0 Us e r ' s G u i d e DEV DIB I /0 Func t i o n Co d e De f i n i t i o n s IO L PA- 1 1 Cha r a c t e r i s t i c s L i n e P r i n t e r Ch a r a c t e r i s t i c s Mag t a pe S t a t us B i t s P r i n te r/Te rm i n a l Ca r r i ag e Co n t r o l Spec i f i e r s Spec i a l Symbo l s fo r Te rm i n a l D r i v e r DRl l -W Dev i c e C h a r a c t e r i s t i c s DR 3 2 Command Ta b l e and Pa c k e t De f i n i t i o n s DMC - 1 1 S t a t us a nd Ch a r a c t e r i s t i c s LA LP MT PC C I /0 U s e r ' s G u i d e I /O Us e r ' s G u i d e Sys t em Se r v i c e s I /O Us e r ' s G u i d e Sys t em Se r v i c e s I /O Us e r ' s G u i d e I /O Us e r ' s G u i d e I / O Us e r ' s Gu i d e S t r uc t u r e Name D- 2 5 TT XA XF XM I/0 I /0 I /0 I /0 User ' s Us e r ' s Us e r '· s Use r ' s Gu i d e Gu i d e Gu i d e Gu i d e DATA STRUCTURE DEF I N I T I ONS D. 4 DATA STRUCTURES USED B Y F I LES-1 1 Th e d a t a s t r uc t u r e s used by t h e f i l e AC P s a nd a s so c i a te d util ities s uc h a s I N I T a nd MOUNT a r e o ut s i d e t h e s c o pe o f t h i s m a n ua l and a r e l i s t ed h e re fo r c ompl e te n e s s . Any i nc i d en t a l r e fe r e n c e s are i nd i c a te d . Th e ANS I m a g n e t i c t a pe l a b e l s a r e p i c t u r ed i n Append i x B o f the VAX- 1 1 Re c o rd Ma n ag em e n t S e r v i c e s Re f e r en c e Ma n ua l ( " RMS Re f e r en c e " ) . Th e At t r i b u t e Li s t De sc r i pto r ( ATR ) and Fi l e Id e n t i f i c a t i o n B l o c k ( F I B ) a r e d e sc r i b ed i n the VAX/VMS I /O Us e r ' s Gu i d e . Da t a S t r uc t u r e s U s ed by t h e F i l e Sys tem ( De f i ned in SYSDEF a nd s t o r ed in L I B . MLB ) S t r uc t u r e Name Ac ronym AC P I /0 B u f fe r Pa c k e t AC P Me s s a g e to B a d B l o c k S c a n Compl e x Ch a i ned B u f f e r E O F l ANS I Mag n e t i c T a pe La b e l E O F 2 ANS I Mag ne t i c Ta pe La b e l E O F 3 ANS I Mag n e t i c Ta pe La b e l Fi l e Con t r o l B l o c k HDR l ANS I Magne t i c Ta pe La b e l HDR 2 ANS I M a g ne t i c Ta pe La be l HDR 3 ANS I Mag n e t i c Ta pe La b e l Mo un t e d Vo l um e L i s t En t r y Mag n e t i c Ta pe Vo l um e L i s t F i l e Name B l o c k Re l a t i ve Vo l um e Ta b l e Re l a t i v e Vo l um e Ta b l e Ex t e n s i o n Vo l ume C a c h e B l o c k Vo l ume C o n t r o l B l o c k VO L ! ANS I Ma g n e t i c Ta pe La b e l Wi nd ow C o n t r o l B l o c k AIB BBS C XB EOl E02 E03 FCB HD l HD2 HD3 MTL MVL NMB RVT RVX VCA VC B VL l WCB Desc r i bed i n RMS Re f e r e n c e RMS Re f e r e nc e RM S Re f e r e n c e RM S Re f e r e n c e RM S Re f e r e nc e RMS Re f e r e n c e RM S Re f e r e nc e Da t a S t r uc t u r e s U s ed by t h e F i l e Sys tem ( De f i n ed in S TARDEF and s to r ed in bo t h S TARLE T . M LB a nd L I B . MLB ) S t r uc t u r e Name At t r i b u t e Li s t De s c r i pt i o n Fi l e Iden t i f ic a t i o n Block F i l e I d en t i f i c a t i o n D- 2 6 Ac ro n ym Desc r i b ed i n ATR FIB FID I /0 Us e r ' s Gu i d e I /0 Us e r ' s G u i d e DATA S TRUCTURE DEFIN I T I ONS D. S M I SCELLANEOUS DATA STRUCTURES AND C ONSTANTS Th i s s ec t i o n l i st s t h e d a ta s t r uc t u r e s a nd c o n s t a n t s t h a t a r e d e f i ne d in SYSDE F . MDL o r S TARDE F . MDL b u t a r e no t m e n t i o n e d i n th i s m a n ua l . A d e s c r i p t i o n o f a n y o f the s e s t r uc tu r e s c an b e o b t a i ne d by l o o k i ng at t h e m i c ro f i c h e l i s t i ng o f t h e f i l e i n wh i c h the s t r uc t u r e i s d e f i n ed . Ve r y f e w o f t h e s e s t r uc t u r e s a r e d e sc r i b ed e l s e wh e r e in the d o c um e n t a t i o n s e t . T h e c onnec t- to- i n t e r r up t f ac i l i ty i s d e sc r i b e d i n t h e VAX/VM S Re a l - T i m e Us e r ' s Gu i d e ( " Re a l -T i m e " ) . Some of the s ym b i o n t manag e r r eq ue s t c od e s are l i s t ed in t h e VAX/VM S Sys tem S e r v i c e s Re f e r enc e Ma n ua l . Th e T PARS E c o n t r o l b l o c k i s p i c t u r ed in the VAX- 1 1 Run- T i m e L i b r a ry Re f e r en c e Ma nua l ( " RT L Re f e r e nc e " ) . M i sc e l l a n e o us Da t a S t r uc t u r e s ( De f i ned i n SYS D E F a nd s to r ed i n L I B . M LB ) S t r uc t u r e Name Ac ronym Gen e r a l i z e d Name S t r i ng De s c r i pto r Co n f i g u r a t i o n C o n t r o l B l o c k C o n n e c t - to - I n t e r r up t De f i n i t i o n s E r r o r L o g Al l o c a t i o n Bu f f e r Head e r C r o s s L i n k e r Imag e He a d e r Fo rm a t RM S Impu r e A r e a O f f s e t De f i n i t i o n s Pe r fo rma n c e Bu f f e r He ad e r Dev i c e Pe r fo rma n c e Da t a B l o c k Pe r fo rma n c e I /O I n f o rm a t i o n B l o c k I n t e r pr o c e s so r Re que s t B l o c k De f i n i t i o n s Remo t e Dev i c e P r o to c o l De f i n i t i o n s U s e r Au t ho r i za t i o n F i l e Re c o r d Fo rma t ABD AC F C IN ERL I HX IMP PB H PDB PIB PRQ RDP UAF De sc r i be d i n Re a l -T i m e M i sc e l l a n e o us Da t a S t r uc t u r e s ( De f i n ed i n S TARD E F a nd s to r ed i n bo th S TARL E T . M LB a nd L I B . MLB ) Ac ronym S t r uc t u r e Name Comma nd La ng uag e I n t e r f a c e De f i n i t i o n C L I S e r v i c e Re que s t Cod e s G e n e r i c Cod e s f o r Command Ve r b s D e t a c hed J o b I n i t i a t e Me s s ag e Ope r a t o r Commun i c a t i o n Me s s ag e Typ e s S ymb i o n t Ma nag e r Jo b Re c o r d He a d e r Symb i o n t Ma n ag e r Qu e ue He a d e r S ymb i o n t Ma n ag e r Re q ue s t Cod e s Symb i o n t Que ue He a d e r Rec o r d Symb i o n t Manag e r Que u e Re c o r d Sym b i o n t Que ue Re c o r d Enve l o pe S t r uc t u r e T PARSE Co n t r o l B l o c k D-2 7 CLI C L I S E RV C L IVE RB DJ I O PR SJH SMQ SMR S QH S QR SYM T PA De sc r i be d i n Sys t em Se r v i c e s RTL Re f e r e n c e DATA S TRUCTURE D E F I N I T I ONS Th e $ EMBDEF mac r o , wi th o n e of f o u r t e e n d i f f e r e n t pa r am e t e r s , d e f i ne s the v a r i o u s e r r o r m e s s ag e b u f f e r s u s e d b y t h e e r r o r l og g e r . Th e b u f f e r h e ad e r a nd the e r r o r l og e n t r y f o r s ys t em c r a s h e s a r e d e sc r i b ed i n Ta b l e 7 - 1 . Th e y a r e i nc l ud ed i n th i s l i s t fo r compl e t en e s s . E r r o r Log Me s s ag e Bu f f e r s ( De f i n ed i n S Y S D E F a n d s to r ed i n L I B . M LB ) Ac r onym S t r uc t u r e Name Bu f f e r H e a d e r En t r y Type De f i n i t i o n s EMB , HDDE F EMB , ETDEF No n f a t a l B ug c h e c k E r r o r C r a sh/Re s t a r t E r r o r ( Fa t a l Bug c h e c k ) Dev i c e E r r o r Ma c h i n e Ch e c k Log S B I Fa ul t s a nd As yn c h r o no us Wr i t e E r r o r s So f t ECC E r r o r s a n s S B I Al e r t Sys tem Se r v i c e M e s sag e s Sys tem S t a r t up M e s sag e T i m e S tamp M e s sag e UN I B US E r r o r S umm a r y UN I B US Ad a p t e r Und e f i n ed I n t e r r up t Vo l ume Mo un t/D i sm o un t Me s s ag e EMB , BCDEF EMB , CRDE F EMB , DVD E F EMB , MC D E F EMB , S BDEF EMB , S EDEF EMB , S SDEF EMB , SUDEF EMB , TSDEF EMB , UEDEF EMB , U I DE F EMB , VMDEF D- 2 8 APPEND I X E S I Z E OF SYSTEM VI RTUAL ADDRES S SPAC E The e x e c u t i v e i ma g e SYS $ S YS TEM : SYS . EXE c o n ta i n s the o pe r a t i ng s ys tem code fo r VM S but v e r y l i t t l e of the d a ta . Many o f the d a t a s t r uc t u r e s t h a t VMS u s e s a r e n o t c r e a t ed un t i l t h e s ys t em i s b o o t s t r a pped , so that the s t r uc t u r e s i z e s c a n b e d e t e rm i ned f rom the appro p r i a t e S YSBOO T pa r am e t e r s . Th i s a ppend i x d e sc r i b e s the r e l a t i o n sh i ps b e twe e n these SYSB OOT p a r ame t e r s a nd t h e po r t i o n s o f s ys t em add r e s s s pa c e who s e s i z e s t h e y d e t e rm i n e . I n t h e equa t i o n s tha t a ppe a r i n th i s a ppe nd i x , t wo c ommo n features d om i n a t e . One feature i s d i v i s i o n b y 5 1 2 , the n umbe r o f b y t e s i n a p ag e . Th i s i s d o ne wh e n ev e r the i n put pa r am e t e r i s a n umbe r o f b y t e s , s uc h a s the N PAG E DYN S Y S B OO T p a r am e t e r o r a n e x p r e s s i o n fo r the n umbe r o f bytes i n a process head e r . I f 5 1 1 i s added to an e x p r e s s i o n f o r a n umbe r o f b yt e s b e fo r e the i n t eg e r d i v i s i o n t a k e s pl ace , th i s r e p r e s e n t s a r o und i ng u p t o the n ex t h i g h e s t pag e bo und a r y . Th e s e c o nd f e a t u r e i s the n umbe r 1 2 8 a ppe a r i ng i n expr ess i ons tha t c o un t a n umbe r o f pag e s f o r wh i c h s ys t em pag e t a b l e e n t r i e s a r e n e ed ed . Th e s i g n i f i c a n c e o f t h e n umbe r 1 2 8 i s t h a t a pag e t a b l e e n t r y is four bytes l o ng so tha t a pag e o f pag e t a b l e e n t r i e s m a ps 1 2 8 pag es . I n th i s c a se , t h e r o un d i ng t e rm t h a t i s a d d ed i s 1 2 7 . E.l S I Z E O F PROC ESS HEADER B e fo r e the v a r i o u s po r t i o n s o f s ys tem a d d r e s s spa c e a r e c a l c u l a te d , we wi l l r e l a te t h e s i ze o f the p r o c e s s h e ad e r to the SYSB OOT p a r am e t e r s t h a t a f f e c t i t s s i ze . Ta b l e E - 1 l i s t s each po r t i o n of the process h ea d e r , the SYSB OOT p a r am e t e r s t h a t a f f e c t i t s s i ze , a nd t h e g l o b a l l o c a t i o n wh e r e t h e s i z e o f t h a t po r t i o n i s s to r ed . Th e t a b l e a l so i n t r od uc e s t h e n o t a t i o n u s ed i n the f i r s t s e t o f e qua t i o n s to d e s c r i b e e a ch p i ec e o f the p r o c e s s h e ad e r . E-1 Ta b l e E - 1 D i sc r e te Po r t i o n s o f t h e Pr o c e s s He ad e r I t ems s to r ed i n t h i s pa r t o f t h e p r o c e s s h e ad e r Fa c to r s Af f e c t i ng s i ze o f t h i s pa r t o f p r o c e s s h e ad e r Gl o b a l l oc a t i o n wh e r e s i z e o f t h i s pa r t i s s t o r ed PHD ( ws l_ps t ) Fi x ed Po r t i o n Wo r k i ng Se t L i s t Pr o c e ss Sec t i o n Ta b l e PHD$K L ENGTH PR OC SEC TC NT WSMAX PQL_DW S DE FAULT SW P $GW_WS L PT E PHD ( empt y ) No Ac c e s s Pag e s fo r wo r k i ng s e t l i st e x pa n s i o n WSMAX PQL_DW SDE FAULT SW P $GW_EM PT PTE PHD ( ba k ) P r o c e s s He ad e r Pa g e Ar r a ys a nd Pag e Ta b l e Pag e Ar r a ys S i ze o f t he Pr o c e s s He ad e r SW P $GW BAKPTE PHD ( p t e ) P O and P l Pag e Ta b l e s VI RTUA L PAGE CNT SGN $G L_PT PAGC NT Symbo l i c Nam e fo r Eq u a t i o n s t:rl I N Th e fo l l o wi ng g l o b a l l o c a t i o n s c o n t a i n s ev e r a l o f t he p i e c e s l i s t e d a b ov e . e @ S GN $G L P H DAPC NT e @ S GN SG L PHDPAGC T • @ SW P $G L_B S LOTSZ = = = PHD ( ws l_ps t ) s um s of s i ze s of + P H D ( ba k ) PHD ( ws l_ps t ) + P H D ( em p t y ) PHD ( ws l _ ps t ) the + PHD ( b a k ) + P H D ( em p t y ) + PH D ( ba k ) + PHD ( pag e_ta b l e s ) S I Z E OF SYSTEM VI RTUAL ADDRES S S PACE E. l.l Process Pag e Ta b l es Th e ma j o r i t y o f t h e p r o c e s s h e ad e r i s t a k e n up by t h e PO and P l pag e t ab l e s . Th e to t a l n um b e r o f pag e s a l l o c a ted fo r the pr o c e s s pag e t a b l e s d e pend s o n t h e p a r a m e t e r VIRTUALPAG E CNT . VIRTUALPAGECNT + 127 PHD( page_ tables ) = ---128 E.l.2 E.1.1 Wo r k i ng Se t L i s t and Proc e s s Sec t i o n Ta b l e Th e wo r k i ng s e t l i s t a nd p r o c e s s s e c t i o n t a b l e a r e l o c a ted a t the low a d d r e s s e nd o f t h e p r o c e s s h e ad e r immed i a t e l y a f te r the f i x ed s i z e a r e a a nd g r o w towa r d e a c h o the r . Th e s i ze o f t h e p r o c e s s sec t i o n t a b l e d epend s o n the pa r am e t e r PROC S EC TCNT . Th e n a i v e a pp r o a c h d i c ta te s tha t t h e wo r k i ng s e t l i s t s i z e d e pend s o n t h e pa r am e t e r WSMAX . Howe v e r , b e c a u se the p r o c e s s h e ad e r pag e s th a t a r e n o t pag e t a b l e pag e s a r e l oc ked i n to the p r o c e s s wo r k i ng set , they a l wa ys r e q u i r e phys i c a l pag e s . In mo s t s ys t ems , many p r o c e s s e s wi l l h av e wo r k i ng s e t s tha t a r e m uc h sm a l l e r than the a l l o wed max i m um . Th e i n i t i a l wo r k i ng s e t l i s t s i z e i s c a l c u l a t ed to t a k e th i s i n to a c c o un t . Th e a s s ump t i o n i s m a d e t h a t m o s t p r o c e s s e s wi l l h a v e wo r k i ng s e t s th a t a r e a pp r o x i m a t e l y e q ua l to the pa r am e t e r PQL_DW SDEFAU L T . Equa t i o n E . l . 2 c a l c u l a t e s the max i m um n um b e r o f pag e s r e qu i r ed fo r t h e f i x ed po r t i o n o f the p r o c e s s h e ad e r , the wo r k i ng s e t l i s t , a nd t h e p r o c e s s s ec t i o n t a b l e . Th e e x t r a s pa c e r e s e r v ed fo r wo r k i ng s e t l i st e x pa n s i o n i s c a l c u l a t ed in Equa t i o n E . l . 3 . Th e d i f f e r e n c e b e t we e n t h e s e two n umbe r s ( Equa t i o n E . l . 4 ) i s t Q e n um b e r o f pag e s initially a v a i l a b l e fo r the f i x ed po r t i o n , the wo r k i ng s e t l i s t , a nd the p r o c e s s s ec t i o n t ab l e . Th e s i g n i f i c anc e o f the num b e r s 4 a nd 32 in Equa t i o n E . l . 2 is tha t a wo r k i ng s e t l i s t e l em e n t i s a l o ng wo r d ( o r f o u r byt e s , WS L $ C L E NG T H ) a nd a p r o c e s s s ec t i o n t ab l e e n t r y is 32 by t e s l o ng ( S E C $ K=L ENGTH ) . PHD(temp) = ( PHD$K_LENGTH + 4 * WS MAX + 32 * PROCSECTCNT + 5 1 1 512 PHD(empty) = WS MAX - PQL_DWSDEFAULT ) E . 1.2 E. 1.3 128 PHD(wsl_pst) E.l.3 = PHD(temp) - PHD(empty) E . 1 .4 Proc e ss He a d e r Pag e A r r ays Th e pr o c e s s head e r pag e a r r a ys i nc l ud e two a r r a ys tha t c o n t a i n a r r a y e l emen ts fo r e ac h pag e i n the p r o c e s s h e ad e r . ( Th e s e two a r r a ys a r e used b y the swa ppe r t o s to r e i n fo rma t i o n a b o u t p r o c e s s h e ad e r pag e s wh i l e t h e h e a d e r is o u t swa pped . ) Th e r e a r e a l s o two b y t e a r r a ys i n E-3 S I Z E OF SYSTEM VI RTUAL ADDRESS S PACE t h i s po r t i o n o f the p r o c e s s h e ad e r tha t c o n t a i n an a r r a y e l em e n t for e a c h pag e t a b l e p ag e . T o s i mpl i f y t h e c a l c u l a t i o n o f t h e s i z e o f th i s po r t i o n o f the p r o c e s s h e a d e r , s pa c e i s a l l o c a ted a s i f the l as t two a r r a ys c o n t a i n ed a n e l em e n t fo r e ac h p r o c e s s h e ad e r pag e . Be c a u s e the pag e t a b l e s compr i s e a pp r o x i m a t e l y 9 0 % of the p r o c e s s h e ad e r in a t yp i c a l sys tem , t h i s i s a v e r y g o od a pp r o x i m a t i o n . Bec a u s e the r e s u l t i s r o und ed up t o t h e n e x t pag e b o und a r y , th e r e i s a b s o l ut e l y n o d i f f e r en c e fo r a lmo s t a l l c om b i n a t i o n s o f SYSB OOT pa r am e t e r s . B e c a u s e the p r o c e s s h e a d e r p ag e a r r a ys a r e l o c a ted i n the process head e r , t h e s pa c e a l l o c a ted fo r t h i s a r e a d epend s o n i t s o wn s i z e . Th e c a l c u l a t i o n o f t h i s po r t i o n o f t h e p r o c e s s h e ad e r proceeds i t e r a t i ve l y . A n a p p r o x i m a t e s i z e o f t h e a r e a i s d e t e r m i n ed , b a s ed o n t h e s i z e s o f t h e o th e r th r e e a r e a s . Th e n t h e e s t i m a t e s a r e r e f i n ed un t i l two s uc c e s s i v e c a l c u l a t i o n s r e a c h t h e same r e s u l t . De f i n e PHD(the_rest) PHD(bak,O) = = PHD(wsl_pst) + PHD(empty) + PHD(page_tables) 0 Pe r fo rm t h e fo l l owi ng c a l c u l a t i o n ( Eq u a t i o n E . l . 5 ) PHD(bak,N) PHD( bak , N) = = un t i l PHD(bak,N-1) 8* (PHD(the_rest) + ) PHD(bak,N- 1) 512 + 511 E.1.5 Ca l l the r e s u l t of th i s c a l c u l a t i o n PHD ( ba k ) . PHD(bak) = PHD(bak,N) Th e s um o f t h e fo u r p i ec e s o f t h e p r o c e s s h e ad e r y i e l d s i t s s i ze in pag e s . Th e r e s u l t o f t h i s c a l c u l a t i o n i s s to r ed i n g l o b a l l o c a t i o n SWP $G L B S LOTS Z . PHD(total) = PHD (wsl_pst) + PHD(empty) + PHD(bak) + PHD(page_tables) E-4 E . 1 .6 S I Z E OF SYSTEM VI RTUAL ADDRE SS S PACE E.2 SYSTEM VI RTUAL ADDRESS S PAC E Onc e the s i z e o f the p r o c e s s h e ad e r h a s b e e n c a l c u l a t ed , t h e s i ze s o f the d yn am i c p i ec e s o f s ys t em a d d r e s s s pa c e c an b e c om p u ted . F i g u r e E - 1 p i c t u r e s s ys t em a d d r e s s s pa c e a nd the nomenc l a t u r e used to d e s i g na t e e a c h p i e c e . Ta b l e E-2 l i s t s e a c h p i e c e , the g l ob a l l o c a t i o n o f t h e po i n t e r to e ac h p i e c e , and t h e SYS B OOT pa r ame t e r s tha t d e te r m i n e i ts s i ze . SVAS( sptskel) \ System Service Vectors 80000000 Linked Driver Code and Data Structures "' Nonpaged Executive Data Nonpaged Executive Code � SVAS ( non paged_exec) (No PFN Data) .J Pageable Executive Routines XDELTA ( usually unmapped), INIT System Virtual Pages Mapped to 1/0 Addresses SVAS(spt req) ( RMS Image (RMS.EXE} Dynamically mapped at initialization time by SYSBOOT System Message File ( SYSMSG.EXE) � �� Pool of Unmapped System Pages SVAS(rpb ) Restart Parameter Block SVAS(pfn) PFN Database SVAS( nonpaged_pool) SV AS(int-&tack) SVAS(scb) SVAS(balance-slots) �� ( No PFN Data) Paged Dynamic Memory SV AS(paged_pool) �� Nonpaged Dynamic Memory (No PFN Data) Interrupt Stack System Control Block ( No PFN Data) ( No PFN Data) Balance Slots �� System Header (No PFN Data) SVAS(spt) System Page Table (No PFN Data) SVAS(gpt) Global Page Table SVAS(sysphd) Figure E-1 La yo u t o f S y s t em V i r t ua l Ad d r e s s Spa c e E-5 ) Static Portion (SYS .EXE) Tabl e E.,.. 2 Deta i l ed Layout of S y s tem Virtua l Addre s s Spa c e (F ixed S i z e Portion ) The fo l lowi ng p i ec e s o f the execut i v e o r ig i na te i n the exec u t i v e imag e f i l e SYS $SYS TEM : SYS . EXE . each o f these pi eces r ema i n unchang ed un t i l a new maj o r rel ease o f the o pe r a t i ng system . The sys t em add resses o f G l oba l Add re s s = Add ress ( 1 ) S i ze i n pag es Pro t OWne r Pag eab l e Mapped by System Se r v i c e Vec to r s SYS $QI OW = 80000000 3 pag es UR K Yes SYSB OOT Nonpag ed Ex ecut i v e Da ta FCP Data Ar ea L i n ked Dr i v e r Da ta S t r uc tures MMG$A ENDVEC 8 0 00 0 6 0 0 PMS$G L FCP 80000600 EXE $GL=B UGCHECK 80000834 4 pag es ( 5 6 4 . bytes ) ( 1 4 8 4 . bytes ) UREW ( 2 ) URKW ( 2 ) K No SYSB OOT Li nked Dr iver Cod e MMG$AL B EGDR IVE DR$INT- 8 0 0 00EOO 8 0000EOO 5 pag es UR K No SYSB OOT 80001 800 8 0 0 0 1 80 0 13 pag es URKW K No SYSBOOT Item Nonpag ed Ex ecut ive Da ta Nonpag ed Ex ecut ive Ro ut i nes = = = MMG$AL ENDDR IVE PFN$AW=HEAD = = = = MMG$FRSTRONLY EXE $RESTART 8 0 0 03200 8 0 00 3 2 0 0 5 5 pag es URKW K No SYSB OOT = Pag eabl e Execut ive Ro ut i nes MMG$AL_PGDCOD = 8 0 0 0A O O O 6 7 pag es UR K Yes SYSB OOT Us ua l l y Unmapped Pag es XDE LTA ! N IT BUGC HECK MMG $AL_PGDCODEN = 8 0 0 1 24 0 0 (80012400) ( 8 0 0 1 2E O O ) ( 8 00 1 4 2 0 0 ) 3 2 pag es ( 5 pag e s ) ( 1 0 pag e s ) ( 1 7 pag e s ) NA URKW ( 3 ) K End of F i x ed Si zed Po r t i o n o f Sys tem Vi r tua l Add ress Spac e SWP$GL_S HE L LBAS = = 80016400 No ( 3 ) SYSBOOT Tabl e E - 2 (cont . ) Deta i l ed Layout o f System Virtual Addre s s Space ( Var iable S i z e Port ion Mapped toward Increas ing Vi r tua l Add r e s s e s ) �� Th e fo l l owi ng pi e c e s o f the sys t em a r e no t a pa r t o f the execut i v e i m ag e SYS . EXE . Th e i r s i ze s a r e no t f i x ed but r a th e r d e pend on t h e va l ue s o f s pec i f i c SYSBOOT pa r am e t e r s o r o n the pa r t i c u l a r d ev i c e a n d mem o r y c on f i g ur a t i on . Th e s e p i e c e s a r e l oc a t ed by s to r ing the i r sta r t i ng add r e s s e s i n po i n t e r f i e l d s , who se add r e s s e s a r e l i s ted he r e . The f i r s t i tems l i sted a r e mapped by I N I T a nd SYS IN IT . i s , t h e conn e c t - to- i n te r r upt pag e s a r e s e t a s i d e f i r st , I t em tzl G l obal Ad d re s s o f Po i n te r Beg i n n i ng o f Va r i a b l e S i zed Po r t i o n o f Sys t em Vi r tua l Ad d r e s s Spa c e SWP$G L_S HE LLBAS Sys t em Vi r tua l Pag es fo r Co nnec t t o I n te r r upt RBM $L S PTFREL i n Re a l �T i m e SPT B i t Ma p Ma ppi ng MMG$AL_S B I C ONF fo r I /O Ad d r e s s e s = I tems a r e mapped towa rd I / O a d a pt e r s a r e m a pped l a rg er s ys t em v i r tua l nex t , a n d s o o n . Fa c to r s Th a t Af f e c t S i ze Pro t REALT I M E S PT S NA Ph ys i c a l Co n f i g u r a t i on ( Types o f Ex t e r nal Ad a pt e r s ) (6) ...J No (5) INIT KW K No (5) I N IT KW K No (5) !NIT URKW K Yes SYS I N IT NA K URKW K Yes SYS I N I T NA K Number o f Di s k Un i ts KW K S PTREQ ( Se v e r a l Othe r De ta i l s ) NA K UCB $ L SVPN i n Un i t-Co n t r o l B l o c k fo r Sys t em Di s k constant RMS MMG $GL_RMSBASE S i ze o f RM S Imag e ( 1 31 pag e s ) pag e Sys t em Me s s a g e Fi l e nul l constant EXE $G L_S YSMSG (1 pag e ) (1 pag e ) S i ze of Sys t em Me s sag e Fi l e ( 2 57 pag e s ) pag e S y s t em Vi r t ua l Pag es fo r o th e r d i s k d r i v e r s UCB $ L SVPN i n Un i t-Co n t r o l B l o c k fo r Eac h Un i t Po o l BOO$G L S PTFREL BOO$G L:s PTFR.EH of ava i l ab l e s ys t em pag es (7) (7 ) Mapped by K Sys t em Vi r t ua l Pag e fo r Sys t em Di s k Dr i v e r nul l Pag ea b l e Th a t 8 0 0 1 6 2 00 I Imag e owne r add r e s se s . (4 ) No (5) S YSGEN i n STARTUP. C OM o r when d r iver i s l oa d ed (continued on next page) Tabl e E - 2 ( cont . ) Deta i l ed Layout of Sys tem Virtual Addr e s s Space (Virtual S i z e Port ion - - Mapped toward Sma l l e r Vir tua l Addr e s s e s ) The s e pi e c e s a r e a l so pa r t o f the d yn am i c a l l y c o n f i g u r ed po r t i o n of s ys t em v i r tua l add r e ss spac e . Th e i r s i ze s are d e t e r m i ned b y SYSB OOT pa ramete r s . Th e s e pi ec e s a r e l oc a ted b y s to r i ng the i r s ta r t i ng add r e s s e s i n po i n te r f i e l d s , who se add r e s s e s a r e l i sted he r e . Th i s pa r t o f s ys tem add ress spa c e i s mapped by Ex c e s s pag e s a r e add ed I t em Re sta r t Ba se Pag ed Dynam i c Memo ry tzl I (X) the po o l G l ob a l Pa r am e t e r Bl o c k P F N Da ta to SYSBOOT s t a r t i ng at the h i g h e s t sys tem v i r t ua l ad d r e s s a nd wo r k i ng of a v a i l ab l e S PTEs Ad d r e s s o f Po i n t e r l i s ted on the pr ev i o us pag e . Fa c to r s Tha t Af f e c t S i ze ( 1 pag e ) EXE $G L_R PB constant PFN$A BASE PFN$AL_PT E ( Ev e r yt h i ng ) MMG$G L_PAGE DYN PAGEDYN down . Pr o t Own e r URKW K No URKW K No SYSB OOT K Yes INIT ERKW K No SYSB OOT No SYSB OOT SYSB OOT Pag eabl e (8) URKW Ma pped by S YS B OOT EW URKW No npag ed Dyn am i c Mem o r y MMG$G L_N PAGEDYN NPAGEDYN ( 1 pag e ) No Ac c e s s g ua rd pag e constant I n t e r r upt INTSTKPAGES Sta c k (1 K K N o Ac c e s s g ua rd pag e EXE $G L_I NTSTK NA K S y s t em Co n t r o l EXE $G L SCB PR$_SCBB ( P ) constant ( 9 ) ( 1 o r 2 pag e s ) ERKW K No Ba l an c e S l o t Ar e a SWP$G L_BA LBASE BALS ETCNT S i ze of Proc e s s He ad er SRKW K Yes Sys t em He a d e r MMG $G L S YS PHD S YSMWCNT GB LS ECT I ONS ERKW K No SYSB OOT Sys t em Pag e Ta bl e MMG $G L S PTBASE MMG$GL-G PTBASE MMG$GL-S B R ( P ) PR$_SBR ( P ) ( Ev e r yt h i ng ) ERKW K No SYSB OOT G l ob a l MMG$G L_G PTE GB LPAGES URKW K Yes Block Pag e Ta b l e End o f Sys t em V i r t ua l Ad d r e s s Spa c e (S) NA ERKW MMG $G L MAXS YSVA MMG$G L-FRESVA MMG$G L:MAXG PTE consta n t pag e ) (10) (11) SWAP PER S YS B OOT (P) G l oba l addresses o r processo r reg i ste r s ( PR$ nam e ) who se names a r e fo l lowed wi th ( P ) conta i n phys i c a l add resses r a th e r than sys tem v i r tua l add resses . The two phys i c a l add resses r e l evant to th i s tabl e a r e the base o f the sys tem pag e tab l e ( i n PR$_SBR) and the base of the sys tem contro l b l o c k ( i n PR$_SCBB) . (S) The i n te r rupt s ta c k g rows towa rd sma l l e r v i rtua l add resses . po i n t to the g ua rd page that fol lows the i n ter rupt s tac k . (1) Some g l obal add resses l i sted here a re o n l y c o i n c i d enta l l y a t the beg i nn i ng o f the named reg i on . Othe r s , those who se names beg i n wi th MMG $ , a r e d e f i ned i n mod ul e MOAT s o l e l y a s symbo l i c l abel s to del im i t the po r t i o n s o f the l i nked execut ive . (2) Al tho ugh only 5 6 4 bytes a r e used for f i l e sys tem s t a t i st i cs , the pro tec t ion g r anul a r i ty d e f i ned by the a rc h i tec ture i s a pag e , 5 1 2 byte s . Fo r th i s r ea son , two ent i r e pag es , 1 0 2 4 byte s , a r e set to UREW pro tec t i on . r ema i n ing two pag e s i n th i s a rea a r e s e t to URKW . VAX The (3) The pages conta i n i ng XDE LTA only r ema i n ma pped i f the R5 f l ag ( Chapter 2 1 ) reque s t i ng the exec ut i ve d ebugg er i s when the sys tem is i n i t i a l i zed . set (4) The pag e s set a s i d e fo r connec t to i nt e r r upt are only ma pped No Access a s pa r t o f i n i t i a l i za t ion . a l l o c a ted i n response to spec i f i c r eque s t s . are (5) I t i s mean ing less to a s k wh ether sys tem v i r tua l pag es tha t a r e ma pped to I/0 add resses a re pag eabl e . (6) MMG $AL_SB ICONF i s the address o f a 1 6-longwo rd a r ray . Each l o ng wo rd _ a r r ay address o f the f i rst pag e tha t maps I /O addresses fo r tha t ad a pte r . (7) Loc a t i ons BOO$G L SPTFREL and BOO$G L S PTFREH do not conta i n sys tem v i rtua l add resses . sys tem v i r tua l page numbers of the fi r s t and l a s t pag e s in the poo l o f ava i l able SPTEs . (8) (9) Th i s i s why the contents e l ement of loca t i on conta i n s Ra ther , EXE $G L_INTSTK These the SPTEs sys tem they v i r t ua l conta i n the The Resta r t Pa rame ter B l o c k d o es not pag e . Howeve r , i t i s not l o c a ted in h i gh phys i c a l memory a s the rest o f the The Re s t a r t Pa rame ter Block i s l ocated in the f i r s t pag e o f the the good 6 4K byte segment nonpag ed exec u t i ve i s . l ocated by the memo ry bootst r a p ROM . The pag e is not pl aced i n to the sys tem wo r k i ng set so the re is no way memory management can ma ke the pag e i nva l i d . The sys tem cont r o l b l o c k on the VAX- 1 1/7 5 0 i s two pag es l ong . page l ong . Th e system cont r o l b l o c k on the VAX- l l/7 8 0 is one ( 10) The process head e r s that res i d e i n the b a l a nce s l o t a rea a r e a pa r t o f the process wo r k i ng set to wh i ch they a r e a sso c i a ted . Al though po rt i o n s o f t h e process h e a d e r do no t pag e , t h e phys i c a l pages l o cked down i n th i s manne r are accounted for i n process wo r k i ng s e ts and d o not count towa rd the execut i ve ' s use o f memory . (11) G l obal pag e tab l e s a r e pag eab l e . However , i f a g l obal pag e table pag e conta i n s a t l ea s t one va l id g lobal page tabl e entr y , then that pag e i s l ocked i n to the sys tem wo r k i ng s e t . S I Z E OF SYSTEM VIRTUAL ADDRESS SPACE E.2.1 S ys t em V i r tua l Add re s s Spa c e a nd SYSBOOT Pa r am e t e r s Th e s i ze s o f mo s t o f t h e p i ec e s o f s ys t e m add r e s s s pa c e l i s te d in Ta b l e E - 2 a r e e i th e r c o n s t a n t o r s im p l y r e l a t ed t o o n e o r two SYSB OOT p a r ame t e r s . Th e i r s i z e s a r e c om p u t e d i n a s t r a i g h t fo r wa r d m a nn e r by SYSBOOT . Th e s i z e s o f the sys t em pag e t ab l e a nd th e PFN d a t a b a s e a r e a l i t t l e mo r e c om p l i c a t ed a nd a d i sc us s i on o f the i r s i z e s i s po s t po ne d unt i l the n e x t s ec t i o n . Wh e n SYSBOOT c a l c ul a t e s the s i ze o f t h e sys t em pag e t ab l e , i t f o rms a s um o f t h e s i ze s o f the p i ec e s o f sys tem v i r tua l add r e s s spa c e , a nd a l l o c a t e s a n S PTE f o r e a c h pag e . Th e c a l c u l a t i o n tha t i s p r e s en t e d here p r e s e n t s e ac h p i ec e o f s ys tem spa c e i n o rd e r o f i n c r e a s i ng v i r tua l add r e ss , r a th e r than i n t h e o rd e r tha t SYS BOOT pe r fo rm s the c a l c ul a t i o n . 1. Th e f i r s t pag e s o f sys tem a d d r e s s s pa c e , c o n ta i n i ng the s y s t em s e r v i c e v ec to r s a nd t h e FCP s t a t i s t i c s b l oc ks , h a v e t h e i r s i z e a c c o un ted fo r in the a ss emb l y t i m e pa r am e t e r MMG $ C S PTSKE L d e f i ne d i n mod u l e S PTSKE L . S VAS(sptskel) = E.2.1 5 Th e FC P d a t a a r ea is l e s s t h a n two pag e s l o ng . Howeve r , the g r a n ul a r i ty of access p r o t e c t i o n is the pag e . Th i s i s wh y pa r t o f t h e f i r s t pag e o f t h e l i n ked d r i v e r d a ta s t r uc t u r e a r e a h a s a p r o tec t i o n o f UREW wh i l e the r e s t o f th a t a r e a i s URKW . 2. Th e a r e a t h a t wi l l c o n t a i n the l i n ked e x e c u t i v e , the RMS i m ag e , a nd t h e sys tem m e s s a g e f i l e h a s i t s s i ze d e t e rm i n ed by the SYSB OOT p a r am e t e r S PTRE Q . In add i t i o n , t h e r e mus t be e n o ug h e x t r a pag e s i n t h i s a r e a to map the I/0 a d a p t e r s a nd to r e s e rve a sys tem v i r t ua l pag e fo r e a c h d ev i c e d r i v e r tha t r e ques t s o n e . I f th e r e a r e a n y s y s tem pag e tab l e ent r i e s r equ i r ed fo r m a pp i ng by PFN fo r r e a l - t i m e d ev i c e s , t h e r eque s t ed n um be r ( S YS B OOT p a r am e t e r REALT IME S PTS } i s a d d ed to sys tem v i r t ua l a d d r e s s r e q u i r emen t s a t t h i s t i m e . SVAS(sptreq) = SPTREQ + REALTIME_SPTS E.2.2 Af t e r the s i z e of the sys t em pag e t ab l e is c a l c u l a ted and r o u n d ed up to the n ex t pag e b o und a r y , any e x t r a pag e s a c qu i r ed a r e a d d ed to t h e po o l o f a v a i l ab l e sys t em pag e t a b l e ent r ies . 3. Th e Re s ta r t Pa r am e t e r B l o c k i s a l wa ys o ne pag e l o ng . no t a t i o n o f F i g u r e E - 1 , t h i s i s e x p r e s s ed as SVAS(rpb) = In the E.2.3 1 Th e s i ng l e pag e r e qu i r ed fo r the Re s t a r t Pa r am e t e r Bloc k is n o t c o un t ed wh e n d e te rm i n i ng the i n i t i a l s i z e o f the sys tem E- 1 0 S I Z E OF SYSTEM VI RTUAL ADDRESS S PACE pag e t a b l e . I t i s a s s umed t h a t pag e r o und i ng o r o n e o f the a p p r o x i m a t i o ns w i l l add t h e s i ng l e S PT E r e qu i r ed to map the R PB . 4. Th e n umbe r o f pag e s i n t h e PFN d a t a b a s e the n e x t sec t i o n . 5. Th e spa c e r e s e r v e d f o r t h e pag ed a nd nonpag ed d yn am i c m emo r y a r e a s d e pend s o n t h e S YS B OO T p a r am e t e r s PAG E DYN a nd N PAG E DYN r e spec t i ve l y . Bo t h pa r am e t e r s , e x p r e s s i ng po o l s i zes in byt e s , are t r un c a t ed t o the nex t sma l l e s t pag e b o und a r y t o g i ve th e po o l s i zes in p ag e s . SYSB OOT mod i f i e s the p a rame t e r s thems e l v e s so tha t the nex t b o o t s t r a p o pe r a t i on w i l l r e f l ec t t h e t r un c a t e d po o l s i z e s . SVAS(pagecLpool) = is d e f e r r ed PAGEDYN un t i l E.2.4 ---- 512 Th e pa g e s i n t h e m i d d l e o f pag ed d yn am i c m emo r y t h a t h a v e p r o tec t i on of E W a r e a l l o c a ted b y t h e u t i l i ty p r og r am RM S S HARE to a c c o mmod a t e the d a ta s t r uc t u r e s tha t RM S r e qu i r e s f o r sh a r ed f i l e s . SVAS(nonpaged_pool) = NPAGEDYN E.2.5 ---- 512 6. Th e S YS B OOT pa r am e t e r I NTS TKPAGE S i n t e r r up t s t a c k i n p ag e s . SVAS(int_stack) = g i ves INTSTKPAGES the v a l ue of the E.2.6 I n c a l c u l a t i ng t h e t o t a l s i z e o f the sys t em pag e tab l e , the g ua r d pag e s ( p r o te c t i o n s e t to no a c c e s s ) a t e i th e r e nd o f t h e i n t e r r up t s t a c k a r e n o t c o un ted . Th e s e pag e s c a u s e a c c e s s v i o l a t i o n e x c e p t i o n s ( a c t ua l l y a n i n te r r up t s ta c k n o t v a l i d HA LT ) on b o th s t a c k o v e r f l o w a nd s ta c k u nd e r f l o w . 7. Th e s i ze o f t h e s y s t em c on t r o l b l o c k i s C PU d epe nd en t . Bo t h the VAX- 1 1 /7 5 0 a nd t h e VAX- 1 1 /7 8 0 c o n ta i n the a r c h i t e c t u r a l sys t em c o n t r o l b l o c k ( F i g u r e 2 - 1 , F i g u r e 6 - 3 ) . In add i t i o n , the VAX- 1 1 /7 5 0 s ys tem c o n t r o l b l o c k h a s a s e c o nd pag e d evo ted to UN I B US i n t e r r up t d i s pa tc h i ng ( F i g u r e 6 - 3 ) . SVAS(scb) � t (for t he VAX-11/750) (for the VAX- 11/780) E-ll E.2.7 S I Z E OF SYSTEM VI RTUAL ADDRESS S PAC E 8. Th e a r e a d evo ted to b a l a n c e s l o t s c ompr i se s mo r e t h a n h a l f o f s y s tem v i r t ua l ad d r e s s s pa c e i n t yp i c a l c o n f i g u r a t i o n s . Its s i ze d e pe nd s o n t h e SYS B OO T p a r ame t e r BALS ETCNT a nd the s i ze o f a p r o c e s s h e ad e r i n p ag e s , c a l c u l a ted i n S ec t i o n E . l . Th e c o n s t a n t s i z e o f b a l a nc e s l o t s , mo t i v a ted i n Ch a pte r 1 1 , m a k e s th i s a t r i v i a l c a l c u l a t i o n . SVAS(balance_slots) = BALSETCNT*PHD(pages) E.2.8 B e c a us e o f the m u l t i pl i c a t i v e n a t u r e of th i s r e l a t i o n sh i p , i t i s nec e s s a r y to r ed uc e t h e BALS ETCNT p a r am e t e r i n sys t em s t h a t mus t s u ppo r t a l a r g e p r o c e s s v i r t ua l a d d r e s s spac e . In a s i m i l a r f a sh i o n , c o n f i g u r a t i o n s tha t r e qu i r e a l a rg e n um b e r o f c o n c u r r en t l y r e s i d en t p r o c e s s e s sho u l d u s e a sma l l e r v a l ue o f VI RTUA L PAG ECNT . 9. Th e s y s t em h e ad e r i nv o l v e s a c a l c ul a t i o n s i m i l a r to the s i ze o f the process heade r , d e sc r i b ed i n the l a s t s ec t i o n . Howe v e r , t h e r e i s no o p t i m i za t i o n t e c h n i que f o r empty pag e s b ec a u s e the r e i s no l a rg e v a r i a t i o n i n wo r k i ng s e t s i ze s . Th e r e i s a l so no n e ed f o r t h e a n a l og ue to p r o c e s s h e ad e r pag e a r r a ys b e c a u s e the s ys t em h e ad e r d o e s no t d e sc r i b e a n o b j e c t t h a t swa p s . Th e s i z e o f t h e system pag e t ab l e , t h e sys tem a n a logue to process p ag e t ab l e s , i s c a l c u l a t ed s e pa r a t e l y f r om the r e s t o f the s ys t em h e ad e r , wh i c h h a s a s impl e d e pe n d e n c e o n two SYSB OOT p a r am e te r s . Th e o n l y s y s tem h e ad e r c ompo n e n t i s t h e sys tem e q u i v a l e n t to t h e wo r k i ng set l i s t a nd the p r o c e s s s e c t i o n t a b l e in the process head e r . Th e s ys t em e qu i v a l en t s a re the s ys t em wo r k i ng set l i s t a nd the g l o b a l s e c t i o n t ab l e . The SYS B OOT p a r am e t e r s th a t co n t r o l the i r s i zes a re SYSMWCNT a nd G B LS ECT I ONS . SVAS(sysphd) � HD$K_LENGTH + 4*SYSMWCNT + 32*GBL SECTIONS + 511 = ) E.2.9 512 Th e s y s tem s e c t i o n t a b l e c o n t a i n s s ec t i o n t a b l e e n t r i e s n o t o n l y fo r a l l g l o b a l s e c t i o n s b u t a l s o fo r th r e e sys tem s e c t i o n s : the e x ec u t i v e i mag e i t s e l f , t h e RM S i m ag e , a nd the sys t em m e s s ag e file . 10. Th e s i ze o f the s ys t em pag e t a b l e d epe nd s o n t h e s i zes o f the o th e r p i ec e s of s y s t em a d d r e s s spac e . Th e c a l c u l a t i o n o f i t s s i ze i s d e fe r r ed un t i l the nex t s ec t i o n . 11. Th e l a s t s i mpl e c a l c ul a t i o n o f a po r t i o n add r e s s s pa c e i nvo l v e s t he s i ze o f the g ov e r ned by the SYSB OOT p a r am e t e r G B L PAG E S . SVAS(gpt) GBLPAGES + 127 = 128 E-12 of sys t em v i r t ua l g l ob a l pag e t a b l e , E.2. 10 S I Z E OF SYSTEM VI RTUAL ADDRESS S PACE E. 2. 2 Sys t em Pag e T ab l e a nd the PFN Da t a B a s e Th e PFN d a t a b a s e c o n t a i n s a d e sc r i pt i o n o f e a c h pag e o f phys i c a l memo r y . Howe v e r , i t d o e s n o t c o n t a i n i n fo rm a t i o n a b o u t t h e n o npag ed exec ut i ve . B e c a us e the PFN d a t a base i s pa r t of the n o n pag ed e x e c u t i v e , i t s s i z e d e pe nd s o n i t s e l f . Ho we v e r , t h e s i t ua t i o n i s mo r e c ompl i c a t ed . Th e sys t em pag e t a b l e , a l so nonpag ed , m a ps t h e PFN d a ta base . Th u s t h e s i ze o f the PFN d a ta b a s e d epe nd s o n i t s o wn s i z e i n two d i f f e r e n t wa ys . Th e s i g n i f i c a nc e o f t h e n umb e r 1 8 i n the f o l l owi ng equa t io n is that the r e a re 18 b yt e s o f i n f o rma t i o n s to r ed f o r e a c h pag e o f phys i c a l memo r y . As d e sc r i b ed i n Ch a p t e r 1 1 , e a c h phys i c a l pag e i s d e sc r i b ed b y two byte a r r a ys , s i x wo rd a r r a ys , a nd two l ongwo r d a r r a ys . Bec ause the two l i n k a r r a ys o ve r l a p t wo o th e r a r r a ys , th i s amo u n t s to a to t a l of 18 byt e s o f i n fo rma t i o n f o r e a c h phys i c a l p ag e . Th i s v a l u e i s r e p r e s e n t ed b y t h e g l o b a l c o n s t a n t PFN $ C L ENGTH d e f i n ed by mod u l e SYS PARAM { o r PARAME T ER ) . SVAS(pfn) = 18*(PHYSICAL - NO_PFN_DATA) + 511 E.2.11 512 whe r e PHYS I CAL r e p r e se n t s th e s i z e o f phys i c a l memo ry { PHYSICAL = minimum size of physical memory , PHYSICALPAGES } a n d NO PFN DATA r e p r e se n t s t h e n o npag ed po r t i o n s o f s y s tem s pa c e a r e not a cco un ted f o r i n t h e PFN d a t a b a s e . th a t NO_PFN_DATA = SVAS(nonpaged_exec) + SVAS(pfn) + SVAS(nonpaged_pool) + SVAS(int_stack) + SVAS(scb) + SVAS(sysphd) + SVAS(spt) Th e no n pag e d po r t i o n o f the e x e c u t i v e i m ag e , SVAS { no npag ed_e x ec ) , i s a subset o f SVAS ( sp t r e q ) wh e n c om p u t i ng the s i z e o f the sys t e m pag e tab l e . I ts s i ze i s a c o n s t a n t who s e v a l u e i s d e te rm i ned whe n t h e e x ec u t i ve i mag e i s l i n ked . SVAS(nonpaged_exec) = MMG$AL_PGDCOD - MMG$A_ENDVEC = 77 pages No t i c e tha t t h e PFN d a t a b a s e d epend s o n i t s o wn s i ze e x p l i c i t l y ( th r o ug h th e N O P F N DATA t e rm ) a n d a l s o impl i c i t l y th r o ug h t h e s i z e o f t h e sys tem pag e-t a ble ( Eq ua t i o n E . 2 . 1 2 ) . I n a s i m i l a r f a sh i o n , th e s i z e o f t h e sys tem pag e t ab l e d epend s o n i t s own s i ze e x p l i c i t l y a nd impl i c i t l y t h r o ug h the s i z e o f the PFN d a ta b a se . E-1 3 S I Z E OF SYSTEM VI RTUAL ADDRESS SPACE SVAS(spt) = THE_REST + SVAS(spt) + SVAS(pfn) + 127 E .2.12 128 wh e r e THE R E S T r e p r e s e n t s a l l c on t r i b ut i o n s to sys tem add r e s s e x c e pt fo r t h e sys tem pag e t a b l e a nd t h e PFN d a t a b a s e . THE_REST E.2.3 = s pa c e SVAS(sptskel) + SVAS(sptreq) + SVAS(rpb) + SVAS(paged_ pool) + SVAS(nonpaged_pool) + SVAS(int_stack) + SVAS(scb) + SVAS(balance_slots) + SVAS(sysphd) + SVAS(gpt) App r ox i ma t i on Used by SYSBOOT Fo r some l a rg e v a l ue s o f e i th e r VI RTUALPAGE CNT o r phys i c a l memo r y s i ze , an i te r a t i ve c a l c u l a t i o n fo r the s i ze s o f the s e two qua n t i t i e s d o es n o t c o nve rg e b u t r a th e r o sc i l l a te s a b o u t a s t a b l e so l ut i o n . To avo i d th i s pro b l em , a s i mp l i f i c a t i o n i n t h e c a l c u l a t i o n i s m ad e . Th e n umbe r o f sys t e m pag e t a b l e e n t r i e s s e t a s i d e fo r the PFN d a ta b a s e d o es n o t t a k e i n to acco unt the f a c t tha t t h e pag e s occ upi ed by t h e nonpag ed e x ec u t i v e a r e n o t a c c o un ted fo r in t h e PFN d a ta b a s e . SVAS(pfn) 18*PHYSICAL + 511 E.2.13 = 512 Th i s r e l a t i o n r ep l a c e s Equa t i o n E . 2 . 1 1 i n the c a l c ul a t i o n o f the s i ze I t a l s o g r ea t l y s i mpl i f i e s Equa t i o n E . 2 . 1 2 of the sys tem pag e t a b l e . bec a us e the SVAS { p f n ) t e r m no l o ng e r d epe nd s o n SVAS { spt ) . I n s t e ad , SVAS ( p f n ) i s a c o n s ta n t . Bec a us e Equa t i o n E . 2 . 1 3 e r r s o n the h ig h s i d e i n a l l o c a t i ng S PTEs f o r the PFN d a ta b a se , t h e n um b e r o f S PTEs se t a s i d e fo r the sys t em pag e t ab l e d o e s n o t u s e Equa t i on E . 2 . 1 2 i t e r a t i v e l y . I n s tead , the r e is a s i ng l e pa s s o n c a l c u l a t i ng t h e s i z e o f t h e s ys t em pag e tabl e . E-14 S I Z E OF SYSTEM VI RTUAL ADDRESS S PACE SVAS(spt,O) = THE_REST + SVAS(pfn) 128 SVAS(spt) = THE_REST + SVAS(pfn) + SVAS(spt,O) + 127 E.2.14 128 B e c a us e phys i c a l pag e s a r e n o t a l l o c a ted f o r the PFN d a t a b a s e unt i l the s ys t em pag e t ab l e s i z e h a s b e e n c a l c u l a t e d , th e r e i s n o l a rg e wa s te o f phys i c a l memo r y . Th e o n l y a f f e c t o f the s e t wo a pp r o x i ma t i o n s m i g h t b e o n e mo r e phys i c a l p ag e a l l o c a t ed f o r t h e sys t e m pag e t a b l e t h a n i s a bso l u t e l y n e c e s s a r y . Th i s wo u l d o n l y o c c u r o n sys t em s wi th very l a r g e amoun t s o f m emo r y i n the f i r s t p l a c e so the l o s s i s p r ac t i c a l l y unno t i c ed . E. 2.4 Reno rma l i za t i on o f S PTREQ Th e r o und i ng of the s i ze o f the s ys t em pag e t a b l e to the n e x t h i g h e s t pag e b o u nd a r y c a n a d d extra sys t em p ag e t a b l e e n t r i e s to tho s e r e q u i r ed to m a p t h e e n t i r e s ys t em . Af t e r SYSB OOT h a s c a l c u l a t ed the r e s u l t o f Equa t i o n E . 2 . 1 4 , i t m a ps the l i nked e x e c u t i ve b eg i nn i ng a t the l o w a d d r e s s e nd o f s ys t em a d d r e s s s pa c e ( 8 0 0 0 0 0 0 0 ) and m a ps the d yn a m i c po r t i o n o f s ys t em s pa c e b eg i nn i ng a t t h e h i g h a d d r e s s e nd . An y pag e s l e f t o v e r a f t e r t h i s m a pp i ng a r e put i n to the po o l o f s ys t em pag e t ab l e e n t r i e s l o c a t e d by BOO $G L S PTFREL and B O O $ G L S PTFRE H . As S PT E s a r e n e ed ed f o r f u r th e r m a pp i ng ( fo r e x ampl e b y SYSIN I T to m a p RMS a nd t h e s ys t em m e s s a g e f i l e o r b y S YSGEN wh e n l o ad i ng d r i v e r s tha t r e q u i r e a sys tem v i r t ua l pag e n um be r ) , t h e s e pag e s a r e t a k e n f r om the po o l . Onc e the e nt i r e s ys t em is m a pped , any e x t r a pag e s ( d u e to r o und i ng as we l l as an o v e r e s t i ma te o f the S PTREQ p a r am e t e r ) r em a i n i n the po o l o f s ys tem pag e t a b l e e n t r i e s . E. 3 PHYS I CAL MEMORY REQU I REMENTS OF THE E XECUT IVE Onc e t h e s i z e s o f t h e v a r i o u s p i e c e s o f s ys tem a d d r e s s s pa c e have b e e n c a l c u l a ted , it is po s s i b l e to l i s t the to t a l phys i c a l m emo r y r e qu i r em e n ts o f t h e e x e c u t i v e , t h e n um b e r o f pag e s t h a t are no t a v a i l a b l e fo r u s e r p r o c e s s e s . E. 3 . 1 Phys i c a l Memo r y Used b y the Ex e c ut i ve Ta b l e E - 3 l i s t s e a c h p i e c e o f the n o npag ed e x e c u t i v e a nd e i th e r i ts i n pag e s o r a n e q ua t i o n n um b e r i n S e c t i o n E . 2 t h a t d e sc r i b e s how s i ze i t s s i ze is c ompu ted . E-15 S I Z E OF S YS TEM VI RTUAL ADDRESS S PACE Tab l e E - 3 Div i s ion of S y s tem Virtua l Addre s s Space into Nonpaged and Paged P ie c e s The fo l l owi ng po r t i o n s o f s ys tem add r e s s s pa c e are permanen t l y m apped b y SYSB OOT . The phys i c a l pag e s tha t they o c c upy a r e n o t a c c o un ted f o r in the PFN d a ta b a s e . S i ze I tem Nonpag ed Po r t i o n o f Execut i v e Imag e MMG $AL PGDCOD - MMG $A_ENDVEC ( 7 7 pa ge s ) PFN Da t a Ba se Equa t i o n E . 2 . 1 3 No n pag ed Dynam i c Mem o r y Equa t i o n E . 2 . 5 In t e r r upt S t a c k Equa t i o n E . 2 . 6 Sys tem Co n t r o l B l o c k Equa t i o n E . 2 . 7 Sys tem He ad e r Eq ua t i o n E . 2 . 9 Sys t em Pag e Ta bl e Equa t i o n E . 2 . 1 4 Th e fo l l owi ng a r e the pag e ab l e po r t i ons of the execut i v e . Th e i r to ta l m emo r y c o s t c an n ev e r exc e ed SYSMWCNT . S i ze I t em Sys t em Se rv i c e Vec to r A r e a 3 pag e s Pa g ed Exec u t ive Ro ut i n e s MMG $A L PGDC ODEN - MMG $AL_PGDCOD ( 6 7 pa ge s ) RMS Imag e S i ze o f RMS Imag e ( 1 3 1 pag e s ) Sys tem Me ssage Fi l e S i ze o f Sys t em Me s sag e Fi l e ( 2 5 7 pag e s ) Pag ed Dynam i c Memory Equa t i o n E . 2 . 4 Gl obal Equa t i o n E . 2 . 1 0 Pag e Ta b l e Pag es Th e fo l l owi ng po r t i o n s o f s ys tem add re s s d o no t phys i c a l memo ry a c c o un ted fo r i n Equa t i o n E . 2 . 1 4 . Re a so n I t em XDE LTA , r equ i r e U s ua l l y n o t mapped IN I T , and BUGC HECK I /0 Spa c e Ma ppi ng I /O Ad d re s s e s SVPNs fo r D i sk Dr i v e r s I /O Ad d re s s e s o r Do ub l e Ma ppi ng Ba l anc e Sl o t Area Proc e s s He ad e r Pag es and Pag e Tab l e Pag es a r e cha rged t o proc e s s wo r k i ng s e t s E-16 S I Z E OF SYSTEM VI RTUAL ADDRESS S PACE NONPAGED = SVAS(nonpaged_exec) + SVAS(rpb) + SVAS(pfn) + SVAS(nonpaged_pool) + SVAS(int_stack) + SVAS(scb) + SVAS(sysphd) + SVAS(spt) E.3.1 Th i s i n i t i a l s um i s the t o ta l m emo r y r eq u i r emen t o f the nonpaged e x e c u t i v e c od e a nd d a t a t a b l e s . Th e pag ed e x e c ut i ve ( Ta b l e E - 3 ) a l so r equ i r e s phys i c a l m emo r y . Howe v e r , i t i s r ea so na b l e to a s s um e tha t the s ys t em wo r k i ng set is full a t a l l t i m e s s o tha t the phys i c a l m emo r y r eq u i r em e n ts o f t h e pag ed e x e c ut i v e a r e s i mpl y SYSMWCNT pag e s . Two f i n a l i t em s mus t b e t a k e n i n t o a c c o un t wh en c a l c u l a t i ng the n umbe r o f phys i c a l pag e s used by the execut i ve . Th e SYS B OO T p a r am e t e r s FRE E L IM a nd MPW L O L IM I T s e t l o w l im i t t h r e sho l d s o n the n umbe r of Th e se p a r ame t e r s s h o u l d b e pag e s o n t h e f r ee a nd mod i f i ed pag e l i s t s . i nc l ud ed wh e n c a l c u l a t i ng t h e n um be r o f a v a i l ab l e ph ys i c a l pag e s . MEMORY = NONPAGED + SYSMWCNT + FREELIM + MPW_LOLIMIT AVAILABLE = PHYSICAL - MEMORY E.3.2 E.3.3 By wo r k i ng b a c k f r om Equa t i o n E . 3 . 3 , i t i s po s s i b l e to o b t a i n the n umbe r o f a v a i l a b l e phys i c a l p ag e s i n t e rm s o f t h e c o n t e n t s of a SYSG EN p a r am e t e r f i l e a nd one more i np u t pa r am e t e r , the s i ze of phys i c a l m em o r y . E. 3. 2 Sys tem P r o c e s s e s Wh e n a t t em p t i ng t o a s s e s s the t o t a l m em o r y r equ i r ed by t h e s ys t em , o n e mo r e f a c t o r mus t b e t a k e n i n to a c c o un t . Al l memo r y r e s i d en t sys tem p ro c e s s e s r e q u i r e a n umbe r of pag e s e qua l to the i r r e spec t i ve wo r k i ng s e t s i ze s . Th e s ys tem p r o c e s s e s a r e : • J o b Co n t r o l l e r • P r i n t Sym b i o n t ( s ) • E r r o r Log g e r Fo rma t P r o c e s s ( E RRFMT ) • Ope r a t o r Commun i c a t i o n P r o c e s s ( O PC OM ) • D i s k AC P ( s ) • Mag ta pe AC P ( s ) e N e t wo r k AC P ( NETAC P ) e Remo t e Te r m i n a l AC P ( REMAC P ) ( I f any) ( At l e a s t o n e ) ( I f any) ( I f any) E-1 7 ( I f any) S I Z E OF SYSTEM VI RTUAL ADDRESS SPACE The amo un t o f memo r y r equ i r ed by t h e s e p r o c e s s e s c anno t b e c a l c u l a t e d in c l o s ed f o rm a s the e x e c u t i v e ' s m emo r y r eq u i r em e n t s a r e c a l c u l a te d f o r s ev e r a l r e a so n s . • • • Th e memo r y c o n s umed by a p r o c e s s i s i t s wo r k i ng s e t s i ze . Automa t i c wo r k i ng s e t s i ze ad j us tme n t c a u s e s th i s p r o c e s s ( Th i s a s s um e s t h a t the p r o c e s s a t t r i b u t e to v a r y o v e r t i m e . i n qu e s t i o n r e a ches i ts wo r k i ng s e t l i m i t , a r e a so na b l e a s s umpt i o n f o r s y s t em p r o c e s s e s . ) Th e wo r k i ng set o f any process in t h e s ys tem i s r e a d i l y a v a i l a b l e f r om t h e D I S P LAY u t i l i ty . Sha r i ng c o n f u s e s the i s s u e . Howe v e r , t h e SHOW SYSTEM c ommand l i s t s t h e ph ys i c a l mem o r y used by e a c h p r o c e s s i n the sys tem . Sys tem p r o c e s s e s c a n b e o u t swa pped , t em po r a r i l y r ed uc i ng phys i c a l memo r y r e qu i r em e n t s of t ho s e p r oc e s s e s to z e r o . the B e c a us e phys i c a l memo r y r eq u i r em e n t s o f s y s tem p r o c e s s e s v a r y o v e r t i me a nd c a n b e e a s i l y o b ta i n ed f r om a ut i l i ty s uc h a s D I S PLAY o r wi th t h e SHOW SYSTEM c omma nd , they a r e not i nc l ud ed in any e q ua t i o n s in t h i s c ha p te r . Howe v e r , the i r r equ i r em e n t s sho u l d b e t a ke n i n to a c c o un t wh e n a n y t ype o f c o n f i g u r a t i o n c a l c ul a t i o n i s m ad e . Th i s a ppe nd i x h a s p r ov i d ed a too l fo r c a l c u l a t i ng t h e memo r y r e qu i r em e n t s o f t h e e x e c u t i ve , a n umbe r th a t i s n o t s o r e a d i l y a v a i l ab l e . E.4 S I Z E S OF P I ECES OF P l S PAC E Mo s t o f t h e p i ec e s o f P1 s pa c e h a v e p r ed e t e rm i n ed s i z e s , b a s ed on the c o n t e n t s o f mod u l e S H E LL i n the e x e c u t i v e . Th i s mod u l e i nc l ud e s a s k e l e to n P l pag e ta b l e tha t i s used wh e n a p r o c e s s i s c r e a t ed to set u p a n i n i t i a l P l pag e ta b l e . Some pi e c e s o f P 1 s pa c e a r e d yn am i c a l l y c o n f i g u r ed , w i th s i ze s tha t a r e d e t e rm i n ed by a v a r i e ty o f t e c h n i q ue s . Tab l e E - 4 l i s t s the p i e c e s The fo l l o w i ng o f P 1 s pa c e a nd h o w t h e s i z e o f e a c h i s d e te rm i ned . l i s t i n c l ud e s d e ta i l s a b o u t e a c h d yn am i c po r t i o n o f P 1 spa c e . L i ke Pl s pa c e i t s e l f , t h e l i s t moves towa r d l o we r v i r t ua l a d d r e s s e s . 1. Al l o f the p i e c e s o f P 1 s p a c e f r om the d eb ug g e r symbo l tab l e to th e c h a nn e l control bloc k tab l e have the i r s i zes d e te r m i n ed by a s s em b l y t i m e pa r am e t e r s i n mod u l e SHELL . ( Th e spec i a l SYS B OOT pa r am e t e r C HANNE LCNT i s c u r r e n t l y unused . ) 2. Th e P 1 wi ndow to th e p r o c e s s h e ad e r i nc l ud e s a l l o f the p r o c e s s h e a d e r e x c e p t f o r pag e t a b l e pag e s ( Ta b l e E- 1 ) . Th e emp t y pag e s a r e i n c l ud ed i n the Pl wi nd ow . Se c t i o n E . 1 r e l a tes the s i ze o f t h e p r o c e s s h e ad e r to the r e l eva n t SYSB OOT p a r am e t e r s . 3. Th e LOG INOUT i m ag e m a ps the s e l ec t ed c omm a nd l a ng uag e i n te r pr e t e r i n to P l s pa c e fo r i n t e r a c t i v e a nd b a tch j o bs . (A m e r g ed imag e a c t i v a t i o n a c c ompl i s h e s th i s m a pp i ng . ) Th e s i ze o f the C L I i m a g e d e t e rm i n e s how m u c h s pa c e i s t a k e n up by the CLI . 4. Th e SYS BOOT p a r am e t e r C L I SYMTBL d e t e rm i n e s t h e numbe r o f d emand z e r o pag e s t h a t a r e c r e a ted b y LOG INOUT f o r t h e C L I s ymbo l t a b l e . E- 1 8 Tab l e E - 4 Deta i l ed Layout o f P l Space ( Va r iable S i z e Portion ) The s i ze o f the f i r s t po r t i o n o f P l s pac e , f r om the user s ta c k to the P l w i ndow to the pro c e s s head er , i s ma i n l y depend ent on SYSBOOT pa ramete r s . The s i ze s o f e a c h o f these pieces m a y v a r y fo r d i f fe rent sys t ems , d i f fe r en t processes i n the same system , or even d i ffe r en t imag e s i n the same process . Item Low Add ress End o f Pl Spa c e Use r Sta c k G l obal Add re s s o f Po inter @ PHD$L FREPlVA ( Of fset i n to the Pro c e s s Head e r ) Fac to rs Tha t Af fect S i ze Pro t own e r Pag eabl e Mapped by uw u Yes Imag e Ac t i va to r uw u Yes Imag e Ac t i v a to r I OS EGMENTS ( L i n k Time Opt ion) UREW E Yes Imag e Ac t i vato r Si ze of Me ssag e Sec t i o n UR E Yes SET M ESSAGE Command CLISYMTB L URSW s Ye s LOGINOUT CLI Imag e Si ze UR s Yes LOGINOUT Si ze o f the Process Head e r SRKW K No Cod e i n SHELL STACK ( L i n k Time Opt ion) = Ex tra Use r Sta c k Pag es EXUSRSTK Image I/0 Segment @ P IO$GW I I OIMPA + 4 @ CTL$AL=S TACK + ( 3 *4 ) (S ) Bo und ary be tween Process-Pe rman ent and Imag e-Spec i f i c Pieces of P l Space @ CTL$G L_CTLBASVA ( 1 ) Pe r -Process Mes sag e Sec t i on @ CTL$G L_PPMSG C L I Symbol Tab l e C LI Imag e @ CTL$AG_C LIM AGE In i t i a l End o f Pl Spa c e for Every Pro c ess i n Th i s System @ MMG$G L_C TLBASVA ( 2 ) P l Wi ndow to Process Head er @ CTL$G L_PHD = (continued on next page ) Detai l ed Layout of P l Space ( F ixed S i z e Port ion ) The rest o f P1 space i s f i x ed in s i ze and locations fo r a l l possible systems . The si zes o f each o f these pieces are determined by assembly t ime pa rameters in modul e SHELL . These pieces ' a re impl i c i tl y mapped by the Swapper when the skeleton P1 pag e tabl es a r e swapped in from the shel l process at the t ime that the process i s c reated . Global Add ress Add ress or G l obal Add ress o f Po inter = Item Channel Co ntrol Block Table Process I/O Segment Si ze in Pag es Prot OWner Pag eabl e 4 pages UREW E Yes 3 0 pag es UREW E Yes 7FFE2C OO 4 pag es uw K Yes 7FFE3400 4 pag es uw K Yes 7FFE3C O O 7FFE3C O O 1 pag es uw K Yes 7FFE3E OO 4 pag es uw s Yes 7FFDE 8 0 0 7FFDFOOO PI O$G L FMLH @ CTL$GL-RMSPP CTL$G L-CCB + 16 7FFDF O O O ( S ) @ CTL$G L=CCBBASE + 1 6 ( S ) = = Pe r-Process Common fo r Users Pe r-Process Common fo r DIGITAL CTL$A_COMMON Compa t i b i l i ty Mode Da ta Pag e CTL$AG CMEDATA CTL$AL=CMCNTX = = = no t cur rently used Process Al location Reg ion 7FFE4600 46 pag es UREW K Yes Gen e r i c CLI Da ta Pag es CTL$AL_CLICALBK = 7FFEA200 3 pages URSW s Yes Image Ac tivato r Sc ratch Pag es MMG$IMGACTBUF = 7FFEA800 8 pag es uw u . Yes 7FFEB800 4 pages uw u Yes = 7FFECOOO 2 pag es UREW K Yes = 7FFEC 4 0 0 1 pag e uw s Yes 7FFEC600 1 pag e NA K Debugger Co ntext Pag es Vec to rs fo r User-Wr i tten System Serv ices and Pe r-Imag e or Pe r-Process Messages CTL$A_DISPVEC Imag e Header Buffer MMG$IMGHDRBUF @ CTL$G L_IMGHDRBF No Access Gua rd Pag e Ke rnel Stack CTL$G L KSTKBAS 7FFEC800 ( S ) @ CTL$AL=STACK + ( - 1 *4 ) ( S ) 3 pag es SRKW K No Execut ive Stack 7FFECEOO ( S ) CTL$G L KSPINI @ CTL$AL=STACK + ( 0 *4 ) ( S ) 8 pages SREW E Yes Supe rv i so r Stack 7FFEDEOO @ CTL$AL_STACK + ( 1 *4 ) ( S ) 16 pag es URSW s Yes P l Po inter Pag e CTL$G L VECTORS 7FFEFEOO @ CTL$AL=STACK + ( 2 *4 ) ( S ) 1 pag e URKW K No Debugger symbol Table = = = 1 28 pag es @ In the g lobal add ress c o l umn , symbo l names pr eced ed by the symbo l @ a r e the add resses o f po inte r s to the spec i f i c po rt ions o f P l space . Symbo l names wi th no pr eced i ng @ s ign a re the ac tua l add resses o f the areas i n quest i o n . (S) Stacks g row towa rd s sma l l e r v i r tua l add resse s . Th i s i s the reason for the seem i ng anomal y i n the addresses and po i nt e r s that d e l im i t the four pe r-process stacks . The channel control block tab l e a l so g rows towa rd sma l l e r v i rtual add resse s . a. Gl obal l o c a t i o n CTL$AL STACK i s the address o f a four l ongwo rd a r r a y whose e l ements conta i n the i n i t i a l va l ue s o f t h e four pe r-process s t a c k po i nte r s . A n a r r ay e l ement c a n b e indexed wi th t h e access m o d e a s an argument . A f i fth l o ng wo rd , preced i ng the a r ray and accessed wi th an i nd ex of - 1 , l ocates the l ow add ress end o f the ke rnel stac k . I n the tab l e , the expl i c i t mul t i pl i cat ions r e f l ect the add re ss i ng i n l ongwo rd contex t . Tha t i s , b. CTL$AL_STACK + 3 *4 l ocates the beg i nn i ng o f the user s tac k . CTL$AL_STACK + 2 *4 l ocates the beg i nn i ng o f the s upe rv i so r stac k . CTL$AL_STACK + 1 *4 l ocates the beg i nn i ng o f the executive stac k . CTL$AL_STACK + 0 *4 l ocates the beg i nn i ng o f the k e rnel stac k . CTL$AL_STACK + -1 * 4 l ocates the end o f the ke rnel stac k . mul t i pl i c a t i on by four tha t is impl i ed by i ndexed CTL$GL CCB i s the add r e s s o f the channel control b l o c k for channel o . The channe l numbe r returned to the cal l e r o f the Ass i g n Ch annel sys tem serv i c e ( o r some o ther sys tem serv i c e o r RMS cal l ) i s a neg a t i ve byte index from th i s loca t ion to the beg i nn i ng o f the channel contr o l b l o c k f o r the sel ec ted channe l . (1) The contents o f l oca t ion CTL$G L CTLBASVA l ocate the bound ary between the image-spec i f i c po r t i o n o f P l space ( del eted at image ex i t by rout ine MMG $IMGRESET) and the process-pe rmanent po r t i on of Pl space . (2) The contents o f g l obal l o c a t i o n MMG$GL C TLBASVA l ocate the i n i t i a l s i ze o f P l space , i nc l ud i ng the l i nked exec utive a nd the P l wi ndow to the proc e s s heade r . Al l processes have th i s a s the i r i n i t i a l s i ze o f Pl s pace . As command l a ng uage interpr ete r s and o ther dynam i c po r t ions o f Pl space s uch as process-pe rmanent message secti ons a re added , l o c a t i o n CTL$GL_CTLBASVA is upd a ted to r e f l ec t the chang e . S I Z E OF SYSTEM VI RTUAL ADDRESS S PACE 5. Th e spec i a l SYSBOOT pa r am e t e r I MG I OCNT d e t e rm i n e s the d e f a u l t n um b e r o f pag e s th a t a r e c r e a te d by t h e i m ag e a c t i va to r fo r t h e i m a g e I /O s egmen t , t h e RMS i m pu r e a r e a fo r f i l e s o pe n ed d u r i ng the e x ec ut i o n of a spec i f i c i m ag e . Th e d e f a ul t n um b e r of imag e I /O s eg me n t pag e s c a n ov e r r i d d en f o r a spe c i f i c i m ag e b y i nc l ud i ng the l i n e I OS EGM ENT = be n , [ [N O ] P O BUFS ] a s a pa r t o f the l i n k t i m e o p t i o n f i l e . 6. Th e spe c i a l SYS BOOT pa r am e t e r EXUS RSTK d e t e rm i n e s the n um b e r of e x t r a pag e s t h a t a r e a l l o c a te d f o r t h e us e r s t a c k b y the i mag e a c t i v a to r . Th e s e pag e s a r e not u s ed for the use r stack . Ins tead , t h e y a r e a t a h i g h e r v i r t ua l a d d r e s s t h a n t h e i n i t i a l v a l ue o f the u se r s ta c k po i n t e r . Th e s e p a g e s a l l ow t h e o pe r a t i ng s y s tem to r e c o v e r i f the use r s t a c k i s c o r r upted . 7. Th e s i z e o f t h e us e r s t a c k i s d e te rm i n ed by t h e opt i o n STACK = n i n an o p t i o n s f i l e a t l i n k t i m e . i s twe n t y pa g e s . Th e d e fa u l t us e r s t a c k s i ze Be c a us e t h e s t a c k i s a utoma t i c a l l y e x pa nd ed by the sys t em ' s a c c e s s v i o l a t i o n h a nd l e r wh e n the us e r s t a c k o v e r f l o ws , the r e i s l i t t l e n e ed fo r u s i ng th i s opt i o n . One po s s i b l e use m i g h t be fo r a n i m a g e th a t r equ i r e s a l a rg e a m o un t o f s ta c k s pa c e b u t c a n n o t a f fo r d t h e o v e r h e a d r e q u i r ed fo r a utoma t i c stac k e x pa ns i o n a t r un t i m e . E- 2 2 APPEND I X F VAX/VMS VE RS I ON 2 . 2 ENHANCEMENTS Two f unc t i o na l c h a ng e s we r e m a d e to VAX/VMS w i th the Ve r s i o n 2 . 2 ma i n t e n a n c e rel ease . Th e s e c h a ng e s a l t e r the wa y two compo n e n t s d e sc r i b ed i n th i s m a n ua l o p e r a t e . Be c a u s e t h e s e c h a ng e s we r e p u t i n t o the sys tem wi t h pa t c h e s to the e x e c u t i v e , t h e y we r e r e s t r i c ted i n t h e c h a ng e s tha t c o u l d b e mad e to the sys t em . It is l i ke l y t h a t these c h a ng e s w i l l a ppe a r i n Ve r s i o n 3 o f VMS i n a s l i g h t l y d i f f e r e n t fo rm th a n they a ppe a r in Ve r s i o n 2 . 2 . On e o f the chang e s a d d s a s e c o nd l o o k a s i d e l i s t to t h e nonpag ed po o l a l l oc a t i o n s c h eme . Th e f i x ed pa c k e t s i ze i n th i s s e c o nd l i s t i s c o n t r o l l ed b y a S YS B OO T p a r am e t e r b u t i s t yp i c a l l y s e t to 5 7 6 bytes . Th i s c h ang e wa s mad e to impr ove DECn e t pe r f o rm a n c e a f t e r i t wa s d i s c o v e r ed t h a t DECn e t wa s s p e nd i ng a c o n s i d e r a b l e amo un t o f t ime a l l o c a t i ng DECn e t r e c e i v e b u f f e r s f r om nonpag ed po o l . Th e s e c o nd chang e a l t e r s t h e t e c h n i que fo r c o un t i ng s l o t s in a swa p f i l e b a s ed on the s i ze o f the swa p f i l e a nd t h e SYSB OOT pa r am e t e r WSMAX . Th i s c h a ng e r emo v e s t h e Ve r s i o n 2 r e s t r i c t i o n o f no mo r e than 256 p r ocesse s . Th e n e w uppe r l i m i t o n the num b e r o f p r o c e s s e s tha t c a n b e c r e a t ed i s 8 1 9 2 . No t e , h o we ve r , th a t o th e r sys t em r e so u r c e s wi l l a l mo s t s u r e l y b e exh a u s ted b e fo r e th i s l i m i t i s r e a c hed . F. l S ECOND LOOKAS IDE LIST I n Ch a pt e r 2 5 , the u s e of two nonpag ed po o l a l l o c a t i o n s c h em e s wa s d i s c us s ed . Th e I /0 l o o k a s i d e l i s t c o n s i s t ed o f a n umb e r ( I R PC OUN T ) o f f i x ed s i ze b l o c k s l i nked tog e th e r . Th i s l i s t wa s e s t ab l i shed b y t h e i n i t i a l i za t i on code i n mod u l e INIT . Th e no npag ed po o l a l l o c a t i o n r o u t i n e c h e c k ed the r e qu e s t ed s i z e ag a i n s t t h e s i z e o f a n I/O r e que s t pa c k e t . I f t h e r e qu e s ted s i z e wa s sm a l l e r than o r equa l t o t h e s i z e o f a n I RP , a n a l l o c a t i o n wa s a t tempted f r om the l o o ka s i d e l i s t ( wi th a s i ng l e REMQUE i n s t r uc t i o n ) . On l y i f th i s a l l o c a t i o n f a i l ed wa s t h e mo r e g e n e r a l ( bu t s l owe r ) a l l o c a t i o n r o u t i n e c a l l ed . Th e Ve r s i o n 2 . 2 e nha n c em e n t e x p a nd s o n t h i s s c h em e o f f i x ed s i ze b l o c ks l i nked tog e th e r . Two s pe c i a l SYSB OOT p a r ame te r s c o n t r o l t h e l i s t pa r ame te r s . Th e pa r ame t e r LRPCNT ( a na l og o u s to IRPC O UNT ) d e t e rm i n e s the n um b e r o f b l oc k s th a t a r e s e t a s i d e by the i n i t i a l i z a t i o n r o u t i n e fo r t h i s s e cond l o o ka s i d e l i s t . Th e si ze of each block i s d e t e rm i n ed b y the pa r ame t e r LRPS I Z E ( a n a l o g o u s t o t h e a s s emb l y t i me c o n s t a n t I RP $ K_L ENGTH ) . F-1 VAX/VMS VE R S I ON 2 . 2 ENHANC EMENTS F. l. l I n i t i a l i za t i o n o f S e c o nd L o o k a s i d e L i s t Th e i n i t i a l i z a t i o n o f t h i s po o l a r e a i s p e r f o rmed by SYS I N I T . ( Th i s i s d o n e b e c a u s e i t i s e a s i e r to r e l e a s e a n e w SYS I N I T i m ag e th a n pa tch t h e I N I T mod u l e in the e x e c u t i ve i mag e SYS . E XE . ) Fi r s t , the s 1 ze p a r ame t e r i s max i m i z e d w i t h I RP $ K L ENGTH . ( I t wo u l d b e us e l e s s to a l l ow t h e s econd l o o ka s i d e l i s t to h ave a b l o c k s i z e sma l l e r than an I RP . ) Wo r k i ng und e r the a s s um p t i o n tha t these b l o c ks wi l l b e u s e d b y D E Cn e t , t h e v a l ue o f LRPS I Z E i s a d d ed to 6 4 ( fo r DECn e t o v e r h e ad ) , and the r esul t is t r un c a ted to a m u l t i pl e of 1 6 . To p r ev e n t i n t e r n a l f r ag m e n t a t i o n ( u s e o f t h e s e b l o c k s f o r s i z e r e que s t s much sma l l e r t h a n the b l o c k s i z e ) , th e nonpag ed po o l a l l o c a t i o n r o u t i n e w i l l o n l y u s e t h i s l i s t i f t h e r eque s t ed s i ze i s b e twe en 8 0 % and 1 0 0 % o f t h e upd a t ed s i ze . Th e m i n imum va l ue ( a l s o t r un c a t e d to a m u l t i pl e of 1 6 ) a nd the u pd a ted p a c k e t s i z e are s to r ed fo r l ater use by t h e a l l o c a t i o n r out ine . A b l o c k o f n o npag e d po o l i s t a k e n f r om t h e h i gh a d d r e s s e nd of the g e n e r a l n o npag ed po o l a r e a , i mmed i a t e l y p r e c ed i ng the l o c a t i o n po i n t ed to by t h e c on t e n t s o f E XE $G L S PL I TADR ( Fi g u r e 2 5 -4 ) . Th i s a r e a is t h e n d i v i d ed i n to e qua l s i z e b l o c k s ( d e t e rm i n ed b y LRPS I Z E ) . Th e r eque s t ed l a rg e pa c k e t c o un t ( LR PCNT ) i s m i n im i zed wi th t h i s c o un t o f e qua l s i zed b l oc ks . Th e s e b l o c k s a r e t h e n l i n k e d tog e th e r ( wi t h a s e r i e s o f I N S QUE i ns t r uc t i o n s ) . Th e bo und a r y b e twe e n the l o w add r e s s e nd o f t h i s s e c o nd l o o ka s i d e l i s t a nd t h e g e ne r a l po o l a r e a i s s a v ed ( fo r the d e a l l o c a t i o n r o u t i n e ) . Th e r e i s a to t a l o f f i v e l o ng wo r d s ( c u r r en t l y l o c a t ed i n the nonpag ed r e a d /wr i t e pa tch a r e a ) th a t d e sc r i b e th i s s e c o nd l o o k a s i d e l i s t . Th e y a re : Upd a t ed S i ze o f P a c k e t s ( t r un c a ted t o m u l t i pl e o f 1 6 ) 8 0 % o f th i s upd a t ed s i ze ( a l so t r un c a ted to m u l t i pl e o f 1 6 ) Fo r wa r d L i n k f o r Lo o k a s i d e L i s t Ba c kwa r d L i n k f o r Lo o k a s i d e L i s t Bo und a r y b e t we en S e c o nd Lo o k a s i d e L i s t a nd G e n e r a l Po o l Ar e a F. l.2 No npag ed Po o l Al l oc a t i o n a nd De a l l o c a t i o n Wh e n o ne o f the no npag ed po o l a l l o c a t i o n r o u t i ne s is c a l l ed , the r eque s t ed s i ze i s f i r s t c ompa r ed to the s i z e o f a n I R P , a s b e fo r e . If t h i s c h e c k i nd i c a t e s t h a t the r e q u e s ted s i ze i s l a r g e r t h a n a n I R P , a s e c o nd c h ec k i s now m ad e . I f t h e r e que s t e d s i ze i s sma l l e r t h a n the upd a ted p a c k e t s i z e but l a rg e r t h a n 8 0 % of the upd a ted pa c ke t s i z e ( p r e c ompu t ed b y t h e i n i t i a l i z a t i o n c od e ) , t h e n a n a l l oc a t i o n i s a t t empted f r om t h e s e c o nd l o o k a s i d e l i s t . I f tha t l i s t i s empt y , the g e n e r a l po o l a l l o c a t i o n r o u t i n e i s c a l l ed . Wh e n a b l o c k o f memo r y i s d e a l l o c a t e d to nonpag ed po o l , a chec k is mad e to d e te rm i n e wh e th e r i ts a d d r e s s i s l a rg e r than the c o n t e n t s o f E XE $G L S PL I TADR . I f s o , t h e b l o c k i s d e a l l o c a t ed to the I /O l o o ka s i d e l i s t (wi th a n I N S QUE i n s t r uc t i o n ) . I f the b l o c k l i e s b e twe e n the two bound a r i e s o f t h e s e c o nd l o o ka s i d e l i s t , then the b l o c k i s d e a l l o c a t ed to tha t l i st ( w i th a n I N S QU E i n s t r uc t i o n to a s e c o nd l i s th e ad ) . F- 2 VAX/VM S VE RS I ON 2 . 2 ENHANC EMENTS F i n a l l y , i f the b l o c k i s l o c a t ed at a l o we r add r e s s t h a n t h e s e c o nd looka s i d e l i st , then the block i s d e a l l o c a ted to the g en e r a l po o l a rea . F. 2 CHANGE TO SUPPORT A LARGE NUMBER OF PROC ESSES I n Ve r s i o n 2 of VM S , t h e swa p f i l e t ab l e e n t r i e s ( S FTE , p i c t u r ed in Figure 1 1-23 ) t h a t d e sc r i b ed the two po s s i b l e swa p f i l e s we r e s t a t i c a l l y a l l o c a ted wh e n t h e e x e c u t i v e wa s l i nked . Th e bi t map in e ach S F TE wa s 1 2 8 b i t s l o ng , l i m i t i ng the n umbe r o f swa p s l o t s i n a I n a d d i t i o n , t h e s l o t c o un t wa s s to r ed in a g i v e n swa p f i l e to 1 2 8 . byte . F. 2. 1 Swa p F i l e I n i t i a l i za t i o n Th e c h a ng ed a l l o c a t i o n s c h e m e i s i m pl eme n ted i n bo th S YS I N I T , fo r the d e f a u l t swa p f i l e SWAPF I L E . SYS , a nd in the SYSGEN u t i l i t y , to a c commod a te a s e c ond swa p f i l e mad e k n o wn to the s ys t em wi th the I N S TA L L/SWAPF I LE c omma n d . Und e r the c h a ng ed a l l o c a t i o n s c h eme , the s wa p f i l e s i z e is d i v i d ed b y the wo r k i ng set m a x i m um ( WSMAX ) to g i v e t h e s l o t c o un t fo r t h e s wa p f i l e b e i ng i n i t i a l i z ed . I f the s l o t c o u n t i s no t l a rg e r than 128, n o th i ng is c h ang ed f r om the Ve r s i o n 2 i mpl em e n t a t i o n . I f the r e i s r o om fo r mo r e t h a n 1 2 8 s l o t s i n the swa p f i l e , t h e n a n e w s wa p f i l e t ab l e e n t r y i s a l l o c a ted f r om n o npa g ed po o l . Th i s S F T E h a s a n ex t end ed b i tm a p to a c commod a t e the to t a l n umber of slots i n the file. Th e a pp r o p r i a t e en t r y in t h e pag e a nd swa p f i l e vec to r ( F i g u r e 1 1 - 2 2 ) i s upd a te d to l o c a t e the n e w S FTE . Und e r the cur rent impl em e n ta t i o n , t h e s e c o nd entry ( en t r y 1) i s upd a t ed f o r a l a rg e SWAPF I LE . SYS a nd the th i r d entry ( entry 2 ) i s upd a t ed fo r an a d d i t i o na l swa p f i l e . F.2.2 Process Li m i t s Onc e the s l o t c o un t i s d e t e r m i n ed a nd the SFTE h a s b e e n a l l o c a t ed a nd i n i t i a l i z ed , t h e uppe r l i m i t o n t h e n um b e r o f p r o c e s s e s th a t t h e s y s tem c a n s uppo r t ( s to r ed i n l o c a t i o n S C H$GW PROC L I M ) i s upd a t ed as b e fo r e . Th e o n l y d i f fe r e nc e i n th i s s t ep- i s t h e n e w r a ng e th a t i s a l l o we d b y r emo v i ng t h e l i m i t i m po s e d b y swa p f i l e s l o t c o un t . No te tha t the p r o c e s s l i m i t i s s t i l l bo unded by t h e SYSB OOT p a r am e t e r MAXPROC ESS CNT . Th us , i n o rd e r to c r e a t e a s ys t em th a t s uppo r t s a l a rg e n um b e r o f p r o c e s s e s , t h r e e s t e p s m u s t b e t a k e n . • • • A l a r g e s wa p f i l e mus t b e c r e a t ed . Cu r r e n t s ug g e s t th a t a m ul t i v o l um e f i l e i s r e qui r ed . MAXPROC E S S CNT m u s t b e c h a ng ed p r o c e s s e s tha t a r e r eq u i r ed . to WSMAX s h o u l d b e k e p t r e a so n a b l y e f f i c i e n t u s e o f t h e swa p f i l e . sma l l F-3 r e f l ec t to d i sk s i ze s the n umbe r al low the of mo s t VAX/VMS VER S I ON 2 . 2 ENHANCEMENTS Th e s e th r e e c h a ng e s s i mpl y r emove t h e abso l u t e l i m i t s i mpo s ed by VMS . Othe r s ys tem r e so u r c e s s uc h a s phys i c a l m em o r y , pag e f i l e spa c e , a nd o th e r s e c o nd a r y s to r ag e a r e a l so r e q u i r ed to r un a sys tem w i th a l a rg e n umb e r o f proc e s s e s . L i m i t s i mpo s ed by l a c k o f t h e s e r e s o u r c e s c a nn o t b e c a l c u l a ted b u t c a n o n l y be d e t e rm i ned by l o o k i ng at a spe c i f i c s ys tem c o n f i g u r a t i o n . A f i n a l c omm e n t i s r e q u i r ed o n t h e a b s o l u t e l i m i t o f 8 1 92 processes that e x i s t s i n Ve r s i o n 2 . 2 . Th e r e i s a n a r c h i t e c t u r a l l i m i t o f 6 5 5 3 6 p r oc e s s e s t h a t c a n ex i s t i n a VM S s ys t em . Th i s l i m i t is i mpo s ed by the use of a wo rd w i t h i n the p r o c e s s ID as a n i nd ex i n to the PC B v e c to r ( Ch a p t e r 1 7 ) . Th e Ve r s i o n 2 . 2 enh a n c em e n t e x t end s the s wa p s l o t c o un t wi th i n a s i ng l e swa p f i l e t o th i s a r c h i tec t u r a l l im i t . Th e l i m i t o f 8 1 9 2 p r o c e s s e s e x i s t s d ue to the s i ze o f i n t e r n a l tables in the S HOW i mag e tha t i mp l em e n t s t h e SHOW/ SYS TEM c omma nd . ( Th i s l a s t l im i t i s o bv i o u s l y a r t i f i c i a l a nd w i l l b e e x tend ed wh e n phys i c a l r e so u r c e s s uc h a s m emo r y a nd d i s k s i ze r e qu i r e i t . ) F-4 INDEX $ADJSTK s e e Ad j us t O u t e r Mo d e S t a c k Po i n t e r $ADJWSL see Ad j u s t Wo r k i ng S e t L i m i t $A L L OC s e e Al l o c a t e Dev i c e $ASC EFC s e e As s o c i a t e Comm o n Event Fl ag C l u s t e r $ASCTIM s e e Conve r t B i n a r y T i m e to ASC I I S t r i ng $ A S S IGN s e e As s i g n Ch a n n e l $ B INTIM see Conve r t AS C I I S t r i ng to B i n a ry T i me $ B RDC S T s e e B r o ad c a s t $ C ANC E L s e e C a n c e l I /O o n Ch a n n e l $ CANEXH s e e C a n c e l Ex i t Ha nd l e r $ CANT IM s e e Ca n c e l T i m e r Reque s t $ CANWAK s e e C a n c e l Wa k e up $ C LREF see C l e a r Event F l ag $ CM EXEC see Ch a ng e Mo d e to Exec ut ive $ CMKRN L s e e Ch a ng e Mo d e to Ke r n e l $ C NTREG s e e Co n t r a c t Reg i o n $ C RE LOG s e e C r e a t e Log i c a l Nam e $ C REMBX s e e C r e a t e Ma i l box $ C REPRC s e e C r e a te P r o c e s s $ C RETVA s e e C r e a t e Vi r t ua l Ad d r e s s S pa c e $ C RMPSC s e e C r e a t e a nd Ma p Sec t i o n $ DAC E FC s e e Di s a s so c i a t e Commo n Ev e n t Fl ag C l us t e r $ DALLOC see De a l l o c a t e Dev i c e $ DAS SGN s e e De a s s i g n Ch a n n e l $ D C LAS T s e e Dec l a r e AST $ DC LCMH see De c l a r e C h a ng e Mo d e o r Compa t i b i l i ty Mod e Hand l e r $ DC LEXH see De c l a r e E x i t Ha nd l e r $ D E LLOG see De l e te Log i c a l Name $ DE LMBX see De l e te Ma i l b o x $ D E L PRC s e e De l e te P r o c e s s $ D E L TVA s e e De l e te V i r t ua l Ad d r e s s Spa c e $ DGBLSC s e e De l e te G l o b a l S e c t i o n $ D LC E FC s e e De l e t e Commo n Eve n t Fl ag C l us te r $ EXIT s e e Ex i t $ EXPREG see Expa nd Reg i o n $ FAO s e e Fo rma t t ed ASC I I Ou tput $ FAOL see Fo rma t ted ASC I I Ou tput $ FORC EX s e e Fo r c e Ex i t $ G E TC HN s e e G e t I /O Ch a nn e l I n fo rm a t i o n $ G E TDEV see Get I/O Dev i c e I n fo rma t i o n $GETJ P I s e e G e t Job/P r o c e s s I n fo rma t i o n $G E TMSG see Get Me s sag e $G ETT IM s e e Ge t T i me $ H I BER see Hi bernate $ LC KPAG s e e Lo c k Pag e s i n Memo r y $ L KWSET s e e Lo c k Pag e s in Wo r k i ng S e t $ MGBLSC s e e Ma p G l o b a l S e c t i o n $NUMTIM s e e Conve r t B i n a r y T i me to Nume r i c T i m e $ P URGWS s e e Pu r g e Wo r k i ng S e t $ P UTM SG see Put Me s sa g e Index-1 INDEX $QIO s e e Q u e u e I /O Re q u e s t $ Q I OW s e e Que ue I/O Re q u e s t $ READE F s e e Re a d Ev e n t Fl ag $ R E S UM E s e e Re s um e P r o c e s s $ S C HDWK s e e S c h e d u l e Wa k e up $ S ETAST s e e S e t A S T Enab l e $ S ETEF see S e t Ev e n t F l a g $ S ETEXV s e e S e t Exc ept i o n Ve c to r $ S E T IM E s e e S e t Sys t em T i m e $ S ET IMR see Se t T i m e r $ S ETPRA s e e S e t Po we r Re c ov e r y AST $ S ETPR I s e e S e t Pr i o r i ty $ S ET PRN s e e Se t Pr o c e s s Name $ S E TPRT s e e S e t P r o tec t i o n o n Pag e s $ S E T PRV s e e S e t Pr i v i l eg e s $ S ETRWM s e e Se t Re s o u r c e Wa i t Mo d e $ S ETS FM s e e S e t Sys tem Se rv i c e Fa i l u r e Mo d e $ S E TSWM s e e S e t Pr o c e s s Swa p Mod e $ SNDACC see S e nd Me ssag e to Ac c o un t i ng Ma n a g e r $ S NDERR s e e Send Me s s ag e to E r r o r Log g e r $ S NDO PR s e e S e nd Me ssag e to Ope r a to r $ SNDSMB s e e S e nd Me s s ag e to Sym b i o n t Ma n ag e r $ S US PN D s e e S u s pend P r o c e s s $ TRN LOG s e e T r a n s l a te Log i c a l Name $ U LK PAG s e e Un l o c k Pag e s f r om Mem o r y $ U LW S E T s e e Un l o c k Pag e s f r o m Wo r k i ng S e t $ UNW IND see Unw i nd Ca l l S t a c k $ U PDS EC s e e Upd a t e Sec t i o n $WA I T FR s e e Wa i t fo r S i ng l e Ev e n t F l ag $WAKE s e e Wa k e P r o c e s s $WFLAND s e e Wa i t fo r Log i c a l AND o f Even t Fl ag s $WFLOR s e e Wa i t fo r Log i c a l OR o f Eve n t F l a g s A Abo r t s , 2 - 8 , 7 - 1 0 Tab l e 2-1 Ac c e s s mod e , x x x , 1 - 1 7 , 1 - 1 9 , 3 - 1 2 , 5 - 2 to S -4 , S - 7 , 7 - 5 , 7 - 9 , 8 - 1 6 , 8 -2 3 , 1 0- 1 1 F i g ure 1-4 F i g u r e 1 1 -7 Ta b l e 9 - 1 T a b l e 1 1 -1 a nd l og i c a l nam e s , 2 6- 1 , 2 6 -4 Ac c e s s r i g h t s b l oc k ( ARB ) , 1 7- 3 , 1 8- 2 4 F i g u r e D- 1 F i g u r e D- 2 Tab l e 1 8-1 Ac c e s s v i o l a t i o n e x c e p t i o n , 2 - 9 , 1 3 -3 T a b l e 2-1 Tab l e 2-2 Ac c o un t n am e , 1 7 - 1 6 , 2 0 -7 , 2 7 - 2 Ta b l e 1 7 - 2 Ac c o un t i ng i n fo rm a t i o n , 5 - 1 1 , 1 1 - 2 , 2 7-1 Ac c o un t i ng m a n ag e r ( j ob cont r o l l e r ) , 1 9- 3 , 2 7-1 Ta b l e 1 9 - 1 AC P s e e F i l e s- 1 1 ACP s e e mag n e t i c tape AC P s e e n e two r k AC P ACP BAS E PR I O SYSBOOT p a r am e te r , a:: 1 9 AC P DATAC HECK SYSBOOT p a r a m e te r , a:: 1 9 AC P D I RCAC HE SYSBOOT p a r am e te r , a:: 1 8 AC P E XTCAC HE SYSBOOT pa r am e t e r , a::1 9 AC P E XTLIM I T SYS BOOT pa r ame t e r , a:: 1 9 AC P F I DCACHE S YSBOOT pa r am e t e r , a:: 1 9 I nd ex - 2 INDEX ACP HDRCAC HE SYSBOOT p a r ame t e r , s= l a AC P MAPCACHE SYSBOOT p a r am e t e r , s= l a AC P MAXREAD SYSB OOT pa r am e te r , s=l 9 ACP MULT I PLE SYSBOOT -pa r am e t e r f l ag , B-17 A C P QUOCACHE SYSBOOT p a r am e t e r , s= l 9 AC P S HARE SYSB OOT p a r am e t e r f l ag , B-1 7 A C P SWAPFLGS SYS B O OT p a r ame t e r , s=l 9 AC P S Y SACC SYSBOOT pa r am e t e r , s= l 9 AC P W I N DOW SYSB OOT p a r am e t e r , l S- 4 , B- 1 9 ACP WORKS E T SYSBOOT pa r am e t e r , s= l 8 AC P WR I TEBAC K SYSB OOT p a r am e t e r , s= l 9 Ac t i ve and v a l i d PFN s t a t e , 1 2-4 , 1 2- 1 9 Figure 1 1-11 Figure 1 2-3 Fig ure 1 2-4 Figure 1 2-5 F i g u r e 1 2-6 Ta b l e 1 4 -4 Ac t i v e t r a n s i t i o n p ag e , 1 2 - 1 8 , 1 4 -2 6 Ad a p t e r c o n t r o l b l o c k ( ADP ) Figure 6-3 Ad d r e s s t r a n s l a t i o n , 1 - 1 6 to 1 - 1 7 , 8 - 2 1 , 1 1 - 2 , 1 2-1 , 1 2-3 Ad d r e s s t r a n s l a t i o n b u f f e r , 8 - 2 8 Ad j u s t S t a c k s y s tem s e rv i c e ( $ ADJSTK ) , 1 3 -3 to 1 3 - 4 Ad j u s t Wo r k i ng S e t L i m i t s y s t em s e rv i c e ( $ ADJWS L ) , 1 3- 1 0 to 1 3-1 2 , 1 3-1 4 , 1 8- 2 2 Ta b l e 1 3 - 1 A l l o c a t e Dev i c e s ys t em s e rv i c e ( $ A LLOC ) , 1 6 - 4 to 1 6 - 5 Ta b l e 2 4 - 2 ALLOC PFN m od u l e i n s ys t em i m a g e Ta b l e 1 4 - 3 Al te r na t e s ta r t I /O e n t r y po i n t , 1 5-9 ALTPR I p r i v i l eg e , 9 - 1 1 , 1 7 -6 An c i l l a r y c o n t r o l p r o c e s s s e e F i l e s- 1 1 AC P Anc i l lary contro l proce s s , ( cont . ) , s e e mag n e t i c t a pe ACP s e e n e two r k AC P Arg um e n t l i s t , 3 - 5 , 5 - 8 t o 5 - 9 Figure 2-3 Fig ure 2-4 F i g u re 3-2 Figure 3-6 Figure 5-2 Arg um e n t po i n t e r ( AP ) , 2 7 - 7 Ar i t hm e t i c e x c e p t i o n s , 2 - 9 Tab l e 2 - 1 T a b l e 2-2 Ta b l e 2 - 3 As s i g n Channe l s ys t em s e rv i c e ( $ AS S I GN ) , 1 6- 1 Ta b l e 2 4 - 2 As s o c i a t e Comm o n Ev e n t Fl ag C l u s t e r s ys t em s e rv i c e ( $ ASC E FC ) , 9-1 , 9- 1 4 Ta b l e 9 - 1 A S S UM E m a c r o , A- 3 AST , 1 - 1 4 , 5 - l e x e c u t i v e mod e , 3 - 1 2 k e r n e l mod e , 1 3 - 1 4 s pe c i a l ke r n e l mod e s e e s pe c i a l ke r n e l AST s upe r v i so r mod e , 2 0 - 9 , 2 0 - 1 4 u s e r mode , 9 - 1 0 AST a rg um e n t l i s t Figure 5-2 AST c o n t r o l b l o c k ( AC B ) , 5 - 2 , 5-4 , 5 -1 3 , 1 0- 8 , 1 8- 2 3 , D-3 Figure 5-l AST d e l i v e r y , 3 - 1 2 , 5 - 6 , 8 - 1 5 , 8 - 2 3 , 9-5 , 1 0-7 , 1 0 -1 1 , 1 2-2 9 , 1 3- 3 t o 1 3 -4 Figure 1-5 Ta b l e 4 - 1 Ta b l e 2 4 - 1 A S T d e l i ve r y i n te r r up t , 8 - 1 4 , 2 4 - 5 AST d e l i v e r y s t a c k f a u l t , 2 - 1 3 Ta b l e 2 - 2 A S T e n q ue u i ng , 5 - 2 , 5 - 4 , 8 - 1 , 8 - 1 0 t o 8 - 1 1 , 8 - 1 3 to 8 - 1 5 , 2 4 - 5 , 2 7 - 8 to 2 7 - 9 Figure 8-5 AST ex i t pa th , 3 - 1 0 , 5 - 8 Figure 3-4 A S T l ev e l r eg i s t e r ( PR $ A S T LVL } , 5 - l t o 5 - 2 , 5 - 5 t o 5 -6 , 8 - 2 0 , 8 - 2 7 to 8 - 2 8 , 1 4 - 2 7 Figure 8-6 Ta b l e 7 - 1 Tab l e 2 3 - 1 A S T pa r am e t e r , 5 - 8 , 5 - 1 0 Figure 5-2 Ind ex- 3 INDEX AST q u e ue Figure 5-l AS TDE L m od u l e i n s ys t em i m ag e , 5-4 , 5-9 Asyn c h r o n o us sys tem t r ap s e e AS T Atten t i o n AS T , 5 - 1 2 , 9 - 1 3 , 1 5- 1 2 , 2 4 - 5 , 2 5-7 Au tho r i z a t i o n r ec o rd , 2 0 - 5 F i g u r e 2 0-1 Tabl e 1 3-1 AUTHOR I Z E u t i l i ty Ta b l e 1 8 - 1 Au t o con f i g u r e o pe r a t i o n , 1 1 - 3 7 AUTOCONF I G URE SYSGEN c omma nd , 22-9 , 22-18 Ta b l e 2 1 - 1 Ta b l e 2 2 - 3 Automa t i c r e s ta r t , 7 - 7 Au tom a t i c u s e r s t a c k e x pa n s i o n , 2-9 , 1 3-3 Automa t i c wo r k i ng s e t s i ze a d j u s tmen t , 5 - 4 , 5 - 1 2 , 8 -8 , 1 3 - 1 0 , 1 3 - 1 2 , 1 8 - 2 2 Ta b l e 1 3 - 2 AWSMAX SYSBOOT pa r am e te r , 8 - 8 , 1 3 - 1 4 , B- 1 6 Ta b l e 1 3 - 2 AWSMIN S YS BOOT pa r am e t e r , 8 - 8 , 1 3 - 1 4 , B- 1 6 Ta b l e 1 3 - 2 AWS T I M E S YS B OOT pa r am e t e r , 8 - 8 , 1 3 - 1 3 , B- 1 6 Ta b l e 1 3 - 2 B BACKTRANS . E XE Fi gure 1-8 Bad b l o c k h a nd l i ng , 1 5 - 1 , 1 5 - 4 Bad pag e l i s t , 1 1 -1 7 F i g u r e 1 1 -1 1 BAK PFN a r r ay , 1 1 -1 1 , 1 1 -1 6 , 1 2-4 , 1 2- 6 , 1 2- 1 2 , 1 2 - 1 4 t o 1 2 -1 5 , 1 2 - 1 7 , 1 2 - 2 6 , 1 4 -1 1 , 1 4 -1 4 , 1 4 - 2 3 F i g u r e 1 1 -9 F i g ur e 1 1 -1 0 Ta b l e 1 1 - 2 BAK save a r ea i n PHD F i g u r e 1 1 -8 Ba l a nce s l o t , 1 1 - 2 7 , 1 1 - 3 0 , 1 4 - 1 1 , 1 4 - 2 0 to 1 4 - 2 3 F i g u r e 1 1 -2 0 Ba l a n c e s l o t a r ea , 2 5 - 1 1 , B-2 3 , E-l l Figure 1-6 F i g u r e 1 2 -8 Balance s l o t area , ( co nt . ) , Figure E-1 Tab l e E - 2 Ta b l e E - 3 BALS E TC NT SYSBO OT pa r am e t e r , 1 1 - 2 7 , 1 4 - 2 0 , 2 2 - 9 , B-1 5 , E - l l F i g u r e 1 1- 2 0 F i g u r e 1 1- 2 1 Tabl e 2 2-1 Ta b l e E - 2 BAS IC , 2 - 2 B a t c h j ob , 7 - 5 , 9-1 0 , 2 0- 1 , 2 7-1 Figure 20-2 Ta b l e 9 - 2 BJOBLIM SYSBOOT pa r am e t e r , B- 1 9 B l a c k h o l e pag e , 2 2- 1 0 , 2 3- 1 1 B L I N K PFN a r r a y , 1 1 - 1 7 F i g u r e 1 1- 9 Figure 1 1-1 3 Ta b l e 1 1 - 2 B OO T 5 8 a l te r na t e b o o t s t r a p p r o g r am , 2 1- 5 Ta b l e 2 1 - 1 Bo o t s t r a p s e e s ys t em i n i t i a l i za t i o n Bo o ts t r a p c omma nd f i l e , 2 1 - 6 Bo o t s t r a p d i s k d r i ve r , 7 - 6 Boo t s t r a p I /O r o ut i ne , 2 1 - 1 4 , 2 2-9 Ta b l e 2 2 - 1 B PT e x c ept i o n Ta b l e 2 - 1 Ta b l e 2 - 2 B PT i n s t r uc t i o n , 2 1 - 9 , 2 1 - 1 5 B r o ad c a s t s ys t em se r v i c e ( $ BRDC S T ) , 1 6-1 6 B r o ad c a s t d e sc r i pto r b l o c k ( BRD ) F i g u r e 1 6 -4 B u f f e red I/O , 5 - 1 0 , 1 6 - 8 B u f f e red I /O c o mpl e t i o n , 1 6 - 9 Bug c he c k , 2 - 1 4 , 2 - 3 1 , 3 - 1 2 , 7-1 t o 7-2 , 7-4 t o 7-5 , 7-1 2 Figure 3-5 Ta b l e 2 - 1 s e e a l so f a ta l bug chec k BUGC HEC KFATAL S YS B OOT pa r am e t e r f l ag , 7 - 5 to 7 - 6 , B- 1 7 B UGC HK p r i v i l eg e , 7 - 2 , 7 - 5 , 27-3 BUGRE BOOT SYSBOOT pa r am e te r f l ag , 7-4 , 7 - 7 , 2 1 - 2 , 2 3-6 Bus r e que s t ( BR ) l evel o n UN I B US , 6-7 B u s r e q u e s t r ec e i v e vec to r r eg i s t e r ( BRRVR ) , 6- 1 0 , 2 3 - 1 1 Fi gure 6-3 Byt e i nd ex , x x x i I nd ex- 4 INDEX c Chann e l a s s ignment , ( cont . ) , r em o t e d ev i c e , 1 6 - 2 t o 1 6 - 3 s po o l ed d ev i c e , 1 6 - 2 t o 1 6 - 3 C a l l f r ame , 2 - 1 , 3 - 4 to 3 - 5 , Channel control bloc k ( CCB) , 5-8 , 1 7-1 8 , 2 0-1 3 5-1 0 , 9-1 5 , 1 6- 1 , 1 6-9 Figure 2-3 Figure 1 1-7 Figure 2-5 F i g u r e 1 6-1 Figure 2-6 F i g u r e 1 6-3 Figure 2-7 Ch a nn e l c on t r o l b l o c k t a b l e Figure 2-8 F i g u r e 1-7 Figure 3-2 Ta b l e E - 4 Figure 3-6 C h a n n e l d e a s s i g nm e n t , 1 6 - 3 C a l l f r am e c ond i t i o n h a nd l e r , Ch a nn e l r eque s t b l o c k ( C RB ) , 2-18 6 - 7 , 6 - 1 0 to 6 - 1 1 CALLG i n s t r uc t i o n , 5 - 8 Figure 6-3 C a l l i ng mecha n i sm , 1 - 1 0 Figure 6-4 C a l l i ng s t and a rd Figure 6-5 s e e p r o c ed u r e c a l l i ng s t a nd a rd F i g u r e 6 -7 CALLx i n s t r uc t i o n , 3 - 1 6 C HANN E LCNT s pe c i a l Figure 3-2 SYSB OOT pa r am e te r , Figure 3-3 B-1 5 , E-1 7 Figure 3-6 C h a r ac t e r d a t a type , 1 - 1 1 C a n c e l I /O o n Ch a nn e l C h a r a c t e r s t r i ng i n s t r uc t i o n s , s y s t e m s e rv i c e ( $ CANC E L ) , 1-11 1 6- 4 , 1 6- 1 0 C HM E e x c e p t i o n , 1 - 1 4 , 1 - 1 8 , C a n c e l T i m e r Re que s t 2 - 7 to 2 - 8 , 3 - 4 , 3- 1 7 , 2 0 - 5 s y s tem s e rv i c e ( $ CANT I M ) , Ta b l e 2 - 1 1 0 - 1 0 to 1 0 - 1 1 , 1 8 - 2 2 C a n c e l Wa k e up C HM E e x c e pt i o n d i spa tc he r , s ys tem s e rv i c e ( $ CANWAK ) , 3 -1 0 , 3-1 3 1 0 -1 0 , 1 0 -1 2 Figure 3-4 C HM E i n s t r uc t i o n , 1 - 1 1 , 1 - 1 8 , Ta b l e 9 - 1 3 - 1 , 3 - 4 , 3- 1 6 C a r d r e a d e r d r i ve r Figure 3-1 Figure 20-2 Figure 3-6 u n so l i c i ted i nput , 2 0 -1 , 2 0 - 4 C HMK e x c e pt i o n , 1 - 1 4 , 1 - 1 8 , CAS EW i n s t r uc t i o n , 3 - 5 , 3 - 1 0 2 - 7 , 3 - 4 , 3-1 0 , 3 - 1 7 Figure 3-2 Ta b l e 2 - 1 Figure 3-4 C HMK e x c e pt i o n d i spa tc h e r , Figure 3-6 3-1 0 , 3-1 3 , 5-8 C a t c h a l l c ond i t i o n h a nd l e r , Figure 3-4 2 - 1 8 , 2 - 3 0 , 1 7 - 1 8 to 1 7 - 1 9 , C HMK i n s t r uc t i o n , 1 - 1 1 , 1 - 1 8 , 20-1 3 , 27-7 3 - 1 , 3 - 4 , 3- 1 6 Cha ng e m o d e d i spa tch e r , 3 - 4 , A-6 Figure 3-1 Figure 3-2 C HMS e x c e p t i o n , 2 - 8 , 2 - 1 3 , 3 - 4 Figure 3-4 Tab l e 2-1 Change mode except i ons Ta b l e 2 - 2 s e e C HMx e x c e p t i o n s Ch a nge mode h a nd l e r , 1 8 - 2 3 C HM S e x c ep t i o n h a nd l e r , 3 - 4 C HMU e x c e pt i o n , 2 - 8 , 2 - 1 3 , 3 - 4 C h a nge mode i n s t r uc t i o n s Ta b l e 2 - 1 s e e C HMx i n s t r uc t i o n Ta b l e 2 - 2 Ch a ng e Mo d e t o Ex e c u t i v e C HMU e x c e p t i o n h a nd l e r , 3 - 4 s ys tem s e rv i c e ( $ CMEXE C ) , C HMx ex c e p t i o n s , 2 - 7 2 - 3 1 , 3- 1 8 , 2 0 - 5 , A- 1 4 C HMx i n s t r uc t i o n , 1 - 1 1 , 3 - 4 , Ch a ng e Mo d e t o Ke r n e l 3-1 3 , 8-1 6 , 8 - 1 8 s ys t em s e rv i c e ( $ CMKRN L ) , F i g u r e 1 -4 2 - 3 1 , 3 - 1 8 , A- 1 4 Figure 3-2 C h a ng e -mod e- t o - s upe r v i s o r hand l e r , Figure 3-9 2 0-9 C l e a r Eve n t Fl ag Figure 20-3 sys tem s e rv i c e ( $ C LR E F ) , Ch a nn e l a s s i g nm e n t , 1 6 - 1 9-7 n e two r k d ev i c e , 1 6 - 2 t o 1 6 - 3 I nd e x - 5 I NDEX C LI s e e c omma nd l a ng uag e i n t e r p r e t e r s e e DC L c omma nd l a ng uag e i n t e r p r e te r s e e MCR c omma nd l a ng uag e i n te r p r e t e r C L I d a ta F i g u r e 1-7 Tab l e E-4 C L I i mag e Figure 1-7 Tabl e E-4 C L I s ymbo l t a b l e F i g u r e 1-7 Tab l e E-4 C L I S YMTBL S Y S B O OT p a r am e t e r , 2 0 - 7 , B- 1 7 , E - 1 7 Tab l e E-4 C l ock t i c ks , 8 - 5 C l u s t e r s i ze , 1 2- 2 0 t o 1 2 - 2 1 , 1 2- 2 5 t o 1 2- 2 7 Tab l e 1 2-1 C l us te r ed r e ad , 1 2 - 1 9 t o 1 2 - 2 0 C l u s t e r ed w r i te , 1 2 - 2 0 CMEXEC p r i v i l eg e , 3 - 1 8 , 1 8 - 1 1 CMKRNL p r i v i l eg e , 3 - 1 8 , 6 - 1 5 , 1 8- 1 1 Tab l e 2 2-3 CMODS SDS P mod u l e i n s ys t em i m ag e , 3 - 5 , 3 - 1 6 to 3 - 1 7 , 5 - 9 F i g u r e 3-4 C OB O L S TO P s t at em en t , 2 0 - 1 5 Co l d s t a r t s e e s ys t e m i n i t i a l i z a t i o n Co l l i d ed p ag e , 1 1 - 1 7 , 1 2 - 2 4 , 1 2- 3 0 Figure 11-12 Co l l i d ed p a g e wa i t s t a t e ( C O L PG ) , 8 - 1 1 , 8 - 1 5 to 8 - 1 6 , 8 - 2 7 , 1 2- 3 0 , 1 3- 5 Figure 8-5 Ta b l e 8 - 1 Tab l e 1 4-2 C OMDRVS UB mod u l e in s ys tem i m ag e , 5 - 1 3 C omma nd l a ng uag e i n t e r p r e t e r ; 1 - 6 , 2 -1 3 , 2- 3 0 , 3-4 , 1 8 -3 , 2 0-7 , 2 2 -1 7 F i g u r e 1-2 F i g u r e 1-4 Figure 20-3 Figure 2 0-4 T a b l e 2 1 -1 c omma nd p r o c e s s o r , 2 0 - 1 1 , 2 0 -1 4 F i g u r e 2 0-3 Command l angu ag e interpr eter , ( cont . ) , m a pp i ng i n to P l s pa c e , 2 0 - 1 , 2 0 - 5 t o 2 0 -6 , 2 2 -1 5 , E-1 7 F i g u r e 1-7 F i g u r e 2 0-1 F i g u r e 2 0-2 Ta b l e E - 4 C ommon e v e n t b l oc k ( C E B ) , 8 - 1 4 , 9-1 , 9-7 Figure 9-2 Figure 9-3 mas t e r CEB , 1 1-4 2 Figure 9-4 Figure 9-5 s l av e C E B , 1 1 - 4 2 Figure 9-4 Figure 9-5 C o mmon e v e n t b l o c k l i s t Ta b l e 8 - 2 C ommon e v e n t b l o c k l i s t m u t ex Ta b l e 2 4 - 2 C ommon e v e n t f l ag , 9 - 1 , 9 - 6 , 9 - 8 , 9 - 1 3 to 9 - 1 4 i n sha r ed m emo r y , 9 - 7 , 9- 1 4 t o 9 -1 5 , 1 1- 3 5 , 1 1-4 2 Figure 9-5 Figure 1 1- 2 5 C ommo n e v e n t f l ag c l u s t e r , 9 - 6 C o mmon e v e n t f l ag wa i t q ue u e s Figure 9-3 Figure 9-4 C ommon e v e n t f l ag wa i t s ta t e ( C E F ) , 8 - 9 , 8 - 1 5 , 9 - 5 to 9 - 6 Figure 8-5 Ta b l e 8 - 1 Ta b l e 1 4 - 2 C o mpa t i b i l i ty mod e , A - 9 s e e a l s o RSX- l lM AME C ompa t i b i l i ty m o d e d a ta pag e , B-27 Figure 1-7 Ta b l e E - 4 Compa t i b i l i ty m o d e e x c e p t i o n , 2-1 3 , 1 8-1 5 Tab l e 2 - 1 Tabl e 2-2 Compa t i b i l i ty m o d e h a nd l e r , 1 8- 2 3 Compa t i b i l i ty m o d e i m ag e , 1 - 2 4 , 1 8- 2 , 1 8 - 5 , 1 8-1 5 Figure 1-8 C o mpu t a b l e o u t swa pped p r o c e s s , 8-8 Compu t a b l e o u t s wa pped s c h ed u l i ng state ( C OMO ) , 8 -9 , 1 4 -4 Figure 8-5 Tab l e 8 - 1 I nd ex - 6 I NDEX Conve r t ASC I I S tr i n g , ( co nt . ) , Compu t a b l e r e s i d en t s c h ed u l i ng s t a t e ( C OM ) , s ys tem s e rv i c e ( $ B I N T I M ) , 8 - 9 , 8 - 2 2 to 8 - 2 3 2 7-1 1 Figure 8-5 C o nv e r t B i n a r y T i m e Ta b l e 8 - 1 to AS C I I S t r i ng s y s t em s e rv i c e ( $ ASCT I M ) , Ta b l e 1 4 - 2 2 7- 1 1 Compu t a b l e s t a t e q ue u e h e ad e r s Fi gure 8 -3 Co nve r t B i n a r y T i m e Compu t e - bo und p r o c e s s , 8 - 5 to Num e r i c T i m e Cond i t i o n hand l i ng f a c i l i ty , 2 - 1 s ys t em s e rv i c e ( $ N UMT IM ) , Cond i t i o n s , 2 - 1 27-1 1 s ee a l so except i o n s Co py-on- r e f e r e n c e pag e , 1 1 - 4 , CONNEC T C ONSOLE SYSGEN c omma nd , 1 1 - 1 6 , 1 2-3 , 1 2-8 1 5 - 1 8 to 1 5 - 1 9 Figure 1 2-4 C ONNEC T S Y SGEN c omma nd , 1 5 - 2 , F i g u r e 1 2-7 2 5- 1 3 C o py-o n - r e f e r e n c e s ec t i o n Connec t - to - i n t e r r up t m e c h a n i sm , F i q u r e 1 1 -7 Figure 18-2 6-1 5 C PU t i m e l i m i t ex p i r a t i o n , 8 - 8 Figure 6-7 Ta b l e 1 4 -3 C ONSOL . S YS , 1 5 - 1 6 , 2 1 - 6 , 2 3 - 4 C PU-d e pe nd ent r o u t i n e , Ta b l e 2 1 - 1 2 1 - 1 6 to 2 1 - 1 7 , 2 2 - 9 , 2 2 - 1 1 , Con so l e b l o c k s to r ag e d ev i c e , 1 5 - 1 8 , 2 1 - 5 to 2 1 - 6 A-1 5 t o A- 1 6 , B-1 3 f l o ppy d i s k , 1 5 - 1 6 , 1 5 - 1 9 Figure 22-3 TU58 c a r tr idge , 1 5-1 6 , 1 5-1 8 , Ta b l e 2 1 -4 2 1-5 Ta b l e 2 2 -1 Conso l e i n te r f a c e , 1 5 - 1 6 CRDENAB LE SYSBOOT p a r am e t e r f l ag , Conso l e p r og r am B-1 7 Figure 2 1-1 C r e a t e a nd Ma p Sec t i on C o n so l e t e rm i n a l , 1 5 - 1 8 , 2 2 - 1 0 , s ys t em s e rv i c e ( $ C RMPS C ) , 9 - 1 4 , 1 1 -2 0 , 1 1 - 2 7 , 1 1 - 4 0 , B-2 1 2 - 6 , 1 2 -2 4 , 1 3 - 6 , 1 3 - 8 , F i g ure 1 5-1 1 8- 8 , 1 8-1 2 C o n t e x t i nd e xed ad d r e s s i ng , C r e a t e Log i c a l Name xxxi , 1- 1 1 , 4-5 s ys t em s e rv i c e ( $ C R E LOG ) , Con tex t s w i tch , 8 - 2 0 , 1 4 - 2 2 6- 4 C ONT INUE c omma nd , 2 0 - 1 6 C r e a t e Ma i l box F i g u r e 2 0-3 s y s t em s e rv i c e ( $ CREMBX ) , C ON T INUE S YSGEN c omma nd , 2 2 - 2 3 9 - 1 4 to 9 - 1 5 , 1 6 - 1 1 F i g u r e 2 2 -4 F i g u r e 2 2-5 C r e a t e P-r o c e s s Ta b l e 2 2 -3 s ys t em s e rv i c e ( $ C R E PRC ) , Co n t i n u i ng f r om a n ex c e pt i o n , 8 - 4 , 1 7 - 1 , 2 0 - 4 to 2 0 - 5 2-2 , 2-2 3 Figure 17-1 C o n t r a c t Reg i o n Ta b l e 9 - 1 sys tem s e rv i c e ( $ C NTREG ) , Ta b l e 9 - 2 Ta b l e 1 3 - 1 1 3-5 Con t r o l mechan i sm s , x x v i i i Tab l e 1 7- 1 Con t r o l r eg i o n , 1 - 2 2 , 5 - 1 1 , 1 7 - 1 C r e a te Vi r t ua l Add r e s s Spa c e Fi gure 1-1 s ys tem s e rv i c e ( $ C R E TVA ) , Fig ure 1 7-1 1 2- 1 0 , 1 3-2 , 1 8- 8 F i g ure 1 7-6 C TR L/C , 5 - 1 5 see a l so Pl space C TR L/Y , 5 - 1 5 , 1 8 - 1 7 , 2 0 - 9 , Con t r o l l e r i n i t i a l i z a t i o n r o u t i n e , 2 0-1 4 , 20-16 2 3 -7 C TR L/Y A S T , 5-1 5 Conve r sa t i o n a l b oo t s t r a p , F i g u re 20-3 2 1-1 7 , 22-21 C u r r en t p r o c e s s Ta b l e 2 1 - 2 s c h ed ul i ng s t a t e ( C UR ) C o nve r t ASC I I S t r i ng Fig u r e 8-5 to B i n a ry T i me Tab l e 8 - 1 I nd ex - 7 I NDEX D D a t a s t r uc t u r e d e f i n i t i o n s , xx i x DC L c o mmand l a ng uag e i n te r p r e t e r , 3-4 , 20-9 Tabl e 1 -1 D e a l l oc a te Dev i c e s y s tem s e rv i c e ( $ DALLOC ) , 1 6 - 4 to 1 6 - 5 , 1 8 - 2 2 D e a s s i g n Ch a n n e l s y s tem s e rv i c e ( $ DA S SGN ) , 1 6- 3 , 1 8 - 2 1 D e bug b oo t s t r a p s e e Imag e S t a r tup DEBUG c omma nd , 2 - 1 3 , 2 - 3 0 , 1 8 - 1 7 , 2 0 -1 6 F i g ur e 2 0-3 D E BUG e x c e pt i o n ( S S $_D EBUG ) , 2-1 3 Tabl e 2-2 D e bug g e r , 1 - 2 4 , 2 - 3 0 , 1 3 - 1 6 , 1 8 - 1 , 1 8 - 1 6 to 1 8 - 1 7 F i g u r e 1-8 D e b ug g e r s ymbo l t a b l e F i g u r e 1-7 Tabl e E-4 D e c ima l o v e r f l ow e x c ep t i o n Ta b l e 2 - 3 Dec l a r e AST s ys tem s e rv i c e ( $ DC LAS T ) , 5-1 , 5-4 , 5-8 D e c l a r e Ch a ng e Mo d e o r Compa t i b i l i ty Mo d e Ha nd l e r s ys tem s e rv i c e ( $ DC LCMH ) , 2-1 3 , 3-4 D e c l a r e E r r o r Log Ma i l bo x s y s tem s e rv i c e ( $ D E R LMB ) , 7 - 3 to 7 - 4 D E Cn e t , 1 5 - 1 1 D e f a ul t d i r e c to r y s t r i ng , 1 7-1 6 , 2 0 -7 Ta b l e 1 7 - 2 D E FBOO . CMD , 2 1 - 6 to 2 1 - 7 D E FMBXB UFQUO SYS BOOT p a r am e t e r , 1 6 - 1 1 , B- 1 6 D E FMB XMXMSG S YS B OOT p a r am e t e r , 1 6 - 1 2 , B- 1 6 D E FMB XN UMMSG S Y S B O OT p a r am e t e r , B-1 6 D E FPR I S YS B OOT pa r am e t e r , 1 4 -4 , B- 1 9 D e l e t e Comm o n Ev e n t F l ag C l u s t e r s ys t em s e rv i c e ( $ D LC E FC ) , 9-2 Tabl e 9 - 1 D e l e t e G l o b a l Sec t i o n s ys tem s e rv i c e ( $ DGB LS C ) , 1 1-2 0 , 1 3-9 D e l e t e Log i c a l Name s ys tem s e rv i c e ( $ D E L LOG ) , 1 8- 2 3 , 2 6-4 D e l e t e Ma i l box s ys t em s e rv i c e ( $ D E LM B X ) , 1 6-1 6 De l e te Process s ys tem s e rv i c e ( $ D E L PRC } , 5 - 1 1 , 1 9 - 1 , 1 9- 6 , 2 0 - 8 to 2 0 - 9 , 2 4 - 9 Ta b l e 9 - 1 Ta b l e 9 - 2 De l e t e Vi r t ua l Ad d r e s s Spa c e s ys tem s e rv i c e ( $ D E LTVA ) , 1 3 -5 , 1 9- 5 Demand z e r o pag e , 1 1 - 7 , 1 2 - 3 , 1 2- 1 0 , 1 3-2 F i g u r e 1 1-3 F i g u r e 1 2-4 Demand ze r o pag e ( g l o ba l ) , 1 1 - 2 3 Demand z e r o s ec t i o n , 1 8 - 8 F i g u r e 1 1 -7 F i g ur e 1 8-2 F i g u r e 1 8-4 D e pth a rg um e n t i n m e c h a n i sm a r r a y , 2-1 8 Figure 2-5 D E TAC H p r i v i l eg e , 1 7 - 1 Tab l e 1 7 -3 D ev i c e a l l o c a t i o n , 1 6 - 5 D ev i c e d e a l l o c a t i o n , 1 6 - 5 De v i c e d r i v e r , 1 - 4 , 2 - 3 1 , 4 - 2 to 4 - 4 , 4 - 7 , 5 - 1 4 , 6 - 7 , 7 - 1 , A- 1 6 F i g u r e 1 - 2· Figure 1-5 Figure 6 -3 F i g u r e 6 -4 Tab l e 2 2 -3 De v i c e e r r o r s , 7 - 1 D ev i c e i n t e r r upt s e r v i c e r o u t i n e , 1- 1 5 , 4 - 4 Figure 1-5 De v i c e t i me o u t , 1 0 - 4 , 1 0 - 1 0 D I AGN O S E p r i v i l eg e , 7 - 4 D i ag n o s t i c s upe r v i so r , 2 1 -8 , 21-1 1 Tab l e 2 1 - 2 D IALTYPE SYS BOOT p a r am e t e r , B - 1 7 D i r e c t I /0 , 5 - 1 0 , 1 6 - 8 D i r e c t I /O c om p l e t i o n , 1 6 - 8 D i r e c t I /O c o un t , 1 3 - 5 , 1 4 - 8 , 1 4 -1 4 D i r e c t l y v e c to r ed UN IBUS d ev i c e i n te r r upts , 6-7 Figure 2-1 Figure 6-2 I nd e x - 8 INDEX ERRFMT proc e s s , ( co nt . ) , D i s a s so c i a t e Common Eve n t Fl ag C l us t e r wa ke up c a l l , 7 - 3 s ys tem s e rv i c e ( $ DAC EFC ) , E RRLOG . SYS 9-2 , 1 8- 2 2 s e e e r r o r l og f i l e D i s k d r iver , 1 5-1 E r r o r c o d e c o r r ec t i o n ( EC C ) , D I SMOUNT 1 5 - 1 t o 1 5 -2 s e e v o l um e d i smo un t u t i l i ty E r r o r l og e n t r y , 7 - 1 1 t o 7 - 1 2 , D i s pl a c em e n t m o d e a d d r e s s i ng , 2 3-1 1 A-2 Ta b l e 7 - 1 D I S PLAY u t i l i t y , 1 - 7 , 8 - 3 , E - 1 7 E r r o r l og f i l e , 7 - 1 , 7 - 3 Ta b l e 1 - 1 E r r o r l og ma i l box , 7 - 3 , 1 8 - 2 2 s ta t i s t i c s , B - 4 , B- 1 2 E r r o r l og m e s s a g e b u f f e r , 7 - 7 , DM C- 1 1 c ommun i c a t i o n s d ev i c e , 7 - 9 , 2 7 - 3 to 2 7 - 4 1 5- 1 2 E r r o r l og r epo r t g e n e r a to r ( S Y E ) , F i g u r e 1 5 -3 7-1 , 7- 3 , 27-3 Do ub l e m a pp i ng of I /0 b u f f e r pag e s E r r o r l og r o ut i n e s , 2 4 -4 , 1 5- 1 9 2 7 - 3 to 2 7 -4 DR 3 2 E r r o r l ogg i ng , 6- 1 0 , 7 - 1 , Ta b l e 6 - 1 7 - 6 to 7 - 7 , 2 7 - 3 DR 3 2 i n t e r r upt s e r v i c e r o u t i n e , Ta b l e 2 - 2 6-1 3 E s t a b l i sh i ng a c o nd i t i o n h a nd l e r , Figure 6-5 2-2 , 2-1 6 DR 7 8 0 i n t e r f a c e Ev en t f l ag , 8 - 1 , 9 - 1 , Ta b l e 2 2 -2 9- 1 3 to 9 - 1 4 , 1 0 - 1 0 , 1 2 - 2 9 D S B INT m a c r o , 2 4 -1 , A- 1 3 s e t t i ng , 1 0 - 8 , 1 6 - 9 , 2 4 - 7 , Figure 24-1 2 7 - 8 ' 2 7 -1 0 Dump f i l e , 7 - 7 , 2 2 -1 3 , 2 2 - 1 6 Even t f l ag wa i t , 1 6 -6 Ta b l e 2 1 - 1 Ev e n t f l ag wa i t ma s k , 8 - 1 0 Dum p f i l e h ead e r b l o c k , 7 - 7 , 7 - 9 E v e n t f l ag wa i t s t a t e s , 9 - 4 Ta b l e 7 - 1 Ev e n t f l ag wa i t s y s t em s e rv i c e s DUM PB UG SYS BOOT pa r am e t e r f l ag , ( $WA I TFR , $WFLAND , o r $WFLOR) , 7 - 4 , 7 - 7 , B- 1 7 9-4 Dyn am i c m em o r y a l l o c a t i o n , E XC E PT I ON x x i x , 1 - 6 , 1 - 2 1 , 2 5 -1 m od u l e i n s ys t em imag e , F i g u r e 2 5 -1 2-1 2 , 2- 1 4 , 27-4 F i g u r e 2 5-2 Ta b l e 2 - 2 Dyn am i c m emo r y d e a l l o c a t i o n , Ex c ept i o n d i s pa tch e r , 3 - 4 2 5- 2 Ex c e pt i o n hand l e r , 1 8 - 2 3 Fig u re 2 5 -1 e x ec u t i v e mode , 2 0 -6 F i g u r e 2 5 -3 E x c ept i o n n ame Dyn am i c S Y S B OOT pa r am e t e r s , F i g u r e 2-2 1 3-1 2 , 22-2 5 E x c e p t i o n se rv i c e r o u t i n e , 1 -1 2 , 1-1 5 Ex c ept i o n v e c t o r s , 2 - 1 7 E Ex c e pt i o n s , 1- 1 4 , 1 - 1 7 , 2 - 1 , 7-1 , 7-9 Emp t y pag e s i n the p r o c e s s h e ad e r , F i gure 1-5 1 1-1 1 F i g u r e 2-1 F i g u r e 1 1 -1 see a l so c o nd i t i o n s ENB INT m a c r o , 2 4 -1 Ex c l u s i v e wr i t e r f l ag Figure 24-1 to $ U PDSEC s ys tem s e rv i c e , En t r y ma s k , 3 - 1 , 3 - 5 , 5 - 8 Figure 3-1 1 3-1 0 Figure 3-9 EXE $ E XCMSG Ta b l e 2 - 3 r o u t i ne i n s ys t e m i m ag e , ERRFMT p r o c e s s , 7 - 1 t o 7 - 4 , 2 7 - 4 , 2 7 -7 E XE $NAM P I D 2 2-1 3 , 2 2 -1 7 , 24-4 , 2 7 - 3 to 2 7 -4 r o u t i ne i n s ys t em imag e , Ta b l e 1 - 1 9 - 8 , 1 7 - 1 2 , A- 1 2 , A- 1 4 Execut ive , x xx i Ta b l e 2 1 -1 I nd ex - 9 INDEX F L I N K PFN a r r a y , 1 1 - 1 7 Ex e c u t i v e a c c e s s m od e , 3 - 1 F i g u r e 1 1 -9 Figure 1-4 F i g u r e 1 1 -1 3 Ta b l e 3 - 1 Ta b l e 1 1 - 2 Ex e c u t i v e d a ta a r e a s , x x i x F l o a t i ng ove r f l o w e x c ep t i o n Ex e c u t i v e mode e x c e p t i o n , 2 - 3 1 Ta b l e 2 - 3 E x e c u t i v e s tac k F l o a t i ng und e r f l o w e x c ep t i o n Figure 1-7 Ta b l e 2 - 3 Ta b l e E - 4 F l o a t i ng / d e c i m a l d i v i d e b y z e r o Ex i t except ion s ys tem s e rv i c e ( $ E XI T ) , Ta b l e 2 - 3 7 - 5 , 9 - 1 0 , 1 7 -1 9 , 2 0 - 6 , Fo r c e Ex i t 2 0 - 9 , 2 0 -1 4 , 2 0 -1 6 s ys tem s e rv i c e ( $ F ORC EX ) , Figure 20-3 5-4 ' 5-1 2 , 9-1 0 Tabl e 9-1 Tab l e 9-1 E X I T c o mmand , 2 0 -1 6 Ta b l e 9 - 2 F i g u r e 2 0-3 Fo r k b l oc k ( FKB } , 5 - 1 3 , 2 4 - 5 , E X I T S Y S G E N c omma nd , 2 2 - 2 3 D- 5 Ta b l e 2 2 - 3 Figure 4-2 E x pa nd Reg i o n Figure 6-3 s ys t em s e rv i c e ( $ E XPREG } , Fo r k d i s pa tc h i ng , 5 - 1 3 1 2 - 1 0 , 1 3 - 2 to 1 3 - 3 , 1 3 - 6 , Tab l e 4 - 1 1 8-1 1 Fo r k pr oc e s s i ng , 1 - 1 5 , E x te r n a l ad a pte r , 2 1 - 7 , 2 1 - 9 , 4-3 to 4 - 5 , 2 4 - 3 , 2 4-6 2 2 -1 , 2 2-8 , 2 2-1 0 , 2 3-6 Figure 1-5 E XTRAC PU S YS B OOT p a r am e t e r , Fo r k que ue , 4 - 5 , 2 4 - 5 8-8 , B-1 6 E XUS RSTK s pe c i a l SYSBOOT pa r am e t e r Fo rma t ted AS C I I O u t p u t s ys tem s e rv i c e ( $ FAO ) , B- 1 5 , E - 21 27-7 , 27-11 Tab l e E - 4 Fo rma t t i ng s uppo r t , 2 7 -1 0 F ORTRAN , 2 - 2 F ORTRAN PA US E s t a tem e n t , 2 0 - 1 5 F F r am e po i n t e r ( FP ) , 1 7 - 1 8 , 2 0 - 1 3 F r e e pag e a v a i l a b l e s ys t em e v e n t , FAB ( F i l e Ac c e s s B l o c k ) , 3 - 1 2 8-1 6 Fac i l i ty c o d e s , 2 7 - 6 , C- 9 F r e e pag e l i s t , 8 - 1 1 , 1 1 - 7 , Fa t a l b ug c h e c k , 7 - 5 , 8 - 2 3 , 1 1 -1 4 , 1 1- 1 7 , 1 2-4 , 1 2-6 , 2 3 -6 , 2 4 - 6 , A- 1 4 1 2 -1 0 , 1 2 - 1 5 , 1 4 - 2 0 , 1 4 - 2 4 F i g u r e 8 -7 F i g u re 1 1 -1 1 Ta b l e 1 5 -1 Figure 1 1-1 3 Fa u l ts , 2-8 , 2 - 2 3 , 8 - 1 6 Figure 1 2-3 Ta b l e 2 - 1 Figure 1 2-5 Ta b l e 2 - 3 Figure 1 2-6 FDT r o u t i n e , 4 - 2 , 4 - 7 , 1 1 - 3 4 , F r e e pag e wa i t s t a t e ( FPG ) , 1 5 -4 , 1 6 -7 , 2 4 - 7 8 - 1 1 , 8 - 1 5 to 8 - 1 6 , 8 - 2 7 , F i g u r e 1 5 -1 1 2-3 0 FFS i n s t r uc t i o n , 8 - 2 6 Figure 8-5 F i g u r e 8 -7 Tabl e 8 - 1 F i l e sys tem ( U I C ) p r o t e c t i o n , Ta b l e 1 4 - 2 1-20 FRE E L I M SYSB OOT p a r am e t e r , Ta b l e 1 - 1 1 4 1 , 1 4 - 4 , 2 2 - 1 0 , B- 1 7 , E - 1 6 F I LE READ Ful l d upl ex t e rm i n a l o pe r a t i o n , m od u l e i n s ys t em i m ag e , 21-1 4 F i l e s- 1 1 , 2 1 - 8 , 2 1 - 1 4 F i l e s- 1 1 ACP , 1 - 6 , 4 - 3 , 1 5 - 1 , 1 5 - 4 to 1 5 - 5 , 1 8 - 2 , 2 1 - 1 4 , 2 2-1 3 , 2 2 - 1 7 , 2 4 - 7 Ta b l e 1 - 1 Ta b l e 2 1 - 1 Ta b l e 2 4 -2 G G B L PAG E S SYSBOOT pa r am e te r , B-1 4 , E-l l G B LS ECT I ONS SYSBO OT p a r am e te r , B-1 4 , E -l l Ta b l e E - 2 I nd ex - 1 0 INDEX G e n e r a l p u r po s e r eg i s te r s , 8 - 2 0 , 8 - 2 7 to 8 - 2 8 Figure 8-6 Ta b l e 7 - 1 Ta b l e 2 3 - 1 G e t I /O Ch a n n e l I n f o rma t i o n s ys t em s e rv i c e ( $ G E TC HN ) , 1 6- 1 9 G e t I /0 Dev i c e I n fo rma t i o n s ys t em s e rv i c e ( $ G ETDEV) , 1 6-1 9 G e t Job/ P r o c e s s I n f o rma t i o n s ys t em s e rv i c e ( $G E TJ P I ) , 5-l , 5-4 , 5- 1 1 , 9-1 , 9-6 , 1 8- 2 1 , 2 7 -7 Ta b l e 9 - 1 s e e a l s o imag e c o un t e r wi l d c a rd s uppo r t , 2 7 - 1 0 G e t Me s s ag e s ys t em s e rv i c e ( $ G E TM SG ) , 27-4 , 2 7-6 Get Time s ys t em s e rv i c e ( $ G E TTIM ) , 1 0 -4 G l o b a l p ag e , 1 1 - 1 , 1 1 - 1 9 to 1 1 - 2 0 a nd i n swa p , 1 4 - 2 5 and o u t swa p , 1 4 - 1 4 a nd pag e f a u l t s , 1 2 -1 2 , 1 2 - 1 5 c o py-o n- r e f e r e nc e , 1 2 -1 0 , 1 2-1 6 r ead-only Figure 1 1-1 2 r e ad/wr i t e Figure 1 1-1 2 G l o b a l p ag e t ab l e , 1 1 - 4 , 1 1 - 2 3 to 1 1 - 2 6 , 2 5 -1 1 , B - 2 3 Figure 1-6 Figure 1 1-1 7 Figure 1 1-18 Figure 1 1-19 F i g u r e 1 4 -2 Figure 1 4-3 Fig ure 1 4 -4 Figure 14-5 Figure 1 4-6 F i g u r e 1 4 -7 F i g u r e E-1 Tab l e 1 2- 1 1 Ta b l e E - 2 Tab l e E-3 G l o b a l pag e t ab l e e n t r y , 1 1 - 4 , 1 1 - 2 3 , 1 1 - 2 5 to 1 1 - 2 6 , 1 2 - 1 2 , 1 2- 1 5 , 1 2-1 7 , 1 3-7 , 1 3- 9 , 1 4 -2 6 Figure 1 1-17 F i g u r e 1 1- 1 8 Figure 1 1-19 ( co nt . ) , F i g u r e 1 2 -4 F i g u r e 1 2-6 F i g u r e 1 2 -7 F i g u r e 1 8-5 Ta b l e 1 4 - 5 G l o b a l pag e t a b l e i nd e x , 1 1 - 4 , 1 1 - 2 6 , 1 2- 1 2 , 1 2-1 5 , 1 2-1 7 , 1 3-7 , 1 3-9 , 1 4 - 2 5 to 1 4 -2 6 F i g u r e 1 1 -3 F i g u r e 1 1 -1 9 F i g u r e 1 2 -4 F i g u r e 1 2-6 F i g u r e 1 2 -7 F i g u r e 1 8-5 Tab l e 1 4 -5 G l obal sect ion , 9-1 , 9-1 4 , 1 1 -4 , 1 3 -1 , 1 3- 6 , 1 8 - 2 , 1 8- 1 1 F i g u r e 1 1 -7 F i g u r e 1 8 -2 F i g u r e 1 8-5 a nd $ U PDSEC s ys tem s e rv i c e , 1 2-2 9 i n sha r ed memo r y , 9 - 1 4 , 1 1 - 3 5 , 1 1 - 3 9 , 1 3 -6 to 1 3-7 Fig ure 1 1-2 5 m a pp i ng , 9 - 1 4 G l oba l sec t i o n c re a t i o n , 1 3-7 G l oba l sec t i o n d e l e t i on , 1 3- 9 G l o b a l s e c t i o n d e sc r i pto r ( G S D ) , 1 1 - 2 0 to 1 1 - 2 1 , 1 1 - 2 5 to 1 1 - 2 6 , 1 1 - 4 0 , 1 3 - 7 , 1 3 - 9 , 2 5 - 1 1 , D- 6 F i g u r e 1 1 -1 4 F i g u r e 1 1 -1 6 F i g u r e 1 1 -1 8 f o r PFN ma pp i ng , 1 3 - 8 Figure 1 1-1 4 i n sha r ed memo r y , 9 - 1 8 , 1 3 - 8 Figure 11-2 5 Figure 11-27 G l o b a l se c t i o n d e sc r i p t o r l i s t Ta b l e 8 - 2 G l o b a l s e c t i o n d e sc r i p to r l i st mutex Ta b l e 2 4 - 2 G l ob a l sec t ion t a b l e , 1 1 -2 1 , 1 1-2 5 , E-l l F i g u r e 1 1 -1 5 F i g u r e 1 1 -1 8 G l ob a l s e c t i o n t a b l e e n t r y , 1 1 - 2 0 to 1 1 -2 1 , 1 1 - 2 5 , 1 1 - 3 0 , 1 1 - 4 0 , 1 2 - 1 2 , 1 3 - 7 to 1 3 - 9 , 1 4-1 1 F i g u r e 1 1 -1 5 F i g u r e 1 1 -1 6 F i g u r e 1 1 -1 8 F i g u r e 1 8 -5 Global page tabl e entry , Index- 1 1 INDEX G l o b a l s ec t i o n tab l e i nd e x , 1 1- 2 3 , 1 1-2 6 , 1 2-1 2 , 1 2 - 1 4 t o 1 2- 1 5 , 1 2 - 1 7 , 1 4-2 5 t o 1 4-2 6 F i g u r e 1 2-4 F i g u r e 1 2-6 F i g u r e 1 2 -7 G r o up , 9 - 1 1 G r o up l og i c a l name t a b l e , 8 - 1 4 , 2 5-1 1 , 2 6- 1 , 2 6 - 3 Figure 26-1 Figure 26-2 Ta b l e 8 - 2 G r o up l og i c a l name t ab l e m u t ex Ta b l e 2 4 -2 GROUP p r i v i l eg e , 1 - 2 0 , 9 - 8 , 9 - 1 1 , 1 0 - 1 1 , 1 9- 1 Ta b l e 9 - 1 G R PNAM p r i v i l eg e , 2 6 - 4 I /0 c o mpl e t i on , 4 - 1 , 5 - l to 5 - 2 , 5 - 4 , 5 - 1 0 , 9 - 6 , 1 1 -1 8 , 1 2- 3 0 Ta b l e 8 - 3 I /0 c o mpl e t i o n A S T , 1 6 - 6 I /0 c ompl e t i o n n o t i f i c a t i o n , 1 6- 6 I /O d a t a b a s e m u t ex Ta b l e 2 4 - 2 I /0 f un c t i o n c od e , 1 2 - 1 9 I /O po s t p r o c e s s i ng , 1 - 1 5 , 4 - 3 , 4 -7 , 5 - 1 0 , 1 2 - 2 0 , 1 2 - 2 4 , 1 2-2 8 , 1 5-4 t o 1 5- 5 , 1 6-8 , 2 4 - 3 , 2 4 -7 F i g ure 1-5 Ta b l e 4 - 1 I /O po s tp r o c e s s i ng q u e ue , 4 - 7 I /O r e que s t , 1 - 1 5 I /O r e que s t pa c k e t ( I R P ) , 5 - 4 , 5-1 3 , 1 2-1 9 I /O s t a t us b l oc k , 5 - 1 0 , 1 6 -6 I /O s ub s ys t em , x x v i i i , 1 - 4 , H 1-1 0 , 1 1-3 2 Ha r d wa r e c l o c k , 6 - 1 , 1 0 - 1 Figure 1-2 Figure 1-5 I /0 s yn c h r o n i z a t i o n , 9 - 1 i n t e r r upt s e r v i c e r o u t i ne , I JO B L I M SYS BOOT pa r am e t e r , B - 1 9 4 - 6 , 8 - 5 , 1 0-1 , 1 0- 3 , Imag e , 1 - 1 , 1 - 3 1 0- 5 t o 1 0-6 , 2 3-7 , 2 4-4 Figure 1-8 Ta b l e 1 0 - 1 Imag e ac t i v a t i o n , 1 3 - 6 , 1 8 - 1 , Ta b l e 1 3 - 2 2 0-1 3 Ha r d wa r e c o n t ex t , 1 - 1 , 1 - 1 1 , F i g u r e 2 0- 3 1 -1 8 , 5-2 , 5-1 1 , 8-1 , 8-2 0 , Ta b l e 9 - 2 8-22 Imag e a c t i va to r , 1 - 3 , 3 - 1 4 , Figure 1-1 1 3-2 , 1 3 -6 , 1 7-18 Ha r d wa r e i n t e r r upt s , 1 - 1 1 , 1 - 1 8 F i g u r e 1-7 Figure 6-2 F i g u r e 1-8 s e e a l so d ev i c e i n te r r upt F i g u r e 3-8 s e rv i c e r o u t i n e Figure 1 8-9 Ha r d wa r e PCB Ta b l e 1 8 - 1 s e e h a r d wa r e p r o c e s s Ta b l e E - 4 cont rol block Imag e c o u n te r , 2 7 - 9 Ha r d wa r e p r o c e s s c o nt r o l b l o c k , Imag e e x e c u t i o n , 1 - 6 xxxi , 1-1 , 1-3 , 1-1 8 , 5-2 , Imag e ex i t , 7 - 5 , 1 3 - 2 , 1 3 -1 0 , 5-5 , 8 -2 1 , 8-2 3 , 9-5 , 1 4-2 2 , 1 8- 1 8 1 4 - 2 7 , D- 1 0 Imag e f i l e , 1 1 - 4 , 1 1 - 1 1 , 1 1 - 3 5 , F i g u re 1 - 1 1 2 - 3 t o 1 2 - 4 , 1 2- 6 , 1 2 - 2 6 , Figure 8 -6 1 3-6 , 1 8- 5 F i g u r e 1 1 -2 Figure 1 8-1 Ta b l e D-3 Imag e h e ad e r , 1 8 - 5 see a l so p r oc e s s c o n t r o l b l o c k Figure 1 8-1 H i b e r na t e P r o c e s s Imag e h e ad e r b u f f e r s ys tem s e rv i c e ( $ B I B E R ) , F i g u r e 1-7 8 -1 1 , 8 - 1 5 , 9-9 Ta b l e E - 4 Ta b l e 9 - 1 Imag e I / O s egmen t , 1 - 2 4 , 1 8 - 8 , Ta b l e 9 - 2 1 8- 2 1 H i b e r n a t e wa i t s ta t e s ( H I B a nd H I B O ) F i g u r e 1-7 8 -1 5 , 9 - 9 Figure 1 8-9 Figure 8-5 Ta b l e E - 4 Ta b l e 8 - 1 Tab l e 1 4 - 2 I nd ex - 1 2 I NDEX I N S QUE i n s t r uc t i o n , 4 - 3 I NS TA L L SYSGEN c omma nd , 1 1 - 3 2 , Imag e i n s ta l l ed wi t h p r i v i l eg e , 1 8-1 1 Imag e r e s e t r o u t i ne i n s ys t em i m ag e , 1 3- 2 , 1 4-1 2 I N S TA L L u t i l i ty , 1 - 7 , 1 1 - 4 0 , 1 3- 7 , 1 8-2 to 1 8 - 3 , 1 8- 1 2 , 1 3-1 2 F i g u r e 1 8-9 T a·b l e 1 8 - 1 Tab l e E-4 Imag e r e s e t o pe r a t i o n , 1 8 - 2 1 Imag e r un d o wn , 7 - 4 , 1 3 - 1 0 , 1 8- 2 0 , 2 0 - 9 , 2 0 -1 3 to 2 0 -1 4 , 2 3-8 , 27-9 14-22 20-1 3 F i g u r e 1 8-7 Imag e s t a r t up , 2 - 3 0 , 1 3 - 1 4 F i g u r e 1-8 Imag e t e rm i n a t i o n , 2 0 - 1 4 Imag e - s pe c i f i c m e s sag e s e c t i o n , 9-1 , 27-5 I MG I OCNT s p e c i a l SYSB OOT p a r am e t e r , B-1 5 , !NIT E-2 1 A- l l F ig u r e 1 1-2 2 F i g u r e 22- 1 Figure 22-2 F i g u r e 2 2- 3 Ta b l e 2 1 - 1 Tab l e 2 1 - 3 Ta b l e 2 1 - 4 Ta b l e 2 2 - 1 s e e a l so vo l um e i n i t i a l i z a t i o n u t i l i ty I N I TADP mod u l e in s ys tem i m ag e , 2 2-1 0 I n i t i a l q u a n t um Tab l e 1 4 - 2 I n i t i a l q u a n t um f l ag , 8 - 5 , 1 4 - 7 I n n e r a c c e s s mo d e , x x x i Fi g u r e 1-4 I n p u t s ym b i o n t , 2 0 - 4 Fi g u r e 2 0-2 Tab l e 1 - 1 9-1 3 I n t e r p r o c e sso r c omm un i c a t i o n , 9-1 4 , 1 1-35 I n t e r r up t d i sp a tc h b l oc k 6-7 , m o d u l e i n s y s t em i m ag e , xxxi , 7-6 , 1 0-3 , 1 1-32 , 1 1 - 3 5 , 1 5-9 , 1 7-1 3 , 2 1 - 1 8 , 2 2 -1 , 2 2 -3 , 2 5 -7 , 2 5 -1 0 , 1 4 -2 6 I n swa p o pe r a t i o n , 1 1 - 3 5 , 1 4 - 2 1 Figure 8-5 Figure 14-5 Figure 1 4- 6 Figure 14-7 Tab l e 1 4 - 5 I n t e g e r d i v i d e b y z e r o e x c e pt i o n Tabl e 2-3 I n t eg e r ove r f l o w e x c e p t i o n Tab l e 2 - 3 I n t e r a c t i v e j ob , 7 - 5 , 8 - 4 to 8 - 5 , 9 - 1 0 , 2 0 - 1 , 2 0 - 5 Figure 20-1 I n t e r l o c k ed i n s t r uc t i o n s , 1 1 - 3 7 I n t e r p r o c e s s c ommun i c a t i o n , 1 8- 8 1 7-1 6 , 14-24 , I n swa p o f the pr o c e s s h e ad e r , Figure 1 8-1 F i g u r e 1 8-2 F i g u r e 1 8-3 F i g u r e 1 8- 4 F i g ur e 1 8- 5 Imag e S t a r t up s ys tem s e rv i c e ( $ I MG S TA ) , 1 8 -1 7 , 2 5 -1 3 Tab l e 1 -1 Tab l e 1 8-1 Tab l e 2 1 -1 I n s t r uc t i o n b u f f e r , A- 5 I n swa p o f the p r o c e s s b o d y , Figure 20-3 Ta b l e 9 - 2 Imag e s ec t i o n , 1 1 - 1 1 Imag e s e c t i o n d e sc r i pt o r , 1 3 - 6 , 1 8- 5 , 22-1 8 , ( I DB ) , 6-1 1 Figure 6-3 Figure 6-4 Figure 6-5 Figure 6-7 I n t e r r up t pr i o r i t y l ev e l s e e I PL I n t e r r upt s e r v i c e r o u t i n e , 1 - 1 2 to 1-1 3 Figure 6-7 I n t e r r up t s t ac k , 1 - 1 4 , 1 - 1 7 , 5-2 , 6-4 , 8-2 7 , 23-1 , 2 5 - 1 1 , B- 2 3 , E - 1 0 Figure 1-6 Figure 6-1 F i g u r e 21-2 Figure E-1 Ta b l e 4 - 1 Ta b l e 2 3 - 1 Ta b l e E - 2 Ta b l e E - 3 2 3-6 , I n t e r r up t s ta c k po i n t e r r eg i s te r ( PR $ I S P ) Ta b le 2 1 - 3 Ta b l e 2 3 - 1 I nd e x - 1 3 I NDEX I n t e r r up t s , 1 - 1 7 , 2 4 - 1 s e e a l s o h a rd wa r e i n t e r r up t s s e e a l so s o f twa r e i n t e r r up t s I n t e rva l t im e r , 1 0 - 1 I N TSTKPAG E S SYSBOOT pa r am e t e r , B-1 5 , E-1 0 Tab l e E-2 I OTA s pe c i a l SYS B O OT p a r am e t e r , 5 - 1 1 , 8 - 5 , B- 1 6 I P L , 1 - 1 1 , 1 - 1 7 to 1 - 1 8 , 2 - 8 , 3-1 0 , 4 - 1 , 4-4 , 6 - 1 , 8 - 1 3 , 2 4-1 F i g u r e 2 4-1 Tab l e 4 -1 v a l ue d e f i n i t i o n s , D- 2 3 I PL 0 , 1 3- 1 4 I P L 2 ( I P L $ ASTDE L ) , 1 - 1 4 , 4 - 3 , 5 - l , 5- 6 , 5 - 9 , 8 - 1 5 , 9-1 0 , 1 2- 1 , 1 3-1 5 , 1 7-1 6 , 24-5 , 24-9 , 2 5-7 Ta b l e 4 - 1 Tab l e 2 4-1 I PL 3 ( I PL $ S C H ED ) , 8 - 1 8 , 8 - 2 0 I P L 4 ( I PL $ I O PO S T ) , 4 - 3 , 4 - 7 , 5 - 1 0 , 1 6 - 8� 2 4 - 7 Ta b l e 4 - 1 I PL 6 ( I PL $_QUE UEAST ) , 5 - 1 3 , 24-5 I P L 7 ( I PL $ S YNC H ) , 1 - 1 1 , 1-2 0 , 5-6 , 5- 1 0 , 5-1 3 to 5 -1 4 , 8-2 0 , 8 - 2 2 to 8 - 2 3 , 9 - 8 , 1 3 - 1 4 , 1 4 -2 3 , 1 7-7 , 1 8 - 2 2 , 1 9 - 5 , 2 4 - 3 , 2 4 - 5 , 2 5 - 7 , 2 5 - 1 1 , A- 1 2 Fig ure 8-7 F i g u r e 1 4 -1 T a b l e 2 4 -1 I PL 7 ( I PL $ T I M E R ) , 4 - 6 Ta b l e 4 -T s o f twa r e i n t e r r up t , 1 0 - 6 I PL 8 - 1 1 , 2 4 -4 , 2 4 -6 T a b l e 2 4 -1 I P L 1 1 ( I PL $ MA I LB OX ) , 1 5 - 1 3 , 2 5-7 T a b l e 2 5 -1 I PL 1 6-3 1 , 6-1 I P L 2 0 -2 3 , 5 - 1 3 t o 5 - 1 4 , 6 - 6 , 2 4 -4 Tab l e 2 4-1 I PL 2 4 ( I P L $ HWC LK ) , 4 - 4 , 1 0 - 5 , 2 3-7 , 2 4 - 4 Ta b l e 2 4 -1 I PL 3 0 , 2 3 - 1 I PL 3 1 ( I P L $ POWE R ) , 7 - 2 to 7 - 3� 7 - 1 0 to 7 - 1 1 , 2 4 -4 , 2 5 -7 Tab l e 2 4-1 T a b l e 2 5 -1 I PL r eg i s te r ( PR $ I P L ) , 2 4 - 1 F i g u r e 2 4 -1 I RP e x t e n s i o n , 1 6 - 8 I RPC OUNT SYSBOOT p a r am e t e r , 2 5 - 9 , 2 5 - 1 3 , B - 1 5 , F- 1 ! SAM f i l e , 3 - 1 2 J Job , 1 - 1 , 1 - 4 F i g u r e 1 7- 2 F i g u r e 1 9- 1 JOB c a rd ( $J OB ) , 9 - 1 1 , 2 0 - 5 Job con t ro l l e r , 3 - 4 , 2 0 -1 , 2 2 - 1 3 , 2 2 - 1 7 , 2 7 - 1 to 2 7 - 2 Figure 20-1 F i g u r e 2 0- 2 Ta b l e 1 - 1 Tabl e 2 1- 1 ma i l bo x , 2 0 - 1 , 2 2 - 1 5 , 2 7 - 2 , B-2 F i gure 2 0-1 F i g u r e 2 0- 2 J o b i n fo rma t i o n b l o c k ( J I B ) , 1 - 3 to 1 - 4 , 1 7 - 1 to 1 7 - 2 , 1 9- 5 , 2 2 - 1 5 , 2 7 - 8 , D-7 Figure 1-1 Figure 1 7- 1 Figure 1 7-2 Figure 1 7-6 F i g u r e D-1 Ta b l e 1 7 - 4 K Ke rnel , 1-4 Ke rnel access mode , 1 -1 6 , 3-1 , 8 -2 7 , 1 4-2 F i g u r e 1-4 Tabl e 3 - 1 K e r n e l mode ex c e p t i o n , 2 - 3 1 K e r n e l s t ac k , 1 - 1 7 , 6 - 4 , 8 - 2 3 , 1 1 -7 , 1 2-3 F i g u re 1-7 Figure 6-1 Figure 1 2-2 Tabl e 4-1 Ta b l e 1 7 - 5 Ta b l e E - 4 K e r n e l - s t a c k -n o t-va l i d e x c ep t i o n , 2 - 7 to 2 - 8 Ta b l e 2 - 1 K F I LSTCNT S Y S B O OT p a r am e t e r , B-1 4 Known f i l e e n t r y , 1 8 - 1 2 F i g u r e 1 8- 6 Known f i l e en t r y t a b l e , 2 5 - 1 3 Ta b l e 8 - 2 · Known f i l e e n t r y t a b l e m u tex Ta b l e 2 4 - 2 I nd ex - 1 4 I NDEX K n own f i l e h e ad e r F i g ur e 1 8-6 K nown imag e , 1 - 7 , 1 8 - 2 , 1 8 - 1 2 , 1 8- 1 5 Table 2 1-1 K S RVE X I T , 3 - 1 0 , 3 - 1 3 , 3 - 1 7 F i g ur e 3-2 Figure 3-4 Figure 3-5 F i g u r e 3 -7 Figure 3-8 s e e a l s o SRVE X I T L LAMAPREGS S YS BOOT pa r am e t e r , B- 1 7 L a s t c h a nc e c o nd i t i o n h a nd l e r , 2- 1 8 , 1 3-4 L a s t c h a n c e e x c e p t i o n v e c to r , 2 - 1 8 , 1 7- 2 0 , 1 8 - 2 3 , 2 0 - 1 3 L a ye r ed p r o d uc t s Fi gure 1-2 L D PC TX i n s t r uc t i o n , 1 - 1 1 , 1 - 1 9 , 8 - 2 3 , 8 - 2 6 to 8 - 2 8 , 1 1 - 3 Figure 8-7 L e s s p r i v i l eg ed a c c e s s m o d e , A-8 see o u t e r a c c e s s mode L I B $ E S TAB L I S H Run-T i m e L i b r a r y p r o c ed u r e , 2-1 6 L I B $ FR E E VM Run-T i m e L i b r a r y p r o c ed u r e , 1 3 -6 L I B $G E T VM Run=T i m e L i b r a r y p r o c ed u r e , 1 2 -1 0 , 1 3 - 6 L I B $ I N I T IA L I Z E Run-T i m e L i b r a r y p r o c ed u r e Figure 1 8-7 L I B $ R EVE RT Run-T i m e L i b r a r y p r o c ed u r e , 2-17 L I B $ S I GNAL Run-T i m e L i b r a r y p r o c ed u r e , 2 -1 2 , 2- 1 4 , 2 7-4 , 2 7-7 Figure 2-3 Figure 2-4 L I B $ S TO P Run-T i m e L i b r a r y p r o c ed u r e Figure 2-3 Figure 2-4 L I B . M LB , 7 - 1 2 , A- 2 , A- 4 , D- 1 L i nk e r opt i o n , 1 2-2 4 , E - 2 1 L OAD S YSGEN c omma nd , 2 5 - 1 3 Lo c a l e v e n t f l ag , 9 - 1 Loc a l e v e n t f l ag wa i t s t a t e s ( L EF a nd L E F O ) , 3-1 2 , 8-9 , 8-1 5 , 9-5 to 9-6 Figure 8-5 Ta b l e 8 - 1 Ta b l e 1 4 - 2 Lo c k pag e i n m emo r y b i t i n WSLE Figure 11-5 Lo c k pag e i n wo r k i ng s e t b i t i n WSLE Figure 11-5 Lo c k Pag e s i n Memo r y s ys t em s e rv i c e ( $ LC K PAG ) , 11-1 0 , 1 3 -1 5 Ta b l e 1 3 - 1 Lo c k Pag e s i n Wo r k i ng S e t s ys t em s e rv i c e ( $ L KWS E T ) , 1 1 -8 , 1 3 - 1 5 , A- 1 2 Ta b l e 1 3 - 1 Lo c k i ng a mut e x f o r r ea d a c c e s s , 2 4 - 9 f o r wr i t e a c c e s s , 2 4 - 9 Lo c k i ng I /0 b u f f e r pag e i n to memo r y , 1 6-8 Lo c k i ng pag e s , 1 1 - 1 6 , 1 1 - 1 8 , 1 1 -3 4 Lo c k i ng pag e s i n the wo r k i ng s e t , 1 3 -1 5 LOCKRETRY s p e c i a l SYSB OOT pa r am e t e r , B-1 7 L OG I O p r i v i l eg e , 1 0 - 4 Log Tc a l b l o c k n um b e r , 1 1 - 1 1 Log i c a l n ame b l o c k ( L OG ) , 1 6 - 1 1 F i g u r e 1 6 -1 Figure 16-3 F ig u r e 26 -1 Figure 26-2 Ta b l e A- 1 Log i c a l n ame c r e a t i o n , 2 6 - 4 Log i c a l n am e s ys t em s e rv i c e s , 8-14 Log i c a l n ame t r a n s l a t i o n , 9 - 1 4 , 11-3 9 , 26-5 Log i c a l n ame s , x x i x , 1 - 6 , 9-1 , 9- 1 4 , 26-1 a nd a s so c i a t ed m a i l bo x , 16-1 2 , 2 6-3 Log i n c ommand f i l e , 2 0 -7 Figure 20-1 LOG I NO UT i m ag e , 2 0 - 1 , 2 0 - 4 to 2 0 - 5 , 2 2 - 1 5 , E - 1 7 F i g u r e 2 0 -1 Figure 20-2 Figure 20-3 I nd ex - I S INDEX LOGINOUT image , 2 0 - 1 , ( co nt . ) , Tab l e 1 - 1 Ta b l e 1 3 - 1 Ta b l e 1 8 - 1 Ta b l e 2 1 - 1 Ta b l e E - 4 Log o u t o pe r a t i o n , 2 0 - 8 Longwo r d i nd ex , x x x i Lo o ka s i d e l i s t , 5 - 3 , 1 6 - 7 , 2 2 - 8 , 2 5 - 9 to 2 5 - 1 0 , F- 1 F i g u r e 2 5 -4 Ta b l e 2 5 -1 T a b l e 2 5- 2 L RPC NT S Y S B O OT p a r am e t e r , F - 1 LRPS I Z E S Y S B OOT pa r am e te r , F - 1 L S I - 1 1 conso l e proce sso r , 1 5- 1 6 , 2 1 -6 M MA7 8 0 i n t e r r upt s e rv i c e r o u t i n e , 6-1 3 , 9-7 F i g u r e 6-6 MA7 8 0 s h a r ed mem o r y , 7 - 9 , 9 - 1 4 , 1 1-1 , 1 1- 3 5 Tab l e 6 -1 Tabl e 2 2-2 Ma c h i ne c h e c k , 2 - 7 to 2 - 8 , 6 - 1 , 7 - 1 to 7 - 2 , 7 - 9 Ta b l e 2 - 1 Tab l e 2-2 M a c h i ne c h e c k c od e , 7 - 1 0 t o 7 - 1 1 Ma c h i ne c h e c k r ecove r y b l oc k , 7-1 2 Ma g n e t i c t a pe AC P , 1 - 6 Ta b l e 1 - 1 Ma g n e t i c t a pe d r i v e r , 1 5 - 6 MA I L u t i l i ty Ta b l e 1 - 1 Ma i l bo x c r e a t i o n , 1 6 - 1 1 , 2 6 - 3 F i g u r e 1 6 -1 F i g u r e 1 6-3 Ma i l bo x d ev i c e , 9 - 1 , 9 - 1 3 , 1 5 - 1 1 , 2 2 - 1 0 , B- 2 i n s h a r ed memo r y , 9 - 1 4 to 9 - 1 5 , 1 1 - 3 5 , 1 1 - 4 2 , 1 6-1 3 Figure 11-2 5 Ma i l bo x d r i v e r , 5 - 1 5 , 9 - 1 3 , 1 5- 1 2 Ma i l bo x l og i c a l name , 1 6 - 1 2 , 26-3 Ma i l bo x m e s sag e b l o c k F i g u r e 1 5 -4 Ma i l bo x r ea d o pe r a t i o n , 1 5 - 1 3 Ma i l bo x un i t c o n t r o l b l o c k , 9-1 5 , 11-42 F i g u r e 1 6 -1 F i g u r e 1 6-3 Ma i l bo x wr i te o pe r a t i o n , 1 5 - 1 5 Map Global Sec t i on s ys t em s e rv i c e ( $ MG B LS C ) , 9-1 4 , 1 1 -2 0 , 1 1-2 7 , 1 3 - 6 to 1 3 - 8 , 1 8 - 1 2 M a pp i ng r eg i s te r s i n MBA o r UBA , 1 1 - 3 4 MAS SBUS a d a p t e r , 6 - 4 Tab l e 6 - 1 Ta b l e 2 2 - 2 i n t e r r up t s e r v i c e r o u t i n e , 6-1 0 Figure 6-4 MAXBUF SYS BOOT p a r am e t e r , B-1 6 MAXPR INTSYM B SYSBOOT p a r am e t e r , B-1 9 MAXPROC ES SCNT SYSBOOT p a r am e t e r , 1 4 -1 2 , 1 7 - 9 , 2 2 - 1 6 , B - 1 4 , F- 3 Figure 1 1-21 Ta b l e 2 2 - 1 MCHECK7 5 0 mod u l e i n s ys t em i m ag e , 7 - 1 0 M C HECK7 8 0 mod u l e i n s ys t em i m ag e , 7 - 1 1 M C R c omma nd l a ng uag e i n t e r pr e t e r , 3-4 , 2 0 - 9 Ta b l e 1 - 1 M DAT mod u l e i n s ys t e m i m ag e , B-1 , B-7 MDL s t r uc t u r e d e f i n i t i o n l a ng uag e , x x i x , A- 1 7 , D- 1 Ta b l e A- 1 Ta b l e A - 2 Ta b l e A- 3 M e c ha n i sm a r r a y , 2 - 1 6 , 2 - 1 8 , 2-2 3 Figure 2-3 Figure 2-4 Figure 2-5 Figure 2-6 Figure 2-7 Figure 2-8 Mem o r y m a n ag em e n t , x x v i i i , 1 - 4 , 1-1 0 Figure 1-2 Memo r y m a n ag em e n t e n a b l i ng , 2 1 -1 8 , 2 2 -1 F i g u r e 2 2- 2 Memo r y m a n ag em e n t I /O r e que s t s Ta b l e 1 2 - 1 Mem o r y m a n ag em e n t pag e p r o t ec t i o n , 1 -1 0 , 1-1 6 , 1 -1 9 , 1 1 - 4 , 2 7- 1 0 Figure 1 1-3 Tab l e 1 1 -1 Memo r y m a n ag em e n t wa i t s t a te s , 8-1 1 , 8-1 6 Memo r y r e s i d e n t p r o c e s s , 8 - 1 Memo r y ROM p r og r am , 2 1 - 7 Tab l e 2 1 - 1 I nd ex - 1 6 INDEX Memo ry s i z i ng operation , Mod i f i ed pag e wr i t i ng , 8 - 8 , 2 1-7 Me r g ed i m a g e a c t i v a t i o n , 1 8 - 2 , 8 -1 1 , 2 2-1 5 Table 2 1-1 Me s s ag e v e c to r s Figure 1-7 Tab l e E-4 M FY L O L IM I T SYSB OOT pa r am e t e r , E-= 1 6 1 1-1 1 , M I NWS C NT SYS BOOT pa r am e t e r , 1 3-1 2 , 1 7-1 5 , B- 1 5 Ta b l e 1 3 - 1 M i s c e l l a ne o us wa i t s t a t e ( MWA I T ) , 8 - 1 1 , 8 - 1 5 to 8 -1 6 , 1 3- 5 , 2 7- 9 F igure 8-5 Tabl e 8 -1 Tab l e 8 -2 Tab l e 1 4 -2 m u t ex wa i t Ta b l e 8 - 2 Tab l e 2 4 -2 r e s o u r c e wa i t Ta b l e 8 - 2 s e e a l s o m u t ex wa i t s e e a l s o r e so u r c e wa i t Mo d i f i ed pag e l i s t , 1 1 - 7 , 1 1 -1 4 , 1 1-1 7 , 1 1-3 5 , 1 2-6 , 1 2 - 8 , 1 2 -2 5 , 1 2-2 8 , 1 4 -2 1 , 14-24 F igure 1 1-1 1 F igure 1 2-3 F igure 1 2-4 Figure 1 2-5 F igure 1 2-8 l owe r l i m i t t h r esho l d , 1 2 - 2 9 , 1 4-8 , 1 4-2 1 uppe r l i m i t t h r esho l d , 1 4 - 8 , 1 4-2 1 Mod i f i ed page wr i te c l u s te r i ng , 1 2-2 5 F igure 1 2-8 Mod i f i ed pag e wr i te c o m pl e t i o n , 1 2 -2 5 , 1 2- 2 8 1 1-2 3 , 1 2-20 1 1-3 0 , Mod i f i ed pag e wr i te r , 1 1 - 2 0 , 1 1-3 5 , 1 2-6 , Tab l e 9 -2 Tab l e 1 2-1 Mod i f i ed pag e wr i te r a r r a ys , 1 1-32 , 22-9 , 25-1 3 Figure 1 1-24 F igure 1 2-8 Tab l e 1 2 -1 Tab l e 2 2-1 Mod i f i ed pag e wr i te r P T E a r r a y , 1 1-35 1 2-2 5 , 1 4- 2 , 1 4-8 Mod i f y b i t Figure 1 2-3 Fig u r e 1 2 -4 Figure 1 2-5 Figure 1 2-7 i n t h e pag e t a b l e e n t r y , 20-6 , 1 1 -1 6 , 1 2- 4 , 1 2 -2 9 Figure 1 1- 3 i n the PFN S TATE a r r a y , 1 1-1 1 , 1 1-1 6 , 1 2 - 6 to 1 2 - 8 , 1 1- 1 8 , 1 4 - 1 3 to 1 4 - 1 5 i n wo r k i ng s e t l i s t e n t r y Figure 1 1-5 Mo r e pr i v i l eg ed a c c e s s m o d e Tab l e 1 1 - 1 s e e i nn e r a c c e s s m o d e MOUNT s e e vo l ume moun t u t i l i ty Mo un t ed v o l um e l i s t , 2 5 - 1 1 , 2 5- 1 3 MOVC 5 i n s t r uc t i o n , 1 2 - 1 0 M·o vcx i n s t r uc t i o n , 2 1 - 1 4 M PW H I L IM SYS BOOT p a r am e t e r , 14 - 9 , B-1 5 14-9 , 2 2-1 0 , M PW LOL IMIT SYSBOOT p a r am e t e r , B-1 5 M PW PR I O s p e c i a l S Y S B OOT pa r am e t e r , B-1 6 Tab l e 1 2 - 1 Ta b l e 1 4 - 1 M PW WRTC LUSTER S Y S B OOT p a r am e t e r , ll- 3 5 , 1 2 - 2 6 , 1 2 - 2 8 to 1 2 - 2 9 , B- 1 5 Figure 1 1-24 Tab l e 2 2 - 1 M u l t i pl y a c t i ve s i g n a l s , 2 - 2 0 , 2-2 8 Figure 2-6 Figure 2-8 MUTEX mod u l e i n sys t em i m ag e , 2 4 - 9 M u t e x wa i t s ta t e ( MWA I T ) , 8 - 1 4 , 2 4-9 to 2 4-1 0 Ta b l e 2 4 - 2 Mu t ua l e x c l us i o n s em a pho r e ( Mu t ex ) , 1-2 1 , 24-7 , 3 -1 2 , 8 -1 4 , 2 6 -4 , D-9 Figure 3-5 F i g u r e 2 4 -2 8-1 6 , 24-1 , MWA I T s t a te ( m i s c e l l an e o u s wa i t ) s e e m i s c e l l a n e o u s wa i t s e e m u t ex wa i t s e e r e s o u r c e wa i t Index- 1 7 INDEX 0 N Nam i ng conv e n t i o n s , C - 1 N a t i v e m o d e i mag e , 1 - 2 4 Figure 1-8 N E TDR IVER F i g u r e 1 5 -3 N E TM B X p r i v i l eg e Ta b l e 1 7 - 3 N e two r k AC P ( N E TAC P ) , 1 5 - 1 2 F i g u r e 1 5 -3 Ta b l e 1 - 1 N e two r k d ev i c e , 1 5 -1 1 N JO B L I M S YS BOOT p a r am e t e r , B- 1 9 No a c c e s s p ag e , 1 - 2 4 Figure 1-8 No a c c e s s p r o c t e c t i o n c od e Ta b l e 1 1 -1 N OACNT p r i v i l eg e Ta b l e 1 7 - 3 N OAUTOC ONF I G s p e c i a l SYSB OOT pa r am e t e r f l ag , B-1 7 N O C LOC K s pe c i a l SYSBOOT p a r am e t e r f l ag , B-1 7 N OC LUS TER s pe c i a l S YS B OOT pa r am e t e r f l ag , 8-1 7 N o n pa g e d d yn am i c m emo r y , 1 - 2 1 , S - 3 , S - 7 , 5 - 9 to 5 - 1 0 , 8 - 1 4 , 9 - 1 , 1 0 -7 , 1 0 - 1 0 , 1 0 - 1 2 , 1 1 -3 0 , 1 1 -3 4 , 2 2-5 , 2 5-1 , 25-1 3 , 8-2 3 , E-1 0 F i g u r e 1-6 F i g u r e 2 1 -2 F i g u r e 2 5 -4 F i g u r e E-1 Ta b l e 8 - 2 Ta b l e 2 2 -1 T a b l e 2 5 -1 T a b l e 2 5 -2 Ta b l e E - 2 Ta b l e E - 3 a l l o c a t i o n , 1 6 -7 , 2 2 - 5 , F- 1 to F - 2 d ea l l oc a t i o n , 2 4 - 5 , F- 2 N o n pa g ed po o l s e e n o n pa g ed d yn am i c m em o r y N PAG EDYN SYS BOOT pa r am e t e r , 2 5- � 3 , B- 1 5 , E - 1 0 Tab l e E-2 N u l l d ev i c e , 1 5 - 1 1 , 2 2 - 1 0 , B- 2 Nul l process , 1 -1 5 , 8-3 , 1 1-3 2 , 2 2 - 8 , B-7 N u l l p r o c e s s PC B , 1 7 - 1 2 F i g u r e 1 7 -3 O PC C RASH p r og r am , 7 - 7 O PC OM p r o c e s s , 2 2 -1 3 , 2 2 - 1 7 , 27-3 Ta b l e 1 - 1 Ta b l e 2 1 - 1 ma i l box , 2 2 -1 5 , 2 7 - 3 , B-2 O PE R p r i v i l eg e , 1 0 - 4 O p e r a to r c ommun i c a t i o n s , 2 7 - 3 O u t e r a cc e s s mo d e , x x x i , 1 7 -1 8 Figure 1-4 O u t s wa p o f p r o c e s s b od y , 1 4 - 1 � , 1 4 -1 5 O u t s wa p o f p r o c e s s h e ad e r , 1 4 - 2 0 to 1 4 - 2 1 O u t s wa p o pe r a t i o n , 1 1 - 3 5 , 1 4 -1 3 Figure 8-5 F i g u r e 1 4 -2 F i g u r e 1 4 -3 F i g u r e 1 4 -4 Ta b l e 1 4 -4 O u t s wa pped p r o c e s s , 8 - 1 Own e r a c c e s s m o d e f i e l d i n t h e pag e t ab l e e n t r y , 1 1-4 , 1 3-1 F i g u r e 1 1 -3 p P O ba s e r eg i s t e r ( PR $ P OB R ) , 8 - 2 0 , 8 - 2 6 to 8 - 2 8 , 1 1 - 3 4 , 2 1 -1 8 , 2 2-2 , 2 3-5 Figure 8-6 F i g u r e 1 1 -2 F i g u r e 2 2 -1 Ta b l e 7 - 1 Ta b l e 2 1 - 4 Ta b l e 2 3 -1 PO l eng th r eg i s t e r ( PR $ P O LR ) , 8 - 2 0 , 8 - 2 6 to 8 - 2 8 , l l- 3 , 2 1 -1 8 , 2 2 -2 F i g u r e 8-6 F i g u r e 1 1 -2 F i g u r e 2 2 -1 Ta b l e 7 - 1 Tabl e 2 1 -4 Ta b l e 2 3 -1 PO p a g e tab l e , 1 - 3 , 1 1 - 1 , 1 1 - 3 , 1 4 - 2 2 , 2 2 - 1 to 2 2 - 2 Figure 1 1-1 F i g u r e 1 1-2 Ta b l e E - 1 P O s pa c e , 1 - 1 6 , 1 1 - 3 P O s pa c e l a yo u t , 1 - 2 4 P O -o n l y i m ag e , 1 8 - 3 , 1 8 -1 1 I n d ex- 1 8 INDEX P l b a s e r eg i s t e r ( PR $ P l B R ) , 8 - 2 0 , 8 - 2 6 to 8 - 2 8 , 1 1 - 3 Figure 8-6 F i g u r e 1 1-2 Ta b l e 7 - 1 Tab l e 2 3 -1 P l l e ngth r eg i s t e r ( PR $_P l LR ) , 8 - 2 0 , 8 - 2 6 to 8 - 2 8 , 1 1 - 3 Figure 8-6 F i g u r e 1 1 -2 Ta b l e 7 - 1 Tab l e 2 3-1 P l p a g e tab l e , 1 - 3 , 1 1 - 1 , 1 1 - 3 , Pag e f i l e , 1 1- 4 , 1 2- 3 , A- 1 0 , E-1 7 1-1 6 , s e e a l s o c o n t r o l r eg i o n P l s pa c e l a yo u t , 1 - 2 2 , A- 1 7 Figure 1-7 Ta b l e E - 4 P l w i ndow t o t h e p r oc e s s h e ad e r , 1 1-8 , 1 4 - 2 2 to 1 4-2 3 , 1 7 -1 5 , Figure 1-7 Ta b l e E - 4 Pa f e f a u l t s e e a l s o t r a n s l a t i o n- no t-va l i d f a ul t Pa g e a nd s wa p f i l e v e c to r , 1 1 - 3 0 Page faul t , 1 -1 4 , 1 1 - 4 , 1 1 -7 , 1 2 -1 , 24-6 F i g u r e 1 2-2 f o r g l o b a l pag e s , 1 2 - 1 2 f r om an i mag e f i l e , 1 2 - 3 f r om the f r e e pag e l i s t , 1 2 - 7 f r om t h e pag e f i l e , 1 2 - 1 2 Pag e f a u l t h a nd l e r , 1 - 4 , 1 - 1 0 , 1 - 1 5 , 8 - 2 7 , 1 1- 1 , 1 1- 4 , 1 1 -7 , 1 1 - 1 7 , 1 2 - 1 , 1 3 - 7 , 1 4 - 2 , A- 6 Figure 1-2 Figure 1-3 Figure 1-5 Ta b l e 1 4 - 1 P a g e fa u l t r e a d e r r o r , 2 - 1 3 Ta b l e 2 - 2 Pag e f a u l t wa i t s ta t e ( P FW ) , 8 -1 1 , 8-1 5 to 8 -1 6 , 8 - 2 7 , 12-4 , 12-2 4 , Figure 8-5 Ta b l e 8 - 1 Ta b l e 1 4 - 2 1 2- 3 0 , 1 3-5 2 2- 1 6 1 4-1 1 , 2 2-1 6 1 1-4 , 1 1-1 6 , 1 2-2 1 , 8-1 6 , 1 2-2 4 , 1 2- 3 0 1 3-5 pag e t a b l e e n t r y f o rm a t F i g u r e 1 1-3 Figure 1 1-10 F i g u r e 1 2- 5 P a g e r ea d compl e t i o n sys tem eve n t , B-2 4 27-9 2 2- 1 3 , Figure 1 1- 2 2 P a g e f i l e i nd ex Figure 1 1- 1 0 P a g e f i l e v i r t ua l b l o c k n um b e r , Figure 1 1-1 Figure 1 1 -2 Tab l e E-1 P l po i n t e r pag e , 1 1 - 7 , 2 3 - 8 , 1 1 -3 , 1 1-3 0 , 1 1-3 5 , 1 2-1 2 , 1 2-2 6 , Tab l e 2 1 - 1 Ta b l e 2 2 - 3 P a g e f i l e b i tm a p , 1 1 - 3 0 , 2 5 - 1 3 Figure 1 1- 2 2 Page f i l e con t r o l b loc k , 1 1- 3 0 , 1 4-22 Figure 1-7 F i g u r e 2 6- 1 Tab l e 1 7 - 5 Ta b l e E - 4 P l s pa c e , 1 - 3 , 1 - 1 4 , 1 2-8 , Tab l e 8 - 3 P a g e t ab l e e n t r y , 1 1 - 2 , 1 1 - 4 , 1 2- 1 , 1 2-3 to 1 2 - 4 , 1 2-7 Figure 11-3 Tab l e 1 1- 1 Ta b l e 1 4 - 5 P a g e t ab l e pag e , 1 2 - 2 0 P a g e type c od e i n PFN TYPE a r r a y Figure 11-12 i n WS LE Figure 11-5 Pag ed d yn am i c memo r y , 1 - 2 1 , 13-7 , B- 2 2 , 2 5 -1 , 2 5 -1 1 , E- 1 0 F i g u r e 1 -6 Figure 2 6-1 2 6-4 , F i gure E-1 Tab l e 8-2 Tab l e 2 5-1 Tab l e 2 5-2 Ta b l e E - 2 Tab l e E-3 P a g ed d yn am i c mem o r y m u t e x Ta b l e 2 4 - 2 P a g ed po o l s e e pag ed d yn am i c memo r y PAG EDYN S Y S B OOT p a r am e t e r , 25-1 3 , B-1 5 , E-1 0 Ta b l e E - 2 PAG E FAU LT mod u l e i n s ys t em i m age Tab l e 1 4 - 3 PAG E F I LE . SYS , 1 1 - 3 0 Figure 1 1- 2 2 PAG E F I LS I Z E s p e c i a l SYSB OOT p a r am e t e r , B-1 5 Pa g e r s e e pag e f a u l t h a nd l e r I nd ex - 1 9 INDEX Pa g e r I /0 , 1 - 1 0 , 1 2 - 4 , 1 2 - 1 9 F i g u r e 1-3 PAG F I LC NT s pe c i a l SYSB OOT pa r am e te r , B-1 5 Pag i ng f i l e quo t a , 1 3 - 3 PAGTB L PF C s pec i a l S Y S B O OT pa r am e te r , 1 2- 2 1 , B- 1 4 Pa r am e t e r f i l e s , 7 - 5 , 2 2 - 1 9 , 2 2 -' 2 3 F i g u r e 2 2-4 F i g u r e 2 2- 5 Ta b l e 2 2 - 3 a nd SYSB OOT , 2 2- 1 9 a nd SYSGEN , 2 2 - 2 3 Pa s swo rd , 2 0 - 6 PAS SWORD c a rd ( $ PAS SWORD ) , 2 0 - 5 PC B s e e h a r d wa r e p r o c e s s c o n t r o l block see proc ess c on t r o l b loc k PC B s t a t u s vec to r ( PC B $ L S TS ) , 8-5 , 8-1 1 , 8-1 3 , 9-1 1 Tabl e 9-2 Ta b l e 1 7 - 3 PC B v e c to r , 1 1 - 2 7 , 1 7 - 7 , 1 7 - 9 , 2 2 - 8 , 2 5 -1 3 , 2 7 - 1 0 Figure 1 1- 2 1 F i g u r e 1 7-3 F i gu r e 1 7-4 Ta b l e 2 2 - 1 PDAT mod u l e in s ys t em i m ag e , 1 - 1 6 , 2 2 -8 , B- 8 Pe r -p r o c e s s c ommon a r e a F i g u r e 1-7 Ta b l e E - 4 Pe r -p r o c e s s m e s sag e s e c t i o n , 1 7-1 6 F i g u r e 1-7 Ta b l e E - 4 Pe r -p r o c e s s s t a c k po i n t e r s , 8 - 2 0 , 8 - 2 7 to 8 - 2 8 F i gure 8-6 Tab l e 7 - 1 Ta b l e 2 3 -1 Pe r i od i c sys t e m s ub r o u t i n e , 1 0 - 9 Figure 1 0-1 T a b l e 1 0 -1 PFCDEFAULT SYSB OOT pa r am e t e r , 1 2 - 2 1 , 1 2 - 2 4 , B- 1 4 Ta b l e 1 2 - 1 P F N d a t a b a se , 1 - 4 , 1 1 - 1 , 1 1 -7 , 1 1 - 1 4 , 1 2- 4 , 1 2-1 5 , 1 4 -1 5 , 2 1 - 1 7 , 2 5 - 1 1 , B- 2 2 , E - 1 0 , E-1 2 to E-1 3 F i g ure 1-6 F igure 11-9 Figure 1 2-3 PFN data ba se , ( cont . ) , Figure 1 2-4 Figure 1 2-5 Figure 1 4-2 Figure 14-3 F i gu r e 1 4-4 Figure 14-5 F i g ur e 1 4 - 6 Figure 14-7 Figure 21-2 Figure E-1 Ta b l e 1 1 - 2 Ta b l e 1 4 -1 Ta b l e E-2 Ta b l e E-3 PFN l i n k a r r a y s , 1 1 - 1 7 F i gure 1 1-9 Figure 1 1- 1 3 Tab l e 1 1 - 2 PFN mapp i ng , 1 3 - 6 , 1 3 - 8 PFN t r a ns i t i o n s ta te s , 1 1 - 7 , 1 2-1 5 , 1 2-2 5 , 1 4 - 2 0 s e e a l s o i nd i v i d ua l s t a t e n a m e s PFNMAP p r i v i l eg e , 6 - 1 5 , 1 3 - 6 P FRATH S Y S B O OT pa r am e t e r , 8 - 8 , 1 3 - 1 4 , 8- 1 6 Ta b l e 1 3- 2 PFRATL S Y S BOOT pa r am e te r , 8 - 8 , 1 3 -1 4 , 8- 1 6 Ta b l e 1 3 - 2 PFRATS s pec i a l SYS800T pa r ame t e r , B-1 6 Ph ys i c a l memo r y , 1 1 - 1 4 a m o un t us ed by the sys t em , E-1 4 Ph ys i c a l m emo r y c o n t e n t s , 7 - 7 , 7-9 Phys i c a l m emo r y d e sc r i pt o r s , 7 - 9 Ta b l e 7 - 1 Phys i c a l m emo r y l ayo u t Figure 21-2 Phys i c a l m emo r y s i z e , x x i x Ph ys i c a l pag e a l l o c a t i o n , 1 2 - 1 0 , 1 2 -1 4 Phys i c a l pag e d e l e t i o n , 1 1 - 1 7 PHYS ICALPAG E S spe c i a l SYSB OOT pa r am e t e r , B- 1 6 , E-1 2 P IC s e e po s i t i o n i nd e pe nd e n t c o d e PL/I , 2 - 2 POO L PAG ING S Y S B OOT pa r am e t e r f l a g , 2 2 -8 , B- 1 7 P O P L pseud o i n s t r uc t i o n F i g u r e A- 1 Po s i t i o n i nd e pend ent c o d e , 1 - 2 4 Figure 1-8 POSTEF mo d u l e in s ys t em i m ag e , 9 - 6 I nd ex - 2 0 INDEX P o we r fa i l , 2 - 7 , 5-1 2 , P r i v a t e sect i o n , 1 3-1 , 1 3-6 , 6-1 , 1 8-8 7-2 , 2 3-1 Tabl e 2-1 Ta b l e 2 3 - 1 Figure 18-2 Figure 18-3 P r i v a t e sect i on c re a t i on , 1 3- 6 P r i v i l eg e e nh a n c eme n t s , 1 8 - 1 2 P r i v i l eg e d i m ag e , 1 - 7 Figure 1-2 Figure 1-4 Ta b l e 1 - 1 Ta b l e 2 1 - 1 P r i v i l eg e d i n s t r uc t i o n e x c e p t i o n Ta b l e 2 - 1 Ta' b l e 2 - 2 P r i v i l eg e d i n s t r uc t i o n s , 1 - 1 1 P r i v i l eg e d l i b r a r y v e c to r ( P LV ) , i n t e r r upt s e r v i c e r o u t i n e , 2 3 -1 Ta b l e 2 1 - 3 Powe r r e c o v e r y , 5 - 1 2 , 8-8 , 21-2 , 2 3-1 Tabl e 2 1 - 3 Tabl e 2 3-1 e r r o r l og e n t r y , 2 3 - 6 s e e a l so r e s t a r t r o u t i n e Po we r r e c ov e r y A S T , 5 - 1 2 , 1 4 - 9 , 1 8-2 1 , 2 3-1 , 23-6 , 23-8 Ta b l e 9 - 2 d e l i ve r y , 2 3-8 P Q L Dq u o t a SYSB OOT pa r am e t e r s , 1 7- 8 , B-1 8 1 7- 1 5 , E-3 1 7- 8 , B-1 8 3-1 4 P Q L DW SDEFAULT SYS BOOT p a r am e t e r , F i g u r e 1 1-1 Ta bl e 1 3 -1 Ta b l e E - 1 P QL DWS QUOTA S Y S B OOT pa r am e t e r Ta b l e 1 3 - 1 P QL Mquo ta SYSBOOT pa r am e t e r s , P Q L MWSDE FAULT SYS BOOT p a r am e t e r Ta b l e 1 3 - 1 P QL MW SQU OTA SYSB OOT pa r am e t e r Ta b l e 1 3 - 1 P R $ I C C S r eg i s t e r , 1 0 - 1 , 1 0 - 3 , 10- 6 Tabl e 1 0-1 P R $ I C R r eg i s t e r , 1 0 - 3 , 1 0 - 5 Ta b l e 1 0 - 1 P R $ MAPEN r eg i s t e r , 2 2 - 3 , 2 3 - 5 Fi gure 22-2 P R $ N I C R r eg i s t e r , 1 0 - 1 , 1 0 - 3 , 2 3- 9 Tabl e 1 5-1 P r e empt i o n , 8 - 4 21-7 , 23-5 , P r i m a r y b o o t s t r a p p r og r am ( VM B ) , 7 - 6 , 7 - 9 , 2 1 - 5 , 2 1 - 7 , A- l l Figure 21-1 Ta b l e 2 1 - 1 Ta b l e 2 1 -2 Ta b l e 2 1 - 3 P r ima ry except i o n vec to r , 2 - 1 8 , 18-2 3 , 20-6 e x ec u t i v e m o d e , 2 - 3 1 k e r n e l mod e , 2 - 3 1 P r i n t s ymb i o n t Ta b l e 1 - 1 P r i v a t e pag e , 1 2 - 3 2-2 1 5-8 P r o c ed u r e c a l l i ng s t a nd a r d , 1-1 2 , 2-1 , 1-2 1 , 2 5 -1 , 5-8 F i g u r e 2-4 P r o c ed u r e e n t r y ma s k see entry mask Process , 1-1 , 8 - 1 P r o c e s s a l l oc a t i o n r eg i o n , 2 5 -1 1 , 26-4 , B- 2 7 Figure 1-7 F i g u r e 2 6 -1 Ta b l e 1 7 - 5 Ta b l e 2 5 - 1 Tab l e 2 5 - 2 Tab l e E - 4 Proc ess contex t , 1- 1 3 , 1 -1 7 , 5-1 0 t o 5-1 1 , 8 -1 6 , 9-9 , 1 0- 5 Ta bl e 1 0 -1 P R $ TXDB r eg i s t e r , 7 - 7 , l S- 1 6 to 1 5 - 1 7 , 2 1 - 2 , Figure 3-9 P r i v i l eg ed p r o c e s s , 3 - 1 8 P r i v i l eg e d s h a r e a b l e i mag e , 3 - 1 3 to 3 - 1 4 , 1 8 - 3 Figure 3-8 Figure 3-9 PRM C EB p r i v i l eg e Ta b l e 9 - 1 P RMMBX p r i v i l eg e , 1 6 - 1 1 , 1 6 - 1 6 P r o c ed u r e , 1 - 1 0 , 1 - 1 2 , 1 - 1 4 , 1 2-2 , 1 3-1 4 , 2 2-1 3 , 2 4 - 7 , Figure 1-1 Tab l e 1 7 - 1 1 6-7 , 1 9- 1 , 2 7 - 8 to 2 7 - 9 P r o c ess c ont r o l , 1 - 6 , 9 - 1 , 9-8 P r o c e ss c ont r o l b l oc k , x x x i , 1-3 , 5-5 , 8-1 , 8-9 , 8 - 2 2 to 8 - 2 3 , 8 - 2 6 , 1 7 - 1 to 1 7 - 2 , 1 9 - 5 , 2 7 - 8 , A-1 0 , D - 9 Figure 1-1 Figure 5-l Figure 8 -1 Figure 9-1 Figure 9-3 Figure 1 1-21 Index- 2 1 9-8 , 22-1 5 , INDEX Proc e s s control block , Figure 1 7-1 Figure 1 7-2 Figure 17-5 Figure 1 7-6 F i g u r e 1 9- 1 F i g u r e D- 2 Ta b l e 7 - 1 Ta b l e 9 - 2 Ta b l e 1 7 - 4 Ta b l e 1 8 - 1 Ta b l e D - 2 ( cont . ) P r oc e s s heade r , Tab l e 1 7- 5 Tab l e 1 8 - 1 T a b l e D- 3 Tabl e E -1 con f ig u r a t i o n , 1 7- 1 3 f i x ed s i z e po r t i o n , 1 1 - 2 , 1 1 -7 , 9-1 4 , 11-3 2 , 1-6 , 1 4-2 , Figure 8-5 Figure 1 7-1 Figure 1 8-9 Tab l e 8 -3 d e t a ch e d p r o c e s s , 1 7 - 6 to 1 7 - 7 Figure 1 7- 1 s ub p r o c es s , 1 7 - 2 , 1 7 - 6 t o 1 7 - 7 Process d e l e t i o n , xxvi i i , 1-6 , 5 - 1 1 , 7 - 5 , 8 - 9 to 8 - 1 1 , 8-1 4 to 8 -1 5 , 8 -2 7 , 9-8 , 9-1 0 , 24-5 , 1 7- 1 8 , 1 8 -1 8 , 2 4-9 , 27-9 Figure 8-5 Ta b l e 8 - 3 Ta b l e 1 4 - 3 Ta b l e 2 4 - 1 s ub p r o c e s s , 1 9- 3 Figure 1 9- 1 1 9- 1 , P r o c e s s h e ad e r , x x i x , 1 - 3 , 1-1 6 , 5-1 1 , 8-8 , 1 0-6 , 1 1-1 , 1 1-4 , 1 1-7 , 1 1-2 0 , 1 1-2 7 , 1 4 - 1 0 , 1 7 - 1 , 2 7 - 9 , A- 1 0 , D - 1 4 Figure 1-1 Figure 1 1-1 Figure 1 1-2 Fig ure 1 1 -4 Figure 1 1-6 F i g u r e 1 1-8 Figure 1 1-2 0 F i g u r e 1 4 -2 F i g u r e 1 4 -3 F i g u r e 1 4 -4 F i g u r e 1 4-5 F i g u r e 1 4-6 F i g u r e 1 4 -7 Fi g u r e 1 7-1 Figure 1 7-6 Ta b l e 9 - 2 1 1-2 , 1 1- 1 1 , 1 4 -1 1 , 1 1-27 , 1 4-2 0 11-27 , 1 1-3 0 , E-3 Figure 1 1-1 Figure 1 1-8 Ta b l e E - 1 P r o c e s s h e ad e r vec to r , 2 2 - 8 Tab l e 2 2- 1 P r o c e s s h e ad e r v e c to r a r r a y s , 8-28 Ta b l e 2 1 - 3 Ta b l e 2 3 - 1 P r oc ess c re a t i o n , xxv1 1 1 , 1 7-1 4 Tab l e 1 7- 5 Tab l e E - 1 s i ze , 1 1 - 2 7 , 2 1 - 1 7 , E - 1 Tab l e E- 1 P r o c e s s h e a d e r pag e a r r a ys , s e e a l s o h a rd wa r e p r o c e s s c o nt r o l b lo c k Process control block b a se r eg i s t e r ( PR $ PC B B ) , x x x i , 8 - 2 1 t o 8 - 2 3� 8 - 2 6 , 8-9 , 9-8 , 21-1 7 ( cont . ) , Figure 1 1-2 1 p r o c e ss i nd ex a r r a y , 1 1 - 2 7 r e f e r en c e c o un t a r r a y , 1 1 - 2 7 P r o c e s s h e ad e r vec to r i nd ex , 1 1-3 5 Figure 1 1-2 0 Figure 1 1-2 1 Figure 1 1- 2 4 P r o c e s s I /O s egmen t , 2 0 - 6 , B - 2 7 Figur e 1-7 Ta b l e 1 7 - 5 Tab l e E-4 Process I D , 1-3 , 5-1 4 , 9-8 , 1 0 - 1 1 t o 1 0 - 1 2 , 1 6 -7 , 1 6- 1 0 , 17-7 , 1 7- 9 , 2 5-1 1 , 26-1 2 7-7 , F-4 Figure 1 7-4 Tab l e 1 2 - 1 P r o c e s s i nd ex , 2 7 - 1 0 , F - 4 Figure 1 1-21 F i g u r e 1 7- 4 P r o c e s s l og i c a l name t a b l e , Figure 26-1 Figure 2 6-2 P r o c e s s n am e , 1 - 3 , 9 - 8 , 9 - 1 0 , 1 7- 5 , 27-7 P r o c e s s o u t s wa pp i ng , 8 - 1 1 P r o c e s s pag e t a b l e , 1 1 - 2 , 1 4-1 0 , 1 4 -1 5 , F i g u r e 1 1-1 9 Figure 1 4-2 Figure 1 4-3 Figure 1 4-4 Figure 1 4-5 Figure 1 4-6 Figure 1 4-7 Tabl e 1 2- 1 1 Ta b l e 1 4 - 1 Tab l e 1 4- 5 I nd ex- 2 2 1 4 -2 4 , 1 8-1 , 1 8 - 5 INDEX P r o c e ss pag e t ab l e e n t r y , 1 2 - 4 , 1 2 - 1 2 , 1 2- 1 7 , 1 3 - 6 to 1 3 - 7 , 1 3-9 P r o c e s s pe rm a n e n t f i l e , 1 8 - 2 1 , 2 0-6 , 2 0- 8 F i g u r e 2 0-1 F i g u r e 2 0- 2 P r o c e ss p r i o r i t y , 1 - 3 , 4-7 , 8-1 , 8-3 , 8-8 , 9-6 , 9-1 0 , 1 2 - 3 0 to 1 2 - 3 1 , 1 4 - 4 , 1 4 - 8 , 1 7- 6 , 2 4 - 1 0 , 2 7 - 2 Figure 8-2 F i g u r e 1 4 -1 Ta b l e 1 2 -1 Ta b l e 1 4 -1 Ta b l e 1 4 -2 a s s o c i a t e d boo s t , 1 0 -8 base , 8 - 3 , 8-1 9 , 8 - 2 3 , 9-1 1 , 1 6-7 , 2 0 -7 cur r ent , 8-3 , 8 -1 9 , 8 - 2 2 to 8 - 2 3 , 9 - 1 1 d yn am i c ad j us tm e n t , 8 - 3 to 8 - 5 , 8 - 1 8 , 1 2 - 2 4 Figure 8-2 Ta b l e 8 - 3 Ta b l e 1 2- 1 no rma l r ang e , 8 - 3 t o 8 - 4 , 2 4 - 9 r e a l - t i m e r a ng e , 8 - 3 , 8 - 1 9 , 8 - 2 3 , 2 4 -9 P r o c e s s p r i v a t e pag e Figure 1 1-1 2 P r o c e ss p r i v a t e s ec t i o n , 1 2 - 2 9 P r o c e s s p r i v i l eg e s , 1 - 3 , 1 - 1 3 , 1-1 9 , 9-8 , 1 6-7 , 1 7- 5 , 1 7 -1 7 , 1 8-1 1 , 1 8- 2 2 t o 1 8- 2 3 , 2 0-7 , 2 2-1 3 Ta b l e 1 7 - 2 Ta b l e 1 8 - 1 p r i v i l eg e m a s k , 2 7 - 2 s e e a l s o i nd i v i d ua l p r i v i l eg e n am e s P r o c e s s quo ta b l o c k ( PQB ) , 1 7 - 1 to 1 7 - 2 , 1 7 - 1 6 F i g u r e 1 7-1 F i g u r e 1 7-6 Ta b l e 1 7 - 2 P r o c e s s quo ta s , 1 - 3 , 1 - 1 3 , 1 - 2 0 , 1 7- 6 , 1 7- 8 , 2 0 -7 , 2 2 - 1 3 Tabl e 1 3 -1 Ta b l e 1 7 -4 d ed uc t i b l e quo ta s , 1 7 - 9 Ta b l e 1 7 - 4 nond ed uc t i b l e quo ta s Ta b l e 1 7- 4 poo l ed quo ta s , 1 - 4 , 1 7 - 9 F i g u r e 1 7- 1 F i g u r e 1 7- 2 Ta b l e 1 7 -4 P r o c e ss r un d o wn , 1 8 - 2 0 , 1 9 - 3 Tab l e 9 - 2 P r o c ess sch ed ul i ng s t a t e s , 4 -7 , 8 - 1 , 8 - 1 5 to 8 - 1 6 , 8 - 2 7 Ta b l e 8 - 1 Tab l e 1 4 -2 see a l so i nd i v i d ua l s t a t e n am e s P r o c e s s sec t ion , 1 1-1 1 P r o c e s s s ec t i o n t ab l e , 1 1 - 2 , 1 1 -4 , 1 1 - 1 1 , 1 7 - 1 4 , E - 3 Figure 1 1-1 Figure 1 1-6 Ta b l e 1 7 - 5 Ta b l e E-1 P r o c ess s e c t i o n tab l e e n t r y , 1 1 -4 , 1 1 - 1 1 , 1 1 - 3 0 , 1 3 - 5 to 1 3 -6 , 1 4 - 1 1 Figure 1 1-6 Figure 11-7 Figure 1 1- 1 0 F i g u r e 1 8- 3 P r o c e s s s ec t i o n tab l e i nd ex , 1 1 -4 , 1 1 - 1 1 , 1 1 - 1 6 , 1 2 - 3 to 1 2 -4 , 1 2 - 7 to 1 2 - 8 , 1 2 - 2 1 , 1 3 -6 , 1 4 - 2 6 Figure 1 1-3 F i g u r e 1 2- 3 F i g u r e 1 2 -4 F i g u r e 1 8-3 P r oc ess s t r uc t ur e , 1 - 1 8 P r oc e ss s uspe n s i o n , 5 - l , 5 - 1 0 , 9-9 P r o c e s s-pe r ma n e n t m e s sag e s ec t i o n , 27-5 P r o c e sso r p r io r i ty s e e I PL P r o c esso r r eg i st e r s s e e i nd i v i d u a l r eg i s t e r nam e s P r o c e s so r s ta t us l o ng wo r d ( PS L ) , 1 - 1 4 , 4 - 2 , 6 - 1 , 8 - 2 0 , 2 4 -1 F i g u r e 1 2- 2 P r o c esso r s ta t us wo r d ( PSW ) F i g u r e 3-7 Ta b l e 2 - 3 PROC SECTCNT SYS B O OT pa r ame t e r , 1 3 - 1 2 , B-1 5 , E - 3 Figure 1 1-1 Ta b l e E - 1 PROC STRT modul e in s ys t em i m ag e , 2 - 3 0 , 3 - 1 3 , 1 7 - 1 , 1 7 -1 6 , 2 0 - 1 2 , 2 0 - 1 4 , A- 1 0 , A- 1 2 F i g u r e 1 7-6 F i g u r e 2 0 -4 Ta b l e 1 7 - 1 Ta b l e 1 8 -1 Tab l e E-4 P r og r am d ev e l o pm e n t too l s Figure 1-2 P rotect ion code i n t h e pag e t ab l e e n t r y , 1 1 - 4 Figure 1 1-3 I nd e x- 2 3 I NDEX PSWAPM p r i v i l eg e , 9 - 1 1 , 1 3 - 1 5 to 1 3 - 1 6 Ta b l e 9 - 1 Ta b l e 1 7 -3 PTE PFN a r r ay , 1 1 - 1 6 to 1 1 - 1 7 , 1 1 - 3 0 , 1 2 -4 , 1 2 -7 , 1 2- 1 4 to 1 2 - 1 5 , 1 2- 1 7 , 1 2 - 2 5 , 1 3- 5 Figure 1 1-9 Figure 1 1-2 0 Ta b l e 1 1 - 2 P u r g e Wo r k i ng S e t sys tem s e rv i c e ( $ P URGWS ) , 1 2-6 , 1 3-1 4 P u t Me s sag e sys tem s e rv i c e ( $ P UTM SG ) , 1 7-1 9 , 27-4 , 2 7-6 Q Q ua n t um end , 4 - 6 , 5 - 4 , 5 - 1 2 , 8 - 4 to 8 - 5 , 1 0 - 6 to 1 0 -7 , 1 3 -1 0 , 1 3 -1 3 Ta b l e 8 - 3 Ta b l e 9 - 2 Ta b l e 1 3 -2 Ta b l e 1 4 - 3 Q UANTUM SYSBOOT pa r am e t e r , 8 - 5 , B-1 5 Q u e ue I /0 Reque s t sys tem s e rv i c e ( $ Q I O ) , 5 - l , 5-4 , 5 - 8 , 5 - 1 3 , 8 - 9 , 8 - 1 5 , 9 - 4 , 9 - 1 3 , 1 5 - 4 , 1 6 -6 , 1 6-1 9 , 24-7 Q u e u e I /0 Reque s t a nd Wa i t fo r Eve n t F l ag sys tem s e rv i c e ( $ Q I OW ) , 1 6 - 6 Q u e u e i n s t r uc t i o n s , 1 - 1 1 , 4 - 3 , 1 1 - 3 7 , 2 5 -9 , 2 5 -1 1 R RAB ( Re c o rd Ac c e s s B l oc k ) , 3 - 1 2 Read a c c e s s i b i l i t y , 3 - 5 Read Ev e n t Fl ag sys tem s e rv i c e { $ R EADE F ) , 9-7 R e a d i n prog r e s s PFN t r a n s i t i o n s ta t e , 8 - 1 1 , 1 2 - 4 , 1 2 -1 4 , 1 2 - 1 7 , 1 3 - 5 Figure 1 1-1 1 F i g ur e 1 2- 3 Figure 1 2-4 Figure 1 2-5 Figure 1 2- 6 F i g u r e 1 2-7 Ta b l e 1 4 -4 Rea l - t i m e b i tm a p Ta b l e 2 2 - 1 R EALT I M E S PTS S Y S B O OT pa r am e t e r , 6 - 1 6 , 2 2 - 8 , B- 1 7 , E - 9 Tab l e 2 2 - 1 Ta b l e E - 2 Reco rd m a n ag em e n t s e rv i c e s s e e RM S R EFCNT PFN a r r a y , 1 1 - 1 8 to 1 1 - 1 9 , 1 1 - 3 4 , 1 2 - 4 , 1 2 -6 , 1 2 - 1 4 to 1 2 - 1 5 F i g u r e 1 1-9 Ta b l e 1 1 - 2 Reg i s t e r s ave m a s k see entry mask RE I i n s t r uc t i o n , 1 - 1 1 , 1 - 1 7 , 2-8 , 2 -1 8 , 2-2 3 , 3-1 0 , 3 -1 7 , 4 - 2 , 4 - 6 , 5 - l to 5 - 2 , 5-6 to 5 - 7 , 5 - 9 , 6 - 1 to 6 - 2 , 6-9 , 8 -2 3 , 8 -2 6 , 8- 2 8 , 1 7-1 8 , 1 8 - 1 5 , 1 8 - 1 9 , 2 0 -7 , 2 3 -7 , 2 4 - 1 , A-8 F i g u r e 1-4 F i g u r e 2-3 F i g u r e 3-2 Figure 3-5 Figure 3-6 Figure 3-8 Figure 6-3 Figure 6-4 Figure 6-5 Figure 6-6 Figure 6-7 Figure 8-7 Ta b l e 2 3 -1 Re l e a se pend i ng PFN t r a n s i t i o n s ta t e , 1 2 - 6 , 1 2-8 Figure 1 1- 1 1 F i g u re 1 2-3 Figure 1 2-4 Figure 1 2-5 RE LOAD S YSGEN c omma nd , 1 5 - 9 Remo t e t e rm i n a l AC P Tab l e 1 - 1 REMQUE i n s t r uc t i o n , 4 - 3 REPLY Tab l e 1 - 1 REQUEST Ta b l e 1-1 RESALLOC s pe c i a l SYS B O OT p a r am e t e r f l ag , B - 1 7 Re s c h ed u l i ng i n t e r r upt , 1 - 1 5 , 4 - 4 , 4 - 7 , 8 - 2 0 , 8 - 2 7 , 9- 6 , 9 - 1 1 , 1 4 -4 , 2 4 -1 0 Figure 1-5 Ta b l e 4 - 1 Re s c h ed u l i ng i n te r r upt hand l e r Figure 8-7 I ndex- 2 4 INDEX Re se r ved add r e s s i ng mod e e x c ept i o n Ta b l e 2 - 1 Ta b l e 2 - 2 Re se rved i ns t r uc t i o n ex c e pt i o n , 2 - 1 4 , 7 - 4 to 7 - 5 Ta b l e 2 - 1 Ta b l e 2 - 2 Re s e rved ope r a nd e x c e pt i o n , 2 - 8 Ta b l e 2 - 1 Ta b l e 2 - 2 Re s i d en t computa b l e proc e ss , 8 - 9 Re s i g n a l l i ng a n e x c e pt i o n , 2 - 2 , 2-2 3 e x ampl e o f Figure 2-6 Re so u r c e a l l o c a t i o n , 1 - 2 0 Re so u r c e c on t r o l , 1 - 1 9 Re so u r c e wa i t mod e , 1 9 - 2 Ta b l e 1 7 - 3 Re so u r c e wa i t s ta t e ( MWA I T } , 8 - 1 3 , 1 2-3 1 , 1 9-6 , 2 4-1 1 R E S TAR . CMD , 2 3 - 4 Re s t a r t pa r am e t e r b l o c k ( R PB ) , 7 - 9 , 2 1 -7 , 2 1 -9 , 2 1 - 1 4 to 2 1 - 1 5 , 2 2 - 8 to 2 2 - 1 0 , 2 3 -1 , 2 3 -3 to 2 3 -4 , 2 3 - 9 , B- 2 2 , D- 1 8 , E - 9 Figure 1-6 Figure 21-1 Figure E-1 Ta b l e 2 1 - 3 Ta b l e 2 2 - 1 Ta b l e 2 3 - 1 Ta b l e E - 2 Re s t a r t r o u t i n e , 2 2 - 8 t o 2 2 - 9 Ta b l e 2 1 - 3 s e e a l s o powe r r ecove r y Re s t a r t a b i l i ty , 2 - 8 R e s ume P r o c e s s s y s t em s e rv i c e ( $ R E S UM E } , 5 - 1 1 , 8 - 1 1 , 9 - 9 to 9 - 1 0 , 1 9- 2 Tabl e 8 - 3 Ta b l e 9 - 1 Ta b l e 9 - 2 R E T i n s t r uc t i o n , 1 - 1 4 , 2 - 2 4 , 3 - 1 , 3- 1 0 , 3 - 1 3 , 3 - 1 7 , 5 - 8 F i g u r e 3-1 F i g ure 3-2 F i g u r e 3-3 Figure 3-5 F i g u r e 3-6 Figure 3-8 Figure 3-9 RMS , 1 - 6 , 1- 1 2 , 3 - 1 , 8 - 1 0 , 9 - 4 , 9-1 3 Figure 1-2 Figure 1-4 Ta b l e 1 - 1 R M S d i spa tch e r , 3 - 1 0 Figure 3-6 RMS e r r o r d e tec t i o n , 3 - 1 3 RMS imag e , 1 1 - 2 1 , 2 2 - 1 , 2 2 - 1 3 , 2 2 - 1 6 to 2 2- 1 7 , A�1 s F i g ur e 1 - 6 Figure E-1 Tabl e 1 2 - 1 Ta b l e 2 1 - 1 Tabl e E - 2 Ta b l e E - 3 R M S r und own , 1 9- 2 , 2 0 - 6 , 2 0 - 9 , 2 0 -1 4 RMS s e rv i c e v e c to r Figure 3-6 RM S se r v i c e s Ta b l e 3 - 1 R M S s ynch ron i za t i o n F i g u r e 3 -1 Ta b l e 3 - 1 RM S DFMBC SYSBOOT pa r am e t e r , a= 1 s RM S DFMBFHSH S Y S B OOT pa r am e t e r , a=1 s RM S DFMBFIDX S Y S B OOT pa r ame t e r , a=1 s RM S D FMBFRE L S Y S BOOT p a r am e te r , a=1 s RMS DFMBFSDK SYS BO OT pa r am e t e r , a=1 s RM S DFMBFSMT S Y S B OOT pa r am e te r , a= 1 s RMS DFMBFSUR S YS BOOT p a r am e t e r , a= 1 s RMS S HARE u t i l i ty , 2 2 - 1 8 , 2 5 - 1 3 , E-1 0 Ta b l e 2 1 - 1 Ro und rob i n sched u l i ng , 8 - 4 to 8 - 5 RSE modul e i n s ys t em i mag e , 8 -5 , 8-1 7 Ta b l e 1 4 - 3 RSX- 1 1M AME , 1 8 - 2 , 1 8 - 1 5 , A- 9 Figure 1-8 s e e a l so c om pa t i b i l i ty mod e RSX . EXE Figure 1-8 RT-1 1 boo ts t r a p , 2 1 -6 Run- T i m e L i b r a r y , 1 - 2 4 Figure 1-2 Figure 1-8 Rund own s ys t em s e rv i c e ( $ R UNDWN ) , 1 8- 2 0 s e e imag e r und own s e e p r o c e s s r und o wn RX O l f l oppy d i s k , 2 1 - 6 I nd e x- 2 5 INDEX s S B I E RRENA B L E SYSBOOT pa r am e t e r fl ag , B-1 7 S c a t t e r/ga t he r , 1 1 - 3 4 S C BVE C TOR m o d u l e in s ys tem imag e , 2 1-1 7 S C HED m od u l e in system imag e , 8 -2 0 , 8 - 2 2 S c h e d u l e Wa k e up s ys tem s e rv i c e ( $ S C HDW K ) , 1 0 - 1 0 to 1 0 -1 1 F i g u r e 1 0 -1 Ta b l e 9 - 1 S c h e d ul ed wa ke up , 1 0 -1 , 1 0 - 7 , 1 0-9 S c h ed u l e r , 1 - 1 0 , 4 - 8 , 5 - 1 1 , 8-1 , 1 2-2 4 , 1 2-3 0 , 1 4-2 7 , 1 7-7 , 2 2-1 0 , 2 4-5 Figure 1-2 Figure 1 4-1 S c h e d u l i ng , x x v i i i , 1 - 6 , 8 - 1 , 1 3- 5 , 2 4- 3 i n swa p s c h ed ul i ng , 1 4 - 4 , 1 4 - 2 2 o u t swa p sched ul i ng , 1 4 -4 , 1 4-1 3 swa p sc h ed ul i ng , 1 4 -2 S c h e d u l i ng s t a t e t r an s i t i o n s Figure 8-5 S DAT mod u l e in s ys t em i m ag e , 8 - 9 , 8 - 2 2 , B- 5 S e a r ch f o r c ond i t i o n h and l e r Fig u r e 2-4 F i g u r e 2-5 F i g u r e 2-6 S e c o nd a r y b o o t s t r a p p r og r a m ( S YS B OOT ) , x xx i , 7 - 6 , 2 1 - 1 1 , 2 1 - 1 5 , A- l l F i g u r e 2 1- 1 F i g u r e 2 2- 2 F i g u r e 2 2- 4 Tabl e 2 1 -1 Ta b l e 2 1 - 4 Tabl e 2 2 -3 T ab l e 2 2-4 S e c o nd a r y e x cept i o n v e c t o r , 2-1 8 , 1 8- 2 3 S e c t i on t ab l e e n t r y s e e g l o b a l s e c t i o n t ab l e e n t r y s e e p r o c e s s s ec t i o n t a b l e e n t r y S e l f - r e l a t i ve q ue ue , 1 1 - 3 7 S e nd Me s s ag e t o Ac c o un t i ng Ma n ag e r s ys te m s e rv i c e ( $ SNDACC ) , 2 7- 1 S e nd Me s s ag e t o E r r o r Logg e r s ys te m s e rv i c e ( $ S NDERR ) , 7 - 2 , 2 7- 3 S end Me s s a g e to Ope r a to r s y s t e m s e rv i c e ( $ S NDO PR ) , 2 7- 3 S e nd Me s s ag e t o Sym b i o n t Ma n ag e r s ys t e m s e rv i c e ( $ SNDSMB ) , 2 7- 2 Figure 2 0-2 Sense cha rac te r i s t i c s $ Q I O f un c t i o n c od e ( 1 0 $ S EN S E C HAR ) , 1 6- 1 9 S e n s e mod e $ Q I 0 f un c t i o n c o d e ( I O $_S EN S EMODE ) , 1 6- 1 9 S e qu e n c e n umbe r v e c to r , 2 2 - 8 , 2 5- 1 3 Ta b l e 2 2 - 1 S ET ACC O UNT ING c omma n d , 2 7 - 1 Set AST Enable s y s t e m s e rv i c e ( $ S E TAST ) , 5-6 , 9-1 1 Ta b l e 9 - 1 S ET c omma nd , 1 - 7 T ab l e 1 - 1 S e t Ev e n t F l ag s ys t em s e rv i c e ( $ S ET E F ) , 9 - 6 S e t E x c ept i o n Ve c to r s ys te m s e rv i c e ( $ S ETEXV ) , 2-1 7 S ET M E S SAGE c omma nd , 2 7 - 5 Ta b l e E - 4 S ET N OC ONTROL Y c omma nd , 2 0 -1 4 S e t Powe r Re c ove r y AST s ys te m s e rv i c e , 1 4 - 9 sys t em s e rv i c e ( $ S E TPRA ) , 2 3 -8 Ta b l e 9 - 1 Ta b l e 9 - 2 S e t P r i o r i ty s ys t e m s e rv i c e ( $ S E TPR I ) , 8 - 3 t o 8 - 4 , 9 - 1 0 to 9 - 1 1 Ta b l e 8 - 3 Ta b l e 9 - 1 S e t P r i v i l eg e s s ys te m s e rv i c e ( $ S ETPRV ) , 1 8- 2 4 Ta b l e 1 8 - 1 S e t P r o c e ss Name s ys t e m s e rv i c e ( $ S E TPRN ) , 9-11 Ta b l e 9 - 1 S ET PROC E S S/PR I OR I TY c omma nd , 8 -3 t o 8 -4 S ET PROC E S S / PR I VI L EG E S c omma nd , 1 8- 2 6 I nd ex - 2 6 INDEX S e t P r o t e c t i o n o n Pag e s s y s tem s e rv i c e ( $ S ETPRT ) , 1 3-1 6 S e t Re s o u r c e Wa i t Mo d e s y s tem s e rv i c e ( $ S ETRWM ) , 8 - 1 3 , 9-1 1 Ta b l e 9 - 1 Ta b l e 9 - 2 S e t Swa p Mo d e s ys tem s e rv i c e ( $ S ETSWM ) , 9 - 1 1 , 1 3 - 1 5 to 1 3 - 1 6 Ta b l e 9 - 1 Ta b l e 9 - 2 S E T SYSGEN c omma nd , 2 2 - 1 9 , 2 2- 2 3 , 2 2-2 5 F i g u r e 2 2-4 F i g ur e 2 2- 5 Ta b l e 2 2 - 3 S e t S y s t em Se r v i c e Fa i l u r e Mo d e s ys t em s e rv i c e ( $ S ETSFM) , 3 - 1 7 , 9- 1 1 Ta b l e 9 - 1 Ta b l e 9 - 2 S e t Sys t em T i m e s ys tem s e rv i c e ( $ S E T IM E ) , 1 0 - 3 to 1 0 - 5 , 2 2 -1 5 Ta b l e 1 0 - 1 Set T i m e r s ys tem se rv i c e ( $ S E T IM R ) , 5 - l , 5-4 , 5 - 8 , 1 0 - 7 to 1 0 - 8 , 1 0 - 1 0 to 1 0 - 1 2 S ET U I C c omma nd Ta b l e 1 8 - 1 S ET WORK ING S E T c omma nd , 1 3 - 1 2 Ta b l e 13- 1 S ET WORK I NG S ET/QUOTA c omma nd , 1 1-8 S ET I PL m a c r o , 2 4 - 1 F i g ure 2 4-1 S E TPRV p r i v i l eg e , 1 7 - 5 , 1 8 - 2 6 S ETTIME SYSBO OT pa r am e t e r f l ag , 2 2 - 1 5 , B-1 7 S h a r ea b l e i m ag e , 1 8 - 1 2 Ta b l e 2 1 - 1 S h a r ed f i l e s , 9 - 1 S h a r ed m emo r y 1 a yo u t , 1 1 - 3 7 phys i c a l l ayo u t Figure 1 1-2 5 Sh a r ed m emo r y c ommo n d a ta pag e , 1 1- 3 8 F i g ure 1 1- 2 5 Ta b l e 1 1 - 3 Sh a r ed m emo r y c ommo n ev e n t b l oc k Figure 9-4 Sh a r ed memo r y c o n t r o l b l o c k , 1 1- 3 8 Figure 1 1- 2 6 S h a r ed memo r y m a i l box c o n t r o l b l oc k , 9 - 1 5 , 1 1 -4 2 , 1 6-1 3 F i g ur e 1 6-2 Figure 1 6-3 S HE L L modul e i n s ys tem i mag e , 1 -2 2 , 2-3 1 , 1 4 -2 , 2 1- 1 7 , 2 5 - 1 1 , B- 2 4 , B- 2 6 , E - 1 7 F i g ure 2 6-1 Ta b l e 1 7 - 1 Ta b l e E - 4 She l l p r o c e s s , 1 1 - 3 2 , 1 4 - 1 2 , 1 7 - 1 , 1 7 -1 2 , 2 2 - 5 , A- 1 2 F i g ur e 1 1- 2 2 F i g u r e 1 7- 5 Ta b l e 1 3 - 1 Ta b l e 1 7 - 5 Ta b l e E-4 S HMEM p r i v i l eg e , 1 6 - 1 1 Sho r t l i t e r a l s , 1 - 1 1 S HOW c omma nd , 1 - 7 Ta b l e 1 - 1 S HOW SYSGEN c ommand , 2 2 - 1 9 Ta b l e 2 2 - 3 SHOW SYSTEM c ommand , 8 - 3 , 1 0 - 4 , E - 1 7 , F-4 S HRCNT PFN a r r a y , 1 1 - 1 9 , 1 2-1 4 t o 1 2-1 5 , 1 3- 1 5 , 1 4-1 4 t o 1 4-1 5 Figure 1 1-9 Tab l e 1 1 - 2 S HUTDOWN . COM , 7 - 7 S i g n a l a r ra y , 2-8 , 2-1 8 , 2 - 2 3 Figure 2-2 Figure 2-3 Figure 2-4 Figure 2-5 Figure 2-6 Figure 2-7 Figure 2-8 Tab l e 2 - 2 S K I PW S L s pe c i a l S Y S B O OT p a r am e t e r , 1 2 - 1 8 to 1 2- 1 9 , 1 4 - 1 0 , 1 4 - 2 6 , B-1 6 Sm i th so n i a n I n s t i t u t i o n a s t r onom i c a l c a l end a r , 1 0- 3 S OFT INT m a c r o , 4 - 2 S o f twa r e c o n t e x t , 1 - 1 , 1 - 3 Fi gure 1-1 So f t wa r e d e t e c t ed e x c e p t i o n , 2-1 4 So f t wa r e i n t e r r up t r eq ue s t r eg i s t e r ( PR $ S I RR ) Figure 4-1 F i g u r e 4 -1 , 4 - 1 I nd ex - 2 7 INDEX So f twa r e i n te r r up t s umma r y r eg i s t e r ( PR $ S I S R ) Figure 4-1 F i g u r e 4 -1 , 4 - 1 Ta b l e 2 1 - 3 Ta b l e 2 3 - 1 So f twa r e i n t e r r up t s , 1 - 1 1 , 1 -1 5 , 1 -1 8 , 4-1 , 5-6 , 5 -1 3 , 8 -1 8 , 2 4-6 Figure 1-5 F i g u r e 2-1 Ta b l e 4 -1 So f twa r e PC B s e e p r o c e s s c on t r o l b l o c k So f twa r e p r i o r i ty s ee p r o c e s s p r i o r i ty So f twa r e t i me r , 4 - 5 , 1 0 - 6 Figure 1-5 i n t e r r up t s e r v i c e r o u t i n e , 4-4 , 4-6 , 1 0-1 , 1 0-6 , 1 3-1 4 Ta b l e 4 -1 So f twa r e- d e t e c t ed e x c e p t i o n s , 2 -1 2 S p e c i a l k e r ne l AST , 5 - 3 , 5 - 5 to 5 - 6 , 5 - 9 to 5 - 1 2 , 9 - 9 to 9 - 1 0 , 1 2 -2 5 , 1 2 - 2 8 to 1 2 -2 9 , 1 6 - 9 to 1 6- 1 0 , 1 9- 1 t o 1 9- 2 , 2 3 - 8 , 2 4 - 5 , 2 4 -7 , 2 7 - 8 to 2 7 - 9 Ta b l e 1 2- 1 S PT R E Q SYS BOOT p a r am e te r , B - 1 5 , E-9 , E-1 4 Ta b l e E - 2 S PTSKE L modul e i n s ys t em i m ag e , E - 9 S RVE X I T , 3 - 1 0 , 3 - 1 3 , 3 - 1 7 F i g u r e 3 -2 F i g u r e 3-4 Figure 3-5 Figure 3-6 Figure 3-7 Figure 3-8 s e e a l s o KSRVE X I T S S $ C ONT INUE s ee c o n t i n u i ng f r om a n ex c e p t i o n S S $ RES IGNAL s ee r e s i g na l l i ng an e x c e p t i o n Sta ck ove r f l ow, 2-9 S TARDEF . MDL , A- 3 t o A - 4 , A- 1 8 , D-1 Ta b l e D- 1 S TARLET . M LB , A- 2 , A- 4 , D - 1 S t a r t up c ommand f i l e , 2 2- 1 , 2 2 - 9 , 2 2 - 1 3 , 2 2- 1 7 to 2 2 - 1 8 Ta b l e 2 1 - 1 S TARTU P . C OM , 2 5 - 1 3 S TATE PFN a r r ay , 1 1 - 7 , 1 1 - 1 6 , 1 1 - 1 8 , 1 1 - 2 3 , 1 2 - 4 , 1 2- 6 , 1 2-1 9 F i g u r e 1 1-9 F i g u r e 1 1-1 1 F i g u r e 1 1-1 3 Ta b l e 1 1 - 2 S t a t e q ue ue s , 8 - 9 S T O P c omma nd , 2 0 - 1 6 F i g u r e 2 0-3 S t r i ng f o rm a t t i ng s e rv i c e s , 1-6 , 3-1 S t r uc t u r e t ype c o d e s Ta b l e D-4 S UBM I T c omma nd , 2 0 - 1 , 2 0 - 4 F i g u r e 2 0-2 S u b s c r i pt r ang e a r i th me t i c t ra p Ta b l e 2 - 3 S upe rv i so r a c c e s s m od e , 2 0 - 5 , 20-7 Figure 1-4 S up e rv i so r m o d e e x c e p t i o n , 2 - 3 1 S up e rv i so r s ta c k F i g u r e 1-7 Ta b l e E - 4 S u spend P r o c e s s s y s tem s e rv i c e ( $ S US PN D ) , 5-1 0 , 8 -1 1 , 8 -1 5 , 9 - 9 to 9 - 1 0 Tab l e 9 - 1 Ta b l e 9 - 2 S u s pend s pe c i a l k e r n e l AST Ta b l e 9 - 2 S u s pend wa i t s ta t e s ( S US P a nd S U S PO ) , 5- 1 1 , 8 - 1 5 to 8 - 1 6 , 9 - 9 to 9 - 1 0 , 2 7 - 9 Figure 8-5 Ta b l e 8 - 1 Ta b l e 1 4 - 2 SVPC TX i n s t r uc t i o n , 1 - 1 1 , 1- 1 9 , 5- 1 1 , 8 - 2 2 , 8 - 2 6 to 8 - 2 8 , 1 9- 5 Figure 8-7 Swa p f i l e , 1 1 - 7 , 1 1 - 3 0 , 1 1 - 3 5 , 1 2-2 6 , 2 2 -1 3 , 2 2- 1 6 Ta b l e 2 1 - 1 Ta b l e 2 2 - 3 i n i t i a l i za t i o n , F - 3 Swa p f i l e b i tm a p F i g u r e 1 1-2 3 Swa p f i l e t ab l e Fi g u r e 1 7-5 Swa p f i l e t ab l e e n t r y , 1 1 - 3 0 , 1 1 - 3 2 , 1 4 - 1 1 , 1 7 - 1 3 , 2 2- 5 , F- 3 F i g u r e 1 1- 2 2 Figure 1 1-2 3 Figure 1 7-5 I nd ex- 2 8 INDEX Swa p s l o t , 1 4 - 1 2 , 1 7 - 7 , 1 9 - 5 F i g u r e 1 7-5 SWAPF I LE mod u l e i n s y s t e m i m ag e , 1 1-3 0 , 1 1-32 SWAPF I LE . SYS , 1 1 - 3 2 , 1 4 - 1 2 F i g u r e 1 1- 2 2 F i g u r e 1 7- 5 Swa ppe r I /O , 1 - 1 0 , 1 1 - 3 4 , 1 2- 1 9 , 1 4-1 1 Figure 1-3 Swa ppe r m a p , 1 1 - 3 2 , 1 1 - 3 4 , 1 4 - 1 0 , 1 4 - 1 2 t o 1 4 -1 3 , 1 4 - 1 5 , 1 4-2 4 , 2 2- 9 , 2 5-1 3 F i g u r e 1 1- 2 4 F i g u r e 1 4-2 F i g u r e 1 4-3 F i g u r e 1 4 -4 Figure 1 4-5 F i g u r e 1 4 -6 F i g u r e 1 4 -7 Ta b l e 1 2 - 1 Tab l e 2 2 - 1 Swa ppe r p r oc e s s , 1 - 4 , 1 - 1 0 , 1 - 1 5 t o 1 - 1 6 , 8 - 8 to 8 - 9 , 8 - 1 5 , 1 1 - 1 , 1 1 -7 , 1 1 - 1 1 , 1 1-1 7 , 1 1 - 3 2 , 1 4 -1 t o 1 4-2 , 1 7 - 1 , 1 7 - 1 3 , 2 2- 8 , 2 2- 1 3 , A- 1 2 , B - 7 Figure 1-2 Figure 1-3 F i g u r e 1 4 -1 Tab l e 9 - 2 Ta b l e 1 2 -1 T a b l e 1 4 -1 Ta b l e 1 4 -3 Ta b l e 1 7 - 1 Ta b l e 2 1 - 1 wa k e up c a l l , 8 - 8 , 8 - 1 8 Swa ppe r ' s P O b a s e r eg i s t e r , 2 2- 9 Swa pp i ng , 1 4 -1 SWP PR I O s p e c i a l SYSBOOT p a r am e t e r , B- 1 6 Tab l e l 2 - l Ta b l e 1 4 - 1 SWPFA I L s pe c i a l SYS B OO T p a r am e t e r , 1 4 - 8 , B- 1 6 SWPF I LCNT s p e c i a l SYS B OOT p a r am e te r , B-1 5 SWPRATE s p e c i a l SYSB OOT p a r am e t e r , 1 4 - 4 , B- 1 6 SWPVBN PFN a r r ay , 1 1 - 2 0 , 1 1 - 3 5 , 1 2-2 6 , 1 4 -1 4 , 1 4 - 2 4 F i g u r e 1 1 -9 T a b l e 1 1 -2 SYE see e r r o r l og r epo r t g en e r a to r Symb i on t m a n ag e r ( j o b control l e r ) , 27-2 Symbo l n am i ng c onven t i o n s , x x i x , C-1 Symbo l i c d ebug g e r , 2 2 - 1 8 s e e d e b ug g e r Sync h r o n i z a t i o n , x x ix , 1 - 6 , 1- 1 1 , 1-1 8 , 1 - 2 0 , 9- 1 3 t o 9 - 1 4 , 1 1 - 3 7 , 2 4 - 1 , 2 5-7 Ta b l e 2 4 - 1 SYS $ CALL HAND L , 2 - 2 6 , 2 - 2 8 F i g ure 2 - 6 F i g u r e 2-7 F i g u r e 2-8 SYS $ C OMMAND , 2 0 - 6 , 2 0 - 8 Figure 20-1 Figure 20-2 SYS $ D I SK , 1 7 - 6 , 1 7 - 1 8 Tab l e 1 7- 2 SYS $ ERROR , 9 - 1 4 , 1 7 - 6 , 1 7 - 1 8 to 1 7 - 1 9 , 2 0 - 6 , 2 0 - 8 , 2 7 -6 to 2 7 -7 Figure 20-1 Figure 20-2 Ta b l e 1 7 - 2 SYS $ IN PUT , 9 - 1 4 , 1 7 - 6 , 1 7 - 1 8 , 2 0 -6 , 2 0 -8 Figure 20-1 Figure 20-2 Ta b l e 1 7 - 2 S YS $ 0UTPU T , 9- 1 4 , 1 7 - 6 , 1 7- 1 8 to 1 7 - 1 9 , 2 0 - 6 , 2 0 - 8 , 2 7 -6 to 2 7 -7 Figure 20-1 Figure 20-2 Ta b l e 1 7 - 2 SYS . EXE s e e sys tem i mag e f i l e SYS . STB s e e s ys t em s ym b o l t ab l e SYS B OOT s e e s e c o nd a r y b oo t s t r a p p r og r am SYS B OO T a nd pa r a m e t e r f i l e s , 2 2- 1 9 SYSB OOT p a r ame te r s , x x i x , x x x i , 1 0-5 , 1 1-1 , 2 1-1 5 , 2 1 - 1 7 , B- 1 4 , E- 1 Ta b l e 1 7 -1 T a b l e 2 2- 4 Ta b l e E-2 see a l s o i nd i v i d ua l pa r a m e t e r n am e s SYS C OMMON mod u l e in s ys t e m i m ag e , 1 0 -7 , 1 0 - 9 , B-8 F i g ur e 2 6-1 I nd ex - 2 9 INDEX SYSDE F . MDL , A-3 to A-4� A- 1 8 , D-1 Ta b l e D-1 SYSGEN a nd pa r am e t e r f i l e s , 22-23 SYSGEN u t i l i ty , 1 - 7 , 6 - 7 , 6 - 1 0 , 6-1 3 , 1 1- 3 2 , 1 1 -3 7 , 2 2 - 1 8 to 2 2- 1 9 , A- 1 6 , F- 3 F i g ur e 1 1-2 2 F i g u r e 2 2- 5 Ta b l e 1 - 1 Ta b l e 2 1 -1 Ta b l e 2 2 -3 Ta b l e 2 2-4 SYS I N IT p r o c e s s , 7 - 7 , 1 0 - 3 , 1 1 - 3 0 , 1 1 - 1 2 , 1 4 -1 2 , 1 8 -2 , 2 1 - 1 8 , 2 2- 1 , 2 2 -1 3 , 2 2- 2 3 , 2 7 - 4 , A- 1 1 , F- 3 Figure 1 1-22 F i g u r e 2 2- 4 Tab l e 2 1 -1 SYS LOAVEC mod u l e i n sys t em i m ag e , 2 2- 1 1 F i g u r e 2 2- 3 Ta b l e 2 2- 1 SYS LOAx xx . EXE , 2 1 - 1 6 , 2 2 - 1 1 Tab l e 2 2 -1 SYSMAR . MAR , A- 3 SYSMWCNT SYS BOOT p a r am e t e r , B-1 5 , E-1 1 , E-1 6 Ta b l e 1 3 -1 Ta b l e E - 2 Ta b l e E - 3 SYSNAM p r i v i l eg e , 2 6 - 4 SYS PAG I NG S YSBOOT p a r am e t e r f l ag , 2 1 - 1 8 , 2 2-5 , B-1 7 SYS PARAM m o d u l e i n s ys t em i m ag e , B - 1 4 , B- 2 0 SYS PFC s pe c i a l SYSBOOT p a r am e t e r , B- 1 4 Ta b l e 1 2 -1 Sys tem , XXX Sys t em b a se r eg i s t e r ( PR $_S B R ) , 21-1 8 Figure 21-2 F i g u r e 2 2- 1 Tab l e 2 1 -3 Ta b l e 2 1 -4 Ta b l e 2 3 -1 Sys tem c o n t e x t , 1 - 1 3 , 1 5 - 1 9 Sys t em c o n t r o l b l o c k , 1 - 1 4 , 1-1 7 , 2-4 , 2-8 , 3-4 , 4-1 , 6 - 1 , 6 - 3 to 6 - 4 , 6 - 9 , 2 1 - 9 , 2 1 - 1 5 , 2 2 - 5 , 2 3 -1 , B-2 3 , E - 1 0 F i g u r e 1-6 F i g u r e 2-1 F i g u r e 6 -1 F i g u r e 6 -2 System control block , ( cont . ) Figure 6-3 Figure 6-4 Figure 6-5 Figure 6-6 Figure 21-1 Figure 2 1-2 Figure E-1 Ta b l e 2 2 - 2 Ta b l e E - 2 Ta b l e E - 3 s i ze , 2 1 - 1 7 S y s t em c o n t r o l b l o c k b a s e r eg i s t e r ( PR $_S C B B ) , 6-4 , 2 2-5 Figure 2-1 Figure 6-2 F i g u r e 2 1- 1 Figure 21-2 Ta b l e 2 1 - 3 Ta b l e 2 3 - 1 Sys t em c o n t r o l b lo c k v e c to r , 7-1 1 Figure 6-1 S y s t em c r a sh e s s e e b ug ch e c k s e e f a t a l b ug ch e c k Sy s t em d i s k d r i v e r , 2 1 - 1 7 Ta b l e 2 1 - 4 Ta b l e 2 2- 1 Sy s t em d ump a na l y z e r ( S DA ) , x x i x , 7 - 6 , 7 - 9 , 8 - 3 , 2 5- 3 , A- 1 6 Ta b l e 1 - 1 Ta b l e 2 2- 1 Sy s t em d ump f i l e , 7 - 9 Sys t em even t , 8 - 1 5 , 9 - 6 Sy s t em even t r epo r t i ng , 8 - 1 7 Ta b l e 8 - 3 Sy s t em h e ad e r , 1 1 - 2 0 , 1 3 - 7 , 1 3 -9 , 2 1 - 1 7 , 2 2 - 1 7 , 2 5 - 1 1 , B- 2 3 , E - l l Figure 1-6 Figure 1 1-1 5 Figure 11-18 Figure 21-2 F i g u r e E-1 Tab l e 2 2- 1 Ta b l e E - 2 Ta b l e E - 3 S y s t em i d en t i f i c a t i o n r eg i s t e r ( PR $ S I D ) , 2 1 - 9 , 2 1 - 1 6 , 2 2- 1 1 Sy s t em i m ag e f i l e ( SYS . EXE ) , xx i x , 1-1 6 , 7-6 , 1 0-5 , 1 1 - 2 1 , 2 1 - 1 5 , 2 1 - 1 7 to 2 1 - 1 8 , 2 2- 1 0 Figure 1-6 F i g u r e 1 7- 5 F i g u r e 2 2- 4 I nd ex- 3 0 INDEX ( SY S . E XE ) { cont . ) , Sy s t em s e rv i c e d i spa tc h i ng , 3 - 1 S y s t em s e rv i c e f a i l u r e e x c e p t i o n , F i g u r e 2 2- 5 2-1 3 , 3-1 2 , 9 -1 0 , 1 8- 2 3 Figure E-1 Ta b l e 2 - 2 Ta b l e 1 2 - 1 Ta b l e 1 7 - 3 Tab l e 1 7 - 1 Sys t em s e rv i c e v e c to r , 3 - 1 , Ta b l e 2 1 - 1 Ta b l e 2 1 - 4 8-1 6 , 2 1 -1 8 , B-1 Tab l e E - 2 F i g u r e 1-6 Sys t em i n i t i a l i za t i o n , x x v 1 1 1 , Figure 3 -1 7 - 1 , 1 0 - 3 to 1 0 -4 , 2 4 - 4 , 2 5 - 7 F i g ur e 3 -2 F i g u r e 2 5 -1 Figure 3-3 Tab l e 2 - 1 F i g ur e E - 1 Ta b l e 1 0 - 1 Ta b l e 3 - 1 Sys t em l eng th r eg i s t e r ( PR $_S LR ) , Ta b l e E - 2 Ta b l e E - 3 1 1-2 5 , 21-1 8 Ta b l e 2 1 - 3 S y s t em s e rv i c e s , 1 - 1 0 , 1 - 1 2 , Ta b l e 2 1 - 4 1 - 1 4 , 3 -1 Tab l e 2 3 - 1 Figure 1-2 Sys t em l og i c a l n am e t a b l e , Figure 1-4 Ta b l e 3 - 1 8 - 1 4 , 2 5 - 1 1 , 2 6 -1 s e e a l s o i nd i v i d ua l s e rv i c e n am e s F i g u r e 2 6 -1 Sys t em sh utd own , 7 - 6 F i g u r e 2 6-2 Ta b l e 8 - 2 S ys t em s ymbo l t a b l e ( S Y S . STB ) , Sys t em l og i c a l name t ab l e m u t ex 1-6 , 1-9 , 1 8-1 1 Tab l e 2 4 - 2 Ta b l e 1 - 1 Sys t em m a p f i l e ( S YS . MAP ) , A- 1 4 sys tem t ime , 1 0 - 1 , 1 0 - 3 , 2 3 - 6 , Sys t em m e ssag e f i l e , 1 1 - 2 1 , 2 4 - 4 , 2 7- 1 1 2 2 - 1 , 2 2 - 1 3 , 2 2 - 1 6 to 2 2 - 1 7 , Ta b l e 7 - 1 2 7 - 4 to 2 7 - 5 Ta b l e 1 0 - 1 Figure 1-6 u pd a t i ng , 1 0 - 5 t o 1 0 - 6 S ys t em v e r s i o n n um b e r Figure E-1 Ta b l e 1 2 - 1 1 Ta b l e 7 - 1 Sys t em v i r t ua l add r e s s s pa c e , Ta b l e 2 1 - 1 xx i x , 1-1 4 , 2 1-1 5 , 2 1- 1 7 Ta b l e E - 2 l ayo u t , 1 - 2 1 , A- 1 7 Ta b l e E - 3 Figure 1-6 Sys t em o v e rv i ew , x x v 1 1 1 Figure E-1 Sys t em pag e t a b l e , 7 - 9 , Ta b l e E - 2 1 1 - 2 4 to 1 1 - 2 5 , 2 1 - 1 5 , 2 2- 1 , s i ze , 2 2- 2 5 , E - 5 2 2 - 3 , 2 5- 1 1 , B- 2 3 , S y s t em wo r k i ng s e t , 1 3 - 9 , E - l l E-l l t o E-1 2 Sys t em wo r k i ng s e t l i st , 1 1 - 2 1 Figure 1-6 F i gu r e 1 1-1 5 F i g u r e 1 1-1 7 Figure 1 1- 1 8 Figure 21-2 S YS U I C SYSBOOT p a r am e t e r , B - 1 6 F i g u r e 2 2-1 S YSWA I T Figure E-1 m o d u l e i n s ys t em i m ag e , 8 - 2 7 Ta b l e 1 2 - 1 1 Tab l e 1 4 - 3 Ta b l e E - 2 Ta b l e E - 3 s i ze , 2 1 -1 7 Sys t em pag e t a b l e e n t r y T u s e d b y d i s k d r i v e r , 1 5- 2 , T e rm i n a l d r i v e r , 5-1 5 , 1 5-7 , 1 5- 1 9 2 1 -1 7 , 2 2-9 Sy s t em PC B , 1 1 - 2 0 F i gu r e 1 5-1 Sys t em p r o c e s s , 2 2 - 1 , 2 2- 1 3 F i g u r e 1 5- 2 Tab l e 1 - 1 F i g ur e 2 0-1 Sys t em s e c t i o n t ab l e e n t r y , Ta b l e 2 1 - 4 2 2- 5 , 2 2 -1 7 Ta b l e 2 2- 1 F i g u r e 1 1-1 6 u n so l i c i te d i np u t , 2 0 - 1 Ta b l e 1 2 - 1 System ima g e f i l e I nd e x - 3 1 INDEX Te rm i n a l I /0 F i g u r e 1 5-1 Te rm i n a t i o n h a nd l e r , 1 8 - 18 , 1 8- 2 3 F i g u r e 1 8·- 8 e x e c u t i v e mode , 1 7 - 1 8 s up e r v i so r mode , 7 - 5 , 2 0 - 9 , 2 0 -1 3 F i g u r e 2 0-3 use r mode , 7 - 5 Te rm i n a t i o n h a nd l e r c on t r o l b l o c k Figure 1 8-8 Te rm i n a t i o n m a i l bo x , 1 9- 5 Te rm i n a t i o n ma i l bo x m e s s a g e , 1 9-3 Ta b l e 1 9 - 1 T i m e -o f-y e a r c l o c k , 1 0 - 1 , 1 0 - 3 , 23-6 T i me-o f-y e a r r eg i s t e r ( PR $ TODR ) , 1 0 - 3 to 1 0 -4 , 2 2 - 1 5 Ta bl e 1 0 -1 T i me r ex p i r a t i o n , 4 - 6 , 5 - 2 , 9 - 6 T i m e r que ue , 4 - 6 , 1 0 - 4 t o 1 0 -7 , 1 0- 1 1 t o 1 0 - 1 2 , 2 3 - 6 T i m e r que ue e l em e n t ( TQE ) , 4 - 6 , 5 - 4 , 1 0 - 6 to 1 0 - 8 , 1 0 -1 0 t o 1 0 -1 2 F i g u r e 1 0 -1 T i m e r r e q ue s t , 9- 1 , 1 0 - 7 to 1 0 - 8 Figure 1 0-1 T i m e r se r v i c e s , 1 - 6 T IM E SCHDL mod u l e in s ys t em i m a g e , 1 0-5 to 1 0 -6 Tab l e 1 4 - 3 TM PMBX p r i v i l eg e , 1 6 - 1 1 TR n umbe r Ta b l e 6 - 1 T r a c e pend i ng e x c e p t i o n Tab l e 2 - 1 Tab l e 2 - 2 T r a c e ba c k f a c i l i ty , 1 - 2 4 , 2 - 3 0 , 1 8- 1 , 1 8 - 1 6 , 1 8 - 1 8 Figure 1-8 Tr a c k o f f s e t r ecove r y , 1 5 - 3 T r a n s fe r a d d r e s s a r r a y , 1 8 - 1 6 Figure 1 8-7 T r a n s i t i o n pag e Figure 1 1-3 Figure 1 1-17 Figure 1 2-3 F i g u r e 1 2-4 Figure 1 2-5 F i g u r e 1 2-7 Ta b l e 1 4 - 4 T r a n s l a t e Lo g i c a l Name s ys t em s e rv i c e ( $ TRN LOG ) , 9- 1 4 , 2 6 - 5 T r a n s l a t i o n-no t-va l i d f a u l t , 1 - 1 5 t o 1 - 1 6 , 2-7 F i g u r e 1-5 F i g u r e 1 2-1 Ta b l e 2 - 1 s e e a l so pag e f a u l t T r a ps , 2 - 8 , 2 - 2 3 Tabl e 2-1 Ta b l e 2 - 3 T T l o g i c a l n am e , 1 7 - 1 8 TTY B U F SYS BOOT p a r am e t e r , B - 1 8 TTY-D E F C HAR SYSBOOT pa r am e t e r , s= l 8 TTY OWNE R SYSBOOT p a r am e t e r , s= l 8 TTY PROT SYS BOOT p a r am e t e r , B - 1 8 TTY-S PE E D SYS BOOT p a r am e t e r , s= l 8 TTY TYPA HDS Z SYSBOOT pa r am e t e r , s= l 8 TTYSCANDE LTA SYSB OOT p a r am e t e r , 1 0 -1 0 , B-1 7 TU58 c a r t ridge s e e c o n s o l e b l o c k s to r ag e d ev i c e TYPE PFN a r r ay , 1 1 - 1 7 , 1 2 - 3 0 , 1 4-1 3 F i g u r e 1 1-9 F i g u r e 1 1- 1 2 Ta b l e 1 1 - 2 Typ e - a h e a d b u f f e r , 1 5 - 1 1 u UAFALTERNATE SYSBOOT pa r am e t e r f l ag , 2 2 - 1 6 , B-1 7 UIC s e e us e r i d e n t i f i c a t i o n c od e Un expe c t e d sys tem s e rv i c e except ion ( bug c h e c k c o d e ) , 2 - 3 1 UN I B US a d a pt e r , 6 - 4 Ta b l e 6 - 1 T ab l e 2 2 - 2 UN I B U S a d a pt e r i n t e r r upt , 6 - 9 UN I B US d ev i c e i n t e r r up t , 6 - 1 5 UN I B US d ev i c e i n t e r r up t s e r v i c e r o u t i n e F i g u r e 6 -3 U N I B U S I /0 p ag e , 6 - 1 5 UN I B US i n t e r r up t d i spa tc h i ng , 6-1 6 UN I B US v e c to r s , 6 - 7 Un i t c on t r o l b l o c k { UC B ) , 5 - 1 3 , 6-9 , 6-1 1 F igur e 6-3 Figure 6 -4 F ig u r e 6-5 F ig u r e 6 -7 I nd ex - 3 2 INDEX U n i t i n i t i a l i za t i o n r o u t i n e , 2 3 -7 U n l o c k Pag e s f rom Mem o ry s ys t em s e rv i c e ( � U LK PAG ) , 1 3 -1 6 U n l o c k Pag e s f rom Wo r k i ng Se t sys t em s e rv i c e ( $ U LW S ET ) , 1 3-1 6 U n l o c k i ng a m u t e x , 2 4 - 1 0 U n l o c k i ng I /0 b u f f e r pag e , 1 6- 8 U n so l i c i ted i np u t , 5 - 1 5 U n so l i c i ted MAS SB U S i n t e r r up t , 6-1 1 U n so l i c i ted UN I B U S i n t e r r up t , 6-9 U nw i nd C a l l S t a c k s ys t em s e rv i c e ( $ UNW I ND ) , 2-2 4 , 2-26 F i g u r e 2-7 F i g u r e 2-8 Unwi nd i ng the c a l l s t ac k , 2 - 2 , 2-2 4 Upd a t e S e c t i o n s ys t em s e rv i c e ( $ U PDS EC ) , 5-4 , 1 1 -4 0 , 1 2- 2 0 , 1 2 - 2 8 to 1 2 - 2 9 , 1 3 - 8 , 1 3 - 1 0 Ta b l e 1 2 - 1 U S E SYSG EN c omma nd , 2 2 - 1 9 , 2 2- 2 3 F i g u r e 2 2- 4 F i g u r e 2 2- 5 Ta b l e 2 2 - 3 U s e r a c c e s s m od e , 2 0 -1 3 Figure 1-4 U s e r a ut ho r i za t i o n f i l e , 8 - 4 , 9-1 1 Tab l e 9 - 2 U s e r i d en t i f i c a t i o n c od e ( U I C ) , 1 -2 0 , 2 0-7 , 2 7 -2 F i g u r e 1 1-1 4 U s e r n am e , 1 7 - 1 6 , 2 0 -6 to 2 0 - 7 , 2 7-2 Tab l e 1 7 - 2 U s e r s t ac k , 1 - 2 4 , 1 8 - 8 , 1 8 - 1 1 , 18-21 Figure 1-7 F i g u r e 1 8-9 Ta b l e E - 4 U s e r -wr i t t e n d ev i c e d r i v e r , A- 1 4 U s e r -wr i t t e n s y s t e m s e rv i c e , 3 -1 3 , 1 7 - 1 6 , 1 8 - 2 1 , A- 1 4 Figure 1-7 Figure 3-8 Ta b l e E - 4 U t i l i ty p r og r am s Figure 1-2 v Va l i d b i t i n t h e pag e t ab l e e n t r y , 1 1 - 4 F i g ure 1 1- 3 va r i ab l e l eng th b i t f i e l d i ns t r uc t i o n s , 1 - 1 1 Va r i ab l e l eng th b i t f i e l d s , 1 - 1 1 Ta b l e A- 3 VAX a r c h i t e c t u r e , 1 - 1 0 , 2 - 1 , 3-1 3 , 4-1 , 4 - 4 , 5 - l , 6-1 , 8 - 2 6 , 1 1 - 3 7 , 2 4 - 4 , 2 4 -6 VAX- 1 1 c a l l i ng s t a nd a rd s e e p r o c ed u r e c a l l i ng s tand a rd VAX- 1 1 l i n k e r Ta b l e 1 8 - 1 VAX- 1 1 /7 5 0 , 6 - 4 , 6 - 7 , 6 - 1 0 , 6 -1 6 , 7-7 , E-1 0 F i g u r e 2-1 F i g ur e 6-2 F i g ur e 6-3 Ta b l e 7 - 1 VAX- 1 1 /7 5 0 bo o t b l oc k p r og r am , 2 1-1 , 2 1-5 Ta b l e 2 1 - 1 VAX- 1 1 /7 5 0 bo o t s t r ap , 2 1 - 1 Ta b l e 2 1 - 1 VAX- 1 1 /7 5 0 c o n so l e , 1 5 - 1 6 VAX- 1 1 /7 5 0 c o n so l e p r og r a m , 2 1-1 to 2 1-2 , 2 3-3 Ta b l e 2 1 - 1 VAX- 1 1 /7 5 0 d ev i c e ROM , 2 1 - 1 to 2 1 - 2 VAX- 1 1 /7 5 0 ma c h i ne chec k , 7 - 1 0 VAX- 1 1 /7 5 0 powe r r ec o v e r y , 2 3 - 3 VAX- 1 1 /7 5 0 po we r -o n a c t i o n swi t c h , 2 3- 3 VAX- 1 1 /7 5 0 sys t em c o n t r o l b l o c k Ta b l e E - 2 VAX- 1 1 /7 5 0 UN I BU S i n t e r r up t s e r v i c e r o u t i n e , 6 - 7 VAX- 1 1 /7 8 0 , 6 - 4 t o 6 - 5 , 6 - 9 to 6 - 1 0 , 6 - 1 6 , 7 - 7 , E- 1 0 Figure 2-1 F i gure 6-3 Ta b l e 2 - 3 Ta b l e 7 - 1 VAX- 1 1 /7 8 0 boo t s t r a p , 2 1 - 6 Ta b l e 2 1 - 1 VAX- 1 1 /7 8 0 c o n so l e , 1 5 - 1 6 VAX- 1 1 /7 8 0 ma c h i ne c h ec k , 7 - 1 1 VAX- 1 1 /7 8 0 memo r y ROM p r og r am Tab l e 1 5 - 1 VAX- 1 1 /7 8 0 powe r r e c ov e r y , 2 3 - 4 VAX- 1 1 /7 8 0 s y s t em c o n t r o l b lo c k Ta b l e E - 2 VAX- 1 1 /7 8 0 UN I B US a d a pte r i n t e r r upt s e r v i c e r o u t i n e , 6 - 9 , A-6 I nd ex- 3 3 INDEX Wa k e P r o c e s s s ys t em s e rv i c e ( $WAK E ) , 8-1 , 8 - 1 1 , 8-1 5 , 9-9 Tabl e 8 - 3 Tab l e 9 - 1 Ta b l e 9 - 2 Wa rm s ta r t s e e powe r r ec ove r y WCSx x x . PAT , 2 1 - 6 , 2 3 - 4 Wi nd ow b i t i n t h e pag e t ab l e e n t r y , 1 3- 8 Figure 11-3 W i nd ow c o nt r o l b l o c k , 1 1 - 1 1 , 1 1- 3 0 , 1 5- 4 F i g u r e 1 1-7 F i g u r e 1 1-1 6 F i g u r e 1 1,- 2 2 F i g u r e 1 1- 2 3 W i nd ow t u r n , 1 5 - 6 Wo rd i nd ex , x x x i Wo r k i ng s e t , 5 - 1 1 , 1 1 - 1 8 , 1 3 - 1 Wo r k i ng s e t l im i t , 1 3 - 1 2 Wo r k i ng s e t l i s t , 1 1 - 1 , 1 1 - 7 , 1 2-4 , 1 4 -1 0 , 1 4-1 5 , 1 4-2 4 , 1 7- 1 4 to 1 7 - 1 5 , E - 3 Fi g u r e 1 1-1 F i g ur e 1 1-4 F i g u r e 1 2-3 F i g u r e 1 2-4 F i g ur e 1 2-5 F i g u r e 1 4-2 F i g u r e 1 4-3 F i g u r e 1 4-4 F i g u r e 1 4-5 Fi g u r e 1 4 -6 F i g u r e 1 4-7 Ta b l e 1 3 - 1 Ta b l e 1 4 - 1 w Ta b l e 1 4 - 5 Wa i t fo r event f l ag Ta b l e 1 7 - 5 s y s t e m s e rv i c e s Ta b l e E - 1 ( $WA I TFR , WF LAND , a nd $WFLOR ) , a nd i t s u s e i n pag i ng , 1 2 - 1 7 8-1 8 d yn am i c po r t i o n , 1 2 -1 8 , Wa i t f o r Log i c a l AND o f E v e n t F l ag s 1 3 -1 2 , 1 3-1 5 sys t em s e rv i c e ( $WFLAND ) , Figure 11-4 8-9 , 9-6 l o c k ed po r t i o n , 1 3 - 1 5 Ta b l e 9 - 1 Fi gure 1 1-4 Ta b l e 9 - 2 u s e d u r i ng i n s wa p , 1 4 - 2 4 Wa i t f o r Lo g i c a l OR o f Ev e n t F l ag s u s e d u r i ng o u t swa p , 1 4 - 1 3 sys t em s e rv i c e ( $WFLOR ) , Wo r k i ng s e t l i s t e n t r y , 1 1 - 1 0 , 8-9 , 9-6 1 2-1 7 , 1 3 -5 , 1 4 -1 0 , 1 4 - 2 6 Ta b l e 9 - 1 F i g u r e 1 1-5 Ta b l e 9 - 2 Wo r k i ng s e t quo t a , 1 3 - 1 2 Wa i t f o r S i ng l e E v e n t F l ag F i g u r e 1 1 -4 sys t em s e rv i c e ( $WA I TFR ) , Wo r k i ng se t r ep l a c eme n t a l g o r i thm , 8 - 9 , 8-1 5 , 9 - 5 , 1 6- 6 1 1-8 , 1 1-1 8 , 1 2-1 7 Tabl e 9 -1 Wo r k i ng s e t s i ze , 1 3 -3 Wa i t s ta t e que u e h ea d e r s F i g u r e 1 1 -4 Fi g u r e 8 - 4 Ta b l e 1 3 - 1 Wa i t s t a t e s , 8 - 1 , 8 - 4 , 8 - 9 VAX- 1 1 /7 8 0 UN I B US powe r f a i l , 2 2 - 1 0 , 2 3 -1 1 Vi r t ua l add r e s s , 1 2 - 1 , 1 2 - 3 V i r t ua l a d d r e s s f o rm a t F i g u r e 1 2 -1 Vi r t ua l add r e s s s pa c e , 1 3 - 1 Vi r t ua l add r e s s s pa c e c r e a t i o n , 1 3 -2 Vi r t ua l a d d r e s s s pa c e d e l e t i o n , 8- 1 1 , 1 2-6 , 1 3- 2 , 1 3 -4 V i r t ua l a d d r e s s s pa c e d e sc r i p t i o n , 1 - 1 , 1 - 3 to 1 - 4 , 1 - 1 3 , 1 1 - 1 F i g u r e 1-1 V i r t ua l b l o c k n um be r , 1 1 - 1 1 Vi r t ua l I /0 f un c t i o n , 1 5 - 4 VI RTUA L PAG E CNT S Y S B O OT pa r am e t e r , 1 1 - 3 , 1 3 - 3 t o 1 3 - 4 , B- 1 5 , E-3 , E-1 1 , E-1 3 F i g u r e 1 1- 1 Tab l e E - 1 VMB s e e p r i m a r y b o o t s t r a p p r og r am VM OUNT s e e v o l um e m o un t u t i l i ty VM S , X X X Vo l ume d i smoun t u t i l i ty , 7 - 2 Ta b l e 1 - 1 Vo l um e i n i t i a l i za t i o n u t i l i ty , xxxi Ta b l e 1 - 1 Vo l um e m o un t u t i l i ty , 1 - 7 , 7 - 1 to 7 - 2 , 2 6 - 3 Ta b l e 1 - 1 Ta b l e 2 4 -2 I nd ex - 3 4 INDEX Working s e t s i z e , ( cont . ) , a ut ho r i zed q uo ta Ta b l e 1 3 - 1 d e f a ul t Tab l e 1 3 - 1 q uo t a Ta b l e 1 3 - 1 WOR LD p r i v i l eg e , 1 - 2 0 , 9 - 8 , 9 -1 1 , 1 0-1 1 , 1 9-1 Tab l e 9 - 1 W r i t a b l e c on t r o l s to r e Figure 6-1 Wr i t a b l e s ec t i o n , 1 1 - 4 WR I TAB L E S YS spec i a l SYSBOOT pa r am e t e r f l ag , B-17 W r i t e b u f f e r pa c k e t F i g u r e 1 6- 5 Wr i t e c om p l e t i o n w i th $ U PD S E C , 1 2 - 2 9 Wr i t e i n p r og r e s s PFN t r a n s i t i o n s ta t e , 1 2 - 6 , 1 3-5 F i g u r e 1 1-1 1 F i g u r e 1 2- 3 F i g u r e 1 2-5 WR I T E SYSGEN c omma nd , 2 2 - 2 5 F i g u r e 2 2- 5 Ta b l e 2 2 - 3 WRI TEB OOT u t i l i ty , 2 1 - 5 WSDEC SYSB OOT pa r am e t e r , 8 - 8 , 1 3 - 1 4 , B- 1 6 Ta b l e 1 3 - 2 WS INC S Y S BOOT p a r am e t e r , 8 - 8 , 1 3 - 1 3 to 1 3 -1 4 , B - 1 6 Ta b l e 1 3 - 2 WS LX P F N a r r ay , 1 1 - 1 1 , 1 1 - 2 0 , 1 2-4 , 1 4-1 1 , 1 4 - 2 3 F i g u r e 1 1- 9 Tab l e 1 1 - 2 W S LX s a v e a r e a i n PHD Fig ure 1 1-8 WSMAX S YSBOOT pa r am e te r , 1 1 - 3 2 , 1 1 -3 4 , 1 3 -1 2 , 1 4 -1 2 , 1 7- 1 5 , 2 2- 1 0 , 22-1 6 , B-1 5 , E- 3 , F-1 , F-3 Figure 1 1-1 Figure 1 1- 2 3 Figure 1 1-2 4 Ta b l e 1 3 - 1 Ta b l e 2 2 - 1 Ta b l e E - 1 X XDE LTA , 2 1 - 9 , 2 1 - 1 5 , Ta b l e 2 - 1 Ta b l e 4 - 1 Ta b l e 2 1 - 2 XFC i n s t r uc t i o n Ta b l e 2 - 1 Ta b l e 2 - 2 I nd ex - 3 5 2 2- 5 , 2 3-1 1 VAX/VMS Interna l s and Data S truc tures AA- K 7 8 5A-TE READER ' S COMMENTS NOTE : Thi s form i s for document comments only . DIGITAL wi l l u s e comments submi tted on thi s form a t the company ' s d i s creti o n . I f y o u require a wri tten reply and are e l igible to receive one under S o f twar e Performance Report ( SPR) service , submit your comments on an SPR form . D i d you f i nd thi s manual under s tandab le , P le a s e make sugges tions for improvement u s able , and wel l-organi z ed? • . CD c 0) c 0 0 ::;) C) .... Did you f ind error s page number . in thi s manual ? I f so , spe c i fy the error and the CD ell 0 CD a: P le a s e i ndicate the type of reader tha t you mos t near ly repr e s en t . [] As semb ly language programmer [] H igher- leve l languag e programme r [] Occ a s i onal programmer ( exper i ence d ) [] U s e r w i th l i ttle programming experience [] S tudent programmer [] Other ( p lease spec i fy) _______________________________________ N ame Date Organi z ation S treet C i ty _________________________ ________________________________________________________________ ______________________________________________________________________ ___________________________ S tate ____ Z ip Code or Country __ __ __ __ __ ___ - Do Not Tear - Fold Here and Tape I II II I Jomoomo No Postage Necessary if Mai led in the United States B US I N ESS REPLY MAI L F I RST CLASS P E R M IT N0.33 MAYNA R D MASS. POSTAG E WI L L BE PA I D BY A D D R ESSEE BSSG PUBLI CATIONS ZK1 -3/J3-5 DIG ITAL EQU I P M ENT CORPORATION 1 1 0 SPIT BROOK ROAD NAS H UA, N EW HAMPSHI RE 03061 - Do Not Tear - Fold Here - - - - - - - - - - - - - - - - - - - - - - .... a
Home
Privacy and Data
Site structure and layout ©2025 Majenko Technologies