diff --git a/xv6.ps b/xv6.ps new file mode 100644 index 0000000..8a7a9db --- /dev/null +++ b/xv6.ps @@ -0,0 +1,20918 @@ +%!PS-Adobe-3.0 +%%Creator: xpdf/pdftops 3.00 +%%LanguageLevel: 2 +%%DocumentSuppliedResources: (atend) +%%DocumentMedia: plain 612 792 0 () () +%%BoundingBox: 0 0 612 792 +%%Pages: 75 +%%EndComments +%%BeginDefaults +%%PageMedia: plain +%%EndDefaults +%%BeginProlog +%%BeginResource: procset xpdf 3.00 0 +/xpdf 75 dict def xpdf begin +% PDF special state +/pdfDictSize 15 def +/pdfSetup { + 3 1 roll 2 array astore + /setpagedevice where { + pop 3 dict begin + /PageSize exch def + /ImagingBBox null def + /Policies 1 dict dup begin /PageSize 3 def end def + { /Duplex true def } if + currentdict end setpagedevice + } { + pop pop + } ifelse +} def +/pdfStartPage { + pdfDictSize dict begin + /pdfFill [0] def + /pdfStroke [0] def + /pdfLastFill false def + /pdfLastStroke false def + /pdfTextMat [1 0 0 1 0 0] def + /pdfFontSize 0 def + /pdfCharSpacing 0 def + /pdfTextRender 0 def + /pdfTextRise 0 def + /pdfWordSpacing 0 def + /pdfHorizScaling 1 def + /pdfTextClipPath [] def +} def +/pdfEndPage { end } def +% separation convention operators +/findcmykcustomcolor where { + pop +}{ + /findcmykcustomcolor { 5 array astore } def +} ifelse +/setcustomcolor where { + pop +}{ + /setcustomcolor { + exch + [ exch /Separation exch dup 4 get exch /DeviceCMYK exch + 0 4 getinterval cvx + [ exch /dup load exch { mul exch dup } /forall load + /pop load dup ] cvx + ] setcolorspace setcolor + } def +} ifelse +/customcolorimage where { + pop +}{ + /customcolorimage { + gsave + [ exch /Separation exch dup 4 get exch /DeviceCMYK exch + 0 4 getinterval + [ exch /dup load exch { mul exch dup } /forall load + /pop load dup ] cvx + ] setcolorspace + 10 dict begin + /ImageType 1 def + /DataSource exch def + /ImageMatrix exch def + /BitsPerComponent exch def + /Height exch def + /Width exch def + /Decode [1 0] def + currentdict end + image + grestore + } def +} ifelse +% PDF color state +/sCol { + pdfLastStroke not { + pdfStroke aload length + dup 1 eq { + pop setgray + }{ + dup 3 eq { + pop setrgbcolor + }{ + 4 eq { + setcmykcolor + }{ + findcmykcustomcolor exch setcustomcolor + } ifelse + } ifelse + } ifelse + /pdfLastStroke true def /pdfLastFill false def + } if +} def +/fCol { + pdfLastFill not { + pdfFill aload length + dup 1 eq { + pop setgray + }{ + dup 3 eq { + pop setrgbcolor + }{ + 4 eq { + setcmykcolor + }{ + findcmykcustomcolor exch setcustomcolor + } ifelse + } ifelse + } ifelse + /pdfLastFill true def /pdfLastStroke false def + } if +} def +% build a font +/pdfMakeFont { + 4 3 roll findfont + 4 2 roll matrix scale makefont + dup length dict begin + { 1 index /FID ne { def } { pop pop } ifelse } forall + /Encoding exch def + currentdict + end + definefont pop +} def +/pdfMakeFont16 { + exch findfont + dup length dict begin + { 1 index /FID ne { def } { pop pop } ifelse } forall + /WMode exch def + currentdict + end + definefont pop +} def +/pdfMakeFont16L3 { + 1 index /CIDFont resourcestatus { + pop pop 1 index /CIDFont findresource /CIDFontType known + } { + false + } ifelse + { + 0 eq { /Identity-H } { /Identity-V } ifelse + exch 1 array astore composefont pop + } { + pdfMakeFont16 + } ifelse +} def +% graphics state operators +/q { gsave pdfDictSize dict begin } def +/Q { end grestore } def +/cm { concat } def +/d { setdash } def +/i { setflat } def +/j { setlinejoin } def +/J { setlinecap } def +/M { setmiterlimit } def +/w { setlinewidth } def +% color operators +/g { dup 1 array astore /pdfFill exch def setgray + /pdfLastFill true def /pdfLastStroke false def } def +/G { dup 1 array astore /pdfStroke exch def setgray + /pdfLastStroke true def /pdfLastFill false def } def +/rg { 3 copy 3 array astore /pdfFill exch def setrgbcolor + /pdfLastFill true def /pdfLastStroke false def } def +/RG { 3 copy 3 array astore /pdfStroke exch def setrgbcolor + /pdfLastStroke true def /pdfLastFill false def } def +/k { 4 copy 4 array astore /pdfFill exch def setcmykcolor + /pdfLastFill true def /pdfLastStroke false def } def +/K { 4 copy 4 array astore /pdfStroke exch def setcmykcolor + /pdfLastStroke true def /pdfLastFill false def } def +/ck { 6 copy 6 array astore /pdfFill exch def + findcmykcustomcolor exch setcustomcolor + /pdfLastFill true def /pdfLastStroke false def } def +/CK { 6 copy 6 array astore /pdfStroke exch def + findcmykcustomcolor exch setcustomcolor + /pdfLastStroke true def /pdfLastFill false def } def +% path segment operators +/m { moveto } def +/l { lineto } def +/c { curveto } def +/re { 4 2 roll moveto 1 index 0 rlineto 0 exch rlineto + neg 0 rlineto closepath } def +/h { closepath } def +% path painting operators +/S { sCol stroke } def +/Sf { fCol stroke } def +/f { fCol fill } def +/f* { fCol eofill } def +% clipping operators +/W { clip newpath } def +/W* { eoclip newpath } def +% text state operators +/Tc { /pdfCharSpacing exch def } def +/Tf { dup /pdfFontSize exch def + dup pdfHorizScaling mul exch matrix scale + pdfTextMat matrix concatmatrix dup 4 0 put dup 5 0 put + exch findfont exch makefont setfont } def +/Tr { /pdfTextRender exch def } def +/Ts { /pdfTextRise exch def } def +/Tw { /pdfWordSpacing exch def } def +/Tz { /pdfHorizScaling exch def } def +% text positioning operators +/Td { pdfTextMat transform moveto } def +/Tm { /pdfTextMat exch def } def +% text string operators +/cshow where { + pop + /cshow2 { + dup { + pop pop + 1 string dup 0 3 index put 3 index exec + } exch cshow + pop pop + } def +}{ + /cshow2 { + currentfont /FontType get 0 eq { + 0 2 2 index length 1 sub { + 2 copy get exch 1 add 2 index exch get + 2 copy exch 256 mul add + 2 string dup 0 6 5 roll put dup 1 5 4 roll put + 3 index exec + } for + } { + dup { + 1 string dup 0 3 index put 3 index exec + } forall + } ifelse + pop pop + } def +} ifelse +/awcp { + exch { + false charpath + 5 index 5 index rmoveto + 6 index eq { 7 index 7 index rmoveto } if + } exch cshow2 + 6 {pop} repeat +} def +/Tj { + fCol + 1 index stringwidth pdfTextMat idtransform pop + sub 1 index length dup 0 ne { div } { pop pop 0 } ifelse + pdfWordSpacing pdfHorizScaling mul 0 pdfTextMat dtransform 32 + 4 3 roll pdfCharSpacing pdfHorizScaling mul add 0 + pdfTextMat dtransform + 6 5 roll Tj1 +} def +/Tj16 { + fCol + 2 index stringwidth pdfTextMat idtransform pop + sub exch div + pdfWordSpacing pdfHorizScaling mul 0 pdfTextMat dtransform 32 + 4 3 roll pdfCharSpacing pdfHorizScaling mul add 0 + pdfTextMat dtransform + 6 5 roll Tj1 +} def +/Tj16V { + fCol + 2 index stringwidth pdfTextMat idtransform exch pop + sub exch div + 0 pdfWordSpacing pdfTextMat dtransform 32 + 4 3 roll pdfCharSpacing add 0 exch + pdfTextMat dtransform + 6 5 roll Tj1 +} def +/Tj1 { + 0 pdfTextRise pdfTextMat dtransform rmoveto + currentpoint 8 2 roll + pdfTextRender 1 and 0 eq { + 6 copy awidthshow + } if + pdfTextRender 3 and dup 1 eq exch 2 eq or { + 7 index 7 index moveto + 6 copy + currentfont /FontType get 3 eq { fCol } { sCol } ifelse + false awcp currentpoint stroke moveto + } if + pdfTextRender 4 and 0 ne { + 8 6 roll moveto + false awcp + /pdfTextClipPath [ pdfTextClipPath aload pop + {/moveto cvx} + {/lineto cvx} + {/curveto cvx} + {/closepath cvx} + pathforall ] def + currentpoint newpath moveto + } { + 8 {pop} repeat + } ifelse + 0 pdfTextRise neg pdfTextMat dtransform rmoveto +} def +/TJm { pdfFontSize 0.001 mul mul neg 0 + pdfTextMat dtransform rmoveto } def +/TJmV { pdfFontSize 0.001 mul mul neg 0 exch + pdfTextMat dtransform rmoveto } def +/Tclip { pdfTextClipPath cvx exec clip newpath + /pdfTextClipPath [] def } def +% Level 2 image operators +/pdfImBuf 100 string def +/pdfIm { + image + { currentfile pdfImBuf readline + not { pop exit } if + (%-EOD-) eq { exit } if } loop +} def +/pdfImSep { + findcmykcustomcolor exch + dup /Width get /pdfImBuf1 exch string def + dup /Decode get aload pop 1 index sub /pdfImDecodeRange exch def + /pdfImDecodeLow exch def + begin Width Height BitsPerComponent ImageMatrix DataSource end + /pdfImData exch def + { pdfImData pdfImBuf1 readstring pop + 0 1 2 index length 1 sub { + 1 index exch 2 copy get + pdfImDecodeRange mul 255 div pdfImDecodeLow add round cvi + 255 exch sub put + } for } + 6 5 roll customcolorimage + { currentfile pdfImBuf readline + not { pop exit } if + (%-EOD-) eq { exit } if } loop +} def +/pdfImM { + fCol imagemask + { currentfile pdfImBuf readline + not { pop exit } if + (%-EOD-) eq { exit } if } loop +} def +end +/__tumble { + 180 rotate + -612 -792 translate +} def +%%EndResource +%%EndProlog +%%BeginSetup +xpdf begin +%%BeginResource: font LTWFJF+OurCharSet +%!FontType1-1.0: LTWFJF+OurCharSet +12 dict begin +/FontInfo 10 dict dup begin +/Notice (Copyright (c) 1991 Bigelow & Holmes Inc. and Y&Y, Inc. (508) 371-3286. All Rights Reserved.) readonly def +/FullName (Lucida Sans Typewriter 83) readonly def +/FamilyName (LucidaSansTypewriter83) readonly def +/isFixedPitch false def +/ItalicAngle 0 def +/UnderlinePosition -100 def +/UnderlineThickness 50 def +end readonly def +/FontName /LTWFJF+OurCharSet def +/PaintType 0 def +/FontType 1 def +/FontMatrix [0.001 0 0 0.001 0 0] readonly def +/FontBBox [-12 -205 618 928] readonly def +/StrokeWidth 0 def +/Encoding 256 array +0 1 255 {1 index exch /.notdef put} for +dup 32 /space put +dup 33 /exclam put +dup 34 /quotedbl put +dup 35 /numbersign put +dup 36 /dollar put +dup 37 /percent put +dup 38 /ampersand put +dup 39 /quoteright put +dup 40 /parenleft put +dup 41 /parenright put +dup 42 /asterisk put +dup 43 /plus put +dup 44 /comma put +dup 45 /minus put +dup 46 /period put +dup 47 /slash put +dup 48 /zero put +dup 49 /one put +dup 50 /two put +dup 51 /three put +dup 52 /four put +dup 53 /five put +dup 54 /six put +dup 55 /seven put +dup 56 /eight put +dup 57 /nine put +dup 58 /colon put +dup 59 /semicolon put +dup 60 /less put +dup 61 /equal put +dup 62 /greater put +dup 63 /question put +dup 64 /at put +dup 65 /A put +dup 66 /B put +dup 67 /C put +dup 68 /D put +dup 69 /E put +dup 70 /F put +dup 71 /G put +dup 72 /H put +dup 73 /I put +dup 74 /J put +dup 75 /K put +dup 76 /L put +dup 77 /M put +dup 78 /N put +dup 79 /O put +dup 80 /P put +dup 81 /Q put +dup 82 /R put +dup 83 /S put +dup 84 /T put +dup 85 /U put +dup 86 /V put +dup 87 /W put +dup 88 /X put +dup 89 /Y put +dup 90 /Z put +dup 91 /bracketleft put +dup 92 /backslash put +dup 93 /bracketright put +dup 94 /asciicircum put +dup 95 /underscore put +dup 96 /quoteleft put +dup 97 /a put +dup 98 /b put +dup 99 /c put +dup 100 /d put +dup 101 /e put +dup 102 /f put +dup 103 /g put +dup 104 /h put +dup 105 /i put +dup 106 /j put +dup 107 /k put +dup 108 /l put +dup 109 /m put +dup 110 /n put +dup 111 /o put +dup 112 /p put +dup 113 /q put +dup 114 /r put +dup 115 /s put +dup 116 /t put +dup 117 /u put +dup 118 /v put +dup 119 /w put +dup 120 /x put +dup 121 /y put +dup 122 /z put +dup 123 /braceleft put +dup 124 /bar put +dup 125 /braceright put +dup 126 /asciitilde put +readonly def +currentdict end +currentfile eexec +5AA4F71255501637F1A431BAB555283D093E1B588B45B0281559110D21315C62 +BD638C6B34BA54AA75227715D9947EBCD51A104CAEA657499E94138F5645BF68 +368BB1B1EC8E4776F067FFF2CE9B89FB7E63A7DB304498C1036D399C47A4CB79 +BD517EDB02BEB90195FD7DDAF3E839BCE2DB156D9337DBB2305A465B3E0FFB97 +1985C79DC71C47E26F9F0F042B2CDEE97B679358059256FB93D662D43C7ECB5B +1A564DFCECB963478373C69F52172F071E0AA6082A3E10D9E1CE2851CFA210EE +7BD5FCB1AAE15E89D1FB339D587D218B89C18A32F47C7451A80CB1FC07CF5EF5 +C2A9054AD59AE4D5522D8745045620C9C40EAB675A6FE53511D83C04968F37DE +389C3A7A551DC79580FF1B382205C5951A9F8E7B6CEF33E027D608C14A394033 +1E603A09B3061B66BB71AC1D2A232B5F2BC9481D7D44F334ACCBBF6538A439A3 +FE8DA1ABE05931A20F8FC365A0F90C9A22578FEBDD03E4201D2887923DD20ED9 +2F8F50AA500DE6414F5521ACCBBA45FBD55A4882C7485B52146BD36775948914 +F8D5FB4C38AFAA25CC8946C7A7DBA010B186D6B5B07DA514976B3CC03535B838 +7B3B0BE3D2A1813A3B406846433DF6235D79BA455E54E35184F42053C1FB0105 +CDB7B017C5BF449CEF69EF7E7B143698D00B249BA50E98D198FCE708667252B4 +E45CC9BE25735FF617ABA79311E655756E2F7993ACB8E4F27F76F14A9088DA85 +6E17B25267A4D8177DEF6684BEB1F400B6B07492E58311CB44EC0B528F8FECE8 +E96A50FC1F544E0F3DDFEC55E4CD9C34AE42CA8EF98BB1901E6D97DFECA023E0 +F1D49EC9054CFEFE87ED611814870C75F636FA9F1430AA5F53C397BD13CE9113 +7B57917BCBD964A8370F3FBCAF0FBC80BB0527B5E1C9DE292498096D0570A220 +444B3E5CCF7F32C09338E4B393D1528267A5CEC43DE04EB0A7D3E802146533F8 +5BE541383085700F322990AE9C7400CD2CD7031F05FDFB9D4825ABDB38E904C2 +096B183D3D32C10A5C0391DA6516282D95C06E54EFBFA34282AE4D4EE0D87D9E +D0F41D3FCD7CEA0794E2A18A5F8092950BCA3B49A1A88A6A49E54BFC5BD354AD +4B58480C1F9136A0D2B34C96E6FAAC235DA8B5A643E94CE0A3924CD4A9C07F8F +CEEF6DB90ACD50F9438B78C1A7BB01F9A52B1A80F6DB7D5C0E26A3929939FCAF +91A90F63E448D6B2513B8835B3732FB96A449289BBCCB20C65A77EA718C25FC5 +AE7C12089733357F89152E2667276AE55358EAA697CF0BA0031AB617710FF229 +571046B5EA6B5EB93FDEE581FAB465EEF10F302EE7C5E39DE51A3C8B3FCEF031 +9819ABC8FD2E80E6D0073E638992185B3C5301267853F69A9E0D969D229569C4 +D59E062DB6A53B5F82FF8ED7584D27CE27EDEEE8C6C31EACC673C18CF53B1D72 +419639DC644D9C1CBD370CE96E8D28C9ECA7F37F26989C125CF0B6B806D8B4D6 +2E1CA29F891ACDCCEBBFF5E2F8BE1D59AF78E01A10B841624499DC224081C1C2 +006938615363E596D014BD38E4729DF9AA2839500FF70D246873CE23A99DD173 +6E4AA28598A115331ADB40913F876D05B8F89625A122CD752A60F2180D971AD3 +486C49066503E24C50F5F4975C2EC545F051BC46DBF96898A28B2F09B608ECCB +57D2499B735ED1C45DA6BC1778273180D9DCC6E15C7DBF9F53BDFF46569CD7D5 +3E66E85372B5A5D8CA62B906BD4CF56F0336441349554A5EF4C43837B83471FD +6CB4FABBADF99FEE2AA79354678722725927BFF26B7797AC9CD034474F889C41 +403BCB546A701285EC285C90A7F69ED5FCFC6E1E9928E71999C408089A3D48C7 +136BB77E9165624383400B324F50F3F88AD03205515A33586CEA9155C3FF70FA +CC1397107C484B8F9FD71F8E37265B47F8A28D50471A0539FE6B89C354A5ED46 +2A0ED3C91DD90FE617D27C70E86A3DC1C05BE7E99D527B681E0141A787139940 +FE22F116C428EA79BA326F462007EAF2D2CBFFEEA47D0A04840728FA57516073 +FC9E482B25CE59A3951841FCB2994A454DBB17F56A629310E128919D60017178 +4DE9E614779A44F400845C4905C13E75EF17E7D5653A62613E7BDC232674349F +7B0D86E1D499F42964E9CCECF15FBB0B557B0BC864CF475BF309B64BDDED98D5 +D2B23DE6EAB32C8C3FD3D930ACD6288A80713148FD98BB757A8740B1DC48F757 +3B19A56CB146FC5F38F3F89C44C4AAC71EC2F65E6024E15F805EF905F3A45094 +289D38BF465D7E90EBB6C64C705D505ACAFF0631135855E9905C54808A9D1E53 +B24360028BE452FABBFF72AFE83F9A26B7101C6E9D4DAB8AA495E19AD99490B4 +870615F47C4135E29EF2178CED745490FCDB229E04FED8353A09DFA1448E3892 +75D7480CD30611AEBBEB051F8F6E5E90B487263DC92F34EF9D1951A40EF2FCCB +3F5DFEBFCE277690B90A82291198B12C535EBE18E2206878829EFF8567B85D89 +CA7BEBC9FF25FC6411D78C1A07FBE98104041632129730E371AD0054A4B74E48 +CA21E60DB8AD10811A91CE4CC2A33D3750A0838643CBD5CE4E94566AACBA6146 +926594ADD73AA1E4A48A3B32B4300B13750E4298EF23E77CF2923F8B95926603 +16EDE4B6AA04E53CF708876C051A02B95D076BB4D754F4057C13EF0C9CAE1E02 +D969A5CD0C82ABC080F3CB65F672344D201B927676B2C80EC6BDD30BDAEA61B8 +6297D34A4BB3FCE96A8762161588AC43116550E8E6CA631B4F4DF540F03CBC41 +046C2CB4547ED81370856486665CA480DB67F6B00727DC6AD77BD78F9EED9A35 +BCF3E276E8BCF746E6BC38A59DD2171B87256AF5FAD646378F8E7DE26ECEA4CE +7089E042EA0A7557C346AA6F8DD6CA1CB9D581B5AC86EA4F6A3B257E286F22F2 +C9CAD0DD32B0FF6798C83AE03B3168F70F7C7C849CC7C28F04F6CE8B6A6D0CF9 +23114D99AE626E926A170751F654B7B268A8934C25EC195D43941F241CB36819 +277B9CAB40F6EAD122B75DA9DD7918C8E5406AD44A54B3733BD01190CFF3740B +4C66E2D58D4682DD41E8F9580570A302FF450C375D9247DC8C8DBD38E48E04FE +F14D0650A63A5290A806C536E1F47EA00B13C27D8958F3332B9FAEE59875F289 +7B224AB3EEA0CF879F56914E64AFD23763C661CCC36FA6B750EE28A1388C2664 +AFE3DB6D09D3E21168A72A82DEED295BC44FC24A4EA46A02AA67447F7374DE34 +3CA0ABAA0777FBBF2D02FCDF58F4783A1823DA35A54CA3A6069FFD7B9960AD3F +7E201A14A202BC5DEA12A40F12FBD779568CDE23DF90AD3EB281D5D63FDE864A +6DBE38FF0FDE4E222EF669EB29DED49A900DC9678D37DA2BD520D9A7C878D4DE +5877B8A6451CCC50B59D2455137CEBEC65CBAF609A00DE3CADFCF818C56409F4 +871107C839043D6319CF2D57B2F94B524C8B9D64C8C4420E0D630471161EAB9F +D74449EBBDFEFCD9DEF0B39F4BF609B852394519F8697B42962BCC1499BF77A8 +B02A695893533389BCD4B204FABCA016459C53D08426AE31A23F52497DCA85F8 +8E19D62AA5AA45E3756BD0D067C510ABD271ECBD8B2A0466CB4AE70950C9A971 +9FD6264399B34D82B9FD7169103BD48886226F267158FCF8E9300A04E4BDE133 +06781119AE5C210F3858A00DCF23AF6D0E83FE052774EED1EF733075663A6599 +19A31B51A977380648DF55CF9A088A864A55515B28D7DC75730E05CAD07B3A2C +818D43625A27F7284243AB26A90E2F80706DCA1676815313EC98F545D8EB02CC +1D1A710DF5C183EB8D7CEF837986556B470C7C0DCFE193047521CCB067226571 +7C4929829A218FC50D522D4239F6B5C8D4A3E8006DE102A4873620AABF1A1FDD +BF94D362FA7B23EA59B8B07828EE49B2E825502960EFBB7F27246F8784797F54 +3CDA02F9E8408E12F3F8724D465C73993321E8368D8E3FC8FE823CCA34042D72 +159038A933CC6618627CC8755E72EC6B3FE4DF5F36D59E99409C6D4F7399936F +91DC03F065003B6AE676AA39B0D3F9746053E18B16C085F5D74C0FC3B6B00E99 +FCCE3590271AA78A76BB36248B7B9B00DE62EE0C6767690228CC5F97CD27107E +D483D52A34182070A54EC20304CBC4763863735EE0C4941277755FC985CF6A9A +D95C8A8DEC8DD9734BC35578B79DF8EB140EEA8C622DEFED33768625FF197B19 +1062FE5B7BC0C3E2EDF8F404477E4A0652342370889232DE662578DB1AE2DA0F +B7612DB64253390460682A6EFD5DA4D3316491DDCA92269289EA782FDAC82A76 +FFE4181A6BAE23E0E539F31AF2CC0C9CF4DBD569C44598CFB6029B50C1D74151 +D98FC5FCF0248778CCDC4F7B59C070E1E7D3FA8D4030178E1F02382C69B0338D +E2296378105DCAEA8AECAF50F8B90F1F2C20B03201D27B7AB1D633DA02D1626C +B6FF684677B042CE5BC5C9668BC1D959B8E666BF00EF10DA7C450FC122DDA86A +BC227BEB160C8F870A9A0BA1CC9ECF7A37E95186F150A3507E0AB6766E1E82BE +7C3E8C7C9C832A89127D7728C8BF89EF8C599F9ED7DAA8223FB2531AD7CC7381 +918E6EB3386DDA03501A83D1BE49F381EE5C8BCE02432BBD93E7E145F681923D +814DF79DE4CEA10E025134E81A1A947F1E62EEAF978EF4B9DADC322881A88090 +F1EE06A5DB1273F87737B35357651B77EC8D3E488BB949A2AC288FBA3C78C217 +FCD52E3BDD13C610022F53617775B14752AE4FA0E5CC39CB66B9539D33C711ED +0F712DF81A28E42AD90C6AE2FAAD9C07ADF0A5CBA487F2D392E294069592F214 +7BB688CB4FCEE81D2518BCBD21B04E2F3F9BE8DE6BF0640A667E700E2EC5414C +9F42F26FAC0923BAF78F63E03321E8BEC2332A8BE703C23457B1EA2448F7B48F +CC7BED855283A132869D38A43D74948D1EA165CAFB6C1FE35A426C23436C411B +C9B81EDCADE1F79F2A16963F609B8E5C8D9547FE8BBC20EBCB421D3D7510EF3F +D801AA9C68B389310E6394952C72BCC2252946260CAD4EC880F69D95AB07AC90 +C6D0C8F95B72CA274CB690C5334B73A2F3B8B9CD6885E431E36FE16430FEB750 +FBB8A3154BE9ACB2F3837E5A69836832F4FF6BC000EFC90167B450916892C728 +D3BEE1F49B276C57BB298A646233A669BCB011179693BCD8AF0E09F14474EDEF +A34936392F66C296A8050F79458AA8F10FC95954CA98096604B99859813B488D +DEDACC162AB1330B9513B17F434A11F6E76746C180FF9B0AFDB4097453C6E1D8 +2B0290CF6F7B8119CFBD59D6FA3BD32BA2D40E6266FB10520A71B734C502B46D +B96F597BBB18FDE6A61BCF7A9DACF524AC3B8C7770727BDB14850E3E6350A3BE +6A5D849BBEA78FA4C973DA470D984C3D2234AF68171A01D7F1E573FD3C9DEBEB +8A77F12916D9C22CA7026CAF1274A9C280FBE5089DA3EA526F9C68BC986A8B7F +4743E87A10196A1E3B9BC621B614CA32F47A171F8DF9D83A6294E796835A98DF +3C87725116BEB93D30C065EE4DFF5BE02E253F251647F3A6CBD9F8066884FA9D +7372CB758C1EC8B19D9B3E85919453B788D6BA4EB55CC047E00AB8ABA22F9001 +4D7076D1B14BF9D9258DA19F8BB89DA70504254FB9D82F5E16F00576319F20FB +98B680758D7435BA34E98EF02F5C8CD16A1062B35A42B2E522D90435072D3BD6 +5FC64AFBF541BBBF497328BE21F36B4EEE20EC18F41F3A985C49BBC05AFDA137 +06F850F85BC991B658EA5DD6504A43D64664900026F08F5AD0657E81CB4B6394 +29F8518C7F3A0CCB787EC827DF97B4EBE133AB28291C3202F7AE1E45DC8EC498 +367870A9C9CA93AF3053D334DBFD307AFA2C421D2DBF465605A711568CAD060D +9C92373F4317EAE7B74228CD32BC3FE7289935DAAC9A1C95D67386820B478C2A +E7A76926BF9EF3B372A9F4A5C98F30BF2A46C1A0C393826191BD343F0DFE5734 +DC38658406967441AE18C73FF0D2E70CC88255385E71F1FD5EBF85D4CCD4FD4D +DF5D02A2C7FD38CCCD29368B7CDE2AAF50B716AFA07470692E6AA278DED84406 +F52643941EAA6ABDE13E948EFF746D506052BCFC45293FC75B3183A188712D37 +11F81585E2279E301A9C967533959B0D99819435ADF4394EAF23C8432E8114DD +3DA40F4C2848A9A131403152773371ADCB6ADAE608A0159B3ED1DF37BCA6D1E1 +DE7261DE98D26A75FC64B23F61CBBF5984DC45112F3E44D9BADFE9372A8AD035 +D966F9D87CB5F831B40D6154C29DFEFCE905AD2F0F525DBA7A471BB8175A6E57 +25598FD243FC0282D2D41AFB41FAF75FC48413DB128475A00BB49E23E1A47C70 +657F84F3D09D66974B98DC898991A6DB7C7EFD32527F3FA56E9464793D47C5CC +17631250AA37B1B7EBD972D379110778F7033B7E10875AECAF5226BF9C43C330 +E66639348E444F7A246D456A678637E6E4EECD1FB25C25A7037C364EB83DCDB3 +4A6FCA2E36E71754927C30A0BC968164FFF79F210D8913A4A03A90EE3F03A860 +4FB7D7513ACF84D3AD96E011067A9794DC09DCC003223A95CDD49C065A247105 +A77118106D8B301D12292C657432A4457D8FEBA4E605FD1D528F2ED51C972831 +4CB7A88AF1088B303598ED0BFDF520755E683F2267C50A0770AF901A7C4F830D +AAE9691172D8CADBAB44276AEB5BFE3D60B23807BE33B7318B0F31D9D1ADE720 +670BC376989C51255259FE3231B842A200051006831B65AE59CA723A3E958FDF +0B10CBC82E0184DA8FE9D172B76AF9472BEA2794FC1A4D6D256AD61A9951C388 +09115F42846C880AE0DA6B0C719BDA2773306957F2C46695104D436C27CC0F5E +FDDBCF9AF99A8E94D7057E10410BCA5C8871CCF35F6640BC5EFF590C3528CA0A +2B754DC5219EB8A95B33FB15698157565102FDA281A7C32C65FF594892ED419B +0EE181A5535E3CAD898C9911A1CEF440A38301D930E534B6BE1142F214456CA0 +6B63D5F854E389C5CAB3C52713004004606CEB24ECD9630330F7DDED6E3CFD05 +E058904B16B3F198EB4A727DE5C24FF496D081A4F149244A9E9A563FA271EA72 +CE24AA04328A612060B88F2ADDCB21B1843B5B8CA7F1521B1D503787A9742FD0 +22C0A7EDD92849E87CD6732D753232392CB0CDE9DB9CC77641F8215EC7C7FB10 +202045EFAB63262F1F21C459A294628886C0D5A677ED6EDF183E92BA7A311456 +3F543B8E3032442269A1474114371F25E7411B3CBB9B1397B2CC7C193C0E0264 +E21FCFA9BC47115422E28D0033F20F9B898CEEE6A1507EB81E54427E2024C67D +24DE610ED650D41FD7618201FA16DFB017890E2E0C5AF82216FC043D3DB21F29 +44748E3BEC5E5049AAB86DFB85AB9F891C2C564D7227C4F9A05B4C8F5CE44BB5 +5524183F6CC7BAD349D94C3C40A22F074F731DCC986D475772005074BFCE608D +BDB002FBD772517D4B43A534081DB7B95AF23D84CF395376D8F9BD6A7B0AD7CC +F9876E644B9CE1D0ACA576A749FBC65A6F56E625D9891096C319C0C355E8518D +C708F6F9F17514C8C5543E8CABEF72B3E5AB01BC676632D2AF90A593346735F1 +446C775B2972E52632DA18869784D610890589D9E899CD9BC98641AFF1506352 +845E206C10FDBE99462B273231986D5E9C74F9B747F5378B7E294B14AC65D35E +79CF4F095347A0EBEAE012D2BFB30BD241141B9F1FD70776E4CA993E7ACFCA53 +3B2CEC09393E72082FCEF5AEC847861C42B498C6F68B14620C4E3FE298C67234 +B9D05A74945CA5C549CC1169DAB2614D0F0FE3209B1D063FBD53DFB97EC0E40F +F398B9A3363B6DE30E47726496A6B2DE2FBD8341C3F7FF2FC20C3589ADAD353B +5CAB95C83A62AD97341C39276F3FB20756EC51464EE631F9DDC50D6AC8BE2482 +5E5341EC76366A610E36E9276893FBF05E7E0FFDDBBA50A13FE23F97700C7CA8 +A8DC0EC182378399ED1ACC44868D4E3A5FF4E7E9D9FB84AA72E868097CFAACB6 +9218465A00019D5D10A41AD270539F2757516DF0DE79ECE5AA4C90603C4C40E3 +D1B57ACB536CD43148EB7389D7D2139BFC287A5D63A89F8D2BA1BA2EB7F6A7A1 +A42472571FEA3C655856A6207D6F48EDF7BD0EDCC0A6E118E43DCA4870431C54 +02B9F9D6DC7E7D82526BB50A15BE15619366AD054AD489EF0E8C812DB50134F7 +F36D356D7B8AF6BA016D0A683FA662CE2809037915A9200893D352CEE4A8A539 +F4DF1320F72585E59943F6A3EE2CBC2E020C17F5391E1045B190CAEF1C0297DE +45F87701542146D953F99FE0E6A23FC4FB081C8A2A3A89F2028F51DFEE278D98 +2FFAB44AA4122E8175074BCA6928252D4147F8A7115161D512DB3410F1762CAF +16211C8FFD8C082F292D7944D508F2BA2FA7AFE471B35BA4B933B6E6E2DA4107 +81A9737C42DE3D56E55C002D83190D893743A3A2200D5B43F7E10F8B4735EEAA +C5F911660F1C172CC1E5C4036098C0AFE71958B01FC261C70DC2C4BAE0A25254 +DEF0801BEF762156E673B69D359962F482E79EF5EC599D1B800E6111576DD289 +3D88CBA03D849DA14E865EDD612E34561ED626EE51BE0B7EBD995FEC2DCD1E1D +1D13FD1EF101E572B732D69961D91E0130CBCB1D0F79AE3E5AB68E11E0B208CF +2B11BEA9FAD42C67E63E35BE7E410D1725B1DD3532CC7F4730EDF325AB77C0F7 +93F39B4D89CA618FC6964C5EB58128DF2BF997000BF3A43341FADBD1FA6A577F +B86018A21665D509AE01E02B73B36FA0BF1A434809512D70ED1231A49FDF5C17 +8A859F63E1C726069232DD0C4E6F9AD64BD7199AD19F14B360D906F40093B84B +9B52A33F36D146E2B5264E53A41745DA30BD649E8CDF2B0871887996BD22D025 +8A4F8CAA6EE7D67E4E36D900DF0B8F31B5A1B10893CCA13A23734A2F6FD654D6 +0E1C9B0A73D59EE66DDE4E8F0C9FE805BF4AEC6F54F25AE66113BCBAE85FA720 +1322EA828073DC235AF729562F888A349D6C5D40CAFB28C495D8BDAAA8E93C4A +4DF630094A7BCEC8C63F1BAA8F28F1BB4BFE28C30C5CABDC6DF2A31B246D3840 +C3642A683A551D3E605F0635773FF926F37B3017F75CF70E1C02B335DF9BB2B6 +25A634897D331FC1A3C23050EC25AC7B68B77BDF239DD2263DCA7893DA7EE147 +2842626C81FA4E487BE92876563211F4BF13B27BF3040021E09C9EBE30B1E342 +86E128E15C2AB17A47C10164862A4286B0B5164F43D9055E18E003A96BC41F52 +8E8EA4B37C0475510AFC513707D649527468E0D6843196AB2CD65B59967B956C +95B2F98CBBEF2B900C65F581A1A4C273C1626131653C2CB2E78152ECCD8F2BBE +C6F6B99EE6958C92B1C4B555AFFE911BBEAC9A2AF10BC8EBF41C2FA6929F414C +CF5088B60DC6F3CDFECDC1169687333E8E42D2E756995DE5EFDC7F1F21B63627 +14AF8CD7B1EA7C84256332F6D2231BE5D6FAE80379CB0132A4BEB397A4D27375 +71D9B6AC8D466E408CED3A3C8D73E078BFE44EFE531433E41250752711EE6B99 +B6C5A8FA6CFAA3F858806A58D06681E8191C02A1555BA9A45FCECD26B6E7A4EA +FD38B456CE576063E87567B9AB3BD3114220E4B4D24B3CCE8BFF26A01A658D96 +50A133E9AE039A6D39EAB0993ACBE8F71C60DEE0A25CADB02B1550C4E5F5406E +238DDA885BCAFA01739AC40559A1FEC332706D9D1DBFE7B7AF9F2F6FB86F9706 +610809706FD7C80F35BBE8252E5E4A978683505F15E2AFF2F5A69F33581133A8 +5F261E686A495B74F7F6BEBE0ED509F0B0FEB387E632195B203ADCAA21FD6405 +B4634EFAAFCC5C5E859E82B7E52FD3B1AAE99898EE6622E40217BF98695468C2 +0E4703C8862208692C12C884AA8D65CD47FE385782F49E12FCCFFECB31125895 +A2AD4D9D20B7287ACB9180BD15B1657F95E80C324E68647E3D7B95F7F07FC917 +30210543C3851FC1E264A1CD1ED95D21AA479B12BCC9B74E9938FE33B4FD1A5C +04AE0031D88D0DE723F56B21237F0D20BB40E0BEBF7D62152B541118B7EB9E0D +EFB1DB53B3E4AA0680EEF6BC021748D23969EF9E711D95159A4271222F0433EF +720E615CC7BF47E7E401512C39F84D873629D6964CC045B4FC422A56B0CEB142 +9CB1A2CF6EBE92B74B6A1D1CC7BCBBA9E50EB527F0186B1846E12384CCECE5EC +335C4F2E7941E4793C63CF6DFBF5AB7C1286CED77D135BA8D1CD4C6D2BCEE104 +1570DFAA5ED9AB7778DBD2DE652B8038B5C2AEF8BE93CA80CA0ECD571E0BA9D7 +CC8614D176B178FB8C51F170017C70BCB01F28805B4053D0DC933A5A1420C27C +88897D7D4A7029685F6C0F9F255CDBFB6CED05607A0A3A8116D61D96A31BEF71 +5397FC32D6A9B198B085D796FB330791085AAA33AF6D1349F5C93243E37797EE +C3458787AA6EAC5753110237D8CDF153EA4ECF5FBBFFF4098A5A9E64E65E244C +04F61511784F0E0524437209C2873143D9C87EEE272A852FF3AD554BC094C156 +4E6FD0F69124B074E1977DAF7AB3AA7914B64578C99A925818F6D54E5BDD53E2 +2A6A786087EF436909DAC86CB8F4CD595996FA03DDF2833BF1485C9611DC0ACD +7366EAEB31F718FD569F1EA3D772945D347771B175D3B488D5F12587A2B91211 +0D5F37EE9FDBBCF9DFA3F7E104F53D80886AFEDF48F0449192EBEF6036278AC8 +9002DE452516EA28C9F3286D42DAA0F78A1B4BFAC7EC35D7E45A99AC66111052 +1AA6A6CA1FA68284997CF7A7674E43B40261177AA982657A7448C1F1DB05DBB8 +CFAE02FFD09F584D1B0B29E1F3FB7DC908021E0B854EBADAD8A833605FFFD1C9 +5D1A6C2E8CD3EAE89BEE21B3E9622398B610223ED6733D5C30DD37362324F2FB +C764FCFDBE7B7EFB247A618016BD74BFD1C39420F6D33FFA6154898B62AB0444 +8B049117E5452A5B84CE45F48389B7AA696F3B194C04EEFA9CD79E1ACA160699 +9E5F7DE8027195E2559D0FA4A59A70CE1266B69F422FB62EC102482620FA09C6 +1B85E545596D226545AC83C89B941A3FA95B0704EA34C4E9FFF8917F1A611E8E +0C9F8A4A8A3F3E9DFB2D3C34EFBAD3C6218B8624EDD9F77E7FA30A8A080EF8A3 +F360D8671D0692EB118A3E83C7140CC161E5E0011CC15073E9B30894354973AA +BAC1DFF1C0889CFF50CF070A806CCA9B4A869E5E15EB345E5686764B142F6B2A +F198443420B930CFD9441720C9BC3A17CF6FCB40ABE90EB198DB21259D402F03 +DE7C84D3BD01E9800348EF8F0B5DCC76D45E7E0869846CAEAF5535EFC15D5D32 +9BDF9869FA715C14639A3DCA72FD34024C89A2363A7C7F18210CA9BC5A75CDE3 +4C2E98737682AE6D20C37220947D5707071FB50C5077439B38795D64BD1530EA +A3DA77C2D4C39AE44697950B5587D026167856859E679AB44776932D84E00225 +34822AD977566481DEB69B6D71FF394C744492443B0BC7E4201807684082B69F +5D0973DAEF0167AFDCFA7C019EFA4FDEACB014B263EA6B5C8A14FE2ABE63516E +A02EFE7B3BC3F7FFAC46725125D0C0DABEF697E9B2FC9017EA707242073D8C50 +46EAF3A89F2806D16B330AB73D64CB38399BBA1480B6DC038270A34B8B16FB6C +F998C2901B8BE47FC0B3B30B352A436A3322948C97BB47741F4BBB3D9ED51A33 +E7005E22474EEF660E9AC247987008748F0B20A2F6EC487910B8F10AE20FDC51 +BE59F58EB10033CD563F1B24665EA7DD179708813390224241849C02DBE44F57 +EE17A22728C030B95AB5D8BDE385CE9E878E94FF2886C88FFF45E41F0FD783D7 +2A4BD1C6CE2353737DD9272C52DA8AA91D152BA16996484B31E0EF9741D43FF8 +9D4AE17847BF44A2A2EF04252FF904CF2F1FC0AE43BF8DFCB3D9035C2F11D359 +8AB2B94E53FAF40580542230648069C84E9475BC330FDA951A9DE4FB350EEEC9 +039BAC59746AE6E527C19DA1D5E81F1CB5D775FAE7326131D34A5D7BCAD1DD6E +744241BB355593A364F8FFC50244911C2FF6932987CF49AC282F0618800DF652 +A396847B441024CE3B634BCB505B9CBAFC44204A980D4B9EB516F4BD166BB91D +FA4AF61DDB4D94A4A23A727F687A801FCCC9CC81D93C64534259B2D74163441C +70EFFCA0952EA5E9D977E965FBD2B931C78FD9F1727B82EE6EC5C3E5B1FA954C +CE1624EBAFF6AF08DC4026D98CAEC116A4CA76CE7679B7683B323887A201CBE8 +3E08BDAE20E9813D26F7B50CFFFB608794B3E557212102106CF8862EFB170D0E +9E90D5EF3E1EF3DCBF21BE27F70E527FDBA3C30DDDBC8BB319E62BCEA406F423 +B4FF9683313CBC0430EC7CA8887AE2924BDA5E048DB731ED00E4E955B19DCA3E +57158330AE6D18A4047C22D0DCD86F1E5A6C02EBD19D39F81EB46BAF322C04D4 +6101A50AB3C0A6FE0575F36EA3703C96A5E273AADF2E263922065F0D296939F0 +B347FDF7DAE050A8C8C41D38DF5F951E7FF2D69BC5D17F6803774D7D795B8531 +46BC1B2541ACF1435C00C033FF98658B2C0A3B0F45EF89B6B7C2B9220CCEEADA +73FD745AFF710B1BC5BA38906BBAC57DEDE11CE03F206269A0CF77FDF4252FEF +878EE755C56ED29CF4775948F0555714E9BDECD09CA84B4D7990DEB7B85D2C04 +87287A6DC7F6AEAB9F6BF2CC06A1210B8B8405DF2CD29E6B36B767C950C0B8B3 +236983F8CAC70ECB93C3E252A28EF16FC8430CA65DF2F42FB5698AC0922C9851 +1AC47678E99535512247ABE19DF4729F9BCF62F9B155DE7B9201A095E5A456CB +539F469F2B7D22DE5CFD57613652B7A38CDA3ADAC7990F5EE0EDB7345F894628 +13B1FAA7D73201D193F2F6B0E45E02D9391408C589C54DF99BD18E6BABD1946C +1DBDB2889E5085519A651EC6AAB38518F71767A6792036F8E1F5E7789A8C3BC3 +294634D8682498A9E329A8DF7374E0A073439440FE90B551082AAC24C2F03423 +52B89E03BBFA681942D97269117D4BEED5F97CD402569A152927C8E1F42DAA04 +0126AA3E1B323368C16ED5F16EF7DDAC6B7CE493ACFA102128D1FE73AC927B44 +C4D5DE39D8919E1909A69B603EB73CF6B3EFD8503FCF03CF5550825D4D39FCA3 +19065E067C1663A930E50196D34307682B75F07733325F280C30FFF4E895F266 +CF553133A0D31CE4F7E88E4AE2D3F55FA72802D8DD04D7F02495B3D43048626C +2C7020FBEBAB25364ADB70EE16C22C0C9CBCF1281872B5E23AE3688B17E5E0A7 +F38E12C07B9955BC6019786C9CF65D9A4E8EE5C273092DEAF97A92E5AC04D250 +1FA1799A112808F4E041C2E6B3DB25495F690C5E6D9EC0D529E23C28A6317F01 +B283DE471016E9587C6105C862984C7653A3B445C9CAD1C5D8F6E4068ED15C59 +4E16BD6572345A4B94AC1234A0CB46B543D15ECB9B3B11909E32BAEB53E13834 +96FCFC4482455BF5B847EFD142C2716FF6E6A5DCC9A568BFA9D0ECB2FF815B85 +175EE958D523C7F8C95D79DAB5FF776BDE102AB7DF6C81EFD51B9CF9C47DEA99 +42079BF3EA4C1F8C6D4950EB0F16FA591C5463A006FB6B9C07B699B39FEB8ACD +06861753F64845934A846336B5F70C92E43D3625AD4B6E2D5E106B127C8E9155 +65130F0481F3B522F96386B06F90E4848BDEC9B034E2FD70467555F719E2DAFF +7541D1678F9D33CBA501AE4AA5B37071E304FB5B4E5E8E4F242AB00C52CFF06E +77F323F785D42F5727EB0EB4267CF4B43C45CC3F5F898DF6E47DF1E3BCDFA32C +6354FF10AF2AFA95ACC0C87FD5649A4C311FFB7CF17AEDF22186A6927A08CCA4 +DF4A339412E323B07EC6A29532AF771E3CE5C39BD173B82207DF1F87E55B969E +FFFD59A78695DFA711BC20DF71CA13955452854F8378808AD167BECB7470D5BD +217212DCB886B5295FAD290139AA6559380056949AFE444F7C5DBE44E7804EB6 +A075697F7A69EA42147ACF1AB84084DE5EA5FFB355A927B77DC646970275A9FF +05FB84C9B2D2F52AE30FE5B7E35832991F159A419528B2CA39BBCD8F215D54A8 +B8C5CD777CB7FAAF086A5C06D4FB8B157E72E42CA9C0E109BD2270CF91BA8678 +1C9BEF2E8E0F54EBE69E9DBD5D7C20BD9FCC22E782FC9D9EDC420DA1914A158A +AB60234B944D4B534F57E11ABB32F481305CF2FCC696BD46F519C22C25A89DE6 +BC97294D816FC09276506BE4D69A89F99DC2DCE7CA9315FFD818BBCCFE39BBB6 +DB2E31FEA52729EA00495AE1EBFB32A737EB9127EF513F28869DA91E5779F90D +C8342F9243D645DC86F28DDA99791BD54FE9CA2479446F2F25EB82A40F006F6C +DBB7A98B407C16D196EE9B65351BE795693D86D234B38E2566CBF0263D9C13BD +87EFD910F953AB4CDA2CA351B74B30FBE79AFB86BBEC212E0DB9661F24A8E3D0 +81CDCF04D8323B4FEF99FEF72FEDF9EF6C2F8022585CF6CEBED03C0BBF7A58D4 +0B4D72B27E15EC0A20C960A20D0D63606517BBE8D7D72D31A30F583F64B97226 +B0D0EB7EC9BD7E99FA18CDE8B37663AB5558924AFC8AE0A429E435B79A6CFAD7 +A51970C7DD68505BA2FF91F7B1EE86FAACDBD10A50B7F928ED31743FAF44624D +D20FCA7D7FEB5A56D8DFD78D89AD89FA8D5D98F216CCB974A845545CD2276878 +0B5F184BDEF71ABAB21B71360448F6BA9B4C6F8A3B609DEA24675A11CCC78EDA +E3D094540F18F1DADF7E311F774CD06893C0486C57E56462E1C7777C5D09F747 +6EDFD5EA99D1B7DF40D116A270DDAE87057CBF78E1F09144A20CB2F2DD5EA497 +8C2F38B0C013AC73FC48FD1EB6FA4E0FAD127EB8E9421F36F0DF10E71FB2E475 +FFE72569A67E84929378F4146E2EB7893667990CE96BB85B995F1181888D3325 +2B9287DB524600D8592F71F0F3B2BB792A041D0E9CA93D63871E2C6B2A4E1DB6 +B6E0E528C594A75BD3F51A41572E753F364EEDC58E6317DDABD4F1F53416D466 +EFBCB92A7E82CB34DC62643AB6928A7C0A6E54DC5730CC8DC6C70B53FA3DCEC2 +CB11D40721D7479D8C28C385D957BE8E3FFF199519FB11B22B54C2BB7AD40D9C +214E22C93EEE97512014DE402097DF8D93579E91B995A24C89B2DB3FCDF2A2A2 +0799F032623EB41A74DAF015ADC00957421DFF0C8FE0A63435C22E8FA8A4E10A +F536E242654948423E11AC20D90A1438F0AE8210996863C01D45507A0CFE3446 +65DE4EF3EE70260C581F499F89FCC79F0590AB0DF78FA693DBC7F577B061A058 +02E3D3893ED18F8CEA394D943AE99F4A551129D46CC80805E00B6AA7F138C08A +1B111224F228C18966F0786716AE6F23C706AF10A364526105E290C4BB222220 +5D62147BD31BD973CE00B21FC890E405F6E05271FF249AB82E86715F5570D78F +AE61E3098253D4703AA38201A0DC339FE12AF47B2886D6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +cleartomark +%%EndResource +/F10_0 /LTWFJF+OurCharSet 1 1 +[ /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /space/exclam/quotedbl/numbersign/dollar/percent/ampersand/quoteright + /parenleft/parenright/asterisk/plus/comma/minus/period/slash + /zero/one/two/three/four/five/six/seven + /eight/nine/colon/semicolon/less/equal/greater/question + /at/A/B/C/D/E/F/G + /H/I/J/K/L/M/N/O + /P/Q/R/S/T/U/V/W + /X/Y/Z/bracketleft/backslash/bracketright/asciicircum/underscore + /quoteleft/a/b/c/d/e/f/g + /h/i/j/k/l/m/n/o + /p/q/r/s/t/u/v/w + /x/y/z/braceleft/bar/braceright/asciitilde/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/exclamdown/cent/sterling/fraction/yen/florin/section + /currency/quotesingle/quotedblleft/guillemotleft/guilsinglleft/guilsinglright/fi/fl + /.notdef/endash/dagger/daggerdbl/periodcentered/.notdef/paragraph/bullet + /quotesinglbase/quotedblbase/quotedblright/guillemotright/ellipsis/perthousand/.notdef/questiondown + /.notdef/grave/acute/circumflex/tilde/macron/breve/dotaccent + /dieresis/.notdef/ring/cedilla/.notdef/hungarumlaut/ogonek/caron + /emdash/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/AE/.notdef/ordfeminine/.notdef/.notdef/.notdef/.notdef + /Lslash/Oslash/OE/ordmasculine/.notdef/.notdef/.notdef/.notdef + /.notdef/ae/.notdef/.notdef/.notdef/dotlessi/.notdef/.notdef + /lslash/oslash/oe/germandbls/.notdef/.notdef/.notdef/.notdef] +pdfMakeFont +612 792 false pdfSetup +%%EndSetup +%%Page: 1 1 +%%BeginPageSetup +%%PageOrientation: Landscape +pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 README Page 1) 19.866 Tj +0 -3.92728 Td +(xv6 is a re-implementation of Dennis Ritchie's and Ken Thompson's Unix) 42.14 Tj +0 -5.23637 Td +(Version 6 \(v6\). xv6 loosely follows the structure and style of v6,) 40.334 Tj +0 -6.54546 Td +(but is implemented for a modern x86-based multiprocessor using ANSI C.) 42.14 Tj +0 -9.16364 Td +(ACKNOWLEDGEMENTS) 9.632 Tj +0 -11.7818 Td +(xv6 is inspired by John Lions' Commentary on UNIX 6th Edition \(Peer) 40.334 Tj +0 -13.0909 Td +(to Peer Communications; ISBN: 1-57398-013-7; 1st edition \(June 14,) 39.732 Tj +0 -14.4 Td +(2000\)\). See also http://pdos.csail.mit.edu/6.828/2006/v6.html, which) 40.936 Tj +0 -15.7091 Td +(provides pointers to on-line resources for v6.) 27.692 Tj +0 -18.3273 Td +(xv6 borrows code from the following sources:) 26.488 Tj +2.40798 -19.6364 Td +(JOS \(asm.h, elf.h, mmu.h, bootasm.S, ide.c, console.c, and others\)) 39.732 Tj +2.40798 -20.9455 Td +(Plan 9 \(bootother.S, mp.h, mp.c, ioapic.h, lapic.c\)) 30.702 Tj +2.40798 -22.2546 Td +(FreeBSD \(ioapic.c\)) 10.836 Tj +2.40798 -23.5636 Td +(NetBSD \(console.c\)) 10.836 Tj +0 -26.1818 Td +(The following people made contributions:) 24.08 Tj +2.40798 -27.4909 Td +(Russ Cox \(context switching, locking\)) 22.274 Tj +2.40798 -28.8 Td +(Cliff Frey \(MP\)) 9.03 Tj +2.40798 -30.1091 Td +(Xiao Yu \(MP\)) 7.224 Tj +0 -32.7273 Td +(The code in the files that constitute xv6 are ) 27.692 Tj +0 -34.0364 Td +(Copyright 2006 Frans Kaashoek, Robert Morris, and Russ Cox.) 35.518 Tj +0 -36.6545 Td +(ERROR REPORTS) 7.826 Tj +0 -39.2727 Td +(If you spot errors or have suggestions for improvement, please send) 40.334 Tj +0 -40.5818 Td +(email to Frans Kaashoek and Robert Morris) 24.682 Tj +0 -41.8909 Td +(\({kaashoek,rtm}@csail.mit.edu\). This version is the very first one,) 40.936 Tj +0 -43.2 Td +(so don't be surprised if there are errors or the code is unclear.) 39.13 Tj +0 -45.8182 Td +(BUIDLING AND RUNNING XV6) 14.448 Tj +0 -48.4364 Td +(To build xv6 on an x86 ELF machine \(like Linux or FreeBSD\), run "make".) 42.742 Tj +0 -49.7454 Td +(On non-x86 or non-ELF machines \(like OS X, even on x86\), you will) 39.13 Tj +0 -51.0545 Td +(need to install a cross-compiler gcc suite capable of producing x86 ELF) 42.742 Tj +0 -52.3636 Td +(binaries. See http://pdos.csail.mit.edu/6.828/2006/tools.html.) 37.926 Tj +0 -53.6727 Td +(Then run "make TOOLPREFIX=i386-jos-elf-".) 24.682 Tj +0 -56.2909 Td +(To run xv6, you can use Bochs or QEMU, both PC simulators. Bochs makes) 42.742 Tj +0 -57.6 Td +(debugging easier, but QEMU is much faster. ) 25.886 Tj +0 -58.9091 Td +(To run in Bochs, run "make bochs" and then type "c" at the bochs prompt.) 43.344 Tj +0 -60.2182 Td +(To run in QEMU, run "make qemu". Both log the xv6 screen output to ) 40.936 Tj +0 -61.5272 Td +(standard output.) 9.632 Tj +0 -64.1454 Td +(To create a typeset version of the code, run "make xv6.pdf".) 36.12 Tj +0 -65.4545 Td +(This requires the "mpage" text formatting utility.) 30.1 Tj +0 -66.7636 Td +(See http://www.mesa.nl/pub/mpage/.) 20.468 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 table of contents Page 1) 26.488 Tj +0 -3.92728 Td +(The numbers to the left of the file names in the table are sheet numbers.) 43.946 Tj +0 -5.23637 Td +(The source code has been printed in a double column format with fifty) 41.538 Tj +0 -6.54546 Td +(lines per column, giving one hundred lines per sheet \(or page\).) 37.926 Tj +0 -7.85455 Td +(Thus there is a convenient relationship between line numbers and sheet numbers.) 47.558 Tj +0 -13.0909 Td +(# basic headers) 9.03 Tj +14.4479 -13.0909 Td +(# processes) 6.622 Tj +28.8958 -13.0909 Td +(35 fs.h) 4.214 Tj +-0.0001 -14.4 Td +(01 types.h) 6.02 Tj +14.4478 -14.4 Td +(19 proc.h) 5.418 Tj +28.8957 -14.4 Td +(36 fsvar.h) 6.02 Tj +-0.0002 -15.7091 Td +(01 param.h) 6.02 Tj +14.4477 -15.7091 Td +(20 proc.c) 5.418 Tj +28.8956 -15.7091 Td +(37 ide.c) 4.816 Tj +-0.0003 -17.0182 Td +(02 defs.h) 5.418 Tj +14.4476 -17.0182 Td +(25 setjmp.S) 6.622 Tj +28.8955 -17.0182 Td +(39 bio.c) 4.816 Tj +-0.0004 -18.3273 Td +(03 x86.h) 4.816 Tj +14.4475 -18.3273 Td +(25 kalloc.c) 6.622 Tj +28.8954 -18.3273 Td +(40 fs.c) 4.214 Tj +-0.0005 -19.6364 Td +(05 asm.h) 4.816 Tj +28.8954 -19.6364 Td +(49 file.c) 5.418 Tj +-0.0005 -20.9455 Td +(06 mmu.h) 4.816 Tj +14.4474 -20.9455 Td +(# system calls) 8.428 Tj +28.8953 -20.9455 Td +(51 sysfile.c) 7.224 Tj +-0.0006 -22.2545 Td +(08 elf.h) 4.816 Tj +14.4473 -22.2545 Td +(27 syscall.h) 7.224 Tj +-0.0006 -23.5636 Td +(08 mp.h) 4.214 Tj +14.4473 -23.5636 Td +(27 trapasm.S) 7.224 Tj +28.8952 -23.5636 Td +(# pipes) 4.214 Tj +14.4473 -24.8727 Td +(28 traps.h) 6.02 Tj +28.8952 -24.8727 Td +(56 pipe.c) 5.418 Tj +-0.0007 -26.1818 Td +(# startup) 5.418 Tj +14.4472 -26.1818 Td +(28 trap.c) 5.418 Tj +-0.0007 -27.4909 Td +(10 bootasm.S) 7.224 Tj +14.4472 -27.4909 Td +(29 vectors.pl) 7.826 Tj +28.8951 -27.4909 Td +(# string operations) 11.438 Tj +-0.0008 -28.8 Td +(11 bootother.S) 8.428 Tj +14.4471 -28.8 Td +(30 syscall.c) 7.224 Tj +28.895 -28.8 Td +(57 string.c) 6.622 Tj +-0.0009 -30.1091 Td +(12 main.c) 5.418 Tj +14.447 -30.1091 Td +(32 sysproc.c) 7.224 Tj +-0.0009 -31.4182 Td +(14 mp.c) 4.214 Tj +28.895 -31.4182 Td +(# low-level PC) 8.428 Tj +-0.0009 -32.7273 Td +(16 init.c) 5.418 Tj +14.447 -32.7273 Td +(# file system) 7.826 Tj +28.8949 -32.7273 Td +(58 ioapic.h) 6.622 Tj +14.447 -34.0364 Td +(33 buf.h) 4.816 Tj +28.8949 -34.0364 Td +(59 lapic.c) 6.02 Tj +-0.001 -35.3454 Td +(# locks) 4.214 Tj +14.4469 -35.3454 Td +(33 dev.h) 4.816 Tj +28.8948 -35.3454 Td +(62 ioapic.c) 6.622 Tj +-0.0011 -36.6545 Td +(17 spinlock.h) 7.826 Tj +14.4468 -36.6545 Td +(34 fcntl.h) 6.02 Tj +28.8947 -36.6545 Td +(63 picirq.c) 6.622 Tj +-0.0012 -37.9636 Td +(17 spinlock.c) 7.826 Tj +14.4467 -37.9636 Td +(34 stat.h) 5.418 Tj +28.8946 -37.9636 Td +(64 console.c) 7.224 Tj +14.4467 -39.2727 Td +(35 file.h) 5.418 Tj +28.8946 -39.2727 Td +(68 8253pit.c) 7.224 Tj +-0.0013 -44.5091 Td +(The source listing is preceded by a cross-reference that lists every defined ) 46.354 Tj +-0.0013 -45.8182 Td +(constant, struct, global variable, and function in xv6. Each entry gives,) 44.548 Tj +-0.0013 -47.1273 Td +(on the same line as the name, the line number \(or, in a few cases, numbers\)) 45.15 Tj +-0.0013 -48.4363 Td +(where the name is defined. Successive lines in an entry list the line) 42.14 Tj +-0.0013 -49.7454 Td +(numbers where the name is used. For example, this entry:) 34.314 Tj +2.40669 -52.3636 Td +(namei 4610) 6.02 Tj +4.81468 -53.6727 Td +(0333 4610 4709 4758) 11.438 Tj +4.81468 -54.9818 Td +(4808 4857 4866 5264) 11.438 Tj +4.81468 -56.2909 Td +(5277 5362 5410 5490) 11.438 Tj +-0.0013 -58.9091 Td +(indicates that namei is defined on line 4610 and is mentioned on twelve lines) 46.354 Tj +-0.0013 -60.2181 Td +(on sheets 03, 46, 47, 48, 52, 53, and 54.) 24.682 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 2 2 +%%BeginPageSetup +%%PageOrientation: Landscape +__tumble pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 cross-references Page 1) 25.886 Tj +0 -3.92728 Td +(acquire 1805) 7.224 Tj +24.0799 -3.92728 Td +(4533) 2.408 Tj +2.408 -5.23637 Td +(0282 1805 1808 2111) 11.438 Tj +21.6719 -5.23637 Td +(B_BUSY 3308) 6.622 Tj +2.408 -6.54546 Td +(2215 2272 2313 2320) 11.438 Tj +24.0799 -6.54546 Td +(3308 3904 3905 3907) 11.438 Tj +2.408 -7.85455 Td +(2335 2355 2368 2403) 11.438 Tj +24.0799 -7.85455 Td +(3921 3923 3973 3978) 11.438 Tj +2.408 -9.16364 Td +(2431 2619 2667 3791) 11.438 Tj +24.0799 -9.16364 Td +(3981 3988 3989 4021) 11.438 Tj +2.408 -10.4727 Td +(3833 3969 4035 4190) 11.438 Tj +24.0799 -10.4727 Td +(4032 4044) 5.418 Tj +2.408 -11.7818 Td +(4327 4359 4442 4930) 11.438 Tj +21.6719 -11.7818 Td +(bfree 4152) 6.02 Tj +2.408 -13.0909 Td +(5004 5054 5663 5684) 11.438 Tj +24.0799 -13.0909 Td +(4152 4414 4420) 8.428 Tj +2.408 -14.4 Td +(5710 6509 6578 6747) 11.438 Tj +21.6719 -14.4 Td +(bget 3965) 5.418 Tj +2.408 -15.7091 Td +(6812) 2.408 Tj +24.0799 -15.7091 Td +(3908 3965 3996 4006) 11.438 Tj +0 -17.0182 Td +(allocproc 2080) 8.428 Tj +21.6719 -17.0182 Td +(binit 3944) 6.02 Tj +2.408 -18.3273 Td +(2080 2112) 5.418 Tj +24.0799 -18.3273 Td +(0316 1251 3944) 8.428 Tj +7.10543e-15 -19.6364 Td +(APBOOTCODE 1603) 9.03 Tj +21.6719 -19.6364 Td +(bmap 4369) 5.418 Tj +2.408 -20.9455 Td +(1603 1612 1621 1624) 11.438 Tj +24.0799 -20.9455 Td +(4369 4376 4380 4383) 11.438 Tj +2.408 -22.2545 Td +(1627) 2.408 Tj +24.0799 -22.2545 Td +(4389 4495 4572 4574) 11.438 Tj +1.42109e-14 -23.5636 Td +(APIC_ID_CLUSTER 5856) 12.04 Tj +24.0799 -23.5636 Td +(4664) 2.408 Tj +2.408 -24.8727 Td +(5856) 2.408 Tj +21.6719 -24.8727 Td +(bread 4002) 6.02 Tj +7.10543e-15 -26.1818 Td +(APIC_ID_CLUSTER_ID 5857) 13.846 Tj +24.0799 -26.1818 Td +(0319 3913 4002 4112) 11.438 Tj +2.408 -27.4909 Td +(5857) 2.408 Tj +24.0799 -27.4909 Td +(4120 4160 4165 4170) 11.438 Tj +7.10543e-15 -28.8 Td +(APIC_ID_CLUSTER_SHIFT 5860) 15.652 Tj +24.0799 -28.8 Td +(4223 4258 4282 4288) 11.438 Tj +2.408 -30.1091 Td +(5860) 2.408 Tj +24.0799 -30.1091 Td +(4384 4410 4495 4530) 11.438 Tj +7.10543e-15 -31.4182 Td +(APIC_ID_MASK 5854) 10.234 Tj +24.0799 -31.4182 Td +(4572 4664) 5.418 Tj +2.408 -32.7273 Td +(5854 5898) 5.418 Tj +21.6719 -32.7273 Td +(brelse 4030) 6.622 Tj +0 -34.0364 Td +(APIC_ID_SHIFT 5855) 10.836 Tj +24.0799 -34.0364 Td +(0321 3920 3924 4030) 11.438 Tj +2.408 -35.3454 Td +(5855 6245 6282) 8.428 Tj +24.0799 -35.3454 Td +(4033 4119 4133 4163) 11.438 Tj +0 -36.6545 Td +(APIC_MAX_CLUSTER 5858) 12.642 Tj +24.0799 -36.6545 Td +(4168 4175 4231 4267) 11.438 Tj +2.408 -37.9636 Td +(5858) 2.408 Tj +24.0799 -37.9636 Td +(4285 4293 4303 4387) 11.438 Tj +0 -39.2727 Td +(APIC_MAX_INTRACLUSTER_ID 5859) 17.458 Tj +24.0799 -39.2727 Td +(4418 4502 4539 4575) 11.438 Tj +2.408 -40.5818 Td +(5859) 2.408 Tj +24.0799 -40.5818 Td +(4675 4680) 5.418 Tj +0 -41.8909 Td +(APIC_VER_MAXLVT 5864) 12.04 Tj +21.6719 -41.8909 Td +(BSIZE 3557) 6.02 Tj +2.408 -43.2 Td +(5864) 2.408 Tj +24.0799 -43.2 Td +(3557 3569 3587 3593) 11.438 Tj +7.10543e-15 -44.5091 Td +(APIC_VER_VERSION 5863) 12.642 Tj +24.0799 -44.5091 Td +(4166 4495 4497 4498) 11.438 Tj +2.408 -45.8182 Td +(5863) 2.408 Tj +24.0799 -45.8182 Td +(4564 4571 4573 4582) 11.438 Tj +7.10543e-15 -47.1272 Td +(argfd 5120) 6.02 Tj +24.0799 -47.1272 Td +(4663 4664 4666) 8.428 Tj +2.408 -48.4363 Td +(5120 5207 5219 5230) 11.438 Tj +21.6719 -48.4363 Td +(buf 3300) 4.816 Tj +2.408 -49.7454 Td +(5445 5456) 5.418 Tj +24.0799 -49.7454 Td +(0317 0318 0319 0320) 11.438 Tj +7.10543e-15 -51.0545 Td +(argint 3052) 6.622 Tj +24.0799 -51.0545 Td +(0321 3010 3210 3300) 11.438 Tj +2.408 -52.3636 Td +(0246 3052 3068 3084) 11.438 Tj +24.0799 -52.3636 Td +(3304 3305 3902 3904) 11.438 Tj +2.408 -53.6727 Td +(3246 3263 5126 5207) 11.438 Tj +24.0799 -53.6727 Td +(3906 3907 3913 3916) 11.438 Tj +2.408 -54.9818 Td +(5219 5260 5326 5327) 11.438 Tj +24.0799 -54.9818 Td +(3924 3933 3935 3941) 11.438 Tj +2.408 -56.2909 Td +(5487) 2.408 Tj +24.0799 -56.2909 Td +(3946 3953 3964 3967) 11.438 Tj +7.10543e-15 -57.6 Td +(argptr 3063) 6.622 Tj +24.0799 -57.6 Td +(3979 4000 4001 4004) 11.438 Tj +2.408 -58.9091 Td +(0247 3063 5174 5207) 11.438 Tj +24.0799 -58.9091 Td +(4016 4019 4028 4030) 11.438 Tj +2.408 -60.2181 Td +(5219 5445) 5.418 Tj +24.0799 -60.2181 Td +(4045 4058 4105 4154) 11.438 Tj +7.10543e-15 -61.5272 Td +(argstr 3081) 6.622 Tj +24.0799 -61.5272 Td +(4188 4255 4280 4373) 11.438 Tj +2.408 -62.8363 Td +(0248 3081 5260 5326) 11.438 Tj +24.0799 -62.8363 Td +(4405 4486 4512 4559) 11.438 Tj +2.408 -64.1454 Td +(5359 5407 5434 5469) 11.438 Tj +24.0799 -64.1454 Td +(4617 5110 6475 6488) 11.438 Tj +2.408 -65.4545 Td +(5487) 2.408 Tj +24.0799 -65.4545 Td +(6491 6494 6574 6581) 11.438 Tj +7.10543e-15 -66.7636 Td +(balloc 4102) 6.622 Tj +21.6719 -66.7636 Td +(bufhead 3941) 7.224 Tj +2.408 -68.0727 Td +(4102 4129 4518 4525) 11.438 Tj +24.0799 -68.0727 Td +(3939 3940 3941 3951) 11.438 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 cross-references Page 2) 25.886 Tj +2.40799 -3.92728 Td +(3952 3954 3955 3956) 11.438 Tj +24.0799 -3.92728 Td +(1850 1854 1962 1972) 11.438 Tj +2.40799 -5.23637 Td +(3957 3972 3977 3987) 11.438 Tj +24.0799 -5.23637 Td +(2030 2061 2227 2229) 11.438 Tj +2.40799 -6.54546 Td +(4039 4040 4041 4042) 11.438 Tj +24.0799 -6.54546 Td +(2234 2251 2255 2259) 11.438 Tj +-1e-05 -7.85455 Td +(buf_table_lock 3936) 11.438 Tj +24.0799 -7.85455 Td +(2263 2270 2287 2305) 11.438 Tj +2.40799 -9.16364 Td +(3936 3948 3969 3979) 11.438 Tj +24.0799 -9.16364 Td +(2390 2428 2883 2902) 11.438 Tj +2.40799 -10.4727 Td +(3983 3992 4035 4047) 11.438 Tj +24.0799 -10.4727 Td +(2907 2932 2936 2938) 11.438 Tj +-1e-05 -11.7818 Td +(B_VALID 3309) 7.224 Tj +24.0799 -11.7818 Td +(2939 2944 2948 3054) 11.438 Tj +2.40799 -13.0909 Td +(3309 3904 3910 3912) 11.438 Tj +24.0799 -13.0909 Td +(3066 3086 3123 3222) 11.438 Tj +2.40799 -14.4 Td +(3973 3982 4007 4011) 11.438 Tj +24.0799 -14.4 Td +(3253 3261 4614 5124) 11.438 Tj +2.40799 -15.7091 Td +(4025) 2.408 Tj +24.0799 -15.7091 Td +(5156 5172 5232 5403) 11.438 Tj +-1e-05 -17.0182 Td +(bwrite 4019) 6.622 Tj +24.0799 -17.0182 Td +(5477 6151 6562) 8.428 Tj +2.40799 -18.3273 Td +(0320 3916 4019 4022) 11.438 Tj +21.6719 -18.3273 Td +(cpuid 0451) 6.02 Tj +2.40799 -19.6364 Td +(4132 4167 4174 4266) 11.438 Tj +24.0799 -19.6364 Td +(0451 0454 1315 1819) 11.438 Tj +2.40799 -20.9455 Td +(4302 4537 4574) 8.428 Tj +24.0799 -20.9455 Td +(1841) 2.408 Tj +-1e-05 -22.2545 Td +(cli 0479) 4.816 Tj +21.6719 -22.2545 Td +(devsw 3350) 6.02 Tj +2.40799 -23.5636 Td +(0479 0481 1022 1067) 11.438 Tj +24.0799 -23.5636 Td +(3350 3355 4489 4491) 11.438 Tj +2.40799 -24.8727 Td +(1122 1811 6436 6560) 11.438 Tj +24.0799 -24.8727 Td +(4555 4557 4914 6839) 11.438 Tj +-1e-05 -26.1818 Td +(cmpxchg 0468) 7.224 Tj +24.0799 -26.1818 Td +(6840) 2.408 Tj +2.40799 -27.4909 Td +(0468 1814) 5.418 Tj +21.6719 -27.4909 Td +(dinode 3573) 6.622 Tj +-1e-05 -28.8 Td +(CONSOLE 3357) 7.224 Tj +24.0799 -28.8 Td +(3573 3587 4187 4224) 11.438 Tj +2.40799 -30.1091 Td +(3357 6839 6840) 8.428 Tj +24.0799 -30.1091 Td +(4256 4259 4276 4289) 11.438 Tj +-1e-05 -31.4182 Td +(console_init 6834) 10.234 Tj +21.6719 -31.4182 Td +(dirent 3603) 6.622 Tj +2.40799 -32.7273 Td +(0206 1273 6834) 8.428 Tj +24.0799 -32.7273 Td +(3600 3603 4607 4618) 11.438 Tj +-1e-05 -34.0364 Td +(console_lock 6409) 10.234 Tj +24.0799 -34.0364 Td +(4665 4666 4719 4805) 11.438 Tj +2.40799 -35.3454 Td +(6409 6509 6551 6578) 11.438 Tj +24.0799 -35.3454 Td +(5356) 2.408 Tj +2.40799 -36.6545 Td +(6584 6836) 5.418 Tj +21.6719 -36.6545 Td +(DIRSIZ 3601) 6.622 Tj +-1e-05 -37.9636 Td +(console_read 6808) 10.234 Tj +24.0799 -37.9636 Td +(3601 3605 4660 4661) 11.438 Tj +2.40799 -39.2727 Td +(6808 6840) 5.418 Tj +24.0799 -39.2727 Td +(4671 4730 4732 5330) 11.438 Tj +-1e-05 -40.5818 Td +(console_write 6574) 10.836 Tj +24.0799 -40.5818 Td +(5375) 2.408 Tj +2.40799 -41.8909 Td +(6574 6839) 5.418 Tj +21.6719 -41.8909 Td +(disk_1_present 3737) 11.438 Tj +-1e-05 -43.2 Td +(cons_putc 6429) 8.428 Tj +24.0799 -43.2 Td +(3737 3762 3830) 8.428 Tj +2.40799 -44.5091 Td +(6429 6494 6518 6531) 11.438 Tj +21.6719 -44.5091 Td +(disk_queue 3738) 9.03 Tj +2.40799 -45.8182 Td +(6534 6539 6542 6543) 11.438 Tj +24.0799 -45.8182 Td +(3738 3837 3861) 8.428 Tj +2.40799 -47.1272 Td +(6581 6820) 5.418 Tj +21.6719 -47.1272 Td +(elfhdr 0805) 6.622 Tj +-1e-05 -48.4363 Td +(copyproc 2105) 7.826 Tj +24.0799 -48.4363 Td +(0805 1367 1370 5481) 11.438 Tj +2.40799 -49.7454 Td +(0215 1339 1345 1354) 11.438 Tj +21.6719 -49.7454 Td +(ELF_MAGIC 0802) 8.428 Tj +2.40799 -51.0545 Td +(2105 3222) 5.418 Tj +24.0799 -51.0545 Td +(0802 0806 1371 5497) 11.438 Tj +-1e-05 -52.3636 Td +(cprintf 6502) 7.224 Tj +21.6719 -52.3636 Td +(ELF_PROG_FLAG_EXEC 0839) 13.846 Tj +2.40799 -53.6727 Td +(0207 1244 1304 1573) 11.438 Tj +24.0799 -53.6727 Td +(0839) 2.408 Tj +2.40799 -54.9818 Td +(1575 2479 2588 2686) 11.438 Tj +21.6719 -54.9818 Td +(ELF_PROG_FLAG_READ 0841) 13.846 Tj +2.40799 -56.2909 Td +(2932 2938 2944 3186) 11.438 Tj +24.0799 -56.2909 Td +(0841) 2.408 Tj +2.40799 -57.6 Td +(4568 6247 6502 6562) 11.438 Tj +21.6719 -57.6 Td +(ELF_PROG_FLAG_WRITE 0840) 14.448 Tj +2.40799 -58.9091 Td +(6563 6564 6567 6786) 11.438 Tj +24.0799 -58.9091 Td +(0840) 2.408 Tj +-1e-05 -60.2181 Td +(cpu 1962 6151) 7.826 Tj +21.6719 -60.2181 Td +(ELF_PROG_LOAD 0836) 10.836 Tj +2.40799 -61.5272 Td +(0272 0277 1244 1289) 11.438 Tj +24.0799 -61.5272 Td +(0836 1379 5505 5572) 11.438 Tj +2.40799 -62.8363 Td +(1304 1306 1307 1308) 11.438 Tj +21.6719 -62.8363 Td +(fdalloc 5153) 7.224 Tj +2.40799 -64.1454 Td +(1316 1319 1431 1436) 11.438 Tj +24.0799 -64.1454 Td +(5153 5179 5290 5458) 11.438 Tj +2.40799 -65.4545 Td +(1616 1617 1629 1706) 11.438 Tj +21.6719 -65.4545 Td +(fetchint 3025) 7.826 Tj +2.40799 -66.7636 Td +(1767 1810 1812 1823) 11.438 Tj +24.0799 -66.7636 Td +(0244 3025 3056 5523) 11.438 Tj +2.40799 -68.0727 Td +(1824 1825 1837 1844) 11.438 Tj +24.0799 -68.0727 Td +(5553) 2.408 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 3 3 +%%BeginPageSetup +%%PageOrientation: Landscape +pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 cross-references Page 3) 25.886 Tj +0 -3.92728 Td +(fetchstr 3037) 7.826 Tj +24.0799 -3.92728 Td +(0611) 2.408 Tj +2.408 -5.23637 Td +(0245 3037 3086 5527) 11.438 Tj +21.6719 -5.23637 Td +(FL_ID 0624) 6.02 Tj +2.408 -6.54546 Td +(5554) 2.408 Tj +24.0799 -6.54546 Td +(0624) 2.408 Tj +0 -7.85455 Td +(file 3500) 5.418 Tj +21.6719 -7.85455 Td +(FL_IF 0610) 6.02 Tj +2.408 -9.16364 Td +(0292 0293 0300 0303) 11.438 Tj +24.0799 -9.16364 Td +(0610 0752 1351) 8.428 Tj +2.408 -10.4727 Td +(0304 0305 0306 0307) 11.438 Tj +21.6719 -10.4727 Td +(FL_IOPL_0 0614) 8.428 Tj +2.408 -11.7818 Td +(0308 0600 0800 1938) 11.438 Tj +24.0799 -11.7818 Td +(0614) 2.408 Tj +2.408 -13.0909 Td +(2004 2150 3014 3214) 11.438 Tj +21.6719 -13.0909 Td +(FL_IOPL_1 0615) 8.428 Tj +2.408 -14.4 Td +(3453 3454 3455 3500) 11.438 Tj +24.0799 -14.4 Td +(0615) 2.408 Tj +2.408 -15.7091 Td +(3550 3561 3577 3578) 11.438 Tj +21.6719 -15.7091 Td +(FL_IOPL_2 0616) 8.428 Tj +2.408 -17.0182 Td +(3600 3608 3650 4271) 11.438 Tj +24.0799 -17.0182 Td +(0616) 2.408 Tj +2.408 -18.3273 Td +(4308 4604 4907 4916) 11.438 Tj +21.6719 -18.3273 Td +(FL_IOPL_3 0617) 8.428 Tj +2.408 -19.6364 Td +(4924 4925 4932 4933) 11.438 Tj +24.0799 -19.6364 Td +(0617) 2.408 Tj +2.408 -20.9455 Td +(4934 4936 4950 4952) 11.438 Tj +21.6719 -20.9455 Td +(FL_IOPL_MASK 0613) 10.234 Tj +2.408 -22.2545 Td +(4972 4974 5000 5002) 11.438 Tj +24.0799 -22.2545 Td +(0613) 2.408 Tj +2.408 -23.5636 Td +(5010 5028 5030 5050) 11.438 Tj +21.6719 -23.5636 Td +(FL_NT 0618) 6.02 Tj +2.408 -24.8727 Td +(5052 5114 5117 5118) 11.438 Tj +24.0799 -24.8727 Td +(0618) 2.408 Tj +2.408 -26.1818 Td +(5120 5123 5150 5151) 11.438 Tj +21.6719 -26.1818 Td +(FL_OF 0612) 6.02 Tj +2.408 -27.4909 Td +(5153 5170 5203 5215) 11.438 Tj +24.0799 -27.4909 Td +(0612) 2.408 Tj +2.408 -28.8 Td +(5228 5257 5442 5453) 11.438 Tj +21.6719 -28.8 Td +(FL_PF 0605) 6.02 Tj +2.408 -30.1091 Td +(5606 5621 6415) 8.428 Tj +24.0799 -30.1091 Td +(0605) 2.408 Tj +7.10543e-15 -31.4182 Td +(filealloc 4926) 8.428 Tj +21.6719 -31.4182 Td +(FL_RF 0619) 6.02 Tj +2.408 -32.7273 Td +(0303 4926 5286 5626) 11.438 Tj +24.0799 -32.7273 Td +(0619) 2.408 Tj +2.408 -34.0364 Td +(5628) 2.408 Tj +21.6719 -34.0364 Td +(FL_SF 0608) 6.02 Tj +7.10543e-15 -35.3454 Td +(fileclose 5002) 8.428 Tj +24.0799 -35.3454 Td +(0608) 2.408 Tj +2.408 -36.6545 Td +(0304 2396 5002 5007) 11.438 Tj +21.6719 -36.6545 Td +(FL_TF 0609) 6.02 Tj +2.408 -37.9636 Td +(5021 5182 5183 5233) 11.438 Tj +24.0799 -37.9636 Td +(0609) 2.408 Tj +2.408 -39.2727 Td +(5292 5651 5655) 8.428 Tj +21.6719 -39.2727 Td +(FL_VIF 0622) 6.622 Tj +0 -40.5818 Td +(fileincref 5052) 9.03 Tj +24.0799 -40.5818 Td +(0622) 2.408 Tj +2.408 -41.8909 Td +(0308 2154 5052 5056) 11.438 Tj +21.6719 -41.8909 Td +(FL_VIP 0623) 6.622 Tj +2.408 -43.2 Td +(5460) 2.408 Tj +24.0799 -43.2 Td +(0623) 2.408 Tj +0 -44.5091 Td +(fileinit 4919) 7.826 Tj +21.6719 -44.5091 Td +(FL_VM 0620) 6.02 Tj +2.408 -45.8182 Td +(0302 1257 4919) 8.428 Tj +24.0799 -45.8182 Td +(0620) 2.408 Tj +7.10543e-15 -47.1272 Td +(fileread 4974) 7.826 Tj +21.6719 -47.1272 Td +(FL_ZF 0607) 6.02 Tj +2.408 -48.4363 Td +(0305 4974 4988 5221) 11.438 Tj +24.0799 -48.4363 Td +(0607) 2.408 Tj +1.42109e-14 -49.7454 Td +(filestat 5030) 7.826 Tj +21.6719 -49.7454 Td +(forkret 2281) 7.224 Tj +2.408 -51.0545 Td +(0307 5030 5447) 8.428 Tj +24.0799 -51.0545 Td +(2014 2145 2147 2281) 11.438 Tj +2.13163e-14 -52.3636 Td +(file_table_lock 4913) 12.04 Tj +21.6719 -52.3636 Td +(gatedesc 0728) 7.826 Tj +2.408 -53.6727 Td +(4913 4921 4930 4935) 11.438 Tj +24.0799 -53.6727 Td +(0414 0417 0728 2860) 11.438 Tj +2.408 -54.9818 Td +(4939 5004 5014 5024) 11.438 Tj +21.6719 -54.9818 Td +(getcallerpcs 1772) 10.234 Tj +2.408 -56.2909 Td +(5054 5058) 5.418 Tj +24.0799 -56.2909 Td +(0285 1772 1826 6565) 11.438 Tj +2.84217e-14 -57.6 Td +(filewrite 4952) 8.428 Tj +21.6719 -57.6 Td +(growproc 2059) 7.826 Tj +2.408 -58.9091 Td +(0306 4952 4967 5209) 11.438 Tj +24.0799 -58.9091 Td +(0217 2059 3265) 8.428 Tj +3.55271e-14 -60.2181 Td +(FL_AC 0621) 6.02 Tj +21.6719 -60.2181 Td +(holding 1852) 7.224 Tj +2.408 -61.5272 Td +(0621) 2.408 Tj +24.0799 -61.5272 Td +(0284 1706 1803 1807) 11.438 Tj +4.26326e-14 -62.8363 Td +(FL_AF 0606) 6.02 Tj +24.0799 -62.8363 Td +(1824 1833 1850 1852) 11.438 Tj +2.408 -64.1454 Td +(0606) 2.408 Tj +24.0799 -64.1454 Td +(2257 2283 3903) 8.428 Tj +4.26326e-14 -65.4545 Td +(FL_CF 0604) 6.02 Tj +21.6719 -65.4545 Td +(ialloc 4273) 6.622 Tj +2.408 -66.7636 Td +(0604) 2.408 Tj +24.0799 -66.7636 Td +(4273 4297 4776) 8.428 Tj +4.9738e-14 -68.0727 Td +(FL_DF 0611) 6.02 Tj +21.6719 -68.0727 Td +(IDE_BSY 3711) 7.224 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 cross-references Page 4) 25.886 Tj +2.40799 -3.92728 Td +(3711 3748) 5.418 Tj +24.0799 -3.92728 Td +(1585 3748 3778 6421) 11.438 Tj +-1e-05 -5.23637 Td +(IDE_CMD_READ 3716) 10.234 Tj +24.0799 -5.23637 Td +(6445 6447 6750 6753) 11.438 Tj +2.40799 -6.54546 Td +(3716 3816) 5.418 Tj +21.6719 -6.54546 Td +(INDIRECT 3568) 7.826 Tj +-1e-05 -7.85455 Td +(IDE_CMD_WRITE 3717) 10.836 Tj +24.0799 -7.85455 Td +(3568 4382 4384 4409) 11.438 Tj +2.40799 -9.16364 Td +(3717 3818) 5.418 Tj +24.0799 -9.16364 Td +(4410 4524 4528 4530) 11.438 Tj +-1e-05 -10.4727 Td +(idecref 4453) 7.224 Tj +24.0799 -10.4727 Td +(4537) 2.408 Tj +2.40799 -11.7818 Td +(0330 2400 4453 4867) 11.438 Tj +21.6719 -11.7818 Td +(initlock 1763) 7.826 Tj +2.40799 -13.0909 Td +(4871 5019 5423) 8.428 Tj +24.0799 -13.0909 Td +(0281 1763 2020 2584) 11.438 Tj +-1e-05 -14.4 Td +(IDE_DF 3713) 6.622 Tj +24.0799 -14.4 Td +(3758 3948 4086 4921) 11.438 Tj +2.40799 -15.7091 Td +(3713 3750) 5.418 Tj +24.0799 -15.7091 Td +(5636 6836 6837) 8.428 Tj +-1e-05 -17.0182 Td +(IDE_DRDY 3712) 7.826 Tj +21.6719 -17.0182 Td +(inode 3652) 6.02 Tj +2.40799 -18.3273 Td +(3712 3748) 5.418 Tj +24.0799 -18.3273 Td +(0326 0327 0328 0329) 11.438 Tj +-1e-05 -19.6364 Td +(IDE_ERR 3714) 7.224 Tj +24.0799 -19.6364 Td +(0330 0331 0332 0333) 11.438 Tj +2.40799 -20.9455 Td +(3714 3750) 5.418 Tj +24.0799 -20.9455 Td +(0334 0335 0336 0337) 11.438 Tj +-1e-05 -22.2545 Td +(ide_init 3756) 7.826 Tj +24.0799 -22.2545 Td +(0338 0340 1939 3506) 11.438 Tj +2.40799 -23.5636 Td +(0311 1274 3756) 8.428 Tj +24.0799 -23.5636 Td +(3572 3577 3589 3652) 11.438 Tj +-1e-05 -24.8727 Td +(ide_intr 3789) 7.826 Tj +24.0799 -24.8727 Td +(3656 3658 4063 4064) 11.438 Tj +2.40799 -26.1818 Td +(0312 2922 3789) 8.428 Tj +24.0799 -26.1818 Td +(4066 4068 4072 4074) 11.438 Tj +-1e-05 -27.4909 Td +(ide_lock 3735) 7.826 Tj +24.0799 -27.4909 Td +(4076 4078 4178 4179) 11.438 Tj +2.40799 -28.8 Td +(3723 3735 3758 3791) 11.438 Tj +24.0799 -28.8 Td +(4181 4183 4186 4194) 11.438 Tj +2.40799 -30.1091 Td +(3793 3833 3837 3851) 11.438 Tj +24.0799 -30.1091 Td +(4199 4200 4250 4253) 11.438 Tj +2.40799 -31.4182 Td +(3867) 2.408 Tj +24.0799 -31.4182 Td +(4270 4272 4275 4287) 11.438 Tj +-1e-05 -32.7273 Td +(ide_probe_disk1 3767) 12.04 Tj +24.0799 -32.7273 Td +(4290 4308 4310 4316) 11.438 Tj +2.40799 -34.0364 Td +(3740 3762 3767) 8.428 Tj +24.0799 -34.0364 Td +(4322 4354 4367 4369) 11.438 Tj +-1e-05 -35.3454 Td +(ide_request 3725) 9.632 Tj +24.0799 -35.3454 Td +(4400 4402 4432 4453) 11.438 Tj +2.40799 -36.6545 Td +(3725 3733 3804 3828) 11.438 Tj +24.0799 -36.6545 Td +(4461 4468 4470 4481) 11.438 Tj +-1e-05 -37.9636 Td +(ide_rw 3826) 6.622 Tj +24.0799 -37.9636 Td +(4483 4508 4510 4550) 11.438 Tj +2.40799 -39.2727 Td +(0313 3826 4010 4024) 11.438 Tj +24.0799 -39.2727 Td +(4552 4601 4602 4607) 11.438 Tj +-1e-05 -40.5818 Td +(ide_wait_ready 3744) 11.438 Tj +24.0799 -40.5818 Td +(4609 4611 4613 4716) 11.438 Tj +2.40799 -41.8909 Td +(3744 3761 3772 3808) 11.438 Tj +24.0799 -41.8909 Td +(4750 4752 4755 4768) 11.438 Tj +2.40799 -43.2 Td +(3855 3879 3889) 8.428 Tj +24.0799 -43.2 Td +(4769 4771 4772 4774) 11.438 Tj +-1e-05 -44.5091 Td +(ide_write 3872) 8.428 Tj +24.0799 -44.5091 Td +(4784 4800 4804 4850) 11.438 Tj +2.40799 -45.8182 Td +(3872 3877) 5.418 Tj +24.0799 -45.8182 Td +(4854 5253 5321 5353) 11.438 Tj +-1e-05 -47.1272 Td +(idtinit 2874) 7.224 Tj +24.0799 -47.1272 Td +(5354 5404 5480) 8.428 Tj +2.40799 -48.4363 Td +(0234 1256 1305 2874) 11.438 Tj +21.6719 -48.4363 Td +(inode_table_lock 4079) 12.642 Tj +-1e-05 -49.7454 Td +(ifree 4310) 6.02 Tj +24.0799 -49.7454 Td +(4079 4086 4190 4197) 11.438 Tj +2.40799 -51.0545 Td +(4310 4439) 5.418 Tj +24.0799 -51.0545 Td +(4198 4206 4221 4327) 11.438 Tj +-1e-05 -52.3636 Td +(iget 4184) 5.418 Tj +24.0799 -52.3636 Td +(4330 4333 4359 4364) 11.438 Tj +2.40799 -53.6727 Td +(0326 1336 4077 4184) 11.438 Tj +24.0799 -53.6727 Td +(4442 4448) 5.418 Tj +2.40799 -54.9818 Td +(4304 4630 4707 4826) 11.438 Tj +21.6719 -54.9818 Td +(insl 0362) 5.418 Tj +-1e-05 -56.2909 Td +(iincref 4461) 7.224 Tj +24.0799 -56.2909 Td +(0362 3856) 5.418 Tj +2.40799 -57.6 Td +(0331 2158 4461 4633) 11.438 Tj +21.6719 -57.6 Td +(ioapic 6207) 6.622 Tj +-1e-05 -58.9091 Td +(iinit 4084) 6.02 Tj +24.0799 -58.9091 Td +(0274 1523 1564 1565) 11.438 Tj +2.40799 -60.2181 Td +(0325 1258 4084) 8.428 Tj +24.0799 -60.2181 Td +(6205 6207 6217 6224) 11.438 Tj +-1e-05 -61.5272 Td +(ilock 4322) 6.02 Tj +24.0799 -61.5272 Td +(6233 6242 6271 6276) 11.438 Tj +2.40799 -62.8363 Td +(0327 4322 4325 4455) 11.438 Tj +21.6719 -62.8363 Td +(IOAPIC_ARB 5870) 9.03 Tj +2.40799 -64.1454 Td +(4463 4634 4876 4959) 11.438 Tj +24.0799 -64.1454 Td +(5870) 2.408 Tj +2.40799 -65.4545 Td +(4981 5033) 5.418 Tj +21.6719 -65.4545 Td +(IO_APIC_BASE 5850) 10.234 Tj +-1e-05 -66.7636 Td +(inb 0354) 4.816 Tj +24.0799 -66.7636 Td +(5850 6242 6276) 8.428 Tj +2.40799 -68.0727 Td +(0354 0357 1043 1051) 11.438 Tj +21.6719 -68.0727 Td +(ioapic_id 1434) 8.428 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 4 4 +%%BeginPageSetup +%%PageOrientation: Landscape +__tumble pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 cross-references Page 5) 25.886 Tj +2.40798 -3.92728 Td +(0275 1434 1565 6246) 11.438 Tj +21.6719 -3.92728 Td +(IOART_DESTPHY 5919) 10.836 Tj +2.40798 -5.23637 Td +(6247) 2.408 Tj +24.0799 -5.23637 Td +(5919) 2.408 Tj +-2e-05 -6.54546 Td +(ioapic_init 6231) 9.632 Tj +21.6719 -6.54546 Td +(IOART_INTAHI 5913) 10.234 Tj +2.40798 -7.85455 Td +(0276 1253 6231 6247) 11.438 Tj +24.0799 -7.85455 Td +(5913) 2.408 Tj +-2e-05 -9.16364 Td +(ioapic_read 6217) 9.632 Tj +21.6719 -9.16364 Td +(IOART_INTALO 5914) 10.234 Tj +2.40798 -10.4727 Td +(6217 6243 6245 6252) 11.438 Tj +24.0799 -10.4727 Td +(5914) 2.408 Tj +2.40798 -11.7818 Td +(6261 6277 6280) 8.428 Tj +21.6719 -11.7818 Td +(IOART_INTMASK 5902) 10.836 Tj +-2e-05 -13.0909 Td +(IOAPIC_REDTBL 5871) 10.836 Tj +24.0799 -13.0909 Td +(5902 6253 6278) 8.428 Tj +2.40798 -14.4 Td +(5871 5872 5873 5874) 11.438 Tj +21.6719 -14.4 Td +(IOART_INTMCLR 5903) 10.836 Tj +2.40798 -15.7091 Td +(5875 5876 5877 5878) 11.438 Tj +24.0799 -15.7091 Td +(5903) 2.408 Tj +2.40798 -17.0182 Td +(5879 5880 5881 5882) 11.438 Tj +21.6719 -17.0182 Td +(IOART_INTMSET 5904) 10.836 Tj +2.40798 -18.3273 Td +(5883 5884 5885 5886) 11.438 Tj +24.0799 -18.3273 Td +(5904 6254) 5.418 Tj +2.40798 -19.6364 Td +(5887 5888 5889 5890) 11.438 Tj +21.6719 -19.6364 Td +(IOART_INTPOL 5912) 10.234 Tj +2.40798 -20.9455 Td +(5891 5892 5893 5894) 11.438 Tj +24.0799 -20.9455 Td +(5912 6255) 5.418 Tj +2.40798 -22.2545 Td +(5895 6213) 5.418 Tj +21.6719 -22.2545 Td +(IOART_INTVEC 5932) 10.234 Tj +-2e-05 -23.5636 Td +(IOAPIC_REDTBL0 5872) 11.438 Tj +24.0799 -23.5636 Td +(5932) 2.408 Tj +2.40798 -24.8727 Td +(5872) 2.408 Tj +21.6719 -24.8727 Td +(IOART_REM_IRR 5910) 10.836 Tj +-2e-05 -26.1818 Td +(IOAPIC_VER 5869) 9.03 Tj +24.0799 -26.1818 Td +(5910) 2.408 Tj +2.40798 -27.4909 Td +(5869 6243) 5.418 Tj +21.6719 -27.4909 Td +(IOART_RESV 5900) 9.03 Tj +-2e-05 -28.8 Td +(IOAPIC_WINDOW 5851) 10.836 Tj +24.0799 -28.8 Td +(5900) 2.408 Tj +2.40798 -30.1091 Td +(5851) 2.408 Tj +21.6719 -30.1091 Td +(IOART_TRGREDG 5907) 10.836 Tj +-2e-05 -31.4182 Td +(ioapic_write 6224) 10.234 Tj +24.0799 -31.4182 Td +(5907) 2.408 Tj +2.40798 -32.7273 Td +(6224 6260 6263 6279) 11.438 Tj +21.6719 -32.7273 Td +(IOART_TRGRLVL 5908) 10.836 Tj +2.40798 -34.0364 Td +(6283) 2.408 Tj +24.0799 -34.0364 Td +(5908) 2.408 Tj +-2e-05 -35.3454 Td +(IOART_DELEXINT 5930) 11.438 Tj +21.6719 -35.3454 Td +(IOART_TRGRMOD 5906) 10.836 Tj +2.40798 -36.6545 Td +(5930) 2.408 Tj +24.0799 -36.6545 Td +(5906 6256) 5.418 Tj +-2e-05 -37.9636 Td +(IOART_DELFIXED 5923) 11.438 Tj +21.6719 -37.9636 Td +(IOART_VER_MAXREDIR 5936) 13.846 Tj +2.40798 -39.2727 Td +(5923) 2.408 Tj +24.0799 -39.2727 Td +(5936 6244) 5.418 Tj +-2e-05 -40.5818 Td +(IOART_DELINIT 5928) 10.836 Tj +21.6719 -40.5818 Td +(IOART_VER_VERSION 5935) 13.244 Tj +2.40798 -41.8909 Td +(5928) 2.408 Tj +24.0799 -41.8909 Td +(5935) 2.408 Tj +-2e-05 -43.2 Td +(IOART_DELIVS 5916) 10.234 Tj +21.6719 -43.2 Td +(IO_PIC1 6306) 7.224 Tj +2.40798 -44.5091 Td +(5916) 2.408 Tj +24.0799 -44.5091 Td +(6306 6320 6335 6344) 11.438 Tj +-2e-05 -45.8182 Td +(IOART_DELLOPRI 5924) 11.438 Tj +24.0799 -45.8182 Td +(6347 6352 6362 6376) 11.438 Tj +2.40798 -47.1272 Td +(5924) 2.408 Tj +24.0799 -47.1272 Td +(6377) 2.408 Tj +-2e-05 -48.4363 Td +(IOART_DELMOD 5922) 10.234 Tj +21.6719 -48.4363 Td +(IO_PIC2 6307) 7.224 Tj +2.40798 -49.7454 Td +(5922 6257) 5.418 Tj +24.0799 -49.7454 Td +(6307 6321 6336 6365) 11.438 Tj +-2e-05 -51.0545 Td +(IOART_DELNMI 5927) 10.234 Tj +24.0799 -51.0545 Td +(6366 6367 6370 6379) 11.438 Tj +2.40798 -52.3636 Td +(5927) 2.408 Tj +24.0799 -52.3636 Td +(6380) 2.408 Tj +-2e-05 -53.6727 Td +(IOART_DELRSV1 5926) 10.836 Tj +21.6719 -53.6727 Td +(IO_TIMER1 6858) 8.428 Tj +2.40798 -54.9818 Td +(5926) 2.408 Tj +24.0799 -54.9818 Td +(6858 6867 6868 6869) 11.438 Tj +-2e-05 -56.2909 Td +(IOART_DELRSV2 5929) 10.836 Tj +24.0799 -56.2909 Td +(6870 6891 6892) 8.428 Tj +2.40798 -57.6 Td +(5929) 2.408 Tj +21.6719 -57.6 Td +(IO_TIMER2 6859) 8.428 Tj +-2e-05 -58.9091 Td +(IOART_DELSMI 5925) 10.234 Tj +24.0799 -58.9091 Td +(6859) 2.408 Tj +2.40798 -60.2181 Td +(5925) 2.408 Tj +21.6719 -60.2181 Td +(iput 4432) 5.418 Tj +-2e-05 -61.5272 Td +(IOART_DEST 5898) 9.03 Tj +24.0799 -61.5272 Td +(0332 4182 4432 4435) 11.438 Tj +2.40798 -62.8363 Td +(5898 6262 6281) 8.428 Tj +24.0799 -62.8363 Td +(4456 4648 4653 4688) 11.438 Tj +-2e-05 -64.1454 Td +(IOART_DESTLOG 5920) 10.836 Tj +24.0799 -64.1454 Td +(4695 4706 4763 4824) 11.438 Tj +2.40798 -65.4545 Td +(5920) 2.408 Tj +24.0799 -65.4545 Td +(4834 4860 4872 4881) 11.438 Tj +-2e-05 -66.7636 Td +(IOART_DESTMOD 5918) 10.836 Tj +24.0799 -66.7636 Td +(4882 5267 5273 5282) 11.438 Tj +2.40798 -68.0727 Td +(5918 6258) 5.418 Tj +24.0799 -68.0727 Td +(5287 5291 5335 5368) 11.438 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 cross-references Page 6) 25.886 Tj +2.40799 -3.92728 Td +(5384 5385 5414 5419) 11.438 Tj +21.6719 -3.92728 Td +(KBDATAP 6602) 7.224 Tj +2.40799 -5.23637 Td +(5581 5592 5596) 8.428 Tj +24.0799 -5.23637 Td +(6602 6753) 5.418 Tj +-1e-05 -6.54546 Td +(irq_enable 6325) 9.03 Tj +21.6719 -6.54546 Td +(KBD_BUF 6735) 7.224 Tj +2.40799 -7.85455 Td +(0252 3759 6325 6842) 11.438 Tj +24.0799 -7.85455 Td +(6735 6736 6794 6796) 11.438 Tj +2.40799 -9.16364 Td +(6893) 2.408 Tj +24.0799 -9.16364 Td +(6824) 2.408 Tj +-1e-05 -10.4727 Td +(IRQ_ERROR 2834) 8.428 Tj +21.6719 -10.4727 Td +(kbd_intr 6743) 7.826 Tj +2.40799 -11.7818 Td +(2834 6109) 5.418 Tj +24.0799 -11.7818 Td +(0209 2927 6743) 8.428 Tj +-1e-05 -13.0909 Td +(IRQ_IDE 2833) 7.224 Tj +21.6719 -13.0909 Td +(kbd_lock 6739) 7.826 Tj +2.40799 -14.4 Td +(2833 2921 3759 3760) 11.438 Tj +24.0799 -14.4 Td +(6739 6747 6804 6812) 11.438 Tj +-1e-05 -15.7091 Td +(IRQ_KBD 2832) 7.224 Tj +24.0799 -15.7091 Td +(6815 6828 6837) 8.428 Tj +2.40799 -17.0182 Td +(2832 2926 6842 6843) 11.438 Tj +21.6719 -17.0182 Td +(kbd_r 6737) 6.02 Tj +-1e-05 -18.3273 Td +(IRQ_OFFSET 2829) 9.03 Tj +24.0799 -18.3273 Td +(6737 6794 6798 6814) 11.438 Tj +2.40799 -19.6364 Td +(2829 2905 2921 2926) 11.438 Tj +24.0799 -19.6364 Td +(6815 6818 6819 6823) 11.438 Tj +2.40799 -20.9455 Td +(2931 6073 6099 6109) 11.438 Tj +24.0799 -20.9455 Td +(6824 6825) 5.418 Tj +2.40799 -22.2545 Td +(6259 6347 6366) 8.428 Tj +21.6719 -22.2545 Td +(kbd_w 6738) 6.02 Tj +-1e-05 -23.5636 Td +(irq_setmask_8259A 6316) 13.244 Tj +24.0799 -23.5636 Td +(6738 6794 6795 6796) 11.438 Tj +2.40799 -24.8727 Td +(6316 6327 6383) 8.428 Tj +24.0799 -24.8727 Td +(6797 6814 6818) 8.428 Tj +-1e-05 -26.1818 Td +(IRQ_SLAVE 6309) 8.428 Tj +21.6719 -26.1818 Td +(KBS_DIB 6601) 7.224 Tj +2.40799 -27.4909 Td +(6309 6313 6352 6367) 11.438 Tj +24.0799 -27.4909 Td +(6601 6751) 5.418 Tj +-1e-05 -28.8 Td +(IRQ_SPURIOUS 2835) 10.234 Tj +21.6719 -28.8 Td +(KBSTATP 6600) 7.224 Tj +2.40799 -30.1091 Td +(2835 2931 6099) 8.428 Tj +24.0799 -30.1091 Td +(6600 6750) 5.418 Tj +-1e-05 -31.4182 Td +(IRQ_TIMER 2831) 8.428 Tj +21.6719 -31.4182 Td +(KEY_DEL 6626) 7.224 Tj +2.40799 -32.7273 Td +(2831 2905 6073 6893) 11.438 Tj +24.0799 -32.7273 Td +(6626 6674 6701 6725) 11.438 Tj +-1e-05 -34.0364 Td +(ismp 1432) 5.418 Tj +21.6719 -34.0364 Td +(KEY_DN 6620) 6.622 Tj +2.40799 -35.3454 Td +(0258 1280 1432 1533) 11.438 Tj +24.0799 -35.3454 Td +(6620 6671 6698 6722) 11.438 Tj +2.40799 -36.6545 Td +(1595 6239 6273) 8.428 Tj +21.6719 -36.6545 Td +(KEY_END 6618) 7.224 Tj +-1e-05 -37.9636 Td +(itrunc 4402) 6.622 Tj +24.0799 -37.9636 Td +(6618 6670 6697 6721) 11.438 Tj +2.40799 -39.2727 Td +(0329 4402 4438) 8.428 Tj +21.6719 -39.2727 Td +(KEY_HOME 6617) 7.826 Tj +-1e-05 -40.5818 Td +(iunlock 4354) 7.224 Tj +24.0799 -40.5818 Td +(6617 6663 6690 6715) 11.438 Tj +2.40799 -41.8909 Td +(0328 1337 4354 4357) 11.438 Tj +21.6719 -41.8909 Td +(KEY_INS 6625) 7.224 Tj +2.40799 -43.2 Td +(4465 4864 4964 4985) 11.438 Tj +24.0799 -43.2 Td +(6625 6673 6700 6724) 11.438 Tj +2.40799 -44.5091 Td +(5035 5300 5425) 8.428 Tj +21.6719 -44.5091 Td +(KEY_LF 6621) 6.622 Tj +-1e-05 -45.8182 Td +(iupdate 4253) 7.224 Tj +24.0799 -45.8182 Td +(6621 6668 6695 6719) 11.438 Tj +2.40799 -47.1272 Td +(0340 4253 4313 4425) 11.438 Tj +21.6719 -47.1272 Td +(KEY_PGDN 6624) 7.826 Tj +2.40799 -48.4363 Td +(4586 4784 4823 4833) 11.438 Tj +24.0799 -48.4363 Td +(6624 6672 6699 6723) 11.438 Tj +2.40799 -49.7454 Td +(4878 5373) 5.418 Tj +21.6719 -49.7454 Td +(KEY_PGUP 6623) 7.826 Tj +-1e-05 -51.0545 Td +(jmpbuf 1915) 6.622 Tj +24.0799 -51.0545 Td +(6623 6667 6694 6718) 11.438 Tj +2.40799 -52.3636 Td +(0228 0229 0230 1266) 11.438 Tj +21.6719 -52.3636 Td +(KEY_RT 6622) 6.622 Tj +2.40799 -53.6727 Td +(1267 1914 1915 1940) 11.438 Tj +24.0799 -53.6727 Td +(6622 6669 6696 6720) 11.438 Tj +2.40799 -54.9818 Td +(1964 2145 2146 2147) 11.438 Tj +21.6719 -54.9818 Td +(KEY_UP 6619) 6.622 Tj +2.40799 -56.2909 Td +(2148 2229 2230 2262) 11.438 Tj +24.0799 -56.2909 Td +(6619 6666 6693 6717) 11.438 Tj +2.40799 -57.6 Td +(2263 2500 2501) 8.428 Tj +21.6719 -57.6 Td +(kfree 2605) 6.02 Tj +-1e-05 -58.9091 Td +(kalloc 2660) 6.622 Tj +24.0799 -58.9091 Td +(0202 2071 2132 2442) 11.438 Tj +2.40799 -60.2181 Td +(0200 0201 1263 1342) 11.438 Tj +24.0799 -60.2181 Td +(2443 2589 2605 2613) 11.438 Tj +2.40799 -61.5272 Td +(2064 2122 2130 2584) 11.438 Tj +24.0799 -61.5272 Td +(5563 5591 5648 5676) 11.438 Tj +2.40799 -62.8363 Td +(2602 2660 2665 2686) 11.438 Tj +21.6719 -62.8363 Td +(kinit 2578) 6.02 Tj +2.40799 -64.1454 Td +(5515 5630) 5.418 Tj +24.0799 -64.1454 Td +(0203 1254 2578 2603) 11.438 Tj +-1e-05 -65.4545 Td +(kalloc_lock 2565) 9.632 Tj +21.6719 -65.4545 Td +(KSTACKSIZE 0152) 9.03 Tj +2.40799 -66.7636 Td +(2565 2584 2619 2653) 11.438 Tj +24.0799 -66.7636 Td +(0152 1263 1267 2034) 11.438 Tj +2.40799 -68.0727 Td +(2667 2674 2680 2685) 11.438 Tj +24.0799 -68.0727 Td +(2130 2139 2443) 8.428 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 5 5 +%%BeginPageSetup +%%PageOrientation: Landscape +pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 cross-references Page 7) 25.886 Tj +0 -3.92728 Td +(lapic_disableintr 6129) 13.244 Tj +24.0799 -3.92728 Td +(0239 1387 1612 2067) 11.438 Tj +2.408 -5.23637 Td +(0270 6129) 5.418 Tj +24.0799 -5.23637 Td +(2127 2140 4230 4265) 11.438 Tj +0 -6.54546 Td +(lapic_enableintr 6122) 12.642 Tj +24.0799 -6.54546 Td +(4498 4573 5555 5780) 11.438 Tj +2.408 -7.85455 Td +(0269 1286 1310 6122) 11.438 Tj +24.0799 -7.85455 Td +(6461) 2.408 Tj +0 -9.16364 Td +(lapic_eoi 6136) 8.428 Tj +21.6719 -9.16364 Td +(memset 5754) 6.622 Tj +2.408 -10.4727 Td +(0271 2923 2928 6136) 11.438 Tj +24.0799 -10.4727 Td +(0237 1229 1348 1388) 11.438 Tj +7.10543e-15 -11.7818 Td +(lapic_init 6086) 9.03 Tj +24.0799 -11.7818 Td +(2068 2146 4166 4300) 11.438 Tj +2.408 -13.0909 Td +(0265 1242 1308 6086) 11.438 Tj +24.0799 -13.0909 Td +(4819 5375 5518 5578) 11.438 Tj +7.10543e-15 -14.4 Td +(lapic_read 6053) 9.03 Tj +24.0799 -14.4 Td +(5754 6463) 5.418 Tj +2.408 -15.7091 Td +(6053 6094 6106 6111) 11.438 Tj +21.6719 -15.7091 Td +(mknod 4753) 6.02 Tj +2.408 -17.0182 Td +(6117 6155) 5.418 Tj +24.0799 -17.0182 Td +(0337 1666 4753 5333) 11.438 Tj +7.10543e-15 -18.3273 Td +(lapic_startap 6162) 10.836 Tj +21.6719 -18.3273 Td +(mknod1 4772) 6.622 Tj +2.408 -19.6364 Td +(0266 1627 6162) 8.428 Tj +24.0799 -19.6364 Td +(0338 4761 4772 5266) 11.438 Tj +1.42109e-14 -20.9455 Td +(lapic_timerinit 6066) 12.04 Tj +24.0799 -20.9455 Td +(5366) 2.408 Tj +2.408 -22.2545 Td +(0267 1281 1309 6066) 11.438 Tj +21.6719 -22.2545 Td +(mp 0852) 4.214 Tj +7.10543e-15 -23.5636 Td +(lapic_timerintr 6079) 12.04 Tj +24.0799 -23.5636 Td +(0257 0852 1111 1112) 11.438 Tj +2.408 -24.8727 Td +(0268 2906 6079) 8.428 Tj +24.0799 -24.8727 Td +(1401 1437 1439 1446) 11.438 Tj +7.10543e-15 -26.1818 Td +(lapic_write 6059) 9.632 Tj +24.0799 -26.1818 Td +(1450 1453 1463 1468) 11.438 Tj +2.408 -27.4909 Td +(6059 6071 6072 6074) 11.438 Tj +24.0799 -27.4909 Td +(1472 1473 1477 1478) 11.438 Tj +2.408 -28.8 Td +(6075 6082 6093 6095) 11.438 Tj +24.0799 -28.8 Td +(1495 1500 1539 1582) 11.438 Tj +2.408 -30.1091 Td +(6096 6099 6101 6102) 11.438 Tj +24.0799 -30.1091 Td +(5951 6201) 5.418 Tj +2.408 -31.4182 Td +(6104 6108 6109 6110) 11.438 Tj +21.6719 -31.4182 Td +(mp_bcpu 1593) 7.224 Tj +2.408 -32.7273 Td +(6114 6115 6125 6132) 11.438 Tj +24.0799 -32.7273 Td +(0261 1236 1593) 8.428 Tj +2.408 -34.0364 Td +(6139 6168 6169 6173) 11.438 Tj +21.6719 -34.0364 Td +(mpbe 0888) 5.418 Tj +2.408 -35.3454 Td +(6180 6181) 5.418 Tj +24.0799 -35.3454 Td +(0888 1522 1556 1561) 11.438 Tj +7.10543e-15 -36.6545 Td +(lgdt 0403) 5.418 Tj +21.6719 -36.6545 Td +(mpctb 0863) 6.02 Tj +2.408 -37.9636 Td +(0403 0411 1068 1144) 11.438 Tj +24.0799 -37.9636 Td +(0863 1491 1500 1520) 11.438 Tj +2.408 -39.2727 Td +(2052) 2.408 Tj +24.0799 -39.2727 Td +(1539 1540 1541 1542) 11.438 Tj +1.42109e-14 -40.5818 Td +(lidt 0417) 5.418 Tj +21.6719 -40.5818 Td +(mp_detect 1489) 8.428 Tj +2.408 -41.8909 Td +(0417 0425 2876) 8.428 Tj +24.0799 -41.8909 Td +(1489 1529) 5.418 Tj +2.13163e-14 -43.2 Td +(link 4852) 5.418 Tj +21.6719 -43.2 Td +(mpie 0908) 5.418 Tj +2.408 -44.5091 Td +(0341 0688 4850 4852) 11.438 Tj +24.0799 -44.5091 Td +(0908 1524 1569 1570) 11.438 Tj +2.408 -45.8182 Td +(5471) 2.408 Tj +21.6719 -45.8182 Td +(mp_init 1516) 7.224 Tj +2.13163e-14 -47.1272 Td +(load_icode 1364) 9.03 Tj +24.0799 -47.1272 Td +(0259 1235 1516 1573) 11.438 Tj +2.408 -48.4363 Td +(0288 1356 1364 1372) 11.438 Tj +21.6719 -48.4363 Td +(mpioapic 0900) 7.826 Tj +2.408 -49.7454 Td +(1382 1384) 5.418 Tj +24.0799 -49.7454 Td +(0900 1523 1564 1566) 11.438 Tj +2.13163e-14 -51.0545 Td +(lpt_putc 6417) 7.826 Tj +21.6719 -51.0545 Td +(mpmain 1302) 6.622 Tj +2.408 -52.3636 Td +(6417 6441) 5.418 Tj +24.0799 -52.3636 Td +(1302 1307 1600 1624) 11.438 Tj +2.84217e-14 -53.6727 Td +(ltr 0429) 4.816 Tj +21.6719 -53.6727 Td +(mppe 0878) 5.418 Tj +2.408 -54.9818 Td +(0429 0431 2053) 8.428 Tj +24.0799 -54.9818 Td +(0878 1521 1547 1553) 11.438 Tj +3.55271e-14 -56.2909 Td +(main0 1222) 6.02 Tj +21.6719 -56.2909 Td +(mp_scan 1440) 7.224 Tj +2.408 -57.6 Td +(1218 1222) 5.418 Tj +24.0799 -57.6 Td +(1440 1472 1477 1480) 11.438 Tj +4.26326e-14 -58.9091 Td +(MAXLVTSHIFT 5865) 9.632 Tj +21.6719 -58.9091 Td +(mp_search 1464) 8.428 Tj +2.408 -60.2181 Td +(5865) 2.408 Tj +24.0799 -60.2181 Td +(1464 1495) 5.418 Tj +4.9738e-14 -61.5272 Td +(MAXREDIRSHIFT 5937) 10.836 Tj +21.6719 -61.5272 Td +(MPSTACK 1959) 7.224 Tj +2.408 -62.8363 Td +(5937 6244) 5.418 Tj +24.0799 -62.8363 Td +(1239 1240 1621 1959) 11.438 Tj +5.68434e-14 -64.1454 Td +(memcmp 5765) 6.622 Tj +24.0799 -64.1454 Td +(1967) 2.408 Tj +2.408 -65.4545 Td +(0238 1447 1501 4670) 11.438 Tj +21.6719 -65.4545 Td +(mp_startthem 1606) 10.234 Tj +2.408 -66.7636 Td +(5765) 2.408 Tj +24.0799 -66.7636 Td +(0260 1277 1606) 8.428 Tj +5.68434e-14 -68.0727 Td +(memmove 5780) 7.224 Tj +21.6719 -68.0727 Td +(namei 4610) 6.02 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 cross-references Page 8) 25.886 Tj +2.40799 -3.92728 Td +(0333 4610 4709 4758) 11.438 Tj +21.6719 -3.92728 Td +(O_RDWR 3403) 6.622 Tj +2.40799 -5.23637 Td +(4808 4857 4866 5264) 11.438 Tj +24.0799 -5.23637 Td +(1665 1667 3403 5281) 11.438 Tj +2.40799 -6.54546 Td +(5277 5362 5410 5490) 11.438 Tj +24.0799 -6.54546 Td +(5302) 2.408 Tj +-1e-05 -7.85455 Td +(NAMEI_CREATE 3669) 10.234 Tj +21.6719 -7.85455 Td +(outb 0371) 5.418 Tj +2.40799 -9.16364 Td +(3669 4602 4644 4686) 11.438 Tj +24.0799 -9.16364 Td +(0371 0373 1047 1055) 11.438 Tj +2.40799 -10.4727 Td +(4758 4866 5264 5362) 11.438 Tj +24.0799 -10.4727 Td +(1584 1587 3775 3782) 11.438 Tj +-1e-05 -11.7818 Td +(NAMEI_DELETE 3670) 10.234 Tj +24.0799 -11.7818 Td +(3809 3810 3811 3812) 11.438 Tj +2.40799 -13.0909 Td +(3670 4607 4701 4808) 11.438 Tj +24.0799 -13.0909 Td +(3813 3814 3816 3818) 11.438 Tj +-1e-05 -14.4 Td +(NAMEI_LOOKUP 3668) 10.234 Tj +24.0799 -14.4 Td +(3881 3882 3883 3884) 11.438 Tj +2.40799 -15.7091 Td +(3668 4601 4642 4857) 11.438 Tj +24.0799 -15.7091 Td +(3885 3886 6320 6321) 11.438 Tj +2.40799 -17.0182 Td +(5277 5410 5490) 8.428 Tj +24.0799 -17.0182 Td +(6335 6336 6344 6347) 11.438 Tj +-1e-05 -18.3273 Td +(NBUF 0157) 5.418 Tj +24.0799 -18.3273 Td +(6352 6362 6365 6366) 11.438 Tj +2.40799 -19.6364 Td +(0157 3935 3953) 8.428 Tj +24.0799 -19.6364 Td +(6367 6370 6376 6377) 11.438 Tj +-1e-05 -20.9455 Td +(NCPU 0153) 5.418 Tj +24.0799 -20.9455 Td +(6379 6380 6423 6424) 11.438 Tj +2.40799 -22.2545 Td +(0153 1232 1431 1957) 11.438 Tj +24.0799 -22.2545 Td +(6425 6444 6446 6466) 11.438 Tj +2.40799 -23.5636 Td +(1972 2012) 5.418 Tj +24.0799 -23.5636 Td +(6467 6468 6469 6890) 11.438 Tj +-1e-05 -24.8727 Td +(NDEV 0159) 5.418 Tj +24.0799 -24.8727 Td +(6891 6892) 5.418 Tj +2.40799 -26.1818 Td +(0159 4489 4555 4914) 11.438 Tj +21.6719 -26.1818 Td +(outsl 0383) 6.02 Tj +-1e-05 -27.4909 Td +(NDIRECT 3567) 7.224 Tj +24.0799 -27.4909 Td +(0383 3819 3891) 8.428 Tj +2.40799 -28.8 Td +(3566 3567 3570 4377) 11.438 Tj +21.6719 -28.8 Td +(outw 0377) 5.418 Tj +2.40799 -30.1091 Td +(4386 4516 4532 4536) 11.438 Tj +24.0799 -30.1091 Td +(0377 0379) 5.418 Tj +-1e-05 -31.4182 Td +(newblock 4510) 7.826 Tj +21.6719 -31.4182 Td +(O_WRONLY 3402) 7.826 Tj +2.40799 -32.7273 Td +(4510 4567 4568) 8.428 Tj +24.0799 -32.7273 Td +(3402 5281 5305) 8.428 Tj +-1e-05 -34.0364 Td +(NFILE 0155) 6.02 Tj +21.6719 -34.0364 Td +(PAGE 0151) 5.418 Tj +2.40799 -35.3454 Td +(0155 4916 4931) 8.428 Tj +24.0799 -35.3454 Td +(0151 0152 1341 2586) 11.438 Tj +-1e-05 -36.6545 Td +(NINODE 0158) 6.622 Tj +24.0799 -36.6545 Td +(2588 2589 2612 2664) 11.438 Tj +2.40799 -37.9636 Td +(0158 4078 4194) 8.428 Tj +24.0799 -37.9636 Td +(5630 5648 5676) 8.428 Tj +-1e-05 -39.2727 Td +(NO 6604) 4.214 Tj +21.6719 -39.2727 Td +(panic 6555) 6.02 Tj +2.40799 -40.5818 Td +(6604 6652 6655 6657) 11.438 Tj +24.0799 -40.5818 Td +(0208 1307 1360 1372) 11.438 Tj +2.40799 -41.8909 Td +(6658 6659 6660 6662) 11.438 Tj +24.0799 -41.8909 Td +(1382 1384 1808 1834) 11.438 Tj +2.40799 -43.2 Td +(6679 6682 6684 6685) 11.438 Tj +24.0799 -43.2 Td +(2258 2260 2308 2311) 11.438 Tj +2.40799 -44.5091 Td +(6686 6687 6689 6708) 11.438 Tj +24.0799 -44.5091 Td +(2419 2613 2625 2665) 11.438 Tj +2.40799 -45.8182 Td +(6709 6711 6712 6713) 11.438 Tj +24.0799 -45.8182 Td +(2945 3831 3877 3996) 11.438 Tj +2.40799 -47.1272 Td +(6714) 2.408 Tj +24.0799 -47.1272 Td +(4022 4033 4129 4214) 11.438 Tj +-1e-05 -48.4363 Td +(NOFILE 0154) 6.622 Tj +24.0799 -48.4363 Td +(4297 4325 4357 4376) 11.438 Tj +2.40799 -49.7454 Td +(0154 1938 2151 2394) 11.438 Tj +24.0799 -49.7454 Td +(4380 4383 4389 4435) 11.438 Tj +2.40799 -51.0545 Td +(5128 5157) 5.418 Tj +24.0799 -51.0545 Td +(4590 4709 4724 4736) 11.438 Tj +-1e-05 -52.3636 Td +(NPROC 0150) 6.02 Tj +24.0799 -52.3636 Td +(4815 4821 4829 4967) 11.438 Tj +2.40799 -53.6727 Td +(0150 2011 2085 2217) 11.438 Tj +24.0799 -53.6727 Td +(4988 5007 5021 5056) 11.438 Tj +2.40799 -54.9818 Td +(2346 2369 2406 2411) 11.438 Tj +24.0799 -54.9818 Td +(6555 6562) 5.418 Tj +2.40799 -56.2909 Td +(2435 2475) 5.418 Tj +21.6719 -56.2909 Td +(pic_init 6332) 7.826 Tj +-1e-05 -57.6 Td +(NREQUEST 0156) 7.826 Tj +24.0799 -57.6 Td +(0251 1252 6332) 8.428 Tj +2.40799 -58.9091 Td +(0156 3733 3836 3845) 11.438 Tj +21.6719 -58.9091 Td +(pinit 2018) 6.02 Tj +2.40799 -60.2181 Td +(3860 3862) 5.418 Tj +24.0799 -60.2181 Td +(0212 1250 2018) 8.428 Tj +-1e-05 -61.5272 Td +(NSEGS 1906) 6.02 Tj +21.6719 -61.5272 Td +(pipe 5611) 5.418 Tj +2.40799 -62.8363 Td +(1906 1966) 5.418 Tj +24.0799 -62.8363 Td +(0290 0291 0294 0295) 11.438 Tj +-1e-05 -64.1454 Td +(O_CREATE 3400) 7.826 Tj +24.0799 -64.1454 Td +(0296 3505 4957 4979) 11.438 Tj +2.40799 -65.4545 Td +(3400 5263) 5.418 Tj +24.0799 -65.4545 Td +(5017 5611 5624 5630) 11.438 Tj +-1e-05 -66.7636 Td +(O_RDONLY 3401) 7.826 Tj +24.0799 -66.7636 Td +(5636 5640 5644 5661) 11.438 Tj +2.40799 -68.0727 Td +(3401) 2.408 Tj +24.0799 -68.0727 Td +(5680 5706) 5.418 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 6 6 +%%BeginPageSetup +%%PageOrientation: Landscape +__tumble pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 cross-references Page 9) 25.886 Tj +0 -3.92728 Td +(pipe_alloc 5621) 9.03 Tj +24.0799 -3.92728 Td +(2223 2239 2250 2257) 11.438 Tj +2.408 -5.23637 Td +(0293 5176 5621) 8.428 Tj +24.0799 -5.23637 Td +(2272 2275 2283 2284) 11.438 Tj +0 -6.54546 Td +(pipe_close 5661) 9.03 Tj +24.0799 -6.54546 Td +(2313 2315 2317 2319) 11.438 Tj +2.408 -7.85455 Td +(0294 5017 5661) 8.428 Tj +24.0799 -7.85455 Td +(2320 2333 2334 2355) 11.438 Tj +0 -9.16364 Td +(pipe_read 5706) 8.428 Tj +24.0799 -9.16364 Td +(2357 2368 2375 2379) 11.438 Tj +2.408 -10.4727 Td +(0296 4979 5706) 8.428 Tj +24.0799 -10.4727 Td +(2403 2431 2448 2457) 11.438 Tj +0 -11.7818 Td +(PIPESIZE 5609) 7.826 Tj +24.0799 -11.7818 Td +(2462) 2.408 Tj +2.408 -13.0909 Td +(5609 5617 5687 5696) 11.438 Tj +21.6719 -13.0909 Td +(proc_wait 2425) 8.428 Tj +2.408 -14.4 Td +(5724) 2.408 Tj +24.0799 -14.4 Td +(0223 1359 2425 3238) 11.438 Tj +0 -15.7091 Td +(pipe_write 5680) 9.03 Tj +21.6719 -15.7091 Td +(proghdr 0824) 7.224 Tj +2.408 -17.0182 Td +(0295 4957 5680) 8.428 Tj +24.0799 -17.0182 Td +(0824 1368 1377 1382) 11.438 Tj +7.10543e-15 -18.3273 Td +(pit8253_timerinit 6887) 13.244 Tj +24.0799 -18.3273 Td +(5482) 2.408 Tj +2.408 -19.6364 Td +(0255 1283 6887) 8.428 Tj +21.6719 -19.6364 Td +(read_eflags 0435) 9.632 Tj +0 -20.9455 Td +(printint 6473) 7.826 Tj +24.0799 -20.9455 Td +(0435) 2.408 Tj +2.408 -22.2545 Td +(6473 6522 6525) 8.428 Tj +21.6719 -22.2545 Td +(readi 4483) 6.02 Tj +-7.10543e-15 -23.5636 Td +(proc 1929) 5.418 Tj +24.0799 -23.5636 Td +(0335 4483 4723 4814) 11.438 Tj +2.408 -24.8727 Td +(0211 0213 0214 0215) 11.438 Tj +24.0799 -24.8727 Td +(4982 5494 5502 5569) 11.438 Tj +2.408 -26.1818 Td +(0244 0245 0288 1203) 11.438 Tj +24.0799 -26.1818 Td +(5576) 2.408 Tj +2.408 -27.4909 Td +(1226 1261 1265 1325) 11.438 Tj +21.6719 -27.4909 Td +(release 1831) 7.224 Tj +2.408 -28.8 Td +(1329 1330 1364 1407) 11.438 Tj +24.0799 -28.8 Td +(0283 1231 1334 1831) 11.438 Tj +2.408 -30.1091 Td +(1521 1547 1548 1549) 11.438 Tj +24.0799 -30.1091 Td +(1834 2113 2118 2223) 11.438 Tj +2.408 -31.4182 Td +(1757 1900 1929 1956) 11.438 Tj +24.0799 -31.4182 Td +(2239 2275 2284 2300) 11.438 Tj +2.408 -32.7273 Td +(1957 2005 2011 2012) 11.438 Tj +24.0799 -32.7273 Td +(2318 2321 2334 2357) 11.438 Tj +2.408 -34.0364 Td +(2028 2061 2076 2079) 11.438 Tj +24.0799 -34.0364 Td +(2375 2379 2448 2457) 11.438 Tj +2.408 -35.3454 Td +(2083 2086 2104 2105) 11.438 Tj +24.0799 -35.3454 Td +(2653 2674 2680 2685) 11.438 Tj +2.408 -36.6545 Td +(2108 2210 2218 2255) 11.438 Tj +24.0799 -36.6545 Td +(3793 3867 3920 3983) 11.438 Tj +2.408 -37.9636 Td +(2270 2305 2344 2346) 11.438 Tj +24.0799 -37.9636 Td +(3992 4047 4206 4221) 11.438 Tj +2.408 -39.2727 Td +(2366 2369 2389 2390) 11.438 Tj +24.0799 -39.2727 Td +(4333 4364 4448 4935) 11.438 Tj +2.408 -40.5818 Td +(2406 2411 2427 2428) 11.438 Tj +24.0799 -40.5818 Td +(4939 5014 5024 5058) 11.438 Tj +2.408 -41.8909 Td +(2436 2473 2476 2562) 11.438 Tj +24.0799 -41.8909 Td +(5673 5689 5700 5714) 11.438 Tj +2.408 -43.2 Td +(2853 2883 2938 3004) 11.438 Tj +24.0799 -43.2 Td +(5727 6551 6584 6804) 11.438 Tj +2.408 -44.5091 Td +(3025 3037 3054 3066) 11.438 Tj +24.0799 -44.5091 Td +(6828) 2.408 Tj +2.408 -45.8182 Td +(3123 3204 3220 3261) 11.438 Tj +21.6719 -45.8182 Td +(run 2567) 4.816 Tj +2.408 -47.1272 Td +(3705 3930 4055 4614) 11.438 Tj +24.0799 -47.1272 Td +(1583 1940 2103 2203) 11.438 Tj +2.408 -48.4363 Td +(4905 5104 5124 5156) 11.438 Tj +24.0799 -48.4363 Td +(2214 2567 2568 2571) 11.438 Tj +2.408 -49.7454 Td +(5172 5403 5477 5604) 11.438 Tj +24.0799 -49.7454 Td +(2607 2608 2609 2623) 11.438 Tj +2.408 -51.0545 Td +(5957) 2.408 Tj +24.0799 -51.0545 Td +(2662 2671 2915) 8.428 Tj +-7.10543e-15 -52.3636 Td +(procdump 2470) 7.826 Tj +21.6719 -52.3636 Td +(RUNNING 1926) 7.224 Tj +2.408 -53.6727 Td +(0225 2470 6790) 8.428 Tj +24.0799 -53.6727 Td +(1926 2228 2916) 8.428 Tj +0 -54.9818 Td +(process0 1327) 7.826 Tj +21.6719 -54.9818 Td +(sched 2253) 6.02 Tj +2.408 -56.2909 Td +(1215 1265 1266 1327) 11.438 Tj +24.0799 -56.2909 Td +(2253 2258 2260 2274) 11.438 Tj +7.10543e-15 -57.6 Td +(proc_exit 2387) 8.428 Tj +24.0799 -57.6 Td +(2314 2327 2418) 8.428 Tj +2.408 -58.9091 Td +(0221 2387 2461 2887) 11.438 Tj +21.6719 -58.9091 Td +(scheduler 2208) 8.428 Tj +2.408 -60.2181 Td +(2891 2913 2940 3231) 11.438 Tj +24.0799 -60.2181 Td +(0220 1292 1322 1325) 11.438 Tj +2.408 -61.5272 Td +(5597) 2.408 Tj +24.0799 -61.5272 Td +(1964 2025 2200 2201) 11.438 Tj +7.10543e-15 -62.8363 Td +(proc_kill 2364) 8.428 Tj +24.0799 -62.8363 Td +(2206 2208 2250 2278) 11.438 Tj +2.408 -64.1454 Td +(0222 2364 3248) 8.428 Tj +24.0799 -64.1454 Td +(2283 2415) 5.418 Tj +7.10543e-15 -65.4545 Td +(proc_table_lock 2009) 12.04 Tj +21.6719 -65.4545 Td +(segdesc 0627) 7.224 Tj +2.408 -66.7636 Td +(1331 1334 2009 2020) 11.438 Tj +24.0799 -66.7636 Td +(0400 0403 0627 0651) 11.438 Tj +2.408 -68.0727 Td +(2111 2113 2118 2215) 11.438 Tj +24.0799 -68.0727 Td +(0654 0659 1966) 8.428 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 cross-references Page 10) 26.488 Tj +0 -3.92728 Td +(SEG_KCODE 1901) 8.428 Tj +21.6719 -3.92728 Td +(stati 4470) 6.02 Tj +2.408 -5.23637 Td +(1901 2040 2869 2870) 11.438 Tj +24.0799 -5.23637 Td +(0334 4470 5034) 8.428 Tj +7.10543e-15 -6.54546 Td +(SEG_KDATA 1902) 8.428 Tj +21.6719 -6.54546 Td +(STA_W 0566 0668) 9.03 Tj +2.408 -7.85455 Td +(1902 2032 2041 2760) 11.438 Tj +24.0799 -7.85455 Td +(0566 0668 1096 1174) 11.438 Tj +1.42109e-14 -9.16364 Td +(SEG_NULLASM 0554) 9.632 Tj +24.0799 -9.16364 Td +(2041 2046) 5.418 Tj +2.408 -10.4727 Td +(0554 1094 1172) 8.428 Tj +21.6719 -10.4727 Td +(STA_X 0563 0665) 9.03 Tj +7.10543e-15 -11.7818 Td +(SEG_TSS 1905) 7.224 Tj +24.0799 -11.7818 Td +(0563 0665 1095 1173) 11.438 Tj +2.408 -13.0909 Td +(1905 2042 2043 2053) 11.438 Tj +24.0799 -13.0909 Td +(2040 2045) 5.418 Tj +7.10543e-15 -14.4 Td +(SEG_UCODE 1903) 8.428 Tj +21.6719 -14.4 Td +(sti 0485) 4.816 Tj +2.408 -15.7091 Td +(1350 1903 2045 2048) 11.438 Tj +24.0799 -15.7091 Td +(0485 0487 1290 1320) 11.438 Tj +1.42109e-14 -17.0182 Td +(SEG_UDATA 1904) 8.428 Tj +24.0799 -17.0182 Td +(1845) 2.408 Tj +2.408 -18.3273 Td +(1349 1904 2046 2049) 11.438 Tj +21.6719 -18.3273 Td +(strncmp 5801) 7.224 Tj +7.10543e-15 -19.6364 Td +(setupsegs 2028) 8.428 Tj +24.0799 -19.6364 Td +(0240 1558 5801) 8.428 Tj +2.408 -20.9455 Td +(0214 1270 1313 2028) 11.438 Tj +21.6719 -20.9455 Td +(STS_CG16 0676) 7.826 Tj +2.408 -22.2545 Td +(2226 2236 3267 5585) 11.438 Tj +24.0799 -22.2545 Td +(0676) 2.408 Tj +7.10543e-15 -23.5636 Td +(shift 6740) 6.02 Tj +21.6719 -23.5636 Td +(STS_CG32 0682) 7.826 Tj +2.408 -24.8727 Td +(6740 6756 6760 6761) 11.438 Tj +24.0799 -24.8727 Td +(0682) 2.408 Tj +2.408 -26.1818 Td +(6763 6766 6769 6770) 11.438 Tj +21.6719 -26.1818 Td +(STS_IG16 0678) 7.826 Tj +2.408 -27.4909 Td +(6772 6773) 5.418 Tj +24.0799 -27.4909 Td +(0678) 2.408 Tj +1.42109e-14 -28.8 Td +(sleep 2303) 6.02 Tj +21.6719 -28.8 Td +(STS_IG32 0683) 7.826 Tj +2.408 -30.1091 Td +(0218 1803 2300 2303) 11.438 Tj +24.0799 -30.1091 Td +(0683 0764) 5.418 Tj +2.408 -31.4182 Td +(2308 2311 2324 2372) 11.438 Tj +21.6719 -31.4182 Td +(STS_LDT 0674) 7.224 Tj +2.408 -32.7273 Td +(2462 3837 3851 3907) 11.438 Tj +24.0799 -32.7273 Td +(0674) 2.408 Tj +2.408 -34.0364 Td +(3979 4076 4197 4330) 11.438 Tj +21.6719 -34.0364 Td +(STS_T16A 0673) 7.826 Tj +2.408 -35.3454 Td +(5693 5717 6815) 8.428 Tj +24.0799 -35.3454 Td +(0673) 2.408 Tj +2.13163e-14 -36.6545 Td +(spinlock 1701) 7.826 Tj +21.6719 -36.6545 Td +(STS_T16B 0675) 7.826 Tj +2.408 -37.9636 Td +(0216 0218 0279 0280) 11.438 Tj +24.0799 -37.9636 Td +(0675) 2.408 Tj +2.408 -39.2727 Td +(0281 0282 0283 0284) 11.438 Tj +21.6719 -39.2727 Td +(STS_T32A 0680) 7.826 Tj +2.408 -40.5818 Td +(1210 1331 1701 1758) 11.438 Tj +24.0799 -40.5818 Td +(0680 2042) 5.418 Tj +2.408 -41.8909 Td +(1763 1805 1831 1852) 11.438 Tj +21.6719 -41.8909 Td +(STS_T32B 0681) 7.826 Tj +2.408 -43.2 Td +(2007 2009 2303 2563) 11.438 Tj +24.0799 -43.2 Td +(0681) 2.408 Tj +2.408 -44.5091 Td +(2565 3009 3209 3709) 11.438 Tj +21.6719 -44.5091 Td +(STS_TG 0677) 6.622 Tj +2.408 -45.8182 Td +(3735 3932 3936 4057) 11.438 Tj +24.0799 -45.8182 Td +(0677) 2.408 Tj +2.408 -47.1272 Td +(4079 4908 4913 5109) 11.438 Tj +21.6719 -47.1272 Td +(STS_TG16 0679) 7.826 Tj +2.408 -48.4363 Td +(5607 5616 6404 6409) 11.438 Tj +24.0799 -48.4363 Td +(0679) 2.408 Tj +2.408 -49.7454 Td +(6739) 2.408 Tj +21.6719 -49.7454 Td +(STS_TG32 0684) 7.826 Tj +2.13163e-14 -51.0545 Td +(STA_A 0568 0670) 9.03 Tj +24.0799 -51.0545 Td +(0684 0764) 5.418 Tj +2.408 -52.3636 Td +(0568 0670) 5.418 Tj +21.6719 -52.3636 Td +(superblock 3560) 9.03 Tj +1.42109e-14 -53.6727 Td +(STA_C 0565 0667) 9.03 Tj +24.0799 -53.6727 Td +(3560 4106 4113 4155) 11.438 Tj +2.408 -54.9818 Td +(0565 0667) 5.418 Tj +24.0799 -54.9818 Td +(4161 4277 4283) 8.428 Tj +1.42109e-14 -56.2909 Td +(STA_E 0564 0666) 9.03 Tj +21.6719 -56.2909 Td +(syscall 3121) 7.224 Tj +2.408 -57.6 Td +(0564 0666) 5.418 Tj +24.0799 -57.6 Td +(0242 0243 1207 2857) 11.438 Tj +2.13163e-14 -58.9091 Td +(STA_R 0567 0669) 9.03 Tj +24.0799 -58.9091 Td +(2889 3008 3121 3208) 11.438 Tj +2.408 -60.2181 Td +(0567 0669 1095 1173) 11.438 Tj +24.0799 -60.2181 Td +(5108) 2.408 Tj +2.408 -61.5272 Td +(2040 2045) 5.418 Tj +21.6719 -61.5272 Td +(SYS_chdir 2716) 8.428 Tj +1.42109e-14 -62.8363 Td +(stat 3450) 5.418 Tj +24.0799 -62.8363 Td +(2716 3173) 5.418 Tj +2.408 -64.1454 Td +(0301 0307 0334 1651) 11.438 Tj +21.6719 -64.1454 Td +(SYS_close 2707) 8.428 Tj +2.408 -65.4545 Td +(3001 3201 3450 4051) 11.438 Tj +24.0799 -65.4545 Td +(2707 3146) 5.418 Tj +2.408 -66.7636 Td +(4468 4470 4901 5030) 11.438 Tj +21.6719 -66.7636 Td +(SYS_dup 2717) 7.224 Tj +2.408 -68.0727 Td +(5101 5443) 5.418 Tj +24.0799 -68.0727 Td +(2717 3176) 5.418 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 7 7 +%%BeginPageSetup +%%PageOrientation: Landscape +pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 cross-references Page 11) 26.488 Tj +0 -3.92728 Td +(SYS_exec 2709) 7.826 Tj +21.6719 -3.92728 Td +(T_DEV 3584) 6.02 Tj +2.408 -5.23637 Td +(2709 3152) 5.418 Tj +24.0799 -5.23637 Td +(1666 3575 3576 3584) 11.438 Tj +7.10543e-15 -6.54546 Td +(SYS_exit 2702) 7.826 Tj +24.0799 -6.54546 Td +(4488 4554) 5.418 Tj +2.408 -7.85455 Td +(2702 3131) 5.418 Tj +21.6719 -7.85455 Td +(T_DEVICE 2810) 7.826 Tj +0 -9.16364 Td +(SYS_fork 2701) 7.826 Tj +24.0799 -9.16364 Td +(2810) 2.408 Tj +2.408 -10.4727 Td +(2701 3128) 5.418 Tj +21.6719 -10.4727 Td +(T_DIR 3582) 6.02 Tj +-7.10543e-15 -11.7818 Td +(SYS_fstat 2713) 8.428 Tj +24.0799 -11.7818 Td +(3582 4558 4581 4652) 11.438 Tj +2.408 -13.0909 Td +(2713 3164) 5.418 Tj +24.0799 -13.0909 Td +(4859 5272 5281 5366) 11.438 Tj +-7.10543e-15 -14.4 Td +(SYS_getpid 2718) 9.03 Tj +24.0799 -14.4 Td +(5418) 2.408 Tj +2.408 -15.7091 Td +(2718 3179) 5.418 Tj +21.6719 -15.7091 Td +(T_DIVIDE 2803) 7.826 Tj +-1.42109e-14 -17.0182 Td +(SYS_kill 2708) 7.826 Tj +24.0799 -17.0182 Td +(2803) 2.408 Tj +2.408 -18.3273 Td +(2708 3149) 5.418 Tj +21.6719 -18.3273 Td +(T_FILE 3583) 6.622 Tj +-2.13163e-14 -19.6364 Td +(SYS_link 2714) 7.826 Tj +24.0799 -19.6364 Td +(3583 4558 5266) 8.428 Tj +2.408 -20.9455 Td +(2714 3167) 5.418 Tj +21.6719 -20.9455 Td +(T_FPERR 2819) 7.224 Tj +-2.84217e-14 -22.2545 Td +(SYS_mkdir 2715) 8.428 Tj +24.0799 -22.2545 Td +(2819) 2.408 Tj +2.408 -23.5636 Td +(2715 3170) 5.418 Tj +21.6719 -23.5636 Td +(T_GPFLT 2816) 7.224 Tj +-3.55271e-14 -24.8727 Td +(SYS_mknod 2711) 8.428 Tj +24.0799 -24.8727 Td +(2816) 2.408 Tj +2.408 -26.1818 Td +(2711 3158) 5.418 Tj +21.6719 -26.1818 Td +(T_ILLOP 2809) 7.224 Tj +-4.26326e-14 -27.4909 Td +(SYS_open 2710) 7.826 Tj +24.0799 -27.4909 Td +(2809) 2.408 Tj +2.408 -28.8 Td +(2710 3155) 5.418 Tj +21.6719 -28.8 Td +(TIMER_16BIT 6883) 9.632 Tj +-4.9738e-14 -30.1091 Td +(SYS_pipe 2704) 7.826 Tj +24.0799 -30.1091 Td +(6883 6890) 5.418 Tj +2.408 -31.4182 Td +(2704 3137) 5.418 Tj +21.6719 -31.4182 Td +(TIMER_BCD 6884) 8.428 Tj +-5.68434e-14 -32.7273 Td +(SYS_read 2706) 7.826 Tj +24.0799 -32.7273 Td +(6884) 2.408 Tj +2.408 -34.0364 Td +(2706 3143) 5.418 Tj +21.6719 -34.0364 Td +(TIMER_FREQ 6864) 9.03 Tj +-6.39488e-14 -35.3454 Td +(SYS_sbrk 2719) 7.826 Tj +24.0799 -35.3454 Td +(6861 6864 6865) 8.428 Tj +2.408 -36.6545 Td +(2719 3182) 5.418 Tj +21.6719 -36.6545 Td +(TIMER_HWSTROBE 6879) 11.438 Tj +-7.10543e-14 -37.9636 Td +(SYS_unlink 2712) 9.03 Tj +24.0799 -37.9636 Td +(6879) 2.408 Tj +2.408 -39.2727 Td +(2712 3161) 5.418 Tj +21.6719 -39.2727 Td +(TIMER_INTTC 6874) 9.632 Tj +-7.81597e-14 -40.5818 Td +(SYS_wait 2703) 7.826 Tj +24.0799 -40.5818 Td +(6874) 2.408 Tj +2.408 -41.8909 Td +(2703 3134) 5.418 Tj +21.6719 -41.8909 Td +(TIMER_LATCH 6880) 9.632 Tj +-8.52651e-14 -43.2 Td +(SYS_write 2705) 8.428 Tj +24.0799 -43.2 Td +(6880) 2.408 Tj +2.408 -44.5091 Td +(2705 3140) 5.418 Tj +21.6719 -44.5091 Td +(TIMER_LSB 6881) 8.428 Tj +-9.23706e-14 -45.8182 Td +(tail 3734) 5.418 Tj +24.0799 -45.8182 Td +(6881) 2.408 Tj +2.408 -47.1272 Td +(3722 3734 3792 3806) 11.438 Tj +21.6719 -47.1272 Td +(TIMER_MSB 6882) 8.428 Tj +2.408 -48.4363 Td +(3807 3836 3860 3862) 11.438 Tj +24.0799 -48.4363 Td +(6882) 2.408 Tj +2.408 -49.7454 Td +(3940) 2.408 Tj +21.6719 -49.7454 Td +(TIMER_ONESHOT 6875) 10.836 Tj +-9.9476e-14 -51.0545 Td +(T_ALIGN 2820) 7.224 Tj +24.0799 -51.0545 Td +(6875) 2.408 Tj +2.408 -52.3636 Td +(2820) 2.408 Tj +21.6719 -52.3636 Td +(TIMER_RATEGEN 6876) 10.836 Tj +-1.06581e-13 -53.6727 Td +(taskstate 0687) 8.428 Tj +24.0799 -53.6727 Td +(6876 6890) 5.418 Tj +2.408 -54.9818 Td +(0687 1965) 5.418 Tj +21.6719 -54.9818 Td +(TIMER_SEL0 6871) 9.03 Tj +-1.13687e-13 -56.2909 Td +(T_BOUND 2808) 7.224 Tj +24.0799 -56.2909 Td +(6871 6890) 5.418 Tj +2.408 -57.6 Td +(2808) 2.408 Tj +21.6719 -57.6 Td +(TIMER_SEL1 6872) 9.03 Tj +-1.20792e-13 -58.9091 Td +(T_BRKPT 2806) 7.224 Tj +24.0799 -58.9091 Td +(6872) 2.408 Tj +2.408 -60.2181 Td +(2806) 2.408 Tj +21.6719 -60.2181 Td +(TIMER_SEL2 6873) 9.03 Tj +-1.27898e-13 -61.5272 Td +(T_DBLFLT 2811) 7.826 Tj +24.0799 -61.5272 Td +(6873) 2.408 Tj +2.408 -62.8363 Td +(2811) 2.408 Tj +21.6719 -62.8363 Td +(TIMER_SQWAVE 6877) 10.234 Tj +-1.35003e-13 -64.1454 Td +(T_DEBUG 2804) 7.224 Tj +24.0799 -64.1454 Td +(6877) 2.408 Tj +2.408 -65.4545 Td +(2804) 2.408 Tj +21.6719 -65.4545 Td +(TIMER_SWSTROBE 6878) 11.438 Tj +-1.42109e-13 -66.7636 Td +(T_DEFAULT 2827) 8.428 Tj +24.0799 -66.7636 Td +(6878) 2.408 Tj +2.408 -68.0727 Td +(2827) 2.408 Tj +21.6719 -68.0727 Td +(T_MCHK 2821) 6.622 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 cross-references Page 12) 26.488 Tj +2.40799 -3.92728 Td +(2821) 2.408 Tj +24.0799 -3.92728 Td +(2826 2870 2885 3017) 11.438 Tj +-1e-05 -5.23637 Td +(T_NMI 2805) 6.02 Tj +21.6719 -5.23637 Td +(T_TSS 2813) 6.02 Tj +2.40799 -6.54546 Td +(2805) 2.408 Tj +24.0799 -6.54546 Td +(2813) 2.408 Tj +-1e-05 -7.85455 Td +(T_OFLOW 2807) 7.224 Tj +21.6719 -7.85455 Td +(tvinit 2864) 6.622 Tj +2.40799 -9.16364 Td +(2807) 2.408 Tj +24.0799 -9.16364 Td +(0233 1255 2864) 8.428 Tj +-1e-05 -10.4727 Td +(T_PGFLT 2817) 7.224 Tj +21.6719 -10.4727 Td +(unlink 4802) 6.622 Tj +2.40799 -11.7818 Td +(2817) 2.408 Tj +24.0799 -11.7818 Td +(0339 4802 4815 4821) 11.438 Tj +-1e-05 -13.0909 Td +(trap 2880) 5.418 Tj +24.0799 -13.0909 Td +(4829 5436) 5.418 Tj +2.40799 -14.4 Td +(0232 0500 0512 0731) 11.438 Tj +21.6719 -14.4 Td +(wakeup 2353) 6.622 Tj +2.40799 -15.7091 Td +(0750 0751 0752 0753) 11.438 Tj +24.0799 -15.7091 Td +(0219 2316 2317 2353) 11.438 Tj +2.40799 -17.0182 Td +(0754 0757 1255 1344) 11.438 Tj +24.0799 -17.0182 Td +(3792 3861 4045 4362) 11.438 Tj +2.40799 -18.3273 Td +(2362 2751 2758 2764) 11.438 Tj +24.0799 -18.3273 Td +(4446 5667 5670 5692) 11.438 Tj +2.40799 -19.6364 Td +(2800 2880 2938 2944) 11.438 Tj +24.0799 -19.6364 Td +(5701 5728 6798) 8.428 Tj +2.40799 -20.9455 Td +(2945 2952 2954) 8.428 Tj +21.6719 -20.9455 Td +(wakeup1 2342) 7.224 Tj +-1e-05 -22.2545 Td +(trapframe 0501) 8.428 Tj +24.0799 -22.2545 Td +(2342 2356 2408 2461) 11.438 Tj +2.40799 -23.5636 Td +(0501 1332 1348 1941) 11.438 Tj +21.6719 -23.5636 Td +(wdir 4716) 5.418 Tj +2.40799 -24.8727 Td +(2015 2138 2139 2763) 11.438 Tj +24.0799 -24.8727 Td +(4716 4724 4736 4786) 11.438 Tj +2.40799 -26.1818 Td +(2880) 2.408 Tj +24.0799 -26.1818 Td +(4880) 2.408 Tj +-1e-05 -27.4909 Td +(T_SEGNP 2814) 7.224 Tj +21.6719 -27.4909 Td +(write_eflags 0443) 10.234 Tj +2.40799 -28.8 Td +(2814) 2.408 Tj +24.0799 -28.8 Td +(0443) 2.408 Tj +-1e-05 -30.1091 Td +(T_SIMDERR 2822) 8.428 Tj +21.6719 -30.1091 Td +(writei 4552) 6.622 Tj +2.40799 -31.4182 Td +(2822) 2.408 Tj +24.0799 -31.4182 Td +(0336 4552 4590 4735) 11.438 Tj +-1e-05 -32.7273 Td +(T_STACK 2815) 7.224 Tj +24.0799 -32.7273 Td +(4820 4960 5378 5382) 11.438 Tj +2.40799 -34.0364 Td +(2815) 2.408 Tj +21.6719 -34.0364 Td +(yield 2268) 6.02 Tj +-1e-05 -35.3454 Td +(T_SYSCALL 2826) 8.428 Tj +24.0799 -35.3454 Td +(0224 2268 2917) 8.428 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 8 8 +%%BeginPageSetup +%%PageOrientation: Landscape +__tumble pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/types.h Page 1) 22.876 Tj +0 -3.92728 Td +(0100 typedef unsigned int uint;) 18.662 Tj +0 -5.23637 Td +(0101 typedef unsigned short ushort;) 21.07 Tj +0 -6.54546 Td +(0102 typedef unsigned char uchar;) 19.866 Tj +0 -7.85455 Td +(0103 ) 3.01 Tj +0 -9.16364 Td +(0104 ) 3.01 Tj +0 -10.4727 Td +(0105 ) 3.01 Tj +0 -11.7818 Td +(0106 ) 3.01 Tj +0 -13.0909 Td +(0107 ) 3.01 Tj +0 -14.4 Td +(0108 ) 3.01 Tj +0 -15.7091 Td +(0109 ) 3.01 Tj +0 -17.0182 Td +(0110 ) 3.01 Tj +0 -18.3273 Td +(0111 ) 3.01 Tj +0 -19.6364 Td +(0112 ) 3.01 Tj +0 -20.9455 Td +(0113 ) 3.01 Tj +0 -22.2545 Td +(0114 ) 3.01 Tj +0 -23.5636 Td +(0115 ) 3.01 Tj +0 -24.8727 Td +(0116 ) 3.01 Tj +0 -26.1818 Td +(0117 ) 3.01 Tj +0 -27.4909 Td +(0118 ) 3.01 Tj +0 -28.8 Td +(0119 ) 3.01 Tj +0 -30.1091 Td +(0120 ) 3.01 Tj +0 -31.4182 Td +(0121 ) 3.01 Tj +0 -32.7273 Td +(0122 ) 3.01 Tj +0 -34.0364 Td +(0123 ) 3.01 Tj +0 -35.3454 Td +(0124 ) 3.01 Tj +0 -36.6545 Td +(0125 ) 3.01 Tj +0 -37.9636 Td +(0126 ) 3.01 Tj +0 -39.2727 Td +(0127 ) 3.01 Tj +0 -40.5818 Td +(0128 ) 3.01 Tj +0 -41.8909 Td +(0129 ) 3.01 Tj +0 -43.2 Td +(0130 ) 3.01 Tj +0 -44.5091 Td +(0131 ) 3.01 Tj +0 -45.8182 Td +(0132 ) 3.01 Tj +0 -47.1272 Td +(0133 ) 3.01 Tj +0 -48.4363 Td +(0134 ) 3.01 Tj +0 -49.7454 Td +(0135 ) 3.01 Tj +0 -51.0545 Td +(0136 ) 3.01 Tj +0 -52.3636 Td +(0137 ) 3.01 Tj +0 -53.6727 Td +(0138 ) 3.01 Tj +0 -54.9818 Td +(0139 ) 3.01 Tj +0 -56.2909 Td +(0140 ) 3.01 Tj +0 -57.6 Td +(0141 ) 3.01 Tj +0 -58.9091 Td +(0142 ) 3.01 Tj +0 -60.2181 Td +(0143 ) 3.01 Tj +0 -61.5272 Td +(0144 ) 3.01 Tj +0 -62.8363 Td +(0145 ) 3.01 Tj +0 -64.1454 Td +(0146 ) 3.01 Tj +0 -65.4545 Td +(0147 ) 3.01 Tj +0 -66.7636 Td +(0148 ) 3.01 Tj +0 -68.0727 Td +(0149 ) 3.01 Tj +0 -72 Td +(Sheet 01) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/param.h Page 1) 22.876 Tj +0 -3.92728 Td +(0150 #define NPROC 64 // maximum number of processes) 36.12 Tj +0 -5.23637 Td +(0151 #define PAGE 4096 // granularity of user-space memory allocation) 45.752 Tj +0 -6.54546 Td +(0152 #define KSTACKSIZE PAGE // size of per-process kernel stack) 39.13 Tj +0 -7.85455 Td +(0153 #define NCPU 8 // maximum number of CPUs) 33.11 Tj +0 -9.16364 Td +(0154 #define NOFILE 16 // open files per process) 33.11 Tj +0 -10.4727 Td +(0155 #define NFILE 100 // open files per system) 32.508 Tj +0 -11.7818 Td +(0156 #define NREQUEST 100 // outstanding disk requests) 34.916 Tj +0 -13.0909 Td +(0157 #define NBUF 10 // size of disk block cache) 34.314 Tj +0 -14.4 Td +(0158 #define NINODE 100 // maximum number of active i-nodes) 39.13 Tj +0 -15.7091 Td +(0159 #define NDEV 10 // maximum major device number) 36.12 Tj +0 -17.0182 Td +(0160 ) 3.01 Tj +0 -18.3273 Td +(0161 ) 3.01 Tj +0 -19.6364 Td +(0162 ) 3.01 Tj +0 -20.9455 Td +(0163 ) 3.01 Tj +0 -22.2545 Td +(0164 ) 3.01 Tj +0 -23.5636 Td +(0165 ) 3.01 Tj +0 -24.8727 Td +(0166 ) 3.01 Tj +0 -26.1818 Td +(0167 ) 3.01 Tj +0 -27.4909 Td +(0168 ) 3.01 Tj +0 -28.8 Td +(0169 ) 3.01 Tj +0 -30.1091 Td +(0170 ) 3.01 Tj +0 -31.4182 Td +(0171 ) 3.01 Tj +0 -32.7273 Td +(0172 ) 3.01 Tj +0 -34.0364 Td +(0173 ) 3.01 Tj +0 -35.3454 Td +(0174 ) 3.01 Tj +0 -36.6545 Td +(0175 ) 3.01 Tj +0 -37.9636 Td +(0176 ) 3.01 Tj +0 -39.2727 Td +(0177 ) 3.01 Tj +0 -40.5818 Td +(0178 ) 3.01 Tj +0 -41.8909 Td +(0179 ) 3.01 Tj +0 -43.2 Td +(0180 ) 3.01 Tj +0 -44.5091 Td +(0181 ) 3.01 Tj +0 -45.8182 Td +(0182 ) 3.01 Tj +0 -47.1272 Td +(0183 ) 3.01 Tj +0 -48.4363 Td +(0184 ) 3.01 Tj +0 -49.7454 Td +(0185 ) 3.01 Tj +0 -51.0545 Td +(0186 ) 3.01 Tj +0 -52.3636 Td +(0187 ) 3.01 Tj +0 -53.6727 Td +(0188 ) 3.01 Tj +0 -54.9818 Td +(0189 ) 3.01 Tj +0 -56.2909 Td +(0190 ) 3.01 Tj +0 -57.6 Td +(0191 ) 3.01 Tj +0 -58.9091 Td +(0192 ) 3.01 Tj +0 -60.2181 Td +(0193 ) 3.01 Tj +0 -61.5272 Td +(0194 ) 3.01 Tj +0 -62.8363 Td +(0195 ) 3.01 Tj +0 -64.1454 Td +(0196 ) 3.01 Tj +0 -65.4545 Td +(0197 ) 3.01 Tj +0 -66.7636 Td +(0198 ) 3.01 Tj +0 -68.0727 Td +(0199 ) 3.01 Tj +0 -72 Td +(Sheet 01) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 9 9 +%%BeginPageSetup +%%PageOrientation: Landscape +pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/defs.h Page 1) 22.274 Tj +0 -3.92728 Td +(0200 // kalloc.c) 9.632 Tj +0 -5.23637 Td +(0201 char* kalloc\(int\);) 13.846 Tj +0 -6.54546 Td +(0202 void kfree\(char*, int\);) 16.856 Tj +0 -7.85455 Td +(0203 void kinit\(void\);) 13.244 Tj +0 -9.16364 Td +(0204 ) 3.01 Tj +0 -10.4727 Td +(0205 // console.c) 10.234 Tj +0 -11.7818 Td +(0206 void console_init\(void\);) 17.458 Tj +0 -13.0909 Td +(0207 void cprintf\(char*, ...\);) 18.06 Tj +0 -14.4 Td +(0208 void panic\(char*\);) 13.846 Tj +0 -15.7091 Td +(0209 void kbd_intr\(void\);) 15.05 Tj +0 -17.0182 Td +(0210 ) 3.01 Tj +0 -18.3273 Td +(0211 // proc.c) 8.428 Tj +0 -19.6364 Td +(0212 void pinit\(void\);) 13.244 Tj +0 -20.9455 Td +(0213 struct proc;) 10.234 Tj +0 -22.2545 Td +(0214 void setupsegs\(struct proc*\);) 20.468 Tj +0 -23.5636 Td +(0215 struct proc* copyproc\(struct proc*\);) 24.682 Tj +0 -24.8727 Td +(0216 struct spinlock;) 12.642 Tj +0 -26.1818 Td +(0217 int growproc\(int\);) 13.846 Tj +0 -27.4909 Td +(0218 void sleep\(void*, struct spinlock*\);) 24.682 Tj +0 -28.8 Td +(0219 void wakeup\(void*\);) 14.448 Tj +0 -30.1091 Td +(0220 void scheduler\(void\);) 15.652 Tj +0 -31.4182 Td +(0221 void proc_exit\(void\);) 15.652 Tj +0 -32.7273 Td +(0222 int proc_kill\(int\);) 14.448 Tj +0 -34.0364 Td +(0223 int proc_wait\(void\);) 15.05 Tj +0 -35.3454 Td +(0224 void yield\(void\);) 13.244 Tj +0 -36.6545 Td +(0225 void procdump\(void\);) 15.05 Tj +0 -37.9636 Td +(0226 ) 3.01 Tj +0 -39.2727 Td +(0227 // setjmp.S) 9.632 Tj +0 -40.5818 Td +(0228 struct jmpbuf;) 11.438 Tj +0 -41.8909 Td +(0229 int setjmp\(struct jmpbuf*\);) 19.264 Tj +0 -43.2 Td +(0230 void longjmp\(struct jmpbuf*\);) 20.468 Tj +0 -44.5091 Td +(0231 ) 3.01 Tj +0 -45.8182 Td +(0232 // trap.c) 8.428 Tj +0 -47.1272 Td +(0233 void tvinit\(void\);) 13.846 Tj +0 -48.4363 Td +(0234 void idtinit\(void\);) 14.448 Tj +0 -49.7454 Td +(0235 ) 3.01 Tj +0 -51.0545 Td +(0236 // string.c) 9.632 Tj +0 -52.3636 Td +(0237 void* memset\(void*, int, uint\);) 21.672 Tj +0 -53.6727 Td +(0238 int memcmp\(const void*, const void*, uint\);) 28.896 Tj +0 -54.9818 Td +(0239 void* memmove\(void*, const void*, uint\);) 27.09 Tj +0 -56.2909 Td +(0240 int strncmp\(const char*, const char*, uint\);) 29.498 Tj +0 -57.6 Td +(0241 ) 3.01 Tj +0 -58.9091 Td +(0242 // syscall.c) 10.234 Tj +0 -60.2181 Td +(0243 void syscall\(void\);) 14.448 Tj +0 -61.5272 Td +(0244 int fetchint\(struct proc*, uint, int*\);) 26.488 Tj +0 -62.8363 Td +(0245 int fetchstr\(struct proc*, uint, char**\);) 27.692 Tj +0 -64.1454 Td +(0246 int argint\(int, int*\);) 16.254 Tj +0 -65.4545 Td +(0247 int argptr\(int, char**, int\);) 20.468 Tj +0 -66.7636 Td +(0248 int argstr\(int, char**\);) 17.458 Tj +0 -68.0727 Td +(0249 ) 3.01 Tj +0 -72 Td +(Sheet 02) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/defs.h Page 2) 22.274 Tj +0 -3.92728 Td +(0250 // picirq.c) 9.632 Tj +0 -5.23637 Td +(0251 void pic_init\(void\);) 15.05 Tj +0 -6.54546 Td +(0252 void irq_enable\(int\);) 15.652 Tj +0 -7.85455 Td +(0253 ) 3.01 Tj +0 -9.16364 Td +(0254 // 8253pit.c) 10.234 Tj +0 -10.4727 Td +(0255 void pit8253_timerinit\(void\);) 20.468 Tj +0 -11.7818 Td +(0256 ) 3.01 Tj +0 -13.0909 Td +(0257 // mp.c) 7.224 Tj +0 -14.4 Td +(0258 extern int ismp;) 12.642 Tj +0 -15.7091 Td +(0259 void mp_init\(void\);) 14.448 Tj +0 -17.0182 Td +(0260 void mp_startthem\(void\);) 17.458 Tj +0 -18.3273 Td +(0261 int mp_bcpu\(void\);) 13.846 Tj +0 -19.6364 Td +(0262 ) 3.01 Tj +0 -20.9455 Td +(0263 // lapic.c) 9.03 Tj +0 -22.2545 Td +(0264 extern uint *lapicaddr;) 16.856 Tj +0 -23.5636 Td +(0265 void lapic_init\(int\);) 15.652 Tj +0 -24.8727 Td +(0266 void lapic_startap\(uchar, int\);) 21.672 Tj +0 -26.1818 Td +(0267 void lapic_timerinit\(void\);) 19.264 Tj +0 -27.4909 Td +(0268 void lapic_timerintr\(void\);) 19.264 Tj +0 -28.8 Td +(0269 void lapic_enableintr\(void\);) 19.866 Tj +0 -30.1091 Td +(0270 void lapic_disableintr\(void\);) 20.468 Tj +0 -31.4182 Td +(0271 void lapic_eoi\(void\);) 15.652 Tj +0 -32.7273 Td +(0272 int cpu\(void\);) 11.438 Tj +0 -34.0364 Td +(0273 ) 3.01 Tj +0 -35.3454 Td +(0274 // ioapic.c) 9.632 Tj +0 -36.6545 Td +(0275 extern uchar ioapic_id;) 16.856 Tj +0 -37.9636 Td +(0276 void ioapic_init\(void\);) 16.856 Tj +0 -39.2727 Td +(0277 void ioapic_enable\(int irq, int cpu\);) 25.284 Tj +0 -40.5818 Td +(0278 ) 3.01 Tj +0 -41.8909 Td +(0279 // spinlock.c) 10.836 Tj +0 -43.2 Td +(0280 struct spinlock;) 12.642 Tj +0 -44.5091 Td +(0281 void initlock\(struct spinlock*, char*\);) 26.488 Tj +0 -45.8182 Td +(0282 void acquire\(struct spinlock*\);) 21.672 Tj +0 -47.1272 Td +(0283 void release\(struct spinlock*\);) 21.672 Tj +0 -48.4363 Td +(0284 int holding\(struct spinlock*\);) 21.07 Tj +0 -49.7454 Td +(0285 void getcallerpcs\(void*, uint*\);) 22.274 Tj +0 -51.0545 Td +(0286 ) 3.01 Tj +0 -52.3636 Td +(0287 // main.c) 8.428 Tj +0 -53.6727 Td +(0288 void load_icode\(struct proc*, uchar*, uint\);) 29.498 Tj +0 -54.9818 Td +(0289 ) 3.01 Tj +0 -56.2909 Td +(0290 // pipe.c) 8.428 Tj +0 -57.6 Td +(0291 struct pipe;) 10.234 Tj +0 -58.9091 Td +(0292 struct file;) 10.234 Tj +0 -60.2181 Td +(0293 int pipe_alloc\(struct file**, struct file**\);) 30.1 Tj +0 -61.5272 Td +(0294 void pipe_close\(struct pipe*, int\);) 24.08 Tj +0 -62.8363 Td +(0295 int pipe_write\(struct pipe*, char*, int\);) 27.692 Tj +0 -64.1454 Td +(0296 int pipe_read\(struct pipe*, char*, int\);) 27.09 Tj +0 -65.4545 Td +(0297 ) 3.01 Tj +0 -66.7636 Td +(0298 ) 3.01 Tj +0 -68.0727 Td +(0299 ) 3.01 Tj +0 -72 Td +(Sheet 02) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 10 10 +%%BeginPageSetup +%%PageOrientation: Landscape +__tumble pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/defs.h Page 3) 22.274 Tj +0 -3.92728 Td +(0300 // file.c) 8.428 Tj +0 -5.23637 Td +(0301 struct stat;) 10.234 Tj +0 -6.54546 Td +(0302 void fileinit\(void\);) 15.05 Tj +0 -7.85455 Td +(0303 struct file* filealloc\(void\);) 20.468 Tj +0 -9.16364 Td +(0304 void fileclose\(struct file*\);) 20.468 Tj +0 -10.4727 Td +(0305 int fileread\(struct file*, char*, int n\);) 27.692 Tj +0 -11.7818 Td +(0306 int filewrite\(struct file*, char*, int n\);) 28.294 Tj +0 -13.0909 Td +(0307 int filestat\(struct file*, struct stat*\);) 27.692 Tj +0 -14.4 Td +(0308 void fileincref\(struct file*\);) 21.07 Tj +0 -15.7091 Td +(0309 ) 3.01 Tj +0 -17.0182 Td +(0310 // ide.c) 7.826 Tj +0 -18.3273 Td +(0311 void ide_init\(void\);) 15.05 Tj +0 -19.6364 Td +(0312 void ide_intr\(void\);) 15.05 Tj +0 -20.9455 Td +(0313 void ide_rw\(int, uint, void*, uint, int\);) 27.692 Tj +0 -22.2545 Td +(0314 ) 3.01 Tj +0 -23.5636 Td +(0315 // bio.c) 7.826 Tj +0 -24.8727 Td +(0316 void binit\(void\);) 13.244 Tj +0 -26.1818 Td +(0317 struct buf;) 9.632 Tj +0 -27.4909 Td +(0318 struct buf* getblk\(uint dev, uint sector\);) 28.294 Tj +0 -28.8 Td +(0319 struct buf* bread\(uint, uint\);) 21.07 Tj +0 -30.1091 Td +(0320 void bwrite\(struct buf*, uint\);) 21.672 Tj +0 -31.4182 Td +(0321 void brelse\(struct buf*\);) 18.06 Tj +0 -32.7273 Td +(0322 ) 3.01 Tj +0 -34.0364 Td +(0323 // fs.c) 7.224 Tj +0 -35.3454 Td +(0324 extern uint rootdev;) 15.05 Tj +0 -36.6545 Td +(0325 void iinit\(void\);) 13.244 Tj +0 -37.9636 Td +(0326 struct inode* iget\(uint, uint\);) 21.672 Tj +0 -39.2727 Td +(0327 void ilock\(struct inode*\);) 18.662 Tj +0 -40.5818 Td +(0328 void iunlock\(struct inode*\);) 19.866 Tj +0 -41.8909 Td +(0329 void itrunc\(struct inode*\);) 19.264 Tj +0 -43.2 Td +(0330 void idecref\(struct inode*\);) 19.866 Tj +0 -44.5091 Td +(0331 void iincref\(struct inode*\);) 19.866 Tj +0 -45.8182 Td +(0332 void iput\(struct inode*\);) 18.06 Tj +0 -47.1272 Td +(0333 struct inode* namei\(char*, int, uint*, char**, struct inode**\);) 40.936 Tj +0 -48.4363 Td +(0334 void stati\(struct inode*, struct stat*\);) 27.09 Tj +0 -49.7454 Td +(0335 int readi\(struct inode*, char*, uint, uint\);) 29.498 Tj +0 -51.0545 Td +(0336 int writei\(struct inode*, char*, uint, uint\);) 30.1 Tj +0 -52.3636 Td +(0337 struct inode* mknod\(char*, short, short, short\);) 31.906 Tj +0 -53.6727 Td +(0338 struct inode* mknod1\(struct inode*, char*, short, short, short\);) 41.538 Tj +0 -54.9818 Td +(0339 int unlink\(char*\);) 13.846 Tj +0 -56.2909 Td +(0340 void iupdate\(struct inode*\);) 19.866 Tj +0 -57.6 Td +(0341 int link\(char*, char*\);) 16.856 Tj +0 -58.9091 Td +(0342 ) 3.01 Tj +0 -60.2181 Td +(0343 ) 3.01 Tj +0 -61.5272 Td +(0344 ) 3.01 Tj +0 -62.8363 Td +(0345 ) 3.01 Tj +0 -64.1454 Td +(0346 ) 3.01 Tj +0 -65.4545 Td +(0347 ) 3.01 Tj +0 -66.7636 Td +(0348 ) 3.01 Tj +0 -68.0727 Td +(0349 ) 3.01 Tj +0 -72 Td +(Sheet 03) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/x86.h Page 1) 21.672 Tj +0 -3.92728 Td +(0350 // Special assembly routines to access x86-specific) 33.712 Tj +0 -5.23637 Td +(0351 // hardware instructions.) 18.06 Tj +0 -6.54546 Td +(0352 ) 3.01 Tj +0 -7.85455 Td +(0353 static __inline uchar) 15.652 Tj +0 -9.16364 Td +(0354 inb\(int port\)) 10.836 Tj +0 -10.4727 Td +(0355 {) 3.612 Tj +0 -11.7818 Td +(0356 uchar data;) 10.836 Tj +0 -13.0909 Td +(0357 __asm __volatile\("inb %w1,%0" : "=a" \(data\) : "d" \(port\)\);) 39.13 Tj +0 -14.4 Td +(0358 return data;) 11.438 Tj +0 -15.7091 Td +(0359 }) 3.612 Tj +0 -17.0182 Td +(0360 ) 3.01 Tj +0 -18.3273 Td +(0361 static __inline void) 15.05 Tj +0 -19.6364 Td +(0362 insl\(int port, void *addr, int cnt\)) 24.08 Tj +0 -20.9455 Td +(0363 {) 3.612 Tj +0 -22.2545 Td +(0364 __asm __volatile\("cld\\n\\trepne\\n\\tinsl" :) 31.304 Tj +0 -23.5636 Td +(0365 "=D" \(addr\), "=c" \(cnt\) :) 31.304 Tj +0 -24.8727 Td +(0366 "d" \(port\), "0" \(addr\), "1" \(cnt\) :) 36.12 Tj +0 -26.1818 Td +(0367 "memory", "cc"\);) 24.08 Tj +0 -27.4909 Td +(0368 }) 3.612 Tj +0 -28.8 Td +(0369 ) 3.01 Tj +0 -30.1091 Td +(0370 static __inline void) 15.05 Tj +0 -31.4182 Td +(0371 outb\(int port, uchar data\)) 18.662 Tj +0 -32.7273 Td +(0372 {) 3.612 Tj +0 -34.0364 Td +(0373 __asm __volatile\("outb %0,%w1" : : "a" \(data\), "d" \(port\)\);) 39.732 Tj +0 -35.3454 Td +(0374 }) 3.612 Tj +0 -36.6545 Td +(0375 ) 3.01 Tj +0 -37.9636 Td +(0376 static __inline void) 15.05 Tj +0 -39.2727 Td +(0377 outw\(int port, ushort data\)) 19.264 Tj +0 -40.5818 Td +(0378 {) 3.612 Tj +0 -41.8909 Td +(0379 __asm __volatile\("outw %0,%w1" : : "a" \(data\), "d" \(port\)\);) 39.732 Tj +0 -43.2 Td +(0380 }) 3.612 Tj +0 -44.5091 Td +(0381 ) 3.01 Tj +0 -45.8182 Td +(0382 static __inline void) 15.05 Tj +0 -47.1272 Td +(0383 outsl\(int port, const void *addr, int cnt\)) 28.294 Tj +0 -48.4363 Td +(0384 {) 3.612 Tj +0 -49.7454 Td +(0385 __asm __volatile\("cld\\n\\trepne\\n\\toutsl" :) 31.304 Tj +0 -51.0545 Td +(0386 "=S" \(addr\), "=c" \(cnt\) :) 31.304 Tj +0 -52.3636 Td +(0387 "d" \(port\), "0" \(addr\), "1" \(cnt\) :) 36.12 Tj +0 -53.6727 Td +(0388 "cc"\);) 18.06 Tj +0 -54.9818 Td +(0389 }) 3.612 Tj +0 -56.2909 Td +(0390 ) 3.01 Tj +0 -57.6 Td +(0391 ) 3.01 Tj +0 -58.9091 Td +(0392 ) 3.01 Tj +0 -60.2181 Td +(0393 ) 3.01 Tj +0 -61.5272 Td +(0394 ) 3.01 Tj +0 -62.8363 Td +(0395 ) 3.01 Tj +0 -64.1454 Td +(0396 ) 3.01 Tj +0 -65.4545 Td +(0397 ) 3.01 Tj +0 -66.7636 Td +(0398 ) 3.01 Tj +0 -68.0727 Td +(0399 ) 3.01 Tj +0 -72 Td +(Sheet 03) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 11 11 +%%BeginPageSetup +%%PageOrientation: Landscape +pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/x86.h Page 2) 21.672 Tj +0 -3.92728 Td +(0400 struct segdesc;) 12.04 Tj +0 -5.23637 Td +(0401 ) 3.01 Tj +0 -6.54546 Td +(0402 static __inline void) 15.05 Tj +0 -7.85455 Td +(0403 lgdt\(struct segdesc *p, int size\)) 22.876 Tj +0 -9.16364 Td +(0404 {) 3.612 Tj +0 -10.4727 Td +(0405 volatile ushort pd[3];) 17.458 Tj +0 -11.7818 Td +(0406 ) 3.01 Tj +0 -13.0909 Td +(0407 pd[0] = size-1;) 13.244 Tj +0 -14.4 Td +(0408 pd[1] = \(uint\)p;) 13.846 Tj +0 -15.7091 Td +(0409 pd[2] = \(uint\)p >> 16;) 17.458 Tj +0 -17.0182 Td +(0410 ) 3.01 Tj +0 -18.3273 Td +(0411 asm volatile\("lgdt \(%0\)" : : "g" \(pd\)\);) 27.692 Tj +0 -19.6364 Td +(0412 }) 3.612 Tj +0 -20.9455 Td +(0413 ) 3.01 Tj +0 -22.2545 Td +(0414 struct gatedesc;) 12.642 Tj +0 -23.5636 Td +(0415 ) 3.01 Tj +0 -24.8727 Td +(0416 static __inline void) 15.05 Tj +0 -26.1818 Td +(0417 lidt\(struct gatedesc *p, int size\)) 23.478 Tj +0 -27.4909 Td +(0418 {) 3.612 Tj +0 -28.8 Td +(0419 volatile ushort pd[3];) 17.458 Tj +0 -30.1091 Td +(0420 ) 3.01 Tj +0 -31.4182 Td +(0421 pd[0] = size-1;) 13.244 Tj +0 -32.7273 Td +(0422 pd[1] = \(uint\)p;) 13.846 Tj +0 -34.0364 Td +(0423 pd[2] = \(uint\)p >> 16;) 17.458 Tj +0 -35.3454 Td +(0424 ) 3.01 Tj +0 -36.6545 Td +(0425 asm volatile\("lidt \(%0\)" : : "g" \(pd\)\);) 27.692 Tj +0 -37.9636 Td +(0426 }) 3.612 Tj +0 -39.2727 Td +(0427 ) 3.01 Tj +0 -40.5818 Td +(0428 static __inline void) 15.05 Tj +0 -41.8909 Td +(0429 ltr\(ushort sel\)) 12.04 Tj +0 -43.2 Td +(0430 {) 3.612 Tj +0 -44.5091 Td +(0431 __asm __volatile\("ltr %0" : : "r" \(sel\)\);) 28.896 Tj +0 -45.8182 Td +(0432 }) 3.612 Tj +0 -47.1272 Td +(0433 ) 3.01 Tj +0 -48.4363 Td +(0434 static __inline uint) 15.05 Tj +0 -49.7454 Td +(0435 read_eflags\(void\)) 13.244 Tj +0 -51.0545 Td +(0436 {) 3.612 Tj +0 -52.3636 Td +(0437 uint eflags;) 11.438 Tj +0 -53.6727 Td +(0438 __asm __volatile\("pushfl; popl %0" : "=r" \(eflags\)\);) 35.518 Tj +0 -54.9818 Td +(0439 return eflags;) 12.642 Tj +0 -56.2909 Td +(0440 }) 3.612 Tj +0 -57.6 Td +(0441 ) 3.01 Tj +0 -58.9091 Td +(0442 static __inline void) 15.05 Tj +0 -60.2181 Td +(0443 write_eflags\(uint eflags\)) 18.06 Tj +0 -61.5272 Td +(0444 {) 3.612 Tj +0 -62.8363 Td +(0445 __asm __volatile\("pushl %0; popfl" : : "r" \(eflags\)\);) 36.12 Tj +0 -64.1454 Td +(0446 }) 3.612 Tj +0 -65.4545 Td +(0447 ) 3.01 Tj +0 -66.7636 Td +(0448 ) 3.01 Tj +0 -68.0727 Td +(0449 ) 3.01 Tj +0 -72 Td +(Sheet 04) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/x86.h Page 3) 21.672 Tj +0 -3.92728 Td +(0450 static __inline void) 15.05 Tj +0 -5.23637 Td +(0451 cpuid\(uint info, uint *eaxp, uint *ebxp, uint *ecxp, uint *edxp\)) 41.538 Tj +0 -6.54546 Td +(0452 {) 3.612 Tj +0 -7.85455 Td +(0453 uint eax, ebx, ecx, edx;) 18.662 Tj +0 -9.16364 Td +(0454 asm volatile\("cpuid" :) 17.458 Tj +0 -10.4727 Td +(0455 "=a" \(eax\), "=b" \(ebx\), "=c" \(ecx\), "=d" \(edx\) :) 40.936 Tj +0 -11.7818 Td +(0456 "a" \(info\)\);) 19.264 Tj +0 -13.0909 Td +(0457 if\(eaxp\)) 9.03 Tj +0 -14.4 Td +(0458 *eaxp = eax;) 12.642 Tj +0 -15.7091 Td +(0459 if\(ebxp\)) 9.03 Tj +0 -17.0182 Td +(0460 *ebxp = ebx;) 12.642 Tj +0 -18.3273 Td +(0461 if\(ecxp\)) 9.03 Tj +0 -19.6364 Td +(0462 *ecxp = ecx;) 12.642 Tj +0 -20.9455 Td +(0463 if\(edxp\)) 9.03 Tj +0 -22.2545 Td +(0464 *edxp = edx;) 12.642 Tj +0 -23.5636 Td +(0465 }) 3.612 Tj +0 -24.8727 Td +(0466 ) 3.01 Tj +0 -26.1818 Td +(0467 static __inline uint) 15.05 Tj +0 -27.4909 Td +(0468 cmpxchg\(uint oldval, uint newval, volatile uint* lock_addr\)) 38.528 Tj +0 -28.8 Td +(0469 {) 3.612 Tj +0 -30.1091 Td +(0470 uint result;) 11.438 Tj +0 -31.4182 Td +(0471 __asm__ __volatile__\("lock; cmpxchgl %2, %0" :) 31.906 Tj +0 -32.7273 Td +(0472 "+m" \(*lock_addr\), "=a" \(result\) :) 37.324 Tj +0 -34.0364 Td +(0473 "r"\(newval\), "1"\(oldval\) :) 32.508 Tj +0 -35.3454 Td +(0474 "cc"\);) 20.468 Tj +0 -36.6545 Td +(0475 return result;) 12.642 Tj +0 -37.9636 Td +(0476 }) 3.612 Tj +0 -39.2727 Td +(0477 ) 3.01 Tj +0 -40.5818 Td +(0478 static __inline void) 15.05 Tj +0 -41.8909 Td +(0479 cli\(void\)) 8.428 Tj +0 -43.2 Td +(0480 {) 3.612 Tj +0 -44.5091 Td +(0481 __asm__ volatile\("cli"\);) 18.662 Tj +0 -45.8182 Td +(0482 }) 3.612 Tj +0 -47.1272 Td +(0483 ) 3.01 Tj +0 -48.4363 Td +(0484 static __inline void) 15.05 Tj +0 -49.7454 Td +(0485 sti\(void\)) 8.428 Tj +0 -51.0545 Td +(0486 {) 3.612 Tj +0 -52.3636 Td +(0487 __asm__ volatile\("sti"\);) 18.662 Tj +0 -53.6727 Td +(0488 }) 3.612 Tj +0 -54.9818 Td +(0489 ) 3.01 Tj +0 -56.2909 Td +(0490 ) 3.01 Tj +0 -57.6 Td +(0491 ) 3.01 Tj +0 -58.9091 Td +(0492 ) 3.01 Tj +0 -60.2181 Td +(0493 ) 3.01 Tj +0 -61.5272 Td +(0494 ) 3.01 Tj +0 -62.8363 Td +(0495 ) 3.01 Tj +0 -64.1454 Td +(0496 ) 3.01 Tj +0 -65.4545 Td +(0497 ) 3.01 Tj +0 -66.7636 Td +(0498 ) 3.01 Tj +0 -68.0727 Td +(0499 ) 3.01 Tj +0 -72 Td +(Sheet 04) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 12 12 +%%BeginPageSetup +%%PageOrientation: Landscape +__tumble pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/x86.h Page 4) 21.672 Tj +0 -3.92728 Td +(0500 // Layout of the trap frame on the stack upon entry to trap.) 39.13 Tj +0 -5.23637 Td +(0501 struct trapframe {) 13.846 Tj +0 -6.54546 Td +(0502 // registers as pushed by pusha) 22.876 Tj +0 -7.85455 Td +(0503 uint edi;) 9.632 Tj +0 -9.16364 Td +(0504 uint esi;) 9.632 Tj +0 -10.4727 Td +(0505 uint ebp;) 9.632 Tj +0 -11.7818 Td +(0506 uint oesp; // useless & ignored) 25.886 Tj +0 -13.0909 Td +(0507 uint ebx;) 9.632 Tj +0 -14.4 Td +(0508 uint edx;) 9.632 Tj +0 -15.7091 Td +(0509 uint ecx;) 9.632 Tj +0 -17.0182 Td +(0510 uint eax;) 9.632 Tj +0 -18.3273 Td +(0511 ) 3.01 Tj +0 -19.6364 Td +(0512 // rest of trap frame) 16.856 Tj +0 -20.9455 Td +(0513 ushort es;) 10.234 Tj +0 -22.2545 Td +(0514 ushort padding1;) 13.846 Tj +0 -23.5636 Td +(0515 ushort ds;) 10.234 Tj +0 -24.8727 Td +(0516 ushort padding2;) 13.846 Tj +0 -26.1818 Td +(0517 uint trapno;) 11.438 Tj +0 -27.4909 Td +(0518 ) 3.01 Tj +0 -28.8 Td +(0519 // below here defined by x86 hardware) 26.488 Tj +0 -30.1091 Td +(0520 uint err;) 9.632 Tj +0 -31.4182 Td +(0521 uint eip;) 9.632 Tj +0 -32.7273 Td +(0522 ushort cs;) 10.234 Tj +0 -34.0364 Td +(0523 ushort padding3;) 13.846 Tj +0 -35.3454 Td +(0524 uint eflags;) 11.438 Tj +0 -36.6545 Td +(0525 ) 3.01 Tj +0 -37.9636 Td +(0526 // below here only when crossing rings, such as from user to kernel) 44.548 Tj +0 -39.2727 Td +(0527 uint esp;) 9.632 Tj +0 -40.5818 Td +(0528 ushort ss;) 10.234 Tj +0 -41.8909 Td +(0529 ushort padding4;) 13.846 Tj +0 -43.2 Td +(0530 };) 4.214 Tj +0 -44.5091 Td +(0531 ) 3.01 Tj +0 -45.8182 Td +(0532 ) 3.01 Tj +0 -47.1272 Td +(0533 ) 3.01 Tj +0 -48.4363 Td +(0534 ) 3.01 Tj +0 -49.7454 Td +(0535 ) 3.01 Tj +0 -51.0545 Td +(0536 ) 3.01 Tj +0 -52.3636 Td +(0537 ) 3.01 Tj +0 -53.6727 Td +(0538 ) 3.01 Tj +0 -54.9818 Td +(0539 ) 3.01 Tj +0 -56.2909 Td +(0540 ) 3.01 Tj +0 -57.6 Td +(0541 ) 3.01 Tj +0 -58.9091 Td +(0542 ) 3.01 Tj +0 -60.2181 Td +(0543 ) 3.01 Tj +0 -61.5272 Td +(0544 ) 3.01 Tj +0 -62.8363 Td +(0545 ) 3.01 Tj +0 -64.1454 Td +(0546 ) 3.01 Tj +0 -65.4545 Td +(0547 ) 3.01 Tj +0 -66.7636 Td +(0548 ) 3.01 Tj +0 -68.0727 Td +(0549 ) 3.01 Tj +0 -72 Td +(Sheet 05) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/asm.h Page 1) 21.672 Tj +0 -3.92728 Td +(0550 //) 4.214 Tj +0 -5.23637 Td +(0551 // macros to create x86 segments from assembler) 31.304 Tj +0 -6.54546 Td +(0552 //) 4.214 Tj +0 -7.85455 Td +(0553 ) 3.01 Tj +0 -9.16364 Td +(0554 #define SEG_NULLASM \\) 42.14 Tj +0 -10.4727 Td +(0555 .word 0, 0; \\) 42.14 Tj +0 -11.7818 Td +(0556 .byte 0, 0, 0, 0) 17.458 Tj +0 -13.0909 Td +(0557 ) 3.01 Tj +0 -14.4 Td +(0558 #define SEG_ASM\(type,base,lim\) \\) 42.14 Tj +0 -15.7091 Td +(0559 .word \(\(\(lim\) >> 12\) & 0xffff\), \(\(base\) & 0xffff\); \\) 42.14 Tj +0 -17.0182 Td +(0560 .byte \(\(\(base\) >> 16\) & 0xff\), \(0x90 | \(type\)\), \\) 42.14 Tj +0 -18.3273 Td +(0561 \(0xC0 | \(\(\(lim\) >> 28\) & 0xf\)\), \(\(\(base\) >> 24\) & 0xff\)) 45.752 Tj +0 -19.6364 Td +(0562 ) 3.01 Tj +0 -20.9455 Td +(0563 #define STA_X 0x8 // Executable segment) 32.508 Tj +0 -22.2545 Td +(0564 #define STA_E 0x4 // Expand down \(non-executable segments\)) 43.946 Tj +0 -23.5636 Td +(0565 #define STA_C 0x4 // Conforming code segment \(executable only\)) 46.354 Tj +0 -24.8727 Td +(0566 #define STA_W 0x2 // Writeable \(non-executable segments\)) 42.742 Tj +0 -26.1818 Td +(0567 #define STA_R 0x2 // Readable \(executable segments\)) 39.732 Tj +0 -27.4909 Td +(0568 #define STA_A 0x1 // Accessed) 26.488 Tj +0 -28.8 Td +(0569 ) 3.01 Tj +0 -30.1091 Td +(0570 ) 3.01 Tj +0 -31.4182 Td +(0571 ) 3.01 Tj +0 -32.7273 Td +(0572 ) 3.01 Tj +0 -34.0364 Td +(0573 ) 3.01 Tj +0 -35.3454 Td +(0574 ) 3.01 Tj +0 -36.6545 Td +(0575 ) 3.01 Tj +0 -37.9636 Td +(0576 ) 3.01 Tj +0 -39.2727 Td +(0577 ) 3.01 Tj +0 -40.5818 Td +(0578 ) 3.01 Tj +0 -41.8909 Td +(0579 ) 3.01 Tj +0 -43.2 Td +(0580 ) 3.01 Tj +0 -44.5091 Td +(0581 ) 3.01 Tj +0 -45.8182 Td +(0582 ) 3.01 Tj +0 -47.1272 Td +(0583 ) 3.01 Tj +0 -48.4363 Td +(0584 ) 3.01 Tj +0 -49.7454 Td +(0585 ) 3.01 Tj +0 -51.0545 Td +(0586 ) 3.01 Tj +0 -52.3636 Td +(0587 ) 3.01 Tj +0 -53.6727 Td +(0588 ) 3.01 Tj +0 -54.9818 Td +(0589 ) 3.01 Tj +0 -56.2909 Td +(0590 ) 3.01 Tj +0 -57.6 Td +(0591 ) 3.01 Tj +0 -58.9091 Td +(0592 ) 3.01 Tj +0 -60.2181 Td +(0593 ) 3.01 Tj +0 -61.5272 Td +(0594 ) 3.01 Tj +0 -62.8363 Td +(0595 ) 3.01 Tj +0 -64.1454 Td +(0596 ) 3.01 Tj +0 -65.4545 Td +(0597 ) 3.01 Tj +0 -66.7636 Td +(0598 ) 3.01 Tj +0 -68.0727 Td +(0599 ) 3.01 Tj +0 -72 Td +(Sheet 05) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 13 13 +%%BeginPageSetup +%%PageOrientation: Landscape +pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/mmu.h Page 1) 21.672 Tj +0 -3.92728 Td +(0600 // This file contains definitions for the) 27.692 Tj +0 -5.23637 Td +(0601 // x86 memory management unit \(MMU\).) 24.682 Tj +0 -6.54546 Td +(0602 ) 3.01 Tj +0 -7.85455 Td +(0603 // Eflags register) 13.846 Tj +0 -9.16364 Td +(0604 #define FL_CF 0x00000001 // Carry Flag) 34.916 Tj +0 -10.4727 Td +(0605 #define FL_PF 0x00000004 // Parity Flag) 35.518 Tj +0 -11.7818 Td +(0606 #define FL_AF 0x00000010 // Auxiliary carry Flag) 40.936 Tj +0 -13.0909 Td +(0607 #define FL_ZF 0x00000040 // Zero Flag) 34.314 Tj +0 -14.4 Td +(0608 #define FL_SF 0x00000080 // Sign Flag) 34.314 Tj +0 -15.7091 Td +(0609 #define FL_TF 0x00000100 // Trap Flag) 34.314 Tj +0 -17.0182 Td +(0610 #define FL_IF 0x00000200 // Interrupt Enable) 38.528 Tj +0 -18.3273 Td +(0611 #define FL_DF 0x00000400 // Direction Flag) 37.324 Tj +0 -19.6364 Td +(0612 #define FL_OF 0x00000800 // Overflow Flag) 36.722 Tj +0 -20.9455 Td +(0613 #define FL_IOPL_MASK 0x00003000 // I/O Privilege Level bitmask) 45.15 Tj +0 -22.2545 Td +(0614 #define FL_IOPL_0 0x00000000 // IOPL == 0) 35.518 Tj +0 -23.5636 Td +(0615 #define FL_IOPL_1 0x00001000 // IOPL == 1) 35.518 Tj +0 -24.8727 Td +(0616 #define FL_IOPL_2 0x00002000 // IOPL == 2) 35.518 Tj +0 -26.1818 Td +(0617 #define FL_IOPL_3 0x00003000 // IOPL == 3) 35.518 Tj +0 -27.4909 Td +(0618 #define FL_NT 0x00004000 // Nested Task) 35.518 Tj +0 -28.8 Td +(0619 #define FL_RF 0x00010000 // Resume Flag) 35.518 Tj +0 -30.1091 Td +(0620 #define FL_VM 0x00020000 // Virtual 8086 mode) 39.13 Tj +0 -31.4182 Td +(0621 #define FL_AC 0x00040000 // Alignment Check) 37.926 Tj +0 -32.7273 Td +(0622 #define FL_VIF 0x00080000 // Virtual Interrupt Flag) 42.14 Tj +0 -34.0364 Td +(0623 #define FL_VIP 0x00100000 // Virtual Interrupt Pending) 43.946 Tj +0 -35.3454 Td +(0624 #define FL_ID 0x00200000 // ID flag) 33.11 Tj +0 -36.6545 Td +(0625 ) 3.01 Tj +0 -37.9636 Td +(0626 // Segment Descriptor) 15.652 Tj +0 -39.2727 Td +(0627 struct segdesc {) 12.642 Tj +0 -40.5818 Td +(0628 uint lim_15_0 : 16; // Low bits of segment limit) 33.712 Tj +0 -41.8909 Td +(0629 uint base_15_0 : 16; // Low bits of segment base address) 37.926 Tj +0 -43.2 Td +(0630 uint base_23_16 : 8; // Middle bits of segment base address) 39.732 Tj +0 -44.5091 Td +(0631 uint type : 4; // Segment type \(see STS_ constants\)) 38.528 Tj +0 -45.8182 Td +(0632 uint s : 1; // 0 = system, 1 = application) 34.916 Tj +0 -47.1272 Td +(0633 uint dpl : 2; // Descriptor Privilege Level) 34.314 Tj +0 -48.4363 Td +(0634 uint p : 1; // Present) 22.876 Tj +0 -49.7454 Td +(0635 uint lim_19_16 : 4; // High bits of segment limit) 34.314 Tj +0 -51.0545 Td +(0636 uint avl : 1; // Unused \(available for software use\)) 39.732 Tj +0 -52.3636 Td +(0637 uint rsv1 : 1; // Reserved) 23.478 Tj +0 -53.6727 Td +(0638 uint db : 1; // 0 = 16-bit segment, 1 = 32-bit segment) 41.538 Tj +0 -54.9818 Td +(0639 uint g : 1; // Granularity: limit scaled by 4K when set) 42.742 Tj +0 -56.2909 Td +(0640 uint base_31_24 : 8; // High bits of segment base address) 38.528 Tj +0 -57.6 Td +(0641 };) 4.214 Tj +0 -58.9091 Td +(0642 ) 3.01 Tj +0 -60.2181 Td +(0643 ) 3.01 Tj +0 -61.5272 Td +(0644 ) 3.01 Tj +0 -62.8363 Td +(0645 ) 3.01 Tj +0 -64.1454 Td +(0646 ) 3.01 Tj +0 -65.4545 Td +(0647 ) 3.01 Tj +0 -66.7636 Td +(0648 ) 3.01 Tj +0 -68.0727 Td +(0649 ) 3.01 Tj +0 -72 Td +(Sheet 06) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/mmu.h Page 2) 21.672 Tj +0 -3.92728 Td +(0650 // Null segment) 12.04 Tj +0 -5.23637 Td +(0651 #define SEG_NULL \(struct segdesc\){ 0,0,0,0,0,0,0,0,0,0,0,0,0 }) 44.548 Tj +0 -6.54546 Td +(0652 ) 3.01 Tj +0 -7.85455 Td +(0653 // Normal segment) 13.244 Tj +0 -9.16364 Td +(0654 #define SEG\(type, base, lim, dpl\) \(struct segdesc\) \\) 46.956 Tj +0 -10.4727 Td +(0655 { \(\(lim\) >> 12\) & 0xffff, \(base\) & 0xffff, \(\(base\) >> 16\) & 0xff, \\) 46.956 Tj +0 -11.7818 Td +(0656 type, 1, dpl, 1, \(uint\) \(lim\) >> 28, 0, 0, 1, 1, \\) 42.14 Tj +0 -13.0909 Td +(0657 \(uint\) \(base\) >> 24 }) 18.06 Tj +0 -14.4 Td +(0658 ) 3.01 Tj +0 -15.7091 Td +(0659 #define SEG16\(type, base, lim, dpl\) \(struct segdesc\) \\) 46.956 Tj +0 -17.0182 Td +(0660 { \(lim\) & 0xffff, \(base\) & 0xffff, \(\(base\) >> 16\) & 0xff, \\) 46.956 Tj +0 -18.3273 Td +(0661 type, 1, dpl, 1, \(uint\) \(lim\) >> 16, 0, 0, 1, 0, \\) 42.14 Tj +0 -19.6364 Td +(0662 \(uint\) \(base\) >> 24 }) 18.06 Tj +0 -20.9455 Td +(0663 ) 3.01 Tj +0 -22.2545 Td +(0664 // Application segment type bits) 22.274 Tj +0 -23.5636 Td +(0665 #define STA_X 0x8 // Executable segment) 32.508 Tj +0 -24.8727 Td +(0666 #define STA_E 0x4 // Expand down \(non-executable segments\)) 43.946 Tj +0 -26.1818 Td +(0667 #define STA_C 0x4 // Conforming code segment \(executable only\)) 46.354 Tj +0 -27.4909 Td +(0668 #define STA_W 0x2 // Writeable \(non-executable segments\)) 42.742 Tj +0 -28.8 Td +(0669 #define STA_R 0x2 // Readable \(executable segments\)) 39.732 Tj +0 -30.1091 Td +(0670 #define STA_A 0x1 // Accessed) 26.488 Tj +0 -31.4182 Td +(0671 ) 3.01 Tj +0 -32.7273 Td +(0672 // System segment type bits) 19.264 Tj +0 -34.0364 Td +(0673 #define STS_T16A 0x1 // Available 16-bit TSS) 33.712 Tj +0 -35.3454 Td +(0674 #define STS_LDT 0x2 // Local Descriptor Table) 34.916 Tj +0 -36.6545 Td +(0675 #define STS_T16B 0x3 // Busy 16-bit TSS) 30.702 Tj +0 -37.9636 Td +(0676 #define STS_CG16 0x4 // 16-bit Call Gate) 31.304 Tj +0 -39.2727 Td +(0677 #define STS_TG 0x5 // Task Gate / Coum Transmitions) 39.13 Tj +0 -40.5818 Td +(0678 #define STS_IG16 0x6 // 16-bit Interrupt Gate) 34.314 Tj +0 -41.8909 Td +(0679 #define STS_TG16 0x7 // 16-bit Trap Gate) 31.304 Tj +0 -43.2 Td +(0680 #define STS_T32A 0x9 // Available 32-bit TSS) 33.712 Tj +0 -44.5091 Td +(0681 #define STS_T32B 0xB // Busy 32-bit TSS) 30.702 Tj +0 -45.8182 Td +(0682 #define STS_CG32 0xC // 32-bit Call Gate) 31.304 Tj +0 -47.1272 Td +(0683 #define STS_IG32 0xE // 32-bit Interrupt Gate) 34.314 Tj +0 -48.4363 Td +(0684 #define STS_TG32 0xF // 32-bit Trap Gate) 31.304 Tj +0 -49.7454 Td +(0685 ) 3.01 Tj +0 -51.0545 Td +(0686 // Task state segment format) 19.866 Tj +0 -52.3636 Td +(0687 struct taskstate {) 13.846 Tj +0 -53.6727 Td +(0688 uint link; // Old ts selector) 24.682 Tj +0 -54.9818 Td +(0689 uint esp0; // Stack pointers and segment selectors) 37.324 Tj +0 -56.2909 Td +(0690 ushort ss0; // after an increase in privilege level) 38.528 Tj +0 -57.6 Td +(0691 ushort padding1;) 13.846 Tj +0 -58.9091 Td +(0692 uint *esp1;) 10.836 Tj +0 -60.2181 Td +(0693 ushort ss1;) 10.836 Tj +0 -61.5272 Td +(0694 ushort padding2;) 13.846 Tj +0 -62.8363 Td +(0695 uint *esp2;) 10.836 Tj +0 -64.1454 Td +(0696 ushort ss2;) 10.836 Tj +0 -65.4545 Td +(0697 ushort padding3;) 13.846 Tj +0 -66.7636 Td +(0698 void *cr3; // Page directory base) 26.488 Tj +0 -68.0727 Td +(0699 uint *eip; // Saved state from last task switch) 34.916 Tj +0 -72 Td +(Sheet 06) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 14 14 +%%BeginPageSetup +%%PageOrientation: Landscape +__tumble pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/mmu.h Page 3) 21.672 Tj +0 -3.92728 Td +(0700 uint eflags;) 11.438 Tj +0 -5.23637 Td +(0701 uint eax; // More saved state \(registers\)) 32.508 Tj +0 -6.54546 Td +(0702 uint ecx;) 9.632 Tj +0 -7.85455 Td +(0703 uint edx;) 9.632 Tj +0 -9.16364 Td +(0704 uint ebx;) 9.632 Tj +0 -10.4727 Td +(0705 uint *esp;) 10.234 Tj +0 -11.7818 Td +(0706 uint *ebp;) 10.234 Tj +0 -13.0909 Td +(0707 uint esi;) 9.632 Tj +0 -14.4 Td +(0708 uint edi;) 9.632 Tj +0 -15.7091 Td +(0709 ushort es; // Even more saved state \(segment selectors\)) 45.15 Tj +0 -17.0182 Td +(0710 ushort padding4;) 13.846 Tj +0 -18.3273 Td +(0711 ushort cs;) 10.234 Tj +0 -19.6364 Td +(0712 ushort padding5;) 13.846 Tj +0 -20.9455 Td +(0713 ushort ss;) 10.234 Tj +0 -22.2545 Td +(0714 ushort padding6;) 13.846 Tj +0 -23.5636 Td +(0715 ushort ds;) 10.234 Tj +0 -24.8727 Td +(0716 ushort padding7;) 13.846 Tj +0 -26.1818 Td +(0717 ushort fs;) 10.234 Tj +0 -27.4909 Td +(0718 ushort padding8;) 13.846 Tj +0 -28.8 Td +(0719 ushort gs;) 10.234 Tj +0 -30.1091 Td +(0720 ushort padding9;) 13.846 Tj +0 -31.4182 Td +(0721 ushort ldt;) 10.836 Tj +0 -32.7273 Td +(0722 ushort padding10;) 14.448 Tj +0 -34.0364 Td +(0723 ushort t; // Trap on task switch) 31.906 Tj +0 -35.3454 Td +(0724 ushort iomb; // I/O map base address) 27.692 Tj +0 -36.6545 Td +(0725 };) 4.214 Tj +0 -37.9636 Td +(0726 ) 3.01 Tj +0 -39.2727 Td +(0727 // Gate descriptors for interrupts and traps) 29.498 Tj +0 -40.5818 Td +(0728 struct gatedesc {) 13.244 Tj +0 -41.8909 Td +(0729 uint off_15_0 : 16; // low 16 bits of offset in segment) 38.528 Tj +0 -43.2 Td +(0730 uint ss : 16; // segment selector) 28.896 Tj +0 -44.5091 Td +(0731 uint args : 5; // # args, 0 for interrupt/trap gates) 39.732 Tj +0 -45.8182 Td +(0732 uint rsv1 : 3; // reserved\(should be zero I guess\)) 38.528 Tj +0 -47.1272 Td +(0733 uint type : 4; // type\(STS_{TG,IG32,TG32}\)) 33.712 Tj +0 -48.4363 Td +(0734 uint s : 1; // must be 0 \(system\)) 30.1 Tj +0 -49.7454 Td +(0735 uint dpl : 2; // descriptor\(meaning new\) privilege level) 42.742 Tj +0 -51.0545 Td +(0736 uint p : 1; // Present) 23.478 Tj +0 -52.3636 Td +(0737 uint off_31_16 : 16; // high bits of offset in segment) 37.324 Tj +0 -53.6727 Td +(0738 };) 4.214 Tj +0 -54.9818 Td +(0739 ) 3.01 Tj +0 -56.2909 Td +(0740 ) 3.01 Tj +0 -57.6 Td +(0741 ) 3.01 Tj +0 -58.9091 Td +(0742 ) 3.01 Tj +0 -60.2181 Td +(0743 ) 3.01 Tj +0 -61.5272 Td +(0744 ) 3.01 Tj +0 -62.8363 Td +(0745 ) 3.01 Tj +0 -64.1454 Td +(0746 ) 3.01 Tj +0 -65.4545 Td +(0747 ) 3.01 Tj +0 -66.7636 Td +(0748 ) 3.01 Tj +0 -68.0727 Td +(0749 ) 3.01 Tj +0 -72 Td +(Sheet 07) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/mmu.h Page 4) 21.672 Tj +0 -3.92728 Td +(0750 // Set up a normal interrupt/trap gate descriptor.) 33.11 Tj +0 -5.23637 Td +(0751 // - istrap: 1 for a trap \(= exception\) gate, 0 for an interrupt gate.) 45.15 Tj +0 -6.54546 Td +(0752 // interrupt gate clears FL_IF, trap gate leaves FL_IF alone) 40.334 Tj +0 -7.85455 Td +(0753 // - sel: Code segment selector for interrupt/trap handler) 37.926 Tj +0 -9.16364 Td +(0754 // - off: Offset in code segment for interrupt/trap handler) 38.528 Tj +0 -10.4727 Td +(0755 // - dpl: Descriptor Privilege Level -) 25.886 Tj +0 -11.7818 Td +(0756 // the privilege level required for software to invoke) 39.732 Tj +0 -13.0909 Td +(0757 // this interrupt/trap gate explicitly using an int instruction.) 45.752 Tj +0 -14.4 Td +(0758 #define SETGATE\(gate, istrap, sel, off, d\) \\) 42.14 Tj +0 -15.7091 Td +(0759 { \\) 42.14 Tj +0 -17.0182 Td +(0760 \(gate\).off_15_0 = \(uint\) \(off\) & 0xffff; \\) 38.528 Tj +0 -18.3273 Td +(0761 \(gate\).ss = \(sel\); \\) 38.528 Tj +0 -19.6364 Td +(0762 \(gate\).args = 0; \\) 38.528 Tj +0 -20.9455 Td +(0763 \(gate\).rsv1 = 0; \\) 38.528 Tj +0 -22.2545 Td +(0764 \(gate\).type = \(istrap\) ? STS_TG32 : STS_IG32; \\) 33.712 Tj +0 -23.5636 Td +(0765 \(gate\).s = 0; \\) 33.712 Tj +0 -24.8727 Td +(0766 \(gate\).dpl = \(d\); \\) 38.528 Tj +0 -26.1818 Td +(0767 \(gate\).p = 1; \\) 33.712 Tj +0 -27.4909 Td +(0768 \(gate\).off_31_16 = \(uint\) \(off\) >> 16; \\) 33.712 Tj +0 -28.8 Td +(0769 }) 3.612 Tj +0 -30.1091 Td +(0770 ) 3.01 Tj +0 -31.4182 Td +(0771 ) 3.01 Tj +0 -32.7273 Td +(0772 ) 3.01 Tj +0 -34.0364 Td +(0773 ) 3.01 Tj +0 -35.3454 Td +(0774 ) 3.01 Tj +0 -36.6545 Td +(0775 ) 3.01 Tj +0 -37.9636 Td +(0776 ) 3.01 Tj +0 -39.2727 Td +(0777 ) 3.01 Tj +0 -40.5818 Td +(0778 ) 3.01 Tj +0 -41.8909 Td +(0779 ) 3.01 Tj +0 -43.2 Td +(0780 ) 3.01 Tj +0 -44.5091 Td +(0781 ) 3.01 Tj +0 -45.8182 Td +(0782 ) 3.01 Tj +0 -47.1272 Td +(0783 ) 3.01 Tj +0 -48.4363 Td +(0784 ) 3.01 Tj +0 -49.7454 Td +(0785 ) 3.01 Tj +0 -51.0545 Td +(0786 ) 3.01 Tj +0 -52.3636 Td +(0787 ) 3.01 Tj +0 -53.6727 Td +(0788 ) 3.01 Tj +0 -54.9818 Td +(0789 ) 3.01 Tj +0 -56.2909 Td +(0790 ) 3.01 Tj +0 -57.6 Td +(0791 ) 3.01 Tj +0 -58.9091 Td +(0792 ) 3.01 Tj +0 -60.2181 Td +(0793 ) 3.01 Tj +0 -61.5272 Td +(0794 ) 3.01 Tj +0 -62.8363 Td +(0795 ) 3.01 Tj +0 -64.1454 Td +(0796 ) 3.01 Tj +0 -65.4545 Td +(0797 ) 3.01 Tj +0 -66.7636 Td +(0798 ) 3.01 Tj +0 -68.0727 Td +(0799 ) 3.01 Tj +0 -72 Td +(Sheet 07) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 15 15 +%%BeginPageSetup +%%PageOrientation: Landscape +pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/elf.h Page 1) 21.672 Tj +0 -3.92728 Td +(0800 // Format of an ELF executable file) 24.08 Tj +0 -5.23637 Td +(0801 ) 3.01 Tj +0 -6.54546 Td +(0802 #define ELF_MAGIC 0x464C457FU // "\\x7FELF" in little endian) 39.13 Tj +0 -7.85455 Td +(0803 ) 3.01 Tj +0 -9.16364 Td +(0804 // File header) 11.438 Tj +0 -10.4727 Td +(0805 struct elfhdr {) 12.04 Tj +0 -11.7818 Td +(0806 uint magic; // must equal ELF_MAGIC) 25.886 Tj +0 -13.0909 Td +(0807 uchar elf[12];) 12.642 Tj +0 -14.4 Td +(0808 ushort type;) 11.438 Tj +0 -15.7091 Td +(0809 ushort machine;) 13.244 Tj +0 -17.0182 Td +(0810 uint version;) 12.04 Tj +0 -18.3273 Td +(0811 uint entry;) 10.836 Tj +0 -19.6364 Td +(0812 uint phoff;) 10.836 Tj +0 -20.9455 Td +(0813 uint shoff;) 10.836 Tj +0 -22.2545 Td +(0814 uint flags;) 10.836 Tj +0 -23.5636 Td +(0815 ushort ehsize;) 12.642 Tj +0 -24.8727 Td +(0816 ushort phentsize;) 14.448 Tj +0 -26.1818 Td +(0817 ushort phnum;) 12.04 Tj +0 -27.4909 Td +(0818 ushort shentsize;) 14.448 Tj +0 -28.8 Td +(0819 ushort shnum;) 12.04 Tj +0 -30.1091 Td +(0820 ushort shstrndx;) 13.846 Tj +0 -31.4182 Td +(0821 };) 4.214 Tj +0 -32.7273 Td +(0822 ) 3.01 Tj +0 -34.0364 Td +(0823 // Program section header) 18.06 Tj +0 -35.3454 Td +(0824 struct proghdr {) 12.642 Tj +0 -36.6545 Td +(0825 uint type;) 10.234 Tj +0 -37.9636 Td +(0826 uint offset;) 11.438 Tj +0 -39.2727 Td +(0827 uint va;) 9.03 Tj +0 -40.5818 Td +(0828 uint pa;) 9.03 Tj +0 -41.8909 Td +(0829 uint filesz;) 11.438 Tj +0 -43.2 Td +(0830 uint memsz;) 10.836 Tj +0 -44.5091 Td +(0831 uint flags;) 10.836 Tj +0 -45.8182 Td +(0832 uint align;) 10.836 Tj +0 -47.1272 Td +(0833 };) 4.214 Tj +0 -48.4363 Td +(0834 ) 3.01 Tj +0 -49.7454 Td +(0835 // Values for Proghdr type) 18.662 Tj +0 -51.0545 Td +(0836 #define ELF_PROG_LOAD 1) 22.876 Tj +0 -52.3636 Td +(0837 ) 3.01 Tj +0 -53.6727 Td +(0838 // Flag bits for Proghdr flags) 21.07 Tj +0 -54.9818 Td +(0839 #define ELF_PROG_FLAG_EXEC 1) 22.876 Tj +0 -56.2909 Td +(0840 #define ELF_PROG_FLAG_WRITE 2) 22.876 Tj +0 -57.6 Td +(0841 #define ELF_PROG_FLAG_READ 4) 22.876 Tj +0 -58.9091 Td +(0842 ) 3.01 Tj +0 -60.2181 Td +(0843 ) 3.01 Tj +0 -61.5272 Td +(0844 ) 3.01 Tj +0 -62.8363 Td +(0845 ) 3.01 Tj +0 -64.1454 Td +(0846 ) 3.01 Tj +0 -65.4545 Td +(0847 ) 3.01 Tj +0 -66.7636 Td +(0848 ) 3.01 Tj +0 -68.0727 Td +(0849 ) 3.01 Tj +0 -72 Td +(Sheet 08) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/mp.h Page 1) 21.07 Tj +0 -3.92728 Td +(0850 // See MultiProcessor Specification Version 1.[14].) 33.712 Tj +0 -5.23637 Td +(0851 ) 3.01 Tj +0 -6.54546 Td +(0852 struct mp { // floating pointer) 28.896 Tj +0 -7.85455 Td +(0853 uchar signature[4]; // "_MP_") 27.692 Tj +0 -9.16364 Td +(0854 void *physaddr; // phys addr of MP config table) 40.936 Tj +0 -10.4727 Td +(0855 uchar length; // 1) 24.682 Tj +0 -11.7818 Td +(0856 uchar specrev; // [14]) 26.488 Tj +0 -13.0909 Td +(0857 uchar checksum; // all bytes must add up to 0) 39.732 Tj +0 -14.4 Td +(0858 uchar type; // MP system config type) 36.722 Tj +0 -15.7091 Td +(0859 uchar imcrp;) 11.438 Tj +0 -17.0182 Td +(0860 uchar reserved[3];) 15.05 Tj +0 -18.3273 Td +(0861 };) 4.214 Tj +0 -19.6364 Td +(0862 ) 3.01 Tj +0 -20.9455 Td +(0863 struct mpctb { // configuration table header) 34.916 Tj +0 -22.2545 Td +(0864 uchar signature[4]; // "PCMP") 27.692 Tj +0 -23.5636 Td +(0865 ushort length; // total table length) 34.916 Tj +0 -24.8727 Td +(0866 uchar version; // [14]) 26.488 Tj +0 -26.1818 Td +(0867 uchar checksum; // all bytes must add up to 0) 39.732 Tj +0 -27.4909 Td +(0868 uchar product[20]; // product id) 30.1 Tj +0 -28.8 Td +(0869 uint *oemtable; // OEM table pointer) 34.314 Tj +0 -30.1091 Td +(0870 ushort oemlength; // OEM table length) 33.712 Tj +0 -31.4182 Td +(0871 ushort entry; // entry count) 30.702 Tj +0 -32.7273 Td +(0872 uint *lapicaddr; // address of local APIC) 36.722 Tj +0 -34.0364 Td +(0873 ushort xlength; // extended table length) 36.722 Tj +0 -35.3454 Td +(0874 uchar xchecksum; // extended table checksum) 37.926 Tj +0 -36.6545 Td +(0875 uchar reserved;) 13.244 Tj +0 -37.9636 Td +(0876 };) 4.214 Tj +0 -39.2727 Td +(0877 ) 3.01 Tj +0 -40.5818 Td +(0878 struct mppe { // processor table entry) 31.906 Tj +0 -41.8909 Td +(0879 uchar type; // entry type \(0\)) 32.508 Tj +0 -43.2 Td +(0880 uchar apicid; // local APIC id) 31.906 Tj +0 -44.5091 Td +(0881 uchar version; // local APIC verison) 34.916 Tj +0 -45.8182 Td +(0882 uchar flags; // CPU flags) 29.498 Tj +0 -47.1272 Td +(0883 uchar signature[4]; // CPU signature) 31.906 Tj +0 -48.4363 Td +(0884 uint feature; // feature flags from CPUID instruction) 45.752 Tj +0 -49.7454 Td +(0885 uchar reserved[8];) 15.05 Tj +0 -51.0545 Td +(0886 };) 4.214 Tj +0 -52.3636 Td +(0887 ) 3.01 Tj +0 -53.6727 Td +(0888 struct mpbe { // bus table entry) 28.294 Tj +0 -54.9818 Td +(0889 uchar type; // entry type \(1\)) 32.508 Tj +0 -56.2909 Td +(0890 uchar busno; // bus id) 27.692 Tj +0 -57.6 Td +(0891 char string[6]; // bus type string) 33.11 Tj +0 -58.9091 Td +(0892 };) 4.214 Tj +0 -60.2181 Td +(0893 ) 3.01 Tj +0 -61.5272 Td +(0894 ) 3.01 Tj +0 -62.8363 Td +(0895 ) 3.01 Tj +0 -64.1454 Td +(0896 ) 3.01 Tj +0 -65.4545 Td +(0897 ) 3.01 Tj +0 -66.7636 Td +(0898 ) 3.01 Tj +0 -68.0727 Td +(0899 ) 3.01 Tj +0 -72 Td +(Sheet 08) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 16 16 +%%BeginPageSetup +%%PageOrientation: Landscape +__tumble pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/mp.h Page 2) 21.07 Tj +0 -3.92728 Td +(0900 struct mpioapic { // I/O APIC table entry) 31.304 Tj +0 -5.23637 Td +(0901 uchar type; // entry type \(2\)) 32.508 Tj +0 -6.54546 Td +(0902 uchar apicno; // I/O APIC id) 30.702 Tj +0 -7.85455 Td +(0903 uchar version; // I/O APIC version) 33.712 Tj +0 -9.16364 Td +(0904 uchar flags; // I/O APIC flags) 32.508 Tj +0 -10.4727 Td +(0905 uint *addr; // I/O APIC address) 33.11 Tj +0 -11.7818 Td +(0906 };) 4.214 Tj +0 -13.0909 Td +(0907 ) 3.01 Tj +0 -14.4 Td +(0908 struct mpie { // interrupt table entry) 31.906 Tj +0 -15.7091 Td +(0909 uchar type; // entry type \([34]\)) 34.314 Tj +0 -17.0182 Td +(0910 uchar intr; // interrupt type) 32.508 Tj +0 -18.3273 Td +(0911 ushort flags; // interrupt flag) 32.508 Tj +0 -19.6364 Td +(0912 uchar busno; // source bus id) 31.906 Tj +0 -20.9455 Td +(0913 uchar irq; // source bus irq) 32.508 Tj +0 -22.2545 Td +(0914 uchar apicno; // destination APIC id) 35.518 Tj +0 -23.5636 Td +(0915 uchar intin; // destination APIC [L]INTIN#) 39.732 Tj +0 -24.8727 Td +(0916 };) 4.214 Tj +0 -26.1818 Td +(0917 ) 3.01 Tj +0 -27.4909 Td +(0918 enum { // table entry types) 29.498 Tj +0 -28.8 Td +(0919 MPPROCESSOR = 0x00, // one entry per processor) 37.926 Tj +0 -30.1091 Td +(0920 MPBUS = 0x01, // one entry per bus) 34.314 Tj +0 -31.4182 Td +(0921 MPIOAPIC = 0x02, // one entry per I/O APIC) 37.324 Tj +0 -32.7273 Td +(0922 MPIOINTR = 0x03, // one entry per bus interrupt source) 44.548 Tj +0 -34.0364 Td +(0923 MPLINTR = 0x04, // one entry per system interrupt source) 46.354 Tj +0 -35.3454 Td +(0924 ) 3.01 Tj +0 -36.6545 Td +(0925 MPSASM = 0x80,) 12.642 Tj +0 -37.9636 Td +(0926 MPHIERARCHY = 0x81,) 16.856 Tj +0 -39.2727 Td +(0927 MPCBASM = 0x82,) 13.244 Tj +0 -40.5818 Td +(0928 ) 3.01 Tj +0 -41.8909 Td +(0929 // PCMPprocessor and PCMPioapic flags) 39.732 Tj +0 -43.2 Td +(0930 MPEN = 0x01, // enabled) 28.294 Tj +0 -44.5091 Td +(0931 MPBP = 0x02, // bootstrap processor) 35.518 Tj +0 -45.8182 Td +(0932 ) 3.01 Tj +0 -47.1272 Td +(0933 // PCMPiointr and PCMPlintr flags) 37.324 Tj +0 -48.4363 Td +(0934 MPPOMASK = 0x03, // polarity conforms to bus specs) 42.14 Tj +0 -49.7454 Td +(0935 MPHIGH = 0x01, // active high) 30.702 Tj +0 -51.0545 Td +(0936 MPLOW = 0x03, // active low) 30.1 Tj +0 -52.3636 Td +(0937 MPELMASK = 0x0C, // trigger mode of APIC input signals) 44.548 Tj +0 -53.6727 Td +(0938 MPEDGE = 0x04, // edge-triggered) 32.508 Tj +0 -54.9818 Td +(0939 MPLEVEL = 0x0C, // level-triggered) 33.11 Tj +0 -56.2909 Td +(0940 ) 3.01 Tj +0 -57.6 Td +(0941 // PCMPiointr and PCMPlintr interrupt type) 42.742 Tj +0 -58.9091 Td +(0942 MPINT = 0x00, // vectored interrupt from APIC Rdt) 43.344 Tj +0 -60.2181 Td +(0943 MPNMI = 0x01, // non-maskable interrupt) 37.324 Tj +0 -61.5272 Td +(0944 MPSMI = 0x02, // system management interrupt) 40.334 Tj +0 -62.8363 Td +(0945 MPExtINT = 0x03, // vectored interrupt from external PIC) 45.752 Tj +0 -64.1454 Td +(0946 };) 4.214 Tj +0 -65.4545 Td +(0947 ) 3.01 Tj +0 -66.7636 Td +(0948 ) 3.01 Tj +0 -68.0727 Td +(0949 ) 3.01 Tj +0 -72 Td +(Sheet 09) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/mp.h Page 3) 21.07 Tj +0 -3.92728 Td +(0950 // Common bits for) 13.846 Tj +0 -5.23637 Td +(0951 // I/O APIC Redirection Table Entry;) 27.692 Tj +0 -6.54546 Td +(0952 // Local APIC Local Interrupt Vector Table;) 31.906 Tj +0 -7.85455 Td +(0953 // Local APIC Inter-Processor Interrupt;) 30.1 Tj +0 -9.16364 Td +(0954 // Local APIC Timer Vector Table.) 25.886 Tj +0 -10.4727 Td +(0955 enum {) 6.622 Tj +0 -11.7818 Td +(0956 APIC_FIXED = 0x00000000, // [10:8] Delivery Mode) 36.12 Tj +0 -13.0909 Td +(0957 APIC_LOWEST = 0x00000100, // Lowest priority) 33.11 Tj +0 -14.4 Td +(0958 APIC_SMI = 0x00000200, // System Management Interrupt) 40.334 Tj +0 -15.7091 Td +(0959 APIC_RR = 0x00000300, // Remote Read) 30.702 Tj +0 -17.0182 Td +(0960 APIC_NMI = 0x00000400,) 21.07 Tj +0 -18.3273 Td +(0961 APIC_INIT = 0x00000500, // INIT/RESET) 30.1 Tj +0 -19.6364 Td +(0962 APIC_STARTUP = 0x00000600, // Startup IPI) 30.702 Tj +0 -20.9455 Td +(0963 APIC_EXTINT = 0x00000700,) 21.07 Tj +0 -22.2545 Td +(0964 ) 3.01 Tj +0 -23.5636 Td +(0965 APIC_PHYSICAL = 0x00000000, // [11] Destination Mode \(RW\)) 39.732 Tj +0 -24.8727 Td +(0966 APIC_LOGICAL = 0x00000800,) 21.07 Tj +0 -26.1818 Td +(0967 ) 3.01 Tj +0 -27.4909 Td +(0968 APIC_DELIVS = 0x00001000, // [12] Delivery Status \(RO\)) 39.13 Tj +0 -28.8 Td +(0969 APIC_HIGH = 0x00000000, // [13] Interrupt Input Pin Polarity \(RW\)) 46.956 Tj +0 -30.1091 Td +(0970 APIC_LOW = 0x00002000,) 21.07 Tj +0 -31.4182 Td +(0971 APIC_REMOTEIRR = 0x00004000, // [14] Remote IRR \(RO\)) 36.12 Tj +0 -32.7273 Td +(0972 APIC_EDGE = 0x00000000, // [15] Trigger Mode \(RW\)) 37.324 Tj +0 -34.0364 Td +(0973 APIC_LEVEL = 0x00008000,) 21.07 Tj +0 -35.3454 Td +(0974 APIC_IMASK = 0x00010000, // [16] Interrupt Mask) 35.518 Tj +0 -36.6545 Td +(0975 };) 4.214 Tj +0 -37.9636 Td +(0976 ) 3.01 Tj +0 -39.2727 Td +(0977 ) 3.01 Tj +0 -40.5818 Td +(0978 ) 3.01 Tj +0 -41.8909 Td +(0979 ) 3.01 Tj +0 -43.2 Td +(0980 ) 3.01 Tj +0 -44.5091 Td +(0981 ) 3.01 Tj +0 -45.8182 Td +(0982 ) 3.01 Tj +0 -47.1272 Td +(0983 ) 3.01 Tj +0 -48.4363 Td +(0984 ) 3.01 Tj +0 -49.7454 Td +(0985 ) 3.01 Tj +0 -51.0545 Td +(0986 ) 3.01 Tj +0 -52.3636 Td +(0987 ) 3.01 Tj +0 -53.6727 Td +(0988 ) 3.01 Tj +0 -54.9818 Td +(0989 ) 3.01 Tj +0 -56.2909 Td +(0990 ) 3.01 Tj +0 -57.6 Td +(0991 ) 3.01 Tj +0 -58.9091 Td +(0992 ) 3.01 Tj +0 -60.2181 Td +(0993 ) 3.01 Tj +0 -61.5272 Td +(0994 ) 3.01 Tj +0 -62.8363 Td +(0995 ) 3.01 Tj +0 -64.1454 Td +(0996 ) 3.01 Tj +0 -65.4545 Td +(0997 ) 3.01 Tj +0 -66.7636 Td +(0998 ) 3.01 Tj +0 -68.0727 Td +(0999 ) 3.01 Tj +0 -72 Td +(Sheet 09) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 17 17 +%%BeginPageSetup +%%PageOrientation: Landscape +pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/bootasm.S Page 1) 24.08 Tj +0 -3.92728 Td +(1000 #include "asm.h") 12.642 Tj +0 -5.23637 Td +(1001 ) 3.01 Tj +0 -6.54546 Td +(1002 .set PROT_MODE_CSEG,0x8 # code segment selector) 36.12 Tj +0 -7.85455 Td +(1003 .set PROT_MODE_DSEG,0x10 # data segment selector) 36.12 Tj +0 -9.16364 Td +(1004 .set CR0_PE_ON,0x1 # protected mode enable flag) 39.13 Tj +0 -10.4727 Td +(1005 ) 3.01 Tj +0 -11.7818 Td +(1006 #########################################################################) 46.956 Tj +0 -13.0909 Td +(1007 # ENTRY POINT for the bootstrap processor) 27.692 Tj +0 -14.4 Td +(1008 # This code should be stored in the first sector of the hard disk.) 43.946 Tj +0 -15.7091 Td +(1009 # After the BIOS initializes the hardware on startup or system reset,) 45.752 Tj +0 -17.0182 Td +(1010 # it loads this code at physical address 0x7c00 - 0x7d00 \(512 bytes\).) 45.752 Tj +0 -18.3273 Td +(1011 # Then the BIOS jumps to the beginning of it, address 0x7c00,) 40.936 Tj +0 -19.6364 Td +(1012 # while running in 16-bit real-mode \(8086 compatibility mode\).) 41.538 Tj +0 -20.9455 Td +(1013 # The Code Segment register \(CS\) is initially zero on entry.) 40.334 Tj +0 -22.2545 Td +(1014 #) 3.612 Tj +0 -23.5636 Td +(1015 # This code switches into 32-bit protected mode so that all of) 40.334 Tj +0 -24.8727 Td +(1016 # memory can accessed, then calls into C.) 27.692 Tj +0 -26.1818 Td +(1017 #########################################################################) 46.956 Tj +0 -27.4909 Td +(1018 ) 3.01 Tj +0 -28.8 Td +(1019 .globl start # Entry point) 31.304 Tj +0 -30.1091 Td +(1020 start:) 6.622 Tj +0 -31.4182 Td +(1021 .code16 # This runs in real mode) 37.926 Tj +0 -32.7273 Td +(1022 cli # Disable interrupts) 35.518 Tj +0 -34.0364 Td +(1023 cld # String operations increment) 40.936 Tj +0 -35.3454 Td +(1024 ) 3.01 Tj +0 -36.6545 Td +(1025 # Set up the important data segment registers \(DS, ES, SS\).) 39.732 Tj +0 -37.9636 Td +(1026 xorw %ax,%ax # Segment number zero) 36.12 Tj +0 -39.2727 Td +(1027 movw %ax,%ds # -> Data Segment) 33.712 Tj +0 -40.5818 Td +(1028 movw %ax,%es # -> Extra Segment) 34.314 Tj +0 -41.8909 Td +(1029 movw %ax,%ss # -> Stack Segment) 34.314 Tj +0 -43.2 Td +(1030 ) 3.01 Tj +0 -44.5091 Td +(1031 # Set up the stack pointer, growing downward from 0x7c00.) 38.528 Tj +0 -45.8182 Td +(1032 movw $start,%sp # Stack Pointer) 32.508 Tj +0 -47.1272 Td +(1033 ) 3.01 Tj +0 -48.4363 Td +(1034 # Enable A20:) 12.04 Tj +0 -49.7454 Td +(1035 # For fascinating historical reasons \(related to the fact that) 42.742 Tj +0 -51.0545 Td +(1036 # the earliest 8086-based PCs could only address 1MB of physical) 43.946 Tj +0 -52.3636 Td +(1037 # memory and subsequent 80286-based PCs wanted to retain maximum) 43.946 Tj +0 -53.6727 Td +(1038 # compatibility\), physical address line 20 is tied to low when the) 45.15 Tj +0 -54.9818 Td +(1039 # machine boots. Obviously this a bit of a drag for us, especially) 45.752 Tj +0 -56.2909 Td +(1040 # when trying to address memory above 1MB. This code undoes this.) 45.15 Tj +0 -57.6 Td +(1041 ) 3.01 Tj +0 -58.9091 Td +(1042 seta20.1:) 8.428 Tj +0 -60.2181 Td +(1043 inb $0x64,%al # Get status) 30.702 Tj +0 -61.5272 Td +(1044 testb $0x2,%al # Busy?) 27.692 Tj +0 -62.8363 Td +(1045 jnz seta20.1 # Yes) 26.488 Tj +0 -64.1454 Td +(1046 movb $0xd1,%al # Command: Write) 33.11 Tj +0 -65.4545 Td +(1047 outb %al,$0x64 # output port) 31.906 Tj +0 -66.7636 Td +(1048 ) 3.01 Tj +0 -68.0727 Td +(1049 ) 3.01 Tj +0 -72 Td +(Sheet 10) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/bootasm.S Page 2) 24.08 Tj +0 -3.92728 Td +(1050 seta20.2:) 8.428 Tj +0 -5.23637 Td +(1051 inb $0x64,%al # Get status) 30.702 Tj +0 -6.54546 Td +(1052 testb $0x2,%al # Busy?) 27.692 Tj +0 -7.85455 Td +(1053 jnz seta20.2 # Yes) 26.488 Tj +0 -9.16364 Td +(1054 movb $0xdf,%al # Enable) 28.294 Tj +0 -10.4727 Td +(1055 outb %al,$0x60 # A20) 27.09 Tj +0 -11.7818 Td +(1056 ) 3.01 Tj +0 -13.0909 Td +(1057 # Switch from real to protected mode) 24.682 Tj +0 -14.4 Td +(1058 # The descriptors in our GDT allow all physical memory to be accessed.) 45.752 Tj +0 -15.7091 Td +(1059 # Furthermore, the descriptors have base addresses of 0, so that the) 44.548 Tj +0 -17.0182 Td +(1060 # segment translation is a NOP, ie. virtual addresses are identical to) 45.752 Tj +0 -18.3273 Td +(1061 # their physical addresses. With this setup, immediately after) 41.538 Tj +0 -19.6364 Td +(1062 # enabling protected mode it will still appear to this code) 39.13 Tj +0 -20.9455 Td +(1063 # that it is running directly on physical memory with no translation.) 45.15 Tj +0 -22.2545 Td +(1064 # This initial NOP-translation setup is required by the processor) 42.742 Tj +0 -23.5636 Td +(1065 # to ensure that the transition to protected mode occurs smoothly.) 43.344 Tj +0 -24.8727 Td +(1066 real_to_prot:) 10.836 Tj +0 -26.1818 Td +(1067 cli # Mandatory since we dont set up an IDT) 44.548 Tj +0 -27.4909 Td +(1068 lgdt gdtdesc # load GDT -- mandatory in protected mode) 45.752 Tj +0 -28.8 Td +(1069 movl %cr0, %eax # turn on protected mode) 35.518 Tj +0 -30.1091 Td +(1070 orl $CR0_PE_ON, %eax #) 21.672 Tj +0 -31.4182 Td +(1071 movl %eax, %cr0 #) 21.672 Tj +0 -32.7273 Td +(1072 ### CPU magic: jump to relocation, flush prefetch queue, and reload %cs) 46.956 Tj +0 -34.0364 Td +(1073 ### Has the effect of just jmp to the next instruction, but simultaneous) 47.558 Tj +0 -35.3454 Td +(1074 ### loads CS with $PROT_MODE_CSEG.) 24.682 Tj +0 -36.6545 Td +(1075 ljmp $PROT_MODE_CSEG, $protcseg) 24.682 Tj +0 -37.9636 Td +(1076 ) 3.01 Tj +0 -39.2727 Td +(1077 #### we are in 32-bit protected mode \(hence the .code32\)) 36.722 Tj +0 -40.5818 Td +(1078 .code32) 7.224 Tj +0 -41.8909 Td +(1079 protcseg:) 8.428 Tj +0 -43.2 Td +(1080 # Set up the protected-mode data segment registers) 34.314 Tj +0 -44.5091 Td +(1081 movw $PROT_MODE_DSEG, %ax # Our data segment selector) 39.732 Tj +0 -45.8182 Td +(1082 movw %ax, %ds # -> DS: Data Segment) 36.12 Tj +0 -47.1272 Td +(1083 movw %ax, %es # -> ES: Extra Segment) 36.722 Tj +0 -48.4363 Td +(1084 movw %ax, %fs # -> FS) 27.692 Tj +0 -49.7454 Td +(1085 movw %ax, %gs # -> GS) 27.692 Tj +0 -51.0545 Td +(1086 movw %ax, %ss # -> SS: Stack Segment) 36.722 Tj +0 -52.3636 Td +(1087 call cmain # finish the boot load from C.) 41.538 Tj +0 -53.6727 Td +(1088 # cmain\(\) should not return) 39.732 Tj +0 -54.9818 Td +(1089 spin:) 6.02 Tj +0 -56.2909 Td +(1090 jmp spin # ..but in case it does, spin) 40.936 Tj +0 -57.6 Td +(1091 ) 3.01 Tj +0 -58.9091 Td +(1092 .p2align 2 # force 4 byte alignment) 42.742 Tj +0 -60.2181 Td +(1093 gdt:) 5.418 Tj +0 -61.5272 Td +(1094 SEG_NULLASM # null seg) 34.314 Tj +0 -62.8363 Td +(1095 SEG_ASM\(STA_X|STA_R, 0x0, 0xffffffff\) # code seg) 34.314 Tj +0 -64.1454 Td +(1096 SEG_ASM\(STA_W, 0x0, 0xffffffff\) # data seg) 34.314 Tj +0 -65.4545 Td +(1097 gdtdesc:) 7.826 Tj +0 -66.7636 Td +(1098 .word 0x17 # sizeof\(gdt\) - 1) 38.528 Tj +0 -68.0727 Td +(1099 .long gdt # address gdt) 36.12 Tj +0 -72 Td +(Sheet 10) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 18 18 +%%BeginPageSetup +%%PageOrientation: Landscape +__tumble pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/bootother.S Page 1) 25.284 Tj +0 -3.92728 Td +(1100 #include "asm.h") 12.642 Tj +0 -5.23637 Td +(1101 ) 3.01 Tj +0 -6.54546 Td +(1102 # Start an Application Processor. This must be placed on a 4KB boundary) 45.752 Tj +0 -7.85455 Td +(1103 # somewhere in the 1st MB of conventional memory \(APBOOTSTRAP\). However,) 46.354 Tj +0 -9.16364 Td +(1104 # due to some shortcuts below it's restricted further to within the 1st) 45.752 Tj +0 -10.4727 Td +(1105 # 64KB. The AP starts in real-mode, with) 27.09 Tj +0 -11.7818 Td +(1106 # CS selector set to the startup memory address/16;) 34.916 Tj +0 -13.0909 Td +(1107 # CS base set to startup memory address;) 28.294 Tj +0 -14.4 Td +(1108 # CS limit set to 64KB;) 18.06 Tj +0 -15.7091 Td +(1109 # CPL and IP set to 0.) 17.458 Tj +0 -17.0182 Td +(1110 #) 3.612 Tj +0 -18.3273 Td +(1111 # mp.c causes each non-boot CPU in turn to jump to start.) 37.324 Tj +0 -19.6364 Td +(1112 # mp.c puts the correct %esp in start-4, and the place to jump) 40.334 Tj +0 -20.9455 Td +(1113 # to in start-8.) 12.642 Tj +0 -22.2545 Td +(1114 ) 3.01 Tj +0 -23.5636 Td +(1115 .set PROT_MODE_CSEG,0x8 # code segment selector) 36.12 Tj +0 -24.8727 Td +(1116 .set PROT_MODE_DSEG,0x10 # data segment selector) 36.12 Tj +0 -26.1818 Td +(1117 .set CR0_PE_ON,0x1 # protected mode enable flag) 39.13 Tj +0 -27.4909 Td +(1118 ) 3.01 Tj +0 -28.8 Td +(1119 .globl start) 10.234 Tj +0 -30.1091 Td +(1120 start:) 6.622 Tj +0 -31.4182 Td +(1121 .code16 # This runs in real mode) 35.518 Tj +0 -32.7273 Td +(1122 cli # Disable interrupts) 33.11 Tj +0 -34.0364 Td +(1123 cld # String operations increment) 38.528 Tj +0 -35.3454 Td +(1124 ) 3.01 Tj +0 -36.6545 Td +(1125 # Set up the important data segment registers \(DS, ES, SS\).) 39.732 Tj +0 -37.9636 Td +(1126 xorw %ax,%ax # Segment number zero) 33.712 Tj +0 -39.2727 Td +(1127 movw %ax,%ds # -> Data Segment) 31.304 Tj +0 -40.5818 Td +(1128 movw %ax,%es # -> Extra Segment) 31.906 Tj +0 -41.8909 Td +(1129 movw %ax,%ss # -> Stack Segment) 31.906 Tj +0 -43.2 Td +(1130 ) 3.01 Tj +0 -44.5091 Td +(1131 # Set up the stack pointer, growing downward from 0x7000-8.) 39.732 Tj +0 -45.8182 Td +(1132 movw $start-8,%sp # Stack Pointer) 30.1 Tj +0 -47.1272 Td +(1133 ) 3.01 Tj +0 -48.4363 Td +(1134 # Switch from real to protected mode) 25.886 Tj +0 -49.7454 Td +(1135 # The descriptors in our GDT allow all physical memory to be accessed.) 46.956 Tj +0 -51.0545 Td +(1136 # Furthermore, the descriptors have base addresses of 0, so that the) 45.752 Tj +0 -52.3636 Td +(1137 # segment translation is a NOP, ie. virtual addresses are identical to) 46.956 Tj +0 -53.6727 Td +(1138 # their physical addresses. With this setup, immediately after) 42.742 Tj +0 -54.9818 Td +(1139 # enabling protected mode it will still appear to this code) 40.334 Tj +0 -56.2909 Td +(1140 # that it is running directly on physical memory with no translation.) 46.354 Tj +0 -57.6 Td +(1141 # This initial NOP-translation setup is required by the processor) 43.946 Tj +0 -58.9091 Td +(1142 # to ensure that the transition to protected mode occurs smoothly.) 44.548 Tj +0 -60.2181 Td +(1143 ) 3.01 Tj +0 -61.5272 Td +(1144 lgdt gdtdesc # load GDT -- mandatory in protected mode) 45.752 Tj +0 -62.8363 Td +(1145 movl %cr0, %eax # turn on protected mode) 35.518 Tj +0 -64.1454 Td +(1146 orl $CR0_PE_ON, %eax #) 21.672 Tj +0 -65.4545 Td +(1147 movl %eax, %cr0 #) 21.672 Tj +0 -66.7636 Td +(1148 ) 3.01 Tj +0 -68.0727 Td +(1149 ) 3.01 Tj +0 -72 Td +(Sheet 11) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/bootother.S Page 2) 25.284 Tj +0 -3.92728 Td +(1150 # CPU magic: jump to relocation, flush prefetch queue, and reload %cs) 45.752 Tj +0 -5.23637 Td +(1151 # Has the effect of just jmp to the next instruction, but simultaneous) 46.354 Tj +0 -6.54546 Td +(1152 # loads CS with $PROT_MODE_CSEG.) 23.478 Tj +0 -7.85455 Td +(1153 ljmp $PROT_MODE_CSEG, $protcseg) 24.682 Tj +0 -9.16364 Td +(1154 ) 3.01 Tj +0 -10.4727 Td +(1155 # We are now in 32-bit protected mode \(hence the .code32\)) 37.324 Tj +0 -11.7818 Td +(1156 .code32) 7.224 Tj +0 -13.0909 Td +(1157 protcseg:) 8.428 Tj +0 -14.4 Td +(1158 # Set up the protected-mode data segment registers) 34.314 Tj +0 -15.7091 Td +(1159 movw $PROT_MODE_DSEG, %ax # Our data segment selector) 39.732 Tj +0 -17.0182 Td +(1160 movw %ax, %ds # -> DS: Data Segment) 36.12 Tj +0 -18.3273 Td +(1161 movw %ax, %es # -> ES: Extra Segment) 36.722 Tj +0 -19.6364 Td +(1162 movw %ax, %fs # -> FS) 27.692 Tj +0 -20.9455 Td +(1163 movw %ax, %gs # -> GS) 27.692 Tj +0 -22.2545 Td +(1164 movw %ax, %ss # -> SS: Stack Segment) 36.722 Tj +0 -23.5636 Td +(1165 ) 3.01 Tj +0 -24.8727 Td +(1166 movl start-8, %eax) 16.856 Tj +0 -26.1818 Td +(1167 movl start-4, %esp) 16.856 Tj +0 -27.4909 Td +(1168 jmp *%eax) 12.04 Tj +0 -28.8 Td +(1169 ) 3.01 Tj +0 -30.1091 Td +(1170 .p2align 2 # force 4 byte alignment) 42.742 Tj +0 -31.4182 Td +(1171 gdt:) 5.418 Tj +0 -32.7273 Td +(1172 SEG_NULLASM # null seg) 34.314 Tj +0 -34.0364 Td +(1173 SEG_ASM\(STA_X|STA_R, 0x0, 0xffffffff\) # code seg) 34.314 Tj +0 -35.3454 Td +(1174 SEG_ASM\(STA_W, 0x0, 0xffffffff\) # data seg) 34.314 Tj +0 -36.6545 Td +(1175 ) 3.01 Tj +0 -37.9636 Td +(1176 gdtdesc:) 7.826 Tj +0 -39.2727 Td +(1177 .word 0x17 # sizeof\(gdt\) - 1) 38.528 Tj +0 -40.5818 Td +(1178 .long gdt # address gdt) 36.12 Tj +0 -41.8909 Td +(1179 ) 3.01 Tj +0 -43.2 Td +(1180 ) 3.01 Tj +0 -44.5091 Td +(1181 ) 3.01 Tj +0 -45.8182 Td +(1182 ) 3.01 Tj +0 -47.1272 Td +(1183 ) 3.01 Tj +0 -48.4363 Td +(1184 ) 3.01 Tj +0 -49.7454 Td +(1185 ) 3.01 Tj +0 -51.0545 Td +(1186 ) 3.01 Tj +0 -52.3636 Td +(1187 ) 3.01 Tj +0 -53.6727 Td +(1188 ) 3.01 Tj +0 -54.9818 Td +(1189 ) 3.01 Tj +0 -56.2909 Td +(1190 ) 3.01 Tj +0 -57.6 Td +(1191 ) 3.01 Tj +0 -58.9091 Td +(1192 ) 3.01 Tj +0 -60.2181 Td +(1193 ) 3.01 Tj +0 -61.5272 Td +(1194 ) 3.01 Tj +0 -62.8363 Td +(1195 ) 3.01 Tj +0 -64.1454 Td +(1196 ) 3.01 Tj +0 -65.4545 Td +(1197 ) 3.01 Tj +0 -66.7636 Td +(1198 ) 3.01 Tj +0 -68.0727 Td +(1199 ) 3.01 Tj +0 -72 Td +(Sheet 11) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 19 19 +%%BeginPageSetup +%%PageOrientation: Landscape +pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/main.c Page 1) 22.274 Tj +0 -3.92728 Td +(1200 #include "types.h") 13.846 Tj +0 -5.23637 Td +(1201 #include "param.h") 13.846 Tj +0 -6.54546 Td +(1202 #include "mmu.h") 12.642 Tj +0 -7.85455 Td +(1203 #include "proc.h") 13.244 Tj +0 -9.16364 Td +(1204 #include "defs.h") 13.244 Tj +0 -10.4727 Td +(1205 #include "x86.h") 12.642 Tj +0 -11.7818 Td +(1206 #include "traps.h") 13.846 Tj +0 -13.0909 Td +(1207 #include "syscall.h") 15.05 Tj +0 -14.4 Td +(1208 #include "elf.h") 12.642 Tj +0 -15.7091 Td +(1209 #include "param.h") 13.846 Tj +0 -17.0182 Td +(1210 #include "spinlock.h") 15.652 Tj +0 -18.3273 Td +(1211 ) 3.01 Tj +0 -19.6364 Td +(1212 extern char edata[], end[];) 19.264 Tj +0 -20.9455 Td +(1213 extern uchar _binary__init_start[], _binary__init_size[];) 37.324 Tj +0 -22.2545 Td +(1214 ) 3.01 Tj +0 -23.5636 Td +(1215 void process0\(\);) 12.642 Tj +0 -24.8727 Td +(1216 ) 3.01 Tj +0 -26.1818 Td +(1217 // Bootstrap processor starts running C code here.) 33.11 Tj +0 -27.4909 Td +(1218 // This is called main0 not main so that it can have) 34.314 Tj +0 -28.8 Td +(1219 // a void return type. Gcc can't handle functions named) 36.722 Tj +0 -30.1091 Td +(1220 // main that don't return int. Really.) 26.488 Tj +0 -31.4182 Td +(1221 void) 5.418 Tj +0 -32.7273 Td +(1222 main0\(void\)) 9.632 Tj +0 -34.0364 Td +(1223 {) 3.612 Tj +0 -35.3454 Td +(1224 int i;) 7.826 Tj +0 -36.6545 Td +(1225 int bcpu;) 9.632 Tj +0 -37.9636 Td +(1226 struct proc *p;) 13.244 Tj +0 -39.2727 Td +(1227 ) 3.01 Tj +0 -40.5818 Td +(1228 // clear BSS) 11.438 Tj +0 -41.8909 Td +(1229 memset\(edata, 0, end - edata\);) 22.274 Tj +0 -43.2 Td +(1230 ) 3.01 Tj +0 -44.5091 Td +(1231 // Prevent release\(\) from enabling interrupts.) 31.906 Tj +0 -45.8182 Td +(1232 for\(i=0; istate = RUNNABLE;) 16.254 Tj +0 -20.9455 Td +(1263 p->kstack = kalloc\(KSTACKSIZE\);) 22.876 Tj +0 -22.2545 Td +(1264 ) 3.01 Tj +0 -23.5636 Td +(1265 // cause proc[0] to start in kernel at process0) 32.508 Tj +0 -24.8727 Td +(1266 p->jmpbuf.eip = \(uint\) process0;) 23.478 Tj +0 -26.1818 Td +(1267 p->jmpbuf.esp = \(uint\) \(p->kstack + KSTACKSIZE - 4\);) 35.518 Tj +0 -27.4909 Td +(1268 ) 3.01 Tj +0 -28.8 Td +(1269 // make sure there's a TSS) 19.866 Tj +0 -30.1091 Td +(1270 setupsegs\(0\);) 12.04 Tj +0 -31.4182 Td +(1271 ) 3.01 Tj +0 -32.7273 Td +(1272 // initialize I/O devices, let them enable interrupts) 36.12 Tj +0 -34.0364 Td +(1273 console_init\(\);) 13.244 Tj +0 -35.3454 Td +(1274 ide_init\(\);) 10.836 Tj +0 -36.6545 Td +(1275 ) 3.01 Tj +0 -37.9636 Td +(1276 // start other CPUs) 15.652 Tj +0 -39.2727 Td +(1277 mp_startthem\(\);) 13.244 Tj +0 -40.5818 Td +(1278 ) 3.01 Tj +0 -41.8909 Td +(1279 // turn on timer) 13.846 Tj +0 -43.2 Td +(1280 if\(ismp\)) 9.03 Tj +0 -44.5091 Td +(1281 lapic_timerinit\(\);) 16.254 Tj +0 -45.8182 Td +(1282 else) 6.622 Tj +0 -47.1272 Td +(1283 pit8253_timerinit\(\);) 17.458 Tj +0 -48.4363 Td +(1284 ) 3.01 Tj +0 -49.7454 Td +(1285 // enable interrupts on the local APIC) 27.09 Tj +0 -51.0545 Td +(1286 lapic_enableintr\(\);) 15.652 Tj +0 -52.3636 Td +(1287 ) 3.01 Tj +0 -53.6727 Td +(1288 // enable interrupts on this processor.) 27.692 Tj +0 -54.9818 Td +(1289 cpus[cpu\(\)].nlock--;) 16.254 Tj +0 -56.2909 Td +(1290 sti\(\);) 7.826 Tj +0 -57.6 Td +(1291 ) 3.01 Tj +0 -58.9091 Td +(1292 scheduler\(\);) 11.438 Tj +0 -60.2181 Td +(1293 }) 3.612 Tj +0 -61.5272 Td +(1294 ) 3.01 Tj +0 -62.8363 Td +(1295 ) 3.01 Tj +0 -64.1454 Td +(1296 ) 3.01 Tj +0 -65.4545 Td +(1297 ) 3.01 Tj +0 -66.7636 Td +(1298 ) 3.01 Tj +0 -68.0727 Td +(1299 ) 3.01 Tj +0 -72 Td +(Sheet 12) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 20 20 +%%BeginPageSetup +%%PageOrientation: Landscape +__tumble pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/main.c Page 3) 22.274 Tj +0 -3.92728 Td +(1300 // Additional processors start here.) 24.682 Tj +0 -5.23637 Td +(1301 void) 5.418 Tj +0 -6.54546 Td +(1302 mpmain\(void\)) 10.234 Tj +0 -7.85455 Td +(1303 {) 3.612 Tj +0 -9.16364 Td +(1304 cprintf\("cpu%d: starting\\n", cpu\(\)\);) 25.886 Tj +0 -10.4727 Td +(1305 idtinit\(\); // CPU's idt) 18.06 Tj +0 -11.7818 Td +(1306 if\(cpu\(\) == 0\)) 12.642 Tj +0 -13.0909 Td +(1307 panic\("mpmain on cpu 0"\);) 20.468 Tj +0 -14.4 Td +(1308 lapic_init\(cpu\(\)\);) 15.05 Tj +0 -15.7091 Td +(1309 lapic_timerinit\(\);) 15.05 Tj +0 -17.0182 Td +(1310 lapic_enableintr\(\);) 15.652 Tj +0 -18.3273 Td +(1311 ) 3.01 Tj +0 -19.6364 Td +(1312 // make sure there's a TSS) 19.866 Tj +0 -20.9455 Td +(1313 setupsegs\(0\);) 12.04 Tj +0 -22.2545 Td +(1314 ) 3.01 Tj +0 -23.5636 Td +(1315 cpuid\(0, 0, 0, 0, 0\); // memory barrier) 28.294 Tj +0 -24.8727 Td +(1316 cpus[cpu\(\)].booted = 1;) 18.06 Tj +0 -26.1818 Td +(1317 ) 3.01 Tj +0 -27.4909 Td +(1318 // Enable interrupts on this processor.) 27.692 Tj +0 -28.8 Td +(1319 cpus[cpu\(\)].nlock--;) 16.254 Tj +0 -30.1091 Td +(1320 sti\(\);) 7.826 Tj +0 -31.4182 Td +(1321 ) 3.01 Tj +0 -32.7273 Td +(1322 scheduler\(\);) 11.438 Tj +0 -34.0364 Td +(1323 }) 3.612 Tj +0 -35.3454 Td +(1324 ) 3.01 Tj +0 -36.6545 Td +(1325 // proc[0] starts here, called by scheduler\(\) in the ordinary way.) 42.742 Tj +0 -37.9636 Td +(1326 void) 5.418 Tj +0 -39.2727 Td +(1327 process0\(\)) 9.03 Tj +0 -40.5818 Td +(1328 {) 3.612 Tj +0 -41.8909 Td +(1329 struct proc *p0 = &proc[0];) 20.468 Tj +0 -43.2 Td +(1330 struct proc *p1;) 13.846 Tj +0 -44.5091 Td +(1331 extern struct spinlock proc_table_lock;) 27.692 Tj +0 -45.8182 Td +(1332 struct trapframe tf;) 16.254 Tj +0 -47.1272 Td +(1333 ) 3.01 Tj +0 -48.4363 Td +(1334 release\(&proc_table_lock\);) 19.866 Tj +0 -49.7454 Td +(1335 ) 3.01 Tj +0 -51.0545 Td +(1336 p0->cwd = iget\(rootdev, 1\);) 20.468 Tj +0 -52.3636 Td +(1337 iunlock\(p0->cwd\);) 14.448 Tj +0 -53.6727 Td +(1338 ) 3.01 Tj +0 -54.9818 Td +(1339 // dummy user memory to make copyproc\(\) happy.) 31.906 Tj +0 -56.2909 Td +(1340 // must be big enough to hold the init binary.) 31.906 Tj +0 -57.6 Td +(1341 p0->sz = PAGE;) 12.642 Tj +0 -58.9091 Td +(1342 p0->mem = kalloc\(p0->sz\);) 19.264 Tj +0 -60.2181 Td +(1343 ) 3.01 Tj +0 -61.5272 Td +(1344 // fake a trap frame as if a user process had made a system) 39.732 Tj +0 -62.8363 Td +(1345 // call, so that copyproc will have a place for the new) 37.324 Tj +0 -64.1454 Td +(1346 // process to return to.) 18.662 Tj +0 -65.4545 Td +(1347 p0->tf = &tf;) 12.04 Tj +0 -66.7636 Td +(1348 memset\(p0->tf, 0, sizeof\(struct trapframe\)\);) 30.702 Tj +0 -68.0727 Td +(1349 p0->tf->es = p0->tf->ds = p0->tf->ss = \(SEG_UDATA << 3\) | 3;) 40.334 Tj +0 -72 Td +(Sheet 13) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/main.c Page 4) 22.274 Tj +0 -3.92728 Td +(1350 p0->tf->cs = \(SEG_UCODE << 3\) | 3;) 24.682 Tj +0 -5.23637 Td +(1351 p0->tf->eflags = FL_IF;) 18.06 Tj +0 -6.54546 Td +(1352 p0->tf->esp = p0->sz;) 16.856 Tj +0 -7.85455 Td +(1353 ) 3.01 Tj +0 -9.16364 Td +(1354 p1 = copyproc\(p0\);) 15.05 Tj +0 -10.4727 Td +(1355 ) 3.01 Tj +0 -11.7818 Td +(1356 load_icode\(p1, _binary__init_start, \(uint\) _binary__init_size\);) 42.14 Tj +0 -13.0909 Td +(1357 p1->state = RUNNABLE;) 16.856 Tj +0 -14.4 Td +(1358 ) 3.01 Tj +0 -15.7091 Td +(1359 proc_wait\(\);) 11.438 Tj +0 -17.0182 Td +(1360 panic\("init exited"\);) 16.856 Tj +0 -18.3273 Td +(1361 }) 3.612 Tj +0 -19.6364 Td +(1362 ) 3.01 Tj +0 -20.9455 Td +(1363 void) 5.418 Tj +0 -22.2545 Td +(1364 load_icode\(struct proc *p, uchar *binary, uint size\)) 34.314 Tj +0 -23.5636 Td +(1365 {) 3.612 Tj +0 -24.8727 Td +(1366 int i;) 7.826 Tj +0 -26.1818 Td +(1367 struct elfhdr *elf;) 15.652 Tj +0 -27.4909 Td +(1368 struct proghdr *ph;) 15.652 Tj +0 -28.8 Td +(1369 ) 3.01 Tj +0 -30.1091 Td +(1370 elf = \(struct elfhdr*\) binary;) 22.274 Tj +0 -31.4182 Td +(1371 if\(elf->magic != ELF_MAGIC\)) 20.468 Tj +0 -32.7273 Td +(1372 panic\("load_icode: not an ELF binary"\);) 28.896 Tj +0 -34.0364 Td +(1373 ) 3.01 Tj +0 -35.3454 Td +(1374 p->tf->eip = elf->entry;) 18.662 Tj +0 -36.6545 Td +(1375 ) 3.01 Tj +0 -37.9636 Td +(1376 // Map and load segments as directed.) 26.488 Tj +0 -39.2727 Td +(1377 ph = \(struct proghdr*\) \(binary + elf->phoff\);) 31.304 Tj +0 -40.5818 Td +(1378 for\(i = 0; i < elf->phnum; i++, ph++\) {) 27.692 Tj +0 -41.8909 Td +(1379 if\(ph->type != ELF_PROG_LOAD\)) 22.876 Tj +0 -43.2 Td +(1380 continue;) 12.04 Tj +0 -44.5091 Td +(1381 if\(ph->va + ph->memsz < ph->va\)) 24.08 Tj +0 -45.8182 Td +(1382 panic\("load_icode: overflow in proghdr"\);) 31.304 Tj +0 -47.1272 Td +(1383 if\(ph->va + ph->memsz >= p->sz\)) 24.08 Tj +0 -48.4363 Td +(1384 panic\("load_icode: icode too large"\);) 28.896 Tj +0 -49.7454 Td +(1385 ) 3.01 Tj +0 -51.0545 Td +(1386 // Load/clear the segment) 20.468 Tj +0 -52.3636 Td +(1387 memmove\(p->mem + ph->va, binary + ph->offset, ph->filesz\);) 40.334 Tj +0 -53.6727 Td +(1388 memset\(p->mem + ph->va + ph->filesz, 0, ph->memsz - ph->filesz\);) 43.946 Tj +0 -54.9818 Td +(1389 }) 4.816 Tj +0 -56.2909 Td +(1390 }) 3.612 Tj +0 -57.6 Td +(1391 ) 3.01 Tj +0 -58.9091 Td +(1392 ) 3.01 Tj +0 -60.2181 Td +(1393 ) 3.01 Tj +0 -61.5272 Td +(1394 ) 3.01 Tj +0 -62.8363 Td +(1395 ) 3.01 Tj +0 -64.1454 Td +(1396 ) 3.01 Tj +0 -65.4545 Td +(1397 ) 3.01 Tj +0 -66.7636 Td +(1398 ) 3.01 Tj +0 -68.0727 Td +(1399 ) 3.01 Tj +0 -72 Td +(Sheet 13) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 21 21 +%%BeginPageSetup +%%PageOrientation: Landscape +pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/mp.c Page 1) 21.07 Tj +0 -3.92728 Td +(1400 #include "types.h") 13.846 Tj +0 -5.23637 Td +(1401 #include "mp.h") 12.04 Tj +0 -6.54546 Td +(1402 #include "defs.h") 13.244 Tj +0 -7.85455 Td +(1403 #include "param.h") 13.846 Tj +0 -9.16364 Td +(1404 #include "x86.h") 12.642 Tj +0 -10.4727 Td +(1405 #include "traps.h") 13.846 Tj +0 -11.7818 Td +(1406 #include "mmu.h") 12.642 Tj +0 -13.0909 Td +(1407 #include "proc.h") 13.244 Tj +0 -14.4 Td +(1408 ) 3.01 Tj +0 -15.7091 Td +(1409 static char *buses[] = {) 17.458 Tj +0 -17.0182 Td +(1410 "CBUSI ",) 9.632 Tj +0 -18.3273 Td +(1411 "CBUSII",) 9.632 Tj +0 -19.6364 Td +(1412 "EISA ",) 9.632 Tj +0 -20.9455 Td +(1413 "FUTURE",) 9.632 Tj +0 -22.2545 Td +(1414 "INTERN",) 9.632 Tj +0 -23.5636 Td +(1415 "ISA ",) 9.632 Tj +0 -24.8727 Td +(1416 "MBI ",) 9.632 Tj +0 -26.1818 Td +(1417 "MBII ",) 9.632 Tj +0 -27.4909 Td +(1418 "MCA ",) 9.632 Tj +0 -28.8 Td +(1419 "MPI ",) 9.632 Tj +0 -30.1091 Td +(1420 "MPSA ",) 9.632 Tj +0 -31.4182 Td +(1421 "NUBUS ",) 9.632 Tj +0 -32.7273 Td +(1422 "PCI ",) 9.632 Tj +0 -34.0364 Td +(1423 "PCMCIA",) 9.632 Tj +0 -35.3454 Td +(1424 "TC ",) 9.632 Tj +0 -36.6545 Td +(1425 "VL ",) 9.632 Tj +0 -37.9636 Td +(1426 "VME ",) 9.632 Tj +0 -39.2727 Td +(1427 "XPRESS",) 9.632 Tj +0 -40.5818 Td +(1428 0,) 5.418 Tj +0 -41.8909 Td +(1429 };) 4.214 Tj +0 -43.2 Td +(1430 ) 3.01 Tj +0 -44.5091 Td +(1431 struct cpu cpus[NCPU];) 16.254 Tj +0 -45.8182 Td +(1432 int ismp;) 8.428 Tj +0 -47.1272 Td +(1433 int ncpu;) 8.428 Tj +0 -48.4363 Td +(1434 uchar ioapic_id;) 12.642 Tj +0 -49.7454 Td +(1435 ) 3.01 Tj +0 -51.0545 Td +(1436 static struct cpu *bcpu;) 17.458 Tj +0 -52.3636 Td +(1437 static struct mp *mp; // The MP floating point structure) 37.324 Tj +0 -53.6727 Td +(1438 ) 3.01 Tj +0 -54.9818 Td +(1439 static struct mp*) 13.244 Tj +0 -56.2909 Td +(1440 mp_scan\(uchar *addr, int len\)) 20.468 Tj +0 -57.6 Td +(1441 {) 3.612 Tj +0 -58.9091 Td +(1442 uchar *e, *p, sum;) 15.05 Tj +0 -60.2181 Td +(1443 int i;) 7.826 Tj +0 -61.5272 Td +(1444 ) 3.01 Tj +0 -62.8363 Td +(1445 e = addr+len;) 12.04 Tj +0 -64.1454 Td +(1446 for\(p = addr; p < e; p += sizeof\(struct mp\)\){) 31.304 Tj +0 -65.4545 Td +(1447 if\(memcmp\(p, "_MP_", 4\)\)) 19.866 Tj +0 -66.7636 Td +(1448 continue;) 12.04 Tj +0 -68.0727 Td +(1449 sum = 0;) 10.234 Tj +0 -72 Td +(Sheet 14) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/mp.c Page 2) 21.07 Tj +0 -3.92728 Td +(1450 for\(i = 0; i < sizeof\(struct mp\); i++\)) 28.294 Tj +0 -5.23637 Td +(1451 sum += p[i];) 13.846 Tj +0 -6.54546 Td +(1452 if\(sum == 0\)) 12.642 Tj +0 -7.85455 Td +(1453 return \(struct mp*\)p;) 19.264 Tj +0 -9.16364 Td +(1454 }) 4.816 Tj +0 -10.4727 Td +(1455 return 0;) 9.632 Tj +0 -11.7818 Td +(1456 }) 3.612 Tj +0 -13.0909 Td +(1457 ) 3.01 Tj +0 -14.4 Td +(1458 // Search for the MP Floating Pointer Structure, which according to the) 45.752 Tj +0 -15.7091 Td +(1459 // spec is in one of the following three locations:) 33.712 Tj +0 -17.0182 Td +(1460 // 1\) in the first KB of the EBDA;) 23.478 Tj +0 -18.3273 Td +(1461 // 2\) in the last KB of system base memory;) 28.896 Tj +0 -19.6364 Td +(1462 // 3\) in the BIOS ROM between 0xE0000 and 0xFFFFF.) 33.11 Tj +0 -20.9455 Td +(1463 static struct mp*) 13.244 Tj +0 -22.2545 Td +(1464 mp_search\(void\)) 12.04 Tj +0 -23.5636 Td +(1465 {) 3.612 Tj +0 -24.8727 Td +(1466 uchar *bda;) 10.836 Tj +0 -26.1818 Td +(1467 uint p;) 8.428 Tj +0 -27.4909 Td +(1468 struct mp *mp;) 12.642 Tj +0 -28.8 Td +(1469 ) 3.01 Tj +0 -30.1091 Td +(1470 bda = \(uchar*\) 0x400;) 16.856 Tj +0 -31.4182 Td +(1471 if\(\(p = \(bda[0x0F]<<8\)|bda[0x0E]\)\){) 25.284 Tj +0 -32.7273 Td +(1472 if\(\(mp = mp_scan\(\(uchar*\) p, 1024\)\)\)) 27.09 Tj +0 -34.0364 Td +(1473 return mp;) 12.642 Tj +0 -35.3454 Td +(1474 }) 4.816 Tj +0 -36.6545 Td +(1475 else{) 7.224 Tj +0 -37.9636 Td +(1476 p = \(\(bda[0x14]<<8\)|bda[0x13]\)*1024;) 27.09 Tj +0 -39.2727 Td +(1477 if\(\(mp = mp_scan\(\(uchar*\)p-1024, 1024\)\)\)) 29.498 Tj +0 -40.5818 Td +(1478 return mp;) 12.642 Tj +0 -41.8909 Td +(1479 }) 4.816 Tj +0 -43.2 Td +(1480 return mp_scan\(\(uchar*\)0xF0000, 0x10000\);) 28.896 Tj +0 -44.5091 Td +(1481 }) 3.612 Tj +0 -45.8182 Td +(1482 ) 3.01 Tj +0 -47.1272 Td +(1483 // Search for an MP configuration table. For now,) 32.508 Tj +0 -48.4363 Td +(1484 // don't accept the default configurations \(physaddr == 0\).) 38.528 Tj +0 -49.7454 Td +(1485 // Check for correct signature, calculate the checksum and,) 38.528 Tj +0 -51.0545 Td +(1486 // if correct, check the version.) 22.876 Tj +0 -52.3636 Td +(1487 // To do: check extended table checksum.) 27.09 Tj +0 -53.6727 Td +(1488 static int) 9.03 Tj +0 -54.9818 Td +(1489 mp_detect\(void\)) 12.04 Tj +0 -56.2909 Td +(1490 {) 3.612 Tj +0 -57.6 Td +(1491 struct mpctb *pcmp;) 15.652 Tj +0 -58.9091 Td +(1492 uchar *p, sum;) 12.642 Tj +0 -60.2181 Td +(1493 uint length;) 11.438 Tj +0 -61.5272 Td +(1494 ) 3.01 Tj +0 -62.8363 Td +(1495 if\(\(mp = mp_search\(\)\) == 0 || mp->physaddr == 0\)) 33.11 Tj +0 -64.1454 Td +(1496 return 1;) 10.836 Tj +0 -65.4545 Td +(1497 ) 3.01 Tj +0 -66.7636 Td +(1498 ) 3.01 Tj +0 -68.0727 Td +(1499 ) 3.01 Tj +0 -72 Td +(Sheet 14) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 22 22 +%%BeginPageSetup +%%PageOrientation: Landscape +__tumble pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/mp.c Page 3) 21.07 Tj +0 -3.92728 Td +(1500 pcmp = \(struct mpctb*\) mp->physaddr;) 25.886 Tj +0 -5.23637 Td +(1501 if\(memcmp\(pcmp, "PCMP", 4\)\)) 20.468 Tj +0 -6.54546 Td +(1502 return 2;) 10.836 Tj +0 -7.85455 Td +(1503 ) 3.01 Tj +0 -9.16364 Td +(1504 length = pcmp->length;) 17.458 Tj +0 -10.4727 Td +(1505 sum = 0;) 9.03 Tj +0 -11.7818 Td +(1506 for\(p = \(uchar*\)pcmp; length; length--\)) 27.692 Tj +0 -13.0909 Td +(1507 sum += *p++;) 12.642 Tj +0 -14.4 Td +(1508 ) 3.01 Tj +0 -15.7091 Td +(1509 if\(sum || \(pcmp->version != 1 && pcmp->version != 4\)\)) 36.12 Tj +0 -17.0182 Td +(1510 return 3;) 10.836 Tj +0 -18.3273 Td +(1511 ) 3.01 Tj +0 -19.6364 Td +(1512 return 0;) 9.632 Tj +0 -20.9455 Td +(1513 }) 3.612 Tj +0 -22.2545 Td +(1514 ) 3.01 Tj +0 -23.5636 Td +(1515 void) 5.418 Tj +0 -24.8727 Td +(1516 mp_init\(void\)) 10.836 Tj +0 -26.1818 Td +(1517 {) 3.612 Tj +0 -27.4909 Td +(1518 int r;) 7.826 Tj +0 -28.8 Td +(1519 uchar *p, *e;) 12.04 Tj +0 -30.1091 Td +(1520 struct mpctb *mpctb;) 16.254 Tj +0 -31.4182 Td +(1521 struct mppe *proc;) 15.05 Tj +0 -32.7273 Td +(1522 struct mpbe *bus;) 14.448 Tj +0 -34.0364 Td +(1523 struct mpioapic *ioapic;) 18.662 Tj +0 -35.3454 Td +(1524 struct mpie *intr;) 15.05 Tj +0 -36.6545 Td +(1525 int i;) 7.826 Tj +0 -37.9636 Td +(1526 uchar byte;) 10.836 Tj +0 -39.2727 Td +(1527 ) 3.01 Tj +0 -40.5818 Td +(1528 ncpu = 0;) 9.632 Tj +0 -41.8909 Td +(1529 if\(\(r = mp_detect\(\)\) != 0\) {) 21.07 Tj +0 -43.2 Td +(1530 return;) 9.632 Tj +0 -44.5091 Td +(1531 }) 4.816 Tj +0 -45.8182 Td +(1532 ) 3.01 Tj +0 -47.1272 Td +(1533 ismp = 1;) 9.632 Tj +0 -48.4363 Td +(1534 ) 3.01 Tj +0 -49.7454 Td +(1535 // Run through the table saving information needed for starting) 42.14 Tj +0 -51.0545 Td +(1536 // application processors and initialising any I/O APICs. The table) 44.548 Tj +0 -52.3636 Td +(1537 // is guaranteed to be in order such that only one pass is necessary.) 45.752 Tj +0 -53.6727 Td +(1538 ) 3.01 Tj +0 -54.9818 Td +(1539 mpctb = \(struct mpctb*\) mp->physaddr;) 26.488 Tj +0 -56.2909 Td +(1540 lapicaddr = \(uint*\) mpctb->lapicaddr;) 26.488 Tj +0 -57.6 Td +(1541 p = \(\(uchar*\)mpctb\)+sizeof\(struct mpctb\);) 28.896 Tj +0 -58.9091 Td +(1542 e = \(\(uchar*\)mpctb\)+mpctb->length;) 24.682 Tj +0 -60.2181 Td +(1543 ) 3.01 Tj +0 -61.5272 Td +(1544 while\(p < e\) {) 12.642 Tj +0 -62.8363 Td +(1545 switch\(*p\){) 12.04 Tj +0 -64.1454 Td +(1546 case MPPROCESSOR:) 15.652 Tj +0 -65.4545 Td +(1547 proc = \(struct mppe*\) p;) 21.07 Tj +0 -66.7636 Td +(1548 cpus[ncpu].apicid = proc->apicid;) 26.488 Tj +0 -68.0727 Td +(1549 if\(proc->flags & MPBP\) {) 21.07 Tj +0 -72 Td +(Sheet 15) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/mp.c Page 4) 21.07 Tj +0 -3.92728 Td +(1550 bcpu = &cpus[ncpu];) 19.264 Tj +0 -5.23637 Td +(1551 }) 7.224 Tj +0 -6.54546 Td +(1552 ncpu++;) 10.836 Tj +0 -7.85455 Td +(1553 p += sizeof\(struct mppe\);) 21.672 Tj +0 -9.16364 Td +(1554 continue;) 12.04 Tj +0 -10.4727 Td +(1555 case MPBUS:) 12.04 Tj +0 -11.7818 Td +(1556 bus = \(struct mpbe*\) p;) 20.468 Tj +0 -13.0909 Td +(1557 for\(i = 0; buses[i]; i++\){) 22.274 Tj +0 -14.4 Td +(1558 if\(strncmp\(buses[i], bus->string, sizeof\(bus->string\)\) == 0\)) 43.946 Tj +0 -15.7091 Td +(1559 break;) 12.642 Tj +0 -17.0182 Td +(1560 }) 7.224 Tj +0 -18.3273 Td +(1561 p += sizeof\(struct mpbe\);) 21.672 Tj +0 -19.6364 Td +(1562 continue;) 12.04 Tj +0 -20.9455 Td +(1563 case MPIOAPIC:) 13.846 Tj +0 -22.2545 Td +(1564 ioapic = \(struct mpioapic*\) p;) 24.682 Tj +0 -23.5636 Td +(1565 ioapic_id = ioapic->apicno;) 22.876 Tj +0 -24.8727 Td +(1566 p += sizeof\(struct mpioapic\);) 24.08 Tj +0 -26.1818 Td +(1567 continue;) 12.04 Tj +0 -27.4909 Td +(1568 case MPIOINTR:) 13.846 Tj +0 -28.8 Td +(1569 intr = \(struct mpie*\) p;) 21.07 Tj +0 -30.1091 Td +(1570 p += sizeof\(struct mpie\);) 21.672 Tj +0 -31.4182 Td +(1571 continue;) 12.04 Tj +0 -32.7273 Td +(1572 default:) 10.234 Tj +0 -34.0364 Td +(1573 cprintf\("mp_init: unknown PCMP type 0x%x \(e-p 0x%x\)\\n", *p, e-p\);) 45.752 Tj +0 -35.3454 Td +(1574 while\(p < e\){) 14.448 Tj +0 -36.6545 Td +(1575 cprintf\("%uX ", *p\);) 19.866 Tj +0 -37.9636 Td +(1576 p++;) 10.234 Tj +0 -39.2727 Td +(1577 }) 7.224 Tj +0 -40.5818 Td +(1578 break;) 10.234 Tj +0 -41.8909 Td +(1579 }) 6.02 Tj +0 -43.2 Td +(1580 }) 4.816 Tj +0 -44.5091 Td +(1581 ) 3.01 Tj +0 -45.8182 Td +(1582 if\(mp->imcrp\) {) 13.244 Tj +0 -47.1272 Td +(1583 // It appears that Bochs doesn't support IMCR, so code won't run.) 44.548 Tj +0 -48.4363 Td +(1584 outb\(0x22, 0x70\); // Select IMCR) 25.886 Tj +0 -49.7454 Td +(1585 byte = inb\(0x23\); // Current contents) 28.896 Tj +0 -51.0545 Td +(1586 byte |= 0x01; // Mask external INTR) 30.1 Tj +0 -52.3636 Td +(1587 outb\(0x23, byte\); // Disconnect 8259s/NMI) 31.304 Tj +0 -53.6727 Td +(1588 }) 4.816 Tj +0 -54.9818 Td +(1589 }) 3.612 Tj +0 -56.2909 Td +(1590 ) 3.01 Tj +0 -57.6 Td +(1591 ) 3.01 Tj +0 -58.9091 Td +(1592 int) 4.816 Tj +0 -60.2181 Td +(1593 mp_bcpu\(void\)) 10.836 Tj +0 -61.5272 Td +(1594 {) 3.612 Tj +0 -62.8363 Td +(1595 if\(ismp\)) 9.03 Tj +0 -64.1454 Td +(1596 return bcpu-cpus;) 15.652 Tj +0 -65.4545 Td +(1597 return 0;) 9.632 Tj +0 -66.7636 Td +(1598 }) 3.612 Tj +0 -68.0727 Td +(1599 ) 3.01 Tj +0 -72 Td +(Sheet 15) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 23 23 +%%BeginPageSetup +%%PageOrientation: Landscape +pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/mp.c Page 5) 21.07 Tj +0 -3.92728 Td +(1600 extern void mpmain\(void\);) 18.06 Tj +0 -5.23637 Td +(1601 ) 3.01 Tj +0 -6.54546 Td +(1602 // Write bootstrap code to unused memory at 0x7000.) 33.712 Tj +0 -7.85455 Td +(1603 #define APBOOTCODE 0x7000) 18.06 Tj +0 -9.16364 Td +(1604 ) 3.01 Tj +0 -10.4727 Td +(1605 void) 5.418 Tj +0 -11.7818 Td +(1606 mp_startthem\(void\)) 13.846 Tj +0 -13.0909 Td +(1607 {) 3.612 Tj +0 -14.4 Td +(1608 extern uchar _binary_bootother_start[], _binary_bootother_size[];) 43.344 Tj +0 -15.7091 Td +(1609 extern int main\(\);) 15.05 Tj +0 -17.0182 Td +(1610 int c;) 7.826 Tj +0 -18.3273 Td +(1611 ) 3.01 Tj +0 -19.6364 Td +(1612 memmove\(\(void*\) APBOOTCODE,_binary_bootother_start,) 34.916 Tj +0 -20.9455 Td +(1613 \(uint\) _binary_bootother_size\);) 27.692 Tj +0 -22.2545 Td +(1614 ) 3.01 Tj +0 -23.5636 Td +(1615 for\(c = 0; c < ncpu; c++\){) 19.866 Tj +0 -24.8727 Td +(1616 // Our current cpu has already started.) 28.896 Tj +0 -26.1818 Td +(1617 if\(c == cpu\(\)\)) 13.846 Tj +0 -27.4909 Td +(1618 continue;) 12.04 Tj +0 -28.8 Td +(1619 ) 3.01 Tj +0 -30.1091 Td +(1620 // Set target %esp) 16.254 Tj +0 -31.4182 Td +(1621 *\(uint*\)\(APBOOTCODE-4\) = \(uint\) \(cpus[c].mpstack\) + MPSTACK;) 41.538 Tj +0 -32.7273 Td +(1622 ) 3.01 Tj +0 -34.0364 Td +(1623 // Set target %eip) 16.254 Tj +0 -35.3454 Td +(1624 *\(uint*\)\(APBOOTCODE-8\) = \(uint\)mpmain;) 28.294 Tj +0 -36.6545 Td +(1625 ) 3.01 Tj +0 -37.9636 Td +(1626 // Go!) 9.03 Tj +0 -39.2727 Td +(1627 lapic_startap\(cpus[c].apicid, \(uint\) APBOOTCODE\);) 34.916 Tj +0 -40.5818 Td +(1628 ) 3.01 Tj +0 -41.8909 Td +(1629 // Wait for cpu to get through bootstrap.) 30.1 Tj +0 -43.2 Td +(1630 while\(cpus[c].booted == 0\)) 21.07 Tj +0 -44.5091 Td +(1631 ;) 7.224 Tj +0 -45.8182 Td +(1632 }) 4.816 Tj +0 -47.1272 Td +(1633 }) 3.612 Tj +0 -48.4363 Td +(1634 ) 3.01 Tj +0 -49.7454 Td +(1635 ) 3.01 Tj +0 -51.0545 Td +(1636 ) 3.01 Tj +0 -52.3636 Td +(1637 ) 3.01 Tj +0 -53.6727 Td +(1638 ) 3.01 Tj +0 -54.9818 Td +(1639 ) 3.01 Tj +0 -56.2909 Td +(1640 ) 3.01 Tj +0 -57.6 Td +(1641 ) 3.01 Tj +0 -58.9091 Td +(1642 ) 3.01 Tj +0 -60.2181 Td +(1643 ) 3.01 Tj +0 -61.5272 Td +(1644 ) 3.01 Tj +0 -62.8363 Td +(1645 ) 3.01 Tj +0 -64.1454 Td +(1646 ) 3.01 Tj +0 -65.4545 Td +(1647 ) 3.01 Tj +0 -66.7636 Td +(1648 ) 3.01 Tj +0 -68.0727 Td +(1649 ) 3.01 Tj +0 -72 Td +(Sheet 16) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/init.c Page 1) 22.274 Tj +0 -3.92728 Td +(1650 #include "types.h") 13.846 Tj +0 -5.23637 Td +(1651 #include "stat.h") 13.244 Tj +0 -6.54546 Td +(1652 #include "user.h") 13.244 Tj +0 -7.85455 Td +(1653 #include "fs.h") 12.04 Tj +0 -9.16364 Td +(1654 #include "fcntl.h") 13.846 Tj +0 -10.4727 Td +(1655 ) 3.01 Tj +0 -11.7818 Td +(1656 // init: The initial user-level program) 26.488 Tj +0 -13.0909 Td +(1657 ) 3.01 Tj +0 -14.4 Td +(1658 char *sh_args[] = { "sh", 0 };) 21.07 Tj +0 -15.7091 Td +(1659 ) 3.01 Tj +0 -17.0182 Td +(1660 int) 4.816 Tj +0 -18.3273 Td +(1661 main\(void\)) 9.03 Tj +0 -19.6364 Td +(1662 {) 3.612 Tj +0 -20.9455 Td +(1663 int pid;) 9.03 Tj +0 -22.2545 Td +(1664 ) 3.01 Tj +0 -23.5636 Td +(1665 if\(open\("console", O_RDWR\) < 0\){) 23.478 Tj +0 -24.8727 Td +(1666 mknod\("console", T_DEV, 1, 1\);) 23.478 Tj +0 -26.1818 Td +(1667 open\("console", O_RDWR\);) 19.866 Tj +0 -27.4909 Td +(1668 }) 4.816 Tj +0 -28.8 Td +(1669 dup\(0\); // stdout) 15.05 Tj +0 -30.1091 Td +(1670 dup\(0\); // stderr) 15.05 Tj +0 -31.4182 Td +(1671 ) 3.01 Tj +0 -32.7273 Td +(1672 for\(;;\){) 9.03 Tj +0 -34.0364 Td +(1673 pid = fork\(\);) 13.244 Tj +0 -35.3454 Td +(1674 if\(pid < 0\){) 12.642 Tj +0 -36.6545 Td +(1675 puts\("init: fork failed\\n"\);) 23.478 Tj +0 -37.9636 Td +(1676 exit\(\);) 10.836 Tj +0 -39.2727 Td +(1677 }) 6.02 Tj +0 -40.5818 Td +(1678 if\(pid == 0\){) 13.244 Tj +0 -41.8909 Td +(1679 exec\("sh", sh_args\);) 18.662 Tj +0 -43.2 Td +(1680 puts\("init: exec sh failed\\n"\);) 25.284 Tj +0 -44.5091 Td +(1681 exit\(\);) 10.836 Tj +0 -45.8182 Td +(1682 } else {) 10.234 Tj +0 -47.1272 Td +(1683 wait\(\);) 10.836 Tj +0 -48.4363 Td +(1684 }) 6.02 Tj +0 -49.7454 Td +(1685 }) 4.816 Tj +0 -51.0545 Td +(1686 }) 3.612 Tj +0 -52.3636 Td +(1687 ) 3.01 Tj +0 -53.6727 Td +(1688 ) 3.01 Tj +0 -54.9818 Td +(1689 ) 3.01 Tj +0 -56.2909 Td +(1690 ) 3.01 Tj +0 -57.6 Td +(1691 ) 3.01 Tj +0 -58.9091 Td +(1692 ) 3.01 Tj +0 -60.2181 Td +(1693 ) 3.01 Tj +0 -61.5272 Td +(1694 ) 3.01 Tj +0 -62.8363 Td +(1695 ) 3.01 Tj +0 -64.1454 Td +(1696 ) 3.01 Tj +0 -65.4545 Td +(1697 ) 3.01 Tj +0 -66.7636 Td +(1698 ) 3.01 Tj +0 -68.0727 Td +(1699 ) 3.01 Tj +0 -72 Td +(Sheet 16) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 24 24 +%%BeginPageSetup +%%PageOrientation: Landscape +__tumble pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/spinlock.h Page 1) 24.682 Tj +0 -3.92728 Td +(1700 // Mutual exclusion lock.) 18.06 Tj +0 -5.23637 Td +(1701 struct spinlock {) 13.244 Tj +0 -6.54546 Td +(1702 uint locked; // Is the lock held?) 25.284 Tj +0 -7.85455 Td +(1703 ) 3.01 Tj +0 -9.16364 Td +(1704 // For debugging:) 14.448 Tj +0 -10.4727 Td +(1705 char *name; // Name of lock.) 22.876 Tj +0 -11.7818 Td +(1706 int cpu; // The number of the cpu holding the lock.) 38.528 Tj +0 -13.0909 Td +(1707 uint pcs[10]; // The call stack \(an array of program counters\)) 42.14 Tj +0 -14.4 Td +(1708 // that locked the lock.) 27.692 Tj +0 -15.7091 Td +(1709 };) 4.214 Tj +0 -17.0182 Td +(1710 ) 3.01 Tj +0 -18.3273 Td +(1711 ) 3.01 Tj +0 -19.6364 Td +(1712 ) 3.01 Tj +0 -20.9455 Td +(1713 ) 3.01 Tj +0 -22.2545 Td +(1714 ) 3.01 Tj +0 -23.5636 Td +(1715 ) 3.01 Tj +0 -24.8727 Td +(1716 ) 3.01 Tj +0 -26.1818 Td +(1717 ) 3.01 Tj +0 -27.4909 Td +(1718 ) 3.01 Tj +0 -28.8 Td +(1719 ) 3.01 Tj +0 -30.1091 Td +(1720 ) 3.01 Tj +0 -31.4182 Td +(1721 ) 3.01 Tj +0 -32.7273 Td +(1722 ) 3.01 Tj +0 -34.0364 Td +(1723 ) 3.01 Tj +0 -35.3454 Td +(1724 ) 3.01 Tj +0 -36.6545 Td +(1725 ) 3.01 Tj +0 -37.9636 Td +(1726 ) 3.01 Tj +0 -39.2727 Td +(1727 ) 3.01 Tj +0 -40.5818 Td +(1728 ) 3.01 Tj +0 -41.8909 Td +(1729 ) 3.01 Tj +0 -43.2 Td +(1730 ) 3.01 Tj +0 -44.5091 Td +(1731 ) 3.01 Tj +0 -45.8182 Td +(1732 ) 3.01 Tj +0 -47.1272 Td +(1733 ) 3.01 Tj +0 -48.4363 Td +(1734 ) 3.01 Tj +0 -49.7454 Td +(1735 ) 3.01 Tj +0 -51.0545 Td +(1736 ) 3.01 Tj +0 -52.3636 Td +(1737 ) 3.01 Tj +0 -53.6727 Td +(1738 ) 3.01 Tj +0 -54.9818 Td +(1739 ) 3.01 Tj +0 -56.2909 Td +(1740 ) 3.01 Tj +0 -57.6 Td +(1741 ) 3.01 Tj +0 -58.9091 Td +(1742 ) 3.01 Tj +0 -60.2181 Td +(1743 ) 3.01 Tj +0 -61.5272 Td +(1744 ) 3.01 Tj +0 -62.8363 Td +(1745 ) 3.01 Tj +0 -64.1454 Td +(1746 ) 3.01 Tj +0 -65.4545 Td +(1747 ) 3.01 Tj +0 -66.7636 Td +(1748 ) 3.01 Tj +0 -68.0727 Td +(1749 ) 3.01 Tj +0 -72 Td +(Sheet 17) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/spinlock.c Page 1) 24.682 Tj +0 -3.92728 Td +(1750 // Mutual exclusion spin locks.) 21.672 Tj +0 -5.23637 Td +(1751 ) 3.01 Tj +0 -6.54546 Td +(1752 #include "types.h") 13.846 Tj +0 -7.85455 Td +(1753 #include "defs.h") 13.244 Tj +0 -9.16364 Td +(1754 #include "x86.h") 12.642 Tj +0 -10.4727 Td +(1755 #include "mmu.h") 12.642 Tj +0 -11.7818 Td +(1756 #include "param.h") 13.846 Tj +0 -13.0909 Td +(1757 #include "proc.h") 13.244 Tj +0 -14.4 Td +(1758 #include "spinlock.h") 15.652 Tj +0 -15.7091 Td +(1759 ) 3.01 Tj +0 -17.0182 Td +(1760 extern int use_console_lock;) 19.866 Tj +0 -18.3273 Td +(1761 ) 3.01 Tj +0 -19.6364 Td +(1762 void) 5.418 Tj +0 -20.9455 Td +(1763 initlock\(struct spinlock *lock, char *name\)) 28.896 Tj +0 -22.2545 Td +(1764 {) 3.612 Tj +0 -23.5636 Td +(1765 lock->name = name;) 15.05 Tj +0 -24.8727 Td +(1766 lock->locked = 0;) 14.448 Tj +0 -26.1818 Td +(1767 lock->cpu = 0xffffffff;) 18.06 Tj +0 -27.4909 Td +(1768 }) 3.612 Tj +0 -28.8 Td +(1769 ) 3.01 Tj +0 -30.1091 Td +(1770 // Record the current call stack in pcs[] by following the %ebp chain.) 45.15 Tj +0 -31.4182 Td +(1771 void) 5.418 Tj +0 -32.7273 Td +(1772 getcallerpcs\(void *v, uint pcs[]\)) 22.876 Tj +0 -34.0364 Td +(1773 {) 3.612 Tj +0 -35.3454 Td +(1774 uint *ebp = \(uint*\)v - 2;) 19.264 Tj +0 -36.6545 Td +(1775 int i;) 7.826 Tj +0 -37.9636 Td +(1776 for\(i = 0; i < 10; i++\){) 18.662 Tj +0 -39.2727 Td +(1777 if\(ebp == 0 || ebp == \(uint*\)0xffffffff\)) 29.498 Tj +0 -40.5818 Td +(1778 break;) 10.234 Tj +0 -41.8909 Td +(1779 pcs[i] = ebp[1]; // saved %eip) 25.886 Tj +0 -43.2 Td +(1780 ebp = \(uint*\)ebp[0]; // saved %ebp) 25.886 Tj +0 -44.5091 Td +(1781 }) 4.816 Tj +0 -45.8182 Td +(1782 for\(; i < 10; i++\)) 15.05 Tj +0 -47.1272 Td +(1783 pcs[i] = 0;) 12.04 Tj +0 -48.4363 Td +(1784 }) 3.612 Tj +0 -49.7454 Td +(1785 ) 3.01 Tj +0 -51.0545 Td +(1786 ) 3.01 Tj +0 -52.3636 Td +(1787 ) 3.01 Tj +0 -53.6727 Td +(1788 ) 3.01 Tj +0 -54.9818 Td +(1789 ) 3.01 Tj +0 -56.2909 Td +(1790 ) 3.01 Tj +0 -57.6 Td +(1791 ) 3.01 Tj +0 -58.9091 Td +(1792 ) 3.01 Tj +0 -60.2181 Td +(1793 ) 3.01 Tj +0 -61.5272 Td +(1794 ) 3.01 Tj +0 -62.8363 Td +(1795 ) 3.01 Tj +0 -64.1454 Td +(1796 ) 3.01 Tj +0 -65.4545 Td +(1797 ) 3.01 Tj +0 -66.7636 Td +(1798 ) 3.01 Tj +0 -68.0727 Td +(1799 ) 3.01 Tj +0 -72 Td +(Sheet 17) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 25 25 +%%BeginPageSetup +%%PageOrientation: Landscape +pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/spinlock.c Page 2) 24.682 Tj +0 -3.92728 Td +(1800 // Acquire the lock.) 15.05 Tj +0 -5.23637 Td +(1801 // Loops \(spins\) until the lock is acquired.) 29.498 Tj +0 -6.54546 Td +(1802 // \(Because contention is handled by spinning, must not) 36.12 Tj +0 -7.85455 Td +(1803 // go to sleep holding any locks.\)) 23.478 Tj +0 -9.16364 Td +(1804 void) 5.418 Tj +0 -10.4727 Td +(1805 acquire\(struct spinlock *lock\)) 21.07 Tj +0 -11.7818 Td +(1806 {) 3.612 Tj +0 -13.0909 Td +(1807 if\(holding\(lock\)\)) 14.448 Tj +0 -14.4 Td +(1808 panic\("acquire"\);) 15.652 Tj +0 -15.7091 Td +(1809 ) 3.01 Tj +0 -17.0182 Td +(1810 if\(cpus[cpu\(\)].nlock == 0\)) 19.866 Tj +0 -18.3273 Td +(1811 cli\(\);) 9.03 Tj +0 -19.6364 Td +(1812 cpus[cpu\(\)].nlock++;) 16.254 Tj +0 -20.9455 Td +(1813 ) 3.01 Tj +0 -22.2545 Td +(1814 while\(cmpxchg\(0, 1, &lock->locked\) == 1\)) 28.294 Tj +0 -23.5636 Td +(1815 ;) 6.02 Tj +0 -24.8727 Td +(1816 ) 3.01 Tj +0 -26.1818 Td +(1817 // Serialize instructions: now that lock is acquired, make sure) 42.14 Tj +0 -27.4909 Td +(1818 // we wait for all pending writes from other processors.) 37.926 Tj +0 -28.8 Td +(1819 cpuid\(0, 0, 0, 0, 0\); // memory barrier \(see Ch 7, IA-32 manual vol 3\)) 46.956 Tj +0 -30.1091 Td +(1820 ) 3.01 Tj +0 -31.4182 Td +(1821 // Record info about lock acquisition for debugging.) 35.518 Tj +0 -32.7273 Td +(1822 // The +10 is only so that we can tell the difference) 36.12 Tj +0 -34.0364 Td +(1823 // between forgetting to initialize lock->cpu) 31.304 Tj +0 -35.3454 Td +(1824 // and holding a lock on cpu 0.) 22.876 Tj +0 -36.6545 Td +(1825 lock->cpu = cpu\(\) + 10;) 18.06 Tj +0 -37.9636 Td +(1826 getcallerpcs\(&lock, lock->pcs\);) 22.876 Tj +0 -39.2727 Td +(1827 }) 3.612 Tj +0 -40.5818 Td +(1828 ) 3.01 Tj +0 -41.8909 Td +(1829 // Release the lock.) 15.05 Tj +0 -43.2 Td +(1830 void) 5.418 Tj +0 -44.5091 Td +(1831 release\(struct spinlock *lock\)) 21.07 Tj +0 -45.8182 Td +(1832 {) 3.612 Tj +0 -47.1272 Td +(1833 if\(!holding\(lock\)\)) 15.05 Tj +0 -48.4363 Td +(1834 panic\("release"\);) 15.652 Tj +0 -49.7454 Td +(1835 ) 3.01 Tj +0 -51.0545 Td +(1836 lock->pcs[0] = 0;) 14.448 Tj +0 -52.3636 Td +(1837 lock->cpu = 0xffffffff;) 18.06 Tj +0 -53.6727 Td +(1838 ) 3.01 Tj +0 -54.9818 Td +(1839 // Serialize instructions: before unlocking the lock, make sure) 42.14 Tj +0 -56.2909 Td +(1840 // to flush any pending memory writes from this processor.) 39.13 Tj +0 -57.6 Td +(1841 cpuid\(0, 0, 0, 0, 0\); // memory barrier \(see Ch 7, IA-32 manual vol 3\)) 46.956 Tj +0 -58.9091 Td +(1842 ) 3.01 Tj +0 -60.2181 Td +(1843 lock->locked = 0;) 14.448 Tj +0 -61.5272 Td +(1844 if\(--cpus[cpu\(\)].nlock == 0\)) 21.07 Tj +0 -62.8363 Td +(1845 sti\(\);) 9.03 Tj +0 -64.1454 Td +(1846 }) 3.612 Tj +0 -65.4545 Td +(1847 ) 3.01 Tj +0 -66.7636 Td +(1848 ) 3.01 Tj +0 -68.0727 Td +(1849 ) 3.01 Tj +0 -72 Td +(Sheet 18) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/spinlock.c Page 3) 24.682 Tj +0 -3.92728 Td +(1850 // Check whether this cpu is holding the lock.) 30.702 Tj +0 -5.23637 Td +(1851 int) 4.816 Tj +0 -6.54546 Td +(1852 holding\(struct spinlock *lock\)) 21.07 Tj +0 -7.85455 Td +(1853 {) 3.612 Tj +0 -9.16364 Td +(1854 return lock->locked && lock->cpu == cpu\(\) + 10;) 32.508 Tj +0 -10.4727 Td +(1855 }) 3.612 Tj +0 -11.7818 Td +(1856 ) 3.01 Tj +0 -13.0909 Td +(1857 ) 3.01 Tj +0 -14.4 Td +(1858 ) 3.01 Tj +0 -15.7091 Td +(1859 ) 3.01 Tj +0 -17.0182 Td +(1860 ) 3.01 Tj +0 -18.3273 Td +(1861 ) 3.01 Tj +0 -19.6364 Td +(1862 ) 3.01 Tj +0 -20.9455 Td +(1863 ) 3.01 Tj +0 -22.2545 Td +(1864 ) 3.01 Tj +0 -23.5636 Td +(1865 ) 3.01 Tj +0 -24.8727 Td +(1866 ) 3.01 Tj +0 -26.1818 Td +(1867 ) 3.01 Tj +0 -27.4909 Td +(1868 ) 3.01 Tj +0 -28.8 Td +(1869 ) 3.01 Tj +0 -30.1091 Td +(1870 ) 3.01 Tj +0 -31.4182 Td +(1871 ) 3.01 Tj +0 -32.7273 Td +(1872 ) 3.01 Tj +0 -34.0364 Td +(1873 ) 3.01 Tj +0 -35.3454 Td +(1874 ) 3.01 Tj +0 -36.6545 Td +(1875 ) 3.01 Tj +0 -37.9636 Td +(1876 ) 3.01 Tj +0 -39.2727 Td +(1877 ) 3.01 Tj +0 -40.5818 Td +(1878 ) 3.01 Tj +0 -41.8909 Td +(1879 ) 3.01 Tj +0 -43.2 Td +(1880 ) 3.01 Tj +0 -44.5091 Td +(1881 ) 3.01 Tj +0 -45.8182 Td +(1882 ) 3.01 Tj +0 -47.1272 Td +(1883 ) 3.01 Tj +0 -48.4363 Td +(1884 ) 3.01 Tj +0 -49.7454 Td +(1885 ) 3.01 Tj +0 -51.0545 Td +(1886 ) 3.01 Tj +0 -52.3636 Td +(1887 ) 3.01 Tj +0 -53.6727 Td +(1888 ) 3.01 Tj +0 -54.9818 Td +(1889 ) 3.01 Tj +0 -56.2909 Td +(1890 ) 3.01 Tj +0 -57.6 Td +(1891 ) 3.01 Tj +0 -58.9091 Td +(1892 ) 3.01 Tj +0 -60.2181 Td +(1893 ) 3.01 Tj +0 -61.5272 Td +(1894 ) 3.01 Tj +0 -62.8363 Td +(1895 ) 3.01 Tj +0 -64.1454 Td +(1896 ) 3.01 Tj +0 -65.4545 Td +(1897 ) 3.01 Tj +0 -66.7636 Td +(1898 ) 3.01 Tj +0 -68.0727 Td +(1899 ) 3.01 Tj +0 -72 Td +(Sheet 18) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 26 26 +%%BeginPageSetup +%%PageOrientation: Landscape +__tumble pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/proc.h Page 1) 22.274 Tj +0 -3.92728 Td +(1900 // Segments in proc->gdt) 17.458 Tj +0 -5.23637 Td +(1901 #define SEG_KCODE 1 // kernel code) 24.08 Tj +0 -6.54546 Td +(1902 #define SEG_KDATA 2 // kernel data+stack) 27.692 Tj +0 -7.85455 Td +(1903 #define SEG_UCODE 3) 14.448 Tj +0 -9.16364 Td +(1904 #define SEG_UDATA 4) 14.448 Tj +0 -10.4727 Td +(1905 #define SEG_TSS 5 // this process's task state) 32.508 Tj +0 -11.7818 Td +(1906 #define NSEGS 6) 14.448 Tj +0 -13.0909 Td +(1907 ) 3.01 Tj +0 -14.4 Td +(1908 // Saved registers for kernel context switches.) 31.304 Tj +0 -15.7091 Td +(1909 // Don't need to save all the %fs etc. segment registers,) 37.324 Tj +0 -17.0182 Td +(1910 // because they are constant across kernel contexts.) 34.314 Tj +0 -18.3273 Td +(1911 // Save all the regular registers so we don't need to care) 37.926 Tj +0 -19.6364 Td +(1912 // which are caller save.) 18.06 Tj +0 -20.9455 Td +(1913 // Don't save %eax, because that's the return register.) 36.12 Tj +0 -22.2545 Td +(1914 // The layout of jmpbuf is known to setjmp.S.) 30.1 Tj +0 -23.5636 Td +(1915 struct jmpbuf {) 12.04 Tj +0 -24.8727 Td +(1916 int ebx;) 9.03 Tj +0 -26.1818 Td +(1917 int ecx;) 9.03 Tj +0 -27.4909 Td +(1918 int edx;) 9.03 Tj +0 -28.8 Td +(1919 int esi;) 9.03 Tj +0 -30.1091 Td +(1920 int edi;) 9.03 Tj +0 -31.4182 Td +(1921 int esp;) 9.03 Tj +0 -32.7273 Td +(1922 int ebp;) 9.03 Tj +0 -34.0364 Td +(1923 int eip;) 9.03 Tj +0 -35.3454 Td +(1924 };) 4.214 Tj +0 -36.6545 Td +(1925 ) 3.01 Tj +0 -37.9636 Td +(1926 enum proc_state { UNUSED, EMBRYO, SLEEPING, RUNNABLE, RUNNING, ZOMBIE };) 46.354 Tj +0 -39.2727 Td +(1927 ) 3.01 Tj +0 -40.5818 Td +(1928 // Per-process state) 15.05 Tj +0 -41.8909 Td +(1929 struct proc {) 10.836 Tj +0 -43.2 Td +(1930 char *mem; // Start of process memory \(kernel address\)) 45.752 Tj +0 -44.5091 Td +(1931 uint sz; // Size of process memory \(bytes\)) 39.732 Tj +0 -45.8182 Td +(1932 char *kstack; // Bottom of kernel stack for this process) 45.15 Tj +0 -47.1272 Td +(1933 enum proc_state state; // Process state) 29.498 Tj +0 -48.4363 Td +(1934 int pid; // Process ID) 27.692 Tj +0 -49.7454 Td +(1935 int ppid; // Parent pid) 27.692 Tj +0 -51.0545 Td +(1936 void *chan; // If non-zero, sleeping on chan) 39.13 Tj +0 -52.3636 Td +(1937 int killed; // If non-zero, have been killed) 39.13 Tj +0 -53.6727 Td +(1938 struct file *ofile[NOFILE]; // Open files) 29.498 Tj +0 -54.9818 Td +(1939 struct inode *cwd; // Current directory) 31.906 Tj +0 -56.2909 Td +(1940 struct jmpbuf jmpbuf; // Jump here to run process) 36.12 Tj +0 -57.6 Td +(1941 struct trapframe *tf; // Trap frame for current interrupt) 40.936 Tj +0 -58.9091 Td +(1942 };) 4.214 Tj +0 -60.2181 Td +(1943 ) 3.01 Tj +0 -61.5272 Td +(1944 ) 3.01 Tj +0 -62.8363 Td +(1945 ) 3.01 Tj +0 -64.1454 Td +(1946 ) 3.01 Tj +0 -65.4545 Td +(1947 ) 3.01 Tj +0 -66.7636 Td +(1948 ) 3.01 Tj +0 -68.0727 Td +(1949 ) 3.01 Tj +0 -72 Td +(Sheet 19) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/proc.h Page 2) 22.274 Tj +0 -3.92728 Td +(1950 // Process memory is laid out contiguously:) 28.896 Tj +0 -5.23637 Td +(1951 // text) 8.428 Tj +0 -6.54546 Td +(1952 // original data and bss) 18.662 Tj +0 -7.85455 Td +(1953 // fixed-size stack) 15.652 Tj +0 -9.16364 Td +(1954 // expandable heap) 15.05 Tj +0 -10.4727 Td +(1955 ) 3.01 Tj +0 -11.7818 Td +(1956 extern struct proc proc[];) 18.662 Tj +0 -13.0909 Td +(1957 extern struct proc *curproc[NCPU]; // Current \(running\) process per CPU) 46.354 Tj +0 -14.4 Td +(1958 ) 3.01 Tj +0 -15.7091 Td +(1959 #define MPSTACK 512) 14.448 Tj +0 -17.0182 Td +(1960 ) 3.01 Tj +0 -18.3273 Td +(1961 // Per-CPU state) 12.642 Tj +0 -19.6364 Td +(1962 struct cpu {) 10.234 Tj +0 -20.9455 Td +(1963 uchar apicid; // Local APIC ID) 30.702 Tj +0 -22.2545 Td +(1964 struct jmpbuf jmpbuf; // Jump here to enter scheduler) 39.732 Tj +0 -23.5636 Td +(1965 struct taskstate ts; // Used by x86 to find stack for interrupt) 46.354 Tj +0 -24.8727 Td +(1966 struct segdesc gdt[NSEGS]; // x86 global descriptor table) 39.13 Tj +0 -26.1818 Td +(1967 char mpstack[MPSTACK]; // Per-CPU startup stack) 35.518 Tj +0 -27.4909 Td +(1968 volatile int booted; // Has the CPU started?) 34.916 Tj +0 -28.8 Td +(1969 int nlock; // Number of locks currently held) 40.936 Tj +0 -30.1091 Td +(1970 };) 4.214 Tj +0 -31.4182 Td +(1971 ) 3.01 Tj +0 -32.7273 Td +(1972 extern struct cpu cpus[NCPU];) 20.468 Tj +0 -34.0364 Td +(1973 extern int ncpu;) 12.642 Tj +0 -35.3454 Td +(1974 ) 3.01 Tj +0 -36.6545 Td +(1975 ) 3.01 Tj +0 -37.9636 Td +(1976 ) 3.01 Tj +0 -39.2727 Td +(1977 ) 3.01 Tj +0 -40.5818 Td +(1978 ) 3.01 Tj +0 -41.8909 Td +(1979 ) 3.01 Tj +0 -43.2 Td +(1980 ) 3.01 Tj +0 -44.5091 Td +(1981 ) 3.01 Tj +0 -45.8182 Td +(1982 ) 3.01 Tj +0 -47.1272 Td +(1983 ) 3.01 Tj +0 -48.4363 Td +(1984 ) 3.01 Tj +0 -49.7454 Td +(1985 ) 3.01 Tj +0 -51.0545 Td +(1986 ) 3.01 Tj +0 -52.3636 Td +(1987 ) 3.01 Tj +0 -53.6727 Td +(1988 ) 3.01 Tj +0 -54.9818 Td +(1989 ) 3.01 Tj +0 -56.2909 Td +(1990 ) 3.01 Tj +0 -57.6 Td +(1991 ) 3.01 Tj +0 -58.9091 Td +(1992 ) 3.01 Tj +0 -60.2181 Td +(1993 ) 3.01 Tj +0 -61.5272 Td +(1994 ) 3.01 Tj +0 -62.8363 Td +(1995 ) 3.01 Tj +0 -64.1454 Td +(1996 ) 3.01 Tj +0 -65.4545 Td +(1997 ) 3.01 Tj +0 -66.7636 Td +(1998 ) 3.01 Tj +0 -68.0727 Td +(1999 ) 3.01 Tj +0 -72 Td +(Sheet 19) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 27 27 +%%BeginPageSetup +%%PageOrientation: Landscape +pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/proc.c Page 1) 22.274 Tj +0 -3.92728 Td +(2000 #include "types.h") 13.846 Tj +0 -5.23637 Td +(2001 #include "mmu.h") 12.642 Tj +0 -6.54546 Td +(2002 #include "x86.h") 12.642 Tj +0 -7.85455 Td +(2003 #include "param.h") 13.846 Tj +0 -9.16364 Td +(2004 #include "file.h") 13.244 Tj +0 -10.4727 Td +(2005 #include "proc.h") 13.244 Tj +0 -11.7818 Td +(2006 #include "defs.h") 13.244 Tj +0 -13.0909 Td +(2007 #include "spinlock.h") 15.652 Tj +0 -14.4 Td +(2008 ) 3.01 Tj +0 -15.7091 Td +(2009 struct spinlock proc_table_lock;) 22.274 Tj +0 -17.0182 Td +(2010 ) 3.01 Tj +0 -18.3273 Td +(2011 struct proc proc[NPROC];) 17.458 Tj +0 -19.6364 Td +(2012 struct proc *curproc[NCPU];) 19.264 Tj +0 -20.9455 Td +(2013 int next_pid = 1;) 13.244 Tj +0 -22.2545 Td +(2014 extern void forkret\(void\);) 18.662 Tj +0 -23.5636 Td +(2015 extern void forkret1\(struct trapframe*\);) 27.09 Tj +0 -24.8727 Td +(2016 ) 3.01 Tj +0 -26.1818 Td +(2017 void) 5.418 Tj +0 -27.4909 Td +(2018 pinit\(void\)) 9.632 Tj +0 -28.8 Td +(2019 {) 3.612 Tj +0 -30.1091 Td +(2020 initlock\(&proc_table_lock, "proc_table"\);) 28.896 Tj +0 -31.4182 Td +(2021 }) 3.612 Tj +0 -32.7273 Td +(2022 ) 3.01 Tj +0 -34.0364 Td +(2023 // Set up CPU's segment descriptors and task state for a) 36.722 Tj +0 -35.3454 Td +(2024 // given process.) 13.244 Tj +0 -36.6545 Td +(2025 // If p==0, set up for "idle" state for when scheduler\(\)) 36.722 Tj +0 -37.9636 Td +(2026 // is idling, not running any process.) 25.886 Tj +0 -39.2727 Td +(2027 void) 5.418 Tj +0 -40.5818 Td +(2028 setupsegs\(struct proc *p\)) 18.06 Tj +0 -41.8909 Td +(2029 {) 3.612 Tj +0 -43.2 Td +(2030 struct cpu *c = &cpus[cpu\(\)];) 21.672 Tj +0 -44.5091 Td +(2031 ) 3.01 Tj +0 -45.8182 Td +(2032 c->ts.ss0 = SEG_KDATA << 3;) 20.468 Tj +0 -47.1272 Td +(2033 if\(p\){) 7.826 Tj +0 -48.4363 Td +(2034 c->ts.esp0 = \(uint\)\(p->kstack + KSTACKSIZE\);) 31.906 Tj +0 -49.7454 Td +(2035 } else {) 9.03 Tj +0 -51.0545 Td +(2036 c->ts.esp0 = 0xffffffff;) 19.866 Tj +0 -52.3636 Td +(2037 }) 4.816 Tj +0 -53.6727 Td +(2038 ) 3.01 Tj +0 -54.9818 Td +(2039 c->gdt[0] = SEG_NULL;) 16.856 Tj +0 -56.2909 Td +(2040 c->gdt[SEG_KCODE] = SEG\(STA_X|STA_R, 0, 0x100000 + 64*1024, 0\);) 42.14 Tj +0 -57.6 Td +(2041 c->gdt[SEG_KDATA] = SEG\(STA_W, 0, 0xffffffff, 0\);) 33.712 Tj +0 -58.9091 Td +(2042 c->gdt[SEG_TSS] = SEG16\(STS_T32A, \(uint\) &c->ts, sizeof\(c->ts\), 0\);) 44.548 Tj +0 -60.2181 Td +(2043 c->gdt[SEG_TSS].s = 0;) 17.458 Tj +0 -61.5272 Td +(2044 if\(p\){) 7.826 Tj +0 -62.8363 Td +(2045 c->gdt[SEG_UCODE] = SEG\(STA_X|STA_R, \(uint\)p->mem, p->sz, 3\);) 42.14 Tj +0 -64.1454 Td +(2046 c->gdt[SEG_UDATA] = SEG\(STA_W, \(uint\)p->mem, p->sz, 3\);) 38.528 Tj +0 -65.4545 Td +(2047 } else {) 9.03 Tj +0 -66.7636 Td +(2048 c->gdt[SEG_UCODE] = SEG_NULL;) 22.876 Tj +0 -68.0727 Td +(2049 c->gdt[SEG_UDATA] = SEG_NULL;) 22.876 Tj +0 -72 Td +(Sheet 20) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/proc.c Page 2) 22.274 Tj +0 -3.92728 Td +(2050 }) 4.816 Tj +0 -5.23637 Td +(2051 ) 3.01 Tj +0 -6.54546 Td +(2052 lgdt\(c->gdt, sizeof c->gdt\);) 21.07 Tj +0 -7.85455 Td +(2053 ltr\(SEG_TSS << 3\);) 15.05 Tj +0 -9.16364 Td +(2054 }) 3.612 Tj +0 -10.4727 Td +(2055 ) 3.01 Tj +0 -11.7818 Td +(2056 // Grow current process's memory by n bytes.) 29.498 Tj +0 -13.0909 Td +(2057 // Return old size on success, -1 on failure.) 30.1 Tj +0 -14.4 Td +(2058 int) 4.816 Tj +0 -15.7091 Td +(2059 growproc\(int n\)) 12.04 Tj +0 -17.0182 Td +(2060 {) 3.612 Tj +0 -18.3273 Td +(2061 struct proc *cp = curproc[cpu\(\)];) 24.08 Tj +0 -19.6364 Td +(2062 char *newmem, *oldmem;) 17.458 Tj +0 -20.9455 Td +(2063 ) 3.01 Tj +0 -22.2545 Td +(2064 newmem = kalloc\(cp->sz + n\);) 21.07 Tj +0 -23.5636 Td +(2065 if\(newmem == 0\)) 13.244 Tj +0 -24.8727 Td +(2066 return 0xffffffff;) 16.254 Tj +0 -26.1818 Td +(2067 memmove\(newmem, cp->mem, cp->sz\);) 24.08 Tj +0 -27.4909 Td +(2068 memset\(newmem + cp->sz, 0, n\);) 22.274 Tj +0 -28.8 Td +(2069 oldmem = cp->mem;) 14.448 Tj +0 -30.1091 Td +(2070 cp->mem = newmem;) 14.448 Tj +0 -31.4182 Td +(2071 kfree\(oldmem, cp->sz\);) 17.458 Tj +0 -32.7273 Td +(2072 cp->sz += n;) 11.438 Tj +0 -34.0364 Td +(2073 return cp->sz - n;) 15.05 Tj +0 -35.3454 Td +(2074 }) 3.612 Tj +0 -36.6545 Td +(2075 ) 3.01 Tj +0 -37.9636 Td +(2076 // Look in the process table for an UNUSED proc.) 31.906 Tj +0 -39.2727 Td +(2077 // If found, change state to EMBRYO and return it.) 33.11 Tj +0 -40.5818 Td +(2078 // Otherwise return 0.) 16.254 Tj +0 -41.8909 Td +(2079 struct proc*) 10.234 Tj +0 -43.2 Td +(2080 allocproc\(void\)) 12.04 Tj +0 -44.5091 Td +(2081 {) 3.612 Tj +0 -45.8182 Td +(2082 int i;) 7.826 Tj +0 -47.1272 Td +(2083 struct proc *p;) 13.244 Tj +0 -48.4363 Td +(2084 ) 3.01 Tj +0 -49.7454 Td +(2085 for\(i = 0; i < NPROC; i++\){) 20.468 Tj +0 -51.0545 Td +(2086 p = &proc[i];) 13.244 Tj +0 -52.3636 Td +(2087 if\(p->state == UNUSED\){) 19.264 Tj +0 -53.6727 Td +(2088 p->state = EMBRYO;) 17.458 Tj +0 -54.9818 Td +(2089 return p;) 12.04 Tj +0 -56.2909 Td +(2090 }) 6.02 Tj +0 -57.6 Td +(2091 }) 4.816 Tj +0 -58.9091 Td +(2092 return 0;) 9.632 Tj +0 -60.2181 Td +(2093 }) 3.612 Tj +0 -61.5272 Td +(2094 ) 3.01 Tj +0 -62.8363 Td +(2095 ) 3.01 Tj +0 -64.1454 Td +(2096 ) 3.01 Tj +0 -65.4545 Td +(2097 ) 3.01 Tj +0 -66.7636 Td +(2098 ) 3.01 Tj +0 -68.0727 Td +(2099 ) 3.01 Tj +0 -72 Td +(Sheet 20) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 28 28 +%%BeginPageSetup +%%PageOrientation: Landscape +__tumble pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/proc.c Page 3) 22.274 Tj +0 -3.92728 Td +(2100 // Create a new process copying p as the parent.) 31.906 Tj +0 -5.23637 Td +(2101 // Does not copy the kernel stack.) 23.478 Tj +0 -6.54546 Td +(2102 // Instead, sets up stack to return as if from system call.) 38.528 Tj +0 -7.85455 Td +(2103 // Caller must arrange for process to run \(set state to RUNNABLE\).) 42.742 Tj +0 -9.16364 Td +(2104 struct proc*) 10.234 Tj +0 -10.4727 Td +(2105 copyproc\(struct proc *p\)) 17.458 Tj +0 -11.7818 Td +(2106 {) 3.612 Tj +0 -13.0909 Td +(2107 int i;) 7.826 Tj +0 -14.4 Td +(2108 struct proc *np;) 13.846 Tj +0 -15.7091 Td +(2109 ) 3.01 Tj +0 -17.0182 Td +(2110 // Allocate process.) 16.254 Tj +0 -18.3273 Td +(2111 acquire\(&proc_table_lock\);) 19.866 Tj +0 -19.6364 Td +(2112 if\(\(np = allocproc\(\)\) == 0\){) 21.07 Tj +0 -20.9455 Td +(2113 release\(&proc_table_lock\);) 21.07 Tj +0 -22.2545 Td +(2114 return 0;) 10.836 Tj +0 -23.5636 Td +(2115 }) 4.816 Tj +0 -24.8727 Td +(2116 np->pid = next_pid++;) 16.856 Tj +0 -26.1818 Td +(2117 np->ppid = p->pid;) 15.05 Tj +0 -27.4909 Td +(2118 release\(&proc_table_lock\);) 19.866 Tj +0 -28.8 Td +(2119 ) 3.01 Tj +0 -30.1091 Td +(2120 // Copy user memory.) 16.254 Tj +0 -31.4182 Td +(2121 np->sz = p->sz;) 13.244 Tj +0 -32.7273 Td +(2122 np->mem = kalloc\(np->sz\);) 19.264 Tj +0 -34.0364 Td +(2123 if\(np->mem == 0\){) 14.448 Tj +0 -35.3454 Td +(2124 np->state = UNUSED;) 16.856 Tj +0 -36.6545 Td +(2125 return 0;) 10.836 Tj +0 -37.9636 Td +(2126 }) 4.816 Tj +0 -39.2727 Td +(2127 memmove\(np->mem, p->mem, np->sz\);) 24.08 Tj +0 -40.5818 Td +(2128 ) 3.01 Tj +0 -41.8909 Td +(2129 // Allocate kernel stack.) 19.264 Tj +0 -43.2 Td +(2130 np->kstack = kalloc\(KSTACKSIZE\);) 23.478 Tj +0 -44.5091 Td +(2131 if\(np->kstack == 0\){) 16.254 Tj +0 -45.8182 Td +(2132 kfree\(np->mem, np->sz\);) 19.264 Tj +0 -47.1272 Td +(2133 np->mem = 0;) 12.642 Tj +0 -48.4363 Td +(2134 np->state = UNUSED;) 16.856 Tj +0 -49.7454 Td +(2135 return 0;) 10.836 Tj +0 -51.0545 Td +(2136 }) 4.816 Tj +0 -52.3636 Td +(2137 ) 3.01 Tj +0 -53.6727 Td +(2138 // Copy trapframe registers from parent.) 28.294 Tj +0 -54.9818 Td +(2139 np->tf = \(struct trapframe*\)\(np->kstack + KSTACKSIZE\) - 1;) 39.13 Tj +0 -56.2909 Td +(2140 memmove\(np->tf, p->tf, sizeof\(*np->tf\)\);) 28.294 Tj +0 -57.6 Td +(2141 ) 3.01 Tj +0 -58.9091 Td +(2142 // Clear %eax so that fork system call returns 0 in child.) 39.13 Tj +0 -60.2181 Td +(2143 np->tf->eax = 0;) 13.846 Tj +0 -61.5272 Td +(2144 ) 3.01 Tj +0 -62.8363 Td +(2145 // Set up new jmpbuf to start executing at forkret \(see below\).) 42.14 Tj +0 -64.1454 Td +(2146 memset\(&np->jmpbuf, 0, sizeof np->jmpbuf\);) 29.498 Tj +0 -65.4545 Td +(2147 np->jmpbuf.eip = \(uint\)forkret;) 22.876 Tj +0 -66.7636 Td +(2148 np->jmpbuf.esp = \(uint\)np->tf - 4;) 24.682 Tj +0 -68.0727 Td +(2149 ) 3.01 Tj +0 -72 Td +(Sheet 21) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/proc.c Page 4) 22.274 Tj +0 -3.92728 Td +(2150 // Copy file descriptors) 18.662 Tj +0 -5.23637 Td +(2151 for\(i = 0; i < NOFILE; i++\){) 21.07 Tj +0 -6.54546 Td +(2152 np->ofile[i] = p->ofile[i];) 21.672 Tj +0 -7.85455 Td +(2153 if\(np->ofile[i]\)) 15.05 Tj +0 -9.16364 Td +(2154 fileincref\(np->ofile[i]\);) 21.672 Tj +0 -10.4727 Td +(2155 }) 4.816 Tj +0 -11.7818 Td +(2156 ) 3.01 Tj +0 -13.0909 Td +(2157 np->cwd = p->cwd;) 14.448 Tj +0 -14.4 Td +(2158 iincref\(p->cwd\);) 13.846 Tj +0 -15.7091 Td +(2159 ) 3.01 Tj +0 -17.0182 Td +(2160 return np;) 10.234 Tj +0 -18.3273 Td +(2161 }) 3.612 Tj +0 -19.6364 Td +(2162 ) 3.01 Tj +0 -20.9455 Td +(2163 ) 3.01 Tj +0 -22.2545 Td +(2164 ) 3.01 Tj +0 -23.5636 Td +(2165 ) 3.01 Tj +0 -24.8727 Td +(2166 ) 3.01 Tj +0 -26.1818 Td +(2167 ) 3.01 Tj +0 -27.4909 Td +(2168 ) 3.01 Tj +0 -28.8 Td +(2169 ) 3.01 Tj +0 -30.1091 Td +(2170 ) 3.01 Tj +0 -31.4182 Td +(2171 ) 3.01 Tj +0 -32.7273 Td +(2172 ) 3.01 Tj +0 -34.0364 Td +(2173 ) 3.01 Tj +0 -35.3454 Td +(2174 ) 3.01 Tj +0 -36.6545 Td +(2175 ) 3.01 Tj +0 -37.9636 Td +(2176 ) 3.01 Tj +0 -39.2727 Td +(2177 ) 3.01 Tj +0 -40.5818 Td +(2178 ) 3.01 Tj +0 -41.8909 Td +(2179 ) 3.01 Tj +0 -43.2 Td +(2180 ) 3.01 Tj +0 -44.5091 Td +(2181 ) 3.01 Tj +0 -45.8182 Td +(2182 ) 3.01 Tj +0 -47.1272 Td +(2183 ) 3.01 Tj +0 -48.4363 Td +(2184 ) 3.01 Tj +0 -49.7454 Td +(2185 ) 3.01 Tj +0 -51.0545 Td +(2186 ) 3.01 Tj +0 -52.3636 Td +(2187 ) 3.01 Tj +0 -53.6727 Td +(2188 ) 3.01 Tj +0 -54.9818 Td +(2189 ) 3.01 Tj +0 -56.2909 Td +(2190 ) 3.01 Tj +0 -57.6 Td +(2191 ) 3.01 Tj +0 -58.9091 Td +(2192 ) 3.01 Tj +0 -60.2181 Td +(2193 ) 3.01 Tj +0 -61.5272 Td +(2194 ) 3.01 Tj +0 -62.8363 Td +(2195 ) 3.01 Tj +0 -64.1454 Td +(2196 ) 3.01 Tj +0 -65.4545 Td +(2197 ) 3.01 Tj +0 -66.7636 Td +(2198 ) 3.01 Tj +0 -68.0727 Td +(2199 ) 3.01 Tj +0 -72 Td +(Sheet 21) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 29 29 +%%BeginPageSetup +%%PageOrientation: Landscape +pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/proc.c Page 5) 22.274 Tj +0 -3.92728 Td +(2200 // Per-CPU process scheduler.) 20.468 Tj +0 -5.23637 Td +(2201 // Each CPU calls scheduler\(\) after setting itself up.) 35.518 Tj +0 -6.54546 Td +(2202 // Scheduler never returns. It loops, doing:) 30.1 Tj +0 -7.85455 Td +(2203 // - choose a process to run) 20.468 Tj +0 -9.16364 Td +(2204 // - longjmp to start running that process) 28.896 Tj +0 -10.4727 Td +(2205 // - eventually that process transfers control back) 34.314 Tj +0 -11.7818 Td +(2206 // via longjmp back to the top of scheduler.) 32.508 Tj +0 -13.0909 Td +(2207 void) 5.418 Tj +0 -14.4 Td +(2208 scheduler\(void\)) 12.04 Tj +0 -15.7091 Td +(2209 {) 3.612 Tj +0 -17.0182 Td +(2210 struct proc *p;) 13.244 Tj +0 -18.3273 Td +(2211 int i;) 7.826 Tj +0 -19.6364 Td +(2212 ) 3.01 Tj +0 -20.9455 Td +(2213 for\(;;\){) 9.03 Tj +0 -22.2545 Td +(2214 // Loop over process table looking for process to run.) 37.926 Tj +0 -23.5636 Td +(2215 acquire\(&proc_table_lock\);) 21.07 Tj +0 -24.8727 Td +(2216 ) 3.01 Tj +0 -26.1818 Td +(2217 for\(i = 0; i < NPROC; i++\){) 21.672 Tj +0 -27.4909 Td +(2218 p = &proc[i];) 14.448 Tj +0 -28.8 Td +(2219 if\(p->state != RUNNABLE\)) 21.07 Tj +0 -30.1091 Td +(2220 continue;) 13.244 Tj +0 -31.4182 Td +(2221 ) 3.01 Tj +0 -32.7273 Td +(2222 // Switch to chosen process. It is the process's job) 38.528 Tj +0 -34.0364 Td +(2223 // to release proc_table_lock and then reacquire it) 37.324 Tj +0 -35.3454 Td +(2224 // before jumping back to us.) 24.08 Tj +0 -36.6545 Td +(2225 ) 3.01 Tj +0 -37.9636 Td +(2226 setupsegs\(p\);) 14.448 Tj +0 -39.2727 Td +(2227 curproc[cpu\(\)] = p;) 18.06 Tj +0 -40.5818 Td +(2228 p->state = RUNNING;) 18.06 Tj +0 -41.8909 Td +(2229 if\(setjmp\(&cpus[cpu\(\)].jmpbuf\) == 0\)) 28.294 Tj +0 -43.2 Td +(2230 longjmp\(&p->jmpbuf\);) 19.866 Tj +0 -44.5091 Td +(2231 ) 3.01 Tj +0 -45.8182 Td +(2232 // Process is done running for now.) 27.692 Tj +0 -47.1272 Td +(2233 // It should have changed its p->state before coming back.) 41.538 Tj +0 -48.4363 Td +(2234 curproc[cpu\(\)] = 0;) 18.06 Tj +0 -49.7454 Td +(2235 ) 3.01 Tj +0 -51.0545 Td +(2236 setupsegs\(0\);) 14.448 Tj +0 -52.3636 Td +(2237 }) 6.02 Tj +0 -53.6727 Td +(2238 ) 3.01 Tj +0 -54.9818 Td +(2239 release\(&proc_table_lock\);) 21.07 Tj +0 -56.2909 Td +(2240 }) 4.816 Tj +0 -57.6 Td +(2241 }) 3.612 Tj +0 -58.9091 Td +(2242 ) 3.01 Tj +0 -60.2181 Td +(2243 ) 3.01 Tj +0 -61.5272 Td +(2244 ) 3.01 Tj +0 -62.8363 Td +(2245 ) 3.01 Tj +0 -64.1454 Td +(2246 ) 3.01 Tj +0 -65.4545 Td +(2247 ) 3.01 Tj +0 -66.7636 Td +(2248 ) 3.01 Tj +0 -68.0727 Td +(2249 ) 3.01 Tj +0 -72 Td +(Sheet 22) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/proc.c Page 6) 22.274 Tj +0 -3.92728 Td +(2250 // Enter scheduler. Must already hold proc_table_lock) 35.518 Tj +0 -5.23637 Td +(2251 // and have changed curproc[cpu\(\)]->state.) 28.294 Tj +0 -6.54546 Td +(2252 void) 5.418 Tj +0 -7.85455 Td +(2253 sched\(void\)) 9.632 Tj +0 -9.16364 Td +(2254 {) 3.612 Tj +0 -10.4727 Td +(2255 struct proc *p = curproc[cpu\(\)];) 23.478 Tj +0 -11.7818 Td +(2256 ) 3.01 Tj +0 -13.0909 Td +(2257 if\(!holding\(&proc_table_lock\)\)) 22.274 Tj +0 -14.4 Td +(2258 panic\("sched"\);) 14.448 Tj +0 -15.7091 Td +(2259 if\(cpus[cpu\(\)].nlock != 1\)) 19.866 Tj +0 -17.0182 Td +(2260 panic\("sched locks"\);) 18.06 Tj +0 -18.3273 Td +(2261 ) 3.01 Tj +0 -19.6364 Td +(2262 if\(setjmp\(&p->jmpbuf\) == 0\)) 20.468 Tj +0 -20.9455 Td +(2263 longjmp\(&cpus[cpu\(\)].jmpbuf\);) 22.876 Tj +0 -22.2545 Td +(2264 }) 3.612 Tj +0 -23.5636 Td +(2265 ) 3.01 Tj +0 -24.8727 Td +(2266 // Give up the CPU for one scheduling round.) 29.498 Tj +0 -26.1818 Td +(2267 void) 5.418 Tj +0 -27.4909 Td +(2268 yield\(void\)) 9.632 Tj +0 -28.8 Td +(2269 {) 3.612 Tj +0 -30.1091 Td +(2270 struct proc *p = curproc[cpu\(\)];) 23.478 Tj +0 -31.4182 Td +(2271 ) 3.01 Tj +0 -32.7273 Td +(2272 acquire\(&proc_table_lock\);) 19.866 Tj +0 -34.0364 Td +(2273 p->state = RUNNABLE;) 16.254 Tj +0 -35.3454 Td +(2274 sched\(\);) 9.03 Tj +0 -36.6545 Td +(2275 release\(&proc_table_lock\);) 19.866 Tj +0 -37.9636 Td +(2276 }) 3.612 Tj +0 -39.2727 Td +(2277 ) 3.01 Tj +0 -40.5818 Td +(2278 // A fork child's very first scheduling by scheduler\(\)) 35.518 Tj +0 -41.8909 Td +(2279 // will longjmp here. "return" to user space.) 30.1 Tj +0 -43.2 Td +(2280 void) 5.418 Tj +0 -44.5091 Td +(2281 forkret\(void\)) 10.836 Tj +0 -45.8182 Td +(2282 {) 3.612 Tj +0 -47.1272 Td +(2283 // Still holding proc_table_lock from scheduler.) 33.11 Tj +0 -48.4363 Td +(2284 release\(&proc_table_lock\);) 19.866 Tj +0 -49.7454 Td +(2285 ) 3.01 Tj +0 -51.0545 Td +(2286 // Jump into assembly, never to return.) 27.692 Tj +0 -52.3636 Td +(2287 forkret1\(curproc[cpu\(\)]->tf\);) 21.672 Tj +0 -53.6727 Td +(2288 }) 3.612 Tj +0 -54.9818 Td +(2289 ) 3.01 Tj +0 -56.2909 Td +(2290 ) 3.01 Tj +0 -57.6 Td +(2291 ) 3.01 Tj +0 -58.9091 Td +(2292 ) 3.01 Tj +0 -60.2181 Td +(2293 ) 3.01 Tj +0 -61.5272 Td +(2294 ) 3.01 Tj +0 -62.8363 Td +(2295 ) 3.01 Tj +0 -64.1454 Td +(2296 ) 3.01 Tj +0 -65.4545 Td +(2297 ) 3.01 Tj +0 -66.7636 Td +(2298 ) 3.01 Tj +0 -68.0727 Td +(2299 ) 3.01 Tj +0 -72 Td +(Sheet 22) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 30 30 +%%BeginPageSetup +%%PageOrientation: Landscape +__tumble pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/proc.c Page 7) 22.274 Tj +0 -3.92728 Td +(2300 // Atomically release lock and sleep on chan.) 30.1 Tj +0 -5.23637 Td +(2301 // Reacquires lock when reawakened.) 24.08 Tj +0 -6.54546 Td +(2302 void) 5.418 Tj +0 -7.85455 Td +(2303 sleep\(void *chan, struct spinlock *lk\)) 25.886 Tj +0 -9.16364 Td +(2304 {) 3.612 Tj +0 -10.4727 Td +(2305 struct proc *p = curproc[cpu\(\)];) 23.478 Tj +0 -11.7818 Td +(2306 ) 3.01 Tj +0 -13.0909 Td +(2307 if\(p == 0\)) 10.234 Tj +0 -14.4 Td +(2308 panic\("sleep"\);) 14.448 Tj +0 -15.7091 Td +(2309 ) 3.01 Tj +0 -17.0182 Td +(2310 if\(lk == 0\)) 10.836 Tj +0 -18.3273 Td +(2311 panic\("sleep without lk"\);) 21.07 Tj +0 -19.6364 Td +(2312 ) 3.01 Tj +0 -20.9455 Td +(2313 // Must acquire proc_table_lock in order to) 30.1 Tj +0 -22.2545 Td +(2314 // change p->state and then call sched.) 27.692 Tj +0 -23.5636 Td +(2315 // Once we hold proc_table_lock, we can be) 29.498 Tj +0 -24.8727 Td +(2316 // guaranteed that we won't miss any wakeup) 30.1 Tj +0 -26.1818 Td +(2317 // \(wakeup runs with proc_table_lock locked\),) 31.304 Tj +0 -27.4909 Td +(2318 // so it's okay to release lk.) 22.274 Tj +0 -28.8 Td +(2319 if\(lk != &proc_table_lock\){) 20.468 Tj +0 -30.1091 Td +(2320 acquire\(&proc_table_lock\);) 21.07 Tj +0 -31.4182 Td +(2321 release\(lk\);) 12.642 Tj +0 -32.7273 Td +(2322 }) 4.816 Tj +0 -34.0364 Td +(2323 ) 3.01 Tj +0 -35.3454 Td +(2324 // Go to sleep.) 13.244 Tj +0 -36.6545 Td +(2325 p->chan = chan;) 13.244 Tj +0 -37.9636 Td +(2326 p->state = SLEEPING;) 16.254 Tj +0 -39.2727 Td +(2327 sched\(\);) 9.03 Tj +0 -40.5818 Td +(2328 ) 3.01 Tj +0 -41.8909 Td +(2329 // Tidy up.) 10.836 Tj +0 -43.2 Td +(2330 p->chan = 0;) 11.438 Tj +0 -44.5091 Td +(2331 ) 3.01 Tj +0 -45.8182 Td +(2332 // Reacquire original lock.) 20.468 Tj +0 -47.1272 Td +(2333 if\(lk != &proc_table_lock\){) 20.468 Tj +0 -48.4363 Td +(2334 release\(&proc_table_lock\);) 21.07 Tj +0 -49.7454 Td +(2335 acquire\(lk\);) 12.642 Tj +0 -51.0545 Td +(2336 }) 4.816 Tj +0 -52.3636 Td +(2337 }) 3.612 Tj +0 -53.6727 Td +(2338 ) 3.01 Tj +0 -54.9818 Td +(2339 // Wake up all processes sleeping on chan.) 28.294 Tj +0 -56.2909 Td +(2340 // Proc_table_lock must be held.) 22.274 Tj +0 -57.6 Td +(2341 void) 5.418 Tj +0 -58.9091 Td +(2342 wakeup1\(void *chan\)) 14.448 Tj +0 -60.2181 Td +(2343 {) 3.612 Tj +0 -61.5272 Td +(2344 struct proc *p;) 13.244 Tj +0 -62.8363 Td +(2345 ) 3.01 Tj +0 -64.1454 Td +(2346 for\(p = proc; p < &proc[NPROC]; p++\)) 25.886 Tj +0 -65.4545 Td +(2347 if\(p->state == SLEEPING && p->chan == chan\)) 31.304 Tj +0 -66.7636 Td +(2348 p->state = RUNNABLE;) 18.662 Tj +0 -68.0727 Td +(2349 }) 3.612 Tj +0 -72 Td +(Sheet 23) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/proc.c Page 8) 22.274 Tj +0 -3.92728 Td +(2350 // Wake up all processes sleeping on chan.) 28.294 Tj +0 -5.23637 Td +(2351 // Proc_table_lock is acquired and released.) 29.498 Tj +0 -6.54546 Td +(2352 void) 5.418 Tj +0 -7.85455 Td +(2353 wakeup\(void *chan\)) 13.846 Tj +0 -9.16364 Td +(2354 {) 3.612 Tj +0 -10.4727 Td +(2355 acquire\(&proc_table_lock\);) 19.866 Tj +0 -11.7818 Td +(2356 wakeup1\(chan\);) 12.642 Tj +0 -13.0909 Td +(2357 release\(&proc_table_lock\);) 19.866 Tj +0 -14.4 Td +(2358 }) 3.612 Tj +0 -15.7091 Td +(2359 ) 3.01 Tj +0 -17.0182 Td +(2360 // Kill the process with the given pid.) 26.488 Tj +0 -18.3273 Td +(2361 // Process won't actually exit until it returns) 31.304 Tj +0 -19.6364 Td +(2362 // to user space \(see trap in trap.c\).) 25.886 Tj +0 -20.9455 Td +(2363 int) 4.816 Tj +0 -22.2545 Td +(2364 proc_kill\(int pid\)) 13.846 Tj +0 -23.5636 Td +(2365 {) 3.612 Tj +0 -24.8727 Td +(2366 struct proc *p;) 13.244 Tj +0 -26.1818 Td +(2367 ) 3.01 Tj +0 -27.4909 Td +(2368 acquire\(&proc_table_lock\);) 19.866 Tj +0 -28.8 Td +(2369 for\(p = proc; p < &proc[NPROC]; p++\){) 26.488 Tj +0 -30.1091 Td +(2370 if\(p->pid == pid\){) 16.254 Tj +0 -31.4182 Td +(2371 p->killed = 1;) 15.05 Tj +0 -32.7273 Td +(2372 // Wake process from sleep if necessary.) 30.702 Tj +0 -34.0364 Td +(2373 if\(p->state == SLEEPING\)) 21.07 Tj +0 -35.3454 Td +(2374 p->state = RUNNABLE;) 19.866 Tj +0 -36.6545 Td +(2375 release\(&proc_table_lock\);) 22.274 Tj +0 -37.9636 Td +(2376 return 0;) 12.04 Tj +0 -39.2727 Td +(2377 }) 6.02 Tj +0 -40.5818 Td +(2378 }) 4.816 Tj +0 -41.8909 Td +(2379 release\(&proc_table_lock\);) 19.866 Tj +0 -43.2 Td +(2380 return -1;) 10.234 Tj +0 -44.5091 Td +(2381 }) 3.612 Tj +0 -45.8182 Td +(2382 ) 3.01 Tj +0 -47.1272 Td +(2383 // Exit the current process. Does not return.) 30.702 Tj +0 -48.4363 Td +(2384 // Exited processes remain in the zombie state) 30.702 Tj +0 -49.7454 Td +(2385 // until their parent calls wait\(\) to find out they exited.) 38.528 Tj +0 -51.0545 Td +(2386 void) 5.418 Tj +0 -52.3636 Td +(2387 proc_exit\(void\)) 12.04 Tj +0 -53.6727 Td +(2388 {) 3.612 Tj +0 -54.9818 Td +(2389 struct proc *p;) 13.244 Tj +0 -56.2909 Td +(2390 struct proc *cp = curproc[cpu\(\)];) 24.08 Tj +0 -57.6 Td +(2391 int fd;) 8.428 Tj +0 -58.9091 Td +(2392 ) 3.01 Tj +0 -60.2181 Td +(2393 // Close all open files.) 18.662 Tj +0 -61.5272 Td +(2394 for\(fd = 0; fd < NOFILE; fd++\){) 22.876 Tj +0 -62.8363 Td +(2395 if\(cp->ofile[fd]\){) 16.254 Tj +0 -64.1454 Td +(2396 fileclose\(cp->ofile[fd]\);) 21.672 Tj +0 -65.4545 Td +(2397 cp->ofile[fd] = 0;) 17.458 Tj +0 -66.7636 Td +(2398 }) 6.02 Tj +0 -68.0727 Td +(2399 }) 4.816 Tj +0 -72 Td +(Sheet 23) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 31 31 +%%BeginPageSetup +%%PageOrientation: Landscape +pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/proc.c Page 9) 22.274 Tj +0 -3.92728 Td +(2400 idecref\(cp->cwd\);) 14.448 Tj +0 -5.23637 Td +(2401 cp->cwd = 0;) 11.438 Tj +0 -6.54546 Td +(2402 ) 3.01 Tj +0 -7.85455 Td +(2403 acquire\(&proc_table_lock\);) 19.866 Tj +0 -9.16364 Td +(2404 ) 3.01 Tj +0 -10.4727 Td +(2405 // Wake up our parent.) 17.458 Tj +0 -11.7818 Td +(2406 for\(p = proc; p < &proc[NPROC]; p++\)) 25.886 Tj +0 -13.0909 Td +(2407 if\(p->pid == cp->ppid\)) 18.662 Tj +0 -14.4 Td +(2408 wakeup1\(p\);) 13.244 Tj +0 -15.7091 Td +(2409 ) 3.01 Tj +0 -17.0182 Td +(2410 // Reparent our children to process 1.) 27.09 Tj +0 -18.3273 Td +(2411 for\(p = proc; p < &proc[NPROC]; p++\)) 25.886 Tj +0 -19.6364 Td +(2412 if\(p->ppid == cp->pid\)) 18.662 Tj +0 -20.9455 Td +(2413 p->ppid = 1;) 13.846 Tj +0 -22.2545 Td +(2414 ) 3.01 Tj +0 -23.5636 Td +(2415 // Jump into the scheduler, never to return.) 30.702 Tj +0 -24.8727 Td +(2416 cp->killed = 0;) 13.244 Tj +0 -26.1818 Td +(2417 cp->state = ZOMBIE;) 15.652 Tj +0 -27.4909 Td +(2418 sched\(\);) 9.03 Tj +0 -28.8 Td +(2419 panic\("zombie exit"\);) 16.856 Tj +0 -30.1091 Td +(2420 }) 3.612 Tj +0 -31.4182 Td +(2421 ) 3.01 Tj +0 -32.7273 Td +(2422 // Wait for a child process to exit and return its pid.) 36.12 Tj +0 -34.0364 Td +(2423 // Return -1 if this process has no children.) 30.1 Tj +0 -35.3454 Td +(2424 int) 4.816 Tj +0 -36.6545 Td +(2425 proc_wait\(void\)) 12.04 Tj +0 -37.9636 Td +(2426 {) 3.612 Tj +0 -39.2727 Td +(2427 struct proc *p;) 13.244 Tj +0 -40.5818 Td +(2428 struct proc *cp = curproc[cpu\(\)];) 24.08 Tj +0 -41.8909 Td +(2429 int i, havekids, pid;) 16.856 Tj +0 -43.2 Td +(2430 ) 3.01 Tj +0 -44.5091 Td +(2431 acquire\(&proc_table_lock\);) 19.866 Tj +0 -45.8182 Td +(2432 for\(;;\){) 9.03 Tj +0 -47.1272 Td +(2433 // Scan through table looking for zombie children.) 35.518 Tj +0 -48.4363 Td +(2434 havekids = 0;) 13.244 Tj +0 -49.7454 Td +(2435 for\(i = 0; i < NPROC; i++\){) 21.672 Tj +0 -51.0545 Td +(2436 p = &proc[i];) 14.448 Tj +0 -52.3636 Td +(2437 if\(p->state == UNUSED\)) 19.866 Tj +0 -53.6727 Td +(2438 continue;) 13.244 Tj +0 -54.9818 Td +(2439 if\(p->ppid == cp->pid\){) 20.468 Tj +0 -56.2909 Td +(2440 if\(p->state == ZOMBIE\){) 21.672 Tj +0 -57.6 Td +(2441 // Found one.) 16.856 Tj +0 -58.9091 Td +(2442 kfree\(p->mem, p->sz\);) 21.672 Tj +0 -60.2181 Td +(2443 kfree\(p->kstack, KSTACKSIZE\);) 26.488 Tj +0 -61.5272 Td +(2444 pid = p->pid;) 16.856 Tj +0 -62.8363 Td +(2445 p->state = UNUSED;) 19.866 Tj +0 -64.1454 Td +(2446 p->pid = 0;) 15.652 Tj +0 -65.4545 Td +(2447 p->ppid = 0;) 16.254 Tj +0 -66.7636 Td +(2448 release\(&proc_table_lock\);) 24.682 Tj +0 -68.0727 Td +(2449 return pid;) 15.652 Tj +0 -72 Td +(Sheet 24) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/proc.c Page 10) 22.876 Tj +0 -3.92728 Td +(2450 }) 8.428 Tj +0 -5.23637 Td +(2451 havekids = 1;) 15.652 Tj +0 -6.54546 Td +(2452 }) 7.224 Tj +0 -7.85455 Td +(2453 }) 6.02 Tj +0 -9.16364 Td +(2454 ) 3.01 Tj +0 -10.4727 Td +(2455 // No point waiting if we don't have any children.) 35.518 Tj +0 -11.7818 Td +(2456 if\(!havekids\){) 13.846 Tj +0 -13.0909 Td +(2457 release\(&proc_table_lock\);) 22.274 Tj +0 -14.4 Td +(2458 return -1;) 12.642 Tj +0 -15.7091 Td +(2459 }) 6.02 Tj +0 -17.0182 Td +(2460 ) 3.01 Tj +0 -18.3273 Td +(2461 // Wait for children to exit. \(See wakeup1 call in proc_exit.\)) 43.344 Tj +0 -19.6364 Td +(2462 sleep\(cp, &proc_table_lock\);) 22.274 Tj +0 -20.9455 Td +(2463 }) 4.816 Tj +0 -22.2545 Td +(2464 }) 3.612 Tj +0 -23.5636 Td +(2465 ) 3.01 Tj +0 -24.8727 Td +(2466 // Print a process listing to console. For debugging.) 35.518 Tj +0 -26.1818 Td +(2467 // Runs when user types ^P on console.) 25.886 Tj +0 -27.4909 Td +(2468 // No lock to avoid wedging a stuck machine further.) 34.314 Tj +0 -28.8 Td +(2469 void) 5.418 Tj +0 -30.1091 Td +(2470 procdump\(void\)) 11.438 Tj +0 -31.4182 Td +(2471 {) 3.612 Tj +0 -32.7273 Td +(2472 int i;) 7.826 Tj +0 -34.0364 Td +(2473 struct proc *p;) 13.244 Tj +0 -35.3454 Td +(2474 ) 3.01 Tj +0 -36.6545 Td +(2475 for\(i = 0; i < NPROC; i++\) {) 21.07 Tj +0 -37.9636 Td +(2476 p = &proc[i];) 13.244 Tj +0 -39.2727 Td +(2477 if\(p->state == UNUSED\)) 18.662 Tj +0 -40.5818 Td +(2478 continue;) 12.04 Tj +0 -41.8909 Td +(2479 cprintf\("%d %d %p\\n", p->pid, p->state\);) 29.498 Tj +0 -43.2 Td +(2480 }) 4.816 Tj +0 -44.5091 Td +(2481 }) 3.612 Tj +0 -45.8182 Td +(2482 ) 3.01 Tj +0 -47.1272 Td +(2483 ) 3.01 Tj +0 -48.4363 Td +(2484 ) 3.01 Tj +0 -49.7454 Td +(2485 ) 3.01 Tj +0 -51.0545 Td +(2486 ) 3.01 Tj +0 -52.3636 Td +(2487 ) 3.01 Tj +0 -53.6727 Td +(2488 ) 3.01 Tj +0 -54.9818 Td +(2489 ) 3.01 Tj +0 -56.2909 Td +(2490 ) 3.01 Tj +0 -57.6 Td +(2491 ) 3.01 Tj +0 -58.9091 Td +(2492 ) 3.01 Tj +0 -60.2181 Td +(2493 ) 3.01 Tj +0 -61.5272 Td +(2494 ) 3.01 Tj +0 -62.8363 Td +(2495 ) 3.01 Tj +0 -64.1454 Td +(2496 ) 3.01 Tj +0 -65.4545 Td +(2497 ) 3.01 Tj +0 -66.7636 Td +(2498 ) 3.01 Tj +0 -68.0727 Td +(2499 ) 3.01 Tj +0 -72 Td +(Sheet 24) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 32 32 +%%BeginPageSetup +%%PageOrientation: Landscape +__tumble pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/setjmp.S Page 1) 23.478 Tj +0 -3.92728 Td +(2500 # int setjmp\(struct jmpbuf *jmp\);) 24.682 Tj +0 -5.23637 Td +(2501 # void longjmp\(struct jmpbuf *jmp\);) 25.284 Tj +0 -6.54546 Td +(2502 #) 3.612 Tj +0 -7.85455 Td +(2503 # Setjmp saves its stack environment in jmp for later use by longjmp.) 44.548 Tj +0 -9.16364 Td +(2504 # It returns 0.) 12.04 Tj +0 -10.4727 Td +(2505 #) 3.612 Tj +0 -11.7818 Td +(2506 # Longjmp restores the environment saved by the last call of setjmp.) 43.946 Tj +0 -13.0909 Td +(2507 # It then causes execution to continue as if the call of setjmp) 40.936 Tj +0 -14.4 Td +(2508 # had just returned 1.) 16.254 Tj +0 -15.7091 Td +(2509 #) 3.612 Tj +0 -17.0182 Td +(2510 # The caller of setjmp must not itself have returned in the interim.) 43.946 Tj +0 -18.3273 Td +(2511 # All accessible data have values as of the time longjmp was called.) 43.946 Tj +0 -19.6364 Td +(2512 #) 3.612 Tj +0 -20.9455 Td +(2513 # [Description, but not code, borrowed from Plan 9.]) 36.12 Tj +0 -22.2545 Td +(2514 ) 3.01 Tj +0 -23.5636 Td +(2515 .globl setjmp) 10.836 Tj +0 -24.8727 Td +(2516 setjmp:) 7.224 Tj +0 -26.1818 Td +(2517 movl 4\(%esp\), %eax) 15.05 Tj +0 -27.4909 Td +(2518 ) 3.01 Tj +0 -28.8 Td +(2519 movl %ebx, 0\(%eax\)) 15.05 Tj +0 -30.1091 Td +(2520 movl %ecx, 4\(%eax\)) 15.05 Tj +0 -31.4182 Td +(2521 movl %edx, 8\(%eax\)) 15.05 Tj +0 -32.7273 Td +(2522 movl %esi, 12\(%eax\)) 15.652 Tj +0 -34.0364 Td +(2523 movl %edi, 16\(%eax\)) 15.652 Tj +0 -35.3454 Td +(2524 movl %esp, 20\(%eax\)) 15.652 Tj +0 -36.6545 Td +(2525 movl %ebp, 24\(%eax\)) 15.652 Tj +0 -37.9636 Td +(2526 pushl 0\(%esp\) # %eip) 17.458 Tj +0 -39.2727 Td +(2527 popl 28\(%eax\)) 12.04 Tj +0 -40.5818 Td +(2528 ) 3.01 Tj +0 -41.8909 Td +(2529 movl $0, %eax # return value) 22.274 Tj +0 -43.2 Td +(2530 ret) 6.02 Tj +0 -44.5091 Td +(2531 ) 3.01 Tj +0 -45.8182 Td +(2532 .globl longjmp) 11.438 Tj +0 -47.1272 Td +(2533 longjmp:) 7.826 Tj +0 -48.4363 Td +(2534 movl 4\(%esp\), %eax) 15.05 Tj +0 -49.7454 Td +(2535 ) 3.01 Tj +0 -51.0545 Td +(2536 movl 0\(%eax\), %ebx) 15.05 Tj +0 -52.3636 Td +(2537 movl 4\(%eax\), %ecx) 15.05 Tj +0 -53.6727 Td +(2538 movl 8\(%eax\), %edx) 15.05 Tj +0 -54.9818 Td +(2539 movl 12\(%eax\), %esi) 15.652 Tj +0 -56.2909 Td +(2540 movl 16\(%eax\), %edi) 15.652 Tj +0 -57.6 Td +(2541 movl 20\(%eax\), %esp) 15.652 Tj +0 -58.9091 Td +(2542 movl 24\(%eax\), %ebp) 15.652 Tj +0 -60.2181 Td +(2543 ) 3.01 Tj +0 -61.5272 Td +(2544 addl $4, %esp # pop and discard %eip) 27.09 Tj +0 -62.8363 Td +(2545 pushl 28\(%eax\) # push new %eip) 22.876 Tj +0 -64.1454 Td +(2546 ) 3.01 Tj +0 -65.4545 Td +(2547 movl $1, %eax # return value \(appears to come from setjmp!\)) 40.936 Tj +0 -66.7636 Td +(2548 ret) 6.02 Tj +0 -68.0727 Td +(2549 ) 3.01 Tj +0 -72 Td +(Sheet 25) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/kalloc.c Page 1) 23.478 Tj +0 -3.92728 Td +(2550 // Physical memory allocator, intended to allocate) 33.11 Tj +0 -5.23637 Td +(2551 // memory for user processes. Allocates in 4096-byte "pages".) 39.732 Tj +0 -6.54546 Td +(2552 // Free list is kept sorted and combines adjacent pages into) 39.13 Tj +0 -7.85455 Td +(2553 // long runs, to make it easier to allocate big segments.) 37.324 Tj +0 -9.16364 Td +(2554 // One reason the page size is 4k is that the x86 segment size) 40.334 Tj +0 -10.4727 Td +(2555 // granularity is 4k.) 15.652 Tj +0 -11.7818 Td +(2556 ) 3.01 Tj +0 -13.0909 Td +(2557 #include "param.h") 13.846 Tj +0 -14.4 Td +(2558 #include "types.h") 13.846 Tj +0 -15.7091 Td +(2559 #include "defs.h") 13.244 Tj +0 -17.0182 Td +(2560 #include "param.h") 13.846 Tj +0 -18.3273 Td +(2561 #include "mmu.h") 12.642 Tj +0 -19.6364 Td +(2562 #include "proc.h") 13.244 Tj +0 -20.9455 Td +(2563 #include "spinlock.h") 15.652 Tj +0 -22.2545 Td +(2564 ) 3.01 Tj +0 -23.5636 Td +(2565 struct spinlock kalloc_lock;) 19.866 Tj +0 -24.8727 Td +(2566 ) 3.01 Tj +0 -26.1818 Td +(2567 struct run {) 10.234 Tj +0 -27.4909 Td +(2568 struct run *next;) 14.448 Tj +0 -28.8 Td +(2569 int len; // bytes) 14.448 Tj +0 -30.1091 Td +(2570 };) 4.214 Tj +0 -31.4182 Td +(2571 struct run *freelist;) 15.652 Tj +0 -32.7273 Td +(2572 ) 3.01 Tj +0 -34.0364 Td +(2573 // Initialize free list of physical pages.) 28.294 Tj +0 -35.3454 Td +(2574 // This code cheats by just considering one megabyte of) 36.12 Tj +0 -36.6545 Td +(2575 // pages after _end. Real systems would determine the) 35.518 Tj +0 -37.9636 Td +(2576 // amount of memory available in the system and use it all.) 38.528 Tj +0 -39.2727 Td +(2577 void) 5.418 Tj +0 -40.5818 Td +(2578 kinit\(void\)) 9.632 Tj +0 -41.8909 Td +(2579 {) 3.612 Tj +0 -43.2 Td +(2580 extern int end;) 13.244 Tj +0 -44.5091 Td +(2581 uint mem;) 9.632 Tj +0 -45.8182 Td +(2582 char *start;) 11.438 Tj +0 -47.1272 Td +(2583 ) 3.01 Tj +0 -48.4363 Td +(2584 initlock\(&kalloc_lock, "kalloc"\);) 24.08 Tj +0 -49.7454 Td +(2585 start = \(char*\) &end;) 16.856 Tj +0 -51.0545 Td +(2586 start = \(char*\) \(\(\(uint\)start + PAGE\) & ~\(PAGE-1\)\);) 34.916 Tj +0 -52.3636 Td +(2587 mem = 256; // assume computer has 256 pages of RAM) 34.314 Tj +0 -53.6727 Td +(2588 cprintf\("mem = %d\\n", mem * PAGE\);) 24.682 Tj +0 -54.9818 Td +(2589 kfree\(start, mem * PAGE\);) 19.264 Tj +0 -56.2909 Td +(2590 }) 3.612 Tj +0 -57.6 Td +(2591 ) 3.01 Tj +0 -58.9091 Td +(2592 ) 3.01 Tj +0 -60.2181 Td +(2593 ) 3.01 Tj +0 -61.5272 Td +(2594 ) 3.01 Tj +0 -62.8363 Td +(2595 ) 3.01 Tj +0 -64.1454 Td +(2596 ) 3.01 Tj +0 -65.4545 Td +(2597 ) 3.01 Tj +0 -66.7636 Td +(2598 ) 3.01 Tj +0 -68.0727 Td +(2599 ) 3.01 Tj +0 -72 Td +(Sheet 25) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 33 33 +%%BeginPageSetup +%%PageOrientation: Landscape +pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/kalloc.c Page 2) 23.478 Tj +0 -3.92728 Td +(2600 // Free the len bytes of memory pointed at by cp,) 32.508 Tj +0 -5.23637 Td +(2601 // which normally should have been returned by a) 31.906 Tj +0 -6.54546 Td +(2602 // call to kalloc\(cp\). \(The exception is when) 30.702 Tj +0 -7.85455 Td +(2603 // initializing the allocator; see kinit above.\)) 31.906 Tj +0 -9.16364 Td +(2604 void) 5.418 Tj +0 -10.4727 Td +(2605 kfree\(char *cp, int len\)) 17.458 Tj +0 -11.7818 Td +(2606 {) 3.612 Tj +0 -13.0909 Td +(2607 struct run **rr;) 13.846 Tj +0 -14.4 Td +(2608 struct run *p = \(struct run*\) cp;) 24.08 Tj +0 -15.7091 Td +(2609 struct run *pend = \(struct run*\) \(cp + len\);) 30.702 Tj +0 -17.0182 Td +(2610 int i;) 7.826 Tj +0 -18.3273 Td +(2611 ) 3.01 Tj +0 -19.6364 Td +(2612 if\(len % PAGE\)) 12.642 Tj +0 -20.9455 Td +(2613 panic\("kfree"\);) 14.448 Tj +0 -22.2545 Td +(2614 ) 3.01 Tj +0 -23.5636 Td +(2615 // Fill with junk to catch dangling refs.) 28.896 Tj +0 -24.8727 Td +(2616 for\(i = 0; i < len; i++\)) 18.662 Tj +0 -26.1818 Td +(2617 cp[i] = 1;) 11.438 Tj +0 -27.4909 Td +(2618 ) 3.01 Tj +0 -28.8 Td +(2619 acquire\(&kalloc_lock\);) 17.458 Tj +0 -30.1091 Td +(2620 ) 3.01 Tj +0 -31.4182 Td +(2621 rr = &freelist;) 13.244 Tj +0 -32.7273 Td +(2622 while\(*rr\){) 10.836 Tj +0 -34.0364 Td +(2623 struct run *rend = \(struct run*\) \(\(char*\)\(*rr\) + \(*rr\)->len\);) 42.14 Tj +0 -35.3454 Td +(2624 if\(p >= *rr && p < rend\)) 19.866 Tj +0 -36.6545 Td +(2625 panic\("freeing free page"\);) 22.876 Tj +0 -37.9636 Td +(2626 if\(pend == *rr\){) 15.05 Tj +0 -39.2727 Td +(2627 p->len = len + \(*rr\)->len;) 22.274 Tj +0 -40.5818 Td +(2628 p->next = \(*rr\)->next;) 19.866 Tj +0 -41.8909 Td +(2629 *rr = p;) 11.438 Tj +0 -43.2 Td +(2630 goto out;) 12.04 Tj +0 -44.5091 Td +(2631 }) 6.02 Tj +0 -45.8182 Td +(2632 if\(pend < *rr\){) 14.448 Tj +0 -47.1272 Td +(2633 p->len = len;) 14.448 Tj +0 -48.4363 Td +(2634 p->next = *rr;) 15.05 Tj +0 -49.7454 Td +(2635 *rr = p;) 11.438 Tj +0 -51.0545 Td +(2636 goto out;) 12.04 Tj +0 -52.3636 Td +(2637 }) 6.02 Tj +0 -53.6727 Td +(2638 if\(p == rend\){) 13.846 Tj +0 -54.9818 Td +(2639 \(*rr\)->len += len;) 17.458 Tj +0 -56.2909 Td +(2640 if\(\(*rr\)->next && \(*rr\)->next == pend\){) 30.1 Tj +0 -57.6 Td +(2641 \(*rr\)->len += \(*rr\)->next->len;) 26.488 Tj +0 -58.9091 Td +(2642 \(*rr\)->next = \(*rr\)->next->next;) 27.09 Tj +0 -60.2181 Td +(2643 }) 7.224 Tj +0 -61.5272 Td +(2644 goto out;) 12.04 Tj +0 -62.8363 Td +(2645 }) 6.02 Tj +0 -64.1454 Td +(2646 rr = &\(\(*rr\)->next\);) 17.458 Tj +0 -65.4545 Td +(2647 }) 4.816 Tj +0 -66.7636 Td +(2648 p->len = len;) 12.04 Tj +0 -68.0727 Td +(2649 p->next = 0;) 11.438 Tj +0 -72 Td +(Sheet 26) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/kalloc.c Page 3) 23.478 Tj +0 -3.92728 Td +(2650 *rr = p;) 9.03 Tj +0 -5.23637 Td +(2651 ) 3.01 Tj +0 -6.54546 Td +(2652 out:) 6.02 Tj +0 -7.85455 Td +(2653 release\(&kalloc_lock\);) 17.458 Tj +0 -9.16364 Td +(2654 }) 3.612 Tj +0 -10.4727 Td +(2655 ) 3.01 Tj +0 -11.7818 Td +(2656 // Allocate n bytes of physical memory.) 26.488 Tj +0 -13.0909 Td +(2657 // Returns a kernel-segment pointer.) 24.682 Tj +0 -14.4 Td +(2658 // Returns 0 if the memory cannot be allocated.) 31.304 Tj +0 -15.7091 Td +(2659 char*) 6.02 Tj +0 -17.0182 Td +(2660 kalloc\(int n\)) 10.836 Tj +0 -18.3273 Td +(2661 {) 3.612 Tj +0 -19.6364 Td +(2662 struct run **rr;) 13.846 Tj +0 -20.9455 Td +(2663 ) 3.01 Tj +0 -22.2545 Td +(2664 if\(n % PAGE\)) 11.438 Tj +0 -23.5636 Td +(2665 panic\("kalloc"\);) 15.05 Tj +0 -24.8727 Td +(2666 ) 3.01 Tj +0 -26.1818 Td +(2667 acquire\(&kalloc_lock\);) 17.458 Tj +0 -27.4909 Td +(2668 ) 3.01 Tj +0 -28.8 Td +(2669 rr = &freelist;) 13.244 Tj +0 -30.1091 Td +(2670 while\(*rr\){) 10.836 Tj +0 -31.4182 Td +(2671 struct run *r = *rr;) 17.458 Tj +0 -32.7273 Td +(2672 if\(r->len == n\){) 15.05 Tj +0 -34.0364 Td +(2673 *rr = r->next;) 15.05 Tj +0 -35.3454 Td +(2674 release\(&kalloc_lock\);) 19.866 Tj +0 -36.6545 Td +(2675 return \(char*\) r;) 16.856 Tj +0 -37.9636 Td +(2676 }) 6.02 Tj +0 -39.2727 Td +(2677 if\(r->len > n\){) 14.448 Tj +0 -40.5818 Td +(2678 char *p = \(char*\)r + \(r->len - n\);) 27.09 Tj +0 -41.8909 Td +(2679 r->len -= n;) 13.846 Tj +0 -43.2 Td +(2680 release\(&kalloc_lock\);) 19.866 Tj +0 -44.5091 Td +(2681 return p;) 12.04 Tj +0 -45.8182 Td +(2682 }) 6.02 Tj +0 -47.1272 Td +(2683 rr = &\(*rr\)->next;) 16.254 Tj +0 -48.4363 Td +(2684 }) 4.816 Tj +0 -49.7454 Td +(2685 release\(&kalloc_lock\);) 17.458 Tj +0 -51.0545 Td +(2686 cprintf\("kalloc: out of memory\\n"\);) 25.284 Tj +0 -52.3636 Td +(2687 return 0;) 9.632 Tj +0 -53.6727 Td +(2688 }) 3.612 Tj +0 -54.9818 Td +(2689 ) 3.01 Tj +0 -56.2909 Td +(2690 ) 3.01 Tj +0 -57.6 Td +(2691 ) 3.01 Tj +0 -58.9091 Td +(2692 ) 3.01 Tj +0 -60.2181 Td +(2693 ) 3.01 Tj +0 -61.5272 Td +(2694 ) 3.01 Tj +0 -62.8363 Td +(2695 ) 3.01 Tj +0 -64.1454 Td +(2696 ) 3.01 Tj +0 -65.4545 Td +(2697 ) 3.01 Tj +0 -66.7636 Td +(2698 ) 3.01 Tj +0 -68.0727 Td +(2699 ) 3.01 Tj +0 -72 Td +(Sheet 26) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 34 34 +%%BeginPageSetup +%%PageOrientation: Landscape +__tumble pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/syscall.h Page 1) 24.08 Tj +0 -3.92728 Td +(2700 // System call numbers) 16.254 Tj +0 -5.23637 Td +(2701 #define SYS_fork 1) 15.652 Tj +0 -6.54546 Td +(2702 #define SYS_exit 2) 15.652 Tj +0 -7.85455 Td +(2703 #define SYS_wait 3) 15.652 Tj +0 -9.16364 Td +(2704 #define SYS_pipe 4) 15.652 Tj +0 -10.4727 Td +(2705 #define SYS_write 5) 15.652 Tj +0 -11.7818 Td +(2706 #define SYS_read 6) 15.652 Tj +0 -13.0909 Td +(2707 #define SYS_close 7) 15.652 Tj +0 -14.4 Td +(2708 #define SYS_kill 8) 15.652 Tj +0 -15.7091 Td +(2709 #define SYS_exec 9) 15.652 Tj +0 -17.0182 Td +(2710 #define SYS_open 10) 15.652 Tj +0 -18.3273 Td +(2711 #define SYS_mknod 11) 15.652 Tj +0 -19.6364 Td +(2712 #define SYS_unlink 12) 15.652 Tj +0 -20.9455 Td +(2713 #define SYS_fstat 13) 15.652 Tj +0 -22.2545 Td +(2714 #define SYS_link 14) 15.652 Tj +0 -23.5636 Td +(2715 #define SYS_mkdir 15) 15.652 Tj +0 -24.8727 Td +(2716 #define SYS_chdir 16) 15.652 Tj +0 -26.1818 Td +(2717 #define SYS_dup 17) 15.652 Tj +0 -27.4909 Td +(2718 #define SYS_getpid 18) 15.652 Tj +0 -28.8 Td +(2719 #define SYS_sbrk 19) 15.652 Tj +0 -30.1091 Td +(2720 ) 3.01 Tj +0 -31.4182 Td +(2721 ) 3.01 Tj +0 -32.7273 Td +(2722 ) 3.01 Tj +0 -34.0364 Td +(2723 ) 3.01 Tj +0 -35.3454 Td +(2724 ) 3.01 Tj +0 -36.6545 Td +(2725 ) 3.01 Tj +0 -37.9636 Td +(2726 ) 3.01 Tj +0 -39.2727 Td +(2727 ) 3.01 Tj +0 -40.5818 Td +(2728 ) 3.01 Tj +0 -41.8909 Td +(2729 ) 3.01 Tj +0 -43.2 Td +(2730 ) 3.01 Tj +0 -44.5091 Td +(2731 ) 3.01 Tj +0 -45.8182 Td +(2732 ) 3.01 Tj +0 -47.1272 Td +(2733 ) 3.01 Tj +0 -48.4363 Td +(2734 ) 3.01 Tj +0 -49.7454 Td +(2735 ) 3.01 Tj +0 -51.0545 Td +(2736 ) 3.01 Tj +0 -52.3636 Td +(2737 ) 3.01 Tj +0 -53.6727 Td +(2738 ) 3.01 Tj +0 -54.9818 Td +(2739 ) 3.01 Tj +0 -56.2909 Td +(2740 ) 3.01 Tj +0 -57.6 Td +(2741 ) 3.01 Tj +0 -58.9091 Td +(2742 ) 3.01 Tj +0 -60.2181 Td +(2743 ) 3.01 Tj +0 -61.5272 Td +(2744 ) 3.01 Tj +0 -62.8363 Td +(2745 ) 3.01 Tj +0 -64.1454 Td +(2746 ) 3.01 Tj +0 -65.4545 Td +(2747 ) 3.01 Tj +0 -66.7636 Td +(2748 ) 3.01 Tj +0 -68.0727 Td +(2749 ) 3.01 Tj +0 -72 Td +(Sheet 27) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/trapasm.S Page 1) 24.08 Tj +0 -3.92728 Td +(2750 .text) 6.02 Tj +0 -5.23637 Td +(2751 .globl trap) 9.632 Tj +0 -6.54546 Td +(2752 .globl trapret1) 12.04 Tj +0 -7.85455 Td +(2753 ) 3.01 Tj +0 -9.16364 Td +(2754 .globl alltraps) 12.04 Tj +0 -10.4727 Td +(2755 alltraps:) 8.428 Tj +0 -11.7818 Td +(2756 /* vectors.S sends all traps here */) 25.886 Tj +0 -13.0909 Td +(2757 pushl %ds # build) 18.662 Tj +0 -14.4 Td +(2758 pushl %es # trap) 18.662 Tj +0 -15.7091 Td +(2759 pushal # frame) 19.264 Tj +0 -17.0182 Td +(2760 movl $16,%eax # SEG_KDATA << 3) 24.08 Tj +0 -18.3273 Td +(2761 movw %ax,%ds # kernel) 19.866 Tj +0 -19.6364 Td +(2762 movw %ax,%es # segments) 21.07 Tj +0 -20.9455 Td +(2763 pushl %esp # pass pointer to this trapframe) 33.712 Tj +0 -22.2545 Td +(2764 call trap # and call trap\(\)) 25.284 Tj +0 -23.5636 Td +(2765 addl $4, %esp) 12.04 Tj +0 -24.8727 Td +(2766 # return falls through to trapret...) 25.886 Tj +0 -26.1818 Td +(2767 ) 3.01 Tj +0 -27.4909 Td +(2768 /*) 5.418 Tj +0 -28.8 Td +(2769 * a forked process RETs here) 21.672 Tj +0 -30.1091 Td +(2770 * expects ESP to point to a Trapframe) 27.09 Tj +0 -31.4182 Td +(2771 */) 6.02 Tj +0 -32.7273 Td +(2772 .globl trapret) 11.438 Tj +0 -34.0364 Td +(2773 trapret:) 7.826 Tj +0 -35.3454 Td +(2774 popal) 7.224 Tj +0 -36.6545 Td +(2775 popl %es) 9.03 Tj +0 -37.9636 Td +(2776 popl %ds) 9.03 Tj +0 -39.2727 Td +(2777 addl $0x8, %esp /* trapno and errcode */) 28.294 Tj +0 -40.5818 Td +(2778 iret) 6.622 Tj +0 -41.8909 Td +(2779 ) 3.01 Tj +0 -43.2 Td +(2780 .globl forkret1) 12.04 Tj +0 -44.5091 Td +(2781 forkret1:) 8.428 Tj +0 -45.8182 Td +(2782 movl 4\(%esp\), %esp) 15.05 Tj +0 -47.1272 Td +(2783 jmp trapret) 10.836 Tj +0 -48.4363 Td +(2784 ) 3.01 Tj +0 -49.7454 Td +(2785 .globl acpu) 10.234 Tj +0 -51.0545 Td +(2786 acpu:) 6.02 Tj +0 -52.3636 Td +(2787 .long 0) 8.428 Tj +0 -53.6727 Td +(2788 ) 3.01 Tj +0 -54.9818 Td +(2789 ) 3.01 Tj +0 -56.2909 Td +(2790 ) 3.01 Tj +0 -57.6 Td +(2791 ) 3.01 Tj +0 -58.9091 Td +(2792 ) 3.01 Tj +0 -60.2181 Td +(2793 ) 3.01 Tj +0 -61.5272 Td +(2794 ) 3.01 Tj +0 -62.8363 Td +(2795 ) 3.01 Tj +0 -64.1454 Td +(2796 ) 3.01 Tj +0 -65.4545 Td +(2797 ) 3.01 Tj +0 -66.7636 Td +(2798 ) 3.01 Tj +0 -68.0727 Td +(2799 ) 3.01 Tj +0 -72 Td +(Sheet 27) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 35 35 +%%BeginPageSetup +%%PageOrientation: Landscape +pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/traps.h Page 1) 22.876 Tj +0 -3.92728 Td +(2800 // x86 trap and interrupt constants.) 24.682 Tj +0 -5.23637 Td +(2801 ) 3.01 Tj +0 -6.54546 Td +(2802 // Processor-defined:) 15.652 Tj +0 -7.85455 Td +(2803 #define T_DIVIDE 0 // divide error) 31.304 Tj +0 -9.16364 Td +(2804 #define T_DEBUG 1 // debug exception) 33.11 Tj +0 -10.4727 Td +(2805 #define T_NMI 2 // non-maskable interrupt) 37.324 Tj +0 -11.7818 Td +(2806 #define T_BRKPT 3 // breakpoint) 30.1 Tj +0 -13.0909 Td +(2807 #define T_OFLOW 4 // overflow) 28.896 Tj +0 -14.4 Td +(2808 #define T_BOUND 5 // bounds check) 31.304 Tj +0 -15.7091 Td +(2809 #define T_ILLOP 6 // illegal opcode) 32.508 Tj +0 -17.0182 Td +(2810 #define T_DEVICE 7 // device not available) 36.12 Tj +0 -18.3273 Td +(2811 #define T_DBLFLT 8 // double fault) 31.304 Tj +0 -19.6364 Td +(2812 // #define T_COPROC 9 // reserved \(not used since 486\)) 41.538 Tj +0 -20.9455 Td +(2813 #define T_TSS 10 // invalid task switch segment) 40.334 Tj +0 -22.2545 Td +(2814 #define T_SEGNP 11 // segment not present) 35.518 Tj +0 -23.5636 Td +(2815 #define T_STACK 12 // stack exception) 33.11 Tj +0 -24.8727 Td +(2816 #define T_GPFLT 13 // genernal protection fault) 39.13 Tj +0 -26.1818 Td +(2817 #define T_PGFLT 14 // page fault) 30.1 Tj +0 -27.4909 Td +(2818 // #define T_RES 15 // reserved) 28.896 Tj +0 -28.8 Td +(2819 #define T_FPERR 16 // floating point error) 36.12 Tj +0 -30.1091 Td +(2820 #define T_ALIGN 17 // aligment check) 32.508 Tj +0 -31.4182 Td +(2821 #define T_MCHK 18 // machine check) 31.906 Tj +0 -32.7273 Td +(2822 #define T_SIMDERR 19 // SIMD floating point error) 39.13 Tj +0 -34.0364 Td +(2823 ) 3.01 Tj +0 -35.3454 Td +(2824 // These are arbitrarily chosen, but with care not to overlap) 39.732 Tj +0 -36.6545 Td +(2825 // processor defined exceptions or interrupt vectors.) 34.916 Tj +0 -37.9636 Td +(2826 #define T_SYSCALL 48 // system call) 30.702 Tj +0 -39.2727 Td +(2827 #define T_DEFAULT 500 // catchall) 28.896 Tj +0 -40.5818 Td +(2828 ) 3.01 Tj +0 -41.8909 Td +(2829 #define IRQ_OFFSET 32 // IRQ 0 corresponds to int IRQ_OFFSET) 45.15 Tj +0 -43.2 Td +(2830 ) 3.01 Tj +0 -44.5091 Td +(2831 #define IRQ_TIMER 0) 18.662 Tj +0 -45.8182 Td +(2832 #define IRQ_KBD 1) 18.662 Tj +0 -47.1272 Td +(2833 #define IRQ_IDE 14) 18.662 Tj +0 -48.4363 Td +(2834 #define IRQ_ERROR 19) 18.662 Tj +0 -49.7454 Td +(2835 #define IRQ_SPURIOUS 31) 18.662 Tj +0 -51.0545 Td +(2836 ) 3.01 Tj +0 -52.3636 Td +(2837 ) 3.01 Tj +0 -53.6727 Td +(2838 ) 3.01 Tj +0 -54.9818 Td +(2839 ) 3.01 Tj +0 -56.2909 Td +(2840 ) 3.01 Tj +0 -57.6 Td +(2841 ) 3.01 Tj +0 -58.9091 Td +(2842 ) 3.01 Tj +0 -60.2181 Td +(2843 ) 3.01 Tj +0 -61.5272 Td +(2844 ) 3.01 Tj +0 -62.8363 Td +(2845 ) 3.01 Tj +0 -64.1454 Td +(2846 ) 3.01 Tj +0 -65.4545 Td +(2847 ) 3.01 Tj +0 -66.7636 Td +(2848 ) 3.01 Tj +0 -68.0727 Td +(2849 ) 3.01 Tj +0 -72 Td +(Sheet 28) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/trap.c Page 1) 22.274 Tj +0 -3.92728 Td +(2850 #include "types.h") 13.846 Tj +0 -5.23637 Td +(2851 #include "param.h") 13.846 Tj +0 -6.54546 Td +(2852 #include "mmu.h") 12.642 Tj +0 -7.85455 Td +(2853 #include "proc.h") 13.244 Tj +0 -9.16364 Td +(2854 #include "defs.h") 13.244 Tj +0 -10.4727 Td +(2855 #include "x86.h") 12.642 Tj +0 -11.7818 Td +(2856 #include "traps.h") 13.846 Tj +0 -13.0909 Td +(2857 #include "syscall.h") 15.05 Tj +0 -14.4 Td +(2858 ) 3.01 Tj +0 -15.7091 Td +(2859 // Interrupt descriptor table \(shared by all CPUs\).) 33.712 Tj +0 -17.0182 Td +(2860 struct gatedesc idt[256];) 18.06 Tj +0 -18.3273 Td +(2861 extern uint vectors[]; // in vectors.S: array of 256 entry pointers) 43.946 Tj +0 -19.6364 Td +(2862 ) 3.01 Tj +0 -20.9455 Td +(2863 void) 5.418 Tj +0 -22.2545 Td +(2864 tvinit\(void\)) 10.234 Tj +0 -23.5636 Td +(2865 {) 3.612 Tj +0 -24.8727 Td +(2866 int i;) 7.826 Tj +0 -26.1818 Td +(2867 ) 3.01 Tj +0 -27.4909 Td +(2868 for\(i = 0; i < 256; i++\)) 18.662 Tj +0 -28.8 Td +(2869 SETGATE\(idt[i], 0, SEG_KCODE << 3, vectors[i], 0\);) 35.518 Tj +0 -30.1091 Td +(2870 SETGATE\(idt[T_SYSCALL], 0, SEG_KCODE << 3, vectors[T_SYSCALL], 3\);) 43.946 Tj +0 -31.4182 Td +(2871 }) 3.612 Tj +0 -32.7273 Td +(2872 ) 3.01 Tj +0 -34.0364 Td +(2873 void) 5.418 Tj +0 -35.3454 Td +(2874 idtinit\(void\)) 10.836 Tj +0 -36.6545 Td +(2875 {) 3.612 Tj +0 -37.9636 Td +(2876 lidt\(idt, sizeof idt\);) 17.458 Tj +0 -39.2727 Td +(2877 }) 3.612 Tj +0 -40.5818 Td +(2878 ) 3.01 Tj +0 -41.8909 Td +(2879 void) 5.418 Tj +0 -43.2 Td +(2880 trap\(struct trapframe *tf\)) 18.662 Tj +0 -44.5091 Td +(2881 {) 3.612 Tj +0 -45.8182 Td +(2882 int v = tf->trapno;) 15.652 Tj +0 -47.1272 Td +(2883 struct proc *cp = curproc[cpu\(\)];) 24.08 Tj +0 -48.4363 Td +(2884 ) 3.01 Tj +0 -49.7454 Td +(2885 if\(v == T_SYSCALL\){) 15.652 Tj +0 -51.0545 Td +(2886 if\(cp->killed\)) 13.846 Tj +0 -52.3636 Td +(2887 proc_exit\(\);) 13.846 Tj +0 -53.6727 Td +(2888 cp->tf = tf;) 12.642 Tj +0 -54.9818 Td +(2889 syscall\(\);) 11.438 Tj +0 -56.2909 Td +(2890 if\(cp->killed\)) 13.846 Tj +0 -57.6 Td +(2891 proc_exit\(\);) 13.846 Tj +0 -58.9091 Td +(2892 return;) 9.632 Tj +0 -60.2181 Td +(2893 }) 4.816 Tj +0 -61.5272 Td +(2894 ) 3.01 Tj +0 -62.8363 Td +(2895 ) 3.01 Tj +0 -64.1454 Td +(2896 ) 3.01 Tj +0 -65.4545 Td +(2897 ) 3.01 Tj +0 -66.7636 Td +(2898 ) 3.01 Tj +0 -68.0727 Td +(2899 ) 3.01 Tj +0 -72 Td +(Sheet 28) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 36 36 +%%BeginPageSetup +%%PageOrientation: Landscape +__tumble pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/trap.c Page 2) 22.274 Tj +0 -3.92728 Td +(2900 // Increment nlock to make sure interrupts stay off) 34.916 Tj +0 -5.23637 Td +(2901 // during interrupt handler. Decrement before returning.) 38.528 Tj +0 -6.54546 Td +(2902 cpus[cpu\(\)].nlock++;) 16.254 Tj +0 -7.85455 Td +(2903 ) 3.01 Tj +0 -9.16364 Td +(2904 switch\(v\){) 10.234 Tj +0 -10.4727 Td +(2905 case IRQ_OFFSET + IRQ_TIMER:) 21.07 Tj +0 -11.7818 Td +(2906 lapic_timerintr\(\);) 16.254 Tj +0 -13.0909 Td +(2907 cpus[cpu\(\)].nlock--;) 17.458 Tj +0 -14.4 Td +(2908 if\(cp\){) 9.632 Tj +0 -15.7091 Td +(2909 // Force process exit if it has been killed and is in user space.) 45.752 Tj +0 -17.0182 Td +(2910 // \(If it is still executing in the kernel, let it keep running) 44.548 Tj +0 -18.3273 Td +(2911 // until it gets to the regular system call return.\)) 37.926 Tj +0 -19.6364 Td +(2912 if\(\(tf->cs&3\) == 3 && cp->killed\)) 26.488 Tj +0 -20.9455 Td +(2913 proc_exit\(\);) 15.05 Tj +0 -22.2545 Td +(2914 ) 3.01 Tj +0 -23.5636 Td +(2915 // Force process to give up CPU and let others run.) 37.324 Tj +0 -24.8727 Td +(2916 if\(cp->state == RUNNING\)) 21.07 Tj +0 -26.1818 Td +(2917 yield\(\);) 12.642 Tj +0 -27.4909 Td +(2918 }) 6.02 Tj +0 -28.8 Td +(2919 return;) 9.632 Tj +0 -30.1091 Td +(2920 ) 3.01 Tj +0 -31.4182 Td +(2921 case IRQ_OFFSET + IRQ_IDE:) 19.866 Tj +0 -32.7273 Td +(2922 ide_intr\(\);) 12.04 Tj +0 -34.0364 Td +(2923 lapic_eoi\(\);) 12.642 Tj +0 -35.3454 Td +(2924 break;) 9.03 Tj +0 -36.6545 Td +(2925 ) 3.01 Tj +0 -37.9636 Td +(2926 case IRQ_OFFSET + IRQ_KBD:) 19.866 Tj +0 -39.2727 Td +(2927 kbd_intr\(\);) 12.04 Tj +0 -40.5818 Td +(2928 lapic_eoi\(\);) 12.642 Tj +0 -41.8909 Td +(2929 break;) 9.03 Tj +0 -43.2 Td +(2930 ) 3.01 Tj +0 -44.5091 Td +(2931 case IRQ_OFFSET + IRQ_SPURIOUS:) 22.876 Tj +0 -45.8182 Td +(2932 cprintf\("spurious interrupt from cpu %d eip %x\\n", cpu\(\), tf->eip\);) 45.752 Tj +0 -47.1272 Td +(2933 break;) 9.03 Tj +0 -48.4363 Td +(2934 ) 3.01 Tj +0 -49.7454 Td +(2935 default:) 9.03 Tj +0 -51.0545 Td +(2936 if\(curproc[cpu\(\)]\) {) 17.458 Tj +0 -52.3636 Td +(2937 // Assume process divided by zero or dereferenced null, etc.) 42.742 Tj +0 -53.6727 Td +(2938 cprintf\("pid %d: unhandled trap %d on cpu %d eip %x -- kill proc\\n",) 47.558 Tj +0 -54.9818 Td +(2939 curproc[cpu\(\)]->pid, v, cpu\(\), tf->eip\);) 35.518 Tj +0 -56.2909 Td +(2940 proc_exit\(\);) 13.846 Tj +0 -57.6 Td +(2941 }) 6.02 Tj +0 -58.9091 Td +(2942 ) 3.01 Tj +0 -60.2181 Td +(2943 // Otherwise it's our mistake.) 23.478 Tj +0 -61.5272 Td +(2944 cprintf\("unexpected trap %d from cpu %d eip %x\\n", v, cpu\(\), tf->eip\);) 47.558 Tj +0 -62.8363 Td +(2945 panic\("trap"\);) 13.846 Tj +0 -64.1454 Td +(2946 }) 4.816 Tj +0 -65.4545 Td +(2947 ) 3.01 Tj +0 -66.7636 Td +(2948 cpus[cpu\(\)].nlock--;) 16.254 Tj +0 -68.0727 Td +(2949 }) 3.612 Tj +0 -72 Td +(Sheet 29) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/vectors.pl Page 1) 24.682 Tj +0 -3.92728 Td +(2950 #!/usr/bin/perl -w) 13.846 Tj +0 -5.23637 Td +(2951 ) 3.01 Tj +0 -6.54546 Td +(2952 # Generate vectors.S, the trap/interrupt entry points.) 35.518 Tj +0 -7.85455 Td +(2953 # There has to be one entry point per interrupt number) 35.518 Tj +0 -9.16364 Td +(2954 # since otherwise there's no way for trap\(\) to discover) 36.12 Tj +0 -10.4727 Td +(2955 # the interrupt number.) 16.856 Tj +0 -11.7818 Td +(2956 ) 3.01 Tj +0 -13.0909 Td +(2957 print "# generated by vectors.pl - do not edit\\n";) 33.11 Tj +0 -14.4 Td +(2958 print "# handlers\\n";) 15.652 Tj +0 -15.7091 Td +(2959 print ".text\\n";) 12.642 Tj +0 -17.0182 Td +(2960 print ".globl alltraps\\n";) 18.662 Tj +0 -18.3273 Td +(2961 for\(my $i = 0; $i < 256; $i++\){) 21.672 Tj +0 -19.6364 Td +(2962 print ".globl vector$i\\n";) 21.07 Tj +0 -20.9455 Td +(2963 print "vector$i:\\n";) 17.458 Tj +0 -22.2545 Td +(2964 if\(\($i < 8 || $i > 14\) && $i != 17\){) 27.09 Tj +0 -23.5636 Td +(2965 print " pushl \\$0\\n";) 21.07 Tj +0 -24.8727 Td +(2966 }) 6.02 Tj +0 -26.1818 Td +(2967 print " pushl \\$$i\\n";) 19.264 Tj +0 -27.4909 Td +(2968 print " jmp alltraps\\n";) 20.468 Tj +0 -28.8 Td +(2969 }) 3.612 Tj +0 -30.1091 Td +(2970 ) 3.01 Tj +0 -31.4182 Td +(2971 print "\\n# vector table\\n";) 19.264 Tj +0 -32.7273 Td +(2972 print ".data\\n";) 12.642 Tj +0 -34.0364 Td +(2973 print ".globl vectors\\n";) 18.06 Tj +0 -35.3454 Td +(2974 print "vectors:\\n";) 14.448 Tj +0 -36.6545 Td +(2975 for\(my $i = 0; $i < 256; $i++\){) 21.672 Tj +0 -37.9636 Td +(2976 print " .long vector$i\\n";) 21.672 Tj +0 -39.2727 Td +(2977 }) 3.612 Tj +0 -40.5818 Td +(2978 ) 3.01 Tj +0 -41.8909 Td +(2979 ) 3.01 Tj +0 -43.2 Td +(2980 ) 3.01 Tj +0 -44.5091 Td +(2981 ) 3.01 Tj +0 -45.8182 Td +(2982 ) 3.01 Tj +0 -47.1272 Td +(2983 ) 3.01 Tj +0 -48.4363 Td +(2984 ) 3.01 Tj +0 -49.7454 Td +(2985 ) 3.01 Tj +0 -51.0545 Td +(2986 ) 3.01 Tj +0 -52.3636 Td +(2987 ) 3.01 Tj +0 -53.6727 Td +(2988 ) 3.01 Tj +0 -54.9818 Td +(2989 ) 3.01 Tj +0 -56.2909 Td +(2990 ) 3.01 Tj +0 -57.6 Td +(2991 ) 3.01 Tj +0 -58.9091 Td +(2992 ) 3.01 Tj +0 -60.2181 Td +(2993 ) 3.01 Tj +0 -61.5272 Td +(2994 ) 3.01 Tj +0 -62.8363 Td +(2995 ) 3.01 Tj +0 -64.1454 Td +(2996 ) 3.01 Tj +0 -65.4545 Td +(2997 ) 3.01 Tj +0 -66.7636 Td +(2998 ) 3.01 Tj +0 -68.0727 Td +(2999 ) 3.01 Tj +0 -72 Td +(Sheet 29) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 37 37 +%%BeginPageSetup +%%PageOrientation: Landscape +pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/syscall.c Page 1) 24.08 Tj +0 -3.92728 Td +(3000 #include "types.h") 13.846 Tj +0 -5.23637 Td +(3001 #include "stat.h") 13.244 Tj +0 -6.54546 Td +(3002 #include "param.h") 13.846 Tj +0 -7.85455 Td +(3003 #include "mmu.h") 12.642 Tj +0 -9.16364 Td +(3004 #include "proc.h") 13.244 Tj +0 -10.4727 Td +(3005 #include "defs.h") 13.244 Tj +0 -11.7818 Td +(3006 #include "x86.h") 12.642 Tj +0 -13.0909 Td +(3007 #include "traps.h") 13.846 Tj +0 -14.4 Td +(3008 #include "syscall.h") 15.05 Tj +0 -15.7091 Td +(3009 #include "spinlock.h") 15.652 Tj +0 -17.0182 Td +(3010 #include "buf.h") 12.642 Tj +0 -18.3273 Td +(3011 #include "fs.h") 12.04 Tj +0 -19.6364 Td +(3012 #include "fsvar.h") 13.846 Tj +0 -20.9455 Td +(3013 #include "elf.h") 12.642 Tj +0 -22.2545 Td +(3014 #include "file.h") 13.244 Tj +0 -23.5636 Td +(3015 #include "fcntl.h") 13.846 Tj +0 -24.8727 Td +(3016 ) 3.01 Tj +0 -26.1818 Td +(3017 // User code makes a system call with INT T_SYSCALL.) 34.314 Tj +0 -27.4909 Td +(3018 // System call number in %eax.) 21.07 Tj +0 -28.8 Td +(3019 // Arguments on the stack, from the user call to the C) 35.518 Tj +0 -30.1091 Td +(3020 // library system call function. The saved user %esp points) 38.528 Tj +0 -31.4182 Td +(3021 // to a saved program counter, and then the first argument.) 38.528 Tj +0 -32.7273 Td +(3022 ) 3.01 Tj +0 -34.0364 Td +(3023 // Fetch the int at addr from process p.) 27.09 Tj +0 -35.3454 Td +(3024 int) 4.816 Tj +0 -36.6545 Td +(3025 fetchint\(struct proc *p, uint addr, int *ip\)) 29.498 Tj +0 -37.9636 Td +(3026 {) 3.612 Tj +0 -39.2727 Td +(3027 if\(addr >= p->sz || addr+4 > p->sz\)) 25.284 Tj +0 -40.5818 Td +(3028 return -1;) 11.438 Tj +0 -41.8909 Td +(3029 *ip = *\(int*\)\(p->mem + addr\);) 21.672 Tj +0 -43.2 Td +(3030 return 0;) 9.632 Tj +0 -44.5091 Td +(3031 }) 3.612 Tj +0 -45.8182 Td +(3032 ) 3.01 Tj +0 -47.1272 Td +(3033 // Fetch the nul-terminated string at addr from process p.) 37.926 Tj +0 -48.4363 Td +(3034 // Doesn't actually copy the string - just sets *pp to point at it.) 43.344 Tj +0 -49.7454 Td +(3035 // Returns length of string, not including nul.) 31.304 Tj +0 -51.0545 Td +(3036 int) 4.816 Tj +0 -52.3636 Td +(3037 fetchstr\(struct proc *p, uint addr, char **pp\)) 30.702 Tj +0 -53.6727 Td +(3038 {) 3.612 Tj +0 -54.9818 Td +(3039 char *cp, *ep;) 12.642 Tj +0 -56.2909 Td +(3040 ) 3.01 Tj +0 -57.6 Td +(3041 if\(addr >= p->sz\)) 14.448 Tj +0 -58.9091 Td +(3042 return -1;) 11.438 Tj +0 -60.2181 Td +(3043 *pp = p->mem + addr;) 16.254 Tj +0 -61.5272 Td +(3044 ep = p->mem + p->sz;) 16.254 Tj +0 -62.8363 Td +(3045 for\(cp = *pp; cp < ep; cp++\)) 21.07 Tj +0 -64.1454 Td +(3046 if\(*cp == 0\)) 12.642 Tj +0 -65.4545 Td +(3047 return cp - *pp;) 16.254 Tj +0 -66.7636 Td +(3048 return -1;) 10.234 Tj +0 -68.0727 Td +(3049 }) 3.612 Tj +0 -72 Td +(Sheet 30) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/syscall.c Page 2) 24.08 Tj +0 -3.92728 Td +(3050 // Fetch the argno'th word-sized system call argument as an integer.) 43.946 Tj +0 -5.23637 Td +(3051 int) 4.816 Tj +0 -6.54546 Td +(3052 argint\(int argno, int *ip\)) 18.662 Tj +0 -7.85455 Td +(3053 {) 3.612 Tj +0 -9.16364 Td +(3054 struct proc *p = curproc[cpu\(\)];) 23.478 Tj +0 -10.4727 Td +(3055 ) 3.01 Tj +0 -11.7818 Td +(3056 return fetchint\(p, p->tf->esp + 4 + 4*argno, ip\);) 33.712 Tj +0 -13.0909 Td +(3057 }) 3.612 Tj +0 -14.4 Td +(3058 ) 3.01 Tj +0 -15.7091 Td +(3059 // Fetch the nth word-sized system call argument as a pointer) 39.732 Tj +0 -17.0182 Td +(3060 // to a block of memory of size n bytes. Check that the pointer) 41.538 Tj +0 -18.3273 Td +(3061 // lies within the process address space.) 27.692 Tj +0 -19.6364 Td +(3062 int) 4.816 Tj +0 -20.9455 Td +(3063 argptr\(int argno, char **pp, int size\)) 25.886 Tj +0 -22.2545 Td +(3064 {) 3.612 Tj +0 -23.5636 Td +(3065 int i;) 7.826 Tj +0 -24.8727 Td +(3066 struct proc *p = curproc[cpu\(\)];) 23.478 Tj +0 -26.1818 Td +(3067 ) 3.01 Tj +0 -27.4909 Td +(3068 if\(argint\(argno, &i\) < 0\)) 19.264 Tj +0 -28.8 Td +(3069 return -1;) 11.438 Tj +0 -30.1091 Td +(3070 if\(\(uint\)i >= p->sz || \(uint\)i+size >= p->sz\)) 31.304 Tj +0 -31.4182 Td +(3071 return -1;) 11.438 Tj +0 -32.7273 Td +(3072 *pp = p->mem + i;) 14.448 Tj +0 -34.0364 Td +(3073 return 0;) 9.632 Tj +0 -35.3454 Td +(3074 }) 3.612 Tj +0 -36.6545 Td +(3075 ) 3.01 Tj +0 -37.9636 Td +(3076 // Fetch the nth word-sized system call argument as a string pointer.) 44.548 Tj +0 -39.2727 Td +(3077 // Check that the pointer is valid and the string is nul-terminated.) 43.946 Tj +0 -40.5818 Td +(3078 // \(There is no shared writable memory, so the string can't change) 42.742 Tj +0 -41.8909 Td +(3079 // between this check and being used by the kernel.\)) 34.314 Tj +0 -43.2 Td +(3080 int) 4.816 Tj +0 -44.5091 Td +(3081 argstr\(int argno, char **pp\)) 19.866 Tj +0 -45.8182 Td +(3082 {) 3.612 Tj +0 -47.1272 Td +(3083 int addr;) 9.632 Tj +0 -48.4363 Td +(3084 if\(argint\(argno, &addr\) < 0\)) 21.07 Tj +0 -49.7454 Td +(3085 return -1;) 11.438 Tj +0 -51.0545 Td +(3086 return fetchstr\(curproc[cpu\(\)], addr, pp\);) 29.498 Tj +0 -52.3636 Td +(3087 }) 3.612 Tj +0 -53.6727 Td +(3088 ) 3.01 Tj +0 -54.9818 Td +(3089 ) 3.01 Tj +0 -56.2909 Td +(3090 ) 3.01 Tj +0 -57.6 Td +(3091 ) 3.01 Tj +0 -58.9091 Td +(3092 ) 3.01 Tj +0 -60.2181 Td +(3093 ) 3.01 Tj +0 -61.5272 Td +(3094 ) 3.01 Tj +0 -62.8363 Td +(3095 ) 3.01 Tj +0 -64.1454 Td +(3096 ) 3.01 Tj +0 -65.4545 Td +(3097 ) 3.01 Tj +0 -66.7636 Td +(3098 ) 3.01 Tj +0 -68.0727 Td +(3099 ) 3.01 Tj +0 -72 Td +(Sheet 30) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 38 38 +%%BeginPageSetup +%%PageOrientation: Landscape +__tumble pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/syscall.c Page 3) 24.08 Tj +0 -3.92728 Td +(3100 extern int sys_chdir\(void\);) 19.264 Tj +0 -5.23637 Td +(3101 extern int sys_close\(void\);) 19.264 Tj +0 -6.54546 Td +(3102 extern int sys_dup\(void\);) 18.06 Tj +0 -7.85455 Td +(3103 extern int sys_exec\(void\);) 18.662 Tj +0 -9.16364 Td +(3104 extern int sys_exit\(void\);) 18.662 Tj +0 -10.4727 Td +(3105 extern int sys_fork\(void\);) 18.662 Tj +0 -11.7818 Td +(3106 extern int sys_fstat\(void\);) 19.264 Tj +0 -13.0909 Td +(3107 extern int sys_getpid\(void\);) 19.866 Tj +0 -14.4 Td +(3108 extern int sys_kill\(void\);) 18.662 Tj +0 -15.7091 Td +(3109 extern int sys_link\(void\);) 18.662 Tj +0 -17.0182 Td +(3110 extern int sys_mkdir\(void\);) 19.264 Tj +0 -18.3273 Td +(3111 extern int sys_mknod\(void\);) 19.264 Tj +0 -19.6364 Td +(3112 extern int sys_open\(void\);) 18.662 Tj +0 -20.9455 Td +(3113 extern int sys_pipe\(void\);) 18.662 Tj +0 -22.2545 Td +(3114 extern int sys_read\(void\);) 18.662 Tj +0 -23.5636 Td +(3115 extern int sys_sbrk\(void\);) 18.662 Tj +0 -24.8727 Td +(3116 extern int sys_unlink\(void\);) 19.866 Tj +0 -26.1818 Td +(3117 extern int sys_wait\(void\);) 18.662 Tj +0 -27.4909 Td +(3118 extern int sys_write\(void\);) 19.264 Tj +0 -28.8 Td +(3119 ) 3.01 Tj +0 -30.1091 Td +(3120 void) 5.418 Tj +0 -31.4182 Td +(3121 syscall\(void\)) 10.836 Tj +0 -32.7273 Td +(3122 {) 3.612 Tj +0 -34.0364 Td +(3123 struct proc *cp = curproc[cpu\(\)];) 24.08 Tj +0 -35.3454 Td +(3124 int num = cp->tf->eax;) 17.458 Tj +0 -36.6545 Td +(3125 int ret = -1;) 12.04 Tj +0 -37.9636 Td +(3126 ) 3.01 Tj +0 -39.2727 Td +(3127 switch\(num\){) 11.438 Tj +0 -40.5818 Td +(3128 case SYS_fork:) 12.642 Tj +0 -41.8909 Td +(3129 ret = sys_fork\(\);) 15.652 Tj +0 -43.2 Td +(3130 break;) 9.03 Tj +0 -44.5091 Td +(3131 case SYS_exit:) 12.642 Tj +0 -45.8182 Td +(3132 ret = sys_exit\(\);) 15.652 Tj +0 -47.1272 Td +(3133 break;) 9.03 Tj +0 -48.4363 Td +(3134 case SYS_wait:) 12.642 Tj +0 -49.7454 Td +(3135 ret = sys_wait\(\);) 15.652 Tj +0 -51.0545 Td +(3136 break;) 9.03 Tj +0 -52.3636 Td +(3137 case SYS_pipe:) 12.642 Tj +0 -53.6727 Td +(3138 ret = sys_pipe\(\);) 15.652 Tj +0 -54.9818 Td +(3139 break;) 9.03 Tj +0 -56.2909 Td +(3140 case SYS_write:) 13.244 Tj +0 -57.6 Td +(3141 ret = sys_write\(\);) 16.254 Tj +0 -58.9091 Td +(3142 break;) 9.03 Tj +0 -60.2181 Td +(3143 case SYS_read:) 12.642 Tj +0 -61.5272 Td +(3144 ret = sys_read\(\);) 15.652 Tj +0 -62.8363 Td +(3145 break;) 9.03 Tj +0 -64.1454 Td +(3146 case SYS_close:) 13.244 Tj +0 -65.4545 Td +(3147 ret = sys_close\(\);) 16.254 Tj +0 -66.7636 Td +(3148 break;) 9.03 Tj +0 -68.0727 Td +(3149 case SYS_kill:) 12.642 Tj +0 -72 Td +(Sheet 31) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/syscall.c Page 4) 24.08 Tj +0 -3.92728 Td +(3150 ret = sys_kill\(\);) 15.652 Tj +0 -5.23637 Td +(3151 break;) 9.03 Tj +0 -6.54546 Td +(3152 case SYS_exec:) 12.642 Tj +0 -7.85455 Td +(3153 ret = sys_exec\(\);) 15.652 Tj +0 -9.16364 Td +(3154 break;) 9.03 Tj +0 -10.4727 Td +(3155 case SYS_open:) 12.642 Tj +0 -11.7818 Td +(3156 ret = sys_open\(\);) 15.652 Tj +0 -13.0909 Td +(3157 break;) 9.03 Tj +0 -14.4 Td +(3158 case SYS_mknod:) 13.244 Tj +0 -15.7091 Td +(3159 ret = sys_mknod\(\);) 16.254 Tj +0 -17.0182 Td +(3160 break;) 9.03 Tj +0 -18.3273 Td +(3161 case SYS_unlink:) 13.846 Tj +0 -19.6364 Td +(3162 ret = sys_unlink\(\);) 16.856 Tj +0 -20.9455 Td +(3163 break;) 9.03 Tj +0 -22.2545 Td +(3164 case SYS_fstat:) 13.244 Tj +0 -23.5636 Td +(3165 ret = sys_fstat\(\);) 16.254 Tj +0 -24.8727 Td +(3166 break;) 9.03 Tj +0 -26.1818 Td +(3167 case SYS_link:) 12.642 Tj +0 -27.4909 Td +(3168 ret = sys_link\(\);) 15.652 Tj +0 -28.8 Td +(3169 break;) 9.03 Tj +0 -30.1091 Td +(3170 case SYS_mkdir:) 13.244 Tj +0 -31.4182 Td +(3171 ret = sys_mkdir\(\);) 16.254 Tj +0 -32.7273 Td +(3172 break;) 9.03 Tj +0 -34.0364 Td +(3173 case SYS_chdir:) 13.244 Tj +0 -35.3454 Td +(3174 ret = sys_chdir\(\);) 16.254 Tj +0 -36.6545 Td +(3175 break;) 9.03 Tj +0 -37.9636 Td +(3176 case SYS_dup:) 12.04 Tj +0 -39.2727 Td +(3177 ret = sys_dup\(\);) 15.05 Tj +0 -40.5818 Td +(3178 break;) 9.03 Tj +0 -41.8909 Td +(3179 case SYS_getpid:) 13.846 Tj +0 -43.2 Td +(3180 ret = sys_getpid\(\);) 16.856 Tj +0 -44.5091 Td +(3181 break;) 9.03 Tj +0 -45.8182 Td +(3182 case SYS_sbrk:) 12.642 Tj +0 -47.1272 Td +(3183 ret = sys_sbrk\(\);) 15.652 Tj +0 -48.4363 Td +(3184 break;) 9.03 Tj +0 -49.7454 Td +(3185 default:) 9.03 Tj +0 -51.0545 Td +(3186 cprintf\("unknown sys call %d\\n", num\);) 28.294 Tj +0 -52.3636 Td +(3187 // Maybe kill the process?) 21.07 Tj +0 -53.6727 Td +(3188 break;) 9.03 Tj +0 -54.9818 Td +(3189 }) 4.816 Tj +0 -56.2909 Td +(3190 cp->tf->eax = ret;) 15.05 Tj +0 -57.6 Td +(3191 }) 3.612 Tj +0 -58.9091 Td +(3192 ) 3.01 Tj +0 -60.2181 Td +(3193 ) 3.01 Tj +0 -61.5272 Td +(3194 ) 3.01 Tj +0 -62.8363 Td +(3195 ) 3.01 Tj +0 -64.1454 Td +(3196 ) 3.01 Tj +0 -65.4545 Td +(3197 ) 3.01 Tj +0 -66.7636 Td +(3198 ) 3.01 Tj +0 -68.0727 Td +(3199 ) 3.01 Tj +0 -72 Td +(Sheet 31) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 39 39 +%%BeginPageSetup +%%PageOrientation: Landscape +pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/sysproc.c Page 1) 24.08 Tj +0 -3.92728 Td +(3200 #include "types.h") 13.846 Tj +0 -5.23637 Td +(3201 #include "stat.h") 13.244 Tj +0 -6.54546 Td +(3202 #include "param.h") 13.846 Tj +0 -7.85455 Td +(3203 #include "mmu.h") 12.642 Tj +0 -9.16364 Td +(3204 #include "proc.h") 13.244 Tj +0 -10.4727 Td +(3205 #include "defs.h") 13.244 Tj +0 -11.7818 Td +(3206 #include "x86.h") 12.642 Tj +0 -13.0909 Td +(3207 #include "traps.h") 13.846 Tj +0 -14.4 Td +(3208 #include "syscall.h") 15.05 Tj +0 -15.7091 Td +(3209 #include "spinlock.h") 15.652 Tj +0 -17.0182 Td +(3210 #include "buf.h") 12.642 Tj +0 -18.3273 Td +(3211 #include "fs.h") 12.04 Tj +0 -19.6364 Td +(3212 #include "fsvar.h") 13.846 Tj +0 -20.9455 Td +(3213 #include "elf.h") 12.642 Tj +0 -22.2545 Td +(3214 #include "file.h") 13.244 Tj +0 -23.5636 Td +(3215 #include "fcntl.h") 13.846 Tj +0 -24.8727 Td +(3216 ) 3.01 Tj +0 -26.1818 Td +(3217 int) 4.816 Tj +0 -27.4909 Td +(3218 sys_fork\(void\)) 11.438 Tj +0 -28.8 Td +(3219 {) 3.612 Tj +0 -30.1091 Td +(3220 struct proc *np;) 13.846 Tj +0 -31.4182 Td +(3221 ) 3.01 Tj +0 -32.7273 Td +(3222 if\(\(np = copyproc\(curproc[cpu\(\)]\)\) == 0\)) 28.294 Tj +0 -34.0364 Td +(3223 return -1;) 11.438 Tj +0 -35.3454 Td +(3224 np->state = RUNNABLE;) 16.856 Tj +0 -36.6545 Td +(3225 return np->pid;) 13.244 Tj +0 -37.9636 Td +(3226 }) 3.612 Tj +0 -39.2727 Td +(3227 ) 3.01 Tj +0 -40.5818 Td +(3228 int) 4.816 Tj +0 -41.8909 Td +(3229 sys_exit\(void\)) 11.438 Tj +0 -43.2 Td +(3230 {) 3.612 Tj +0 -44.5091 Td +(3231 proc_exit\(\);) 11.438 Tj +0 -45.8182 Td +(3232 return 0; // not reached) 19.264 Tj +0 -47.1272 Td +(3233 }) 3.612 Tj +0 -48.4363 Td +(3234 ) 3.01 Tj +0 -49.7454 Td +(3235 int) 4.816 Tj +0 -51.0545 Td +(3236 sys_wait\(void\)) 11.438 Tj +0 -52.3636 Td +(3237 {) 3.612 Tj +0 -53.6727 Td +(3238 return proc_wait\(\);) 15.652 Tj +0 -54.9818 Td +(3239 }) 3.612 Tj +0 -56.2909 Td +(3240 ) 3.01 Tj +0 -57.6 Td +(3241 int) 4.816 Tj +0 -58.9091 Td +(3242 sys_kill\(void\)) 11.438 Tj +0 -60.2181 Td +(3243 {) 3.612 Tj +0 -61.5272 Td +(3244 int pid;) 9.03 Tj +0 -62.8363 Td +(3245 ) 3.01 Tj +0 -64.1454 Td +(3246 if\(argint\(0, &pid\) < 0\)) 18.06 Tj +0 -65.4545 Td +(3247 return -1;) 11.438 Tj +0 -66.7636 Td +(3248 return proc_kill\(pid\);) 17.458 Tj +0 -68.0727 Td +(3249 }) 3.612 Tj +0 -72 Td +(Sheet 32) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/sysproc.c Page 2) 24.08 Tj +0 -3.92728 Td +(3250 int) 4.816 Tj +0 -5.23637 Td +(3251 sys_getpid\(void\)) 12.642 Tj +0 -6.54546 Td +(3252 {) 3.612 Tj +0 -7.85455 Td +(3253 return curproc[cpu\(\)]->pid;) 20.468 Tj +0 -9.16364 Td +(3254 }) 3.612 Tj +0 -10.4727 Td +(3255 ) 3.01 Tj +0 -11.7818 Td +(3256 int) 4.816 Tj +0 -13.0909 Td +(3257 sys_sbrk\(void\)) 11.438 Tj +0 -14.4 Td +(3258 {) 3.612 Tj +0 -15.7091 Td +(3259 int addr;) 9.632 Tj +0 -17.0182 Td +(3260 int n;) 7.826 Tj +0 -18.3273 Td +(3261 struct proc *cp = curproc[cpu\(\)];) 24.08 Tj +0 -19.6364 Td +(3262 ) 3.01 Tj +0 -20.9455 Td +(3263 if\(argint\(0, &n\) < 0\)) 16.856 Tj +0 -22.2545 Td +(3264 return -1;) 11.438 Tj +0 -23.5636 Td +(3265 if\(\(addr = growproc\(n\)\) < 0\)) 21.07 Tj +0 -24.8727 Td +(3266 return -1;) 11.438 Tj +0 -26.1818 Td +(3267 setupsegs\(cp\);) 12.642 Tj +0 -27.4909 Td +(3268 return addr;) 11.438 Tj +0 -28.8 Td +(3269 }) 3.612 Tj +0 -30.1091 Td +(3270 ) 3.01 Tj +0 -31.4182 Td +(3271 ) 3.01 Tj +0 -32.7273 Td +(3272 ) 3.01 Tj +0 -34.0364 Td +(3273 ) 3.01 Tj +0 -35.3454 Td +(3274 ) 3.01 Tj +0 -36.6545 Td +(3275 ) 3.01 Tj +0 -37.9636 Td +(3276 ) 3.01 Tj +0 -39.2727 Td +(3277 ) 3.01 Tj +0 -40.5818 Td +(3278 ) 3.01 Tj +0 -41.8909 Td +(3279 ) 3.01 Tj +0 -43.2 Td +(3280 ) 3.01 Tj +0 -44.5091 Td +(3281 ) 3.01 Tj +0 -45.8182 Td +(3282 ) 3.01 Tj +0 -47.1272 Td +(3283 ) 3.01 Tj +0 -48.4363 Td +(3284 ) 3.01 Tj +0 -49.7454 Td +(3285 ) 3.01 Tj +0 -51.0545 Td +(3286 ) 3.01 Tj +0 -52.3636 Td +(3287 ) 3.01 Tj +0 -53.6727 Td +(3288 ) 3.01 Tj +0 -54.9818 Td +(3289 ) 3.01 Tj +0 -56.2909 Td +(3290 ) 3.01 Tj +0 -57.6 Td +(3291 ) 3.01 Tj +0 -58.9091 Td +(3292 ) 3.01 Tj +0 -60.2181 Td +(3293 ) 3.01 Tj +0 -61.5272 Td +(3294 ) 3.01 Tj +0 -62.8363 Td +(3295 ) 3.01 Tj +0 -64.1454 Td +(3296 ) 3.01 Tj +0 -65.4545 Td +(3297 ) 3.01 Tj +0 -66.7636 Td +(3298 ) 3.01 Tj +0 -68.0727 Td +(3299 ) 3.01 Tj +0 -72 Td +(Sheet 32) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 40 40 +%%BeginPageSetup +%%PageOrientation: Landscape +__tumble pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/buf.h Page 1) 21.672 Tj +0 -3.92728 Td +(3300 struct buf {) 10.234 Tj +0 -5.23637 Td +(3301 int flags;) 10.234 Tj +0 -6.54546 Td +(3302 uint dev;) 9.632 Tj +0 -7.85455 Td +(3303 uint sector;) 11.438 Tj +0 -9.16364 Td +(3304 struct buf *prev;) 14.448 Tj +0 -10.4727 Td +(3305 struct buf *next;) 14.448 Tj +0 -11.7818 Td +(3306 uchar data[512];) 13.846 Tj +0 -13.0909 Td +(3307 };) 4.214 Tj +0 -14.4 Td +(3308 #define B_BUSY 0x1 // buffer is locked by some process) 36.12 Tj +0 -15.7091 Td +(3309 #define B_VALID 0x2 // buffer contains the data of the sector) 39.732 Tj +0 -17.0182 Td +(3310 ) 3.01 Tj +0 -18.3273 Td +(3311 ) 3.01 Tj +0 -19.6364 Td +(3312 ) 3.01 Tj +0 -20.9455 Td +(3313 ) 3.01 Tj +0 -22.2545 Td +(3314 ) 3.01 Tj +0 -23.5636 Td +(3315 ) 3.01 Tj +0 -24.8727 Td +(3316 ) 3.01 Tj +0 -26.1818 Td +(3317 ) 3.01 Tj +0 -27.4909 Td +(3318 ) 3.01 Tj +0 -28.8 Td +(3319 ) 3.01 Tj +0 -30.1091 Td +(3320 ) 3.01 Tj +0 -31.4182 Td +(3321 ) 3.01 Tj +0 -32.7273 Td +(3322 ) 3.01 Tj +0 -34.0364 Td +(3323 ) 3.01 Tj +0 -35.3454 Td +(3324 ) 3.01 Tj +0 -36.6545 Td +(3325 ) 3.01 Tj +0 -37.9636 Td +(3326 ) 3.01 Tj +0 -39.2727 Td +(3327 ) 3.01 Tj +0 -40.5818 Td +(3328 ) 3.01 Tj +0 -41.8909 Td +(3329 ) 3.01 Tj +0 -43.2 Td +(3330 ) 3.01 Tj +0 -44.5091 Td +(3331 ) 3.01 Tj +0 -45.8182 Td +(3332 ) 3.01 Tj +0 -47.1272 Td +(3333 ) 3.01 Tj +0 -48.4363 Td +(3334 ) 3.01 Tj +0 -49.7454 Td +(3335 ) 3.01 Tj +0 -51.0545 Td +(3336 ) 3.01 Tj +0 -52.3636 Td +(3337 ) 3.01 Tj +0 -53.6727 Td +(3338 ) 3.01 Tj +0 -54.9818 Td +(3339 ) 3.01 Tj +0 -56.2909 Td +(3340 ) 3.01 Tj +0 -57.6 Td +(3341 ) 3.01 Tj +0 -58.9091 Td +(3342 ) 3.01 Tj +0 -60.2181 Td +(3343 ) 3.01 Tj +0 -61.5272 Td +(3344 ) 3.01 Tj +0 -62.8363 Td +(3345 ) 3.01 Tj +0 -64.1454 Td +(3346 ) 3.01 Tj +0 -65.4545 Td +(3347 ) 3.01 Tj +0 -66.7636 Td +(3348 ) 3.01 Tj +0 -68.0727 Td +(3349 ) 3.01 Tj +0 -72 Td +(Sheet 33) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/dev.h Page 1) 21.672 Tj +0 -3.92728 Td +(3350 struct devsw {) 11.438 Tj +0 -5.23637 Td +(3351 int \(*read\)\(int, char*, int\);) 21.672 Tj +0 -6.54546 Td +(3352 int \(*write\)\(int, char*, int\);) 22.274 Tj +0 -7.85455 Td +(3353 };) 4.214 Tj +0 -9.16364 Td +(3354 ) 3.01 Tj +0 -10.4727 Td +(3355 extern struct devsw devsw[];) 19.866 Tj +0 -11.7818 Td +(3356 ) 3.01 Tj +0 -13.0909 Td +(3357 #define CONSOLE 1) 13.244 Tj +0 -14.4 Td +(3358 ) 3.01 Tj +0 -15.7091 Td +(3359 ) 3.01 Tj +0 -17.0182 Td +(3360 ) 3.01 Tj +0 -18.3273 Td +(3361 ) 3.01 Tj +0 -19.6364 Td +(3362 ) 3.01 Tj +0 -20.9455 Td +(3363 ) 3.01 Tj +0 -22.2545 Td +(3364 ) 3.01 Tj +0 -23.5636 Td +(3365 ) 3.01 Tj +0 -24.8727 Td +(3366 ) 3.01 Tj +0 -26.1818 Td +(3367 ) 3.01 Tj +0 -27.4909 Td +(3368 ) 3.01 Tj +0 -28.8 Td +(3369 ) 3.01 Tj +0 -30.1091 Td +(3370 ) 3.01 Tj +0 -31.4182 Td +(3371 ) 3.01 Tj +0 -32.7273 Td +(3372 ) 3.01 Tj +0 -34.0364 Td +(3373 ) 3.01 Tj +0 -35.3454 Td +(3374 ) 3.01 Tj +0 -36.6545 Td +(3375 ) 3.01 Tj +0 -37.9636 Td +(3376 ) 3.01 Tj +0 -39.2727 Td +(3377 ) 3.01 Tj +0 -40.5818 Td +(3378 ) 3.01 Tj +0 -41.8909 Td +(3379 ) 3.01 Tj +0 -43.2 Td +(3380 ) 3.01 Tj +0 -44.5091 Td +(3381 ) 3.01 Tj +0 -45.8182 Td +(3382 ) 3.01 Tj +0 -47.1272 Td +(3383 ) 3.01 Tj +0 -48.4363 Td +(3384 ) 3.01 Tj +0 -49.7454 Td +(3385 ) 3.01 Tj +0 -51.0545 Td +(3386 ) 3.01 Tj +0 -52.3636 Td +(3387 ) 3.01 Tj +0 -53.6727 Td +(3388 ) 3.01 Tj +0 -54.9818 Td +(3389 ) 3.01 Tj +0 -56.2909 Td +(3390 ) 3.01 Tj +0 -57.6 Td +(3391 ) 3.01 Tj +0 -58.9091 Td +(3392 ) 3.01 Tj +0 -60.2181 Td +(3393 ) 3.01 Tj +0 -61.5272 Td +(3394 ) 3.01 Tj +0 -62.8363 Td +(3395 ) 3.01 Tj +0 -64.1454 Td +(3396 ) 3.01 Tj +0 -65.4545 Td +(3397 ) 3.01 Tj +0 -66.7636 Td +(3398 ) 3.01 Tj +0 -68.0727 Td +(3399 ) 3.01 Tj +0 -72 Td +(Sheet 33) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 41 41 +%%BeginPageSetup +%%PageOrientation: Landscape +pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/fcntl.h Page 1) 22.876 Tj +0 -3.92728 Td +(3400 #define O_CREATE 0x200) 16.856 Tj +0 -5.23637 Td +(3401 #define O_RDONLY 0x000) 16.856 Tj +0 -6.54546 Td +(3402 #define O_WRONLY 0x001) 16.856 Tj +0 -7.85455 Td +(3403 #define O_RDWR 0x002) 16.856 Tj +0 -9.16364 Td +(3404 ) 3.01 Tj +0 -10.4727 Td +(3405 ) 3.01 Tj +0 -11.7818 Td +(3406 ) 3.01 Tj +0 -13.0909 Td +(3407 ) 3.01 Tj +0 -14.4 Td +(3408 ) 3.01 Tj +0 -15.7091 Td +(3409 ) 3.01 Tj +0 -17.0182 Td +(3410 ) 3.01 Tj +0 -18.3273 Td +(3411 ) 3.01 Tj +0 -19.6364 Td +(3412 ) 3.01 Tj +0 -20.9455 Td +(3413 ) 3.01 Tj +0 -22.2545 Td +(3414 ) 3.01 Tj +0 -23.5636 Td +(3415 ) 3.01 Tj +0 -24.8727 Td +(3416 ) 3.01 Tj +0 -26.1818 Td +(3417 ) 3.01 Tj +0 -27.4909 Td +(3418 ) 3.01 Tj +0 -28.8 Td +(3419 ) 3.01 Tj +0 -30.1091 Td +(3420 ) 3.01 Tj +0 -31.4182 Td +(3421 ) 3.01 Tj +0 -32.7273 Td +(3422 ) 3.01 Tj +0 -34.0364 Td +(3423 ) 3.01 Tj +0 -35.3454 Td +(3424 ) 3.01 Tj +0 -36.6545 Td +(3425 ) 3.01 Tj +0 -37.9636 Td +(3426 ) 3.01 Tj +0 -39.2727 Td +(3427 ) 3.01 Tj +0 -40.5818 Td +(3428 ) 3.01 Tj +0 -41.8909 Td +(3429 ) 3.01 Tj +0 -43.2 Td +(3430 ) 3.01 Tj +0 -44.5091 Td +(3431 ) 3.01 Tj +0 -45.8182 Td +(3432 ) 3.01 Tj +0 -47.1272 Td +(3433 ) 3.01 Tj +0 -48.4363 Td +(3434 ) 3.01 Tj +0 -49.7454 Td +(3435 ) 3.01 Tj +0 -51.0545 Td +(3436 ) 3.01 Tj +0 -52.3636 Td +(3437 ) 3.01 Tj +0 -53.6727 Td +(3438 ) 3.01 Tj +0 -54.9818 Td +(3439 ) 3.01 Tj +0 -56.2909 Td +(3440 ) 3.01 Tj +0 -57.6 Td +(3441 ) 3.01 Tj +0 -58.9091 Td +(3442 ) 3.01 Tj +0 -60.2181 Td +(3443 ) 3.01 Tj +0 -61.5272 Td +(3444 ) 3.01 Tj +0 -62.8363 Td +(3445 ) 3.01 Tj +0 -64.1454 Td +(3446 ) 3.01 Tj +0 -65.4545 Td +(3447 ) 3.01 Tj +0 -66.7636 Td +(3448 ) 3.01 Tj +0 -68.0727 Td +(3449 ) 3.01 Tj +0 -72 Td +(Sheet 34) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/stat.h Page 1) 22.274 Tj +0 -3.92728 Td +(3450 struct stat {) 10.836 Tj +0 -5.23637 Td +(3451 int dev; // Device number) 21.672 Tj +0 -6.54546 Td +(3452 uint ino; // Inode number on device) 27.09 Tj +0 -7.85455 Td +(3453 short type; // Type of file) 21.07 Tj +0 -9.16364 Td +(3454 short nlink; // Number of links to file) 27.692 Tj +0 -10.4727 Td +(3455 uint size; // Size of file in bytes) 26.488 Tj +0 -11.7818 Td +(3456 };) 4.214 Tj +0 -13.0909 Td +(3457 ) 3.01 Tj +0 -14.4 Td +(3458 ) 3.01 Tj +0 -15.7091 Td +(3459 ) 3.01 Tj +0 -17.0182 Td +(3460 ) 3.01 Tj +0 -18.3273 Td +(3461 ) 3.01 Tj +0 -19.6364 Td +(3462 ) 3.01 Tj +0 -20.9455 Td +(3463 ) 3.01 Tj +0 -22.2545 Td +(3464 ) 3.01 Tj +0 -23.5636 Td +(3465 ) 3.01 Tj +0 -24.8727 Td +(3466 ) 3.01 Tj +0 -26.1818 Td +(3467 ) 3.01 Tj +0 -27.4909 Td +(3468 ) 3.01 Tj +0 -28.8 Td +(3469 ) 3.01 Tj +0 -30.1091 Td +(3470 ) 3.01 Tj +0 -31.4182 Td +(3471 ) 3.01 Tj +0 -32.7273 Td +(3472 ) 3.01 Tj +0 -34.0364 Td +(3473 ) 3.01 Tj +0 -35.3454 Td +(3474 ) 3.01 Tj +0 -36.6545 Td +(3475 ) 3.01 Tj +0 -37.9636 Td +(3476 ) 3.01 Tj +0 -39.2727 Td +(3477 ) 3.01 Tj +0 -40.5818 Td +(3478 ) 3.01 Tj +0 -41.8909 Td +(3479 ) 3.01 Tj +0 -43.2 Td +(3480 ) 3.01 Tj +0 -44.5091 Td +(3481 ) 3.01 Tj +0 -45.8182 Td +(3482 ) 3.01 Tj +0 -47.1272 Td +(3483 ) 3.01 Tj +0 -48.4363 Td +(3484 ) 3.01 Tj +0 -49.7454 Td +(3485 ) 3.01 Tj +0 -51.0545 Td +(3486 ) 3.01 Tj +0 -52.3636 Td +(3487 ) 3.01 Tj +0 -53.6727 Td +(3488 ) 3.01 Tj +0 -54.9818 Td +(3489 ) 3.01 Tj +0 -56.2909 Td +(3490 ) 3.01 Tj +0 -57.6 Td +(3491 ) 3.01 Tj +0 -58.9091 Td +(3492 ) 3.01 Tj +0 -60.2181 Td +(3493 ) 3.01 Tj +0 -61.5272 Td +(3494 ) 3.01 Tj +0 -62.8363 Td +(3495 ) 3.01 Tj +0 -64.1454 Td +(3496 ) 3.01 Tj +0 -65.4545 Td +(3497 ) 3.01 Tj +0 -66.7636 Td +(3498 ) 3.01 Tj +0 -68.0727 Td +(3499 ) 3.01 Tj +0 -72 Td +(Sheet 34) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 42 42 +%%BeginPageSetup +%%PageOrientation: Landscape +__tumble pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/file.h Page 1) 22.274 Tj +0 -3.92728 Td +(3500 struct file {) 10.836 Tj +0 -5.23637 Td +(3501 enum { FD_CLOSED, FD_NONE, FD_PIPE, FD_FILE } type;) 34.916 Tj +0 -6.54546 Td +(3502 int ref; // reference count) 20.468 Tj +0 -7.85455 Td +(3503 char readable;) 12.642 Tj +0 -9.16364 Td +(3504 char writable;) 12.642 Tj +0 -10.4727 Td +(3505 struct pipe *pipe;) 15.05 Tj +0 -11.7818 Td +(3506 struct inode *ip;) 14.448 Tj +0 -13.0909 Td +(3507 uint off;) 9.632 Tj +0 -14.4 Td +(3508 };) 4.214 Tj +0 -15.7091 Td +(3509 ) 3.01 Tj +0 -17.0182 Td +(3510 ) 3.01 Tj +0 -18.3273 Td +(3511 ) 3.01 Tj +0 -19.6364 Td +(3512 ) 3.01 Tj +0 -20.9455 Td +(3513 ) 3.01 Tj +0 -22.2545 Td +(3514 ) 3.01 Tj +0 -23.5636 Td +(3515 ) 3.01 Tj +0 -24.8727 Td +(3516 ) 3.01 Tj +0 -26.1818 Td +(3517 ) 3.01 Tj +0 -27.4909 Td +(3518 ) 3.01 Tj +0 -28.8 Td +(3519 ) 3.01 Tj +0 -30.1091 Td +(3520 ) 3.01 Tj +0 -31.4182 Td +(3521 ) 3.01 Tj +0 -32.7273 Td +(3522 ) 3.01 Tj +0 -34.0364 Td +(3523 ) 3.01 Tj +0 -35.3454 Td +(3524 ) 3.01 Tj +0 -36.6545 Td +(3525 ) 3.01 Tj +0 -37.9636 Td +(3526 ) 3.01 Tj +0 -39.2727 Td +(3527 ) 3.01 Tj +0 -40.5818 Td +(3528 ) 3.01 Tj +0 -41.8909 Td +(3529 ) 3.01 Tj +0 -43.2 Td +(3530 ) 3.01 Tj +0 -44.5091 Td +(3531 ) 3.01 Tj +0 -45.8182 Td +(3532 ) 3.01 Tj +0 -47.1272 Td +(3533 ) 3.01 Tj +0 -48.4363 Td +(3534 ) 3.01 Tj +0 -49.7454 Td +(3535 ) 3.01 Tj +0 -51.0545 Td +(3536 ) 3.01 Tj +0 -52.3636 Td +(3537 ) 3.01 Tj +0 -53.6727 Td +(3538 ) 3.01 Tj +0 -54.9818 Td +(3539 ) 3.01 Tj +0 -56.2909 Td +(3540 ) 3.01 Tj +0 -57.6 Td +(3541 ) 3.01 Tj +0 -58.9091 Td +(3542 ) 3.01 Tj +0 -60.2181 Td +(3543 ) 3.01 Tj +0 -61.5272 Td +(3544 ) 3.01 Tj +0 -62.8363 Td +(3545 ) 3.01 Tj +0 -64.1454 Td +(3546 ) 3.01 Tj +0 -65.4545 Td +(3547 ) 3.01 Tj +0 -66.7636 Td +(3548 ) 3.01 Tj +0 -68.0727 Td +(3549 ) 3.01 Tj +0 -72 Td +(Sheet 35) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/fs.h Page 1) 21.07 Tj +0 -3.92728 Td +(3550 // On-disk file system format.) 21.07 Tj +0 -5.23637 Td +(3551 // This header is shared between kernel and user space.) 36.12 Tj +0 -6.54546 Td +(3552 ) 3.01 Tj +0 -7.85455 Td +(3553 // Block 0 is unused.) 15.652 Tj +0 -9.16364 Td +(3554 // Block 1 is super block.) 18.662 Tj +0 -10.4727 Td +(3555 // Inodes start at block 2.) 19.264 Tj +0 -11.7818 Td +(3556 ) 3.01 Tj +0 -13.0909 Td +(3557 #define BSIZE 512 // block size) 22.274 Tj +0 -14.4 Td +(3558 ) 3.01 Tj +0 -15.7091 Td +(3559 // File system super block) 18.662 Tj +0 -17.0182 Td +(3560 struct superblock {) 14.448 Tj +0 -18.3273 Td +(3561 uint size; // Size of file system image \(blocks\)) 37.926 Tj +0 -19.6364 Td +(3562 uint nblocks; // Number of data blocks) 30.1 Tj +0 -20.9455 Td +(3563 uint ninodes; // Number of inodes.) 27.692 Tj +0 -22.2545 Td +(3564 };) 4.214 Tj +0 -23.5636 Td +(3565 ) 3.01 Tj +0 -24.8727 Td +(3566 #define NADDRS \(NDIRECT+1\)) 18.662 Tj +0 -26.1818 Td +(3567 #define NDIRECT 12) 13.846 Tj +0 -27.4909 Td +(3568 #define INDIRECT 12) 14.448 Tj +0 -28.8 Td +(3569 #define NINDIRECT \(BSIZE / sizeof\(uint\)\)) 27.09 Tj +0 -30.1091 Td +(3570 #define MAXFILE \(NDIRECT + NINDIRECT\)) 25.886 Tj +0 -31.4182 Td +(3571 ) 3.01 Tj +0 -32.7273 Td +(3572 // On-disk inode structure) 18.662 Tj +0 -34.0364 Td +(3573 struct dinode {) 12.04 Tj +0 -35.3454 Td +(3574 short type; // File type) 24.682 Tj +0 -36.6545 Td +(3575 short major; // Major device number \(T_DEV only\)) 38.528 Tj +0 -37.9636 Td +(3576 short minor; // Minor device number \(T_DEV only\)) 38.528 Tj +0 -39.2727 Td +(3577 short nlink; // Number of links to inode in file system) 42.742 Tj +0 -40.5818 Td +(3578 uint size; // Size of file \(bytes\)) 31.304 Tj +0 -41.8909 Td +(3579 uint addrs[NADDRS]; // Data block addresses) 31.304 Tj +0 -43.2 Td +(3580 };) 4.214 Tj +0 -44.5091 Td +(3581 ) 3.01 Tj +0 -45.8182 Td +(3582 #define T_DIR 1 // Directory) 21.672 Tj +0 -47.1272 Td +(3583 #define T_FILE 2 // File) 18.662 Tj +0 -48.4363 Td +(3584 #define T_DEV 3 // Special device) 24.682 Tj +0 -49.7454 Td +(3585 ) 3.01 Tj +0 -51.0545 Td +(3586 // Inodes per block.) 15.05 Tj +0 -52.3636 Td +(3587 #define IPB \(BSIZE / sizeof\(struct dinode\)\)) 34.916 Tj +0 -53.6727 Td +(3588 ) 3.01 Tj +0 -54.9818 Td +(3589 // Block containing inode i) 19.264 Tj +0 -56.2909 Td +(3590 #define IBLOCK\(i\) \(\(i\) / IPB + 2\)) 25.284 Tj +0 -57.6 Td +(3591 ) 3.01 Tj +0 -58.9091 Td +(3592 // Bitmap bits per block) 17.458 Tj +0 -60.2181 Td +(3593 #define BPB \(BSIZE*8\)) 21.672 Tj +0 -61.5272 Td +(3594 ) 3.01 Tj +0 -62.8363 Td +(3595 // Block containing bit for block b) 24.08 Tj +0 -64.1454 Td +(3596 #define BBLOCK\(b, ninodes\) \(b/BPB + \(ninodes\)/IPB + 3\)) 35.518 Tj +0 -65.4545 Td +(3597 ) 3.01 Tj +0 -66.7636 Td +(3598 ) 3.01 Tj +0 -68.0727 Td +(3599 ) 3.01 Tj +0 -72 Td +(Sheet 35) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 43 43 +%%BeginPageSetup +%%PageOrientation: Landscape +pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/fs.h Page 2) 21.07 Tj +0 -3.92728 Td +(3600 // Directory is a file containing a sequence of dirent structures.) 42.742 Tj +0 -5.23637 Td +(3601 #define DIRSIZ 14) 13.244 Tj +0 -6.54546 Td +(3602 ) 3.01 Tj +0 -7.85455 Td +(3603 struct dirent {) 12.04 Tj +0 -9.16364 Td +(3604 ushort inum;) 11.438 Tj +0 -10.4727 Td +(3605 char name[DIRSIZ];) 15.05 Tj +0 -11.7818 Td +(3606 };) 4.214 Tj +0 -13.0909 Td +(3607 ) 3.01 Tj +0 -14.4 Td +(3608 extern uint rootdev; // Device number of root file system) 37.926 Tj +0 -15.7091 Td +(3609 ) 3.01 Tj +0 -17.0182 Td +(3610 ) 3.01 Tj +0 -18.3273 Td +(3611 ) 3.01 Tj +0 -19.6364 Td +(3612 ) 3.01 Tj +0 -20.9455 Td +(3613 ) 3.01 Tj +0 -22.2545 Td +(3614 ) 3.01 Tj +0 -23.5636 Td +(3615 ) 3.01 Tj +0 -24.8727 Td +(3616 ) 3.01 Tj +0 -26.1818 Td +(3617 ) 3.01 Tj +0 -27.4909 Td +(3618 ) 3.01 Tj +0 -28.8 Td +(3619 ) 3.01 Tj +0 -30.1091 Td +(3620 ) 3.01 Tj +0 -31.4182 Td +(3621 ) 3.01 Tj +0 -32.7273 Td +(3622 ) 3.01 Tj +0 -34.0364 Td +(3623 ) 3.01 Tj +0 -35.3454 Td +(3624 ) 3.01 Tj +0 -36.6545 Td +(3625 ) 3.01 Tj +0 -37.9636 Td +(3626 ) 3.01 Tj +0 -39.2727 Td +(3627 ) 3.01 Tj +0 -40.5818 Td +(3628 ) 3.01 Tj +0 -41.8909 Td +(3629 ) 3.01 Tj +0 -43.2 Td +(3630 ) 3.01 Tj +0 -44.5091 Td +(3631 ) 3.01 Tj +0 -45.8182 Td +(3632 ) 3.01 Tj +0 -47.1272 Td +(3633 ) 3.01 Tj +0 -48.4363 Td +(3634 ) 3.01 Tj +0 -49.7454 Td +(3635 ) 3.01 Tj +0 -51.0545 Td +(3636 ) 3.01 Tj +0 -52.3636 Td +(3637 ) 3.01 Tj +0 -53.6727 Td +(3638 ) 3.01 Tj +0 -54.9818 Td +(3639 ) 3.01 Tj +0 -56.2909 Td +(3640 ) 3.01 Tj +0 -57.6 Td +(3641 ) 3.01 Tj +0 -58.9091 Td +(3642 ) 3.01 Tj +0 -60.2181 Td +(3643 ) 3.01 Tj +0 -61.5272 Td +(3644 ) 3.01 Tj +0 -62.8363 Td +(3645 ) 3.01 Tj +0 -64.1454 Td +(3646 ) 3.01 Tj +0 -65.4545 Td +(3647 ) 3.01 Tj +0 -66.7636 Td +(3648 ) 3.01 Tj +0 -68.0727 Td +(3649 ) 3.01 Tj +0 -72 Td +(Sheet 36) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/fsvar.h Page 1) 22.876 Tj +0 -3.92728 Td +(3650 // in-core file system types) 19.866 Tj +0 -5.23637 Td +(3651 ) 3.01 Tj +0 -6.54546 Td +(3652 struct inode {) 11.438 Tj +0 -7.85455 Td +(3653 uint dev; // Device number) 25.886 Tj +0 -9.16364 Td +(3654 uint inum; // Inode number) 25.284 Tj +0 -10.4727 Td +(3655 int ref; // Reference count) 27.09 Tj +0 -11.7818 Td +(3656 int busy; // Is the inode "locked"?) 31.304 Tj +0 -13.0909 Td +(3657 ) 3.01 Tj +0 -14.4 Td +(3658 short type; // copy of disk inode) 28.896 Tj +0 -15.7091 Td +(3659 short major;) 11.438 Tj +0 -17.0182 Td +(3660 short minor;) 11.438 Tj +0 -18.3273 Td +(3661 short nlink;) 11.438 Tj +0 -19.6364 Td +(3662 uint size;) 10.234 Tj +0 -20.9455 Td +(3663 uint addrs[NADDRS];) 15.652 Tj +0 -22.2545 Td +(3664 };) 4.214 Tj +0 -23.5636 Td +(3665 ) 3.01 Tj +0 -24.8727 Td +(3666 extern uint rootdev;) 15.05 Tj +0 -26.1818 Td +(3667 ) 3.01 Tj +0 -27.4909 Td +(3668 #define NAMEI_LOOKUP 1) 16.254 Tj +0 -28.8 Td +(3669 #define NAMEI_CREATE 2) 16.254 Tj +0 -30.1091 Td +(3670 #define NAMEI_DELETE 3) 16.254 Tj +0 -31.4182 Td +(3671 ) 3.01 Tj +0 -32.7273 Td +(3672 ) 3.01 Tj +0 -34.0364 Td +(3673 ) 3.01 Tj +0 -35.3454 Td +(3674 ) 3.01 Tj +0 -36.6545 Td +(3675 ) 3.01 Tj +0 -37.9636 Td +(3676 ) 3.01 Tj +0 -39.2727 Td +(3677 ) 3.01 Tj +0 -40.5818 Td +(3678 ) 3.01 Tj +0 -41.8909 Td +(3679 ) 3.01 Tj +0 -43.2 Td +(3680 ) 3.01 Tj +0 -44.5091 Td +(3681 ) 3.01 Tj +0 -45.8182 Td +(3682 ) 3.01 Tj +0 -47.1272 Td +(3683 ) 3.01 Tj +0 -48.4363 Td +(3684 ) 3.01 Tj +0 -49.7454 Td +(3685 ) 3.01 Tj +0 -51.0545 Td +(3686 ) 3.01 Tj +0 -52.3636 Td +(3687 ) 3.01 Tj +0 -53.6727 Td +(3688 ) 3.01 Tj +0 -54.9818 Td +(3689 ) 3.01 Tj +0 -56.2909 Td +(3690 ) 3.01 Tj +0 -57.6 Td +(3691 ) 3.01 Tj +0 -58.9091 Td +(3692 ) 3.01 Tj +0 -60.2181 Td +(3693 ) 3.01 Tj +0 -61.5272 Td +(3694 ) 3.01 Tj +0 -62.8363 Td +(3695 ) 3.01 Tj +0 -64.1454 Td +(3696 ) 3.01 Tj +0 -65.4545 Td +(3697 ) 3.01 Tj +0 -66.7636 Td +(3698 ) 3.01 Tj +0 -68.0727 Td +(3699 ) 3.01 Tj +0 -72 Td +(Sheet 36) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 44 44 +%%BeginPageSetup +%%PageOrientation: Landscape +__tumble pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/ide.c Page 1) 21.672 Tj +0 -3.92728 Td +(3700 // Simple PIO-based \(non-DMA\) IDE driver code.) 30.702 Tj +0 -5.23637 Td +(3701 ) 3.01 Tj +0 -6.54546 Td +(3702 #include "types.h") 13.846 Tj +0 -7.85455 Td +(3703 #include "param.h") 13.846 Tj +0 -9.16364 Td +(3704 #include "mmu.h") 12.642 Tj +0 -10.4727 Td +(3705 #include "proc.h") 13.244 Tj +0 -11.7818 Td +(3706 #include "defs.h") 13.244 Tj +0 -13.0909 Td +(3707 #include "x86.h") 12.642 Tj +0 -14.4 Td +(3708 #include "traps.h") 13.846 Tj +0 -15.7091 Td +(3709 #include "spinlock.h") 15.652 Tj +0 -17.0182 Td +(3710 ) 3.01 Tj +0 -18.3273 Td +(3711 #define IDE_BSY 0x80) 18.662 Tj +0 -19.6364 Td +(3712 #define IDE_DRDY 0x40) 18.662 Tj +0 -20.9455 Td +(3713 #define IDE_DF 0x20) 18.662 Tj +0 -22.2545 Td +(3714 #define IDE_ERR 0x01) 18.662 Tj +0 -23.5636 Td +(3715 ) 3.01 Tj +0 -24.8727 Td +(3716 #define IDE_CMD_READ 0x20) 18.662 Tj +0 -26.1818 Td +(3717 #define IDE_CMD_WRITE 0x30) 18.662 Tj +0 -27.4909 Td +(3718 ) 3.01 Tj +0 -28.8 Td +(3719 // IDE request queue.) 15.652 Tj +0 -30.1091 Td +(3720 // The next request will be stored in request[head],) 34.314 Tj +0 -31.4182 Td +(3721 // and the request currently being served by the disk) 34.916 Tj +0 -32.7273 Td +(3722 // is request[tail].) 15.05 Tj +0 -34.0364 Td +(3723 // Must hold ide_lock while manipulating queue.) 31.304 Tj +0 -35.3454 Td +(3724 ) 3.01 Tj +0 -36.6545 Td +(3725 struct ide_request {) 15.05 Tj +0 -37.9636 Td +(3726 int diskno;) 10.836 Tj +0 -39.2727 Td +(3727 uint secno;) 10.836 Tj +0 -40.5818 Td +(3728 void *addr;) 10.836 Tj +0 -41.8909 Td +(3729 uint nsecs;) 10.836 Tj +0 -43.2 Td +(3730 uint read;) 10.234 Tj +0 -44.5091 Td +(3731 };) 4.214 Tj +0 -45.8182 Td +(3732 ) 3.01 Tj +0 -47.1272 Td +(3733 static struct ide_request request[NREQUEST];) 29.498 Tj +0 -48.4363 Td +(3734 static int head, tail;) 16.254 Tj +0 -49.7454 Td +(3735 static struct spinlock ide_lock;) 22.274 Tj +0 -51.0545 Td +(3736 ) 3.01 Tj +0 -52.3636 Td +(3737 static int disk_1_present;) 18.662 Tj +0 -53.6727 Td +(3738 static int disk_queue;) 16.254 Tj +0 -54.9818 Td +(3739 ) 3.01 Tj +0 -56.2909 Td +(3740 static int ide_probe_disk1\(void\);) 22.876 Tj +0 -57.6 Td +(3741 ) 3.01 Tj +0 -58.9091 Td +(3742 // Wait for IDE disk to become ready.) 25.284 Tj +0 -60.2181 Td +(3743 static int) 9.03 Tj +0 -61.5272 Td +(3744 ide_wait_ready\(int check_error\)) 21.672 Tj +0 -62.8363 Td +(3745 {) 3.612 Tj +0 -64.1454 Td +(3746 int r;) 7.826 Tj +0 -65.4545 Td +(3747 ) 3.01 Tj +0 -66.7636 Td +(3748 while\(\(\(r = inb\(0x1F7\)\) & \(IDE_BSY|IDE_DRDY\)\) != IDE_DRDY\)) 39.13 Tj +0 -68.0727 Td +(3749 ;) 6.02 Tj +0 -72 Td +(Sheet 37) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/ide.c Page 2) 21.672 Tj +0 -3.92728 Td +(3750 if\(check_error && \(r & \(IDE_DF|IDE_ERR\)\) != 0\)) 31.906 Tj +0 -5.23637 Td +(3751 return -1;) 11.438 Tj +0 -6.54546 Td +(3752 return 0;) 9.632 Tj +0 -7.85455 Td +(3753 }) 3.612 Tj +0 -9.16364 Td +(3754 ) 3.01 Tj +0 -10.4727 Td +(3755 void) 5.418 Tj +0 -11.7818 Td +(3756 ide_init\(void\)) 11.438 Tj +0 -13.0909 Td +(3757 {) 3.612 Tj +0 -14.4 Td +(3758 initlock\(&ide_lock, "ide"\);) 20.468 Tj +0 -15.7091 Td +(3759 irq_enable\(IRQ_IDE\);) 16.254 Tj +0 -17.0182 Td +(3760 ioapic_enable\(IRQ_IDE, ncpu - 1\);) 24.08 Tj +0 -18.3273 Td +(3761 ide_wait_ready\(0\);) 15.05 Tj +0 -19.6364 Td +(3762 disk_1_present = ide_probe_disk1\(\);) 25.284 Tj +0 -20.9455 Td +(3763 }) 3.612 Tj +0 -22.2545 Td +(3764 ) 3.01 Tj +0 -23.5636 Td +(3765 // Probe to see if disk 1 exists \(we assume disk 0 exists\).) 38.528 Tj +0 -24.8727 Td +(3766 static int) 9.03 Tj +0 -26.1818 Td +(3767 ide_probe_disk1\(void\)) 15.652 Tj +0 -27.4909 Td +(3768 {) 3.612 Tj +0 -28.8 Td +(3769 int r, x;) 9.632 Tj +0 -30.1091 Td +(3770 ) 3.01 Tj +0 -31.4182 Td +(3771 // wait for Device 0 to be ready) 23.478 Tj +0 -32.7273 Td +(3772 ide_wait_ready\(0\);) 15.05 Tj +0 -34.0364 Td +(3773 ) 3.01 Tj +0 -35.3454 Td +(3774 // switch to Device 1) 16.856 Tj +0 -36.6545 Td +(3775 outb\(0x1F6, 0xE0 | \(1<<4\)\);) 20.468 Tj +0 -37.9636 Td +(3776 ) 3.01 Tj +0 -39.2727 Td +(3777 // check for Device 1 to be ready for a while) 31.304 Tj +0 -40.5818 Td +(3778 for\(x = 0; x < 1000 && \(r = inb\(0x1F7\)\) == 0; x++\)) 34.314 Tj +0 -41.8909 Td +(3779 ;) 6.02 Tj +0 -43.2 Td +(3780 ) 3.01 Tj +0 -44.5091 Td +(3781 // switch back to Device 0) 19.866 Tj +0 -45.8182 Td +(3782 outb\(0x1F6, 0xE0 | \(0<<4\)\);) 20.468 Tj +0 -47.1272 Td +(3783 ) 3.01 Tj +0 -48.4363 Td +(3784 return x < 1000;) 13.846 Tj +0 -49.7454 Td +(3785 }) 3.612 Tj +0 -51.0545 Td +(3786 ) 3.01 Tj +0 -52.3636 Td +(3787 // Interrupt handler - wake up the request that just finished.) 40.334 Tj +0 -53.6727 Td +(3788 void) 5.418 Tj +0 -54.9818 Td +(3789 ide_intr\(void\)) 11.438 Tj +0 -56.2909 Td +(3790 {) 3.612 Tj +0 -57.6 Td +(3791 acquire\(&ide_lock\);) 15.652 Tj +0 -58.9091 Td +(3792 wakeup\(&request[tail]\);) 18.06 Tj +0 -60.2181 Td +(3793 release\(&ide_lock\);) 15.652 Tj +0 -61.5272 Td +(3794 }) 3.612 Tj +0 -62.8363 Td +(3795 ) 3.01 Tj +0 -64.1454 Td +(3796 ) 3.01 Tj +0 -65.4545 Td +(3797 ) 3.01 Tj +0 -66.7636 Td +(3798 ) 3.01 Tj +0 -68.0727 Td +(3799 ) 3.01 Tj +0 -72 Td +(Sheet 37) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 45 45 +%%BeginPageSetup +%%PageOrientation: Landscape +pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/ide.c Page 3) 21.672 Tj +0 -3.92728 Td +(3800 // Start the next request in the queue.) 26.488 Tj +0 -5.23637 Td +(3801 static void) 9.632 Tj +0 -6.54546 Td +(3802 ide_start_request \(void\)) 17.458 Tj +0 -7.85455 Td +(3803 {) 3.612 Tj +0 -9.16364 Td +(3804 struct ide_request *r;) 17.458 Tj +0 -10.4727 Td +(3805 ) 3.01 Tj +0 -11.7818 Td +(3806 if\(head != tail\) {) 15.05 Tj +0 -13.0909 Td +(3807 r = &request[tail];) 16.856 Tj +0 -14.4 Td +(3808 ide_wait_ready\(0\);) 16.254 Tj +0 -15.7091 Td +(3809 outb\(0x3f6, 0\); // generate interrupt) 28.294 Tj +0 -17.0182 Td +(3810 outb\(0x1F2, r->nsecs\);) 18.662 Tj +0 -18.3273 Td +(3811 outb\(0x1F3, r->secno & 0xFF\);) 22.876 Tj +0 -19.6364 Td +(3812 outb\(0x1F4, \(r->secno >> 8\) & 0xFF\);) 27.09 Tj +0 -20.9455 Td +(3813 outb\(0x1F5, \(r->secno >> 16\) & 0xFF\);) 27.692 Tj +0 -22.2545 Td +(3814 outb\(0x1F6, 0xE0 | \(\(r->diskno&1\)<<4\) | \(\(r->secno>>24\)&0x0F\)\);) 43.344 Tj +0 -23.5636 Td +(3815 if\(r->read\)) 12.04 Tj +0 -24.8727 Td +(3816 outb\(0x1F7, IDE_CMD_READ\);) 22.274 Tj +0 -26.1818 Td +(3817 else {) 9.03 Tj +0 -27.4909 Td +(3818 outb\(0x1F7, IDE_CMD_WRITE\);) 22.876 Tj +0 -28.8 Td +(3819 outsl\(0x1F0, r->addr, 512/4\);) 24.08 Tj +0 -30.1091 Td +(3820 }) 6.02 Tj +0 -31.4182 Td +(3821 }) 4.816 Tj +0 -32.7273 Td +(3822 }) 3.612 Tj +0 -34.0364 Td +(3823 ) 3.01 Tj +0 -35.3454 Td +(3824 // Run an entire disk operation.) 22.274 Tj +0 -36.6545 Td +(3825 void) 5.418 Tj +0 -37.9636 Td +(3826 ide_rw\(int diskno, uint secno, void *addr, uint nsecs, int read\)) 41.538 Tj +0 -39.2727 Td +(3827 {) 3.612 Tj +0 -40.5818 Td +(3828 struct ide_request *r;) 17.458 Tj +0 -41.8909 Td +(3829 ) 3.01 Tj +0 -43.2 Td +(3830 if\(diskno && !disk_1_present\)) 21.672 Tj +0 -44.5091 Td +(3831 panic\("ide disk 1 not present"\);) 24.682 Tj +0 -45.8182 Td +(3832 ) 3.01 Tj +0 -47.1272 Td +(3833 acquire\(&ide_lock\);) 15.652 Tj +0 -48.4363 Td +(3834 ) 3.01 Tj +0 -49.7454 Td +(3835 // Add request to queue.) 18.662 Tj +0 -51.0545 Td +(3836 while\(\(head + 1\) % NREQUEST == tail\)) 25.886 Tj +0 -52.3636 Td +(3837 sleep\(&disk_queue, &ide_lock\);) 23.478 Tj +0 -53.6727 Td +(3838 ) 3.01 Tj +0 -54.9818 Td +(3839 r = &request[head];) 15.652 Tj +0 -56.2909 Td +(3840 r->secno = secno;) 14.448 Tj +0 -57.6 Td +(3841 r->addr = addr;) 13.244 Tj +0 -58.9091 Td +(3842 r->nsecs = nsecs;) 14.448 Tj +0 -60.2181 Td +(3843 r->diskno = diskno;) 15.652 Tj +0 -61.5272 Td +(3844 r->read = read;) 13.244 Tj +0 -62.8363 Td +(3845 head = \(head + 1\) % NREQUEST;) 21.672 Tj +0 -64.1454 Td +(3846 ) 3.01 Tj +0 -65.4545 Td +(3847 // Start request if necessary.) 22.274 Tj +0 -66.7636 Td +(3848 ide_start_request\(\);) 16.254 Tj +0 -68.0727 Td +(3849 ) 3.01 Tj +0 -72 Td +(Sheet 38) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/ide.c Page 4) 21.672 Tj +0 -3.92728 Td +(3850 // Wait for request to finish.) 22.274 Tj +0 -5.23637 Td +(3851 sleep\(r, &ide_lock\);) 16.254 Tj +0 -6.54546 Td +(3852 ) 3.01 Tj +0 -7.85455 Td +(3853 // Finish request.) 15.05 Tj +0 -9.16364 Td +(3854 if\(read\){) 9.632 Tj +0 -10.4727 Td +(3855 if\(ide_wait_ready\(1\) >= 0\)) 21.07 Tj +0 -11.7818 Td +(3856 insl\(0x1F0, addr, 512/4\);) 21.672 Tj +0 -13.0909 Td +(3857 }) 4.816 Tj +0 -14.4 Td +(3858 ) 3.01 Tj +0 -15.7091 Td +(3859 // Remove request from queue.) 21.672 Tj +0 -17.0182 Td +(3860 if\(\(head + 1\) % NREQUEST == tail\)) 24.08 Tj +0 -18.3273 Td +(3861 wakeup\(&disk_queue\);) 17.458 Tj +0 -19.6364 Td +(3862 tail = \(tail + 1\) % NREQUEST;) 21.672 Tj +0 -20.9455 Td +(3863 ) 3.01 Tj +0 -22.2545 Td +(3864 // Start next request in queue, if any.) 27.692 Tj +0 -23.5636 Td +(3865 ide_start_request\(\);) 16.254 Tj +0 -24.8727 Td +(3866 ) 3.01 Tj +0 -26.1818 Td +(3867 release\(&ide_lock\);) 15.652 Tj +0 -27.4909 Td +(3868 }) 3.612 Tj +0 -28.8 Td +(3869 ) 3.01 Tj +0 -30.1091 Td +(3870 // Synchronous disk write.) 18.662 Tj +0 -31.4182 Td +(3871 int) 4.816 Tj +0 -32.7273 Td +(3872 ide_write\(int diskno, uint secno, const void *src, uint nsecs\)) 40.334 Tj +0 -34.0364 Td +(3873 {) 3.612 Tj +0 -35.3454 Td +(3874 int r;) 7.826 Tj +0 -36.6545 Td +(3875 ) 3.01 Tj +0 -37.9636 Td +(3876 if\(nsecs > 256\)) 13.244 Tj +0 -39.2727 Td +(3877 panic\("ide_write"\);) 16.856 Tj +0 -40.5818 Td +(3878 ) 3.01 Tj +0 -41.8909 Td +(3879 ide_wait_ready\(0\);) 15.05 Tj +0 -43.2 Td +(3880 ) 3.01 Tj +0 -44.5091 Td +(3881 outb\(0x1F2, nsecs\);) 15.652 Tj +0 -45.8182 Td +(3882 outb\(0x1F3, secno & 0xFF\);) 19.866 Tj +0 -47.1272 Td +(3883 outb\(0x1F4, \(secno >> 8\) & 0xFF\);) 24.08 Tj +0 -48.4363 Td +(3884 outb\(0x1F5, \(secno >> 16\) & 0xFF\);) 24.682 Tj +0 -49.7454 Td +(3885 outb\(0x1F6, 0xE0 | \(\(diskno&1\)<<4\) | \(\(secno>>24\)&0x0F\)\);) 38.528 Tj +0 -51.0545 Td +(3886 outb\(0x1F7, 0x30\); // CMD 0x30 means write sector) 35.518 Tj +0 -52.3636 Td +(3887 ) 3.01 Tj +0 -53.6727 Td +(3888 for\(; nsecs > 0; nsecs--, src += 512\) {) 27.692 Tj +0 -54.9818 Td +(3889 if\(\(r = ide_wait_ready\(1\)\) < 0\)) 24.08 Tj +0 -56.2909 Td +(3890 return r;) 12.04 Tj +0 -57.6 Td +(3891 outsl\(0x1F0, src, 512/4\);) 20.468 Tj +0 -58.9091 Td +(3892 }) 4.816 Tj +0 -60.2181 Td +(3893 ) 3.01 Tj +0 -61.5272 Td +(3894 return 0;) 9.632 Tj +0 -62.8363 Td +(3895 }) 3.612 Tj +0 -64.1454 Td +(3896 ) 3.01 Tj +0 -65.4545 Td +(3897 ) 3.01 Tj +0 -66.7636 Td +(3898 ) 3.01 Tj +0 -68.0727 Td +(3899 ) 3.01 Tj +0 -72 Td +(Sheet 38) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 46 46 +%%BeginPageSetup +%%PageOrientation: Landscape +__tumble pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/bio.c Page 1) 21.672 Tj +0 -3.92728 Td +(3900 // Buffer cache.) 12.642 Tj +0 -5.23637 Td +(3901 //) 4.214 Tj +0 -6.54546 Td +(3902 // The buffer cache is a linked list of buf structures) 35.518 Tj +0 -7.85455 Td +(3903 // holding cached copies of disk block contents.) 31.906 Tj +0 -9.16364 Td +(3904 // Each buf has two state bits B_BUSY and B_VALID.) 33.11 Tj +0 -10.4727 Td +(3905 // If B_BUSY is set, it means that some code is currently) 37.324 Tj +0 -11.7818 Td +(3906 // editing buf, so other code is not allowed to look at it.) 38.528 Tj +0 -13.0909 Td +(3907 // To wait for a buffer that is B_BUSY, sleep on buf.) 34.916 Tj +0 -14.4 Td +(3908 // \(See bget below.\)) 15.05 Tj +0 -15.7091 Td +(3909 //) 4.214 Tj +0 -17.0182 Td +(3910 // If B_VALID is set, it means that the memory contents) 36.12 Tj +0 -18.3273 Td +(3911 // have been initialized by reading them off the disk.) 35.518 Tj +0 -19.6364 Td +(3912 // \(Conversely, if B_VALID is not set, the memory contents) 37.926 Tj +0 -20.9455 Td +(3913 // of buf must be initialized, often by calling bread,) 35.518 Tj +0 -22.2545 Td +(3914 // before being used.\)) 16.254 Tj +0 -23.5636 Td +(3915 //) 4.214 Tj +0 -24.8727 Td +(3916 // After making changes to a buf's memory, call bwrite to flush) 40.936 Tj +0 -26.1818 Td +(3917 // the changes out to disk, to keep the disk and memory copies) 40.334 Tj +0 -27.4909 Td +(3918 // in sync.) 9.632 Tj +0 -28.8 Td +(3919 //) 4.214 Tj +0 -30.1091 Td +(3920 // When finished with a buffer, call brelse to release the buffer) 42.14 Tj +0 -31.4182 Td +(3921 // \(i.e., clear B_BUSY\), so that others can access it.) 35.518 Tj +0 -32.7273 Td +(3922 //) 4.214 Tj +0 -34.0364 Td +(3923 // Bufs that are not B_BUSY are fair game for reuse for other) 39.732 Tj +0 -35.3454 Td +(3924 // disk blocks. It is not allowed to use a buf after calling brelse.) 44.548 Tj +0 -36.6545 Td +(3925 ) 3.01 Tj +0 -37.9636 Td +(3926 #include "types.h") 13.846 Tj +0 -39.2727 Td +(3927 #include "param.h") 13.846 Tj +0 -40.5818 Td +(3928 #include "x86.h") 12.642 Tj +0 -41.8909 Td +(3929 #include "mmu.h") 12.642 Tj +0 -43.2 Td +(3930 #include "proc.h") 13.244 Tj +0 -44.5091 Td +(3931 #include "defs.h") 13.244 Tj +0 -45.8182 Td +(3932 #include "spinlock.h") 15.652 Tj +0 -47.1272 Td +(3933 #include "buf.h") 12.642 Tj +0 -48.4363 Td +(3934 ) 3.01 Tj +0 -49.7454 Td +(3935 struct buf buf[NBUF];) 15.652 Tj +0 -51.0545 Td +(3936 struct spinlock buf_table_lock;) 21.672 Tj +0 -52.3636 Td +(3937 ) 3.01 Tj +0 -53.6727 Td +(3938 // Linked list of all buffers, through prev/next.) 32.508 Tj +0 -54.9818 Td +(3939 // bufhead->next is most recently used.) 26.488 Tj +0 -56.2909 Td +(3940 // bufhead->tail is least recently used.) 27.09 Tj +0 -57.6 Td +(3941 struct buf bufhead;) 14.448 Tj +0 -58.9091 Td +(3942 ) 3.01 Tj +0 -60.2181 Td +(3943 void) 5.418 Tj +0 -61.5272 Td +(3944 binit\(void\)) 9.632 Tj +0 -62.8363 Td +(3945 {) 3.612 Tj +0 -64.1454 Td +(3946 struct buf *b;) 12.642 Tj +0 -65.4545 Td +(3947 ) 3.01 Tj +0 -66.7636 Td +(3948 initlock\(&buf_table_lock, "buf_table"\);) 27.692 Tj +0 -68.0727 Td +(3949 ) 3.01 Tj +0 -72 Td +(Sheet 39) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/bio.c Page 2) 21.672 Tj +0 -3.92728 Td +(3950 // Create linked list of buffers) 23.478 Tj +0 -5.23637 Td +(3951 bufhead.prev = &bufhead;) 18.662 Tj +0 -6.54546 Td +(3952 bufhead.next = &bufhead;) 18.662 Tj +0 -7.85455 Td +(3953 for\(b = buf; b < buf+NBUF; b++\){) 23.478 Tj +0 -9.16364 Td +(3954 b->next = bufhead.next;) 19.264 Tj +0 -10.4727 Td +(3955 b->prev = &bufhead;) 16.856 Tj +0 -11.7818 Td +(3956 bufhead.next->prev = b;) 19.264 Tj +0 -13.0909 Td +(3957 bufhead.next = b;) 15.652 Tj +0 -14.4 Td +(3958 }) 4.816 Tj +0 -15.7091 Td +(3959 }) 3.612 Tj +0 -17.0182 Td +(3960 ) 3.01 Tj +0 -18.3273 Td +(3961 // Look through buffer cache for block n on device dev.) 36.12 Tj +0 -19.6364 Td +(3962 // If not found, allocate fresh block.) 25.886 Tj +0 -20.9455 Td +(3963 // In either case, return locked buffer.) 27.09 Tj +0 -22.2545 Td +(3964 static struct buf*) 13.846 Tj +0 -23.5636 Td +(3965 bget\(uint dev, uint sector\)) 19.264 Tj +0 -24.8727 Td +(3966 {) 3.612 Tj +0 -26.1818 Td +(3967 struct buf *b;) 12.642 Tj +0 -27.4909 Td +(3968 ) 3.01 Tj +0 -28.8 Td +(3969 acquire\(&buf_table_lock\);) 19.264 Tj +0 -30.1091 Td +(3970 ) 3.01 Tj +0 -31.4182 Td +(3971 for\(;;\){) 9.03 Tj +0 -32.7273 Td +(3972 for\(b = bufhead.next; b != &bufhead; b = b->next\)) 34.916 Tj +0 -34.0364 Td +(3973 if\(\(b->flags & \(B_BUSY|B_VALID\)\) &&) 27.692 Tj +0 -35.3454 Td +(3974 b->dev == dev && b->sector == sector\)) 30.702 Tj +0 -36.6545 Td +(3975 break;) 11.438 Tj +0 -37.9636 Td +(3976 ) 3.01 Tj +0 -39.2727 Td +(3977 if\(b != &bufhead\){) 16.254 Tj +0 -40.5818 Td +(3978 if\(b->flags & B_BUSY\){) 19.866 Tj +0 -41.8909 Td +(3979 sleep\(buf, &buf_table_lock\);) 24.682 Tj +0 -43.2 Td +(3980 } else {) 11.438 Tj +0 -44.5091 Td +(3981 b->flags |= B_BUSY;) 19.264 Tj +0 -45.8182 Td +(3982 // b->flags &= ~B_VALID; // Force reread from disk) 37.926 Tj +0 -47.1272 Td +(3983 release\(&buf_table_lock\);) 22.876 Tj +0 -48.4363 Td +(3984 return b;) 13.244 Tj +0 -49.7454 Td +(3985 }) 7.224 Tj +0 -51.0545 Td +(3986 } else {) 10.234 Tj +0 -52.3636 Td +(3987 for\(b = bufhead.prev; b != &bufhead; b = b->prev\){) 36.722 Tj +0 -53.6727 Td +(3988 if\(\(b->flags & B_BUSY\) == 0\){) 25.284 Tj +0 -54.9818 Td +(3989 b->flags = B_BUSY;) 19.866 Tj +0 -56.2909 Td +(3990 b->dev = dev;) 16.856 Tj +0 -57.6 Td +(3991 b->sector = sector;) 20.468 Tj +0 -58.9091 Td +(3992 release\(&buf_table_lock\);) 24.08 Tj +0 -60.2181 Td +(3993 return b;) 14.448 Tj +0 -61.5272 Td +(3994 }) 8.428 Tj +0 -62.8363 Td +(3995 }) 7.224 Tj +0 -64.1454 Td +(3996 panic\("bget: no buffers"\);) 22.274 Tj +0 -65.4545 Td +(3997 }) 6.02 Tj +0 -66.7636 Td +(3998 }) 4.816 Tj +0 -68.0727 Td +(3999 }) 3.612 Tj +0 -72 Td +(Sheet 39) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 47 47 +%%BeginPageSetup +%%PageOrientation: Landscape +pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/bio.c Page 3) 21.672 Tj +0 -3.92728 Td +(4000 // Read buf's contents from disk.) 22.876 Tj +0 -5.23637 Td +(4001 struct buf*) 9.632 Tj +0 -6.54546 Td +(4002 bread\(uint dev, uint sector\)) 19.866 Tj +0 -7.85455 Td +(4003 {) 3.612 Tj +0 -9.16364 Td +(4004 struct buf *b;) 12.642 Tj +0 -10.4727 Td +(4005 ) 3.01 Tj +0 -11.7818 Td +(4006 b = bget\(dev, sector\);) 17.458 Tj +0 -13.0909 Td +(4007 if\(b->flags & B_VALID\)) 17.458 Tj +0 -14.4 Td +(4008 return b;) 10.836 Tj +0 -15.7091 Td +(4009 ) 3.01 Tj +0 -17.0182 Td +(4010 ide_rw\(dev & 0xff, sector, b->data, 1, 1\);) 29.498 Tj +0 -18.3273 Td +(4011 b->flags |= B_VALID;) 16.254 Tj +0 -19.6364 Td +(4012 ) 3.01 Tj +0 -20.9455 Td +(4013 return b;) 9.632 Tj +0 -22.2545 Td +(4014 }) 3.612 Tj +0 -23.5636 Td +(4015 ) 3.01 Tj +0 -24.8727 Td +(4016 // Write buf's contents to disk.) 22.274 Tj +0 -26.1818 Td +(4017 // Must be locked.) 13.846 Tj +0 -27.4909 Td +(4018 void) 5.418 Tj +0 -28.8 Td +(4019 bwrite\(struct buf *b, uint sector\)) 23.478 Tj +0 -30.1091 Td +(4020 {) 3.612 Tj +0 -31.4182 Td +(4021 if\(\(b->flags & B_BUSY\) == 0\)) 21.07 Tj +0 -32.7273 Td +(4022 panic\("bwrite"\);) 15.05 Tj +0 -34.0364 Td +(4023 ) 3.01 Tj +0 -35.3454 Td +(4024 ide_rw\(b->dev & 0xff, sector, b->data, 1, 0\);) 31.304 Tj +0 -36.6545 Td +(4025 b->flags |= B_VALID;) 16.254 Tj +0 -37.9636 Td +(4026 }) 3.612 Tj +0 -39.2727 Td +(4027 ) 3.01 Tj +0 -40.5818 Td +(4028 // Release the buffer buf.) 18.662 Tj +0 -41.8909 Td +(4029 void) 5.418 Tj +0 -43.2 Td +(4030 brelse\(struct buf *b\)) 15.652 Tj +0 -44.5091 Td +(4031 {) 3.612 Tj +0 -45.8182 Td +(4032 if\(\(b->flags & B_BUSY\) == 0\)) 21.07 Tj +0 -47.1272 Td +(4033 panic\("brelse"\);) 15.05 Tj +0 -48.4363 Td +(4034 ) 3.01 Tj +0 -49.7454 Td +(4035 acquire\(&buf_table_lock\);) 19.264 Tj +0 -51.0545 Td +(4036 ) 3.01 Tj +0 -52.3636 Td +(4037 b->next->prev = b->prev;) 18.662 Tj +0 -53.6727 Td +(4038 b->prev->next = b->next;) 18.662 Tj +0 -54.9818 Td +(4039 b->next = bufhead.next;) 18.06 Tj +0 -56.2909 Td +(4040 b->prev = &bufhead;) 15.652 Tj +0 -57.6 Td +(4041 bufhead.next->prev = b;) 18.06 Tj +0 -58.9091 Td +(4042 bufhead.next = b;) 14.448 Tj +0 -60.2181 Td +(4043 ) 3.01 Tj +0 -61.5272 Td +(4044 b->flags &= ~B_BUSY;) 16.254 Tj +0 -62.8363 Td +(4045 wakeup\(buf\);) 11.438 Tj +0 -64.1454 Td +(4046 ) 3.01 Tj +0 -65.4545 Td +(4047 release\(&buf_table_lock\);) 19.264 Tj +0 -66.7636 Td +(4048 }) 3.612 Tj +0 -68.0727 Td +(4049 ) 3.01 Tj +0 -72 Td +(Sheet 40) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/fs.c Page 1) 21.07 Tj +0 -3.92728 Td +(4050 #include "types.h") 13.846 Tj +0 -5.23637 Td +(4051 #include "stat.h") 13.244 Tj +0 -6.54546 Td +(4052 #include "param.h") 13.846 Tj +0 -7.85455 Td +(4053 #include "x86.h") 12.642 Tj +0 -9.16364 Td +(4054 #include "mmu.h") 12.642 Tj +0 -10.4727 Td +(4055 #include "proc.h") 13.244 Tj +0 -11.7818 Td +(4056 #include "defs.h") 13.244 Tj +0 -13.0909 Td +(4057 #include "spinlock.h") 15.652 Tj +0 -14.4 Td +(4058 #include "buf.h") 12.642 Tj +0 -15.7091 Td +(4059 #include "fs.h") 12.04 Tj +0 -17.0182 Td +(4060 #include "fsvar.h") 13.846 Tj +0 -18.3273 Td +(4061 #include "dev.h") 12.642 Tj +0 -19.6364 Td +(4062 ) 3.01 Tj +0 -20.9455 Td +(4063 // Inode table. The inode table is an in-memory cache of the) 39.732 Tj +0 -22.2545 Td +(4064 // on-disk inode structures. If an inode in the table has a non-zero) 44.548 Tj +0 -23.5636 Td +(4065 // reference count, then some open files refer to it and it must stay) 44.548 Tj +0 -24.8727 Td +(4066 // in memory. If an inode has a zero reference count, it is only in) 43.946 Tj +0 -26.1818 Td +(4067 // memory as a cache in hopes of being used again \(avoiding a disk read\).) 46.956 Tj +0 -27.4909 Td +(4068 // Any inode with reference count zero can be evicted from the table.) 44.548 Tj +0 -28.8 Td +(4069 //) 4.214 Tj +0 -30.1091 Td +(4070 // In addition to having a reference count, inodes can be marked busy) 44.548 Tj +0 -31.4182 Td +(4071 // \(just like bufs\), meaning that some code has logically locked the) 43.946 Tj +0 -32.7273 Td +(4072 // inode, and others are not allowed to look at it.) 33.712 Tj +0 -34.0364 Td +(4073 // This locking can last for a long) 24.08 Tj +0 -35.3454 Td +(4074 // time \(for example, if the inode is busy during a disk access\),) 42.14 Tj +0 -36.6545 Td +(4075 // so we don't use spin locks. Instead, if a process wants to use) 42.742 Tj +0 -37.9636 Td +(4076 // a particular inode, it must sleep\(ip\) to wait for it to be not busy.) 45.752 Tj +0 -39.2727 Td +(4077 // See iget below.) 13.846 Tj +0 -40.5818 Td +(4078 struct inode inode[NINODE];) 19.264 Tj +0 -41.8909 Td +(4079 struct spinlock inode_table_lock;) 22.876 Tj +0 -43.2 Td +(4080 ) 3.01 Tj +0 -44.5091 Td +(4081 uint rootdev = 1;) 13.244 Tj +0 -45.8182 Td +(4082 ) 3.01 Tj +0 -47.1272 Td +(4083 void) 5.418 Tj +0 -48.4363 Td +(4084 iinit\(void\)) 9.632 Tj +0 -49.7454 Td +(4085 {) 3.612 Tj +0 -51.0545 Td +(4086 initlock\(&inode_table_lock, "inode_table"\);) 30.1 Tj +0 -52.3636 Td +(4087 }) 3.612 Tj +0 -53.6727 Td +(4088 ) 3.01 Tj +0 -54.9818 Td +(4089 ) 3.01 Tj +0 -56.2909 Td +(4090 ) 3.01 Tj +0 -57.6 Td +(4091 ) 3.01 Tj +0 -58.9091 Td +(4092 ) 3.01 Tj +0 -60.2181 Td +(4093 ) 3.01 Tj +0 -61.5272 Td +(4094 ) 3.01 Tj +0 -62.8363 Td +(4095 ) 3.01 Tj +0 -64.1454 Td +(4096 ) 3.01 Tj +0 -65.4545 Td +(4097 ) 3.01 Tj +0 -66.7636 Td +(4098 ) 3.01 Tj +0 -68.0727 Td +(4099 ) 3.01 Tj +0 -72 Td +(Sheet 40) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 48 48 +%%BeginPageSetup +%%PageOrientation: Landscape +__tumble pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/fs.c Page 2) 21.07 Tj +0 -3.92728 Td +(4100 // Allocate a disk block.) 18.06 Tj +0 -5.23637 Td +(4101 static uint) 9.632 Tj +0 -6.54546 Td +(4102 balloc\(uint dev\)) 12.642 Tj +0 -7.85455 Td +(4103 {) 3.612 Tj +0 -9.16364 Td +(4104 int b;) 7.826 Tj +0 -10.4727 Td +(4105 struct buf *bp;) 13.244 Tj +0 -11.7818 Td +(4106 struct superblock *sb;) 17.458 Tj +0 -13.0909 Td +(4107 int bi = 0;) 10.836 Tj +0 -14.4 Td +(4108 int size;) 9.632 Tj +0 -15.7091 Td +(4109 int ninodes;) 11.438 Tj +0 -17.0182 Td +(4110 uchar m;) 9.03 Tj +0 -18.3273 Td +(4111 ) 3.01 Tj +0 -19.6364 Td +(4112 bp = bread\(dev, 1\);) 15.652 Tj +0 -20.9455 Td +(4113 sb = \(struct superblock*\) bp->data;) 25.284 Tj +0 -22.2545 Td +(4114 size = sb->size;) 13.846 Tj +0 -23.5636 Td +(4115 ninodes = sb->ninodes;) 17.458 Tj +0 -24.8727 Td +(4116 ) 3.01 Tj +0 -26.1818 Td +(4117 for\(b = 0; b < size; b++\) {) 20.468 Tj +0 -27.4909 Td +(4118 if\(b % BPB == 0\) {) 16.254 Tj +0 -28.8 Td +(4119 brelse\(bp\);) 13.244 Tj +0 -30.1091 Td +(4120 bp = bread\(dev, BBLOCK\(b, ninodes\)\);) 28.294 Tj +0 -31.4182 Td +(4121 }) 6.02 Tj +0 -32.7273 Td +(4122 bi = b % BPB;) 13.244 Tj +0 -34.0364 Td +(4123 m = 0x1 << \(bi % 8\);) 17.458 Tj +0 -35.3454 Td +(4124 if\(\(bp->data[bi/8] & m\) == 0\) { // is block free?) 35.518 Tj +0 -36.6545 Td +(4125 break;) 10.234 Tj +0 -37.9636 Td +(4126 }) 6.02 Tj +0 -39.2727 Td +(4127 }) 4.816 Tj +0 -40.5818 Td +(4128 if\(b >= size\)) 12.04 Tj +0 -41.8909 Td +(4129 panic\("balloc: out of blocks"\);) 24.08 Tj +0 -43.2 Td +(4130 ) 3.01 Tj +0 -44.5091 Td +(4131 bp->data[bi/8] |= 0x1 << \(bi % 8\);) 24.682 Tj +0 -45.8182 Td +(4132 bwrite\(bp, BBLOCK\(b, ninodes\)\); // mark it allocated on disk) 40.936 Tj +0 -47.1272 Td +(4133 brelse\(bp\);) 10.836 Tj +0 -48.4363 Td +(4134 return b;) 9.632 Tj +0 -49.7454 Td +(4135 }) 3.612 Tj +0 -51.0545 Td +(4136 ) 3.01 Tj +0 -52.3636 Td +(4137 ) 3.01 Tj +0 -53.6727 Td +(4138 ) 3.01 Tj +0 -54.9818 Td +(4139 ) 3.01 Tj +0 -56.2909 Td +(4140 ) 3.01 Tj +0 -57.6 Td +(4141 ) 3.01 Tj +0 -58.9091 Td +(4142 ) 3.01 Tj +0 -60.2181 Td +(4143 ) 3.01 Tj +0 -61.5272 Td +(4144 ) 3.01 Tj +0 -62.8363 Td +(4145 ) 3.01 Tj +0 -64.1454 Td +(4146 ) 3.01 Tj +0 -65.4545 Td +(4147 ) 3.01 Tj +0 -66.7636 Td +(4148 ) 3.01 Tj +0 -68.0727 Td +(4149 ) 3.01 Tj +0 -72 Td +(Sheet 41) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/fs.c Page 3) 21.07 Tj +0 -3.92728 Td +(4150 // Free a disk block.) 15.652 Tj +0 -5.23637 Td +(4151 static void) 9.632 Tj +0 -6.54546 Td +(4152 bfree\(int dev, uint b\)) 16.254 Tj +0 -7.85455 Td +(4153 {) 3.612 Tj +0 -9.16364 Td +(4154 struct buf *bp;) 13.244 Tj +0 -10.4727 Td +(4155 struct superblock *sb;) 17.458 Tj +0 -11.7818 Td +(4156 int bi;) 8.428 Tj +0 -13.0909 Td +(4157 int ninodes;) 11.438 Tj +0 -14.4 Td +(4158 uchar m;) 9.03 Tj +0 -15.7091 Td +(4159 ) 3.01 Tj +0 -17.0182 Td +(4160 bp = bread\(dev, 1\);) 15.652 Tj +0 -18.3273 Td +(4161 sb = \(struct superblock*\) bp->data;) 25.284 Tj +0 -19.6364 Td +(4162 ninodes = sb->ninodes;) 17.458 Tj +0 -20.9455 Td +(4163 brelse\(bp\);) 10.836 Tj +0 -22.2545 Td +(4164 ) 3.01 Tj +0 -23.5636 Td +(4165 bp = bread\(dev, b\);) 15.652 Tj +0 -24.8727 Td +(4166 memset\(bp->data, 0, BSIZE\);) 20.468 Tj +0 -26.1818 Td +(4167 bwrite\(bp, b\);) 12.642 Tj +0 -27.4909 Td +(4168 brelse\(bp\);) 10.836 Tj +0 -28.8 Td +(4169 ) 3.01 Tj +0 -30.1091 Td +(4170 bp = bread\(dev, BBLOCK\(b, ninodes\)\);) 25.886 Tj +0 -31.4182 Td +(4171 bi = b % BPB;) 12.04 Tj +0 -32.7273 Td +(4172 m = ~\(0x1 << \(bi %8\)\);) 17.458 Tj +0 -34.0364 Td +(4173 bp->data[bi/8] &= m;) 16.254 Tj +0 -35.3454 Td +(4174 bwrite\(bp, BBLOCK\(b, ninodes\)\); // mark it free on disk) 37.926 Tj +0 -36.6545 Td +(4175 brelse\(bp\);) 10.836 Tj +0 -37.9636 Td +(4176 }) 3.612 Tj +0 -39.2727 Td +(4177 ) 3.01 Tj +0 -40.5818 Td +(4178 // Find the inode with number inum on device dev) 31.906 Tj +0 -41.8909 Td +(4179 // and return an in-memory copy. Loads the inode) 32.508 Tj +0 -43.2 Td +(4180 // from disk into the in-core table if necessary.) 32.508 Tj +0 -44.5091 Td +(4181 // The returned inode has busy set and has its ref count incremented.) 44.548 Tj +0 -45.8182 Td +(4182 // Caller must iput the return value when done with it.) 36.12 Tj +0 -47.1272 Td +(4183 struct inode*) 10.836 Tj +0 -48.4363 Td +(4184 iget\(uint dev, uint inum\)) 18.06 Tj +0 -49.7454 Td +(4185 {) 3.612 Tj +0 -51.0545 Td +(4186 struct inode *ip, *nip;) 18.06 Tj +0 -52.3636 Td +(4187 struct dinode *dip;) 15.652 Tj +0 -53.6727 Td +(4188 struct buf *bp;) 13.244 Tj +0 -54.9818 Td +(4189 ) 3.01 Tj +0 -56.2909 Td +(4190 acquire\(&inode_table_lock\);) 20.468 Tj +0 -57.6 Td +(4191 ) 3.01 Tj +0 -58.9091 Td +(4192 loop:) 6.622 Tj +0 -60.2181 Td +(4193 nip = 0;) 9.03 Tj +0 -61.5272 Td +(4194 for\(ip = &inode[0]; ip < &inode[NINODE]; ip++\){) 32.508 Tj +0 -62.8363 Td +(4195 if\(ip->ref > 0 && ip->dev == dev && ip->inum == inum\){) 37.926 Tj +0 -64.1454 Td +(4196 if\(ip->busy\){) 14.448 Tj +0 -65.4545 Td +(4197 sleep\(ip, &inode_table_lock\);) 25.284 Tj +0 -66.7636 Td +(4198 // Since we droped inode_table_lock, ip might have been reused) 45.15 Tj +0 -68.0727 Td +(4199 // for some other inode entirely. Must start the scan over,) 43.946 Tj +0 -72 Td +(Sheet 41) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 49 49 +%%BeginPageSetup +%%PageOrientation: Landscape +pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/fs.c Page 4) 21.07 Tj +0 -3.92728 Td +(4200 // and hopefully this time we will find the inode we want) 42.14 Tj +0 -5.23637 Td +(4201 // and it will not be busy.) 24.08 Tj +0 -6.54546 Td +(4202 goto loop;) 13.846 Tj +0 -7.85455 Td +(4203 }) 7.224 Tj +0 -9.16364 Td +(4204 ip->ref++;) 12.642 Tj +0 -10.4727 Td +(4205 ip->busy = 1;) 14.448 Tj +0 -11.7818 Td +(4206 release\(&inode_table_lock\);) 22.876 Tj +0 -13.0909 Td +(4207 return ip;) 12.642 Tj +0 -14.4 Td +(4208 }) 6.02 Tj +0 -15.7091 Td +(4209 if\(nip == 0 && ip->ref == 0\)) 22.274 Tj +0 -17.0182 Td +(4210 nip = ip;) 12.04 Tj +0 -18.3273 Td +(4211 }) 4.816 Tj +0 -19.6364 Td +(4212 ) 3.01 Tj +0 -20.9455 Td +(4213 if\(nip == 0\)) 11.438 Tj +0 -22.2545 Td +(4214 panic\("out of inodes"\);) 19.264 Tj +0 -23.5636 Td +(4215 ) 3.01 Tj +0 -24.8727 Td +(4216 nip->dev = dev;) 13.244 Tj +0 -26.1818 Td +(4217 nip->inum = inum;) 14.448 Tj +0 -27.4909 Td +(4218 nip->ref = 1;) 12.04 Tj +0 -28.8 Td +(4219 nip->busy = 1;) 12.642 Tj +0 -30.1091 Td +(4220 ) 3.01 Tj +0 -31.4182 Td +(4221 release\(&inode_table_lock\);) 20.468 Tj +0 -32.7273 Td +(4222 ) 3.01 Tj +0 -34.0364 Td +(4223 bp = bread\(dev, IBLOCK\(inum\)\);) 22.274 Tj +0 -35.3454 Td +(4224 dip = &\(\(struct dinode*\)\(bp->data\)\)[inum % IPB];) 33.11 Tj +0 -36.6545 Td +(4225 nip->type = dip->type;) 17.458 Tj +0 -37.9636 Td +(4226 nip->major = dip->major;) 18.662 Tj +0 -39.2727 Td +(4227 nip->minor = dip->minor;) 18.662 Tj +0 -40.5818 Td +(4228 nip->nlink = dip->nlink;) 18.662 Tj +0 -41.8909 Td +(4229 nip->size = dip->size;) 17.458 Tj +0 -43.2 Td +(4230 memmove\(nip->addrs, dip->addrs, sizeof\(nip->addrs\)\);) 35.518 Tj +0 -44.5091 Td +(4231 brelse\(bp\);) 10.836 Tj +0 -45.8182 Td +(4232 ) 3.01 Tj +0 -47.1272 Td +(4233 return nip;) 10.836 Tj +0 -48.4363 Td +(4234 }) 3.612 Tj +0 -49.7454 Td +(4235 ) 3.01 Tj +0 -51.0545 Td +(4236 ) 3.01 Tj +0 -52.3636 Td +(4237 ) 3.01 Tj +0 -53.6727 Td +(4238 ) 3.01 Tj +0 -54.9818 Td +(4239 ) 3.01 Tj +0 -56.2909 Td +(4240 ) 3.01 Tj +0 -57.6 Td +(4241 ) 3.01 Tj +0 -58.9091 Td +(4242 ) 3.01 Tj +0 -60.2181 Td +(4243 ) 3.01 Tj +0 -61.5272 Td +(4244 ) 3.01 Tj +0 -62.8363 Td +(4245 ) 3.01 Tj +0 -64.1454 Td +(4246 ) 3.01 Tj +0 -65.4545 Td +(4247 ) 3.01 Tj +0 -66.7636 Td +(4248 ) 3.01 Tj +0 -68.0727 Td +(4249 ) 3.01 Tj +0 -72 Td +(Sheet 42) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/fs.c Page 5) 21.07 Tj +0 -3.92728 Td +(4250 // Copy inode in memory, which has changed, to disk.) 34.314 Tj +0 -5.23637 Td +(4251 // Caller must have locked ip.) 21.07 Tj +0 -6.54546 Td +(4252 void) 5.418 Tj +0 -7.85455 Td +(4253 iupdate\(struct inode *ip\)) 18.06 Tj +0 -9.16364 Td +(4254 {) 3.612 Tj +0 -10.4727 Td +(4255 struct buf *bp;) 13.244 Tj +0 -11.7818 Td +(4256 struct dinode *dip;) 15.652 Tj +0 -13.0909 Td +(4257 ) 3.01 Tj +0 -14.4 Td +(4258 bp = bread\(ip->dev, IBLOCK\(ip->inum\)\);) 27.09 Tj +0 -15.7091 Td +(4259 dip = &\(\(struct dinode*\)\(bp->data\)\)[ip->inum % IPB];) 35.518 Tj +0 -17.0182 Td +(4260 dip->type = ip->type;) 16.856 Tj +0 -18.3273 Td +(4261 dip->major = ip->major;) 18.06 Tj +0 -19.6364 Td +(4262 dip->minor = ip->minor;) 18.06 Tj +0 -20.9455 Td +(4263 dip->nlink = ip->nlink;) 18.06 Tj +0 -22.2545 Td +(4264 dip->size = ip->size;) 16.856 Tj +0 -23.5636 Td +(4265 memmove\(dip->addrs, ip->addrs, sizeof\(ip->addrs\)\);) 34.314 Tj +0 -24.8727 Td +(4266 bwrite\(bp, IBLOCK\(ip->inum\)\); // mark it allocated on the disk) 42.742 Tj +0 -26.1818 Td +(4267 brelse\(bp\);) 10.836 Tj +0 -27.4909 Td +(4268 }) 3.612 Tj +0 -28.8 Td +(4269 ) 3.01 Tj +0 -30.1091 Td +(4270 // Allocate a new inode with the given type) 28.896 Tj +0 -31.4182 Td +(4271 // from the file system on device dev.) 25.886 Tj +0 -32.7273 Td +(4272 struct inode*) 10.836 Tj +0 -34.0364 Td +(4273 ialloc\(uint dev, short type\)) 19.866 Tj +0 -35.3454 Td +(4274 {) 3.612 Tj +0 -36.6545 Td +(4275 struct inode *ip;) 14.448 Tj +0 -37.9636 Td +(4276 struct dinode *dip = 0;) 18.06 Tj +0 -39.2727 Td +(4277 struct superblock *sb;) 17.458 Tj +0 -40.5818 Td +(4278 int ninodes;) 11.438 Tj +0 -41.8909 Td +(4279 int inum;) 9.632 Tj +0 -43.2 Td +(4280 struct buf *bp;) 13.244 Tj +0 -44.5091 Td +(4281 ) 3.01 Tj +0 -45.8182 Td +(4282 bp = bread\(dev, 1\);) 15.652 Tj +0 -47.1272 Td +(4283 sb = \(struct superblock*\) bp->data;) 25.284 Tj +0 -48.4363 Td +(4284 ninodes = sb->ninodes;) 17.458 Tj +0 -49.7454 Td +(4285 brelse\(bp\);) 10.836 Tj +0 -51.0545 Td +(4286 ) 3.01 Tj +0 -52.3636 Td +(4287 for\(inum = 1; inum < ninodes; inum++\) { // loop over inode blocks) 43.946 Tj +0 -53.6727 Td +(4288 bp = bread\(dev, IBLOCK\(inum\)\);) 23.478 Tj +0 -54.9818 Td +(4289 dip = &\(\(struct dinode*\)\(bp->data\)\)[inum % IPB];) 34.314 Tj +0 -56.2909 Td +(4290 if\(dip->type == 0\) { // a free inode) 27.692 Tj +0 -57.6 Td +(4291 break;) 10.234 Tj +0 -58.9091 Td +(4292 }) 6.02 Tj +0 -60.2181 Td +(4293 brelse\(bp\);) 12.04 Tj +0 -61.5272 Td +(4294 }) 4.816 Tj +0 -62.8363 Td +(4295 ) 3.01 Tj +0 -64.1454 Td +(4296 if\(inum >= ninodes\)) 15.652 Tj +0 -65.4545 Td +(4297 panic\("ialloc: no inodes left"\);) 24.682 Tj +0 -66.7636 Td +(4298 ) 3.01 Tj +0 -68.0727 Td +(4299 ) 3.01 Tj +0 -72 Td +(Sheet 42) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 50 50 +%%BeginPageSetup +%%PageOrientation: Landscape +__tumble pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/fs.c Page 6) 21.07 Tj +0 -3.92728 Td +(4300 memset\(dip, 0, sizeof\(*dip\)\);) 21.672 Tj +0 -5.23637 Td +(4301 dip->type = type;) 14.448 Tj +0 -6.54546 Td +(4302 bwrite\(bp, IBLOCK\(inum\)\); // mark it allocated on the disk) 40.334 Tj +0 -7.85455 Td +(4303 brelse\(bp\);) 10.836 Tj +0 -9.16364 Td +(4304 ip = iget\(dev, inum\);) 16.856 Tj +0 -10.4727 Td +(4305 return ip;) 10.234 Tj +0 -11.7818 Td +(4306 }) 3.612 Tj +0 -13.0909 Td +(4307 ) 3.01 Tj +0 -14.4 Td +(4308 // Free the given inode from its file system.) 30.1 Tj +0 -15.7091 Td +(4309 static void) 9.632 Tj +0 -17.0182 Td +(4310 ifree\(struct inode *ip\)) 16.856 Tj +0 -18.3273 Td +(4311 {) 3.612 Tj +0 -19.6364 Td +(4312 ip->type = 0;) 12.04 Tj +0 -20.9455 Td +(4313 iupdate\(ip\);) 11.438 Tj +0 -22.2545 Td +(4314 }) 3.612 Tj +0 -23.5636 Td +(4315 ) 3.01 Tj +0 -24.8727 Td +(4316 // Lock the given inode \(wait for it to be not busy,) 34.314 Tj +0 -26.1818 Td +(4317 // and then ip->busy\).) 16.254 Tj +0 -27.4909 Td +(4318 // Caller must already hold a reference to ip.) 30.702 Tj +0 -28.8 Td +(4319 // Otherwise, if all the references to ip go away,) 33.11 Tj +0 -30.1091 Td +(4320 // it might be reused underfoot.) 22.274 Tj +0 -31.4182 Td +(4321 void) 5.418 Tj +0 -32.7273 Td +(4322 ilock\(struct inode *ip\)) 16.856 Tj +0 -34.0364 Td +(4323 {) 3.612 Tj +0 -35.3454 Td +(4324 if\(ip->ref < 1\)) 13.244 Tj +0 -36.6545 Td +(4325 panic\("ilock"\);) 14.448 Tj +0 -37.9636 Td +(4326 ) 3.01 Tj +0 -39.2727 Td +(4327 acquire\(&inode_table_lock\);) 20.468 Tj +0 -40.5818 Td +(4328 ) 3.01 Tj +0 -41.8909 Td +(4329 while\(ip->busy\)) 13.244 Tj +0 -43.2 Td +(4330 sleep\(ip, &inode_table_lock\);) 22.876 Tj +0 -44.5091 Td +(4331 ip->busy = 1;) 12.04 Tj +0 -45.8182 Td +(4332 ) 3.01 Tj +0 -47.1272 Td +(4333 release\(&inode_table_lock\);) 20.468 Tj +0 -48.4363 Td +(4334 }) 3.612 Tj +0 -49.7454 Td +(4335 ) 3.01 Tj +0 -51.0545 Td +(4336 ) 3.01 Tj +0 -52.3636 Td +(4337 ) 3.01 Tj +0 -53.6727 Td +(4338 ) 3.01 Tj +0 -54.9818 Td +(4339 ) 3.01 Tj +0 -56.2909 Td +(4340 ) 3.01 Tj +0 -57.6 Td +(4341 ) 3.01 Tj +0 -58.9091 Td +(4342 ) 3.01 Tj +0 -60.2181 Td +(4343 ) 3.01 Tj +0 -61.5272 Td +(4344 ) 3.01 Tj +0 -62.8363 Td +(4345 ) 3.01 Tj +0 -64.1454 Td +(4346 ) 3.01 Tj +0 -65.4545 Td +(4347 ) 3.01 Tj +0 -66.7636 Td +(4348 ) 3.01 Tj +0 -68.0727 Td +(4349 ) 3.01 Tj +0 -72 Td +(Sheet 43) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/fs.c Page 7) 21.07 Tj +0 -3.92728 Td +(4350 // Caller holds reference to ip and has locked it.) 33.11 Tj +0 -5.23637 Td +(4351 // Caller no longer needs to examine / change it.) 32.508 Tj +0 -6.54546 Td +(4352 // Unlock it, but keep the reference.) 25.284 Tj +0 -7.85455 Td +(4353 void) 5.418 Tj +0 -9.16364 Td +(4354 iunlock\(struct inode *ip\)) 18.06 Tj +0 -10.4727 Td +(4355 {) 3.612 Tj +0 -11.7818 Td +(4356 if\(ip->busy != 1 || ip->ref < 1\)) 23.478 Tj +0 -13.0909 Td +(4357 panic\("iunlock"\);) 15.652 Tj +0 -14.4 Td +(4358 ) 3.01 Tj +0 -15.7091 Td +(4359 acquire\(&inode_table_lock\);) 20.468 Tj +0 -17.0182 Td +(4360 ) 3.01 Tj +0 -18.3273 Td +(4361 ip->busy = 0;) 12.04 Tj +0 -19.6364 Td +(4362 wakeup\(ip\);) 10.836 Tj +0 -20.9455 Td +(4363 ) 3.01 Tj +0 -22.2545 Td +(4364 release\(&inode_table_lock\);) 20.468 Tj +0 -23.5636 Td +(4365 }) 3.612 Tj +0 -24.8727 Td +(4366 ) 3.01 Tj +0 -26.1818 Td +(4367 // Return the disk block address of the nth block in inode ip.) 40.334 Tj +0 -27.4909 Td +(4368 uint) 5.418 Tj +0 -28.8 Td +(4369 bmap\(struct inode *ip, uint bn\)) 21.672 Tj +0 -30.1091 Td +(4370 {) 3.612 Tj +0 -31.4182 Td +(4371 unsigned x;) 10.836 Tj +0 -32.7273 Td +(4372 uint *a;) 9.03 Tj +0 -34.0364 Td +(4373 struct buf *inbp;) 14.448 Tj +0 -35.3454 Td +(4374 ) 3.01 Tj +0 -36.6545 Td +(4375 if\(bn >= MAXFILE\)) 14.448 Tj +0 -37.9636 Td +(4376 panic\("bmap 1"\);) 15.05 Tj +0 -39.2727 Td +(4377 if\(bn < NDIRECT\) {) 15.05 Tj +0 -40.5818 Td +(4378 x = ip->addrs[bn];) 16.254 Tj +0 -41.8909 Td +(4379 if\(x == 0\)) 11.438 Tj +0 -43.2 Td +(4380 panic\("bmap 2"\);) 16.254 Tj +0 -44.5091 Td +(4381 } else {) 9.03 Tj +0 -45.8182 Td +(4382 if\(ip->addrs[INDIRECT] == 0\)) 22.274 Tj +0 -47.1272 Td +(4383 panic\("bmap 3"\);) 16.254 Tj +0 -48.4363 Td +(4384 inbp = bread\(ip->dev, ip->addrs[INDIRECT]\);) 31.304 Tj +0 -49.7454 Td +(4385 a = \(uint*\) inbp->data;) 19.264 Tj +0 -51.0545 Td +(4386 x = a[bn - NDIRECT];) 17.458 Tj +0 -52.3636 Td +(4387 brelse\(inbp\);) 13.244 Tj +0 -53.6727 Td +(4388 if\(x == 0\)) 11.438 Tj +0 -54.9818 Td +(4389 panic\("bmap 4"\);) 16.254 Tj +0 -56.2909 Td +(4390 }) 4.816 Tj +0 -57.6 Td +(4391 return x;) 9.632 Tj +0 -58.9091 Td +(4392 }) 3.612 Tj +0 -60.2181 Td +(4393 ) 3.01 Tj +0 -61.5272 Td +(4394 ) 3.01 Tj +0 -62.8363 Td +(4395 ) 3.01 Tj +0 -64.1454 Td +(4396 ) 3.01 Tj +0 -65.4545 Td +(4397 ) 3.01 Tj +0 -66.7636 Td +(4398 ) 3.01 Tj +0 -68.0727 Td +(4399 ) 3.01 Tj +0 -72 Td +(Sheet 43) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 51 51 +%%BeginPageSetup +%%PageOrientation: Landscape +pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/fs.c Page 8) 21.07 Tj +0 -3.92728 Td +(4400 // Truncate the inode ip, discarding all its data blocks.) 37.324 Tj +0 -5.23637 Td +(4401 void) 5.418 Tj +0 -6.54546 Td +(4402 itrunc\(struct inode *ip\)) 17.458 Tj +0 -7.85455 Td +(4403 {) 3.612 Tj +0 -9.16364 Td +(4404 int i, j;) 9.632 Tj +0 -10.4727 Td +(4405 struct buf *inbp;) 14.448 Tj +0 -11.7818 Td +(4406 ) 3.01 Tj +0 -13.0909 Td +(4407 for\(i = 0; i < NADDRS; i++\) {) 21.672 Tj +0 -14.4 Td +(4408 if\(ip->addrs[i] != 0\) {) 19.264 Tj +0 -15.7091 Td +(4409 if\(i == INDIRECT\) {) 18.06 Tj +0 -17.0182 Td +(4410 inbp = bread\(ip->dev, ip->addrs[INDIRECT]\);) 33.712 Tj +0 -18.3273 Td +(4411 uint *a = \(uint*\) inbp->data;) 25.284 Tj +0 -19.6364 Td +(4412 for\(j = 0; j < NINDIRECT; j++\) {) 27.09 Tj +0 -20.9455 Td +(4413 if\(a[j] != 0\) {) 18.06 Tj +0 -22.2545 Td +(4414 bfree\(ip->dev, a[j]\);) 22.876 Tj +0 -23.5636 Td +(4415 a[j] = 0;) 15.652 Tj +0 -24.8727 Td +(4416 }) 9.632 Tj +0 -26.1818 Td +(4417 }) 8.428 Tj +0 -27.4909 Td +(4418 brelse\(inbp\);) 15.652 Tj +0 -28.8 Td +(4419 }) 7.224 Tj +0 -30.1091 Td +(4420 bfree\(ip->dev, ip->addrs[i]\);) 24.08 Tj +0 -31.4182 Td +(4421 ip->addrs[i] = 0;) 16.856 Tj +0 -32.7273 Td +(4422 }) 6.02 Tj +0 -34.0364 Td +(4423 }) 4.816 Tj +0 -35.3454 Td +(4424 ip->size = 0;) 12.04 Tj +0 -36.6545 Td +(4425 iupdate\(ip\);) 11.438 Tj +0 -37.9636 Td +(4426 }) 3.612 Tj +0 -39.2727 Td +(4427 ) 3.01 Tj +0 -40.5818 Td +(4428 // Caller holds reference to ip and has locked it,) 33.11 Tj +0 -41.8909 Td +(4429 // possibly editing it.) 16.856 Tj +0 -43.2 Td +(4430 // Release lock and drop the reference.) 26.488 Tj +0 -44.5091 Td +(4431 void) 5.418 Tj +0 -45.8182 Td +(4432 iput\(struct inode *ip\)) 16.254 Tj +0 -47.1272 Td +(4433 {) 3.612 Tj +0 -48.4363 Td +(4434 if\(ip->ref < 1 || ip->busy != 1\)) 23.478 Tj +0 -49.7454 Td +(4435 panic\("iput"\);) 13.846 Tj +0 -51.0545 Td +(4436 ) 3.01 Tj +0 -52.3636 Td +(4437 if\(\(ip->ref == 1\) && \(ip->nlink == 0\)\) {) 28.294 Tj +0 -53.6727 Td +(4438 itrunc\(ip\);) 12.04 Tj +0 -54.9818 Td +(4439 ifree\(ip\);) 11.438 Tj +0 -56.2909 Td +(4440 }) 4.816 Tj +0 -57.6 Td +(4441 ) 3.01 Tj +0 -58.9091 Td +(4442 acquire\(&inode_table_lock\);) 20.468 Tj +0 -60.2181 Td +(4443 ) 3.01 Tj +0 -61.5272 Td +(4444 ip->ref -= 1;) 12.04 Tj +0 -62.8363 Td +(4445 ip->busy = 0;) 12.04 Tj +0 -64.1454 Td +(4446 wakeup\(ip\);) 10.836 Tj +0 -65.4545 Td +(4447 ) 3.01 Tj +0 -66.7636 Td +(4448 release\(&inode_table_lock\);) 20.468 Tj +0 -68.0727 Td +(4449 }) 3.612 Tj +0 -72 Td +(Sheet 44) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/fs.c Page 9) 21.07 Tj +0 -3.92728 Td +(4450 // Caller holds reference to ip but not lock.) 30.1 Tj +0 -5.23637 Td +(4451 // Drop reference.) 13.846 Tj +0 -6.54546 Td +(4452 void) 5.418 Tj +0 -7.85455 Td +(4453 idecref\(struct inode *ip\)) 18.06 Tj +0 -9.16364 Td +(4454 {) 3.612 Tj +0 -10.4727 Td +(4455 ilock\(ip\);) 10.234 Tj +0 -11.7818 Td +(4456 iput\(ip\);) 9.632 Tj +0 -13.0909 Td +(4457 }) 3.612 Tj +0 -14.4 Td +(4458 ) 3.01 Tj +0 -15.7091 Td +(4459 // Increment reference count for ip.) 24.682 Tj +0 -17.0182 Td +(4460 void) 5.418 Tj +0 -18.3273 Td +(4461 iincref\(struct inode *ip\)) 18.06 Tj +0 -19.6364 Td +(4462 {) 3.612 Tj +0 -20.9455 Td +(4463 ilock\(ip\);) 10.234 Tj +0 -22.2545 Td +(4464 ip->ref++;) 10.234 Tj +0 -23.5636 Td +(4465 iunlock\(ip\);) 11.438 Tj +0 -24.8727 Td +(4466 }) 3.612 Tj +0 -26.1818 Td +(4467 ) 3.01 Tj +0 -27.4909 Td +(4468 // Copy stat information from inode.) 24.682 Tj +0 -28.8 Td +(4469 void) 5.418 Tj +0 -30.1091 Td +(4470 stati\(struct inode *ip, struct stat *st\)) 27.09 Tj +0 -31.4182 Td +(4471 {) 3.612 Tj +0 -32.7273 Td +(4472 st->dev = ip->dev;) 15.05 Tj +0 -34.0364 Td +(4473 st->ino = ip->inum;) 15.652 Tj +0 -35.3454 Td +(4474 st->type = ip->type;) 16.254 Tj +0 -36.6545 Td +(4475 st->nlink = ip->nlink;) 17.458 Tj +0 -37.9636 Td +(4476 st->size = ip->size;) 16.254 Tj +0 -39.2727 Td +(4477 }) 3.612 Tj +0 -40.5818 Td +(4478 ) 3.01 Tj +0 -41.8909 Td +(4479 #define min\(a, b\) \(\(a\) < \(b\) ? \(a\) : \(b\)\)) 27.692 Tj +0 -43.2 Td +(4480 ) 3.01 Tj +0 -44.5091 Td +(4481 // Read data from inode.) 17.458 Tj +0 -45.8182 Td +(4482 int) 4.816 Tj +0 -47.1272 Td +(4483 readi\(struct inode *ip, char *dst, uint off, uint n\)) 34.314 Tj +0 -48.4363 Td +(4484 {) 3.612 Tj +0 -49.7454 Td +(4485 uint target = n, n1;) 16.254 Tj +0 -51.0545 Td +(4486 struct buf *bp;) 13.244 Tj +0 -52.3636 Td +(4487 ) 3.01 Tj +0 -53.6727 Td +(4488 if\(ip->type == T_DEV\) {) 18.06 Tj +0 -54.9818 Td +(4489 if\(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read\)) 43.946 Tj +0 -56.2909 Td +(4490 return -1;) 12.642 Tj +0 -57.6 Td +(4491 return devsw[ip->major].read\(ip->minor, dst, n\);) 34.314 Tj +0 -58.9091 Td +(4492 }) 4.816 Tj +0 -60.2181 Td +(4493 ) 3.01 Tj +0 -61.5272 Td +(4494 while\(n > 0 && off < ip->size\){) 22.876 Tj +0 -62.8363 Td +(4495 bp = bread\(ip->dev, bmap\(ip, off / BSIZE\)\);) 31.304 Tj +0 -64.1454 Td +(4496 n1 = min\(n, ip->size - off\);) 22.274 Tj +0 -65.4545 Td +(4497 n1 = min\(n1, BSIZE - \(off % BSIZE\)\);) 27.09 Tj +0 -66.7636 Td +(4498 memmove\(dst, bp->data + \(off % BSIZE\), n1\);) 31.304 Tj +0 -68.0727 Td +(4499 n -= n1;) 10.234 Tj +0 -72 Td +(Sheet 44) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 52 52 +%%BeginPageSetup +%%PageOrientation: Landscape +__tumble pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/fs.c Page 10) 21.672 Tj +0 -3.92728 Td +(4500 off += n1;) 11.438 Tj +0 -5.23637 Td +(4501 dst += n1;) 11.438 Tj +0 -6.54546 Td +(4502 brelse\(bp\);) 12.04 Tj +0 -7.85455 Td +(4503 }) 4.816 Tj +0 -9.16364 Td +(4504 ) 3.01 Tj +0 -10.4727 Td +(4505 return target - n;) 15.05 Tj +0 -11.7818 Td +(4506 }) 3.612 Tj +0 -13.0909 Td +(4507 ) 3.01 Tj +0 -14.4 Td +(4508 // Allocate the nth block in inode ip if necessary.) 33.712 Tj +0 -15.7091 Td +(4509 static int) 9.03 Tj +0 -17.0182 Td +(4510 newblock\(struct inode *ip, uint lbn\)) 24.682 Tj +0 -18.3273 Td +(4511 {) 3.612 Tj +0 -19.6364 Td +(4512 struct buf *inbp;) 14.448 Tj +0 -20.9455 Td +(4513 uint *inaddrs;) 12.642 Tj +0 -22.2545 Td +(4514 uint b;) 8.428 Tj +0 -23.5636 Td +(4515 ) 3.01 Tj +0 -24.8727 Td +(4516 if\(lbn < NDIRECT\) {) 15.652 Tj +0 -26.1818 Td +(4517 if\(ip->addrs[lbn] == 0\) {) 20.468 Tj +0 -27.4909 Td +(4518 b = balloc\(ip->dev\);) 18.662 Tj +0 -28.8 Td +(4519 if\(b <= 0\)) 12.642 Tj +0 -30.1091 Td +(4520 return -1;) 13.846 Tj +0 -31.4182 Td +(4521 ip->addrs[lbn] = b;) 18.06 Tj +0 -32.7273 Td +(4522 }) 6.02 Tj +0 -34.0364 Td +(4523 } else {) 9.03 Tj +0 -35.3454 Td +(4524 if\(ip->addrs[INDIRECT] == 0\) {) 23.478 Tj +0 -36.6545 Td +(4525 b = balloc\(ip->dev\);) 18.662 Tj +0 -37.9636 Td +(4526 if\(b <= 0\)) 12.642 Tj +0 -39.2727 Td +(4527 return -1;) 13.846 Tj +0 -40.5818 Td +(4528 ip->addrs[INDIRECT] = b;) 21.07 Tj +0 -41.8909 Td +(4529 }) 6.02 Tj +0 -43.2 Td +(4530 inbp = bread\(ip->dev, ip->addrs[INDIRECT]\);) 31.304 Tj +0 -44.5091 Td +(4531 inaddrs = \(uint*\) inbp->data;) 22.876 Tj +0 -45.8182 Td +(4532 if\(inaddrs[lbn - NDIRECT] == 0\) {) 25.284 Tj +0 -47.1272 Td +(4533 b = balloc\(ip->dev\);) 18.662 Tj +0 -48.4363 Td +(4534 if\(b <= 0\)) 12.642 Tj +0 -49.7454 Td +(4535 return -1;) 13.846 Tj +0 -51.0545 Td +(4536 inaddrs[lbn - NDIRECT] = b;) 22.876 Tj +0 -52.3636 Td +(4537 bwrite\(inbp, ip->addrs[INDIRECT]\);) 27.09 Tj +0 -53.6727 Td +(4538 }) 6.02 Tj +0 -54.9818 Td +(4539 brelse\(inbp\);) 13.244 Tj +0 -56.2909 Td +(4540 }) 4.816 Tj +0 -57.6 Td +(4541 return 0;) 9.632 Tj +0 -58.9091 Td +(4542 }) 3.612 Tj +0 -60.2181 Td +(4543 ) 3.01 Tj +0 -61.5272 Td +(4544 ) 3.01 Tj +0 -62.8363 Td +(4545 ) 3.01 Tj +0 -64.1454 Td +(4546 ) 3.01 Tj +0 -65.4545 Td +(4547 ) 3.01 Tj +0 -66.7636 Td +(4548 ) 3.01 Tj +0 -68.0727 Td +(4549 ) 3.01 Tj +0 -72 Td +(Sheet 45) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/fs.c Page 11) 21.672 Tj +0 -3.92728 Td +(4550 // Write data to inode.) 16.856 Tj +0 -5.23637 Td +(4551 int) 4.816 Tj +0 -6.54546 Td +(4552 writei\(struct inode *ip, char *addr, uint off, uint n\)) 35.518 Tj +0 -7.85455 Td +(4553 {) 3.612 Tj +0 -9.16364 Td +(4554 if\(ip->type == T_DEV\) {) 18.06 Tj +0 -10.4727 Td +(4555 if\(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write\)) 44.548 Tj +0 -11.7818 Td +(4556 return -1;) 12.642 Tj +0 -13.0909 Td +(4557 return devsw[ip->major].write\(ip->minor, addr, n\);) 35.518 Tj +0 -14.4 Td +(4558 } else if\(ip->type == T_FILE || ip->type == T_DIR\) {) 35.518 Tj +0 -15.7091 Td +(4559 struct buf *bp;) 14.448 Tj +0 -17.0182 Td +(4560 int r = 0;) 11.438 Tj +0 -18.3273 Td +(4561 int m;) 9.03 Tj +0 -19.6364 Td +(4562 int lbn;) 10.234 Tj +0 -20.9455 Td +(4563 while\(r < n\) {) 13.846 Tj +0 -22.2545 Td +(4564 lbn = off / BSIZE;) 17.458 Tj +0 -23.5636 Td +(4565 if\(lbn >= MAXFILE\)) 17.458 Tj +0 -24.8727 Td +(4566 return r;) 13.244 Tj +0 -26.1818 Td +(4567 if\(newblock\(ip, lbn\) < 0\) {) 22.876 Tj +0 -27.4909 Td +(4568 cprintf\("newblock failed\\n"\);) 25.284 Tj +0 -28.8 Td +(4569 return r;) 13.244 Tj +0 -30.1091 Td +(4570 }) 7.224 Tj +0 -31.4182 Td +(4571 m = min\(BSIZE - off % BSIZE, n-r\);) 27.09 Tj +0 -32.7273 Td +(4572 bp = bread\(ip->dev, bmap\(ip, lbn\)\);) 27.692 Tj +0 -34.0364 Td +(4573 memmove\(bp->data + off % BSIZE, addr, m\);) 31.304 Tj +0 -35.3454 Td +(4574 bwrite\(bp, bmap\(ip, lbn\)\);) 22.274 Tj +0 -36.6545 Td +(4575 brelse\(bp\);) 13.244 Tj +0 -37.9636 Td +(4576 r += m;) 10.836 Tj +0 -39.2727 Td +(4577 off += m;) 12.04 Tj +0 -40.5818 Td +(4578 }) 6.02 Tj +0 -41.8909 Td +(4579 if\(r > 0\) {) 12.04 Tj +0 -43.2 Td +(4580 if\(off > ip->size\) {) 18.662 Tj +0 -44.5091 Td +(4581 if\(ip->type == T_DIR\)) 20.468 Tj +0 -45.8182 Td +(4582 ip->size = \(\(off / BSIZE\) + 1\) * BSIZE;) 32.508 Tj +0 -47.1272 Td +(4583 else) 10.234 Tj +0 -48.4363 Td +(4584 ip->size = off;) 18.06 Tj +0 -49.7454 Td +(4585 }) 7.224 Tj +0 -51.0545 Td +(4586 iupdate\(ip\);) 13.846 Tj +0 -52.3636 Td +(4587 }) 6.02 Tj +0 -53.6727 Td +(4588 return r;) 10.836 Tj +0 -54.9818 Td +(4589 } else {) 9.03 Tj +0 -56.2909 Td +(4590 panic\("writei: unknown type"\);) 23.478 Tj +0 -57.6 Td +(4591 return 0;) 10.836 Tj +0 -58.9091 Td +(4592 }) 4.816 Tj +0 -60.2181 Td +(4593 }) 3.612 Tj +0 -61.5272 Td +(4594 ) 3.01 Tj +0 -62.8363 Td +(4595 ) 3.01 Tj +0 -64.1454 Td +(4596 ) 3.01 Tj +0 -65.4545 Td +(4597 ) 3.01 Tj +0 -66.7636 Td +(4598 ) 3.01 Tj +0 -68.0727 Td +(4599 ) 3.01 Tj +0 -72 Td +(Sheet 45) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 53 53 +%%BeginPageSetup +%%PageOrientation: Landscape +pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/fs.c Page 12) 21.672 Tj +0 -3.92728 Td +(4600 // look up a path name, in one of three modes.) 30.702 Tj +0 -5.23637 Td +(4601 // NAMEI_LOOKUP: return locked target inode.) 29.498 Tj +0 -6.54546 Td +(4602 // NAMEI_CREATE: return locked parent inode.) 29.498 Tj +0 -7.85455 Td +(4603 // return 0 if name does exist.) 22.876 Tj +0 -9.16364 Td +(4604 // *ret_last points to last path component \(i.e. new file name\).) 42.742 Tj +0 -10.4727 Td +(4605 // *ret_ip points to the the name that did exist, if it did.) 40.334 Tj +0 -11.7818 Td +(4606 // *ret_ip and *ret_last may be zero even if return value is zero.) 43.946 Tj +0 -13.0909 Td +(4607 // NAMEI_DELETE: return locked parent inode, offset of dirent in *ret_off.) 47.558 Tj +0 -14.4 Td +(4608 // return 0 if name doesn't exist.) 24.682 Tj +0 -15.7091 Td +(4609 struct inode*) 10.836 Tj +0 -17.0182 Td +(4610 namei\(char *path, int mode, uint *ret_off,) 28.294 Tj +0 -18.3273 Td +(4611 char **ret_last, struct inode **ret_ip\)) 30.1 Tj +0 -19.6364 Td +(4612 {) 3.612 Tj +0 -20.9455 Td +(4613 struct inode *dp;) 14.448 Tj +0 -22.2545 Td +(4614 struct proc *p = curproc[cpu\(\)];) 23.478 Tj +0 -23.5636 Td +(4615 char *cp = path, *cp1;) 17.458 Tj +0 -24.8727 Td +(4616 uint off, dev;) 12.642 Tj +0 -26.1818 Td +(4617 struct buf *bp;) 13.244 Tj +0 -27.4909 Td +(4618 struct dirent *ep;) 15.05 Tj +0 -28.8 Td +(4619 int i, l, atend;) 13.846 Tj +0 -30.1091 Td +(4620 uint ninum;) 10.836 Tj +0 -31.4182 Td +(4621 ) 3.01 Tj +0 -32.7273 Td +(4622 if\(ret_off\)) 10.836 Tj +0 -34.0364 Td +(4623 *ret_off = 0xffffffff;) 18.662 Tj +0 -35.3454 Td +(4624 if\(ret_last\)) 11.438 Tj +0 -36.6545 Td +(4625 *ret_last = 0;) 13.846 Tj +0 -37.9636 Td +(4626 if\(ret_ip\)) 10.234 Tj +0 -39.2727 Td +(4627 *ret_ip = 0;) 12.642 Tj +0 -40.5818 Td +(4628 ) 3.01 Tj +0 -41.8909 Td +(4629 if\(*cp == '/'\)) 12.642 Tj +0 -43.2 Td +(4630 dp = iget\(rootdev, 1\);) 18.662 Tj +0 -44.5091 Td +(4631 else {) 7.826 Tj +0 -45.8182 Td +(4632 dp = p->cwd;) 12.642 Tj +0 -47.1272 Td +(4633 iincref\(dp\);) 12.642 Tj +0 -48.4363 Td +(4634 ilock\(dp\);) 11.438 Tj +0 -49.7454 Td +(4635 }) 4.816 Tj +0 -51.0545 Td +(4636 ) 3.01 Tj +0 -52.3636 Td +(4637 for\(;;\){) 9.03 Tj +0 -53.6727 Td +(4638 while\(*cp == '/'\)) 15.652 Tj +0 -54.9818 Td +(4639 cp++;) 9.632 Tj +0 -56.2909 Td +(4640 ) 3.01 Tj +0 -57.6 Td +(4641 if\(*cp == '\\0'\){) 15.05 Tj +0 -58.9091 Td +(4642 if\(mode == NAMEI_LOOKUP\)) 21.07 Tj +0 -60.2181 Td +(4643 return dp;) 13.846 Tj +0 -61.5272 Td +(4644 if\(mode == NAMEI_CREATE && ret_ip\){) 27.692 Tj +0 -62.8363 Td +(4645 *ret_ip = dp;) 15.652 Tj +0 -64.1454 Td +(4646 return 0;) 13.244 Tj +0 -65.4545 Td +(4647 }) 7.224 Tj +0 -66.7636 Td +(4648 iput\(dp\);) 12.04 Tj +0 -68.0727 Td +(4649 return 0;) 12.04 Tj +0 -72 Td +(Sheet 46) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/fs.c Page 13) 21.672 Tj +0 -3.92728 Td +(4650 }) 6.02 Tj +0 -5.23637 Td +(4651 ) 3.01 Tj +0 -6.54546 Td +(4652 if\(dp->type != T_DIR\){) 18.662 Tj +0 -7.85455 Td +(4653 iput\(dp\);) 12.04 Tj +0 -9.16364 Td +(4654 return 0;) 12.04 Tj +0 -10.4727 Td +(4655 }) 6.02 Tj +0 -11.7818 Td +(4656 ) 3.01 Tj +0 -13.0909 Td +(4657 for\(i = 0; cp[i] != 0 && cp[i] != '/'; i++\)) 31.304 Tj +0 -14.4 Td +(4658 ;) 7.224 Tj +0 -15.7091 Td +(4659 l = i;) 9.03 Tj +0 -17.0182 Td +(4660 if\(i > DIRSIZ\)) 13.846 Tj +0 -18.3273 Td +(4661 l = DIRSIZ;) 13.244 Tj +0 -19.6364 Td +(4662 ) 3.01 Tj +0 -20.9455 Td +(4663 for\(off = 0; off < dp->size; off += BSIZE\){) 31.304 Tj +0 -22.2545 Td +(4664 bp = bread\(dp->dev, bmap\(dp, off / BSIZE\)\);) 32.508 Tj +0 -23.5636 Td +(4665 for\(ep = \(struct dirent*\) bp->data;) 27.692 Tj +0 -24.8727 Td +(4666 ep < \(struct dirent*\) \(bp->data + BSIZE\);) 33.712 Tj +0 -26.1818 Td +(4667 ep++\){) 12.642 Tj +0 -27.4909 Td +(4668 if\(ep->inum == 0\)) 18.06 Tj +0 -28.8 Td +(4669 continue;) 14.448 Tj +0 -30.1091 Td +(4670 if\(memcmp\(cp, ep->name, l\) == 0 &&) 28.294 Tj +0 -31.4182 Td +(4671 \(l == DIRSIZ || ep->name[l]== 0\)\){) 30.1 Tj +0 -32.7273 Td +(4672 // entry matches path element) 26.488 Tj +0 -34.0364 Td +(4673 off += \(uchar*\)ep - bp->data;) 26.488 Tj +0 -35.3454 Td +(4674 ninum = ep->inum;) 19.264 Tj +0 -36.6545 Td +(4675 brelse\(bp\);) 15.652 Tj +0 -37.9636 Td +(4676 cp += i;) 13.846 Tj +0 -39.2727 Td +(4677 goto found;) 15.652 Tj +0 -40.5818 Td +(4678 }) 8.428 Tj +0 -41.8909 Td +(4679 }) 7.224 Tj +0 -43.2 Td +(4680 brelse\(bp\);) 13.244 Tj +0 -44.5091 Td +(4681 }) 6.02 Tj +0 -45.8182 Td +(4682 atend = 1;) 11.438 Tj +0 -47.1272 Td +(4683 for\(cp1 = cp; *cp1; cp1++\)) 21.07 Tj +0 -48.4363 Td +(4684 if\(*cp1 == '/'\)) 15.652 Tj +0 -49.7454 Td +(4685 atend = 0;) 13.846 Tj +0 -51.0545 Td +(4686 if\(mode == NAMEI_CREATE && atend\){) 25.886 Tj +0 -52.3636 Td +(4687 if\(*cp == '\\0'\){) 16.254 Tj +0 -53.6727 Td +(4688 iput\(dp\);) 13.244 Tj +0 -54.9818 Td +(4689 return 0;) 13.244 Tj +0 -56.2909 Td +(4690 }) 7.224 Tj +0 -57.6 Td +(4691 *ret_last = cp;) 15.652 Tj +0 -58.9091 Td +(4692 return dp;) 12.642 Tj +0 -60.2181 Td +(4693 }) 6.02 Tj +0 -61.5272 Td +(4694 ) 3.01 Tj +0 -62.8363 Td +(4695 iput\(dp\);) 10.836 Tj +0 -64.1454 Td +(4696 return 0;) 10.836 Tj +0 -65.4545 Td +(4697 ) 3.01 Tj +0 -66.7636 Td +(4698 ) 3.01 Tj +0 -68.0727 Td +(4699 ) 3.01 Tj +0 -72 Td +(Sheet 46) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 54 54 +%%BeginPageSetup +%%PageOrientation: Landscape +__tumble pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/fs.c Page 14) 21.672 Tj +0 -3.92728 Td +(4700 found:) 7.826 Tj +0 -5.23637 Td +(4701 if\(mode == NAMEI_DELETE && *cp == '\\0'\){) 29.498 Tj +0 -6.54546 Td +(4702 *ret_off = off;) 15.652 Tj +0 -7.85455 Td +(4703 return dp;) 12.642 Tj +0 -9.16364 Td +(4704 }) 6.02 Tj +0 -10.4727 Td +(4705 dev = dp->dev;) 13.846 Tj +0 -11.7818 Td +(4706 iput\(dp\);) 10.836 Tj +0 -13.0909 Td +(4707 dp = iget\(dev, ninum\);) 18.662 Tj +0 -14.4 Td +(4708 if\(dp->type == 0 || dp->nlink < 1\)) 25.886 Tj +0 -15.7091 Td +(4709 panic\("namei"\);) 15.652 Tj +0 -17.0182 Td +(4710 }) 4.816 Tj +0 -18.3273 Td +(4711 }) 3.612 Tj +0 -19.6364 Td +(4712 ) 3.01 Tj +0 -20.9455 Td +(4713 // Write a new directory entry \(name, ino\) into the directory dp.) 42.14 Tj +0 -22.2545 Td +(4714 // Caller must have locked dp.) 21.07 Tj +0 -23.5636 Td +(4715 void) 5.418 Tj +0 -24.8727 Td +(4716 wdir\(struct inode *dp, char *name, uint ino\)) 29.498 Tj +0 -26.1818 Td +(4717 {) 3.612 Tj +0 -27.4909 Td +(4718 uint off;) 9.632 Tj +0 -28.8 Td +(4719 struct dirent de;) 14.448 Tj +0 -30.1091 Td +(4720 int i;) 7.826 Tj +0 -31.4182 Td +(4721 ) 3.01 Tj +0 -32.7273 Td +(4722 for\(off = 0; off < dp->size; off += sizeof\(de\)\){) 33.11 Tj +0 -34.0364 Td +(4723 if\(readi\(dp, \(char*\) &de, off, sizeof\(de\)\) != sizeof\(de\)\)) 39.732 Tj +0 -35.3454 Td +(4724 panic\("wdir read"\);) 18.06 Tj +0 -36.6545 Td +(4725 if\(de.inum == 0\)) 15.05 Tj +0 -37.9636 Td +(4726 break;) 10.234 Tj +0 -39.2727 Td +(4727 }) 4.816 Tj +0 -40.5818 Td +(4728 ) 3.01 Tj +0 -41.8909 Td +(4729 de.inum = ino;) 12.642 Tj +0 -43.2 Td +(4730 for\(i = 0; i < DIRSIZ && name[i]; i++\)) 27.09 Tj +0 -44.5091 Td +(4731 de.name[i] = name[i];) 18.06 Tj +0 -45.8182 Td +(4732 for\( ; i < DIRSIZ; i++\)) 18.06 Tj +0 -47.1272 Td +(4733 de.name[i] = '\\0';) 16.254 Tj +0 -48.4363 Td +(4734 ) 3.01 Tj +0 -49.7454 Td +(4735 if\(writei\(dp, \(char*\) &de, off, sizeof\(de\)\) != sizeof\(de\)\)) 39.13 Tj +0 -51.0545 Td +(4736 panic\("wdir write"\);) 17.458 Tj +0 -52.3636 Td +(4737 }) 3.612 Tj +0 -53.6727 Td +(4738 ) 3.01 Tj +0 -54.9818 Td +(4739 ) 3.01 Tj +0 -56.2909 Td +(4740 ) 3.01 Tj +0 -57.6 Td +(4741 ) 3.01 Tj +0 -58.9091 Td +(4742 ) 3.01 Tj +0 -60.2181 Td +(4743 ) 3.01 Tj +0 -61.5272 Td +(4744 ) 3.01 Tj +0 -62.8363 Td +(4745 ) 3.01 Tj +0 -64.1454 Td +(4746 ) 3.01 Tj +0 -65.4545 Td +(4747 ) 3.01 Tj +0 -66.7636 Td +(4748 ) 3.01 Tj +0 -68.0727 Td +(4749 ) 3.01 Tj +0 -72 Td +(Sheet 47) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/fs.c Page 15) 21.672 Tj +0 -3.92728 Td +(4750 // Create the path cp and return its locked inode structure.) 39.13 Tj +0 -5.23637 Td +(4751 // If cp already exists, return 0.) 23.478 Tj +0 -6.54546 Td +(4752 struct inode*) 10.836 Tj +0 -7.85455 Td +(4753 mknod\(char *cp, short type, short major, short minor\)) 34.916 Tj +0 -9.16364 Td +(4754 {) 3.612 Tj +0 -10.4727 Td +(4755 struct inode *ip, *dp;) 17.458 Tj +0 -11.7818 Td +(4756 char *last;) 10.836 Tj +0 -13.0909 Td +(4757 ) 3.01 Tj +0 -14.4 Td +(4758 if\(\(dp = namei\(cp, NAMEI_CREATE, 0, &last, 0\)\) == 0\)) 35.518 Tj +0 -15.7091 Td +(4759 return 0;) 10.836 Tj +0 -17.0182 Td +(4760 ) 3.01 Tj +0 -18.3273 Td +(4761 ip = mknod1\(dp, last, type, major, minor\);) 29.498 Tj +0 -19.6364 Td +(4762 ) 3.01 Tj +0 -20.9455 Td +(4763 iput\(dp\);) 9.632 Tj +0 -22.2545 Td +(4764 ) 3.01 Tj +0 -23.5636 Td +(4765 return ip;) 10.234 Tj +0 -24.8727 Td +(4766 }) 3.612 Tj +0 -26.1818 Td +(4767 ) 3.01 Tj +0 -27.4909 Td +(4768 // Create a new inode named name inside dp) 28.294 Tj +0 -28.8 Td +(4769 // and return its locked inode structure.) 27.692 Tj +0 -30.1091 Td +(4770 // If name already exists, return 0.) 24.682 Tj +0 -31.4182 Td +(4771 struct inode*) 10.836 Tj +0 -32.7273 Td +(4772 mknod1\(struct inode *dp, char *name, short type, short major, short minor\)) 47.558 Tj +0 -34.0364 Td +(4773 {) 3.612 Tj +0 -35.3454 Td +(4774 struct inode *ip;) 14.448 Tj +0 -36.6545 Td +(4775 ) 3.01 Tj +0 -37.9636 Td +(4776 ip = ialloc\(dp->dev, type\);) 20.468 Tj +0 -39.2727 Td +(4777 if\(ip == 0\)) 10.836 Tj +0 -40.5818 Td +(4778 return 0;) 10.836 Tj +0 -41.8909 Td +(4779 ip->major = major;) 15.05 Tj +0 -43.2 Td +(4780 ip->minor = minor;) 15.05 Tj +0 -44.5091 Td +(4781 ip->size = 0;) 12.04 Tj +0 -45.8182 Td +(4782 ip->nlink = 1;) 12.642 Tj +0 -47.1272 Td +(4783 ) 3.01 Tj +0 -48.4363 Td +(4784 iupdate\(ip\); // write new inode to disk) 28.294 Tj +0 -49.7454 Td +(4785 ) 3.01 Tj +0 -51.0545 Td +(4786 wdir\(dp, name, ip->inum\);) 19.264 Tj +0 -52.3636 Td +(4787 ) 3.01 Tj +0 -53.6727 Td +(4788 return ip;) 10.234 Tj +0 -54.9818 Td +(4789 }) 3.612 Tj +0 -56.2909 Td +(4790 ) 3.01 Tj +0 -57.6 Td +(4791 ) 3.01 Tj +0 -58.9091 Td +(4792 ) 3.01 Tj +0 -60.2181 Td +(4793 ) 3.01 Tj +0 -61.5272 Td +(4794 ) 3.01 Tj +0 -62.8363 Td +(4795 ) 3.01 Tj +0 -64.1454 Td +(4796 ) 3.01 Tj +0 -65.4545 Td +(4797 ) 3.01 Tj +0 -66.7636 Td +(4798 ) 3.01 Tj +0 -68.0727 Td +(4799 ) 3.01 Tj +0 -72 Td +(Sheet 47) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 55 55 +%%BeginPageSetup +%%PageOrientation: Landscape +pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/fs.c Page 16) 21.672 Tj +0 -3.92728 Td +(4800 // Unlink the inode named cp.) 20.468 Tj +0 -5.23637 Td +(4801 int) 4.816 Tj +0 -6.54546 Td +(4802 unlink\(char *cp\)) 12.642 Tj +0 -7.85455 Td +(4803 {) 3.612 Tj +0 -9.16364 Td +(4804 struct inode *ip, *dp;) 17.458 Tj +0 -10.4727 Td +(4805 struct dirent de;) 14.448 Tj +0 -11.7818 Td +(4806 uint off, inum, dev;) 16.254 Tj +0 -13.0909 Td +(4807 ) 3.01 Tj +0 -14.4 Td +(4808 dp = namei\(cp, NAMEI_DELETE, &off, 0, 0\);) 28.896 Tj +0 -15.7091 Td +(4809 if\(dp == 0\)) 10.836 Tj +0 -17.0182 Td +(4810 return -1;) 11.438 Tj +0 -18.3273 Td +(4811 ) 3.01 Tj +0 -19.6364 Td +(4812 dev = dp->dev;) 12.642 Tj +0 -20.9455 Td +(4813 ) 3.01 Tj +0 -22.2545 Td +(4814 if\(readi\(dp, \(char*\)&de, off, sizeof\(de\)\) != sizeof\(de\) || de.inum == 0\)) 47.558 Tj +0 -23.5636 Td +(4815 panic\("unlink no entry"\);) 20.468 Tj +0 -24.8727 Td +(4816 ) 3.01 Tj +0 -26.1818 Td +(4817 inum = de.inum;) 13.244 Tj +0 -27.4909 Td +(4818 ) 3.01 Tj +0 -28.8 Td +(4819 memset\(&de, 0, sizeof\(de\)\);) 20.468 Tj +0 -30.1091 Td +(4820 if\(writei\(dp, \(char*\)&de, off, sizeof\(de\)\) != sizeof\(de\)\)) 38.528 Tj +0 -31.4182 Td +(4821 panic\("unlink dir write"\);) 21.07 Tj +0 -32.7273 Td +(4822 ) 3.01 Tj +0 -34.0364 Td +(4823 iupdate\(dp\);) 11.438 Tj +0 -35.3454 Td +(4824 iput\(dp\);) 9.632 Tj +0 -36.6545 Td +(4825 ) 3.01 Tj +0 -37.9636 Td +(4826 ip = iget\(dev, inum\);) 16.856 Tj +0 -39.2727 Td +(4827 ) 3.01 Tj +0 -40.5818 Td +(4828 if\(ip->nlink < 1\)) 14.448 Tj +0 -41.8909 Td +(4829 panic\("unlink nlink < 1"\);) 21.07 Tj +0 -43.2 Td +(4830 ) 3.01 Tj +0 -44.5091 Td +(4831 ip->nlink--;) 11.438 Tj +0 -45.8182 Td +(4832 ) 3.01 Tj +0 -47.1272 Td +(4833 iupdate\(ip\);) 11.438 Tj +0 -48.4363 Td +(4834 iput\(ip\);) 9.632 Tj +0 -49.7454 Td +(4835 ) 3.01 Tj +0 -51.0545 Td +(4836 return 0;) 9.632 Tj +0 -52.3636 Td +(4837 }) 3.612 Tj +0 -53.6727 Td +(4838 ) 3.01 Tj +0 -54.9818 Td +(4839 ) 3.01 Tj +0 -56.2909 Td +(4840 ) 3.01 Tj +0 -57.6 Td +(4841 ) 3.01 Tj +0 -58.9091 Td +(4842 ) 3.01 Tj +0 -60.2181 Td +(4843 ) 3.01 Tj +0 -61.5272 Td +(4844 ) 3.01 Tj +0 -62.8363 Td +(4845 ) 3.01 Tj +0 -64.1454 Td +(4846 ) 3.01 Tj +0 -65.4545 Td +(4847 ) 3.01 Tj +0 -66.7636 Td +(4848 ) 3.01 Tj +0 -68.0727 Td +(4849 ) 3.01 Tj +0 -72 Td +(Sheet 48) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/fs.c Page 17) 21.672 Tj +0 -3.92728 Td +(4850 // Create the path new as a link to the same inode as old.) 37.926 Tj +0 -5.23637 Td +(4851 int) 4.816 Tj +0 -6.54546 Td +(4852 link\(char *name1, char *name2\)) 21.07 Tj +0 -7.85455 Td +(4853 {) 3.612 Tj +0 -9.16364 Td +(4854 struct inode *ip, *dp;) 17.458 Tj +0 -10.4727 Td +(4855 char *last;) 10.836 Tj +0 -11.7818 Td +(4856 ) 3.01 Tj +0 -13.0909 Td +(4857 if\(\(ip = namei\(name1, NAMEI_LOOKUP, 0, 0, 0\)\) == 0\)) 34.916 Tj +0 -14.4 Td +(4858 return -1;) 11.438 Tj +0 -15.7091 Td +(4859 if\(ip->type == T_DIR\){) 17.458 Tj +0 -17.0182 Td +(4860 iput\(ip\);) 10.836 Tj +0 -18.3273 Td +(4861 return -1;) 11.438 Tj +0 -19.6364 Td +(4862 }) 4.816 Tj +0 -20.9455 Td +(4863 ) 3.01 Tj +0 -22.2545 Td +(4864 iunlock\(ip\);) 11.438 Tj +0 -23.5636 Td +(4865 ) 3.01 Tj +0 -24.8727 Td +(4866 if\(\(dp = namei\(name2, NAMEI_CREATE, 0, &last, 0\)\) == 0\) {) 38.528 Tj +0 -26.1818 Td +(4867 idecref\(ip\);) 12.642 Tj +0 -27.4909 Td +(4868 return -1;) 11.438 Tj +0 -28.8 Td +(4869 }) 4.816 Tj +0 -30.1091 Td +(4870 if\(dp->dev != ip->dev\){) 18.06 Tj +0 -31.4182 Td +(4871 idecref\(ip\);) 12.642 Tj +0 -32.7273 Td +(4872 iput\(dp\);) 10.836 Tj +0 -34.0364 Td +(4873 return -1;) 11.438 Tj +0 -35.3454 Td +(4874 }) 4.816 Tj +0 -36.6545 Td +(4875 ) 3.01 Tj +0 -37.9636 Td +(4876 ilock\(ip\);) 10.234 Tj +0 -39.2727 Td +(4877 ip->nlink++;) 11.438 Tj +0 -40.5818 Td +(4878 iupdate\(ip\);) 11.438 Tj +0 -41.8909 Td +(4879 ) 3.01 Tj +0 -43.2 Td +(4880 wdir\(dp, last, ip->inum\);) 19.264 Tj +0 -44.5091 Td +(4881 iput\(dp\);) 9.632 Tj +0 -45.8182 Td +(4882 iput\(ip\);) 9.632 Tj +0 -47.1272 Td +(4883 ) 3.01 Tj +0 -48.4363 Td +(4884 return 0;) 9.632 Tj +0 -49.7454 Td +(4885 }) 3.612 Tj +0 -51.0545 Td +(4886 ) 3.01 Tj +0 -52.3636 Td +(4887 ) 3.01 Tj +0 -53.6727 Td +(4888 ) 3.01 Tj +0 -54.9818 Td +(4889 ) 3.01 Tj +0 -56.2909 Td +(4890 ) 3.01 Tj +0 -57.6 Td +(4891 ) 3.01 Tj +0 -58.9091 Td +(4892 ) 3.01 Tj +0 -60.2181 Td +(4893 ) 3.01 Tj +0 -61.5272 Td +(4894 ) 3.01 Tj +0 -62.8363 Td +(4895 ) 3.01 Tj +0 -64.1454 Td +(4896 ) 3.01 Tj +0 -65.4545 Td +(4897 ) 3.01 Tj +0 -66.7636 Td +(4898 ) 3.01 Tj +0 -68.0727 Td +(4899 ) 3.01 Tj +0 -72 Td +(Sheet 48) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 56 56 +%%BeginPageSetup +%%PageOrientation: Landscape +__tumble pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/file.c Page 1) 22.274 Tj +0 -3.92728 Td +(4900 #include "types.h") 13.846 Tj +0 -5.23637 Td +(4901 #include "stat.h") 13.244 Tj +0 -6.54546 Td +(4902 #include "param.h") 13.846 Tj +0 -7.85455 Td +(4903 #include "x86.h") 12.642 Tj +0 -9.16364 Td +(4904 #include "mmu.h") 12.642 Tj +0 -10.4727 Td +(4905 #include "proc.h") 13.244 Tj +0 -11.7818 Td +(4906 #include "defs.h") 13.244 Tj +0 -13.0909 Td +(4907 #include "file.h") 13.244 Tj +0 -14.4 Td +(4908 #include "spinlock.h") 15.652 Tj +0 -15.7091 Td +(4909 #include "dev.h") 12.642 Tj +0 -17.0182 Td +(4910 #include "fs.h") 12.04 Tj +0 -18.3273 Td +(4911 #include "fsvar.h") 13.846 Tj +0 -19.6364 Td +(4912 ) 3.01 Tj +0 -20.9455 Td +(4913 struct spinlock file_table_lock;) 22.274 Tj +0 -22.2545 Td +(4914 struct devsw devsw[NDEV];) 18.06 Tj +0 -23.5636 Td +(4915 ) 3.01 Tj +0 -24.8727 Td +(4916 struct file file[NFILE];) 17.458 Tj +0 -26.1818 Td +(4917 ) 3.01 Tj +0 -27.4909 Td +(4918 void) 5.418 Tj +0 -28.8 Td +(4919 fileinit\(void\)) 11.438 Tj +0 -30.1091 Td +(4920 {) 3.612 Tj +0 -31.4182 Td +(4921 initlock\(&file_table_lock, "file_table"\);) 28.896 Tj +0 -32.7273 Td +(4922 }) 3.612 Tj +0 -34.0364 Td +(4923 ) 3.01 Tj +0 -35.3454 Td +(4924 // Allocate a file structure) 19.866 Tj +0 -36.6545 Td +(4925 struct file*) 10.234 Tj +0 -37.9636 Td +(4926 filealloc\(void\)) 12.04 Tj +0 -39.2727 Td +(4927 {) 3.612 Tj +0 -40.5818 Td +(4928 int i;) 7.826 Tj +0 -41.8909 Td +(4929 ) 3.01 Tj +0 -43.2 Td +(4930 acquire\(&file_table_lock\);) 19.866 Tj +0 -44.5091 Td +(4931 for\(i = 0; i < NFILE; i++\){) 20.468 Tj +0 -45.8182 Td +(4932 if\(file[i].type == FD_CLOSED\){) 23.478 Tj +0 -47.1272 Td +(4933 file[i].type = FD_NONE;) 20.468 Tj +0 -48.4363 Td +(4934 file[i].ref = 1;) 16.254 Tj +0 -49.7454 Td +(4935 release\(&file_table_lock\);) 22.274 Tj +0 -51.0545 Td +(4936 return file + i;) 16.254 Tj +0 -52.3636 Td +(4937 }) 6.02 Tj +0 -53.6727 Td +(4938 }) 4.816 Tj +0 -54.9818 Td +(4939 release\(&file_table_lock\);) 19.866 Tj +0 -56.2909 Td +(4940 return 0;) 9.632 Tj +0 -57.6 Td +(4941 }) 3.612 Tj +0 -58.9091 Td +(4942 ) 3.01 Tj +0 -60.2181 Td +(4943 ) 3.01 Tj +0 -61.5272 Td +(4944 ) 3.01 Tj +0 -62.8363 Td +(4945 ) 3.01 Tj +0 -64.1454 Td +(4946 ) 3.01 Tj +0 -65.4545 Td +(4947 ) 3.01 Tj +0 -66.7636 Td +(4948 ) 3.01 Tj +0 -68.0727 Td +(4949 ) 3.01 Tj +0 -72 Td +(Sheet 49) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/file.c Page 2) 22.274 Tj +0 -3.92728 Td +(4950 // Write to file f. Addr is kernel address.) 29.498 Tj +0 -5.23637 Td +(4951 int) 4.816 Tj +0 -6.54546 Td +(4952 filewrite\(struct file *f, char *addr, int n\)) 29.498 Tj +0 -7.85455 Td +(4953 {) 3.612 Tj +0 -9.16364 Td +(4954 if\(f->writable == 0\)) 16.254 Tj +0 -10.4727 Td +(4955 return -1;) 11.438 Tj +0 -11.7818 Td +(4956 if\(f->type == FD_PIPE\){) 18.06 Tj +0 -13.0909 Td +(4957 return pipe_write\(f->pipe, addr, n\);) 27.09 Tj +0 -14.4 Td +(4958 } else if\(f->type == FD_FILE\) {) 22.876 Tj +0 -15.7091 Td +(4959 ilock\(f->ip\);) 13.244 Tj +0 -17.0182 Td +(4960 int r = writei\(f->ip, addr, f->off, n\);) 28.896 Tj +0 -18.3273 Td +(4961 if\(r > 0\) {) 12.04 Tj +0 -19.6364 Td +(4962 f->off += r;) 13.846 Tj +0 -20.9455 Td +(4963 }) 6.02 Tj +0 -22.2545 Td +(4964 iunlock\(f->ip\);) 14.448 Tj +0 -23.5636 Td +(4965 return r;) 10.836 Tj +0 -24.8727 Td +(4966 } else {) 9.03 Tj +0 -26.1818 Td +(4967 panic\("filewrite"\);) 16.856 Tj +0 -27.4909 Td +(4968 return -1;) 11.438 Tj +0 -28.8 Td +(4969 }) 4.816 Tj +0 -30.1091 Td +(4970 }) 3.612 Tj +0 -31.4182 Td +(4971 ) 3.01 Tj +0 -32.7273 Td +(4972 // Read from file f. Addr is kernel address.) 30.1 Tj +0 -34.0364 Td +(4973 int) 4.816 Tj +0 -35.3454 Td +(4974 fileread\(struct file *f, char *addr, int n\)) 28.896 Tj +0 -36.6545 Td +(4975 {) 3.612 Tj +0 -37.9636 Td +(4976 if\(f->readable == 0\)) 16.254 Tj +0 -39.2727 Td +(4977 return -1;) 11.438 Tj +0 -40.5818 Td +(4978 if\(f->type == FD_PIPE\){) 18.06 Tj +0 -41.8909 Td +(4979 return pipe_read\(f->pipe, addr, n\);) 26.488 Tj +0 -43.2 Td +(4980 } else if\(f->type == FD_FILE\){) 22.274 Tj +0 -44.5091 Td +(4981 ilock\(f->ip\);) 13.244 Tj +0 -45.8182 Td +(4982 int cc = readi\(f->ip, addr, f->off, n\);) 28.896 Tj +0 -47.1272 Td +(4983 if\(cc > 0\)) 11.438 Tj +0 -48.4363 Td +(4984 f->off += cc;) 14.448 Tj +0 -49.7454 Td +(4985 iunlock\(f->ip\);) 14.448 Tj +0 -51.0545 Td +(4986 return cc;) 11.438 Tj +0 -52.3636 Td +(4987 } else {) 9.03 Tj +0 -53.6727 Td +(4988 panic\("fileread"\);) 16.254 Tj +0 -54.9818 Td +(4989 return -1;) 11.438 Tj +0 -56.2909 Td +(4990 }) 4.816 Tj +0 -57.6 Td +(4991 }) 3.612 Tj +0 -58.9091 Td +(4992 ) 3.01 Tj +0 -60.2181 Td +(4993 ) 3.01 Tj +0 -61.5272 Td +(4994 ) 3.01 Tj +0 -62.8363 Td +(4995 ) 3.01 Tj +0 -64.1454 Td +(4996 ) 3.01 Tj +0 -65.4545 Td +(4997 ) 3.01 Tj +0 -66.7636 Td +(4998 ) 3.01 Tj +0 -68.0727 Td +(4999 ) 3.01 Tj +0 -72 Td +(Sheet 49) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 57 57 +%%BeginPageSetup +%%PageOrientation: Landscape +pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/file.c Page 3) 22.274 Tj +0 -3.92728 Td +(5000 // Close file f. \(Decrement ref count, close when reaches 0.\)) 40.334 Tj +0 -5.23637 Td +(5001 void) 5.418 Tj +0 -6.54546 Td +(5002 fileclose\(struct file *f\)) 18.06 Tj +0 -7.85455 Td +(5003 {) 3.612 Tj +0 -9.16364 Td +(5004 acquire\(&file_table_lock\);) 19.866 Tj +0 -10.4727 Td +(5005 ) 3.01 Tj +0 -11.7818 Td +(5006 if\(f->ref < 1 || f->type == FD_CLOSED\)) 27.09 Tj +0 -13.0909 Td +(5007 panic\("fileclose"\);) 16.856 Tj +0 -14.4 Td +(5008 ) 3.01 Tj +0 -15.7091 Td +(5009 if\(--f->ref == 0\){) 15.05 Tj +0 -17.0182 Td +(5010 struct file dummy = *f;) 19.264 Tj +0 -18.3273 Td +(5011 ) 3.01 Tj +0 -19.6364 Td +(5012 f->ref = 0;) 12.04 Tj +0 -20.9455 Td +(5013 f->type = FD_CLOSED;) 17.458 Tj +0 -22.2545 Td +(5014 release\(&file_table_lock\);) 21.07 Tj +0 -23.5636 Td +(5015 ) 3.01 Tj +0 -24.8727 Td +(5016 if\(dummy.type == FD_PIPE\){) 21.07 Tj +0 -26.1818 Td +(5017 pipe_close\(dummy.pipe, dummy.writable\);) 30.1 Tj +0 -27.4909 Td +(5018 } else if\(dummy.type == FD_FILE\){) 25.284 Tj +0 -28.8 Td +(5019 idecref\(dummy.ip\);) 17.458 Tj +0 -30.1091 Td +(5020 } else {) 10.234 Tj +0 -31.4182 Td +(5021 panic\("fileclose"\);) 18.06 Tj +0 -32.7273 Td +(5022 }) 6.02 Tj +0 -34.0364 Td +(5023 } else {) 9.03 Tj +0 -35.3454 Td +(5024 release\(&file_table_lock\);) 21.07 Tj +0 -36.6545 Td +(5025 }) 4.816 Tj +0 -37.9636 Td +(5026 }) 3.612 Tj +0 -39.2727 Td +(5027 ) 3.01 Tj +0 -40.5818 Td +(5028 // Get metadata about file f.) 20.468 Tj +0 -41.8909 Td +(5029 int) 4.816 Tj +0 -43.2 Td +(5030 filestat\(struct file *f, struct stat *st\)) 27.692 Tj +0 -44.5091 Td +(5031 {) 3.612 Tj +0 -45.8182 Td +(5032 if\(f->type == FD_FILE\){) 18.06 Tj +0 -47.1272 Td +(5033 ilock\(f->ip\);) 13.244 Tj +0 -48.4363 Td +(5034 stati\(f->ip, st\);) 15.652 Tj +0 -49.7454 Td +(5035 iunlock\(f->ip\);) 14.448 Tj +0 -51.0545 Td +(5036 return 0;) 10.836 Tj +0 -52.3636 Td +(5037 } else) 7.826 Tj +0 -53.6727 Td +(5038 return -1;) 11.438 Tj +0 -54.9818 Td +(5039 }) 3.612 Tj +0 -56.2909 Td +(5040 ) 3.01 Tj +0 -57.6 Td +(5041 ) 3.01 Tj +0 -58.9091 Td +(5042 ) 3.01 Tj +0 -60.2181 Td +(5043 ) 3.01 Tj +0 -61.5272 Td +(5044 ) 3.01 Tj +0 -62.8363 Td +(5045 ) 3.01 Tj +0 -64.1454 Td +(5046 ) 3.01 Tj +0 -65.4545 Td +(5047 ) 3.01 Tj +0 -66.7636 Td +(5048 ) 3.01 Tj +0 -68.0727 Td +(5049 ) 3.01 Tj +0 -72 Td +(Sheet 50) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/file.c Page 4) 22.274 Tj +0 -3.92728 Td +(5050 // Increment ref count for file f.) 23.478 Tj +0 -5.23637 Td +(5051 void) 5.418 Tj +0 -6.54546 Td +(5052 fileincref\(struct file *f\)) 18.662 Tj +0 -7.85455 Td +(5053 {) 3.612 Tj +0 -9.16364 Td +(5054 acquire\(&file_table_lock\);) 19.866 Tj +0 -10.4727 Td +(5055 if\(f->ref < 1 || f->type == FD_CLOSED\)) 27.09 Tj +0 -11.7818 Td +(5056 panic\("fileincref"\);) 17.458 Tj +0 -13.0909 Td +(5057 f->ref++;) 9.632 Tj +0 -14.4 Td +(5058 release\(&file_table_lock\);) 19.866 Tj +0 -15.7091 Td +(5059 }) 3.612 Tj +0 -17.0182 Td +(5060 ) 3.01 Tj +0 -18.3273 Td +(5061 ) 3.01 Tj +0 -19.6364 Td +(5062 ) 3.01 Tj +0 -20.9455 Td +(5063 ) 3.01 Tj +0 -22.2545 Td +(5064 ) 3.01 Tj +0 -23.5636 Td +(5065 ) 3.01 Tj +0 -24.8727 Td +(5066 ) 3.01 Tj +0 -26.1818 Td +(5067 ) 3.01 Tj +0 -27.4909 Td +(5068 ) 3.01 Tj +0 -28.8 Td +(5069 ) 3.01 Tj +0 -30.1091 Td +(5070 ) 3.01 Tj +0 -31.4182 Td +(5071 ) 3.01 Tj +0 -32.7273 Td +(5072 ) 3.01 Tj +0 -34.0364 Td +(5073 ) 3.01 Tj +0 -35.3454 Td +(5074 ) 3.01 Tj +0 -36.6545 Td +(5075 ) 3.01 Tj +0 -37.9636 Td +(5076 ) 3.01 Tj +0 -39.2727 Td +(5077 ) 3.01 Tj +0 -40.5818 Td +(5078 ) 3.01 Tj +0 -41.8909 Td +(5079 ) 3.01 Tj +0 -43.2 Td +(5080 ) 3.01 Tj +0 -44.5091 Td +(5081 ) 3.01 Tj +0 -45.8182 Td +(5082 ) 3.01 Tj +0 -47.1272 Td +(5083 ) 3.01 Tj +0 -48.4363 Td +(5084 ) 3.01 Tj +0 -49.7454 Td +(5085 ) 3.01 Tj +0 -51.0545 Td +(5086 ) 3.01 Tj +0 -52.3636 Td +(5087 ) 3.01 Tj +0 -53.6727 Td +(5088 ) 3.01 Tj +0 -54.9818 Td +(5089 ) 3.01 Tj +0 -56.2909 Td +(5090 ) 3.01 Tj +0 -57.6 Td +(5091 ) 3.01 Tj +0 -58.9091 Td +(5092 ) 3.01 Tj +0 -60.2181 Td +(5093 ) 3.01 Tj +0 -61.5272 Td +(5094 ) 3.01 Tj +0 -62.8363 Td +(5095 ) 3.01 Tj +0 -64.1454 Td +(5096 ) 3.01 Tj +0 -65.4545 Td +(5097 ) 3.01 Tj +0 -66.7636 Td +(5098 ) 3.01 Tj +0 -68.0727 Td +(5099 ) 3.01 Tj +0 -72 Td +(Sheet 50) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 58 58 +%%BeginPageSetup +%%PageOrientation: Landscape +__tumble pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/sysfile.c Page 1) 24.08 Tj +0 -3.92728 Td +(5100 #include "types.h") 13.846 Tj +0 -5.23637 Td +(5101 #include "stat.h") 13.244 Tj +0 -6.54546 Td +(5102 #include "param.h") 13.846 Tj +0 -7.85455 Td +(5103 #include "mmu.h") 12.642 Tj +0 -9.16364 Td +(5104 #include "proc.h") 13.244 Tj +0 -10.4727 Td +(5105 #include "defs.h") 13.244 Tj +0 -11.7818 Td +(5106 #include "x86.h") 12.642 Tj +0 -13.0909 Td +(5107 #include "traps.h") 13.846 Tj +0 -14.4 Td +(5108 #include "syscall.h") 15.05 Tj +0 -15.7091 Td +(5109 #include "spinlock.h") 15.652 Tj +0 -17.0182 Td +(5110 #include "buf.h") 12.642 Tj +0 -18.3273 Td +(5111 #include "fs.h") 12.04 Tj +0 -19.6364 Td +(5112 #include "fsvar.h") 13.846 Tj +0 -20.9455 Td +(5113 #include "elf.h") 12.642 Tj +0 -22.2545 Td +(5114 #include "file.h") 13.244 Tj +0 -23.5636 Td +(5115 #include "fcntl.h") 13.846 Tj +0 -24.8727 Td +(5116 ) 3.01 Tj +0 -26.1818 Td +(5117 // Fetch the nth word-sized system call argument as a file descriptor) 44.548 Tj +0 -27.4909 Td +(5118 // and return both the descriptor and the corresponding struct file.) 43.946 Tj +0 -28.8 Td +(5119 static int) 9.03 Tj +0 -30.1091 Td +(5120 argfd\(int argno, int *pfd, struct file **pf\)) 29.498 Tj +0 -31.4182 Td +(5121 {) 3.612 Tj +0 -32.7273 Td +(5122 int fd;) 8.428 Tj +0 -34.0364 Td +(5123 struct file *f;) 13.244 Tj +0 -35.3454 Td +(5124 struct proc *p = curproc[cpu\(\)];) 23.478 Tj +0 -36.6545 Td +(5125 ) 3.01 Tj +0 -37.9636 Td +(5126 if\(argint\(argno, &fd\) < 0\)) 19.866 Tj +0 -39.2727 Td +(5127 return -1;) 11.438 Tj +0 -40.5818 Td +(5128 if\(fd < 0 || fd >= NOFILE || \(f=p->ofile[fd]\) == 0\)) 34.916 Tj +0 -41.8909 Td +(5129 return -1;) 11.438 Tj +0 -43.2 Td +(5130 if\(pfd\)) 8.428 Tj +0 -44.5091 Td +(5131 *pfd = fd;) 11.438 Tj +0 -45.8182 Td +(5132 if\(pf\)) 7.826 Tj +0 -47.1272 Td +(5133 *pf = f;) 10.234 Tj +0 -48.4363 Td +(5134 return 0;) 9.632 Tj +0 -49.7454 Td +(5135 }) 3.612 Tj +0 -51.0545 Td +(5136 ) 3.01 Tj +0 -52.3636 Td +(5137 ) 3.01 Tj +0 -53.6727 Td +(5138 ) 3.01 Tj +0 -54.9818 Td +(5139 ) 3.01 Tj +0 -56.2909 Td +(5140 ) 3.01 Tj +0 -57.6 Td +(5141 ) 3.01 Tj +0 -58.9091 Td +(5142 ) 3.01 Tj +0 -60.2181 Td +(5143 ) 3.01 Tj +0 -61.5272 Td +(5144 ) 3.01 Tj +0 -62.8363 Td +(5145 ) 3.01 Tj +0 -64.1454 Td +(5146 ) 3.01 Tj +0 -65.4545 Td +(5147 ) 3.01 Tj +0 -66.7636 Td +(5148 ) 3.01 Tj +0 -68.0727 Td +(5149 ) 3.01 Tj +0 -72 Td +(Sheet 51) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/sysfile.c Page 2) 24.08 Tj +0 -3.92728 Td +(5150 // Allocate a file descriptor for the given file.) 32.508 Tj +0 -5.23637 Td +(5151 // Takes over file reference from caller on success.) 34.314 Tj +0 -6.54546 Td +(5152 static int) 9.03 Tj +0 -7.85455 Td +(5153 fdalloc\(struct file *f\)) 16.856 Tj +0 -9.16364 Td +(5154 {) 3.612 Tj +0 -10.4727 Td +(5155 int fd;) 8.428 Tj +0 -11.7818 Td +(5156 struct proc *p = curproc[cpu\(\)];) 23.478 Tj +0 -13.0909 Td +(5157 for\(fd = 0; fd < NOFILE; fd++\){) 22.876 Tj +0 -14.4 Td +(5158 if\(p->ofile[fd] == 0\){) 18.662 Tj +0 -15.7091 Td +(5159 p->ofile[fd] = f;) 16.856 Tj +0 -17.0182 Td +(5160 return fd;) 12.642 Tj +0 -18.3273 Td +(5161 }) 6.02 Tj +0 -19.6364 Td +(5162 }) 4.816 Tj +0 -20.9455 Td +(5163 return -1;) 10.234 Tj +0 -22.2545 Td +(5164 }) 3.612 Tj +0 -23.5636 Td +(5165 ) 3.01 Tj +0 -24.8727 Td +(5166 int) 4.816 Tj +0 -26.1818 Td +(5167 sys_pipe\(void\)) 11.438 Tj +0 -27.4909 Td +(5168 {) 3.612 Tj +0 -28.8 Td +(5169 int *fd;) 9.03 Tj +0 -30.1091 Td +(5170 struct file *rf = 0, *wf = 0;) 21.672 Tj +0 -31.4182 Td +(5171 int fd0, fd1;) 12.04 Tj +0 -32.7273 Td +(5172 struct proc *p = curproc[cpu\(\)];) 23.478 Tj +0 -34.0364 Td +(5173 ) 3.01 Tj +0 -35.3454 Td +(5174 if\(argptr\(0, \(void*\)&fd, 2*sizeof fd[0]\) < 0\)) 31.304 Tj +0 -36.6545 Td +(5175 return -1;) 11.438 Tj +0 -37.9636 Td +(5176 if\(pipe_alloc\(&rf, &wf\) < 0\)) 21.07 Tj +0 -39.2727 Td +(5177 return -1;) 11.438 Tj +0 -40.5818 Td +(5178 fd0 = -1;) 9.632 Tj +0 -41.8909 Td +(5179 if\(\(fd0 = fdalloc\(rf\)\) < 0 || \(fd1 = fdalloc\(wf\)\) < 0\){) 37.324 Tj +0 -43.2 Td +(5180 if\(fd0 >= 0\)) 12.642 Tj +0 -44.5091 Td +(5181 p->ofile[fd0] = 0;) 17.458 Tj +0 -45.8182 Td +(5182 fileclose\(rf\);) 13.846 Tj +0 -47.1272 Td +(5183 fileclose\(wf\);) 13.846 Tj +0 -48.4363 Td +(5184 return -1;) 11.438 Tj +0 -49.7454 Td +(5185 }) 4.816 Tj +0 -51.0545 Td +(5186 fd[0] = fd0;) 11.438 Tj +0 -52.3636 Td +(5187 fd[1] = fd1;) 11.438 Tj +0 -53.6727 Td +(5188 return 0;) 9.632 Tj +0 -54.9818 Td +(5189 }) 3.612 Tj +0 -56.2909 Td +(5190 ) 3.01 Tj +0 -57.6 Td +(5191 ) 3.01 Tj +0 -58.9091 Td +(5192 ) 3.01 Tj +0 -60.2181 Td +(5193 ) 3.01 Tj +0 -61.5272 Td +(5194 ) 3.01 Tj +0 -62.8363 Td +(5195 ) 3.01 Tj +0 -64.1454 Td +(5196 ) 3.01 Tj +0 -65.4545 Td +(5197 ) 3.01 Tj +0 -66.7636 Td +(5198 ) 3.01 Tj +0 -68.0727 Td +(5199 ) 3.01 Tj +0 -72 Td +(Sheet 51) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 59 59 +%%BeginPageSetup +%%PageOrientation: Landscape +pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/sysfile.c Page 3) 24.08 Tj +0 -3.92728 Td +(5200 int) 4.816 Tj +0 -5.23637 Td +(5201 sys_write\(void\)) 12.04 Tj +0 -6.54546 Td +(5202 {) 3.612 Tj +0 -7.85455 Td +(5203 struct file *f;) 13.244 Tj +0 -9.16364 Td +(5204 int n;) 7.826 Tj +0 -10.4727 Td +(5205 char *cp;) 9.632 Tj +0 -11.7818 Td +(5206 ) 3.01 Tj +0 -13.0909 Td +(5207 if\(argfd\(0, 0, &f\) < 0 || argint\(2, &n\) < 0 || argptr\(1, &cp, n\) < 0\)) 45.752 Tj +0 -14.4 Td +(5208 return -1;) 11.438 Tj +0 -15.7091 Td +(5209 return filewrite\(f, cp, n\);) 20.468 Tj +0 -17.0182 Td +(5210 }) 3.612 Tj +0 -18.3273 Td +(5211 ) 3.01 Tj +0 -19.6364 Td +(5212 int) 4.816 Tj +0 -20.9455 Td +(5213 sys_read\(void\)) 11.438 Tj +0 -22.2545 Td +(5214 {) 3.612 Tj +0 -23.5636 Td +(5215 struct file *f;) 13.244 Tj +0 -24.8727 Td +(5216 int n;) 7.826 Tj +0 -26.1818 Td +(5217 char *cp;) 9.632 Tj +0 -27.4909 Td +(5218 ) 3.01 Tj +0 -28.8 Td +(5219 if\(argfd\(0, 0, &f\) < 0 || argint\(2, &n\) < 0 || argptr\(1, &cp, n\) < 0\)) 45.752 Tj +0 -30.1091 Td +(5220 return -1;) 11.438 Tj +0 -31.4182 Td +(5221 return fileread\(f, cp, n\);) 19.866 Tj +0 -32.7273 Td +(5222 }) 3.612 Tj +0 -34.0364 Td +(5223 ) 3.01 Tj +0 -35.3454 Td +(5224 int) 4.816 Tj +0 -36.6545 Td +(5225 sys_close\(void\)) 12.04 Tj +0 -37.9636 Td +(5226 {) 3.612 Tj +0 -39.2727 Td +(5227 int fd;) 8.428 Tj +0 -40.5818 Td +(5228 struct file *f;) 13.244 Tj +0 -41.8909 Td +(5229 ) 3.01 Tj +0 -43.2 Td +(5230 if\(argfd\(0, &fd, &f\) < 0\)) 19.264 Tj +0 -44.5091 Td +(5231 return -1;) 11.438 Tj +0 -45.8182 Td +(5232 curproc[cpu\(\)]->ofile[fd] = 0;) 22.274 Tj +0 -47.1272 Td +(5233 fileclose\(f\);) 12.04 Tj +0 -48.4363 Td +(5234 return 0;) 9.632 Tj +0 -49.7454 Td +(5235 }) 3.612 Tj +0 -51.0545 Td +(5236 ) 3.01 Tj +0 -52.3636 Td +(5237 ) 3.01 Tj +0 -53.6727 Td +(5238 ) 3.01 Tj +0 -54.9818 Td +(5239 ) 3.01 Tj +0 -56.2909 Td +(5240 ) 3.01 Tj +0 -57.6 Td +(5241 ) 3.01 Tj +0 -58.9091 Td +(5242 ) 3.01 Tj +0 -60.2181 Td +(5243 ) 3.01 Tj +0 -61.5272 Td +(5244 ) 3.01 Tj +0 -62.8363 Td +(5245 ) 3.01 Tj +0 -64.1454 Td +(5246 ) 3.01 Tj +0 -65.4545 Td +(5247 ) 3.01 Tj +0 -66.7636 Td +(5248 ) 3.01 Tj +0 -68.0727 Td +(5249 ) 3.01 Tj +0 -72 Td +(Sheet 52) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/sysfile.c Page 4) 24.08 Tj +0 -3.92728 Td +(5250 int) 4.816 Tj +0 -5.23637 Td +(5251 sys_open\(void\)) 11.438 Tj +0 -6.54546 Td +(5252 {) 3.612 Tj +0 -7.85455 Td +(5253 struct inode *ip, *dp;) 17.458 Tj +0 -9.16364 Td +(5254 char *path;) 10.836 Tj +0 -10.4727 Td +(5255 int omode;) 10.234 Tj +0 -11.7818 Td +(5256 int fd;) 8.428 Tj +0 -13.0909 Td +(5257 struct file *f;) 13.244 Tj +0 -14.4 Td +(5258 char *last;) 10.836 Tj +0 -15.7091 Td +(5259 ) 3.01 Tj +0 -17.0182 Td +(5260 if\(argstr\(0, &path\) < 0 || argint\(1, &omode\) < 0\)) 33.712 Tj +0 -18.3273 Td +(5261 return -1;) 11.438 Tj +0 -19.6364 Td +(5262 ) 3.01 Tj +0 -20.9455 Td +(5263 if\(omode & O_CREATE\){) 16.856 Tj +0 -22.2545 Td +(5264 dp = namei\(path, NAMEI_CREATE, 0, &last, &ip\);) 33.11 Tj +0 -23.5636 Td +(5265 if\(dp\){) 9.632 Tj +0 -24.8727 Td +(5266 ip = mknod1\(dp, last, T_FILE, 0, 0\);) 28.294 Tj +0 -26.1818 Td +(5267 iput\(dp\);) 12.04 Tj +0 -27.4909 Td +(5268 if\(ip == 0\)) 13.244 Tj +0 -28.8 Td +(5269 return -1;) 13.846 Tj +0 -30.1091 Td +(5270 } else if\(ip == 0\){) 16.856 Tj +0 -31.4182 Td +(5271 return -1;) 12.642 Tj +0 -32.7273 Td +(5272 } else if\(ip->type == T_DIR\){) 22.876 Tj +0 -34.0364 Td +(5273 iput\(ip\);) 12.04 Tj +0 -35.3454 Td +(5274 return -1;) 12.642 Tj +0 -36.6545 Td +(5275 }) 6.02 Tj +0 -37.9636 Td +(5276 } else {) 9.03 Tj +0 -39.2727 Td +(5277 ip = namei\(path, NAMEI_LOOKUP, 0, 0, 0\);) 29.498 Tj +0 -40.5818 Td +(5278 if\(ip == 0\)) 12.04 Tj +0 -41.8909 Td +(5279 return -1;) 12.642 Tj +0 -43.2 Td +(5280 }) 4.816 Tj +0 -44.5091 Td +(5281 if\(ip->type == T_DIR && \(\(omode & O_RDWR\) || \(omode & O_WRONLY\)\)\){) 43.946 Tj +0 -45.8182 Td +(5282 iput\(ip\);) 10.836 Tj +0 -47.1272 Td +(5283 return -1;) 11.438 Tj +0 -48.4363 Td +(5284 }) 4.816 Tj +0 -49.7454 Td +(5285 ) 3.01 Tj +0 -51.0545 Td +(5286 if\(\(f = filealloc\(\)\) == 0\){) 20.468 Tj +0 -52.3636 Td +(5287 iput\(ip\);) 10.836 Tj +0 -53.6727 Td +(5288 return -1;) 11.438 Tj +0 -54.9818 Td +(5289 }) 4.816 Tj +0 -56.2909 Td +(5290 if\(\(fd = fdalloc\(f\)\) < 0\){) 19.866 Tj +0 -57.6 Td +(5291 iput\(ip\);) 10.836 Tj +0 -58.9091 Td +(5292 fileclose\(f\);) 13.244 Tj +0 -60.2181 Td +(5293 return -1;) 11.438 Tj +0 -61.5272 Td +(5294 }) 4.816 Tj +0 -62.8363 Td +(5295 ) 3.01 Tj +0 -64.1454 Td +(5296 ) 3.01 Tj +0 -65.4545 Td +(5297 ) 3.01 Tj +0 -66.7636 Td +(5298 ) 3.01 Tj +0 -68.0727 Td +(5299 ) 3.01 Tj +0 -72 Td +(Sheet 52) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 60 60 +%%BeginPageSetup +%%PageOrientation: Landscape +__tumble pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/sysfile.c Page 5) 24.08 Tj +0 -3.92728 Td +(5300 iunlock\(ip\);) 11.438 Tj +0 -5.23637 Td +(5301 f->type = FD_FILE;) 15.05 Tj +0 -6.54546 Td +(5302 if\(omode & O_RDWR\) {) 16.254 Tj +0 -7.85455 Td +(5303 f->readable = 1;) 15.05 Tj +0 -9.16364 Td +(5304 f->writable = 1;) 15.05 Tj +0 -10.4727 Td +(5305 } else if\(omode & O_WRONLY\) {) 21.672 Tj +0 -11.7818 Td +(5306 f->readable = 0;) 15.05 Tj +0 -13.0909 Td +(5307 f->writable = 1;) 15.05 Tj +0 -14.4 Td +(5308 } else {) 9.03 Tj +0 -15.7091 Td +(5309 f->readable = 1;) 15.05 Tj +0 -17.0182 Td +(5310 f->writable = 0;) 15.05 Tj +0 -18.3273 Td +(5311 }) 4.816 Tj +0 -19.6364 Td +(5312 f->ip = ip;) 10.836 Tj +0 -20.9455 Td +(5313 f->off = 0;) 10.836 Tj +0 -22.2545 Td +(5314 ) 3.01 Tj +0 -23.5636 Td +(5315 return fd;) 10.234 Tj +0 -24.8727 Td +(5316 }) 3.612 Tj +0 -26.1818 Td +(5317 ) 3.01 Tj +0 -27.4909 Td +(5318 int) 4.816 Tj +0 -28.8 Td +(5319 sys_mknod\(void\)) 12.04 Tj +0 -30.1091 Td +(5320 {) 3.612 Tj +0 -31.4182 Td +(5321 struct inode *nip;) 15.05 Tj +0 -32.7273 Td +(5322 char *path;) 10.836 Tj +0 -34.0364 Td +(5323 int len;) 9.03 Tj +0 -35.3454 Td +(5324 int type, major, minor;) 18.06 Tj +0 -36.6545 Td +(5325 ) 3.01 Tj +0 -37.9636 Td +(5326 if\(\(len=argstr\(0, &path\)\) < 0 || argint\(1, &type\) < 0 ||) 37.926 Tj +0 -39.2727 Td +(5327 argint\(2, &major\) < 0 || argint\(3, &minor\) < 0\)) 34.314 Tj +0 -40.5818 Td +(5328 return -1;) 11.438 Tj +0 -41.8909 Td +(5329 ) 3.01 Tj +0 -43.2 Td +(5330 if\(len >= DIRSIZ\)) 14.448 Tj +0 -44.5091 Td +(5331 return -1;) 11.438 Tj +0 -45.8182 Td +(5332 ) 3.01 Tj +0 -47.1272 Td +(5333 if\(\(nip = mknod\(path, type, major, minor\)\) == 0\)) 33.11 Tj +0 -48.4363 Td +(5334 return -1;) 11.438 Tj +0 -49.7454 Td +(5335 iput\(nip\);) 10.234 Tj +0 -51.0545 Td +(5336 return 0;) 9.632 Tj +0 -52.3636 Td +(5337 }) 3.612 Tj +0 -53.6727 Td +(5338 ) 3.01 Tj +0 -54.9818 Td +(5339 ) 3.01 Tj +0 -56.2909 Td +(5340 ) 3.01 Tj +0 -57.6 Td +(5341 ) 3.01 Tj +0 -58.9091 Td +(5342 ) 3.01 Tj +0 -60.2181 Td +(5343 ) 3.01 Tj +0 -61.5272 Td +(5344 ) 3.01 Tj +0 -62.8363 Td +(5345 ) 3.01 Tj +0 -64.1454 Td +(5346 ) 3.01 Tj +0 -65.4545 Td +(5347 ) 3.01 Tj +0 -66.7636 Td +(5348 ) 3.01 Tj +0 -68.0727 Td +(5349 ) 3.01 Tj +0 -72 Td +(Sheet 53) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/sysfile.c Page 6) 24.08 Tj +0 -3.92728 Td +(5350 int) 4.816 Tj +0 -5.23637 Td +(5351 sys_mkdir\(void\)) 12.04 Tj +0 -6.54546 Td +(5352 {) 3.612 Tj +0 -7.85455 Td +(5353 struct inode *nip;) 15.05 Tj +0 -9.16364 Td +(5354 struct inode *dp;) 14.448 Tj +0 -10.4727 Td +(5355 char *path;) 10.836 Tj +0 -11.7818 Td +(5356 struct dirent de;) 14.448 Tj +0 -13.0909 Td +(5357 char *last;) 10.836 Tj +0 -14.4 Td +(5358 ) 3.01 Tj +0 -15.7091 Td +(5359 if\(argstr\(0, &path\) < 0\)) 18.662 Tj +0 -17.0182 Td +(5360 return -1;) 11.438 Tj +0 -18.3273 Td +(5361 ) 3.01 Tj +0 -19.6364 Td +(5362 dp = namei\(path, NAMEI_CREATE, 0, &last, 0\);) 30.702 Tj +0 -20.9455 Td +(5363 if\(dp == 0\)) 10.836 Tj +0 -22.2545 Td +(5364 return -1;) 11.438 Tj +0 -23.5636 Td +(5365 ) 3.01 Tj +0 -24.8727 Td +(5366 nip = mknod1\(dp, last, T_DIR, 0, 0\);) 25.886 Tj +0 -26.1818 Td +(5367 if\(nip == 0\){) 12.04 Tj +0 -27.4909 Td +(5368 iput\(dp\);) 10.836 Tj +0 -28.8 Td +(5369 return -1;) 11.438 Tj +0 -30.1091 Td +(5370 }) 4.816 Tj +0 -31.4182 Td +(5371 ) 3.01 Tj +0 -32.7273 Td +(5372 dp->nlink++;) 11.438 Tj +0 -34.0364 Td +(5373 iupdate\(dp\);) 11.438 Tj +0 -35.3454 Td +(5374 ) 3.01 Tj +0 -36.6545 Td +(5375 memset\(de.name, '\\0', DIRSIZ\);) 22.274 Tj +0 -37.9636 Td +(5376 de.name[0] = '.';) 14.448 Tj +0 -39.2727 Td +(5377 de.inum = nip->inum;) 16.254 Tj +0 -40.5818 Td +(5378 writei\(nip, \(char*\) &de, 0, sizeof\(de\)\);) 28.294 Tj +0 -41.8909 Td +(5379 ) 3.01 Tj +0 -43.2 Td +(5380 de.inum = dp->inum;) 15.652 Tj +0 -44.5091 Td +(5381 de.name[1] = '.';) 14.448 Tj +0 -45.8182 Td +(5382 writei\(nip, \(char*\) &de, sizeof\(de\), sizeof\(de\)\);) 33.712 Tj +0 -47.1272 Td +(5383 ) 3.01 Tj +0 -48.4363 Td +(5384 iput\(dp\);) 9.632 Tj +0 -49.7454 Td +(5385 iput\(nip\);) 10.234 Tj +0 -51.0545 Td +(5386 ) 3.01 Tj +0 -52.3636 Td +(5387 return 0;) 9.632 Tj +0 -53.6727 Td +(5388 }) 3.612 Tj +0 -54.9818 Td +(5389 ) 3.01 Tj +0 -56.2909 Td +(5390 ) 3.01 Tj +0 -57.6 Td +(5391 ) 3.01 Tj +0 -58.9091 Td +(5392 ) 3.01 Tj +0 -60.2181 Td +(5393 ) 3.01 Tj +0 -61.5272 Td +(5394 ) 3.01 Tj +0 -62.8363 Td +(5395 ) 3.01 Tj +0 -64.1454 Td +(5396 ) 3.01 Tj +0 -65.4545 Td +(5397 ) 3.01 Tj +0 -66.7636 Td +(5398 ) 3.01 Tj +0 -68.0727 Td +(5399 ) 3.01 Tj +0 -72 Td +(Sheet 53) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 61 61 +%%BeginPageSetup +%%PageOrientation: Landscape +pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/sysfile.c Page 7) 24.08 Tj +0 -3.92728 Td +(5400 int) 4.816 Tj +0 -5.23637 Td +(5401 sys_chdir\(void\)) 12.04 Tj +0 -6.54546 Td +(5402 {) 3.612 Tj +0 -7.85455 Td +(5403 struct proc *p = curproc[cpu\(\)];) 23.478 Tj +0 -9.16364 Td +(5404 struct inode *ip;) 14.448 Tj +0 -10.4727 Td +(5405 char *path;) 10.836 Tj +0 -11.7818 Td +(5406 ) 3.01 Tj +0 -13.0909 Td +(5407 if\(argstr\(0, &path\) < 0\)) 18.662 Tj +0 -14.4 Td +(5408 return -1;) 11.438 Tj +0 -15.7091 Td +(5409 ) 3.01 Tj +0 -17.0182 Td +(5410 if\(\(ip = namei\(path, NAMEI_LOOKUP, 0, 0, 0\)\) == 0\)) 34.314 Tj +0 -18.3273 Td +(5411 return -1;) 11.438 Tj +0 -19.6364 Td +(5412 ) 3.01 Tj +0 -20.9455 Td +(5413 if\(ip == p->cwd\) {) 15.05 Tj +0 -22.2545 Td +(5414 iput\(ip\);) 10.836 Tj +0 -23.5636 Td +(5415 return 0;) 10.836 Tj +0 -24.8727 Td +(5416 }) 4.816 Tj +0 -26.1818 Td +(5417 ) 3.01 Tj +0 -27.4909 Td +(5418 if\(ip->type != T_DIR\) {) 18.06 Tj +0 -28.8 Td +(5419 iput\(ip\);) 10.836 Tj +0 -30.1091 Td +(5420 return -1;) 11.438 Tj +0 -31.4182 Td +(5421 }) 4.816 Tj +0 -32.7273 Td +(5422 ) 3.01 Tj +0 -34.0364 Td +(5423 idecref\(p->cwd\);) 13.846 Tj +0 -35.3454 Td +(5424 p->cwd = ip;) 11.438 Tj +0 -36.6545 Td +(5425 iunlock\(p->cwd\);) 13.846 Tj +0 -37.9636 Td +(5426 return 0;) 9.632 Tj +0 -39.2727 Td +(5427 }) 3.612 Tj +0 -40.5818 Td +(5428 ) 3.01 Tj +0 -41.8909 Td +(5429 int) 4.816 Tj +0 -43.2 Td +(5430 sys_unlink\(void\)) 12.642 Tj +0 -44.5091 Td +(5431 {) 3.612 Tj +0 -45.8182 Td +(5432 char *path;) 10.836 Tj +0 -47.1272 Td +(5433 ) 3.01 Tj +0 -48.4363 Td +(5434 if\(argstr\(0, &path\) < 0\)) 18.662 Tj +0 -49.7454 Td +(5435 return -1;) 11.438 Tj +0 -51.0545 Td +(5436 return unlink\(path\);) 16.254 Tj +0 -52.3636 Td +(5437 }) 3.612 Tj +0 -53.6727 Td +(5438 ) 3.01 Tj +0 -54.9818 Td +(5439 int) 4.816 Tj +0 -56.2909 Td +(5440 sys_fstat\(void\)) 12.04 Tj +0 -57.6 Td +(5441 {) 3.612 Tj +0 -58.9091 Td +(5442 struct file *f;) 13.244 Tj +0 -60.2181 Td +(5443 struct stat *st;) 13.846 Tj +0 -61.5272 Td +(5444 ) 3.01 Tj +0 -62.8363 Td +(5445 if\(argfd\(0, 0, &f\) < 0 || argptr\(1, \(void*\)&st, sizeof *st\) < 0\)) 42.742 Tj +0 -64.1454 Td +(5446 return -1;) 11.438 Tj +0 -65.4545 Td +(5447 return filestat\(f, st\);) 18.06 Tj +0 -66.7636 Td +(5448 }) 3.612 Tj +0 -68.0727 Td +(5449 ) 3.01 Tj +0 -72 Td +(Sheet 54) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/sysfile.c Page 8) 24.08 Tj +0 -3.92728 Td +(5450 int) 4.816 Tj +0 -5.23637 Td +(5451 sys_dup\(void\)) 10.836 Tj +0 -6.54546 Td +(5452 {) 3.612 Tj +0 -7.85455 Td +(5453 struct file *f;) 13.244 Tj +0 -9.16364 Td +(5454 int fd;) 8.428 Tj +0 -10.4727 Td +(5455 ) 3.01 Tj +0 -11.7818 Td +(5456 if\(argfd\(0, 0, &f\) < 0\)) 18.06 Tj +0 -13.0909 Td +(5457 return -1;) 11.438 Tj +0 -14.4 Td +(5458 if\(\(fd=fdalloc\(f\)\) < 0\)) 18.06 Tj +0 -15.7091 Td +(5459 return -1;) 11.438 Tj +0 -17.0182 Td +(5460 fileincref\(f\);) 12.642 Tj +0 -18.3273 Td +(5461 return fd;) 10.234 Tj +0 -19.6364 Td +(5462 }) 3.612 Tj +0 -20.9455 Td +(5463 ) 3.01 Tj +0 -22.2545 Td +(5464 int) 4.816 Tj +0 -23.5636 Td +(5465 sys_link\(void\)) 11.438 Tj +0 -24.8727 Td +(5466 {) 3.612 Tj +0 -26.1818 Td +(5467 char *old, *new;) 13.846 Tj +0 -27.4909 Td +(5468 ) 3.01 Tj +0 -28.8 Td +(5469 if\(argstr\(0, &old\) < 0 || argstr\(1, &new\) < 0\)) 31.906 Tj +0 -30.1091 Td +(5470 return -1;) 11.438 Tj +0 -31.4182 Td +(5471 return link\(old, new\);) 17.458 Tj +0 -32.7273 Td +(5472 }) 3.612 Tj +0 -34.0364 Td +(5473 ) 3.01 Tj +0 -35.3454 Td +(5474 int) 4.816 Tj +0 -36.6545 Td +(5475 sys_exec\(void\)) 11.438 Tj +0 -37.9636 Td +(5476 {) 3.612 Tj +0 -39.2727 Td +(5477 struct proc *cp = curproc[cpu\(\)];) 24.08 Tj +0 -40.5818 Td +(5478 uint sz=0, ap, sp, p1, p2;) 19.866 Tj +0 -41.8909 Td +(5479 int i, nargs, argbytes, len;) 21.07 Tj +0 -43.2 Td +(5480 struct inode *ip;) 14.448 Tj +0 -44.5091 Td +(5481 struct elfhdr elf;) 15.05 Tj +0 -45.8182 Td +(5482 struct proghdr ph;) 15.05 Tj +0 -47.1272 Td +(5483 char *mem = 0;) 12.642 Tj +0 -48.4363 Td +(5484 char *path, *s;) 13.244 Tj +0 -49.7454 Td +(5485 uint argv;) 10.234 Tj +0 -51.0545 Td +(5486 ) 3.01 Tj +0 -52.3636 Td +(5487 if\(argstr\(0, &path\) < 0 || argint\(1, \(int*\)&argv\) < 0\)) 36.722 Tj +0 -53.6727 Td +(5488 return -1;) 11.438 Tj +0 -54.9818 Td +(5489 ) 3.01 Tj +0 -56.2909 Td +(5490 ip = namei\(path, NAMEI_LOOKUP, 0, 0, 0\);) 28.294 Tj +0 -57.6 Td +(5491 if\(ip == 0\)) 10.836 Tj +0 -58.9091 Td +(5492 return -1;) 11.438 Tj +0 -60.2181 Td +(5493 ) 3.01 Tj +0 -61.5272 Td +(5494 if\(readi\(ip, \(char*\)&elf, 0, sizeof\(elf\)\) < sizeof\(elf\)\)) 37.926 Tj +0 -62.8363 Td +(5495 goto bad;) 10.836 Tj +0 -64.1454 Td +(5496 ) 3.01 Tj +0 -65.4545 Td +(5497 if\(elf.magic != ELF_MAGIC\)) 19.866 Tj +0 -66.7636 Td +(5498 goto bad;) 10.836 Tj +0 -68.0727 Td +(5499 ) 3.01 Tj +0 -72 Td +(Sheet 54) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 62 62 +%%BeginPageSetup +%%PageOrientation: Landscape +__tumble pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/sysfile.c Page 9) 24.08 Tj +0 -3.92728 Td +(5500 sz = 0;) 8.428 Tj +0 -5.23637 Td +(5501 for\(i = 0; i < elf.phnum; i++\){) 22.876 Tj +0 -6.54546 Td +(5502 if\(readi\(ip, \(char*\)&ph, elf.phoff + i * sizeof\(ph\),) 36.722 Tj +0 -7.85455 Td +(5503 sizeof\(ph\)\) != sizeof\(ph\)\)) 26.488 Tj +0 -9.16364 Td +(5504 goto bad;) 12.04 Tj +0 -10.4727 Td +(5505 if\(ph.type != ELF_PROG_LOAD\)) 22.274 Tj +0 -11.7818 Td +(5506 continue;) 12.04 Tj +0 -13.0909 Td +(5507 if\(ph.memsz < ph.filesz\)) 19.866 Tj +0 -14.4 Td +(5508 goto bad;) 12.04 Tj +0 -15.7091 Td +(5509 sz += ph.memsz;) 14.448 Tj +0 -17.0182 Td +(5510 }) 4.816 Tj +0 -18.3273 Td +(5511 ) 3.01 Tj +0 -19.6364 Td +(5512 sz += 4096 - \(sz % 4096\);) 19.264 Tj +0 -20.9455 Td +(5513 sz += 4096;) 10.836 Tj +0 -22.2545 Td +(5514 ) 3.01 Tj +0 -23.5636 Td +(5515 mem = kalloc\(sz\);) 14.448 Tj +0 -24.8727 Td +(5516 if\(mem == 0\)) 11.438 Tj +0 -26.1818 Td +(5517 goto bad;) 10.836 Tj +0 -27.4909 Td +(5518 memset\(mem, 0, sz\);) 15.652 Tj +0 -28.8 Td +(5519 ) 3.01 Tj +0 -30.1091 Td +(5520 nargs = 0;) 10.234 Tj +0 -31.4182 Td +(5521 argbytes = 0;) 12.04 Tj +0 -32.7273 Td +(5522 for\(i = 0;; i++\){) 14.448 Tj +0 -34.0364 Td +(5523 if\(fetchint\(cp, argv + 4*i, \(int*\)&ap\) < 0\)) 31.304 Tj +0 -35.3454 Td +(5524 goto bad;) 12.04 Tj +0 -36.6545 Td +(5525 if\(ap == 0\)) 12.04 Tj +0 -37.9636 Td +(5526 break;) 10.234 Tj +0 -39.2727 Td +(5527 len = fetchstr\(cp, ap, &s\);) 21.672 Tj +0 -40.5818 Td +(5528 if\(len < 0\)) 12.04 Tj +0 -41.8909 Td +(5529 goto bad;) 12.04 Tj +0 -43.2 Td +(5530 nargs++;) 10.234 Tj +0 -44.5091 Td +(5531 argbytes += len + 1;) 17.458 Tj +0 -45.8182 Td +(5532 }) 4.816 Tj +0 -47.1272 Td +(5533 ) 3.01 Tj +0 -48.4363 Td +(5534 // argn\\0) 9.632 Tj +0 -49.7454 Td +(5535 // ...) 7.826 Tj +0 -51.0545 Td +(5536 // arg0\\0) 9.632 Tj +0 -52.3636 Td +(5537 // 0) 6.622 Tj +0 -53.6727 Td +(5538 // ptr to argn) 12.642 Tj +0 -54.9818 Td +(5539 // ...) 7.826 Tj +0 -56.2909 Td +(5540 // 12: ptr to arg0) 15.05 Tj +0 -57.6 Td +(5541 // 8: argv \(points to ptr to arg0\)) 25.284 Tj +0 -58.9091 Td +(5542 // 4: argc) 10.836 Tj +0 -60.2181 Td +(5543 // 0: fake return pc) 16.856 Tj +0 -61.5272 Td +(5544 sp = sz - argbytes - \(nargs+1\)*4 - 4 - 4 - 4;) 31.304 Tj +0 -62.8363 Td +(5545 *\(uint*\)\(mem + sp\) = 0xffffffff;) 23.478 Tj +0 -64.1454 Td +(5546 *\(uint*\)\(mem + sp + 4\) = nargs;) 22.876 Tj +0 -65.4545 Td +(5547 *\(uint*\)\(mem + sp + 8\) = \(uint\)\(sp + 12\);) 28.896 Tj +0 -66.7636 Td +(5548 ) 3.01 Tj +0 -68.0727 Td +(5549 ) 3.01 Tj +0 -72 Td +(Sheet 55) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/sysfile.c Page 10) 24.682 Tj +0 -3.92728 Td +(5550 p1 = sp + 12;) 12.04 Tj +0 -5.23637 Td +(5551 p2 = sp + 12 + \(nargs + 1\) * 4;) 22.876 Tj +0 -6.54546 Td +(5552 for\(i = 0; i < nargs; i++\){) 20.468 Tj +0 -7.85455 Td +(5553 fetchint\(cp, argv + 4*i, \(int*\)&ap\);) 27.09 Tj +0 -9.16364 Td +(5554 len = fetchstr\(cp, ap, &s\);) 21.672 Tj +0 -10.4727 Td +(5555 memmove\(mem + p2, s, len + 1\);) 23.478 Tj +0 -11.7818 Td +(5556 *\(uint*\)\(mem + p1\) = p2;) 19.866 Tj +0 -13.0909 Td +(5557 p1 += 4;) 10.234 Tj +0 -14.4 Td +(5558 p2 += len + 1;) 13.846 Tj +0 -15.7091 Td +(5559 }) 4.816 Tj +0 -17.0182 Td +(5560 *\(uint*\)\(mem + p1\) = 0;) 18.06 Tj +0 -18.3273 Td +(5561 ) 3.01 Tj +0 -19.6364 Td +(5562 // commit to the new image.) 20.468 Tj +0 -20.9455 Td +(5563 kfree\(cp->mem, cp->sz\);) 18.06 Tj +0 -22.2545 Td +(5564 cp->sz = sz;) 11.438 Tj +0 -23.5636 Td +(5565 cp->mem = mem;) 12.642 Tj +0 -24.8727 Td +(5566 mem = 0;) 9.03 Tj +0 -26.1818 Td +(5567 ) 3.01 Tj +0 -27.4909 Td +(5568 for\(i = 0; i < elf.phnum; i++\){) 22.876 Tj +0 -28.8 Td +(5569 if\(readi\(ip, \(char*\)&ph, elf.phoff + i * sizeof\(ph\),) 36.722 Tj +0 -30.1091 Td +(5570 sizeof\(ph\)\) != sizeof\(ph\)\)) 26.488 Tj +0 -31.4182 Td +(5571 goto bad2;) 12.642 Tj +0 -32.7273 Td +(5572 if\(ph.type != ELF_PROG_LOAD\)) 22.274 Tj +0 -34.0364 Td +(5573 continue;) 12.04 Tj +0 -35.3454 Td +(5574 if\(ph.va + ph.memsz > sz\)) 20.468 Tj +0 -36.6545 Td +(5575 goto bad2;) 12.642 Tj +0 -37.9636 Td +(5576 if\(readi\(ip, cp->mem + ph.va, ph.offset, ph.filesz\) != ph.filesz\)) 44.548 Tj +0 -39.2727 Td +(5577 goto bad2;) 12.642 Tj +0 -40.5818 Td +(5578 memset\(cp->mem + ph.va + ph.filesz, 0, ph.memsz - ph.filesz\);) 42.14 Tj +0 -41.8909 Td +(5579 }) 4.816 Tj +0 -43.2 Td +(5580 ) 3.01 Tj +0 -44.5091 Td +(5581 iput\(ip\);) 9.632 Tj +0 -45.8182 Td +(5582 ) 3.01 Tj +0 -47.1272 Td +(5583 cp->tf->eip = elf.entry;) 18.662 Tj +0 -48.4363 Td +(5584 cp->tf->esp = sp;) 14.448 Tj +0 -49.7454 Td +(5585 setupsegs\(cp\);) 12.642 Tj +0 -51.0545 Td +(5586 ) 3.01 Tj +0 -52.3636 Td +(5587 return 0;) 9.632 Tj +0 -53.6727 Td +(5588 ) 3.01 Tj +0 -54.9818 Td +(5589 bad:) 6.02 Tj +0 -56.2909 Td +(5590 if\(mem\)) 8.428 Tj +0 -57.6 Td +(5591 kfree\(mem, sz\);) 14.448 Tj +0 -58.9091 Td +(5592 iput\(ip\);) 9.632 Tj +0 -60.2181 Td +(5593 return -1;) 10.234 Tj +0 -61.5272 Td +(5594 ) 3.01 Tj +0 -62.8363 Td +(5595 bad2:) 6.622 Tj +0 -64.1454 Td +(5596 iput\(ip\);) 9.632 Tj +0 -65.4545 Td +(5597 proc_exit\(\);) 11.438 Tj +0 -66.7636 Td +(5598 return 0;) 9.632 Tj +0 -68.0727 Td +(5599 }) 3.612 Tj +0 -72 Td +(Sheet 55) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 63 63 +%%BeginPageSetup +%%PageOrientation: Landscape +pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/pipe.c Page 1) 22.274 Tj +0 -3.92728 Td +(5600 #include "types.h") 13.846 Tj +0 -5.23637 Td +(5601 #include "param.h") 13.846 Tj +0 -6.54546 Td +(5602 #include "x86.h") 12.642 Tj +0 -7.85455 Td +(5603 #include "mmu.h") 12.642 Tj +0 -9.16364 Td +(5604 #include "proc.h") 13.244 Tj +0 -10.4727 Td +(5605 #include "defs.h") 13.244 Tj +0 -11.7818 Td +(5606 #include "file.h") 13.244 Tj +0 -13.0909 Td +(5607 #include "spinlock.h") 15.652 Tj +0 -14.4 Td +(5608 ) 3.01 Tj +0 -15.7091 Td +(5609 #define PIPESIZE 512) 15.05 Tj +0 -17.0182 Td +(5610 ) 3.01 Tj +0 -18.3273 Td +(5611 struct pipe {) 10.836 Tj +0 -19.6364 Td +(5612 int readopen; // read fd is still open) 27.09 Tj +0 -20.9455 Td +(5613 int writeopen; // write fd is still open) 28.294 Tj +0 -22.2545 Td +(5614 int writep; // next index to write) 24.682 Tj +0 -23.5636 Td +(5615 int readp; // next index to read) 24.08 Tj +0 -24.8727 Td +(5616 struct spinlock lock;) 16.856 Tj +0 -26.1818 Td +(5617 char data[PIPESIZE];) 16.254 Tj +0 -27.4909 Td +(5618 };) 4.214 Tj +0 -28.8 Td +(5619 ) 3.01 Tj +0 -30.1091 Td +(5620 int) 4.816 Tj +0 -31.4182 Td +(5621 pipe_alloc\(struct file **f0, struct file **f1\)) 30.702 Tj +0 -32.7273 Td +(5622 {) 3.612 Tj +0 -34.0364 Td +(5623 *f0 = *f1 = 0;) 12.642 Tj +0 -35.3454 Td +(5624 struct pipe *p = 0;) 15.652 Tj +0 -36.6545 Td +(5625 ) 3.01 Tj +0 -37.9636 Td +(5626 if\(\(*f0 = filealloc\(\)\) == 0\)) 21.07 Tj +0 -39.2727 Td +(5627 goto oops;) 11.438 Tj +0 -40.5818 Td +(5628 if\(\(*f1 = filealloc\(\)\) == 0\)) 21.07 Tj +0 -41.8909 Td +(5629 goto oops;) 11.438 Tj +0 -43.2 Td +(5630 if\(\(p = \(struct pipe*\) kalloc\(PAGE\)\) == 0\)) 29.498 Tj +0 -44.5091 Td +(5631 goto oops;) 11.438 Tj +0 -45.8182 Td +(5632 p->readopen = 1;) 13.846 Tj +0 -47.1272 Td +(5633 p->writeopen = 1;) 14.448 Tj +0 -48.4363 Td +(5634 p->writep = 0;) 12.642 Tj +0 -49.7454 Td +(5635 p->readp = 0;) 12.04 Tj +0 -51.0545 Td +(5636 initlock\(&p->lock, "pipe"\);) 20.468 Tj +0 -52.3636 Td +(5637 \(*f0\)->type = FD_PIPE;) 17.458 Tj +0 -53.6727 Td +(5638 \(*f0\)->readable = 1;) 16.254 Tj +0 -54.9818 Td +(5639 \(*f0\)->writable = 0;) 16.254 Tj +0 -56.2909 Td +(5640 \(*f0\)->pipe = p;) 13.846 Tj +0 -57.6 Td +(5641 \(*f1\)->type = FD_PIPE;) 17.458 Tj +0 -58.9091 Td +(5642 \(*f1\)->readable = 0;) 16.254 Tj +0 -60.2181 Td +(5643 \(*f1\)->writable = 1;) 16.254 Tj +0 -61.5272 Td +(5644 \(*f1\)->pipe = p;) 13.846 Tj +0 -62.8363 Td +(5645 return 0;) 9.632 Tj +0 -64.1454 Td +(5646 oops:) 6.622 Tj +0 -65.4545 Td +(5647 if\(p\)) 7.224 Tj +0 -66.7636 Td +(5648 kfree\(\(char*\) p, PAGE\);) 19.264 Tj +0 -68.0727 Td +(5649 if\(*f0\){) 9.03 Tj +0 -72 Td +(Sheet 56) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/pipe.c Page 2) 22.274 Tj +0 -3.92728 Td +(5650 \(*f0\)->type = FD_NONE;) 18.662 Tj +0 -5.23637 Td +(5651 fileclose\(*f0\);) 14.448 Tj +0 -6.54546 Td +(5652 }) 4.816 Tj +0 -7.85455 Td +(5653 if\(*f1\){) 9.03 Tj +0 -9.16364 Td +(5654 \(*f1\)->type = FD_NONE;) 18.662 Tj +0 -10.4727 Td +(5655 fileclose\(*f1\);) 14.448 Tj +0 -11.7818 Td +(5656 }) 4.816 Tj +0 -13.0909 Td +(5657 return -1;) 10.234 Tj +0 -14.4 Td +(5658 }) 3.612 Tj +0 -15.7091 Td +(5659 ) 3.01 Tj +0 -17.0182 Td +(5660 void) 5.418 Tj +0 -18.3273 Td +(5661 pipe_close\(struct pipe *p, int writable\)) 27.09 Tj +0 -19.6364 Td +(5662 {) 3.612 Tj +0 -20.9455 Td +(5663 acquire\(&p->lock\);) 15.05 Tj +0 -22.2545 Td +(5664 ) 3.01 Tj +0 -23.5636 Td +(5665 if\(writable\){) 12.04 Tj +0 -24.8727 Td +(5666 p->writeopen = 0;) 15.652 Tj +0 -26.1818 Td +(5667 wakeup\(&p->readp\);) 16.254 Tj +0 -27.4909 Td +(5668 } else {) 9.03 Tj +0 -28.8 Td +(5669 p->readopen = 0;) 15.05 Tj +0 -30.1091 Td +(5670 wakeup\(&p->writep\);) 16.856 Tj +0 -31.4182 Td +(5671 }) 4.816 Tj +0 -32.7273 Td +(5672 ) 3.01 Tj +0 -34.0364 Td +(5673 release\(&p->lock\);) 15.05 Tj +0 -35.3454 Td +(5674 ) 3.01 Tj +0 -36.6545 Td +(5675 if\(p->readopen == 0 && p->writeopen == 0\)) 28.896 Tj +0 -37.9636 Td +(5676 kfree\(\(char*\) p, PAGE\);) 19.264 Tj +0 -39.2727 Td +(5677 }) 3.612 Tj +0 -40.5818 Td +(5678 ) 3.01 Tj +0 -41.8909 Td +(5679 int) 4.816 Tj +0 -43.2 Td +(5680 pipe_write\(struct pipe *p, char *addr, int n\)) 30.1 Tj +0 -44.5091 Td +(5681 {) 3.612 Tj +0 -45.8182 Td +(5682 int i;) 7.826 Tj +0 -47.1272 Td +(5683 ) 3.01 Tj +0 -48.4363 Td +(5684 acquire\(&p->lock\);) 15.05 Tj +0 -49.7454 Td +(5685 ) 3.01 Tj +0 -51.0545 Td +(5686 for\(i = 0; i < n; i++\){) 18.06 Tj +0 -52.3636 Td +(5687 while\(\(\(p->writep + 1\) % PIPESIZE\) == p->readp\){) 34.314 Tj +0 -53.6727 Td +(5688 if\(p->readopen == 0\){) 19.264 Tj +0 -54.9818 Td +(5689 release\(&p->lock\);) 18.662 Tj +0 -56.2909 Td +(5690 return -1;) 13.846 Tj +0 -57.6 Td +(5691 }) 7.224 Tj +0 -58.9091 Td +(5692 wakeup\(&p->readp\);) 17.458 Tj +0 -60.2181 Td +(5693 sleep\(&p->writep, &p->lock\);) 23.478 Tj +0 -61.5272 Td +(5694 }) 6.02 Tj +0 -62.8363 Td +(5695 p->data[p->writep] = addr[i];) 22.876 Tj +0 -64.1454 Td +(5696 p->writep = \(p->writep + 1\) % PIPESIZE;) 28.896 Tj +0 -65.4545 Td +(5697 }) 4.816 Tj +0 -66.7636 Td +(5698 ) 3.01 Tj +0 -68.0727 Td +(5699 ) 3.01 Tj +0 -72 Td +(Sheet 56) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 64 64 +%%BeginPageSetup +%%PageOrientation: Landscape +__tumble pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/pipe.c Page 3) 22.274 Tj +0 -3.92728 Td +(5700 release\(&p->lock\);) 15.05 Tj +0 -5.23637 Td +(5701 wakeup\(&p->readp\);) 15.05 Tj +0 -6.54546 Td +(5702 return i;) 9.632 Tj +0 -7.85455 Td +(5703 }) 3.612 Tj +0 -9.16364 Td +(5704 ) 3.01 Tj +0 -10.4727 Td +(5705 int) 4.816 Tj +0 -11.7818 Td +(5706 pipe_read\(struct pipe *p, char *addr, int n\)) 29.498 Tj +0 -13.0909 Td +(5707 {) 3.612 Tj +0 -14.4 Td +(5708 int i;) 7.826 Tj +0 -15.7091 Td +(5709 ) 3.01 Tj +0 -17.0182 Td +(5710 acquire\(&p->lock\);) 15.05 Tj +0 -18.3273 Td +(5711 ) 3.01 Tj +0 -19.6364 Td +(5712 while\(p->readp == p->writep\){) 21.672 Tj +0 -20.9455 Td +(5713 if\(p->writeopen == 0\){) 18.662 Tj +0 -22.2545 Td +(5714 release\(&p->lock\);) 17.458 Tj +0 -23.5636 Td +(5715 return 0;) 12.04 Tj +0 -24.8727 Td +(5716 }) 6.02 Tj +0 -26.1818 Td +(5717 sleep\(&p->readp, &p->lock\);) 21.672 Tj +0 -27.4909 Td +(5718 }) 4.816 Tj +0 -28.8 Td +(5719 ) 3.01 Tj +0 -30.1091 Td +(5720 for\(i = 0; i < n; i++\){) 18.06 Tj +0 -31.4182 Td +(5721 if\(p->readp == p->writep\)) 20.468 Tj +0 -32.7273 Td +(5722 break;) 10.234 Tj +0 -34.0364 Td +(5723 addr[i] = p->data[p->readp];) 22.274 Tj +0 -35.3454 Td +(5724 p->readp = \(p->readp + 1\) % PIPESIZE;) 27.692 Tj +0 -36.6545 Td +(5725 }) 4.816 Tj +0 -37.9636 Td +(5726 ) 3.01 Tj +0 -39.2727 Td +(5727 release\(&p->lock\);) 15.05 Tj +0 -40.5818 Td +(5728 wakeup\(&p->writep\);) 15.652 Tj +0 -41.8909 Td +(5729 return i;) 9.632 Tj +0 -43.2 Td +(5730 }) 3.612 Tj +0 -44.5091 Td +(5731 ) 3.01 Tj +0 -45.8182 Td +(5732 ) 3.01 Tj +0 -47.1272 Td +(5733 ) 3.01 Tj +0 -48.4363 Td +(5734 ) 3.01 Tj +0 -49.7454 Td +(5735 ) 3.01 Tj +0 -51.0545 Td +(5736 ) 3.01 Tj +0 -52.3636 Td +(5737 ) 3.01 Tj +0 -53.6727 Td +(5738 ) 3.01 Tj +0 -54.9818 Td +(5739 ) 3.01 Tj +0 -56.2909 Td +(5740 ) 3.01 Tj +0 -57.6 Td +(5741 ) 3.01 Tj +0 -58.9091 Td +(5742 ) 3.01 Tj +0 -60.2181 Td +(5743 ) 3.01 Tj +0 -61.5272 Td +(5744 ) 3.01 Tj +0 -62.8363 Td +(5745 ) 3.01 Tj +0 -64.1454 Td +(5746 ) 3.01 Tj +0 -65.4545 Td +(5747 ) 3.01 Tj +0 -66.7636 Td +(5748 ) 3.01 Tj +0 -68.0727 Td +(5749 ) 3.01 Tj +0 -72 Td +(Sheet 57) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/string.c Page 1) 23.478 Tj +0 -3.92728 Td +(5750 #include "types.h") 13.846 Tj +0 -5.23637 Td +(5751 #include "defs.h") 13.244 Tj +0 -6.54546 Td +(5752 ) 3.01 Tj +0 -7.85455 Td +(5753 void*) 6.02 Tj +0 -9.16364 Td +(5754 memset\(void *dst, int c, uint n\)) 22.274 Tj +0 -10.4727 Td +(5755 {) 3.612 Tj +0 -11.7818 Td +(5756 char *d = \(char*\) dst;) 17.458 Tj +0 -13.0909 Td +(5757 ) 3.01 Tj +0 -14.4 Td +(5758 while\(n-- > 0\)) 12.642 Tj +0 -15.7091 Td +(5759 *d++ = c;) 10.836 Tj +0 -17.0182 Td +(5760 ) 3.01 Tj +0 -18.3273 Td +(5761 return dst;) 10.836 Tj +0 -19.6364 Td +(5762 }) 3.612 Tj +0 -20.9455 Td +(5763 ) 3.01 Tj +0 -22.2545 Td +(5764 int) 4.816 Tj +0 -23.5636 Td +(5765 memcmp\(const void *v1, const void *v2, uint n\)) 30.702 Tj +0 -24.8727 Td +(5766 {) 3.612 Tj +0 -26.1818 Td +(5767 const uchar *s1 = \(const uchar*\) v1;) 25.886 Tj +0 -27.4909 Td +(5768 const uchar *s2 = \(const uchar*\) v2;) 25.886 Tj +0 -28.8 Td +(5769 ) 3.01 Tj +0 -30.1091 Td +(5770 while\(n-- > 0\) {) 13.846 Tj +0 -31.4182 Td +(5771 if\(*s1 != *s2\)) 13.846 Tj +0 -32.7273 Td +(5772 return \(int\) *s1 - \(int\) *s2;) 24.08 Tj +0 -34.0364 Td +(5773 s1++, s2++;) 12.04 Tj +0 -35.3454 Td +(5774 }) 4.816 Tj +0 -36.6545 Td +(5775 ) 3.01 Tj +0 -37.9636 Td +(5776 return 0;) 9.632 Tj +0 -39.2727 Td +(5777 }) 3.612 Tj +0 -40.5818 Td +(5778 ) 3.01 Tj +0 -41.8909 Td +(5779 void*) 6.02 Tj +0 -43.2 Td +(5780 memmove\(void *dst, const void *src, uint n\)) 28.896 Tj +0 -44.5091 Td +(5781 {) 3.612 Tj +0 -45.8182 Td +(5782 const char *s;) 12.642 Tj +0 -47.1272 Td +(5783 char *d;) 9.03 Tj +0 -48.4363 Td +(5784 ) 3.01 Tj +0 -49.7454 Td +(5785 s = src;) 9.03 Tj +0 -51.0545 Td +(5786 d = dst;) 9.03 Tj +0 -52.3636 Td +(5787 if\(s < d && s + n > d\) {) 18.662 Tj +0 -53.6727 Td +(5788 s += n;) 9.632 Tj +0 -54.9818 Td +(5789 d += n;) 9.632 Tj +0 -56.2909 Td +(5790 while\(n-- > 0\)) 13.846 Tj +0 -57.6 Td +(5791 *--d = *--s;) 13.846 Tj +0 -58.9091 Td +(5792 } else) 7.826 Tj +0 -60.2181 Td +(5793 while\(n-- > 0\)) 13.846 Tj +0 -61.5272 Td +(5794 *d++ = *s++;) 13.846 Tj +0 -62.8363 Td +(5795 ) 3.01 Tj +0 -64.1454 Td +(5796 return dst;) 10.836 Tj +0 -65.4545 Td +(5797 }) 3.612 Tj +0 -66.7636 Td +(5798 ) 3.01 Tj +0 -68.0727 Td +(5799 ) 3.01 Tj +0 -72 Td +(Sheet 57) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 65 65 +%%BeginPageSetup +%%PageOrientation: Landscape +pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/string.c Page 2) 23.478 Tj +0 -3.92728 Td +(5800 int) 4.816 Tj +0 -5.23637 Td +(5801 strncmp\(const char *p, const char *q, uint n\)) 30.1 Tj +0 -6.54546 Td +(5802 {) 3.612 Tj +0 -7.85455 Td +(5803 while\(n > 0 && *p && *p == *q\)) 22.274 Tj +0 -9.16364 Td +(5804 n--, p++, q++;) 13.846 Tj +0 -10.4727 Td +(5805 if\(n == 0\)) 10.234 Tj +0 -11.7818 Td +(5806 return 0;) 10.836 Tj +0 -13.0909 Td +(5807 else) 6.622 Tj +0 -14.4 Td +(5808 return \(int\) \(\(uchar\) *p - \(uchar\) *q\);) 28.896 Tj +0 -15.7091 Td +(5809 }) 3.612 Tj +0 -17.0182 Td +(5810 ) 3.01 Tj +0 -18.3273 Td +(5811 ) 3.01 Tj +0 -19.6364 Td +(5812 ) 3.01 Tj +0 -20.9455 Td +(5813 ) 3.01 Tj +0 -22.2545 Td +(5814 ) 3.01 Tj +0 -23.5636 Td +(5815 ) 3.01 Tj +0 -24.8727 Td +(5816 ) 3.01 Tj +0 -26.1818 Td +(5817 ) 3.01 Tj +0 -27.4909 Td +(5818 ) 3.01 Tj +0 -28.8 Td +(5819 ) 3.01 Tj +0 -30.1091 Td +(5820 ) 3.01 Tj +0 -31.4182 Td +(5821 ) 3.01 Tj +0 -32.7273 Td +(5822 ) 3.01 Tj +0 -34.0364 Td +(5823 ) 3.01 Tj +0 -35.3454 Td +(5824 ) 3.01 Tj +0 -36.6545 Td +(5825 ) 3.01 Tj +0 -37.9636 Td +(5826 ) 3.01 Tj +0 -39.2727 Td +(5827 ) 3.01 Tj +0 -40.5818 Td +(5828 ) 3.01 Tj +0 -41.8909 Td +(5829 ) 3.01 Tj +0 -43.2 Td +(5830 ) 3.01 Tj +0 -44.5091 Td +(5831 ) 3.01 Tj +0 -45.8182 Td +(5832 ) 3.01 Tj +0 -47.1272 Td +(5833 ) 3.01 Tj +0 -48.4363 Td +(5834 ) 3.01 Tj +0 -49.7454 Td +(5835 ) 3.01 Tj +0 -51.0545 Td +(5836 ) 3.01 Tj +0 -52.3636 Td +(5837 ) 3.01 Tj +0 -53.6727 Td +(5838 ) 3.01 Tj +0 -54.9818 Td +(5839 ) 3.01 Tj +0 -56.2909 Td +(5840 ) 3.01 Tj +0 -57.6 Td +(5841 ) 3.01 Tj +0 -58.9091 Td +(5842 ) 3.01 Tj +0 -60.2181 Td +(5843 ) 3.01 Tj +0 -61.5272 Td +(5844 ) 3.01 Tj +0 -62.8363 Td +(5845 ) 3.01 Tj +0 -64.1454 Td +(5846 ) 3.01 Tj +0 -65.4545 Td +(5847 ) 3.01 Tj +0 -66.7636 Td +(5848 ) 3.01 Tj +0 -68.0727 Td +(5849 ) 3.01 Tj +0 -72 Td +(Sheet 58) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/ioapic.h Page 1) 23.478 Tj +0 -3.92728 Td +(5850 #define IO_APIC_BASE 0xFEC00000 // Default phys addr of IO APIC) 43.344 Tj +0 -5.23637 Td +(5851 #define IOAPIC_WINDOW 0x10 // Window register offset) 39.732 Tj +0 -6.54546 Td +(5852 ) 3.01 Tj +0 -7.85455 Td +(5853 // Constants relating to APIC ID registers) 28.294 Tj +0 -9.16364 Td +(5854 #define APIC_ID_MASK 0xff000000) 28.294 Tj +0 -10.4727 Td +(5855 #define APIC_ID_SHIFT 24) 23.478 Tj +0 -11.7818 Td +(5856 #define APIC_ID_CLUSTER 0xf0) 24.682 Tj +0 -13.0909 Td +(5857 #define APIC_ID_CLUSTER_ID 0x0f) 24.682 Tj +0 -14.4 Td +(5858 #define APIC_MAX_CLUSTER 0xe) 24.08 Tj +0 -15.7091 Td +(5859 #define APIC_MAX_INTRACLUSTER_ID 3) 23.478 Tj +0 -17.0182 Td +(5860 #define APIC_ID_CLUSTER_SHIFT 4) 22.876 Tj +0 -18.3273 Td +(5861 ) 3.01 Tj +0 -19.6364 Td +(5862 // Fields in VER) 12.642 Tj +0 -20.9455 Td +(5863 #define APIC_VER_VERSION 0x000000ff) 28.294 Tj +0 -22.2545 Td +(5864 #define APIC_VER_MAXLVT 0x00ff0000) 28.294 Tj +0 -23.5636 Td +(5865 #define MAXLVTSHIFT 16) 23.478 Tj +0 -24.8727 Td +(5866 ) 3.01 Tj +0 -26.1818 Td +(5867 // Indexes into IO APIC) 16.856 Tj +0 -27.4909 Td +(5868 #define IOAPIC_ID 0x00) 24.682 Tj +0 -28.8 Td +(5869 #define IOAPIC_VER 0x01) 24.682 Tj +0 -30.1091 Td +(5870 #define IOAPIC_ARB 0x02) 24.682 Tj +0 -31.4182 Td +(5871 #define IOAPIC_REDTBL 0x10) 24.682 Tj +0 -32.7273 Td +(5872 #define IOAPIC_REDTBL0 IOAPIC_REDTBL) 30.1 Tj +0 -34.0364 Td +(5873 #define IOAPIC_REDTBL1 \(IOAPIC_REDTBL+0x02\)) 34.314 Tj +0 -35.3454 Td +(5874 #define IOAPIC_REDTBL2 \(IOAPIC_REDTBL+0x04\)) 34.314 Tj +0 -36.6545 Td +(5875 #define IOAPIC_REDTBL3 \(IOAPIC_REDTBL+0x06\)) 34.314 Tj +0 -37.9636 Td +(5876 #define IOAPIC_REDTBL4 \(IOAPIC_REDTBL+0x08\)) 34.314 Tj +0 -39.2727 Td +(5877 #define IOAPIC_REDTBL5 \(IOAPIC_REDTBL+0x0a\)) 34.314 Tj +0 -40.5818 Td +(5878 #define IOAPIC_REDTBL6 \(IOAPIC_REDTBL+0x0c\)) 34.314 Tj +0 -41.8909 Td +(5879 #define IOAPIC_REDTBL7 \(IOAPIC_REDTBL+0x0e\)) 34.314 Tj +0 -43.2 Td +(5880 #define IOAPIC_REDTBL8 \(IOAPIC_REDTBL+0x10\)) 34.314 Tj +0 -44.5091 Td +(5881 #define IOAPIC_REDTBL9 \(IOAPIC_REDTBL+0x12\)) 34.314 Tj +0 -45.8182 Td +(5882 #define IOAPIC_REDTBL10 \(IOAPIC_REDTBL+0x14\)) 34.314 Tj +0 -47.1272 Td +(5883 #define IOAPIC_REDTBL11 \(IOAPIC_REDTBL+0x16\)) 34.314 Tj +0 -48.4363 Td +(5884 #define IOAPIC_REDTBL12 \(IOAPIC_REDTBL+0x18\)) 34.314 Tj +0 -49.7454 Td +(5885 #define IOAPIC_REDTBL13 \(IOAPIC_REDTBL+0x1a\)) 34.314 Tj +0 -51.0545 Td +(5886 #define IOAPIC_REDTBL14 \(IOAPIC_REDTBL+0x1c\)) 34.314 Tj +0 -52.3636 Td +(5887 #define IOAPIC_REDTBL15 \(IOAPIC_REDTBL+0x1e\)) 34.314 Tj +0 -53.6727 Td +(5888 #define IOAPIC_REDTBL16 \(IOAPIC_REDTBL+0x20\)) 34.314 Tj +0 -54.9818 Td +(5889 #define IOAPIC_REDTBL17 \(IOAPIC_REDTBL+0x22\)) 34.314 Tj +0 -56.2909 Td +(5890 #define IOAPIC_REDTBL18 \(IOAPIC_REDTBL+0x24\)) 34.314 Tj +0 -57.6 Td +(5891 #define IOAPIC_REDTBL19 \(IOAPIC_REDTBL+0x26\)) 34.314 Tj +0 -58.9091 Td +(5892 #define IOAPIC_REDTBL20 \(IOAPIC_REDTBL+0x28\)) 34.314 Tj +0 -60.2181 Td +(5893 #define IOAPIC_REDTBL21 \(IOAPIC_REDTBL+0x2a\)) 34.314 Tj +0 -61.5272 Td +(5894 #define IOAPIC_REDTBL22 \(IOAPIC_REDTBL+0x2c\)) 34.314 Tj +0 -62.8363 Td +(5895 #define IOAPIC_REDTBL23 \(IOAPIC_REDTBL+0x2e\)) 34.314 Tj +0 -64.1454 Td +(5896 ) 3.01 Tj +0 -65.4545 Td +(5897 // Fields in the IO APIC's redirection table entries) 34.314 Tj +0 -66.7636 Td +(5898 #define IOART_DEST APIC_ID_MASK // broadcast addr: all APICs) 43.946 Tj +0 -68.0727 Td +(5899 ) 3.01 Tj +0 -72 Td +(Sheet 58) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 66 66 +%%BeginPageSetup +%%PageOrientation: Landscape +__tumble pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/ioapic.h Page 2) 23.478 Tj +0 -3.92728 Td +(5900 #define IOART_RESV 0x00fe0000 // reserved) 33.712 Tj +0 -5.23637 Td +(5901 ) 3.01 Tj +0 -6.54546 Td +(5902 #define IOART_INTMASK 0x00010000 // R/W: INTerrupt mask) 40.334 Tj +0 -7.85455 Td +(5903 #define IOART_INTMCLR 0x00000000 // clear, allow INTs) 42.742 Tj +0 -9.16364 Td +(5904 #define IOART_INTMSET 0x00010000 // set, inhibit INTs) 42.742 Tj +0 -10.4727 Td +(5905 ) 3.01 Tj +0 -11.7818 Td +(5906 #define IOART_TRGRMOD 0x00008000 // R/W: trigger mode) 39.13 Tj +0 -13.0909 Td +(5907 #define IOART_TRGREDG 0x00000000 // edge) 34.916 Tj +0 -14.4 Td +(5908 #define IOART_TRGRLVL 0x00008000 // level) 35.518 Tj +0 -15.7091 Td +(5909 ) 3.01 Tj +0 -17.0182 Td +(5910 #define IOART_REM_IRR 0x00004000 // RO: remote IRR) 37.324 Tj +0 -18.3273 Td +(5911 ) 3.01 Tj +0 -19.6364 Td +(5912 #define IOART_INTPOL 0x00002000 // R/W: INT input pin polarity) 45.15 Tj +0 -20.9455 Td +(5913 #define IOART_INTAHI 0x00000000 // active high) 38.528 Tj +0 -22.2545 Td +(5914 #define IOART_INTALO 0x00002000 // active low) 37.926 Tj +0 -23.5636 Td +(5915 ) 3.01 Tj +0 -24.8727 Td +(5916 #define IOART_DELIVS 0x00001000 // RO: delivery status) 40.334 Tj +0 -26.1818 Td +(5917 ) 3.01 Tj +0 -27.4909 Td +(5918 #define IOART_DESTMOD 0x00000800 // R/W: destination mode) 41.538 Tj +0 -28.8 Td +(5919 #define IOART_DESTPHY 0x00000000 // physical) 36.722 Tj +0 -30.1091 Td +(5920 #define IOART_DESTLOG 0x00000800 // logical) 36.12 Tj +0 -31.4182 Td +(5921 ) 3.01 Tj +0 -32.7273 Td +(5922 #define IOART_DELMOD 0x00000700 // R/W: delivery mode) 39.732 Tj +0 -34.0364 Td +(5923 #define IOART_DELFIXED 0x00000000 // fixed) 35.518 Tj +0 -35.3454 Td +(5924 #define IOART_DELLOPRI 0x00000100 // lowest priority) 41.538 Tj +0 -36.6545 Td +(5925 #define IOART_DELSMI 0x00000200 // System Management INT) 45.15 Tj +0 -37.9636 Td +(5926 #define IOART_DELRSV1 0x00000300 // reserved) 37.324 Tj +0 -39.2727 Td +(5927 #define IOART_DELNMI 0x00000400 // NMI signal) 38.528 Tj +0 -40.5818 Td +(5928 #define IOART_DELINIT 0x00000500 // INIT signal) 39.13 Tj +0 -41.8909 Td +(5929 #define IOART_DELRSV2 0x00000600 // reserved) 37.324 Tj +0 -43.2 Td +(5930 #define IOART_DELEXINT 0x00000700 // External INTerrupt) 43.344 Tj +0 -44.5091 Td +(5931 ) 3.01 Tj +0 -45.8182 Td +(5932 #define IOART_INTVEC 0x000000ff // R/W: INTerrupt vector field) 45.15 Tj +0 -47.1272 Td +(5933 ) 3.01 Tj +0 -48.4363 Td +(5934 // Fields in VER) 12.642 Tj +0 -49.7454 Td +(5935 #define IOART_VER_VERSION 0x000000ff) 28.294 Tj +0 -51.0545 Td +(5936 #define IOART_VER_MAXREDIR 0x00ff0000) 28.294 Tj +0 -52.3636 Td +(5937 #define MAXREDIRSHIFT 16) 23.478 Tj +0 -53.6727 Td +(5938 ) 3.01 Tj +0 -54.9818 Td +(5939 ) 3.01 Tj +0 -56.2909 Td +(5940 ) 3.01 Tj +0 -57.6 Td +(5941 ) 3.01 Tj +0 -58.9091 Td +(5942 ) 3.01 Tj +0 -60.2181 Td +(5943 ) 3.01 Tj +0 -61.5272 Td +(5944 ) 3.01 Tj +0 -62.8363 Td +(5945 ) 3.01 Tj +0 -64.1454 Td +(5946 ) 3.01 Tj +0 -65.4545 Td +(5947 ) 3.01 Tj +0 -66.7636 Td +(5948 ) 3.01 Tj +0 -68.0727 Td +(5949 ) 3.01 Tj +0 -72 Td +(Sheet 59) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/lapic.c Page 1) 22.876 Tj +0 -3.92728 Td +(5950 #include "types.h") 13.846 Tj +0 -5.23637 Td +(5951 #include "mp.h") 12.04 Tj +0 -6.54546 Td +(5952 #include "defs.h") 13.244 Tj +0 -7.85455 Td +(5953 #include "param.h") 13.846 Tj +0 -9.16364 Td +(5954 #include "x86.h") 12.642 Tj +0 -10.4727 Td +(5955 #include "traps.h") 13.846 Tj +0 -11.7818 Td +(5956 #include "mmu.h") 12.642 Tj +0 -13.0909 Td +(5957 #include "proc.h") 13.244 Tj +0 -14.4 Td +(5958 ) 3.01 Tj +0 -15.7091 Td +(5959 enum { // Local APIC registers) 21.672 Tj +0 -17.0182 Td +(5960 LAPIC_ID = 0x0020, // ID) 20.468 Tj +0 -18.3273 Td +(5961 LAPIC_VER = 0x0030, // Version) 23.478 Tj +0 -19.6364 Td +(5962 LAPIC_TPR = 0x0080, // Task Priority) 27.09 Tj +0 -20.9455 Td +(5963 LAPIC_APR = 0x0090, // Arbitration Priority) 31.304 Tj +0 -22.2545 Td +(5964 LAPIC_PPR = 0x00A0, // Processor Priority) 30.1 Tj +0 -23.5636 Td +(5965 LAPIC_EOI = 0x00B0, // EOI) 21.07 Tj +0 -24.8727 Td +(5966 LAPIC_LDR = 0x00D0, // Logical Destination) 30.702 Tj +0 -26.1818 Td +(5967 LAPIC_DFR = 0x00E0, // Destination Format) 30.1 Tj +0 -27.4909 Td +(5968 LAPIC_SVR = 0x00F0, // Spurious Interrupt Vector) 34.314 Tj +0 -28.8 Td +(5969 LAPIC_ISR = 0x0100, // Interrupt Status \(8 registers\)) 37.324 Tj +0 -30.1091 Td +(5970 LAPIC_TMR = 0x0180, // Trigger Mode \(8 registers\)) 34.916 Tj +0 -31.4182 Td +(5971 LAPIC_IRR = 0x0200, // Interrupt Request \(8 registers\)) 37.926 Tj +0 -32.7273 Td +(5972 LAPIC_ESR = 0x0280, // Error Status) 26.488 Tj +0 -34.0364 Td +(5973 LAPIC_ICRLO = 0x0300, // Interrupt Command) 29.498 Tj +0 -35.3454 Td +(5974 LAPIC_ICRHI = 0x0310, // Interrupt Command [63:32]) 34.314 Tj +0 -36.6545 Td +(5975 LAPIC_TIMER = 0x0320, // Local Vector Table 0 \(TIMER\)) 36.12 Tj +0 -37.9636 Td +(5976 LAPIC_PCINT = 0x0340, // Performance Counter LVT) 33.11 Tj +0 -39.2727 Td +(5977 LAPIC_LINT0 = 0x0350, // Local Vector Table 1 \(LINT0\)) 36.12 Tj +0 -40.5818 Td +(5978 LAPIC_LINT1 = 0x0360, // Local Vector Table 2 \(LINT1\)) 36.12 Tj +0 -41.8909 Td +(5979 LAPIC_ERROR = 0x0370, // Local Vector Table 3 \(ERROR\)) 36.12 Tj +0 -43.2 Td +(5980 LAPIC_TICR = 0x0380, // Timer Initial Count) 30.702 Tj +0 -44.5091 Td +(5981 LAPIC_TCCR = 0x0390, // Timer Current Count) 30.702 Tj +0 -45.8182 Td +(5982 LAPIC_TDCR = 0x03E0, // Timer Divide Configuration) 34.916 Tj +0 -47.1272 Td +(5983 };) 4.214 Tj +0 -48.4363 Td +(5984 ) 3.01 Tj +0 -49.7454 Td +(5985 enum { // LAPIC_SVR) 15.05 Tj +0 -51.0545 Td +(5986 LAPIC_ENABLE = 0x00000100, // Unit Enable) 30.702 Tj +0 -52.3636 Td +(5987 LAPIC_FOCUS = 0x00000200, // Focus Processor Checking Disable) 43.344 Tj +0 -53.6727 Td +(5988 };) 4.214 Tj +0 -54.9818 Td +(5989 ) 3.01 Tj +0 -56.2909 Td +(5990 ) 3.01 Tj +0 -57.6 Td +(5991 ) 3.01 Tj +0 -58.9091 Td +(5992 ) 3.01 Tj +0 -60.2181 Td +(5993 ) 3.01 Tj +0 -61.5272 Td +(5994 ) 3.01 Tj +0 -62.8363 Td +(5995 ) 3.01 Tj +0 -64.1454 Td +(5996 ) 3.01 Tj +0 -65.4545 Td +(5997 ) 3.01 Tj +0 -66.7636 Td +(5998 ) 3.01 Tj +0 -68.0727 Td +(5999 ) 3.01 Tj +0 -72 Td +(Sheet 59) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 67 67 +%%BeginPageSetup +%%PageOrientation: Landscape +pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/lapic.c Page 2) 22.876 Tj +0 -3.92728 Td +(6000 enum { // LAPIC_ICRLO) 16.254 Tj +0 -5.23637 Td +(6001 // [14] IPI Trigger Mode Level \(RW\)) 25.284 Tj +0 -6.54546 Td +(6002 LAPIC_DEASSERT = 0x00000000, // Deassert level-sensitive interrupt) 44.548 Tj +0 -7.85455 Td +(6003 LAPIC_ASSERT = 0x00004000, // Assert level-sensitive interrupt) 43.344 Tj +0 -9.16364 Td +(6004 ) 3.01 Tj +0 -10.4727 Td +(6005 // [17:16] Remote Read Status) 21.672 Tj +0 -11.7818 Td +(6006 LAPIC_INVALID = 0x00000000, // Invalid) 28.294 Tj +0 -13.0909 Td +(6007 LAPIC_WAIT = 0x00010000, // In-Progress) 30.702 Tj +0 -14.4 Td +(6008 LAPIC_VALID = 0x00020000, // Valid) 27.09 Tj +0 -15.7091 Td +(6009 ) 3.01 Tj +0 -17.0182 Td +(6010 // [19:18] Destination Shorthand) 23.478 Tj +0 -18.3273 Td +(6011 LAPIC_FIELD = 0x00000000, // No shorthand) 31.304 Tj +0 -19.6364 Td +(6012 LAPIC_SELF = 0x00040000, // Self is single destination) 39.732 Tj +0 -20.9455 Td +(6013 LAPIC_ALLINC = 0x00080000, // All including self) 34.916 Tj +0 -22.2545 Td +(6014 LAPIC_ALLEXC = 0x000C0000, // All Excluding self) 34.916 Tj +0 -23.5636 Td +(6015 };) 4.214 Tj +0 -24.8727 Td +(6016 ) 3.01 Tj +0 -26.1818 Td +(6017 enum { // LAPIC_ESR) 15.05 Tj +0 -27.4909 Td +(6018 LAPIC_SENDCS = 0x00000001, // Send CS Error) 33.11 Tj +0 -28.8 Td +(6019 LAPIC_RCVCS = 0x00000002, // Receive CS Error) 34.916 Tj +0 -30.1091 Td +(6020 LAPIC_SENDACCEPT = 0x00000004, // Send Accept Error) 35.518 Tj +0 -31.4182 Td +(6021 LAPIC_RCVACCEPT = 0x00000008, // Receive Accept Error) 37.324 Tj +0 -32.7273 Td +(6022 LAPIC_SENDVECTOR = 0x00000020, // Send Illegal Vector) 36.722 Tj +0 -34.0364 Td +(6023 LAPIC_RCVVECTOR = 0x00000040, // Receive Illegal Vector) 38.528 Tj +0 -35.3454 Td +(6024 LAPIC_REGISTER = 0x00000080, // Illegal Register Address) 39.732 Tj +0 -36.6545 Td +(6025 };) 4.214 Tj +0 -37.9636 Td +(6026 ) 3.01 Tj +0 -39.2727 Td +(6027 enum { // LAPIC_TIMER) 16.254 Tj +0 -40.5818 Td +(6028 // [17] Timer Mode \(RW\)) 18.06 Tj +0 -41.8909 Td +(6029 LAPIC_ONESHOT = 0x00000000, // One-shot) 28.896 Tj +0 -43.2 Td +(6030 LAPIC_PERIODIC = 0x00020000, // Periodic) 28.896 Tj +0 -44.5091 Td +(6031 ) 3.01 Tj +0 -45.8182 Td +(6032 // [19:18] Timer Base \(RW\)) 19.866 Tj +0 -47.1272 Td +(6033 LAPIC_CLKIN = 0x00000000, // use CLKIN as input) 34.916 Tj +0 -48.4363 Td +(6034 LAPIC_TMBASE = 0x00040000, // use TMBASE) 30.1 Tj +0 -49.7454 Td +(6035 LAPIC_DIVIDER = 0x00080000, // use output of the divider) 39.13 Tj +0 -51.0545 Td +(6036 };) 4.214 Tj +0 -52.3636 Td +(6037 ) 3.01 Tj +0 -53.6727 Td +(6038 enum { // LAPIC_TDCR) 15.652 Tj +0 -54.9818 Td +(6039 LAPIC_X2 = 0x00000000, // divide by 2) 30.702 Tj +0 -56.2909 Td +(6040 LAPIC_X4 = 0x00000001, // divide by 4) 30.702 Tj +0 -57.6 Td +(6041 LAPIC_X8 = 0x00000002, // divide by 8) 30.702 Tj +0 -58.9091 Td +(6042 LAPIC_X16 = 0x00000003, // divide by 16) 31.304 Tj +0 -60.2181 Td +(6043 LAPIC_X32 = 0x00000008, // divide by 32) 31.304 Tj +0 -61.5272 Td +(6044 LAPIC_X64 = 0x00000009, // divide by 64) 31.304 Tj +0 -62.8363 Td +(6045 LAPIC_X128 = 0x0000000A, // divide by 128) 31.906 Tj +0 -64.1454 Td +(6046 LAPIC_X1 = 0x0000000B, // divide by 1) 30.702 Tj +0 -65.4545 Td +(6047 };) 4.214 Tj +0 -66.7636 Td +(6048 ) 3.01 Tj +0 -68.0727 Td +(6049 ) 3.01 Tj +0 -72 Td +(Sheet 60) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/lapic.c Page 3) 22.876 Tj +0 -3.92728 Td +(6050 uint *lapicaddr;) 12.642 Tj +0 -5.23637 Td +(6051 ) 3.01 Tj +0 -6.54546 Td +(6052 static int) 9.03 Tj +0 -7.85455 Td +(6053 lapic_read\(int r\)) 13.244 Tj +0 -9.16364 Td +(6054 {) 3.612 Tj +0 -10.4727 Td +(6055 return *\(lapicaddr+\(r/sizeof\(*lapicaddr\)\)\);) 30.1 Tj +0 -11.7818 Td +(6056 }) 3.612 Tj +0 -13.0909 Td +(6057 ) 3.01 Tj +0 -14.4 Td +(6058 static void) 9.632 Tj +0 -15.7091 Td +(6059 lapic_write\(int r, int data\)) 19.866 Tj +0 -17.0182 Td +(6060 {) 3.612 Tj +0 -18.3273 Td +(6061 *\(lapicaddr+\(r/sizeof\(*lapicaddr\)\)\) = data;) 30.1 Tj +0 -19.6364 Td +(6062 }) 3.612 Tj +0 -20.9455 Td +(6063 ) 3.01 Tj +0 -22.2545 Td +(6064 ) 3.01 Tj +0 -23.5636 Td +(6065 void) 5.418 Tj +0 -24.8727 Td +(6066 lapic_timerinit\(void\)) 15.652 Tj +0 -26.1818 Td +(6067 {) 3.612 Tj +0 -27.4909 Td +(6068 if\(!lapicaddr\)) 12.642 Tj +0 -28.8 Td +(6069 return;) 9.632 Tj +0 -30.1091 Td +(6070 ) 3.01 Tj +0 -31.4182 Td +(6071 lapic_write\(LAPIC_TDCR, LAPIC_X1\);) 24.682 Tj +0 -32.7273 Td +(6072 lapic_write\(LAPIC_TIMER, LAPIC_CLKIN | LAPIC_PERIODIC |) 37.324 Tj +0 -34.0364 Td +(6073 ) 3.01 Tj +8.42796 -34.0364 Td +(\(IRQ_OFFSET + IRQ_TIMER\)\);) 15.652 Tj +0 -35.3454 Td +(6074 lapic_write\(LAPIC_TCCR, 10000000\);) 24.682 Tj +0 -36.6545 Td +(6075 lapic_write\(LAPIC_TICR, 10000000\);) 24.682 Tj +0 -37.9636 Td +(6076 }) 3.612 Tj +0 -39.2727 Td +(6077 ) 3.01 Tj +0 -40.5818 Td +(6078 void) 5.418 Tj +0 -41.8909 Td +(6079 lapic_timerintr\(void\)) 15.652 Tj +0 -43.2 Td +(6080 {) 3.612 Tj +0 -44.5091 Td +(6081 if\(lapicaddr\)) 12.04 Tj +0 -45.8182 Td +(6082 lapic_write\(LAPIC_EOI, 0\);) 21.07 Tj +0 -47.1272 Td +(6083 }) 3.612 Tj +0 -48.4363 Td +(6084 ) 3.01 Tj +0 -49.7454 Td +(6085 void) 5.418 Tj +0 -51.0545 Td +(6086 lapic_init\(int c\)) 13.244 Tj +0 -52.3636 Td +(6087 {) 3.612 Tj +0 -53.6727 Td +(6088 uint r, lvt;) 11.438 Tj +0 -54.9818 Td +(6089 ) 3.01 Tj +0 -56.2909 Td +(6090 if\(!lapicaddr\)) 12.642 Tj +0 -57.6 Td +(6091 return;) 9.632 Tj +0 -58.9091 Td +(6092 ) 3.01 Tj +0 -60.2181 Td +(6093 lapic_write\(LAPIC_DFR, 0xFFFFFFFF\); // Set dst format register) 43.344 Tj +0 -61.5272 Td +(6094 r = \(lapic_read\(LAPIC_ID\)>>24\) & 0xFF; // Read APIC ID) 36.722 Tj +0 -62.8363 Td +(6095 lapic_write\(LAPIC_LDR, \(1<>16\) & 0xFF;) 28.896 Tj +0 -13.0909 Td +(6107 if\(lvt >= 4\)) 11.438 Tj +0 -14.4 Td +(6108 lapic_write\(LAPIC_PCINT, APIC_IMASK\);) 27.692 Tj +0 -15.7091 Td +(6109 lapic_write\(LAPIC_ERROR, IRQ_OFFSET+IRQ_ERROR\);) 32.508 Tj +0 -17.0182 Td +(6110 lapic_write\(LAPIC_ESR, 0\);) 19.866 Tj +0 -18.3273 Td +(6111 lapic_read\(LAPIC_ESR\);) 17.458 Tj +0 -19.6364 Td +(6112 ) 3.01 Tj +0 -20.9455 Td +(6113 // Issue an INIT Level De-Assert to synchronise arbitration ID's.) 43.344 Tj +0 -22.2545 Td +(6114 lapic_write\(LAPIC_ICRHI, 0\);) 21.07 Tj +0 -23.5636 Td +(6115 lapic_write\(LAPIC_ICRLO, LAPIC_ALLINC|APIC_LEVEL|) 33.712 Tj +0 -24.8727 Td +(6116 LAPIC_DEASSERT|APIC_INIT\);) 34.916 Tj +0 -26.1818 Td +(6117 while\(lapic_read\(LAPIC_ICRLO\) & APIC_DELIVS\)) 30.702 Tj +0 -27.4909 Td +(6118 ;) 6.02 Tj +0 -28.8 Td +(6119 }) 3.612 Tj +0 -30.1091 Td +(6120 ) 3.01 Tj +0 -31.4182 Td +(6121 void) 5.418 Tj +0 -32.7273 Td +(6122 lapic_enableintr\(void\)) 16.254 Tj +0 -34.0364 Td +(6123 {) 3.612 Tj +0 -35.3454 Td +(6124 if\(lapicaddr\)) 12.04 Tj +0 -36.6545 Td +(6125 lapic_write\(LAPIC_TPR, 0\);) 21.07 Tj +0 -37.9636 Td +(6126 }) 3.612 Tj +0 -39.2727 Td +(6127 ) 3.01 Tj +0 -40.5818 Td +(6128 void) 5.418 Tj +0 -41.8909 Td +(6129 lapic_disableintr\(void\)) 16.856 Tj +0 -43.2 Td +(6130 {) 3.612 Tj +0 -44.5091 Td +(6131 if\(lapicaddr\)) 12.04 Tj +0 -45.8182 Td +(6132 lapic_write\(LAPIC_TPR, 0xFF\);) 22.876 Tj +0 -47.1272 Td +(6133 }) 3.612 Tj +0 -48.4363 Td +(6134 ) 3.01 Tj +0 -49.7454 Td +(6135 void) 5.418 Tj +0 -51.0545 Td +(6136 lapic_eoi\(void\)) 12.04 Tj +0 -52.3636 Td +(6137 {) 3.612 Tj +0 -53.6727 Td +(6138 if\(lapicaddr\)) 12.04 Tj +0 -54.9818 Td +(6139 lapic_write\(LAPIC_EOI, 0\);) 21.07 Tj +0 -56.2909 Td +(6140 }) 3.612 Tj +0 -57.6 Td +(6141 ) 3.01 Tj +0 -58.9091 Td +(6142 ) 3.01 Tj +0 -60.2181 Td +(6143 ) 3.01 Tj +0 -61.5272 Td +(6144 ) 3.01 Tj +0 -62.8363 Td +(6145 ) 3.01 Tj +0 -64.1454 Td +(6146 ) 3.01 Tj +0 -65.4545 Td +(6147 ) 3.01 Tj +0 -66.7636 Td +(6148 ) 3.01 Tj +0 -68.0727 Td +(6149 ) 3.01 Tj +0 -72 Td +(Sheet 61) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/lapic.c Page 5) 22.876 Tj +0 -3.92728 Td +(6150 int) 4.816 Tj +0 -5.23637 Td +(6151 cpu\(void\)) 8.428 Tj +0 -6.54546 Td +(6152 {) 3.612 Tj +0 -7.85455 Td +(6153 int x;) 7.826 Tj +0 -9.16364 Td +(6154 if\(lapicaddr\)) 12.04 Tj +0 -10.4727 Td +(6155 x = \(lapic_read\(LAPIC_ID\)>>24\) & 0xFF;) 28.294 Tj +0 -11.7818 Td +(6156 else) 6.622 Tj +0 -13.0909 Td +(6157 x = 0;) 9.03 Tj +0 -14.4 Td +(6158 return x;) 9.632 Tj +0 -15.7091 Td +(6159 }) 3.612 Tj +0 -17.0182 Td +(6160 ) 3.01 Tj +0 -18.3273 Td +(6161 void) 5.418 Tj +0 -19.6364 Td +(6162 lapic_startap\(uchar apicid, int v\)) 23.478 Tj +0 -20.9455 Td +(6163 {) 3.612 Tj +0 -22.2545 Td +(6164 int crhi, i;) 11.438 Tj +0 -23.5636 Td +(6165 volatile int j = 0;) 15.652 Tj +0 -24.8727 Td +(6166 ) 3.01 Tj +0 -26.1818 Td +(6167 crhi = apicid<<24;) 15.05 Tj +0 -27.4909 Td +(6168 lapic_write\(LAPIC_ICRHI, crhi\);) 22.876 Tj +0 -28.8 Td +(6169 lapic_write\(LAPIC_ICRLO, LAPIC_FIELD|APIC_LEVEL|) 33.11 Tj +0 -30.1091 Td +(6170 LAPIC_ASSERT|APIC_INIT\);) 33.712 Tj +0 -31.4182 Td +(6171 ) 3.01 Tj +0 -32.7273 Td +(6172 while\(j++ < 10000\) {;}) 17.458 Tj +0 -34.0364 Td +(6173 lapic_write\(LAPIC_ICRLO, LAPIC_FIELD|APIC_LEVEL|) 33.11 Tj +0 -35.3454 Td +(6174 LAPIC_DEASSERT|APIC_INIT\);) 34.916 Tj +0 -36.6545 Td +(6175 ) 3.01 Tj +0 -37.9636 Td +(6176 while\(j++ < 1000000\) {;}) 18.662 Tj +0 -39.2727 Td +(6177 ) 3.01 Tj +0 -40.5818 Td +(6178 // in p9 code, this was i < 2, which is what the spec says on page B-3) 46.354 Tj +0 -41.8909 Td +(6179 for\(i = 0; i < 1; i++\){) 18.06 Tj +0 -43.2 Td +(6180 lapic_write\(LAPIC_ICRHI, crhi\);) 24.08 Tj +0 -44.5091 Td +(6181 lapic_write\(LAPIC_ICRLO, LAPIC_FIELD|APIC_EDGE|APIC_STARTUP|\(v/4096\)\);) 47.558 Tj +0 -45.8182 Td +(6182 while\(j++ < 100000\) {;}) 19.264 Tj +0 -47.1272 Td +(6183 }) 4.816 Tj +0 -48.4363 Td +(6184 }) 3.612 Tj +0 -49.7454 Td +(6185 ) 3.01 Tj +0 -51.0545 Td +(6186 ) 3.01 Tj +0 -52.3636 Td +(6187 ) 3.01 Tj +0 -53.6727 Td +(6188 ) 3.01 Tj +0 -54.9818 Td +(6189 ) 3.01 Tj +0 -56.2909 Td +(6190 ) 3.01 Tj +0 -57.6 Td +(6191 ) 3.01 Tj +0 -58.9091 Td +(6192 ) 3.01 Tj +0 -60.2181 Td +(6193 ) 3.01 Tj +0 -61.5272 Td +(6194 ) 3.01 Tj +0 -62.8363 Td +(6195 ) 3.01 Tj +0 -64.1454 Td +(6196 ) 3.01 Tj +0 -65.4545 Td +(6197 ) 3.01 Tj +0 -66.7636 Td +(6198 ) 3.01 Tj +0 -68.0727 Td +(6199 ) 3.01 Tj +0 -72 Td +(Sheet 61) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 69 69 +%%BeginPageSetup +%%PageOrientation: Landscape +pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/ioapic.c Page 1) 23.478 Tj +0 -3.92728 Td +(6200 #include "types.h") 13.846 Tj +0 -5.23637 Td +(6201 #include "mp.h") 12.04 Tj +0 -6.54546 Td +(6202 #include "defs.h") 13.244 Tj +0 -7.85455 Td +(6203 #include "x86.h") 12.642 Tj +0 -9.16364 Td +(6204 #include "traps.h") 13.846 Tj +0 -10.4727 Td +(6205 #include "ioapic.h") 14.448 Tj +0 -11.7818 Td +(6206 ) 3.01 Tj +0 -13.0909 Td +(6207 struct ioapic {) 12.04 Tj +0 -14.4 Td +(6208 uint ioregsel; uint p01; uint p02; uint p03;) 31.304 Tj +0 -15.7091 Td +(6209 uint iowin; uint p11; uint p12; uint p13;) 31.304 Tj +0 -17.0182 Td +(6210 };) 4.214 Tj +0 -18.3273 Td +(6211 ) 3.01 Tj +0 -19.6364 Td +(6212 ) 3.01 Tj +0 -20.9455 Td +(6213 #define IOAPIC_REDTBL_LO\(i\) \(IOAPIC_REDTBL + \(i\) * 2\)) 35.518 Tj +0 -22.2545 Td +(6214 #define IOAPIC_REDTBL_HI\(i\) \(IOAPIC_REDTBL_LO\(i\) + 1\)) 35.518 Tj +0 -23.5636 Td +(6215 ) 3.01 Tj +0 -24.8727 Td +(6216 static uint) 9.632 Tj +0 -26.1818 Td +(6217 ioapic_read\(struct ioapic *io, int reg\)) 26.488 Tj +0 -27.4909 Td +(6218 {) 3.612 Tj +0 -28.8 Td +(6219 io->ioregsel = reg;) 15.652 Tj +0 -30.1091 Td +(6220 return io->iowin;) 14.448 Tj +0 -31.4182 Td +(6221 }) 3.612 Tj +0 -32.7273 Td +(6222 ) 3.01 Tj +0 -34.0364 Td +(6223 static void) 9.632 Tj +0 -35.3454 Td +(6224 ioapic_write\(struct ioapic *io, int reg, uint val\)) 33.11 Tj +0 -36.6545 Td +(6225 {) 3.612 Tj +0 -37.9636 Td +(6226 io->ioregsel = reg;) 15.652 Tj +0 -39.2727 Td +(6227 io->iowin = val;) 13.846 Tj +0 -40.5818 Td +(6228 }) 3.612 Tj +0 -41.8909 Td +(6229 ) 3.01 Tj +0 -43.2 Td +(6230 void) 5.418 Tj +0 -44.5091 Td +(6231 ioapic_init\(void\)) 13.244 Tj +0 -45.8182 Td +(6232 {) 3.612 Tj +0 -47.1272 Td +(6233 struct ioapic *io;) 15.05 Tj +0 -48.4363 Td +(6234 uint l, h;) 10.234 Tj +0 -49.7454 Td +(6235 int nintr;) 10.234 Tj +0 -51.0545 Td +(6236 uchar id;) 9.632 Tj +0 -52.3636 Td +(6237 int i;) 7.826 Tj +0 -53.6727 Td +(6238 ) 3.01 Tj +0 -54.9818 Td +(6239 if\(!ismp\)) 9.632 Tj +0 -56.2909 Td +(6240 return;) 9.632 Tj +0 -57.6 Td +(6241 ) 3.01 Tj +0 -58.9091 Td +(6242 io = \(struct ioapic*\) IO_APIC_BASE;) 25.284 Tj +0 -60.2181 Td +(6243 l = ioapic_read\(io, IOAPIC_VER\);) 23.478 Tj +0 -61.5272 Td +(6244 nintr = \(\(l & IOART_VER_MAXREDIR\) >> MAXREDIRSHIFT\) + 1;) 38.528 Tj +0 -62.8363 Td +(6245 id = ioapic_read\(io, IOAPIC_ID\) >> APIC_ID_SHIFT;) 33.712 Tj +0 -64.1454 Td +(6246 if\(id != ioapic_id\)) 15.652 Tj +0 -65.4545 Td +(6247 cprintf\("ioapic_init: id isn't equal to ioapic_id; not a MP\\n"\);) 43.946 Tj +0 -66.7636 Td +(6248 for\(i = 0; i < nintr; i++\) {) 21.07 Tj +0 -68.0727 Td +(6249 // active-hi and edge-triggered for ISA interrupts) 35.518 Tj +0 -72 Td +(Sheet 62) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/ioapic.c Page 2) 23.478 Tj +0 -3.92728 Td +(6250 // Assume that pin 0 on the first I/O APIC is an ExtINT pin.) 41.538 Tj +0 -5.23637 Td +(6251 // Assume that pins 1-15 are ISA interrupts) 31.304 Tj +0 -6.54546 Td +(6252 l = ioapic_read\(io, IOAPIC_REDTBL_LO\(i\)\);) 30.1 Tj +0 -7.85455 Td +(6253 l = l & ~IOART_INTMASK; // allow INTs) 28.294 Tj +0 -9.16364 Td +(6254 l |= IOART_INTMSET;) 16.856 Tj +0 -10.4727 Td +(6255 l = l & ~IOART_INTPOL; // active hi) 27.692 Tj +0 -11.7818 Td +(6256 l = l & ~IOART_TRGRMOD; // edgee triggered) 31.304 Tj +0 -13.0909 Td +(6257 l = l & ~IOART_DELMOD; // fixed) 25.284 Tj +0 -14.4 Td +(6258 l = l & ~IOART_DESTMOD; // physical mode) 30.1 Tj +0 -15.7091 Td +(6259 l = l | \(IRQ_OFFSET + i\); // vector) 26.488 Tj +0 -17.0182 Td +(6260 ioapic_write\(io, IOAPIC_REDTBL_LO\(i\), l\);) 30.1 Tj +0 -18.3273 Td +(6261 h = ioapic_read\(io, IOAPIC_REDTBL_HI\(i\)\);) 30.1 Tj +0 -19.6364 Td +(6262 h &= ~IOART_DEST;) 15.652 Tj +0 -20.9455 Td +(6263 ioapic_write\(io, IOAPIC_REDTBL_HI\(i\), h\);) 30.1 Tj +0 -22.2545 Td +(6264 }) 4.816 Tj +0 -23.5636 Td +(6265 }) 3.612 Tj +0 -24.8727 Td +(6266 ) 3.01 Tj +0 -26.1818 Td +(6267 void) 5.418 Tj +0 -27.4909 Td +(6268 ioapic_enable \(int irq, int cpunum\)) 24.08 Tj +0 -28.8 Td +(6269 {) 3.612 Tj +0 -30.1091 Td +(6270 uint l, h;) 10.234 Tj +0 -31.4182 Td +(6271 struct ioapic *io;) 15.05 Tj +0 -32.7273 Td +(6272 ) 3.01 Tj +0 -34.0364 Td +(6273 if\(!ismp\)) 9.632 Tj +0 -35.3454 Td +(6274 return;) 9.632 Tj +0 -36.6545 Td +(6275 ) 3.01 Tj +0 -37.9636 Td +(6276 io = \(struct ioapic*\) IO_APIC_BASE;) 25.284 Tj +0 -39.2727 Td +(6277 l = ioapic_read\(io, IOAPIC_REDTBL_LO\(irq\)\);) 30.1 Tj +0 -40.5818 Td +(6278 l = l & ~IOART_INTMASK; // allow INTs) 27.09 Tj +0 -41.8909 Td +(6279 ioapic_write\(io, IOAPIC_REDTBL_LO\(irq\), l\);) 30.1 Tj +0 -43.2 Td +(6280 h = ioapic_read\(io, IOAPIC_REDTBL_HI\(irq\)\);) 30.1 Tj +0 -44.5091 Td +(6281 h &= ~IOART_DEST;) 14.448 Tj +0 -45.8182 Td +(6282 h |= \(cpunum << APIC_ID_SHIFT\);) 22.876 Tj +0 -47.1272 Td +(6283 ioapic_write\(io, IOAPIC_REDTBL_HI\(irq\), h\);) 30.1 Tj +0 -48.4363 Td +(6284 }) 3.612 Tj +0 -49.7454 Td +(6285 ) 3.01 Tj +0 -51.0545 Td +(6286 ) 3.01 Tj +0 -52.3636 Td +(6287 ) 3.01 Tj +0 -53.6727 Td +(6288 ) 3.01 Tj +0 -54.9818 Td +(6289 ) 3.01 Tj +0 -56.2909 Td +(6290 ) 3.01 Tj +0 -57.6 Td +(6291 ) 3.01 Tj +0 -58.9091 Td +(6292 ) 3.01 Tj +0 -60.2181 Td +(6293 ) 3.01 Tj +0 -61.5272 Td +(6294 ) 3.01 Tj +0 -62.8363 Td +(6295 ) 3.01 Tj +0 -64.1454 Td +(6296 ) 3.01 Tj +0 -65.4545 Td +(6297 ) 3.01 Tj +0 -66.7636 Td +(6298 ) 3.01 Tj +0 -68.0727 Td +(6299 ) 3.01 Tj +0 -72 Td +(Sheet 62) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 70 70 +%%BeginPageSetup +%%PageOrientation: Landscape +__tumble pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/picirq.c Page 1) 23.478 Tj +0 -3.92728 Td +(6300 #include "types.h") 13.846 Tj +0 -5.23637 Td +(6301 #include "x86.h") 12.642 Tj +0 -6.54546 Td +(6302 #include "traps.h") 13.846 Tj +0 -7.85455 Td +(6303 #include "defs.h") 13.244 Tj +0 -9.16364 Td +(6304 ) 3.01 Tj +0 -10.4727 Td +(6305 // I/O Addresses of the two 8259A programmable interrupt controllers) 43.946 Tj +0 -11.7818 Td +(6306 #define IO_PIC1 0x20 // Master \(IRQs 0-7\)) 34.314 Tj +0 -13.0909 Td +(6307 #define IO_PIC2 0xA0 // Slave \(IRQs 8-15\)) 34.314 Tj +0 -14.4 Td +(6308 ) 3.01 Tj +0 -15.7091 Td +(6309 #define IRQ_SLAVE 2 // IRQ at which slave connects to master) 46.354 Tj +0 -17.0182 Td +(6310 ) 3.01 Tj +0 -18.3273 Td +(6311 // Current IRQ mask.) 15.05 Tj +0 -19.6364 Td +(6312 // Initial IRQ mask has interrupt 2 enabled \(for slave 8259A\).) 40.334 Tj +0 -20.9455 Td +(6313 static ushort irq_mask_8259A = 0xFFFF & ~\(1<> 8\)\);) 25.284 Tj +0 -32.7273 Td +(6322 }) 3.612 Tj +0 -34.0364 Td +(6323 ) 3.01 Tj +0 -35.3454 Td +(6324 void) 5.418 Tj +0 -36.6545 Td +(6325 irq_enable\(int irq\)) 14.448 Tj +0 -37.9636 Td +(6326 {) 3.612 Tj +0 -39.2727 Td +(6327 irq_setmask_8259A\(irq_mask_8259A & ~\(1<= 24\){) 16.856 Tj +0 -17.0182 Td +(6460 // scroll up) 12.642 Tj +0 -18.3273 Td +(6461 memmove\(crt, crt + 80, sizeof\(crt[0]\) * \(23 * 80\)\);) 36.12 Tj +0 -19.6364 Td +(6462 ind -= 80;) 11.438 Tj +0 -20.9455 Td +(6463 memset\(crt + ind, 0, sizeof\(crt[0]\) * \(\(24 * 80\) - ind\)\);) 39.732 Tj +0 -22.2545 Td +(6464 }) 4.816 Tj +0 -23.5636 Td +(6465 ) 3.01 Tj +0 -24.8727 Td +(6466 outb\(crtport, 14\);) 15.05 Tj +0 -26.1818 Td +(6467 outb\(crtport + 1, ind >> 8\);) 21.07 Tj +0 -27.4909 Td +(6468 outb\(crtport, 15\);) 15.05 Tj +0 -28.8 Td +(6469 outb\(crtport + 1, ind\);) 18.06 Tj +0 -30.1091 Td +(6470 }) 3.612 Tj +0 -31.4182 Td +(6471 ) 3.01 Tj +0 -32.7273 Td +(6472 void) 5.418 Tj +0 -34.0364 Td +(6473 printint\(int xx, int base, int sgn\)) 24.08 Tj +0 -35.3454 Td +(6474 {) 3.612 Tj +0 -36.6545 Td +(6475 char buf[16];) 12.04 Tj +0 -37.9636 Td +(6476 char digits[] = "0123456789ABCDEF";) 25.284 Tj +0 -39.2727 Td +(6477 int i = 0, neg = 0;) 15.652 Tj +0 -40.5818 Td +(6478 uint x;) 8.428 Tj +0 -41.8909 Td +(6479 ) 3.01 Tj +0 -43.2 Td +(6480 if\(sgn && xx < 0\){) 15.05 Tj +0 -44.5091 Td +(6481 neg = 1;) 10.234 Tj +0 -45.8182 Td +(6482 x = 0 - xx;) 12.04 Tj +0 -47.1272 Td +(6483 } else {) 9.03 Tj +0 -48.4363 Td +(6484 x = xx;) 9.632 Tj +0 -49.7454 Td +(6485 }) 4.816 Tj +0 -51.0545 Td +(6486 ) 3.01 Tj +0 -52.3636 Td +(6487 do {) 6.622 Tj +0 -53.6727 Td +(6488 buf[i++] = digits[x % base];) 22.274 Tj +0 -54.9818 Td +(6489 } while\(\(x /= base\) != 0\);) 19.866 Tj +0 -56.2909 Td +(6490 if\(neg\)) 8.428 Tj +0 -57.6 Td +(6491 buf[i++] = '-';) 14.448 Tj +0 -58.9091 Td +(6492 ) 3.01 Tj +0 -60.2181 Td +(6493 while\(--i >= 0\)) 13.244 Tj +0 -61.5272 Td +(6494 cons_putc\(buf[i]\);) 16.254 Tj +0 -62.8363 Td +(6495 }) 3.612 Tj +0 -64.1454 Td +(6496 ) 3.01 Tj +0 -65.4545 Td +(6497 ) 3.01 Tj +0 -66.7636 Td +(6498 ) 3.01 Tj +0 -68.0727 Td +(6499 ) 3.01 Tj +0 -72 Td +(Sheet 64) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 72 72 +%%BeginPageSetup +%%PageOrientation: Landscape +__tumble pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/console.c Page 3) 24.08 Tj +0 -3.92728 Td +(6500 // Print to the console. only understands %d, %x, %p, %s.) 37.324 Tj +0 -5.23637 Td +(6501 void) 5.418 Tj +0 -6.54546 Td +(6502 cprintf\(char *fmt, ...\)) 16.856 Tj +0 -7.85455 Td +(6503 {) 3.612 Tj +0 -9.16364 Td +(6504 int i, state = 0, c, locking = 0;) 24.08 Tj +0 -10.4727 Td +(6505 uint *ap = \(uint*\)\(void*\)&fmt + 1;) 24.682 Tj +0 -11.7818 Td +(6506 ) 3.01 Tj +0 -13.0909 Td +(6507 if\(use_console_lock\){) 16.856 Tj +0 -14.4 Td +(6508 locking = 1;) 12.642 Tj +0 -15.7091 Td +(6509 acquire\(&console_lock\);) 19.264 Tj +0 -17.0182 Td +(6510 }) 4.816 Tj +0 -18.3273 Td +(6511 ) 3.01 Tj +0 -19.6364 Td +(6512 for\(i = 0; fmt[i]; i++\){) 18.662 Tj +0 -20.9455 Td +(6513 c = fmt[i] & 0xff;) 16.254 Tj +0 -22.2545 Td +(6514 if\(state == 0\){) 14.448 Tj +0 -23.5636 Td +(6515 if\(c == '%'\){) 14.448 Tj +0 -24.8727 Td +(6516 state = '%';) 15.05 Tj +0 -26.1818 Td +(6517 } else {) 11.438 Tj +0 -27.4909 Td +(6518 cons_putc\(c\);) 15.652 Tj +0 -28.8 Td +(6519 }) 7.224 Tj +0 -30.1091 Td +(6520 } else if\(state == '%'\){) 19.866 Tj +0 -31.4182 Td +(6521 if\(c == 'd'\){) 14.448 Tj +0 -32.7273 Td +(6522 printint\(*ap, 10, 1\);) 20.468 Tj +0 -34.0364 Td +(6523 ap++;) 10.836 Tj +0 -35.3454 Td +(6524 } else if\(c == 'x' || c == 'p'\){) 25.886 Tj +0 -36.6545 Td +(6525 printint\(*ap, 16, 0\);) 20.468 Tj +0 -37.9636 Td +(6526 ap++;) 10.836 Tj +0 -39.2727 Td +(6527 } else if\(c == 's'\){) 18.662 Tj +0 -40.5818 Td +(6528 char *s = \(char*\)*ap;) 20.468 Tj +0 -41.8909 Td +(6529 ap++;) 10.836 Tj +0 -43.2 Td +(6530 if\(s == 0\){) 14.448 Tj +0 -44.5091 Td +(6531 cons_putc\('0'\);) 18.06 Tj +0 -45.8182 Td +(6532 }else{) 11.438 Tj +0 -47.1272 Td +(6533 while\(*s != 0\){) 18.06 Tj +0 -48.4363 Td +(6534 cons_putc\(*s\);) 18.662 Tj +0 -49.7454 Td +(6535 s++;) 12.642 Tj +0 -51.0545 Td +(6536 }) 9.632 Tj +0 -52.3636 Td +(6537 }) 8.428 Tj +0 -53.6727 Td +(6538 } else if\(c == '%'\){) 18.662 Tj +0 -54.9818 Td +(6539 cons_putc\(c\);) 15.652 Tj +0 -56.2909 Td +(6540 } else {) 11.438 Tj +0 -57.6 Td +(6541 // Unknown % sequence. Print it to draw attention.) 38.528 Tj +0 -58.9091 Td +(6542 cons_putc\('%'\);) 16.856 Tj +0 -60.2181 Td +(6543 cons_putc\(c\);) 15.652 Tj +0 -61.5272 Td +(6544 }) 7.224 Tj +0 -62.8363 Td +(6545 state = 0;) 12.642 Tj +0 -64.1454 Td +(6546 }) 6.02 Tj +0 -65.4545 Td +(6547 }) 4.816 Tj +0 -66.7636 Td +(6548 ) 3.01 Tj +0 -68.0727 Td +(6549 ) 3.01 Tj +0 -72 Td +(Sheet 65) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/console.c Page 4) 24.08 Tj +0 -3.92728 Td +(6550 if\(locking\)) 10.836 Tj +0 -5.23637 Td +(6551 release\(&console_lock\);) 19.264 Tj +0 -6.54546 Td +(6552 }) 3.612 Tj +0 -7.85455 Td +(6553 ) 3.01 Tj +0 -9.16364 Td +(6554 void) 5.418 Tj +0 -10.4727 Td +(6555 panic\(char *s\)) 11.438 Tj +0 -11.7818 Td +(6556 {) 3.612 Tj +0 -13.0909 Td +(6557 int i;) 7.826 Tj +0 -14.4 Td +(6558 uint pcs[10];) 12.04 Tj +0 -15.7091 Td +(6559 ) 3.01 Tj +0 -17.0182 Td +(6560 __asm __volatile\("cli"\);) 18.662 Tj +0 -18.3273 Td +(6561 use_console_lock = 0;) 16.856 Tj +0 -19.6364 Td +(6562 cprintf\("panic \(%d\): ", cpu\(\)\);) 22.876 Tj +0 -20.9455 Td +(6563 cprintf\(s, 0\);) 12.642 Tj +0 -22.2545 Td +(6564 cprintf\("\\n", 0\);) 14.448 Tj +0 -23.5636 Td +(6565 getcallerpcs\(&s, pcs\);) 17.458 Tj +0 -24.8727 Td +(6566 for\(i=0; i<10; i++\)) 15.652 Tj +0 -26.1818 Td +(6567 cprintf\(" %p", pcs[i]\);) 19.264 Tj +0 -27.4909 Td +(6568 panicked = 1; // freeze other CPU) 24.08 Tj +0 -28.8 Td +(6569 for\(;;\)) 8.428 Tj +0 -30.1091 Td +(6570 ;) 6.02 Tj +0 -31.4182 Td +(6571 }) 3.612 Tj +0 -32.7273 Td +(6572 ) 3.01 Tj +0 -34.0364 Td +(6573 int) 4.816 Tj +0 -35.3454 Td +(6574 console_write\(int minor, char *buf, int n\)) 28.294 Tj +0 -36.6545 Td +(6575 {) 3.612 Tj +0 -37.9636 Td +(6576 int i;) 7.826 Tj +0 -39.2727 Td +(6577 ) 3.01 Tj +0 -40.5818 Td +(6578 acquire\(&console_lock\);) 18.06 Tj +0 -41.8909 Td +(6579 ) 3.01 Tj +0 -43.2 Td +(6580 for\(i = 0; i < n; i++\) {) 18.662 Tj +0 -44.5091 Td +(6581 cons_putc\(buf[i] & 0xff\);) 20.468 Tj +0 -45.8182 Td +(6582 }) 4.816 Tj +0 -47.1272 Td +(6583 ) 3.01 Tj +0 -48.4363 Td +(6584 release\(&console_lock\);) 18.06 Tj +0 -49.7454 Td +(6585 ) 3.01 Tj +0 -51.0545 Td +(6586 return n;) 9.632 Tj +0 -52.3636 Td +(6587 }) 3.612 Tj +0 -53.6727 Td +(6588 ) 3.01 Tj +0 -54.9818 Td +(6589 ) 3.01 Tj +0 -56.2909 Td +(6590 ) 3.01 Tj +0 -57.6 Td +(6591 ) 3.01 Tj +0 -58.9091 Td +(6592 ) 3.01 Tj +0 -60.2181 Td +(6593 ) 3.01 Tj +0 -61.5272 Td +(6594 ) 3.01 Tj +0 -62.8363 Td +(6595 ) 3.01 Tj +0 -64.1454 Td +(6596 ) 3.01 Tj +0 -65.4545 Td +(6597 ) 3.01 Tj +0 -66.7636 Td +(6598 ) 3.01 Tj +0 -68.0727 Td +(6599 ) 3.01 Tj +0 -72 Td +(Sheet 65) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 73 73 +%%BeginPageSetup +%%PageOrientation: Landscape +pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/console.c Page 5) 24.08 Tj +0 -3.92728 Td +(6600 #define KBSTATP 0x64 // kbd controller status port\(I\)) 41.538 Tj +0 -5.23637 Td +(6601 #define KBS_DIB 0x01 // kbd data in buffer) 34.916 Tj +0 -6.54546 Td +(6602 #define KBDATAP 0x60 // kbd data port\(I\)) 33.712 Tj +0 -7.85455 Td +(6603 ) 3.01 Tj +0 -9.16364 Td +(6604 #define NO 0) 18.06 Tj +0 -10.4727 Td +(6605 ) 3.01 Tj +0 -11.7818 Td +(6606 #define SHIFT \(1<<0\)) 21.07 Tj +0 -13.0909 Td +(6607 #define CTL \(1<<1\)) 21.07 Tj +0 -14.4 Td +(6608 #define ALT \(1<<2\)) 21.07 Tj +0 -15.7091 Td +(6609 ) 3.01 Tj +0 -17.0182 Td +(6610 #define CAPSLOCK \(1<<3\)) 21.07 Tj +0 -18.3273 Td +(6611 #define NUMLOCK \(1<<4\)) 21.07 Tj +0 -19.6364 Td +(6612 #define SCROLLLOCK \(1<<5\)) 21.07 Tj +0 -20.9455 Td +(6613 ) 3.01 Tj +0 -22.2545 Td +(6614 #define E0ESC \(1<<6\)) 21.07 Tj +0 -23.5636 Td +(6615 ) 3.01 Tj +0 -24.8727 Td +(6616 // Special keycodes) 14.448 Tj +0 -26.1818 Td +(6617 #define KEY_HOME 0xE0) 19.866 Tj +0 -27.4909 Td +(6618 #define KEY_END 0xE1) 19.866 Tj +0 -28.8 Td +(6619 #define KEY_UP 0xE2) 19.866 Tj +0 -30.1091 Td +(6620 #define KEY_DN 0xE3) 19.866 Tj +0 -31.4182 Td +(6621 #define KEY_LF 0xE4) 19.866 Tj +0 -32.7273 Td +(6622 #define KEY_RT 0xE5) 19.866 Tj +0 -34.0364 Td +(6623 #define KEY_PGUP 0xE6) 19.866 Tj +0 -35.3454 Td +(6624 #define KEY_PGDN 0xE7) 19.866 Tj +0 -36.6545 Td +(6625 #define KEY_INS 0xE8) 19.866 Tj +0 -37.9636 Td +(6626 #define KEY_DEL 0xE9) 19.866 Tj +0 -39.2727 Td +(6627 ) 3.01 Tj +0 -40.5818 Td +(6628 static uchar shiftcode[256] =) 20.468 Tj +0 -41.8909 Td +(6629 {) 3.612 Tj +0 -43.2 Td +(6630 [0x1D] CTL,) 10.836 Tj +0 -44.5091 Td +(6631 [0x2A] SHIFT,) 12.04 Tj +0 -45.8182 Td +(6632 [0x36] SHIFT,) 12.04 Tj +0 -47.1272 Td +(6633 [0x38] ALT,) 10.836 Tj +0 -48.4363 Td +(6634 [0x9D] CTL,) 10.836 Tj +0 -49.7454 Td +(6635 [0xB8] ALT) 10.234 Tj +0 -51.0545 Td +(6636 };) 4.214 Tj +0 -52.3636 Td +(6637 ) 3.01 Tj +0 -53.6727 Td +(6638 static uchar togglecode[256] =) 21.07 Tj +0 -54.9818 Td +(6639 {) 3.612 Tj +0 -56.2909 Td +(6640 [0x3A] CAPSLOCK,) 13.846 Tj +0 -57.6 Td +(6641 [0x45] NUMLOCK,) 13.244 Tj +0 -58.9091 Td +(6642 [0x46] SCROLLLOCK) 14.448 Tj +0 -60.2181 Td +(6643 };) 4.214 Tj +0 -61.5272 Td +(6644 ) 3.01 Tj +0 -62.8363 Td +(6645 ) 3.01 Tj +0 -64.1454 Td +(6646 ) 3.01 Tj +0 -65.4545 Td +(6647 ) 3.01 Tj +0 -66.7636 Td +(6648 ) 3.01 Tj +0 -68.0727 Td +(6649 ) 3.01 Tj +0 -72 Td +(Sheet 66) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/console.c Page 6) 24.08 Tj +0 -3.92728 Td +(6650 static uchar normalmap[256] =) 20.468 Tj +0 -5.23637 Td +(6651 {) 3.612 Tj +0 -6.54546 Td +(6652 NO, 0x1B, '1', '2', '3', '4', '5', '6', // 0x00) 37.324 Tj +0 -7.85455 Td +(6653 '7', '8', '9', '0', '-', '=', '\\b', '\\t',) 32.508 Tj +0 -9.16364 Td +(6654 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', // 0x10) 37.324 Tj +0 -10.4727 Td +(6655 'o', 'p', '[', ']', '\\n', NO, 'a', 's',) 31.906 Tj +0 -11.7818 Td +(6656 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', // 0x20) 37.324 Tj +0 -13.0909 Td +(6657 '\\'', '`', NO, '\\\\', 'z', 'x', 'c', 'v',) 31.906 Tj +0 -14.4 Td +(6658 'b', 'n', 'm', ',', '.', '/', NO, '*', // 0x30) 37.324 Tj +0 -15.7091 Td +(6659 NO, ' ', NO, NO, NO, NO, NO, NO,) 31.304 Tj +0 -17.0182 Td +(6660 NO, NO, NO, NO, NO, NO, NO, '7', // 0x40) 37.324 Tj +0 -18.3273 Td +(6661 '8', '9', '-', '4', '5', '6', '+', '1',) 31.906 Tj +0 -19.6364 Td +(6662 '2', '3', '0', '.', NO, NO, NO, NO, // 0x50) 37.324 Tj +0 -20.9455 Td +(6663 [0x97] KEY_HOME,) 13.846 Tj +0 -22.2545 Td +(6664 [0x9C] '\\n', // KP_Enter) 21.672 Tj +0 -23.5636 Td +(6665 [0xB5] '/', // KP_Div) 20.468 Tj +0 -24.8727 Td +(6666 [0xC8] KEY_UP,) 12.642 Tj +0 -26.1818 Td +(6667 [0xC9] KEY_PGUP,) 13.846 Tj +0 -27.4909 Td +(6668 [0xCB] KEY_LF,) 12.642 Tj +0 -28.8 Td +(6669 [0xCD] KEY_RT,) 12.642 Tj +0 -30.1091 Td +(6670 [0xCF] KEY_END,) 13.244 Tj +0 -31.4182 Td +(6671 [0xD0] KEY_DN,) 12.642 Tj +0 -32.7273 Td +(6672 [0xD1] KEY_PGDN,) 13.846 Tj +0 -34.0364 Td +(6673 [0xD2] KEY_INS,) 13.244 Tj +0 -35.3454 Td +(6674 [0xD3] KEY_DEL) 12.642 Tj +0 -36.6545 Td +(6675 };) 4.214 Tj +0 -37.9636 Td +(6676 ) 3.01 Tj +0 -39.2727 Td +(6677 static uchar shiftmap[256] =) 19.866 Tj +0 -40.5818 Td +(6678 {) 3.612 Tj +0 -41.8909 Td +(6679 NO, 033, '!', '@', '#', '$', '%', '^', // 0x00) 37.324 Tj +0 -43.2 Td +(6680 '&', '*', '\(', '\)', '_', '+', '\\b', '\\t',) 32.508 Tj +0 -44.5091 Td +(6681 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', // 0x10) 37.324 Tj +0 -45.8182 Td +(6682 'O', 'P', '{', '}', '\\n', NO, 'A', 'S',) 31.906 Tj +0 -47.1272 Td +(6683 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', // 0x20) 37.324 Tj +0 -48.4363 Td +(6684 '"', '~', NO, '|', 'Z', 'X', 'C', 'V',) 31.906 Tj +0 -49.7454 Td +(6685 'B', 'N', 'M', '<', '>', '?', NO, '*', // 0x30) 37.324 Tj +0 -51.0545 Td +(6686 NO, ' ', NO, NO, NO, NO, NO, NO,) 31.304 Tj +0 -52.3636 Td +(6687 NO, NO, NO, NO, NO, NO, NO, '7', // 0x40) 37.324 Tj +0 -53.6727 Td +(6688 '8', '9', '-', '4', '5', '6', '+', '1',) 31.906 Tj +0 -54.9818 Td +(6689 '2', '3', '0', '.', NO, NO, NO, NO, // 0x50) 37.324 Tj +0 -56.2909 Td +(6690 [0x97] KEY_HOME,) 13.846 Tj +0 -57.6 Td +(6691 [0x9C] '\\n', // KP_Enter) 21.672 Tj +0 -58.9091 Td +(6692 [0xB5] '/', // KP_Div) 20.468 Tj +0 -60.2181 Td +(6693 [0xC8] KEY_UP,) 12.642 Tj +0 -61.5272 Td +(6694 [0xC9] KEY_PGUP,) 13.846 Tj +0 -62.8363 Td +(6695 [0xCB] KEY_LF,) 12.642 Tj +0 -64.1454 Td +(6696 [0xCD] KEY_RT,) 12.642 Tj +0 -65.4545 Td +(6697 [0xCF] KEY_END,) 13.244 Tj +0 -66.7636 Td +(6698 [0xD0] KEY_DN,) 12.642 Tj +0 -68.0727 Td +(6699 [0xD1] KEY_PGDN,) 13.846 Tj +0 -72 Td +(Sheet 66) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 74 74 +%%BeginPageSetup +%%PageOrientation: Landscape +__tumble pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/console.c Page 7) 24.08 Tj +0 -3.92728 Td +(6700 [0xD2] KEY_INS,) 13.244 Tj +0 -5.23637 Td +(6701 [0xD3] KEY_DEL) 12.642 Tj +0 -6.54546 Td +(6702 };) 4.214 Tj +0 -7.85455 Td +(6703 ) 3.01 Tj +0 -9.16364 Td +(6704 #define C\(x\) \(x - '@'\)) 16.254 Tj +0 -10.4727 Td +(6705 ) 3.01 Tj +0 -11.7818 Td +(6706 static uchar ctlmap[256] =) 18.662 Tj +0 -13.0909 Td +(6707 {) 3.612 Tj +0 -14.4 Td +(6708 NO, NO, NO, NO, NO, NO, NO, NO,) 43.946 Tj +0 -15.7091 Td +(6709 NO, NO, NO, NO, NO, NO, NO, NO,) 43.946 Tj +0 -17.0182 Td +(6710 C\('Q'\), C\('W'\), C\('E'\), C\('R'\), C\('T'\), C\('Y'\), C\('U'\), C\('I'\),) 46.354 Tj +0 -18.3273 Td +(6711 C\('O'\), C\('P'\), NO, NO, '\\r', NO, C\('A'\), C\('S'\),) 46.354 Tj +0 -19.6364 Td +(6712 C\('D'\), C\('F'\), C\('G'\), C\('H'\), C\('J'\), C\('K'\), C\('L'\), NO,) 43.946 Tj +0 -20.9455 Td +(6713 NO, NO, NO, C\('\\\\'\), C\('Z'\), C\('X'\), C\('C'\), C\('V'\),) 46.354 Tj +0 -22.2545 Td +(6714 C\('B'\), C\('N'\), C\('M'\), NO, NO, C\('/'\), NO, NO,) 43.946 Tj +0 -23.5636 Td +(6715 [0x97] KEY_HOME,) 13.846 Tj +0 -24.8727 Td +(6716 [0xB5] C\('/'\), // KP_Div) 20.468 Tj +0 -26.1818 Td +(6717 [0xC8] KEY_UP,) 12.642 Tj +0 -27.4909 Td +(6718 [0xC9] KEY_PGUP,) 13.846 Tj +0 -28.8 Td +(6719 [0xCB] KEY_LF,) 12.642 Tj +0 -30.1091 Td +(6720 [0xCD] KEY_RT,) 12.642 Tj +0 -31.4182 Td +(6721 [0xCF] KEY_END,) 13.244 Tj +0 -32.7273 Td +(6722 [0xD0] KEY_DN,) 12.642 Tj +0 -34.0364 Td +(6723 [0xD1] KEY_PGDN,) 13.846 Tj +0 -35.3454 Td +(6724 [0xD2] KEY_INS,) 13.244 Tj +0 -36.6545 Td +(6725 [0xD3] KEY_DEL) 12.642 Tj +0 -37.9636 Td +(6726 };) 4.214 Tj +0 -39.2727 Td +(6727 ) 3.01 Tj +0 -40.5818 Td +(6728 static uchar *charcode[4] = {) 20.468 Tj +0 -41.8909 Td +(6729 normalmap,) 10.234 Tj +0 -43.2 Td +(6730 shiftmap,) 9.632 Tj +0 -44.5091 Td +(6731 ctlmap,) 8.428 Tj +0 -45.8182 Td +(6732 ctlmap) 7.826 Tj +0 -47.1272 Td +(6733 };) 4.214 Tj +0 -48.4363 Td +(6734 ) 3.01 Tj +0 -49.7454 Td +(6735 #define KBD_BUF 64) 13.846 Tj +0 -51.0545 Td +(6736 char kbd_buf[KBD_BUF];) 16.254 Tj +0 -52.3636 Td +(6737 int kbd_r;) 9.03 Tj +0 -53.6727 Td +(6738 int kbd_w;) 9.03 Tj +0 -54.9818 Td +(6739 struct spinlock kbd_lock;) 18.06 Tj +0 -56.2909 Td +(6740 static uint shift;) 13.846 Tj +0 -57.6 Td +(6741 ) 3.01 Tj +0 -58.9091 Td +(6742 void) 5.418 Tj +0 -60.2181 Td +(6743 kbd_intr\(\)) 9.03 Tj +0 -61.5272 Td +(6744 {) 3.612 Tj +0 -62.8363 Td +(6745 uint st, data, c;) 14.448 Tj +0 -64.1454 Td +(6746 ) 3.01 Tj +0 -65.4545 Td +(6747 acquire\(&kbd_lock\);) 15.652 Tj +0 -66.7636 Td +(6748 ) 3.01 Tj +0 -68.0727 Td +(6749 ) 3.01 Tj +0 -72 Td +(Sheet 67) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/console.c Page 8) 24.08 Tj +0 -3.92728 Td +(6750 st = inb\(KBSTATP\);) 15.05 Tj +0 -5.23637 Td +(6751 if\(\(st & KBS_DIB\) == 0\)) 18.06 Tj +0 -6.54546 Td +(6752 goto out;) 10.836 Tj +0 -7.85455 Td +(6753 data = inb\(KBDATAP\);) 16.254 Tj +0 -9.16364 Td +(6754 ) 3.01 Tj +0 -10.4727 Td +(6755 if\(data == 0xE0\) {) 15.05 Tj +0 -11.7818 Td +(6756 shift |= E0ESC;) 14.448 Tj +0 -13.0909 Td +(6757 goto out;) 10.836 Tj +0 -14.4 Td +(6758 } else if\(data & 0x80\) {) 18.662 Tj +0 -15.7091 Td +(6759 // Key released) 14.448 Tj +0 -17.0182 Td +(6760 data = \(shift & E0ESC ? data : data & 0x7F\);) 31.906 Tj +0 -18.3273 Td +(6761 shift &= ~\(shiftcode[data] | E0ESC\);) 27.09 Tj +0 -19.6364 Td +(6762 goto out;) 10.836 Tj +0 -20.9455 Td +(6763 } else if\(shift & E0ESC\) {) 19.866 Tj +0 -22.2545 Td +(6764 // Last character was an E0 escape; or with 0x80) 34.314 Tj +0 -23.5636 Td +(6765 data |= 0x80;) 13.244 Tj +0 -24.8727 Td +(6766 shift &= ~E0ESC;) 15.05 Tj +0 -26.1818 Td +(6767 }) 4.816 Tj +0 -27.4909 Td +(6768 ) 3.01 Tj +0 -28.8 Td +(6769 shift |= shiftcode[data];) 19.264 Tj +0 -30.1091 Td +(6770 shift ^= togglecode[data];) 19.866 Tj +0 -31.4182 Td +(6771 ) 3.01 Tj +0 -32.7273 Td +(6772 c = charcode[shift & \(CTL | SHIFT\)][data];) 29.498 Tj +0 -34.0364 Td +(6773 if\(shift & CAPSLOCK\) {) 17.458 Tj +0 -35.3454 Td +(6774 if\('a' <= c && c <= 'z'\)) 19.866 Tj +0 -36.6545 Td +(6775 c += 'A' - 'a';) 15.652 Tj +0 -37.9636 Td +(6776 else if\('A' <= c && c <= 'Z'\)) 22.876 Tj +0 -39.2727 Td +(6777 c += 'a' - 'A';) 15.652 Tj +0 -40.5818 Td +(6778 }) 4.816 Tj +0 -41.8909 Td +(6779 ) 3.01 Tj +0 -43.2 Td +(6780 switch\(c\){) 10.234 Tj +0 -44.5091 Td +(6781 case 0:) 8.428 Tj +0 -45.8182 Td +(6782 // Ignore unknown keystrokes.) 22.876 Tj +0 -47.1272 Td +(6783 break;) 9.03 Tj +0 -48.4363 Td +(6784 ) 3.01 Tj +0 -49.7454 Td +(6785 case C\('T'\):) 11.438 Tj +0 -51.0545 Td +(6786 cprintf\("#"\); // Let user know we're still alive.) 35.518 Tj +0 -52.3636 Td +(6787 break;) 9.03 Tj +0 -53.6727 Td +(6788 ) 3.01 Tj +0 -54.9818 Td +(6789 case C\('P'\):) 11.438 Tj +0 -56.2909 Td +(6790 procdump\(\);) 12.04 Tj +0 -57.6 Td +(6791 break;) 9.03 Tj +0 -58.9091 Td +(6792 ) 3.01 Tj +0 -60.2181 Td +(6793 default:) 9.03 Tj +0 -61.5272 Td +(6794 if\(\(\(kbd_w + 1\) % KBD_BUF\) != kbd_r\){) 27.692 Tj +0 -62.8363 Td +(6795 kbd_buf[kbd_w++] = c;) 19.264 Tj +0 -64.1454 Td +(6796 if\(kbd_w >= KBD_BUF\)) 18.662 Tj +0 -65.4545 Td +(6797 kbd_w = 0;) 13.846 Tj +0 -66.7636 Td +(6798 wakeup\(&kbd_r\);) 15.652 Tj +0 -68.0727 Td +(6799 }) 6.02 Tj +0 -72 Td +(Sheet 67) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 75 75 +%%BeginPageSetup +%%PageOrientation: Landscape +pdfStartPage +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +0 g +0 G +q +q +[0.1 0 0 0.1 0 0] cm +q +Q +q +180 3960 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 738.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/console.c Page 9) 24.08 Tj +0 -3.92728 Td +(6800 break;) 9.03 Tj +0 -5.23637 Td +(6801 }) 4.816 Tj +0 -6.54546 Td +(6802 ) 3.01 Tj +0 -7.85455 Td +(6803 out:) 5.418 Tj +0 -9.16364 Td +(6804 release\(&kbd_lock\);) 15.652 Tj +0 -10.4727 Td +(6805 }) 3.612 Tj +0 -11.7818 Td +(6806 ) 3.01 Tj +0 -13.0909 Td +(6807 int) 4.816 Tj +0 -14.4 Td +(6808 console_read\(int minor, char *dst, int n\)) 27.692 Tj +0 -15.7091 Td +(6809 {) 3.612 Tj +0 -17.0182 Td +(6810 uint target = n;) 13.846 Tj +0 -18.3273 Td +(6811 ) 3.01 Tj +0 -19.6364 Td +(6812 acquire\(&kbd_lock\);) 15.652 Tj +0 -20.9455 Td +(6813 ) 3.01 Tj +0 -22.2545 Td +(6814 while\(kbd_w == kbd_r\) {) 18.06 Tj +0 -23.5636 Td +(6815 sleep\(&kbd_r, &kbd_lock\);) 20.468 Tj +0 -24.8727 Td +(6816 }) 4.816 Tj +0 -26.1818 Td +(6817 ) 3.01 Tj +0 -27.4909 Td +(6818 while\(n > 0 && kbd_w != kbd_r\){) 22.876 Tj +0 -28.8 Td +(6819 *dst = \(kbd_buf[kbd_r]\) & 0xff;) 24.08 Tj +0 -30.1091 Td +(6820 cons_putc\(*dst & 0xff\);) 19.264 Tj +0 -31.4182 Td +(6821 dst++;) 9.03 Tj +0 -32.7273 Td +(6822 --n;) 7.826 Tj +0 -34.0364 Td +(6823 kbd_r++;) 10.234 Tj +0 -35.3454 Td +(6824 if\(kbd_r >= KBD_BUF\)) 17.458 Tj +0 -36.6545 Td +(6825 kbd_r = 0;) 12.642 Tj +0 -37.9636 Td +(6826 }) 4.816 Tj +0 -39.2727 Td +(6827 ) 3.01 Tj +0 -40.5818 Td +(6828 release\(&kbd_lock\);) 15.652 Tj +0 -41.8909 Td +(6829 ) 3.01 Tj +0 -43.2 Td +(6830 return target - n;) 15.05 Tj +0 -44.5091 Td +(6831 }) 3.612 Tj +0 -45.8182 Td +(6832 ) 3.01 Tj +0 -47.1272 Td +(6833 void) 5.418 Tj +0 -48.4363 Td +(6834 console_init\(\)) 11.438 Tj +0 -49.7454 Td +(6835 {) 3.612 Tj +0 -51.0545 Td +(6836 initlock\(&console_lock, "console"\);) 25.284 Tj +0 -52.3636 Td +(6837 initlock\(&kbd_lock, "kbd"\);) 20.468 Tj +0 -53.6727 Td +(6838 ) 3.01 Tj +0 -54.9818 Td +(6839 devsw[CONSOLE].write = console_write;) 26.488 Tj +0 -56.2909 Td +(6840 devsw[CONSOLE].read = console_read;) 25.284 Tj +0 -57.6 Td +(6841 ) 3.01 Tj +0 -58.9091 Td +(6842 irq_enable\(IRQ_KBD\);) 16.254 Tj +0 -60.2181 Td +(6843 ioapic_enable\(IRQ_KBD, 0\);) 19.866 Tj +0 -61.5272 Td +(6844 ) 3.01 Tj +0 -62.8363 Td +(6845 use_console_lock = 1;) 16.856 Tj +0 -64.1454 Td +(6846 }) 3.612 Tj +0 -65.4545 Td +(6847 ) 3.01 Tj +0 -66.7636 Td +(6848 ) 3.01 Tj +0 -68.0727 Td +(6849 ) 3.01 Tj +0 -72 Td +(Sheet 68) 4.816 Tj +Q +Q +q +180 500 5760 3460 re +W +q +[10 0 0 10 0 0] cm +[1 0 0 1 0 0] Tm +0 0 Td +[0 -7.0183 7.25185 0 564.72 392.865] Tm +0 0 Td +/F10_0 1 Tf +(Sep 8 11:37 2006 xv6/8253pit.c Page 1) 24.08 Tj +0 -3.92728 Td +(6850 #include "types.h") 13.846 Tj +0 -5.23637 Td +(6851 #include "x86.h") 12.642 Tj +0 -6.54546 Td +(6852 #include "defs.h") 13.244 Tj +0 -7.85455 Td +(6853 #include "traps.h") 13.846 Tj +0 -9.16364 Td +(6854 ) 3.01 Tj +0 -10.4727 Td +(6855 // Register definitions for the Intel) 25.284 Tj +0 -11.7818 Td +(6856 // 8253/8254/82C54 Programmable Interval Timer \(PIT\).) 34.916 Tj +0 -13.0909 Td +(6857 ) 3.01 Tj +0 -14.4 Td +(6858 #define IO_TIMER1 0x040 // 8253 Timer #1) 36.722 Tj +0 -15.7091 Td +(6859 #define IO_TIMER2 0x048 // 8253 Timer #2 \(EISA only\)) 43.946 Tj +0 -17.0182 Td +(6860 ) 3.01 Tj +0 -18.3273 Td +(6861 // Frequency of all three count-down timers; \(TIMER_FREQ/freq\) is the) 44.548 Tj +0 -19.6364 Td +(6862 // appropriate count to generate a frequency of freq hz.) 36.722 Tj +0 -20.9455 Td +(6863 ) 3.01 Tj +0 -22.2545 Td +(6864 #define TIMER_FREQ 1193182) 21.672 Tj +0 -23.5636 Td +(6865 #define TIMER_DIV\(x\) \(\(TIMER_FREQ+\(x\)/2\)/\(x\)\)) 31.906 Tj +0 -24.8727 Td +(6866 ) 3.01 Tj +0 -26.1818 Td +(6867 #define TIMER_CNTR0 \(IO_TIMER1 + 0\) // timer 0 counter port) 40.936 Tj +0 -27.4909 Td +(6868 #define TIMER_CNTR1 \(IO_TIMER1 + 1\) // timer 1 counter port) 40.936 Tj +0 -28.8 Td +(6869 #define TIMER_CNTR2 \(IO_TIMER1 + 2\) // timer 2 counter port) 40.936 Tj +0 -30.1091 Td +(6870 #define TIMER_MODE \(IO_TIMER1 + 3\) // timer mode port) 37.926 Tj +0 -31.4182 Td +(6871 #define TIMER_SEL0 0x00 // select counter 0) 33.712 Tj +0 -32.7273 Td +(6872 #define TIMER_SEL1 0x40 // select counter 1) 33.712 Tj +0 -34.0364 Td +(6873 #define TIMER_SEL2 0x80 // select counter 2) 33.712 Tj +0 -35.3454 Td +(6874 #define TIMER_INTTC 0x00 // mode 0, intr on terminal cnt) 40.936 Tj +0 -36.6545 Td +(6875 #define TIMER_ONESHOT 0x02 // mode 1, one shot) 33.712 Tj +0 -37.9636 Td +(6876 #define TIMER_RATEGEN 0x04 // mode 2, rate generator) 37.324 Tj +0 -39.2727 Td +(6877 #define TIMER_SQWAVE 0x06 // mode 3, square wave) 35.518 Tj +0 -40.5818 Td +(6878 #define TIMER_SWSTROBE 0x08 // mode 4, s/w triggered strobe) 40.936 Tj +0 -41.8909 Td +(6879 #define TIMER_HWSTROBE 0x0a // mode 5, h/w triggered strobe) 40.936 Tj +0 -43.2 Td +(6880 #define TIMER_LATCH 0x00 // latch counter for reading) 39.13 Tj +0 -44.5091 Td +(6881 #define TIMER_LSB 0x10 // r/w counter LSB) 33.11 Tj +0 -45.8182 Td +(6882 #define TIMER_MSB 0x20 // r/w counter MSB) 33.11 Tj +0 -47.1272 Td +(6883 #define TIMER_16BIT 0x30 // r/w counter 16 bits, LSB first) 42.14 Tj +0 -48.4363 Td +(6884 #define TIMER_BCD 0x01 // count in BCD) 31.304 Tj +0 -49.7454 Td +(6885 ) 3.01 Tj +0 -51.0545 Td +(6886 void) 5.418 Tj +0 -52.3636 Td +(6887 pit8253_timerinit\(void\)) 16.856 Tj +0 -53.6727 Td +(6888 {) 3.612 Tj +0 -54.9818 Td +(6889 // initialize 8253 clock to interrupt 100 times/sec) 34.916 Tj +0 -56.2909 Td +(6890 outb\(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT\);) 39.732 Tj +0 -57.6 Td +(6891 outb\(IO_TIMER1, TIMER_DIV\(100\) % 256\);) 27.09 Tj +0 -58.9091 Td +(6892 outb\(IO_TIMER1, TIMER_DIV\(100\) / 256\);) 27.09 Tj +0 -60.2181 Td +(6893 irq_enable\(IRQ_TIMER\);) 17.458 Tj +0 -61.5272 Td +(6894 }) 3.612 Tj +0 -62.8363 Td +(6895 ) 3.01 Tj +0 -64.1454 Td +(6896 ) 3.01 Tj +0 -65.4545 Td +(6897 ) 3.01 Tj +0 -66.7636 Td +(6898 ) 3.01 Tj +0 -68.0727 Td +(6899 ) 3.01 Tj +0 -72 Td +(Sheet 68) 4.816 Tj +Q +Q +Q +Q +showpage +%%PageTrailer +pdfEndPage +%%Trailer +end +%%DocumentSuppliedResources: +%%+ font LTWFJF+OurCharSet +%%EOF