diff --git a/ch6-dev/.lock b/ch6-dev/.lock old mode 100755 new mode 100644 diff --git a/ch6-dev/FiraSans-Medium.woff b/ch6-dev/FiraSans-Medium.woff deleted file mode 100644 index 7d742c5f..00000000 Binary files a/ch6-dev/FiraSans-Medium.woff and /dev/null differ diff --git a/ch6-dev/FiraSans-Regular.woff b/ch6-dev/FiraSans-Regular.woff deleted file mode 100644 index d8e0363f..00000000 Binary files a/ch6-dev/FiraSans-Regular.woff and /dev/null differ diff --git a/ch6-dev/NanumBarunGothic.ttf.woff b/ch6-dev/NanumBarunGothic.ttf.woff deleted file mode 100644 index fb063e8f..00000000 Binary files a/ch6-dev/NanumBarunGothic.ttf.woff and /dev/null differ diff --git a/ch6-dev/SourceCodePro-It.ttf.woff b/ch6-dev/SourceCodePro-It.ttf.woff deleted file mode 100644 index 8d68f2fe..00000000 Binary files a/ch6-dev/SourceCodePro-It.ttf.woff and /dev/null differ diff --git a/ch6-dev/SourceCodePro-Regular.ttf.woff b/ch6-dev/SourceCodePro-Regular.ttf.woff deleted file mode 100644 index 7be076e1..00000000 Binary files a/ch6-dev/SourceCodePro-Regular.ttf.woff and /dev/null differ diff --git a/ch6-dev/SourceCodePro-Semibold.ttf.woff b/ch6-dev/SourceCodePro-Semibold.ttf.woff deleted file mode 100644 index 61bc67b8..00000000 Binary files a/ch6-dev/SourceCodePro-Semibold.ttf.woff and /dev/null differ diff --git a/ch6-dev/SourceSerif4-Bold.ttf.woff b/ch6-dev/SourceSerif4-Bold.ttf.woff deleted file mode 100644 index 8ad41888..00000000 Binary files a/ch6-dev/SourceSerif4-Bold.ttf.woff and /dev/null differ diff --git a/ch6-dev/SourceSerif4-Bold.ttf.woff2 b/ch6-dev/SourceSerif4-Bold.ttf.woff2 deleted file mode 100644 index db57d214..00000000 Binary files a/ch6-dev/SourceSerif4-Bold.ttf.woff2 and /dev/null differ diff --git a/ch6-dev/SourceSerif4-It.ttf.woff b/ch6-dev/SourceSerif4-It.ttf.woff deleted file mode 100644 index 2a34b5c4..00000000 Binary files a/ch6-dev/SourceSerif4-It.ttf.woff and /dev/null differ diff --git a/ch6-dev/SourceSerif4-It.ttf.woff2 b/ch6-dev/SourceSerif4-It.ttf.woff2 deleted file mode 100644 index 1cbc021a..00000000 Binary files a/ch6-dev/SourceSerif4-It.ttf.woff2 and /dev/null differ diff --git a/ch6-dev/SourceSerif4-Regular.ttf.woff b/ch6-dev/SourceSerif4-Regular.ttf.woff deleted file mode 100644 index 45a5521a..00000000 Binary files a/ch6-dev/SourceSerif4-Regular.ttf.woff and /dev/null differ diff --git a/ch6-dev/SourceSerif4-Regular.ttf.woff2 b/ch6-dev/SourceSerif4-Regular.ttf.woff2 deleted file mode 100644 index 2db73fe2..00000000 Binary files a/ch6-dev/SourceSerif4-Regular.ttf.woff2 and /dev/null differ diff --git a/ch6-dev/ayu.css b/ch6-dev/ayu.css deleted file mode 100644 index 50d893e2..00000000 --- a/ch6-dev/ayu.css +++ /dev/null @@ -1 +0,0 @@ - body{background-color:#0f1419;color:#c5c5c5;}h1,h2,h3,h4{color:white;}h1.fqn{border-bottom-color:#5c6773;}h1.fqn a{color:#fff;}h2,h3,h4{border-bottom-color:#5c6773;}h4{border:none;}.in-band{background-color:#0f1419;}.invisible{background:rgba(0,0,0,0);}.docblock code{color:#ffb454;}.code-header{color:#e6e1cf;}.docblock pre>code,pre>code{color:#e6e1cf;}span code{color:#e6e1cf;}.docblock a>code{color:#39AFD7 !important;}.docblock code,.docblock-short code{background-color:#191f26;}pre,.rustdoc.source .example-wrap{color:#e6e1cf;background-color:#191f26;}.sidebar,.mobile-topbar,.sidebar-menu-toggle{background-color:#14191f;}.rust-logo{filter:drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff);}*{scrollbar-color:#5c6773 #24292f;}.sidebar{scrollbar-color:#5c6773 #24292f;}::-webkit-scrollbar-track{background-color:transparent;}::-webkit-scrollbar-thumb{background-color:#5c6773;}.sidebar::-webkit-scrollbar-track{background-color:transparent;}.sidebar::-webkit-scrollbar-thumb{background-color:#5c6773;}.sidebar .current,.sidebar a:hover{background-color:transparent;color:#ffb44c;}.source .sidebar{background-color:#14191f;}.sidebar-elems .location{color:#ff7733;}.line-numbers span{color:#5c6773;}.line-numbers .line-highlighted{color:#708090;background-color:rgba(255,236,164,0.06);padding-right:4px;border-right:1px solid #ffb44c;}.docblock h1,.docblock h2,.docblock h3,.docblock h4,.docblock h5,.docblock h6{border-bottom-color:#5c6773;}.docblock table td,.docblock table th{border-color:#5c6773;}.content .method .where,.content .fn .where,.content .where.fmt-newline{color:#c5c5c5;}.search-results a:hover{background-color:#777;}.search-results a:focus{color:#000 !important;background-color:#c6afb3;}.search-results a{color:#0096cf;}.search-results a div.desc{color:#c5c5c5;}.content .item-info::before{color:#ccc;}.content span.foreigntype,.content a.foreigntype{color:#ffa0a5;}.content span.union,.content a.union{color:#ffa0a5;}.content span.constant,.content a.constant,.content span.static,.content a.static{color:#39AFD7;}.content span.primitive,.content a.primitive{color:#ffa0a5;}.content span.traitalias,.content a.traitalias{color:#39AFD7;}.content span.keyword,.content a.keyword{color:#39AFD7;}.content span.externcrate,.content span.mod,.content a.mod{color:#39AFD7;}.content span.struct,.content a.struct{color:#ffa0a5;}.content span.enum,.content a.enum{color:#ffa0a5;}.content span.trait,.content a.trait{color:#39AFD7;}.content span.type,.content a.type{color:#39AFD7;}.content span.type,.content a.type,.block a.current.type{color:#39AFD7;}.content span.associatedtype,.content a.associatedtype,.block a.current.associatedtype{color:#39AFD7;}.content span.fn,.content a.fn,.content span.method,.content a.method,.content span.tymethod,.content a.tymethod,.content .fnname{color:#fdd687;}.content span.attr,.content a.attr,.content span.derive,.content a.derive,.content span.macro,.content a.macro{color:#a37acc;}.sidebar a{color:#53b1db;}.sidebar a.current.type{color:#53b1db;}.sidebar a.current.associatedtype{color:#53b1db;}pre.rust .comment{color:#788797;}pre.rust .doccomment{color:#a1ac88;}nav.main .current{border-top-color:#5c6773;border-bottom-color:#5c6773;}nav.main .separator{border:1px solid #5c6773;}a{color:#39AFD7;}a#toggle-all-docs,a.anchor,.small-section-header a,#source-sidebar a,pre.rust a,.sidebar h2 a,.sidebar h3 a,.mobile-topbar h2 a,.in-band a{color:#c5c5c5;}.sidebar h2 a,.sidebar h3 a{color:white;}.search-results a{color:#0096cf;}body.source .example-wrap pre.rust a{background:#333;}details.rustdoc-toggle>summary.hideme>span,details.rustdoc-toggle>summary::before,details.undocumented>summary::before{color:#999;}details.rustdoc-toggle>summary::before,details.undocumented>summary::before{filter:invert(100%);}#crate-search,.search-input{background-color:#141920;border-color:#424c57;color:#c5c5c5;}.search-input{color:#ffffff;}.module-item .stab,.import-item .stab{color:#000;}.stab.unstable,.stab.deprecated,.stab.portability{color:#c5c5c5;background:#314559 !important;border-style:none !important;border-radius:4px;padding:3px 6px 3px 6px;}.stab.portability>code{color:#e6e1cf;background:none;}#help>div{background:#14191f;box-shadow:0px 6px 20px 0px black;border:none;border-radius:4px;}#help span.bottom,#help span.top{border-color:#5c6773;}.rightside,.out-of-band{color:grey;}.result-name .primitive>i,.result-name .keyword>i{color:#788797;}.line-numbers :target{background-color:transparent;}pre.rust .number,pre.rust .string{color:#b8cc52;}pre.rust .kw,pre.rust .kw-2,pre.rust .prelude-ty,pre.rust .bool-val,pre.rust .prelude-val,pre.rust .op,pre.rust .lifetime{color:#ff7733;}pre.rust .macro,pre.rust .macro-nonterminal{color:#a37acc;}pre.rust .question-mark{color:#ff9011;}pre.rust .self{color:#36a3d9;font-style:italic;}pre.rust .attribute{color:#e6e1cf;}pre.rust .attribute .ident,pre.rust .attribute .op{color:#e6e1cf;}.example-wrap>pre.line-number{color:#5c67736e;border:none;}a.test-arrow{font-size:100%;color:#788797;border-radius:4px;background-color:rgba(57,175,215,0.09);}a.test-arrow:hover{background-color:rgba(57,175,215,0.368);color:#c5c5c5;}.toggle-label,.code-attribute{color:#999;}:target{background:rgba(255,236,164,0.06);border-right:3px solid rgba(255,180,76,0.85);}pre.compile_fail{border-left:2px solid rgba(255,0,0,.4);}pre.compile_fail:hover,.information:hover+pre.compile_fail{border-left:2px solid #f00;}pre.should_panic{border-left:2px solid rgba(255,0,0,.4);}pre.should_panic:hover,.information:hover+pre.should_panic{border-left:2px solid #f00;}pre.ignore{border-left:2px solid rgba(255,142,0,.6);}pre.ignore:hover,.information:hover+pre.ignore{border-left:2px solid #ff9200;}.tooltip.compile_fail{color:rgba(255,0,0,.5);}.information>.compile_fail:hover{color:#f00;}.tooltip.should_panic{color:rgba(255,0,0,.5);}.information>.should_panic:hover{color:#f00;}.tooltip.ignore{color:rgba(255,142,0,.6);}.information>.ignore:hover{color:#ff9200;}.search-failed a{color:#39AFD7;}.tooltip::after{background-color:#314559;color:#c5c5c5;border:1px solid #5c6773;}.tooltip::before{border-color:transparent #314559 transparent transparent;}.notable-traits-tooltiptext{background-color:#314559;border-color:#5c6773;}.notable-traits-tooltiptext .notable{border-bottom-color:#5c6773;}#titles>button.selected{background-color:#141920 !important;border-bottom:1px solid #ffb44c !important;border-top:none;}#titles>button:not(.selected){background-color:transparent !important;border:none;}#titles>button:hover{border-bottom:1px solid rgba(242,151,24,0.3);}#titles>button>div.count{color:#888;}.search-input:focus{}.content span.attr,.content a.attr,.block a.current.attr,.content span.derive,.content a.derive,.block a.current.derive,.content span.macro,.content a.macro,.block a.current.macro{}.content span.struct,.content a.struct,.block a.current.struct{}#titles>button:hover,#titles>button.selected{}.content span.typedef,.content a.typedef,.block a.current.typedef{}.content span.union,.content a.union,.block a.current.union{}pre.rust .lifetime{}.stab.unstable{}h2,h3:not(.impl):not(.method):not(.type):not(.tymethod),h4:not(.method):not(.type):not(.tymethod){}.content span.enum,.content a.enum,.block a.current.enum{}.content span.constant,.content a.constant,.block a.current.constant,.content span.static,.content a.static,.block a.current.static{}.content span.keyword,.content a.keyword,.block a.current.keyword{}pre.rust .comment{}.content span.traitalias,.content a.traitalias,.block a.current.traitalias{}.content span.fn,.content a.fn,.block a.current.fn,.content span.method,.content a.method,.block a.current.method,.content span.tymethod,.content a.tymethod,.block a.current.tymethod,.content .fnname{}pre.rust .kw{}pre.rust .self,pre.rust .bool-val,pre.rust .prelude-val,pre.rust .attribute,pre.rust .attribute .ident{}.content span.foreigntype,.content a.foreigntype,.block a.current.foreigntype{}pre.rust .doccomment{}.stab.deprecated{}.content a.attr,.content a.derive,.content a.macro{}.stab.portability{}.content span.primitive,.content a.primitive,.block a.current.primitive{}.content span.externcrate,.content span.mod,.content a.mod,.block a.current.mod{}pre.rust .kw-2,pre.rust .prelude-ty{}.content span.trait,.content a.trait,.block a.current.trait{}.search-results a:focus span{}a.result-trait:focus{}a.result-traitalias:focus{}a.result-mod:focus,a.result-externcrate:focus{}a.result-mod:focus{}a.result-externcrate:focus{}a.result-enum:focus{}a.result-struct:focus{}a.result-union:focus{}a.result-fn:focus,a.result-method:focus,a.result-tymethod:focus{}a.result-type:focus{}a.result-associatedtype:focus{}a.result-foreigntype:focus{}a.result-attr:focus,a.result-derive:focus,a.result-macro:focus{}a.result-constant:focus,a.result-static:focus{}a.result-primitive:focus{}a.result-keyword:focus{}.sidebar a.current.enum{}.sidebar a.current.struct{}.sidebar a.current.foreigntype{}.sidebar a.current.attr,.sidebar a.current.derive,.sidebar a.current.macro{}.sidebar a.current.union{}.sidebar a.current.constant .sidebar a.current.static{}.sidebar a.current.primitive{}.sidebar a.current.externcrate .sidebar a.current.mod{}.sidebar a.current.trait{}.sidebar a.current.traitalias{}.sidebar a.current.fn,.sidebar a.current.method,.sidebar a.current.tymethod{}.sidebar a.current.keyword{}@media (max-width:700px){.sidebar-menu{background-color:#14191f;border-bottom-color:#5c6773;border-right-color:#5c6773;}.sidebar-elems{background-color:#14191f;border-right-color:#5c6773;}#sidebar-filler{background-color:#14191f;border-bottom-color:#5c6773;}}kbd{color:#c5c5c5;background-color:#314559;border-color:#5c6773;border-bottom-color:#5c6773;box-shadow:inset 0 -1px 0 #5c6773;}#theme-picker,#settings-menu,#help-button{border-color:#5c6773;background-color:#0f1419;color:#fff;}#theme-picker>img,#settings-menu>img{filter:invert(100);}#copy-path{color:#fff;}#copy-path>img{filter:invert(70%);}#copy-path:hover>img{filter:invert(100%);}#theme-picker:hover,#theme-picker:focus,#settings-menu:hover,#settings-menu:focus,#help-button:hover,#help-button:focus{border-color:#e0e0e0;}#theme-choices{border-color:#5c6773;background-color:#0f1419;}#theme-choices>button:not(:first-child){border-top-color:#5c6773;}#theme-choices>button:hover,#theme-choices>button:focus{background-color:rgba(110,110,110,0.33);}@media (max-width:700px){#theme-picker{background:#0f1419;}}.search-results .result-name span.alias{color:#c5c5c5;}.search-results .result-name span.grey{color:#999;}#sidebar-toggle{background-color:#14191f;}#sidebar-toggle:hover{background-color:rgba(70,70,70,0.33);}#source-sidebar{background-color:#14191f;}#source-sidebar>.title{color:#fff;border-bottom-color:#5c6773;}div.files>a:hover,div.name:hover{background-color:#14191f;color:#ffb44c;}div.files>.selected{background-color:#14191f;color:#ffb44c;}.setting-line>.title{border-bottom-color:#5c6773;}input:checked+.slider{background-color:#ffb454 !important;}.scraped-example .example-wrap .rust span.highlight{background:rgb(91,59,1);}.scraped-example .example-wrap .rust span.highlight.focus{background:rgb(124,75,15);}.scraped-example:not(.expanded) .code-wrapper:before{background:linear-gradient(to bottom,rgba(15,20,25,1),rgba(15,20,25,0));}.scraped-example:not(.expanded) .code-wrapper:after{background:linear-gradient(to top,rgba(15,20,25,1),rgba(15,20,25,0));}.toggle-line-inner{background:#616161;}.toggle-line:hover .toggle-line-inner{background:#898989;} \ No newline at end of file diff --git a/ch6-dev/brush.svg b/ch6-dev/brush.svg deleted file mode 100644 index ea266e85..00000000 --- a/ch6-dev/brush.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ch6-dev/dark.css b/ch6-dev/dark.css deleted file mode 100644 index a31f453f..00000000 --- a/ch6-dev/dark.css +++ /dev/null @@ -1 +0,0 @@ -body{background-color:#353535;color:#ddd;}h1,h2,h3,h4{color:#ddd;}h1.fqn{border-bottom-color:#d2d2d2;}h2,h3,h4{border-bottom-color:#d2d2d2;}.in-band{background-color:#353535;}.invisible{background:rgba(0,0,0,0);}.docblock code,.docblock-short code{background-color:#2A2A2A;}pre,.rustdoc.source .example-wrap{background-color:#2A2A2A;}.sidebar,.mobile-topbar,.sidebar-menu-toggle{background-color:#505050;}.rust-logo{filter:drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff)}*{scrollbar-color:rgb(64,65,67) #717171;}.sidebar{scrollbar-color:rgba(32,34,37,.6) #5a5a5a;}::-webkit-scrollbar-track{background-color:#717171;}::-webkit-scrollbar-thumb{background-color:rgba(32,34,37,.6);}.sidebar::-webkit-scrollbar-track{background-color:#717171;}.sidebar::-webkit-scrollbar-thumb{background-color:rgba(32,34,37,.6);}.sidebar .current,.sidebar a:hover{background:#444;}.source .sidebar{background-color:#565656;}.line-numbers span{color:#3B91E2;}.line-numbers .line-highlighted{background-color:#0a042f !important;}.docblock h1,.docblock h2,.docblock h3,.docblock h4,.docblock h5,.docblock h6{border-bottom-color:#DDD;}.docblock table td,.docblock table th{border-color:#ddd;}.content .method .where,.content .fn .where,.content .where.fmt-newline{color:#ddd;}.search-results a:hover{background-color:#777;}.search-results a:focus{color:#eee !important;background-color:#616161;}.search-results a:focus span{color:#eee !important;}a.result-trait:focus{background-color:#013191;}a.result-traitalias:focus{background-color:#013191;}a.result-mod:focus,a.result-externcrate:focus{background-color:#884719;}a.result-enum:focus{background-color:#194e9f;}a.result-struct:focus{background-color:#194e9f;}a.result-union:focus{background-color:#194e9f;}a.result-fn:focus,a.result-method:focus,a.result-tymethod:focus{background-color:#4950ed;}a.result-type:focus{background-color:#194e9f;}a.result-associatedtype:focus{background-color:#884719;}a.result-foreigntype:focus{background-color:#194e9f;}a.result-attr:focus,a.result-derive:focus,a.result-macro:focus{background-color:#217d1c;}a.result-constant:focus,a.result-static:focus{background-color:#884719;}a.result-primitive:focus{background-color:#194e9f;}a.result-keyword:focus{background-color:#884719;}.content .item-info::before{color:#ccc;}.content span.enum,.content a.enum,.block a.current.enum{color:#2dbfb8;}.content span.struct,.content a.struct,.block a.current.struct{color:#2dbfb8;}.content span.type,.content a.type,.block a.current.type{color:#2dbfb8;}.content span.associatedtype,.content a.associatedtype,.block a.current.associatedtype{color:#D2991D;}.content span.foreigntype,.content a.foreigntype,.block a.current.foreigntype{color:#2dbfb8;}.content span.attr,.content a.attr,.block a.current.attr,.content span.derive,.content a.derive,.block a.current.derive,.content span.macro,.content a.macro,.block a.current.macro{color:#09bd00;}.content span.union,.content a.union,.block a.current.union{color:#2dbfb8;}.content span.constant,.content a.constant,.block a.current.constant,.content span.static,.content a.static,.block a.current.static{color:#D2991D;}.content span.primitive,.content a.primitive,.block a.current.primitive{color:#2dbfb8;}.content span.externcrate,.content span.mod,.content a.mod,.block a.current.mod{color:#D2991D;}.content span.trait,.content a.trait,.block a.current.trait{color:#b78cf2;}.content span.traitalias,.content a.traitalias,.block a.current.traitalias{color:#b78cf2;}.content span.fn,.content a.fn,.block a.current.fn,.content span.method,.content a.method,.block a.current.method,.content span.tymethod,.content a.tymethod,.block a.current.tymethod,.content .fnname{color:#2BAB63;}.content span.keyword,.content a.keyword,.block a.current.keyword{color:#D2991D;}.sidebar a{color:#fdbf35;}.sidebar a.current.enum{color:#12ece2;}.sidebar a.current.struct{color:#12ece2;}.sidebar a.current.type{color:#12ece2;}.sidebar a.current.associatedtype{color:#fdbf35;}.sidebar a.current.foreigntype{color:#12ece2;}.sidebar a.current.attr,.sidebar a.current.derive,.sidebar a.current.macro{color:#0be900;}.sidebar a.current.union{color:#12ece2;}.sidebar a.current.constant .sidebar a.current.static{color:#fdbf35;}.sidebar a.current.primitive{color:#12ece2;}.sidebar a.current.externcrate .sidebar a.current.mod{color:#fdbf35;}.sidebar a.current.trait{color:#cca7ff;}.sidebar a.current.traitalias{color:#cca7ff;}.sidebar a.current.fn,.sidebar a.current.method,.sidebar a.current.tymethod{color:#32d479;}.sidebar a.current.keyword{color:#fdbf35;}pre.rust .comment{color:#8d8d8b;}pre.rust .doccomment{color:#8ca375;}nav.main .current{border-top-color:#eee;border-bottom-color:#eee;}nav.main .separator{border-color:#eee;}a{color:#D2991D;}a#toggle-all-docs,a.anchor,.small-section-header a,#source-sidebar a,pre.rust a,.sidebar h2 a,.sidebar h3 a,.mobile-topbar h2 a,.in-band a{color:#ddd;}.search-results a{color:#ddd;}a.test-arrow{color:#dedede;}body.source .example-wrap pre.rust a{background:#333;}details.rustdoc-toggle>summary.hideme>span,details.rustdoc-toggle>summary::before,details.undocumented>summary::before{color:#999;}details.rustdoc-toggle>summary::before,details.undocumented>summary::before{filter:invert(100%);}#crate-search,.search-input{color:#111;background-color:#f0f0f0;border-color:#000;}.search-input{border-color:#e0e0e0;}.search-input:focus{border-color:#008dfd;}.module-item .stab,.import-item .stab{color:#ddd;}.stab.unstable{background:#FFF5D6;border-color:#FFC600;color:#2f2f2f;}.stab.deprecated{background:#ffc4c4;border-color:#db7b7b;color:#2f2f2f;}.stab.portability{background:#F3DFFF;border-color:#b07bdb;color:#2f2f2f;}.stab.portability>code{background:none;}#help>div{background:#4d4d4d;border-color:#bfbfbf;}#help span.bottom,#help span.top{border-color:#bfbfbf;}#help dt{border-color:#bfbfbf;background:rgba(0,0,0,0);}.rightside,.out-of-band{color:grey;}.result-name .primitive>i,.result-name .keyword>i{color:#ddd;}.line-numbers :target{background-color:transparent;}pre.rust .kw{color:#ab8ac1;}pre.rust .kw-2,pre.rust .prelude-ty{color:#769acb;}pre.rust .number,pre.rust .string{color:#83a300;}pre.rust .self,pre.rust .bool-val,pre.rust .prelude-val,pre.rust .attribute,pre.rust .attribute .ident{color:#ee6868;}pre.rust .macro,pre.rust .macro-nonterminal{color:#3E999F;}pre.rust .lifetime{color:#d97f26;}pre.rust .question-mark{color:#ff9011;}.example-wrap>pre.line-number{border-color:#4a4949;}a.test-arrow{background-color:rgba(78,139,202,0.2);}a.test-arrow:hover{background-color:#4e8bca;}.toggle-label,.code-attribute{color:#999;}:target{background-color:#494a3d;border-right:3px solid #bb7410;}pre.compile_fail{border-left:2px solid rgba(255,0,0,.8);}pre.compile_fail:hover,.information:hover+pre.compile_fail{border-left:2px solid #f00;}pre.should_panic{border-left:2px solid rgba(255,0,0,.8);}pre.should_panic:hover,.information:hover+pre.should_panic{border-left:2px solid #f00;}pre.ignore{border-left:2px solid rgba(255,142,0,.6);}pre.ignore:hover,.information:hover+pre.ignore{border-left:2px solid #ff9200;}.tooltip.compile_fail{color:rgba(255,0,0,.8);}.information>.compile_fail:hover{color:#f00;}.tooltip.should_panic{color:rgba(255,0,0,.8);}.information>.should_panic:hover{color:#f00;}.tooltip.ignore{color:rgba(255,142,0,.6);}.information>.ignore:hover{color:#ff9200;}.search-failed a{color:#0089ff;}.tooltip::after{background-color:#000;color:#fff;border-color:#000;}.tooltip::before{border-color:transparent black transparent transparent;}.notable-traits-tooltiptext{background-color:#111;border-color:#777;}.notable-traits-tooltiptext .notable{border-bottom-color:#d2d2d2;}#titles>button:not(.selected){background-color:#252525;border-top-color:#252525;}#titles>button:hover,#titles>button.selected{border-top-color:#0089ff;background-color:#353535;}#titles>button>div.count{color:#888;}@media (max-width:700px){.sidebar-menu{background-color:#505050;border-bottom-color:#e0e0e0;border-right-color:#e0e0e0;}.sidebar-elems{background-color:#505050;border-right-color:#000;}#sidebar-filler{background-color:#505050;border-bottom-color:#e0e0e0;}}kbd{color:#000;background-color:#fafbfc;border-color:#d1d5da;border-bottom-color:#c6cbd1;box-shadow:inset 0 -1px 0 #c6cbd1;}#theme-picker,#settings-menu,#help-button{border-color:#e0e0e0;background:#f0f0f0;color:#000;}#theme-picker:hover,#theme-picker:focus,#settings-menu:hover,#settings-menu:focus,#help-button:hover,#help-button:focus{border-color:#ffb900;}#copy-path{color:#999;}#copy-path>img{filter:invert(50%);}#copy-path:hover>img{filter:invert(65%);}#theme-choices{border-color:#e0e0e0;background-color:#353535;}#theme-choices>button:not(:first-child){border-top-color:#e0e0e0;}#theme-choices>button:hover,#theme-choices>button:focus{background-color:#4e4e4e;}@media (max-width:700px){#theme-picker{background:#f0f0f0;}}.search-results .result-name span.alias{color:#fff;}.search-results .result-name span.grey{color:#ccc;}#sidebar-toggle{background-color:#565656;}#sidebar-toggle:hover{background-color:#676767;}#source-sidebar{background-color:#565656;}#source-sidebar>.title{border-bottom-color:#ccc;}div.files>a:hover,div.name:hover{background-color:#444;}div.files>.selected{background-color:#333;}.setting-line>.title{border-bottom-color:#ddd;}.scraped-example .example-wrap .rust span.highlight{background:rgb(91,59,1);}.scraped-example .example-wrap .rust span.highlight.focus{background:rgb(124,75,15);}.scraped-example:not(.expanded) .code-wrapper:before{background:linear-gradient(to bottom,rgba(53,53,53,1),rgba(53,53,53,0));}.scraped-example:not(.expanded) .code-wrapper:after{background:linear-gradient(to top,rgba(53,53,53,1),rgba(53,53,53,0));}.toggle-line-inner{background:#616161;}.toggle-line:hover .toggle-line-inner{background:#898989;} \ No newline at end of file diff --git a/ch6-dev/down-arrow.svg b/ch6-dev/down-arrow.svg deleted file mode 100644 index 35437e77..00000000 --- a/ch6-dev/down-arrow.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ch6-dev/help.html b/ch6-dev/help.html new file mode 100644 index 00000000..26794106 --- /dev/null +++ b/ch6-dev/help.html @@ -0,0 +1 @@ +Rustdoc help

Rustdoc help

Back
\ No newline at end of file diff --git a/ch6-dev/implementors/core/clone/trait.Clone.js b/ch6-dev/implementors/core/clone/trait.Clone.js index 78f78fe1..bf81b7af 100644 --- a/ch6-dev/implementors/core/clone/trait.Clone.js +++ b/ch6-dev/implementors/core/clone/trait.Clone.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = [{"text":"impl Clone for CMD","synthetic":false,"types":["os::drivers::block::sdcard::CMD"]},{"text":"impl Clone for InitError","synthetic":false,"types":["os::drivers::block::sdcard::InitError"]},{"text":"impl Clone for SDCardCSD","synthetic":false,"types":["os::drivers::block::sdcard::SDCardCSD"]},{"text":"impl Clone for SDCardCID","synthetic":false,"types":["os::drivers::block::sdcard::SDCardCID"]},{"text":"impl Clone for SDCardInfo","synthetic":false,"types":["os::drivers::block::sdcard::SDCardInfo"]},{"text":"impl Clone for OpenFlags","synthetic":false,"types":["os::fs::inode::OpenFlags"]},{"text":"impl Clone for PhysAddr","synthetic":false,"types":["os::mm::address::PhysAddr"]},{"text":"impl Clone for VirtAddr","synthetic":false,"types":["os::mm::address::VirtAddr"]},{"text":"impl Clone for PhysPageNum","synthetic":false,"types":["os::mm::address::PhysPageNum"]},{"text":"impl Clone for VirtPageNum","synthetic":false,"types":["os::mm::address::VirtPageNum"]},{"text":"impl<T: Clone> Clone for SimpleRange<T> where
    T: StepByOne + Copy + PartialEq + PartialOrd + Debug
","synthetic":false,"types":["os::mm::address::SimpleRange"]},{"text":"impl Clone for MapType","synthetic":false,"types":["os::mm::memory_set::MapType"]},{"text":"impl Clone for MapPermission","synthetic":false,"types":["os::mm::memory_set::MapPermission"]},{"text":"impl Clone for PTEFlags","synthetic":false,"types":["os::mm::page_table::PTEFlags"]},{"text":"impl Clone for PageTableEntry","synthetic":false,"types":["os::mm::page_table::PageTableEntry"]},{"text":"impl Clone for TaskStatus","synthetic":false,"types":["os::task::task::TaskStatus"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[["impl Clone for PageTableEntry"],["impl<T> Clone for SimpleRange<T>where\n T: StepByOne + Copy + PartialEq + PartialOrd + Debug + Clone,"],["impl Clone for VirtAddr"],["impl Clone for VirtPageNum"],["impl Clone for PTEFlags"],["impl Clone for MapType"],["impl Clone for OpenFlags"],["impl Clone for PhysPageNum"],["impl Clone for MapPermission"],["impl Clone for TaskStatus"],["impl Clone for PhysAddr"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/core/cmp/trait.Eq.js b/ch6-dev/implementors/core/cmp/trait.Eq.js index 207410b1..18526b90 100644 --- a/ch6-dev/implementors/core/cmp/trait.Eq.js +++ b/ch6-dev/implementors/core/cmp/trait.Eq.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = [{"text":"impl Eq for CMD","synthetic":false,"types":["os::drivers::block::sdcard::CMD"]},{"text":"impl Eq for OpenFlags","synthetic":false,"types":["os::fs::inode::OpenFlags"]},{"text":"impl Eq for PhysAddr","synthetic":false,"types":["os::mm::address::PhysAddr"]},{"text":"impl Eq for VirtAddr","synthetic":false,"types":["os::mm::address::VirtAddr"]},{"text":"impl Eq for PhysPageNum","synthetic":false,"types":["os::mm::address::PhysPageNum"]},{"text":"impl Eq for VirtPageNum","synthetic":false,"types":["os::mm::address::VirtPageNum"]},{"text":"impl Eq for MapPermission","synthetic":false,"types":["os::mm::memory_set::MapPermission"]},{"text":"impl Eq for PTEFlags","synthetic":false,"types":["os::mm::page_table::PTEFlags"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[["impl Eq for PhysAddr"],["impl Eq for VirtPageNum"],["impl Eq for VirtAddr"],["impl Eq for OpenFlags"],["impl Eq for MapPermission"],["impl Eq for PTEFlags"],["impl Eq for PhysPageNum"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/core/cmp/trait.Ord.js b/ch6-dev/implementors/core/cmp/trait.Ord.js index c4f5e412..3c919e5e 100644 --- a/ch6-dev/implementors/core/cmp/trait.Ord.js +++ b/ch6-dev/implementors/core/cmp/trait.Ord.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = [{"text":"impl Ord for OpenFlags","synthetic":false,"types":["os::fs::inode::OpenFlags"]},{"text":"impl Ord for PhysAddr","synthetic":false,"types":["os::mm::address::PhysAddr"]},{"text":"impl Ord for VirtAddr","synthetic":false,"types":["os::mm::address::VirtAddr"]},{"text":"impl Ord for PhysPageNum","synthetic":false,"types":["os::mm::address::PhysPageNum"]},{"text":"impl Ord for VirtPageNum","synthetic":false,"types":["os::mm::address::VirtPageNum"]},{"text":"impl Ord for MapPermission","synthetic":false,"types":["os::mm::memory_set::MapPermission"]},{"text":"impl Ord for PTEFlags","synthetic":false,"types":["os::mm::page_table::PTEFlags"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[["impl Ord for PTEFlags"],["impl Ord for MapPermission"],["impl Ord for VirtAddr"],["impl Ord for PhysAddr"],["impl Ord for PhysPageNum"],["impl Ord for OpenFlags"],["impl Ord for VirtPageNum"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/core/cmp/trait.PartialEq.js b/ch6-dev/implementors/core/cmp/trait.PartialEq.js index 7bf2c8fd..e76fc9b3 100644 --- a/ch6-dev/implementors/core/cmp/trait.PartialEq.js +++ b/ch6-dev/implementors/core/cmp/trait.PartialEq.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = [{"text":"impl PartialEq<CMD> for CMD","synthetic":false,"types":["os::drivers::block::sdcard::CMD"]},{"text":"impl PartialEq<OpenFlags> for OpenFlags","synthetic":false,"types":["os::fs::inode::OpenFlags"]},{"text":"impl PartialEq<PhysAddr> for PhysAddr","synthetic":false,"types":["os::mm::address::PhysAddr"]},{"text":"impl PartialEq<VirtAddr> for VirtAddr","synthetic":false,"types":["os::mm::address::VirtAddr"]},{"text":"impl PartialEq<PhysPageNum> for PhysPageNum","synthetic":false,"types":["os::mm::address::PhysPageNum"]},{"text":"impl PartialEq<VirtPageNum> for VirtPageNum","synthetic":false,"types":["os::mm::address::VirtPageNum"]},{"text":"impl PartialEq<MapType> for MapType","synthetic":false,"types":["os::mm::memory_set::MapType"]},{"text":"impl PartialEq<MapPermission> for MapPermission","synthetic":false,"types":["os::mm::memory_set::MapPermission"]},{"text":"impl PartialEq<PTEFlags> for PTEFlags","synthetic":false,"types":["os::mm::page_table::PTEFlags"]},{"text":"impl PartialEq<TaskStatus> for TaskStatus","synthetic":false,"types":["os::task::task::TaskStatus"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[["impl PartialEq<OpenFlags> for OpenFlags"],["impl PartialEq<PhysAddr> for PhysAddr"],["impl PartialEq<MapType> for MapType"],["impl PartialEq<MapPermission> for MapPermission"],["impl PartialEq<VirtPageNum> for VirtPageNum"],["impl PartialEq<TaskStatus> for TaskStatus"],["impl PartialEq<PhysPageNum> for PhysPageNum"],["impl PartialEq<PTEFlags> for PTEFlags"],["impl PartialEq<VirtAddr> for VirtAddr"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/core/cmp/trait.PartialOrd.js b/ch6-dev/implementors/core/cmp/trait.PartialOrd.js index fa8662da..e90af104 100644 --- a/ch6-dev/implementors/core/cmp/trait.PartialOrd.js +++ b/ch6-dev/implementors/core/cmp/trait.PartialOrd.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = [{"text":"impl PartialOrd<OpenFlags> for OpenFlags","synthetic":false,"types":["os::fs::inode::OpenFlags"]},{"text":"impl PartialOrd<PhysAddr> for PhysAddr","synthetic":false,"types":["os::mm::address::PhysAddr"]},{"text":"impl PartialOrd<VirtAddr> for VirtAddr","synthetic":false,"types":["os::mm::address::VirtAddr"]},{"text":"impl PartialOrd<PhysPageNum> for PhysPageNum","synthetic":false,"types":["os::mm::address::PhysPageNum"]},{"text":"impl PartialOrd<VirtPageNum> for VirtPageNum","synthetic":false,"types":["os::mm::address::VirtPageNum"]},{"text":"impl PartialOrd<MapPermission> for MapPermission","synthetic":false,"types":["os::mm::memory_set::MapPermission"]},{"text":"impl PartialOrd<PTEFlags> for PTEFlags","synthetic":false,"types":["os::mm::page_table::PTEFlags"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[["impl PartialOrd<PhysAddr> for PhysAddr"],["impl PartialOrd<PTEFlags> for PTEFlags"],["impl PartialOrd<PhysPageNum> for PhysPageNum"],["impl PartialOrd<VirtPageNum> for VirtPageNum"],["impl PartialOrd<MapPermission> for MapPermission"],["impl PartialOrd<OpenFlags> for OpenFlags"],["impl PartialOrd<VirtAddr> for VirtAddr"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/core/convert/trait.From.js b/ch6-dev/implementors/core/convert/trait.From.js index d2fbb8c0..52135ba7 100644 --- a/ch6-dev/implementors/core/convert/trait.From.js +++ b/ch6-dev/implementors/core/convert/trait.From.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = [{"text":"impl From<usize> for PhysAddr","synthetic":false,"types":["os::mm::address::PhysAddr"]},{"text":"impl From<usize> for PhysPageNum","synthetic":false,"types":["os::mm::address::PhysPageNum"]},{"text":"impl From<usize> for VirtAddr","synthetic":false,"types":["os::mm::address::VirtAddr"]},{"text":"impl From<usize> for VirtPageNum","synthetic":false,"types":["os::mm::address::VirtPageNum"]},{"text":"impl From<PhysAddr> for usize","synthetic":false,"types":[]},{"text":"impl From<PhysPageNum> for usize","synthetic":false,"types":[]},{"text":"impl From<VirtAddr> for usize","synthetic":false,"types":[]},{"text":"impl From<VirtPageNum> for usize","synthetic":false,"types":[]},{"text":"impl From<VirtAddr> for VirtPageNum","synthetic":false,"types":["os::mm::address::VirtPageNum"]},{"text":"impl From<VirtPageNum> for VirtAddr","synthetic":false,"types":["os::mm::address::VirtAddr"]},{"text":"impl From<PhysAddr> for PhysPageNum","synthetic":false,"types":["os::mm::address::PhysPageNum"]},{"text":"impl From<PhysPageNum> for PhysAddr","synthetic":false,"types":["os::mm::address::PhysAddr"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[["impl From<usize> for PhysPageNum"],["impl From<usize> for VirtAddr"],["impl From<PhysAddr> for PhysPageNum"],["impl From<PhysPageNum> for PhysAddr"],["impl From<usize> for PhysAddr"],["impl From<VirtPageNum> for usize"],["impl From<VirtAddr> for VirtPageNum"],["impl From<usize> for VirtPageNum"],["impl From<VirtAddr> for usize"],["impl From<PhysPageNum> for usize"],["impl From<VirtPageNum> for VirtAddr"],["impl From<PhysAddr> for usize"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/core/fmt/trait.Binary.js b/ch6-dev/implementors/core/fmt/trait.Binary.js index 09ec8b2b..c3d5d17b 100644 --- a/ch6-dev/implementors/core/fmt/trait.Binary.js +++ b/ch6-dev/implementors/core/fmt/trait.Binary.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = [{"text":"impl Binary for OpenFlags","synthetic":false,"types":["os::fs::inode::OpenFlags"]},{"text":"impl Binary for MapPermission","synthetic":false,"types":["os::mm::memory_set::MapPermission"]},{"text":"impl Binary for PTEFlags","synthetic":false,"types":["os::mm::page_table::PTEFlags"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[["impl Binary for MapPermission"],["impl Binary for OpenFlags"],["impl Binary for PTEFlags"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/core/fmt/trait.Debug.js b/ch6-dev/implementors/core/fmt/trait.Debug.js index 595621c0..822a45d3 100644 --- a/ch6-dev/implementors/core/fmt/trait.Debug.js +++ b/ch6-dev/implementors/core/fmt/trait.Debug.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = [{"text":"impl Debug for CMD","synthetic":false,"types":["os::drivers::block::sdcard::CMD"]},{"text":"impl Debug for InitError","synthetic":false,"types":["os::drivers::block::sdcard::InitError"]},{"text":"impl Debug for SDCardCSD","synthetic":false,"types":["os::drivers::block::sdcard::SDCardCSD"]},{"text":"impl Debug for SDCardCID","synthetic":false,"types":["os::drivers::block::sdcard::SDCardCID"]},{"text":"impl Debug for SDCardInfo","synthetic":false,"types":["os::drivers::block::sdcard::SDCardInfo"]},{"text":"impl Debug for OpenFlags","synthetic":false,"types":["os::fs::inode::OpenFlags"]},{"text":"impl Debug for VirtAddr","synthetic":false,"types":["os::mm::address::VirtAddr"]},{"text":"impl Debug for VirtPageNum","synthetic":false,"types":["os::mm::address::VirtPageNum"]},{"text":"impl Debug for PhysAddr","synthetic":false,"types":["os::mm::address::PhysAddr"]},{"text":"impl Debug for PhysPageNum","synthetic":false,"types":["os::mm::address::PhysPageNum"]},{"text":"impl Debug for FrameTracker","synthetic":false,"types":["os::mm::frame_allocator::FrameTracker"]},{"text":"impl Debug for MapType","synthetic":false,"types":["os::mm::memory_set::MapType"]},{"text":"impl Debug for MapPermission","synthetic":false,"types":["os::mm::memory_set::MapPermission"]},{"text":"impl Debug for PTEFlags","synthetic":false,"types":["os::mm::page_table::PTEFlags"]},{"text":"impl Debug for TrapContext","synthetic":false,"types":["os::trap::context::TrapContext"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[["impl Debug for PhysAddr"],["impl Debug for PTEFlags"],["impl Debug for VirtPageNum"],["impl Debug for MapType"],["impl Debug for MapPermission"],["impl Debug for PhysPageNum"],["impl Debug for OpenFlags"],["impl Debug for TrapContext"],["impl Debug for VirtAddr"],["impl Debug for FrameTracker"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/core/fmt/trait.LowerHex.js b/ch6-dev/implementors/core/fmt/trait.LowerHex.js index f813c697..bf42c2a3 100644 --- a/ch6-dev/implementors/core/fmt/trait.LowerHex.js +++ b/ch6-dev/implementors/core/fmt/trait.LowerHex.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = [{"text":"impl LowerHex for OpenFlags","synthetic":false,"types":["os::fs::inode::OpenFlags"]},{"text":"impl LowerHex for MapPermission","synthetic":false,"types":["os::mm::memory_set::MapPermission"]},{"text":"impl LowerHex for PTEFlags","synthetic":false,"types":["os::mm::page_table::PTEFlags"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[["impl LowerHex for PTEFlags"],["impl LowerHex for MapPermission"],["impl LowerHex for OpenFlags"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/core/fmt/trait.Octal.js b/ch6-dev/implementors/core/fmt/trait.Octal.js index e4fe0cfb..1da85da5 100644 --- a/ch6-dev/implementors/core/fmt/trait.Octal.js +++ b/ch6-dev/implementors/core/fmt/trait.Octal.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = [{"text":"impl Octal for OpenFlags","synthetic":false,"types":["os::fs::inode::OpenFlags"]},{"text":"impl Octal for MapPermission","synthetic":false,"types":["os::mm::memory_set::MapPermission"]},{"text":"impl Octal for PTEFlags","synthetic":false,"types":["os::mm::page_table::PTEFlags"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[["impl Octal for PTEFlags"],["impl Octal for MapPermission"],["impl Octal for OpenFlags"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/core/fmt/trait.UpperHex.js b/ch6-dev/implementors/core/fmt/trait.UpperHex.js index c947ae8e..1df82c7b 100644 --- a/ch6-dev/implementors/core/fmt/trait.UpperHex.js +++ b/ch6-dev/implementors/core/fmt/trait.UpperHex.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = [{"text":"impl UpperHex for OpenFlags","synthetic":false,"types":["os::fs::inode::OpenFlags"]},{"text":"impl UpperHex for MapPermission","synthetic":false,"types":["os::mm::memory_set::MapPermission"]},{"text":"impl UpperHex for PTEFlags","synthetic":false,"types":["os::mm::page_table::PTEFlags"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[["impl UpperHex for PTEFlags"],["impl UpperHex for MapPermission"],["impl UpperHex for OpenFlags"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/core/fmt/trait.Write.js b/ch6-dev/implementors/core/fmt/trait.Write.js index 0d40b97a..d9d7c42d 100644 --- a/ch6-dev/implementors/core/fmt/trait.Write.js +++ b/ch6-dev/implementors/core/fmt/trait.Write.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = [{"text":"impl Write for Stdout","synthetic":false,"types":["os::console::Stdout"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[["impl Write for Stdout"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/core/hash/trait.Hash.js b/ch6-dev/implementors/core/hash/trait.Hash.js index a4d2c82b..3e0d29f7 100644 --- a/ch6-dev/implementors/core/hash/trait.Hash.js +++ b/ch6-dev/implementors/core/hash/trait.Hash.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = [{"text":"impl Hash for OpenFlags","synthetic":false,"types":["os::fs::inode::OpenFlags"]},{"text":"impl Hash for MapPermission","synthetic":false,"types":["os::mm::memory_set::MapPermission"]},{"text":"impl Hash for PTEFlags","synthetic":false,"types":["os::mm::page_table::PTEFlags"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[["impl Hash for MapPermission"],["impl Hash for PTEFlags"],["impl Hash for OpenFlags"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/core/iter/traits/collect/trait.Extend.js b/ch6-dev/implementors/core/iter/traits/collect/trait.Extend.js index a5000152..de71176b 100644 --- a/ch6-dev/implementors/core/iter/traits/collect/trait.Extend.js +++ b/ch6-dev/implementors/core/iter/traits/collect/trait.Extend.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = [{"text":"impl Extend<OpenFlags> for OpenFlags","synthetic":false,"types":["os::fs::inode::OpenFlags"]},{"text":"impl Extend<MapPermission> for MapPermission","synthetic":false,"types":["os::mm::memory_set::MapPermission"]},{"text":"impl Extend<PTEFlags> for PTEFlags","synthetic":false,"types":["os::mm::page_table::PTEFlags"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[["impl Extend<OpenFlags> for OpenFlags"],["impl Extend<PTEFlags> for PTEFlags"],["impl Extend<MapPermission> for MapPermission"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/core/iter/traits/collect/trait.FromIterator.js b/ch6-dev/implementors/core/iter/traits/collect/trait.FromIterator.js index 7b852646..0b67c8f8 100644 --- a/ch6-dev/implementors/core/iter/traits/collect/trait.FromIterator.js +++ b/ch6-dev/implementors/core/iter/traits/collect/trait.FromIterator.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = [{"text":"impl FromIterator<OpenFlags> for OpenFlags","synthetic":false,"types":["os::fs::inode::OpenFlags"]},{"text":"impl FromIterator<MapPermission> for MapPermission","synthetic":false,"types":["os::mm::memory_set::MapPermission"]},{"text":"impl FromIterator<PTEFlags> for PTEFlags","synthetic":false,"types":["os::mm::page_table::PTEFlags"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[["impl FromIterator<OpenFlags> for OpenFlags"],["impl FromIterator<MapPermission> for MapPermission"],["impl FromIterator<PTEFlags> for PTEFlags"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/core/iter/traits/collect/trait.IntoIterator.js b/ch6-dev/implementors/core/iter/traits/collect/trait.IntoIterator.js index 7a056c59..96c3063e 100644 --- a/ch6-dev/implementors/core/iter/traits/collect/trait.IntoIterator.js +++ b/ch6-dev/implementors/core/iter/traits/collect/trait.IntoIterator.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = [{"text":"impl<T> IntoIterator for SimpleRange<T> where
    T: StepByOne + Copy + PartialEq + PartialOrd + Debug
","synthetic":false,"types":["os::mm::address::SimpleRange"]},{"text":"impl IntoIterator for UserBuffer","synthetic":false,"types":["os::mm::page_table::UserBuffer"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[["impl<T> IntoIterator for SimpleRange<T>where\n T: StepByOne + Copy + PartialEq + PartialOrd + Debug,"],["impl IntoIterator for UserBuffer"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/core/iter/traits/iterator/trait.Iterator.js b/ch6-dev/implementors/core/iter/traits/iterator/trait.Iterator.js index ede026ae..32ca6707 100644 --- a/ch6-dev/implementors/core/iter/traits/iterator/trait.Iterator.js +++ b/ch6-dev/implementors/core/iter/traits/iterator/trait.Iterator.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = [{"text":"impl<T> Iterator for SimpleRangeIterator<T> where
    T: StepByOne + Copy + PartialEq + PartialOrd + Debug
","synthetic":false,"types":["os::mm::address::SimpleRangeIterator"]},{"text":"impl Iterator for UserBufferIterator","synthetic":false,"types":["os::mm::page_table::UserBufferIterator"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[["impl Iterator for UserBufferIterator"],["impl<T> Iterator for SimpleRangeIterator<T>where\n T: StepByOne + Copy + PartialEq + PartialOrd + Debug,"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/core/marker/trait.Copy.js b/ch6-dev/implementors/core/marker/trait.Copy.js index 9d743550..6fd72ffe 100644 --- a/ch6-dev/implementors/core/marker/trait.Copy.js +++ b/ch6-dev/implementors/core/marker/trait.Copy.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = [{"text":"impl Copy for CMD","synthetic":false,"types":["os::drivers::block::sdcard::CMD"]},{"text":"impl Copy for InitError","synthetic":false,"types":["os::drivers::block::sdcard::InitError"]},{"text":"impl Copy for SDCardCSD","synthetic":false,"types":["os::drivers::block::sdcard::SDCardCSD"]},{"text":"impl Copy for SDCardCID","synthetic":false,"types":["os::drivers::block::sdcard::SDCardCID"]},{"text":"impl Copy for SDCardInfo","synthetic":false,"types":["os::drivers::block::sdcard::SDCardInfo"]},{"text":"impl Copy for OpenFlags","synthetic":false,"types":["os::fs::inode::OpenFlags"]},{"text":"impl Copy for PhysAddr","synthetic":false,"types":["os::mm::address::PhysAddr"]},{"text":"impl Copy for VirtAddr","synthetic":false,"types":["os::mm::address::VirtAddr"]},{"text":"impl Copy for PhysPageNum","synthetic":false,"types":["os::mm::address::PhysPageNum"]},{"text":"impl Copy for VirtPageNum","synthetic":false,"types":["os::mm::address::VirtPageNum"]},{"text":"impl<T: Copy> Copy for SimpleRange<T> where
    T: StepByOne + Copy + PartialEq + PartialOrd + Debug
","synthetic":false,"types":["os::mm::address::SimpleRange"]},{"text":"impl Copy for MapType","synthetic":false,"types":["os::mm::memory_set::MapType"]},{"text":"impl Copy for MapPermission","synthetic":false,"types":["os::mm::memory_set::MapPermission"]},{"text":"impl Copy for PTEFlags","synthetic":false,"types":["os::mm::page_table::PTEFlags"]},{"text":"impl Copy for PageTableEntry","synthetic":false,"types":["os::mm::page_table::PageTableEntry"]},{"text":"impl Copy for TaskStatus","synthetic":false,"types":["os::task::task::TaskStatus"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[["impl Copy for PageTableEntry"],["impl Copy for PhysAddr"],["impl Copy for MapPermission"],["impl Copy for PTEFlags"],["impl Copy for VirtAddr"],["impl Copy for OpenFlags"],["impl<T> Copy for SimpleRange<T>where\n T: StepByOne + Copy + PartialEq + PartialOrd + Debug + Copy,"],["impl Copy for TaskStatus"],["impl Copy for MapType"],["impl Copy for PhysPageNum"],["impl Copy for VirtPageNum"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/core/marker/trait.Freeze.js b/ch6-dev/implementors/core/marker/trait.Freeze.js index ed235f80..242bcfb8 100644 --- a/ch6-dev/implementors/core/marker/trait.Freeze.js +++ b/ch6-dev/implementors/core/marker/trait.Freeze.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = [{"text":"impl Freeze for RISCV64","synthetic":true,"types":["os::board::RISCV64"]},{"text":"impl Freeze for Stdout","synthetic":true,"types":["os::console::Stdout"]},{"text":"impl<SPI> Freeze for SDCard<SPI> where
    SPI: Freeze
","synthetic":true,"types":["os::drivers::block::sdcard::SDCard"]},{"text":"impl Freeze for CMD","synthetic":true,"types":["os::drivers::block::sdcard::CMD"]},{"text":"impl Freeze for InitError","synthetic":true,"types":["os::drivers::block::sdcard::InitError"]},{"text":"impl Freeze for SDCardCSD","synthetic":true,"types":["os::drivers::block::sdcard::SDCardCSD"]},{"text":"impl Freeze for SDCardCID","synthetic":true,"types":["os::drivers::block::sdcard::SDCardCID"]},{"text":"impl Freeze for SDCardInfo","synthetic":true,"types":["os::drivers::block::sdcard::SDCardInfo"]},{"text":"impl Freeze for PERIPHERALS","synthetic":true,"types":["os::drivers::block::sdcard::PERIPHERALS"]},{"text":"impl !Freeze for SDCardWrapper","synthetic":true,"types":["os::drivers::block::sdcard::SDCardWrapper"]},{"text":"impl !Freeze for VirtIOBlock","synthetic":true,"types":["os::drivers::block::virtio_blk::VirtIOBlock"]},{"text":"impl Freeze for QUEUE_FRAMES","synthetic":true,"types":["os::drivers::block::virtio_blk::QUEUE_FRAMES"]},{"text":"impl Freeze for BLOCK_DEVICE","synthetic":true,"types":["os::drivers::block::BLOCK_DEVICE"]},{"text":"impl !Freeze for OSInode","synthetic":true,"types":["os::fs::inode::OSInode"]},{"text":"impl Freeze for OSInodeInner","synthetic":true,"types":["os::fs::inode::OSInodeInner"]},{"text":"impl Freeze for ROOT_INODE","synthetic":true,"types":["os::fs::inode::ROOT_INODE"]},{"text":"impl Freeze for OpenFlags","synthetic":true,"types":["os::fs::inode::OpenFlags"]},{"text":"impl Freeze for Stdin","synthetic":true,"types":["os::fs::stdio::Stdin"]},{"text":"impl Freeze for Stdout","synthetic":true,"types":["os::fs::stdio::Stdout"]},{"text":"impl Freeze for PhysAddr","synthetic":true,"types":["os::mm::address::PhysAddr"]},{"text":"impl Freeze for VirtAddr","synthetic":true,"types":["os::mm::address::VirtAddr"]},{"text":"impl Freeze for PhysPageNum","synthetic":true,"types":["os::mm::address::PhysPageNum"]},{"text":"impl Freeze for VirtPageNum","synthetic":true,"types":["os::mm::address::VirtPageNum"]},{"text":"impl<T> Freeze for SimpleRange<T> where
    T: Freeze
","synthetic":true,"types":["os::mm::address::SimpleRange"]},{"text":"impl<T> Freeze for SimpleRangeIterator<T> where
    T: Freeze
","synthetic":true,"types":["os::mm::address::SimpleRangeIterator"]},{"text":"impl Freeze for FrameTracker","synthetic":true,"types":["os::mm::frame_allocator::FrameTracker"]},{"text":"impl Freeze for StackFrameAllocator","synthetic":true,"types":["os::mm::frame_allocator::StackFrameAllocator"]},{"text":"impl Freeze for FRAME_ALLOCATOR","synthetic":true,"types":["os::mm::frame_allocator::FRAME_ALLOCATOR"]},{"text":"impl Freeze for KERNEL_SPACE","synthetic":true,"types":["os::mm::memory_set::KERNEL_SPACE"]},{"text":"impl Freeze for MemorySet","synthetic":true,"types":["os::mm::memory_set::MemorySet"]},{"text":"impl Freeze for MapArea","synthetic":true,"types":["os::mm::memory_set::MapArea"]},{"text":"impl Freeze for MapType","synthetic":true,"types":["os::mm::memory_set::MapType"]},{"text":"impl Freeze for MapPermission","synthetic":true,"types":["os::mm::memory_set::MapPermission"]},{"text":"impl Freeze for PTEFlags","synthetic":true,"types":["os::mm::page_table::PTEFlags"]},{"text":"impl Freeze for PageTableEntry","synthetic":true,"types":["os::mm::page_table::PageTableEntry"]},{"text":"impl Freeze for PageTable","synthetic":true,"types":["os::mm::page_table::PageTable"]},{"text":"impl Freeze for UserBuffer","synthetic":true,"types":["os::mm::page_table::UserBuffer"]},{"text":"impl Freeze for UserBufferIterator","synthetic":true,"types":["os::mm::page_table::UserBufferIterator"]},{"text":"impl<T> !Freeze for UPSafeCell<T>","synthetic":true,"types":["os::sync::up::UPSafeCell"]},{"text":"impl Freeze for TaskContext","synthetic":true,"types":["os::task::context::TaskContext"]},{"text":"impl Freeze for TaskManager","synthetic":true,"types":["os::task::manager::TaskManager"]},{"text":"impl Freeze for TASK_MANAGER","synthetic":true,"types":["os::task::manager::TASK_MANAGER"]},{"text":"impl Freeze for PidAllocator","synthetic":true,"types":["os::task::pid::PidAllocator"]},{"text":"impl Freeze for PID_ALLOCATOR","synthetic":true,"types":["os::task::pid::PID_ALLOCATOR"]},{"text":"impl Freeze for PidHandle","synthetic":true,"types":["os::task::pid::PidHandle"]},{"text":"impl Freeze for KernelStack","synthetic":true,"types":["os::task::pid::KernelStack"]},{"text":"impl Freeze for Processor","synthetic":true,"types":["os::task::processor::Processor"]},{"text":"impl Freeze for PROCESSOR","synthetic":true,"types":["os::task::processor::PROCESSOR"]},{"text":"impl !Freeze for TaskControlBlock","synthetic":true,"types":["os::task::task::TaskControlBlock"]},{"text":"impl Freeze for TaskControlBlockInner","synthetic":true,"types":["os::task::task::TaskControlBlockInner"]},{"text":"impl Freeze for TaskStatus","synthetic":true,"types":["os::task::task::TaskStatus"]},{"text":"impl Freeze for INITPROC","synthetic":true,"types":["os::task::INITPROC"]},{"text":"impl Freeze for TrapContext","synthetic":true,"types":["os::trap::context::TrapContext"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[["impl Freeze for Stdout",1,["os::console::Stdout"]],["impl !Freeze for VirtIOBlock",1,["os::drivers::block::virtio_blk::VirtIOBlock"]],["impl Freeze for QUEUE_FRAMES",1,["os::drivers::block::virtio_blk::QUEUE_FRAMES"]],["impl Freeze for VirtioHal",1,["os::drivers::block::virtio_blk::VirtioHal"]],["impl Freeze for BLOCK_DEVICE",1,["os::drivers::block::BLOCK_DEVICE"]],["impl !Freeze for OSInode",1,["os::fs::inode::OSInode"]],["impl Freeze for OSInodeInner",1,["os::fs::inode::OSInodeInner"]],["impl Freeze for ROOT_INODE",1,["os::fs::inode::ROOT_INODE"]],["impl Freeze for OpenFlags",1,["os::fs::inode::OpenFlags"]],["impl Freeze for Stdin",1,["os::fs::stdio::Stdin"]],["impl Freeze for Stdout",1,["os::fs::stdio::Stdout"]],["impl Freeze for PhysAddr",1,["os::mm::address::PhysAddr"]],["impl Freeze for VirtAddr",1,["os::mm::address::VirtAddr"]],["impl Freeze for PhysPageNum",1,["os::mm::address::PhysPageNum"]],["impl Freeze for VirtPageNum",1,["os::mm::address::VirtPageNum"]],["impl<T> Freeze for SimpleRange<T>where\n T: Freeze,",1,["os::mm::address::SimpleRange"]],["impl<T> Freeze for SimpleRangeIterator<T>where\n T: Freeze,",1,["os::mm::address::SimpleRangeIterator"]],["impl Freeze for FrameTracker",1,["os::mm::frame_allocator::FrameTracker"]],["impl Freeze for StackFrameAllocator",1,["os::mm::frame_allocator::StackFrameAllocator"]],["impl Freeze for FRAME_ALLOCATOR",1,["os::mm::frame_allocator::FRAME_ALLOCATOR"]],["impl Freeze for KERNEL_SPACE",1,["os::mm::memory_set::KERNEL_SPACE"]],["impl Freeze for MemorySet",1,["os::mm::memory_set::MemorySet"]],["impl Freeze for MapArea",1,["os::mm::memory_set::MapArea"]],["impl Freeze for MapType",1,["os::mm::memory_set::MapType"]],["impl Freeze for MapPermission",1,["os::mm::memory_set::MapPermission"]],["impl Freeze for PTEFlags",1,["os::mm::page_table::PTEFlags"]],["impl Freeze for PageTableEntry",1,["os::mm::page_table::PageTableEntry"]],["impl Freeze for PageTable",1,["os::mm::page_table::PageTable"]],["impl Freeze for UserBuffer",1,["os::mm::page_table::UserBuffer"]],["impl Freeze for UserBufferIterator",1,["os::mm::page_table::UserBufferIterator"]],["impl<T> !Freeze for UPSafeCell<T>",1,["os::sync::up::UPSafeCell"]],["impl !Freeze for RawExclusiveLock",1,["os::sync::up::RawExclusiveLock"]],["impl Freeze for TaskContext",1,["os::task::context::TaskContext"]],["impl Freeze for TaskManager",1,["os::task::manager::TaskManager"]],["impl Freeze for TASK_MANAGER",1,["os::task::manager::TASK_MANAGER"]],["impl Freeze for PidAllocator",1,["os::task::pid::PidAllocator"]],["impl Freeze for PID_ALLOCATOR",1,["os::task::pid::PID_ALLOCATOR"]],["impl Freeze for PidHandle",1,["os::task::pid::PidHandle"]],["impl Freeze for KernelStack",1,["os::task::pid::KernelStack"]],["impl Freeze for Processor",1,["os::task::processor::Processor"]],["impl Freeze for PROCESSOR",1,["os::task::processor::PROCESSOR"]],["impl !Freeze for TaskControlBlock",1,["os::task::task::TaskControlBlock"]],["impl Freeze for TaskControlBlockInner",1,["os::task::task::TaskControlBlockInner"]],["impl Freeze for TaskStatus",1,["os::task::task::TaskStatus"]],["impl Freeze for INITPROC",1,["os::task::INITPROC"]],["impl Freeze for TrapContext",1,["os::trap::context::TrapContext"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/core/marker/trait.Send.js b/ch6-dev/implementors/core/marker/trait.Send.js index e62c3752..32dac63a 100644 --- a/ch6-dev/implementors/core/marker/trait.Send.js +++ b/ch6-dev/implementors/core/marker/trait.Send.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = [{"text":"impl Send for RISCV64","synthetic":true,"types":["os::board::RISCV64"]},{"text":"impl Send for Stdout","synthetic":true,"types":["os::console::Stdout"]},{"text":"impl<SPI> Send for SDCard<SPI> where
    SPI: Send
","synthetic":true,"types":["os::drivers::block::sdcard::SDCard"]},{"text":"impl Send for CMD","synthetic":true,"types":["os::drivers::block::sdcard::CMD"]},{"text":"impl Send for InitError","synthetic":true,"types":["os::drivers::block::sdcard::InitError"]},{"text":"impl Send for SDCardCSD","synthetic":true,"types":["os::drivers::block::sdcard::SDCardCSD"]},{"text":"impl Send for SDCardCID","synthetic":true,"types":["os::drivers::block::sdcard::SDCardCID"]},{"text":"impl Send for SDCardInfo","synthetic":true,"types":["os::drivers::block::sdcard::SDCardInfo"]},{"text":"impl Send for PERIPHERALS","synthetic":true,"types":["os::drivers::block::sdcard::PERIPHERALS"]},{"text":"impl Send for SDCardWrapper","synthetic":true,"types":["os::drivers::block::sdcard::SDCardWrapper"]},{"text":"impl Send for VirtIOBlock","synthetic":true,"types":["os::drivers::block::virtio_blk::VirtIOBlock"]},{"text":"impl Send for QUEUE_FRAMES","synthetic":true,"types":["os::drivers::block::virtio_blk::QUEUE_FRAMES"]},{"text":"impl Send for BLOCK_DEVICE","synthetic":true,"types":["os::drivers::block::BLOCK_DEVICE"]},{"text":"impl Send for OSInode","synthetic":true,"types":["os::fs::inode::OSInode"]},{"text":"impl Send for OSInodeInner","synthetic":true,"types":["os::fs::inode::OSInodeInner"]},{"text":"impl Send for ROOT_INODE","synthetic":true,"types":["os::fs::inode::ROOT_INODE"]},{"text":"impl Send for OpenFlags","synthetic":true,"types":["os::fs::inode::OpenFlags"]},{"text":"impl Send for Stdin","synthetic":true,"types":["os::fs::stdio::Stdin"]},{"text":"impl Send for Stdout","synthetic":true,"types":["os::fs::stdio::Stdout"]},{"text":"impl Send for PhysAddr","synthetic":true,"types":["os::mm::address::PhysAddr"]},{"text":"impl Send for VirtAddr","synthetic":true,"types":["os::mm::address::VirtAddr"]},{"text":"impl Send for PhysPageNum","synthetic":true,"types":["os::mm::address::PhysPageNum"]},{"text":"impl Send for VirtPageNum","synthetic":true,"types":["os::mm::address::VirtPageNum"]},{"text":"impl<T> Send for SimpleRange<T> where
    T: Send
","synthetic":true,"types":["os::mm::address::SimpleRange"]},{"text":"impl<T> Send for SimpleRangeIterator<T> where
    T: Send
","synthetic":true,"types":["os::mm::address::SimpleRangeIterator"]},{"text":"impl Send for FrameTracker","synthetic":true,"types":["os::mm::frame_allocator::FrameTracker"]},{"text":"impl Send for StackFrameAllocator","synthetic":true,"types":["os::mm::frame_allocator::StackFrameAllocator"]},{"text":"impl Send for FRAME_ALLOCATOR","synthetic":true,"types":["os::mm::frame_allocator::FRAME_ALLOCATOR"]},{"text":"impl Send for KERNEL_SPACE","synthetic":true,"types":["os::mm::memory_set::KERNEL_SPACE"]},{"text":"impl Send for MemorySet","synthetic":true,"types":["os::mm::memory_set::MemorySet"]},{"text":"impl Send for MapArea","synthetic":true,"types":["os::mm::memory_set::MapArea"]},{"text":"impl Send for MapType","synthetic":true,"types":["os::mm::memory_set::MapType"]},{"text":"impl Send for MapPermission","synthetic":true,"types":["os::mm::memory_set::MapPermission"]},{"text":"impl Send for PTEFlags","synthetic":true,"types":["os::mm::page_table::PTEFlags"]},{"text":"impl Send for PageTableEntry","synthetic":true,"types":["os::mm::page_table::PageTableEntry"]},{"text":"impl Send for PageTable","synthetic":true,"types":["os::mm::page_table::PageTable"]},{"text":"impl Send for UserBuffer","synthetic":true,"types":["os::mm::page_table::UserBuffer"]},{"text":"impl Send for UserBufferIterator","synthetic":true,"types":["os::mm::page_table::UserBufferIterator"]},{"text":"impl<T> Send for UPSafeCell<T> where
    T: Send
","synthetic":true,"types":["os::sync::up::UPSafeCell"]},{"text":"impl Send for TaskContext","synthetic":true,"types":["os::task::context::TaskContext"]},{"text":"impl Send for TaskManager","synthetic":true,"types":["os::task::manager::TaskManager"]},{"text":"impl Send for TASK_MANAGER","synthetic":true,"types":["os::task::manager::TASK_MANAGER"]},{"text":"impl Send for PidAllocator","synthetic":true,"types":["os::task::pid::PidAllocator"]},{"text":"impl Send for PID_ALLOCATOR","synthetic":true,"types":["os::task::pid::PID_ALLOCATOR"]},{"text":"impl Send for PidHandle","synthetic":true,"types":["os::task::pid::PidHandle"]},{"text":"impl Send for KernelStack","synthetic":true,"types":["os::task::pid::KernelStack"]},{"text":"impl Send for Processor","synthetic":true,"types":["os::task::processor::Processor"]},{"text":"impl Send for PROCESSOR","synthetic":true,"types":["os::task::processor::PROCESSOR"]},{"text":"impl Send for TaskControlBlock","synthetic":true,"types":["os::task::task::TaskControlBlock"]},{"text":"impl Send for TaskControlBlockInner","synthetic":true,"types":["os::task::task::TaskControlBlockInner"]},{"text":"impl Send for TaskStatus","synthetic":true,"types":["os::task::task::TaskStatus"]},{"text":"impl Send for INITPROC","synthetic":true,"types":["os::task::INITPROC"]},{"text":"impl Send for TrapContext","synthetic":true,"types":["os::trap::context::TrapContext"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[["impl Send for Stdout",1,["os::console::Stdout"]],["impl Send for VirtIOBlock",1,["os::drivers::block::virtio_blk::VirtIOBlock"]],["impl Send for QUEUE_FRAMES",1,["os::drivers::block::virtio_blk::QUEUE_FRAMES"]],["impl Send for VirtioHal",1,["os::drivers::block::virtio_blk::VirtioHal"]],["impl Send for BLOCK_DEVICE",1,["os::drivers::block::BLOCK_DEVICE"]],["impl Send for OSInode",1,["os::fs::inode::OSInode"]],["impl Send for OSInodeInner",1,["os::fs::inode::OSInodeInner"]],["impl Send for ROOT_INODE",1,["os::fs::inode::ROOT_INODE"]],["impl Send for OpenFlags",1,["os::fs::inode::OpenFlags"]],["impl Send for Stdin",1,["os::fs::stdio::Stdin"]],["impl Send for Stdout",1,["os::fs::stdio::Stdout"]],["impl Send for PhysAddr",1,["os::mm::address::PhysAddr"]],["impl Send for VirtAddr",1,["os::mm::address::VirtAddr"]],["impl Send for PhysPageNum",1,["os::mm::address::PhysPageNum"]],["impl Send for VirtPageNum",1,["os::mm::address::VirtPageNum"]],["impl<T> Send for SimpleRange<T>where\n T: Send,",1,["os::mm::address::SimpleRange"]],["impl<T> Send for SimpleRangeIterator<T>where\n T: Send,",1,["os::mm::address::SimpleRangeIterator"]],["impl Send for FrameTracker",1,["os::mm::frame_allocator::FrameTracker"]],["impl Send for StackFrameAllocator",1,["os::mm::frame_allocator::StackFrameAllocator"]],["impl Send for FRAME_ALLOCATOR",1,["os::mm::frame_allocator::FRAME_ALLOCATOR"]],["impl Send for KERNEL_SPACE",1,["os::mm::memory_set::KERNEL_SPACE"]],["impl Send for MemorySet",1,["os::mm::memory_set::MemorySet"]],["impl Send for MapArea",1,["os::mm::memory_set::MapArea"]],["impl Send for MapType",1,["os::mm::memory_set::MapType"]],["impl Send for MapPermission",1,["os::mm::memory_set::MapPermission"]],["impl Send for PTEFlags",1,["os::mm::page_table::PTEFlags"]],["impl Send for PageTableEntry",1,["os::mm::page_table::PageTableEntry"]],["impl Send for PageTable",1,["os::mm::page_table::PageTable"]],["impl Send for UserBuffer",1,["os::mm::page_table::UserBuffer"]],["impl Send for UserBufferIterator",1,["os::mm::page_table::UserBufferIterator"]],["impl<T> Send for UPSafeCell<T>where\n T: Send,",1,["os::sync::up::UPSafeCell"]],["impl Send for RawExclusiveLock",1,["os::sync::up::RawExclusiveLock"]],["impl Send for TaskContext",1,["os::task::context::TaskContext"]],["impl Send for TaskManager",1,["os::task::manager::TaskManager"]],["impl Send for TASK_MANAGER",1,["os::task::manager::TASK_MANAGER"]],["impl Send for PidAllocator",1,["os::task::pid::PidAllocator"]],["impl Send for PID_ALLOCATOR",1,["os::task::pid::PID_ALLOCATOR"]],["impl Send for PidHandle",1,["os::task::pid::PidHandle"]],["impl Send for KernelStack",1,["os::task::pid::KernelStack"]],["impl Send for Processor",1,["os::task::processor::Processor"]],["impl Send for PROCESSOR",1,["os::task::processor::PROCESSOR"]],["impl Send for TaskControlBlock",1,["os::task::task::TaskControlBlock"]],["impl Send for TaskControlBlockInner",1,["os::task::task::TaskControlBlockInner"]],["impl Send for TaskStatus",1,["os::task::task::TaskStatus"]],["impl Send for INITPROC",1,["os::task::INITPROC"]],["impl Send for TrapContext",1,["os::trap::context::TrapContext"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/core/marker/trait.StructuralEq.js b/ch6-dev/implementors/core/marker/trait.StructuralEq.js index 9cccc2f8..77447677 100644 --- a/ch6-dev/implementors/core/marker/trait.StructuralEq.js +++ b/ch6-dev/implementors/core/marker/trait.StructuralEq.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = [{"text":"impl StructuralEq for CMD","synthetic":false,"types":["os::drivers::block::sdcard::CMD"]},{"text":"impl StructuralEq for OpenFlags","synthetic":false,"types":["os::fs::inode::OpenFlags"]},{"text":"impl StructuralEq for PhysAddr","synthetic":false,"types":["os::mm::address::PhysAddr"]},{"text":"impl StructuralEq for VirtAddr","synthetic":false,"types":["os::mm::address::VirtAddr"]},{"text":"impl StructuralEq for PhysPageNum","synthetic":false,"types":["os::mm::address::PhysPageNum"]},{"text":"impl StructuralEq for VirtPageNum","synthetic":false,"types":["os::mm::address::VirtPageNum"]},{"text":"impl StructuralEq for MapPermission","synthetic":false,"types":["os::mm::memory_set::MapPermission"]},{"text":"impl StructuralEq for PTEFlags","synthetic":false,"types":["os::mm::page_table::PTEFlags"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[["impl StructuralEq for VirtAddr"],["impl StructuralEq for MapPermission"],["impl StructuralEq for VirtPageNum"],["impl StructuralEq for OpenFlags"],["impl StructuralEq for PhysAddr"],["impl StructuralEq for PhysPageNum"],["impl StructuralEq for PTEFlags"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/core/marker/trait.StructuralPartialEq.js b/ch6-dev/implementors/core/marker/trait.StructuralPartialEq.js index 912918b1..97ba8d2a 100644 --- a/ch6-dev/implementors/core/marker/trait.StructuralPartialEq.js +++ b/ch6-dev/implementors/core/marker/trait.StructuralPartialEq.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = [{"text":"impl StructuralPartialEq for CMD","synthetic":false,"types":["os::drivers::block::sdcard::CMD"]},{"text":"impl StructuralPartialEq for OpenFlags","synthetic":false,"types":["os::fs::inode::OpenFlags"]},{"text":"impl StructuralPartialEq for PhysAddr","synthetic":false,"types":["os::mm::address::PhysAddr"]},{"text":"impl StructuralPartialEq for VirtAddr","synthetic":false,"types":["os::mm::address::VirtAddr"]},{"text":"impl StructuralPartialEq for PhysPageNum","synthetic":false,"types":["os::mm::address::PhysPageNum"]},{"text":"impl StructuralPartialEq for VirtPageNum","synthetic":false,"types":["os::mm::address::VirtPageNum"]},{"text":"impl StructuralPartialEq for MapType","synthetic":false,"types":["os::mm::memory_set::MapType"]},{"text":"impl StructuralPartialEq for MapPermission","synthetic":false,"types":["os::mm::memory_set::MapPermission"]},{"text":"impl StructuralPartialEq for PTEFlags","synthetic":false,"types":["os::mm::page_table::PTEFlags"]},{"text":"impl StructuralPartialEq for TaskStatus","synthetic":false,"types":["os::task::task::TaskStatus"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[["impl StructuralPartialEq for PhysAddr"],["impl StructuralPartialEq for VirtPageNum"],["impl StructuralPartialEq for PhysPageNum"],["impl StructuralPartialEq for MapPermission"],["impl StructuralPartialEq for VirtAddr"],["impl StructuralPartialEq for OpenFlags"],["impl StructuralPartialEq for PTEFlags"],["impl StructuralPartialEq for TaskStatus"],["impl StructuralPartialEq for MapType"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/core/marker/trait.Sync.js b/ch6-dev/implementors/core/marker/trait.Sync.js index ebc01a36..f9916b7d 100644 --- a/ch6-dev/implementors/core/marker/trait.Sync.js +++ b/ch6-dev/implementors/core/marker/trait.Sync.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = [{"text":"impl Sync for RISCV64","synthetic":true,"types":["os::board::RISCV64"]},{"text":"impl Sync for Stdout","synthetic":true,"types":["os::console::Stdout"]},{"text":"impl<SPI> Sync for SDCard<SPI> where
    SPI: Sync
","synthetic":true,"types":["os::drivers::block::sdcard::SDCard"]},{"text":"impl Sync for CMD","synthetic":true,"types":["os::drivers::block::sdcard::CMD"]},{"text":"impl Sync for InitError","synthetic":true,"types":["os::drivers::block::sdcard::InitError"]},{"text":"impl Sync for SDCardCSD","synthetic":true,"types":["os::drivers::block::sdcard::SDCardCSD"]},{"text":"impl Sync for SDCardCID","synthetic":true,"types":["os::drivers::block::sdcard::SDCardCID"]},{"text":"impl Sync for SDCardInfo","synthetic":true,"types":["os::drivers::block::sdcard::SDCardInfo"]},{"text":"impl Sync for PERIPHERALS","synthetic":true,"types":["os::drivers::block::sdcard::PERIPHERALS"]},{"text":"impl Sync for SDCardWrapper","synthetic":true,"types":["os::drivers::block::sdcard::SDCardWrapper"]},{"text":"impl Sync for VirtIOBlock","synthetic":true,"types":["os::drivers::block::virtio_blk::VirtIOBlock"]},{"text":"impl Sync for QUEUE_FRAMES","synthetic":true,"types":["os::drivers::block::virtio_blk::QUEUE_FRAMES"]},{"text":"impl Sync for BLOCK_DEVICE","synthetic":true,"types":["os::drivers::block::BLOCK_DEVICE"]},{"text":"impl Sync for OSInode","synthetic":true,"types":["os::fs::inode::OSInode"]},{"text":"impl Sync for OSInodeInner","synthetic":true,"types":["os::fs::inode::OSInodeInner"]},{"text":"impl Sync for ROOT_INODE","synthetic":true,"types":["os::fs::inode::ROOT_INODE"]},{"text":"impl Sync for OpenFlags","synthetic":true,"types":["os::fs::inode::OpenFlags"]},{"text":"impl Sync for Stdin","synthetic":true,"types":["os::fs::stdio::Stdin"]},{"text":"impl Sync for Stdout","synthetic":true,"types":["os::fs::stdio::Stdout"]},{"text":"impl Sync for PhysAddr","synthetic":true,"types":["os::mm::address::PhysAddr"]},{"text":"impl Sync for VirtAddr","synthetic":true,"types":["os::mm::address::VirtAddr"]},{"text":"impl Sync for PhysPageNum","synthetic":true,"types":["os::mm::address::PhysPageNum"]},{"text":"impl Sync for VirtPageNum","synthetic":true,"types":["os::mm::address::VirtPageNum"]},{"text":"impl<T> Sync for SimpleRange<T> where
    T: Sync
","synthetic":true,"types":["os::mm::address::SimpleRange"]},{"text":"impl<T> Sync for SimpleRangeIterator<T> where
    T: Sync
","synthetic":true,"types":["os::mm::address::SimpleRangeIterator"]},{"text":"impl Sync for FrameTracker","synthetic":true,"types":["os::mm::frame_allocator::FrameTracker"]},{"text":"impl Sync for StackFrameAllocator","synthetic":true,"types":["os::mm::frame_allocator::StackFrameAllocator"]},{"text":"impl Sync for FRAME_ALLOCATOR","synthetic":true,"types":["os::mm::frame_allocator::FRAME_ALLOCATOR"]},{"text":"impl Sync for KERNEL_SPACE","synthetic":true,"types":["os::mm::memory_set::KERNEL_SPACE"]},{"text":"impl Sync for MemorySet","synthetic":true,"types":["os::mm::memory_set::MemorySet"]},{"text":"impl Sync for MapArea","synthetic":true,"types":["os::mm::memory_set::MapArea"]},{"text":"impl Sync for MapType","synthetic":true,"types":["os::mm::memory_set::MapType"]},{"text":"impl Sync for MapPermission","synthetic":true,"types":["os::mm::memory_set::MapPermission"]},{"text":"impl Sync for PTEFlags","synthetic":true,"types":["os::mm::page_table::PTEFlags"]},{"text":"impl Sync for PageTableEntry","synthetic":true,"types":["os::mm::page_table::PageTableEntry"]},{"text":"impl Sync for PageTable","synthetic":true,"types":["os::mm::page_table::PageTable"]},{"text":"impl Sync for UserBuffer","synthetic":true,"types":["os::mm::page_table::UserBuffer"]},{"text":"impl Sync for UserBufferIterator","synthetic":true,"types":["os::mm::page_table::UserBufferIterator"]},{"text":"impl Sync for TaskContext","synthetic":true,"types":["os::task::context::TaskContext"]},{"text":"impl Sync for TaskManager","synthetic":true,"types":["os::task::manager::TaskManager"]},{"text":"impl Sync for TASK_MANAGER","synthetic":true,"types":["os::task::manager::TASK_MANAGER"]},{"text":"impl Sync for PidAllocator","synthetic":true,"types":["os::task::pid::PidAllocator"]},{"text":"impl Sync for PID_ALLOCATOR","synthetic":true,"types":["os::task::pid::PID_ALLOCATOR"]},{"text":"impl Sync for PidHandle","synthetic":true,"types":["os::task::pid::PidHandle"]},{"text":"impl Sync for KernelStack","synthetic":true,"types":["os::task::pid::KernelStack"]},{"text":"impl Sync for Processor","synthetic":true,"types":["os::task::processor::Processor"]},{"text":"impl Sync for PROCESSOR","synthetic":true,"types":["os::task::processor::PROCESSOR"]},{"text":"impl Sync for TaskControlBlock","synthetic":true,"types":["os::task::task::TaskControlBlock"]},{"text":"impl Sync for TaskControlBlockInner","synthetic":true,"types":["os::task::task::TaskControlBlockInner"]},{"text":"impl Sync for TaskStatus","synthetic":true,"types":["os::task::task::TaskStatus"]},{"text":"impl Sync for INITPROC","synthetic":true,"types":["os::task::INITPROC"]},{"text":"impl Sync for TrapContext","synthetic":true,"types":["os::trap::context::TrapContext"]},{"text":"impl<T> Sync for UPSafeCell<T>","synthetic":false,"types":["os::sync::up::UPSafeCell"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[["impl Sync for Stdout",1,["os::console::Stdout"]],["impl Sync for VirtIOBlock",1,["os::drivers::block::virtio_blk::VirtIOBlock"]],["impl Sync for QUEUE_FRAMES",1,["os::drivers::block::virtio_blk::QUEUE_FRAMES"]],["impl Sync for VirtioHal",1,["os::drivers::block::virtio_blk::VirtioHal"]],["impl Sync for BLOCK_DEVICE",1,["os::drivers::block::BLOCK_DEVICE"]],["impl Sync for OSInode",1,["os::fs::inode::OSInode"]],["impl Sync for OSInodeInner",1,["os::fs::inode::OSInodeInner"]],["impl Sync for ROOT_INODE",1,["os::fs::inode::ROOT_INODE"]],["impl Sync for OpenFlags",1,["os::fs::inode::OpenFlags"]],["impl Sync for Stdin",1,["os::fs::stdio::Stdin"]],["impl Sync for Stdout",1,["os::fs::stdio::Stdout"]],["impl Sync for PhysAddr",1,["os::mm::address::PhysAddr"]],["impl Sync for VirtAddr",1,["os::mm::address::VirtAddr"]],["impl Sync for PhysPageNum",1,["os::mm::address::PhysPageNum"]],["impl Sync for VirtPageNum",1,["os::mm::address::VirtPageNum"]],["impl<T> Sync for SimpleRange<T>where\n T: Sync,",1,["os::mm::address::SimpleRange"]],["impl<T> Sync for SimpleRangeIterator<T>where\n T: Sync,",1,["os::mm::address::SimpleRangeIterator"]],["impl Sync for FrameTracker",1,["os::mm::frame_allocator::FrameTracker"]],["impl Sync for StackFrameAllocator",1,["os::mm::frame_allocator::StackFrameAllocator"]],["impl Sync for FRAME_ALLOCATOR",1,["os::mm::frame_allocator::FRAME_ALLOCATOR"]],["impl Sync for KERNEL_SPACE",1,["os::mm::memory_set::KERNEL_SPACE"]],["impl Sync for MemorySet",1,["os::mm::memory_set::MemorySet"]],["impl Sync for MapArea",1,["os::mm::memory_set::MapArea"]],["impl Sync for MapType",1,["os::mm::memory_set::MapType"]],["impl Sync for MapPermission",1,["os::mm::memory_set::MapPermission"]],["impl Sync for PTEFlags",1,["os::mm::page_table::PTEFlags"]],["impl Sync for PageTableEntry",1,["os::mm::page_table::PageTableEntry"]],["impl Sync for PageTable",1,["os::mm::page_table::PageTable"]],["impl Sync for UserBuffer",1,["os::mm::page_table::UserBuffer"]],["impl Sync for UserBufferIterator",1,["os::mm::page_table::UserBufferIterator"]],["impl Sync for RawExclusiveLock",1,["os::sync::up::RawExclusiveLock"]],["impl Sync for TaskContext",1,["os::task::context::TaskContext"]],["impl Sync for TaskManager",1,["os::task::manager::TaskManager"]],["impl Sync for TASK_MANAGER",1,["os::task::manager::TASK_MANAGER"]],["impl Sync for PidAllocator",1,["os::task::pid::PidAllocator"]],["impl Sync for PID_ALLOCATOR",1,["os::task::pid::PID_ALLOCATOR"]],["impl Sync for PidHandle",1,["os::task::pid::PidHandle"]],["impl Sync for KernelStack",1,["os::task::pid::KernelStack"]],["impl Sync for Processor",1,["os::task::processor::Processor"]],["impl Sync for PROCESSOR",1,["os::task::processor::PROCESSOR"]],["impl Sync for TaskControlBlock",1,["os::task::task::TaskControlBlock"]],["impl Sync for TaskControlBlockInner",1,["os::task::task::TaskControlBlockInner"]],["impl Sync for TaskStatus",1,["os::task::task::TaskStatus"]],["impl Sync for INITPROC",1,["os::task::INITPROC"]],["impl Sync for TrapContext",1,["os::trap::context::TrapContext"]],["impl<T> Sync for UPSafeCell<T>"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/core/marker/trait.Unpin.js b/ch6-dev/implementors/core/marker/trait.Unpin.js index ceea48bd..7e4468a0 100644 --- a/ch6-dev/implementors/core/marker/trait.Unpin.js +++ b/ch6-dev/implementors/core/marker/trait.Unpin.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = [{"text":"impl Unpin for RISCV64","synthetic":true,"types":["os::board::RISCV64"]},{"text":"impl Unpin for Stdout","synthetic":true,"types":["os::console::Stdout"]},{"text":"impl<SPI> Unpin for SDCard<SPI> where
    SPI: Unpin
","synthetic":true,"types":["os::drivers::block::sdcard::SDCard"]},{"text":"impl Unpin for CMD","synthetic":true,"types":["os::drivers::block::sdcard::CMD"]},{"text":"impl Unpin for InitError","synthetic":true,"types":["os::drivers::block::sdcard::InitError"]},{"text":"impl Unpin for SDCardCSD","synthetic":true,"types":["os::drivers::block::sdcard::SDCardCSD"]},{"text":"impl Unpin for SDCardCID","synthetic":true,"types":["os::drivers::block::sdcard::SDCardCID"]},{"text":"impl Unpin for SDCardInfo","synthetic":true,"types":["os::drivers::block::sdcard::SDCardInfo"]},{"text":"impl Unpin for PERIPHERALS","synthetic":true,"types":["os::drivers::block::sdcard::PERIPHERALS"]},{"text":"impl Unpin for SDCardWrapper","synthetic":true,"types":["os::drivers::block::sdcard::SDCardWrapper"]},{"text":"impl Unpin for VirtIOBlock","synthetic":true,"types":["os::drivers::block::virtio_blk::VirtIOBlock"]},{"text":"impl Unpin for QUEUE_FRAMES","synthetic":true,"types":["os::drivers::block::virtio_blk::QUEUE_FRAMES"]},{"text":"impl Unpin for BLOCK_DEVICE","synthetic":true,"types":["os::drivers::block::BLOCK_DEVICE"]},{"text":"impl Unpin for OSInode","synthetic":true,"types":["os::fs::inode::OSInode"]},{"text":"impl Unpin for OSInodeInner","synthetic":true,"types":["os::fs::inode::OSInodeInner"]},{"text":"impl Unpin for ROOT_INODE","synthetic":true,"types":["os::fs::inode::ROOT_INODE"]},{"text":"impl Unpin for OpenFlags","synthetic":true,"types":["os::fs::inode::OpenFlags"]},{"text":"impl Unpin for Stdin","synthetic":true,"types":["os::fs::stdio::Stdin"]},{"text":"impl Unpin for Stdout","synthetic":true,"types":["os::fs::stdio::Stdout"]},{"text":"impl Unpin for PhysAddr","synthetic":true,"types":["os::mm::address::PhysAddr"]},{"text":"impl Unpin for VirtAddr","synthetic":true,"types":["os::mm::address::VirtAddr"]},{"text":"impl Unpin for PhysPageNum","synthetic":true,"types":["os::mm::address::PhysPageNum"]},{"text":"impl Unpin for VirtPageNum","synthetic":true,"types":["os::mm::address::VirtPageNum"]},{"text":"impl<T> Unpin for SimpleRange<T> where
    T: Unpin
","synthetic":true,"types":["os::mm::address::SimpleRange"]},{"text":"impl<T> Unpin for SimpleRangeIterator<T> where
    T: Unpin
","synthetic":true,"types":["os::mm::address::SimpleRangeIterator"]},{"text":"impl Unpin for FrameTracker","synthetic":true,"types":["os::mm::frame_allocator::FrameTracker"]},{"text":"impl Unpin for StackFrameAllocator","synthetic":true,"types":["os::mm::frame_allocator::StackFrameAllocator"]},{"text":"impl Unpin for FRAME_ALLOCATOR","synthetic":true,"types":["os::mm::frame_allocator::FRAME_ALLOCATOR"]},{"text":"impl Unpin for KERNEL_SPACE","synthetic":true,"types":["os::mm::memory_set::KERNEL_SPACE"]},{"text":"impl Unpin for MemorySet","synthetic":true,"types":["os::mm::memory_set::MemorySet"]},{"text":"impl Unpin for MapArea","synthetic":true,"types":["os::mm::memory_set::MapArea"]},{"text":"impl Unpin for MapType","synthetic":true,"types":["os::mm::memory_set::MapType"]},{"text":"impl Unpin for MapPermission","synthetic":true,"types":["os::mm::memory_set::MapPermission"]},{"text":"impl Unpin for PTEFlags","synthetic":true,"types":["os::mm::page_table::PTEFlags"]},{"text":"impl Unpin for PageTableEntry","synthetic":true,"types":["os::mm::page_table::PageTableEntry"]},{"text":"impl Unpin for PageTable","synthetic":true,"types":["os::mm::page_table::PageTable"]},{"text":"impl Unpin for UserBuffer","synthetic":true,"types":["os::mm::page_table::UserBuffer"]},{"text":"impl Unpin for UserBufferIterator","synthetic":true,"types":["os::mm::page_table::UserBufferIterator"]},{"text":"impl<T> Unpin for UPSafeCell<T> where
    T: Unpin
","synthetic":true,"types":["os::sync::up::UPSafeCell"]},{"text":"impl Unpin for TaskContext","synthetic":true,"types":["os::task::context::TaskContext"]},{"text":"impl Unpin for TaskManager","synthetic":true,"types":["os::task::manager::TaskManager"]},{"text":"impl Unpin for TASK_MANAGER","synthetic":true,"types":["os::task::manager::TASK_MANAGER"]},{"text":"impl Unpin for PidAllocator","synthetic":true,"types":["os::task::pid::PidAllocator"]},{"text":"impl Unpin for PID_ALLOCATOR","synthetic":true,"types":["os::task::pid::PID_ALLOCATOR"]},{"text":"impl Unpin for PidHandle","synthetic":true,"types":["os::task::pid::PidHandle"]},{"text":"impl Unpin for KernelStack","synthetic":true,"types":["os::task::pid::KernelStack"]},{"text":"impl Unpin for Processor","synthetic":true,"types":["os::task::processor::Processor"]},{"text":"impl Unpin for PROCESSOR","synthetic":true,"types":["os::task::processor::PROCESSOR"]},{"text":"impl Unpin for TaskControlBlock","synthetic":true,"types":["os::task::task::TaskControlBlock"]},{"text":"impl Unpin for TaskControlBlockInner","synthetic":true,"types":["os::task::task::TaskControlBlockInner"]},{"text":"impl Unpin for TaskStatus","synthetic":true,"types":["os::task::task::TaskStatus"]},{"text":"impl Unpin for INITPROC","synthetic":true,"types":["os::task::INITPROC"]},{"text":"impl Unpin for TrapContext","synthetic":true,"types":["os::trap::context::TrapContext"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[["impl Unpin for Stdout",1,["os::console::Stdout"]],["impl Unpin for VirtIOBlock",1,["os::drivers::block::virtio_blk::VirtIOBlock"]],["impl Unpin for QUEUE_FRAMES",1,["os::drivers::block::virtio_blk::QUEUE_FRAMES"]],["impl Unpin for VirtioHal",1,["os::drivers::block::virtio_blk::VirtioHal"]],["impl Unpin for BLOCK_DEVICE",1,["os::drivers::block::BLOCK_DEVICE"]],["impl Unpin for OSInode",1,["os::fs::inode::OSInode"]],["impl Unpin for OSInodeInner",1,["os::fs::inode::OSInodeInner"]],["impl Unpin for ROOT_INODE",1,["os::fs::inode::ROOT_INODE"]],["impl Unpin for OpenFlags",1,["os::fs::inode::OpenFlags"]],["impl Unpin for Stdin",1,["os::fs::stdio::Stdin"]],["impl Unpin for Stdout",1,["os::fs::stdio::Stdout"]],["impl Unpin for PhysAddr",1,["os::mm::address::PhysAddr"]],["impl Unpin for VirtAddr",1,["os::mm::address::VirtAddr"]],["impl Unpin for PhysPageNum",1,["os::mm::address::PhysPageNum"]],["impl Unpin for VirtPageNum",1,["os::mm::address::VirtPageNum"]],["impl<T> Unpin for SimpleRange<T>where\n T: Unpin,",1,["os::mm::address::SimpleRange"]],["impl<T> Unpin for SimpleRangeIterator<T>where\n T: Unpin,",1,["os::mm::address::SimpleRangeIterator"]],["impl Unpin for FrameTracker",1,["os::mm::frame_allocator::FrameTracker"]],["impl Unpin for StackFrameAllocator",1,["os::mm::frame_allocator::StackFrameAllocator"]],["impl Unpin for FRAME_ALLOCATOR",1,["os::mm::frame_allocator::FRAME_ALLOCATOR"]],["impl Unpin for KERNEL_SPACE",1,["os::mm::memory_set::KERNEL_SPACE"]],["impl Unpin for MemorySet",1,["os::mm::memory_set::MemorySet"]],["impl Unpin for MapArea",1,["os::mm::memory_set::MapArea"]],["impl Unpin for MapType",1,["os::mm::memory_set::MapType"]],["impl Unpin for MapPermission",1,["os::mm::memory_set::MapPermission"]],["impl Unpin for PTEFlags",1,["os::mm::page_table::PTEFlags"]],["impl Unpin for PageTableEntry",1,["os::mm::page_table::PageTableEntry"]],["impl Unpin for PageTable",1,["os::mm::page_table::PageTable"]],["impl Unpin for UserBuffer",1,["os::mm::page_table::UserBuffer"]],["impl Unpin for UserBufferIterator",1,["os::mm::page_table::UserBufferIterator"]],["impl<T> Unpin for UPSafeCell<T>where\n T: Unpin,",1,["os::sync::up::UPSafeCell"]],["impl Unpin for RawExclusiveLock",1,["os::sync::up::RawExclusiveLock"]],["impl Unpin for TaskContext",1,["os::task::context::TaskContext"]],["impl Unpin for TaskManager",1,["os::task::manager::TaskManager"]],["impl Unpin for TASK_MANAGER",1,["os::task::manager::TASK_MANAGER"]],["impl Unpin for PidAllocator",1,["os::task::pid::PidAllocator"]],["impl Unpin for PID_ALLOCATOR",1,["os::task::pid::PID_ALLOCATOR"]],["impl Unpin for PidHandle",1,["os::task::pid::PidHandle"]],["impl Unpin for KernelStack",1,["os::task::pid::KernelStack"]],["impl Unpin for Processor",1,["os::task::processor::Processor"]],["impl Unpin for PROCESSOR",1,["os::task::processor::PROCESSOR"]],["impl Unpin for TaskControlBlock",1,["os::task::task::TaskControlBlock"]],["impl Unpin for TaskControlBlockInner",1,["os::task::task::TaskControlBlockInner"]],["impl Unpin for TaskStatus",1,["os::task::task::TaskStatus"]],["impl Unpin for INITPROC",1,["os::task::INITPROC"]],["impl Unpin for TrapContext",1,["os::trap::context::TrapContext"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/core/ops/arith/trait.Sub.js b/ch6-dev/implementors/core/ops/arith/trait.Sub.js index 6aa5697f..d1b9c85a 100644 --- a/ch6-dev/implementors/core/ops/arith/trait.Sub.js +++ b/ch6-dev/implementors/core/ops/arith/trait.Sub.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = [{"text":"impl Sub<OpenFlags> for OpenFlags","synthetic":false,"types":["os::fs::inode::OpenFlags"]},{"text":"impl Sub<MapPermission> for MapPermission","synthetic":false,"types":["os::mm::memory_set::MapPermission"]},{"text":"impl Sub<PTEFlags> for PTEFlags","synthetic":false,"types":["os::mm::page_table::PTEFlags"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[["impl Sub<OpenFlags> for OpenFlags"],["impl Sub<MapPermission> for MapPermission"],["impl Sub<PTEFlags> for PTEFlags"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/core/ops/arith/trait.SubAssign.js b/ch6-dev/implementors/core/ops/arith/trait.SubAssign.js index b281d4dd..f629936e 100644 --- a/ch6-dev/implementors/core/ops/arith/trait.SubAssign.js +++ b/ch6-dev/implementors/core/ops/arith/trait.SubAssign.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = [{"text":"impl SubAssign<OpenFlags> for OpenFlags","synthetic":false,"types":["os::fs::inode::OpenFlags"]},{"text":"impl SubAssign<MapPermission> for MapPermission","synthetic":false,"types":["os::mm::memory_set::MapPermission"]},{"text":"impl SubAssign<PTEFlags> for PTEFlags","synthetic":false,"types":["os::mm::page_table::PTEFlags"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[["impl SubAssign<MapPermission> for MapPermission"],["impl SubAssign<PTEFlags> for PTEFlags"],["impl SubAssign<OpenFlags> for OpenFlags"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/core/ops/bit/trait.BitAnd.js b/ch6-dev/implementors/core/ops/bit/trait.BitAnd.js index 6dda9914..8c814d78 100644 --- a/ch6-dev/implementors/core/ops/bit/trait.BitAnd.js +++ b/ch6-dev/implementors/core/ops/bit/trait.BitAnd.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = [{"text":"impl BitAnd<OpenFlags> for OpenFlags","synthetic":false,"types":["os::fs::inode::OpenFlags"]},{"text":"impl BitAnd<MapPermission> for MapPermission","synthetic":false,"types":["os::mm::memory_set::MapPermission"]},{"text":"impl BitAnd<PTEFlags> for PTEFlags","synthetic":false,"types":["os::mm::page_table::PTEFlags"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[["impl BitAnd<MapPermission> for MapPermission"],["impl BitAnd<OpenFlags> for OpenFlags"],["impl BitAnd<PTEFlags> for PTEFlags"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/core/ops/bit/trait.BitAndAssign.js b/ch6-dev/implementors/core/ops/bit/trait.BitAndAssign.js index 5c07e9a4..11796347 100644 --- a/ch6-dev/implementors/core/ops/bit/trait.BitAndAssign.js +++ b/ch6-dev/implementors/core/ops/bit/trait.BitAndAssign.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = [{"text":"impl BitAndAssign<OpenFlags> for OpenFlags","synthetic":false,"types":["os::fs::inode::OpenFlags"]},{"text":"impl BitAndAssign<MapPermission> for MapPermission","synthetic":false,"types":["os::mm::memory_set::MapPermission"]},{"text":"impl BitAndAssign<PTEFlags> for PTEFlags","synthetic":false,"types":["os::mm::page_table::PTEFlags"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[["impl BitAndAssign<PTEFlags> for PTEFlags"],["impl BitAndAssign<MapPermission> for MapPermission"],["impl BitAndAssign<OpenFlags> for OpenFlags"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/core/ops/bit/trait.BitOr.js b/ch6-dev/implementors/core/ops/bit/trait.BitOr.js index e98eebf6..ca24c930 100644 --- a/ch6-dev/implementors/core/ops/bit/trait.BitOr.js +++ b/ch6-dev/implementors/core/ops/bit/trait.BitOr.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = [{"text":"impl BitOr<OpenFlags> for OpenFlags","synthetic":false,"types":["os::fs::inode::OpenFlags"]},{"text":"impl BitOr<MapPermission> for MapPermission","synthetic":false,"types":["os::mm::memory_set::MapPermission"]},{"text":"impl BitOr<PTEFlags> for PTEFlags","synthetic":false,"types":["os::mm::page_table::PTEFlags"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[["impl BitOr<MapPermission> for MapPermission"],["impl BitOr<PTEFlags> for PTEFlags"],["impl BitOr<OpenFlags> for OpenFlags"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/core/ops/bit/trait.BitOrAssign.js b/ch6-dev/implementors/core/ops/bit/trait.BitOrAssign.js index e318953c..ff4e8b34 100644 --- a/ch6-dev/implementors/core/ops/bit/trait.BitOrAssign.js +++ b/ch6-dev/implementors/core/ops/bit/trait.BitOrAssign.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = [{"text":"impl BitOrAssign<OpenFlags> for OpenFlags","synthetic":false,"types":["os::fs::inode::OpenFlags"]},{"text":"impl BitOrAssign<MapPermission> for MapPermission","synthetic":false,"types":["os::mm::memory_set::MapPermission"]},{"text":"impl BitOrAssign<PTEFlags> for PTEFlags","synthetic":false,"types":["os::mm::page_table::PTEFlags"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[["impl BitOrAssign<PTEFlags> for PTEFlags"],["impl BitOrAssign<MapPermission> for MapPermission"],["impl BitOrAssign<OpenFlags> for OpenFlags"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/core/ops/bit/trait.BitXor.js b/ch6-dev/implementors/core/ops/bit/trait.BitXor.js index f505e2c2..4dd36885 100644 --- a/ch6-dev/implementors/core/ops/bit/trait.BitXor.js +++ b/ch6-dev/implementors/core/ops/bit/trait.BitXor.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = [{"text":"impl BitXor<OpenFlags> for OpenFlags","synthetic":false,"types":["os::fs::inode::OpenFlags"]},{"text":"impl BitXor<MapPermission> for MapPermission","synthetic":false,"types":["os::mm::memory_set::MapPermission"]},{"text":"impl BitXor<PTEFlags> for PTEFlags","synthetic":false,"types":["os::mm::page_table::PTEFlags"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[["impl BitXor<PTEFlags> for PTEFlags"],["impl BitXor<OpenFlags> for OpenFlags"],["impl BitXor<MapPermission> for MapPermission"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/core/ops/bit/trait.BitXorAssign.js b/ch6-dev/implementors/core/ops/bit/trait.BitXorAssign.js index f072c399..cf43bb87 100644 --- a/ch6-dev/implementors/core/ops/bit/trait.BitXorAssign.js +++ b/ch6-dev/implementors/core/ops/bit/trait.BitXorAssign.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = [{"text":"impl BitXorAssign<OpenFlags> for OpenFlags","synthetic":false,"types":["os::fs::inode::OpenFlags"]},{"text":"impl BitXorAssign<MapPermission> for MapPermission","synthetic":false,"types":["os::mm::memory_set::MapPermission"]},{"text":"impl BitXorAssign<PTEFlags> for PTEFlags","synthetic":false,"types":["os::mm::page_table::PTEFlags"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[["impl BitXorAssign<OpenFlags> for OpenFlags"],["impl BitXorAssign<PTEFlags> for PTEFlags"],["impl BitXorAssign<MapPermission> for MapPermission"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/core/ops/bit/trait.Not.js b/ch6-dev/implementors/core/ops/bit/trait.Not.js index 7296dfa3..abaf9685 100644 --- a/ch6-dev/implementors/core/ops/bit/trait.Not.js +++ b/ch6-dev/implementors/core/ops/bit/trait.Not.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = [{"text":"impl Not for OpenFlags","synthetic":false,"types":["os::fs::inode::OpenFlags"]},{"text":"impl Not for MapPermission","synthetic":false,"types":["os::mm::memory_set::MapPermission"]},{"text":"impl Not for PTEFlags","synthetic":false,"types":["os::mm::page_table::PTEFlags"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[["impl Not for MapPermission"],["impl Not for OpenFlags"],["impl Not for PTEFlags"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/core/ops/deref/trait.Deref.js b/ch6-dev/implementors/core/ops/deref/trait.Deref.js index 6ae1942f..f88aad55 100644 --- a/ch6-dev/implementors/core/ops/deref/trait.Deref.js +++ b/ch6-dev/implementors/core/ops/deref/trait.Deref.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = [{"text":"impl Deref for PERIPHERALS","synthetic":false,"types":["os::drivers::block::sdcard::PERIPHERALS"]},{"text":"impl Deref for QUEUE_FRAMES","synthetic":false,"types":["os::drivers::block::virtio_blk::QUEUE_FRAMES"]},{"text":"impl Deref for BLOCK_DEVICE","synthetic":false,"types":["os::drivers::block::BLOCK_DEVICE"]},{"text":"impl Deref for ROOT_INODE","synthetic":false,"types":["os::fs::inode::ROOT_INODE"]},{"text":"impl Deref for FRAME_ALLOCATOR","synthetic":false,"types":["os::mm::frame_allocator::FRAME_ALLOCATOR"]},{"text":"impl Deref for KERNEL_SPACE","synthetic":false,"types":["os::mm::memory_set::KERNEL_SPACE"]},{"text":"impl Deref for TASK_MANAGER","synthetic":false,"types":["os::task::manager::TASK_MANAGER"]},{"text":"impl Deref for PID_ALLOCATOR","synthetic":false,"types":["os::task::pid::PID_ALLOCATOR"]},{"text":"impl Deref for PROCESSOR","synthetic":false,"types":["os::task::processor::PROCESSOR"]},{"text":"impl Deref for INITPROC","synthetic":false,"types":["os::task::INITPROC"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[["impl Deref for QUEUE_FRAMES"],["impl Deref for FRAME_ALLOCATOR"],["impl Deref for INITPROC"],["impl Deref for KERNEL_SPACE"],["impl Deref for ROOT_INODE"],["impl Deref for PID_ALLOCATOR"],["impl Deref for BLOCK_DEVICE"],["impl Deref for TASK_MANAGER"],["impl Deref for PROCESSOR"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/core/ops/drop/trait.Drop.js b/ch6-dev/implementors/core/ops/drop/trait.Drop.js index 3c6fba4e..f0eb8cff 100644 --- a/ch6-dev/implementors/core/ops/drop/trait.Drop.js +++ b/ch6-dev/implementors/core/ops/drop/trait.Drop.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = [{"text":"impl Drop for FrameTracker","synthetic":false,"types":["os::mm::frame_allocator::FrameTracker"]},{"text":"impl Drop for PidHandle","synthetic":false,"types":["os::task::pid::PidHandle"]},{"text":"impl Drop for KernelStack","synthetic":false,"types":["os::task::pid::KernelStack"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[["impl Drop for KernelStack"],["impl Drop for FrameTracker"],["impl Drop for PidHandle"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/core/panic/unwind_safe/trait.RefUnwindSafe.js b/ch6-dev/implementors/core/panic/unwind_safe/trait.RefUnwindSafe.js index 58e12f35..a851e68b 100644 --- a/ch6-dev/implementors/core/panic/unwind_safe/trait.RefUnwindSafe.js +++ b/ch6-dev/implementors/core/panic/unwind_safe/trait.RefUnwindSafe.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = [{"text":"impl RefUnwindSafe for RISCV64","synthetic":true,"types":["os::board::RISCV64"]},{"text":"impl RefUnwindSafe for Stdout","synthetic":true,"types":["os::console::Stdout"]},{"text":"impl<SPI> RefUnwindSafe for SDCard<SPI> where
    SPI: RefUnwindSafe
","synthetic":true,"types":["os::drivers::block::sdcard::SDCard"]},{"text":"impl RefUnwindSafe for CMD","synthetic":true,"types":["os::drivers::block::sdcard::CMD"]},{"text":"impl RefUnwindSafe for InitError","synthetic":true,"types":["os::drivers::block::sdcard::InitError"]},{"text":"impl RefUnwindSafe for SDCardCSD","synthetic":true,"types":["os::drivers::block::sdcard::SDCardCSD"]},{"text":"impl RefUnwindSafe for SDCardCID","synthetic":true,"types":["os::drivers::block::sdcard::SDCardCID"]},{"text":"impl RefUnwindSafe for SDCardInfo","synthetic":true,"types":["os::drivers::block::sdcard::SDCardInfo"]},{"text":"impl RefUnwindSafe for PERIPHERALS","synthetic":true,"types":["os::drivers::block::sdcard::PERIPHERALS"]},{"text":"impl !RefUnwindSafe for SDCardWrapper","synthetic":true,"types":["os::drivers::block::sdcard::SDCardWrapper"]},{"text":"impl !RefUnwindSafe for VirtIOBlock","synthetic":true,"types":["os::drivers::block::virtio_blk::VirtIOBlock"]},{"text":"impl RefUnwindSafe for QUEUE_FRAMES","synthetic":true,"types":["os::drivers::block::virtio_blk::QUEUE_FRAMES"]},{"text":"impl RefUnwindSafe for BLOCK_DEVICE","synthetic":true,"types":["os::drivers::block::BLOCK_DEVICE"]},{"text":"impl !RefUnwindSafe for OSInode","synthetic":true,"types":["os::fs::inode::OSInode"]},{"text":"impl !RefUnwindSafe for OSInodeInner","synthetic":true,"types":["os::fs::inode::OSInodeInner"]},{"text":"impl RefUnwindSafe for ROOT_INODE","synthetic":true,"types":["os::fs::inode::ROOT_INODE"]},{"text":"impl RefUnwindSafe for OpenFlags","synthetic":true,"types":["os::fs::inode::OpenFlags"]},{"text":"impl RefUnwindSafe for Stdin","synthetic":true,"types":["os::fs::stdio::Stdin"]},{"text":"impl RefUnwindSafe for Stdout","synthetic":true,"types":["os::fs::stdio::Stdout"]},{"text":"impl RefUnwindSafe for PhysAddr","synthetic":true,"types":["os::mm::address::PhysAddr"]},{"text":"impl RefUnwindSafe for VirtAddr","synthetic":true,"types":["os::mm::address::VirtAddr"]},{"text":"impl RefUnwindSafe for PhysPageNum","synthetic":true,"types":["os::mm::address::PhysPageNum"]},{"text":"impl RefUnwindSafe for VirtPageNum","synthetic":true,"types":["os::mm::address::VirtPageNum"]},{"text":"impl<T> RefUnwindSafe for SimpleRange<T> where
    T: RefUnwindSafe
","synthetic":true,"types":["os::mm::address::SimpleRange"]},{"text":"impl<T> RefUnwindSafe for SimpleRangeIterator<T> where
    T: RefUnwindSafe
","synthetic":true,"types":["os::mm::address::SimpleRangeIterator"]},{"text":"impl RefUnwindSafe for FrameTracker","synthetic":true,"types":["os::mm::frame_allocator::FrameTracker"]},{"text":"impl RefUnwindSafe for StackFrameAllocator","synthetic":true,"types":["os::mm::frame_allocator::StackFrameAllocator"]},{"text":"impl RefUnwindSafe for FRAME_ALLOCATOR","synthetic":true,"types":["os::mm::frame_allocator::FRAME_ALLOCATOR"]},{"text":"impl RefUnwindSafe for KERNEL_SPACE","synthetic":true,"types":["os::mm::memory_set::KERNEL_SPACE"]},{"text":"impl RefUnwindSafe for MemorySet","synthetic":true,"types":["os::mm::memory_set::MemorySet"]},{"text":"impl RefUnwindSafe for MapArea","synthetic":true,"types":["os::mm::memory_set::MapArea"]},{"text":"impl RefUnwindSafe for MapType","synthetic":true,"types":["os::mm::memory_set::MapType"]},{"text":"impl RefUnwindSafe for MapPermission","synthetic":true,"types":["os::mm::memory_set::MapPermission"]},{"text":"impl RefUnwindSafe for PTEFlags","synthetic":true,"types":["os::mm::page_table::PTEFlags"]},{"text":"impl RefUnwindSafe for PageTableEntry","synthetic":true,"types":["os::mm::page_table::PageTableEntry"]},{"text":"impl RefUnwindSafe for PageTable","synthetic":true,"types":["os::mm::page_table::PageTable"]},{"text":"impl RefUnwindSafe for UserBuffer","synthetic":true,"types":["os::mm::page_table::UserBuffer"]},{"text":"impl RefUnwindSafe for UserBufferIterator","synthetic":true,"types":["os::mm::page_table::UserBufferIterator"]},{"text":"impl<T> !RefUnwindSafe for UPSafeCell<T>","synthetic":true,"types":["os::sync::up::UPSafeCell"]},{"text":"impl RefUnwindSafe for TaskContext","synthetic":true,"types":["os::task::context::TaskContext"]},{"text":"impl !RefUnwindSafe for TaskManager","synthetic":true,"types":["os::task::manager::TaskManager"]},{"text":"impl RefUnwindSafe for TASK_MANAGER","synthetic":true,"types":["os::task::manager::TASK_MANAGER"]},{"text":"impl RefUnwindSafe for PidAllocator","synthetic":true,"types":["os::task::pid::PidAllocator"]},{"text":"impl RefUnwindSafe for PID_ALLOCATOR","synthetic":true,"types":["os::task::pid::PID_ALLOCATOR"]},{"text":"impl RefUnwindSafe for PidHandle","synthetic":true,"types":["os::task::pid::PidHandle"]},{"text":"impl RefUnwindSafe for KernelStack","synthetic":true,"types":["os::task::pid::KernelStack"]},{"text":"impl !RefUnwindSafe for Processor","synthetic":true,"types":["os::task::processor::Processor"]},{"text":"impl RefUnwindSafe for PROCESSOR","synthetic":true,"types":["os::task::processor::PROCESSOR"]},{"text":"impl !RefUnwindSafe for TaskControlBlock","synthetic":true,"types":["os::task::task::TaskControlBlock"]},{"text":"impl !RefUnwindSafe for TaskControlBlockInner","synthetic":true,"types":["os::task::task::TaskControlBlockInner"]},{"text":"impl RefUnwindSafe for TaskStatus","synthetic":true,"types":["os::task::task::TaskStatus"]},{"text":"impl RefUnwindSafe for INITPROC","synthetic":true,"types":["os::task::INITPROC"]},{"text":"impl RefUnwindSafe for TrapContext","synthetic":true,"types":["os::trap::context::TrapContext"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[["impl RefUnwindSafe for Stdout",1,["os::console::Stdout"]],["impl !RefUnwindSafe for VirtIOBlock",1,["os::drivers::block::virtio_blk::VirtIOBlock"]],["impl RefUnwindSafe for QUEUE_FRAMES",1,["os::drivers::block::virtio_blk::QUEUE_FRAMES"]],["impl RefUnwindSafe for VirtioHal",1,["os::drivers::block::virtio_blk::VirtioHal"]],["impl RefUnwindSafe for BLOCK_DEVICE",1,["os::drivers::block::BLOCK_DEVICE"]],["impl !RefUnwindSafe for OSInode",1,["os::fs::inode::OSInode"]],["impl !RefUnwindSafe for OSInodeInner",1,["os::fs::inode::OSInodeInner"]],["impl RefUnwindSafe for ROOT_INODE",1,["os::fs::inode::ROOT_INODE"]],["impl RefUnwindSafe for OpenFlags",1,["os::fs::inode::OpenFlags"]],["impl RefUnwindSafe for Stdin",1,["os::fs::stdio::Stdin"]],["impl RefUnwindSafe for Stdout",1,["os::fs::stdio::Stdout"]],["impl RefUnwindSafe for PhysAddr",1,["os::mm::address::PhysAddr"]],["impl RefUnwindSafe for VirtAddr",1,["os::mm::address::VirtAddr"]],["impl RefUnwindSafe for PhysPageNum",1,["os::mm::address::PhysPageNum"]],["impl RefUnwindSafe for VirtPageNum",1,["os::mm::address::VirtPageNum"]],["impl<T> RefUnwindSafe for SimpleRange<T>where\n T: RefUnwindSafe,",1,["os::mm::address::SimpleRange"]],["impl<T> RefUnwindSafe for SimpleRangeIterator<T>where\n T: RefUnwindSafe,",1,["os::mm::address::SimpleRangeIterator"]],["impl RefUnwindSafe for FrameTracker",1,["os::mm::frame_allocator::FrameTracker"]],["impl RefUnwindSafe for StackFrameAllocator",1,["os::mm::frame_allocator::StackFrameAllocator"]],["impl RefUnwindSafe for FRAME_ALLOCATOR",1,["os::mm::frame_allocator::FRAME_ALLOCATOR"]],["impl RefUnwindSafe for KERNEL_SPACE",1,["os::mm::memory_set::KERNEL_SPACE"]],["impl RefUnwindSafe for MemorySet",1,["os::mm::memory_set::MemorySet"]],["impl RefUnwindSafe for MapArea",1,["os::mm::memory_set::MapArea"]],["impl RefUnwindSafe for MapType",1,["os::mm::memory_set::MapType"]],["impl RefUnwindSafe for MapPermission",1,["os::mm::memory_set::MapPermission"]],["impl RefUnwindSafe for PTEFlags",1,["os::mm::page_table::PTEFlags"]],["impl RefUnwindSafe for PageTableEntry",1,["os::mm::page_table::PageTableEntry"]],["impl RefUnwindSafe for PageTable",1,["os::mm::page_table::PageTable"]],["impl RefUnwindSafe for UserBuffer",1,["os::mm::page_table::UserBuffer"]],["impl RefUnwindSafe for UserBufferIterator",1,["os::mm::page_table::UserBufferIterator"]],["impl<T> !RefUnwindSafe for UPSafeCell<T>",1,["os::sync::up::UPSafeCell"]],["impl RefUnwindSafe for RawExclusiveLock",1,["os::sync::up::RawExclusiveLock"]],["impl RefUnwindSafe for TaskContext",1,["os::task::context::TaskContext"]],["impl !RefUnwindSafe for TaskManager",1,["os::task::manager::TaskManager"]],["impl RefUnwindSafe for TASK_MANAGER",1,["os::task::manager::TASK_MANAGER"]],["impl RefUnwindSafe for PidAllocator",1,["os::task::pid::PidAllocator"]],["impl RefUnwindSafe for PID_ALLOCATOR",1,["os::task::pid::PID_ALLOCATOR"]],["impl RefUnwindSafe for PidHandle",1,["os::task::pid::PidHandle"]],["impl RefUnwindSafe for KernelStack",1,["os::task::pid::KernelStack"]],["impl !RefUnwindSafe for Processor",1,["os::task::processor::Processor"]],["impl RefUnwindSafe for PROCESSOR",1,["os::task::processor::PROCESSOR"]],["impl !RefUnwindSafe for TaskControlBlock",1,["os::task::task::TaskControlBlock"]],["impl !RefUnwindSafe for TaskControlBlockInner",1,["os::task::task::TaskControlBlockInner"]],["impl RefUnwindSafe for TaskStatus",1,["os::task::task::TaskStatus"]],["impl RefUnwindSafe for INITPROC",1,["os::task::INITPROC"]],["impl RefUnwindSafe for TrapContext",1,["os::trap::context::TrapContext"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/core/panic/unwind_safe/trait.UnwindSafe.js b/ch6-dev/implementors/core/panic/unwind_safe/trait.UnwindSafe.js index 42506d79..7ac235f0 100644 --- a/ch6-dev/implementors/core/panic/unwind_safe/trait.UnwindSafe.js +++ b/ch6-dev/implementors/core/panic/unwind_safe/trait.UnwindSafe.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = [{"text":"impl UnwindSafe for RISCV64","synthetic":true,"types":["os::board::RISCV64"]},{"text":"impl UnwindSafe for Stdout","synthetic":true,"types":["os::console::Stdout"]},{"text":"impl<SPI> UnwindSafe for SDCard<SPI> where
    SPI: UnwindSafe
","synthetic":true,"types":["os::drivers::block::sdcard::SDCard"]},{"text":"impl UnwindSafe for CMD","synthetic":true,"types":["os::drivers::block::sdcard::CMD"]},{"text":"impl UnwindSafe for InitError","synthetic":true,"types":["os::drivers::block::sdcard::InitError"]},{"text":"impl UnwindSafe for SDCardCSD","synthetic":true,"types":["os::drivers::block::sdcard::SDCardCSD"]},{"text":"impl UnwindSafe for SDCardCID","synthetic":true,"types":["os::drivers::block::sdcard::SDCardCID"]},{"text":"impl UnwindSafe for SDCardInfo","synthetic":true,"types":["os::drivers::block::sdcard::SDCardInfo"]},{"text":"impl UnwindSafe for PERIPHERALS","synthetic":true,"types":["os::drivers::block::sdcard::PERIPHERALS"]},{"text":"impl UnwindSafe for SDCardWrapper","synthetic":true,"types":["os::drivers::block::sdcard::SDCardWrapper"]},{"text":"impl !UnwindSafe for VirtIOBlock","synthetic":true,"types":["os::drivers::block::virtio_blk::VirtIOBlock"]},{"text":"impl UnwindSafe for QUEUE_FRAMES","synthetic":true,"types":["os::drivers::block::virtio_blk::QUEUE_FRAMES"]},{"text":"impl UnwindSafe for BLOCK_DEVICE","synthetic":true,"types":["os::drivers::block::BLOCK_DEVICE"]},{"text":"impl !UnwindSafe for OSInode","synthetic":true,"types":["os::fs::inode::OSInode"]},{"text":"impl !UnwindSafe for OSInodeInner","synthetic":true,"types":["os::fs::inode::OSInodeInner"]},{"text":"impl UnwindSafe for ROOT_INODE","synthetic":true,"types":["os::fs::inode::ROOT_INODE"]},{"text":"impl UnwindSafe for OpenFlags","synthetic":true,"types":["os::fs::inode::OpenFlags"]},{"text":"impl UnwindSafe for Stdin","synthetic":true,"types":["os::fs::stdio::Stdin"]},{"text":"impl UnwindSafe for Stdout","synthetic":true,"types":["os::fs::stdio::Stdout"]},{"text":"impl UnwindSafe for PhysAddr","synthetic":true,"types":["os::mm::address::PhysAddr"]},{"text":"impl UnwindSafe for VirtAddr","synthetic":true,"types":["os::mm::address::VirtAddr"]},{"text":"impl UnwindSafe for PhysPageNum","synthetic":true,"types":["os::mm::address::PhysPageNum"]},{"text":"impl UnwindSafe for VirtPageNum","synthetic":true,"types":["os::mm::address::VirtPageNum"]},{"text":"impl<T> UnwindSafe for SimpleRange<T> where
    T: UnwindSafe
","synthetic":true,"types":["os::mm::address::SimpleRange"]},{"text":"impl<T> UnwindSafe for SimpleRangeIterator<T> where
    T: UnwindSafe
","synthetic":true,"types":["os::mm::address::SimpleRangeIterator"]},{"text":"impl UnwindSafe for FrameTracker","synthetic":true,"types":["os::mm::frame_allocator::FrameTracker"]},{"text":"impl UnwindSafe for StackFrameAllocator","synthetic":true,"types":["os::mm::frame_allocator::StackFrameAllocator"]},{"text":"impl UnwindSafe for FRAME_ALLOCATOR","synthetic":true,"types":["os::mm::frame_allocator::FRAME_ALLOCATOR"]},{"text":"impl UnwindSafe for KERNEL_SPACE","synthetic":true,"types":["os::mm::memory_set::KERNEL_SPACE"]},{"text":"impl UnwindSafe for MemorySet","synthetic":true,"types":["os::mm::memory_set::MemorySet"]},{"text":"impl UnwindSafe for MapArea","synthetic":true,"types":["os::mm::memory_set::MapArea"]},{"text":"impl UnwindSafe for MapType","synthetic":true,"types":["os::mm::memory_set::MapType"]},{"text":"impl UnwindSafe for MapPermission","synthetic":true,"types":["os::mm::memory_set::MapPermission"]},{"text":"impl UnwindSafe for PTEFlags","synthetic":true,"types":["os::mm::page_table::PTEFlags"]},{"text":"impl UnwindSafe for PageTableEntry","synthetic":true,"types":["os::mm::page_table::PageTableEntry"]},{"text":"impl UnwindSafe for PageTable","synthetic":true,"types":["os::mm::page_table::PageTable"]},{"text":"impl !UnwindSafe for UserBuffer","synthetic":true,"types":["os::mm::page_table::UserBuffer"]},{"text":"impl !UnwindSafe for UserBufferIterator","synthetic":true,"types":["os::mm::page_table::UserBufferIterator"]},{"text":"impl<T> UnwindSafe for UPSafeCell<T> where
    T: UnwindSafe
","synthetic":true,"types":["os::sync::up::UPSafeCell"]},{"text":"impl UnwindSafe for TaskContext","synthetic":true,"types":["os::task::context::TaskContext"]},{"text":"impl !UnwindSafe for TaskManager","synthetic":true,"types":["os::task::manager::TaskManager"]},{"text":"impl UnwindSafe for TASK_MANAGER","synthetic":true,"types":["os::task::manager::TASK_MANAGER"]},{"text":"impl UnwindSafe for PidAllocator","synthetic":true,"types":["os::task::pid::PidAllocator"]},{"text":"impl UnwindSafe for PID_ALLOCATOR","synthetic":true,"types":["os::task::pid::PID_ALLOCATOR"]},{"text":"impl UnwindSafe for PidHandle","synthetic":true,"types":["os::task::pid::PidHandle"]},{"text":"impl UnwindSafe for KernelStack","synthetic":true,"types":["os::task::pid::KernelStack"]},{"text":"impl !UnwindSafe for Processor","synthetic":true,"types":["os::task::processor::Processor"]},{"text":"impl UnwindSafe for PROCESSOR","synthetic":true,"types":["os::task::processor::PROCESSOR"]},{"text":"impl !UnwindSafe for TaskControlBlock","synthetic":true,"types":["os::task::task::TaskControlBlock"]},{"text":"impl !UnwindSafe for TaskControlBlockInner","synthetic":true,"types":["os::task::task::TaskControlBlockInner"]},{"text":"impl UnwindSafe for TaskStatus","synthetic":true,"types":["os::task::task::TaskStatus"]},{"text":"impl UnwindSafe for INITPROC","synthetic":true,"types":["os::task::INITPROC"]},{"text":"impl UnwindSafe for TrapContext","synthetic":true,"types":["os::trap::context::TrapContext"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[["impl UnwindSafe for Stdout",1,["os::console::Stdout"]],["impl !UnwindSafe for VirtIOBlock",1,["os::drivers::block::virtio_blk::VirtIOBlock"]],["impl UnwindSafe for QUEUE_FRAMES",1,["os::drivers::block::virtio_blk::QUEUE_FRAMES"]],["impl UnwindSafe for VirtioHal",1,["os::drivers::block::virtio_blk::VirtioHal"]],["impl UnwindSafe for BLOCK_DEVICE",1,["os::drivers::block::BLOCK_DEVICE"]],["impl !UnwindSafe for OSInode",1,["os::fs::inode::OSInode"]],["impl !UnwindSafe for OSInodeInner",1,["os::fs::inode::OSInodeInner"]],["impl UnwindSafe for ROOT_INODE",1,["os::fs::inode::ROOT_INODE"]],["impl UnwindSafe for OpenFlags",1,["os::fs::inode::OpenFlags"]],["impl UnwindSafe for Stdin",1,["os::fs::stdio::Stdin"]],["impl UnwindSafe for Stdout",1,["os::fs::stdio::Stdout"]],["impl UnwindSafe for PhysAddr",1,["os::mm::address::PhysAddr"]],["impl UnwindSafe for VirtAddr",1,["os::mm::address::VirtAddr"]],["impl UnwindSafe for PhysPageNum",1,["os::mm::address::PhysPageNum"]],["impl UnwindSafe for VirtPageNum",1,["os::mm::address::VirtPageNum"]],["impl<T> UnwindSafe for SimpleRange<T>where\n T: UnwindSafe,",1,["os::mm::address::SimpleRange"]],["impl<T> UnwindSafe for SimpleRangeIterator<T>where\n T: UnwindSafe,",1,["os::mm::address::SimpleRangeIterator"]],["impl UnwindSafe for FrameTracker",1,["os::mm::frame_allocator::FrameTracker"]],["impl UnwindSafe for StackFrameAllocator",1,["os::mm::frame_allocator::StackFrameAllocator"]],["impl UnwindSafe for FRAME_ALLOCATOR",1,["os::mm::frame_allocator::FRAME_ALLOCATOR"]],["impl UnwindSafe for KERNEL_SPACE",1,["os::mm::memory_set::KERNEL_SPACE"]],["impl UnwindSafe for MemorySet",1,["os::mm::memory_set::MemorySet"]],["impl UnwindSafe for MapArea",1,["os::mm::memory_set::MapArea"]],["impl UnwindSafe for MapType",1,["os::mm::memory_set::MapType"]],["impl UnwindSafe for MapPermission",1,["os::mm::memory_set::MapPermission"]],["impl UnwindSafe for PTEFlags",1,["os::mm::page_table::PTEFlags"]],["impl UnwindSafe for PageTableEntry",1,["os::mm::page_table::PageTableEntry"]],["impl UnwindSafe for PageTable",1,["os::mm::page_table::PageTable"]],["impl !UnwindSafe for UserBuffer",1,["os::mm::page_table::UserBuffer"]],["impl !UnwindSafe for UserBufferIterator",1,["os::mm::page_table::UserBufferIterator"]],["impl<T> UnwindSafe for UPSafeCell<T>where\n T: UnwindSafe,",1,["os::sync::up::UPSafeCell"]],["impl UnwindSafe for RawExclusiveLock",1,["os::sync::up::RawExclusiveLock"]],["impl UnwindSafe for TaskContext",1,["os::task::context::TaskContext"]],["impl !UnwindSafe for TaskManager",1,["os::task::manager::TaskManager"]],["impl UnwindSafe for TASK_MANAGER",1,["os::task::manager::TASK_MANAGER"]],["impl UnwindSafe for PidAllocator",1,["os::task::pid::PidAllocator"]],["impl UnwindSafe for PID_ALLOCATOR",1,["os::task::pid::PID_ALLOCATOR"]],["impl UnwindSafe for PidHandle",1,["os::task::pid::PidHandle"]],["impl UnwindSafe for KernelStack",1,["os::task::pid::KernelStack"]],["impl !UnwindSafe for Processor",1,["os::task::processor::Processor"]],["impl UnwindSafe for PROCESSOR",1,["os::task::processor::PROCESSOR"]],["impl !UnwindSafe for TaskControlBlock",1,["os::task::task::TaskControlBlock"]],["impl !UnwindSafe for TaskControlBlockInner",1,["os::task::task::TaskControlBlockInner"]],["impl UnwindSafe for TaskStatus",1,["os::task::task::TaskStatus"]],["impl UnwindSafe for INITPROC",1,["os::task::INITPROC"]],["impl UnwindSafe for TrapContext",1,["os::trap::context::TrapContext"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/easy_fs/block_dev/trait.BlockDevice.js b/ch6-dev/implementors/easy_fs/block_dev/trait.BlockDevice.js index 1a85f316..d4446681 100644 --- a/ch6-dev/implementors/easy_fs/block_dev/trait.BlockDevice.js +++ b/ch6-dev/implementors/easy_fs/block_dev/trait.BlockDevice.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = [{"text":"impl BlockDevice for SDCardWrapper","synthetic":false,"types":["os::drivers::block::sdcard::SDCardWrapper"]},{"text":"impl BlockDevice for VirtIOBlock","synthetic":false,"types":["os::drivers::block::virtio_blk::VirtIOBlock"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[["impl BlockDevice for VirtIOBlock"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/lazy_static/trait.LazyStatic.js b/ch6-dev/implementors/lazy_static/trait.LazyStatic.js index 29c0f64a..46d32a71 100644 --- a/ch6-dev/implementors/lazy_static/trait.LazyStatic.js +++ b/ch6-dev/implementors/lazy_static/trait.LazyStatic.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = [{"text":"impl LazyStatic for PERIPHERALS","synthetic":false,"types":["os::drivers::block::sdcard::PERIPHERALS"]},{"text":"impl LazyStatic for QUEUE_FRAMES","synthetic":false,"types":["os::drivers::block::virtio_blk::QUEUE_FRAMES"]},{"text":"impl LazyStatic for BLOCK_DEVICE","synthetic":false,"types":["os::drivers::block::BLOCK_DEVICE"]},{"text":"impl LazyStatic for ROOT_INODE","synthetic":false,"types":["os::fs::inode::ROOT_INODE"]},{"text":"impl LazyStatic for FRAME_ALLOCATOR","synthetic":false,"types":["os::mm::frame_allocator::FRAME_ALLOCATOR"]},{"text":"impl LazyStatic for KERNEL_SPACE","synthetic":false,"types":["os::mm::memory_set::KERNEL_SPACE"]},{"text":"impl LazyStatic for TASK_MANAGER","synthetic":false,"types":["os::task::manager::TASK_MANAGER"]},{"text":"impl LazyStatic for PID_ALLOCATOR","synthetic":false,"types":["os::task::pid::PID_ALLOCATOR"]},{"text":"impl LazyStatic for PROCESSOR","synthetic":false,"types":["os::task::processor::PROCESSOR"]},{"text":"impl LazyStatic for INITPROC","synthetic":false,"types":["os::task::INITPROC"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[["impl LazyStatic for FRAME_ALLOCATOR"],["impl LazyStatic for QUEUE_FRAMES"],["impl LazyStatic for ROOT_INODE"],["impl LazyStatic for INITPROC"],["impl LazyStatic for PROCESSOR"],["impl LazyStatic for PID_ALLOCATOR"],["impl LazyStatic for KERNEL_SPACE"],["impl LazyStatic for TASK_MANAGER"],["impl LazyStatic for BLOCK_DEVICE"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/lock_api/mutex/trait.RawMutex.js b/ch6-dev/implementors/lock_api/mutex/trait.RawMutex.js new file mode 100644 index 00000000..4e85847f --- /dev/null +++ b/ch6-dev/implementors/lock_api/mutex/trait.RawMutex.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"os":[["impl RawMutex for RawExclusiveLock"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/os/board/trait.QEMUExit.js b/ch6-dev/implementors/os/board/trait.QEMUExit.js deleted file mode 100644 index 34fffcbd..00000000 --- a/ch6-dev/implementors/os/board/trait.QEMUExit.js +++ /dev/null @@ -1,3 +0,0 @@ -(function() {var implementors = {}; -implementors["os"] = []; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/os/fs/trait.File.js b/ch6-dev/implementors/os/fs/trait.File.js index 34fffcbd..f0f0a3ce 100644 --- a/ch6-dev/implementors/os/fs/trait.File.js +++ b/ch6-dev/implementors/os/fs/trait.File.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = []; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/os/mm/address/trait.StepByOne.js b/ch6-dev/implementors/os/mm/address/trait.StepByOne.js index 34fffcbd..f0f0a3ce 100644 --- a/ch6-dev/implementors/os/mm/address/trait.StepByOne.js +++ b/ch6-dev/implementors/os/mm/address/trait.StepByOne.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = []; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/os/mm/frame_allocator/trait.FrameAllocator.js b/ch6-dev/implementors/os/mm/frame_allocator/trait.FrameAllocator.js index 34fffcbd..f0f0a3ce 100644 --- a/ch6-dev/implementors/os/mm/frame_allocator/trait.FrameAllocator.js +++ b/ch6-dev/implementors/os/mm/frame_allocator/trait.FrameAllocator.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["os"] = []; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"os":[] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/implementors/virtio_drivers/hal/trait.Hal.js b/ch6-dev/implementors/virtio_drivers/hal/trait.Hal.js new file mode 100644 index 00000000..be4a87c5 --- /dev/null +++ b/ch6-dev/implementors/virtio_drivers/hal/trait.Hal.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"os":[["impl Hal for VirtioHal"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch6-dev/light.css b/ch6-dev/light.css deleted file mode 100644 index 289f10cf..00000000 --- a/ch6-dev/light.css +++ /dev/null @@ -1 +0,0 @@ - body{background-color:white;color:black;}h1,h2,h3,h4{color:black;}h1.fqn{border-bottom-color:#DDDDDD;}h2,h3,h4{border-bottom-color:#DDDDDD;}.in-band{background-color:white;}.invisible{background:rgba(0,0,0,0);}.docblock code,.docblock-short code{background-color:#F5F5F5;}pre,.rustdoc.source .example-wrap{background-color:#F5F5F5;}.sidebar,.mobile-topbar,.sidebar-menu-toggle{background-color:#F5F5F5;}*{scrollbar-color:rgba(36,37,39,0.6) #e6e6e6;}.sidebar{scrollbar-color:rgba(36,37,39,0.6) #d9d9d9;}.rust-logo{}::-webkit-scrollbar-track{background-color:#ecebeb;}::-webkit-scrollbar-thumb{background-color:rgba(36,37,39,0.6);}.sidebar::-webkit-scrollbar-track{background-color:#dcdcdc;}.sidebar::-webkit-scrollbar-thumb{background-color:rgba(36,37,39,0.6);}.sidebar .current,.sidebar a:hover{background-color:#fff;}.source .sidebar{background-color:#f1f1f1;}.line-numbers span{color:#c67e2d;}.line-numbers .line-highlighted{background-color:#FDFFD3 !important;}.docblock h1,.docblock h2,.docblock h3,.docblock h4,.docblock h5,.docblock h6{border-bottom-color:#ddd;}.docblock table td,.docblock table th{border-color:#ddd;}.content .method .where,.content .fn .where,.content .where.fmt-newline{color:#4E4C4C;}.search-results a:hover{background-color:#ddd;}.search-results a:focus{color:#000 !important;background-color:#ccc;}.search-results a:focus span{color:#000 !important;}a.result-trait:focus{background-color:#c7b6ff;}a.result-traitalias:focus{background-color:#c7b6ff;}a.result-mod:focus,a.result-externcrate:focus{background-color:#afc6e4;}a.result-enum:focus{background-color:#e7b1a0;}a.result-struct:focus{background-color:#e7b1a0;}a.result-union:focus{background-color:#e7b1a0;}a.result-fn:focus,a.result-method:focus,a.result-tymethod:focus{background-color:#c6afb3;}a.result-type:focus{background-color:#e7b1a0;}a.result-associatedtype:focus{background-color:#afc6e4;}a.result-foreigntype:focus{background-color:#e7b1a0;}a.result-attr:focus,a.result-derive:focus,a.result-macro:focus{background-color:#8ce488;}a.result-constant:focus,a.result-static:focus{background-color:#afc6e4;}a.result-primitive:focus{background-color:#e7b1a0;}a.result-keyword:focus{background-color:#afc6e4;}.content .item-info::before{color:#ccc;}.content span.enum,.content a.enum,.block a.current.enum{color:#AD378A;}.content span.struct,.content a.struct,.block a.current.struct{color:#AD378A;}.content span.type,.content a.type,.block a.current.type{color:#AD378A;}.content span.foreigntype,.content a.foreigntype,.block a.current.foreigntype{color:#3873AD;}.content span.associatedtype,.content a.associatedtype,.block a.current.associatedtype{color:#3873AD;}.content span.attr,.content a.attr,.block a.current.attr,.content span.derive,.content a.derive,.block a.current.derive,.content span.macro,.content a.macro,.block a.current.macro{color:#068000;}.content span.union,.content a.union,.block a.current.union{color:#AD378A;}.content span.constant,.content a.constant,.block a.current.constant,.content span.static,.content a.static,.block a.current.static{color:#3873AD;}.content span.primitive,.content a.primitive,.block a.current.primitive{color:#AD378A;}.content span.externcrate,.content span.mod,.content a.mod,.block a.current.mod{color:#3873AD;}.content span.trait,.content a.trait,.block a.current.trait{color:#6E4FC9;}.content span.traitalias,.content a.traitalias,.block a.current.traitalias{color:#5137AD;}.content span.fn,.content a.fn,.block a.current.fn,.content span.method,.content a.method,.block a.current.method,.content span.tymethod,.content a.tymethod,.block a.current.tymethod,.content .fnname{color:#AD7C37;}.content span.keyword,.content a.keyword,.block a.current.keyword{color:#3873AD;}.sidebar a{color:#356da4;}.sidebar a.current.enum{color:#a63283;}.sidebar a.current.struct{color:#a63283;}.sidebar a.current.type{color:#a63283;}.sidebar a.current.associatedtype{color:#356da4;}.sidebar a.current.foreigntype{color:#356da4;}.sidebar a.current.attr,.sidebar a.current.derive,.sidebar a.current.macro{color:#067901;}.sidebar a.current.union{color:#a63283;}.sidebar a.current.constant .sidebar a.current.static{color:#356da4;}.sidebar a.current.primitive{color:#a63283;}.sidebar a.current.externcrate .sidebar a.current.mod{color:#356da4;}.sidebar a.current.trait{color:#6849c3;}.sidebar a.current.traitalias{color:#4b349e;}.sidebar a.current.fn,.sidebar a.current.method,.sidebar a.current.tymethod{color:#a67736;}.sidebar a.current.keyword{color:#356da4;}nav.main .current{border-top-color:#000;border-bottom-color:#000;}nav.main .separator{border:1px solid #000;}a{color:#3873AD;}a#toggle-all-docs,a.anchor,.small-section-header a,#source-sidebar a,pre.rust a,.sidebar h2 a,.sidebar h3 a,.mobile-topbar h2 a,.in-band a{color:#000;}.search-results a{color:initial;}a.test-arrow{color:#f5f5f5;}body.source .example-wrap pre.rust a{background:#eee;}details.rustdoc-toggle>summary.hideme>span,details.rustdoc-toggle>summary::before,details.undocumented>summary::before{color:#999;}#crate-search,.search-input{color:#555;background-color:white;border-color:#e0e0e0;}.search-input:focus{border-color:#66afe9;}.module-item .stab,.import-item .stab{color:#000;}.stab.unstable{background:#FFF5D6;border-color:#FFC600;}.stab.deprecated{background:#ffc4c4;border-color:#db7b7b;}.stab.portability{background:#F3DFFF;border-color:#b07bdb;}.stab.portability>code{background:none;}#help>div{background:#e9e9e9;border-color:#bfbfbf;}#help span.bottom,#help span.top{border-color:#bfbfbf;}.rightside,.out-of-band{color:grey;}.result-name .primitive>i,.result-name .keyword>i{color:black;}.line-numbers :target{background-color:transparent;}pre.rust .kw{color:#8959A8;}pre.rust .kw-2,pre.rust .prelude-ty{color:#4271AE;}pre.rust .number,pre.rust .string{color:#718C00;}pre.rust .self,pre.rust .bool-val,pre.rust .prelude-val,pre.rust .attribute,pre.rust .attribute .ident{color:#C82829;}pre.rust .comment{color:#8E908C;}pre.rust .doccomment{color:#4D4D4C;}pre.rust .macro,pre.rust .macro-nonterminal{color:#3E999F;}pre.rust .lifetime{color:#B76514;}pre.rust .question-mark{color:#ff9011;}.example-wrap>pre.line-number{border-color:#c7c7c7;}a.test-arrow{background-color:rgb(78,139,202,0.2);}a.test-arrow:hover{background-color:#4e8bca;}.toggle-label,.code-attribute{color:#999;}:target{background:#FDFFD3;border-right:3px solid #AD7C37;}pre.compile_fail{border-left:2px solid rgba(255,0,0,.5);}pre.compile_fail:hover,.information:hover+pre.compile_fail{border-left:2px solid #f00;}pre.should_panic{border-left:2px solid rgba(255,0,0,.5);}pre.should_panic:hover,.information:hover+pre.should_panic{border-left:2px solid #f00;}pre.ignore{border-left:2px solid rgba(255,142,0,.6);}pre.ignore:hover,.information:hover+pre.ignore{border-left:2px solid #ff9200;}.tooltip.compile_fail{color:rgba(255,0,0,.5);}.information>.compile_fail:hover{color:#f00;}.tooltip.should_panic{color:rgba(255,0,0,.5);}.information>.should_panic:hover{color:#f00;}.tooltip.ignore{color:rgba(255,142,0,.6);}.information>.ignore:hover{color:#ff9200;}.search-failed a{color:#3873AD;}.tooltip::after{background-color:#000;color:#fff;}.tooltip::before{border-color:transparent black transparent transparent;}.notable-traits-tooltiptext{background-color:#eee;border-color:#999;}.notable-traits-tooltiptext .notable{border-bottom-color:#DDDDDD;}#titles>button:not(.selected){background-color:#e6e6e6;border-top-color:#e6e6e6;}#titles>button:hover,#titles>button.selected{background-color:#ffffff;border-top-color:#0089ff;}#titles>button>div.count{color:#888;}@media (max-width:700px){.sidebar-menu{background-color:#F5F5F5;border-bottom-color:#e0e0e0;border-right-color:#e0e0e0;}.sidebar-elems{background-color:#F5F5F5;border-right-color:#000;}#sidebar-filler{background-color:#F5F5F5;border-bottom-color:#e0e0e0;}}kbd{color:#000;background-color:#fafbfc;border-color:#d1d5da;border-bottom-color:#c6cbd1;box-shadow:inset 0 -1px 0 #c6cbd1;}#theme-picker,#settings-menu,#help-button{border-color:#e0e0e0;background-color:#fff;}#theme-picker:hover,#theme-picker:focus,#settings-menu:hover,#settings-menu:focus,#help-button:hover,#help-button:focus{border-color:#717171;}#copy-path{color:#999;}#copy-path>img{filter:invert(50%);}#copy-path:hover>img{filter:invert(35%);}#theme-choices{border-color:#ccc;background-color:#fff;}#theme-choices>button:not(:first-child){border-top-color:#e0e0e0;}#theme-choices>button:hover,#theme-choices>button:focus{background-color:#eee;}@media (max-width:700px){#theme-picker{background:#fff;}}.search-results .result-name span.alias{color:#000;}.search-results .result-name span.grey{color:#999;}#sidebar-toggle{background-color:#F5F5F5;}#sidebar-toggle:hover{background-color:#E0E0E0;}#source-sidebar{background-color:#F5F5F5;}#source-sidebar>.title{border-bottom-color:#ccc;}div.files>a:hover,div.name:hover{background-color:#E0E0E0;}div.files>.selected{background-color:#fff;}.setting-line>.title{border-bottom-color:#D5D5D5;} \ No newline at end of file diff --git a/ch6-dev/main.js b/ch6-dev/main.js deleted file mode 100644 index 5c0ce8ad..00000000 --- a/ch6-dev/main.js +++ /dev/null @@ -1,8 +0,0 @@ -if(!String.prototype.startsWith){String.prototype.startsWith=function(searchString,position){position=position||0;return this.indexOf(searchString,position)===position}}if(!String.prototype.endsWith){String.prototype.endsWith=function(suffix,length){var l=length||this.length;return this.indexOf(suffix,l-suffix.length)!==-1}}if(!DOMTokenList.prototype.add){DOMTokenList.prototype.add=function(className){if(className&&!hasClass(this,className)){if(this.className&&this.className.length>0){this.className+=" "+className}else{this.className=className}}}}if(!DOMTokenList.prototype.remove){DOMTokenList.prototype.remove=function(className){if(className&&this.className){this.className=(" "+this.className+" ").replace(" "+className+" "," ").trim()}}}function getVar(name){var el=document.getElementById("rustdoc-vars");if(el){return el.attributes["data-"+name].value}else{return null}}function resourcePath(basename,extension){return getVar("root-path")+basename+getVar("resource-suffix")+extension}(function(){window.rootPath=getVar("root-path");window.currentCrate=getVar("current-crate");window.searchJS=resourcePath("search",".js");window.searchIndexJS=resourcePath("search-index",".js");var sidebarVars=document.getElementById("sidebar-vars");if(sidebarVars){window.sidebarCurrent={name:sidebarVars.attributes["data-name"].value,ty:sidebarVars.attributes["data-ty"].value,relpath:sidebarVars.attributes["data-relpath"].value,};var mobileLocationTitle=document.querySelector(".mobile-topbar h2.location");var locationTitle=document.querySelector(".sidebar h2.location");if(mobileLocationTitle&&locationTitle){mobileLocationTitle.innerHTML=locationTitle.innerHTML}}}());function getVirtualKey(ev){if("key"in ev&&typeof ev.key!="undefined"){return ev.key}var c=ev.charCode||ev.keyCode;if(c==27){return"Escape"}return String.fromCharCode(c)}var THEME_PICKER_ELEMENT_ID="theme-picker";var THEMES_ELEMENT_ID="theme-choices";var MAIN_ID="main-content";function getThemesElement(){return document.getElementById(THEMES_ELEMENT_ID)}function getThemePickerElement(){return document.getElementById(THEME_PICKER_ELEMENT_ID)}function getNakedUrl(){return window.location.href.split("?")[0].split("#")[0]}function showThemeButtonState(){var themePicker=getThemePickerElement();var themeChoices=getThemesElement();themeChoices.style.display="block";themePicker.style.borderBottomRightRadius="0";themePicker.style.borderBottomLeftRadius="0"}function hideThemeButtonState(){var themePicker=getThemePickerElement();var themeChoices=getThemesElement();themeChoices.style.display="none";themePicker.style.borderBottomRightRadius="3px";themePicker.style.borderBottomLeftRadius="3px"}(function(){if(!document.location.href.startsWith("file:///")){return}var themeChoices=getThemesElement();var themePicker=getThemePickerElement();var availableThemes=getVar("themes").split(",");removeClass(themeChoices.parentElement,"hidden");function switchThemeButtonState(){if(themeChoices.style.display==="block"){hideThemeButtonState()}else{showThemeButtonState()}}function handleThemeButtonsBlur(e){var active=document.activeElement;var related=e.relatedTarget;if(active.id!==THEME_PICKER_ELEMENT_ID&&(!active.parentNode||active.parentNode.id!==THEMES_ELEMENT_ID)&&(!related||(related.id!==THEME_PICKER_ELEMENT_ID&&(!related.parentNode||related.parentNode.id!==THEMES_ELEMENT_ID)))){hideThemeButtonState()}}themePicker.onclick=switchThemeButtonState;themePicker.onblur=handleThemeButtonsBlur;availableThemes.forEach(function(item){var but=document.createElement("button");but.textContent=item;but.onclick=function(){switchTheme(window.currentTheme,window.mainTheme,item,true);useSystemTheme(false)};but.onblur=handleThemeButtonsBlur;themeChoices.appendChild(but)})}());(function(){"use strict";window.searchState={loadingText:"Loading search results...",input:document.getElementsByClassName("search-input")[0],outputElement:function(){return document.getElementById("search")},title:document.title,titleBeforeSearch:document.title,timeout:null,currentTab:0,focusedByTab:[null,null,null],clearInputTimeout:function(){if(searchState.timeout!==null){clearTimeout(searchState.timeout);searchState.timeout=null}},focus:function(){searchState.input.focus()},defocus:function(){searchState.input.blur()},showResults:function(search){if(search===null||typeof search==='undefined'){search=searchState.outputElement()}addClass(main,"hidden");removeClass(search,"hidden");searchState.mouseMovedAfterSearch=false;document.title=searchState.title},hideResults:function(search){if(search===null||typeof search==='undefined'){search=searchState.outputElement()}addClass(search,"hidden");removeClass(main,"hidden");document.title=searchState.titleBeforeSearch;if(searchState.browserSupportsHistoryApi()){history.replaceState(null,window.currentCrate+" - Rust",getNakedUrl()+window.location.hash)}},getQueryStringParams:function(){var params={};window.location.search.substring(1).split("&").map(function(s){var pair=s.split("=");params[decodeURIComponent(pair[0])]=typeof pair[1]==="undefined"?null:decodeURIComponent(pair[1])});return params},browserSupportsHistoryApi:function(){return window.history&&typeof window.history.pushState==="function"},setup:function(){var search_input=searchState.input;if(!searchState.input){return}function loadScript(url){var script=document.createElement('script');script.src=url;document.head.append(script)}var searchLoaded=false;function loadSearch(){if(!searchLoaded){searchLoaded=true;loadScript(window.searchJS);loadScript(window.searchIndexJS)}}search_input.addEventListener("focus",function(){search_input.origPlaceholder=search_input.placeholder;search_input.placeholder="Type your search here.";loadSearch()});if(search_input.value!=''){loadSearch()}var params=searchState.getQueryStringParams();if(params.search!==undefined){var search=searchState.outputElement();search.innerHTML="

"+searchState.loadingText+"

";searchState.showResults(search);loadSearch()}},};function getPageId(){if(window.location.hash){var tmp=window.location.hash.replace(/^#/,"");if(tmp.length>0){return tmp}}return null}var toggleAllDocsId="toggle-all-docs";var main=document.getElementById(MAIN_ID);var savedHash="";function handleHashes(ev){var elem;var search=searchState.outputElement();if(ev!==null&&search&&!hasClass(search,"hidden")&&ev.newURL){searchState.hideResults(search);var hash=ev.newURL.slice(ev.newURL.indexOf("#")+1);if(searchState.browserSupportsHistoryApi()){history.replaceState(null,"",getNakedUrl()+window.location.search+"#"+hash)}elem=document.getElementById(hash);if(elem){elem.scrollIntoView()}}if(savedHash!==window.location.hash){savedHash=window.location.hash;if(savedHash.length===0){return}expandSection(savedHash.slice(1))}}function onHashChange(ev){var sidebar=document.getElementsByClassName("sidebar")[0];removeClass(sidebar,"shown");handleHashes(ev)}function openParentDetails(elem){while(elem){if(elem.tagName==="DETAILS"){elem.open=true}elem=elem.parentNode}}function expandSection(id){openParentDetails(document.getElementById(id))}function getHelpElement(build){if(build){buildHelperPopup()}return document.getElementById("help")}function displayHelp(display,ev,help){if(display){help=help?help:getHelpElement(true);if(hasClass(help,"hidden")){ev.preventDefault();removeClass(help,"hidden");addClass(document.body,"blur")}}else{help=help?help:getHelpElement(false);if(help&&!hasClass(help,"hidden")){ev.preventDefault();addClass(help,"hidden");removeClass(document.body,"blur")}}}function handleEscape(ev){var help=getHelpElement(false);var search=searchState.outputElement();if(help&&!hasClass(help,"hidden")){displayHelp(false,ev,help)}else if(search&&!hasClass(search,"hidden")){searchState.clearInputTimeout();ev.preventDefault();searchState.hideResults(search)}searchState.defocus();hideThemeButtonState()}var disableShortcuts=getSettingValue("disable-shortcuts")==="true";function handleShortcut(ev){if(ev.ctrlKey||ev.altKey||ev.metaKey||disableShortcuts){return}if(document.activeElement.tagName==="INPUT"){switch(getVirtualKey(ev)){case"Escape":handleEscape(ev);break}}else{switch(getVirtualKey(ev)){case"Escape":handleEscape(ev);break;case"s":case"S":displayHelp(false,ev);ev.preventDefault();searchState.focus();break;case"+":case"-":ev.preventDefault();toggleAllDocs();break;case"?":displayHelp(true,ev);break;case"t":case"T":displayHelp(false,ev);ev.preventDefault();var themePicker=getThemePickerElement();themePicker.click();themePicker.focus();break;default:if(getThemePickerElement().parentNode.contains(ev.target)){handleThemeKeyDown(ev)}}}}function handleThemeKeyDown(ev){var active=document.activeElement;var themes=getThemesElement();switch(getVirtualKey(ev)){case"ArrowUp":ev.preventDefault();if(active.previousElementSibling&&ev.target.id!==THEME_PICKER_ELEMENT_ID){active.previousElementSibling.focus()}else{showThemeButtonState();themes.lastElementChild.focus()}break;case"ArrowDown":ev.preventDefault();if(active.nextElementSibling&&ev.target.id!==THEME_PICKER_ELEMENT_ID){active.nextElementSibling.focus()}else{showThemeButtonState();themes.firstElementChild.focus()}break;case"Enter":case"Return":case"Space":if(ev.target.id===THEME_PICKER_ELEMENT_ID&&themes.style.display==="none"){ev.preventDefault();showThemeButtonState();themes.firstElementChild.focus()}break;case"Home":ev.preventDefault();themes.firstElementChild.focus();break;case"End":ev.preventDefault();themes.lastElementChild.focus();break}}document.addEventListener("keypress",handleShortcut);document.addEventListener("keydown",handleShortcut);(function(){var x=document.getElementsByClassName("version-selector");if(x.length>0){x[0].onchange=function(){var i,match,url=document.location.href,stripped="",len=window.rootPath.match(/\.\.\//g).length+1;for(i=0;i${longty}`;div.appendChild(h3);var ul=document.createElement("ul");for(var i=0,len=filtered.length;i .in-band > .trait").textContent;var baseIdName="impl-"+traitName+"-";var libs=Object.getOwnPropertyNames(imp);for(var i=0,llength=libs.length;i summary:not(.hideme)"),function(el){el.addEventListener("click",function(e){if(e.target.tagName!="SUMMARY"&&e.target.tagName!="A"){e.preventDefault()}})});onEachLazy(document.getElementsByClassName("notable-traits"),function(e){e.onclick=function(){this.getElementsByClassName('notable-traits-tooltiptext')[0].classList.toggle("force-tooltip")}});var sidebar_menu_toggle=document.getElementsByClassName("sidebar-menu-toggle")[0];if(sidebar_menu_toggle){sidebar_menu_toggle.addEventListener("click",function(){var sidebar=document.getElementsByClassName("sidebar")[0];if(!hasClass(sidebar,"shown")){addClass(sidebar,"shown")}else{removeClass(sidebar,"shown")}})}var buildHelperPopup=function(){var popup=document.createElement("aside");addClass(popup,"hidden");popup.id="help";popup.addEventListener("click",function(ev){if(ev.target===popup){displayHelp(false,ev)}});var book_info=document.createElement("span");book_info.className="top";book_info.innerHTML="You can find more information in \ - the rustdoc book.";var container=document.createElement("div");var shortcuts=[["?","Show this help dialog"],["S","Focus the search field"],["T","Focus the theme picker menu"],["↑","Move up in search results"],["↓","Move down in search results"],["← / →","Switch result tab (when results focused)"],["⏎","Go to active search result"],["+","Expand all sections"],["-","Collapse all sections"],].map(function(x){return"
"+x[0].split(" ").map(function(y,index){return(index&1)===0?""+y+"":" "+y+" "}).join("")+"
"+x[1]+"
"}).join("");var div_shortcuts=document.createElement("div");addClass(div_shortcuts,"shortcuts");div_shortcuts.innerHTML="

Keyboard Shortcuts

"+shortcuts+"
";var infos=["Prefix searches with a type followed by a colon (e.g., fn:) to \ - restrict the search to a given item kind.","Accepted kinds are: fn, mod, struct, \ - enum, trait, type, macro, \ - and const.","Search functions by type signature (e.g., vec -> usize or \ - * -> vec)","Search multiple things at once by splitting your query with comma (e.g., \ - str,u8 or String,struct:Vec,test)","You can look for items with an exact name by putting double quotes around \ - your request: \"string\"","Look for items inside another one by searching for a path: vec::Vec",].map(function(x){return"

"+x+"

"}).join("");var div_infos=document.createElement("div");addClass(div_infos,"infos");div_infos.innerHTML="

Search Tricks

"+infos;container.appendChild(book_info);container.appendChild(div_shortcuts);container.appendChild(div_infos);var rustdoc_version=document.createElement("span");rustdoc_version.className="bottom";var rustdoc_version_code=document.createElement("code");rustdoc_version_code.innerText="rustdoc "+getVar("rustdoc-version");rustdoc_version.appendChild(rustdoc_version_code);container.appendChild(rustdoc_version);popup.appendChild(container);insertAfter(popup,document.querySelector("main"));buildHelperPopup=function(){}};onHashChange(null);window.addEventListener("hashchange",onHashChange);searchState.setup()}());(function(){var reset_button_timeout=null;window.copy_path=function(but){var parent=but.parentElement;var path=[];onEach(parent.childNodes,function(child){if(child.tagName==='A'){path.push(child.textContent)}});var el=document.createElement('textarea');el.value=path.join('::');el.setAttribute('readonly','');el.style.position='absolute';el.style.left='-9999px';document.body.appendChild(el);el.select();document.execCommand('copy');document.body.removeChild(el);but.children[0].style.display='none';var tmp;if(but.childNodes.length<2){tmp=document.createTextNode('✓');but.appendChild(tmp)}else{onEachLazy(but.childNodes,function(e){if(e.nodeType===Node.TEXT_NODE){tmp=e;return true}});tmp.textContent='✓'}if(reset_button_timeout!==null){window.clearTimeout(reset_button_timeout)}function reset_button(){tmp.textContent='';reset_button_timeout=null;but.children[0].style.display=""}reset_button_timeout=window.setTimeout(reset_button,1000)}}()) \ No newline at end of file diff --git a/ch6-dev/noscript.css b/ch6-dev/noscript.css deleted file mode 100644 index 8ad88640..00000000 --- a/ch6-dev/noscript.css +++ /dev/null @@ -1 +0,0 @@ - #main-content .attributes{margin-left:0 !important;}#copy-path{display:none;}.sub{display:none;}#theme-picker{display:none;} \ No newline at end of file diff --git a/ch6-dev/os/all.html b/ch6-dev/os/all.html index d0a28228..de6b5995 100644 --- a/ch6-dev/os/all.html +++ b/ch6-dev/os/all.html @@ -1,7 +1 @@ -List of all items in this crate - -

List of all items

Structs

Enums

Traits

Macros

Functions

Typedefs

Statics

Constants

- \ No newline at end of file +List of all items in this crate

List of all items

Structs

Enums

Traits

Macros

Functions

Type Aliases

Statics

Constants

\ No newline at end of file diff --git a/ch6-dev/os/board/constant.CLOCK_FREQ.html b/ch6-dev/os/board/constant.CLOCK_FREQ.html index 146b54a9..be383e66 100644 --- a/ch6-dev/os/board/constant.CLOCK_FREQ.html +++ b/ch6-dev/os/board/constant.CLOCK_FREQ.html @@ -1,8 +1 @@ -CLOCK_FREQ in os::board - Rust - -
-

Constant os::board::CLOCK_FREQ

source · []
pub const CLOCK_FREQ: usize = 12500000;
- \ No newline at end of file +CLOCK_FREQ in os::board - Rust

Constant os::board::CLOCK_FREQ

source ·
pub const CLOCK_FREQ: usize = 12500000;
\ No newline at end of file diff --git a/ch6-dev/os/board/constant.EXIT_FAILURE.html b/ch6-dev/os/board/constant.EXIT_FAILURE.html deleted file mode 100644 index 0e1858cb..00000000 --- a/ch6-dev/os/board/constant.EXIT_FAILURE.html +++ /dev/null @@ -1,8 +0,0 @@ -EXIT_FAILURE in os::board - Rust - -
-

Constant os::board::EXIT_FAILURE

source · []
const EXIT_FAILURE: u32 = exit_code_encode(1); // 78_643u32
- \ No newline at end of file diff --git a/ch6-dev/os/board/constant.EXIT_FAILURE_FLAG.html b/ch6-dev/os/board/constant.EXIT_FAILURE_FLAG.html deleted file mode 100644 index bd645434..00000000 --- a/ch6-dev/os/board/constant.EXIT_FAILURE_FLAG.html +++ /dev/null @@ -1,8 +0,0 @@ -EXIT_FAILURE_FLAG in os::board - Rust - -
const EXIT_FAILURE_FLAG: u32 = 0x3333;
- \ No newline at end of file diff --git a/ch6-dev/os/board/constant.EXIT_RESET.html b/ch6-dev/os/board/constant.EXIT_RESET.html deleted file mode 100644 index ee0e4ba6..00000000 --- a/ch6-dev/os/board/constant.EXIT_RESET.html +++ /dev/null @@ -1,8 +0,0 @@ -EXIT_RESET in os::board - Rust - -
-

Constant os::board::EXIT_RESET

source · []
const EXIT_RESET: u32 = 0x7777;
- \ No newline at end of file diff --git a/ch6-dev/os/board/constant.EXIT_SUCCESS.html b/ch6-dev/os/board/constant.EXIT_SUCCESS.html deleted file mode 100644 index 877cd5de..00000000 --- a/ch6-dev/os/board/constant.EXIT_SUCCESS.html +++ /dev/null @@ -1,8 +0,0 @@ -EXIT_SUCCESS in os::board - Rust - -
-

Constant os::board::EXIT_SUCCESS

source · []
const EXIT_SUCCESS: u32 = 0x5555;
- \ No newline at end of file diff --git a/ch6-dev/os/board/constant.MEMORY_END.html b/ch6-dev/os/board/constant.MEMORY_END.html index 53c4ab3a..734576ea 100644 --- a/ch6-dev/os/board/constant.MEMORY_END.html +++ b/ch6-dev/os/board/constant.MEMORY_END.html @@ -1,8 +1 @@ -MEMORY_END in os::board - Rust - -
-

Constant os::board::MEMORY_END

source · []
pub const MEMORY_END: usize = 0x801000000;
- \ No newline at end of file +MEMORY_END in os::board - Rust

Constant os::board::MEMORY_END

source ·
pub const MEMORY_END: usize = 0x88000000;
\ No newline at end of file diff --git a/ch6-dev/os/board/constant.MMIO.html b/ch6-dev/os/board/constant.MMIO.html index 53ea8b9d..471c4133 100644 --- a/ch6-dev/os/board/constant.MMIO.html +++ b/ch6-dev/os/board/constant.MMIO.html @@ -1,8 +1 @@ -MMIO in os::board - Rust - -
-

Constant os::board::MMIO

source · []
pub const MMIO: &[(usize, usize)];
- \ No newline at end of file +MMIO in os::board - Rust

Constant os::board::MMIO

source ·
pub const MMIO: &[(usize, usize)];
\ No newline at end of file diff --git a/ch6-dev/os/board/constant.QEMU_EXIT_HANDLE.html b/ch6-dev/os/board/constant.QEMU_EXIT_HANDLE.html deleted file mode 100644 index 2c093a9f..00000000 --- a/ch6-dev/os/board/constant.QEMU_EXIT_HANDLE.html +++ /dev/null @@ -1,8 +0,0 @@ -QEMU_EXIT_HANDLE in os::board - Rust - -
pub const QEMU_EXIT_HANDLE: RISCV64;
- \ No newline at end of file diff --git a/ch6-dev/os/board/constant.VIRT_TEST.html b/ch6-dev/os/board/constant.VIRT_TEST.html deleted file mode 100644 index 09bf248a..00000000 --- a/ch6-dev/os/board/constant.VIRT_TEST.html +++ /dev/null @@ -1,8 +0,0 @@ -VIRT_TEST in os::board - Rust - -
-

Constant os::board::VIRT_TEST

source · []
const VIRT_TEST: u64 = 0x100000;
- \ No newline at end of file diff --git a/ch6-dev/os/board/fn.exit_code_encode.html b/ch6-dev/os/board/fn.exit_code_encode.html deleted file mode 100644 index 7ea06049..00000000 --- a/ch6-dev/os/board/fn.exit_code_encode.html +++ /dev/null @@ -1,9 +0,0 @@ -exit_code_encode in os::board - Rust - -
const fn exit_code_encode(code: u32) -> u32
Expand description

Encode the exit code using EXIT_FAILURE_FLAG.

-
- \ No newline at end of file diff --git a/ch6-dev/os/board/index.html b/ch6-dev/os/board/index.html index c8e15f21..7ab4821c 100644 --- a/ch6-dev/os/board/index.html +++ b/ch6-dev/os/board/index.html @@ -1,15 +1 @@ -os::board - Rust - -
- \ No newline at end of file +os::board - Rust
\ No newline at end of file diff --git a/ch6-dev/os/board/sidebar-items.js b/ch6-dev/os/board/sidebar-items.js index 054919ae..7ca4409a 100644 --- a/ch6-dev/os/board/sidebar-items.js +++ b/ch6-dev/os/board/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"constant":[["CLOCK_FREQ",""],["EXIT_FAILURE",""],["EXIT_FAILURE_FLAG",""],["EXIT_RESET",""],["EXIT_SUCCESS",""],["MEMORY_END",""],["MMIO",""],["QEMU_EXIT_HANDLE",""],["VIRT_TEST",""]],"fn":[["exit_code_encode","Encode the exit code using EXIT_FAILURE_FLAG."]],"struct":[["RISCV64","RISCV64 configuration"]],"trait":[["QEMUExit",""]],"type":[["BlockDeviceImpl",""]]}); \ No newline at end of file +window.SIDEBAR_ITEMS = {"constant":["CLOCK_FREQ","MEMORY_END","MMIO"],"type":["BlockDeviceImpl"]}; \ No newline at end of file diff --git a/ch6-dev/os/board/struct.RISCV64.html b/ch6-dev/os/board/struct.RISCV64.html deleted file mode 100644 index d6a89766..00000000 --- a/ch6-dev/os/board/struct.RISCV64.html +++ /dev/null @@ -1,27 +0,0 @@ -RISCV64 in os::board - Rust - -
-

Struct os::board::RISCV64

source · []
pub struct RISCV64 {
-    addr: u64,
-}
Expand description

RISCV64 configuration

-

Fields

addr: u64

Address of the sifive_test mapped device.

-

Implementations

Create an instance.

-

Trait Implementations

Exit qemu with specified exit code.

-

Exit QEMU using EXIT_SUCCESS, aka 0, if possible. Read more

-

Exit QEMU using EXIT_FAILURE, aka 1.

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
- \ No newline at end of file diff --git a/ch6-dev/os/board/trait.QEMUExit.html b/ch6-dev/os/board/trait.QEMUExit.html deleted file mode 100644 index 5acf55e8..00000000 --- a/ch6-dev/os/board/trait.QEMUExit.html +++ /dev/null @@ -1,17 +0,0 @@ -QEMUExit in os::board - Rust - -
pub trait QEMUExit {
-    fn exit(&self, code: u32) -> !;
-    fn exit_success(&self) -> !;
-    fn exit_failure(&self) -> !;
-}

Required methods

Exit with specified return code.

-

Note: For X86, code is binary-OR’ed with 0x1 inside QEMU.

-

Exit QEMU using EXIT_SUCCESS, aka 0, if possible.

-

Note: Not possible for X86.

-

Exit QEMU using EXIT_FAILURE, aka 1.

-

Implementors

- \ No newline at end of file diff --git a/ch6-dev/os/board/type.BlockDeviceImpl.html b/ch6-dev/os/board/type.BlockDeviceImpl.html index bad2166f..a9cc0efe 100644 --- a/ch6-dev/os/board/type.BlockDeviceImpl.html +++ b/ch6-dev/os/board/type.BlockDeviceImpl.html @@ -1,8 +1 @@ -BlockDeviceImpl in os::board - Rust - -
-

Type Definition os::board::BlockDeviceImpl

source · []
pub type BlockDeviceImpl = VirtIOBlock;
- \ No newline at end of file +BlockDeviceImpl in os::board - Rust

Type Alias os::board::BlockDeviceImpl

source ·
pub type BlockDeviceImpl = VirtIOBlock;

Aliased Type§

struct BlockDeviceImpl(UPSafeCell<VirtIOBlk<'static, VirtioHal>>);

Fields§

§0: UPSafeCell<VirtIOBlk<'static, VirtioHal>>

Implementations§

source§

impl VirtIOBlock

source

pub fn new() -> Self

Trait Implementations§

source§

impl BlockDevice for VirtIOBlock

source§

fn read_block(&self, block_id: usize, buf: &mut [u8])

Read data form block to buffer
source§

fn write_block(&self, block_id: usize, buf: &[u8])

Write data from buffer to block
\ No newline at end of file diff --git a/ch6-dev/os/config/constant.KERNEL_HEAP_SIZE.html b/ch6-dev/os/config/constant.KERNEL_HEAP_SIZE.html index f493891f..ddd6b3c7 100644 --- a/ch6-dev/os/config/constant.KERNEL_HEAP_SIZE.html +++ b/ch6-dev/os/config/constant.KERNEL_HEAP_SIZE.html @@ -1,8 +1 @@ -KERNEL_HEAP_SIZE in os::config - Rust - -
pub const KERNEL_HEAP_SIZE: usize = 0x20_0000;
- \ No newline at end of file +KERNEL_HEAP_SIZE in os::config - Rust

Constant os::config::KERNEL_HEAP_SIZE

source ·
pub const KERNEL_HEAP_SIZE: usize = 0x20_0000;
\ No newline at end of file diff --git a/ch6-dev/os/config/constant.KERNEL_STACK_SIZE.html b/ch6-dev/os/config/constant.KERNEL_STACK_SIZE.html index b58008dd..d05b2491 100644 --- a/ch6-dev/os/config/constant.KERNEL_STACK_SIZE.html +++ b/ch6-dev/os/config/constant.KERNEL_STACK_SIZE.html @@ -1,8 +1 @@ -KERNEL_STACK_SIZE in os::config - Rust - -
pub const KERNEL_STACK_SIZE: usize = 4096 * 2; // 8_192usize
- \ No newline at end of file +KERNEL_STACK_SIZE in os::config - Rust

Constant os::config::KERNEL_STACK_SIZE

source ·
pub const KERNEL_STACK_SIZE: usize = _; // 8_192usize
\ No newline at end of file diff --git a/ch6-dev/os/config/constant.PAGE_SIZE.html b/ch6-dev/os/config/constant.PAGE_SIZE.html index 4600b912..dd2e7860 100644 --- a/ch6-dev/os/config/constant.PAGE_SIZE.html +++ b/ch6-dev/os/config/constant.PAGE_SIZE.html @@ -1,8 +1 @@ -PAGE_SIZE in os::config - Rust - -
-

Constant os::config::PAGE_SIZE

source · []
pub const PAGE_SIZE: usize = 0x1000;
- \ No newline at end of file +PAGE_SIZE in os::config - Rust

Constant os::config::PAGE_SIZE

source ·
pub const PAGE_SIZE: usize = 0x1000;
\ No newline at end of file diff --git a/ch6-dev/os/config/constant.PAGE_SIZE_BITS.html b/ch6-dev/os/config/constant.PAGE_SIZE_BITS.html index d314ac6c..d206b21f 100644 --- a/ch6-dev/os/config/constant.PAGE_SIZE_BITS.html +++ b/ch6-dev/os/config/constant.PAGE_SIZE_BITS.html @@ -1,8 +1 @@ -PAGE_SIZE_BITS in os::config - Rust - -
pub const PAGE_SIZE_BITS: usize = 0xc;
- \ No newline at end of file +PAGE_SIZE_BITS in os::config - Rust

Constant os::config::PAGE_SIZE_BITS

source ·
pub const PAGE_SIZE_BITS: usize = 0xc;
\ No newline at end of file diff --git a/ch6-dev/os/config/constant.TRAMPOLINE.html b/ch6-dev/os/config/constant.TRAMPOLINE.html index 5ecf2f96..410a2af2 100644 --- a/ch6-dev/os/config/constant.TRAMPOLINE.html +++ b/ch6-dev/os/config/constant.TRAMPOLINE.html @@ -1,8 +1 @@ -TRAMPOLINE in os::config - Rust - -
-

Constant os::config::TRAMPOLINE

source · []
pub const TRAMPOLINE: usize = usize::MAX - PAGE_SIZE + 1; // 18_446_744_073_709_547_520usize
- \ No newline at end of file +TRAMPOLINE in os::config - Rust

Constant os::config::TRAMPOLINE

source ·
pub const TRAMPOLINE: usize = _; // 18_446_744_073_709_547_520usize
\ No newline at end of file diff --git a/ch6-dev/os/config/constant.TRAP_CONTEXT.html b/ch6-dev/os/config/constant.TRAP_CONTEXT.html index 7dbacf7b..acb0fcb8 100644 --- a/ch6-dev/os/config/constant.TRAP_CONTEXT.html +++ b/ch6-dev/os/config/constant.TRAP_CONTEXT.html @@ -1,8 +1 @@ -TRAP_CONTEXT in os::config - Rust - -
pub const TRAP_CONTEXT: usize = TRAMPOLINE - PAGE_SIZE; // 18_446_744_073_709_543_424usize
- \ No newline at end of file +TRAP_CONTEXT in os::config - Rust

Constant os::config::TRAP_CONTEXT

source ·
pub const TRAP_CONTEXT: usize = _; // 18_446_744_073_709_543_424usize
\ No newline at end of file diff --git a/ch6-dev/os/config/constant.USER_STACK_SIZE.html b/ch6-dev/os/config/constant.USER_STACK_SIZE.html index e05d0af4..d73afccc 100644 --- a/ch6-dev/os/config/constant.USER_STACK_SIZE.html +++ b/ch6-dev/os/config/constant.USER_STACK_SIZE.html @@ -1,8 +1 @@ -USER_STACK_SIZE in os::config - Rust - -
pub const USER_STACK_SIZE: usize = 4096 * 2; // 8_192usize
- \ No newline at end of file +USER_STACK_SIZE in os::config - Rust

Constant os::config::USER_STACK_SIZE

source ·
pub const USER_STACK_SIZE: usize = _; // 8_192usize
\ No newline at end of file diff --git a/ch6-dev/os/config/index.html b/ch6-dev/os/config/index.html index 8d81b691..bafed177 100644 --- a/ch6-dev/os/config/index.html +++ b/ch6-dev/os/config/index.html @@ -1,11 +1,2 @@ -os::config - Rust - -
-

Module os::config

source · []
Expand description

Constants used in rCore

-

Re-exports

-
pub use crate::board::CLOCK_FREQ;
pub use crate::board::MEMORY_END;
pub use crate::board::MMIO;

Constants

-
- \ No newline at end of file +os::config - Rust

Module os::config

source ·
Expand description

Constants used in rCore

+

Re-exports

Constants

\ No newline at end of file diff --git a/ch6-dev/os/config/sidebar-items.js b/ch6-dev/os/config/sidebar-items.js index 1835a162..cd442118 100644 --- a/ch6-dev/os/config/sidebar-items.js +++ b/ch6-dev/os/config/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"constant":[["KERNEL_HEAP_SIZE",""],["KERNEL_STACK_SIZE",""],["PAGE_SIZE",""],["PAGE_SIZE_BITS",""],["TRAMPOLINE",""],["TRAP_CONTEXT",""],["USER_STACK_SIZE",""]]}); \ No newline at end of file +window.SIDEBAR_ITEMS = {"constant":["KERNEL_HEAP_SIZE","KERNEL_STACK_SIZE","PAGE_SIZE","PAGE_SIZE_BITS","TRAMPOLINE","TRAP_CONTEXT","USER_STACK_SIZE"]}; \ No newline at end of file diff --git a/ch6-dev/os/console/fn.print.html b/ch6-dev/os/console/fn.print.html index da0a7e32..536de6e6 100644 --- a/ch6-dev/os/console/fn.print.html +++ b/ch6-dev/os/console/fn.print.html @@ -1,8 +1 @@ -print in os::console - Rust - -
-

Function os::console::print

source · []
pub fn print(args: Arguments<'_>)
- \ No newline at end of file +print in os::console - Rust

Function os::console::print

source ·
pub fn print(args: Arguments<'_>)
\ No newline at end of file diff --git a/ch6-dev/os/console/index.html b/ch6-dev/os/console/index.html index d18f0bf2..3ce314c2 100644 --- a/ch6-dev/os/console/index.html +++ b/ch6-dev/os/console/index.html @@ -1,11 +1,2 @@ -os::console - Rust - -
-

Module os::console

source · []
Expand description

SBI console driver, for text output

-

Structs

-
Stdout 🔒

Functions

-
- \ No newline at end of file +os::console - Rust

Module os::console

source ·
Expand description

SBI console driver, for text output

+

Structs

Functions

\ No newline at end of file diff --git a/ch6-dev/os/console/sidebar-items.js b/ch6-dev/os/console/sidebar-items.js index 32906922..d7b318cf 100644 --- a/ch6-dev/os/console/sidebar-items.js +++ b/ch6-dev/os/console/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"fn":[["print",""]],"struct":[["Stdout",""]]}); \ No newline at end of file +window.SIDEBAR_ITEMS = {"fn":["print"],"struct":["Stdout"]}; \ No newline at end of file diff --git a/ch6-dev/os/console/struct.Stdout.html b/ch6-dev/os/console/struct.Stdout.html index 34462a88..2d4a4c8a 100644 --- a/ch6-dev/os/console/struct.Stdout.html +++ b/ch6-dev/os/console/struct.Stdout.html @@ -1,23 +1,12 @@ -Stdout in os::console - Rust - -
-

Struct os::console::Stdout

source · []
struct Stdout;

Trait Implementations

Writes a string slice into this writer, returning whether the write -succeeded. Read more

-

Writes a char into this writer, returning whether the write succeeded. Read more

-

Glue for usage of the write! macro with implementors of this trait. Read more

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+Stdout in os::console - Rust

Struct os::console::Stdout

source ·
struct Stdout;

Trait Implementations§

source§

impl Write for Stdout

source§

fn write_str(&mut self, s: &str) -> Result

Writes a string slice into this writer, returning whether the write +succeeded. Read more
1.1.0 · source§

fn write_char(&mut self, c: char) -> Result<(), Error>

Writes a char into this writer, returning whether the write succeeded. Read more
1.0.0 · source§

fn write_fmt(&mut self, args: Arguments<'_>) -> Result<(), Error>

Glue for usage of the write! macro with implementors of this trait. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
- \ No newline at end of file +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/ch6-dev/os/drivers/block/fn.block_device_test.html b/ch6-dev/os/drivers/block/fn.block_device_test.html index 0e374a0e..a7c8eeeb 100644 --- a/ch6-dev/os/drivers/block/fn.block_device_test.html +++ b/ch6-dev/os/drivers/block/fn.block_device_test.html @@ -1,8 +1 @@ -block_device_test in os::drivers::block - Rust - -
pub fn block_device_test()
- \ No newline at end of file +block_device_test in os::drivers::block - Rust
pub fn block_device_test()
\ No newline at end of file diff --git a/ch6-dev/os/drivers/block/index.html b/ch6-dev/os/drivers/block/index.html index a231a5d6..e0dfea44 100644 --- a/ch6-dev/os/drivers/block/index.html +++ b/ch6-dev/os/drivers/block/index.html @@ -1,12 +1 @@ -os::drivers::block - Rust - -
- \ No newline at end of file +os::drivers::block - Rust
\ No newline at end of file diff --git a/ch6-dev/os/drivers/block/sdcard/constant.SD_CS.html b/ch6-dev/os/drivers/block/sdcard/constant.SD_CS.html deleted file mode 100644 index 55b18129..00000000 --- a/ch6-dev/os/drivers/block/sdcard/constant.SD_CS.html +++ /dev/null @@ -1,10 +0,0 @@ -SD_CS in os::drivers::block::sdcard - Rust - -
-

Constant os::drivers::block::sdcard::SD_CS

source · []
const SD_CS: u32 = 3;
Expand description

CS value passed to SPI controller, this is a dummy value as SPI0_CS3 is not mapping to anything -in the FPIOA

-
- \ No newline at end of file diff --git a/ch6-dev/os/drivers/block/sdcard/constant.SD_CS_GPIONUM.html b/ch6-dev/os/drivers/block/sdcard/constant.SD_CS_GPIONUM.html deleted file mode 100644 index 20e23ef7..00000000 --- a/ch6-dev/os/drivers/block/sdcard/constant.SD_CS_GPIONUM.html +++ /dev/null @@ -1,9 +0,0 @@ -SD_CS_GPIONUM in os::drivers::block::sdcard - Rust - -
const SD_CS_GPIONUM: u8 = 7;
Expand description

GPIOHS GPIO number to use for controlling the SD card CS pin

-
- \ No newline at end of file diff --git a/ch6-dev/os/drivers/block/sdcard/constant.SD_START_DATA_MULTIPLE_BLOCK_READ.html b/ch6-dev/os/drivers/block/sdcard/constant.SD_START_DATA_MULTIPLE_BLOCK_READ.html deleted file mode 100644 index 661bff1f..00000000 --- a/ch6-dev/os/drivers/block/sdcard/constant.SD_START_DATA_MULTIPLE_BLOCK_READ.html +++ /dev/null @@ -1,9 +0,0 @@ -SD_START_DATA_MULTIPLE_BLOCK_READ in os::drivers::block::sdcard - Rust - -
pub const SD_START_DATA_MULTIPLE_BLOCK_READ: u8 = 0xFE;
Expand description

Data token start byte, Start Multiple Block Read

-
- \ No newline at end of file diff --git a/ch6-dev/os/drivers/block/sdcard/constant.SD_START_DATA_MULTIPLE_BLOCK_WRITE.html b/ch6-dev/os/drivers/block/sdcard/constant.SD_START_DATA_MULTIPLE_BLOCK_WRITE.html deleted file mode 100644 index 190cac5a..00000000 --- a/ch6-dev/os/drivers/block/sdcard/constant.SD_START_DATA_MULTIPLE_BLOCK_WRITE.html +++ /dev/null @@ -1,9 +0,0 @@ -SD_START_DATA_MULTIPLE_BLOCK_WRITE in os::drivers::block::sdcard - Rust - -
pub const SD_START_DATA_MULTIPLE_BLOCK_WRITE: u8 = 0xFC;
Expand description

Data token start byte, Start Multiple Block Write

-
- \ No newline at end of file diff --git a/ch6-dev/os/drivers/block/sdcard/constant.SD_START_DATA_SINGLE_BLOCK_READ.html b/ch6-dev/os/drivers/block/sdcard/constant.SD_START_DATA_SINGLE_BLOCK_READ.html deleted file mode 100644 index 8b50884e..00000000 --- a/ch6-dev/os/drivers/block/sdcard/constant.SD_START_DATA_SINGLE_BLOCK_READ.html +++ /dev/null @@ -1,9 +0,0 @@ -SD_START_DATA_SINGLE_BLOCK_READ in os::drivers::block::sdcard - Rust - -
pub const SD_START_DATA_SINGLE_BLOCK_READ: u8 = 0xFE;
Expand description

Data token start byte, Start Single Block Read

-
- \ No newline at end of file diff --git a/ch6-dev/os/drivers/block/sdcard/constant.SD_START_DATA_SINGLE_BLOCK_WRITE.html b/ch6-dev/os/drivers/block/sdcard/constant.SD_START_DATA_SINGLE_BLOCK_WRITE.html deleted file mode 100644 index 4d70d58b..00000000 --- a/ch6-dev/os/drivers/block/sdcard/constant.SD_START_DATA_SINGLE_BLOCK_WRITE.html +++ /dev/null @@ -1,9 +0,0 @@ -SD_START_DATA_SINGLE_BLOCK_WRITE in os::drivers::block::sdcard - Rust - -
pub const SD_START_DATA_SINGLE_BLOCK_WRITE: u8 = 0xFE;
Expand description

Data token start byte, Start Single Block Write

-
- \ No newline at end of file diff --git a/ch6-dev/os/drivers/block/sdcard/constant.SEC_LEN.html b/ch6-dev/os/drivers/block/sdcard/constant.SEC_LEN.html deleted file mode 100644 index c15a12a2..00000000 --- a/ch6-dev/os/drivers/block/sdcard/constant.SEC_LEN.html +++ /dev/null @@ -1,8 +0,0 @@ -SEC_LEN in os::drivers::block::sdcard - Rust - -
pub const SEC_LEN: usize = 512;
- \ No newline at end of file diff --git a/ch6-dev/os/drivers/block/sdcard/enum.CMD.html b/ch6-dev/os/drivers/block/sdcard/enum.CMD.html deleted file mode 100644 index 9b31e561..00000000 --- a/ch6-dev/os/drivers/block/sdcard/enum.CMD.html +++ /dev/null @@ -1,61 +0,0 @@ -CMD in os::drivers::block::sdcard - Rust - -
#[repr(u8)]
-pub enum CMD {
-
Show 15 variants CMD0, - CMD8, - CMD9, - CMD10, - CMD12, - CMD16, - CMD17, - CMD18, - ACMD23, - CMD24, - CMD25, - ACMD41, - CMD55, - CMD58, - CMD59, -
}
Expand description

SD commands

-

Variants

CMD0

Software reset

-

CMD8

Check voltage range (SDC V2)

-

CMD9

Read CSD register

-

CMD10

Read CID register

-

CMD12

Stop to read data

-

CMD16

Change R/W block size

-

CMD17

Read block

-

CMD18

Read multiple blocks

-

ACMD23

Number of blocks to erase (SDC)

-

CMD24

Write a block

-

CMD25

Write multiple blocks

-

ACMD41

Initiate initialization process (SDC)

-

CMD55

Leading command for ACMD*

-

CMD58

Read OCR

-

CMD59

Enable/disable CRC check

-

Trait Implementations

Returns a copy of the value. Read more

-

Performs copy-assignment from source. Read more

-

Formats the value using the given formatter. Read more

-

This method tests for self and other values to be equal, and is used -by ==. Read more

-

This method tests for !=.

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The resulting type after obtaining ownership.

-

Creates owned data from borrowed data, usually by cloning. Read more

-
🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
- \ No newline at end of file diff --git a/ch6-dev/os/drivers/block/sdcard/enum.InitError.html b/ch6-dev/os/drivers/block/sdcard/enum.InitError.html deleted file mode 100644 index 595bda38..00000000 --- a/ch6-dev/os/drivers/block/sdcard/enum.InitError.html +++ /dev/null @@ -1,29 +0,0 @@ -InitError in os::drivers::block::sdcard - Rust - -
pub enum InitError {
-    CMDFailed(CMDu8),
-    CardCapacityStatusNotSet([u8; 4]),
-    CannotGetCardInfo,
-}

Variants

CMDFailed(CMDu8)

CardCapacityStatusNotSet([u8; 4])

CannotGetCardInfo

Trait Implementations

Returns a copy of the value. Read more

-

Performs copy-assignment from source. Read more

-

Formats the value using the given formatter. Read more

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The resulting type after obtaining ownership.

-

Creates owned data from borrowed data, usually by cloning. Read more

-
🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
- \ No newline at end of file diff --git a/ch6-dev/os/drivers/block/sdcard/fn.init_sdcard.html b/ch6-dev/os/drivers/block/sdcard/fn.init_sdcard.html deleted file mode 100644 index 01baf5c5..00000000 --- a/ch6-dev/os/drivers/block/sdcard/fn.init_sdcard.html +++ /dev/null @@ -1,8 +0,0 @@ -init_sdcard in os::drivers::block::sdcard - Rust - -
fn init_sdcard() -> SDCard<SPIImpl<SPI0>>
- \ No newline at end of file diff --git a/ch6-dev/os/drivers/block/sdcard/fn.io_init.html b/ch6-dev/os/drivers/block/sdcard/fn.io_init.html deleted file mode 100644 index de329858..00000000 --- a/ch6-dev/os/drivers/block/sdcard/fn.io_init.html +++ /dev/null @@ -1,9 +0,0 @@ -io_init in os::drivers::block::sdcard - Rust - -
fn io_init()
Expand description

Connect pins to internal functions

-
- \ No newline at end of file diff --git a/ch6-dev/os/drivers/block/sdcard/index.html b/ch6-dev/os/drivers/block/sdcard/index.html deleted file mode 100644 index ddd32c17..00000000 --- a/ch6-dev/os/drivers/block/sdcard/index.html +++ /dev/null @@ -1,24 +0,0 @@ -os::drivers::block::sdcard - Rust - -

Structs

-

Card Identification Data: CID Register

-

Card Specific Data: CSD Register

-

Card information

-

Enums

-

SD commands

-

Constants

-
SD_CS 🔒

CS value passed to SPI controller, this is a dummy value as SPI0_CS3 is not mapping to anything -in the FPIOA

-

GPIOHS GPIO number to use for controlling the SD card CS pin

-

Data token start byte, Start Multiple Block Read

-

Data token start byte, Start Multiple Block Write

-

Data token start byte, Start Single Block Read

-

Data token start byte, Start Single Block Write

-

Functions

-
io_init 🔒

Connect pins to internal functions

-
- \ No newline at end of file diff --git a/ch6-dev/os/drivers/block/sdcard/sidebar-items.js b/ch6-dev/os/drivers/block/sdcard/sidebar-items.js deleted file mode 100644 index e5a624de..00000000 --- a/ch6-dev/os/drivers/block/sdcard/sidebar-items.js +++ /dev/null @@ -1 +0,0 @@ -initSidebarItems({"constant":[["SD_CS","CS value passed to SPI controller, this is a dummy value as SPI0_CS3 is not mapping to anything in the FPIOA "],["SD_CS_GPIONUM","GPIOHS GPIO number to use for controlling the SD card CS pin "],["SD_START_DATA_MULTIPLE_BLOCK_READ","Data token start byte, Start Multiple Block Read "],["SD_START_DATA_MULTIPLE_BLOCK_WRITE","Data token start byte, Start Multiple Block Write "],["SD_START_DATA_SINGLE_BLOCK_READ","Data token start byte, Start Single Block Read "],["SD_START_DATA_SINGLE_BLOCK_WRITE","Data token start byte, Start Single Block Write "],["SEC_LEN",""]],"enum":[["CMD","SD commands "],["InitError",""]],"fn":[["init_sdcard",""],["io_init","Connect pins to internal functions "]],"struct":[["PERIPHERALS",""],["SDCard",""],["SDCardCID","Card Identification Data: CID Register"],["SDCardCSD","Card Specific Data: CSD Register"],["SDCardInfo","Card information"],["SDCardWrapper",""]]}); \ No newline at end of file diff --git a/ch6-dev/os/drivers/block/sdcard/struct.PERIPHERALS.html b/ch6-dev/os/drivers/block/sdcard/struct.PERIPHERALS.html deleted file mode 100644 index cce093d9..00000000 --- a/ch6-dev/os/drivers/block/sdcard/struct.PERIPHERALS.html +++ /dev/null @@ -1,24 +0,0 @@ -PERIPHERALS in os::drivers::block::sdcard - Rust - -
struct PERIPHERALS {
-    __private_field: (),
-}

Fields

__private_field: ()

Methods from Deref<Target = UPSafeCell<Peripherals>>

Exclusive access inner data in UPSafeCell. Panic if the data has been borrowed.

-

Trait Implementations

The resulting type after dereferencing.

-

Dereferences the value.

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
- \ No newline at end of file diff --git a/ch6-dev/os/drivers/block/sdcard/struct.SDCard.html b/ch6-dev/os/drivers/block/sdcard/struct.SDCard.html deleted file mode 100644 index a5c7926f..00000000 --- a/ch6-dev/os/drivers/block/sdcard/struct.SDCard.html +++ /dev/null @@ -1,23 +0,0 @@ -SDCard in os::drivers::block::sdcard - Rust - -
pub struct SDCard<SPI> {
-    spi: SPI,
-    spi_cs: u32,
-    cs_gpionum: u8,
-}

Fields

spi: SPIspi_cs: u32cs_gpionum: u8

Implementations

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
- \ No newline at end of file diff --git a/ch6-dev/os/drivers/block/sdcard/struct.SDCardCID.html b/ch6-dev/os/drivers/block/sdcard/struct.SDCardCID.html deleted file mode 100644 index c8bb5e6c..00000000 --- a/ch6-dev/os/drivers/block/sdcard/struct.SDCardCID.html +++ /dev/null @@ -1,37 +0,0 @@ -SDCardCID in os::drivers::block::sdcard - Rust - -
pub struct SDCardCID {
-    pub ManufacturerID: u8,
-    pub OEM_AppliID: u16,
-    pub ProdName1: u32,
-    pub ProdName2: u8,
-    pub ProdRev: u8,
-    pub ProdSN: u32,
-    pub Reserved1: u8,
-    pub ManufactDate: u16,
-    pub CID_CRC: u8,
-    pub Reserved2: u8,
-}
Expand description

Card Identification Data: CID Register

-

Fields

ManufacturerID: u8OEM_AppliID: u16ProdName1: u32ProdName2: u8ProdRev: u8ProdSN: u32Reserved1: u8ManufactDate: u16CID_CRC: u8Reserved2: u8

Trait Implementations

Returns a copy of the value. Read more

-

Performs copy-assignment from source. Read more

-

Formats the value using the given formatter. Read more

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The resulting type after obtaining ownership.

-

Creates owned data from borrowed data, usually by cloning. Read more

-
🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
- \ No newline at end of file diff --git a/ch6-dev/os/drivers/block/sdcard/struct.SDCardCSD.html b/ch6-dev/os/drivers/block/sdcard/struct.SDCardCSD.html deleted file mode 100644 index 0989ce3b..00000000 --- a/ch6-dev/os/drivers/block/sdcard/struct.SDCardCSD.html +++ /dev/null @@ -1,59 +0,0 @@ -SDCardCSD in os::drivers::block::sdcard - Rust - -
pub struct SDCardCSD {
Show 32 fields - pub CSDStruct: u8, - pub SysSpecVersion: u8, - pub Reserved1: u8, - pub TAAC: u8, - pub NSAC: u8, - pub MaxBusClkFrec: u8, - pub CardComdClasses: u16, - pub RdBlockLen: u8, - pub PartBlockRead: u8, - pub WrBlockMisalign: u8, - pub RdBlockMisalign: u8, - pub DSRImpl: u8, - pub Reserved2: u8, - pub DeviceSize: u32, - pub EraseGrSize: u8, - pub EraseGrMul: u8, - pub WrProtectGrSize: u8, - pub WrProtectGrEnable: u8, - pub ManDeflECC: u8, - pub WrSpeedFact: u8, - pub MaxWrBlockLen: u8, - pub WriteBlockPaPartial: u8, - pub Reserved3: u8, - pub ContentProtectAppli: u8, - pub FileFormatGroup: u8, - pub CopyFlag: u8, - pub PermWrProtect: u8, - pub TempWrProtect: u8, - pub FileFormat: u8, - pub ECC: u8, - pub CSD_CRC: u8, - pub Reserved4: u8, -
}
Expand description

Card Specific Data: CSD Register

-

Fields

CSDStruct: u8SysSpecVersion: u8Reserved1: u8TAAC: u8NSAC: u8MaxBusClkFrec: u8CardComdClasses: u16RdBlockLen: u8PartBlockRead: u8WrBlockMisalign: u8RdBlockMisalign: u8DSRImpl: u8Reserved2: u8DeviceSize: u32EraseGrSize: u8EraseGrMul: u8WrProtectGrSize: u8WrProtectGrEnable: u8ManDeflECC: u8WrSpeedFact: u8MaxWrBlockLen: u8WriteBlockPaPartial: u8Reserved3: u8ContentProtectAppli: u8FileFormatGroup: u8CopyFlag: u8PermWrProtect: u8TempWrProtect: u8FileFormat: u8ECC: u8CSD_CRC: u8Reserved4: u8

Trait Implementations

Returns a copy of the value. Read more

-

Performs copy-assignment from source. Read more

-

Formats the value using the given formatter. Read more

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The resulting type after obtaining ownership.

-

Creates owned data from borrowed data, usually by cloning. Read more

-
🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
- \ No newline at end of file diff --git a/ch6-dev/os/drivers/block/sdcard/struct.SDCardInfo.html b/ch6-dev/os/drivers/block/sdcard/struct.SDCardInfo.html deleted file mode 100644 index b8df7a02..00000000 --- a/ch6-dev/os/drivers/block/sdcard/struct.SDCardInfo.html +++ /dev/null @@ -1,31 +0,0 @@ -SDCardInfo in os::drivers::block::sdcard - Rust - -
pub struct SDCardInfo {
-    pub SD_csd: SDCardCSD,
-    pub SD_cid: SDCardCID,
-    pub CardCapacity: u64,
-    pub CardBlockSize: u64,
-}
Expand description

Card information

-

Fields

SD_csd: SDCardCSDSD_cid: SDCardCIDCardCapacity: u64CardBlockSize: u64

Trait Implementations

Returns a copy of the value. Read more

-

Performs copy-assignment from source. Read more

-

Formats the value using the given formatter. Read more

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The resulting type after obtaining ownership.

-

Creates owned data from borrowed data, usually by cloning. Read more

-
🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
- \ No newline at end of file diff --git a/ch6-dev/os/drivers/block/sdcard/struct.SDCardWrapper.html b/ch6-dev/os/drivers/block/sdcard/struct.SDCardWrapper.html deleted file mode 100644 index 280e5152..00000000 --- a/ch6-dev/os/drivers/block/sdcard/struct.SDCardWrapper.html +++ /dev/null @@ -1,21 +0,0 @@ -SDCardWrapper in os::drivers::block::sdcard - Rust - -
pub struct SDCardWrapper(UPSafeCell<SDCard<SPIImpl<SPI0>>>);

Tuple Fields

0: UPSafeCell<SDCard<SPIImpl<SPI0>>>

Implementations

Trait Implementations

Read data form block to buffer

-

Write data from buffer to block

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
- \ No newline at end of file diff --git a/ch6-dev/os/drivers/block/sidebar-items.js b/ch6-dev/os/drivers/block/sidebar-items.js index 11ff3e4d..c3481c60 100644 --- a/ch6-dev/os/drivers/block/sidebar-items.js +++ b/ch6-dev/os/drivers/block/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"fn":[["block_device_test",""]],"mod":[["sdcard",""],["virtio_blk",""]],"struct":[["BLOCK_DEVICE",""]]}); \ No newline at end of file +window.SIDEBAR_ITEMS = {"fn":["block_device_test"],"mod":["virtio_blk"],"struct":["BLOCK_DEVICE"]}; \ No newline at end of file diff --git a/ch6-dev/os/drivers/block/struct.BLOCK_DEVICE.html b/ch6-dev/os/drivers/block/struct.BLOCK_DEVICE.html index c56b5de3..a60bc1c5 100644 --- a/ch6-dev/os/drivers/block/struct.BLOCK_DEVICE.html +++ b/ch6-dev/os/drivers/block/struct.BLOCK_DEVICE.html @@ -1,23 +1,13 @@ -BLOCK_DEVICE in os::drivers::block - Rust - -
pub struct BLOCK_DEVICE {
+BLOCK_DEVICE in os::drivers::block - Rust

Struct os::drivers::block::BLOCK_DEVICE

source ·
pub struct BLOCK_DEVICE {
     __private_field: (),
-}

Fields

__private_field: ()

Trait Implementations

The resulting type after dereferencing.

-

Dereferences the value.

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+}

Fields§

§__private_field: ()

Trait Implementations§

source§

impl Deref for BLOCK_DEVICE

§

type Target = Arc<dyn BlockDevice, Global>

The resulting type after dereferencing.
source§

fn deref(&self) -> &Arc<dyn BlockDevice>

Dereferences the value.
source§

impl LazyStatic for BLOCK_DEVICE

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
- \ No newline at end of file +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/ch6-dev/os/drivers/block/virtio_blk/constant.VIRTIO0.html b/ch6-dev/os/drivers/block/virtio_blk/constant.VIRTIO0.html index 6cd46f6e..b7f0ca66 100644 --- a/ch6-dev/os/drivers/block/virtio_blk/constant.VIRTIO0.html +++ b/ch6-dev/os/drivers/block/virtio_blk/constant.VIRTIO0.html @@ -1,8 +1 @@ -VIRTIO0 in os::drivers::block::virtio_blk - Rust - -
const VIRTIO0: usize = 0x10001000;
- \ No newline at end of file +VIRTIO0 in os::drivers::block::virtio_blk - Rust

Constant os::drivers::block::virtio_blk::VIRTIO0

source ·
const VIRTIO0: usize = 0x10001000;
\ No newline at end of file diff --git a/ch6-dev/os/drivers/block/virtio_blk/fn.virtio_dma_alloc.html b/ch6-dev/os/drivers/block/virtio_blk/fn.virtio_dma_alloc.html deleted file mode 100644 index 304546b4..00000000 --- a/ch6-dev/os/drivers/block/virtio_blk/fn.virtio_dma_alloc.html +++ /dev/null @@ -1,9 +0,0 @@ -virtio_dma_alloc in os::drivers::block::virtio_blk - Rust - -
#[no_mangle]
-pub extern "C" fn virtio_dma_alloc(pages: usize) -> PhysAddr
- \ No newline at end of file diff --git a/ch6-dev/os/drivers/block/virtio_blk/fn.virtio_dma_dealloc.html b/ch6-dev/os/drivers/block/virtio_blk/fn.virtio_dma_dealloc.html deleted file mode 100644 index 292c54bc..00000000 --- a/ch6-dev/os/drivers/block/virtio_blk/fn.virtio_dma_dealloc.html +++ /dev/null @@ -1,9 +0,0 @@ -virtio_dma_dealloc in os::drivers::block::virtio_blk - Rust - -
#[no_mangle]
-pub extern "C" fn virtio_dma_dealloc(
    pa: PhysAddr,
    pages: usize
) -> i32
- \ No newline at end of file diff --git a/ch6-dev/os/drivers/block/virtio_blk/fn.virtio_phys_to_virt.html b/ch6-dev/os/drivers/block/virtio_blk/fn.virtio_phys_to_virt.html deleted file mode 100644 index 7d23a8dd..00000000 --- a/ch6-dev/os/drivers/block/virtio_blk/fn.virtio_phys_to_virt.html +++ /dev/null @@ -1,9 +0,0 @@ -virtio_phys_to_virt in os::drivers::block::virtio_blk - Rust - -
#[no_mangle]
-pub extern "C" fn virtio_phys_to_virt(paddr: PhysAddr) -> VirtAddr
- \ No newline at end of file diff --git a/ch6-dev/os/drivers/block/virtio_blk/fn.virtio_virt_to_phys.html b/ch6-dev/os/drivers/block/virtio_blk/fn.virtio_virt_to_phys.html deleted file mode 100644 index 199c4b17..00000000 --- a/ch6-dev/os/drivers/block/virtio_blk/fn.virtio_virt_to_phys.html +++ /dev/null @@ -1,9 +0,0 @@ -virtio_virt_to_phys in os::drivers::block::virtio_blk - Rust - -
#[no_mangle]
-pub extern "C" fn virtio_virt_to_phys(vaddr: VirtAddr) -> PhysAddr
- \ No newline at end of file diff --git a/ch6-dev/os/drivers/block/virtio_blk/index.html b/ch6-dev/os/drivers/block/virtio_blk/index.html index 7cde2000..972b84a4 100644 --- a/ch6-dev/os/drivers/block/virtio_blk/index.html +++ b/ch6-dev/os/drivers/block/virtio_blk/index.html @@ -1,11 +1 @@ -os::drivers::block::virtio_blk - Rust - -
- \ No newline at end of file +os::drivers::block::virtio_blk - Rust
\ No newline at end of file diff --git a/ch6-dev/os/drivers/block/virtio_blk/sidebar-items.js b/ch6-dev/os/drivers/block/virtio_blk/sidebar-items.js index 06229704..eea77e12 100644 --- a/ch6-dev/os/drivers/block/virtio_blk/sidebar-items.js +++ b/ch6-dev/os/drivers/block/virtio_blk/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"constant":[["VIRTIO0",""]],"fn":[["virtio_dma_alloc",""],["virtio_dma_dealloc",""],["virtio_phys_to_virt",""],["virtio_virt_to_phys",""]],"struct":[["QUEUE_FRAMES",""],["VirtIOBlock",""]]}); \ No newline at end of file +window.SIDEBAR_ITEMS = {"constant":["VIRTIO0"],"struct":["QUEUE_FRAMES","VirtIOBlock","VirtioHal"]}; \ No newline at end of file diff --git a/ch6-dev/os/drivers/block/virtio_blk/struct.QUEUE_FRAMES.html b/ch6-dev/os/drivers/block/virtio_blk/struct.QUEUE_FRAMES.html index 46bbb728..dbd25a96 100644 --- a/ch6-dev/os/drivers/block/virtio_blk/struct.QUEUE_FRAMES.html +++ b/ch6-dev/os/drivers/block/virtio_blk/struct.QUEUE_FRAMES.html @@ -1,24 +1,14 @@ -QUEUE_FRAMES in os::drivers::block::virtio_blk - Rust - -
struct QUEUE_FRAMES {
+QUEUE_FRAMES in os::drivers::block::virtio_blk - Rust
struct QUEUE_FRAMES {
     __private_field: (),
-}

Fields

__private_field: ()

Methods from Deref<Target = UPSafeCell<Vec<FrameTracker>>>

Exclusive access inner data in UPSafeCell. Panic if the data has been borrowed.

-

Trait Implementations

The resulting type after dereferencing.

-

Dereferences the value.

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+}

Fields§

§__private_field: ()

Methods from Deref<Target = UPSafeCell<Vec<FrameTracker>>>§

source

pub fn exclusive_access(&self) -> RefMut<'_, T>

Exclusive access inner data in UPSafeCell. Panic if the data has been borrowed.

+

Trait Implementations§

source§

impl Deref for QUEUE_FRAMES

§

type Target = UPSafeCell<Vec<FrameTracker, Global>>

The resulting type after dereferencing.
source§

fn deref(&self) -> &UPSafeCell<Vec<FrameTracker>>

Dereferences the value.
source§

impl LazyStatic for QUEUE_FRAMES

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
- \ No newline at end of file +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/ch6-dev/os/drivers/block/virtio_blk/struct.VirtIOBlock.html b/ch6-dev/os/drivers/block/virtio_blk/struct.VirtIOBlock.html index 50e5a7fc..39682cc0 100644 --- a/ch6-dev/os/drivers/block/virtio_blk/struct.VirtIOBlock.html +++ b/ch6-dev/os/drivers/block/virtio_blk/struct.VirtIOBlock.html @@ -1,21 +1,11 @@ -VirtIOBlock in os::drivers::block::virtio_blk - Rust - -
pub struct VirtIOBlock(UPSafeCell<VirtIOBlk<'static>>);

Tuple Fields

0: UPSafeCell<VirtIOBlk<'static>>

Implementations

Trait Implementations

Read data form block to buffer

-

Write data from buffer to block

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+VirtIOBlock in os::drivers::block::virtio_blk - Rust
pub struct VirtIOBlock(UPSafeCell<VirtIOBlk<'static, VirtioHal>>);

Tuple Fields§

§0: UPSafeCell<VirtIOBlk<'static, VirtioHal>>

Implementations§

source§

impl VirtIOBlock

source

pub fn new() -> Self

Trait Implementations§

source§

impl BlockDevice for VirtIOBlock

source§

fn read_block(&self, block_id: usize, buf: &mut [u8])

Read data form block to buffer
source§

fn write_block(&self, block_id: usize, buf: &[u8])

Write data from buffer to block

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
- \ No newline at end of file +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/ch6-dev/os/drivers/block/virtio_blk/struct.VirtioHal.html b/ch6-dev/os/drivers/block/virtio_blk/struct.VirtioHal.html new file mode 100644 index 00000000..47afd70c --- /dev/null +++ b/ch6-dev/os/drivers/block/virtio_blk/struct.VirtioHal.html @@ -0,0 +1,13 @@ +VirtioHal in os::drivers::block::virtio_blk - Rust
pub struct VirtioHal;

Trait Implementations§

source§

impl Hal for VirtioHal

source§

fn dma_alloc(pages: usize) -> usize

Allocates the given number of contiguous physical pages of DMA memory for virtio use.
source§

fn dma_dealloc(pa: usize, pages: usize) -> i32

Deallocates the given contiguous physical DMA memory pages.
source§

fn phys_to_virt(addr: usize) -> usize

Converts a physical address used for virtio to a virtual address which the program can +access.
source§

fn virt_to_phys(vaddr: usize) -> usize

Converts a virtual address which the program can access to the corresponding physical +address to use for virtio.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/ch6-dev/os/drivers/index.html b/ch6-dev/os/drivers/index.html index 45ff82c3..4712bbe7 100644 --- a/ch6-dev/os/drivers/index.html +++ b/ch6-dev/os/drivers/index.html @@ -1,10 +1 @@ -os::drivers - Rust - -
-

Module os::drivers

source · []

Re-exports

-
pub use block::BLOCK_DEVICE;
pub use block::BLOCK_DEVICE;

Modules

-
- \ No newline at end of file +os::drivers - Rust

Module os::drivers

source ·

Re-exports

Modules

\ No newline at end of file diff --git a/ch6-dev/os/drivers/sidebar-items.js b/ch6-dev/os/drivers/sidebar-items.js index 7c00c7a4..5ecd9a7b 100644 --- a/ch6-dev/os/drivers/sidebar-items.js +++ b/ch6-dev/os/drivers/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"mod":[["block",""]]}); \ No newline at end of file +window.SIDEBAR_ITEMS = {"mod":["block"]}; \ No newline at end of file diff --git a/ch6-dev/os/fn.clear_bss.html b/ch6-dev/os/fn.clear_bss.html index 5cf0aa99..4d4daf17 100644 --- a/ch6-dev/os/fn.clear_bss.html +++ b/ch6-dev/os/fn.clear_bss.html @@ -1,9 +1,2 @@ -clear_bss in os - Rust - -
-

Function os::clear_bss

source · []
pub(crate) fn clear_bss()
Expand description

clear BSS segment

-
- \ No newline at end of file +clear_bss in os - Rust

Function os::clear_bss

source ·
pub(crate) fn clear_bss()
Expand description

clear BSS segment

+
\ No newline at end of file diff --git a/ch6-dev/os/fn.rust_main.html b/ch6-dev/os/fn.rust_main.html index cf6f341f..e783e67e 100644 --- a/ch6-dev/os/fn.rust_main.html +++ b/ch6-dev/os/fn.rust_main.html @@ -1,10 +1,3 @@ -rust_main in os - Rust - -
-

Function os::rust_main

source · []
#[no_mangle]
-pub fn rust_main() -> !
Expand description

the rust entry-point of os

-
- \ No newline at end of file +rust_main in os - Rust

Function os::rust_main

source ·
#[no_mangle]
+pub fn rust_main() -> !
Expand description

the rust entry-point of os

+
\ No newline at end of file diff --git a/ch6-dev/os/fs/fn.list_apps.html b/ch6-dev/os/fs/fn.list_apps.html index 6e9347aa..886c5a13 100644 --- a/ch6-dev/os/fs/fn.list_apps.html +++ b/ch6-dev/os/fs/fn.list_apps.html @@ -1,9 +1,2 @@ -list_apps in os::fs - Rust - -
-

Function os::fs::list_apps

source · []
pub fn list_apps()
Expand description

List all files in the filesystems

-
- \ No newline at end of file +list_apps in os::fs - Rust

Function os::fs::list_apps

source ·
pub fn list_apps()
Expand description

List all files in the filesystems

+
\ No newline at end of file diff --git a/ch6-dev/os/fs/fn.open_file.html b/ch6-dev/os/fs/fn.open_file.html index 9a2faded..a77f6b99 100644 --- a/ch6-dev/os/fs/fn.open_file.html +++ b/ch6-dev/os/fs/fn.open_file.html @@ -1,9 +1,2 @@ -open_file in os::fs - Rust - -
-

Function os::fs::open_file

source · []
pub fn open_file(name: &str, flags: OpenFlags) -> Option<Arc<OSInode>>
Expand description

Open file with flags

-
- \ No newline at end of file +open_file in os::fs - Rust

Function os::fs::open_file

source ·
pub fn open_file(name: &str, flags: OpenFlags) -> Option<Arc<OSInode>>
Expand description

Open file with flags

+
\ No newline at end of file diff --git a/ch6-dev/os/fs/index.html b/ch6-dev/os/fs/index.html index f3ab1858..8b0d45d0 100644 --- a/ch6-dev/os/fs/index.html +++ b/ch6-dev/os/fs/index.html @@ -1,25 +1,5 @@ -os::fs - Rust - -
-

Module os::fs

source · []
Expand description

File system in os

-

Modules

-
inode 🔒

Arc<Inode> -> OSInodeInner: In order to open files concurrently +os::fs - Rust

Module os::fs

source ·
Expand description

File system in os

+

Modules

  • inode 🔒
    Arc<Inode> -> OSInodeInner: In order to open files concurrently we need to wrap Inode into Arc,but Mutex in Inode prevents -file systems from being accessed simultaneously

    -
stdio 🔒

Stdin & Stdout

-

Structs

-

A wrapper around a filesystem inode -to implement File trait atop

-

Open file flags

-

Standard input

-

Standard output

-

Traits

-

File trait

-

Functions

-

List all files in the filesystems

-

Open file with flags

-
- \ No newline at end of file +file systems from being accessed simultaneously
  • stdio 🔒
    Stdin & Stdout
  • Structs

    • A wrapper around a filesystem inode +to implement File trait atop
    • Open file flags
    • Standard input
    • Standard output

    Traits

    Functions

    \ No newline at end of file diff --git a/ch6-dev/os/fs/inode/constant.BLOCK_CACHE_SIZE.html b/ch6-dev/os/fs/inode/constant.BLOCK_CACHE_SIZE.html new file mode 100644 index 00000000..2c44f885 --- /dev/null +++ b/ch6-dev/os/fs/inode/constant.BLOCK_CACHE_SIZE.html @@ -0,0 +1 @@ +BLOCK_CACHE_SIZE in os::fs::inode - Rust

    Constant os::fs::inode::BLOCK_CACHE_SIZE

    source ·
    const BLOCK_CACHE_SIZE: usize = 64;
    \ No newline at end of file diff --git a/ch6-dev/os/fs/inode/fn.list_apps.html b/ch6-dev/os/fs/inode/fn.list_apps.html index 375dd1a5..deeb30e8 100644 --- a/ch6-dev/os/fs/inode/fn.list_apps.html +++ b/ch6-dev/os/fs/inode/fn.list_apps.html @@ -1,9 +1,2 @@ -list_apps in os::fs::inode - Rust - -
    -

    Function os::fs::inode::list_apps

    source · []
    pub fn list_apps()
    Expand description

    List all files in the filesystems

    -
    - \ No newline at end of file +list_apps in os::fs::inode - Rust

    Function os::fs::inode::list_apps

    source ·
    pub fn list_apps()
    Expand description

    List all files in the filesystems

    +
    \ No newline at end of file diff --git a/ch6-dev/os/fs/inode/fn.open_file.html b/ch6-dev/os/fs/inode/fn.open_file.html index 17696c13..a4ac4f68 100644 --- a/ch6-dev/os/fs/inode/fn.open_file.html +++ b/ch6-dev/os/fs/inode/fn.open_file.html @@ -1,9 +1,2 @@ -open_file in os::fs::inode - Rust - -
    -

    Function os::fs::inode::open_file

    source · []
    pub fn open_file(name: &str, flags: OpenFlags) -> Option<Arc<OSInode>>
    Expand description

    Open file with flags

    -
    - \ No newline at end of file +open_file in os::fs::inode - Rust

    Function os::fs::inode::open_file

    source ·
    pub fn open_file(name: &str, flags: OpenFlags) -> Option<Arc<OSInode>>
    Expand description

    Open file with flags

    +
    \ No newline at end of file diff --git a/ch6-dev/os/fs/inode/index.html b/ch6-dev/os/fs/inode/index.html index 0b700acd..3d71b29a 100644 --- a/ch6-dev/os/fs/inode/index.html +++ b/ch6-dev/os/fs/inode/index.html @@ -1,21 +1,7 @@ -os::fs::inode - Rust - -
    -

    Module os::fs::inode

    source · []
    Expand description

    Arc<Inode> -> OSInodeInner: In order to open files concurrently +os::fs::inode - Rust

    Module os::fs::inode

    source ·
    Expand description

    Arc<Inode> -> OSInodeInner: In order to open files concurrently we need to wrap Inode into Arc,but Mutex in Inode prevents file systems from being accessed simultaneously

    UPSafeCell<OSInodeInner> -> OSInode: for static ROOT_INODE,we need to wrap OSInodeInner into UPSafeCell

    -

    Structs

    -

    A wrapper around a filesystem inode -to implement File trait atop

    -

    The OS inode inner in ‘UPSafeCell’

    -

    Open file flags

    -

    Functions

    -

    List all files in the filesystems

    -

    Open file with flags

    -
    - \ No newline at end of file +

    Structs

    Constants

    Functions

    Type Aliases

    \ No newline at end of file diff --git a/ch6-dev/os/fs/inode/sidebar-items.js b/ch6-dev/os/fs/inode/sidebar-items.js index d6fbc299..cd97407c 100644 --- a/ch6-dev/os/fs/inode/sidebar-items.js +++ b/ch6-dev/os/fs/inode/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"fn":[["list_apps","List all files in the filesystems"],["open_file","Open file with flags"]],"struct":[["OSInode","A wrapper around a filesystem inode to implement File trait atop"],["OSInodeInner","The OS inode inner in ‘UPSafeCell’"],["OpenFlags","Open file flags"],["ROOT_INODE",""]]}); \ No newline at end of file +window.SIDEBAR_ITEMS = {"constant":["BLOCK_CACHE_SIZE"],"fn":["list_apps","open_file"],"struct":["OSInode","OSInodeInner","OpenFlags","ROOT_INODE"],"type":["InodeType"]}; \ No newline at end of file diff --git a/ch6-dev/os/fs/inode/struct.OSInode.html b/ch6-dev/os/fs/inode/struct.OSInode.html index 0cee49da..141fa511 100644 --- a/ch6-dev/os/fs/inode/struct.OSInode.html +++ b/ch6-dev/os/fs/inode/struct.OSInode.html @@ -1,31 +1,23 @@ -OSInode in os::fs::inode - Rust - -
    -

    Struct os::fs::inode::OSInode

    source · []
    pub struct OSInode {
    +OSInode in os::fs::inode - Rust

    Struct os::fs::inode::OSInode

    source ·
    pub struct OSInode {
         readable: bool,
         writable: bool,
         inner: UPSafeCell<OSInodeInner>,
    -}
    Expand description

    A wrapper around a filesystem inode +}

    Expand description

    A wrapper around a filesystem inode to implement File trait atop

    -

    Fields

    readable: boolwritable: boolinner: UPSafeCell<OSInodeInner>

    Implementations

    Construct an OS inode from a inode

    -

    Read all data inside a inode into vector

    -

    Trait Implementations

    If readable

    -

    If writable

    -

    Read file to UserBuffer

    -

    Write UserBuffer to file

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +

    Fields§

    §readable: bool§writable: bool§inner: UPSafeCell<OSInodeInner>

    Implementations§

    source§

    impl OSInode

    source

    pub fn new( + readable: bool, + writable: bool, + inode: Arc<Inode<RawExclusiveLock, BLOCK_CACHE_SIZE, RawExclusiveLock, RawExclusiveLock>> +) -> Self

    Construct an OS inode from a inode

    +
    source

    pub fn read_all(&self) -> Vec<u8>

    Read all data inside a inode into vector

    +

    Trait Implementations§

    source§

    impl File for OSInode

    source§

    fn readable(&self) -> bool

    If readable
    source§

    fn writable(&self) -> bool

    If writable
    source§

    fn read(&self, buf: UserBuffer) -> usize

    Read file to UserBuffer
    source§

    fn write(&self, buf: UserBuffer) -> usize

    Write UserBuffer to file

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/fs/inode/struct.OSInodeInner.html b/ch6-dev/os/fs/inode/struct.OSInodeInner.html index 6c8d7ce5..dd57446e 100644 --- a/ch6-dev/os/fs/inode/struct.OSInodeInner.html +++ b/ch6-dev/os/fs/inode/struct.OSInodeInner.html @@ -1,23 +1,15 @@ -OSInodeInner in os::fs::inode - Rust - -
    pub struct OSInodeInner {
    +OSInodeInner in os::fs::inode - Rust

    Struct os::fs::inode::OSInodeInner

    source ·
    pub struct OSInodeInner {
         offset: usize,
    -    inode: Arc<Inode>,
    -}
    Expand description

    The OS inode inner in ‘UPSafeCell’

    -

    Fields

    offset: usizeinode: Arc<Inode>

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    + inode: Arc<Inode<RawExclusiveLock, BLOCK_CACHE_SIZE, RawExclusiveLock, RawExclusiveLock>>, +}
    Expand description

    The OS inode inner in ‘UPSafeCell’

    +

    Fields§

    §offset: usize§inode: Arc<Inode<RawExclusiveLock, BLOCK_CACHE_SIZE, RawExclusiveLock, RawExclusiveLock>>

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/fs/inode/struct.OpenFlags.html b/ch6-dev/os/fs/inode/struct.OpenFlags.html index 5908a036..046245aa 100644 --- a/ch6-dev/os/fs/inode/struct.OpenFlags.html +++ b/ch6-dev/os/fs/inode/struct.OpenFlags.html @@ -1,25 +1,19 @@ -OpenFlags in os::fs::inode - Rust - -
    -

    Struct os::fs::inode::OpenFlags

    source · []
    pub struct OpenFlags {
    +OpenFlags in os::fs::inode - Rust

    Struct os::fs::inode::OpenFlags

    source ·
    pub struct OpenFlags {
         bits: u32,
    -}
    Expand description

    Open file flags

    -

    Fields

    bits: u32

    Implementations

    Read only

    -

    Write only

    -

    Read & Write

    -

    Allow create

    -

    Clear file and return an empty one

    -

    Returns an empty set of flags.

    -

    Returns the set containing all flags.

    -

    Returns the raw value of the flags currently stored.

    -

    Convert from underlying bit representation, unless that +}

    Expand description

    Open file flags

    +

    Fields§

    §bits: u32

    Implementations§

    source§

    impl OpenFlags

    source

    pub const RDONLY: Self = _

    Read only

    +
    source

    pub const WRONLY: Self = _

    Write only

    +
    source

    pub const RDWR: Self = _

    Read & Write

    +
    source

    pub const CREATE: Self = _

    Allow create

    +
    source

    pub const TRUNC: Self = _

    Clear file and return an empty one

    +
    source

    pub const fn empty() -> Self

    Returns an empty set of flags.

    +
    source

    pub const fn all() -> Self

    Returns the set containing all flags.

    +
    source

    pub const fn bits(&self) -> u32

    Returns the raw value of the flags currently stored.

    +
    source

    pub const fn from_bits(bits: u32) -> Option<Self>

    Convert from underlying bit representation, unless that representation contains bits that do not correspond to a flag.

    -

    Convert from underlying bit representation, dropping any bits +

    source

    pub const fn from_bits_truncate(bits: u32) -> Self

    Convert from underlying bit representation, dropping any bits that do not correspond to flags.

    -

    Convert from underlying bit representation, preserving all +

    source

    pub const unsafe fn from_bits_unchecked(bits: u32) -> Self

    Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).

    Safety

    The caller of the bitflags! macro can chose to allow or @@ -27,35 +21,35 @@ disallow extra bits for their bitflags type.

    The caller of from_bits_unchecked() has to ensure that all bits correspond to a defined flag or that extra bits are valid for this bitflags type.

    -

    Returns true if no flags are currently stored.

    -

    Returns true if all flags are currently set.

    -

    Returns true if there are flags common to both self and other.

    -

    Returns true if all of the flags in other are contained within self.

    -

    Inserts the specified flags in-place.

    -

    Removes the specified flags in-place.

    -

    Toggles the specified flags in-place.

    -

    Inserts or removes the specified flags depending on the passed value.

    -

    Returns the intersection between the flags in self and +

    source

    pub const fn is_empty(&self) -> bool

    Returns true if no flags are currently stored.

    +
    source

    pub const fn is_all(&self) -> bool

    Returns true if all flags are currently set.

    +
    source

    pub const fn intersects(&self, other: Self) -> bool

    Returns true if there are flags common to both self and other.

    +
    source

    pub const fn contains(&self, other: Self) -> bool

    Returns true if all of the flags in other are contained within self.

    +
    source

    pub fn insert(&mut self, other: Self)

    Inserts the specified flags in-place.

    +
    source

    pub fn remove(&mut self, other: Self)

    Removes the specified flags in-place.

    +
    source

    pub fn toggle(&mut self, other: Self)

    Toggles the specified flags in-place.

    +
    source

    pub fn set(&mut self, other: Self, value: bool)

    Inserts or removes the specified flags depending on the passed value.

    +
    source

    pub const fn intersection(self, other: Self) -> Self

    Returns the intersection between the flags in self and other.

    Specifically, the returned set contains only the flags which are present in both self and other.

    This is equivalent to using the & operator (e.g. ops::BitAnd), as in flags & other.

    -

    Returns the union of between the flags in self and other.

    +
    source

    pub const fn union(self, other: Self) -> Self

    Returns the union of between the flags in self and other.

    Specifically, the returned set contains all flags which are present in either self or other, including any which are -present in both (see Self::symmetric_difference if that +present in both (see Self::symmetric_difference if that is undesirable).

    This is equivalent to using the | operator (e.g. ops::BitOr), as in flags | other.

    -

    Returns the difference between the flags in self and other.

    +
    source

    pub const fn difference(self, other: Self) -> Self

    Returns the difference between the flags in self and other.

    Specifically, the returned set contains all flags present in self, except for the ones present in other.

    It is also conceptually equivalent to the “bit-clear” operation: flags & !other (and this syntax is also supported).

    This is equivalent to using the - operator (e.g. ops::Sub), as in flags - other.

    -

    Returns the symmetric difference between the flags +

    source

    pub const fn symmetric_difference(self, other: Self) -> Self

    Returns the symmetric difference between the flags in self and other.

    Specifically, the returned set contains the flags present which are present in self or other, but that are not present in @@ -63,69 +57,42 @@ both. Equivalently, it contains the flags present in exactly one of the sets self and other.

    This is equivalent to using the ^ operator (e.g. ops::BitXor), as in flags ^ other.

    -

    Returns the complement of this set of flags.

    +
    source

    pub const fn complement(self) -> Self

    Returns the complement of this set of flags.

    Specifically, the returned set contains all the flags which are not set in self, but which are allowed for this type.

    Alternatively, it can be thought of as the set difference -between Self::all() and self (e.g. Self::all() - self)

    +between Self::all() and self (e.g. Self::all() - self)

    This is equivalent to using the ! operator (e.g. ops::Not), as in !flags.

    -

    Do not check validity for simplicity +

    source§

    impl OpenFlags

    source

    pub fn read_write(&self) -> (bool, bool)

    Do not check validity for simplicity Return (readable, writable)

    -

    Trait Implementations

    Formats the value using the given formatter.

    -

    Returns the intersection between the two sets of flags.

    -

    The resulting type after applying the & operator.

    -

    Disables all flags disabled in the set.

    -

    Returns the union of the two sets of flags.

    -

    The resulting type after applying the | operator.

    -

    Adds the set of flags.

    -

    Returns the left flags, but with all the right flags toggled.

    -

    The resulting type after applying the ^ operator.

    -

    Toggles the set of flags.

    -

    Returns a copy of the value. Read more

    -

    Performs copy-assignment from source. Read more

    -

    Formats the value using the given formatter. Read more

    -

    Extends a collection with the contents of an iterator. Read more

    -
    🔬 This is a nightly-only experimental API. (extend_one)

    Extends a collection with exactly one element.

    -
    🔬 This is a nightly-only experimental API. (extend_one)

    Reserves capacity in a collection for the given number of additional elements. Read more

    -

    Creates a value from an iterator. Read more

    -

    Feeds this value into the given Hasher. Read more

    -

    Feeds a slice of this type into the given Hasher. Read more

    -

    Formats the value using the given formatter.

    -

    Returns the complement of this set of flags.

    -

    The resulting type after applying the ! operator.

    -

    Formats the value using the given formatter.

    -

    This method returns an Ordering between self and other. Read more

    -

    Compares and returns the maximum of two values. Read more

    -

    Compares and returns the minimum of two values. Read more

    -

    Restrict a value to a certain interval. Read more

    -

    This method tests for self and other values to be equal, and is used -by ==. Read more

    -

    This method tests for !=.

    -

    This method returns an ordering between self and other values if one exists. Read more

    -

    This method tests less than (for self and other) and is used by the < operator. Read more

    -

    This method tests less than or equal to (for self and other) and is used by the <= -operator. Read more

    -

    This method tests greater than (for self and other) and is used by the > operator. Read more

    -

    This method tests greater than or equal to (for self and other) and is used by the >= -operator. Read more

    -

    Returns the set difference of the two sets of flags.

    -

    The resulting type after applying the - operator.

    -

    Disables all flags enabled in the set.

    -

    Formats the value using the given formatter.

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +

    Trait Implementations§

    source§

    impl Binary for OpenFlags

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter.
    source§

    impl BitAnd<OpenFlags> for OpenFlags

    source§

    fn bitand(self, other: Self) -> Self

    Returns the intersection between the two sets of flags.

    +
    §

    type Output = OpenFlags

    The resulting type after applying the & operator.
    source§

    impl BitAndAssign<OpenFlags> for OpenFlags

    source§

    fn bitand_assign(&mut self, other: Self)

    Disables all flags disabled in the set.

    +
    source§

    impl BitOr<OpenFlags> for OpenFlags

    source§

    fn bitor(self, other: OpenFlags) -> Self

    Returns the union of the two sets of flags.

    +
    §

    type Output = OpenFlags

    The resulting type after applying the | operator.
    source§

    impl BitOrAssign<OpenFlags> for OpenFlags

    source§

    fn bitor_assign(&mut self, other: Self)

    Adds the set of flags.

    +
    source§

    impl BitXor<OpenFlags> for OpenFlags

    source§

    fn bitxor(self, other: Self) -> Self

    Returns the left flags, but with all the right flags toggled.

    +
    §

    type Output = OpenFlags

    The resulting type after applying the ^ operator.
    source§

    impl BitXorAssign<OpenFlags> for OpenFlags

    source§

    fn bitxor_assign(&mut self, other: Self)

    Toggles the set of flags.

    +
    source§

    impl Clone for OpenFlags

    source§

    fn clone(&self) -> OpenFlags

    Returns a copy of the value. Read more
    1.0.0 · source§

    fn clone_from(&mut self, source: &Self)

    Performs copy-assignment from source. Read more
    source§

    impl Debug for OpenFlags

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    source§

    impl Extend<OpenFlags> for OpenFlags

    source§

    fn extend<T: IntoIterator<Item = Self>>(&mut self, iterator: T)

    Extends a collection with the contents of an iterator. Read more
    source§

    fn extend_one(&mut self, item: A)

    🔬This is a nightly-only experimental API. (extend_one)
    Extends a collection with exactly one element.
    source§

    fn extend_reserve(&mut self, additional: usize)

    🔬This is a nightly-only experimental API. (extend_one)
    Reserves capacity in a collection for the given number of additional elements. Read more
    source§

    impl FromIterator<OpenFlags> for OpenFlags

    source§

    fn from_iter<T: IntoIterator<Item = Self>>(iterator: T) -> Self

    Creates a value from an iterator. Read more
    source§

    impl Hash for OpenFlags

    source§

    fn hash<__H: Hasher>(&self, state: &mut __H)

    Feeds this value into the given Hasher. Read more
    1.3.0 · source§

    fn hash_slice<H>(data: &[Self], state: &mut H)where + H: Hasher, + Self: Sized,

    Feeds a slice of this type into the given Hasher. Read more
    source§

    impl LowerHex for OpenFlags

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter.
    source§

    impl Not for OpenFlags

    source§

    fn not(self) -> Self

    Returns the complement of this set of flags.

    +
    §

    type Output = OpenFlags

    The resulting type after applying the ! operator.
    source§

    impl Octal for OpenFlags

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter.
    source§

    impl Ord for OpenFlags

    source§

    fn cmp(&self, other: &OpenFlags) -> Ordering

    This method returns an Ordering between self and other. Read more
    1.21.0 · source§

    fn max(self, other: Self) -> Selfwhere + Self: Sized,

    Compares and returns the maximum of two values. Read more
    1.21.0 · source§

    fn min(self, other: Self) -> Selfwhere + Self: Sized,

    Compares and returns the minimum of two values. Read more
    1.50.0 · source§

    fn clamp(self, min: Self, max: Self) -> Selfwhere + Self: Sized + PartialOrd<Self>,

    Restrict a value to a certain interval. Read more
    source§

    impl PartialEq<OpenFlags> for OpenFlags

    source§

    fn eq(&self, other: &OpenFlags) -> bool

    This method tests for self and other values to be equal, and is used +by ==.
    1.0.0 · source§

    fn ne(&self, other: &Rhs) -> bool

    This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
    source§

    impl PartialOrd<OpenFlags> for OpenFlags

    source§

    fn partial_cmp(&self, other: &OpenFlags) -> Option<Ordering>

    This method returns an ordering between self and other values if one exists. Read more
    1.0.0 · source§

    fn lt(&self, other: &Rhs) -> bool

    This method tests less than (for self and other) and is used by the < operator. Read more
    1.0.0 · source§

    fn le(&self, other: &Rhs) -> bool

    This method tests less than or equal to (for self and other) and is used by the <= +operator. Read more
    1.0.0 · source§

    fn gt(&self, other: &Rhs) -> bool

    This method tests greater than (for self and other) and is used by the > operator. Read more
    1.0.0 · source§

    fn ge(&self, other: &Rhs) -> bool

    This method tests greater than or equal to (for self and other) and is used by the >= +operator. Read more
    source§

    impl Sub<OpenFlags> for OpenFlags

    source§

    fn sub(self, other: Self) -> Self

    Returns the set difference of the two sets of flags.

    +
    §

    type Output = OpenFlags

    The resulting type after applying the - operator.
    source§

    impl SubAssign<OpenFlags> for OpenFlags

    source§

    fn sub_assign(&mut self, other: Self)

    Disables all flags enabled in the set.

    +
    source§

    impl UpperHex for OpenFlags

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter.
    source§

    impl Copy for OpenFlags

    source§

    impl Eq for OpenFlags

    source§

    impl StructuralEq for OpenFlags

    source§

    impl StructuralPartialEq for OpenFlags

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The resulting type after obtaining ownership.

    -

    Creates owned data from borrowed data, usually by cloning. Read more

    -
    🔬 This is a nightly-only experimental API. (toowned_clone_into)

    Uses borrowed data to replace owned data, usually by cloning. Read more

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T> ToOwned for Twhere + T: Clone,

    §

    type Owned = T

    The resulting type after obtaining ownership.
    source§

    fn to_owned(&self) -> T

    Creates owned data from borrowed data, usually by cloning. Read more
    source§

    fn clone_into(&self, target: &mut T)

    Uses borrowed data to replace owned data, usually by cloning. Read more
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/fs/inode/struct.ROOT_INODE.html b/ch6-dev/os/fs/inode/struct.ROOT_INODE.html index f2d25cac..9471dc11 100644 --- a/ch6-dev/os/fs/inode/struct.ROOT_INODE.html +++ b/ch6-dev/os/fs/inode/struct.ROOT_INODE.html @@ -1,23 +1,15 @@ -ROOT_INODE in os::fs::inode - Rust - -
    -

    Struct os::fs::inode::ROOT_INODE

    source · []
    pub struct ROOT_INODE {
    +ROOT_INODE in os::fs::inode - Rust

    Struct os::fs::inode::ROOT_INODE

    source ·
    pub struct ROOT_INODE {
         __private_field: (),
    -}

    Fields

    __private_field: ()

    Trait Implementations

    The resulting type after dereferencing.

    -

    Dereferences the value.

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +}

    Fields§

    §__private_field: ()

    Trait Implementations§

    source§

    impl Deref for ROOT_INODE

    §

    type Target = Arc<Inode<RawExclusiveLock, BLOCK_CACHE_SIZE, RawExclusiveLock, RawExclusiveLock>, Global>

    The resulting type after dereferencing.
    source§

    fn deref( + &self +) -> &Arc<Inode<RawExclusiveLock, BLOCK_CACHE_SIZE, RawExclusiveLock, RawExclusiveLock>>

    Dereferences the value.
    source§

    impl LazyStatic for ROOT_INODE

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/fs/inode/type.InodeType.html b/ch6-dev/os/fs/inode/type.InodeType.html new file mode 100644 index 00000000..cf1d482d --- /dev/null +++ b/ch6-dev/os/fs/inode/type.InodeType.html @@ -0,0 +1,5 @@ +InodeType in os::fs::inode - Rust

    Type Alias os::fs::inode::InodeType

    source ·
    type InodeType = Inode<RawExclusiveLock, BLOCK_CACHE_SIZE, RawExclusiveLock, RawExclusiveLock>;

    Aliased Type§

    struct InodeType {
    +    block_id: usize,
    +    block_offset: usize,
    +    fs: Arc<Mutex<RawExclusiveLock, EasyFileSystem<64, RawExclusiveLock, RawExclusiveLock>>, Global>,
    +}

    Fields§

    §block_id: usize§block_offset: usize§fs: Arc<Mutex<RawExclusiveLock, EasyFileSystem<64, RawExclusiveLock, RawExclusiveLock>>, Global>
    \ No newline at end of file diff --git a/ch6-dev/os/fs/sidebar-items.js b/ch6-dev/os/fs/sidebar-items.js index ddc620a7..111cf21a 100644 --- a/ch6-dev/os/fs/sidebar-items.js +++ b/ch6-dev/os/fs/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"fn":[["list_apps","List all files in the filesystems"],["open_file","Open file with flags"]],"mod":[["inode","`Arc` -> `OSInodeInner`: In order to open files concurrently we need to wrap `Inode` into `Arc`,but `Mutex` in `Inode` prevents file systems from being accessed simultaneously"],["stdio","Stdin & Stdout"]],"struct":[["OSInode","A wrapper around a filesystem inode to implement File trait atop"],["OpenFlags","Open file flags"],["Stdin","Standard input"],["Stdout","Standard output"]],"trait":[["File","File trait"]]}); \ No newline at end of file +window.SIDEBAR_ITEMS = {"fn":["list_apps","open_file"],"mod":["inode","stdio"],"struct":["OSInode","OpenFlags","Stdin","Stdout"],"trait":["File"]}; \ No newline at end of file diff --git a/ch6-dev/os/fs/stdio/index.html b/ch6-dev/os/fs/stdio/index.html index 07bc9e70..7f81f1c6 100644 --- a/ch6-dev/os/fs/stdio/index.html +++ b/ch6-dev/os/fs/stdio/index.html @@ -1,12 +1,2 @@ -os::fs::stdio - Rust - -
    -

    Module os::fs::stdio

    source · []
    Expand description

    Stdin & Stdout

    -

    Structs

    -

    Standard input

    -

    Standard output

    -
    - \ No newline at end of file +os::fs::stdio - Rust

    Module os::fs::stdio

    source ·
    Expand description

    Stdin & Stdout

    +

    Structs

    \ No newline at end of file diff --git a/ch6-dev/os/fs/stdio/sidebar-items.js b/ch6-dev/os/fs/stdio/sidebar-items.js index 666252a2..d61fa3a2 100644 --- a/ch6-dev/os/fs/stdio/sidebar-items.js +++ b/ch6-dev/os/fs/stdio/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"struct":[["Stdin","Standard input"],["Stdout","Standard output"]]}); \ No newline at end of file +window.SIDEBAR_ITEMS = {"struct":["Stdin","Stdout"]}; \ No newline at end of file diff --git a/ch6-dev/os/fs/stdio/struct.Stdin.html b/ch6-dev/os/fs/stdio/struct.Stdin.html index ad37a241..ba0a3e85 100644 --- a/ch6-dev/os/fs/stdio/struct.Stdin.html +++ b/ch6-dev/os/fs/stdio/struct.Stdin.html @@ -1,24 +1,12 @@ -Stdin in os::fs::stdio - Rust - -
    -

    Struct os::fs::stdio::Stdin

    source · []
    pub struct Stdin;
    Expand description

    Standard input

    -

    Trait Implementations

    If readable

    -

    If writable

    -

    Read file to UserBuffer

    -

    Write UserBuffer to file

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +Stdin in os::fs::stdio - Rust

    Struct os::fs::stdio::Stdin

    source ·
    pub struct Stdin;
    Expand description

    Standard input

    +

    Trait Implementations§

    source§

    impl File for Stdin

    source§

    fn readable(&self) -> bool

    If readable
    source§

    fn writable(&self) -> bool

    If writable
    source§

    fn read(&self, user_buf: UserBuffer) -> usize

    Read file to UserBuffer
    source§

    fn write(&self, _user_buf: UserBuffer) -> usize

    Write UserBuffer to file

    Auto Trait Implementations§

    §

    impl RefUnwindSafe for Stdin

    §

    impl Send for Stdin

    §

    impl Sync for Stdin

    §

    impl Unpin for Stdin

    §

    impl UnwindSafe for Stdin

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/fs/stdio/struct.Stdout.html b/ch6-dev/os/fs/stdio/struct.Stdout.html index 4d614467..99f7be7b 100644 --- a/ch6-dev/os/fs/stdio/struct.Stdout.html +++ b/ch6-dev/os/fs/stdio/struct.Stdout.html @@ -1,24 +1,12 @@ -Stdout in os::fs::stdio - Rust - -
    -

    Struct os::fs::stdio::Stdout

    source · []
    pub struct Stdout;
    Expand description

    Standard output

    -

    Trait Implementations

    If readable

    -

    If writable

    -

    Read file to UserBuffer

    -

    Write UserBuffer to file

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +Stdout in os::fs::stdio - Rust

    Struct os::fs::stdio::Stdout

    source ·
    pub struct Stdout;
    Expand description

    Standard output

    +

    Trait Implementations§

    source§

    impl File for Stdout

    source§

    fn readable(&self) -> bool

    If readable
    source§

    fn writable(&self) -> bool

    If writable
    source§

    fn read(&self, _user_buf: UserBuffer) -> usize

    Read file to UserBuffer
    source§

    fn write(&self, user_buf: UserBuffer) -> usize

    Write UserBuffer to file

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/fs/struct.OSInode.html b/ch6-dev/os/fs/struct.OSInode.html index 883257bb..81e88c17 100644 --- a/ch6-dev/os/fs/struct.OSInode.html +++ b/ch6-dev/os/fs/struct.OSInode.html @@ -1,31 +1,23 @@ -OSInode in os::fs - Rust - -
    -

    Struct os::fs::OSInode

    source · []
    pub struct OSInode {
    +OSInode in os::fs - Rust

    Struct os::fs::OSInode

    source ·
    pub struct OSInode {
         readable: bool,
         writable: bool,
         inner: UPSafeCell<OSInodeInner>,
    -}
    Expand description

    A wrapper around a filesystem inode +}

    Expand description

    A wrapper around a filesystem inode to implement File trait atop

    -

    Fields

    readable: boolwritable: boolinner: UPSafeCell<OSInodeInner>

    Implementations

    Construct an OS inode from a inode

    -

    Read all data inside a inode into vector

    -

    Trait Implementations

    If readable

    -

    If writable

    -

    Read file to UserBuffer

    -

    Write UserBuffer to file

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +

    Fields§

    §readable: bool§writable: bool§inner: UPSafeCell<OSInodeInner>

    Implementations§

    source§

    impl OSInode

    source

    pub fn new( + readable: bool, + writable: bool, + inode: Arc<Inode<RawExclusiveLock, BLOCK_CACHE_SIZE, RawExclusiveLock, RawExclusiveLock>> +) -> Self

    Construct an OS inode from a inode

    +
    source

    pub fn read_all(&self) -> Vec<u8>

    Read all data inside a inode into vector

    +

    Trait Implementations§

    source§

    impl File for OSInode

    source§

    fn readable(&self) -> bool

    If readable
    source§

    fn writable(&self) -> bool

    If writable
    source§

    fn read(&self, buf: UserBuffer) -> usize

    Read file to UserBuffer
    source§

    fn write(&self, buf: UserBuffer) -> usize

    Write UserBuffer to file

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/fs/struct.OpenFlags.html b/ch6-dev/os/fs/struct.OpenFlags.html index 891f1e21..0bb282c8 100644 --- a/ch6-dev/os/fs/struct.OpenFlags.html +++ b/ch6-dev/os/fs/struct.OpenFlags.html @@ -1,25 +1,19 @@ -OpenFlags in os::fs - Rust - -
    -

    Struct os::fs::OpenFlags

    source · []
    pub struct OpenFlags {
    +OpenFlags in os::fs - Rust

    Struct os::fs::OpenFlags

    source ·
    pub struct OpenFlags {
         bits: u32,
    -}
    Expand description

    Open file flags

    -

    Fields

    bits: u32

    Implementations

    Read only

    -

    Write only

    -

    Read & Write

    -

    Allow create

    -

    Clear file and return an empty one

    -

    Returns an empty set of flags.

    -

    Returns the set containing all flags.

    -

    Returns the raw value of the flags currently stored.

    -

    Convert from underlying bit representation, unless that +}

    Expand description

    Open file flags

    +

    Fields§

    §bits: u32

    Implementations§

    source§

    impl OpenFlags

    source

    pub const RDONLY: Self = _

    Read only

    +
    source

    pub const WRONLY: Self = _

    Write only

    +
    source

    pub const RDWR: Self = _

    Read & Write

    +
    source

    pub const CREATE: Self = _

    Allow create

    +
    source

    pub const TRUNC: Self = _

    Clear file and return an empty one

    +
    source

    pub const fn empty() -> Self

    Returns an empty set of flags.

    +
    source

    pub const fn all() -> Self

    Returns the set containing all flags.

    +
    source

    pub const fn bits(&self) -> u32

    Returns the raw value of the flags currently stored.

    +
    source

    pub const fn from_bits(bits: u32) -> Option<Self>

    Convert from underlying bit representation, unless that representation contains bits that do not correspond to a flag.

    -

    Convert from underlying bit representation, dropping any bits +

    source

    pub const fn from_bits_truncate(bits: u32) -> Self

    Convert from underlying bit representation, dropping any bits that do not correspond to flags.

    -

    Convert from underlying bit representation, preserving all +

    source

    pub const unsafe fn from_bits_unchecked(bits: u32) -> Self

    Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).

    Safety

    The caller of the bitflags! macro can chose to allow or @@ -27,35 +21,35 @@ disallow extra bits for their bitflags type.

    The caller of from_bits_unchecked() has to ensure that all bits correspond to a defined flag or that extra bits are valid for this bitflags type.

    -

    Returns true if no flags are currently stored.

    -

    Returns true if all flags are currently set.

    -

    Returns true if there are flags common to both self and other.

    -

    Returns true if all of the flags in other are contained within self.

    -

    Inserts the specified flags in-place.

    -

    Removes the specified flags in-place.

    -

    Toggles the specified flags in-place.

    -

    Inserts or removes the specified flags depending on the passed value.

    -

    Returns the intersection between the flags in self and +

    source

    pub const fn is_empty(&self) -> bool

    Returns true if no flags are currently stored.

    +
    source

    pub const fn is_all(&self) -> bool

    Returns true if all flags are currently set.

    +
    source

    pub const fn intersects(&self, other: Self) -> bool

    Returns true if there are flags common to both self and other.

    +
    source

    pub const fn contains(&self, other: Self) -> bool

    Returns true if all of the flags in other are contained within self.

    +
    source

    pub fn insert(&mut self, other: Self)

    Inserts the specified flags in-place.

    +
    source

    pub fn remove(&mut self, other: Self)

    Removes the specified flags in-place.

    +
    source

    pub fn toggle(&mut self, other: Self)

    Toggles the specified flags in-place.

    +
    source

    pub fn set(&mut self, other: Self, value: bool)

    Inserts or removes the specified flags depending on the passed value.

    +
    source

    pub const fn intersection(self, other: Self) -> Self

    Returns the intersection between the flags in self and other.

    Specifically, the returned set contains only the flags which are present in both self and other.

    This is equivalent to using the & operator (e.g. ops::BitAnd), as in flags & other.

    -

    Returns the union of between the flags in self and other.

    +
    source

    pub const fn union(self, other: Self) -> Self

    Returns the union of between the flags in self and other.

    Specifically, the returned set contains all flags which are present in either self or other, including any which are -present in both (see Self::symmetric_difference if that +present in both (see Self::symmetric_difference if that is undesirable).

    This is equivalent to using the | operator (e.g. ops::BitOr), as in flags | other.

    -

    Returns the difference between the flags in self and other.

    +
    source

    pub const fn difference(self, other: Self) -> Self

    Returns the difference between the flags in self and other.

    Specifically, the returned set contains all flags present in self, except for the ones present in other.

    It is also conceptually equivalent to the “bit-clear” operation: flags & !other (and this syntax is also supported).

    This is equivalent to using the - operator (e.g. ops::Sub), as in flags - other.

    -

    Returns the symmetric difference between the flags +

    source

    pub const fn symmetric_difference(self, other: Self) -> Self

    Returns the symmetric difference between the flags in self and other.

    Specifically, the returned set contains the flags present which are present in self or other, but that are not present in @@ -63,69 +57,42 @@ both. Equivalently, it contains the flags present in exactly one of the sets self and other.

    This is equivalent to using the ^ operator (e.g. ops::BitXor), as in flags ^ other.

    -

    Returns the complement of this set of flags.

    +
    source

    pub const fn complement(self) -> Self

    Returns the complement of this set of flags.

    Specifically, the returned set contains all the flags which are not set in self, but which are allowed for this type.

    Alternatively, it can be thought of as the set difference -between Self::all() and self (e.g. Self::all() - self)

    +between Self::all() and self (e.g. Self::all() - self)

    This is equivalent to using the ! operator (e.g. ops::Not), as in !flags.

    -

    Do not check validity for simplicity +

    source§

    impl OpenFlags

    source

    pub fn read_write(&self) -> (bool, bool)

    Do not check validity for simplicity Return (readable, writable)

    -

    Trait Implementations

    Formats the value using the given formatter.

    -

    Returns the intersection between the two sets of flags.

    -

    The resulting type after applying the & operator.

    -

    Disables all flags disabled in the set.

    -

    Returns the union of the two sets of flags.

    -

    The resulting type after applying the | operator.

    -

    Adds the set of flags.

    -

    Returns the left flags, but with all the right flags toggled.

    -

    The resulting type after applying the ^ operator.

    -

    Toggles the set of flags.

    -

    Returns a copy of the value. Read more

    -

    Performs copy-assignment from source. Read more

    -

    Formats the value using the given formatter. Read more

    -

    Extends a collection with the contents of an iterator. Read more

    -
    🔬 This is a nightly-only experimental API. (extend_one)

    Extends a collection with exactly one element.

    -
    🔬 This is a nightly-only experimental API. (extend_one)

    Reserves capacity in a collection for the given number of additional elements. Read more

    -

    Creates a value from an iterator. Read more

    -

    Feeds this value into the given Hasher. Read more

    -

    Feeds a slice of this type into the given Hasher. Read more

    -

    Formats the value using the given formatter.

    -

    Returns the complement of this set of flags.

    -

    The resulting type after applying the ! operator.

    -

    Formats the value using the given formatter.

    -

    This method returns an Ordering between self and other. Read more

    -

    Compares and returns the maximum of two values. Read more

    -

    Compares and returns the minimum of two values. Read more

    -

    Restrict a value to a certain interval. Read more

    -

    This method tests for self and other values to be equal, and is used -by ==. Read more

    -

    This method tests for !=.

    -

    This method returns an ordering between self and other values if one exists. Read more

    -

    This method tests less than (for self and other) and is used by the < operator. Read more

    -

    This method tests less than or equal to (for self and other) and is used by the <= -operator. Read more

    -

    This method tests greater than (for self and other) and is used by the > operator. Read more

    -

    This method tests greater than or equal to (for self and other) and is used by the >= -operator. Read more

    -

    Returns the set difference of the two sets of flags.

    -

    The resulting type after applying the - operator.

    -

    Disables all flags enabled in the set.

    -

    Formats the value using the given formatter.

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +

    Trait Implementations§

    source§

    impl Binary for OpenFlags

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter.
    source§

    impl BitAnd<OpenFlags> for OpenFlags

    source§

    fn bitand(self, other: Self) -> Self

    Returns the intersection between the two sets of flags.

    +
    §

    type Output = OpenFlags

    The resulting type after applying the & operator.
    source§

    impl BitAndAssign<OpenFlags> for OpenFlags

    source§

    fn bitand_assign(&mut self, other: Self)

    Disables all flags disabled in the set.

    +
    source§

    impl BitOr<OpenFlags> for OpenFlags

    source§

    fn bitor(self, other: OpenFlags) -> Self

    Returns the union of the two sets of flags.

    +
    §

    type Output = OpenFlags

    The resulting type after applying the | operator.
    source§

    impl BitOrAssign<OpenFlags> for OpenFlags

    source§

    fn bitor_assign(&mut self, other: Self)

    Adds the set of flags.

    +
    source§

    impl BitXor<OpenFlags> for OpenFlags

    source§

    fn bitxor(self, other: Self) -> Self

    Returns the left flags, but with all the right flags toggled.

    +
    §

    type Output = OpenFlags

    The resulting type after applying the ^ operator.
    source§

    impl BitXorAssign<OpenFlags> for OpenFlags

    source§

    fn bitxor_assign(&mut self, other: Self)

    Toggles the set of flags.

    +
    source§

    impl Clone for OpenFlags

    source§

    fn clone(&self) -> OpenFlags

    Returns a copy of the value. Read more
    1.0.0 · source§

    fn clone_from(&mut self, source: &Self)

    Performs copy-assignment from source. Read more
    source§

    impl Debug for OpenFlags

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    source§

    impl Extend<OpenFlags> for OpenFlags

    source§

    fn extend<T: IntoIterator<Item = Self>>(&mut self, iterator: T)

    Extends a collection with the contents of an iterator. Read more
    source§

    fn extend_one(&mut self, item: A)

    🔬This is a nightly-only experimental API. (extend_one)
    Extends a collection with exactly one element.
    source§

    fn extend_reserve(&mut self, additional: usize)

    🔬This is a nightly-only experimental API. (extend_one)
    Reserves capacity in a collection for the given number of additional elements. Read more
    source§

    impl FromIterator<OpenFlags> for OpenFlags

    source§

    fn from_iter<T: IntoIterator<Item = Self>>(iterator: T) -> Self

    Creates a value from an iterator. Read more
    source§

    impl Hash for OpenFlags

    source§

    fn hash<__H: Hasher>(&self, state: &mut __H)

    Feeds this value into the given Hasher. Read more
    1.3.0 · source§

    fn hash_slice<H>(data: &[Self], state: &mut H)where + H: Hasher, + Self: Sized,

    Feeds a slice of this type into the given Hasher. Read more
    source§

    impl LowerHex for OpenFlags

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter.
    source§

    impl Not for OpenFlags

    source§

    fn not(self) -> Self

    Returns the complement of this set of flags.

    +
    §

    type Output = OpenFlags

    The resulting type after applying the ! operator.
    source§

    impl Octal for OpenFlags

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter.
    source§

    impl Ord for OpenFlags

    source§

    fn cmp(&self, other: &OpenFlags) -> Ordering

    This method returns an Ordering between self and other. Read more
    1.21.0 · source§

    fn max(self, other: Self) -> Selfwhere + Self: Sized,

    Compares and returns the maximum of two values. Read more
    1.21.0 · source§

    fn min(self, other: Self) -> Selfwhere + Self: Sized,

    Compares and returns the minimum of two values. Read more
    1.50.0 · source§

    fn clamp(self, min: Self, max: Self) -> Selfwhere + Self: Sized + PartialOrd<Self>,

    Restrict a value to a certain interval. Read more
    source§

    impl PartialEq<OpenFlags> for OpenFlags

    source§

    fn eq(&self, other: &OpenFlags) -> bool

    This method tests for self and other values to be equal, and is used +by ==.
    1.0.0 · source§

    fn ne(&self, other: &Rhs) -> bool

    This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
    source§

    impl PartialOrd<OpenFlags> for OpenFlags

    source§

    fn partial_cmp(&self, other: &OpenFlags) -> Option<Ordering>

    This method returns an ordering between self and other values if one exists. Read more
    1.0.0 · source§

    fn lt(&self, other: &Rhs) -> bool

    This method tests less than (for self and other) and is used by the < operator. Read more
    1.0.0 · source§

    fn le(&self, other: &Rhs) -> bool

    This method tests less than or equal to (for self and other) and is used by the <= +operator. Read more
    1.0.0 · source§

    fn gt(&self, other: &Rhs) -> bool

    This method tests greater than (for self and other) and is used by the > operator. Read more
    1.0.0 · source§

    fn ge(&self, other: &Rhs) -> bool

    This method tests greater than or equal to (for self and other) and is used by the >= +operator. Read more
    source§

    impl Sub<OpenFlags> for OpenFlags

    source§

    fn sub(self, other: Self) -> Self

    Returns the set difference of the two sets of flags.

    +
    §

    type Output = OpenFlags

    The resulting type after applying the - operator.
    source§

    impl SubAssign<OpenFlags> for OpenFlags

    source§

    fn sub_assign(&mut self, other: Self)

    Disables all flags enabled in the set.

    +
    source§

    impl UpperHex for OpenFlags

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter.
    source§

    impl Copy for OpenFlags

    source§

    impl Eq for OpenFlags

    source§

    impl StructuralEq for OpenFlags

    source§

    impl StructuralPartialEq for OpenFlags

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The resulting type after obtaining ownership.

    -

    Creates owned data from borrowed data, usually by cloning. Read more

    -
    🔬 This is a nightly-only experimental API. (toowned_clone_into)

    Uses borrowed data to replace owned data, usually by cloning. Read more

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T> ToOwned for Twhere + T: Clone,

    §

    type Owned = T

    The resulting type after obtaining ownership.
    source§

    fn to_owned(&self) -> T

    Creates owned data from borrowed data, usually by cloning. Read more
    source§

    fn clone_into(&self, target: &mut T)

    Uses borrowed data to replace owned data, usually by cloning. Read more
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/fs/struct.Stdin.html b/ch6-dev/os/fs/struct.Stdin.html index c8b22bf9..6356c7d5 100644 --- a/ch6-dev/os/fs/struct.Stdin.html +++ b/ch6-dev/os/fs/struct.Stdin.html @@ -1,24 +1,12 @@ -Stdin in os::fs - Rust - -
    -

    Struct os::fs::Stdin

    source · []
    pub struct Stdin;
    Expand description

    Standard input

    -

    Trait Implementations

    If readable

    -

    If writable

    -

    Read file to UserBuffer

    -

    Write UserBuffer to file

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +Stdin in os::fs - Rust

    Struct os::fs::Stdin

    source ·
    pub struct Stdin;
    Expand description

    Standard input

    +

    Trait Implementations§

    source§

    impl File for Stdin

    source§

    fn readable(&self) -> bool

    If readable
    source§

    fn writable(&self) -> bool

    If writable
    source§

    fn read(&self, user_buf: UserBuffer) -> usize

    Read file to UserBuffer
    source§

    fn write(&self, _user_buf: UserBuffer) -> usize

    Write UserBuffer to file

    Auto Trait Implementations§

    §

    impl RefUnwindSafe for Stdin

    §

    impl Send for Stdin

    §

    impl Sync for Stdin

    §

    impl Unpin for Stdin

    §

    impl UnwindSafe for Stdin

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/fs/struct.Stdout.html b/ch6-dev/os/fs/struct.Stdout.html index 834ebe41..b3c2cb37 100644 --- a/ch6-dev/os/fs/struct.Stdout.html +++ b/ch6-dev/os/fs/struct.Stdout.html @@ -1,24 +1,12 @@ -Stdout in os::fs - Rust - -
    -

    Struct os::fs::Stdout

    source · []
    pub struct Stdout;
    Expand description

    Standard output

    -

    Trait Implementations

    If readable

    -

    If writable

    -

    Read file to UserBuffer

    -

    Write UserBuffer to file

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +Stdout in os::fs - Rust

    Struct os::fs::Stdout

    source ·
    pub struct Stdout;
    Expand description

    Standard output

    +

    Trait Implementations§

    source§

    impl File for Stdout

    source§

    fn readable(&self) -> bool

    If readable
    source§

    fn writable(&self) -> bool

    If writable
    source§

    fn read(&self, _user_buf: UserBuffer) -> usize

    Read file to UserBuffer
    source§

    fn write(&self, user_buf: UserBuffer) -> usize

    Write UserBuffer to file

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/fs/trait.File.html b/ch6-dev/os/fs/trait.File.html index db79d78f..e6ebe38f 100644 --- a/ch6-dev/os/fs/trait.File.html +++ b/ch6-dev/os/fs/trait.File.html @@ -1,18 +1,12 @@ -File in os::fs - Rust - -
    -

    Trait os::fs::File

    source · []
    pub trait File: Send + Sync {
    -    fn readable(&self) -> bool;
    -    fn writable(&self) -> bool;
    -    fn read(&self, buf: UserBuffer) -> usize;
    -    fn write(&self, buf: UserBuffer) -> usize;
    -}
    Expand description

    File trait

    -

    Required methods

    If readable

    -

    If writable

    -

    Read file to UserBuffer

    -

    Write UserBuffer to file

    -

    Implementors

    - \ No newline at end of file +File in os::fs - Rust

    Trait os::fs::File

    source ·
    pub trait File: Send + Sync {
    +    // Required methods
    +    fn readable(&self) -> bool;
    +    fn writable(&self) -> bool;
    +    fn read(&self, buf: UserBuffer) -> usize;
    +    fn write(&self, buf: UserBuffer) -> usize;
    +}
    Expand description

    File trait

    +

    Required Methods§

    source

    fn readable(&self) -> bool

    If readable

    +
    source

    fn writable(&self) -> bool

    If writable

    +
    source

    fn read(&self, buf: UserBuffer) -> usize

    Read file to UserBuffer

    +
    source

    fn write(&self, buf: UserBuffer) -> usize

    Write UserBuffer to file

    +

    Implementors§

    \ No newline at end of file diff --git a/ch6-dev/os/index.html b/ch6-dev/os/index.html index 1bb3423c..e16eec99 100644 --- a/ch6-dev/os/index.html +++ b/ch6-dev/os/index.html @@ -1,43 +1,18 @@ -os - Rust - -
    -

    Crate os

    source · []
    Expand description

    The main module and entrypoint

    +os - Rust

    Crate os

    source ·
    Expand description

    The main module and entrypoint

    Various facilities of the kernels are implemented as submodules. The most important ones are:

      -
    • trap: Handles all cases of switching from userspace to the kernel
    • -
    • task: Task management
    • -
    • syscall: System call handling and implementation
    • -
    • mm: Address map using SV39
    • -
    • sync: Wrap a static data structure inside it so that we are able to access it without any unsafe.
    • -
    • fs: Separate user from file system with some structures
    • +
    • trap: Handles all cases of switching from userspace to the kernel
    • +
    • task: Task management
    • +
    • syscall: System call handling and implementation
    • +
    • mm: Address map using SV39
    • +
    • sync: Wrap a static data structure inside it so that we are able to access it without any unsafe.
    • +
    • fs: Separate user from file system with some structures

    The operating system also starts in this module. Kernel code starts -executing from entry.asm, after which rust_main() is called to +executing from entry.asm, after which rust_main() is called to initialize various pieces of functionality. (See its source code for details.)

    -

    We then call task::run_tasks() and for the first time go to +

    We then call task::run_tasks() and for the first time go to userspace.

    -

    Modules

    -
    board 🔒
    config 🔒

    Constants used in rCore

    -
    console 🔒

    SBI console driver, for text output

    -
    drivers 🔒

    File system in os

    -

    The panic handler

    -

    Memory management implementation

    -

    SBI call wrappers

    -

    Synchronization and interior mutability primitives

    -

    Implementation of syscalls

    -

    Task management implementation

    -

    RISC-V timer-related functionality

    -

    Trap handling functionality

    -

    Macros

    -

    print string macro

    -

    println string macro

    -

    Functions

    -
    clear_bss 🔒

    clear BSS segment

    -

    the rust entry-point of os

    -
    - \ No newline at end of file +

    Modules

    • board 🔒
    • config 🔒
      Constants used in rCore
    • console 🔒
      SBI console driver, for text output
    • drivers 🔒
    • File system in os
    • The panic handler
    • Memory management implementation
    • SBI call wrappers
    • Synchronization and interior mutability primitives
    • Implementation of syscalls
    • Task management implementation
    • RISC-V timer-related functionality
    • Trap handling functionality

    Macros

    Functions

    \ No newline at end of file diff --git a/ch6-dev/os/lang_items/fn.panic.html b/ch6-dev/os/lang_items/fn.panic.html index 9bac00ce..1479ac8f 100644 --- a/ch6-dev/os/lang_items/fn.panic.html +++ b/ch6-dev/os/lang_items/fn.panic.html @@ -1,8 +1 @@ -panic in os::lang_items - Rust - -
    -

    Function os::lang_items::panic

    source · []
    fn panic(info: &PanicInfo<'_>) -> !
    - \ No newline at end of file +panic in os::lang_items - Rust

    Function os::lang_items::panic

    source ·
    fn panic(info: &PanicInfo<'_>) -> !
    \ No newline at end of file diff --git a/ch6-dev/os/lang_items/index.html b/ch6-dev/os/lang_items/index.html index b137cf66..b82ab874 100644 --- a/ch6-dev/os/lang_items/index.html +++ b/ch6-dev/os/lang_items/index.html @@ -1,10 +1,2 @@ -os::lang_items - Rust - -
    -

    Module os::lang_items

    source · []
    Expand description

    The panic handler

    -

    Functions

    -
    panic 🔒
    - \ No newline at end of file +os::lang_items - Rust

    Module os::lang_items

    source ·
    Expand description

    The panic handler

    +

    Functions

    \ No newline at end of file diff --git a/ch6-dev/os/lang_items/sidebar-items.js b/ch6-dev/os/lang_items/sidebar-items.js index 8ea0dd88..6330d593 100644 --- a/ch6-dev/os/lang_items/sidebar-items.js +++ b/ch6-dev/os/lang_items/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"fn":[["panic",""]]}); \ No newline at end of file +window.SIDEBAR_ITEMS = {"fn":["panic"]}; \ No newline at end of file diff --git a/ch6-dev/os/macro.print.html b/ch6-dev/os/macro.print.html index 388f897a..be9fdef8 100644 --- a/ch6-dev/os/macro.print.html +++ b/ch6-dev/os/macro.print.html @@ -1,12 +1,4 @@ -print in os - Rust - -
    -

    Macro os::print

    source · []
    macro_rules! print {
    -    ($fmt: literal $(, $($arg: tt)+)?) => { ... };
    -}
    -
    Expand description

    print string macro

    -
    - \ No newline at end of file +print in os - Rust

    Macro os::print

    source ·
    macro_rules! print {
    +    ($fmt: literal $(, $($arg: tt)+)?) => { ... };
    +}
    Expand description

    print string macro

    +
    \ No newline at end of file diff --git a/ch6-dev/os/macro.println.html b/ch6-dev/os/macro.println.html index 7073f76a..2117ac86 100644 --- a/ch6-dev/os/macro.println.html +++ b/ch6-dev/os/macro.println.html @@ -1,12 +1,4 @@ -println in os - Rust - -
    -

    Macro os::println

    source · []
    macro_rules! println {
    -    ($fmt: literal $(, $($arg: tt)+)?) => { ... };
    -}
    -
    Expand description

    println string macro

    -
    - \ No newline at end of file +println in os - Rust

    Macro os::println

    source ·
    macro_rules! println {
    +    ($fmt: literal $(, $($arg: tt)+)?) => { ... };
    +}
    Expand description

    println string macro

    +
    \ No newline at end of file diff --git a/ch6-dev/os/mm/address/constant.PA_WIDTH_SV39.html b/ch6-dev/os/mm/address/constant.PA_WIDTH_SV39.html index 9d084a30..a0b2542b 100644 --- a/ch6-dev/os/mm/address/constant.PA_WIDTH_SV39.html +++ b/ch6-dev/os/mm/address/constant.PA_WIDTH_SV39.html @@ -1,8 +1 @@ -PA_WIDTH_SV39 in os::mm::address - Rust - -
    const PA_WIDTH_SV39: usize = 56;
    - \ No newline at end of file +PA_WIDTH_SV39 in os::mm::address - Rust

    Constant os::mm::address::PA_WIDTH_SV39

    source ·
    const PA_WIDTH_SV39: usize = 56;
    \ No newline at end of file diff --git a/ch6-dev/os/mm/address/constant.PPN_WIDTH_SV39.html b/ch6-dev/os/mm/address/constant.PPN_WIDTH_SV39.html index 684a71e7..23c5ffdd 100644 --- a/ch6-dev/os/mm/address/constant.PPN_WIDTH_SV39.html +++ b/ch6-dev/os/mm/address/constant.PPN_WIDTH_SV39.html @@ -1,8 +1 @@ -PPN_WIDTH_SV39 in os::mm::address - Rust - -
    const PPN_WIDTH_SV39: usize = PA_WIDTH_SV39 - PAGE_SIZE_BITS; // 44usize
    - \ No newline at end of file +PPN_WIDTH_SV39 in os::mm::address - Rust

    Constant os::mm::address::PPN_WIDTH_SV39

    source ·
    const PPN_WIDTH_SV39: usize = _; // 44usize
    \ No newline at end of file diff --git a/ch6-dev/os/mm/address/constant.VA_WIDTH_SV39.html b/ch6-dev/os/mm/address/constant.VA_WIDTH_SV39.html index ef15067b..f2a5525e 100644 --- a/ch6-dev/os/mm/address/constant.VA_WIDTH_SV39.html +++ b/ch6-dev/os/mm/address/constant.VA_WIDTH_SV39.html @@ -1,8 +1 @@ -VA_WIDTH_SV39 in os::mm::address - Rust - -
    const VA_WIDTH_SV39: usize = 39;
    - \ No newline at end of file +VA_WIDTH_SV39 in os::mm::address - Rust

    Constant os::mm::address::VA_WIDTH_SV39

    source ·
    const VA_WIDTH_SV39: usize = 39;
    \ No newline at end of file diff --git a/ch6-dev/os/mm/address/constant.VPN_WIDTH_SV39.html b/ch6-dev/os/mm/address/constant.VPN_WIDTH_SV39.html index 55d91999..b8b1ba49 100644 --- a/ch6-dev/os/mm/address/constant.VPN_WIDTH_SV39.html +++ b/ch6-dev/os/mm/address/constant.VPN_WIDTH_SV39.html @@ -1,8 +1 @@ -VPN_WIDTH_SV39 in os::mm::address - Rust - -
    const VPN_WIDTH_SV39: usize = VA_WIDTH_SV39 - PAGE_SIZE_BITS; // 27usize
    - \ No newline at end of file +VPN_WIDTH_SV39 in os::mm::address - Rust

    Constant os::mm::address::VPN_WIDTH_SV39

    source ·
    const VPN_WIDTH_SV39: usize = _; // 27usize
    \ No newline at end of file diff --git a/ch6-dev/os/mm/address/index.html b/ch6-dev/os/mm/address/index.html index 78164824..3c364d27 100644 --- a/ch6-dev/os/mm/address/index.html +++ b/ch6-dev/os/mm/address/index.html @@ -1,21 +1,2 @@ -os::mm::address - Rust - -
    -

    Module os::mm::address

    source · []
    Expand description

    Implementation of physical and virtual address and page number.

    -

    Structs

    -

    Definitions

    -

    phiscal page number

    -

    a simple range structure for type T

    -

    iterator for the simple range structure

    -

    virtual address

    -

    virtual page number

    -

    Constants

    -

    Traits

    -

    Add value by one

    -

    Type Definitions

    -

    a simple range structure for virtual page number

    -
    - \ No newline at end of file +os::mm::address - Rust

    Module os::mm::address

    source ·
    Expand description

    Implementation of physical and virtual address and page number.

    +

    Structs

    Constants

    Traits

    Type Aliases

    • a simple range structure for virtual page number
    \ No newline at end of file diff --git a/ch6-dev/os/mm/address/sidebar-items.js b/ch6-dev/os/mm/address/sidebar-items.js index 3720794f..60e19a5a 100644 --- a/ch6-dev/os/mm/address/sidebar-items.js +++ b/ch6-dev/os/mm/address/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"constant":[["PA_WIDTH_SV39",""],["PPN_WIDTH_SV39",""],["VA_WIDTH_SV39",""],["VPN_WIDTH_SV39",""]],"struct":[["PhysAddr","Definitions"],["PhysPageNum","phiscal page number"],["SimpleRange","a simple range structure for type T"],["SimpleRangeIterator","iterator for the simple range structure"],["VirtAddr","virtual address"],["VirtPageNum","virtual page number"]],"trait":[["StepByOne","Add value by one"]],"type":[["VPNRange","a simple range structure for virtual page number"]]}); \ No newline at end of file +window.SIDEBAR_ITEMS = {"constant":["PA_WIDTH_SV39","PPN_WIDTH_SV39","VA_WIDTH_SV39","VPN_WIDTH_SV39"],"struct":["PhysAddr","PhysPageNum","SimpleRange","SimpleRangeIterator","VirtAddr","VirtPageNum"],"trait":["StepByOne"],"type":["VPNRange"]}; \ No newline at end of file diff --git a/ch6-dev/os/mm/address/struct.PhysAddr.html b/ch6-dev/os/mm/address/struct.PhysAddr.html index a7e8fc3c..5016b26d 100644 --- a/ch6-dev/os/mm/address/struct.PhysAddr.html +++ b/ch6-dev/os/mm/address/struct.PhysAddr.html @@ -1,53 +1,29 @@ -PhysAddr in os::mm::address - Rust - -
    -

    Struct os::mm::address::PhysAddr

    source · []
    #[repr(C)]
    pub struct PhysAddr(pub usize);
    Expand description

    Definitions

    -

    Tuple Fields

    0: usize

    Implementations

    PhysAddr->PhysPageNum

    -

    PhysAddr->PhysPageNum

    -

    Get page offset

    -

    Check page aligned

    -

    Get reference to PhysAddr value

    -

    Get mutable reference to PhysAddr value

    -

    Trait Implementations

    Returns a copy of the value. Read more

    -

    Performs copy-assignment from source. Read more

    -

    Formats the value using the given formatter. Read more

    -

    Converts to this type from the input type.

    -

    Converts to this type from the input type.

    -

    Converts to this type from the input type.

    -

    T: {PhysAddr, VirtAddr, PhysPageNum, VirtPageNum} +PhysAddr in os::mm::address - Rust

    Struct os::mm::address::PhysAddr

    source ·
    #[repr(C)]
    pub struct PhysAddr(pub usize);
    Expand description

    Definitions

    +

    Tuple Fields§

    §0: usize

    Implementations§

    source§

    impl PhysAddr

    source

    pub fn floor(&self) -> PhysPageNum

    PhysAddr->PhysPageNum

    +
    source

    pub fn ceil(&self) -> PhysPageNum

    PhysAddr->PhysPageNum

    +
    source

    pub fn page_offset(&self) -> usize

    Get page offset

    +
    source

    pub fn aligned(&self) -> bool

    Check page aligned

    +
    source§

    impl PhysAddr

    source

    pub fn get_ref<T>(&self) -> &'static T

    Get reference to PhysAddr value

    +
    source

    pub fn get_mut<T>(&self) -> &'static mut T

    Get mutable reference to PhysAddr value

    +

    Trait Implementations§

    source§

    impl Clone for PhysAddr

    source§

    fn clone(&self) -> PhysAddr

    Returns a copy of the value. Read more
    1.0.0 · source§

    fn clone_from(&mut self, source: &Self)

    Performs copy-assignment from source. Read more
    source§

    impl Debug for PhysAddr

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    source§

    impl From<PhysAddr> for PhysPageNum

    source§

    fn from(v: PhysAddr) -> Self

    Converts to this type from the input type.
    source§

    impl From<PhysAddr> for usize

    source§

    fn from(v: PhysAddr) -> Self

    Converts to this type from the input type.
    source§

    impl From<PhysPageNum> for PhysAddr

    source§

    fn from(v: PhysPageNum) -> Self

    Converts to this type from the input type.
    source§

    impl From<usize> for PhysAddr

    T: {PhysAddr, VirtAddr, PhysPageNum, VirtPageNum} T -> usize: T.0 usize -> T: usize.into()

    -

    Converts to this type from the input type.

    -

    This method returns an Ordering between self and other. Read more

    -

    Compares and returns the maximum of two values. Read more

    -

    Compares and returns the minimum of two values. Read more

    -

    Restrict a value to a certain interval. Read more

    -

    This method tests for self and other values to be equal, and is used -by ==. Read more

    -

    This method tests for !=.

    -

    This method returns an ordering between self and other values if one exists. Read more

    -

    This method tests less than (for self and other) and is used by the < operator. Read more

    -

    This method tests less than or equal to (for self and other) and is used by the <= -operator. Read more

    -

    This method tests greater than (for self and other) and is used by the > operator. Read more

    -

    This method tests greater than or equal to (for self and other) and is used by the >= -operator. Read more

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +
    source§

    fn from(v: usize) -> Self

    Converts to this type from the input type.
    source§

    impl Ord for PhysAddr

    source§

    fn cmp(&self, other: &PhysAddr) -> Ordering

    This method returns an Ordering between self and other. Read more
    1.21.0 · source§

    fn max(self, other: Self) -> Selfwhere + Self: Sized,

    Compares and returns the maximum of two values. Read more
    1.21.0 · source§

    fn min(self, other: Self) -> Selfwhere + Self: Sized,

    Compares and returns the minimum of two values. Read more
    1.50.0 · source§

    fn clamp(self, min: Self, max: Self) -> Selfwhere + Self: Sized + PartialOrd<Self>,

    Restrict a value to a certain interval. Read more
    source§

    impl PartialEq<PhysAddr> for PhysAddr

    source§

    fn eq(&self, other: &PhysAddr) -> bool

    This method tests for self and other values to be equal, and is used +by ==.
    1.0.0 · source§

    fn ne(&self, other: &Rhs) -> bool

    This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
    source§

    impl PartialOrd<PhysAddr> for PhysAddr

    source§

    fn partial_cmp(&self, other: &PhysAddr) -> Option<Ordering>

    This method returns an ordering between self and other values if one exists. Read more
    1.0.0 · source§

    fn lt(&self, other: &Rhs) -> bool

    This method tests less than (for self and other) and is used by the < operator. Read more
    1.0.0 · source§

    fn le(&self, other: &Rhs) -> bool

    This method tests less than or equal to (for self and other) and is used by the <= +operator. Read more
    1.0.0 · source§

    fn gt(&self, other: &Rhs) -> bool

    This method tests greater than (for self and other) and is used by the > operator. Read more
    1.0.0 · source§

    fn ge(&self, other: &Rhs) -> bool

    This method tests greater than or equal to (for self and other) and is used by the >= +operator. Read more
    source§

    impl Copy for PhysAddr

    source§

    impl Eq for PhysAddr

    source§

    impl StructuralEq for PhysAddr

    source§

    impl StructuralPartialEq for PhysAddr

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The resulting type after obtaining ownership.

    -

    Creates owned data from borrowed data, usually by cloning. Read more

    -
    🔬 This is a nightly-only experimental API. (toowned_clone_into)

    Uses borrowed data to replace owned data, usually by cloning. Read more

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T> ToOwned for Twhere + T: Clone,

    §

    type Owned = T

    The resulting type after obtaining ownership.
    source§

    fn to_owned(&self) -> T

    Creates owned data from borrowed data, usually by cloning. Read more
    source§

    fn clone_into(&self, target: &mut T)

    Uses borrowed data to replace owned data, usually by cloning. Read more
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/mm/address/struct.PhysPageNum.html b/ch6-dev/os/mm/address/struct.PhysPageNum.html index 6f55cc83..a71244e0 100644 --- a/ch6-dev/os/mm/address/struct.PhysPageNum.html +++ b/ch6-dev/os/mm/address/struct.PhysPageNum.html @@ -1,48 +1,23 @@ -PhysPageNum in os::mm::address - Rust - -
    #[repr(C)]
    pub struct PhysPageNum(pub usize);
    Expand description

    phiscal page number

    -

    Tuple Fields

    0: usize

    Implementations

    Get PageTableEntry on PhysPageNum

    -

    Get u8 array on PhysPageNum

    -

    Get Get mutable reference to PhysAddr value on PhysPageNum

    -

    Trait Implementations

    Returns a copy of the value. Read more

    -

    Performs copy-assignment from source. Read more

    -

    Formats the value using the given formatter. Read more

    -

    Converts to this type from the input type.

    -

    Converts to this type from the input type.

    -

    Converts to this type from the input type.

    -

    Converts to this type from the input type.

    -

    This method returns an Ordering between self and other. Read more

    -

    Compares and returns the maximum of two values. Read more

    -

    Compares and returns the minimum of two values. Read more

    -

    Restrict a value to a certain interval. Read more

    -

    This method tests for self and other values to be equal, and is used -by ==. Read more

    -

    This method tests for !=.

    -

    This method returns an ordering between self and other values if one exists. Read more

    -

    This method tests less than (for self and other) and is used by the < operator. Read more

    -

    This method tests less than or equal to (for self and other) and is used by the <= -operator. Read more

    -

    This method tests greater than (for self and other) and is used by the > operator. Read more

    -

    This method tests greater than or equal to (for self and other) and is used by the >= -operator. Read more

    -

    Add value by one

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +PhysPageNum in os::mm::address - Rust

    Struct os::mm::address::PhysPageNum

    source ·
    #[repr(C)]
    pub struct PhysPageNum(pub usize);
    Expand description

    phiscal page number

    +

    Tuple Fields§

    §0: usize

    Implementations§

    source§

    impl PhysPageNum

    source

    pub fn get_pte_array(&self) -> &'static mut [PageTableEntry]

    Get PageTableEntry on PhysPageNum

    +
    source

    pub fn get_bytes_array(&self) -> &'static mut [u8]

    Get u8 array on PhysPageNum

    +
    source

    pub fn get_mut<T>(&self) -> &'static mut T

    Get Get mutable reference to PhysAddr value on PhysPageNum

    +

    Trait Implementations§

    source§

    impl Clone for PhysPageNum

    source§

    fn clone(&self) -> PhysPageNum

    Returns a copy of the value. Read more
    1.0.0 · source§

    fn clone_from(&mut self, source: &Self)

    Performs copy-assignment from source. Read more
    source§

    impl Debug for PhysPageNum

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    source§

    impl From<PhysAddr> for PhysPageNum

    source§

    fn from(v: PhysAddr) -> Self

    Converts to this type from the input type.
    source§

    impl From<PhysPageNum> for PhysAddr

    source§

    fn from(v: PhysPageNum) -> Self

    Converts to this type from the input type.
    source§

    impl From<PhysPageNum> for usize

    source§

    fn from(v: PhysPageNum) -> Self

    Converts to this type from the input type.
    source§

    impl From<usize> for PhysPageNum

    source§

    fn from(v: usize) -> Self

    Converts to this type from the input type.
    source§

    impl Ord for PhysPageNum

    source§

    fn cmp(&self, other: &PhysPageNum) -> Ordering

    This method returns an Ordering between self and other. Read more
    1.21.0 · source§

    fn max(self, other: Self) -> Selfwhere + Self: Sized,

    Compares and returns the maximum of two values. Read more
    1.21.0 · source§

    fn min(self, other: Self) -> Selfwhere + Self: Sized,

    Compares and returns the minimum of two values. Read more
    1.50.0 · source§

    fn clamp(self, min: Self, max: Self) -> Selfwhere + Self: Sized + PartialOrd<Self>,

    Restrict a value to a certain interval. Read more
    source§

    impl PartialEq<PhysPageNum> for PhysPageNum

    source§

    fn eq(&self, other: &PhysPageNum) -> bool

    This method tests for self and other values to be equal, and is used +by ==.
    1.0.0 · source§

    fn ne(&self, other: &Rhs) -> bool

    This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
    source§

    impl PartialOrd<PhysPageNum> for PhysPageNum

    source§

    fn partial_cmp(&self, other: &PhysPageNum) -> Option<Ordering>

    This method returns an ordering between self and other values if one exists. Read more
    1.0.0 · source§

    fn lt(&self, other: &Rhs) -> bool

    This method tests less than (for self and other) and is used by the < operator. Read more
    1.0.0 · source§

    fn le(&self, other: &Rhs) -> bool

    This method tests less than or equal to (for self and other) and is used by the <= +operator. Read more
    1.0.0 · source§

    fn gt(&self, other: &Rhs) -> bool

    This method tests greater than (for self and other) and is used by the > operator. Read more
    1.0.0 · source§

    fn ge(&self, other: &Rhs) -> bool

    This method tests greater than or equal to (for self and other) and is used by the >= +operator. Read more
    source§

    impl StepByOne for PhysPageNum

    source§

    fn step(&mut self)

    Add value by one
    source§

    impl Copy for PhysPageNum

    source§

    impl Eq for PhysPageNum

    source§

    impl StructuralEq for PhysPageNum

    source§

    impl StructuralPartialEq for PhysPageNum

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The resulting type after obtaining ownership.

    -

    Creates owned data from borrowed data, usually by cloning. Read more

    -
    🔬 This is a nightly-only experimental API. (toowned_clone_into)

    Uses borrowed data to replace owned data, usually by cloning. Read more

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T> ToOwned for Twhere + T: Clone,

    §

    type Owned = T

    The resulting type after obtaining ownership.
    source§

    fn to_owned(&self) -> T

    Creates owned data from borrowed data, usually by cloning. Read more
    source§

    fn clone_into(&self, target: &mut T)

    Uses borrowed data to replace owned data, usually by cloning. Read more
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/mm/address/struct.SimpleRange.html b/ch6-dev/os/mm/address/struct.SimpleRange.html index 39937ed9..cf06e451 100644 --- a/ch6-dev/os/mm/address/struct.SimpleRange.html +++ b/ch6-dev/os/mm/address/struct.SimpleRange.html @@ -1,31 +1,26 @@ -SimpleRange in os::mm::address - Rust - -
    pub struct SimpleRange<T> where
        T: StepByOne + Copy + PartialEq + PartialOrd + Debug
    { +SimpleRange in os::mm::address - Rust

    Struct os::mm::address::SimpleRange

    source ·
    pub struct SimpleRange<T>where
    +    T: StepByOne + Copy + PartialEq + PartialOrd + Debug,{
         l: T,
         r: T,
    -}
    Expand description

    a simple range structure for type T

    -

    Fields

    l: Tr: T

    Implementations

    Trait Implementations

    Returns a copy of the value. Read more

    -

    Performs copy-assignment from source. Read more

    -

    The type of the elements being iterated over.

    -

    Which kind of iterator are we turning this into?

    -

    Creates an iterator from a value. Read more

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +}
    Expand description

    a simple range structure for type T

    +

    Fields§

    §l: T§r: T

    Implementations§

    source§

    impl<T> SimpleRange<T>where + T: StepByOne + Copy + PartialEq + PartialOrd + Debug,

    source

    pub fn new(start: T, end: T) -> Self

    source

    pub fn get_start(&self) -> T

    source

    pub fn get_end(&self) -> T

    Trait Implementations§

    source§

    impl<T> Clone for SimpleRange<T>where + T: StepByOne + Copy + PartialEq + PartialOrd + Debug + Clone,

    source§

    fn clone(&self) -> SimpleRange<T>

    Returns a copy of the value. Read more
    1.0.0 · source§

    fn clone_from(&mut self, source: &Self)

    Performs copy-assignment from source. Read more
    source§

    impl<T> IntoIterator for SimpleRange<T>where + T: StepByOne + Copy + PartialEq + PartialOrd + Debug,

    §

    type Item = T

    The type of the elements being iterated over.
    §

    type IntoIter = SimpleRangeIterator<T>

    Which kind of iterator are we turning this into?
    source§

    fn into_iter(self) -> Self::IntoIter

    Creates an iterator from a value. Read more
    source§

    impl<T> Copy for SimpleRange<T>where + T: StepByOne + Copy + PartialEq + PartialOrd + Debug + Copy,

    Auto Trait Implementations§

    §

    impl<T> RefUnwindSafe for SimpleRange<T>where + T: RefUnwindSafe,

    §

    impl<T> Send for SimpleRange<T>where + T: Send,

    §

    impl<T> Sync for SimpleRange<T>where + T: Sync,

    §

    impl<T> Unpin for SimpleRange<T>where + T: Unpin,

    §

    impl<T> UnwindSafe for SimpleRange<T>where + T: UnwindSafe,

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The resulting type after obtaining ownership.

    -

    Creates owned data from borrowed data, usually by cloning. Read more

    -
    🔬 This is a nightly-only experimental API. (toowned_clone_into)

    Uses borrowed data to replace owned data, usually by cloning. Read more

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T> ToOwned for Twhere + T: Clone,

    §

    type Owned = T

    The resulting type after obtaining ownership.
    source§

    fn to_owned(&self) -> T

    Creates owned data from borrowed data, usually by cloning. Read more
    source§

    fn clone_into(&self, target: &mut T)

    Uses borrowed data to replace owned data, usually by cloning. Read more
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/mm/address/struct.SimpleRangeIterator.html b/ch6-dev/os/mm/address/struct.SimpleRangeIterator.html index 83edf3dc..bede2469 100644 --- a/ch6-dev/os/mm/address/struct.SimpleRangeIterator.html +++ b/ch6-dev/os/mm/address/struct.SimpleRangeIterator.html @@ -1,138 +1,201 @@ -SimpleRangeIterator in os::mm::address - Rust - -
    pub struct SimpleRangeIterator<T> where
        T: StepByOne + Copy + PartialEq + PartialOrd + Debug
    { +SimpleRangeIterator in os::mm::address - Rust
    pub struct SimpleRangeIterator<T>where
    +    T: StepByOne + Copy + PartialEq + PartialOrd + Debug,{
         current: T,
         end: T,
    -}
    Expand description

    iterator for the simple range structure

    -

    Fields

    current: Tend: T

    Implementations

    Trait Implementations

    The type of the elements being iterated over.

    -

    Advances the iterator and returns the next value. Read more

    -

    Returns the bounds on the remaining length of the iterator. Read more

    -

    Consumes the iterator, counting the number of iterations and returning it. Read more

    -

    Consumes the iterator, returning the last element. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_advance_by)

    Advances the iterator by n elements. Read more

    -

    Returns the nth element of the iterator. Read more

    -

    Creates an iterator starting at the same point, but stepping by -the given amount at each iteration. Read more

    -

    Takes two iterators and creates a new iterator over both in sequence. Read more

    -

    ‘Zips up’ two iterators into a single iterator of pairs. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_intersperse)

    Creates a new iterator which places a copy of separator between adjacent -items of the original iterator. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_intersperse)

    Creates a new iterator which places an item generated by separator -between adjacent items of the original iterator. Read more

    -

    Takes a closure and creates an iterator which calls that closure on each -element. Read more

    -

    Calls a closure on each element of an iterator. Read more

    -

    Creates an iterator which uses a closure to determine if an element -should be yielded. Read more

    -

    Creates an iterator that both filters and maps. Read more

    -

    Creates an iterator which gives the current iteration count as well as -the next value. Read more

    -

    Creates an iterator which can use the peek and peek_mut methods +}

    Expand description

    iterator for the simple range structure

    +

    Fields§

    §current: T§end: T

    Implementations§

    source§

    impl<T> SimpleRangeIterator<T>where + T: StepByOne + Copy + PartialEq + PartialOrd + Debug,

    source

    pub fn new(l: T, r: T) -> Self

    Trait Implementations§

    source§

    impl<T> Iterator for SimpleRangeIterator<T>where + T: StepByOne + Copy + PartialEq + PartialOrd + Debug,

    §

    type Item = T

    The type of the elements being iterated over.
    source§

    fn next(&mut self) -> Option<Self::Item>

    Advances the iterator and returns the next value. Read more
    source§

    fn next_chunk<const N: usize>( + &mut self +) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where + Self: Sized,

    🔬This is a nightly-only experimental API. (iter_next_chunk)
    Advances the iterator and returns an array containing the next N values. Read more
    1.0.0 · source§

    fn size_hint(&self) -> (usize, Option<usize>)

    Returns the bounds on the remaining length of the iterator. Read more
    1.0.0 · source§

    fn count(self) -> usizewhere + Self: Sized,

    Consumes the iterator, counting the number of iterations and returning it. Read more
    1.0.0 · source§

    fn last(self) -> Option<Self::Item>where + Self: Sized,

    Consumes the iterator, returning the last element. Read more
    source§

    fn advance_by(&mut self, n: usize) -> Result<(), NonZeroUsize>

    🔬This is a nightly-only experimental API. (iter_advance_by)
    Advances the iterator by n elements. Read more
    1.0.0 · source§

    fn nth(&mut self, n: usize) -> Option<Self::Item>

    Returns the nth element of the iterator. Read more
    1.28.0 · source§

    fn step_by(self, step: usize) -> StepBy<Self>where + Self: Sized,

    Creates an iterator starting at the same point, but stepping by +the given amount at each iteration. Read more
    1.0.0 · source§

    fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where + Self: Sized, + U: IntoIterator<Item = Self::Item>,

    Takes two iterators and creates a new iterator over both in sequence. Read more
    1.0.0 · source§

    fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where + Self: Sized, + U: IntoIterator,

    ‘Zips up’ two iterators into a single iterator of pairs. Read more
    source§

    fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>where + Self: Sized, + G: FnMut() -> Self::Item,

    🔬This is a nightly-only experimental API. (iter_intersperse)
    Creates a new iterator which places an item generated by separator +between adjacent items of the original iterator. Read more
    1.0.0 · source§

    fn map<B, F>(self, f: F) -> Map<Self, F>where + Self: Sized, + F: FnMut(Self::Item) -> B,

    Takes a closure and creates an iterator which calls that closure on each +element. Read more
    1.21.0 · source§

    fn for_each<F>(self, f: F)where + Self: Sized, + F: FnMut(Self::Item),

    Calls a closure on each element of an iterator. Read more
    1.0.0 · source§

    fn filter<P>(self, predicate: P) -> Filter<Self, P>where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

    Creates an iterator which uses a closure to determine if an element +should be yielded. Read more
    1.0.0 · source§

    fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>where + Self: Sized, + F: FnMut(Self::Item) -> Option<B>,

    Creates an iterator that both filters and maps. Read more
    1.0.0 · source§

    fn enumerate(self) -> Enumerate<Self>where + Self: Sized,

    Creates an iterator which gives the current iteration count as well as +the next value. Read more
    1.0.0 · source§

    fn peekable(self) -> Peekable<Self>where + Self: Sized,

    Creates an iterator which can use the peek and peek_mut methods to look at the next element of the iterator without consuming it. See -their documentation for more information. Read more

    -

    Creates an iterator that skips elements based on a predicate. Read more

    -

    Creates an iterator that yields elements based on a predicate. Read more

    -

    Creates an iterator that both yields elements based on a predicate and maps. Read more

    -

    Creates an iterator that skips the first n elements. Read more

    -

    Creates an iterator that yields the first n elements, or fewer -if the underlying iterator ends sooner. Read more

    -

    An iterator adapter similar to fold that holds internal state and -produces a new iterator. Read more

    -

    Creates an iterator that works like map, but flattens nested structure. Read more

    -

    Creates an iterator that flattens nested structure. Read more

    -

    Creates an iterator which ends after the first None. Read more

    -

    Does something with each element of an iterator, passing the value on. Read more

    -

    Borrows an iterator, rather than consuming it. Read more

    -

    Transforms an iterator into a collection. Read more

    -
    🔬 This is a nightly-only experimental API. (iterator_try_collect)

    Fallibly transforms an iterator into a collection, short circuiting if -a failure is encountered. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_collect_into)

    Collects all the items from an iterator into a collection. Read more

    -

    Consumes an iterator, creating two collections from it. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_partition_in_place)

    Reorders the elements of this iterator in-place according to the given predicate, -such that all those that return true precede all those that return false. -Returns the number of true elements found. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_is_partitioned)

    Checks if the elements of this iterator are partitioned according to the given predicate, -such that all those that return true precede all those that return false. Read more

    -

    An iterator method that applies a function as long as it returns -successfully, producing a single, final value. Read more

    -

    An iterator method that applies a fallible function to each item in the -iterator, stopping at the first error and returning that error. Read more

    -

    Folds every element into an accumulator by applying an operation, -returning the final result. Read more

    -

    Reduces the elements to a single one, by repeatedly applying a reducing -operation. Read more

    -
    🔬 This is a nightly-only experimental API. (iterator_try_reduce)

    Reduces the elements to a single one by repeatedly applying a reducing operation. If the -closure returns a failure, the failure is propagated back to the caller immediately. Read more

    -

    Tests if every element of the iterator matches a predicate. Read more

    -

    Tests if any element of the iterator matches a predicate. Read more

    -

    Searches for an element of an iterator that satisfies a predicate. Read more

    -

    Applies function to the elements of iterator and returns -the first non-none result. Read more

    -
    🔬 This is a nightly-only experimental API. (try_find)

    Applies function to the elements of iterator and returns -the first true result or the first error. Read more

    -

    Searches for an element in an iterator, returning its index. Read more

    -

    Searches for an element in an iterator from the right, returning its -index. Read more

    -

    Returns the maximum element of an iterator. Read more

    -

    Returns the minimum element of an iterator. Read more

    -

    Returns the element that gives the maximum value from the -specified function. Read more

    -

    Returns the element that gives the maximum value with respect to the -specified comparison function. Read more

    -

    Returns the element that gives the minimum value from the -specified function. Read more

    -

    Returns the element that gives the minimum value with respect to the -specified comparison function. Read more

    -

    Reverses an iterator’s direction. Read more

    -

    Converts an iterator of pairs into a pair of containers. Read more

    -

    Creates an iterator which copies all of its elements. Read more

    -

    Creates an iterator which clones all of its elements. Read more

    -

    Repeats an iterator endlessly. Read more

    -

    Sums the elements of an iterator. Read more

    -

    Iterates over the entire iterator, multiplying all the elements Read more

    -

    Lexicographically compares the elements of this Iterator with those -of another. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_order_by)

    Lexicographically compares the elements of this Iterator with those -of another with respect to the specified comparison function. Read more

    -

    Lexicographically compares the elements of this Iterator with those -of another. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_order_by)

    Lexicographically compares the elements of this Iterator with those -of another with respect to the specified comparison function. Read more

    -

    Determines if the elements of this Iterator are equal to those of -another. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_order_by)

    Determines if the elements of this Iterator are equal to those of -another with respect to the specified equality function. Read more

    -

    Determines if the elements of this Iterator are unequal to those of -another. Read more

    -

    Determines if the elements of this Iterator are lexicographically -less than those of another. Read more

    -

    Determines if the elements of this Iterator are lexicographically -less or equal to those of another. Read more

    -

    Determines if the elements of this Iterator are lexicographically -greater than those of another. Read more

    -

    Determines if the elements of this Iterator are lexicographically -greater than or equal to those of another. Read more

    -
    🔬 This is a nightly-only experimental API. (is_sorted)

    Checks if the elements of this iterator are sorted. Read more

    -
    🔬 This is a nightly-only experimental API. (is_sorted)

    Checks if the elements of this iterator are sorted using the given comparator function. Read more

    -
    🔬 This is a nightly-only experimental API. (is_sorted)

    Checks if the elements of this iterator are sorted using the given key extraction -function. Read more

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +their documentation for more information. Read more
    1.0.0 · source§

    fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

    Creates an iterator that skips elements based on a predicate. Read more
    1.0.0 · source§

    fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

    Creates an iterator that yields elements based on a predicate. Read more
    1.57.0 · source§

    fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where + Self: Sized, + P: FnMut(Self::Item) -> Option<B>,

    Creates an iterator that both yields elements based on a predicate and maps. Read more
    1.0.0 · source§

    fn skip(self, n: usize) -> Skip<Self>where + Self: Sized,

    Creates an iterator that skips the first n elements. Read more
    1.0.0 · source§

    fn take(self, n: usize) -> Take<Self>where + Self: Sized,

    Creates an iterator that yields the first n elements, or fewer +if the underlying iterator ends sooner. Read more
    1.0.0 · source§

    fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>where + Self: Sized, + F: FnMut(&mut St, Self::Item) -> Option<B>,

    An iterator adapter which, like fold, holds internal state, but +unlike fold, produces a new iterator. Read more
    1.0.0 · source§

    fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where + Self: Sized, + U: IntoIterator, + F: FnMut(Self::Item) -> U,

    Creates an iterator that works like map, but flattens nested structure. Read more
    source§

    fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>where + Self: Sized, + F: FnMut(&[Self::Item; N]) -> R,

    🔬This is a nightly-only experimental API. (iter_map_windows)
    Calls the given function f for each contiguous window of size N over +self and returns an iterator over the outputs of f. Like slice::windows(), +the windows during mapping overlap as well. Read more
    1.0.0 · source§

    fn fuse(self) -> Fuse<Self>where + Self: Sized,

    Creates an iterator which ends after the first None. Read more
    1.0.0 · source§

    fn inspect<F>(self, f: F) -> Inspect<Self, F>where + Self: Sized, + F: FnMut(&Self::Item),

    Does something with each element of an iterator, passing the value on. Read more
    1.0.0 · source§

    fn by_ref(&mut self) -> &mut Selfwhere + Self: Sized,

    Borrows an iterator, rather than consuming it. Read more
    1.0.0 · source§

    fn collect<B>(self) -> Bwhere + B: FromIterator<Self::Item>, + Self: Sized,

    Transforms an iterator into a collection. Read more
    source§

    fn collect_into<E>(self, collection: &mut E) -> &mut Ewhere + E: Extend<Self::Item>, + Self: Sized,

    🔬This is a nightly-only experimental API. (iter_collect_into)
    Collects all the items from an iterator into a collection. Read more
    1.0.0 · source§

    fn partition<B, F>(self, f: F) -> (B, B)where + Self: Sized, + B: Default + Extend<Self::Item>, + F: FnMut(&Self::Item) -> bool,

    Consumes an iterator, creating two collections from it. Read more
    source§

    fn is_partitioned<P>(self, predicate: P) -> boolwhere + Self: Sized, + P: FnMut(Self::Item) -> bool,

    🔬This is a nightly-only experimental API. (iter_is_partitioned)
    Checks if the elements of this iterator are partitioned according to the given predicate, +such that all those that return true precede all those that return false. Read more
    1.27.0 · source§

    fn try_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere + Self: Sized, + F: FnMut(B, Self::Item) -> R, + R: Try<Output = B>,

    An iterator method that applies a function as long as it returns +successfully, producing a single, final value. Read more
    1.27.0 · source§

    fn try_for_each<F, R>(&mut self, f: F) -> Rwhere + Self: Sized, + F: FnMut(Self::Item) -> R, + R: Try<Output = ()>,

    An iterator method that applies a fallible function to each item in the +iterator, stopping at the first error and returning that error. Read more
    1.0.0 · source§

    fn fold<B, F>(self, init: B, f: F) -> Bwhere + Self: Sized, + F: FnMut(B, Self::Item) -> B,

    Folds every element into an accumulator by applying an operation, +returning the final result. Read more
    1.51.0 · source§

    fn reduce<F>(self, f: F) -> Option<Self::Item>where + Self: Sized, + F: FnMut(Self::Item, Self::Item) -> Self::Item,

    Reduces the elements to a single one, by repeatedly applying a reducing +operation. Read more
    source§

    fn try_reduce<F, R>( + &mut self, + f: F +) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere + Self: Sized, + F: FnMut(Self::Item, Self::Item) -> R, + R: Try<Output = Self::Item>, + <R as Try>::Residual: Residual<Option<Self::Item>>,

    🔬This is a nightly-only experimental API. (iterator_try_reduce)
    Reduces the elements to a single one by repeatedly applying a reducing operation. If the +closure returns a failure, the failure is propagated back to the caller immediately. Read more
    1.0.0 · source§

    fn all<F>(&mut self, f: F) -> boolwhere + Self: Sized, + F: FnMut(Self::Item) -> bool,

    Tests if every element of the iterator matches a predicate. Read more
    1.0.0 · source§

    fn any<F>(&mut self, f: F) -> boolwhere + Self: Sized, + F: FnMut(Self::Item) -> bool,

    Tests if any element of the iterator matches a predicate. Read more
    1.0.0 · source§

    fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

    Searches for an element of an iterator that satisfies a predicate. Read more
    1.30.0 · source§

    fn find_map<B, F>(&mut self, f: F) -> Option<B>where + Self: Sized, + F: FnMut(Self::Item) -> Option<B>,

    Applies function to the elements of iterator and returns +the first non-none result. Read more
    source§

    fn try_find<F, R>( + &mut self, + f: F +) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere + Self: Sized, + F: FnMut(&Self::Item) -> R, + R: Try<Output = bool>, + <R as Try>::Residual: Residual<Option<Self::Item>>,

    🔬This is a nightly-only experimental API. (try_find)
    Applies function to the elements of iterator and returns +the first true result or the first error. Read more
    1.0.0 · source§

    fn position<P>(&mut self, predicate: P) -> Option<usize>where + Self: Sized, + P: FnMut(Self::Item) -> bool,

    Searches for an element in an iterator, returning its index. Read more
    1.6.0 · source§

    fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>where + B: Ord, + Self: Sized, + F: FnMut(&Self::Item) -> B,

    Returns the element that gives the maximum value from the +specified function. Read more
    1.15.0 · source§

    fn max_by<F>(self, compare: F) -> Option<Self::Item>where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

    Returns the element that gives the maximum value with respect to the +specified comparison function. Read more
    1.6.0 · source§

    fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>where + B: Ord, + Self: Sized, + F: FnMut(&Self::Item) -> B,

    Returns the element that gives the minimum value from the +specified function. Read more
    1.15.0 · source§

    fn min_by<F>(self, compare: F) -> Option<Self::Item>where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

    Returns the element that gives the minimum value with respect to the +specified comparison function. Read more
    1.0.0 · source§

    fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where + FromA: Default + Extend<A>, + FromB: Default + Extend<B>, + Self: Sized + Iterator<Item = (A, B)>,

    Converts an iterator of pairs into a pair of containers. Read more
    1.36.0 · source§

    fn copied<'a, T>(self) -> Copied<Self>where + T: 'a + Copy, + Self: Sized + Iterator<Item = &'a T>,

    Creates an iterator which copies all of its elements. Read more
    1.0.0 · source§

    fn cloned<'a, T>(self) -> Cloned<Self>where + T: 'a + Clone, + Self: Sized + Iterator<Item = &'a T>,

    Creates an iterator which clones all of its elements. Read more
    source§

    fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where + Self: Sized,

    🔬This is a nightly-only experimental API. (iter_array_chunks)
    Returns an iterator over N elements of the iterator at a time. Read more
    1.11.0 · source§

    fn sum<S>(self) -> Swhere + Self: Sized, + S: Sum<Self::Item>,

    Sums the elements of an iterator. Read more
    1.11.0 · source§

    fn product<P>(self) -> Pwhere + Self: Sized, + P: Product<Self::Item>,

    Iterates over the entire iterator, multiplying all the elements Read more
    source§

    fn cmp_by<I, F>(self, other: I, cmp: F) -> Orderingwhere + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,

    🔬This is a nightly-only experimental API. (iter_order_by)
    Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
    1.5.0 · source§

    fn partial_cmp<I>(self, other: I) -> Option<Ordering>where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

    Lexicographically compares the PartialOrd elements of +this Iterator with those of another. The comparison works like short-circuit +evaluation, returning a result without comparing the remaining elements. +As soon as an order can be determined, the evaluation stops and a result is returned. Read more
    source§

    fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,

    🔬This is a nightly-only experimental API. (iter_order_by)
    Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
    1.5.0 · source§

    fn eq<I>(self, other: I) -> boolwhere + I: IntoIterator, + Self::Item: PartialEq<<I as IntoIterator>::Item>, + Self: Sized,

    Determines if the elements of this Iterator are equal to those of +another. Read more
    source§

    fn eq_by<I, F>(self, other: I, eq: F) -> boolwhere + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,

    🔬This is a nightly-only experimental API. (iter_order_by)
    Determines if the elements of this Iterator are equal to those of +another with respect to the specified equality function. Read more
    1.5.0 · source§

    fn ne<I>(self, other: I) -> boolwhere + I: IntoIterator, + Self::Item: PartialEq<<I as IntoIterator>::Item>, + Self: Sized,

    Determines if the elements of this Iterator are not equal to those of +another. Read more
    1.5.0 · source§

    fn lt<I>(self, other: I) -> boolwhere + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

    Determines if the elements of this Iterator are lexicographically +less than those of another. Read more
    1.5.0 · source§

    fn le<I>(self, other: I) -> boolwhere + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

    Determines if the elements of this Iterator are lexicographically +less or equal to those of another. Read more
    1.5.0 · source§

    fn gt<I>(self, other: I) -> boolwhere + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

    Determines if the elements of this Iterator are lexicographically +greater than those of another. Read more
    1.5.0 · source§

    fn ge<I>(self, other: I) -> boolwhere + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

    Determines if the elements of this Iterator are lexicographically +greater than or equal to those of another. Read more
    source§

    fn is_sorted_by<F>(self, compare: F) -> boolwhere + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Option<Ordering>,

    🔬This is a nightly-only experimental API. (is_sorted)
    Checks if the elements of this iterator are sorted using the given comparator function. Read more
    source§

    fn is_sorted_by_key<F, K>(self, f: F) -> boolwhere + Self: Sized, + F: FnMut(Self::Item) -> K, + K: PartialOrd<K>,

    🔬This is a nightly-only experimental API. (is_sorted)
    Checks if the elements of this iterator are sorted using the given key extraction +function. Read more

    Auto Trait Implementations§

    §

    impl<T> RefUnwindSafe for SimpleRangeIterator<T>where + T: RefUnwindSafe,

    §

    impl<T> Send for SimpleRangeIterator<T>where + T: Send,

    §

    impl<T> Sync for SimpleRangeIterator<T>where + T: Sync,

    §

    impl<T> Unpin for SimpleRangeIterator<T>where + T: Unpin,

    §

    impl<T> UnwindSafe for SimpleRangeIterator<T>where + T: UnwindSafe,

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type of the elements being iterated over.

    -

    Which kind of iterator are we turning this into?

    -

    Creates an iterator from a value. Read more

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<I> IntoIterator for Iwhere + I: Iterator,

    §

    type Item = <I as Iterator>::Item

    The type of the elements being iterated over.
    §

    type IntoIter = I

    Which kind of iterator are we turning this into?
    const: unstable · source§

    fn into_iter(self) -> I

    Creates an iterator from a value. Read more
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/mm/address/struct.VirtAddr.html b/ch6-dev/os/mm/address/struct.VirtAddr.html index d9c15b48..cbc09e0b 100644 --- a/ch6-dev/os/mm/address/struct.VirtAddr.html +++ b/ch6-dev/os/mm/address/struct.VirtAddr.html @@ -1,49 +1,25 @@ -VirtAddr in os::mm::address - Rust - -
    -

    Struct os::mm::address::VirtAddr

    source · []
    #[repr(C)]
    pub struct VirtAddr(pub usize);
    Expand description

    virtual address

    -

    Tuple Fields

    0: usize

    Implementations

    VirtAddr->VirtPageNum

    -

    VirtAddr->VirtPageNum

    -

    Get page offset

    -

    Check page aligned

    -

    Trait Implementations

    Returns a copy of the value. Read more

    -

    Performs copy-assignment from source. Read more

    -

    Debugging

    -

    Formats the value using the given formatter. Read more

    -

    Converts to this type from the input type.

    -

    Converts to this type from the input type.

    -

    Converts to this type from the input type.

    -

    Converts to this type from the input type.

    -

    This method returns an Ordering between self and other. Read more

    -

    Compares and returns the maximum of two values. Read more

    -

    Compares and returns the minimum of two values. Read more

    -

    Restrict a value to a certain interval. Read more

    -

    This method tests for self and other values to be equal, and is used -by ==. Read more

    -

    This method tests for !=.

    -

    This method returns an ordering between self and other values if one exists. Read more

    -

    This method tests less than (for self and other) and is used by the < operator. Read more

    -

    This method tests less than or equal to (for self and other) and is used by the <= -operator. Read more

    -

    This method tests greater than (for self and other) and is used by the > operator. Read more

    -

    This method tests greater than or equal to (for self and other) and is used by the >= -operator. Read more

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +VirtAddr in os::mm::address - Rust

    Struct os::mm::address::VirtAddr

    source ·
    #[repr(C)]
    pub struct VirtAddr(pub usize);
    Expand description

    virtual address

    +

    Tuple Fields§

    §0: usize

    Implementations§

    source§

    impl VirtAddr

    source

    pub fn floor(&self) -> VirtPageNum

    VirtAddr->VirtPageNum

    +
    source

    pub fn ceil(&self) -> VirtPageNum

    VirtAddr->VirtPageNum

    +
    source

    pub fn page_offset(&self) -> usize

    Get page offset

    +
    source

    pub fn aligned(&self) -> bool

    Check page aligned

    +

    Trait Implementations§

    source§

    impl Clone for VirtAddr

    source§

    fn clone(&self) -> VirtAddr

    Returns a copy of the value. Read more
    1.0.0 · source§

    fn clone_from(&mut self, source: &Self)

    Performs copy-assignment from source. Read more
    source§

    impl Debug for VirtAddr

    Debugging

    +
    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    source§

    impl From<VirtAddr> for VirtPageNum

    source§

    fn from(v: VirtAddr) -> Self

    Converts to this type from the input type.
    source§

    impl From<VirtAddr> for usize

    source§

    fn from(v: VirtAddr) -> Self

    Converts to this type from the input type.
    source§

    impl From<VirtPageNum> for VirtAddr

    source§

    fn from(v: VirtPageNum) -> Self

    Converts to this type from the input type.
    source§

    impl From<usize> for VirtAddr

    source§

    fn from(v: usize) -> Self

    Converts to this type from the input type.
    source§

    impl Ord for VirtAddr

    source§

    fn cmp(&self, other: &VirtAddr) -> Ordering

    This method returns an Ordering between self and other. Read more
    1.21.0 · source§

    fn max(self, other: Self) -> Selfwhere + Self: Sized,

    Compares and returns the maximum of two values. Read more
    1.21.0 · source§

    fn min(self, other: Self) -> Selfwhere + Self: Sized,

    Compares and returns the minimum of two values. Read more
    1.50.0 · source§

    fn clamp(self, min: Self, max: Self) -> Selfwhere + Self: Sized + PartialOrd<Self>,

    Restrict a value to a certain interval. Read more
    source§

    impl PartialEq<VirtAddr> for VirtAddr

    source§

    fn eq(&self, other: &VirtAddr) -> bool

    This method tests for self and other values to be equal, and is used +by ==.
    1.0.0 · source§

    fn ne(&self, other: &Rhs) -> bool

    This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
    source§

    impl PartialOrd<VirtAddr> for VirtAddr

    source§

    fn partial_cmp(&self, other: &VirtAddr) -> Option<Ordering>

    This method returns an ordering between self and other values if one exists. Read more
    1.0.0 · source§

    fn lt(&self, other: &Rhs) -> bool

    This method tests less than (for self and other) and is used by the < operator. Read more
    1.0.0 · source§

    fn le(&self, other: &Rhs) -> bool

    This method tests less than or equal to (for self and other) and is used by the <= +operator. Read more
    1.0.0 · source§

    fn gt(&self, other: &Rhs) -> bool

    This method tests greater than (for self and other) and is used by the > operator. Read more
    1.0.0 · source§

    fn ge(&self, other: &Rhs) -> bool

    This method tests greater than or equal to (for self and other) and is used by the >= +operator. Read more
    source§

    impl Copy for VirtAddr

    source§

    impl Eq for VirtAddr

    source§

    impl StructuralEq for VirtAddr

    source§

    impl StructuralPartialEq for VirtAddr

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The resulting type after obtaining ownership.

    -

    Creates owned data from borrowed data, usually by cloning. Read more

    -
    🔬 This is a nightly-only experimental API. (toowned_clone_into)

    Uses borrowed data to replace owned data, usually by cloning. Read more

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T> ToOwned for Twhere + T: Clone,

    §

    type Owned = T

    The resulting type after obtaining ownership.
    source§

    fn to_owned(&self) -> T

    Creates owned data from borrowed data, usually by cloning. Read more
    source§

    fn clone_into(&self, target: &mut T)

    Uses borrowed data to replace owned data, usually by cloning. Read more
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/mm/address/struct.VirtPageNum.html b/ch6-dev/os/mm/address/struct.VirtPageNum.html index f8ad0695..128ba758 100644 --- a/ch6-dev/os/mm/address/struct.VirtPageNum.html +++ b/ch6-dev/os/mm/address/struct.VirtPageNum.html @@ -1,46 +1,21 @@ -VirtPageNum in os::mm::address - Rust - -
    #[repr(C)]
    pub struct VirtPageNum(pub usize);
    Expand description

    virtual page number

    -

    Tuple Fields

    0: usize

    Implementations

    Return VPN 3 level index

    -

    Trait Implementations

    Returns a copy of the value. Read more

    -

    Performs copy-assignment from source. Read more

    -

    Formats the value using the given formatter. Read more

    -

    Converts to this type from the input type.

    -

    Converts to this type from the input type.

    -

    Converts to this type from the input type.

    -

    Converts to this type from the input type.

    -

    This method returns an Ordering between self and other. Read more

    -

    Compares and returns the maximum of two values. Read more

    -

    Compares and returns the minimum of two values. Read more

    -

    Restrict a value to a certain interval. Read more

    -

    This method tests for self and other values to be equal, and is used -by ==. Read more

    -

    This method tests for !=.

    -

    This method returns an ordering between self and other values if one exists. Read more

    -

    This method tests less than (for self and other) and is used by the < operator. Read more

    -

    This method tests less than or equal to (for self and other) and is used by the <= -operator. Read more

    -

    This method tests greater than (for self and other) and is used by the > operator. Read more

    -

    This method tests greater than or equal to (for self and other) and is used by the >= -operator. Read more

    -

    Add value by one

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +VirtPageNum in os::mm::address - Rust

    Struct os::mm::address::VirtPageNum

    source ·
    #[repr(C)]
    pub struct VirtPageNum(pub usize);
    Expand description

    virtual page number

    +

    Tuple Fields§

    §0: usize

    Implementations§

    source§

    impl VirtPageNum

    source

    pub fn indexes(&self) -> [usize; 3]

    Return VPN 3 level index

    +

    Trait Implementations§

    source§

    impl Clone for VirtPageNum

    source§

    fn clone(&self) -> VirtPageNum

    Returns a copy of the value. Read more
    1.0.0 · source§

    fn clone_from(&mut self, source: &Self)

    Performs copy-assignment from source. Read more
    source§

    impl Debug for VirtPageNum

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    source§

    impl From<VirtAddr> for VirtPageNum

    source§

    fn from(v: VirtAddr) -> Self

    Converts to this type from the input type.
    source§

    impl From<VirtPageNum> for VirtAddr

    source§

    fn from(v: VirtPageNum) -> Self

    Converts to this type from the input type.
    source§

    impl From<VirtPageNum> for usize

    source§

    fn from(v: VirtPageNum) -> Self

    Converts to this type from the input type.
    source§

    impl From<usize> for VirtPageNum

    source§

    fn from(v: usize) -> Self

    Converts to this type from the input type.
    source§

    impl Ord for VirtPageNum

    source§

    fn cmp(&self, other: &VirtPageNum) -> Ordering

    This method returns an Ordering between self and other. Read more
    1.21.0 · source§

    fn max(self, other: Self) -> Selfwhere + Self: Sized,

    Compares and returns the maximum of two values. Read more
    1.21.0 · source§

    fn min(self, other: Self) -> Selfwhere + Self: Sized,

    Compares and returns the minimum of two values. Read more
    1.50.0 · source§

    fn clamp(self, min: Self, max: Self) -> Selfwhere + Self: Sized + PartialOrd<Self>,

    Restrict a value to a certain interval. Read more
    source§

    impl PartialEq<VirtPageNum> for VirtPageNum

    source§

    fn eq(&self, other: &VirtPageNum) -> bool

    This method tests for self and other values to be equal, and is used +by ==.
    1.0.0 · source§

    fn ne(&self, other: &Rhs) -> bool

    This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
    source§

    impl PartialOrd<VirtPageNum> for VirtPageNum

    source§

    fn partial_cmp(&self, other: &VirtPageNum) -> Option<Ordering>

    This method returns an ordering between self and other values if one exists. Read more
    1.0.0 · source§

    fn lt(&self, other: &Rhs) -> bool

    This method tests less than (for self and other) and is used by the < operator. Read more
    1.0.0 · source§

    fn le(&self, other: &Rhs) -> bool

    This method tests less than or equal to (for self and other) and is used by the <= +operator. Read more
    1.0.0 · source§

    fn gt(&self, other: &Rhs) -> bool

    This method tests greater than (for self and other) and is used by the > operator. Read more
    1.0.0 · source§

    fn ge(&self, other: &Rhs) -> bool

    This method tests greater than or equal to (for self and other) and is used by the >= +operator. Read more
    source§

    impl StepByOne for VirtPageNum

    source§

    fn step(&mut self)

    Add value by one
    source§

    impl Copy for VirtPageNum

    source§

    impl Eq for VirtPageNum

    source§

    impl StructuralEq for VirtPageNum

    source§

    impl StructuralPartialEq for VirtPageNum

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The resulting type after obtaining ownership.

    -

    Creates owned data from borrowed data, usually by cloning. Read more

    -
    🔬 This is a nightly-only experimental API. (toowned_clone_into)

    Uses borrowed data to replace owned data, usually by cloning. Read more

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T> ToOwned for Twhere + T: Clone,

    §

    type Owned = T

    The resulting type after obtaining ownership.
    source§

    fn to_owned(&self) -> T

    Creates owned data from borrowed data, usually by cloning. Read more
    source§

    fn clone_into(&self, target: &mut T)

    Uses borrowed data to replace owned data, usually by cloning. Read more
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/mm/address/trait.StepByOne.html b/ch6-dev/os/mm/address/trait.StepByOne.html index ab9a6788..d85e63b6 100644 --- a/ch6-dev/os/mm/address/trait.StepByOne.html +++ b/ch6-dev/os/mm/address/trait.StepByOne.html @@ -1,12 +1,6 @@ -StepByOne in os::mm::address - Rust - -
    pub trait StepByOne {
    -    fn step(&mut self);
    -}
    Expand description

    Add value by one

    -

    Required methods

    Add value by one

    -

    Implementors

    - \ No newline at end of file +StepByOne in os::mm::address - Rust

    Trait os::mm::address::StepByOne

    source ·
    pub trait StepByOne {
    +    // Required method
    +    fn step(&mut self);
    +}
    Expand description

    Add value by one

    +

    Required Methods§

    source

    fn step(&mut self)

    Add value by one

    +

    Implementors§

    \ No newline at end of file diff --git a/ch6-dev/os/mm/address/type.VPNRange.html b/ch6-dev/os/mm/address/type.VPNRange.html index 661bd7b0..d8996228 100644 --- a/ch6-dev/os/mm/address/type.VPNRange.html +++ b/ch6-dev/os/mm/address/type.VPNRange.html @@ -1,9 +1,9 @@ -VPNRange in os::mm::address - Rust - -
    -

    Type Definition os::mm::address::VPNRange

    source · []
    pub type VPNRange = SimpleRange<VirtPageNum>;
    Expand description

    a simple range structure for virtual page number

    -
    - \ No newline at end of file +VPNRange in os::mm::address - Rust

    Type Alias os::mm::address::VPNRange

    source ·
    pub type VPNRange = SimpleRange<VirtPageNum>;
    Expand description

    a simple range structure for virtual page number

    +

    Aliased Type§

    struct VPNRange {
    +    l: VirtPageNum,
    +    r: VirtPageNum,
    +}

    Fields§

    §l: VirtPageNum§r: VirtPageNum

    Implementations§

    source§

    impl<T> SimpleRange<T>where + T: StepByOne + Copy + PartialEq + PartialOrd + Debug,

    source

    pub fn new(start: T, end: T) -> Self

    source

    pub fn get_start(&self) -> T

    source

    pub fn get_end(&self) -> T

    Trait Implementations§

    source§

    impl<T> Clone for SimpleRange<T>where + T: StepByOne + Copy + PartialEq + PartialOrd + Debug + Clone,

    source§

    fn clone(&self) -> SimpleRange<T>

    Returns a copy of the value. Read more
    1.0.0 · source§

    fn clone_from(&mut self, source: &Self)

    Performs copy-assignment from source. Read more
    source§

    impl<T> IntoIterator for SimpleRange<T>where + T: StepByOne + Copy + PartialEq + PartialOrd + Debug,

    §

    type Item = T

    The type of the elements being iterated over.
    §

    type IntoIter = SimpleRangeIterator<T>

    Which kind of iterator are we turning this into?
    source§

    fn into_iter(self) -> Self::IntoIter

    Creates an iterator from a value. Read more
    source§

    impl<T> Copy for SimpleRange<T>where + T: StepByOne + Copy + PartialEq + PartialOrd + Debug + Copy,

    \ No newline at end of file diff --git a/ch6-dev/os/mm/fn.frame_alloc.html b/ch6-dev/os/mm/fn.frame_alloc.html index 73a1c8f7..c85dde37 100644 --- a/ch6-dev/os/mm/fn.frame_alloc.html +++ b/ch6-dev/os/mm/fn.frame_alloc.html @@ -1,9 +1,2 @@ -frame_alloc in os::mm - Rust - -
    -

    Function os::mm::frame_alloc

    source · []
    pub fn frame_alloc() -> Option<FrameTracker>
    Expand description

    allocate a frame

    -
    - \ No newline at end of file +frame_alloc in os::mm - Rust

    Function os::mm::frame_alloc

    source ·
    pub fn frame_alloc() -> Option<FrameTracker>
    Expand description

    allocate a frame

    +
    \ No newline at end of file diff --git a/ch6-dev/os/mm/fn.frame_dealloc.html b/ch6-dev/os/mm/fn.frame_dealloc.html index a5db3dbc..22197ad9 100644 --- a/ch6-dev/os/mm/fn.frame_dealloc.html +++ b/ch6-dev/os/mm/fn.frame_dealloc.html @@ -1,9 +1,2 @@ -frame_dealloc in os::mm - Rust - -
    -

    Function os::mm::frame_dealloc

    source · []
    pub fn frame_dealloc(ppn: PhysPageNum)
    Expand description

    deallocate a frame

    -
    - \ No newline at end of file +frame_dealloc in os::mm - Rust

    Function os::mm::frame_dealloc

    source ·
    pub fn frame_dealloc(ppn: PhysPageNum)
    Expand description

    deallocate a frame

    +
    \ No newline at end of file diff --git a/ch6-dev/os/mm/fn.init.html b/ch6-dev/os/mm/fn.init.html index d6ed0e74..d4ffa8e4 100644 --- a/ch6-dev/os/mm/fn.init.html +++ b/ch6-dev/os/mm/fn.init.html @@ -1,9 +1,2 @@ -init in os::mm - Rust - -
    -

    Function os::mm::init

    source · []
    pub fn init()
    Expand description

    initiate heap allocator, frame allocator and kernel space

    -
    - \ No newline at end of file +init in os::mm - Rust

    Function os::mm::init

    source ·
    pub fn init()
    Expand description

    initiate heap allocator, frame allocator and kernel space

    +
    \ No newline at end of file diff --git a/ch6-dev/os/mm/fn.kernel_token.html b/ch6-dev/os/mm/fn.kernel_token.html index adb24c81..1331fde9 100644 --- a/ch6-dev/os/mm/fn.kernel_token.html +++ b/ch6-dev/os/mm/fn.kernel_token.html @@ -1,9 +1,2 @@ -kernel_token in os::mm - Rust - -
    -

    Function os::mm::kernel_token

    source · []
    pub fn kernel_token() -> usize
    Expand description

    Get kernelspace root ppn

    -
    - \ No newline at end of file +kernel_token in os::mm - Rust

    Function os::mm::kernel_token

    source ·
    pub fn kernel_token() -> usize
    Expand description

    Get kernelspace root ppn

    +
    \ No newline at end of file diff --git a/ch6-dev/os/mm/fn.remap_test.html b/ch6-dev/os/mm/fn.remap_test.html index 65749d20..d702d5f3 100644 --- a/ch6-dev/os/mm/fn.remap_test.html +++ b/ch6-dev/os/mm/fn.remap_test.html @@ -1,9 +1,2 @@ -remap_test in os::mm - Rust - -
    -

    Function os::mm::remap_test

    source · []
    pub fn remap_test()
    Expand description

    Check PageTable running correctly

    -
    - \ No newline at end of file +remap_test in os::mm - Rust

    Function os::mm::remap_test

    source ·
    pub fn remap_test()
    Expand description

    Check PageTable running correctly

    +
    \ No newline at end of file diff --git a/ch6-dev/os/mm/fn.translated_byte_buffer.html b/ch6-dev/os/mm/fn.translated_byte_buffer.html index e7793a88..68bca0f3 100644 --- a/ch6-dev/os/mm/fn.translated_byte_buffer.html +++ b/ch6-dev/os/mm/fn.translated_byte_buffer.html @@ -1,9 +1,6 @@ -translated_byte_buffer in os::mm - Rust - -
    pub fn translated_byte_buffer(
        token: usize,
        ptr: *const u8,
        len: usize
    ) -> Vec<&'static mut [u8]>
    Expand description

    Translate a pointer to a mutable u8 Vec through page table

    -
    - \ No newline at end of file +translated_byte_buffer in os::mm - Rust

    Function os::mm::translated_byte_buffer

    source ·
    pub fn translated_byte_buffer(
    +    token: usize,
    +    ptr: *const u8,
    +    len: usize
    +) -> Vec<&'static mut [u8]>
    Expand description

    Translate a pointer to a mutable u8 Vec through page table

    +
    \ No newline at end of file diff --git a/ch6-dev/os/mm/fn.translated_ref.html b/ch6-dev/os/mm/fn.translated_ref.html index 8af3221b..a916d993 100644 --- a/ch6-dev/os/mm/fn.translated_ref.html +++ b/ch6-dev/os/mm/fn.translated_ref.html @@ -1,9 +1,2 @@ -translated_ref in os::mm - Rust - -
    -

    Function os::mm::translated_ref

    source · []
    pub fn translated_ref<T>(token: usize, ptr: *const T) -> &'static T
    Expand description

    Translate a generic through page table and return a reference

    -
    - \ No newline at end of file +translated_ref in os::mm - Rust

    Function os::mm::translated_ref

    source ·
    pub fn translated_ref<T>(token: usize, ptr: *const T) -> &'static T
    Expand description

    Translate a generic through page table and return a reference

    +
    \ No newline at end of file diff --git a/ch6-dev/os/mm/fn.translated_refmut.html b/ch6-dev/os/mm/fn.translated_refmut.html index d0da9b3f..48b872b2 100644 --- a/ch6-dev/os/mm/fn.translated_refmut.html +++ b/ch6-dev/os/mm/fn.translated_refmut.html @@ -1,9 +1,2 @@ -translated_refmut in os::mm - Rust - -
    pub fn translated_refmut<T>(token: usize, ptr: *mut T) -> &'static mut T
    Expand description

    Translate a generic through page table and return a mutable reference

    -
    - \ No newline at end of file +translated_refmut in os::mm - Rust

    Function os::mm::translated_refmut

    source ·
    pub fn translated_refmut<T>(token: usize, ptr: *mut T) -> &'static mut T
    Expand description

    Translate a generic through page table and return a mutable reference

    +
    \ No newline at end of file diff --git a/ch6-dev/os/mm/fn.translated_str.html b/ch6-dev/os/mm/fn.translated_str.html index 30720e8a..dcfc7f13 100644 --- a/ch6-dev/os/mm/fn.translated_str.html +++ b/ch6-dev/os/mm/fn.translated_str.html @@ -1,9 +1,2 @@ -translated_str in os::mm - Rust - -
    -

    Function os::mm::translated_str

    source · []
    pub fn translated_str(token: usize, ptr: *const u8) -> String
    Expand description

    Translate a pointer to a mutable u8 Vec end with \0 through page table to a String

    -
    - \ No newline at end of file +translated_str in os::mm - Rust

    Function os::mm::translated_str

    source ·
    pub fn translated_str(token: usize, ptr: *const u8) -> String
    Expand description

    Translate a pointer to a mutable u8 Vec end with \0 through page table to a String

    +
    \ No newline at end of file diff --git a/ch6-dev/os/mm/frame_allocator/fn.frame_alloc.html b/ch6-dev/os/mm/frame_allocator/fn.frame_alloc.html index b8a61125..b611ff59 100644 --- a/ch6-dev/os/mm/frame_allocator/fn.frame_alloc.html +++ b/ch6-dev/os/mm/frame_allocator/fn.frame_alloc.html @@ -1,9 +1,2 @@ -frame_alloc in os::mm::frame_allocator - Rust - -
    pub fn frame_alloc() -> Option<FrameTracker>
    Expand description

    allocate a frame

    -
    - \ No newline at end of file +frame_alloc in os::mm::frame_allocator - Rust

    Function os::mm::frame_allocator::frame_alloc

    source ·
    pub fn frame_alloc() -> Option<FrameTracker>
    Expand description

    allocate a frame

    +
    \ No newline at end of file diff --git a/ch6-dev/os/mm/frame_allocator/fn.frame_allocator_test.html b/ch6-dev/os/mm/frame_allocator/fn.frame_allocator_test.html index 5ebf4e9a..e4ebf6de 100644 --- a/ch6-dev/os/mm/frame_allocator/fn.frame_allocator_test.html +++ b/ch6-dev/os/mm/frame_allocator/fn.frame_allocator_test.html @@ -1,9 +1,2 @@ -frame_allocator_test in os::mm::frame_allocator - Rust - -
    pub fn frame_allocator_test()
    Expand description

    a simple test for frame allocator

    -
    - \ No newline at end of file +frame_allocator_test in os::mm::frame_allocator - Rust
    pub fn frame_allocator_test()
    Expand description

    a simple test for frame allocator

    +
    \ No newline at end of file diff --git a/ch6-dev/os/mm/frame_allocator/fn.frame_dealloc.html b/ch6-dev/os/mm/frame_allocator/fn.frame_dealloc.html index 4389f7d2..1adef62b 100644 --- a/ch6-dev/os/mm/frame_allocator/fn.frame_dealloc.html +++ b/ch6-dev/os/mm/frame_allocator/fn.frame_dealloc.html @@ -1,9 +1,2 @@ -frame_dealloc in os::mm::frame_allocator - Rust - -
    pub fn frame_dealloc(ppn: PhysPageNum)
    Expand description

    deallocate a frame

    -
    - \ No newline at end of file +frame_dealloc in os::mm::frame_allocator - Rust
    pub fn frame_dealloc(ppn: PhysPageNum)
    Expand description

    deallocate a frame

    +
    \ No newline at end of file diff --git a/ch6-dev/os/mm/frame_allocator/fn.init_frame_allocator.html b/ch6-dev/os/mm/frame_allocator/fn.init_frame_allocator.html index b853fd2a..bb1fde60 100644 --- a/ch6-dev/os/mm/frame_allocator/fn.init_frame_allocator.html +++ b/ch6-dev/os/mm/frame_allocator/fn.init_frame_allocator.html @@ -1,9 +1,2 @@ -init_frame_allocator in os::mm::frame_allocator - Rust - -
    pub fn init_frame_allocator()
    Expand description

    initiate the frame allocator using ekernel and MEMORY_END

    -
    - \ No newline at end of file +init_frame_allocator in os::mm::frame_allocator - Rust
    pub fn init_frame_allocator()
    Expand description

    initiate the frame allocator using ekernel and MEMORY_END

    +
    \ No newline at end of file diff --git a/ch6-dev/os/mm/frame_allocator/index.html b/ch6-dev/os/mm/frame_allocator/index.html index 617a2ab4..8079d692 100644 --- a/ch6-dev/os/mm/frame_allocator/index.html +++ b/ch6-dev/os/mm/frame_allocator/index.html @@ -1,21 +1,3 @@ -os::mm::frame_allocator - Rust - -
    Expand description

    Implementation of FrameAllocator which +os::mm::frame_allocator - Rust

    Module os::mm::frame_allocator

    source ·
    Expand description

    Implementation of FrameAllocator which controls all the frames in the operating system.

    -

    Structs

    -

    frame allocator instance through lazy_static!

    -

    manage a frame which has the same lifecycle as the tracker

    -

    an implementation for frame allocator

    -

    Traits

    -

    Functions

    -

    allocate a frame

    -

    a simple test for frame allocator

    -

    deallocate a frame

    -

    initiate the frame allocator using ekernel and MEMORY_END

    -

    Type Definitions

    -
    - \ No newline at end of file +

    Structs

    Traits

    Functions

    Type Aliases

    \ No newline at end of file diff --git a/ch6-dev/os/mm/frame_allocator/sidebar-items.js b/ch6-dev/os/mm/frame_allocator/sidebar-items.js index 91a50bd8..be15c50b 100644 --- a/ch6-dev/os/mm/frame_allocator/sidebar-items.js +++ b/ch6-dev/os/mm/frame_allocator/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"fn":[["frame_alloc","allocate a frame"],["frame_allocator_test","a simple test for frame allocator"],["frame_dealloc","deallocate a frame"],["init_frame_allocator","initiate the frame allocator using `ekernel` and `MEMORY_END`"]],"struct":[["FRAME_ALLOCATOR","frame allocator instance through lazy_static!"],["FrameTracker","manage a frame which has the same lifecycle as the tracker"],["StackFrameAllocator","an implementation for frame allocator"]],"trait":[["FrameAllocator",""]],"type":[["FrameAllocatorImpl",""]]}); \ No newline at end of file +window.SIDEBAR_ITEMS = {"fn":["frame_alloc","frame_allocator_test","frame_dealloc","init_frame_allocator"],"struct":["FRAME_ALLOCATOR","FrameTracker","StackFrameAllocator"],"trait":["FrameAllocator"],"type":["FrameAllocatorImpl"]}; \ No newline at end of file diff --git a/ch6-dev/os/mm/frame_allocator/struct.FRAME_ALLOCATOR.html b/ch6-dev/os/mm/frame_allocator/struct.FRAME_ALLOCATOR.html index 7c0d41f9..6ed6db7e 100644 --- a/ch6-dev/os/mm/frame_allocator/struct.FRAME_ALLOCATOR.html +++ b/ch6-dev/os/mm/frame_allocator/struct.FRAME_ALLOCATOR.html @@ -1,25 +1,15 @@ -FRAME_ALLOCATOR in os::mm::frame_allocator - Rust - -
    pub struct FRAME_ALLOCATOR {
    +FRAME_ALLOCATOR in os::mm::frame_allocator - Rust
    pub struct FRAME_ALLOCATOR {
         __private_field: (),
    -}
    Expand description

    frame allocator instance through lazy_static!

    -

    Fields

    __private_field: ()

    Methods from Deref<Target = UPSafeCell<StackFrameAllocator>>

    Exclusive access inner data in UPSafeCell. Panic if the data has been borrowed.

    -

    Trait Implementations

    The resulting type after dereferencing.

    -

    Dereferences the value.

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +}
    Expand description

    frame allocator instance through lazy_static!

    +

    Fields§

    §__private_field: ()

    Methods from Deref<Target = UPSafeCell<StackFrameAllocator>>§

    source

    pub fn exclusive_access(&self) -> RefMut<'_, T>

    Exclusive access inner data in UPSafeCell. Panic if the data has been borrowed.

    +

    Trait Implementations§

    source§

    impl Deref for FRAME_ALLOCATOR

    §

    type Target = UPSafeCell<StackFrameAllocator>

    The resulting type after dereferencing.
    source§

    fn deref(&self) -> &UPSafeCell<StackFrameAllocator>

    Dereferences the value.
    source§

    impl LazyStatic for FRAME_ALLOCATOR

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/mm/frame_allocator/struct.FrameTracker.html b/ch6-dev/os/mm/frame_allocator/struct.FrameTracker.html index 6805929a..bfbc576a 100644 --- a/ch6-dev/os/mm/frame_allocator/struct.FrameTracker.html +++ b/ch6-dev/os/mm/frame_allocator/struct.FrameTracker.html @@ -1,25 +1,15 @@ -FrameTracker in os::mm::frame_allocator - Rust - -
    pub struct FrameTracker {
    +FrameTracker in os::mm::frame_allocator - Rust
    pub struct FrameTracker {
         pub ppn: PhysPageNum,
    -}
    Expand description

    manage a frame which has the same lifecycle as the tracker

    -

    Fields

    ppn: PhysPageNum

    Implementations

    Create an empty FrameTracker

    -

    Trait Implementations

    Formats the value using the given formatter. Read more

    -

    Executes the destructor for this type. Read more

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +}
    Expand description

    manage a frame which has the same lifecycle as the tracker

    +

    Fields§

    §ppn: PhysPageNum

    Implementations§

    source§

    impl FrameTracker

    source

    pub fn new(ppn: PhysPageNum) -> Self

    Create an empty FrameTracker

    +

    Trait Implementations§

    source§

    impl Debug for FrameTracker

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    source§

    impl Drop for FrameTracker

    source§

    fn drop(&mut self)

    Executes the destructor for this type. Read more

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/mm/frame_allocator/struct.StackFrameAllocator.html b/ch6-dev/os/mm/frame_allocator/struct.StackFrameAllocator.html index 7d776232..935b87bd 100644 --- a/ch6-dev/os/mm/frame_allocator/struct.StackFrameAllocator.html +++ b/ch6-dev/os/mm/frame_allocator/struct.StackFrameAllocator.html @@ -1,24 +1,16 @@ -StackFrameAllocator in os::mm::frame_allocator - Rust - -
    pub struct StackFrameAllocator {
    +StackFrameAllocator in os::mm::frame_allocator - Rust
    pub struct StackFrameAllocator {
         current: usize,
         end: usize,
         recycled: Vec<usize>,
    -}
    Expand description

    an implementation for frame allocator

    -

    Fields

    current: usizeend: usizerecycled: Vec<usize>

    Implementations

    Trait Implementations

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +}
    Expand description

    an implementation for frame allocator

    +

    Fields§

    §current: usize§end: usize§recycled: Vec<usize>

    Implementations§

    Trait Implementations§

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/mm/frame_allocator/trait.FrameAllocator.html b/ch6-dev/os/mm/frame_allocator/trait.FrameAllocator.html index 72c2c9fb..28041a23 100644 --- a/ch6-dev/os/mm/frame_allocator/trait.FrameAllocator.html +++ b/ch6-dev/os/mm/frame_allocator/trait.FrameAllocator.html @@ -1,12 +1,6 @@ -FrameAllocator in os::mm::frame_allocator - Rust - -
    trait FrameAllocator {
    -    fn new() -> Self;
    -    fn alloc(&mut self) -> Option<PhysPageNum>;
    -    fn dealloc(&mut self, ppn: PhysPageNum);
    -}

    Required methods

    Implementors

    - \ No newline at end of file +FrameAllocator in os::mm::frame_allocator - Rust
    trait FrameAllocator {
    +    // Required methods
    +    fn new() -> Self;
    +    fn alloc(&mut self) -> Option<PhysPageNum>;
    +    fn dealloc(&mut self, ppn: PhysPageNum);
    +}

    Required Methods§

    source

    fn new() -> Self

    source

    fn alloc(&mut self) -> Option<PhysPageNum>

    source

    fn dealloc(&mut self, ppn: PhysPageNum)

    Implementors§

    \ No newline at end of file diff --git a/ch6-dev/os/mm/frame_allocator/type.FrameAllocatorImpl.html b/ch6-dev/os/mm/frame_allocator/type.FrameAllocatorImpl.html index 8e266eda..235bf775 100644 --- a/ch6-dev/os/mm/frame_allocator/type.FrameAllocatorImpl.html +++ b/ch6-dev/os/mm/frame_allocator/type.FrameAllocatorImpl.html @@ -1,8 +1,5 @@ -FrameAllocatorImpl in os::mm::frame_allocator - Rust - -
    type FrameAllocatorImpl = StackFrameAllocator;
    - \ No newline at end of file +FrameAllocatorImpl in os::mm::frame_allocator - Rust
    type FrameAllocatorImpl = StackFrameAllocator;

    Aliased Type§

    struct FrameAllocatorImpl {
    +    current: usize,
    +    end: usize,
    +    recycled: Vec<usize, Global>,
    +}

    Fields§

    §current: usize§end: usize§recycled: Vec<usize, Global>

    Implementations§

    Trait Implementations§

    \ No newline at end of file diff --git a/ch6-dev/os/mm/heap_allocator/fn.handle_alloc_error.html b/ch6-dev/os/mm/heap_allocator/fn.handle_alloc_error.html index 601c4266..6bb35dfb 100644 --- a/ch6-dev/os/mm/heap_allocator/fn.handle_alloc_error.html +++ b/ch6-dev/os/mm/heap_allocator/fn.handle_alloc_error.html @@ -1,9 +1,2 @@ -handle_alloc_error in os::mm::heap_allocator - Rust - -
    pub fn handle_alloc_error(layout: Layout) -> !
    Expand description

    panic when heap allocation error occurs

    -
    - \ No newline at end of file +handle_alloc_error in os::mm::heap_allocator - Rust
    pub fn handle_alloc_error(layout: Layout) -> !
    Expand description

    panic when heap allocation error occurs

    +
    \ No newline at end of file diff --git a/ch6-dev/os/mm/heap_allocator/fn.heap_test.html b/ch6-dev/os/mm/heap_allocator/fn.heap_test.html index ce7ad454..5de05955 100644 --- a/ch6-dev/os/mm/heap_allocator/fn.heap_test.html +++ b/ch6-dev/os/mm/heap_allocator/fn.heap_test.html @@ -1,8 +1 @@ -heap_test in os::mm::heap_allocator - Rust - -
    pub fn heap_test()
    - \ No newline at end of file +heap_test in os::mm::heap_allocator - Rust

    Function os::mm::heap_allocator::heap_test

    source ·
    pub fn heap_test()
    \ No newline at end of file diff --git a/ch6-dev/os/mm/heap_allocator/fn.init_heap.html b/ch6-dev/os/mm/heap_allocator/fn.init_heap.html index 21e3ec41..03da3c6e 100644 --- a/ch6-dev/os/mm/heap_allocator/fn.init_heap.html +++ b/ch6-dev/os/mm/heap_allocator/fn.init_heap.html @@ -1,9 +1,2 @@ -init_heap in os::mm::heap_allocator - Rust - -
    pub fn init_heap()
    Expand description

    initiate heap allocator

    -
    - \ No newline at end of file +init_heap in os::mm::heap_allocator - Rust

    Function os::mm::heap_allocator::init_heap

    source ·
    pub fn init_heap()
    Expand description

    initiate heap allocator

    +
    \ No newline at end of file diff --git a/ch6-dev/os/mm/heap_allocator/index.html b/ch6-dev/os/mm/heap_allocator/index.html index 43eafb33..e99493c8 100644 --- a/ch6-dev/os/mm/heap_allocator/index.html +++ b/ch6-dev/os/mm/heap_allocator/index.html @@ -1,15 +1,2 @@ -os::mm::heap_allocator - Rust - -
    Expand description

    The global allocator

    -

    Statics

    -

    heap allocator instance

    -
    HEAP_SPACE 🔒

    heap space ([u8; KERNEL_HEAP_SIZE])

    -

    Functions

    -

    panic when heap allocation error occurs

    -

    initiate heap allocator

    -
    - \ No newline at end of file +os::mm::heap_allocator - Rust

    Module os::mm::heap_allocator

    source ·
    Expand description

    The global allocator

    +

    Statics

    Functions

    \ No newline at end of file diff --git a/ch6-dev/os/mm/heap_allocator/sidebar-items.js b/ch6-dev/os/mm/heap_allocator/sidebar-items.js index a400d729..d5956da4 100644 --- a/ch6-dev/os/mm/heap_allocator/sidebar-items.js +++ b/ch6-dev/os/mm/heap_allocator/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"fn":[["handle_alloc_error","panic when heap allocation error occurs"],["heap_test",""],["init_heap","initiate heap allocator"]],"static":[["HEAP_ALLOCATOR","heap allocator instance"],["HEAP_SPACE","heap space ([u8; KERNEL_HEAP_SIZE])"]]}); \ No newline at end of file +window.SIDEBAR_ITEMS = {"fn":["handle_alloc_error","heap_test","init_heap"],"static":["HEAP_ALLOCATOR","HEAP_SPACE"]}; \ No newline at end of file diff --git a/ch6-dev/os/mm/heap_allocator/static.HEAP_ALLOCATOR.html b/ch6-dev/os/mm/heap_allocator/static.HEAP_ALLOCATOR.html index 4703f7e9..3761e118 100644 --- a/ch6-dev/os/mm/heap_allocator/static.HEAP_ALLOCATOR.html +++ b/ch6-dev/os/mm/heap_allocator/static.HEAP_ALLOCATOR.html @@ -1,9 +1,2 @@ -HEAP_ALLOCATOR in os::mm::heap_allocator - Rust - -
    static HEAP_ALLOCATOR: LockedHeap
    Expand description

    heap allocator instance

    -
    - \ No newline at end of file +HEAP_ALLOCATOR in os::mm::heap_allocator - Rust
    static HEAP_ALLOCATOR: LockedHeap
    Expand description

    heap allocator instance

    +
    \ No newline at end of file diff --git a/ch6-dev/os/mm/heap_allocator/static.HEAP_SPACE.html b/ch6-dev/os/mm/heap_allocator/static.HEAP_SPACE.html index 208ea6c3..1d6274fc 100644 --- a/ch6-dev/os/mm/heap_allocator/static.HEAP_SPACE.html +++ b/ch6-dev/os/mm/heap_allocator/static.HEAP_SPACE.html @@ -1,9 +1,2 @@ -HEAP_SPACE in os::mm::heap_allocator - Rust - -
    static mut HEAP_SPACE: [u8; 2097152]
    Expand description

    heap space ([u8; KERNEL_HEAP_SIZE])

    -
    - \ No newline at end of file +HEAP_SPACE in os::mm::heap_allocator - Rust
    static mut HEAP_SPACE: [u8; 2097152]
    Expand description

    heap space ([u8; KERNEL_HEAP_SIZE])

    +
    \ No newline at end of file diff --git a/ch6-dev/os/mm/index.html b/ch6-dev/os/mm/index.html index 2a979111..6a41b891 100644 --- a/ch6-dev/os/mm/index.html +++ b/ch6-dev/os/mm/index.html @@ -1,45 +1,7 @@ -os::mm - Rust - -
    -

    Module os::mm

    source · []
    Expand description

    Memory management implementation

    +os::mm - Rust

    Module os::mm

    source ·
    Expand description

    Memory management implementation

    SV39 page-based virtual-memory architecture for RV64 systems, and everything about memory management, like frame allocator, page table, map area and memory set, is implemented here.

    Every task or process has a memory_set to control its virtual memory.

    -

    Modules

    -
    address 🔒

    Implementation of physical and virtual address and page number.

    -

    Implementation of FrameAllocator which -controls all the frames in the operating system.

    -

    The global allocator

    -
    memory_set 🔒

    Implementation of MapArea and MemorySet.

    -
    page_table 🔒

    Implementation of PageTableEntry and PageTable.

    -

    Structs

    -

    manage a frame which has the same lifecycle as the tracker

    -

    a memory set instance through lazy_static! managing kernel space

    -

    map permission corresponding to that in pte: R W X U

    -

    memory set structure, controls virtual-memory space

    -

    Record root ppn and has the same lifetime as 1 and 2 level PageTableEntry

    -

    page table entry structure

    -

    Definitions

    -

    phiscal page number

    -

    Array of u8 slice that user communicate with os

    -

    Iterator of UserBuffer

    -

    virtual address

    -

    virtual page number

    -

    Traits

    -

    Add value by one

    -

    Functions

    -

    allocate a frame

    -

    deallocate a frame

    -

    initiate heap allocator, frame allocator and kernel space

    -

    Get kernelspace root ppn

    -

    Check PageTable running correctly

    -

    Translate a pointer to a mutable u8 Vec through page table

    -

    Translate a generic through page table and return a reference

    -

    Translate a generic through page table and return a mutable reference

    -

    Translate a pointer to a mutable u8 Vec end with \0 through page table to a String

    -
    - \ No newline at end of file +

    Re-exports

    • pub use memory_set::KERNEL_SPACE;
    • pub use memory_set::KERNEL_SPACE;

    Modules

    Structs

    Traits

    Functions

    \ No newline at end of file diff --git a/ch6-dev/os/mm/memory_set/enum.MapType.html b/ch6-dev/os/mm/memory_set/enum.MapType.html index a1aac0d3..ead33624 100644 --- a/ch6-dev/os/mm/memory_set/enum.MapType.html +++ b/ch6-dev/os/mm/memory_set/enum.MapType.html @@ -1,32 +1,18 @@ -MapType in os::mm::memory_set - Rust - -
    pub enum MapType {
    +MapType in os::mm::memory_set - Rust

    Enum os::mm::memory_set::MapType

    source ·
    pub enum MapType {
         Identical,
         Framed,
    -}
    Expand description

    map type for memory set: identical or framed

    -

    Variants

    Identical

    Framed

    Trait Implementations

    Returns a copy of the value. Read more

    -

    Performs copy-assignment from source. Read more

    -

    Formats the value using the given formatter. Read more

    -

    This method tests for self and other values to be equal, and is used -by ==. Read more

    -

    This method tests for !=.

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +}
    Expand description

    map type for memory set: identical or framed

    +

    Variants§

    §

    Identical

    §

    Framed

    Trait Implementations§

    source§

    impl Clone for MapType

    source§

    fn clone(&self) -> MapType

    Returns a copy of the value. Read more
    1.0.0 · source§

    fn clone_from(&mut self, source: &Self)

    Performs copy-assignment from source. Read more
    source§

    impl Debug for MapType

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    source§

    impl PartialEq<MapType> for MapType

    source§

    fn eq(&self, other: &MapType) -> bool

    This method tests for self and other values to be equal, and is used +by ==.
    1.0.0 · source§

    fn ne(&self, other: &Rhs) -> bool

    This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
    source§

    impl Copy for MapType

    source§

    impl StructuralPartialEq for MapType

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The resulting type after obtaining ownership.

    -

    Creates owned data from borrowed data, usually by cloning. Read more

    -
    🔬 This is a nightly-only experimental API. (toowned_clone_into)

    Uses borrowed data to replace owned data, usually by cloning. Read more

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T> ToOwned for Twhere + T: Clone,

    §

    type Owned = T

    The resulting type after obtaining ownership.
    source§

    fn to_owned(&self) -> T

    Creates owned data from borrowed data, usually by cloning. Read more
    source§

    fn clone_into(&self, target: &mut T)

    Uses borrowed data to replace owned data, usually by cloning. Read more
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/mm/memory_set/fn.ebss.html b/ch6-dev/os/mm/memory_set/fn.ebss.html index 3eb32d69..2b13c3d5 100644 --- a/ch6-dev/os/mm/memory_set/fn.ebss.html +++ b/ch6-dev/os/mm/memory_set/fn.ebss.html @@ -1,8 +1 @@ -ebss in os::mm::memory_set - Rust - -
    -

    Function os::mm::memory_set::ebss

    source · []
    unsafe extern "C" fn ebss()
    - \ No newline at end of file +ebss in os::mm::memory_set - Rust

    Function os::mm::memory_set::ebss

    source ·
    unsafe extern "C" fn ebss()
    \ No newline at end of file diff --git a/ch6-dev/os/mm/memory_set/fn.edata.html b/ch6-dev/os/mm/memory_set/fn.edata.html index b4fb932e..6692613e 100644 --- a/ch6-dev/os/mm/memory_set/fn.edata.html +++ b/ch6-dev/os/mm/memory_set/fn.edata.html @@ -1,8 +1 @@ -edata in os::mm::memory_set - Rust - -
    -

    Function os::mm::memory_set::edata

    source · []
    unsafe extern "C" fn edata()
    - \ No newline at end of file +edata in os::mm::memory_set - Rust

    Function os::mm::memory_set::edata

    source ·
    unsafe extern "C" fn edata()
    \ No newline at end of file diff --git a/ch6-dev/os/mm/memory_set/fn.ekernel.html b/ch6-dev/os/mm/memory_set/fn.ekernel.html index aeba8924..776a8212 100644 --- a/ch6-dev/os/mm/memory_set/fn.ekernel.html +++ b/ch6-dev/os/mm/memory_set/fn.ekernel.html @@ -1,8 +1 @@ -ekernel in os::mm::memory_set - Rust - -
    -

    Function os::mm::memory_set::ekernel

    source · []
    unsafe extern "C" fn ekernel()
    - \ No newline at end of file +ekernel in os::mm::memory_set - Rust

    Function os::mm::memory_set::ekernel

    source ·
    unsafe extern "C" fn ekernel()
    \ No newline at end of file diff --git a/ch6-dev/os/mm/memory_set/fn.erodata.html b/ch6-dev/os/mm/memory_set/fn.erodata.html index 4519e0dd..59b2a302 100644 --- a/ch6-dev/os/mm/memory_set/fn.erodata.html +++ b/ch6-dev/os/mm/memory_set/fn.erodata.html @@ -1,8 +1 @@ -erodata in os::mm::memory_set - Rust - -
    -

    Function os::mm::memory_set::erodata

    source · []
    unsafe extern "C" fn erodata()
    - \ No newline at end of file +erodata in os::mm::memory_set - Rust

    Function os::mm::memory_set::erodata

    source ·
    unsafe extern "C" fn erodata()
    \ No newline at end of file diff --git a/ch6-dev/os/mm/memory_set/fn.etext.html b/ch6-dev/os/mm/memory_set/fn.etext.html index c9a582bc..ea098077 100644 --- a/ch6-dev/os/mm/memory_set/fn.etext.html +++ b/ch6-dev/os/mm/memory_set/fn.etext.html @@ -1,8 +1 @@ -etext in os::mm::memory_set - Rust - -
    -

    Function os::mm::memory_set::etext

    source · []
    unsafe extern "C" fn etext()
    - \ No newline at end of file +etext in os::mm::memory_set - Rust

    Function os::mm::memory_set::etext

    source ·
    unsafe extern "C" fn etext()
    \ No newline at end of file diff --git a/ch6-dev/os/mm/memory_set/fn.kernel_token.html b/ch6-dev/os/mm/memory_set/fn.kernel_token.html index 8786146a..36bb223f 100644 --- a/ch6-dev/os/mm/memory_set/fn.kernel_token.html +++ b/ch6-dev/os/mm/memory_set/fn.kernel_token.html @@ -1,9 +1,2 @@ -kernel_token in os::mm::memory_set - Rust - -
    pub fn kernel_token() -> usize
    Expand description

    Get kernelspace root ppn

    -
    - \ No newline at end of file +kernel_token in os::mm::memory_set - Rust

    Function os::mm::memory_set::kernel_token

    source ·
    pub fn kernel_token() -> usize
    Expand description

    Get kernelspace root ppn

    +
    \ No newline at end of file diff --git a/ch6-dev/os/mm/memory_set/fn.remap_test.html b/ch6-dev/os/mm/memory_set/fn.remap_test.html index 725c8191..a9a10b2c 100644 --- a/ch6-dev/os/mm/memory_set/fn.remap_test.html +++ b/ch6-dev/os/mm/memory_set/fn.remap_test.html @@ -1,9 +1,2 @@ -remap_test in os::mm::memory_set - Rust - -
    pub fn remap_test()
    Expand description

    Check PageTable running correctly

    -
    - \ No newline at end of file +remap_test in os::mm::memory_set - Rust

    Function os::mm::memory_set::remap_test

    source ·
    pub fn remap_test()
    Expand description

    Check PageTable running correctly

    +
    \ No newline at end of file diff --git a/ch6-dev/os/mm/memory_set/fn.sbss_with_stack.html b/ch6-dev/os/mm/memory_set/fn.sbss_with_stack.html index 08d429d8..aa9603cd 100644 --- a/ch6-dev/os/mm/memory_set/fn.sbss_with_stack.html +++ b/ch6-dev/os/mm/memory_set/fn.sbss_with_stack.html @@ -1,8 +1 @@ -sbss_with_stack in os::mm::memory_set - Rust - -
    unsafe extern "C" fn sbss_with_stack()
    - \ No newline at end of file +sbss_with_stack in os::mm::memory_set - Rust

    Function os::mm::memory_set::sbss_with_stack

    source ·
    unsafe extern "C" fn sbss_with_stack()
    \ No newline at end of file diff --git a/ch6-dev/os/mm/memory_set/fn.sdata.html b/ch6-dev/os/mm/memory_set/fn.sdata.html index a8cd42d7..f57910fc 100644 --- a/ch6-dev/os/mm/memory_set/fn.sdata.html +++ b/ch6-dev/os/mm/memory_set/fn.sdata.html @@ -1,8 +1 @@ -sdata in os::mm::memory_set - Rust - -
    -

    Function os::mm::memory_set::sdata

    source · []
    unsafe extern "C" fn sdata()
    - \ No newline at end of file +sdata in os::mm::memory_set - Rust

    Function os::mm::memory_set::sdata

    source ·
    unsafe extern "C" fn sdata()
    \ No newline at end of file diff --git a/ch6-dev/os/mm/memory_set/fn.srodata.html b/ch6-dev/os/mm/memory_set/fn.srodata.html index 1dee6349..04b75488 100644 --- a/ch6-dev/os/mm/memory_set/fn.srodata.html +++ b/ch6-dev/os/mm/memory_set/fn.srodata.html @@ -1,8 +1 @@ -srodata in os::mm::memory_set - Rust - -
    -

    Function os::mm::memory_set::srodata

    source · []
    unsafe extern "C" fn srodata()
    - \ No newline at end of file +srodata in os::mm::memory_set - Rust

    Function os::mm::memory_set::srodata

    source ·
    unsafe extern "C" fn srodata()
    \ No newline at end of file diff --git a/ch6-dev/os/mm/memory_set/fn.stext.html b/ch6-dev/os/mm/memory_set/fn.stext.html index cecb13ad..7d72ec3a 100644 --- a/ch6-dev/os/mm/memory_set/fn.stext.html +++ b/ch6-dev/os/mm/memory_set/fn.stext.html @@ -1,8 +1 @@ -stext in os::mm::memory_set - Rust - -
    -

    Function os::mm::memory_set::stext

    source · []
    unsafe extern "C" fn stext()
    - \ No newline at end of file +stext in os::mm::memory_set - Rust

    Function os::mm::memory_set::stext

    source ·
    unsafe extern "C" fn stext()
    \ No newline at end of file diff --git a/ch6-dev/os/mm/memory_set/fn.strampoline.html b/ch6-dev/os/mm/memory_set/fn.strampoline.html index b967e3d1..fb5dd69d 100644 --- a/ch6-dev/os/mm/memory_set/fn.strampoline.html +++ b/ch6-dev/os/mm/memory_set/fn.strampoline.html @@ -1,8 +1 @@ -strampoline in os::mm::memory_set - Rust - -
    unsafe extern "C" fn strampoline()
    - \ No newline at end of file +strampoline in os::mm::memory_set - Rust

    Function os::mm::memory_set::strampoline

    source ·
    unsafe extern "C" fn strampoline()
    \ No newline at end of file diff --git a/ch6-dev/os/mm/memory_set/index.html b/ch6-dev/os/mm/memory_set/index.html index 07149455..3e878055 100644 --- a/ch6-dev/os/mm/memory_set/index.html +++ b/ch6-dev/os/mm/memory_set/index.html @@ -1,19 +1,2 @@ -os::mm::memory_set - Rust - -
    -

    Module os::mm::memory_set

    source · []
    Expand description

    Implementation of MapArea and MemorySet.

    -

    Structs

    -

    a memory set instance through lazy_static! managing kernel space

    -

    map area structure, controls a contiguous piece of virtual memory

    -

    map permission corresponding to that in pte: R W X U

    -

    memory set structure, controls virtual-memory space

    -

    Enums

    -

    map type for memory set: identical or framed

    -

    Functions

    -
    ebss 🔒
    edata 🔒
    ekernel 🔒
    erodata 🔒
    etext 🔒

    Get kernelspace root ppn

    -

    Check PageTable running correctly

    -
    sdata 🔒
    srodata 🔒
    stext 🔒
    - \ No newline at end of file +os::mm::memory_set - Rust

    Module os::mm::memory_set

    source ·
    Expand description

    Implementation of MapArea and MemorySet.

    +

    Structs

    • a memory set instance through lazy_static! managing kernel space
    • map area structure, controls a contiguous piece of virtual memory
    • map permission corresponding to that in pte: R W X U
    • memory set structure, controls virtual-memory space

    Enums

    • map type for memory set: identical or framed

    Functions

    \ No newline at end of file diff --git a/ch6-dev/os/mm/memory_set/sidebar-items.js b/ch6-dev/os/mm/memory_set/sidebar-items.js index df595325..1135b439 100644 --- a/ch6-dev/os/mm/memory_set/sidebar-items.js +++ b/ch6-dev/os/mm/memory_set/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"enum":[["MapType","map type for memory set: identical or framed"]],"fn":[["ebss",""],["edata",""],["ekernel",""],["erodata",""],["etext",""],["kernel_token","Get kernelspace root ppn"],["remap_test","Check PageTable running correctly"],["sbss_with_stack",""],["sdata",""],["srodata",""],["stext",""],["strampoline",""]],"struct":[["KERNEL_SPACE","a memory set instance through lazy_static! managing kernel space"],["MapArea","map area structure, controls a contiguous piece of virtual memory"],["MapPermission","map permission corresponding to that in pte: `R W X U`"],["MemorySet","memory set structure, controls virtual-memory space"]]}); \ No newline at end of file +window.SIDEBAR_ITEMS = {"enum":["MapType"],"fn":["ebss","edata","ekernel","erodata","etext","kernel_token","remap_test","sbss_with_stack","sdata","srodata","stext","strampoline"],"struct":["KERNEL_SPACE","MapArea","MapPermission","MemorySet"]}; \ No newline at end of file diff --git a/ch6-dev/os/mm/memory_set/struct.KERNEL_SPACE.html b/ch6-dev/os/mm/memory_set/struct.KERNEL_SPACE.html index 42381bc8..df99208f 100644 --- a/ch6-dev/os/mm/memory_set/struct.KERNEL_SPACE.html +++ b/ch6-dev/os/mm/memory_set/struct.KERNEL_SPACE.html @@ -1,24 +1,14 @@ -KERNEL_SPACE in os::mm::memory_set - Rust - -
    pub struct KERNEL_SPACE {
    +KERNEL_SPACE in os::mm::memory_set - Rust

    Struct os::mm::memory_set::KERNEL_SPACE

    source ·
    pub struct KERNEL_SPACE {
         __private_field: (),
    -}
    Expand description

    a memory set instance through lazy_static! managing kernel space

    -

    Fields

    __private_field: ()

    Trait Implementations

    The resulting type after dereferencing.

    -

    Dereferences the value.

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +}
    Expand description

    a memory set instance through lazy_static! managing kernel space

    +

    Fields§

    §__private_field: ()

    Trait Implementations§

    source§

    impl Deref for KERNEL_SPACE

    §

    type Target = Arc<UPSafeCell<MemorySet>, Global>

    The resulting type after dereferencing.
    source§

    fn deref(&self) -> &Arc<UPSafeCell<MemorySet>>

    Dereferences the value.
    source§

    impl LazyStatic for KERNEL_SPACE

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/mm/memory_set/struct.MapArea.html b/ch6-dev/os/mm/memory_set/struct.MapArea.html index 30f6a47e..4b7d2d93 100644 --- a/ch6-dev/os/mm/memory_set/struct.MapArea.html +++ b/ch6-dev/os/mm/memory_set/struct.MapArea.html @@ -1,27 +1,24 @@ -MapArea in os::mm::memory_set - Rust - -
    pub struct MapArea {
    +MapArea in os::mm::memory_set - Rust

    Struct os::mm::memory_set::MapArea

    source ·
    pub struct MapArea {
         vpn_range: SimpleRange<VirtPageNum>,
         data_frames: BTreeMap<VirtPageNum, FrameTracker>,
         map_type: MapType,
         map_perm: MapPermission,
    -}
    Expand description

    map area structure, controls a contiguous piece of virtual memory

    -

    Fields

    vpn_range: SimpleRange<VirtPageNum>data_frames: BTreeMap<VirtPageNum, FrameTracker>map_type: MapTypemap_perm: MapPermission

    Implementations

    data: start-aligned but maybe with shorter length +}

    Expand description

    map area structure, controls a contiguous piece of virtual memory

    +

    Fields§

    §vpn_range: SimpleRange<VirtPageNum>§data_frames: BTreeMap<VirtPageNum, FrameTracker>§map_type: MapType§map_perm: MapPermission

    Implementations§

    source§

    impl MapArea

    source

    pub fn new( + start_va: VirtAddr, + end_va: VirtAddr, + map_type: MapType, + map_perm: MapPermission +) -> Self

    source

    pub fn from_another(another: &MapArea) -> Self

    source

    pub fn map_one(&mut self, page_table: &mut PageTable, vpn: VirtPageNum)

    source

    pub fn unmap_one(&mut self, page_table: &mut PageTable, vpn: VirtPageNum)

    source

    pub fn map(&mut self, page_table: &mut PageTable)

    source

    pub fn unmap(&mut self, page_table: &mut PageTable)

    source

    pub fn copy_data(&mut self, page_table: &mut PageTable, data: &[u8])

    data: start-aligned but maybe with shorter length assume that all frames were cleared before

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/mm/memory_set/struct.MapPermission.html b/ch6-dev/os/mm/memory_set/struct.MapPermission.html index b04f2284..c5456c45 100644 --- a/ch6-dev/os/mm/memory_set/struct.MapPermission.html +++ b/ch6-dev/os/mm/memory_set/struct.MapPermission.html @@ -1,24 +1,18 @@ -MapPermission in os::mm::memory_set - Rust - -
    pub struct MapPermission {
    +MapPermission in os::mm::memory_set - Rust

    Struct os::mm::memory_set::MapPermission

    source ·
    pub struct MapPermission {
         bits: u8,
    -}
    Expand description

    map permission corresponding to that in pte: R W X U

    -

    Fields

    bits: u8

    Implementations

    Readable

    -

    Writable

    -

    Excutable

    -

    Accessible in U mode

    -

    Returns an empty set of flags.

    -

    Returns the set containing all flags.

    -

    Returns the raw value of the flags currently stored.

    -

    Convert from underlying bit representation, unless that +}

    Expand description

    map permission corresponding to that in pte: R W X U

    +

    Fields§

    §bits: u8

    Implementations§

    source§

    impl MapPermission

    source

    pub const R: Self = _

    Readable

    +
    source

    pub const W: Self = _

    Writable

    +
    source

    pub const X: Self = _

    Excutable

    +
    source

    pub const U: Self = _

    Accessible in U mode

    +
    source

    pub const fn empty() -> Self

    Returns an empty set of flags.

    +
    source

    pub const fn all() -> Self

    Returns the set containing all flags.

    +
    source

    pub const fn bits(&self) -> u8

    Returns the raw value of the flags currently stored.

    +
    source

    pub const fn from_bits(bits: u8) -> Option<Self>

    Convert from underlying bit representation, unless that representation contains bits that do not correspond to a flag.

    -

    Convert from underlying bit representation, dropping any bits +

    source

    pub const fn from_bits_truncate(bits: u8) -> Self

    Convert from underlying bit representation, dropping any bits that do not correspond to flags.

    -

    Convert from underlying bit representation, preserving all +

    source

    pub const unsafe fn from_bits_unchecked(bits: u8) -> Self

    Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).

    Safety

    The caller of the bitflags! macro can chose to allow or @@ -26,35 +20,35 @@ disallow extra bits for their bitflags type.

    The caller of from_bits_unchecked() has to ensure that all bits correspond to a defined flag or that extra bits are valid for this bitflags type.

    -

    Returns true if no flags are currently stored.

    -

    Returns true if all flags are currently set.

    -

    Returns true if there are flags common to both self and other.

    -

    Returns true if all of the flags in other are contained within self.

    -

    Inserts the specified flags in-place.

    -

    Removes the specified flags in-place.

    -

    Toggles the specified flags in-place.

    -

    Inserts or removes the specified flags depending on the passed value.

    -

    Returns the intersection between the flags in self and +

    source

    pub const fn is_empty(&self) -> bool

    Returns true if no flags are currently stored.

    +
    source

    pub const fn is_all(&self) -> bool

    Returns true if all flags are currently set.

    +
    source

    pub const fn intersects(&self, other: Self) -> bool

    Returns true if there are flags common to both self and other.

    +
    source

    pub const fn contains(&self, other: Self) -> bool

    Returns true if all of the flags in other are contained within self.

    +
    source

    pub fn insert(&mut self, other: Self)

    Inserts the specified flags in-place.

    +
    source

    pub fn remove(&mut self, other: Self)

    Removes the specified flags in-place.

    +
    source

    pub fn toggle(&mut self, other: Self)

    Toggles the specified flags in-place.

    +
    source

    pub fn set(&mut self, other: Self, value: bool)

    Inserts or removes the specified flags depending on the passed value.

    +
    source

    pub const fn intersection(self, other: Self) -> Self

    Returns the intersection between the flags in self and other.

    Specifically, the returned set contains only the flags which are present in both self and other.

    This is equivalent to using the & operator (e.g. ops::BitAnd), as in flags & other.

    -

    Returns the union of between the flags in self and other.

    +
    source

    pub const fn union(self, other: Self) -> Self

    Returns the union of between the flags in self and other.

    Specifically, the returned set contains all flags which are present in either self or other, including any which are -present in both (see Self::symmetric_difference if that +present in both (see Self::symmetric_difference if that is undesirable).

    This is equivalent to using the | operator (e.g. ops::BitOr), as in flags | other.

    -

    Returns the difference between the flags in self and other.

    +
    source

    pub const fn difference(self, other: Self) -> Self

    Returns the difference between the flags in self and other.

    Specifically, the returned set contains all flags present in self, except for the ones present in other.

    It is also conceptually equivalent to the “bit-clear” operation: flags & !other (and this syntax is also supported).

    This is equivalent to using the - operator (e.g. ops::Sub), as in flags - other.

    -

    Returns the symmetric difference between the flags +

    source

    pub const fn symmetric_difference(self, other: Self) -> Self

    Returns the symmetric difference between the flags in self and other.

    Specifically, the returned set contains the flags present which are present in self or other, but that are not present in @@ -62,67 +56,40 @@ both. Equivalently, it contains the flags present in exactly one of the sets self and other.

    This is equivalent to using the ^ operator (e.g. ops::BitXor), as in flags ^ other.

    -

    Returns the complement of this set of flags.

    +
    source

    pub const fn complement(self) -> Self

    Returns the complement of this set of flags.

    Specifically, the returned set contains all the flags which are not set in self, but which are allowed for this type.

    Alternatively, it can be thought of as the set difference -between Self::all() and self (e.g. Self::all() - self)

    +between Self::all() and self (e.g. Self::all() - self)

    This is equivalent to using the ! operator (e.g. ops::Not), as in !flags.

    -

    Trait Implementations

    Formats the value using the given formatter.

    -

    Returns the intersection between the two sets of flags.

    -

    The resulting type after applying the & operator.

    -

    Disables all flags disabled in the set.

    -

    Returns the union of the two sets of flags.

    -

    The resulting type after applying the | operator.

    -

    Adds the set of flags.

    -

    Returns the left flags, but with all the right flags toggled.

    -

    The resulting type after applying the ^ operator.

    -

    Toggles the set of flags.

    -

    Returns a copy of the value. Read more

    -

    Performs copy-assignment from source. Read more

    -

    Formats the value using the given formatter. Read more

    -

    Extends a collection with the contents of an iterator. Read more

    -
    🔬 This is a nightly-only experimental API. (extend_one)

    Extends a collection with exactly one element.

    -
    🔬 This is a nightly-only experimental API. (extend_one)

    Reserves capacity in a collection for the given number of additional elements. Read more

    -

    Creates a value from an iterator. Read more

    -

    Feeds this value into the given Hasher. Read more

    -

    Feeds a slice of this type into the given Hasher. Read more

    -

    Formats the value using the given formatter.

    -

    Returns the complement of this set of flags.

    -

    The resulting type after applying the ! operator.

    -

    Formats the value using the given formatter.

    -

    This method returns an Ordering between self and other. Read more

    -

    Compares and returns the maximum of two values. Read more

    -

    Compares and returns the minimum of two values. Read more

    -

    Restrict a value to a certain interval. Read more

    -

    This method tests for self and other values to be equal, and is used -by ==. Read more

    -

    This method tests for !=.

    -

    This method returns an ordering between self and other values if one exists. Read more

    -

    This method tests less than (for self and other) and is used by the < operator. Read more

    -

    This method tests less than or equal to (for self and other) and is used by the <= -operator. Read more

    -

    This method tests greater than (for self and other) and is used by the > operator. Read more

    -

    This method tests greater than or equal to (for self and other) and is used by the >= -operator. Read more

    -

    Returns the set difference of the two sets of flags.

    -

    The resulting type after applying the - operator.

    -

    Disables all flags enabled in the set.

    -

    Formats the value using the given formatter.

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +

    Trait Implementations§

    source§

    impl Binary for MapPermission

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter.
    source§

    impl BitAnd<MapPermission> for MapPermission

    source§

    fn bitand(self, other: Self) -> Self

    Returns the intersection between the two sets of flags.

    +
    §

    type Output = MapPermission

    The resulting type after applying the & operator.
    source§

    impl BitAndAssign<MapPermission> for MapPermission

    source§

    fn bitand_assign(&mut self, other: Self)

    Disables all flags disabled in the set.

    +
    source§

    impl BitOr<MapPermission> for MapPermission

    source§

    fn bitor(self, other: MapPermission) -> Self

    Returns the union of the two sets of flags.

    +
    §

    type Output = MapPermission

    The resulting type after applying the | operator.
    source§

    impl BitOrAssign<MapPermission> for MapPermission

    source§

    fn bitor_assign(&mut self, other: Self)

    Adds the set of flags.

    +
    source§

    impl BitXor<MapPermission> for MapPermission

    source§

    fn bitxor(self, other: Self) -> Self

    Returns the left flags, but with all the right flags toggled.

    +
    §

    type Output = MapPermission

    The resulting type after applying the ^ operator.
    source§

    impl BitXorAssign<MapPermission> for MapPermission

    source§

    fn bitxor_assign(&mut self, other: Self)

    Toggles the set of flags.

    +
    source§

    impl Clone for MapPermission

    source§

    fn clone(&self) -> MapPermission

    Returns a copy of the value. Read more
    1.0.0 · source§

    fn clone_from(&mut self, source: &Self)

    Performs copy-assignment from source. Read more
    source§

    impl Debug for MapPermission

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    source§

    impl Extend<MapPermission> for MapPermission

    source§

    fn extend<T: IntoIterator<Item = Self>>(&mut self, iterator: T)

    Extends a collection with the contents of an iterator. Read more
    source§

    fn extend_one(&mut self, item: A)

    🔬This is a nightly-only experimental API. (extend_one)
    Extends a collection with exactly one element.
    source§

    fn extend_reserve(&mut self, additional: usize)

    🔬This is a nightly-only experimental API. (extend_one)
    Reserves capacity in a collection for the given number of additional elements. Read more
    source§

    impl FromIterator<MapPermission> for MapPermission

    source§

    fn from_iter<T: IntoIterator<Item = Self>>(iterator: T) -> Self

    Creates a value from an iterator. Read more
    source§

    impl Hash for MapPermission

    source§

    fn hash<__H: Hasher>(&self, state: &mut __H)

    Feeds this value into the given Hasher. Read more
    1.3.0 · source§

    fn hash_slice<H>(data: &[Self], state: &mut H)where + H: Hasher, + Self: Sized,

    Feeds a slice of this type into the given Hasher. Read more
    source§

    impl LowerHex for MapPermission

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter.
    source§

    impl Not for MapPermission

    source§

    fn not(self) -> Self

    Returns the complement of this set of flags.

    +
    §

    type Output = MapPermission

    The resulting type after applying the ! operator.
    source§

    impl Octal for MapPermission

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter.
    source§

    impl Ord for MapPermission

    source§

    fn cmp(&self, other: &MapPermission) -> Ordering

    This method returns an Ordering between self and other. Read more
    1.21.0 · source§

    fn max(self, other: Self) -> Selfwhere + Self: Sized,

    Compares and returns the maximum of two values. Read more
    1.21.0 · source§

    fn min(self, other: Self) -> Selfwhere + Self: Sized,

    Compares and returns the minimum of two values. Read more
    1.50.0 · source§

    fn clamp(self, min: Self, max: Self) -> Selfwhere + Self: Sized + PartialOrd<Self>,

    Restrict a value to a certain interval. Read more
    source§

    impl PartialEq<MapPermission> for MapPermission

    source§

    fn eq(&self, other: &MapPermission) -> bool

    This method tests for self and other values to be equal, and is used +by ==.
    1.0.0 · source§

    fn ne(&self, other: &Rhs) -> bool

    This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
    source§

    impl PartialOrd<MapPermission> for MapPermission

    source§

    fn partial_cmp(&self, other: &MapPermission) -> Option<Ordering>

    This method returns an ordering between self and other values if one exists. Read more
    1.0.0 · source§

    fn lt(&self, other: &Rhs) -> bool

    This method tests less than (for self and other) and is used by the < operator. Read more
    1.0.0 · source§

    fn le(&self, other: &Rhs) -> bool

    This method tests less than or equal to (for self and other) and is used by the <= +operator. Read more
    1.0.0 · source§

    fn gt(&self, other: &Rhs) -> bool

    This method tests greater than (for self and other) and is used by the > operator. Read more
    1.0.0 · source§

    fn ge(&self, other: &Rhs) -> bool

    This method tests greater than or equal to (for self and other) and is used by the >= +operator. Read more
    source§

    impl Sub<MapPermission> for MapPermission

    source§

    fn sub(self, other: Self) -> Self

    Returns the set difference of the two sets of flags.

    +
    §

    type Output = MapPermission

    The resulting type after applying the - operator.
    source§

    impl SubAssign<MapPermission> for MapPermission

    source§

    fn sub_assign(&mut self, other: Self)

    Disables all flags enabled in the set.

    +
    source§

    impl UpperHex for MapPermission

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter.
    source§

    impl Copy for MapPermission

    source§

    impl Eq for MapPermission

    source§

    impl StructuralEq for MapPermission

    source§

    impl StructuralPartialEq for MapPermission

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The resulting type after obtaining ownership.

    -

    Creates owned data from borrowed data, usually by cloning. Read more

    -
    🔬 This is a nightly-only experimental API. (toowned_clone_into)

    Uses borrowed data to replace owned data, usually by cloning. Read more

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T> ToOwned for Twhere + T: Clone,

    §

    type Owned = T

    The resulting type after obtaining ownership.
    source§

    fn to_owned(&self) -> T

    Creates owned data from borrowed data, usually by cloning. Read more
    source§

    fn clone_into(&self, target: &mut T)

    Uses borrowed data to replace owned data, usually by cloning. Read more
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/mm/memory_set/struct.MemorySet.html b/ch6-dev/os/mm/memory_set/struct.MemorySet.html index 31400927..0acd1810 100644 --- a/ch6-dev/os/mm/memory_set/struct.MemorySet.html +++ b/ch6-dev/os/mm/memory_set/struct.MemorySet.html @@ -1,35 +1,32 @@ -MemorySet in os::mm::memory_set - Rust - -
    pub struct MemorySet {
    +MemorySet in os::mm::memory_set - Rust

    Struct os::mm::memory_set::MemorySet

    source ·
    pub struct MemorySet {
         page_table: PageTable,
         areas: Vec<MapArea>,
    -}
    Expand description

    memory set structure, controls virtual-memory space

    -

    Fields

    page_table: PageTableareas: Vec<MapArea>

    Implementations

    Create an empty MemorySet

    -

    Get pagetable root_ppn

    -

    Assume that no conflicts.

    -

    Remove MapArea that starts with start_vpn

    -

    Mention that trampoline is not collected by areas.

    -

    Without kernel stacks.

    -

    Include sections in elf and trampoline and TrapContext and user stack, +}

    Expand description

    memory set structure, controls virtual-memory space

    +

    Fields§

    §page_table: PageTable§areas: Vec<MapArea>

    Implementations§

    source§

    impl MemorySet

    source

    pub fn new_bare() -> Self

    Create an empty MemorySet

    +
    source

    pub fn token(&self) -> usize

    Get pagetable root_ppn

    +
    source

    pub fn insert_framed_area( + &mut self, + start_va: VirtAddr, + end_va: VirtAddr, + permission: MapPermission +)

    Assume that no conflicts.

    +
    source

    pub fn remove_area_with_start_vpn(&mut self, start_vpn: VirtPageNum)

    Remove MapArea that starts with start_vpn

    +
    source

    fn push(&mut self, map_area: MapArea, data: Option<&[u8]>)

    source

    fn map_trampoline(&mut self)

    Mention that trampoline is not collected by areas.

    +
    source

    pub fn new_kernel() -> Self

    Without kernel stacks.

    +
    source

    pub fn from_elf(elf_data: &[u8]) -> (Self, usize, usize)

    Include sections in elf and trampoline and TrapContext and user stack, also returns user_sp and entry point.

    -

    Clone a same MemorySet

    -

    Refresh TLB with sfence.vma

    -

    Translate throuth pagetable

    -

    Remove all MapArea

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +
    source

    pub fn from_existed_user(user_space: &MemorySet) -> MemorySet

    Clone a same MemorySet

    +
    source

    pub fn activate(&self)

    Refresh TLB with sfence.vma

    +
    source

    pub fn translate(&self, vpn: VirtPageNum) -> Option<PageTableEntry>

    Translate throuth pagetable

    +
    source

    pub fn recycle_data_pages(&mut self)

    Remove all MapArea

    +

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/mm/page_table/fn.translated_byte_buffer.html b/ch6-dev/os/mm/page_table/fn.translated_byte_buffer.html index 81d23fd4..ecdb88c5 100644 --- a/ch6-dev/os/mm/page_table/fn.translated_byte_buffer.html +++ b/ch6-dev/os/mm/page_table/fn.translated_byte_buffer.html @@ -1,9 +1,6 @@ -translated_byte_buffer in os::mm::page_table - Rust - -
    pub fn translated_byte_buffer(
        token: usize,
        ptr: *const u8,
        len: usize
    ) -> Vec<&'static mut [u8]>
    Expand description

    Translate a pointer to a mutable u8 Vec through page table

    -
    - \ No newline at end of file +translated_byte_buffer in os::mm::page_table - Rust
    pub fn translated_byte_buffer(
    +    token: usize,
    +    ptr: *const u8,
    +    len: usize
    +) -> Vec<&'static mut [u8]>
    Expand description

    Translate a pointer to a mutable u8 Vec through page table

    +
    \ No newline at end of file diff --git a/ch6-dev/os/mm/page_table/fn.translated_ref.html b/ch6-dev/os/mm/page_table/fn.translated_ref.html index 6f39eb11..e47591e3 100644 --- a/ch6-dev/os/mm/page_table/fn.translated_ref.html +++ b/ch6-dev/os/mm/page_table/fn.translated_ref.html @@ -1,9 +1,2 @@ -translated_ref in os::mm::page_table - Rust - -
    pub fn translated_ref<T>(token: usize, ptr: *const T) -> &'static T
    Expand description

    Translate a generic through page table and return a reference

    -
    - \ No newline at end of file +translated_ref in os::mm::page_table - Rust

    Function os::mm::page_table::translated_ref

    source ·
    pub fn translated_ref<T>(token: usize, ptr: *const T) -> &'static T
    Expand description

    Translate a generic through page table and return a reference

    +
    \ No newline at end of file diff --git a/ch6-dev/os/mm/page_table/fn.translated_refmut.html b/ch6-dev/os/mm/page_table/fn.translated_refmut.html index 61f08833..3ccc440f 100644 --- a/ch6-dev/os/mm/page_table/fn.translated_refmut.html +++ b/ch6-dev/os/mm/page_table/fn.translated_refmut.html @@ -1,9 +1,2 @@ -translated_refmut in os::mm::page_table - Rust - -
    pub fn translated_refmut<T>(token: usize, ptr: *mut T) -> &'static mut T
    Expand description

    Translate a generic through page table and return a mutable reference

    -
    - \ No newline at end of file +translated_refmut in os::mm::page_table - Rust
    pub fn translated_refmut<T>(token: usize, ptr: *mut T) -> &'static mut T
    Expand description

    Translate a generic through page table and return a mutable reference

    +
    \ No newline at end of file diff --git a/ch6-dev/os/mm/page_table/fn.translated_str.html b/ch6-dev/os/mm/page_table/fn.translated_str.html index de71305f..66e1332d 100644 --- a/ch6-dev/os/mm/page_table/fn.translated_str.html +++ b/ch6-dev/os/mm/page_table/fn.translated_str.html @@ -1,9 +1,2 @@ -translated_str in os::mm::page_table - Rust - -
    pub fn translated_str(token: usize, ptr: *const u8) -> String
    Expand description

    Translate a pointer to a mutable u8 Vec end with \0 through page table to a String

    -
    - \ No newline at end of file +translated_str in os::mm::page_table - Rust

    Function os::mm::page_table::translated_str

    source ·
    pub fn translated_str(token: usize, ptr: *const u8) -> String
    Expand description

    Translate a pointer to a mutable u8 Vec end with \0 through page table to a String

    +
    \ No newline at end of file diff --git a/ch6-dev/os/mm/page_table/index.html b/ch6-dev/os/mm/page_table/index.html index 3f2012a4..6448fe19 100644 --- a/ch6-dev/os/mm/page_table/index.html +++ b/ch6-dev/os/mm/page_table/index.html @@ -1,19 +1,2 @@ -os::mm::page_table - Rust - -
    -

    Module os::mm::page_table

    source · []
    Expand description

    Implementation of PageTableEntry and PageTable.

    -

    Structs

    -

    Record root ppn and has the same lifetime as 1 and 2 level PageTableEntry

    -

    page table entry structure

    -

    Array of u8 slice that user communicate with os

    -

    Iterator of UserBuffer

    -

    Functions

    -

    Translate a pointer to a mutable u8 Vec through page table

    -

    Translate a generic through page table and return a reference

    -

    Translate a generic through page table and return a mutable reference

    -

    Translate a pointer to a mutable u8 Vec end with \0 through page table to a String

    -
    - \ No newline at end of file +os::mm::page_table - Rust

    Module os::mm::page_table

    source ·
    Expand description

    Implementation of PageTableEntry and PageTable.

    +

    Structs

    Functions

    • Translate a pointer to a mutable u8 Vec through page table
    • Translate a generic through page table and return a reference
    • Translate a generic through page table and return a mutable reference
    • Translate a pointer to a mutable u8 Vec end with \0 through page table to a String
    \ No newline at end of file diff --git a/ch6-dev/os/mm/page_table/sidebar-items.js b/ch6-dev/os/mm/page_table/sidebar-items.js index 2a99da52..fa3e7d68 100644 --- a/ch6-dev/os/mm/page_table/sidebar-items.js +++ b/ch6-dev/os/mm/page_table/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"fn":[["translated_byte_buffer","Translate a pointer to a mutable u8 Vec through page table"],["translated_ref","Translate a generic through page table and return a reference"],["translated_refmut","Translate a generic through page table and return a mutable reference"],["translated_str","Translate a pointer to a mutable u8 Vec end with `\\0` through page table to a `String`"]],"struct":[["PTEFlags",""],["PageTable","Record root ppn and has the same lifetime as 1 and 2 level `PageTableEntry`"],["PageTableEntry","page table entry structure"],["UserBuffer","Array of u8 slice that user communicate with os"],["UserBufferIterator","Iterator of `UserBuffer`"]]}); \ No newline at end of file +window.SIDEBAR_ITEMS = {"fn":["translated_byte_buffer","translated_ref","translated_refmut","translated_str"],"struct":["PTEFlags","PageTable","PageTableEntry","UserBuffer","UserBufferIterator"]}; \ No newline at end of file diff --git a/ch6-dev/os/mm/page_table/struct.PTEFlags.html b/ch6-dev/os/mm/page_table/struct.PTEFlags.html index 06eff429..adc69682 100644 --- a/ch6-dev/os/mm/page_table/struct.PTEFlags.html +++ b/ch6-dev/os/mm/page_table/struct.PTEFlags.html @@ -1,19 +1,13 @@ -PTEFlags in os::mm::page_table - Rust - -
    pub struct PTEFlags {
    +PTEFlags in os::mm::page_table - Rust

    Struct os::mm::page_table::PTEFlags

    source ·
    pub struct PTEFlags {
         bits: u8,
    -}

    Fields

    bits: u8

    Implementations

    Returns an empty set of flags.

    -

    Returns the set containing all flags.

    -

    Returns the raw value of the flags currently stored.

    -

    Convert from underlying bit representation, unless that +}

    Fields§

    §bits: u8

    Implementations§

    source§

    impl PTEFlags

    source

    pub const V: Self = _

    source

    pub const R: Self = _

    source

    pub const W: Self = _

    source

    pub const X: Self = _

    source

    pub const U: Self = _

    source

    pub const G: Self = _

    source

    pub const A: Self = _

    source

    pub const D: Self = _

    source

    pub const fn empty() -> Self

    Returns an empty set of flags.

    +
    source

    pub const fn all() -> Self

    Returns the set containing all flags.

    +
    source

    pub const fn bits(&self) -> u8

    Returns the raw value of the flags currently stored.

    +
    source

    pub const fn from_bits(bits: u8) -> Option<Self>

    Convert from underlying bit representation, unless that representation contains bits that do not correspond to a flag.

    -

    Convert from underlying bit representation, dropping any bits +

    source

    pub const fn from_bits_truncate(bits: u8) -> Self

    Convert from underlying bit representation, dropping any bits that do not correspond to flags.

    -

    Convert from underlying bit representation, preserving all +

    source

    pub const unsafe fn from_bits_unchecked(bits: u8) -> Self

    Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).

    Safety

    The caller of the bitflags! macro can chose to allow or @@ -21,35 +15,35 @@ disallow extra bits for their bitflags type.

    The caller of from_bits_unchecked() has to ensure that all bits correspond to a defined flag or that extra bits are valid for this bitflags type.

    -

    Returns true if no flags are currently stored.

    -

    Returns true if all flags are currently set.

    -

    Returns true if there are flags common to both self and other.

    -

    Returns true if all of the flags in other are contained within self.

    -

    Inserts the specified flags in-place.

    -

    Removes the specified flags in-place.

    -

    Toggles the specified flags in-place.

    -

    Inserts or removes the specified flags depending on the passed value.

    -

    Returns the intersection between the flags in self and +

    source

    pub const fn is_empty(&self) -> bool

    Returns true if no flags are currently stored.

    +
    source

    pub const fn is_all(&self) -> bool

    Returns true if all flags are currently set.

    +
    source

    pub const fn intersects(&self, other: Self) -> bool

    Returns true if there are flags common to both self and other.

    +
    source

    pub const fn contains(&self, other: Self) -> bool

    Returns true if all of the flags in other are contained within self.

    +
    source

    pub fn insert(&mut self, other: Self)

    Inserts the specified flags in-place.

    +
    source

    pub fn remove(&mut self, other: Self)

    Removes the specified flags in-place.

    +
    source

    pub fn toggle(&mut self, other: Self)

    Toggles the specified flags in-place.

    +
    source

    pub fn set(&mut self, other: Self, value: bool)

    Inserts or removes the specified flags depending on the passed value.

    +
    source

    pub const fn intersection(self, other: Self) -> Self

    Returns the intersection between the flags in self and other.

    Specifically, the returned set contains only the flags which are present in both self and other.

    This is equivalent to using the & operator (e.g. ops::BitAnd), as in flags & other.

    -

    Returns the union of between the flags in self and other.

    +
    source

    pub const fn union(self, other: Self) -> Self

    Returns the union of between the flags in self and other.

    Specifically, the returned set contains all flags which are present in either self or other, including any which are -present in both (see Self::symmetric_difference if that +present in both (see Self::symmetric_difference if that is undesirable).

    This is equivalent to using the | operator (e.g. ops::BitOr), as in flags | other.

    -

    Returns the difference between the flags in self and other.

    +
    source

    pub const fn difference(self, other: Self) -> Self

    Returns the difference between the flags in self and other.

    Specifically, the returned set contains all flags present in self, except for the ones present in other.

    It is also conceptually equivalent to the “bit-clear” operation: flags & !other (and this syntax is also supported).

    This is equivalent to using the - operator (e.g. ops::Sub), as in flags - other.

    -

    Returns the symmetric difference between the flags +

    source

    pub const fn symmetric_difference(self, other: Self) -> Self

    Returns the symmetric difference between the flags in self and other.

    Specifically, the returned set contains the flags present which are present in self or other, but that are not present in @@ -57,67 +51,40 @@ both. Equivalently, it contains the flags present in exactly one of the sets self and other.

    This is equivalent to using the ^ operator (e.g. ops::BitXor), as in flags ^ other.

    -

    Returns the complement of this set of flags.

    +
    source

    pub const fn complement(self) -> Self

    Returns the complement of this set of flags.

    Specifically, the returned set contains all the flags which are not set in self, but which are allowed for this type.

    Alternatively, it can be thought of as the set difference -between Self::all() and self (e.g. Self::all() - self)

    +between Self::all() and self (e.g. Self::all() - self)

    This is equivalent to using the ! operator (e.g. ops::Not), as in !flags.

    -

    Trait Implementations

    Formats the value using the given formatter.

    -

    Returns the intersection between the two sets of flags.

    -

    The resulting type after applying the & operator.

    -

    Disables all flags disabled in the set.

    -

    Returns the union of the two sets of flags.

    -

    The resulting type after applying the | operator.

    -

    Adds the set of flags.

    -

    Returns the left flags, but with all the right flags toggled.

    -

    The resulting type after applying the ^ operator.

    -

    Toggles the set of flags.

    -

    Returns a copy of the value. Read more

    -

    Performs copy-assignment from source. Read more

    -

    Formats the value using the given formatter. Read more

    -

    Extends a collection with the contents of an iterator. Read more

    -
    🔬 This is a nightly-only experimental API. (extend_one)

    Extends a collection with exactly one element.

    -
    🔬 This is a nightly-only experimental API. (extend_one)

    Reserves capacity in a collection for the given number of additional elements. Read more

    -

    Creates a value from an iterator. Read more

    -

    Feeds this value into the given Hasher. Read more

    -

    Feeds a slice of this type into the given Hasher. Read more

    -

    Formats the value using the given formatter.

    -

    Returns the complement of this set of flags.

    -

    The resulting type after applying the ! operator.

    -

    Formats the value using the given formatter.

    -

    This method returns an Ordering between self and other. Read more

    -

    Compares and returns the maximum of two values. Read more

    -

    Compares and returns the minimum of two values. Read more

    -

    Restrict a value to a certain interval. Read more

    -

    This method tests for self and other values to be equal, and is used -by ==. Read more

    -

    This method tests for !=.

    -

    This method returns an ordering between self and other values if one exists. Read more

    -

    This method tests less than (for self and other) and is used by the < operator. Read more

    -

    This method tests less than or equal to (for self and other) and is used by the <= -operator. Read more

    -

    This method tests greater than (for self and other) and is used by the > operator. Read more

    -

    This method tests greater than or equal to (for self and other) and is used by the >= -operator. Read more

    -

    Returns the set difference of the two sets of flags.

    -

    The resulting type after applying the - operator.

    -

    Disables all flags enabled in the set.

    -

    Formats the value using the given formatter.

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +

    Trait Implementations§

    source§

    impl Binary for PTEFlags

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter.
    source§

    impl BitAnd<PTEFlags> for PTEFlags

    source§

    fn bitand(self, other: Self) -> Self

    Returns the intersection between the two sets of flags.

    +
    §

    type Output = PTEFlags

    The resulting type after applying the & operator.
    source§

    impl BitAndAssign<PTEFlags> for PTEFlags

    source§

    fn bitand_assign(&mut self, other: Self)

    Disables all flags disabled in the set.

    +
    source§

    impl BitOr<PTEFlags> for PTEFlags

    source§

    fn bitor(self, other: PTEFlags) -> Self

    Returns the union of the two sets of flags.

    +
    §

    type Output = PTEFlags

    The resulting type after applying the | operator.
    source§

    impl BitOrAssign<PTEFlags> for PTEFlags

    source§

    fn bitor_assign(&mut self, other: Self)

    Adds the set of flags.

    +
    source§

    impl BitXor<PTEFlags> for PTEFlags

    source§

    fn bitxor(self, other: Self) -> Self

    Returns the left flags, but with all the right flags toggled.

    +
    §

    type Output = PTEFlags

    The resulting type after applying the ^ operator.
    source§

    impl BitXorAssign<PTEFlags> for PTEFlags

    source§

    fn bitxor_assign(&mut self, other: Self)

    Toggles the set of flags.

    +
    source§

    impl Clone for PTEFlags

    source§

    fn clone(&self) -> PTEFlags

    Returns a copy of the value. Read more
    1.0.0 · source§

    fn clone_from(&mut self, source: &Self)

    Performs copy-assignment from source. Read more
    source§

    impl Debug for PTEFlags

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    source§

    impl Extend<PTEFlags> for PTEFlags

    source§

    fn extend<T: IntoIterator<Item = Self>>(&mut self, iterator: T)

    Extends a collection with the contents of an iterator. Read more
    source§

    fn extend_one(&mut self, item: A)

    🔬This is a nightly-only experimental API. (extend_one)
    Extends a collection with exactly one element.
    source§

    fn extend_reserve(&mut self, additional: usize)

    🔬This is a nightly-only experimental API. (extend_one)
    Reserves capacity in a collection for the given number of additional elements. Read more
    source§

    impl FromIterator<PTEFlags> for PTEFlags

    source§

    fn from_iter<T: IntoIterator<Item = Self>>(iterator: T) -> Self

    Creates a value from an iterator. Read more
    source§

    impl Hash for PTEFlags

    source§

    fn hash<__H: Hasher>(&self, state: &mut __H)

    Feeds this value into the given Hasher. Read more
    1.3.0 · source§

    fn hash_slice<H>(data: &[Self], state: &mut H)where + H: Hasher, + Self: Sized,

    Feeds a slice of this type into the given Hasher. Read more
    source§

    impl LowerHex for PTEFlags

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter.
    source§

    impl Not for PTEFlags

    source§

    fn not(self) -> Self

    Returns the complement of this set of flags.

    +
    §

    type Output = PTEFlags

    The resulting type after applying the ! operator.
    source§

    impl Octal for PTEFlags

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter.
    source§

    impl Ord for PTEFlags

    source§

    fn cmp(&self, other: &PTEFlags) -> Ordering

    This method returns an Ordering between self and other. Read more
    1.21.0 · source§

    fn max(self, other: Self) -> Selfwhere + Self: Sized,

    Compares and returns the maximum of two values. Read more
    1.21.0 · source§

    fn min(self, other: Self) -> Selfwhere + Self: Sized,

    Compares and returns the minimum of two values. Read more
    1.50.0 · source§

    fn clamp(self, min: Self, max: Self) -> Selfwhere + Self: Sized + PartialOrd<Self>,

    Restrict a value to a certain interval. Read more
    source§

    impl PartialEq<PTEFlags> for PTEFlags

    source§

    fn eq(&self, other: &PTEFlags) -> bool

    This method tests for self and other values to be equal, and is used +by ==.
    1.0.0 · source§

    fn ne(&self, other: &Rhs) -> bool

    This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
    source§

    impl PartialOrd<PTEFlags> for PTEFlags

    source§

    fn partial_cmp(&self, other: &PTEFlags) -> Option<Ordering>

    This method returns an ordering between self and other values if one exists. Read more
    1.0.0 · source§

    fn lt(&self, other: &Rhs) -> bool

    This method tests less than (for self and other) and is used by the < operator. Read more
    1.0.0 · source§

    fn le(&self, other: &Rhs) -> bool

    This method tests less than or equal to (for self and other) and is used by the <= +operator. Read more
    1.0.0 · source§

    fn gt(&self, other: &Rhs) -> bool

    This method tests greater than (for self and other) and is used by the > operator. Read more
    1.0.0 · source§

    fn ge(&self, other: &Rhs) -> bool

    This method tests greater than or equal to (for self and other) and is used by the >= +operator. Read more
    source§

    impl Sub<PTEFlags> for PTEFlags

    source§

    fn sub(self, other: Self) -> Self

    Returns the set difference of the two sets of flags.

    +
    §

    type Output = PTEFlags

    The resulting type after applying the - operator.
    source§

    impl SubAssign<PTEFlags> for PTEFlags

    source§

    fn sub_assign(&mut self, other: Self)

    Disables all flags enabled in the set.

    +
    source§

    impl UpperHex for PTEFlags

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter.
    source§

    impl Copy for PTEFlags

    source§

    impl Eq for PTEFlags

    source§

    impl StructuralEq for PTEFlags

    source§

    impl StructuralPartialEq for PTEFlags

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The resulting type after obtaining ownership.

    -

    Creates owned data from borrowed data, usually by cloning. Read more

    -
    🔬 This is a nightly-only experimental API. (toowned_clone_into)

    Uses borrowed data to replace owned data, usually by cloning. Read more

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T> ToOwned for Twhere + T: Clone,

    §

    type Owned = T

    The resulting type after obtaining ownership.
    source§

    fn to_owned(&self) -> T

    Creates owned data from borrowed data, usually by cloning. Read more
    source§

    fn clone_into(&self, target: &mut T)

    Uses borrowed data to replace owned data, usually by cloning. Read more
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/mm/page_table/struct.PageTable.html b/ch6-dev/os/mm/page_table/struct.PageTable.html index ef2cffe6..ac58ab20 100644 --- a/ch6-dev/os/mm/page_table/struct.PageTable.html +++ b/ch6-dev/os/mm/page_table/struct.PageTable.html @@ -1,33 +1,25 @@ -PageTable in os::mm::page_table - Rust - -
    pub struct PageTable {
    +PageTable in os::mm::page_table - Rust

    Struct os::mm::page_table::PageTable

    source ·
    pub struct PageTable {
         root_ppn: PhysPageNum,
         frames: Vec<FrameTracker>,
    -}
    Expand description

    Record root ppn and has the same lifetime as 1 and 2 level PageTableEntry

    -

    Fields

    root_ppn: PhysPageNumframes: Vec<FrameTracker>

    Implementations

    Assume that it won’t oom when creating/mapping.

    -

    Create an empty PageTable

    -

    Temporarily used to get arguments from user space.

    -

    Find phsical address by virtual address, create a frame if not exist

    -

    Find phsical address by virtual address

    -

    Create a mapping form vpn to ppn

    -

    Delete a mapping form vpn

    -

    Translate VirtPageNum to PageTableEntry

    -

    Translate VirtAddr to PhysAddr

    -

    Get root ppn

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +}
    Expand description

    Record root ppn and has the same lifetime as 1 and 2 level PageTableEntry

    +

    Fields§

    §root_ppn: PhysPageNum§frames: Vec<FrameTracker>

    Implementations§

    source§

    impl PageTable

    Assume that it won’t oom when creating/mapping.

    +
    source

    pub fn new() -> Self

    Create an empty PageTable

    +
    source

    pub fn from_token(satp: usize) -> Self

    Temporarily used to get arguments from user space.

    +
    source

    fn find_pte_create(&mut self, vpn: VirtPageNum) -> Option<&mut PageTableEntry>

    Find phsical address by virtual address, create a frame if not exist

    +
    source

    fn find_pte(&self, vpn: VirtPageNum) -> Option<&mut PageTableEntry>

    Find phsical address by virtual address

    +
    source

    pub fn map(&mut self, vpn: VirtPageNum, ppn: PhysPageNum, flags: PTEFlags)

    Create a mapping form vpn to ppn

    +
    source

    pub fn unmap(&mut self, vpn: VirtPageNum)

    Delete a mapping form vpn

    +
    source

    pub fn translate(&self, vpn: VirtPageNum) -> Option<PageTableEntry>

    Translate VirtPageNum to PageTableEntry

    +
    source

    pub fn translate_va(&self, va: VirtAddr) -> Option<PhysAddr>

    Translate VirtAddr to PhysAddr

    +
    source

    pub fn token(&self) -> usize

    Get root ppn

    +

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/mm/page_table/struct.PageTableEntry.html b/ch6-dev/os/mm/page_table/struct.PageTableEntry.html index 6169b126..dae19078 100644 --- a/ch6-dev/os/mm/page_table/struct.PageTableEntry.html +++ b/ch6-dev/os/mm/page_table/struct.PageTableEntry.html @@ -1,36 +1,24 @@ -PageTableEntry in os::mm::page_table - Rust - -
    #[repr(C)]
    pub struct PageTableEntry { +PageTableEntry in os::mm::page_table - Rust
    #[repr(C)]
    pub struct PageTableEntry { pub bits: usize, -}
    Expand description

    page table entry structure

    -

    Fields

    bits: usize

    PTE

    -

    Implementations

    Create a PTE from ppn

    -

    Return an empty PTE

    -

    Return 44bit ppn

    -

    Return 10bit flag

    -

    Check PTE valid

    -

    Check PTE readable

    -

    Check PTE writable

    -

    Check PTE executable

    -

    Trait Implementations

    Returns a copy of the value. Read more

    -

    Performs copy-assignment from source. Read more

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +}
    Expand description

    page table entry structure

    +

    Fields§

    §bits: usize

    PTE

    +

    Implementations§

    source§

    impl PageTableEntry

    source

    pub fn new(ppn: PhysPageNum, flags: PTEFlags) -> Self

    Create a PTE from ppn

    +
    source

    pub fn empty() -> Self

    Return an empty PTE

    +
    source

    pub fn ppn(&self) -> PhysPageNum

    Return 44bit ppn

    +
    source

    pub fn flags(&self) -> PTEFlags

    Return 10bit flag

    +
    source

    pub fn is_valid(&self) -> bool

    Check PTE valid

    +
    source

    pub fn readable(&self) -> bool

    Check PTE readable

    +
    source

    pub fn writable(&self) -> bool

    Check PTE writable

    +
    source

    pub fn executable(&self) -> bool

    Check PTE executable

    +

    Trait Implementations§

    source§

    impl Clone for PageTableEntry

    source§

    fn clone(&self) -> PageTableEntry

    Returns a copy of the value. Read more
    1.0.0 · source§

    fn clone_from(&mut self, source: &Self)

    Performs copy-assignment from source. Read more
    source§

    impl Copy for PageTableEntry

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The resulting type after obtaining ownership.

    -

    Creates owned data from borrowed data, usually by cloning. Read more

    -
    🔬 This is a nightly-only experimental API. (toowned_clone_into)

    Uses borrowed data to replace owned data, usually by cloning. Read more

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T> ToOwned for Twhere + T: Clone,

    §

    type Owned = T

    The resulting type after obtaining ownership.
    source§

    fn to_owned(&self) -> T

    Creates owned data from borrowed data, usually by cloning. Read more
    source§

    fn clone_into(&self, target: &mut T)

    Uses borrowed data to replace owned data, usually by cloning. Read more
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/mm/page_table/struct.UserBuffer.html b/ch6-dev/os/mm/page_table/struct.UserBuffer.html index 0931a9b8..eff51f89 100644 --- a/ch6-dev/os/mm/page_table/struct.UserBuffer.html +++ b/ch6-dev/os/mm/page_table/struct.UserBuffer.html @@ -1,28 +1,17 @@ -UserBuffer in os::mm::page_table - Rust - -
    pub struct UserBuffer {
    -    pub buffers: Vec<&'static mut [u8]>,
    -}
    Expand description

    Array of u8 slice that user communicate with os

    -

    Fields

    buffers: Vec<&'static mut [u8]>

    U8 vec

    -

    Implementations

    Create a UserBuffer by parameter

    -

    Length of UserBuffer

    -

    Trait Implementations

    The type of the elements being iterated over.

    -

    Which kind of iterator are we turning this into?

    -

    Creates an iterator from a value. Read more

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +UserBuffer in os::mm::page_table - Rust

    Struct os::mm::page_table::UserBuffer

    source ·
    pub struct UserBuffer {
    +    pub buffers: Vec<&'static mut [u8]>,
    +}
    Expand description

    Array of u8 slice that user communicate with os

    +

    Fields§

    §buffers: Vec<&'static mut [u8]>

    U8 vec

    +

    Implementations§

    source§

    impl UserBuffer

    source

    pub fn new(buffers: Vec<&'static mut [u8]>) -> Self

    Create a UserBuffer by parameter

    +
    source

    pub fn len(&self) -> usize

    Length of UserBuffer

    +

    Trait Implementations§

    source§

    impl IntoIterator for UserBuffer

    §

    type Item = *mut u8

    The type of the elements being iterated over.
    §

    type IntoIter = UserBufferIterator

    Which kind of iterator are we turning this into?
    source§

    fn into_iter(self) -> Self::IntoIter

    Creates an iterator from a value. Read more

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/mm/page_table/struct.UserBufferIterator.html b/ch6-dev/os/mm/page_table/struct.UserBufferIterator.html index 3518db5e..3435d370 100644 --- a/ch6-dev/os/mm/page_table/struct.UserBufferIterator.html +++ b/ch6-dev/os/mm/page_table/struct.UserBufferIterator.html @@ -1,139 +1,207 @@ -UserBufferIterator in os::mm::page_table - Rust - -
    pub struct UserBufferIterator {
    -    buffers: Vec<&'static mut [u8]>,
    +UserBufferIterator in os::mm::page_table - Rust
    pub struct UserBufferIterator {
    +    buffers: Vec<&'static mut [u8]>,
         current_buffer: usize,
         current_idx: usize,
    -}
    Expand description

    Iterator of UserBuffer

    -

    Fields

    buffers: Vec<&'static mut [u8]>current_buffer: usizecurrent_idx: usize

    Trait Implementations

    The type of the elements being iterated over.

    -

    Advances the iterator and returns the next value. Read more

    -

    Returns the bounds on the remaining length of the iterator. Read more

    -

    Consumes the iterator, counting the number of iterations and returning it. Read more

    -

    Consumes the iterator, returning the last element. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_advance_by)

    Advances the iterator by n elements. Read more

    -

    Returns the nth element of the iterator. Read more

    -

    Creates an iterator starting at the same point, but stepping by -the given amount at each iteration. Read more

    -

    Takes two iterators and creates a new iterator over both in sequence. Read more

    -

    ‘Zips up’ two iterators into a single iterator of pairs. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_intersperse)

    Creates a new iterator which places a copy of separator between adjacent -items of the original iterator. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_intersperse)

    Creates a new iterator which places an item generated by separator -between adjacent items of the original iterator. Read more

    -

    Takes a closure and creates an iterator which calls that closure on each -element. Read more

    -

    Calls a closure on each element of an iterator. Read more

    -

    Creates an iterator which uses a closure to determine if an element -should be yielded. Read more

    -

    Creates an iterator that both filters and maps. Read more

    -

    Creates an iterator which gives the current iteration count as well as -the next value. Read more

    -

    Creates an iterator which can use the peek and peek_mut methods +}

    Expand description

    Iterator of UserBuffer

    +

    Fields§

    §buffers: Vec<&'static mut [u8]>§current_buffer: usize§current_idx: usize

    Trait Implementations§

    source§

    impl Iterator for UserBufferIterator

    §

    type Item = *mut u8

    The type of the elements being iterated over.
    source§

    fn next(&mut self) -> Option<Self::Item>

    Advances the iterator and returns the next value. Read more
    source§

    fn next_chunk<const N: usize>( + &mut self +) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where + Self: Sized,

    🔬This is a nightly-only experimental API. (iter_next_chunk)
    Advances the iterator and returns an array containing the next N values. Read more
    1.0.0 · source§

    fn size_hint(&self) -> (usize, Option<usize>)

    Returns the bounds on the remaining length of the iterator. Read more
    1.0.0 · source§

    fn count(self) -> usizewhere + Self: Sized,

    Consumes the iterator, counting the number of iterations and returning it. Read more
    1.0.0 · source§

    fn last(self) -> Option<Self::Item>where + Self: Sized,

    Consumes the iterator, returning the last element. Read more
    source§

    fn advance_by(&mut self, n: usize) -> Result<(), NonZeroUsize>

    🔬This is a nightly-only experimental API. (iter_advance_by)
    Advances the iterator by n elements. Read more
    1.0.0 · source§

    fn nth(&mut self, n: usize) -> Option<Self::Item>

    Returns the nth element of the iterator. Read more
    1.28.0 · source§

    fn step_by(self, step: usize) -> StepBy<Self>where + Self: Sized,

    Creates an iterator starting at the same point, but stepping by +the given amount at each iteration. Read more
    1.0.0 · source§

    fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where + Self: Sized, + U: IntoIterator<Item = Self::Item>,

    Takes two iterators and creates a new iterator over both in sequence. Read more
    1.0.0 · source§

    fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where + Self: Sized, + U: IntoIterator,

    ‘Zips up’ two iterators into a single iterator of pairs. Read more
    source§

    fn intersperse(self, separator: Self::Item) -> Intersperse<Self>where + Self: Sized, + Self::Item: Clone,

    🔬This is a nightly-only experimental API. (iter_intersperse)
    Creates a new iterator which places a copy of separator between adjacent +items of the original iterator. Read more
    source§

    fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>where + Self: Sized, + G: FnMut() -> Self::Item,

    🔬This is a nightly-only experimental API. (iter_intersperse)
    Creates a new iterator which places an item generated by separator +between adjacent items of the original iterator. Read more
    1.0.0 · source§

    fn map<B, F>(self, f: F) -> Map<Self, F>where + Self: Sized, + F: FnMut(Self::Item) -> B,

    Takes a closure and creates an iterator which calls that closure on each +element. Read more
    1.21.0 · source§

    fn for_each<F>(self, f: F)where + Self: Sized, + F: FnMut(Self::Item),

    Calls a closure on each element of an iterator. Read more
    1.0.0 · source§

    fn filter<P>(self, predicate: P) -> Filter<Self, P>where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

    Creates an iterator which uses a closure to determine if an element +should be yielded. Read more
    1.0.0 · source§

    fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>where + Self: Sized, + F: FnMut(Self::Item) -> Option<B>,

    Creates an iterator that both filters and maps. Read more
    1.0.0 · source§

    fn enumerate(self) -> Enumerate<Self>where + Self: Sized,

    Creates an iterator which gives the current iteration count as well as +the next value. Read more
    1.0.0 · source§

    fn peekable(self) -> Peekable<Self>where + Self: Sized,

    Creates an iterator which can use the peek and peek_mut methods to look at the next element of the iterator without consuming it. See -their documentation for more information. Read more

    -

    Creates an iterator that skips elements based on a predicate. Read more

    -

    Creates an iterator that yields elements based on a predicate. Read more

    -

    Creates an iterator that both yields elements based on a predicate and maps. Read more

    -

    Creates an iterator that skips the first n elements. Read more

    -

    Creates an iterator that yields the first n elements, or fewer -if the underlying iterator ends sooner. Read more

    -

    An iterator adapter similar to fold that holds internal state and -produces a new iterator. Read more

    -

    Creates an iterator that works like map, but flattens nested structure. Read more

    -

    Creates an iterator that flattens nested structure. Read more

    -

    Creates an iterator which ends after the first None. Read more

    -

    Does something with each element of an iterator, passing the value on. Read more

    -

    Borrows an iterator, rather than consuming it. Read more

    -

    Transforms an iterator into a collection. Read more

    -
    🔬 This is a nightly-only experimental API. (iterator_try_collect)

    Fallibly transforms an iterator into a collection, short circuiting if -a failure is encountered. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_collect_into)

    Collects all the items from an iterator into a collection. Read more

    -

    Consumes an iterator, creating two collections from it. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_partition_in_place)

    Reorders the elements of this iterator in-place according to the given predicate, -such that all those that return true precede all those that return false. -Returns the number of true elements found. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_is_partitioned)

    Checks if the elements of this iterator are partitioned according to the given predicate, -such that all those that return true precede all those that return false. Read more

    -

    An iterator method that applies a function as long as it returns -successfully, producing a single, final value. Read more

    -

    An iterator method that applies a fallible function to each item in the -iterator, stopping at the first error and returning that error. Read more

    -

    Folds every element into an accumulator by applying an operation, -returning the final result. Read more

    -

    Reduces the elements to a single one, by repeatedly applying a reducing -operation. Read more

    -
    🔬 This is a nightly-only experimental API. (iterator_try_reduce)

    Reduces the elements to a single one by repeatedly applying a reducing operation. If the -closure returns a failure, the failure is propagated back to the caller immediately. Read more

    -

    Tests if every element of the iterator matches a predicate. Read more

    -

    Tests if any element of the iterator matches a predicate. Read more

    -

    Searches for an element of an iterator that satisfies a predicate. Read more

    -

    Applies function to the elements of iterator and returns -the first non-none result. Read more

    -
    🔬 This is a nightly-only experimental API. (try_find)

    Applies function to the elements of iterator and returns -the first true result or the first error. Read more

    -

    Searches for an element in an iterator, returning its index. Read more

    -

    Searches for an element in an iterator from the right, returning its -index. Read more

    -

    Returns the maximum element of an iterator. Read more

    -

    Returns the minimum element of an iterator. Read more

    -

    Returns the element that gives the maximum value from the -specified function. Read more

    -

    Returns the element that gives the maximum value with respect to the -specified comparison function. Read more

    -

    Returns the element that gives the minimum value from the -specified function. Read more

    -

    Returns the element that gives the minimum value with respect to the -specified comparison function. Read more

    -

    Reverses an iterator’s direction. Read more

    -

    Converts an iterator of pairs into a pair of containers. Read more

    -

    Creates an iterator which copies all of its elements. Read more

    -

    Creates an iterator which clones all of its elements. Read more

    -

    Repeats an iterator endlessly. Read more

    -

    Sums the elements of an iterator. Read more

    -

    Iterates over the entire iterator, multiplying all the elements Read more

    -

    Lexicographically compares the elements of this Iterator with those -of another. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_order_by)

    Lexicographically compares the elements of this Iterator with those -of another with respect to the specified comparison function. Read more

    -

    Lexicographically compares the elements of this Iterator with those -of another. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_order_by)

    Lexicographically compares the elements of this Iterator with those -of another with respect to the specified comparison function. Read more

    -

    Determines if the elements of this Iterator are equal to those of -another. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_order_by)

    Determines if the elements of this Iterator are equal to those of -another with respect to the specified equality function. Read more

    -

    Determines if the elements of this Iterator are unequal to those of -another. Read more

    -

    Determines if the elements of this Iterator are lexicographically -less than those of another. Read more

    -

    Determines if the elements of this Iterator are lexicographically -less or equal to those of another. Read more

    -

    Determines if the elements of this Iterator are lexicographically -greater than those of another. Read more

    -

    Determines if the elements of this Iterator are lexicographically -greater than or equal to those of another. Read more

    -
    🔬 This is a nightly-only experimental API. (is_sorted)

    Checks if the elements of this iterator are sorted. Read more

    -
    🔬 This is a nightly-only experimental API. (is_sorted)

    Checks if the elements of this iterator are sorted using the given comparator function. Read more

    -
    🔬 This is a nightly-only experimental API. (is_sorted)

    Checks if the elements of this iterator are sorted using the given key extraction -function. Read more

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +their documentation for more information. Read more
    1.0.0 · source§

    fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

    Creates an iterator that skips elements based on a predicate. Read more
    1.0.0 · source§

    fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

    Creates an iterator that yields elements based on a predicate. Read more
    1.57.0 · source§

    fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where + Self: Sized, + P: FnMut(Self::Item) -> Option<B>,

    Creates an iterator that both yields elements based on a predicate and maps. Read more
    1.0.0 · source§

    fn skip(self, n: usize) -> Skip<Self>where + Self: Sized,

    Creates an iterator that skips the first n elements. Read more
    1.0.0 · source§

    fn take(self, n: usize) -> Take<Self>where + Self: Sized,

    Creates an iterator that yields the first n elements, or fewer +if the underlying iterator ends sooner. Read more
    1.0.0 · source§

    fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>where + Self: Sized, + F: FnMut(&mut St, Self::Item) -> Option<B>,

    An iterator adapter which, like fold, holds internal state, but +unlike fold, produces a new iterator. Read more
    1.0.0 · source§

    fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where + Self: Sized, + U: IntoIterator, + F: FnMut(Self::Item) -> U,

    Creates an iterator that works like map, but flattens nested structure. Read more
    source§

    fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>where + Self: Sized, + F: FnMut(&[Self::Item; N]) -> R,

    🔬This is a nightly-only experimental API. (iter_map_windows)
    Calls the given function f for each contiguous window of size N over +self and returns an iterator over the outputs of f. Like slice::windows(), +the windows during mapping overlap as well. Read more
    1.0.0 · source§

    fn fuse(self) -> Fuse<Self>where + Self: Sized,

    Creates an iterator which ends after the first None. Read more
    1.0.0 · source§

    fn inspect<F>(self, f: F) -> Inspect<Self, F>where + Self: Sized, + F: FnMut(&Self::Item),

    Does something with each element of an iterator, passing the value on. Read more
    1.0.0 · source§

    fn by_ref(&mut self) -> &mut Selfwhere + Self: Sized,

    Borrows an iterator, rather than consuming it. Read more
    1.0.0 · source§

    fn collect<B>(self) -> Bwhere + B: FromIterator<Self::Item>, + Self: Sized,

    Transforms an iterator into a collection. Read more
    source§

    fn collect_into<E>(self, collection: &mut E) -> &mut Ewhere + E: Extend<Self::Item>, + Self: Sized,

    🔬This is a nightly-only experimental API. (iter_collect_into)
    Collects all the items from an iterator into a collection. Read more
    1.0.0 · source§

    fn partition<B, F>(self, f: F) -> (B, B)where + Self: Sized, + B: Default + Extend<Self::Item>, + F: FnMut(&Self::Item) -> bool,

    Consumes an iterator, creating two collections from it. Read more
    source§

    fn is_partitioned<P>(self, predicate: P) -> boolwhere + Self: Sized, + P: FnMut(Self::Item) -> bool,

    🔬This is a nightly-only experimental API. (iter_is_partitioned)
    Checks if the elements of this iterator are partitioned according to the given predicate, +such that all those that return true precede all those that return false. Read more
    1.27.0 · source§

    fn try_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere + Self: Sized, + F: FnMut(B, Self::Item) -> R, + R: Try<Output = B>,

    An iterator method that applies a function as long as it returns +successfully, producing a single, final value. Read more
    1.27.0 · source§

    fn try_for_each<F, R>(&mut self, f: F) -> Rwhere + Self: Sized, + F: FnMut(Self::Item) -> R, + R: Try<Output = ()>,

    An iterator method that applies a fallible function to each item in the +iterator, stopping at the first error and returning that error. Read more
    1.0.0 · source§

    fn fold<B, F>(self, init: B, f: F) -> Bwhere + Self: Sized, + F: FnMut(B, Self::Item) -> B,

    Folds every element into an accumulator by applying an operation, +returning the final result. Read more
    1.51.0 · source§

    fn reduce<F>(self, f: F) -> Option<Self::Item>where + Self: Sized, + F: FnMut(Self::Item, Self::Item) -> Self::Item,

    Reduces the elements to a single one, by repeatedly applying a reducing +operation. Read more
    source§

    fn try_reduce<F, R>( + &mut self, + f: F +) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere + Self: Sized, + F: FnMut(Self::Item, Self::Item) -> R, + R: Try<Output = Self::Item>, + <R as Try>::Residual: Residual<Option<Self::Item>>,

    🔬This is a nightly-only experimental API. (iterator_try_reduce)
    Reduces the elements to a single one by repeatedly applying a reducing operation. If the +closure returns a failure, the failure is propagated back to the caller immediately. Read more
    1.0.0 · source§

    fn all<F>(&mut self, f: F) -> boolwhere + Self: Sized, + F: FnMut(Self::Item) -> bool,

    Tests if every element of the iterator matches a predicate. Read more
    1.0.0 · source§

    fn any<F>(&mut self, f: F) -> boolwhere + Self: Sized, + F: FnMut(Self::Item) -> bool,

    Tests if any element of the iterator matches a predicate. Read more
    1.0.0 · source§

    fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

    Searches for an element of an iterator that satisfies a predicate. Read more
    1.30.0 · source§

    fn find_map<B, F>(&mut self, f: F) -> Option<B>where + Self: Sized, + F: FnMut(Self::Item) -> Option<B>,

    Applies function to the elements of iterator and returns +the first non-none result. Read more
    source§

    fn try_find<F, R>( + &mut self, + f: F +) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere + Self: Sized, + F: FnMut(&Self::Item) -> R, + R: Try<Output = bool>, + <R as Try>::Residual: Residual<Option<Self::Item>>,

    🔬This is a nightly-only experimental API. (try_find)
    Applies function to the elements of iterator and returns +the first true result or the first error. Read more
    1.0.0 · source§

    fn position<P>(&mut self, predicate: P) -> Option<usize>where + Self: Sized, + P: FnMut(Self::Item) -> bool,

    Searches for an element in an iterator, returning its index. Read more
    1.0.0 · source§

    fn max(self) -> Option<Self::Item>where + Self: Sized, + Self::Item: Ord,

    Returns the maximum element of an iterator. Read more
    1.0.0 · source§

    fn min(self) -> Option<Self::Item>where + Self: Sized, + Self::Item: Ord,

    Returns the minimum element of an iterator. Read more
    1.6.0 · source§

    fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>where + B: Ord, + Self: Sized, + F: FnMut(&Self::Item) -> B,

    Returns the element that gives the maximum value from the +specified function. Read more
    1.15.0 · source§

    fn max_by<F>(self, compare: F) -> Option<Self::Item>where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

    Returns the element that gives the maximum value with respect to the +specified comparison function. Read more
    1.6.0 · source§

    fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>where + B: Ord, + Self: Sized, + F: FnMut(&Self::Item) -> B,

    Returns the element that gives the minimum value from the +specified function. Read more
    1.15.0 · source§

    fn min_by<F>(self, compare: F) -> Option<Self::Item>where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

    Returns the element that gives the minimum value with respect to the +specified comparison function. Read more
    1.0.0 · source§

    fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where + FromA: Default + Extend<A>, + FromB: Default + Extend<B>, + Self: Sized + Iterator<Item = (A, B)>,

    Converts an iterator of pairs into a pair of containers. Read more
    1.36.0 · source§

    fn copied<'a, T>(self) -> Copied<Self>where + T: 'a + Copy, + Self: Sized + Iterator<Item = &'a T>,

    Creates an iterator which copies all of its elements. Read more
    1.0.0 · source§

    fn cloned<'a, T>(self) -> Cloned<Self>where + T: 'a + Clone, + Self: Sized + Iterator<Item = &'a T>,

    Creates an iterator which clones all of its elements. Read more
    source§

    fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where + Self: Sized,

    🔬This is a nightly-only experimental API. (iter_array_chunks)
    Returns an iterator over N elements of the iterator at a time. Read more
    1.11.0 · source§

    fn sum<S>(self) -> Swhere + Self: Sized, + S: Sum<Self::Item>,

    Sums the elements of an iterator. Read more
    1.11.0 · source§

    fn product<P>(self) -> Pwhere + Self: Sized, + P: Product<Self::Item>,

    Iterates over the entire iterator, multiplying all the elements Read more
    1.5.0 · source§

    fn cmp<I>(self, other: I) -> Orderingwhere + I: IntoIterator<Item = Self::Item>, + Self::Item: Ord, + Self: Sized,

    Lexicographically compares the elements of this Iterator with those +of another. Read more
    source§

    fn cmp_by<I, F>(self, other: I, cmp: F) -> Orderingwhere + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,

    🔬This is a nightly-only experimental API. (iter_order_by)
    Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
    1.5.0 · source§

    fn partial_cmp<I>(self, other: I) -> Option<Ordering>where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

    Lexicographically compares the PartialOrd elements of +this Iterator with those of another. The comparison works like short-circuit +evaluation, returning a result without comparing the remaining elements. +As soon as an order can be determined, the evaluation stops and a result is returned. Read more
    source§

    fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,

    🔬This is a nightly-only experimental API. (iter_order_by)
    Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
    1.5.0 · source§

    fn eq<I>(self, other: I) -> boolwhere + I: IntoIterator, + Self::Item: PartialEq<<I as IntoIterator>::Item>, + Self: Sized,

    Determines if the elements of this Iterator are equal to those of +another. Read more
    source§

    fn eq_by<I, F>(self, other: I, eq: F) -> boolwhere + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,

    🔬This is a nightly-only experimental API. (iter_order_by)
    Determines if the elements of this Iterator are equal to those of +another with respect to the specified equality function. Read more
    1.5.0 · source§

    fn ne<I>(self, other: I) -> boolwhere + I: IntoIterator, + Self::Item: PartialEq<<I as IntoIterator>::Item>, + Self: Sized,

    Determines if the elements of this Iterator are not equal to those of +another. Read more
    1.5.0 · source§

    fn lt<I>(self, other: I) -> boolwhere + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

    Determines if the elements of this Iterator are lexicographically +less than those of another. Read more
    1.5.0 · source§

    fn le<I>(self, other: I) -> boolwhere + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

    Determines if the elements of this Iterator are lexicographically +less or equal to those of another. Read more
    1.5.0 · source§

    fn gt<I>(self, other: I) -> boolwhere + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

    Determines if the elements of this Iterator are lexicographically +greater than those of another. Read more
    1.5.0 · source§

    fn ge<I>(self, other: I) -> boolwhere + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

    Determines if the elements of this Iterator are lexicographically +greater than or equal to those of another. Read more
    source§

    fn is_sorted(self) -> boolwhere + Self: Sized, + Self::Item: PartialOrd<Self::Item>,

    🔬This is a nightly-only experimental API. (is_sorted)
    Checks if the elements of this iterator are sorted. Read more
    source§

    fn is_sorted_by<F>(self, compare: F) -> boolwhere + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Option<Ordering>,

    🔬This is a nightly-only experimental API. (is_sorted)
    Checks if the elements of this iterator are sorted using the given comparator function. Read more
    source§

    fn is_sorted_by_key<F, K>(self, f: F) -> boolwhere + Self: Sized, + F: FnMut(Self::Item) -> K, + K: PartialOrd<K>,

    🔬This is a nightly-only experimental API. (is_sorted)
    Checks if the elements of this iterator are sorted using the given key extraction +function. Read more

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type of the elements being iterated over.

    -

    Which kind of iterator are we turning this into?

    -

    Creates an iterator from a value. Read more

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<I> IntoIterator for Iwhere + I: Iterator,

    §

    type Item = <I as Iterator>::Item

    The type of the elements being iterated over.
    §

    type IntoIter = I

    Which kind of iterator are we turning this into?
    const: unstable · source§

    fn into_iter(self) -> I

    Creates an iterator from a value. Read more
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/mm/sidebar-items.js b/ch6-dev/os/mm/sidebar-items.js index 78a50caa..0d2091b9 100644 --- a/ch6-dev/os/mm/sidebar-items.js +++ b/ch6-dev/os/mm/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"fn":[["frame_alloc","allocate a frame"],["frame_dealloc","deallocate a frame"],["init","initiate heap allocator, frame allocator and kernel space"],["kernel_token","Get kernelspace root ppn"],["remap_test","Check PageTable running correctly"],["translated_byte_buffer","Translate a pointer to a mutable u8 Vec through page table"],["translated_ref","Translate a generic through page table and return a reference"],["translated_refmut","Translate a generic through page table and return a mutable reference"],["translated_str","Translate a pointer to a mutable u8 Vec end with `\\0` through page table to a `String`"]],"mod":[["address","Implementation of physical and virtual address and page number."],["frame_allocator","Implementation of [`FrameAllocator`] which controls all the frames in the operating system."],["heap_allocator","The global allocator"],["memory_set","Implementation of [`MapArea`] and [`MemorySet`]."],["page_table","Implementation of [`PageTableEntry`] and [`PageTable`]."]],"struct":[["FrameTracker","manage a frame which has the same lifecycle as the tracker"],["KERNEL_SPACE","a memory set instance through lazy_static! managing kernel space"],["MapPermission","map permission corresponding to that in pte: `R W X U`"],["MemorySet","memory set structure, controls virtual-memory space"],["PageTable","Record root ppn and has the same lifetime as 1 and 2 level `PageTableEntry`"],["PageTableEntry","page table entry structure"],["PhysAddr","Definitions"],["PhysPageNum","phiscal page number"],["UserBuffer","Array of u8 slice that user communicate with os"],["UserBufferIterator","Iterator of `UserBuffer`"],["VirtAddr","virtual address"],["VirtPageNum","virtual page number"]],"trait":[["StepByOne","Add value by one"]]}); \ No newline at end of file +window.SIDEBAR_ITEMS = {"fn":["frame_alloc","frame_dealloc","init","kernel_token","remap_test","translated_byte_buffer","translated_ref","translated_refmut","translated_str"],"mod":["address","frame_allocator","heap_allocator","memory_set","page_table"],"struct":["FrameTracker","KERNEL_SPACE","MapPermission","MemorySet","PageTable","PageTableEntry","PhysAddr","PhysPageNum","UserBuffer","UserBufferIterator","VirtAddr","VirtPageNum"],"trait":["StepByOne"]}; \ No newline at end of file diff --git a/ch6-dev/os/mm/struct.FrameTracker.html b/ch6-dev/os/mm/struct.FrameTracker.html index cb4f6398..14b40bfc 100644 --- a/ch6-dev/os/mm/struct.FrameTracker.html +++ b/ch6-dev/os/mm/struct.FrameTracker.html @@ -1,25 +1,15 @@ -FrameTracker in os::mm - Rust - -
    -

    Struct os::mm::FrameTracker

    source · []
    pub struct FrameTracker {
    +FrameTracker in os::mm - Rust

    Struct os::mm::FrameTracker

    source ·
    pub struct FrameTracker {
         pub ppn: PhysPageNum,
    -}
    Expand description

    manage a frame which has the same lifecycle as the tracker

    -

    Fields

    ppn: PhysPageNum

    Implementations

    Create an empty FrameTracker

    -

    Trait Implementations

    Formats the value using the given formatter. Read more

    -

    Executes the destructor for this type. Read more

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +}
    Expand description

    manage a frame which has the same lifecycle as the tracker

    +

    Fields§

    §ppn: PhysPageNum

    Implementations§

    source§

    impl FrameTracker

    source

    pub fn new(ppn: PhysPageNum) -> Self

    Create an empty FrameTracker

    +

    Trait Implementations§

    source§

    impl Debug for FrameTracker

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    source§

    impl Drop for FrameTracker

    source§

    fn drop(&mut self)

    Executes the destructor for this type. Read more

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/mm/struct.KERNEL_SPACE.html b/ch6-dev/os/mm/struct.KERNEL_SPACE.html index a9a9ae4f..a3cc6b59 100644 --- a/ch6-dev/os/mm/struct.KERNEL_SPACE.html +++ b/ch6-dev/os/mm/struct.KERNEL_SPACE.html @@ -1,24 +1,14 @@ -KERNEL_SPACE in os::mm - Rust - -
    -

    Struct os::mm::KERNEL_SPACE

    source · []
    pub struct KERNEL_SPACE {
    +KERNEL_SPACE in os::mm - Rust

    Struct os::mm::KERNEL_SPACE

    source ·
    pub struct KERNEL_SPACE {
         __private_field: (),
    -}
    Expand description

    a memory set instance through lazy_static! managing kernel space

    -

    Fields

    __private_field: ()

    Trait Implementations

    The resulting type after dereferencing.

    -

    Dereferences the value.

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +}
    Expand description

    a memory set instance through lazy_static! managing kernel space

    +

    Fields§

    §__private_field: ()

    Trait Implementations§

    source§

    impl Deref for KERNEL_SPACE

    §

    type Target = Arc<UPSafeCell<MemorySet>, Global>

    The resulting type after dereferencing.
    source§

    fn deref(&self) -> &Arc<UPSafeCell<MemorySet>>

    Dereferences the value.
    source§

    impl LazyStatic for KERNEL_SPACE

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/mm/struct.MapPermission.html b/ch6-dev/os/mm/struct.MapPermission.html index b8f99029..14037eae 100644 --- a/ch6-dev/os/mm/struct.MapPermission.html +++ b/ch6-dev/os/mm/struct.MapPermission.html @@ -1,24 +1,18 @@ -MapPermission in os::mm - Rust - -
    pub struct MapPermission {
    +MapPermission in os::mm - Rust

    Struct os::mm::MapPermission

    source ·
    pub struct MapPermission {
         bits: u8,
    -}
    Expand description

    map permission corresponding to that in pte: R W X U

    -

    Fields

    bits: u8

    Implementations

    Readable

    -

    Writable

    -

    Excutable

    -

    Accessible in U mode

    -

    Returns an empty set of flags.

    -

    Returns the set containing all flags.

    -

    Returns the raw value of the flags currently stored.

    -

    Convert from underlying bit representation, unless that +}

    Expand description

    map permission corresponding to that in pte: R W X U

    +

    Fields§

    §bits: u8

    Implementations§

    source§

    impl MapPermission

    source

    pub const R: Self = _

    Readable

    +
    source

    pub const W: Self = _

    Writable

    +
    source

    pub const X: Self = _

    Excutable

    +
    source

    pub const U: Self = _

    Accessible in U mode

    +
    source

    pub const fn empty() -> Self

    Returns an empty set of flags.

    +
    source

    pub const fn all() -> Self

    Returns the set containing all flags.

    +
    source

    pub const fn bits(&self) -> u8

    Returns the raw value of the flags currently stored.

    +
    source

    pub const fn from_bits(bits: u8) -> Option<Self>

    Convert from underlying bit representation, unless that representation contains bits that do not correspond to a flag.

    -

    Convert from underlying bit representation, dropping any bits +

    source

    pub const fn from_bits_truncate(bits: u8) -> Self

    Convert from underlying bit representation, dropping any bits that do not correspond to flags.

    -

    Convert from underlying bit representation, preserving all +

    source

    pub const unsafe fn from_bits_unchecked(bits: u8) -> Self

    Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).

    Safety

    The caller of the bitflags! macro can chose to allow or @@ -26,35 +20,35 @@ disallow extra bits for their bitflags type.

    The caller of from_bits_unchecked() has to ensure that all bits correspond to a defined flag or that extra bits are valid for this bitflags type.

    -

    Returns true if no flags are currently stored.

    -

    Returns true if all flags are currently set.

    -

    Returns true if there are flags common to both self and other.

    -

    Returns true if all of the flags in other are contained within self.

    -

    Inserts the specified flags in-place.

    -

    Removes the specified flags in-place.

    -

    Toggles the specified flags in-place.

    -

    Inserts or removes the specified flags depending on the passed value.

    -

    Returns the intersection between the flags in self and +

    source

    pub const fn is_empty(&self) -> bool

    Returns true if no flags are currently stored.

    +
    source

    pub const fn is_all(&self) -> bool

    Returns true if all flags are currently set.

    +
    source

    pub const fn intersects(&self, other: Self) -> bool

    Returns true if there are flags common to both self and other.

    +
    source

    pub const fn contains(&self, other: Self) -> bool

    Returns true if all of the flags in other are contained within self.

    +
    source

    pub fn insert(&mut self, other: Self)

    Inserts the specified flags in-place.

    +
    source

    pub fn remove(&mut self, other: Self)

    Removes the specified flags in-place.

    +
    source

    pub fn toggle(&mut self, other: Self)

    Toggles the specified flags in-place.

    +
    source

    pub fn set(&mut self, other: Self, value: bool)

    Inserts or removes the specified flags depending on the passed value.

    +
    source

    pub const fn intersection(self, other: Self) -> Self

    Returns the intersection between the flags in self and other.

    Specifically, the returned set contains only the flags which are present in both self and other.

    This is equivalent to using the & operator (e.g. ops::BitAnd), as in flags & other.

    -

    Returns the union of between the flags in self and other.

    +
    source

    pub const fn union(self, other: Self) -> Self

    Returns the union of between the flags in self and other.

    Specifically, the returned set contains all flags which are present in either self or other, including any which are -present in both (see Self::symmetric_difference if that +present in both (see Self::symmetric_difference if that is undesirable).

    This is equivalent to using the | operator (e.g. ops::BitOr), as in flags | other.

    -

    Returns the difference between the flags in self and other.

    +
    source

    pub const fn difference(self, other: Self) -> Self

    Returns the difference between the flags in self and other.

    Specifically, the returned set contains all flags present in self, except for the ones present in other.

    It is also conceptually equivalent to the “bit-clear” operation: flags & !other (and this syntax is also supported).

    This is equivalent to using the - operator (e.g. ops::Sub), as in flags - other.

    -

    Returns the symmetric difference between the flags +

    source

    pub const fn symmetric_difference(self, other: Self) -> Self

    Returns the symmetric difference between the flags in self and other.

    Specifically, the returned set contains the flags present which are present in self or other, but that are not present in @@ -62,67 +56,40 @@ both. Equivalently, it contains the flags present in exactly one of the sets self and other.

    This is equivalent to using the ^ operator (e.g. ops::BitXor), as in flags ^ other.

    -

    Returns the complement of this set of flags.

    +
    source

    pub const fn complement(self) -> Self

    Returns the complement of this set of flags.

    Specifically, the returned set contains all the flags which are not set in self, but which are allowed for this type.

    Alternatively, it can be thought of as the set difference -between Self::all() and self (e.g. Self::all() - self)

    +between Self::all() and self (e.g. Self::all() - self)

    This is equivalent to using the ! operator (e.g. ops::Not), as in !flags.

    -

    Trait Implementations

    Formats the value using the given formatter.

    -

    Returns the intersection between the two sets of flags.

    -

    The resulting type after applying the & operator.

    -

    Disables all flags disabled in the set.

    -

    Returns the union of the two sets of flags.

    -

    The resulting type after applying the | operator.

    -

    Adds the set of flags.

    -

    Returns the left flags, but with all the right flags toggled.

    -

    The resulting type after applying the ^ operator.

    -

    Toggles the set of flags.

    -

    Returns a copy of the value. Read more

    -

    Performs copy-assignment from source. Read more

    -

    Formats the value using the given formatter. Read more

    -

    Extends a collection with the contents of an iterator. Read more

    -
    🔬 This is a nightly-only experimental API. (extend_one)

    Extends a collection with exactly one element.

    -
    🔬 This is a nightly-only experimental API. (extend_one)

    Reserves capacity in a collection for the given number of additional elements. Read more

    -

    Creates a value from an iterator. Read more

    -

    Feeds this value into the given Hasher. Read more

    -

    Feeds a slice of this type into the given Hasher. Read more

    -

    Formats the value using the given formatter.

    -

    Returns the complement of this set of flags.

    -

    The resulting type after applying the ! operator.

    -

    Formats the value using the given formatter.

    -

    This method returns an Ordering between self and other. Read more

    -

    Compares and returns the maximum of two values. Read more

    -

    Compares and returns the minimum of two values. Read more

    -

    Restrict a value to a certain interval. Read more

    -

    This method tests for self and other values to be equal, and is used -by ==. Read more

    -

    This method tests for !=.

    -

    This method returns an ordering between self and other values if one exists. Read more

    -

    This method tests less than (for self and other) and is used by the < operator. Read more

    -

    This method tests less than or equal to (for self and other) and is used by the <= -operator. Read more

    -

    This method tests greater than (for self and other) and is used by the > operator. Read more

    -

    This method tests greater than or equal to (for self and other) and is used by the >= -operator. Read more

    -

    Returns the set difference of the two sets of flags.

    -

    The resulting type after applying the - operator.

    -

    Disables all flags enabled in the set.

    -

    Formats the value using the given formatter.

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +

    Trait Implementations§

    source§

    impl Binary for MapPermission

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter.
    source§

    impl BitAnd<MapPermission> for MapPermission

    source§

    fn bitand(self, other: Self) -> Self

    Returns the intersection between the two sets of flags.

    +
    §

    type Output = MapPermission

    The resulting type after applying the & operator.
    source§

    impl BitAndAssign<MapPermission> for MapPermission

    source§

    fn bitand_assign(&mut self, other: Self)

    Disables all flags disabled in the set.

    +
    source§

    impl BitOr<MapPermission> for MapPermission

    source§

    fn bitor(self, other: MapPermission) -> Self

    Returns the union of the two sets of flags.

    +
    §

    type Output = MapPermission

    The resulting type after applying the | operator.
    source§

    impl BitOrAssign<MapPermission> for MapPermission

    source§

    fn bitor_assign(&mut self, other: Self)

    Adds the set of flags.

    +
    source§

    impl BitXor<MapPermission> for MapPermission

    source§

    fn bitxor(self, other: Self) -> Self

    Returns the left flags, but with all the right flags toggled.

    +
    §

    type Output = MapPermission

    The resulting type after applying the ^ operator.
    source§

    impl BitXorAssign<MapPermission> for MapPermission

    source§

    fn bitxor_assign(&mut self, other: Self)

    Toggles the set of flags.

    +
    source§

    impl Clone for MapPermission

    source§

    fn clone(&self) -> MapPermission

    Returns a copy of the value. Read more
    1.0.0 · source§

    fn clone_from(&mut self, source: &Self)

    Performs copy-assignment from source. Read more
    source§

    impl Debug for MapPermission

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    source§

    impl Extend<MapPermission> for MapPermission

    source§

    fn extend<T: IntoIterator<Item = Self>>(&mut self, iterator: T)

    Extends a collection with the contents of an iterator. Read more
    source§

    fn extend_one(&mut self, item: A)

    🔬This is a nightly-only experimental API. (extend_one)
    Extends a collection with exactly one element.
    source§

    fn extend_reserve(&mut self, additional: usize)

    🔬This is a nightly-only experimental API. (extend_one)
    Reserves capacity in a collection for the given number of additional elements. Read more
    source§

    impl FromIterator<MapPermission> for MapPermission

    source§

    fn from_iter<T: IntoIterator<Item = Self>>(iterator: T) -> Self

    Creates a value from an iterator. Read more
    source§

    impl Hash for MapPermission

    source§

    fn hash<__H: Hasher>(&self, state: &mut __H)

    Feeds this value into the given Hasher. Read more
    1.3.0 · source§

    fn hash_slice<H>(data: &[Self], state: &mut H)where + H: Hasher, + Self: Sized,

    Feeds a slice of this type into the given Hasher. Read more
    source§

    impl LowerHex for MapPermission

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter.
    source§

    impl Not for MapPermission

    source§

    fn not(self) -> Self

    Returns the complement of this set of flags.

    +
    §

    type Output = MapPermission

    The resulting type after applying the ! operator.
    source§

    impl Octal for MapPermission

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter.
    source§

    impl Ord for MapPermission

    source§

    fn cmp(&self, other: &MapPermission) -> Ordering

    This method returns an Ordering between self and other. Read more
    1.21.0 · source§

    fn max(self, other: Self) -> Selfwhere + Self: Sized,

    Compares and returns the maximum of two values. Read more
    1.21.0 · source§

    fn min(self, other: Self) -> Selfwhere + Self: Sized,

    Compares and returns the minimum of two values. Read more
    1.50.0 · source§

    fn clamp(self, min: Self, max: Self) -> Selfwhere + Self: Sized + PartialOrd<Self>,

    Restrict a value to a certain interval. Read more
    source§

    impl PartialEq<MapPermission> for MapPermission

    source§

    fn eq(&self, other: &MapPermission) -> bool

    This method tests for self and other values to be equal, and is used +by ==.
    1.0.0 · source§

    fn ne(&self, other: &Rhs) -> bool

    This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
    source§

    impl PartialOrd<MapPermission> for MapPermission

    source§

    fn partial_cmp(&self, other: &MapPermission) -> Option<Ordering>

    This method returns an ordering between self and other values if one exists. Read more
    1.0.0 · source§

    fn lt(&self, other: &Rhs) -> bool

    This method tests less than (for self and other) and is used by the < operator. Read more
    1.0.0 · source§

    fn le(&self, other: &Rhs) -> bool

    This method tests less than or equal to (for self and other) and is used by the <= +operator. Read more
    1.0.0 · source§

    fn gt(&self, other: &Rhs) -> bool

    This method tests greater than (for self and other) and is used by the > operator. Read more
    1.0.0 · source§

    fn ge(&self, other: &Rhs) -> bool

    This method tests greater than or equal to (for self and other) and is used by the >= +operator. Read more
    source§

    impl Sub<MapPermission> for MapPermission

    source§

    fn sub(self, other: Self) -> Self

    Returns the set difference of the two sets of flags.

    +
    §

    type Output = MapPermission

    The resulting type after applying the - operator.
    source§

    impl SubAssign<MapPermission> for MapPermission

    source§

    fn sub_assign(&mut self, other: Self)

    Disables all flags enabled in the set.

    +
    source§

    impl UpperHex for MapPermission

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter.
    source§

    impl Copy for MapPermission

    source§

    impl Eq for MapPermission

    source§

    impl StructuralEq for MapPermission

    source§

    impl StructuralPartialEq for MapPermission

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The resulting type after obtaining ownership.

    -

    Creates owned data from borrowed data, usually by cloning. Read more

    -
    🔬 This is a nightly-only experimental API. (toowned_clone_into)

    Uses borrowed data to replace owned data, usually by cloning. Read more

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T> ToOwned for Twhere + T: Clone,

    §

    type Owned = T

    The resulting type after obtaining ownership.
    source§

    fn to_owned(&self) -> T

    Creates owned data from borrowed data, usually by cloning. Read more
    source§

    fn clone_into(&self, target: &mut T)

    Uses borrowed data to replace owned data, usually by cloning. Read more
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/mm/struct.MemorySet.html b/ch6-dev/os/mm/struct.MemorySet.html index ad77dd6c..ada9e9c8 100644 --- a/ch6-dev/os/mm/struct.MemorySet.html +++ b/ch6-dev/os/mm/struct.MemorySet.html @@ -1,35 +1,32 @@ -MemorySet in os::mm - Rust - -
    -

    Struct os::mm::MemorySet

    source · []
    pub struct MemorySet {
    +MemorySet in os::mm - Rust

    Struct os::mm::MemorySet

    source ·
    pub struct MemorySet {
         page_table: PageTable,
         areas: Vec<MapArea>,
    -}
    Expand description

    memory set structure, controls virtual-memory space

    -

    Fields

    page_table: PageTableareas: Vec<MapArea>

    Implementations

    Create an empty MemorySet

    -

    Get pagetable root_ppn

    -

    Assume that no conflicts.

    -

    Remove MapArea that starts with start_vpn

    -

    Mention that trampoline is not collected by areas.

    -

    Without kernel stacks.

    -

    Include sections in elf and trampoline and TrapContext and user stack, +}

    Expand description

    memory set structure, controls virtual-memory space

    +

    Fields§

    §page_table: PageTable§areas: Vec<MapArea>

    Implementations§

    source§

    impl MemorySet

    source

    pub fn new_bare() -> Self

    Create an empty MemorySet

    +
    source

    pub fn token(&self) -> usize

    Get pagetable root_ppn

    +
    source

    pub fn insert_framed_area( + &mut self, + start_va: VirtAddr, + end_va: VirtAddr, + permission: MapPermission +)

    Assume that no conflicts.

    +
    source

    pub fn remove_area_with_start_vpn(&mut self, start_vpn: VirtPageNum)

    Remove MapArea that starts with start_vpn

    +
    source

    fn push(&mut self, map_area: MapArea, data: Option<&[u8]>)

    source

    fn map_trampoline(&mut self)

    Mention that trampoline is not collected by areas.

    +
    source

    pub fn new_kernel() -> Self

    Without kernel stacks.

    +
    source

    pub fn from_elf(elf_data: &[u8]) -> (Self, usize, usize)

    Include sections in elf and trampoline and TrapContext and user stack, also returns user_sp and entry point.

    -

    Clone a same MemorySet

    -

    Refresh TLB with sfence.vma

    -

    Translate throuth pagetable

    -

    Remove all MapArea

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +
    source

    pub fn from_existed_user(user_space: &MemorySet) -> MemorySet

    Clone a same MemorySet

    +
    source

    pub fn activate(&self)

    Refresh TLB with sfence.vma

    +
    source

    pub fn translate(&self, vpn: VirtPageNum) -> Option<PageTableEntry>

    Translate throuth pagetable

    +
    source

    pub fn recycle_data_pages(&mut self)

    Remove all MapArea

    +

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/mm/struct.PageTable.html b/ch6-dev/os/mm/struct.PageTable.html index 2e8218a8..c83f17d1 100644 --- a/ch6-dev/os/mm/struct.PageTable.html +++ b/ch6-dev/os/mm/struct.PageTable.html @@ -1,33 +1,25 @@ -PageTable in os::mm - Rust - -
    -

    Struct os::mm::PageTable

    source · []
    pub struct PageTable {
    +PageTable in os::mm - Rust

    Struct os::mm::PageTable

    source ·
    pub struct PageTable {
         root_ppn: PhysPageNum,
         frames: Vec<FrameTracker>,
    -}
    Expand description

    Record root ppn and has the same lifetime as 1 and 2 level PageTableEntry

    -

    Fields

    root_ppn: PhysPageNumframes: Vec<FrameTracker>

    Implementations

    Assume that it won’t oom when creating/mapping.

    -

    Create an empty PageTable

    -

    Temporarily used to get arguments from user space.

    -

    Find phsical address by virtual address, create a frame if not exist

    -

    Find phsical address by virtual address

    -

    Create a mapping form vpn to ppn

    -

    Delete a mapping form vpn

    -

    Translate VirtPageNum to PageTableEntry

    -

    Translate VirtAddr to PhysAddr

    -

    Get root ppn

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +}
    Expand description

    Record root ppn and has the same lifetime as 1 and 2 level PageTableEntry

    +

    Fields§

    §root_ppn: PhysPageNum§frames: Vec<FrameTracker>

    Implementations§

    source§

    impl PageTable

    Assume that it won’t oom when creating/mapping.

    +
    source

    pub fn new() -> Self

    Create an empty PageTable

    +
    source

    pub fn from_token(satp: usize) -> Self

    Temporarily used to get arguments from user space.

    +
    source

    fn find_pte_create(&mut self, vpn: VirtPageNum) -> Option<&mut PageTableEntry>

    Find phsical address by virtual address, create a frame if not exist

    +
    source

    fn find_pte(&self, vpn: VirtPageNum) -> Option<&mut PageTableEntry>

    Find phsical address by virtual address

    +
    source

    pub fn map(&mut self, vpn: VirtPageNum, ppn: PhysPageNum, flags: PTEFlags)

    Create a mapping form vpn to ppn

    +
    source

    pub fn unmap(&mut self, vpn: VirtPageNum)

    Delete a mapping form vpn

    +
    source

    pub fn translate(&self, vpn: VirtPageNum) -> Option<PageTableEntry>

    Translate VirtPageNum to PageTableEntry

    +
    source

    pub fn translate_va(&self, va: VirtAddr) -> Option<PhysAddr>

    Translate VirtAddr to PhysAddr

    +
    source

    pub fn token(&self) -> usize

    Get root ppn

    +

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/mm/struct.PageTableEntry.html b/ch6-dev/os/mm/struct.PageTableEntry.html index ee0e2baf..57700eac 100644 --- a/ch6-dev/os/mm/struct.PageTableEntry.html +++ b/ch6-dev/os/mm/struct.PageTableEntry.html @@ -1,36 +1,24 @@ -PageTableEntry in os::mm - Rust - -
    #[repr(C)]
    pub struct PageTableEntry { +PageTableEntry in os::mm - Rust

    Struct os::mm::PageTableEntry

    source ·
    #[repr(C)]
    pub struct PageTableEntry { pub bits: usize, -}
    Expand description

    page table entry structure

    -

    Fields

    bits: usize

    PTE

    -

    Implementations

    Create a PTE from ppn

    -

    Return an empty PTE

    -

    Return 44bit ppn

    -

    Return 10bit flag

    -

    Check PTE valid

    -

    Check PTE readable

    -

    Check PTE writable

    -

    Check PTE executable

    -

    Trait Implementations

    Returns a copy of the value. Read more

    -

    Performs copy-assignment from source. Read more

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +}
    Expand description

    page table entry structure

    +

    Fields§

    §bits: usize

    PTE

    +

    Implementations§

    source§

    impl PageTableEntry

    source

    pub fn new(ppn: PhysPageNum, flags: PTEFlags) -> Self

    Create a PTE from ppn

    +
    source

    pub fn empty() -> Self

    Return an empty PTE

    +
    source

    pub fn ppn(&self) -> PhysPageNum

    Return 44bit ppn

    +
    source

    pub fn flags(&self) -> PTEFlags

    Return 10bit flag

    +
    source

    pub fn is_valid(&self) -> bool

    Check PTE valid

    +
    source

    pub fn readable(&self) -> bool

    Check PTE readable

    +
    source

    pub fn writable(&self) -> bool

    Check PTE writable

    +
    source

    pub fn executable(&self) -> bool

    Check PTE executable

    +

    Trait Implementations§

    source§

    impl Clone for PageTableEntry

    source§

    fn clone(&self) -> PageTableEntry

    Returns a copy of the value. Read more
    1.0.0 · source§

    fn clone_from(&mut self, source: &Self)

    Performs copy-assignment from source. Read more
    source§

    impl Copy for PageTableEntry

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The resulting type after obtaining ownership.

    -

    Creates owned data from borrowed data, usually by cloning. Read more

    -
    🔬 This is a nightly-only experimental API. (toowned_clone_into)

    Uses borrowed data to replace owned data, usually by cloning. Read more

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T> ToOwned for Twhere + T: Clone,

    §

    type Owned = T

    The resulting type after obtaining ownership.
    source§

    fn to_owned(&self) -> T

    Creates owned data from borrowed data, usually by cloning. Read more
    source§

    fn clone_into(&self, target: &mut T)

    Uses borrowed data to replace owned data, usually by cloning. Read more
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/mm/struct.PhysAddr.html b/ch6-dev/os/mm/struct.PhysAddr.html index 02e775d9..44973bda 100644 --- a/ch6-dev/os/mm/struct.PhysAddr.html +++ b/ch6-dev/os/mm/struct.PhysAddr.html @@ -1,53 +1,29 @@ -PhysAddr in os::mm - Rust - -
    -

    Struct os::mm::PhysAddr

    source · []
    #[repr(C)]
    pub struct PhysAddr(pub usize);
    Expand description

    Definitions

    -

    Tuple Fields

    0: usize

    Implementations

    PhysAddr->PhysPageNum

    -

    PhysAddr->PhysPageNum

    -

    Get page offset

    -

    Check page aligned

    -

    Get reference to PhysAddr value

    -

    Get mutable reference to PhysAddr value

    -

    Trait Implementations

    Returns a copy of the value. Read more

    -

    Performs copy-assignment from source. Read more

    -

    Formats the value using the given formatter. Read more

    -

    Converts to this type from the input type.

    -

    Converts to this type from the input type.

    -

    Converts to this type from the input type.

    -

    T: {PhysAddr, VirtAddr, PhysPageNum, VirtPageNum} +PhysAddr in os::mm - Rust

    Struct os::mm::PhysAddr

    source ·
    #[repr(C)]
    pub struct PhysAddr(pub usize);
    Expand description

    Definitions

    +

    Tuple Fields§

    §0: usize

    Implementations§

    source§

    impl PhysAddr

    source

    pub fn floor(&self) -> PhysPageNum

    PhysAddr->PhysPageNum

    +
    source

    pub fn ceil(&self) -> PhysPageNum

    PhysAddr->PhysPageNum

    +
    source

    pub fn page_offset(&self) -> usize

    Get page offset

    +
    source

    pub fn aligned(&self) -> bool

    Check page aligned

    +
    source§

    impl PhysAddr

    source

    pub fn get_ref<T>(&self) -> &'static T

    Get reference to PhysAddr value

    +
    source

    pub fn get_mut<T>(&self) -> &'static mut T

    Get mutable reference to PhysAddr value

    +

    Trait Implementations§

    source§

    impl Clone for PhysAddr

    source§

    fn clone(&self) -> PhysAddr

    Returns a copy of the value. Read more
    1.0.0 · source§

    fn clone_from(&mut self, source: &Self)

    Performs copy-assignment from source. Read more
    source§

    impl Debug for PhysAddr

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    source§

    impl From<PhysAddr> for PhysPageNum

    source§

    fn from(v: PhysAddr) -> Self

    Converts to this type from the input type.
    source§

    impl From<PhysAddr> for usize

    source§

    fn from(v: PhysAddr) -> Self

    Converts to this type from the input type.
    source§

    impl From<PhysPageNum> for PhysAddr

    source§

    fn from(v: PhysPageNum) -> Self

    Converts to this type from the input type.
    source§

    impl From<usize> for PhysAddr

    T: {PhysAddr, VirtAddr, PhysPageNum, VirtPageNum} T -> usize: T.0 usize -> T: usize.into()

    -

    Converts to this type from the input type.

    -

    This method returns an Ordering between self and other. Read more

    -

    Compares and returns the maximum of two values. Read more

    -

    Compares and returns the minimum of two values. Read more

    -

    Restrict a value to a certain interval. Read more

    -

    This method tests for self and other values to be equal, and is used -by ==. Read more

    -

    This method tests for !=.

    -

    This method returns an ordering between self and other values if one exists. Read more

    -

    This method tests less than (for self and other) and is used by the < operator. Read more

    -

    This method tests less than or equal to (for self and other) and is used by the <= -operator. Read more

    -

    This method tests greater than (for self and other) and is used by the > operator. Read more

    -

    This method tests greater than or equal to (for self and other) and is used by the >= -operator. Read more

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +
    source§

    fn from(v: usize) -> Self

    Converts to this type from the input type.
    source§

    impl Ord for PhysAddr

    source§

    fn cmp(&self, other: &PhysAddr) -> Ordering

    This method returns an Ordering between self and other. Read more
    1.21.0 · source§

    fn max(self, other: Self) -> Selfwhere + Self: Sized,

    Compares and returns the maximum of two values. Read more
    1.21.0 · source§

    fn min(self, other: Self) -> Selfwhere + Self: Sized,

    Compares and returns the minimum of two values. Read more
    1.50.0 · source§

    fn clamp(self, min: Self, max: Self) -> Selfwhere + Self: Sized + PartialOrd<Self>,

    Restrict a value to a certain interval. Read more
    source§

    impl PartialEq<PhysAddr> for PhysAddr

    source§

    fn eq(&self, other: &PhysAddr) -> bool

    This method tests for self and other values to be equal, and is used +by ==.
    1.0.0 · source§

    fn ne(&self, other: &Rhs) -> bool

    This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
    source§

    impl PartialOrd<PhysAddr> for PhysAddr

    source§

    fn partial_cmp(&self, other: &PhysAddr) -> Option<Ordering>

    This method returns an ordering between self and other values if one exists. Read more
    1.0.0 · source§

    fn lt(&self, other: &Rhs) -> bool

    This method tests less than (for self and other) and is used by the < operator. Read more
    1.0.0 · source§

    fn le(&self, other: &Rhs) -> bool

    This method tests less than or equal to (for self and other) and is used by the <= +operator. Read more
    1.0.0 · source§

    fn gt(&self, other: &Rhs) -> bool

    This method tests greater than (for self and other) and is used by the > operator. Read more
    1.0.0 · source§

    fn ge(&self, other: &Rhs) -> bool

    This method tests greater than or equal to (for self and other) and is used by the >= +operator. Read more
    source§

    impl Copy for PhysAddr

    source§

    impl Eq for PhysAddr

    source§

    impl StructuralEq for PhysAddr

    source§

    impl StructuralPartialEq for PhysAddr

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The resulting type after obtaining ownership.

    -

    Creates owned data from borrowed data, usually by cloning. Read more

    -
    🔬 This is a nightly-only experimental API. (toowned_clone_into)

    Uses borrowed data to replace owned data, usually by cloning. Read more

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T> ToOwned for Twhere + T: Clone,

    §

    type Owned = T

    The resulting type after obtaining ownership.
    source§

    fn to_owned(&self) -> T

    Creates owned data from borrowed data, usually by cloning. Read more
    source§

    fn clone_into(&self, target: &mut T)

    Uses borrowed data to replace owned data, usually by cloning. Read more
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/mm/struct.PhysPageNum.html b/ch6-dev/os/mm/struct.PhysPageNum.html index 349af250..93e060f7 100644 --- a/ch6-dev/os/mm/struct.PhysPageNum.html +++ b/ch6-dev/os/mm/struct.PhysPageNum.html @@ -1,48 +1,23 @@ -PhysPageNum in os::mm - Rust - -
    -

    Struct os::mm::PhysPageNum

    source · []
    #[repr(C)]
    pub struct PhysPageNum(pub usize);
    Expand description

    phiscal page number

    -

    Tuple Fields

    0: usize

    Implementations

    Get PageTableEntry on PhysPageNum

    -

    Get u8 array on PhysPageNum

    -

    Get Get mutable reference to PhysAddr value on PhysPageNum

    -

    Trait Implementations

    Returns a copy of the value. Read more

    -

    Performs copy-assignment from source. Read more

    -

    Formats the value using the given formatter. Read more

    -

    Converts to this type from the input type.

    -

    Converts to this type from the input type.

    -

    Converts to this type from the input type.

    -

    Converts to this type from the input type.

    -

    This method returns an Ordering between self and other. Read more

    -

    Compares and returns the maximum of two values. Read more

    -

    Compares and returns the minimum of two values. Read more

    -

    Restrict a value to a certain interval. Read more

    -

    This method tests for self and other values to be equal, and is used -by ==. Read more

    -

    This method tests for !=.

    -

    This method returns an ordering between self and other values if one exists. Read more

    -

    This method tests less than (for self and other) and is used by the < operator. Read more

    -

    This method tests less than or equal to (for self and other) and is used by the <= -operator. Read more

    -

    This method tests greater than (for self and other) and is used by the > operator. Read more

    -

    This method tests greater than or equal to (for self and other) and is used by the >= -operator. Read more

    -

    Add value by one

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +PhysPageNum in os::mm - Rust

    Struct os::mm::PhysPageNum

    source ·
    #[repr(C)]
    pub struct PhysPageNum(pub usize);
    Expand description

    phiscal page number

    +

    Tuple Fields§

    §0: usize

    Implementations§

    source§

    impl PhysPageNum

    source

    pub fn get_pte_array(&self) -> &'static mut [PageTableEntry]

    Get PageTableEntry on PhysPageNum

    +
    source

    pub fn get_bytes_array(&self) -> &'static mut [u8]

    Get u8 array on PhysPageNum

    +
    source

    pub fn get_mut<T>(&self) -> &'static mut T

    Get Get mutable reference to PhysAddr value on PhysPageNum

    +

    Trait Implementations§

    source§

    impl Clone for PhysPageNum

    source§

    fn clone(&self) -> PhysPageNum

    Returns a copy of the value. Read more
    1.0.0 · source§

    fn clone_from(&mut self, source: &Self)

    Performs copy-assignment from source. Read more
    source§

    impl Debug for PhysPageNum

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    source§

    impl From<PhysAddr> for PhysPageNum

    source§

    fn from(v: PhysAddr) -> Self

    Converts to this type from the input type.
    source§

    impl From<PhysPageNum> for PhysAddr

    source§

    fn from(v: PhysPageNum) -> Self

    Converts to this type from the input type.
    source§

    impl From<PhysPageNum> for usize

    source§

    fn from(v: PhysPageNum) -> Self

    Converts to this type from the input type.
    source§

    impl From<usize> for PhysPageNum

    source§

    fn from(v: usize) -> Self

    Converts to this type from the input type.
    source§

    impl Ord for PhysPageNum

    source§

    fn cmp(&self, other: &PhysPageNum) -> Ordering

    This method returns an Ordering between self and other. Read more
    1.21.0 · source§

    fn max(self, other: Self) -> Selfwhere + Self: Sized,

    Compares and returns the maximum of two values. Read more
    1.21.0 · source§

    fn min(self, other: Self) -> Selfwhere + Self: Sized,

    Compares and returns the minimum of two values. Read more
    1.50.0 · source§

    fn clamp(self, min: Self, max: Self) -> Selfwhere + Self: Sized + PartialOrd<Self>,

    Restrict a value to a certain interval. Read more
    source§

    impl PartialEq<PhysPageNum> for PhysPageNum

    source§

    fn eq(&self, other: &PhysPageNum) -> bool

    This method tests for self and other values to be equal, and is used +by ==.
    1.0.0 · source§

    fn ne(&self, other: &Rhs) -> bool

    This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
    source§

    impl PartialOrd<PhysPageNum> for PhysPageNum

    source§

    fn partial_cmp(&self, other: &PhysPageNum) -> Option<Ordering>

    This method returns an ordering between self and other values if one exists. Read more
    1.0.0 · source§

    fn lt(&self, other: &Rhs) -> bool

    This method tests less than (for self and other) and is used by the < operator. Read more
    1.0.0 · source§

    fn le(&self, other: &Rhs) -> bool

    This method tests less than or equal to (for self and other) and is used by the <= +operator. Read more
    1.0.0 · source§

    fn gt(&self, other: &Rhs) -> bool

    This method tests greater than (for self and other) and is used by the > operator. Read more
    1.0.0 · source§

    fn ge(&self, other: &Rhs) -> bool

    This method tests greater than or equal to (for self and other) and is used by the >= +operator. Read more
    source§

    impl StepByOne for PhysPageNum

    source§

    fn step(&mut self)

    Add value by one
    source§

    impl Copy for PhysPageNum

    source§

    impl Eq for PhysPageNum

    source§

    impl StructuralEq for PhysPageNum

    source§

    impl StructuralPartialEq for PhysPageNum

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The resulting type after obtaining ownership.

    -

    Creates owned data from borrowed data, usually by cloning. Read more

    -
    🔬 This is a nightly-only experimental API. (toowned_clone_into)

    Uses borrowed data to replace owned data, usually by cloning. Read more

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T> ToOwned for Twhere + T: Clone,

    §

    type Owned = T

    The resulting type after obtaining ownership.
    source§

    fn to_owned(&self) -> T

    Creates owned data from borrowed data, usually by cloning. Read more
    source§

    fn clone_into(&self, target: &mut T)

    Uses borrowed data to replace owned data, usually by cloning. Read more
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/mm/struct.UserBuffer.html b/ch6-dev/os/mm/struct.UserBuffer.html index fe808cc6..c1ae3ee1 100644 --- a/ch6-dev/os/mm/struct.UserBuffer.html +++ b/ch6-dev/os/mm/struct.UserBuffer.html @@ -1,28 +1,17 @@ -UserBuffer in os::mm - Rust - -
    -

    Struct os::mm::UserBuffer

    source · []
    pub struct UserBuffer {
    -    pub buffers: Vec<&'static mut [u8]>,
    -}
    Expand description

    Array of u8 slice that user communicate with os

    -

    Fields

    buffers: Vec<&'static mut [u8]>

    U8 vec

    -

    Implementations

    Create a UserBuffer by parameter

    -

    Length of UserBuffer

    -

    Trait Implementations

    The type of the elements being iterated over.

    -

    Which kind of iterator are we turning this into?

    -

    Creates an iterator from a value. Read more

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +UserBuffer in os::mm - Rust

    Struct os::mm::UserBuffer

    source ·
    pub struct UserBuffer {
    +    pub buffers: Vec<&'static mut [u8]>,
    +}
    Expand description

    Array of u8 slice that user communicate with os

    +

    Fields§

    §buffers: Vec<&'static mut [u8]>

    U8 vec

    +

    Implementations§

    source§

    impl UserBuffer

    source

    pub fn new(buffers: Vec<&'static mut [u8]>) -> Self

    Create a UserBuffer by parameter

    +
    source

    pub fn len(&self) -> usize

    Length of UserBuffer

    +

    Trait Implementations§

    source§

    impl IntoIterator for UserBuffer

    §

    type Item = *mut u8

    The type of the elements being iterated over.
    §

    type IntoIter = UserBufferIterator

    Which kind of iterator are we turning this into?
    source§

    fn into_iter(self) -> Self::IntoIter

    Creates an iterator from a value. Read more

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/mm/struct.UserBufferIterator.html b/ch6-dev/os/mm/struct.UserBufferIterator.html index df2d8701..f3f66639 100644 --- a/ch6-dev/os/mm/struct.UserBufferIterator.html +++ b/ch6-dev/os/mm/struct.UserBufferIterator.html @@ -1,139 +1,207 @@ -UserBufferIterator in os::mm - Rust - -
    pub struct UserBufferIterator {
    -    buffers: Vec<&'static mut [u8]>,
    +UserBufferIterator in os::mm - Rust

    Struct os::mm::UserBufferIterator

    source ·
    pub struct UserBufferIterator {
    +    buffers: Vec<&'static mut [u8]>,
         current_buffer: usize,
         current_idx: usize,
    -}
    Expand description

    Iterator of UserBuffer

    -

    Fields

    buffers: Vec<&'static mut [u8]>current_buffer: usizecurrent_idx: usize

    Trait Implementations

    The type of the elements being iterated over.

    -

    Advances the iterator and returns the next value. Read more

    -

    Returns the bounds on the remaining length of the iterator. Read more

    -

    Consumes the iterator, counting the number of iterations and returning it. Read more

    -

    Consumes the iterator, returning the last element. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_advance_by)

    Advances the iterator by n elements. Read more

    -

    Returns the nth element of the iterator. Read more

    -

    Creates an iterator starting at the same point, but stepping by -the given amount at each iteration. Read more

    -

    Takes two iterators and creates a new iterator over both in sequence. Read more

    -

    ‘Zips up’ two iterators into a single iterator of pairs. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_intersperse)

    Creates a new iterator which places a copy of separator between adjacent -items of the original iterator. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_intersperse)

    Creates a new iterator which places an item generated by separator -between adjacent items of the original iterator. Read more

    -

    Takes a closure and creates an iterator which calls that closure on each -element. Read more

    -

    Calls a closure on each element of an iterator. Read more

    -

    Creates an iterator which uses a closure to determine if an element -should be yielded. Read more

    -

    Creates an iterator that both filters and maps. Read more

    -

    Creates an iterator which gives the current iteration count as well as -the next value. Read more

    -

    Creates an iterator which can use the peek and peek_mut methods +}

    Expand description

    Iterator of UserBuffer

    +

    Fields§

    §buffers: Vec<&'static mut [u8]>§current_buffer: usize§current_idx: usize

    Trait Implementations§

    source§

    impl Iterator for UserBufferIterator

    §

    type Item = *mut u8

    The type of the elements being iterated over.
    source§

    fn next(&mut self) -> Option<Self::Item>

    Advances the iterator and returns the next value. Read more
    source§

    fn next_chunk<const N: usize>( + &mut self +) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where + Self: Sized,

    🔬This is a nightly-only experimental API. (iter_next_chunk)
    Advances the iterator and returns an array containing the next N values. Read more
    1.0.0 · source§

    fn size_hint(&self) -> (usize, Option<usize>)

    Returns the bounds on the remaining length of the iterator. Read more
    1.0.0 · source§

    fn count(self) -> usizewhere + Self: Sized,

    Consumes the iterator, counting the number of iterations and returning it. Read more
    1.0.0 · source§

    fn last(self) -> Option<Self::Item>where + Self: Sized,

    Consumes the iterator, returning the last element. Read more
    source§

    fn advance_by(&mut self, n: usize) -> Result<(), NonZeroUsize>

    🔬This is a nightly-only experimental API. (iter_advance_by)
    Advances the iterator by n elements. Read more
    1.0.0 · source§

    fn nth(&mut self, n: usize) -> Option<Self::Item>

    Returns the nth element of the iterator. Read more
    1.28.0 · source§

    fn step_by(self, step: usize) -> StepBy<Self>where + Self: Sized,

    Creates an iterator starting at the same point, but stepping by +the given amount at each iteration. Read more
    1.0.0 · source§

    fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where + Self: Sized, + U: IntoIterator<Item = Self::Item>,

    Takes two iterators and creates a new iterator over both in sequence. Read more
    1.0.0 · source§

    fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where + Self: Sized, + U: IntoIterator,

    ‘Zips up’ two iterators into a single iterator of pairs. Read more
    source§

    fn intersperse(self, separator: Self::Item) -> Intersperse<Self>where + Self: Sized, + Self::Item: Clone,

    🔬This is a nightly-only experimental API. (iter_intersperse)
    Creates a new iterator which places a copy of separator between adjacent +items of the original iterator. Read more
    source§

    fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>where + Self: Sized, + G: FnMut() -> Self::Item,

    🔬This is a nightly-only experimental API. (iter_intersperse)
    Creates a new iterator which places an item generated by separator +between adjacent items of the original iterator. Read more
    1.0.0 · source§

    fn map<B, F>(self, f: F) -> Map<Self, F>where + Self: Sized, + F: FnMut(Self::Item) -> B,

    Takes a closure and creates an iterator which calls that closure on each +element. Read more
    1.21.0 · source§

    fn for_each<F>(self, f: F)where + Self: Sized, + F: FnMut(Self::Item),

    Calls a closure on each element of an iterator. Read more
    1.0.0 · source§

    fn filter<P>(self, predicate: P) -> Filter<Self, P>where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

    Creates an iterator which uses a closure to determine if an element +should be yielded. Read more
    1.0.0 · source§

    fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>where + Self: Sized, + F: FnMut(Self::Item) -> Option<B>,

    Creates an iterator that both filters and maps. Read more
    1.0.0 · source§

    fn enumerate(self) -> Enumerate<Self>where + Self: Sized,

    Creates an iterator which gives the current iteration count as well as +the next value. Read more
    1.0.0 · source§

    fn peekable(self) -> Peekable<Self>where + Self: Sized,

    Creates an iterator which can use the peek and peek_mut methods to look at the next element of the iterator without consuming it. See -their documentation for more information. Read more

    -

    Creates an iterator that skips elements based on a predicate. Read more

    -

    Creates an iterator that yields elements based on a predicate. Read more

    -

    Creates an iterator that both yields elements based on a predicate and maps. Read more

    -

    Creates an iterator that skips the first n elements. Read more

    -

    Creates an iterator that yields the first n elements, or fewer -if the underlying iterator ends sooner. Read more

    -

    An iterator adapter similar to fold that holds internal state and -produces a new iterator. Read more

    -

    Creates an iterator that works like map, but flattens nested structure. Read more

    -

    Creates an iterator that flattens nested structure. Read more

    -

    Creates an iterator which ends after the first None. Read more

    -

    Does something with each element of an iterator, passing the value on. Read more

    -

    Borrows an iterator, rather than consuming it. Read more

    -

    Transforms an iterator into a collection. Read more

    -
    🔬 This is a nightly-only experimental API. (iterator_try_collect)

    Fallibly transforms an iterator into a collection, short circuiting if -a failure is encountered. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_collect_into)

    Collects all the items from an iterator into a collection. Read more

    -

    Consumes an iterator, creating two collections from it. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_partition_in_place)

    Reorders the elements of this iterator in-place according to the given predicate, -such that all those that return true precede all those that return false. -Returns the number of true elements found. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_is_partitioned)

    Checks if the elements of this iterator are partitioned according to the given predicate, -such that all those that return true precede all those that return false. Read more

    -

    An iterator method that applies a function as long as it returns -successfully, producing a single, final value. Read more

    -

    An iterator method that applies a fallible function to each item in the -iterator, stopping at the first error and returning that error. Read more

    -

    Folds every element into an accumulator by applying an operation, -returning the final result. Read more

    -

    Reduces the elements to a single one, by repeatedly applying a reducing -operation. Read more

    -
    🔬 This is a nightly-only experimental API. (iterator_try_reduce)

    Reduces the elements to a single one by repeatedly applying a reducing operation. If the -closure returns a failure, the failure is propagated back to the caller immediately. Read more

    -

    Tests if every element of the iterator matches a predicate. Read more

    -

    Tests if any element of the iterator matches a predicate. Read more

    -

    Searches for an element of an iterator that satisfies a predicate. Read more

    -

    Applies function to the elements of iterator and returns -the first non-none result. Read more

    -
    🔬 This is a nightly-only experimental API. (try_find)

    Applies function to the elements of iterator and returns -the first true result or the first error. Read more

    -

    Searches for an element in an iterator, returning its index. Read more

    -

    Searches for an element in an iterator from the right, returning its -index. Read more

    -

    Returns the maximum element of an iterator. Read more

    -

    Returns the minimum element of an iterator. Read more

    -

    Returns the element that gives the maximum value from the -specified function. Read more

    -

    Returns the element that gives the maximum value with respect to the -specified comparison function. Read more

    -

    Returns the element that gives the minimum value from the -specified function. Read more

    -

    Returns the element that gives the minimum value with respect to the -specified comparison function. Read more

    -

    Reverses an iterator’s direction. Read more

    -

    Converts an iterator of pairs into a pair of containers. Read more

    -

    Creates an iterator which copies all of its elements. Read more

    -

    Creates an iterator which clones all of its elements. Read more

    -

    Repeats an iterator endlessly. Read more

    -

    Sums the elements of an iterator. Read more

    -

    Iterates over the entire iterator, multiplying all the elements Read more

    -

    Lexicographically compares the elements of this Iterator with those -of another. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_order_by)

    Lexicographically compares the elements of this Iterator with those -of another with respect to the specified comparison function. Read more

    -

    Lexicographically compares the elements of this Iterator with those -of another. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_order_by)

    Lexicographically compares the elements of this Iterator with those -of another with respect to the specified comparison function. Read more

    -

    Determines if the elements of this Iterator are equal to those of -another. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_order_by)

    Determines if the elements of this Iterator are equal to those of -another with respect to the specified equality function. Read more

    -

    Determines if the elements of this Iterator are unequal to those of -another. Read more

    -

    Determines if the elements of this Iterator are lexicographically -less than those of another. Read more

    -

    Determines if the elements of this Iterator are lexicographically -less or equal to those of another. Read more

    -

    Determines if the elements of this Iterator are lexicographically -greater than those of another. Read more

    -

    Determines if the elements of this Iterator are lexicographically -greater than or equal to those of another. Read more

    -
    🔬 This is a nightly-only experimental API. (is_sorted)

    Checks if the elements of this iterator are sorted. Read more

    -
    🔬 This is a nightly-only experimental API. (is_sorted)

    Checks if the elements of this iterator are sorted using the given comparator function. Read more

    -
    🔬 This is a nightly-only experimental API. (is_sorted)

    Checks if the elements of this iterator are sorted using the given key extraction -function. Read more

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +their documentation for more information. Read more
    1.0.0 · source§

    fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

    Creates an iterator that skips elements based on a predicate. Read more
    1.0.0 · source§

    fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

    Creates an iterator that yields elements based on a predicate. Read more
    1.57.0 · source§

    fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where + Self: Sized, + P: FnMut(Self::Item) -> Option<B>,

    Creates an iterator that both yields elements based on a predicate and maps. Read more
    1.0.0 · source§

    fn skip(self, n: usize) -> Skip<Self>where + Self: Sized,

    Creates an iterator that skips the first n elements. Read more
    1.0.0 · source§

    fn take(self, n: usize) -> Take<Self>where + Self: Sized,

    Creates an iterator that yields the first n elements, or fewer +if the underlying iterator ends sooner. Read more
    1.0.0 · source§

    fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>where + Self: Sized, + F: FnMut(&mut St, Self::Item) -> Option<B>,

    An iterator adapter which, like fold, holds internal state, but +unlike fold, produces a new iterator. Read more
    1.0.0 · source§

    fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where + Self: Sized, + U: IntoIterator, + F: FnMut(Self::Item) -> U,

    Creates an iterator that works like map, but flattens nested structure. Read more
    source§

    fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>where + Self: Sized, + F: FnMut(&[Self::Item; N]) -> R,

    🔬This is a nightly-only experimental API. (iter_map_windows)
    Calls the given function f for each contiguous window of size N over +self and returns an iterator over the outputs of f. Like slice::windows(), +the windows during mapping overlap as well. Read more
    1.0.0 · source§

    fn fuse(self) -> Fuse<Self>where + Self: Sized,

    Creates an iterator which ends after the first None. Read more
    1.0.0 · source§

    fn inspect<F>(self, f: F) -> Inspect<Self, F>where + Self: Sized, + F: FnMut(&Self::Item),

    Does something with each element of an iterator, passing the value on. Read more
    1.0.0 · source§

    fn by_ref(&mut self) -> &mut Selfwhere + Self: Sized,

    Borrows an iterator, rather than consuming it. Read more
    1.0.0 · source§

    fn collect<B>(self) -> Bwhere + B: FromIterator<Self::Item>, + Self: Sized,

    Transforms an iterator into a collection. Read more
    source§

    fn collect_into<E>(self, collection: &mut E) -> &mut Ewhere + E: Extend<Self::Item>, + Self: Sized,

    🔬This is a nightly-only experimental API. (iter_collect_into)
    Collects all the items from an iterator into a collection. Read more
    1.0.0 · source§

    fn partition<B, F>(self, f: F) -> (B, B)where + Self: Sized, + B: Default + Extend<Self::Item>, + F: FnMut(&Self::Item) -> bool,

    Consumes an iterator, creating two collections from it. Read more
    source§

    fn is_partitioned<P>(self, predicate: P) -> boolwhere + Self: Sized, + P: FnMut(Self::Item) -> bool,

    🔬This is a nightly-only experimental API. (iter_is_partitioned)
    Checks if the elements of this iterator are partitioned according to the given predicate, +such that all those that return true precede all those that return false. Read more
    1.27.0 · source§

    fn try_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere + Self: Sized, + F: FnMut(B, Self::Item) -> R, + R: Try<Output = B>,

    An iterator method that applies a function as long as it returns +successfully, producing a single, final value. Read more
    1.27.0 · source§

    fn try_for_each<F, R>(&mut self, f: F) -> Rwhere + Self: Sized, + F: FnMut(Self::Item) -> R, + R: Try<Output = ()>,

    An iterator method that applies a fallible function to each item in the +iterator, stopping at the first error and returning that error. Read more
    1.0.0 · source§

    fn fold<B, F>(self, init: B, f: F) -> Bwhere + Self: Sized, + F: FnMut(B, Self::Item) -> B,

    Folds every element into an accumulator by applying an operation, +returning the final result. Read more
    1.51.0 · source§

    fn reduce<F>(self, f: F) -> Option<Self::Item>where + Self: Sized, + F: FnMut(Self::Item, Self::Item) -> Self::Item,

    Reduces the elements to a single one, by repeatedly applying a reducing +operation. Read more
    source§

    fn try_reduce<F, R>( + &mut self, + f: F +) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere + Self: Sized, + F: FnMut(Self::Item, Self::Item) -> R, + R: Try<Output = Self::Item>, + <R as Try>::Residual: Residual<Option<Self::Item>>,

    🔬This is a nightly-only experimental API. (iterator_try_reduce)
    Reduces the elements to a single one by repeatedly applying a reducing operation. If the +closure returns a failure, the failure is propagated back to the caller immediately. Read more
    1.0.0 · source§

    fn all<F>(&mut self, f: F) -> boolwhere + Self: Sized, + F: FnMut(Self::Item) -> bool,

    Tests if every element of the iterator matches a predicate. Read more
    1.0.0 · source§

    fn any<F>(&mut self, f: F) -> boolwhere + Self: Sized, + F: FnMut(Self::Item) -> bool,

    Tests if any element of the iterator matches a predicate. Read more
    1.0.0 · source§

    fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

    Searches for an element of an iterator that satisfies a predicate. Read more
    1.30.0 · source§

    fn find_map<B, F>(&mut self, f: F) -> Option<B>where + Self: Sized, + F: FnMut(Self::Item) -> Option<B>,

    Applies function to the elements of iterator and returns +the first non-none result. Read more
    source§

    fn try_find<F, R>( + &mut self, + f: F +) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere + Self: Sized, + F: FnMut(&Self::Item) -> R, + R: Try<Output = bool>, + <R as Try>::Residual: Residual<Option<Self::Item>>,

    🔬This is a nightly-only experimental API. (try_find)
    Applies function to the elements of iterator and returns +the first true result or the first error. Read more
    1.0.0 · source§

    fn position<P>(&mut self, predicate: P) -> Option<usize>where + Self: Sized, + P: FnMut(Self::Item) -> bool,

    Searches for an element in an iterator, returning its index. Read more
    1.0.0 · source§

    fn max(self) -> Option<Self::Item>where + Self: Sized, + Self::Item: Ord,

    Returns the maximum element of an iterator. Read more
    1.0.0 · source§

    fn min(self) -> Option<Self::Item>where + Self: Sized, + Self::Item: Ord,

    Returns the minimum element of an iterator. Read more
    1.6.0 · source§

    fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>where + B: Ord, + Self: Sized, + F: FnMut(&Self::Item) -> B,

    Returns the element that gives the maximum value from the +specified function. Read more
    1.15.0 · source§

    fn max_by<F>(self, compare: F) -> Option<Self::Item>where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

    Returns the element that gives the maximum value with respect to the +specified comparison function. Read more
    1.6.0 · source§

    fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>where + B: Ord, + Self: Sized, + F: FnMut(&Self::Item) -> B,

    Returns the element that gives the minimum value from the +specified function. Read more
    1.15.0 · source§

    fn min_by<F>(self, compare: F) -> Option<Self::Item>where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

    Returns the element that gives the minimum value with respect to the +specified comparison function. Read more
    1.0.0 · source§

    fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where + FromA: Default + Extend<A>, + FromB: Default + Extend<B>, + Self: Sized + Iterator<Item = (A, B)>,

    Converts an iterator of pairs into a pair of containers. Read more
    1.36.0 · source§

    fn copied<'a, T>(self) -> Copied<Self>where + T: 'a + Copy, + Self: Sized + Iterator<Item = &'a T>,

    Creates an iterator which copies all of its elements. Read more
    1.0.0 · source§

    fn cloned<'a, T>(self) -> Cloned<Self>where + T: 'a + Clone, + Self: Sized + Iterator<Item = &'a T>,

    Creates an iterator which clones all of its elements. Read more
    source§

    fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where + Self: Sized,

    🔬This is a nightly-only experimental API. (iter_array_chunks)
    Returns an iterator over N elements of the iterator at a time. Read more
    1.11.0 · source§

    fn sum<S>(self) -> Swhere + Self: Sized, + S: Sum<Self::Item>,

    Sums the elements of an iterator. Read more
    1.11.0 · source§

    fn product<P>(self) -> Pwhere + Self: Sized, + P: Product<Self::Item>,

    Iterates over the entire iterator, multiplying all the elements Read more
    1.5.0 · source§

    fn cmp<I>(self, other: I) -> Orderingwhere + I: IntoIterator<Item = Self::Item>, + Self::Item: Ord, + Self: Sized,

    Lexicographically compares the elements of this Iterator with those +of another. Read more
    source§

    fn cmp_by<I, F>(self, other: I, cmp: F) -> Orderingwhere + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,

    🔬This is a nightly-only experimental API. (iter_order_by)
    Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
    1.5.0 · source§

    fn partial_cmp<I>(self, other: I) -> Option<Ordering>where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

    Lexicographically compares the PartialOrd elements of +this Iterator with those of another. The comparison works like short-circuit +evaluation, returning a result without comparing the remaining elements. +As soon as an order can be determined, the evaluation stops and a result is returned. Read more
    source§

    fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,

    🔬This is a nightly-only experimental API. (iter_order_by)
    Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
    1.5.0 · source§

    fn eq<I>(self, other: I) -> boolwhere + I: IntoIterator, + Self::Item: PartialEq<<I as IntoIterator>::Item>, + Self: Sized,

    Determines if the elements of this Iterator are equal to those of +another. Read more
    source§

    fn eq_by<I, F>(self, other: I, eq: F) -> boolwhere + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,

    🔬This is a nightly-only experimental API. (iter_order_by)
    Determines if the elements of this Iterator are equal to those of +another with respect to the specified equality function. Read more
    1.5.0 · source§

    fn ne<I>(self, other: I) -> boolwhere + I: IntoIterator, + Self::Item: PartialEq<<I as IntoIterator>::Item>, + Self: Sized,

    Determines if the elements of this Iterator are not equal to those of +another. Read more
    1.5.0 · source§

    fn lt<I>(self, other: I) -> boolwhere + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

    Determines if the elements of this Iterator are lexicographically +less than those of another. Read more
    1.5.0 · source§

    fn le<I>(self, other: I) -> boolwhere + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

    Determines if the elements of this Iterator are lexicographically +less or equal to those of another. Read more
    1.5.0 · source§

    fn gt<I>(self, other: I) -> boolwhere + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

    Determines if the elements of this Iterator are lexicographically +greater than those of another. Read more
    1.5.0 · source§

    fn ge<I>(self, other: I) -> boolwhere + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

    Determines if the elements of this Iterator are lexicographically +greater than or equal to those of another. Read more
    source§

    fn is_sorted(self) -> boolwhere + Self: Sized, + Self::Item: PartialOrd<Self::Item>,

    🔬This is a nightly-only experimental API. (is_sorted)
    Checks if the elements of this iterator are sorted. Read more
    source§

    fn is_sorted_by<F>(self, compare: F) -> boolwhere + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Option<Ordering>,

    🔬This is a nightly-only experimental API. (is_sorted)
    Checks if the elements of this iterator are sorted using the given comparator function. Read more
    source§

    fn is_sorted_by_key<F, K>(self, f: F) -> boolwhere + Self: Sized, + F: FnMut(Self::Item) -> K, + K: PartialOrd<K>,

    🔬This is a nightly-only experimental API. (is_sorted)
    Checks if the elements of this iterator are sorted using the given key extraction +function. Read more

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type of the elements being iterated over.

    -

    Which kind of iterator are we turning this into?

    -

    Creates an iterator from a value. Read more

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<I> IntoIterator for Iwhere + I: Iterator,

    §

    type Item = <I as Iterator>::Item

    The type of the elements being iterated over.
    §

    type IntoIter = I

    Which kind of iterator are we turning this into?
    const: unstable · source§

    fn into_iter(self) -> I

    Creates an iterator from a value. Read more
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/mm/struct.VirtAddr.html b/ch6-dev/os/mm/struct.VirtAddr.html index 2fdb50a3..40102ec8 100644 --- a/ch6-dev/os/mm/struct.VirtAddr.html +++ b/ch6-dev/os/mm/struct.VirtAddr.html @@ -1,49 +1,25 @@ -VirtAddr in os::mm - Rust - -
    -

    Struct os::mm::VirtAddr

    source · []
    #[repr(C)]
    pub struct VirtAddr(pub usize);
    Expand description

    virtual address

    -

    Tuple Fields

    0: usize

    Implementations

    VirtAddr->VirtPageNum

    -

    VirtAddr->VirtPageNum

    -

    Get page offset

    -

    Check page aligned

    -

    Trait Implementations

    Returns a copy of the value. Read more

    -

    Performs copy-assignment from source. Read more

    -

    Debugging

    -

    Formats the value using the given formatter. Read more

    -

    Converts to this type from the input type.

    -

    Converts to this type from the input type.

    -

    Converts to this type from the input type.

    -

    Converts to this type from the input type.

    -

    This method returns an Ordering between self and other. Read more

    -

    Compares and returns the maximum of two values. Read more

    -

    Compares and returns the minimum of two values. Read more

    -

    Restrict a value to a certain interval. Read more

    -

    This method tests for self and other values to be equal, and is used -by ==. Read more

    -

    This method tests for !=.

    -

    This method returns an ordering between self and other values if one exists. Read more

    -

    This method tests less than (for self and other) and is used by the < operator. Read more

    -

    This method tests less than or equal to (for self and other) and is used by the <= -operator. Read more

    -

    This method tests greater than (for self and other) and is used by the > operator. Read more

    -

    This method tests greater than or equal to (for self and other) and is used by the >= -operator. Read more

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +VirtAddr in os::mm - Rust

    Struct os::mm::VirtAddr

    source ·
    #[repr(C)]
    pub struct VirtAddr(pub usize);
    Expand description

    virtual address

    +

    Tuple Fields§

    §0: usize

    Implementations§

    source§

    impl VirtAddr

    source

    pub fn floor(&self) -> VirtPageNum

    VirtAddr->VirtPageNum

    +
    source

    pub fn ceil(&self) -> VirtPageNum

    VirtAddr->VirtPageNum

    +
    source

    pub fn page_offset(&self) -> usize

    Get page offset

    +
    source

    pub fn aligned(&self) -> bool

    Check page aligned

    +

    Trait Implementations§

    source§

    impl Clone for VirtAddr

    source§

    fn clone(&self) -> VirtAddr

    Returns a copy of the value. Read more
    1.0.0 · source§

    fn clone_from(&mut self, source: &Self)

    Performs copy-assignment from source. Read more
    source§

    impl Debug for VirtAddr

    Debugging

    +
    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    source§

    impl From<VirtAddr> for VirtPageNum

    source§

    fn from(v: VirtAddr) -> Self

    Converts to this type from the input type.
    source§

    impl From<VirtAddr> for usize

    source§

    fn from(v: VirtAddr) -> Self

    Converts to this type from the input type.
    source§

    impl From<VirtPageNum> for VirtAddr

    source§

    fn from(v: VirtPageNum) -> Self

    Converts to this type from the input type.
    source§

    impl From<usize> for VirtAddr

    source§

    fn from(v: usize) -> Self

    Converts to this type from the input type.
    source§

    impl Ord for VirtAddr

    source§

    fn cmp(&self, other: &VirtAddr) -> Ordering

    This method returns an Ordering between self and other. Read more
    1.21.0 · source§

    fn max(self, other: Self) -> Selfwhere + Self: Sized,

    Compares and returns the maximum of two values. Read more
    1.21.0 · source§

    fn min(self, other: Self) -> Selfwhere + Self: Sized,

    Compares and returns the minimum of two values. Read more
    1.50.0 · source§

    fn clamp(self, min: Self, max: Self) -> Selfwhere + Self: Sized + PartialOrd<Self>,

    Restrict a value to a certain interval. Read more
    source§

    impl PartialEq<VirtAddr> for VirtAddr

    source§

    fn eq(&self, other: &VirtAddr) -> bool

    This method tests for self and other values to be equal, and is used +by ==.
    1.0.0 · source§

    fn ne(&self, other: &Rhs) -> bool

    This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
    source§

    impl PartialOrd<VirtAddr> for VirtAddr

    source§

    fn partial_cmp(&self, other: &VirtAddr) -> Option<Ordering>

    This method returns an ordering between self and other values if one exists. Read more
    1.0.0 · source§

    fn lt(&self, other: &Rhs) -> bool

    This method tests less than (for self and other) and is used by the < operator. Read more
    1.0.0 · source§

    fn le(&self, other: &Rhs) -> bool

    This method tests less than or equal to (for self and other) and is used by the <= +operator. Read more
    1.0.0 · source§

    fn gt(&self, other: &Rhs) -> bool

    This method tests greater than (for self and other) and is used by the > operator. Read more
    1.0.0 · source§

    fn ge(&self, other: &Rhs) -> bool

    This method tests greater than or equal to (for self and other) and is used by the >= +operator. Read more
    source§

    impl Copy for VirtAddr

    source§

    impl Eq for VirtAddr

    source§

    impl StructuralEq for VirtAddr

    source§

    impl StructuralPartialEq for VirtAddr

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The resulting type after obtaining ownership.

    -

    Creates owned data from borrowed data, usually by cloning. Read more

    -
    🔬 This is a nightly-only experimental API. (toowned_clone_into)

    Uses borrowed data to replace owned data, usually by cloning. Read more

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T> ToOwned for Twhere + T: Clone,

    §

    type Owned = T

    The resulting type after obtaining ownership.
    source§

    fn to_owned(&self) -> T

    Creates owned data from borrowed data, usually by cloning. Read more
    source§

    fn clone_into(&self, target: &mut T)

    Uses borrowed data to replace owned data, usually by cloning. Read more
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/mm/struct.VirtPageNum.html b/ch6-dev/os/mm/struct.VirtPageNum.html index d0e797e5..a8639153 100644 --- a/ch6-dev/os/mm/struct.VirtPageNum.html +++ b/ch6-dev/os/mm/struct.VirtPageNum.html @@ -1,46 +1,21 @@ -VirtPageNum in os::mm - Rust - -
    -

    Struct os::mm::VirtPageNum

    source · []
    #[repr(C)]
    pub struct VirtPageNum(pub usize);
    Expand description

    virtual page number

    -

    Tuple Fields

    0: usize

    Implementations

    Return VPN 3 level index

    -

    Trait Implementations

    Returns a copy of the value. Read more

    -

    Performs copy-assignment from source. Read more

    -

    Formats the value using the given formatter. Read more

    -

    Converts to this type from the input type.

    -

    Converts to this type from the input type.

    -

    Converts to this type from the input type.

    -

    Converts to this type from the input type.

    -

    This method returns an Ordering between self and other. Read more

    -

    Compares and returns the maximum of two values. Read more

    -

    Compares and returns the minimum of two values. Read more

    -

    Restrict a value to a certain interval. Read more

    -

    This method tests for self and other values to be equal, and is used -by ==. Read more

    -

    This method tests for !=.

    -

    This method returns an ordering between self and other values if one exists. Read more

    -

    This method tests less than (for self and other) and is used by the < operator. Read more

    -

    This method tests less than or equal to (for self and other) and is used by the <= -operator. Read more

    -

    This method tests greater than (for self and other) and is used by the > operator. Read more

    -

    This method tests greater than or equal to (for self and other) and is used by the >= -operator. Read more

    -

    Add value by one

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +VirtPageNum in os::mm - Rust

    Struct os::mm::VirtPageNum

    source ·
    #[repr(C)]
    pub struct VirtPageNum(pub usize);
    Expand description

    virtual page number

    +

    Tuple Fields§

    §0: usize

    Implementations§

    source§

    impl VirtPageNum

    source

    pub fn indexes(&self) -> [usize; 3]

    Return VPN 3 level index

    +

    Trait Implementations§

    source§

    impl Clone for VirtPageNum

    source§

    fn clone(&self) -> VirtPageNum

    Returns a copy of the value. Read more
    1.0.0 · source§

    fn clone_from(&mut self, source: &Self)

    Performs copy-assignment from source. Read more
    source§

    impl Debug for VirtPageNum

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    source§

    impl From<VirtAddr> for VirtPageNum

    source§

    fn from(v: VirtAddr) -> Self

    Converts to this type from the input type.
    source§

    impl From<VirtPageNum> for VirtAddr

    source§

    fn from(v: VirtPageNum) -> Self

    Converts to this type from the input type.
    source§

    impl From<VirtPageNum> for usize

    source§

    fn from(v: VirtPageNum) -> Self

    Converts to this type from the input type.
    source§

    impl From<usize> for VirtPageNum

    source§

    fn from(v: usize) -> Self

    Converts to this type from the input type.
    source§

    impl Ord for VirtPageNum

    source§

    fn cmp(&self, other: &VirtPageNum) -> Ordering

    This method returns an Ordering between self and other. Read more
    1.21.0 · source§

    fn max(self, other: Self) -> Selfwhere + Self: Sized,

    Compares and returns the maximum of two values. Read more
    1.21.0 · source§

    fn min(self, other: Self) -> Selfwhere + Self: Sized,

    Compares and returns the minimum of two values. Read more
    1.50.0 · source§

    fn clamp(self, min: Self, max: Self) -> Selfwhere + Self: Sized + PartialOrd<Self>,

    Restrict a value to a certain interval. Read more
    source§

    impl PartialEq<VirtPageNum> for VirtPageNum

    source§

    fn eq(&self, other: &VirtPageNum) -> bool

    This method tests for self and other values to be equal, and is used +by ==.
    1.0.0 · source§

    fn ne(&self, other: &Rhs) -> bool

    This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
    source§

    impl PartialOrd<VirtPageNum> for VirtPageNum

    source§

    fn partial_cmp(&self, other: &VirtPageNum) -> Option<Ordering>

    This method returns an ordering between self and other values if one exists. Read more
    1.0.0 · source§

    fn lt(&self, other: &Rhs) -> bool

    This method tests less than (for self and other) and is used by the < operator. Read more
    1.0.0 · source§

    fn le(&self, other: &Rhs) -> bool

    This method tests less than or equal to (for self and other) and is used by the <= +operator. Read more
    1.0.0 · source§

    fn gt(&self, other: &Rhs) -> bool

    This method tests greater than (for self and other) and is used by the > operator. Read more
    1.0.0 · source§

    fn ge(&self, other: &Rhs) -> bool

    This method tests greater than or equal to (for self and other) and is used by the >= +operator. Read more
    source§

    impl StepByOne for VirtPageNum

    source§

    fn step(&mut self)

    Add value by one
    source§

    impl Copy for VirtPageNum

    source§

    impl Eq for VirtPageNum

    source§

    impl StructuralEq for VirtPageNum

    source§

    impl StructuralPartialEq for VirtPageNum

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The resulting type after obtaining ownership.

    -

    Creates owned data from borrowed data, usually by cloning. Read more

    -
    🔬 This is a nightly-only experimental API. (toowned_clone_into)

    Uses borrowed data to replace owned data, usually by cloning. Read more

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T> ToOwned for Twhere + T: Clone,

    §

    type Owned = T

    The resulting type after obtaining ownership.
    source§

    fn to_owned(&self) -> T

    Creates owned data from borrowed data, usually by cloning. Read more
    source§

    fn clone_into(&self, target: &mut T)

    Uses borrowed data to replace owned data, usually by cloning. Read more
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/mm/trait.StepByOne.html b/ch6-dev/os/mm/trait.StepByOne.html index 8acb1597..b86a0317 100644 --- a/ch6-dev/os/mm/trait.StepByOne.html +++ b/ch6-dev/os/mm/trait.StepByOne.html @@ -1,12 +1,6 @@ -StepByOne in os::mm - Rust - -
    -

    Trait os::mm::StepByOne

    source · []
    pub trait StepByOne {
    -    fn step(&mut self);
    -}
    Expand description

    Add value by one

    -

    Required methods

    Add value by one

    -

    Implementors

    - \ No newline at end of file +StepByOne in os::mm - Rust

    Trait os::mm::StepByOne

    source ·
    pub trait StepByOne {
    +    // Required method
    +    fn step(&mut self);
    +}
    Expand description

    Add value by one

    +

    Required Methods§

    source

    fn step(&mut self)

    Add value by one

    +

    Implementors§

    \ No newline at end of file diff --git a/ch6-dev/os/sbi/constant.SBI_CLEAR_IPI.html b/ch6-dev/os/sbi/constant.SBI_CLEAR_IPI.html deleted file mode 100644 index be14110f..00000000 --- a/ch6-dev/os/sbi/constant.SBI_CLEAR_IPI.html +++ /dev/null @@ -1,8 +0,0 @@ -SBI_CLEAR_IPI in os::sbi - Rust - -
    -

    Constant os::sbi::SBI_CLEAR_IPI

    source · []
    const SBI_CLEAR_IPI: usize = 3;
    - \ No newline at end of file diff --git a/ch6-dev/os/sbi/constant.SBI_CONSOLE_GETCHAR.html b/ch6-dev/os/sbi/constant.SBI_CONSOLE_GETCHAR.html deleted file mode 100644 index abc48e6e..00000000 --- a/ch6-dev/os/sbi/constant.SBI_CONSOLE_GETCHAR.html +++ /dev/null @@ -1,8 +0,0 @@ -SBI_CONSOLE_GETCHAR in os::sbi - Rust - -
    const SBI_CONSOLE_GETCHAR: usize = 2;
    - \ No newline at end of file diff --git a/ch6-dev/os/sbi/constant.SBI_CONSOLE_PUTCHAR.html b/ch6-dev/os/sbi/constant.SBI_CONSOLE_PUTCHAR.html deleted file mode 100644 index e1bb6f31..00000000 --- a/ch6-dev/os/sbi/constant.SBI_CONSOLE_PUTCHAR.html +++ /dev/null @@ -1,8 +0,0 @@ -SBI_CONSOLE_PUTCHAR in os::sbi - Rust - -
    const SBI_CONSOLE_PUTCHAR: usize = 1;
    - \ No newline at end of file diff --git a/ch6-dev/os/sbi/constant.SBI_REMOTE_FENCE_I.html b/ch6-dev/os/sbi/constant.SBI_REMOTE_FENCE_I.html deleted file mode 100644 index 34b2f2c5..00000000 --- a/ch6-dev/os/sbi/constant.SBI_REMOTE_FENCE_I.html +++ /dev/null @@ -1,8 +0,0 @@ -SBI_REMOTE_FENCE_I in os::sbi - Rust - -
    const SBI_REMOTE_FENCE_I: usize = 5;
    - \ No newline at end of file diff --git a/ch6-dev/os/sbi/constant.SBI_REMOTE_SFENCE_VMA.html b/ch6-dev/os/sbi/constant.SBI_REMOTE_SFENCE_VMA.html deleted file mode 100644 index 49295e76..00000000 --- a/ch6-dev/os/sbi/constant.SBI_REMOTE_SFENCE_VMA.html +++ /dev/null @@ -1,8 +0,0 @@ -SBI_REMOTE_SFENCE_VMA in os::sbi - Rust - -
    const SBI_REMOTE_SFENCE_VMA: usize = 6;
    - \ No newline at end of file diff --git a/ch6-dev/os/sbi/constant.SBI_REMOTE_SFENCE_VMA_ASID.html b/ch6-dev/os/sbi/constant.SBI_REMOTE_SFENCE_VMA_ASID.html deleted file mode 100644 index 23f4fa82..00000000 --- a/ch6-dev/os/sbi/constant.SBI_REMOTE_SFENCE_VMA_ASID.html +++ /dev/null @@ -1,8 +0,0 @@ -SBI_REMOTE_SFENCE_VMA_ASID in os::sbi - Rust - -
    const SBI_REMOTE_SFENCE_VMA_ASID: usize = 7;
    - \ No newline at end of file diff --git a/ch6-dev/os/sbi/constant.SBI_SEND_IPI.html b/ch6-dev/os/sbi/constant.SBI_SEND_IPI.html deleted file mode 100644 index e58b3592..00000000 --- a/ch6-dev/os/sbi/constant.SBI_SEND_IPI.html +++ /dev/null @@ -1,8 +0,0 @@ -SBI_SEND_IPI in os::sbi - Rust - -
    -

    Constant os::sbi::SBI_SEND_IPI

    source · []
    const SBI_SEND_IPI: usize = 4;
    - \ No newline at end of file diff --git a/ch6-dev/os/sbi/constant.SBI_SET_TIMER.html b/ch6-dev/os/sbi/constant.SBI_SET_TIMER.html deleted file mode 100644 index fd0ae79d..00000000 --- a/ch6-dev/os/sbi/constant.SBI_SET_TIMER.html +++ /dev/null @@ -1,8 +0,0 @@ -SBI_SET_TIMER in os::sbi - Rust - -
    -

    Constant os::sbi::SBI_SET_TIMER

    source · []
    const SBI_SET_TIMER: usize = 0;
    - \ No newline at end of file diff --git a/ch6-dev/os/sbi/constant.SBI_SHUTDOWN.html b/ch6-dev/os/sbi/constant.SBI_SHUTDOWN.html deleted file mode 100644 index b1e93dc4..00000000 --- a/ch6-dev/os/sbi/constant.SBI_SHUTDOWN.html +++ /dev/null @@ -1,8 +0,0 @@ -SBI_SHUTDOWN in os::sbi - Rust - -
    -

    Constant os::sbi::SBI_SHUTDOWN

    source · []
    const SBI_SHUTDOWN: usize = 8;
    - \ No newline at end of file diff --git a/ch6-dev/os/sbi/fn.console_getchar.html b/ch6-dev/os/sbi/fn.console_getchar.html index e7e4500e..f480a50a 100644 --- a/ch6-dev/os/sbi/fn.console_getchar.html +++ b/ch6-dev/os/sbi/fn.console_getchar.html @@ -1,9 +1,2 @@ -console_getchar in os::sbi - Rust - -
    pub fn console_getchar() -> usize
    Expand description

    use sbi call to getchar from console (qemu uart handler)

    -
    - \ No newline at end of file +console_getchar in os::sbi - Rust

    Function os::sbi::console_getchar

    source ·
    pub fn console_getchar() -> usize
    Expand description

    use sbi call to getchar from console (qemu uart handler)

    +
    \ No newline at end of file diff --git a/ch6-dev/os/sbi/fn.console_putchar.html b/ch6-dev/os/sbi/fn.console_putchar.html index f4858061..e56c8eb0 100644 --- a/ch6-dev/os/sbi/fn.console_putchar.html +++ b/ch6-dev/os/sbi/fn.console_putchar.html @@ -1,9 +1,2 @@ -console_putchar in os::sbi - Rust - -
    pub fn console_putchar(c: usize)
    Expand description

    use sbi call to putchar in console (qemu uart handler)

    -
    - \ No newline at end of file +console_putchar in os::sbi - Rust

    Function os::sbi::console_putchar

    source ·
    pub fn console_putchar(c: usize)
    Expand description

    use sbi call to putchar in console (qemu uart handler)

    +
    \ No newline at end of file diff --git a/ch6-dev/os/sbi/fn.sbi_call.html b/ch6-dev/os/sbi/fn.sbi_call.html deleted file mode 100644 index 04f84c5b..00000000 --- a/ch6-dev/os/sbi/fn.sbi_call.html +++ /dev/null @@ -1,9 +0,0 @@ -sbi_call in os::sbi - Rust - -
    -

    Function os::sbi::sbi_call

    source · []
    fn sbi_call(which: usize, arg0: usize, arg1: usize, arg2: usize) -> usize
    Expand description

    general sbi call

    -
    - \ No newline at end of file diff --git a/ch6-dev/os/sbi/fn.set_timer.html b/ch6-dev/os/sbi/fn.set_timer.html index 4e4ca12e..84acf5eb 100644 --- a/ch6-dev/os/sbi/fn.set_timer.html +++ b/ch6-dev/os/sbi/fn.set_timer.html @@ -1,9 +1,2 @@ -set_timer in os::sbi - Rust - -
    -

    Function os::sbi::set_timer

    source · []
    pub fn set_timer(timer: usize)
    Expand description

    use sbi call to set timer

    -
    - \ No newline at end of file +set_timer in os::sbi - Rust

    Function os::sbi::set_timer

    source ·
    pub fn set_timer(timer: usize)
    Expand description

    use sbi call to set timer

    +
    \ No newline at end of file diff --git a/ch6-dev/os/sbi/fn.shutdown.html b/ch6-dev/os/sbi/fn.shutdown.html index 8aaf3c4f..8c2a956b 100644 --- a/ch6-dev/os/sbi/fn.shutdown.html +++ b/ch6-dev/os/sbi/fn.shutdown.html @@ -1,9 +1,2 @@ -shutdown in os::sbi - Rust - -
    -

    Function os::sbi::shutdown

    source · []
    pub fn shutdown() -> !
    Expand description

    use sbi call to shutdown the kernel

    -
    - \ No newline at end of file +shutdown in os::sbi - Rust

    Function os::sbi::shutdown

    source ·
    pub fn shutdown(failure: bool) -> !
    Expand description

    use sbi call to shutdown the kernel

    +
    \ No newline at end of file diff --git a/ch6-dev/os/sbi/index.html b/ch6-dev/os/sbi/index.html index 362721f1..90c24f2b 100644 --- a/ch6-dev/os/sbi/index.html +++ b/ch6-dev/os/sbi/index.html @@ -1,16 +1,2 @@ -os::sbi - Rust - -
    -

    Module os::sbi

    source · []
    Expand description

    SBI call wrappers

    -

    Constants

    -

    Functions

    -

    use sbi call to getchar from console (qemu uart handler)

    -

    use sbi call to putchar in console (qemu uart handler)

    -
    sbi_call 🔒

    general sbi call

    -

    use sbi call to set timer

    -

    use sbi call to shutdown the kernel

    -
    - \ No newline at end of file +os::sbi - Rust

    Module os::sbi

    source ·
    Expand description

    SBI call wrappers

    +

    Functions

    \ No newline at end of file diff --git a/ch6-dev/os/sbi/sidebar-items.js b/ch6-dev/os/sbi/sidebar-items.js index df8a1503..48cbb3c3 100644 --- a/ch6-dev/os/sbi/sidebar-items.js +++ b/ch6-dev/os/sbi/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"constant":[["SBI_CLEAR_IPI",""],["SBI_CONSOLE_GETCHAR",""],["SBI_CONSOLE_PUTCHAR",""],["SBI_REMOTE_FENCE_I",""],["SBI_REMOTE_SFENCE_VMA",""],["SBI_REMOTE_SFENCE_VMA_ASID",""],["SBI_SEND_IPI",""],["SBI_SET_TIMER",""],["SBI_SHUTDOWN",""]],"fn":[["console_getchar","use sbi call to getchar from console (qemu uart handler)"],["console_putchar","use sbi call to putchar in console (qemu uart handler)"],["sbi_call","general sbi call"],["set_timer","use sbi call to set timer"],["shutdown","use sbi call to shutdown the kernel"]]}); \ No newline at end of file +window.SIDEBAR_ITEMS = {"fn":["console_getchar","console_putchar","set_timer","shutdown"]}; \ No newline at end of file diff --git a/ch6-dev/os/sidebar-items.js b/ch6-dev/os/sidebar-items.js index cd282bdc..5e2a1923 100644 --- a/ch6-dev/os/sidebar-items.js +++ b/ch6-dev/os/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"fn":[["clear_bss","clear BSS segment"],["rust_main","the rust entry-point of os"]],"macro":[["print","print string macro"],["println","println string macro"]],"mod":[["board",""],["config","Constants used in rCore"],["console","SBI console driver, for text output"],["drivers",""],["fs","File system in os"],["lang_items","The panic handler"],["mm","Memory management implementation"],["sbi","SBI call wrappers"],["sync","Synchronization and interior mutability primitives"],["syscall","Implementation of syscalls"],["task","Task management implementation"],["timer","RISC-V timer-related functionality"],["trap","Trap handling functionality"]]}); \ No newline at end of file +window.SIDEBAR_ITEMS = {"fn":["clear_bss","rust_main"],"macro":["print","println"],"mod":["board","config","console","drivers","fs","lang_items","mm","sbi","sync","syscall","task","timer","trap"]}; \ No newline at end of file diff --git a/ch6-dev/os/sync/index.html b/ch6-dev/os/sync/index.html index 6119d98c..04f2b1a5 100644 --- a/ch6-dev/os/sync/index.html +++ b/ch6-dev/os/sync/index.html @@ -1,14 +1,3 @@ -os::sync - Rust - -
    -

    Module os::sync

    source · []
    Expand description

    Synchronization and interior mutability primitives

    -

    Modules

    -
    up 🔒

    Uniprocessor interior mutability primitives

    -

    Structs

    -

    Wrap a static data structure inside it so that we are -able to access it without any unsafe.

    -
    - \ No newline at end of file +os::sync - Rust

    Module os::sync

    source ·
    Expand description

    Synchronization and interior mutability primitives

    +

    Modules

    • up 🔒
      Uniprocessor interior mutability primitives

    Structs

    • The sync primitive used by easy-fs.
    • Wrap a static data structure inside it so that we are +able to access it without any unsafe.
    \ No newline at end of file diff --git a/ch6-dev/os/sync/sidebar-items.js b/ch6-dev/os/sync/sidebar-items.js index a310b54a..b1b930bd 100644 --- a/ch6-dev/os/sync/sidebar-items.js +++ b/ch6-dev/os/sync/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"mod":[["up","Uniprocessor interior mutability primitives"]],"struct":[["UPSafeCell","Wrap a static data structure inside it so that we are able to access it without any `unsafe`."]]}); \ No newline at end of file +window.SIDEBAR_ITEMS = {"mod":["up"],"struct":["RawExclusiveLock","UPSafeCell"]}; \ No newline at end of file diff --git a/ch6-dev/os/sync/struct.RawExclusiveLock.html b/ch6-dev/os/sync/struct.RawExclusiveLock.html new file mode 100644 index 00000000..78d2525c --- /dev/null +++ b/ch6-dev/os/sync/struct.RawExclusiveLock.html @@ -0,0 +1,14 @@ +RawExclusiveLock in os::sync - Rust

    Struct os::sync::RawExclusiveLock

    source ·
    pub struct RawExclusiveLock(AtomicBool);
    Expand description

    The sync primitive used by easy-fs.

    +

    Tuple Fields§

    §0: AtomicBool

    Trait Implementations§

    source§

    impl RawMutex for RawExclusiveLock

    source§

    const INIT: Self = _

    Initial value for an unlocked mutex.
    §

    type GuardMarker = GuardNoSend

    Marker type which determines whether a lock guard should be Send. Use +one of the GuardSend or GuardNoSend helper types here.
    source§

    fn lock(&self)

    Acquires this mutex, blocking the current thread until it is able to do so.
    source§

    fn try_lock(&self) -> bool

    Attempts to acquire this mutex without blocking. Returns true +if the lock was successfully acquired and false otherwise.
    source§

    unsafe fn unlock(&self)

    Unlocks this mutex. Read more
    §

    fn is_locked(&self) -> bool

    Checks whether the mutex is currently locked.

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    +

    That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/sync/struct.UPSafeCell.html b/ch6-dev/os/sync/struct.UPSafeCell.html index 9163b002..50a98c65 100644 --- a/ch6-dev/os/sync/struct.UPSafeCell.html +++ b/ch6-dev/os/sync/struct.UPSafeCell.html @@ -1,30 +1,25 @@ -UPSafeCell in os::sync - Rust - -
    -

    Struct os::sync::UPSafeCell

    source · []
    pub struct UPSafeCell<T> {
    +UPSafeCell in os::sync - Rust

    Struct os::sync::UPSafeCell

    source ·
    pub struct UPSafeCell<T> {
         inner: RefCell<T>,
    -}
    Expand description

    Wrap a static data structure inside it so that we are +}

    Expand description

    Wrap a static data structure inside it so that we are able to access it without any unsafe.

    We should only use it in uniprocessor.

    In order to get mutable reference of inner data, call exclusive_access.

    -

    Fields

    inner: RefCell<T>

    inner data

    -

    Implementations

    User is responsible to guarantee that inner struct is only used in +

    Fields§

    §inner: RefCell<T>

    inner data

    +

    Implementations§

    source§

    impl<T> UPSafeCell<T>

    source

    pub unsafe fn new(value: T) -> Self

    User is responsible to guarantee that inner struct is only used in uniprocessor.

    -

    Exclusive access inner data in UPSafeCell. Panic if the data has been borrowed.

    -

    Trait Implementations

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +
    source

    pub fn exclusive_access(&self) -> RefMut<'_, T>

    Exclusive access inner data in UPSafeCell. Panic if the data has been borrowed.

    +

    Trait Implementations§

    source§

    impl<T> Sync for UPSafeCell<T>

    Auto Trait Implementations§

    §

    impl<T> !RefUnwindSafe for UPSafeCell<T>

    §

    impl<T> Send for UPSafeCell<T>where + T: Send,

    §

    impl<T> Unpin for UPSafeCell<T>where + T: Unpin,

    §

    impl<T> UnwindSafe for UPSafeCell<T>where + T: UnwindSafe,

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/sync/up/index.html b/ch6-dev/os/sync/up/index.html index db7fed21..6975728c 100644 --- a/ch6-dev/os/sync/up/index.html +++ b/ch6-dev/os/sync/up/index.html @@ -1,12 +1,3 @@ -os::sync::up - Rust - -
    -

    Module os::sync::up

    source · []
    Expand description

    Uniprocessor interior mutability primitives

    -

    Structs

    -

    Wrap a static data structure inside it so that we are -able to access it without any unsafe.

    -
    - \ No newline at end of file +os::sync::up - Rust

    Module os::sync::up

    source ·
    Expand description

    Uniprocessor interior mutability primitives

    +

    Structs

    • The sync primitive used by easy-fs.
    • Wrap a static data structure inside it so that we are +able to access it without any unsafe.
    \ No newline at end of file diff --git a/ch6-dev/os/sync/up/sidebar-items.js b/ch6-dev/os/sync/up/sidebar-items.js index d34252dd..0cd2b62e 100644 --- a/ch6-dev/os/sync/up/sidebar-items.js +++ b/ch6-dev/os/sync/up/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"struct":[["UPSafeCell","Wrap a static data structure inside it so that we are able to access it without any `unsafe`."]]}); \ No newline at end of file +window.SIDEBAR_ITEMS = {"struct":["RawExclusiveLock","UPSafeCell"]}; \ No newline at end of file diff --git a/ch6-dev/os/sync/up/struct.RawExclusiveLock.html b/ch6-dev/os/sync/up/struct.RawExclusiveLock.html new file mode 100644 index 00000000..7e4e8e62 --- /dev/null +++ b/ch6-dev/os/sync/up/struct.RawExclusiveLock.html @@ -0,0 +1,14 @@ +RawExclusiveLock in os::sync::up - Rust

    Struct os::sync::up::RawExclusiveLock

    source ·
    pub struct RawExclusiveLock(AtomicBool);
    Expand description

    The sync primitive used by easy-fs.

    +

    Tuple Fields§

    §0: AtomicBool

    Trait Implementations§

    source§

    impl RawMutex for RawExclusiveLock

    source§

    const INIT: Self = _

    Initial value for an unlocked mutex.
    §

    type GuardMarker = GuardNoSend

    Marker type which determines whether a lock guard should be Send. Use +one of the GuardSend or GuardNoSend helper types here.
    source§

    fn lock(&self)

    Acquires this mutex, blocking the current thread until it is able to do so.
    source§

    fn try_lock(&self) -> bool

    Attempts to acquire this mutex without blocking. Returns true +if the lock was successfully acquired and false otherwise.
    source§

    unsafe fn unlock(&self)

    Unlocks this mutex. Read more
    §

    fn is_locked(&self) -> bool

    Checks whether the mutex is currently locked.

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    +

    That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/sync/up/struct.UPSafeCell.html b/ch6-dev/os/sync/up/struct.UPSafeCell.html index 52784de0..88aa70b7 100644 --- a/ch6-dev/os/sync/up/struct.UPSafeCell.html +++ b/ch6-dev/os/sync/up/struct.UPSafeCell.html @@ -1,30 +1,25 @@ -UPSafeCell in os::sync::up - Rust - -
    -

    Struct os::sync::up::UPSafeCell

    source · []
    pub struct UPSafeCell<T> {
    +UPSafeCell in os::sync::up - Rust

    Struct os::sync::up::UPSafeCell

    source ·
    pub struct UPSafeCell<T> {
         inner: RefCell<T>,
    -}
    Expand description

    Wrap a static data structure inside it so that we are +}

    Expand description

    Wrap a static data structure inside it so that we are able to access it without any unsafe.

    We should only use it in uniprocessor.

    In order to get mutable reference of inner data, call exclusive_access.

    -

    Fields

    inner: RefCell<T>

    inner data

    -

    Implementations

    User is responsible to guarantee that inner struct is only used in +

    Fields§

    §inner: RefCell<T>

    inner data

    +

    Implementations§

    source§

    impl<T> UPSafeCell<T>

    source

    pub unsafe fn new(value: T) -> Self

    User is responsible to guarantee that inner struct is only used in uniprocessor.

    -

    Exclusive access inner data in UPSafeCell. Panic if the data has been borrowed.

    -

    Trait Implementations

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +
    source

    pub fn exclusive_access(&self) -> RefMut<'_, T>

    Exclusive access inner data in UPSafeCell. Panic if the data has been borrowed.

    +

    Trait Implementations§

    source§

    impl<T> Sync for UPSafeCell<T>

    Auto Trait Implementations§

    §

    impl<T> !RefUnwindSafe for UPSafeCell<T>

    §

    impl<T> Send for UPSafeCell<T>where + T: Send,

    §

    impl<T> Unpin for UPSafeCell<T>where + T: Unpin,

    §

    impl<T> UnwindSafe for UPSafeCell<T>where + T: UnwindSafe,

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/syscall/constant.SYSCALL_CLOSE.html b/ch6-dev/os/syscall/constant.SYSCALL_CLOSE.html index 74ba595a..06ba9551 100644 --- a/ch6-dev/os/syscall/constant.SYSCALL_CLOSE.html +++ b/ch6-dev/os/syscall/constant.SYSCALL_CLOSE.html @@ -1,8 +1 @@ -SYSCALL_CLOSE in os::syscall - Rust - -
    const SYSCALL_CLOSE: usize = 57;
    - \ No newline at end of file +SYSCALL_CLOSE in os::syscall - Rust

    Constant os::syscall::SYSCALL_CLOSE

    source ·
    const SYSCALL_CLOSE: usize = 57;
    \ No newline at end of file diff --git a/ch6-dev/os/syscall/constant.SYSCALL_EXEC.html b/ch6-dev/os/syscall/constant.SYSCALL_EXEC.html index 9f41ab69..f357b5ec 100644 --- a/ch6-dev/os/syscall/constant.SYSCALL_EXEC.html +++ b/ch6-dev/os/syscall/constant.SYSCALL_EXEC.html @@ -1,8 +1 @@ -SYSCALL_EXEC in os::syscall - Rust - -
    const SYSCALL_EXEC: usize = 221;
    - \ No newline at end of file +SYSCALL_EXEC in os::syscall - Rust

    Constant os::syscall::SYSCALL_EXEC

    source ·
    const SYSCALL_EXEC: usize = 221;
    \ No newline at end of file diff --git a/ch6-dev/os/syscall/constant.SYSCALL_EXIT.html b/ch6-dev/os/syscall/constant.SYSCALL_EXIT.html index e71ea061..341d1775 100644 --- a/ch6-dev/os/syscall/constant.SYSCALL_EXIT.html +++ b/ch6-dev/os/syscall/constant.SYSCALL_EXIT.html @@ -1,8 +1 @@ -SYSCALL_EXIT in os::syscall - Rust - -
    const SYSCALL_EXIT: usize = 93;
    - \ No newline at end of file +SYSCALL_EXIT in os::syscall - Rust

    Constant os::syscall::SYSCALL_EXIT

    source ·
    const SYSCALL_EXIT: usize = 93;
    \ No newline at end of file diff --git a/ch6-dev/os/syscall/constant.SYSCALL_FORK.html b/ch6-dev/os/syscall/constant.SYSCALL_FORK.html index 0e0fe560..a2ef2bb6 100644 --- a/ch6-dev/os/syscall/constant.SYSCALL_FORK.html +++ b/ch6-dev/os/syscall/constant.SYSCALL_FORK.html @@ -1,8 +1 @@ -SYSCALL_FORK in os::syscall - Rust - -
    const SYSCALL_FORK: usize = 220;
    - \ No newline at end of file +SYSCALL_FORK in os::syscall - Rust

    Constant os::syscall::SYSCALL_FORK

    source ·
    const SYSCALL_FORK: usize = 220;
    \ No newline at end of file diff --git a/ch6-dev/os/syscall/constant.SYSCALL_GETPID.html b/ch6-dev/os/syscall/constant.SYSCALL_GETPID.html index 3e6a5efd..350d9668 100644 --- a/ch6-dev/os/syscall/constant.SYSCALL_GETPID.html +++ b/ch6-dev/os/syscall/constant.SYSCALL_GETPID.html @@ -1,8 +1 @@ -SYSCALL_GETPID in os::syscall - Rust - -
    const SYSCALL_GETPID: usize = 172;
    - \ No newline at end of file +SYSCALL_GETPID in os::syscall - Rust

    Constant os::syscall::SYSCALL_GETPID

    source ·
    const SYSCALL_GETPID: usize = 172;
    \ No newline at end of file diff --git a/ch6-dev/os/syscall/constant.SYSCALL_GET_TIME.html b/ch6-dev/os/syscall/constant.SYSCALL_GET_TIME.html index 5233863e..6ca211be 100644 --- a/ch6-dev/os/syscall/constant.SYSCALL_GET_TIME.html +++ b/ch6-dev/os/syscall/constant.SYSCALL_GET_TIME.html @@ -1,8 +1 @@ -SYSCALL_GET_TIME in os::syscall - Rust - -
    const SYSCALL_GET_TIME: usize = 169;
    - \ No newline at end of file +SYSCALL_GET_TIME in os::syscall - Rust

    Constant os::syscall::SYSCALL_GET_TIME

    source ·
    const SYSCALL_GET_TIME: usize = 169;
    \ No newline at end of file diff --git a/ch6-dev/os/syscall/constant.SYSCALL_OPEN.html b/ch6-dev/os/syscall/constant.SYSCALL_OPEN.html index 88047045..187d2adc 100644 --- a/ch6-dev/os/syscall/constant.SYSCALL_OPEN.html +++ b/ch6-dev/os/syscall/constant.SYSCALL_OPEN.html @@ -1,8 +1 @@ -SYSCALL_OPEN in os::syscall - Rust - -
    const SYSCALL_OPEN: usize = 56;
    - \ No newline at end of file +SYSCALL_OPEN in os::syscall - Rust

    Constant os::syscall::SYSCALL_OPEN

    source ·
    const SYSCALL_OPEN: usize = 56;
    \ No newline at end of file diff --git a/ch6-dev/os/syscall/constant.SYSCALL_READ.html b/ch6-dev/os/syscall/constant.SYSCALL_READ.html index 9493ccdc..2c828555 100644 --- a/ch6-dev/os/syscall/constant.SYSCALL_READ.html +++ b/ch6-dev/os/syscall/constant.SYSCALL_READ.html @@ -1,8 +1 @@ -SYSCALL_READ in os::syscall - Rust - -
    const SYSCALL_READ: usize = 63;
    - \ No newline at end of file +SYSCALL_READ in os::syscall - Rust

    Constant os::syscall::SYSCALL_READ

    source ·
    const SYSCALL_READ: usize = 63;
    \ No newline at end of file diff --git a/ch6-dev/os/syscall/constant.SYSCALL_WAITPID.html b/ch6-dev/os/syscall/constant.SYSCALL_WAITPID.html index 86f7ac1e..4ca4c9be 100644 --- a/ch6-dev/os/syscall/constant.SYSCALL_WAITPID.html +++ b/ch6-dev/os/syscall/constant.SYSCALL_WAITPID.html @@ -1,8 +1 @@ -SYSCALL_WAITPID in os::syscall - Rust - -
    const SYSCALL_WAITPID: usize = 260;
    - \ No newline at end of file +SYSCALL_WAITPID in os::syscall - Rust

    Constant os::syscall::SYSCALL_WAITPID

    source ·
    const SYSCALL_WAITPID: usize = 260;
    \ No newline at end of file diff --git a/ch6-dev/os/syscall/constant.SYSCALL_WRITE.html b/ch6-dev/os/syscall/constant.SYSCALL_WRITE.html index 5f8ef985..7d1f7b0b 100644 --- a/ch6-dev/os/syscall/constant.SYSCALL_WRITE.html +++ b/ch6-dev/os/syscall/constant.SYSCALL_WRITE.html @@ -1,8 +1 @@ -SYSCALL_WRITE in os::syscall - Rust - -
    const SYSCALL_WRITE: usize = 64;
    - \ No newline at end of file +SYSCALL_WRITE in os::syscall - Rust

    Constant os::syscall::SYSCALL_WRITE

    source ·
    const SYSCALL_WRITE: usize = 64;
    \ No newline at end of file diff --git a/ch6-dev/os/syscall/constant.SYSCALL_YIELD.html b/ch6-dev/os/syscall/constant.SYSCALL_YIELD.html index 4bf4a980..88321e30 100644 --- a/ch6-dev/os/syscall/constant.SYSCALL_YIELD.html +++ b/ch6-dev/os/syscall/constant.SYSCALL_YIELD.html @@ -1,8 +1 @@ -SYSCALL_YIELD in os::syscall - Rust - -
    const SYSCALL_YIELD: usize = 124;
    - \ No newline at end of file +SYSCALL_YIELD in os::syscall - Rust

    Constant os::syscall::SYSCALL_YIELD

    source ·
    const SYSCALL_YIELD: usize = 124;
    \ No newline at end of file diff --git a/ch6-dev/os/syscall/fn.syscall.html b/ch6-dev/os/syscall/fn.syscall.html index d0eae4bd..e9c74d3c 100644 --- a/ch6-dev/os/syscall/fn.syscall.html +++ b/ch6-dev/os/syscall/fn.syscall.html @@ -1,9 +1,2 @@ -syscall in os::syscall - Rust - -
    -

    Function os::syscall::syscall

    source · []
    pub fn syscall(syscall_id: usize, args: [usize; 3]) -> isize
    Expand description

    handle syscall exception with syscall_id and other arguments

    -
    - \ No newline at end of file +syscall in os::syscall - Rust

    Function os::syscall::syscall

    source ·
    pub fn syscall(syscall_id: usize, args: [usize; 3]) -> isize
    Expand description

    handle syscall exception with syscall_id and other arguments

    +
    \ No newline at end of file diff --git a/ch6-dev/os/syscall/fs/fn.sys_close.html b/ch6-dev/os/syscall/fs/fn.sys_close.html index 3e3471a6..e61e0d1b 100644 --- a/ch6-dev/os/syscall/fs/fn.sys_close.html +++ b/ch6-dev/os/syscall/fs/fn.sys_close.html @@ -1,8 +1 @@ -sys_close in os::syscall::fs - Rust - -
    -

    Function os::syscall::fs::sys_close

    source · []
    pub fn sys_close(fd: usize) -> isize
    - \ No newline at end of file +sys_close in os::syscall::fs - Rust

    Function os::syscall::fs::sys_close

    source ·
    pub fn sys_close(fd: usize) -> isize
    \ No newline at end of file diff --git a/ch6-dev/os/syscall/fs/fn.sys_open.html b/ch6-dev/os/syscall/fs/fn.sys_open.html index 34f41857..65b7fa1b 100644 --- a/ch6-dev/os/syscall/fs/fn.sys_open.html +++ b/ch6-dev/os/syscall/fs/fn.sys_open.html @@ -1,8 +1 @@ -sys_open in os::syscall::fs - Rust - -
    -

    Function os::syscall::fs::sys_open

    source · []
    pub fn sys_open(path: *const u8, flags: u32) -> isize
    - \ No newline at end of file +sys_open in os::syscall::fs - Rust

    Function os::syscall::fs::sys_open

    source ·
    pub fn sys_open(path: *const u8, flags: u32) -> isize
    \ No newline at end of file diff --git a/ch6-dev/os/syscall/fs/fn.sys_read.html b/ch6-dev/os/syscall/fs/fn.sys_read.html index 17ff86fd..14af4b94 100644 --- a/ch6-dev/os/syscall/fs/fn.sys_read.html +++ b/ch6-dev/os/syscall/fs/fn.sys_read.html @@ -1,8 +1 @@ -sys_read in os::syscall::fs - Rust - -
    -

    Function os::syscall::fs::sys_read

    source · []
    pub fn sys_read(fd: usize, buf: *const u8, len: usize) -> isize
    - \ No newline at end of file +sys_read in os::syscall::fs - Rust

    Function os::syscall::fs::sys_read

    source ·
    pub fn sys_read(fd: usize, buf: *const u8, len: usize) -> isize
    \ No newline at end of file diff --git a/ch6-dev/os/syscall/fs/fn.sys_write.html b/ch6-dev/os/syscall/fs/fn.sys_write.html index 961b7436..ba8b01bd 100644 --- a/ch6-dev/os/syscall/fs/fn.sys_write.html +++ b/ch6-dev/os/syscall/fs/fn.sys_write.html @@ -1,8 +1 @@ -sys_write in os::syscall::fs - Rust - -
    -

    Function os::syscall::fs::sys_write

    source · []
    pub fn sys_write(fd: usize, buf: *const u8, len: usize) -> isize
    - \ No newline at end of file +sys_write in os::syscall::fs - Rust

    Function os::syscall::fs::sys_write

    source ·
    pub fn sys_write(fd: usize, buf: *const u8, len: usize) -> isize
    \ No newline at end of file diff --git a/ch6-dev/os/syscall/fs/index.html b/ch6-dev/os/syscall/fs/index.html index 70ce2c2e..0ce5cf99 100644 --- a/ch6-dev/os/syscall/fs/index.html +++ b/ch6-dev/os/syscall/fs/index.html @@ -1,10 +1,2 @@ -os::syscall::fs - Rust - -
    -

    Module os::syscall::fs

    source · []
    Expand description

    File and filesystem-related syscalls

    -

    Functions

    -
    - \ No newline at end of file +os::syscall::fs - Rust

    Module os::syscall::fs

    source ·
    Expand description

    File and filesystem-related syscalls

    +

    Functions

    \ No newline at end of file diff --git a/ch6-dev/os/syscall/fs/sidebar-items.js b/ch6-dev/os/syscall/fs/sidebar-items.js index e104a6f0..73bb9b45 100644 --- a/ch6-dev/os/syscall/fs/sidebar-items.js +++ b/ch6-dev/os/syscall/fs/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"fn":[["sys_close",""],["sys_open",""],["sys_read",""],["sys_write",""]]}); \ No newline at end of file +window.SIDEBAR_ITEMS = {"fn":["sys_close","sys_open","sys_read","sys_write"]}; \ No newline at end of file diff --git a/ch6-dev/os/syscall/index.html b/ch6-dev/os/syscall/index.html index 9abd44a5..2325f71a 100644 --- a/ch6-dev/os/syscall/index.html +++ b/ch6-dev/os/syscall/index.html @@ -1,22 +1,10 @@ -os::syscall - Rust - -
    -

    Module os::syscall

    source · []
    Expand description

    Implementation of syscalls

    -

    The single entry point to all system calls, syscall(), is called +os::syscall - Rust

    Module os::syscall

    source ·
    Expand description

    Implementation of syscalls

    +

    The single entry point to all system calls, syscall(), is called whenever userspace wishes to perform a system call using the ecall instruction. In this case, the processor raises an ‘Environment call from U-mode’ exception, which is handled as one of the cases in -crate::trap::trap_handler.

    +crate::trap::trap_handler.

    For clarity, each single syscall is implemented as its own function, named sys_ then the name of the syscall. You can find functions like this in submodules, and you should also implement syscalls this way.

    -

    Modules

    -
    fs 🔒

    File and filesystem-related syscalls

    -
    process 🔒

    Constants

    -

    Functions

    -

    handle syscall exception with syscall_id and other arguments

    -
    - \ No newline at end of file +

    Modules

    • fs 🔒
      File and filesystem-related syscalls
    • process 🔒

    Constants

    Functions

    • handle syscall exception with syscall_id and other arguments
    \ No newline at end of file diff --git a/ch6-dev/os/syscall/process/fn.sys_exec.html b/ch6-dev/os/syscall/process/fn.sys_exec.html index 78d91f39..829078c0 100644 --- a/ch6-dev/os/syscall/process/fn.sys_exec.html +++ b/ch6-dev/os/syscall/process/fn.sys_exec.html @@ -1,8 +1 @@ -sys_exec in os::syscall::process - Rust - -
    pub fn sys_exec(path: *const u8) -> isize
    - \ No newline at end of file +sys_exec in os::syscall::process - Rust

    Function os::syscall::process::sys_exec

    source ·
    pub fn sys_exec(path: *const u8) -> isize
    \ No newline at end of file diff --git a/ch6-dev/os/syscall/process/fn.sys_exit.html b/ch6-dev/os/syscall/process/fn.sys_exit.html index 4455a982..6d684faf 100644 --- a/ch6-dev/os/syscall/process/fn.sys_exit.html +++ b/ch6-dev/os/syscall/process/fn.sys_exit.html @@ -1,8 +1 @@ -sys_exit in os::syscall::process - Rust - -
    pub fn sys_exit(exit_code: i32) -> !
    - \ No newline at end of file +sys_exit in os::syscall::process - Rust

    Function os::syscall::process::sys_exit

    source ·
    pub fn sys_exit(exit_code: i32) -> !
    \ No newline at end of file diff --git a/ch6-dev/os/syscall/process/fn.sys_fork.html b/ch6-dev/os/syscall/process/fn.sys_fork.html index 32ff7296..e56df4b8 100644 --- a/ch6-dev/os/syscall/process/fn.sys_fork.html +++ b/ch6-dev/os/syscall/process/fn.sys_fork.html @@ -1,8 +1 @@ -sys_fork in os::syscall::process - Rust - -
    pub fn sys_fork() -> isize
    - \ No newline at end of file +sys_fork in os::syscall::process - Rust

    Function os::syscall::process::sys_fork

    source ·
    pub fn sys_fork() -> isize
    \ No newline at end of file diff --git a/ch6-dev/os/syscall/process/fn.sys_get_time.html b/ch6-dev/os/syscall/process/fn.sys_get_time.html index 67e92816..5d5f7a7e 100644 --- a/ch6-dev/os/syscall/process/fn.sys_get_time.html +++ b/ch6-dev/os/syscall/process/fn.sys_get_time.html @@ -1,8 +1 @@ -sys_get_time in os::syscall::process - Rust - -
    pub fn sys_get_time() -> isize
    - \ No newline at end of file +sys_get_time in os::syscall::process - Rust

    Function os::syscall::process::sys_get_time

    source ·
    pub fn sys_get_time() -> isize
    \ No newline at end of file diff --git a/ch6-dev/os/syscall/process/fn.sys_getpid.html b/ch6-dev/os/syscall/process/fn.sys_getpid.html index 0f919c59..e11ffb87 100644 --- a/ch6-dev/os/syscall/process/fn.sys_getpid.html +++ b/ch6-dev/os/syscall/process/fn.sys_getpid.html @@ -1,8 +1 @@ -sys_getpid in os::syscall::process - Rust - -
    pub fn sys_getpid() -> isize
    - \ No newline at end of file +sys_getpid in os::syscall::process - Rust

    Function os::syscall::process::sys_getpid

    source ·
    pub fn sys_getpid() -> isize
    \ No newline at end of file diff --git a/ch6-dev/os/syscall/process/fn.sys_waitpid.html b/ch6-dev/os/syscall/process/fn.sys_waitpid.html index a24959fe..edb9ca37 100644 --- a/ch6-dev/os/syscall/process/fn.sys_waitpid.html +++ b/ch6-dev/os/syscall/process/fn.sys_waitpid.html @@ -1,10 +1,3 @@ -sys_waitpid in os::syscall::process - Rust - -
    pub fn sys_waitpid(pid: isize, exit_code_ptr: *mut i32) -> isize
    Expand description

    If there is not a child process whose pid is same as given, return -1. +sys_waitpid in os::syscall::process - Rust

    Function os::syscall::process::sys_waitpid

    source ·
    pub fn sys_waitpid(pid: isize, exit_code_ptr: *mut i32) -> isize
    Expand description

    If there is not a child process whose pid is same as given, return -1. Else if there is a child process but it is still running, return -2.

    -
    - \ No newline at end of file +
    \ No newline at end of file diff --git a/ch6-dev/os/syscall/process/fn.sys_yield.html b/ch6-dev/os/syscall/process/fn.sys_yield.html index 25478be0..9394cfd2 100644 --- a/ch6-dev/os/syscall/process/fn.sys_yield.html +++ b/ch6-dev/os/syscall/process/fn.sys_yield.html @@ -1,8 +1 @@ -sys_yield in os::syscall::process - Rust - -
    pub fn sys_yield() -> isize
    - \ No newline at end of file +sys_yield in os::syscall::process - Rust

    Function os::syscall::process::sys_yield

    source ·
    pub fn sys_yield() -> isize
    \ No newline at end of file diff --git a/ch6-dev/os/syscall/process/index.html b/ch6-dev/os/syscall/process/index.html index 1ea53cd8..25102bc6 100644 --- a/ch6-dev/os/syscall/process/index.html +++ b/ch6-dev/os/syscall/process/index.html @@ -1,11 +1,2 @@ -os::syscall::process - Rust - -
    -

    Module os::syscall::process

    source · []

    Functions

    -

    If there is not a child process whose pid is same as given, return -1. -Else if there is a child process but it is still running, return -2.

    -
    - \ No newline at end of file +os::syscall::process - Rust

    Module os::syscall::process

    source ·

    Functions

    \ No newline at end of file diff --git a/ch6-dev/os/syscall/process/sidebar-items.js b/ch6-dev/os/syscall/process/sidebar-items.js index 5d43519f..c7cff172 100644 --- a/ch6-dev/os/syscall/process/sidebar-items.js +++ b/ch6-dev/os/syscall/process/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"fn":[["sys_exec",""],["sys_exit",""],["sys_fork",""],["sys_get_time",""],["sys_getpid",""],["sys_waitpid","If there is not a child process whose pid is same as given, return -1. Else if there is a child process but it is still running, return -2."],["sys_yield",""]]}); \ No newline at end of file +window.SIDEBAR_ITEMS = {"fn":["sys_exec","sys_exit","sys_fork","sys_get_time","sys_getpid","sys_waitpid","sys_yield"]}; \ No newline at end of file diff --git a/ch6-dev/os/syscall/sidebar-items.js b/ch6-dev/os/syscall/sidebar-items.js index c9722296..202b0227 100644 --- a/ch6-dev/os/syscall/sidebar-items.js +++ b/ch6-dev/os/syscall/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"constant":[["SYSCALL_CLOSE",""],["SYSCALL_EXEC",""],["SYSCALL_EXIT",""],["SYSCALL_FORK",""],["SYSCALL_GETPID",""],["SYSCALL_GET_TIME",""],["SYSCALL_OPEN",""],["SYSCALL_READ",""],["SYSCALL_WAITPID",""],["SYSCALL_WRITE",""],["SYSCALL_YIELD",""]],"fn":[["syscall","handle syscall exception with `syscall_id` and other arguments"]],"mod":[["fs","File and filesystem-related syscalls"],["process",""]]}); \ No newline at end of file +window.SIDEBAR_ITEMS = {"constant":["SYSCALL_CLOSE","SYSCALL_EXEC","SYSCALL_EXIT","SYSCALL_FORK","SYSCALL_GETPID","SYSCALL_GET_TIME","SYSCALL_OPEN","SYSCALL_READ","SYSCALL_WAITPID","SYSCALL_WRITE","SYSCALL_YIELD"],"fn":["syscall"],"mod":["fs","process"]}; \ No newline at end of file diff --git a/ch6-dev/os/task/constant.IDLE_PID.html b/ch6-dev/os/task/constant.IDLE_PID.html index ee6cbfd5..35b9e6d5 100644 --- a/ch6-dev/os/task/constant.IDLE_PID.html +++ b/ch6-dev/os/task/constant.IDLE_PID.html @@ -1,9 +1,2 @@ -IDLE_PID in os::task - Rust - -
    -

    Constant os::task::IDLE_PID

    source · []
    pub const IDLE_PID: usize = 0;
    Expand description

    pid of usertests app in make run TEST=1

    -
    - \ No newline at end of file +IDLE_PID in os::task - Rust

    Constant os::task::IDLE_PID

    source ·
    pub const IDLE_PID: usize = 0;
    Expand description

    pid of usertests app in make run TEST=1

    +
    \ No newline at end of file diff --git a/ch6-dev/os/task/context/index.html b/ch6-dev/os/task/context/index.html index 209177cd..0fed0d17 100644 --- a/ch6-dev/os/task/context/index.html +++ b/ch6-dev/os/task/context/index.html @@ -1,11 +1,2 @@ -os::task::context - Rust - -
    -

    Module os::task::context

    source · []
    Expand description

    Implementation of TaskContext

    -

    Structs

    -

    task context structure containing some registers

    -
    - \ No newline at end of file +os::task::context - Rust

    Module os::task::context

    source ·
    Expand description

    Implementation of TaskContext

    +

    Structs

    • task context structure containing some registers
    \ No newline at end of file diff --git a/ch6-dev/os/task/context/sidebar-items.js b/ch6-dev/os/task/context/sidebar-items.js index c68c1891..f64436cc 100644 --- a/ch6-dev/os/task/context/sidebar-items.js +++ b/ch6-dev/os/task/context/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"struct":[["TaskContext","task context structure containing some registers"]]}); \ No newline at end of file +window.SIDEBAR_ITEMS = {"struct":["TaskContext"]}; \ No newline at end of file diff --git a/ch6-dev/os/task/context/struct.TaskContext.html b/ch6-dev/os/task/context/struct.TaskContext.html index f596bb56..49ceaaf9 100644 --- a/ch6-dev/os/task/context/struct.TaskContext.html +++ b/ch6-dev/os/task/context/struct.TaskContext.html @@ -1,29 +1,21 @@ -TaskContext in os::task::context - Rust - -
    #[repr(C)]
    pub struct TaskContext { +TaskContext in os::task::context - Rust

    Struct os::task::context::TaskContext

    source ·
    #[repr(C)]
    pub struct TaskContext { ra: usize, sp: usize, - s: [usize; 12], -}
    Expand description

    task context structure containing some registers

    -

    Fields

    ra: usize

    return address ( e.g. __restore ) of __switch ASM function

    -
    sp: usize

    kernel stack pointer of app

    -
    s: [usize; 12]

    s0-11 register, callee saved

    -

    Implementations

    init task context

    -

    set Task Context{__restore ASM funciton: trap_return, sp: kstack_ptr, s: s_0..12}

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    + s: [usize; 12], +}
    Expand description

    task context structure containing some registers

    +

    Fields§

    §ra: usize

    return address ( e.g. __restore ) of __switch ASM function

    +
    §sp: usize

    kernel stack pointer of app

    +
    §s: [usize; 12]

    s0-11 register, callee saved

    +

    Implementations§

    source§

    impl TaskContext

    source

    pub fn zero_init() -> Self

    init task context

    +
    source

    pub fn goto_trap_return(kstack_ptr: usize) -> Self

    set Task Context{__restore ASM funciton: trap_return, sp: kstack_ptr, s: s_0..12}

    +

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/task/fn.add_initproc.html b/ch6-dev/os/task/fn.add_initproc.html index b6f7029d..1eb272dd 100644 --- a/ch6-dev/os/task/fn.add_initproc.html +++ b/ch6-dev/os/task/fn.add_initproc.html @@ -1,9 +1,2 @@ -add_initproc in os::task - Rust - -
    -

    Function os::task::add_initproc

    source · []
    pub fn add_initproc()
    Expand description

    Add init process to the manager

    -
    - \ No newline at end of file +add_initproc in os::task - Rust

    Function os::task::add_initproc

    source ·
    pub fn add_initproc()
    Expand description

    Add init process to the manager

    +
    \ No newline at end of file diff --git a/ch6-dev/os/task/fn.add_task.html b/ch6-dev/os/task/fn.add_task.html index f9e1b627..c88b999b 100644 --- a/ch6-dev/os/task/fn.add_task.html +++ b/ch6-dev/os/task/fn.add_task.html @@ -1,9 +1,2 @@ -add_task in os::task - Rust - -
    -

    Function os::task::add_task

    source · []
    pub fn add_task(task: Arc<TaskControlBlock>)
    Expand description

    Interface offered to add task

    -
    - \ No newline at end of file +add_task in os::task - Rust

    Function os::task::add_task

    source ·
    pub fn add_task(task: Arc<TaskControlBlock>)
    Expand description

    Interface offered to add task

    +
    \ No newline at end of file diff --git a/ch6-dev/os/task/fn.current_task.html b/ch6-dev/os/task/fn.current_task.html index 08c15734..8306af47 100644 --- a/ch6-dev/os/task/fn.current_task.html +++ b/ch6-dev/os/task/fn.current_task.html @@ -1,9 +1,2 @@ -current_task in os::task - Rust - -
    -

    Function os::task::current_task

    source · []
    pub fn current_task() -> Option<Arc<TaskControlBlock>>
    Expand description

    Get running task

    -
    - \ No newline at end of file +current_task in os::task - Rust

    Function os::task::current_task

    source ·
    pub fn current_task() -> Option<Arc<TaskControlBlock>>
    Expand description

    Get running task

    +
    \ No newline at end of file diff --git a/ch6-dev/os/task/fn.current_trap_cx.html b/ch6-dev/os/task/fn.current_trap_cx.html index 3a49b090..293cd33c 100644 --- a/ch6-dev/os/task/fn.current_trap_cx.html +++ b/ch6-dev/os/task/fn.current_trap_cx.html @@ -1,9 +1,2 @@ -current_trap_cx in os::task - Rust - -
    pub fn current_trap_cx() -> &'static mut TrapContext
    Expand description

    Get the mutable reference to trap context of current task

    -
    - \ No newline at end of file +current_trap_cx in os::task - Rust

    Function os::task::current_trap_cx

    source ·
    pub fn current_trap_cx() -> &'static mut TrapContext
    Expand description

    Get the mutable reference to trap context of current task

    +
    \ No newline at end of file diff --git a/ch6-dev/os/task/fn.current_user_token.html b/ch6-dev/os/task/fn.current_user_token.html index 18e6e449..66e6c27a 100644 --- a/ch6-dev/os/task/fn.current_user_token.html +++ b/ch6-dev/os/task/fn.current_user_token.html @@ -1,9 +1,2 @@ -current_user_token in os::task - Rust - -
    pub fn current_user_token() -> usize
    Expand description

    Get token of the address space of current task

    -
    - \ No newline at end of file +current_user_token in os::task - Rust

    Function os::task::current_user_token

    source ·
    pub fn current_user_token() -> usize
    Expand description

    Get token of the address space of current task

    +
    \ No newline at end of file diff --git a/ch6-dev/os/task/fn.exit_current_and_run_next.html b/ch6-dev/os/task/fn.exit_current_and_run_next.html index b429ae77..88f0dc87 100644 --- a/ch6-dev/os/task/fn.exit_current_and_run_next.html +++ b/ch6-dev/os/task/fn.exit_current_and_run_next.html @@ -1,9 +1,2 @@ -exit_current_and_run_next in os::task - Rust - -
    pub fn exit_current_and_run_next(exit_code: i32)
    Expand description

    Exit the current ‘Running’ task and run the next task in task list.

    -
    - \ No newline at end of file +exit_current_and_run_next in os::task - Rust
    pub fn exit_current_and_run_next(exit_code: i32)
    Expand description

    Exit the current ‘Running’ task and run the next task in task list.

    +
    \ No newline at end of file diff --git a/ch6-dev/os/task/fn.fetch_task.html b/ch6-dev/os/task/fn.fetch_task.html index 6e62c16f..2d27aa7c 100644 --- a/ch6-dev/os/task/fn.fetch_task.html +++ b/ch6-dev/os/task/fn.fetch_task.html @@ -1,9 +1,2 @@ -fetch_task in os::task - Rust - -
    -

    Function os::task::fetch_task

    source · []
    pub fn fetch_task() -> Option<Arc<TaskControlBlock>>
    Expand description

    Interface offered to pop the first task

    -
    - \ No newline at end of file +fetch_task in os::task - Rust

    Function os::task::fetch_task

    source ·
    pub fn fetch_task() -> Option<Arc<TaskControlBlock>>
    Expand description

    Interface offered to pop the first task

    +
    \ No newline at end of file diff --git a/ch6-dev/os/task/fn.pid_alloc.html b/ch6-dev/os/task/fn.pid_alloc.html index 435d7577..4cf1a968 100644 --- a/ch6-dev/os/task/fn.pid_alloc.html +++ b/ch6-dev/os/task/fn.pid_alloc.html @@ -1,9 +1,2 @@ -pid_alloc in os::task - Rust - -
    -

    Function os::task::pid_alloc

    source · []
    pub fn pid_alloc() -> PidHandle
    Expand description

    Allocate a pid from PID_ALLOCATOR

    -
    - \ No newline at end of file +pid_alloc in os::task - Rust

    Function os::task::pid_alloc

    source ·
    pub fn pid_alloc() -> PidHandle
    Expand description

    Allocate a pid from PID_ALLOCATOR

    +
    \ No newline at end of file diff --git a/ch6-dev/os/task/fn.run_tasks.html b/ch6-dev/os/task/fn.run_tasks.html index 0f2a2d6c..fde15911 100644 --- a/ch6-dev/os/task/fn.run_tasks.html +++ b/ch6-dev/os/task/fn.run_tasks.html @@ -1,10 +1,3 @@ -run_tasks in os::task - Rust - -
    -

    Function os::task::run_tasks

    source · []
    pub fn run_tasks()
    Expand description

    The main part of process execution and scheduling +run_tasks in os::task - Rust

    Function os::task::run_tasks

    source ·
    pub fn run_tasks()
    Expand description

    The main part of process execution and scheduling Loop fetch_task to get the process that needs to run, and switch the process through __switch

    -
    - \ No newline at end of file +
    \ No newline at end of file diff --git a/ch6-dev/os/task/fn.schedule.html b/ch6-dev/os/task/fn.schedule.html index 6f39f65b..142ea291 100644 --- a/ch6-dev/os/task/fn.schedule.html +++ b/ch6-dev/os/task/fn.schedule.html @@ -1,9 +1,2 @@ -schedule in os::task - Rust - -
    -

    Function os::task::schedule

    source · []
    pub fn schedule(switched_task_cx_ptr: *mut TaskContext)
    Expand description

    Return to idle control flow for new scheduling

    -
    - \ No newline at end of file +schedule in os::task - Rust

    Function os::task::schedule

    source ·
    pub fn schedule(switched_task_cx_ptr: *mut TaskContext)
    Expand description

    Return to idle control flow for new scheduling

    +
    \ No newline at end of file diff --git a/ch6-dev/os/task/fn.suspend_current_and_run_next.html b/ch6-dev/os/task/fn.suspend_current_and_run_next.html index 2f0dd6d0..492144f0 100644 --- a/ch6-dev/os/task/fn.suspend_current_and_run_next.html +++ b/ch6-dev/os/task/fn.suspend_current_and_run_next.html @@ -1,9 +1,2 @@ -suspend_current_and_run_next in os::task - Rust - -
    pub fn suspend_current_and_run_next()
    Expand description

    Suspend the current ‘Running’ task and run the next task in task list.

    -
    - \ No newline at end of file +suspend_current_and_run_next in os::task - Rust
    pub fn suspend_current_and_run_next()
    Expand description

    Suspend the current ‘Running’ task and run the next task in task list.

    +
    \ No newline at end of file diff --git a/ch6-dev/os/task/fn.take_current_task.html b/ch6-dev/os/task/fn.take_current_task.html index 0219d701..c8466f8a 100644 --- a/ch6-dev/os/task/fn.take_current_task.html +++ b/ch6-dev/os/task/fn.take_current_task.html @@ -1,9 +1,2 @@ -take_current_task in os::task - Rust - -
    pub fn take_current_task() -> Option<Arc<TaskControlBlock>>
    Expand description

    Take the current task,leaving a None in its place

    -
    - \ No newline at end of file +take_current_task in os::task - Rust

    Function os::task::take_current_task

    source ·
    pub fn take_current_task() -> Option<Arc<TaskControlBlock>>
    Expand description

    Take the current task,leaving a None in its place

    +
    \ No newline at end of file diff --git a/ch6-dev/os/task/index.html b/ch6-dev/os/task/index.html index 6d277ff3..c3882030 100644 --- a/ch6-dev/os/task/index.html +++ b/ch6-dev/os/task/index.html @@ -1,50 +1,13 @@ -os::task - Rust - -
    -

    Module os::task

    source · []
    Expand description

    Task management implementation

    +os::task - Rust

    Module os::task

    source ·
    Expand description

    Task management implementation

    Everything about task management, like starting and switching tasks is implemented here.

    -

    A single global instance of TaskManager called TASK_MANAGER controls +

    A single global instance of TaskManager called TASK_MANAGER controls all the tasks in the whole operating system.

    -

    A single global instance of Processor called PROCESSOR monitors running +

    A single global instance of Processor called PROCESSOR monitors running task(s) for each core.

    -

    A single global instance of PidAllocator called PID_ALLOCATOR allocates +

    A single global instance of PidAllocator called PID_ALLOCATOR allocates pid for user apps.

    Be careful when you see __switch ASM function in switch.S. Control flow around this function might not be what you expect.

    -

    Modules

    -
    context 🔒

    Implementation of TaskContext

    -
    manager 🔒

    Implementation of TaskManager

    -
    pid 🔒

    Implementation of PidAllocator

    -
    processor 🔒

    Implementation of Processor and Intersection of control flow

    -
    switch 🔒

    Wrap switch.S as a function

    -
    task 🔒

    Implementation of TaskControlBlock

    -

    Structs

    -

    Globle process that init user shell

    -

    Kernelstack for app

    -

    Pid Allocator struct

    -

    Bind pid lifetime to PidHandle

    -

    Processor management structure

    -

    task context structure containing some registers

    -

    A array of TaskControlBlock that is thread-safe

    -

    Constants

    -

    pid of usertests app in make run TEST=1

    -

    Functions

    -

    Add init process to the manager

    -

    Interface offered to add task

    -

    Get running task

    -

    Get the mutable reference to trap context of current task

    -

    Get token of the address space of current task

    -

    Exit the current ‘Running’ task and run the next task in task list.

    -

    Interface offered to pop the first task

    -

    Allocate a pid from PID_ALLOCATOR

    -

    The main part of process execution and scheduling -Loop fetch_task to get the process that needs to run, and switch the process through __switch

    -

    Return to idle control flow for new scheduling

    -

    Suspend the current ‘Running’ task and run the next task in task list.

    -

    Take the current task,leaving a None in its place

    -
    - \ No newline at end of file +

    Modules

    Structs

    Constants

    • pid of usertests app in make run TEST=1

    Functions

    \ No newline at end of file diff --git a/ch6-dev/os/task/manager/fn.add_task.html b/ch6-dev/os/task/manager/fn.add_task.html index cf550e9a..f101e4fc 100644 --- a/ch6-dev/os/task/manager/fn.add_task.html +++ b/ch6-dev/os/task/manager/fn.add_task.html @@ -1,9 +1,2 @@ -add_task in os::task::manager - Rust - -
    -

    Function os::task::manager::add_task

    source · []
    pub fn add_task(task: Arc<TaskControlBlock>)
    Expand description

    Interface offered to add task

    -
    - \ No newline at end of file +add_task in os::task::manager - Rust

    Function os::task::manager::add_task

    source ·
    pub fn add_task(task: Arc<TaskControlBlock>)
    Expand description

    Interface offered to add task

    +
    \ No newline at end of file diff --git a/ch6-dev/os/task/manager/fn.fetch_task.html b/ch6-dev/os/task/manager/fn.fetch_task.html index ae80d78b..080b520b 100644 --- a/ch6-dev/os/task/manager/fn.fetch_task.html +++ b/ch6-dev/os/task/manager/fn.fetch_task.html @@ -1,9 +1,2 @@ -fetch_task in os::task::manager - Rust - -
    pub fn fetch_task() -> Option<Arc<TaskControlBlock>>
    Expand description

    Interface offered to pop the first task

    -
    - \ No newline at end of file +fetch_task in os::task::manager - Rust

    Function os::task::manager::fetch_task

    source ·
    pub fn fetch_task() -> Option<Arc<TaskControlBlock>>
    Expand description

    Interface offered to pop the first task

    +
    \ No newline at end of file diff --git a/ch6-dev/os/task/manager/index.html b/ch6-dev/os/task/manager/index.html index ef4a8063..e3cf325f 100644 --- a/ch6-dev/os/task/manager/index.html +++ b/ch6-dev/os/task/manager/index.html @@ -1,14 +1,2 @@ -os::task::manager - Rust - -
    -

    Module os::task::manager

    source · []
    Expand description

    Implementation of TaskManager

    -

    Structs

    -

    A array of TaskControlBlock that is thread-safe

    -

    Functions

    -

    Interface offered to add task

    -

    Interface offered to pop the first task

    -
    - \ No newline at end of file +os::task::manager - Rust

    Module os::task::manager

    source ·
    Expand description

    Implementation of TaskManager

    +

    Structs

    Functions

    \ No newline at end of file diff --git a/ch6-dev/os/task/manager/sidebar-items.js b/ch6-dev/os/task/manager/sidebar-items.js index 66fe2851..4f27ad34 100644 --- a/ch6-dev/os/task/manager/sidebar-items.js +++ b/ch6-dev/os/task/manager/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"fn":[["add_task","Interface offered to add task"],["fetch_task","Interface offered to pop the first task"]],"struct":[["TASK_MANAGER",""],["TaskManager","A array of `TaskControlBlock` that is thread-safe"]]}); \ No newline at end of file +window.SIDEBAR_ITEMS = {"fn":["add_task","fetch_task"],"struct":["TASK_MANAGER","TaskManager"]}; \ No newline at end of file diff --git a/ch6-dev/os/task/manager/struct.TASK_MANAGER.html b/ch6-dev/os/task/manager/struct.TASK_MANAGER.html index f6b2ea71..4d15e8d2 100644 --- a/ch6-dev/os/task/manager/struct.TASK_MANAGER.html +++ b/ch6-dev/os/task/manager/struct.TASK_MANAGER.html @@ -1,24 +1,14 @@ -TASK_MANAGER in os::task::manager - Rust - -
    pub struct TASK_MANAGER {
    +TASK_MANAGER in os::task::manager - Rust

    Struct os::task::manager::TASK_MANAGER

    source ·
    pub struct TASK_MANAGER {
         __private_field: (),
    -}

    Fields

    __private_field: ()

    Methods from Deref<Target = UPSafeCell<TaskManager>>

    Exclusive access inner data in UPSafeCell. Panic if the data has been borrowed.

    -

    Trait Implementations

    The resulting type after dereferencing.

    -

    Dereferences the value.

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +}

    Fields§

    §__private_field: ()

    Methods from Deref<Target = UPSafeCell<TaskManager>>§

    source

    pub fn exclusive_access(&self) -> RefMut<'_, T>

    Exclusive access inner data in UPSafeCell. Panic if the data has been borrowed.

    +

    Trait Implementations§

    source§

    impl Deref for TASK_MANAGER

    §

    type Target = UPSafeCell<TaskManager>

    The resulting type after dereferencing.
    source§

    fn deref(&self) -> &UPSafeCell<TaskManager>

    Dereferences the value.
    source§

    impl LazyStatic for TASK_MANAGER

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/task/manager/struct.TaskManager.html b/ch6-dev/os/task/manager/struct.TaskManager.html index be9d8d65..e8518360 100644 --- a/ch6-dev/os/task/manager/struct.TaskManager.html +++ b/ch6-dev/os/task/manager/struct.TaskManager.html @@ -1,26 +1,18 @@ -TaskManager in os::task::manager - Rust - -
    pub struct TaskManager {
    +TaskManager in os::task::manager - Rust

    Struct os::task::manager::TaskManager

    source ·
    pub struct TaskManager {
         ready_queue: VecDeque<Arc<TaskControlBlock>>,
    -}
    Expand description

    A array of TaskControlBlock that is thread-safe

    -

    Fields

    ready_queue: VecDeque<Arc<TaskControlBlock>>

    Implementations

    A simple FIFO scheduler.

    -

    Creat an empty TaskManager

    -

    Add a task to TaskManager

    -

    Remove the first task and return it,or None if TaskManager is empty

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +}
    Expand description

    A array of TaskControlBlock that is thread-safe

    +

    Fields§

    §ready_queue: VecDeque<Arc<TaskControlBlock>>

    Implementations§

    source§

    impl TaskManager

    A simple FIFO scheduler.

    +
    source

    pub fn new() -> Self

    Creat an empty TaskManager

    +
    source

    pub fn add(&mut self, task: Arc<TaskControlBlock>)

    Add a task to TaskManager

    +
    source

    pub fn fetch(&mut self) -> Option<Arc<TaskControlBlock>>

    Remove the first task and return it,or None if TaskManager is empty

    +

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/task/pid/fn.kernel_stack_position.html b/ch6-dev/os/task/pid/fn.kernel_stack_position.html index 1d753eb5..05f462a2 100644 --- a/ch6-dev/os/task/pid/fn.kernel_stack_position.html +++ b/ch6-dev/os/task/pid/fn.kernel_stack_position.html @@ -1,9 +1,2 @@ -kernel_stack_position in os::task::pid - Rust - -
    pub fn kernel_stack_position(app_id: usize) -> (usize, usize)
    Expand description

    Return (bottom, top) of a kernel stack in kernel space.

    -
    - \ No newline at end of file +kernel_stack_position in os::task::pid - Rust

    Function os::task::pid::kernel_stack_position

    source ·
    pub fn kernel_stack_position(app_id: usize) -> (usize, usize)
    Expand description

    Return (bottom, top) of a kernel stack in kernel space.

    +
    \ No newline at end of file diff --git a/ch6-dev/os/task/pid/fn.pid_alloc.html b/ch6-dev/os/task/pid/fn.pid_alloc.html index 609c8046..8599352c 100644 --- a/ch6-dev/os/task/pid/fn.pid_alloc.html +++ b/ch6-dev/os/task/pid/fn.pid_alloc.html @@ -1,9 +1,2 @@ -pid_alloc in os::task::pid - Rust - -
    -

    Function os::task::pid::pid_alloc

    source · []
    pub fn pid_alloc() -> PidHandle
    Expand description

    Allocate a pid from PID_ALLOCATOR

    -
    - \ No newline at end of file +pid_alloc in os::task::pid - Rust

    Function os::task::pid::pid_alloc

    source ·
    pub fn pid_alloc() -> PidHandle
    Expand description

    Allocate a pid from PID_ALLOCATOR

    +
    \ No newline at end of file diff --git a/ch6-dev/os/task/pid/index.html b/ch6-dev/os/task/pid/index.html index 282c53d2..80be16d4 100644 --- a/ch6-dev/os/task/pid/index.html +++ b/ch6-dev/os/task/pid/index.html @@ -1,16 +1,2 @@ -os::task::pid - Rust - -
    -

    Module os::task::pid

    source · []
    Expand description

    Implementation of PidAllocator

    -

    Structs

    -

    Kernelstack for app

    -

    Pid Allocator struct

    -

    Bind pid lifetime to PidHandle

    -

    Functions

    -

    Return (bottom, top) of a kernel stack in kernel space.

    -

    Allocate a pid from PID_ALLOCATOR

    -
    - \ No newline at end of file +os::task::pid - Rust

    Module os::task::pid

    source ·
    Expand description

    Implementation of PidAllocator

    +

    Structs

    Functions

    \ No newline at end of file diff --git a/ch6-dev/os/task/pid/sidebar-items.js b/ch6-dev/os/task/pid/sidebar-items.js index 4a77f7f7..8392d298 100644 --- a/ch6-dev/os/task/pid/sidebar-items.js +++ b/ch6-dev/os/task/pid/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"fn":[["kernel_stack_position","Return (bottom, top) of a kernel stack in kernel space."],["pid_alloc","Allocate a pid from PID_ALLOCATOR"]],"struct":[["KernelStack","Kernelstack for app"],["PID_ALLOCATOR",""],["PidAllocator","Pid Allocator struct"],["PidHandle","Bind pid lifetime to `PidHandle`"]]}); \ No newline at end of file +window.SIDEBAR_ITEMS = {"fn":["kernel_stack_position","pid_alloc"],"struct":["KernelStack","PID_ALLOCATOR","PidAllocator","PidHandle"]}; \ No newline at end of file diff --git a/ch6-dev/os/task/pid/struct.KernelStack.html b/ch6-dev/os/task/pid/struct.KernelStack.html index 5c77859a..afa40ac9 100644 --- a/ch6-dev/os/task/pid/struct.KernelStack.html +++ b/ch6-dev/os/task/pid/struct.KernelStack.html @@ -1,26 +1,18 @@ -KernelStack in os::task::pid - Rust - -
    pub struct KernelStack {
    +KernelStack in os::task::pid - Rust

    Struct os::task::pid::KernelStack

    source ·
    pub struct KernelStack {
         pid: usize,
    -}
    Expand description

    Kernelstack for app

    -

    Fields

    pid: usize

    Implementations

    Create a kernelstack from pid

    -

    Push a value on top of kernelstack

    -

    Get the value on the top of kernelstack

    -

    Trait Implementations

    Executes the destructor for this type. Read more

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +}
    Expand description

    Kernelstack for app

    +

    Fields§

    §pid: usize

    Implementations§

    source§

    impl KernelStack

    source

    pub fn new(pid_handle: &PidHandle) -> Self

    Create a kernelstack from pid

    +
    source

    pub fn push_on_top<T>(&self, value: T) -> *mut Twhere + T: Sized,

    Push a value on top of kernelstack

    +
    source

    pub fn get_top(&self) -> usize

    Get the value on the top of kernelstack

    +

    Trait Implementations§

    source§

    impl Drop for KernelStack

    source§

    fn drop(&mut self)

    Executes the destructor for this type. Read more

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/task/pid/struct.PID_ALLOCATOR.html b/ch6-dev/os/task/pid/struct.PID_ALLOCATOR.html index 450533db..1d230b19 100644 --- a/ch6-dev/os/task/pid/struct.PID_ALLOCATOR.html +++ b/ch6-dev/os/task/pid/struct.PID_ALLOCATOR.html @@ -1,24 +1,14 @@ -PID_ALLOCATOR in os::task::pid - Rust - -
    pub struct PID_ALLOCATOR {
    +PID_ALLOCATOR in os::task::pid - Rust

    Struct os::task::pid::PID_ALLOCATOR

    source ·
    pub struct PID_ALLOCATOR {
         __private_field: (),
    -}

    Fields

    __private_field: ()

    Methods from Deref<Target = UPSafeCell<PidAllocator>>

    Exclusive access inner data in UPSafeCell. Panic if the data has been borrowed.

    -

    Trait Implementations

    The resulting type after dereferencing.

    -

    Dereferences the value.

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +}

    Fields§

    §__private_field: ()

    Methods from Deref<Target = UPSafeCell<PidAllocator>>§

    source

    pub fn exclusive_access(&self) -> RefMut<'_, T>

    Exclusive access inner data in UPSafeCell. Panic if the data has been borrowed.

    +

    Trait Implementations§

    source§

    impl Deref for PID_ALLOCATOR

    §

    type Target = UPSafeCell<PidAllocator>

    The resulting type after dereferencing.
    source§

    fn deref(&self) -> &UPSafeCell<PidAllocator>

    Dereferences the value.
    source§

    impl LazyStatic for PID_ALLOCATOR

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/task/pid/struct.PidAllocator.html b/ch6-dev/os/task/pid/struct.PidAllocator.html index 60033447..1b4855a4 100644 --- a/ch6-dev/os/task/pid/struct.PidAllocator.html +++ b/ch6-dev/os/task/pid/struct.PidAllocator.html @@ -1,26 +1,18 @@ -PidAllocator in os::task::pid - Rust - -
    pub struct PidAllocator {
    +PidAllocator in os::task::pid - Rust

    Struct os::task::pid::PidAllocator

    source ·
    pub struct PidAllocator {
         current: usize,
         recycled: Vec<usize>,
    -}
    Expand description

    Pid Allocator struct

    -

    Fields

    current: usizerecycled: Vec<usize>

    Implementations

    Create an empty PidAllocator

    -

    Allocate a pid

    -

    Recycle a pid

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +}
    Expand description

    Pid Allocator struct

    +

    Fields§

    §current: usize§recycled: Vec<usize>

    Implementations§

    source§

    impl PidAllocator

    source

    pub fn new() -> Self

    Create an empty PidAllocator

    +
    source

    pub fn alloc(&mut self) -> PidHandle

    Allocate a pid

    +
    source

    pub fn dealloc(&mut self, pid: usize)

    Recycle a pid

    +

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/task/pid/struct.PidHandle.html b/ch6-dev/os/task/pid/struct.PidHandle.html index 2440db00..2f41be36 100644 --- a/ch6-dev/os/task/pid/struct.PidHandle.html +++ b/ch6-dev/os/task/pid/struct.PidHandle.html @@ -1,21 +1,12 @@ -PidHandle in os::task::pid - Rust - -
    -

    Struct os::task::pid::PidHandle

    source · []
    pub struct PidHandle(pub usize);
    Expand description

    Bind pid lifetime to PidHandle

    -

    Tuple Fields

    0: usize

    Trait Implementations

    Executes the destructor for this type. Read more

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +PidHandle in os::task::pid - Rust

    Struct os::task::pid::PidHandle

    source ·
    pub struct PidHandle(pub usize);
    Expand description

    Bind pid lifetime to PidHandle

    +

    Tuple Fields§

    §0: usize

    Trait Implementations§

    source§

    impl Drop for PidHandle

    source§

    fn drop(&mut self)

    Executes the destructor for this type. Read more

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/task/processor/fn.current_task.html b/ch6-dev/os/task/processor/fn.current_task.html index 0735123c..b89ecbb4 100644 --- a/ch6-dev/os/task/processor/fn.current_task.html +++ b/ch6-dev/os/task/processor/fn.current_task.html @@ -1,9 +1,2 @@ -current_task in os::task::processor - Rust - -
    pub fn current_task() -> Option<Arc<TaskControlBlock>>
    Expand description

    Get running task

    -
    - \ No newline at end of file +current_task in os::task::processor - Rust

    Function os::task::processor::current_task

    source ·
    pub fn current_task() -> Option<Arc<TaskControlBlock>>
    Expand description

    Get running task

    +
    \ No newline at end of file diff --git a/ch6-dev/os/task/processor/fn.current_trap_cx.html b/ch6-dev/os/task/processor/fn.current_trap_cx.html index 5cafec54..2c0ef498 100644 --- a/ch6-dev/os/task/processor/fn.current_trap_cx.html +++ b/ch6-dev/os/task/processor/fn.current_trap_cx.html @@ -1,9 +1,2 @@ -current_trap_cx in os::task::processor - Rust - -
    pub fn current_trap_cx() -> &'static mut TrapContext
    Expand description

    Get the mutable reference to trap context of current task

    -
    - \ No newline at end of file +current_trap_cx in os::task::processor - Rust

    Function os::task::processor::current_trap_cx

    source ·
    pub fn current_trap_cx() -> &'static mut TrapContext
    Expand description

    Get the mutable reference to trap context of current task

    +
    \ No newline at end of file diff --git a/ch6-dev/os/task/processor/fn.current_user_token.html b/ch6-dev/os/task/processor/fn.current_user_token.html index 1223abb4..61122ac5 100644 --- a/ch6-dev/os/task/processor/fn.current_user_token.html +++ b/ch6-dev/os/task/processor/fn.current_user_token.html @@ -1,9 +1,2 @@ -current_user_token in os::task::processor - Rust - -
    pub fn current_user_token() -> usize
    Expand description

    Get token of the address space of current task

    -
    - \ No newline at end of file +current_user_token in os::task::processor - Rust
    pub fn current_user_token() -> usize
    Expand description

    Get token of the address space of current task

    +
    \ No newline at end of file diff --git a/ch6-dev/os/task/processor/fn.run_tasks.html b/ch6-dev/os/task/processor/fn.run_tasks.html index 2016e34f..d8a6d6cc 100644 --- a/ch6-dev/os/task/processor/fn.run_tasks.html +++ b/ch6-dev/os/task/processor/fn.run_tasks.html @@ -1,10 +1,3 @@ -run_tasks in os::task::processor - Rust - -
    pub fn run_tasks()
    Expand description

    The main part of process execution and scheduling +run_tasks in os::task::processor - Rust

    Function os::task::processor::run_tasks

    source ·
    pub fn run_tasks()
    Expand description

    The main part of process execution and scheduling Loop fetch_task to get the process that needs to run, and switch the process through __switch

    -
    - \ No newline at end of file +
    \ No newline at end of file diff --git a/ch6-dev/os/task/processor/fn.schedule.html b/ch6-dev/os/task/processor/fn.schedule.html index 00df90ea..02470d31 100644 --- a/ch6-dev/os/task/processor/fn.schedule.html +++ b/ch6-dev/os/task/processor/fn.schedule.html @@ -1,9 +1,2 @@ -schedule in os::task::processor - Rust - -
    pub fn schedule(switched_task_cx_ptr: *mut TaskContext)
    Expand description

    Return to idle control flow for new scheduling

    -
    - \ No newline at end of file +schedule in os::task::processor - Rust

    Function os::task::processor::schedule

    source ·
    pub fn schedule(switched_task_cx_ptr: *mut TaskContext)
    Expand description

    Return to idle control flow for new scheduling

    +
    \ No newline at end of file diff --git a/ch6-dev/os/task/processor/fn.take_current_task.html b/ch6-dev/os/task/processor/fn.take_current_task.html index 5041f930..8545c8cf 100644 --- a/ch6-dev/os/task/processor/fn.take_current_task.html +++ b/ch6-dev/os/task/processor/fn.take_current_task.html @@ -1,9 +1,2 @@ -take_current_task in os::task::processor - Rust - -
    pub fn take_current_task() -> Option<Arc<TaskControlBlock>>
    Expand description

    Take the current task,leaving a None in its place

    -
    - \ No newline at end of file +take_current_task in os::task::processor - Rust
    pub fn take_current_task() -> Option<Arc<TaskControlBlock>>
    Expand description

    Take the current task,leaving a None in its place

    +
    \ No newline at end of file diff --git a/ch6-dev/os/task/processor/index.html b/ch6-dev/os/task/processor/index.html index e3a83114..ed6018f8 100644 --- a/ch6-dev/os/task/processor/index.html +++ b/ch6-dev/os/task/processor/index.html @@ -1,19 +1,3 @@ -os::task::processor - Rust - -
    -

    Module os::task::processor

    source · []
    Expand description

    Implementation of Processor and Intersection of control flow

    -

    Structs

    -

    Processor management structure

    -

    Functions

    -

    Get running task

    -

    Get the mutable reference to trap context of current task

    -

    Get token of the address space of current task

    -

    The main part of process execution and scheduling -Loop fetch_task to get the process that needs to run, and switch the process through __switch

    -

    Return to idle control flow for new scheduling

    -

    Take the current task,leaving a None in its place

    -
    - \ No newline at end of file +os::task::processor - Rust

    Module os::task::processor

    source ·
    Expand description

    Implementation of Processor and Intersection of control flow

    +

    Structs

    Functions

    • Get running task
    • Get the mutable reference to trap context of current task
    • Get token of the address space of current task
    • The main part of process execution and scheduling +Loop fetch_task to get the process that needs to run, and switch the process through __switch
    • Return to idle control flow for new scheduling
    • Take the current task,leaving a None in its place
    \ No newline at end of file diff --git a/ch6-dev/os/task/processor/sidebar-items.js b/ch6-dev/os/task/processor/sidebar-items.js index 1ffd68de..567a9a18 100644 --- a/ch6-dev/os/task/processor/sidebar-items.js +++ b/ch6-dev/os/task/processor/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"fn":[["current_task","Get running task"],["current_trap_cx","Get the mutable reference to trap context of current task"],["current_user_token","Get token of the address space of current task"],["run_tasks","The main part of process execution and scheduling Loop `fetch_task` to get the process that needs to run, and switch the process through `__switch`"],["schedule","Return to idle control flow for new scheduling"],["take_current_task","Take the current task,leaving a None in its place"]],"struct":[["PROCESSOR",""],["Processor","Processor management structure"]]}); \ No newline at end of file +window.SIDEBAR_ITEMS = {"fn":["current_task","current_trap_cx","current_user_token","run_tasks","schedule","take_current_task"],"struct":["PROCESSOR","Processor"]}; \ No newline at end of file diff --git a/ch6-dev/os/task/processor/struct.PROCESSOR.html b/ch6-dev/os/task/processor/struct.PROCESSOR.html index bd114840..00bdc4df 100644 --- a/ch6-dev/os/task/processor/struct.PROCESSOR.html +++ b/ch6-dev/os/task/processor/struct.PROCESSOR.html @@ -1,24 +1,14 @@ -PROCESSOR in os::task::processor - Rust - -
    pub struct PROCESSOR {
    +PROCESSOR in os::task::processor - Rust

    Struct os::task::processor::PROCESSOR

    source ·
    pub struct PROCESSOR {
         __private_field: (),
    -}

    Fields

    __private_field: ()

    Methods from Deref<Target = UPSafeCell<Processor>>

    Exclusive access inner data in UPSafeCell. Panic if the data has been borrowed.

    -

    Trait Implementations

    The resulting type after dereferencing.

    -

    Dereferences the value.

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +}

    Fields§

    §__private_field: ()

    Methods from Deref<Target = UPSafeCell<Processor>>§

    source

    pub fn exclusive_access(&self) -> RefMut<'_, T>

    Exclusive access inner data in UPSafeCell. Panic if the data has been borrowed.

    +

    Trait Implementations§

    source§

    impl Deref for PROCESSOR

    §

    type Target = UPSafeCell<Processor>

    The resulting type after dereferencing.
    source§

    fn deref(&self) -> &UPSafeCell<Processor>

    Dereferences the value.
    source§

    impl LazyStatic for PROCESSOR

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/task/processor/struct.Processor.html b/ch6-dev/os/task/processor/struct.Processor.html index 7b7da15f..fd743a7d 100644 --- a/ch6-dev/os/task/processor/struct.Processor.html +++ b/ch6-dev/os/task/processor/struct.Processor.html @@ -1,29 +1,21 @@ -Processor in os::task::processor - Rust - -
    pub struct Processor {
    +Processor in os::task::processor - Rust

    Struct os::task::processor::Processor

    source ·
    pub struct Processor {
         current: Option<Arc<TaskControlBlock>>,
         idle_task_cx: TaskContext,
    -}
    Expand description

    Processor management structure

    -

    Fields

    current: Option<Arc<TaskControlBlock>>

    The task currently executing on the current processor

    -
    idle_task_cx: TaskContext

    The basic control flow of each core, helping to select and switch process

    -

    Implementations

    Create an empty Processor

    -

    Get mutable reference to idle_task_cx

    -

    Get current task in moving semanteme

    -

    Get current task in cloning semanteme

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +}
    Expand description

    Processor management structure

    +

    Fields§

    §current: Option<Arc<TaskControlBlock>>

    The task currently executing on the current processor

    +
    §idle_task_cx: TaskContext

    The basic control flow of each core, helping to select and switch process

    +

    Implementations§

    source§

    impl Processor

    source

    pub fn new() -> Self

    Create an empty Processor

    +
    source

    fn get_idle_task_cx_ptr(&mut self) -> *mut TaskContext

    Get mutable reference to idle_task_cx

    +
    source

    pub fn take_current(&mut self) -> Option<Arc<TaskControlBlock>>

    Get current task in moving semanteme

    +
    source

    pub fn current(&self) -> Option<Arc<TaskControlBlock>>

    Get current task in cloning semanteme

    +

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/task/sidebar-items.js b/ch6-dev/os/task/sidebar-items.js index 7eb28cf4..d5317e17 100644 --- a/ch6-dev/os/task/sidebar-items.js +++ b/ch6-dev/os/task/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"constant":[["IDLE_PID","pid of usertests app in make run TEST=1"]],"fn":[["add_initproc","Add init process to the manager"],["add_task","Interface offered to add task"],["current_task","Get running task"],["current_trap_cx","Get the mutable reference to trap context of current task"],["current_user_token","Get token of the address space of current task"],["exit_current_and_run_next","Exit the current ‘Running’ task and run the next task in task list."],["fetch_task","Interface offered to pop the first task"],["pid_alloc","Allocate a pid from PID_ALLOCATOR"],["run_tasks","The main part of process execution and scheduling Loop `fetch_task` to get the process that needs to run, and switch the process through `__switch`"],["schedule","Return to idle control flow for new scheduling"],["suspend_current_and_run_next","Suspend the current ‘Running’ task and run the next task in task list."],["take_current_task","Take the current task,leaving a None in its place"]],"mod":[["context","Implementation of [`TaskContext`]"],["manager","Implementation of [`TaskManager`]"],["pid","Implementation of [`PidAllocator`]"],["processor","Implementation of [`Processor`] and Intersection of control flow"],["switch","Wrap `switch.S` as a function"],["task","Implementation of [`TaskControlBlock`]"]],"struct":[["INITPROC","Globle process that init user shell"],["KernelStack","Kernelstack for app"],["PidAllocator","Pid Allocator struct"],["PidHandle","Bind pid lifetime to `PidHandle`"],["Processor","Processor management structure"],["TaskContext","task context structure containing some registers"],["TaskManager","A array of `TaskControlBlock` that is thread-safe"]]}); \ No newline at end of file +window.SIDEBAR_ITEMS = {"constant":["IDLE_PID"],"fn":["add_initproc","add_task","current_task","current_trap_cx","current_user_token","exit_current_and_run_next","fetch_task","pid_alloc","run_tasks","schedule","suspend_current_and_run_next","take_current_task"],"mod":["context","manager","pid","processor","switch","task"],"struct":["INITPROC","KernelStack","PidAllocator","PidHandle","Processor","TaskContext","TaskManager"]}; \ No newline at end of file diff --git a/ch6-dev/os/task/struct.INITPROC.html b/ch6-dev/os/task/struct.INITPROC.html index 40b72825..a82ca21d 100644 --- a/ch6-dev/os/task/struct.INITPROC.html +++ b/ch6-dev/os/task/struct.INITPROC.html @@ -1,24 +1,14 @@ -INITPROC in os::task - Rust - -
    -

    Struct os::task::INITPROC

    source · []
    pub struct INITPROC {
    +INITPROC in os::task - Rust

    Struct os::task::INITPROC

    source ·
    pub struct INITPROC {
         __private_field: (),
    -}
    Expand description

    Globle process that init user shell

    -

    Fields

    __private_field: ()

    Trait Implementations

    The resulting type after dereferencing.

    -

    Dereferences the value.

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +}
    Expand description

    Globle process that init user shell

    +

    Fields§

    §__private_field: ()

    Trait Implementations§

    source§

    impl Deref for INITPROC

    §

    type Target = Arc<TaskControlBlock, Global>

    The resulting type after dereferencing.
    source§

    fn deref(&self) -> &Arc<TaskControlBlock>

    Dereferences the value.
    source§

    impl LazyStatic for INITPROC

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/task/struct.KernelStack.html b/ch6-dev/os/task/struct.KernelStack.html index 1354995f..3d4f1c11 100644 --- a/ch6-dev/os/task/struct.KernelStack.html +++ b/ch6-dev/os/task/struct.KernelStack.html @@ -1,26 +1,18 @@ -KernelStack in os::task - Rust - -
    pub struct KernelStack {
    +KernelStack in os::task - Rust

    Struct os::task::KernelStack

    source ·
    pub struct KernelStack {
         pid: usize,
    -}
    Expand description

    Kernelstack for app

    -

    Fields

    pid: usize

    Implementations

    Create a kernelstack from pid

    -

    Push a value on top of kernelstack

    -

    Get the value on the top of kernelstack

    -

    Trait Implementations

    Executes the destructor for this type. Read more

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +}
    Expand description

    Kernelstack for app

    +

    Fields§

    §pid: usize

    Implementations§

    source§

    impl KernelStack

    source

    pub fn new(pid_handle: &PidHandle) -> Self

    Create a kernelstack from pid

    +
    source

    pub fn push_on_top<T>(&self, value: T) -> *mut Twhere + T: Sized,

    Push a value on top of kernelstack

    +
    source

    pub fn get_top(&self) -> usize

    Get the value on the top of kernelstack

    +

    Trait Implementations§

    source§

    impl Drop for KernelStack

    source§

    fn drop(&mut self)

    Executes the destructor for this type. Read more

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/task/struct.PidAllocator.html b/ch6-dev/os/task/struct.PidAllocator.html index 98512e49..e00c1cc6 100644 --- a/ch6-dev/os/task/struct.PidAllocator.html +++ b/ch6-dev/os/task/struct.PidAllocator.html @@ -1,26 +1,18 @@ -PidAllocator in os::task - Rust - -
    pub struct PidAllocator {
    +PidAllocator in os::task - Rust

    Struct os::task::PidAllocator

    source ·
    pub struct PidAllocator {
         current: usize,
         recycled: Vec<usize>,
    -}
    Expand description

    Pid Allocator struct

    -

    Fields

    current: usizerecycled: Vec<usize>

    Implementations

    Create an empty PidAllocator

    -

    Allocate a pid

    -

    Recycle a pid

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +}
    Expand description

    Pid Allocator struct

    +

    Fields§

    §current: usize§recycled: Vec<usize>

    Implementations§

    source§

    impl PidAllocator

    source

    pub fn new() -> Self

    Create an empty PidAllocator

    +
    source

    pub fn alloc(&mut self) -> PidHandle

    Allocate a pid

    +
    source

    pub fn dealloc(&mut self, pid: usize)

    Recycle a pid

    +

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/task/struct.PidHandle.html b/ch6-dev/os/task/struct.PidHandle.html index 1433284b..cc55ffe7 100644 --- a/ch6-dev/os/task/struct.PidHandle.html +++ b/ch6-dev/os/task/struct.PidHandle.html @@ -1,21 +1,12 @@ -PidHandle in os::task - Rust - -
    -

    Struct os::task::PidHandle

    source · []
    pub struct PidHandle(pub usize);
    Expand description

    Bind pid lifetime to PidHandle

    -

    Tuple Fields

    0: usize

    Trait Implementations

    Executes the destructor for this type. Read more

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +PidHandle in os::task - Rust

    Struct os::task::PidHandle

    source ·
    pub struct PidHandle(pub usize);
    Expand description

    Bind pid lifetime to PidHandle

    +

    Tuple Fields§

    §0: usize

    Trait Implementations§

    source§

    impl Drop for PidHandle

    source§

    fn drop(&mut self)

    Executes the destructor for this type. Read more

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/task/struct.Processor.html b/ch6-dev/os/task/struct.Processor.html index 9abb91cb..b982e912 100644 --- a/ch6-dev/os/task/struct.Processor.html +++ b/ch6-dev/os/task/struct.Processor.html @@ -1,29 +1,21 @@ -Processor in os::task - Rust - -
    -

    Struct os::task::Processor

    source · []
    pub struct Processor {
    +Processor in os::task - Rust

    Struct os::task::Processor

    source ·
    pub struct Processor {
         current: Option<Arc<TaskControlBlock>>,
         idle_task_cx: TaskContext,
    -}
    Expand description

    Processor management structure

    -

    Fields

    current: Option<Arc<TaskControlBlock>>

    The task currently executing on the current processor

    -
    idle_task_cx: TaskContext

    The basic control flow of each core, helping to select and switch process

    -

    Implementations

    Create an empty Processor

    -

    Get mutable reference to idle_task_cx

    -

    Get current task in moving semanteme

    -

    Get current task in cloning semanteme

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +}
    Expand description

    Processor management structure

    +

    Fields§

    §current: Option<Arc<TaskControlBlock>>

    The task currently executing on the current processor

    +
    §idle_task_cx: TaskContext

    The basic control flow of each core, helping to select and switch process

    +

    Implementations§

    source§

    impl Processor

    source

    pub fn new() -> Self

    Create an empty Processor

    +
    source

    fn get_idle_task_cx_ptr(&mut self) -> *mut TaskContext

    Get mutable reference to idle_task_cx

    +
    source

    pub fn take_current(&mut self) -> Option<Arc<TaskControlBlock>>

    Get current task in moving semanteme

    +
    source

    pub fn current(&self) -> Option<Arc<TaskControlBlock>>

    Get current task in cloning semanteme

    +

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/task/struct.TaskContext.html b/ch6-dev/os/task/struct.TaskContext.html index ae64a01c..67729232 100644 --- a/ch6-dev/os/task/struct.TaskContext.html +++ b/ch6-dev/os/task/struct.TaskContext.html @@ -1,29 +1,21 @@ -TaskContext in os::task - Rust - -
    #[repr(C)]
    pub struct TaskContext { +TaskContext in os::task - Rust

    Struct os::task::TaskContext

    source ·
    #[repr(C)]
    pub struct TaskContext { ra: usize, sp: usize, - s: [usize; 12], -}
    Expand description

    task context structure containing some registers

    -

    Fields

    ra: usize

    return address ( e.g. __restore ) of __switch ASM function

    -
    sp: usize

    kernel stack pointer of app

    -
    s: [usize; 12]

    s0-11 register, callee saved

    -

    Implementations

    init task context

    -

    set Task Context{__restore ASM funciton: trap_return, sp: kstack_ptr, s: s_0..12}

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    + s: [usize; 12], +}
    Expand description

    task context structure containing some registers

    +

    Fields§

    §ra: usize

    return address ( e.g. __restore ) of __switch ASM function

    +
    §sp: usize

    kernel stack pointer of app

    +
    §s: [usize; 12]

    s0-11 register, callee saved

    +

    Implementations§

    source§

    impl TaskContext

    source

    pub fn zero_init() -> Self

    init task context

    +
    source

    pub fn goto_trap_return(kstack_ptr: usize) -> Self

    set Task Context{__restore ASM funciton: trap_return, sp: kstack_ptr, s: s_0..12}

    +

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/task/struct.TaskManager.html b/ch6-dev/os/task/struct.TaskManager.html index 1628852a..a904b98f 100644 --- a/ch6-dev/os/task/struct.TaskManager.html +++ b/ch6-dev/os/task/struct.TaskManager.html @@ -1,26 +1,18 @@ -TaskManager in os::task - Rust - -
    pub struct TaskManager {
    +TaskManager in os::task - Rust

    Struct os::task::TaskManager

    source ·
    pub struct TaskManager {
         ready_queue: VecDeque<Arc<TaskControlBlock>>,
    -}
    Expand description

    A array of TaskControlBlock that is thread-safe

    -

    Fields

    ready_queue: VecDeque<Arc<TaskControlBlock>>

    Implementations

    A simple FIFO scheduler.

    -

    Creat an empty TaskManager

    -

    Add a task to TaskManager

    -

    Remove the first task and return it,or None if TaskManager is empty

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +}
    Expand description

    A array of TaskControlBlock that is thread-safe

    +

    Fields§

    §ready_queue: VecDeque<Arc<TaskControlBlock>>

    Implementations§

    source§

    impl TaskManager

    A simple FIFO scheduler.

    +
    source

    pub fn new() -> Self

    Creat an empty TaskManager

    +
    source

    pub fn add(&mut self, task: Arc<TaskControlBlock>)

    Add a task to TaskManager

    +
    source

    pub fn fetch(&mut self) -> Option<Arc<TaskControlBlock>>

    Remove the first task and return it,or None if TaskManager is empty

    +

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/task/switch/fn.__switch.html b/ch6-dev/os/task/switch/fn.__switch.html index b609d6fc..fe2ca3b4 100644 --- a/ch6-dev/os/task/switch/fn.__switch.html +++ b/ch6-dev/os/task/switch/fn.__switch.html @@ -1,8 +1,4 @@ -__switch in os::task::switch - Rust - -
    -

    Function os::task::switch::__switch

    source · []
    pub unsafe extern "C" fn __switch(
        current_task_cx_ptr: *mut TaskContext,
        next_task_cx_ptr: *const TaskContext
    )
    - \ No newline at end of file +__switch in os::task::switch - Rust

    Function os::task::switch::__switch

    source ·
    pub unsafe extern "C" fn __switch(
    +    current_task_cx_ptr: *mut TaskContext,
    +    next_task_cx_ptr: *const TaskContext
    +)
    \ No newline at end of file diff --git a/ch6-dev/os/task/switch/index.html b/ch6-dev/os/task/switch/index.html index 2a16118b..a5a5f151 100644 --- a/ch6-dev/os/task/switch/index.html +++ b/ch6-dev/os/task/switch/index.html @@ -1,10 +1,2 @@ -os::task::switch - Rust - -
    -

    Module os::task::switch

    source · []
    Expand description

    Wrap switch.S as a function

    -

    Functions

    -
    - \ No newline at end of file +os::task::switch - Rust

    Module os::task::switch

    source ·
    Expand description

    Wrap switch.S as a function

    +

    Functions

    \ No newline at end of file diff --git a/ch6-dev/os/task/switch/sidebar-items.js b/ch6-dev/os/task/switch/sidebar-items.js index 59e64029..8dea751a 100644 --- a/ch6-dev/os/task/switch/sidebar-items.js +++ b/ch6-dev/os/task/switch/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"fn":[["__switch",""]]}); \ No newline at end of file +window.SIDEBAR_ITEMS = {"fn":["__switch"]}; \ No newline at end of file diff --git a/ch6-dev/os/task/task/enum.TaskStatus.html b/ch6-dev/os/task/task/enum.TaskStatus.html index 2a7240bc..a7c18555 100644 --- a/ch6-dev/os/task/task/enum.TaskStatus.html +++ b/ch6-dev/os/task/task/enum.TaskStatus.html @@ -1,31 +1,18 @@ -TaskStatus in os::task::task - Rust - -
    pub enum TaskStatus {
    +TaskStatus in os::task::task - Rust

    Enum os::task::task::TaskStatus

    source ·
    pub enum TaskStatus {
         Ready,
         Running,
         Zombie,
    -}

    Variants

    Ready

    Running

    Zombie

    Trait Implementations

    Returns a copy of the value. Read more

    -

    Performs copy-assignment from source. Read more

    -

    This method tests for self and other values to be equal, and is used -by ==. Read more

    -

    This method tests for !=.

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +}

    Variants§

    §

    Ready

    §

    Running

    §

    Zombie

    Trait Implementations§

    source§

    impl Clone for TaskStatus

    source§

    fn clone(&self) -> TaskStatus

    Returns a copy of the value. Read more
    1.0.0 · source§

    fn clone_from(&mut self, source: &Self)

    Performs copy-assignment from source. Read more
    source§

    impl PartialEq<TaskStatus> for TaskStatus

    source§

    fn eq(&self, other: &TaskStatus) -> bool

    This method tests for self and other values to be equal, and is used +by ==.
    1.0.0 · source§

    fn ne(&self, other: &Rhs) -> bool

    This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
    source§

    impl Copy for TaskStatus

    source§

    impl StructuralPartialEq for TaskStatus

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The resulting type after obtaining ownership.

    -

    Creates owned data from borrowed data, usually by cloning. Read more

    -
    🔬 This is a nightly-only experimental API. (toowned_clone_into)

    Uses borrowed data to replace owned data, usually by cloning. Read more

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T> ToOwned for Twhere + T: Clone,

    §

    type Owned = T

    The resulting type after obtaining ownership.
    source§

    fn to_owned(&self) -> T

    Creates owned data from borrowed data, usually by cloning. Read more
    source§

    fn clone_into(&self, target: &mut T)

    Uses borrowed data to replace owned data, usually by cloning. Read more
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/task/task/index.html b/ch6-dev/os/task/task/index.html index b988ddaa..40201be8 100644 --- a/ch6-dev/os/task/task/index.html +++ b/ch6-dev/os/task/task/index.html @@ -1,11 +1,2 @@ -os::task::task - Rust - -
    - \ No newline at end of file +os::task::task - Rust
    \ No newline at end of file diff --git a/ch6-dev/os/task/task/sidebar-items.js b/ch6-dev/os/task/task/sidebar-items.js index dd3e5786..e3e27912 100644 --- a/ch6-dev/os/task/task/sidebar-items.js +++ b/ch6-dev/os/task/task/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"enum":[["TaskStatus",""]],"struct":[["TaskControlBlock",""],["TaskControlBlockInner",""]]}); \ No newline at end of file +window.SIDEBAR_ITEMS = {"enum":["TaskStatus"],"struct":["TaskControlBlock","TaskControlBlockInner"]}; \ No newline at end of file diff --git a/ch6-dev/os/task/task/struct.TaskControlBlock.html b/ch6-dev/os/task/task/struct.TaskControlBlock.html index 193bfa3d..e8aa73d7 100644 --- a/ch6-dev/os/task/task/struct.TaskControlBlock.html +++ b/ch6-dev/os/task/task/struct.TaskControlBlock.html @@ -1,23 +1,15 @@ -TaskControlBlock in os::task::task - Rust - -
    pub struct TaskControlBlock {
    +TaskControlBlock in os::task::task - Rust

    Struct os::task::task::TaskControlBlock

    source ·
    pub struct TaskControlBlock {
         pub pid: PidHandle,
         pub kernel_stack: KernelStack,
         inner: UPSafeCell<TaskControlBlockInner>,
    -}

    Fields

    pid: PidHandlekernel_stack: KernelStackinner: UPSafeCell<TaskControlBlockInner>

    Implementations

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +}

    Fields§

    §pid: PidHandle§kernel_stack: KernelStack§inner: UPSafeCell<TaskControlBlockInner>

    Implementations§

    source§

    impl TaskControlBlock

    source

    pub fn inner_exclusive_access(&self) -> RefMut<'_, TaskControlBlockInner>

    source

    pub fn new(elf_data: &[u8]) -> Self

    source

    pub fn exec(&self, elf_data: &[u8])

    source

    pub fn fork(self: &Arc<TaskControlBlock>) -> Arc<TaskControlBlock>

    source

    pub fn getpid(&self) -> usize

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/task/task/struct.TaskControlBlockInner.html b/ch6-dev/os/task/task/struct.TaskControlBlockInner.html index 136a5601..6efa4c17 100644 --- a/ch6-dev/os/task/task/struct.TaskControlBlockInner.html +++ b/ch6-dev/os/task/task/struct.TaskControlBlockInner.html @@ -1,10 +1,4 @@ -TaskControlBlockInner in os::task::task - Rust - -
    pub struct TaskControlBlockInner {
    +TaskControlBlockInner in os::task::task - Rust
    pub struct TaskControlBlockInner {
         pub trap_cx_ppn: PhysPageNum,
         pub base_size: usize,
         pub task_cx: TaskContext,
    @@ -14,16 +8,14 @@
         pub children: Vec<Arc<TaskControlBlock>>,
         pub exit_code: i32,
         pub fd_table: Vec<Option<Arc<dyn File + Send + Sync>>>,
    -}

    Fields

    trap_cx_ppn: PhysPageNumbase_size: usizetask_cx: TaskContexttask_status: TaskStatusmemory_set: MemorySetparent: Option<Weak<TaskControlBlock>>children: Vec<Arc<TaskControlBlock>>exit_code: i32fd_table: Vec<Option<Arc<dyn File + Send + Sync>>>

    Implementations

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +}

    Fields§

    §trap_cx_ppn: PhysPageNum§base_size: usize§task_cx: TaskContext§task_status: TaskStatus§memory_set: MemorySet§parent: Option<Weak<TaskControlBlock>>§children: Vec<Arc<TaskControlBlock>>§exit_code: i32§fd_table: Vec<Option<Arc<dyn File + Send + Sync>>>

    Implementations§

    source§

    impl TaskControlBlockInner

    source

    pub fn get_trap_cx(&self) -> &'static mut TrapContext

    source

    pub fn get_user_token(&self) -> usize

    source

    fn get_status(&self) -> TaskStatus

    source

    pub fn is_zombie(&self) -> bool

    source

    pub fn alloc_fd(&mut self) -> usize

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/timer/constant.MSEC_PER_SEC.html b/ch6-dev/os/timer/constant.MSEC_PER_SEC.html index 5cf83142..38b28724 100644 --- a/ch6-dev/os/timer/constant.MSEC_PER_SEC.html +++ b/ch6-dev/os/timer/constant.MSEC_PER_SEC.html @@ -1,8 +1 @@ -MSEC_PER_SEC in os::timer - Rust - -
    -

    Constant os::timer::MSEC_PER_SEC

    source · []
    const MSEC_PER_SEC: usize = 1000;
    - \ No newline at end of file +MSEC_PER_SEC in os::timer - Rust

    Constant os::timer::MSEC_PER_SEC

    source ·
    const MSEC_PER_SEC: usize = 1000;
    \ No newline at end of file diff --git a/ch6-dev/os/timer/constant.TICKS_PER_SEC.html b/ch6-dev/os/timer/constant.TICKS_PER_SEC.html index f75f843f..13cd686d 100644 --- a/ch6-dev/os/timer/constant.TICKS_PER_SEC.html +++ b/ch6-dev/os/timer/constant.TICKS_PER_SEC.html @@ -1,8 +1 @@ -TICKS_PER_SEC in os::timer - Rust - -
    const TICKS_PER_SEC: usize = 100;
    - \ No newline at end of file +TICKS_PER_SEC in os::timer - Rust

    Constant os::timer::TICKS_PER_SEC

    source ·
    const TICKS_PER_SEC: usize = 100;
    \ No newline at end of file diff --git a/ch6-dev/os/timer/fn.get_time.html b/ch6-dev/os/timer/fn.get_time.html index dba4c631..824ae03f 100644 --- a/ch6-dev/os/timer/fn.get_time.html +++ b/ch6-dev/os/timer/fn.get_time.html @@ -1,9 +1,2 @@ -get_time in os::timer - Rust - -
    -

    Function os::timer::get_time

    source · []
    pub fn get_time() -> usize
    Expand description

    get current time

    -
    - \ No newline at end of file +get_time in os::timer - Rust

    Function os::timer::get_time

    source ·
    pub fn get_time() -> usize
    Expand description

    get current time

    +
    \ No newline at end of file diff --git a/ch6-dev/os/timer/fn.get_time_ms.html b/ch6-dev/os/timer/fn.get_time_ms.html index 7982032f..e6805486 100644 --- a/ch6-dev/os/timer/fn.get_time_ms.html +++ b/ch6-dev/os/timer/fn.get_time_ms.html @@ -1,9 +1,2 @@ -get_time_ms in os::timer - Rust - -
    -

    Function os::timer::get_time_ms

    source · []
    pub fn get_time_ms() -> usize
    Expand description

    get current time in microseconds

    -
    - \ No newline at end of file +get_time_ms in os::timer - Rust

    Function os::timer::get_time_ms

    source ·
    pub fn get_time_ms() -> usize
    Expand description

    get current time in microseconds

    +
    \ No newline at end of file diff --git a/ch6-dev/os/timer/fn.set_next_trigger.html b/ch6-dev/os/timer/fn.set_next_trigger.html index 7e62bbd2..ae5c305c 100644 --- a/ch6-dev/os/timer/fn.set_next_trigger.html +++ b/ch6-dev/os/timer/fn.set_next_trigger.html @@ -1,9 +1,2 @@ -set_next_trigger in os::timer - Rust - -
    pub fn set_next_trigger()
    Expand description

    set the next timer interrupt

    -
    - \ No newline at end of file +set_next_trigger in os::timer - Rust

    Function os::timer::set_next_trigger

    source ·
    pub fn set_next_trigger()
    Expand description

    set the next timer interrupt

    +
    \ No newline at end of file diff --git a/ch6-dev/os/timer/index.html b/ch6-dev/os/timer/index.html index b2c1a940..3163dace 100644 --- a/ch6-dev/os/timer/index.html +++ b/ch6-dev/os/timer/index.html @@ -1,14 +1,2 @@ -os::timer - Rust - -
    -

    Module os::timer

    source · []
    Expand description

    RISC-V timer-related functionality

    -

    Constants

    -

    Functions

    -

    get current time

    -

    get current time in microseconds

    -

    set the next timer interrupt

    -
    - \ No newline at end of file +os::timer - Rust

    Module os::timer

    source ·
    Expand description

    RISC-V timer-related functionality

    +

    Constants

    Functions

    \ No newline at end of file diff --git a/ch6-dev/os/timer/sidebar-items.js b/ch6-dev/os/timer/sidebar-items.js index cc248a10..bf5ff37b 100644 --- a/ch6-dev/os/timer/sidebar-items.js +++ b/ch6-dev/os/timer/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"constant":[["MSEC_PER_SEC",""],["TICKS_PER_SEC",""]],"fn":[["get_time","get current time"],["get_time_ms","get current time in microseconds"],["set_next_trigger","set the next timer interrupt"]]}); \ No newline at end of file +window.SIDEBAR_ITEMS = {"constant":["MSEC_PER_SEC","TICKS_PER_SEC"],"fn":["get_time","get_time_ms","set_next_trigger"]}; \ No newline at end of file diff --git a/ch6-dev/os/trap/context/index.html b/ch6-dev/os/trap/context/index.html index dbd6109a..87df363b 100644 --- a/ch6-dev/os/trap/context/index.html +++ b/ch6-dev/os/trap/context/index.html @@ -1,11 +1,2 @@ -os::trap::context - Rust - -
    -

    Module os::trap::context

    source · []
    Expand description

    Implementation of TrapContext

    -

    Structs

    -

    trap context structure containing sstatus, sepc and registers

    -
    - \ No newline at end of file +os::trap::context - Rust

    Module os::trap::context

    source ·
    Expand description

    Implementation of TrapContext

    +

    Structs

    • trap context structure containing sstatus, sepc and registers
    \ No newline at end of file diff --git a/ch6-dev/os/trap/context/sidebar-items.js b/ch6-dev/os/trap/context/sidebar-items.js index 3f97d83e..920f7c9e 100644 --- a/ch6-dev/os/trap/context/sidebar-items.js +++ b/ch6-dev/os/trap/context/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"struct":[["TrapContext","trap context structure containing sstatus, sepc and registers"]]}); \ No newline at end of file +window.SIDEBAR_ITEMS = {"struct":["TrapContext"]}; \ No newline at end of file diff --git a/ch6-dev/os/trap/context/struct.TrapContext.html b/ch6-dev/os/trap/context/struct.TrapContext.html index 5a952415..86136fd7 100644 --- a/ch6-dev/os/trap/context/struct.TrapContext.html +++ b/ch6-dev/os/trap/context/struct.TrapContext.html @@ -1,36 +1,33 @@ -TrapContext in os::trap::context - Rust - -
    #[repr(C)]
    pub struct TrapContext { - pub x: [usize; 32], +TrapContext in os::trap::context - Rust

    Struct os::trap::context::TrapContext

    source ·
    #[repr(C)]
    pub struct TrapContext { + pub x: [usize; 32], pub sstatus: Sstatus, pub sepc: usize, pub kernel_satp: usize, pub kernel_sp: usize, pub trap_handler: usize, -}
    Expand description

    trap context structure containing sstatus, sepc and registers

    -

    Fields

    x: [usize; 32]

    general regs[0..31]

    -
    sstatus: Sstatus

    CSR sstatus

    -
    sepc: usize

    CSR sepc

    -
    kernel_satp: usize

    Addr of Page Table

    -
    kernel_sp: usize

    kernel stack

    -
    trap_handler: usize

    Addr of trap_handler function

    -

    Implementations

    set stack pointer to x_2 reg (sp)

    -

    init app context

    -

    Trait Implementations

    Formats the value using the given formatter. Read more

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +}
    Expand description

    trap context structure containing sstatus, sepc and registers

    +

    Fields§

    §x: [usize; 32]

    general regs[0..31]

    +
    §sstatus: Sstatus

    CSR sstatus

    +
    §sepc: usize

    CSR sepc

    +
    §kernel_satp: usize

    Addr of Page Table

    +
    §kernel_sp: usize

    kernel stack

    +
    §trap_handler: usize

    Addr of trap_handler function

    +

    Implementations§

    source§

    impl TrapContext

    source

    pub fn set_sp(&mut self, sp: usize)

    set stack pointer to x_2 reg (sp)

    +
    source

    pub fn app_init_context( + entry: usize, + sp: usize, + kernel_satp: usize, + kernel_sp: usize, + trap_handler: usize +) -> Self

    init app context

    +

    Trait Implementations§

    source§

    impl Debug for TrapContext

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/os/trap/fn.enable_timer_interrupt.html b/ch6-dev/os/trap/fn.enable_timer_interrupt.html index c6f514af..9f286f5c 100644 --- a/ch6-dev/os/trap/fn.enable_timer_interrupt.html +++ b/ch6-dev/os/trap/fn.enable_timer_interrupt.html @@ -1,9 +1,2 @@ -enable_timer_interrupt in os::trap - Rust - -
    pub fn enable_timer_interrupt()
    Expand description

    enable timer interrupt in sie CSR

    -
    - \ No newline at end of file +enable_timer_interrupt in os::trap - Rust
    pub fn enable_timer_interrupt()
    Expand description

    enable timer interrupt in sie CSR

    +
    \ No newline at end of file diff --git a/ch6-dev/os/trap/fn.init.html b/ch6-dev/os/trap/fn.init.html index d2f3ef65..4a472035 100644 --- a/ch6-dev/os/trap/fn.init.html +++ b/ch6-dev/os/trap/fn.init.html @@ -1,9 +1,2 @@ -init in os::trap - Rust - -
    -

    Function os::trap::init

    source · []
    pub fn init()
    Expand description

    initialize CSR stvec as the entry of __alltraps

    -
    - \ No newline at end of file +init in os::trap - Rust

    Function os::trap::init

    source ·
    pub fn init()
    Expand description

    initialize CSR stvec as the entry of __alltraps

    +
    \ No newline at end of file diff --git a/ch6-dev/os/trap/fn.set_kernel_trap_entry.html b/ch6-dev/os/trap/fn.set_kernel_trap_entry.html index 59e9cdad..601fb857 100644 --- a/ch6-dev/os/trap/fn.set_kernel_trap_entry.html +++ b/ch6-dev/os/trap/fn.set_kernel_trap_entry.html @@ -1,8 +1 @@ -set_kernel_trap_entry in os::trap - Rust - -
    fn set_kernel_trap_entry()
    - \ No newline at end of file +set_kernel_trap_entry in os::trap - Rust

    Function os::trap::set_kernel_trap_entry

    source ·
    fn set_kernel_trap_entry()
    \ No newline at end of file diff --git a/ch6-dev/os/trap/fn.set_user_trap_entry.html b/ch6-dev/os/trap/fn.set_user_trap_entry.html index 792b4705..5b3f1ca9 100644 --- a/ch6-dev/os/trap/fn.set_user_trap_entry.html +++ b/ch6-dev/os/trap/fn.set_user_trap_entry.html @@ -1,8 +1 @@ -set_user_trap_entry in os::trap - Rust - -
    fn set_user_trap_entry()
    - \ No newline at end of file +set_user_trap_entry in os::trap - Rust

    Function os::trap::set_user_trap_entry

    source ·
    fn set_user_trap_entry()
    \ No newline at end of file diff --git a/ch6-dev/os/trap/fn.trap_from_kernel.html b/ch6-dev/os/trap/fn.trap_from_kernel.html index 1645b07b..55362f57 100644 --- a/ch6-dev/os/trap/fn.trap_from_kernel.html +++ b/ch6-dev/os/trap/fn.trap_from_kernel.html @@ -1,11 +1,4 @@ -trap_from_kernel in os::trap - Rust - -
    #[no_mangle]
    -pub fn trap_from_kernel() -> !
    Expand description

    Unimplement: traps/interrupts/exceptions from kernel mode +trap_from_kernel in os::trap - Rust

    Function os::trap::trap_from_kernel

    source ·
    #[no_mangle]
    +pub fn trap_from_kernel() -> !
    Expand description

    Unimplement: traps/interrupts/exceptions from kernel mode Todo: Chapter 9: I/O device

    -
    - \ No newline at end of file +
    \ No newline at end of file diff --git a/ch6-dev/os/trap/fn.trap_handler.html b/ch6-dev/os/trap/fn.trap_handler.html index 24a87ae6..285ffd8d 100644 --- a/ch6-dev/os/trap/fn.trap_handler.html +++ b/ch6-dev/os/trap/fn.trap_handler.html @@ -1,10 +1,3 @@ -trap_handler in os::trap - Rust - -
    -

    Function os::trap::trap_handler

    source · []
    #[no_mangle]
    -pub fn trap_handler() -> !
    Expand description

    handle an interrupt, exception, or system call from user space

    -
    - \ No newline at end of file +trap_handler in os::trap - Rust

    Function os::trap::trap_handler

    source ·
    #[no_mangle]
    +pub fn trap_handler() -> !
    Expand description

    handle an interrupt, exception, or system call from user space

    +
    \ No newline at end of file diff --git a/ch6-dev/os/trap/fn.trap_return.html b/ch6-dev/os/trap/fn.trap_return.html index 8642c90a..f30cc457 100644 --- a/ch6-dev/os/trap/fn.trap_return.html +++ b/ch6-dev/os/trap/fn.trap_return.html @@ -1,12 +1,5 @@ -trap_return in os::trap - Rust - -
    -

    Function os::trap::trap_return

    source · []
    #[no_mangle]
    -pub fn trap_return() -> !
    Expand description

    set the new addr of __restore asm function in TRAMPOLINE page, +trap_return in os::trap - Rust

    Function os::trap::trap_return

    source ·
    #[no_mangle]
    +pub fn trap_return() -> !
    Expand description

    set the new addr of __restore asm function in TRAMPOLINE page, set the reg a0 = trap_cx_ptr, reg a1 = phy addr of usr page table, finally, jump to new addr of __restore asm function

    -
    - \ No newline at end of file +
    \ No newline at end of file diff --git a/ch6-dev/os/trap/index.html b/ch6-dev/os/trap/index.html index a571c000..77a1b9e3 100644 --- a/ch6-dev/os/trap/index.html +++ b/ch6-dev/os/trap/index.html @@ -1,31 +1,14 @@ -os::trap - Rust - -
    -

    Module os::trap

    source · []
    Expand description

    Trap handling functionality

    +os::trap - Rust

    Module os::trap

    source ·
    Expand description

    Trap handling functionality

    For rCore, we have a single trap entry point, namely __alltraps. At -initialization in init(), we set the stvec CSR to point to it.

    +initialization in init(), we set the stvec CSR to point to it.

    All traps go through __alltraps, which is defined in trap.S. The assembly language code does just enough work restore the kernel space context, ensuring that Rust code safely runs, and transfers control to -trap_handler().

    +trap_handler().

    It then calls different functionality based on what exactly the exception was. For example, timer interrupts trigger task preemption, and syscalls go -to syscall().

    -

    Modules

    -
    context 🔒

    Implementation of TrapContext

    -

    Structs

    -

    trap context structure containing sstatus, sepc and registers

    -

    Functions

    -

    enable timer interrupt in sie CSR

    -

    initialize CSR stvec as the entry of __alltraps

    -

    Unimplement: traps/interrupts/exceptions from kernel mode -Todo: Chapter 9: I/O device

    -

    handle an interrupt, exception, or system call from user space

    -

    set the new addr of __restore asm function in TRAMPOLINE page, +to syscall().

    +

    Modules

    Structs

    • trap context structure containing sstatus, sepc and registers

    Functions

    • enable timer interrupt in sie CSR
    • initialize CSR stvec as the entry of __alltraps
    • Unimplement: traps/interrupts/exceptions from kernel mode +Todo: Chapter 9: I/O device
    • handle an interrupt, exception, or system call from user space
    • set the new addr of __restore asm function in TRAMPOLINE page, set the reg a0 = trap_cx_ptr, reg a1 = phy addr of usr page table, -finally, jump to new addr of __restore asm function

      -
    - \ No newline at end of file +finally, jump to new addr of __restore asm function \ No newline at end of file diff --git a/ch6-dev/os/trap/sidebar-items.js b/ch6-dev/os/trap/sidebar-items.js index b082e657..0901c834 100644 --- a/ch6-dev/os/trap/sidebar-items.js +++ b/ch6-dev/os/trap/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"fn":[["enable_timer_interrupt","enable timer interrupt in sie CSR"],["init","initialize CSR `stvec` as the entry of `__alltraps`"],["set_kernel_trap_entry",""],["set_user_trap_entry",""],["trap_from_kernel","Unimplement: traps/interrupts/exceptions from kernel mode Todo: Chapter 9: I/O device"],["trap_handler","handle an interrupt, exception, or system call from user space"],["trap_return","set the new addr of __restore asm function in TRAMPOLINE page, set the reg a0 = trap_cx_ptr, reg a1 = phy addr of usr page table, finally, jump to new addr of __restore asm function"]],"mod":[["context","Implementation of [`TrapContext`]"]],"struct":[["TrapContext","trap context structure containing sstatus, sepc and registers"]]}); \ No newline at end of file +window.SIDEBAR_ITEMS = {"fn":["enable_timer_interrupt","init","set_kernel_trap_entry","set_user_trap_entry","trap_from_kernel","trap_handler","trap_return"],"mod":["context"],"struct":["TrapContext"]}; \ No newline at end of file diff --git a/ch6-dev/os/trap/struct.TrapContext.html b/ch6-dev/os/trap/struct.TrapContext.html index 61cffbd0..fb639cc5 100644 --- a/ch6-dev/os/trap/struct.TrapContext.html +++ b/ch6-dev/os/trap/struct.TrapContext.html @@ -1,36 +1,33 @@ -TrapContext in os::trap - Rust - -
    #[repr(C)]
    pub struct TrapContext { - pub x: [usize; 32], +TrapContext in os::trap - Rust

    Struct os::trap::TrapContext

    source ·
    #[repr(C)]
    pub struct TrapContext { + pub x: [usize; 32], pub sstatus: Sstatus, pub sepc: usize, pub kernel_satp: usize, pub kernel_sp: usize, pub trap_handler: usize, -}
    Expand description

    trap context structure containing sstatus, sepc and registers

    -

    Fields

    x: [usize; 32]

    general regs[0..31]

    -
    sstatus: Sstatus

    CSR sstatus

    -
    sepc: usize

    CSR sepc

    -
    kernel_satp: usize

    Addr of Page Table

    -
    kernel_sp: usize

    kernel stack

    -
    trap_handler: usize

    Addr of trap_handler function

    -

    Implementations

    set stack pointer to x_2 reg (sp)

    -

    init app context

    -

    Trait Implementations

    Formats the value using the given formatter. Read more

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +}
    Expand description

    trap context structure containing sstatus, sepc and registers

    +

    Fields§

    §x: [usize; 32]

    general regs[0..31]

    +
    §sstatus: Sstatus

    CSR sstatus

    +
    §sepc: usize

    CSR sepc

    +
    §kernel_satp: usize

    Addr of Page Table

    +
    §kernel_sp: usize

    kernel stack

    +
    §trap_handler: usize

    Addr of trap_handler function

    +

    Implementations§

    source§

    impl TrapContext

    source

    pub fn set_sp(&mut self, sp: usize)

    set stack pointer to x_2 reg (sp)

    +
    source

    pub fn app_init_context( + entry: usize, + sp: usize, + kernel_satp: usize, + kernel_sp: usize, + trap_handler: usize +) -> Self

    init app context

    +

    Trait Implementations§

    source§

    impl Debug for TrapContext

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for Twhere + T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for Twhere + T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for Twhere + T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    +
    source§

    impl<T, U> Into<U> for Twhere + U: From<T>,

    source§

    fn into(self) -> U

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    - \ No newline at end of file +From<T> for U chooses to do.

    +
    source§

    impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

    §

    type Error = Infallible

    The type returned in the event of a conversion error.
    source§

    fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

    Performs the conversion.
    source§

    impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

    §

    type Error = <U as TryFrom<T>>::Error

    The type returned in the event of a conversion error.
    source§

    fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

    Performs the conversion.
    \ No newline at end of file diff --git a/ch6-dev/rustdoc.css b/ch6-dev/rustdoc.css deleted file mode 100644 index 674a5af6..00000000 --- a/ch6-dev/rustdoc.css +++ /dev/null @@ -1 +0,0 @@ - @font-face {font-family:'Fira Sans';font-style:normal;font-weight:400;src:local('Fira Sans'),url("FiraSans-Regular.woff2") format("woff2"),url("FiraSans-Regular.woff") format('woff');font-display:swap;}@font-face {font-family:'Fira Sans';font-style:normal;font-weight:500;src:local('Fira Sans Medium'),url("FiraSans-Medium.woff2") format("woff2"),url("FiraSans-Medium.woff") format('woff');font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:normal;font-weight:400;src:local('Source Serif 4'),url("SourceSerif4-Regular.ttf.woff2") format("woff2"),url("SourceSerif4-Regular.ttf.woff") format("woff");font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:italic;font-weight:400;src:local('Source Serif 4 Italic'),url("SourceSerif4-It.ttf.woff2") format("woff2"),url("SourceSerif4-It.ttf.woff") format("woff");font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:normal;font-weight:700;src:local('Source Serif 4 Bold'),url("SourceSerif4-Bold.ttf.woff2") format("woff2"),url("SourceSerif4-Bold.ttf.woff") format("woff");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:normal;font-weight:400;src:url("SourceCodePro-Regular.ttf.woff2") format("woff2"),url("SourceCodePro-Regular.ttf.woff") format("woff");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:italic;font-weight:400;src:url("SourceCodePro-It.ttf.woff2") format("woff2"),url("SourceCodePro-It.ttf.woff") format("woff");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:normal;font-weight:600;src:url("SourceCodePro-Semibold.ttf.woff2") format("woff2"),url("SourceCodePro-Semibold.ttf.woff") format("woff");font-display:swap;}@font-face {font-family:'NanumBarunGothic';src:url("NanumBarunGothic.ttf.woff2") format("woff2"),url("NanumBarunGothic.ttf.woff") format("woff");font-display:swap;unicode-range:U+AC00-D7AF,U+1100-11FF,U+3130-318F,U+A960-A97F,U+D7B0-D7FF;}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;}html{content:"";}@media (prefers-color-scheme:light){html{content:"light";}}@media (prefers-color-scheme:dark){html{content:"dark";}}body{font:1rem/1.5 "Source Serif 4",NanumBarunGothic,serif;margin:0;position:relative;overflow-wrap:break-word;overflow-wrap:anywhere;-webkit-font-feature-settings:"kern","liga";-moz-font-feature-settings:"kern","liga";font-feature-settings:"kern","liga";}h1{font-size:1.5rem;}h2{font-size:1.375rem;}h3{font-size:1.25rem;}h1,h2,h3,h4,h5,h6{font-weight:500;}h1,h2,h3,h4{margin:20px 0 15px 0;padding-bottom:6px;}.docblock h3,.docblock h4,h5,h6{margin:15px 0 5px 0;}h1.fqn{margin:0;padding:0;}.main-heading{display:flex;flex-wrap:wrap;justify-content:space-between;padding-bottom:6px;margin-bottom:15px;}.main-heading a:hover{text-decoration:underline;}#toggle-all-docs{text-decoration:none;}h2,.top-doc h3,.top-doc h4{border-bottom:1px solid;}h3.code-header{font-size:1.125rem;}h4.code-header{font-size:1rem;}.code-header{font-weight:600;border-bottom-style:none;margin:0;padding:0;margin-top:0.6em;margin-bottom:0.4em;}.impl,.impl-items .method,.methods .method,.impl-items .type,.methods .type,.impl-items .associatedconstant,.methods .associatedconstant,.impl-items .associatedtype,.methods .associatedtype{flex-basis:100%;font-weight:600;position:relative;}div.impl-items>div{padding-left:0;}h1,h2,h3,h4,h5,h6,.sidebar,.mobile-topbar,a.source,.search-input,.search-results .result-name,.content table td:first-child>a,.item-left>a,.out-of-band,span.since,#source-sidebar,#sidebar-toggle,details.rustdoc-toggle>summary::before,div.impl-items>div:not(.docblock):not(.item-info),.content ul.crate a.crate,a.srclink,#main-content>ul.docblock>li>a{font-family:"Fira Sans",Arial,NanumBarunGothic,sans-serif;}ol,ul{padding-left:24px;}ul ul,ol ul,ul ol,ol ol{margin-bottom:.625em;}p{margin:0 0 .75em 0;}summary{outline:none;}td,th{padding:0;}table{border-collapse:collapse;}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0;}button{padding:1px 6px;}.rustdoc{display:flex;flex-direction:row;flex-wrap:nowrap;}main{position:relative;flex-grow:1;padding:10px 15px 40px 45px;min-width:0;}.source main{padding:15px;}.width-limiter{max-width:960px;margin-right:auto;}.source .width-limiter{max-width:unset;}details:not(.rustdoc-toggle) summary{margin-bottom:.6em;}code,pre,a.test-arrow,.code-header{font-family:"Source Code Pro",monospace;}.docblock code,.docblock-short code{border-radius:3px;padding:0 0.125em;}.docblock pre code,.docblock-short pre code{padding:0;}pre{padding:14px;}.docblock.item-decl{margin-left:0;}.item-decl pre{overflow-x:auto;}.source .content pre{padding:20px;}img{max-width:100%;}li{position:relative;}.source .content{max-width:none;overflow:visible;margin-left:0px;}nav.sub{position:relative;font-size:1rem;text-transform:uppercase;}.sub-container{display:flex;flex-direction:row;flex-wrap:nowrap;}.sub-logo-container{display:none;margin-right:20px;}.source .sub-logo-container{display:block;}.source .sub-logo-container>img{height:60px;width:60px;object-fit:contain;}.sidebar{font-size:0.875rem;width:250px;min-width:200px;overflow-y:scroll;position:sticky;height:100vh;top:0;left:0;}.sidebar-elems,.sidebar>.location{padding-left:24px;}.sidebar .location{overflow-wrap:anywhere;}.rustdoc.source .sidebar{width:50px;min-width:0px;max-width:300px;flex-grow:0;flex-shrink:0;flex-basis:auto;border-right:1px solid;overflow-x:hidden;overflow-y:hidden;}.source .sidebar>*:not(#sidebar-toggle){opacity:0;visibility:hidden;}.source .sidebar.expanded{overflow-y:auto;}.source .sidebar.expanded>*:not(#sidebar-toggle){opacity:1;visibility:visible;}#all-types{margin-top:1em;}*{scrollbar-width:initial;}.sidebar{scrollbar-width:thin;}::-webkit-scrollbar{width:12px;}.sidebar::-webkit-scrollbar{width:8px;}::-webkit-scrollbar-track{-webkit-box-shadow:inset 0;}.hidden{display:none !important;}.sidebar .logo-container{display:flex;margin-top:10px;margin-bottom:10px;justify-content:center;}.version{overflow-wrap:break-word;}.logo-container>img{height:100px;width:100px;}.location:empty{border:none;}.location a:first-of-type{font-weight:500;}.block{padding:0;}.block ul,.block li{padding:0;margin:0;list-style:none;}.block a,h2.location a{display:block;padding:0.25rem;margin-left:-0.25rem;text-overflow:ellipsis;overflow:hidden;}.sidebar h2{border-bottom:none;font-weight:500;padding:0;margin:0;margin-top:0.7rem;margin-bottom:0.7rem;}.sidebar h3{font-size:1.125rem;font-weight:500;padding:0;margin:0;}.sidebar-elems .block{margin-bottom:2em;}.sidebar-elems .block li a{white-space:nowrap;}.mobile-topbar{display:none;}.source .content pre.rust{white-space:pre;overflow:auto;padding-left:0;}.rustdoc .example-wrap{display:inline-flex;margin-bottom:10px;}.example-wrap{position:relative;width:100%;}.example-wrap>pre.line-number{overflow:initial;border:1px solid;padding:13px 8px;text-align:right;border-top-left-radius:5px;border-bottom-left-radius:5px;}.example-wrap>pre.rust a:hover{text-decoration:underline;}.line-numbers{text-align:right;}.rustdoc:not(.source) .example-wrap>pre:not(.line-number){width:100%;overflow-x:auto;}.rustdoc:not(.source) .example-wrap>pre.line-numbers{width:auto;overflow-x:visible;}.rustdoc .example-wrap>pre{margin:0;}#search{position:relative;}.search-loading{text-align:center;}#results>table{width:100%;table-layout:fixed;}.content>.example-wrap pre.line-numbers{position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.line-numbers span{cursor:pointer;}.docblock-short{overflow-wrap:break-word;overflow-wrap:anywhere;}.docblock-short p{display:inline;}.docblock-short p{overflow:hidden;text-overflow:ellipsis;margin:0;}.docblock>:not(pre)>code,.docblock-short>:not(pre)>code{white-space:pre-wrap;}.top-doc .docblock h2{font-size:1.375rem;}.top-doc .docblock h3{font-size:1.25;}.top-doc .docblock h4,.top-doc .docblock h5{font-size:1.125rem;}.top-doc .docblock h6{font-size:1rem;}.docblock h5{font-size:1rem;}.docblock h6{font-size:0.875rem;}.docblock{margin-left:24px;position:relative;}.docblock>:not(.information){max-width:100%;overflow-x:auto;}.content .out-of-band{flex-grow:0;font-size:1.125rem;font-weight:normal;float:right;}.method>.code-header,.trait-impl>.code-header{max-width:calc(100% - 41px);display:block;}.invisible{width:100%;display:inline-block;}.content .in-band{flex-grow:1;margin:0px;padding:0px;overflow-wrap:break-word;overflow-wrap:anywhere;}.in-band>code,.in-band>.code-header{display:inline-block;}#main-content{position:relative;}#main-content>.since{top:inherit;font-family:"Fira Sans",Arial,sans-serif;}.content table:not(.table-display){border-spacing:0 5px;}.content td{vertical-align:top;}.content td:first-child{padding-right:20px;}.content td p:first-child{margin-top:0;}.content td h1,.content td h2{margin-left:0;font-size:1.125rem;}.content tr:first-child td{border-top:0;}.docblock table{margin:.5em 0;width:calc(100% - 2px);overflow-x:auto;display:block;}.docblock table td{padding:.5em;border:1px dashed;}.docblock table th{padding:.5em;text-align:left;border:1px solid;}.fields+table{margin-bottom:1em;}.content .item-list{list-style-type:none;padding:0;}.content .multi-column{-moz-column-count:5;-moz-column-gap:2.5em;-webkit-column-count:5;-webkit-column-gap:2.5em;column-count:5;column-gap:2.5em;}.content .multi-column li{width:100%;display:inline-block;}.content>.methods>.method{font-size:1rem;position:relative;}.content .method .where,.content .fn .where,.content .where.fmt-newline{display:block;font-size:0.875rem;}.content .methods>div:not(.notable-traits):not(.method){margin-left:40px;margin-bottom:15px;}.content .docblock>.impl-items{margin-left:20px;margin-top:-34px;}.content .docblock>.impl-items .table-display{margin:0;}.content .docblock>.impl-items table td{padding:0;}.content .docblock>.impl-items .table-display,.impl-items table td{border:none;}.item-info{display:block;}.content .item-info code{font-size:0.875rem;}.content .item-info{position:relative;margin-left:24px;}.sub-variant>div>.item-info{margin-top:initial;}.content .impl-items .docblock,.content .impl-items .item-info{margin-bottom:.6em;}.content .impl-items>.item-info{margin-left:40px;}.methods>.item-info,.content .impl-items>.item-info{margin-top:-8px;}.impl-items{flex-basis:100%;}#main-content>.item-info{margin-top:0;margin-left:0;}nav.sub{flex-grow:1;margin-bottom:25px;}.source nav.sub{margin-left:32px;}nav.main{padding:20px 0;text-align:center;}nav.main .current{border-top:1px solid;border-bottom:1px solid;}nav.main .separator{border:1px solid;display:inline-block;height:23px;margin:0 20px;}nav.sum{text-align:right;}nav.sub form{display:inline;}a{text-decoration:none;background:transparent;}.small-section-header{display:flex;justify-content:space-between;position:relative;}.small-section-header:hover>.anchor{display:initial;}.in-band:hover>.anchor,.impl:hover>.anchor,.method.trait-impl:hover>.anchor,.type.trait-impl:hover>.anchor,.associatedconstant.trait-impl:hover>.anchor,.associatedtype.trait-impl:hover>.anchor{display:inline-block;position:absolute;}.anchor{display:none;position:absolute;left:-0.5em;background:none !important;}.anchor.field{left:-5px;}.small-section-header>.anchor{left:-15px;padding-right:8px;}h2.small-section-header>.anchor{padding-right:6px;}.anchor::before{content:'§';}.docblock a:not(.srclink):not(.test-arrow):hover,.docblock-short a:not(.srclink):not(.test-arrow):hover,.item-info a{text-decoration:underline;}.block a.current.crate{font-weight:500;}table,.item-table{overflow-wrap:break-word;}.item-table{display:table;}.item-row{display:table-row;}.item-left,.item-right{display:table-cell;}.item-left{padding-right:1.25rem;}.search-container{position:relative;display:flex;height:34px;}.search-container>*{height:100%;}.search-results-title{display:inline;}#search-settings{font-size:1.5rem;font-weight:500;margin-bottom:20px;}#crate-search{min-width:115px;margin-top:5px;margin-left:0.25em;padding-left:0.3125em;padding-right:23px;border:0;border-radius:4px;outline:none;cursor:pointer;-moz-appearance:none;-webkit-appearance:none;text-indent:0.01px;text-overflow:"";background-repeat:no-repeat;background-color:transparent;background-size:20px;background-position:calc(100% - 1px) 56%;background-image:url("down-arrow.svg");}.search-container{margin-top:4px;}.search-input{-webkit-appearance:none;-moz-box-sizing:border-box !important;box-sizing:border-box !important;outline:none;border:1px solid;border-radius:2px;padding:8px;font-size:1rem;transition:border-color 300ms ease;width:100%;}.search-results{display:none;padding-bottom:2em;}.search-results.active{display:block;clear:both;}.search-results .desc>span{white-space:nowrap;text-overflow:ellipsis;overflow:hidden;display:block;}.search-results>a{display:block;width:100%;margin-left:2px;margin-right:2px;border-bottom:1px solid #aaa3;}.search-results>a>div{display:flex;flex-flow:row wrap;}.search-results .result-name,.search-results div.desc,.search-results .result-description{width:50%;}.search-results .result-name{padding-right:1em;}.search-results .result-name>span{display:inline-block;margin:0;font-weight:normal;}body.blur>:not(#help){filter:blur(8px);-webkit-filter:blur(8px);opacity:.7;}#help{width:100%;height:100vh;position:fixed;top:0;left:0;display:flex;justify-content:center;align-items:center;}#help>div{flex:0 0 auto;box-shadow:0 0 6px rgba(0,0,0,.2);width:550px;height:auto;border:1px solid;}#help dt{float:left;clear:left;display:block;margin-right:0.5rem;}#help span.top,#help span.bottom{text-align:center;display:block;font-size:1.125rem;}#help span.top{text-align:center;display:block;margin:10px 0;border-bottom:1px solid;padding-bottom:4px;margin-bottom:6px;}#help span.bottom{clear:both;border-top:1px solid;}#help dd{margin:5px 35px;}#help .infos{padding-left:0;}#help h1,#help h2{margin-top:0;}#help>div div{width:50%;float:left;padding:0 20px 20px 17px;;}.item-info .stab{display:inline-block;}.stab{padding:3px;margin-bottom:5px;font-size:0.875rem;font-weight:normal;}.stab p{display:inline;}.stab .emoji{font-size:1.25rem;}.emoji{text-shadow:1px 0 0 black,-1px 0 0 black,0 1px 0 black,0 -1px 0 black;}.module-item .stab,.import-item .stab{border-radius:3px;display:inline-block;font-size:0.875rem;line-height:1.2;margin-bottom:0;margin-left:0.3125em;padding:2px;vertical-align:text-bottom;}.module-item.unstable,.import-item.unstable{opacity:0.65;}.since{font-weight:normal;font-size:initial;}.rightside{padding-left:12px;padding-right:2px;position:initial;}.impl-items .srclink,.impl .srclink,.methods .srclink{font-weight:normal;font-size:1rem;}.rightside{float:right;}.variants_table{width:100%;}.variants_table tbody tr td:first-child{width:1%;}td.summary-column{width:100%;}.summary{padding-right:0px;}pre.rust .question-mark{font-weight:bold;}a.test-arrow{display:inline-block;visibility:hidden;position:absolute;padding:5px 10px 5px 10px;border-radius:5px;font-size:1.375rem;top:5px;right:5px;z-index:1;}.example-wrap:hover .test-arrow{visibility:visible;}a.test-arrow:hover{text-decoration:none;}.code-attribute{font-weight:300;}.item-spacer{width:100%;height:12px;}.out-of-band>span.since{position:initial;font-size:1.25rem;}h3.variant{font-weight:600;font-size:1.125rem;margin-bottom:10px;border-bottom:none;}.sub-variant h4{font-size:1rem;font-weight:400;border-bottom:none;margin-top:0;margin-bottom:0;}.sub-variant{margin-left:24px;margin-bottom:40px;}.sub-variant>.sub-variant-field{margin-left:24px;}.toggle-label{display:inline-block;margin-left:4px;margin-top:3px;}:target>code,:target>.code-header{opacity:1;}:target{padding-right:3px;}.information{position:absolute;left:-25px;margin-top:7px;z-index:1;}.tooltip{position:relative;display:inline-block;cursor:pointer;}.tooltip::after{display:none;text-align:center;padding:5px 3px 3px 3px;border-radius:6px;margin-left:5px;font-size:1rem;}.tooltip.ignore::after{content:"This example is not tested";}.tooltip.compile_fail::after{content:"This example deliberately fails to compile";}.tooltip.should_panic::after{content:"This example panics";}.tooltip.edition::after{content:"This code runs with edition " attr(data-edition);}.tooltip::before{content:" ";position:absolute;top:50%;left:16px;margin-top:-5px;border-width:5px;border-style:solid;display:none;}.tooltip:hover::before,.tooltip:hover::after{display:inline;}.tooltip.compile_fail,.tooltip.should_panic,.tooltip.ignore{font-weight:bold;font-size:1.25rem;}.notable-traits-tooltip{display:inline-block;cursor:pointer;}.notable-traits:hover .notable-traits-tooltiptext,.notable-traits .notable-traits-tooltiptext.force-tooltip{display:inline-block;}.notable-traits .notable-traits-tooltiptext{display:none;padding:5px 3px 3px 3px;border-radius:6px;margin-left:5px;z-index:10;font-size:1rem;cursor:default;position:absolute;border:1px solid;}.notable-traits-tooltip::after{content:"\00a0\00a0\00a0";}.notable-traits .notable,.notable-traits .docblock{margin:0;}.notable-traits .notable{margin:0;margin-bottom:13px;font-size:1.1875rem;font-weight:600;display:block;}.notable-traits .docblock code.content{margin:0;padding:0;font-size:1.25rem;}pre.rust.rust-example-rendered{position:relative;}pre.rust{tab-size:4;-moz-tab-size:4;}.search-failed{text-align:center;margin-top:20px;display:none;}.search-failed.active{display:block;}.search-failed>ul{text-align:left;max-width:570px;margin-left:auto;margin-right:auto;}#titles{height:35px;}#titles>button{float:left;width:33.3%;text-align:center;font-size:1.125rem;cursor:pointer;border:0;border-top:2px solid;}#titles>button:not(:last-child){margin-right:1px;width:calc(33.3% - 1px);}#titles>button>div.count{display:inline-block;font-size:1rem;}.notable-traits{cursor:pointer;z-index:2;margin-left:5px;}#sidebar-toggle{position:sticky;top:0;left:0;cursor:pointer;font-weight:bold;font-size:1.25rem;border-bottom:1px solid;display:flex;height:40px;justify-content:center;align-items:center;z-index:10;}#source-sidebar{width:100%;z-index:1;overflow:auto;}#source-sidebar>.title{font-size:1.5rem;text-align:center;border-bottom:1px solid;margin-bottom:6px;}.theme-picker{position:absolute;left:-38px;top:4px;}.theme-picker button{outline:none;}#settings-menu,#help-button{margin-left:4px;outline:none;}#theme-picker,#copy-path{height:34px;}#theme-picker,#settings-menu,#help-button,#copy-path{padding:5px;width:33px;border:1px solid;border-radius:2px;cursor:pointer;}#help-button{font-family:"Fira Sans",Arial,sans-serif;text-align:center;font-size:20px;padding-top:2px;}#copy-path{background:initial;margin-left:10px;padding:0;padding-left:2px;border:0;}#theme-choices{display:none;position:absolute;left:0;top:28px;border:1px solid;border-radius:3px;z-index:1;cursor:pointer;}#theme-choices>button{border:none;width:100%;padding:4px 8px;text-align:center;background:rgba(0,0,0,0);overflow-wrap:normal;}#theme-choices>button:not(:first-child){border-top:1px solid;}kbd{display:inline-block;padding:3px 5px;font:15px monospace;line-height:10px;vertical-align:middle;border:solid 1px;border-radius:3px;cursor:default;}.hidden-by-impl-hider,.hidden-by-usual-hider{display:none !important;}#implementations-list>h3>span.in-band{width:100%;}.table-display{width:100%;border:0;border-collapse:collapse;border-spacing:0;font-size:1rem;}.table-display tr td:first-child{padding-right:0;}.table-display tr td:last-child{float:right;}.table-display .out-of-band{position:relative;font-size:1.125rem;display:block;}.table-display td:hover .anchor{display:block;top:2px;left:-5px;}#main-content>ul{padding-left:10px;}#main-content>ul>li{list-style:none;}.non-exhaustive{margin-bottom:1em;}div.children{padding-left:27px;display:none;}div.name{cursor:pointer;position:relative;margin-left:16px;}div.files>a{display:block;padding:0 3px;}div.files>a:hover,div.name:hover{background-color:#a14b4b;}div.name.expand+.children{display:block;}div.name::before{content:"\25B6";padding-left:4px;font-size:0.625rem;position:absolute;left:-16px;top:4px;}div.name.expand::before{transform:rotate(90deg);left:-15px;top:2px;}details.rustdoc-toggle>summary.hideme{cursor:pointer;}details.rustdoc-toggle>summary{list-style:none;}details.rustdoc-toggle>summary::-webkit-details-marker,details.rustdoc-toggle>summary::marker{display:none;}details.rustdoc-toggle>summary.hideme>span{margin-left:9px;}details.rustdoc-toggle>summary::before{content:"";cursor:pointer;width:16px;height:16px;background-repeat:no-repeat;background-position:top left;display:inline-block;vertical-align:middle;opacity:.5;}details.rustdoc-toggle>summary::after{content:"Expand";overflow:hidden;width:0;height:0;position:absolute;}details.rustdoc-toggle>summary.hideme::after{content:"";}details.rustdoc-toggle>summary:focus::before,details.rustdoc-toggle>summary:hover::before{opacity:1;}details.rustdoc-toggle.top-doc>summary,details.rustdoc-toggle.top-doc>summary::before,details.rustdoc-toggle.non-exhaustive>summary,details.rustdoc-toggle.non-exhaustive>summary::before{font-family:'Fira Sans';font-size:1rem;}details.non-exhaustive{margin-bottom:8px;}details.rustdoc-toggle>summary.hideme::before{position:relative;}details.rustdoc-toggle>summary:not(.hideme)::before{position:absolute;left:-24px;top:4px;}.impl-items>details.rustdoc-toggle>summary:not(.hideme)::before{position:absolute;left:-24px;}details.rustdoc-toggle[open] >summary.hideme{position:absolute;}details.rustdoc-toggle{position:relative;}details.rustdoc-toggle[open] >summary.hideme>span{display:none;}details.undocumented[open] >summary::before,details.rustdoc-toggle[open] >summary::before,details.rustdoc-toggle[open] >summary.hideme::before{background-image:url("toggle-minus.svg");}details.undocumented>summary::before,details.rustdoc-toggle>summary::before{background-image:url("toggle-plus.svg");}details.rustdoc-toggle[open] >summary::before,details.rustdoc-toggle[open] >summary.hideme::before{width:16px;height:16px;background-repeat:no-repeat;background-position:top left;display:inline-block;content:"";}details.rustdoc-toggle[open] >summary::after,details.rustdoc-toggle[open] >summary.hideme::after{content:"Collapse";}@media (min-width:701px){.docblock>.information:first-child>.tooltip{margin-top:16px;}.sidebar.expanded+main .width-limiter .sub-logo-container.rust-logo{display:none;}.source .sidebar.expanded{width:300px;}}@media (max-width:700px){*[id]{scroll-margin-top:45px;}.rustdoc{padding-top:0px;display:block;}main{padding-left:15px;padding-top:0px;}.rustdoc,.main-heading{flex-direction:column;}.content .out-of-band{text-align:left;margin-left:initial;padding:initial;}.content .out-of-band .since::before{content:"Since ";}#copy-path{display:none;}.sidebar .sidebar-logo,.sidebar .location{display:none;}.sidebar-elems{margin-top:1em;}.sidebar{position:fixed;top:45px;left:-1000px;margin-left:0;background-color:rgba(0,0,0,0);margin:0;padding:0;z-index:11;height:calc(100vh - 45px);}.source main,.source .sidebar{top:0;padding:0;}.sidebar.shown,.sidebar.expanded,.sidebar:focus-within{left:0;}.rustdoc.source>.sidebar{position:fixed;margin:0;z-index:11;width:0;}.mobile-topbar .location a{padding:0;margin:0;}.mobile-topbar .location{border:none;padding:0;margin:auto 0.5em auto auto;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;font-size:24px;}.mobile-topbar .logo-container{max-height:45px;}.mobile-topbar .logo-container>img{max-width:35px;max-height:35px;margin-left:20px;margin-top:5px;margin-bottom:5px;}.mobile-topbar{display:flex;flex-direction:row;position:sticky;z-index:10;font-size:2rem;height:45px;width:100%;left:0;top:0;}.source .mobile-topbar{display:none;}.sidebar-menu-toggle{width:45px;font-size:32px;border:none;}.source nav:not(.sidebar).sub{margin-left:32px;}#theme-picker{display:none;width:0;}.content{margin-left:0px;}.source .content{margin-top:10px;}#search{margin-left:0;padding:0;}.anchor{display:none !important;}.notable-traits{position:absolute;left:-22px;top:24px;}#titles>button>div.count{float:left;width:100%;}#titles{height:50px;}#sidebar-filler{position:fixed;left:45px;width:calc(100% - 45px);top:0;height:45px;z-index:-1;border-bottom:1px solid;}#main-content>details.rustdoc-toggle>summary::before,#main-content>div>details.rustdoc-toggle>summary::before{left:-11px;}.sidebar.expanded #sidebar-toggle{font-size:1.5rem;}.sidebar:not(.expanded) #sidebar-toggle{position:fixed;left:1px;top:100px;width:30px;font-size:1.5rem;text-align:center;padding:0;z-index:10;border-top-right-radius:3px;border-bottom-right-radius:3px;cursor:pointer;font-weight:bold;border:1px solid;border-left:0;}#source-sidebar{z-index:11;}#main-content>.line-numbers{margin-top:0;}.notable-traits .notable-traits-tooltiptext{left:0;top:100%;}#help-button{display:none;}.item-table{display:block;}.item-row{display:flex;flex-flow:column wrap;}.item-left,.item-right{width:100%;}.search-results>a{border-bottom:1px solid #aaa9;padding:5px 0px;}.search-results .result-name,.search-results div.desc,.search-results .result-description{width:100%;}.search-results div.desc,.search-results .result-description,.item-right{padding-left:2em;}.source .sidebar.expanded{max-width:100vw;width:100vw;}details.rustdoc-toggle:not(.top-doc)>summary{margin-left:10px;}.impl-items>details.rustdoc-toggle>summary:not(.hideme)::before,#main-content>details.rustdoc-toggle:not(.top-doc)>summary::before,#main-content>div>details.rustdoc-toggle>summary::before{left:-11px;}}@media print{nav.sub,.content .out-of-band{display:none;}}@media (max-width:464px){#titles,#titles>button{height:73px;}#main-content>table:not(.table-display) td{word-break:break-word;width:50%;}#crate-search{border-radius:4px;border:0;}.docblock{margin-left:12px;}.docblock code{overflow-wrap:break-word;overflow-wrap:anywhere;}.sub-container{flex-direction:column;}.sub-logo-container{align-self:center;}.source .sub-logo-container>img{height:35px;width:35px;}.sidebar:not(.expanded) #sidebar-toggle{top:10px;}}.method-toggle summary,.implementors-toggle summary,.impl{margin-bottom:0.75em;}.method-toggle[open]{margin-bottom:2em;}.implementors-toggle[open]{margin-bottom:2em;}#trait-implementations-list .method-toggle,#synthetic-implementations-list .method-toggle,#blanket-implementations-list .method-toggle{margin-bottom:1em;}.scraped-example-title{font-family:'Fira Sans';}.scraped-example:not(.expanded) .code-wrapper pre.line-numbers{overflow:hidden;max-height:240px;}.scraped-example:not(.expanded) .code-wrapper .example-wrap pre.rust{overflow-y:hidden;max-height:240px;padding-bottom:0;}.scraped-example .code-wrapper .prev{position:absolute;top:0.25em;right:2.25em;z-index:100;cursor:pointer;}.scraped-example .code-wrapper .next{position:absolute;top:0.25em;right:1.25em;z-index:100;cursor:pointer;}.scraped-example .code-wrapper .expand{position:absolute;top:0.25em;right:0.25em;z-index:100;cursor:pointer;}.scraped-example .code-wrapper{position:relative;display:flex;flex-direction:row;flex-wrap:wrap;width:100%;}.scraped-example:not(.expanded) .code-wrapper:before{content:" ";width:100%;height:5px;position:absolute;z-index:100;top:0;background:linear-gradient(to bottom,rgba(255,255,255,1),rgba(255,255,255,0));}.scraped-example:not(.expanded) .code-wrapper:after{content:" ";width:100%;height:5px;position:absolute;z-index:100;bottom:0;background:linear-gradient(to top,rgba(255,255,255,1),rgba(255,255,255,0));}.scraped-example:not(.expanded) .code-wrapper{overflow:hidden;max-height:240px;}.scraped-example .code-wrapper .line-numbers{margin:0;padding:14px 0;}.scraped-example .code-wrapper .line-numbers span{padding:0 14px;}.scraped-example .code-wrapper .example-wrap{flex:1;overflow-x:auto;overflow-y:hidden;margin-bottom:0;}.scraped-example .code-wrapper .example-wrap pre.rust{overflow-x:inherit;width:inherit;overflow-y:hidden;}.scraped-example .example-wrap .rust span.highlight{background:#fcffd6;}.scraped-example .example-wrap .rust span.highlight.focus{background:#f6fdb0;}.more-examples-toggle{margin-top:10px;}.more-examples-toggle summary{color:#999;font-family:'Fira Sans';}.more-scraped-examples{margin-left:25px;display:flex;flex-direction:row;width:calc(100% - 25px);}.more-scraped-examples-inner{width:calc(100% - 20px);}.toggle-line{align-self:stretch;margin-right:10px;margin-top:5px;padding:0 4px;cursor:pointer;}.toggle-line:hover .toggle-line-inner{background:#aaa;}.toggle-line-inner{min-width:2px;background:#ddd;height:100%;}.more-scraped-examples .scraped-example{margin-bottom:20px;}.more-scraped-examples .scraped-example:last-child{margin-bottom:0;}.example-links a{margin-top:20px;font-family:'Fira Sans';}.example-links ul{margin-bottom:0;} \ No newline at end of file diff --git a/ch6-dev/search-index.js b/ch6-dev/search-index.js index 41b697e6..35ad76be 100644 --- a/ch6-dev/search-index.js +++ b/ch6-dev/search-index.js @@ -1,4 +1,5 @@ var searchIndex = JSON.parse('{\ -"os":{"doc":"The main module and entrypoint","t":[0,5,0,0,0,0,0,0,14,14,5,0,0,0,0,0,0,6,17,17,17,17,17,17,17,8,17,3,17,12,11,11,10,11,5,10,11,10,11,11,11,11,11,11,11,17,17,17,17,17,17,17,3,11,11,11,11,5,11,11,11,11,0,3,12,5,11,11,11,11,11,0,11,11,11,0,12,13,13,12,4,13,13,13,13,13,13,13,13,13,13,13,13,13,13,12,12,11,11,13,12,12,13,12,12,12,12,12,12,12,12,12,12,11,4,12,12,12,12,12,12,12,3,12,12,12,12,12,12,12,12,12,12,12,12,12,12,3,3,3,3,3,17,17,17,17,17,17,12,12,17,12,12,12,12,12,12,12,12,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,5,11,11,11,11,11,11,11,11,5,11,11,11,11,11,11,11,12,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,12,12,12,3,17,3,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,5,5,5,5,11,8,3,3,3,3,12,12,0,5,5,10,10,12,0,10,12,10,18,3,3,3,18,18,3,18,18,12,11,11,11,11,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,12,11,11,11,11,11,11,11,11,11,5,11,11,11,12,5,11,11,11,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,3,3,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,5,12,12,12,12,3,3,3,3,3,3,3,3,8,3,3,3,3,12,0,12,12,12,12,12,12,12,5,0,5,12,0,5,5,0,0,12,12,5,12,10,5,5,5,5,12,12,12,12,17,17,3,3,3,3,8,17,6,17,3,3,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,12,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,3,8,6,3,3,12,10,11,11,11,11,11,11,11,12,10,11,11,11,12,11,5,5,5,11,11,11,11,5,11,11,11,10,11,11,12,12,11,11,11,11,11,11,11,11,11,7,7,5,5,5,13,13,3,3,3,4,3,18,18,18,18,12,11,11,12,11,11,11,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,5,5,5,11,11,11,5,5,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,5,11,11,12,11,12,11,11,11,11,11,12,11,11,11,5,11,11,5,5,11,5,5,5,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,18,18,18,3,3,3,18,18,3,3,18,18,18,11,11,11,11,11,11,12,12,11,11,11,11,11,11,11,11,11,11,11,11,12,12,11,11,11,11,11,11,11,12,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,11,11,11,11,11,11,11,5,5,5,5,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,17,17,17,17,17,17,17,17,17,5,5,5,5,5,3,12,0,3,11,11,11,11,12,11,11,11,11,11,17,17,17,17,17,17,17,17,17,17,17,0,0,5,5,5,5,5,5,5,5,5,5,5,5,12,17,3,3,3,3,3,3,3,12,5,5,11,11,0,12,12,5,5,5,11,5,5,11,12,11,0,0,12,5,0,12,12,12,5,12,5,12,5,0,5,0,11,11,11,3,11,11,11,11,11,12,12,12,11,11,11,11,3,3,12,11,5,11,11,11,11,11,11,5,11,11,11,11,11,12,11,11,11,11,11,11,12,3,3,3,3,12,11,11,11,11,11,11,11,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,5,11,11,12,5,11,12,11,11,11,11,11,11,11,11,11,11,11,11,3,3,12,11,11,11,11,11,12,5,5,5,11,11,11,11,12,11,11,11,5,5,11,5,11,11,11,11,11,11,5,13,13,3,3,4,13,11,12,11,11,11,11,11,11,12,11,11,11,11,12,12,11,11,11,11,11,11,11,11,12,11,11,11,11,11,12,12,11,12,12,12,12,11,12,11,11,11,11,11,11,11,11,11,17,17,5,5,5,3,0,5,5,12,12,12,5,5,12,5,5,12,5,12,3,11,11,11,11,11,11,12,12,12,11,12,12,11,11,11,12],"n":["board","clear_bss","config","console","drivers","fs","lang_items","mm","print","println","rust_main","sbi","sync","syscall","task","timer","trap","BlockDeviceImpl","CLOCK_FREQ","EXIT_FAILURE","EXIT_FAILURE_FLAG","EXIT_RESET","EXIT_SUCCESS","MEMORY_END","MMIO","QEMUExit","QEMU_EXIT_HANDLE","RISCV64","VIRT_TEST","addr","borrow","borrow_mut","exit","exit","exit_code_encode","exit_failure","exit_failure","exit_success","exit_success","from","into","new","try_from","try_into","type_id","KERNEL_HEAP_SIZE","KERNEL_STACK_SIZE","PAGE_SIZE","PAGE_SIZE_BITS","TRAMPOLINE","TRAP_CONTEXT","USER_STACK_SIZE","Stdout","borrow","borrow_mut","from","into","print","try_from","try_into","type_id","write_str","block","BLOCK_DEVICE","__private_field","block_device_test","borrow","borrow_mut","deref","from","into","sdcard","try_from","try_into","type_id","virtio_blk","0","ACMD23","ACMD41","CID_CRC","CMD","CMD0","CMD10","CMD12","CMD16","CMD17","CMD18","CMD24","CMD25","CMD55","CMD58","CMD59","CMD8","CMD9","CMDFailed","CSDStruct","CSD_CRC","CS_HIGH","CS_LOW","CannotGetCardInfo","CardBlockSize","CardCapacity","CardCapacityStatusNotSet","CardComdClasses","ContentProtectAppli","CopyFlag","DSRImpl","DeviceSize","ECC","EraseGrMul","EraseGrSize","FileFormat","FileFormatGroup","HIGH_SPEED_ENABLE","InitError","ManDeflECC","ManufactDate","ManufacturerID","MaxBusClkFrec","MaxWrBlockLen","NSAC","OEM_AppliID","PERIPHERALS","PartBlockRead","PermWrProtect","ProdName1","ProdName2","ProdRev","ProdSN","RdBlockLen","RdBlockMisalign","Reserved1","Reserved1","Reserved2","Reserved2","Reserved3","Reserved4","SDCard","SDCardCID","SDCardCSD","SDCardInfo","SDCardWrapper","SD_CS","SD_CS_GPIONUM","SD_START_DATA_MULTIPLE_BLOCK_READ","SD_START_DATA_MULTIPLE_BLOCK_WRITE","SD_START_DATA_SINGLE_BLOCK_READ","SD_START_DATA_SINGLE_BLOCK_WRITE","SD_cid","SD_csd","SEC_LEN","SysSpecVersion","TAAC","TempWrProtect","WrBlockMisalign","WrProtectGrEnable","WrProtectGrSize","WrSpeedFact","WriteBlockPaPartial","__private_field","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","clone","clone","clone","clone","clone","clone_into","clone_into","clone_into","clone_into","clone_into","cs_gpionum","deref","end_cmd","eq","fmt","fmt","fmt","fmt","fmt","from","from","from","from","from","from","from","from","get_cardinfo","get_cidregister","get_csdregister","get_dataresponse","get_response","init","init_sdcard","into","into","into","into","into","into","into","into","io_init","lowlevel_init","new","new","read_block","read_data","read_sector","send_cmd","spi","spi_cs","to_owned","to_owned","to_owned","to_owned","to_owned","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","write_block","write_data","write_sector","0","0","1","0","QUEUE_FRAMES","VIRTIO0","VirtIOBlock","__private_field","borrow","borrow","borrow_mut","borrow_mut","deref","from","from","into","into","new","read_block","try_from","try_from","try_into","try_into","type_id","type_id","virtio_dma_alloc","virtio_dma_dealloc","virtio_phys_to_virt","virtio_virt_to_phys","write_block","File","OSInode","OpenFlags","Stdin","Stdout","bits","inner","inode","list_apps","open_file","read","readable","readable","stdio","writable","writable","write","CREATE","OSInode","OSInodeInner","OpenFlags","RDONLY","RDWR","ROOT_INODE","TRUNC","WRONLY","__private_field","all","bitand","bitand_assign","bitor","bitor_assign","bits","bits","bitxor","bitxor_assign","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","clone","clone_into","cmp","complement","contains","deref","difference","empty","eq","extend","fmt","fmt","fmt","fmt","fmt","from","from","from","from","from_bits","from_bits_truncate","from_bits_unchecked","from_iter","hash","inner","inode","insert","intersection","intersects","into","into","into","into","is_all","is_empty","list_apps","ne","new","not","offset","open_file","partial_cmp","read","read_all","read_write","readable","readable","remove","set","sub","sub_assign","symmetric_difference","to_owned","toggle","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","union","writable","writable","write","Stdin","Stdout","borrow","borrow","borrow_mut","borrow_mut","from","from","into","into","read","read","readable","readable","try_from","try_from","try_into","try_into","type_id","type_id","writable","writable","write","write","panic","0","0","0","0","FrameTracker","KERNEL_SPACE","MapPermission","MemorySet","PageTable","PageTableEntry","PhysAddr","PhysPageNum","StepByOne","UserBuffer","UserBufferIterator","VirtAddr","VirtPageNum","__private_field","address","areas","bits","bits","buffers","buffers","current_buffer","current_idx","frame_alloc","frame_allocator","frame_dealloc","frames","heap_allocator","init","kernel_token","memory_set","page_table","page_table","ppn","remap_test","root_ppn","step","translated_byte_buffer","translated_ref","translated_refmut","translated_str","0","0","0","0","PA_WIDTH_SV39","PPN_WIDTH_SV39","PhysAddr","PhysPageNum","SimpleRange","SimpleRangeIterator","StepByOne","VA_WIDTH_SV39","VPNRange","VPN_WIDTH_SV39","VirtAddr","VirtPageNum","aligned","aligned","borrow","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","ceil","ceil","clone","clone","clone","clone","clone","clone_into","clone_into","clone_into","clone_into","clone_into","cmp","cmp","cmp","cmp","current","end","eq","eq","eq","eq","floor","floor","fmt","fmt","fmt","fmt","from","from","from","from","from","from","from","from","from","from","from","from","from","from","get_bytes_array","get_end","get_mut","get_mut","get_pte_array","get_ref","get_start","indexes","into","into","into","into","into","into","into_iter","into_iter","l","ne","ne","ne","ne","new","new","next","page_offset","page_offset","partial_cmp","partial_cmp","partial_cmp","partial_cmp","r","step","step","step","to_owned","to_owned","to_owned","to_owned","to_owned","try_from","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","type_id","FRAME_ALLOCATOR","FrameAllocator","FrameAllocatorImpl","FrameTracker","StackFrameAllocator","__private_field","alloc","alloc","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","current","dealloc","dealloc","deref","drop","end","fmt","frame_alloc","frame_allocator_test","frame_dealloc","from","from","from","init","init_frame_allocator","into","into","into","new","new","new","ppn","recycled","try_from","try_from","try_from","try_into","try_into","try_into","type_id","type_id","type_id","HEAP_ALLOCATOR","HEAP_SPACE","handle_alloc_error","heap_test","init_heap","Framed","Identical","KERNEL_SPACE","MapArea","MapPermission","MapType","MemorySet","R","U","W","X","__private_field","activate","all","areas","bitand","bitand_assign","bitor","bitor_assign","bits","bits","bitxor","bitxor_assign","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","clone","clone","clone_into","clone_into","cmp","complement","contains","copy_data","data_frames","deref","difference","ebss","edata","ekernel","empty","eq","eq","erodata","etext","extend","fmt","fmt","fmt","fmt","fmt","fmt","from","from","from","from","from","from_another","from_bits","from_bits_truncate","from_bits_unchecked","from_elf","from_existed_user","from_iter","hash","insert","insert_framed_area","intersection","intersects","into","into","into","into","into","is_all","is_empty","kernel_token","map","map_one","map_perm","map_trampoline","map_type","ne","new","new_bare","new_kernel","not","page_table","partial_cmp","push","recycle_data_pages","remap_test","remove","remove_area_with_start_vpn","sbss_with_stack","sdata","set","srodata","stext","strampoline","sub","sub_assign","symmetric_difference","to_owned","to_owned","toggle","token","translate","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","union","unmap","unmap_one","vpn_range","A","D","G","PTEFlags","PageTable","PageTableEntry","R","U","UserBuffer","UserBufferIterator","V","W","X","all","bitand","bitand_assign","bitor","bitor_assign","bits","bits","bits","bitxor","bitxor_assign","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","buffers","buffers","clone","clone","clone_into","clone_into","cmp","complement","contains","current_buffer","current_idx","difference","empty","empty","eq","executable","extend","find_pte","find_pte_create","flags","fmt","fmt","fmt","fmt","fmt","frames","from","from","from","from","from","from_bits","from_bits_truncate","from_bits_unchecked","from_iter","from_token","hash","insert","intersection","intersects","into","into","into","into","into","into_iter","into_iter","is_all","is_empty","is_valid","len","map","ne","new","new","new","next","not","partial_cmp","ppn","readable","remove","root_ppn","set","sub","sub_assign","symmetric_difference","to_owned","to_owned","toggle","token","translate","translate_va","translated_byte_buffer","translated_ref","translated_refmut","translated_str","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","union","unmap","writable","SBI_CLEAR_IPI","SBI_CONSOLE_GETCHAR","SBI_CONSOLE_PUTCHAR","SBI_REMOTE_FENCE_I","SBI_REMOTE_SFENCE_VMA","SBI_REMOTE_SFENCE_VMA_ASID","SBI_SEND_IPI","SBI_SET_TIMER","SBI_SHUTDOWN","console_getchar","console_putchar","sbi_call","set_timer","shutdown","UPSafeCell","inner","up","UPSafeCell","borrow","borrow_mut","exclusive_access","from","inner","into","new","try_from","try_into","type_id","SYSCALL_CLOSE","SYSCALL_EXEC","SYSCALL_EXIT","SYSCALL_FORK","SYSCALL_GETPID","SYSCALL_GET_TIME","SYSCALL_OPEN","SYSCALL_READ","SYSCALL_WAITPID","SYSCALL_WRITE","SYSCALL_YIELD","fs","process","syscall","sys_close","sys_open","sys_read","sys_write","sys_exec","sys_exit","sys_fork","sys_get_time","sys_getpid","sys_waitpid","sys_yield","0","IDLE_PID","INITPROC","KernelStack","PidAllocator","PidHandle","Processor","TaskContext","TaskManager","__private_field","add_initproc","add_task","borrow","borrow_mut","context","current","current","current_task","current_trap_cx","current_user_token","deref","exit_current_and_run_next","fetch_task","from","idle_task_cx","into","manager","pid","pid","pid_alloc","processor","ra","ready_queue","recycled","run_tasks","s","schedule","sp","suspend_current_and_run_next","switch","take_current_task","task","try_from","try_into","type_id","TaskContext","borrow","borrow_mut","from","goto_trap_return","into","ra","s","sp","try_from","try_into","type_id","zero_init","TASK_MANAGER","TaskManager","__private_field","add","add_task","borrow","borrow","borrow_mut","borrow_mut","deref","fetch","fetch_task","from","from","into","into","new","ready_queue","try_from","try_from","try_into","try_into","type_id","type_id","0","KernelStack","PID_ALLOCATOR","PidAllocator","PidHandle","__private_field","alloc","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","current","dealloc","deref","drop","drop","from","from","from","from","get_top","into","into","into","into","kernel_stack_position","new","new","pid","pid_alloc","push_on_top","recycled","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","PROCESSOR","Processor","__private_field","borrow","borrow","borrow_mut","borrow_mut","current","current","current_task","current_trap_cx","current_user_token","deref","from","from","get_idle_task_cx_ptr","idle_task_cx","into","into","new","run_tasks","schedule","take_current","take_current_task","try_from","try_from","try_into","try_into","type_id","type_id","__switch","Ready","Running","TaskControlBlock","TaskControlBlockInner","TaskStatus","Zombie","alloc_fd","base_size","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","children","clone","clone_into","eq","exec","exit_code","fd_table","fork","from","from","from","get_status","get_trap_cx","get_user_token","getpid","inner","inner_exclusive_access","into","into","into","is_zombie","kernel_stack","memory_set","new","parent","pid","task_cx","task_status","to_owned","trap_cx_ppn","try_from","try_from","try_from","try_into","try_into","try_into","type_id","type_id","type_id","MSEC_PER_SEC","TICKS_PER_SEC","get_time","get_time_ms","set_next_trigger","TrapContext","context","enable_timer_interrupt","init","kernel_satp","kernel_sp","sepc","set_kernel_trap_entry","set_user_trap_entry","sstatus","trap_from_kernel","trap_handler","trap_handler","trap_return","x","TrapContext","app_init_context","borrow","borrow_mut","fmt","from","into","kernel_satp","kernel_sp","sepc","set_sp","sstatus","trap_handler","try_from","try_into","type_id","x"],"q":["os","","","","","","","","","","","","","","","","","os::board","","","","","","","","","","","","","","","","","","","","","","","","","","","","os::config","","","","","","","os::console","","","","","","","","","","os::drivers","os::drivers::block","","","","","","","","","","","","","os::drivers::block::sdcard","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","os::drivers::block::sdcard::InitError","","","os::drivers::block::virtio_blk","","","","","","","","","","","","","","","","","","","","","","","","","","","os::fs","","","","","","","","","","","","","","","","","os::fs::inode","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","os::fs::stdio","","","","","","","","","","","","","","","","","","","","","","","","os::lang_items","os::mm","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","os::mm::address","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","os::mm::frame_allocator","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","os::mm::heap_allocator","","","","","os::mm::memory_set","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","os::mm::page_table","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","os::sbi","","","","","","","","","","","","","","os::sync","","","os::sync::up","","","","","","","","","","","os::syscall","","","","","","","","","","","","","","os::syscall::fs","","","","os::syscall::process","","","","","","","os::task","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","os::task::context","","","","","","","","","","","","","os::task::manager","","","","","","","","","","","","","","","","","","","","","","","","os::task::pid","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","os::task::processor","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","os::task::switch","os::task::task","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","os::timer","","","","","os::trap","","","","","","","","","","","","","","","os::trap::context","","","","","","","","","","","","","","","",""],"d":["","clear BSS segment","Constants used in rCore","SBI console driver, for text output","","File system in os","The panic handler","Memory management implementation","print string macro","println string macro","the rust entry-point of os","SBI call wrappers","Synchronization and interior mutability primitives","Implementation of syscalls","Task management implementation","RISC-V timer-related functionality","Trap handling functionality","","","","","","","","","","","RISCV64 configuration","","Address of the sifive_test mapped device.","","","Exit with specified return code.","Exit qemu with specified exit code.","Encode the exit code using EXIT_FAILURE_FLAG.","Exit QEMU using EXIT_FAILURE, aka 1.","","Exit QEMU using EXIT_SUCCESS, aka 0, if possible.","","Returns the argument unchanged.","Calls U::from(self).","Create an instance.","","","","","","","","","","","","","","Returns the argument unchanged.","Calls U::from(self).","","","","","","","","","","","","","Returns the argument unchanged.","Calls U::from(self).","","","","","","","Number of blocks to erase (SDC) ","Initiate initialization process (SDC) ","","SD commands ","Software reset ","Read CID register ","Stop to read data ","Change R/W block size ","Read block ","Read multiple blocks ","Write a block ","Write multiple blocks ","Leading command for ACMD* ","Read OCR ","Enable/disable CRC check ","Check voltage range (SDC V2) ","Read CSD register ","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Card Identification Data: CID Register","Card Specific Data: CSD Register","Card information","","CS value passed to SPI controller, this is a dummy value …","GPIOHS GPIO number to use for controlling the SD card CS …","Data token start byte, Start Multiple Block Read ","Data token start byte, Start Multiple Block Write ","Data token start byte, Start Single Block Read ","Data token start byte, Start Single Block Write ","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","","","","","","","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Connect pins to internal functions ","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","","","","File trait","A wrapper around a filesystem inode to implement File …","Open file flags","Standard input","Standard output","","","Arc<Inode> -> OSInodeInner: In order to open files …","List all files in the filesystems","Open file with flags","Read file to UserBuffer","If readable","","Stdin & Stdout","If writable","","Write UserBuffer to file","Allow create","A wrapper around a filesystem inode to implement File …","The OS inode inner in ‘UPSafeCell’","Open file flags","Read only","Read & Write","","Clear file and return an empty one","Write only","","Returns the set containing all flags.","Returns the intersection between the two sets of flags.","Disables all flags disabled in the set.","Returns the union of the two sets of flags.","Adds the set of flags.","Returns the raw value of the flags currently stored.","","Returns the left flags, but with all the right flags …","Toggles the set of flags.","","","","","","","","","","","","Returns the complement of this set of flags.","Returns true if all of the flags in other are contained …","","Returns the difference between the flags in self and other.","Returns an empty set of flags.","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Convert from underlying bit representation, unless that …","Convert from underlying bit representation, dropping any …","Convert from underlying bit representation, preserving all …","","","","","Inserts the specified flags in-place.","Returns the intersection between the flags in self and …","Returns true if there are flags common to both self and …","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Returns true if all flags are currently set.","Returns true if no flags are currently stored.","List all files in the filesystems","","Construct an OS inode from a inode","Returns the complement of this set of flags.","","Open file with flags","","","Read all data inside a inode into vector","Do not check validity for simplicity Return (readable, …","","","Removes the specified flags in-place.","Inserts or removes the specified flags depending on the …","Returns the set difference of the two sets of flags.","Disables all flags enabled in the set.","Returns the symmetric difference between the flags in self …","","Toggles the specified flags in-place.","","","","","","","","","","","","","Returns the union of between the flags in self and other.","","","","Standard input","Standard output","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","","","","","","","","","","manage a frame which has the same lifecycle as the tracker","a memory set instance through lazy_static! managing kernel …","map permission corresponding to that in pte: R W X U","memory set structure, controls virtual-memory space","Record root ppn and has the same lifetime as 1 and 2 level …","page table entry structure","Definitions","phiscal page number","Add value by one","Array of u8 slice that user communicate with os","Iterator of UserBuffer","virtual address","virtual page number","","Implementation of physical and virtual address and page …","","","PTE","U8 vec","","","","allocate a frame","Implementation of FrameAllocator which controls all the …","deallocate a frame","","The global allocator","initiate heap allocator, frame allocator and kernel space","Get kernelspace root ppn","Implementation of MapArea and MemorySet.","Implementation of PageTableEntry and PageTable.","","","Check PageTable running correctly","","Add value by one","Translate a pointer to a mutable u8 Vec through page table","Translate a generic through page table and return a …","Translate a generic through page table and return a …","Translate a pointer to a mutable u8 Vec end with \\\\0 …","","","","","","","Definitions","phiscal page number","a simple range structure for type T","iterator for the simple range structure","Add value by one","","a simple range structure for virtual page number","","virtual address","virtual page number","Check page aligned","Check page aligned","","","","","","","","","","","","","PhysAddr->PhysPageNum","VirtAddr->VirtPageNum","","","","","","","","","","","","","","","","","","","","","PhysAddr->PhysPageNum","VirtAddr->VirtPageNum","","","","","Returns the argument unchanged.","Returns the argument unchanged.","","","","Returns the argument unchanged.","","Returns the argument unchanged.","","","Returns the argument unchanged.","","","Returns the argument unchanged.","Get u8 array on PhysPageNum","","Get mutable reference to PhysAddr value","Get Get mutable reference to PhysAddr value on PhysPageNum","Get PageTableEntry on PhysPageNum","Get reference to PhysAddr value","","Return VPN 3 level index","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","Get page offset","Get page offset","","","","","","Add value by one","","","","","","","","","","","","","","","","","","","","","","","","","","frame allocator instance through lazy_static!","","","manage a frame which has the same lifecycle as the tracker","an implementation for frame allocator","","","","","","","","","","","","","","","","","allocate a frame","a simple test for frame allocator","deallocate a frame","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","initiate the frame allocator using ekernel and MEMORY_END","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","Create an empty FrameTracker","","","","","","","","","","","","","heap allocator instance","heap space ([u8; KERNEL_HEAP_SIZE])","panic when heap allocation error occurs","","initiate heap allocator","","","a memory set instance through lazy_static! managing kernel …","map area structure, controls a contiguous piece of virtual …","map permission corresponding to that in pte: R W X U","map type for memory set: identical or framed","memory set structure, controls virtual-memory space","Readable","Accessible in U mode","Writable","Excutable","","Refresh TLB with sfence.vma","Returns the set containing all flags.","","Returns the intersection between the two sets of flags.","Disables all flags disabled in the set.","Returns the union of the two sets of flags.","Adds the set of flags.","Returns the raw value of the flags currently stored.","","Returns the left flags, but with all the right flags …","Toggles the set of flags.","","","","","","","","","","","","","","","","Returns the complement of this set of flags.","Returns true if all of the flags in other are contained …","data: start-aligned but maybe with shorter length assume …","","","Returns the difference between the flags in self and other.","","","","Returns an empty set of flags.","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","Convert from underlying bit representation, unless that …","Convert from underlying bit representation, dropping any …","Convert from underlying bit representation, preserving all …","Include sections in elf and trampoline and TrapContext and …","Clone a same MemorySet","","","Inserts the specified flags in-place.","Assume that no conflicts.","Returns the intersection between the flags in self and …","Returns true if there are flags common to both self and …","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Returns true if all flags are currently set.","Returns true if no flags are currently stored.","Get kernelspace root ppn","","","","Mention that trampoline is not collected by areas.","","","","Create an empty MemorySet","Without kernel stacks.","Returns the complement of this set of flags.","","","","Remove all MapArea","Check PageTable running correctly","Removes the specified flags in-place.","Remove MapArea that starts with start_vpn","","","Inserts or removes the specified flags depending on the …","","","","Returns the set difference of the two sets of flags.","Disables all flags enabled in the set.","Returns the symmetric difference between the flags in self …","","","Toggles the specified flags in-place.","Get pagetable root_ppn","Translate throuth pagetable","","","","","","","","","","","","","","","","Returns the union of between the flags in self and other.","","","","","","","","Record root ppn and has the same lifetime as 1 and 2 level …","page table entry structure","","","Array of u8 slice that user communicate with os","Iterator of UserBuffer","","","","Returns the set containing all flags.","Returns the intersection between the two sets of flags.","Disables all flags disabled in the set.","Returns the union of the two sets of flags.","Adds the set of flags.","Returns the raw value of the flags currently stored.","","PTE","Returns the left flags, but with all the right flags …","Toggles the set of flags.","","","","","","","","","","","U8 vec","","","","","","","Returns the complement of this set of flags.","Returns true if all of the flags in other are contained …","","","Returns the difference between the flags in self and other.","Returns an empty set of flags.","Return an empty PTE","","Check PTE executable","","Find phsical address by virtual address","Find phsical address by virtual address, create a frame if …","Return 10bit flag","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Convert from underlying bit representation, unless that …","Convert from underlying bit representation, dropping any …","Convert from underlying bit representation, preserving all …","","Temporarily used to get arguments from user space.","","Inserts the specified flags in-place.","Returns the intersection between the flags in self and …","Returns true if there are flags common to both self and …","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","Returns true if all flags are currently set.","Returns true if no flags are currently stored.","Check PTE valid","Length of UserBuffer","Create a mapping form vpn to ppn","","Create an empty PageTable","Create a UserBuffer by parameter","Create a PTE from ppn","","Returns the complement of this set of flags.","","Return 44bit ppn","Check PTE readable","Removes the specified flags in-place.","","Inserts or removes the specified flags depending on the …","Returns the set difference of the two sets of flags.","Disables all flags enabled in the set.","Returns the symmetric difference between the flags in self …","","","Toggles the specified flags in-place.","Get root ppn","Translate VirtPageNum to PageTableEntry","Translate VirtAddr to PhysAddr","Translate a pointer to a mutable u8 Vec through page table","Translate a generic through page table and return a …","Translate a generic through page table and return a …","Translate a pointer to a mutable u8 Vec end with \\\\0 …","","","","","","","","","","","","","","","","Returns the union of between the flags in self and other.","Delete a mapping form vpn","Check PTE writable","","","","","","","","","","use sbi call to getchar from console (qemu uart handler)","use sbi call to putchar in console (qemu uart handler)","general sbi call","use sbi call to set timer","use sbi call to shutdown the kernel","Wrap a static data structure inside it so that we are able …","inner data","Uniprocessor interior mutability primitives","Wrap a static data structure inside it so that we are able …","","","Exclusive access inner data in UPSafeCell. Panic if the …","Returns the argument unchanged.","inner data","Calls U::from(self).","User is responsible to guarantee that inner struct is only …","","","","","","","","","","","","","","","File and filesystem-related syscalls","","handle syscall exception with syscall_id and other …","","","","","","","","","","If there is not a child process whose pid is same as …","","","pid of usertests app in make run TEST=1","Globle process that init user shell","Kernelstack for app","Pid Allocator struct","Bind pid lifetime to PidHandle","Processor management structure","task context structure containing some registers","A array of TaskControlBlock that is thread-safe","","Add init process to the manager","Interface offered to add task","","","Implementation of TaskContext","","The task currently executing on the current processor","Get running task","Get the mutable reference to trap context of current task","Get token of the address space of current task","","Exit the current ‘Running’ task and run the next task …","Interface offered to pop the first task","Returns the argument unchanged.","The basic control flow of each core, helping to select and …","Calls U::from(self).","Implementation of TaskManager","Implementation of PidAllocator","","Allocate a pid from PID_ALLOCATOR","Implementation of Processor and Intersection of control …","return address ( e.g. __restore ) of __switch ASM function","","","The main part of process execution and scheduling Loop …","s0-11 register, callee saved","Return to idle control flow for new scheduling","kernel stack pointer of app","Suspend the current ‘Running’ task and run the next …","Wrap switch.S as a function","Take the current task,leaving a None in its place","Implementation of TaskControlBlock","","","","task context structure containing some registers","","","Returns the argument unchanged.","set Task Context{__restore ASM funciton: trap_return, sp: …","Calls U::from(self).","return address ( e.g. __restore ) of __switch ASM function","s0-11 register, callee saved","kernel stack pointer of app","","","","init task context","","A array of TaskControlBlock that is thread-safe","","Add a task to TaskManager","Interface offered to add task","","","","","","Remove the first task and return it,or None if TaskManager …","Interface offered to pop the first task","Returns the argument unchanged.","Returns the argument unchanged.","Calls U::from(self).","Calls U::from(self).","Creat an empty TaskManager","","","","","","","","","Kernelstack for app","","Pid Allocator struct","Bind pid lifetime to PidHandle","","Allocate a pid","","","","","","","","","","Recycle a pid","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Get the value on the top of kernelstack","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Return (bottom, top) of a kernel stack in kernel space.","Create an empty PidAllocator","Create a kernelstack from pid","","Allocate a pid from PID_ALLOCATOR","Push a value on top of kernelstack","","","","","","","","","","","","","","","Processor management structure","","","","","","Get current task in cloning semanteme","The task currently executing on the current processor","Get running task","Get the mutable reference to trap context of current task","Get token of the address space of current task","","Returns the argument unchanged.","Returns the argument unchanged.","Get mutable reference to idle_task_cx","The basic control flow of each core, helping to select and …","Calls U::from(self).","Calls U::from(self).","Create an empty Processor","The main part of process execution and scheduling Loop …","Return to idle control flow for new scheduling","Get current task in moving semanteme","Take the current task,leaving a None in its place","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","","","","","","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","","","","","","","","","","","","get current time","get current time in microseconds","set the next timer interrupt","trap context structure containing sstatus, sepc and …","Implementation of TrapContext","enable timer interrupt in sie CSR","initialize CSR stvec as the entry of __alltraps","Addr of Page Table","kernel stack","CSR sepc","","","CSR sstatus ","Unimplement: traps/interrupts/exceptions from kernel mode …","handle an interrupt, exception, or system call from user …","Addr of trap_handler function","set the new addr of __restore asm function in TRAMPOLINE …","general regs[0..31]","trap context structure containing sstatus, sepc and …","init app context","","","","Returns the argument unchanged.","Calls U::from(self).","Addr of Page Table","kernel stack","CSR sepc","set stack pointer to x_2 reg (sp)","CSR sstatus ","Addr of trap_handler function","","","","general regs[0..31]"],"i":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,2,1,0,2,1,2,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,3,3,3,3,0,3,3,3,3,0,0,4,0,4,4,4,4,4,0,4,4,4,0,5,6,6,7,0,6,6,6,6,6,6,6,6,6,6,6,6,6,8,9,9,10,10,8,11,11,8,9,9,9,9,9,9,9,9,9,9,10,0,9,7,7,9,9,9,7,0,9,9,7,7,7,7,9,9,9,7,9,7,9,9,0,0,0,0,0,0,0,0,0,0,0,11,11,0,9,9,9,9,9,9,9,9,12,10,5,6,8,9,7,11,12,10,5,6,8,9,7,11,12,6,8,9,7,11,6,8,9,7,11,10,12,10,6,6,8,9,7,11,10,5,6,8,9,7,11,12,10,10,10,10,10,10,0,10,5,6,8,9,7,11,12,0,10,10,5,5,10,10,10,10,10,6,8,9,7,11,10,5,6,8,9,7,11,12,10,5,6,8,9,7,11,12,10,5,6,8,9,7,11,12,5,10,10,13,14,13,15,0,0,0,16,15,16,15,16,16,15,16,15,16,15,15,15,16,15,16,15,16,0,0,0,0,15,0,0,0,0,0,17,18,0,0,0,19,19,18,0,19,18,19,17,0,0,0,17,17,0,17,17,20,17,17,17,17,17,17,17,17,17,18,21,20,17,18,21,20,17,17,17,17,17,17,20,17,17,17,17,17,17,17,17,17,18,21,20,17,17,17,17,17,17,18,21,17,17,17,18,21,20,17,17,17,0,17,18,17,21,0,17,18,18,17,18,18,17,17,17,17,17,17,17,18,21,20,17,18,21,20,17,18,21,20,17,17,18,18,18,0,0,22,23,22,23,22,23,22,23,22,23,22,23,22,23,22,23,22,23,22,23,22,23,0,24,25,26,27,0,0,0,0,0,0,0,0,0,0,0,0,0,28,0,29,30,31,32,33,33,33,0,0,0,34,0,0,0,0,0,29,35,0,34,36,0,0,0,0,24,25,26,27,0,0,0,0,0,0,0,0,0,0,0,0,24,25,37,24,25,26,27,38,37,24,25,26,27,38,24,25,24,25,26,27,38,24,25,26,27,38,24,25,26,27,37,37,24,25,26,27,24,25,24,25,26,27,37,24,24,24,25,25,25,26,26,26,27,27,27,38,26,38,24,26,26,24,38,27,37,24,25,26,27,38,37,38,38,24,25,26,27,37,38,37,24,25,24,25,26,27,38,36,26,27,24,25,26,27,38,37,24,25,26,27,38,37,24,25,26,27,38,37,24,25,26,27,38,0,0,0,0,0,39,40,41,35,41,39,35,41,39,41,40,41,39,35,41,35,0,0,0,35,41,39,41,0,35,41,39,40,35,41,35,41,35,41,39,35,41,39,35,41,39,0,0,0,0,0,42,42,0,0,0,0,0,30,30,30,30,28,29,30,29,30,30,30,30,30,30,30,30,29,43,28,42,30,29,43,28,42,30,42,30,42,30,30,30,30,43,43,28,30,0,0,0,30,42,30,0,0,30,42,30,30,30,30,30,29,43,28,42,30,43,30,30,30,29,29,30,30,30,29,30,30,29,43,28,42,30,30,30,0,43,43,43,29,43,30,43,29,29,30,29,30,29,29,0,30,29,0,0,30,0,0,0,30,30,30,42,30,30,29,29,29,43,28,42,30,29,43,28,42,30,29,43,28,42,30,30,43,43,43,44,44,44,0,0,0,44,44,0,0,44,44,44,44,44,44,44,44,44,44,31,44,44,34,32,33,44,31,34,32,33,44,31,32,33,44,31,44,31,44,44,44,33,33,44,44,31,44,31,44,34,34,31,44,44,44,44,44,34,34,32,33,44,31,44,44,44,44,34,44,44,44,44,34,32,33,44,31,32,33,44,44,31,32,34,44,34,32,31,33,44,44,31,31,44,34,44,44,44,44,44,31,44,34,34,34,0,0,0,0,34,32,33,44,31,34,32,33,44,31,34,32,33,44,31,44,34,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,45,0,0,45,45,45,45,45,45,45,45,45,45,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,46,0,0,0,0,0,0,0,0,47,0,0,47,47,0,48,49,0,0,0,47,0,0,47,49,47,0,0,50,0,0,51,52,48,0,51,0,51,0,0,0,0,47,47,47,0,51,51,51,51,51,51,51,51,51,51,51,51,0,0,53,52,0,52,53,52,53,53,52,0,52,53,52,53,52,52,52,53,52,53,52,53,46,0,0,0,0,54,48,48,46,50,54,48,46,50,54,48,48,54,46,50,48,46,50,54,50,48,46,50,54,0,48,50,50,0,50,48,48,46,50,54,48,46,50,54,48,46,50,54,0,0,55,49,55,49,55,49,49,0,0,0,55,49,55,49,49,49,55,49,0,0,49,0,49,55,49,55,49,55,0,56,56,0,0,0,56,57,57,58,57,56,58,57,56,57,56,56,56,58,57,57,58,58,57,56,57,57,57,58,58,58,58,57,56,57,58,57,58,57,58,57,57,56,57,58,57,56,58,57,56,58,57,56,0,0,0,0,0,0,0,0,0,59,59,59,0,0,59,0,0,59,0,59,0,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59],"f":[null,[[]],null,null,null,null,null,null,null,null,[[],["never",0]],null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,[[["",0]],["",0]],[[["",0]],["",0]],[[["",0],["u32",0]],["never",0]],[[["",0],["u32",0]],["never",0]],[[["u32",0]],["u32",0]],[[["",0]],["never",0]],[[["",0]],["never",0]],[[["",0]],["never",0]],[[["",0]],["never",0]],[[]],[[]],[[["u64",0]]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],null,null,null,null,null,null,null,null,[[["",0]],["",0]],[[["",0]],["",0]],[[]],[[]],[[["arguments",3]]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],[[["",0],["str",0]],["result",6]],null,null,null,[[]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["arc",3]],[[]],[[]],null,[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,[[["",0]]],[[["",0]]],null,null,null,null,null,null,null,null,null,null,null,null,null,null,[[["",0]]],null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["cmd",4]],[[["",0]],["initerror",4]],[[["",0]],["sdcardcsd",3]],[[["",0]],["sdcardcid",3]],[[["",0]],["sdcardinfo",3]],[[["",0],["",0]]],[[["",0],["",0]]],[[["",0],["",0]]],[[["",0],["",0]]],[[["",0],["",0]]],null,[[["",0]],["upsafecell",3]],[[["",0]]],[[["",0],["cmd",4]],["bool",0]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[["",0]],["result",4,[["sdcardinfo",3]]]],[[["",0]],["result",4,[["sdcardcid",3]]]],[[["",0]],["result",4,[["sdcardcsd",3]]]],[[["",0]],["u8",0]],[[["",0]],["u8",0]],[[["",0]],["result",4,[["sdcardinfo",3],["initerror",4]]]],[[],["sdcard",3,[["spiimpl",3,[["spi0",3]]]]]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[["",0]]],[[["u32",0],["u8",0]]],[[]],[[["",0],["usize",0]]],[[["",0]]],[[["",0],["u32",0]],["result",4]],[[["",0],["cmd",4],["u32",0],["u8",0]]],null,null,[[["",0]]],[[["",0]]],[[["",0]]],[[["",0]]],[[["",0]]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0],["usize",0]]],[[["",0]]],[[["",0],["u32",0]],["result",4]],null,null,null,null,null,null,null,null,[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["upsafecell",3]],[[]],[[]],[[]],[[]],[[]],[[["",0],["usize",0]]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["usize",0]],["physaddr",3]],[[["physaddr",3],["usize",0]],["i32",0]],[[["physaddr",3]],["virtaddr",3]],[[["virtaddr",3]],["physaddr",3]],[[["",0],["usize",0]]],null,null,null,null,null,null,null,null,[[]],[[["str",0],["openflags",3]],["option",4,[["arc",3,[["osinode",3]]]]]],[[["",0],["userbuffer",3]],["usize",0]],[[["",0]],["bool",0]],null,null,[[["",0]],["bool",0]],null,[[["",0],["userbuffer",3]],["usize",0]],null,null,null,null,null,null,null,null,null,null,[[]],[[]],[[["",0]]],[[["openflags",3]]],[[["",0]]],[[["",0]],["u32",0]],null,[[]],[[["",0]]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["openflags",3]],[[["",0],["",0]]],[[["",0],["openflags",3]],["ordering",4]],[[]],[[["",0]],["bool",0]],[[["",0]],["arc",3]],[[]],[[]],[[["",0],["openflags",3]],["bool",0]],[[["",0],["intoiterator",8]]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[]],[[]],[[]],[[]],[[["u32",0]],["option",4]],[[["u32",0]]],[[["u32",0]]],[[["intoiterator",8]]],[[["",0],["",0]]],null,null,[[["",0]]],[[]],[[["",0]],["bool",0]],[[]],[[]],[[]],[[]],[[["",0]],["bool",0]],[[["",0]],["bool",0]],[[]],[[["",0],["openflags",3]],["bool",0]],[[["bool",0],["bool",0],["arc",3,[["inode",3]]]]],[[]],null,[[["str",0],["openflags",3]],["option",4,[["arc",3,[["osinode",3]]]]]],[[["",0],["openflags",3]],["option",4,[["ordering",4]]]],[[["",0],["userbuffer",3]],["usize",0]],[[["",0]],["vec",3,[["u8",0]]]],[[["",0]]],[[["",0]],["bool",0]],null,[[["",0]]],[[["",0],["bool",0]]],[[]],[[["",0]]],[[]],[[["",0]]],[[["",0]]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[]],[[["",0]],["bool",0]],null,[[["",0],["userbuffer",3]],["usize",0]],null,null,[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[]],[[]],[[]],[[]],[[["",0],["userbuffer",3]],["usize",0]],[[["",0],["userbuffer",3]],["usize",0]],[[["",0]],["bool",0]],[[["",0]],["bool",0]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["bool",0]],[[["",0]],["bool",0]],[[["",0],["userbuffer",3]],["usize",0]],[[["",0],["userbuffer",3]],["usize",0]],[[["panicinfo",3]],["never",0]],null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,[[],["option",4,[["frametracker",3]]]],null,[[["physpagenum",3]]],null,null,[[]],[[],["usize",0]],null,null,null,null,[[]],null,[[["",0]]],[[["usize",0],["usize",0]],["vec",3]],[[["usize",0]],["",0]],[[["usize",0]],["",0]],[[["usize",0]],["string",3]],null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,[[["",0]],["bool",0]],[[["",0]],["bool",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["physpagenum",3]],[[["",0]],["virtpagenum",3]],[[["",0]],["physaddr",3]],[[["",0]],["virtaddr",3]],[[["",0]],["physpagenum",3]],[[["",0]],["virtpagenum",3]],[[["",0]],["simplerange",3]],[[["",0],["",0]]],[[["",0],["",0]]],[[["",0],["",0]]],[[["",0],["",0]]],[[["",0],["",0]]],[[["",0],["physaddr",3]],["ordering",4]],[[["",0],["virtaddr",3]],["ordering",4]],[[["",0],["physpagenum",3]],["ordering",4]],[[["",0],["virtpagenum",3]],["ordering",4]],null,null,[[["",0],["physaddr",3]],["bool",0]],[[["",0],["virtaddr",3]],["bool",0]],[[["",0],["physpagenum",3]],["bool",0]],[[["",0],["virtpagenum",3]],["bool",0]],[[["",0]],["physpagenum",3]],[[["",0]],["virtpagenum",3]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[]],[[]],[[["physpagenum",3]]],[[["usize",0]]],[[["usize",0]]],[[]],[[["virtpagenum",3]]],[[]],[[["usize",0]]],[[["physaddr",3]]],[[]],[[["usize",0]]],[[["virtaddr",3]]],[[]],[[["",0]]],[[["",0]]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]]],[[["",0]],["",0]],[[["",0]]],[[["",0]]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],null,[[["",0],["physaddr",3]],["bool",0]],[[["",0],["virtaddr",3]],["bool",0]],[[["",0],["physpagenum",3]],["bool",0]],[[["",0],["virtpagenum",3]],["bool",0]],[[]],[[]],[[["",0]],["option",4]],[[["",0]],["usize",0]],[[["",0]],["usize",0]],[[["",0],["physaddr",3]],["option",4,[["ordering",4]]]],[[["",0],["virtaddr",3]],["option",4,[["ordering",4]]]],[[["",0],["physpagenum",3]],["option",4,[["ordering",4]]]],[[["",0],["virtpagenum",3]],["option",4,[["ordering",4]]]],null,[[["",0]]],[[["",0]]],[[["",0]]],[[["",0]]],[[["",0]]],[[["",0]]],[[["",0]]],[[["",0]]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],null,null,null,null,null,null,[[["",0]],["option",4,[["physpagenum",3]]]],[[["",0]],["option",4,[["physpagenum",3]]]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],null,[[["",0],["physpagenum",3]]],[[["",0],["physpagenum",3]]],[[["",0]],["upsafecell",3]],[[["",0]]],null,[[["",0],["formatter",3]],["result",6]],[[],["option",4,[["frametracker",3]]]],[[]],[[["physpagenum",3]]],[[]],[[]],[[]],[[["",0],["physpagenum",3],["physpagenum",3]]],[[]],[[]],[[]],[[]],[[]],[[["physpagenum",3]]],[[]],null,null,[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],null,null,[[["layout",3]],["never",0]],[[]],[[]],null,null,null,null,null,null,null,null,null,null,null,null,[[["",0]]],[[]],null,[[]],[[["",0]]],[[["mappermission",3]]],[[["",0]]],[[["",0]],["u8",0]],null,[[]],[[["",0]]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["maptype",4]],[[["",0]],["mappermission",3]],[[["",0],["",0]]],[[["",0],["",0]]],[[["",0],["mappermission",3]],["ordering",4]],[[]],[[["",0]],["bool",0]],[[["",0],["pagetable",3]]],null,[[["",0]],["arc",3]],[[]],null,null,null,[[]],[[["",0],["maptype",4]],["bool",0]],[[["",0],["mappermission",3]],["bool",0]],null,null,[[["",0],["intoiterator",8]]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[]],[[]],[[]],[[]],[[]],[[["maparea",3]]],[[["u8",0]],["option",4]],[[["u8",0]]],[[["u8",0]]],[[]],[[["memoryset",3]],["memoryset",3]],[[["intoiterator",8]]],[[["",0],["",0]]],[[["",0]]],[[["",0],["virtaddr",3],["virtaddr",3],["mappermission",3]]],[[]],[[["",0]],["bool",0]],[[]],[[]],[[]],[[]],[[]],[[["",0]],["bool",0]],[[["",0]],["bool",0]],[[],["usize",0]],[[["",0],["pagetable",3]]],[[["",0],["pagetable",3],["virtpagenum",3]]],null,[[["",0]]],null,[[["",0],["mappermission",3]],["bool",0]],[[["virtaddr",3],["virtaddr",3],["maptype",4],["mappermission",3]]],[[]],[[]],[[]],null,[[["",0],["mappermission",3]],["option",4,[["ordering",4]]]],[[["",0],["maparea",3],["option",4]]],[[["",0]]],[[]],[[["",0]]],[[["",0],["virtpagenum",3]]],null,null,[[["",0],["bool",0]]],null,null,null,[[]],[[["",0]]],[[]],[[["",0]]],[[["",0]]],[[["",0]]],[[["",0]],["usize",0]],[[["",0],["virtpagenum",3]],["option",4,[["pagetableentry",3]]]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[]],[[["",0],["pagetable",3]]],[[["",0],["pagetable",3],["virtpagenum",3]]],null,null,null,null,null,null,null,null,null,null,null,null,null,null,[[]],[[]],[[["",0]]],[[["pteflags",3]]],[[["",0]]],[[["",0]],["u8",0]],null,null,[[]],[[["",0]]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],null,null,[[["",0]],["pteflags",3]],[[["",0]],["pagetableentry",3]],[[["",0],["",0]]],[[["",0],["",0]]],[[["",0],["pteflags",3]],["ordering",4]],[[]],[[["",0]],["bool",0]],null,null,[[]],[[]],[[]],[[["",0],["pteflags",3]],["bool",0]],[[["",0]],["bool",0]],[[["",0],["intoiterator",8]]],[[["",0],["virtpagenum",3]],["option",4,[["pagetableentry",3]]]],[[["",0],["virtpagenum",3]],["option",4,[["pagetableentry",3]]]],[[["",0]],["pteflags",3]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],null,[[]],[[]],[[]],[[]],[[]],[[["u8",0]],["option",4]],[[["u8",0]]],[[["u8",0]]],[[["intoiterator",8]]],[[["usize",0]]],[[["",0],["",0]]],[[["",0]]],[[]],[[["",0]],["bool",0]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[["",0]],["bool",0]],[[["",0]],["bool",0]],[[["",0]],["bool",0]],[[["",0]],["usize",0]],[[["",0],["virtpagenum",3],["physpagenum",3],["pteflags",3]]],[[["",0],["pteflags",3]],["bool",0]],[[]],[[["vec",3]]],[[["physpagenum",3],["pteflags",3]]],[[["",0]],["option",4]],[[]],[[["",0],["pteflags",3]],["option",4,[["ordering",4]]]],[[["",0]],["physpagenum",3]],[[["",0]],["bool",0]],[[["",0]]],null,[[["",0],["bool",0]]],[[]],[[["",0]]],[[]],[[["",0]]],[[["",0]]],[[["",0]]],[[["",0]],["usize",0]],[[["",0],["virtpagenum",3]],["option",4,[["pagetableentry",3]]]],[[["",0],["virtaddr",3]],["option",4,[["physaddr",3]]]],[[["usize",0],["usize",0]],["vec",3]],[[["usize",0]],["",0]],[[["usize",0]],["",0]],[[["usize",0]],["string",3]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[]],[[["",0],["virtpagenum",3]]],[[["",0]],["bool",0]],null,null,null,null,null,null,null,null,null,[[],["usize",0]],[[["usize",0]]],[[["usize",0],["usize",0],["usize",0],["usize",0]],["usize",0]],[[["usize",0]]],[[],["never",0]],null,null,null,null,[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["refmut",3]],[[]],null,[[]],[[]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],null,null,null,null,null,null,null,null,null,null,null,null,null,[[["usize",0]],["isize",0]],[[["usize",0]],["isize",0]],[[["u32",0]],["isize",0]],[[["usize",0],["usize",0]],["isize",0]],[[["usize",0],["usize",0]],["isize",0]],[[],["isize",0]],[[["i32",0]],["never",0]],[[],["isize",0]],[[],["isize",0]],[[],["isize",0]],[[["isize",0]],["isize",0]],[[],["isize",0]],null,null,null,null,null,null,null,null,null,null,[[]],[[["arc",3,[["taskcontrolblock",3]]]]],[[["",0]],["",0]],[[["",0]],["",0]],null,null,null,[[],["option",4,[["arc",3,[["taskcontrolblock",3]]]]]],[[],["trapcontext",3]],[[],["usize",0]],[[["",0]],["arc",3]],[[["i32",0]]],[[],["option",4,[["arc",3,[["taskcontrolblock",3]]]]]],[[]],null,[[]],null,null,null,[[],["pidhandle",3]],null,null,null,null,[[]],null,[[]],null,[[]],null,[[],["option",4,[["arc",3,[["taskcontrolblock",3]]]]]],null,[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],null,[[["",0]],["",0]],[[["",0]],["",0]],[[]],[[["usize",0]]],[[]],null,null,null,[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],[[]],null,null,null,[[["",0],["arc",3,[["taskcontrolblock",3]]]]],[[["arc",3,[["taskcontrolblock",3]]]]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["upsafecell",3]],[[["",0]],["option",4,[["arc",3,[["taskcontrolblock",3]]]]]],[[],["option",4,[["arc",3,[["taskcontrolblock",3]]]]]],[[]],[[]],[[]],[[]],[[]],null,[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],null,null,null,null,null,null,[[["",0]],["pidhandle",3]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],null,[[["",0],["usize",0]]],[[["",0]],["upsafecell",3]],[[["",0]]],[[["",0]]],[[]],[[]],[[]],[[]],[[["",0]],["usize",0]],[[]],[[]],[[]],[[]],[[["usize",0]]],[[]],[[["pidhandle",3]]],null,[[],["pidhandle",3]],[[["",0]]],null,[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],null,null,null,[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["option",4,[["arc",3,[["taskcontrolblock",3]]]]]],null,[[],["option",4,[["arc",3,[["taskcontrolblock",3]]]]]],[[],["trapcontext",3]],[[],["usize",0]],[[["",0]],["upsafecell",3]],[[]],[[]],[[["",0]]],null,[[]],[[]],[[]],[[]],[[]],[[["",0]],["option",4,[["arc",3,[["taskcontrolblock",3]]]]]],[[],["option",4,[["arc",3,[["taskcontrolblock",3]]]]]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],null,null,null,null,null,null,null,[[["",0]],["usize",0]],null,[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],null,[[["",0]],["taskstatus",4]],[[["",0],["",0]]],[[["",0],["taskstatus",4]],["bool",0]],[[["",0]]],null,null,[[["arc",3]],["arc",3,[["taskcontrolblock",3]]]],[[]],[[]],[[]],[[["",0]],["taskstatus",4]],[[["",0]],["trapcontext",3]],[[["",0]],["usize",0]],[[["",0]],["usize",0]],null,[[["",0]],["refmut",3,[["taskcontrolblockinner",3]]]],[[]],[[]],[[]],[[["",0]],["bool",0]],null,null,[[]],null,null,null,null,[[["",0]]],null,[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],null,null,[[],["usize",0]],[[],["usize",0]],[[]],null,null,[[]],[[]],null,null,null,[[]],[[]],null,[[],["never",0]],[[],["never",0]],null,[[],["never",0]],null,null,[[["usize",0],["usize",0],["usize",0],["usize",0],["usize",0]]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0],["formatter",3]],["result",6]],[[]],[[]],null,null,null,[[["",0],["usize",0]]],null,null,[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],null],"p":[[3,"RISCV64"],[8,"QEMUExit"],[3,"Stdout"],[3,"BLOCK_DEVICE"],[3,"SDCardWrapper"],[4,"CMD"],[3,"SDCardCID"],[4,"InitError"],[3,"SDCardCSD"],[3,"SDCard"],[3,"SDCardInfo"],[3,"PERIPHERALS"],[13,"CMDFailed"],[13,"CardCapacityStatusNotSet"],[3,"VirtIOBlock"],[3,"QUEUE_FRAMES"],[3,"OpenFlags"],[3,"OSInode"],[8,"File"],[3,"ROOT_INODE"],[3,"OSInodeInner"],[3,"Stdin"],[3,"Stdout"],[3,"PhysAddr"],[3,"VirtAddr"],[3,"PhysPageNum"],[3,"VirtPageNum"],[3,"KERNEL_SPACE"],[3,"MemorySet"],[3,"MapPermission"],[3,"PageTableEntry"],[3,"UserBuffer"],[3,"UserBufferIterator"],[3,"PageTable"],[3,"FrameTracker"],[8,"StepByOne"],[3,"SimpleRangeIterator"],[3,"SimpleRange"],[3,"FRAME_ALLOCATOR"],[8,"FrameAllocator"],[3,"StackFrameAllocator"],[4,"MapType"],[3,"MapArea"],[3,"PTEFlags"],[3,"UPSafeCell"],[3,"PidHandle"],[3,"INITPROC"],[3,"PidAllocator"],[3,"Processor"],[3,"KernelStack"],[3,"TaskContext"],[3,"TaskManager"],[3,"TASK_MANAGER"],[3,"PID_ALLOCATOR"],[3,"PROCESSOR"],[4,"TaskStatus"],[3,"TaskControlBlockInner"],[3,"TaskControlBlock"],[3,"TrapContext"]]}\ +"os":{"doc":"The main module and entrypoint","t":"AFAAAAAAOOFAAAAAAGRRRCRRCCRRRRRDLLLLFLLLLCCADCMFLLLLLLLLADRDDMLLLLLLLLLLLLLLLLLLLLLLLLLLLLLIDDDDMMAFFKKMAKMKRSGDDDSSDSSMLLLLLLMLLMMLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLMLMMLLLLLLLLLFLLMFLLLLLMLLLLLLLLLLLLLLLLLLLLLMLDDLLLLLLLLLLLLLLLLLLLLLLFDCCDDDDDDDIDDDDMAMMMMMMMFAFMAFFAAMMFMKFFFFRRDDDDIRGRDDLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLMMLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLMMLLLLLLLLLMMKLLLLLLLLLLLLLLLLLLLLLLLLLDIGDDMKLLLLLLLMMKLLLMMLFFFLLLLFLLLKLLMMMLLLLLLLLLHHFFFNNDDDEDSSSSMLLMLLLLLMLLLLLLLLLLLLLLLLLLLLMLLFFFLLLFFLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLFLLMLMLLLLMLLLFLLFFLFFFLLLLLLLLLLLLLLLLLLLLLLLLLLMSSSDDDSSDDSSSLLLLLLMMLLLLLLLLLLLLMMLLLLLLLMMLLLLLLLLLLLLLLMLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLMLLLLLLLLLLFFFFLLLLLLLLLLLLLLLLLLFFFFDDMADDLLLLLLLMLLLLLLLLLLLLRRRRRRRRRRRAAFFFFFFFFFFFFRDDDDDDDMFFLLAMMFFFLFFLMLAAMFAMMMFMFMFAFALLLDLLLLLMMMLLLLDDMLFLLLLLLFLLLLLMLLLLLLDDDDMLLLLLLLLLMLLLLLLLLLLLLLFLLMFLMLLLLLLLLLLLLDDMLLLLLMFFFLLLLMLLLFFLFLLLLLLFNNDDENLMLLLLLLMLLLLMMLLLLLLLLMLLLLLMMLMMMMLMLLLLLLLLLRRFFFDAFFMMMFFMFFMFMDLLLLLLMMMLMMLLLM","n":["board","clear_bss","config","console","drivers","fs","lang_items","mm","print","println","rust_main","sbi","sync","syscall","task","timer","trap","BlockDeviceImpl","CLOCK_FREQ","MEMORY_END","MMIO","CLOCK_FREQ","KERNEL_HEAP_SIZE","KERNEL_STACK_SIZE","MEMORY_END","MMIO","PAGE_SIZE","PAGE_SIZE_BITS","TRAMPOLINE","TRAP_CONTEXT","USER_STACK_SIZE","Stdout","borrow","borrow_mut","from","into","print","try_from","try_into","type_id","write_str","BLOCK_DEVICE","BLOCK_DEVICE","block","BLOCK_DEVICE","VirtIOBlock","__private_field","block_device_test","borrow","borrow_mut","deref","from","into","try_from","try_into","type_id","virtio_blk","QUEUE_FRAMES","VIRTIO0","VirtIOBlock","VirtioHal","__private_field","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","deref","dma_alloc","dma_dealloc","from","from","from","into","into","into","new","phys_to_virt","read_block","try_from","try_from","try_from","try_into","try_into","try_into","type_id","type_id","type_id","virt_to_phys","write_block","File","OSInode","OpenFlags","Stdin","Stdout","bits","inner","inode","list_apps","open_file","read","readable","readable","stdio","writable","writable","write","BLOCK_CACHE_SIZE","CREATE","InodeType","OSInode","OSInodeInner","OpenFlags","RDONLY","RDWR","ROOT_INODE","TRUNC","WRONLY","__private_field","all","bitand","bitand_assign","bitor","bitor_assign","bits","bits","bitxor","bitxor_assign","block_id","block_offset","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","clone","clone_into","cmp","complement","contains","deref","difference","empty","eq","extend","fmt","fmt","fmt","fmt","fmt","from","from","from","from","from_bits","from_bits_truncate","from_bits_unchecked","from_iter","fs","hash","inner","inode","insert","intersection","intersects","into","into","into","into","is_all","is_empty","list_apps","new","not","offset","open_file","partial_cmp","read","read_all","read_write","readable","readable","remove","set","sub","sub_assign","symmetric_difference","to_owned","toggle","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","union","writable","writable","write","Stdin","Stdout","borrow","borrow","borrow_mut","borrow_mut","from","from","into","into","read","read","readable","readable","try_from","try_from","try_into","try_into","type_id","type_id","writable","writable","write","write","panic","FrameTracker","KERNEL_SPACE","KERNEL_SPACE","KERNEL_SPACE","MapPermission","MemorySet","PageTable","PageTableEntry","PhysAddr","PhysPageNum","StepByOne","UserBuffer","UserBufferIterator","VirtAddr","VirtPageNum","__private_field","address","areas","bits","bits","buffers","buffers","current_buffer","current_idx","frame_alloc","frame_allocator","frame_dealloc","frames","heap_allocator","init","kernel_token","memory_set","page_table","page_table","ppn","remap_test","root_ppn","step","translated_byte_buffer","translated_ref","translated_refmut","translated_str","PA_WIDTH_SV39","PPN_WIDTH_SV39","PhysAddr","PhysPageNum","SimpleRange","SimpleRangeIterator","StepByOne","VA_WIDTH_SV39","VPNRange","VPN_WIDTH_SV39","VirtAddr","VirtPageNum","aligned","aligned","borrow","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","ceil","ceil","clone","clone","clone","clone","clone","clone_into","clone_into","clone_into","clone_into","clone_into","cmp","cmp","cmp","cmp","current","end","eq","eq","eq","eq","floor","floor","fmt","fmt","fmt","fmt","from","from","from","from","from","from","from","from","from","from","from","from","from","from","get_bytes_array","get_end","get_mut","get_mut","get_pte_array","get_ref","get_start","indexes","into","into","into","into","into","into","into_iter","into_iter","l","l","new","new","next","page_offset","page_offset","partial_cmp","partial_cmp","partial_cmp","partial_cmp","r","r","step","step","step","to_owned","to_owned","to_owned","to_owned","to_owned","try_from","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","type_id","FRAME_ALLOCATOR","FrameAllocator","FrameAllocatorImpl","FrameTracker","StackFrameAllocator","__private_field","alloc","alloc","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","current","current","dealloc","dealloc","deref","drop","end","end","fmt","frame_alloc","frame_allocator_test","frame_dealloc","from","from","from","init","init_frame_allocator","into","into","into","new","new","new","ppn","recycled","recycled","try_from","try_from","try_from","try_into","try_into","try_into","type_id","type_id","type_id","HEAP_ALLOCATOR","HEAP_SPACE","handle_alloc_error","heap_test","init_heap","Framed","Identical","KERNEL_SPACE","MapArea","MapPermission","MapType","MemorySet","R","U","W","X","__private_field","activate","all","areas","bitand","bitand_assign","bitor","bitor_assign","bits","bits","bitxor","bitxor_assign","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","clone","clone","clone_into","clone_into","cmp","complement","contains","copy_data","data_frames","deref","difference","ebss","edata","ekernel","empty","eq","eq","erodata","etext","extend","fmt","fmt","fmt","fmt","fmt","fmt","from","from","from","from","from","from_another","from_bits","from_bits_truncate","from_bits_unchecked","from_elf","from_existed_user","from_iter","hash","insert","insert_framed_area","intersection","intersects","into","into","into","into","into","is_all","is_empty","kernel_token","map","map_one","map_perm","map_trampoline","map_type","new","new_bare","new_kernel","not","page_table","partial_cmp","push","recycle_data_pages","remap_test","remove","remove_area_with_start_vpn","sbss_with_stack","sdata","set","srodata","stext","strampoline","sub","sub_assign","symmetric_difference","to_owned","to_owned","toggle","token","translate","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","union","unmap","unmap_one","vpn_range","A","D","G","PTEFlags","PageTable","PageTableEntry","R","U","UserBuffer","UserBufferIterator","V","W","X","all","bitand","bitand_assign","bitor","bitor_assign","bits","bits","bits","bitxor","bitxor_assign","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","buffers","buffers","clone","clone","clone_into","clone_into","cmp","complement","contains","current_buffer","current_idx","difference","empty","empty","eq","executable","extend","find_pte","find_pte_create","flags","fmt","fmt","fmt","fmt","fmt","frames","from","from","from","from","from","from_bits","from_bits_truncate","from_bits_unchecked","from_iter","from_token","hash","insert","intersection","intersects","into","into","into","into","into","into_iter","into_iter","is_all","is_empty","is_valid","len","map","new","new","new","next","not","partial_cmp","ppn","readable","remove","root_ppn","set","sub","sub_assign","symmetric_difference","to_owned","to_owned","toggle","token","translate","translate_va","translated_byte_buffer","translated_ref","translated_refmut","translated_str","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","union","unmap","writable","console_getchar","console_putchar","set_timer","shutdown","RawExclusiveLock","UPSafeCell","inner","up","RawExclusiveLock","UPSafeCell","borrow","borrow","borrow_mut","borrow_mut","exclusive_access","from","from","inner","into","into","lock","new","try_from","try_from","try_into","try_into","try_lock","type_id","type_id","unlock","SYSCALL_CLOSE","SYSCALL_EXEC","SYSCALL_EXIT","SYSCALL_FORK","SYSCALL_GETPID","SYSCALL_GET_TIME","SYSCALL_OPEN","SYSCALL_READ","SYSCALL_WAITPID","SYSCALL_WRITE","SYSCALL_YIELD","fs","process","syscall","sys_close","sys_open","sys_read","sys_write","sys_exec","sys_exit","sys_fork","sys_get_time","sys_getpid","sys_waitpid","sys_yield","IDLE_PID","INITPROC","KernelStack","PidAllocator","PidHandle","Processor","TaskContext","TaskManager","__private_field","add_initproc","add_task","borrow","borrow_mut","context","current","current","current_task","current_trap_cx","current_user_token","deref","exit_current_and_run_next","fetch_task","from","idle_task_cx","into","manager","pid","pid","pid_alloc","processor","ra","ready_queue","recycled","run_tasks","s","schedule","sp","suspend_current_and_run_next","switch","take_current_task","task","try_from","try_into","type_id","TaskContext","borrow","borrow_mut","from","goto_trap_return","into","ra","s","sp","try_from","try_into","type_id","zero_init","TASK_MANAGER","TaskManager","__private_field","add","add_task","borrow","borrow","borrow_mut","borrow_mut","deref","fetch","fetch_task","from","from","into","into","new","ready_queue","try_from","try_from","try_into","try_into","type_id","type_id","KernelStack","PID_ALLOCATOR","PidAllocator","PidHandle","__private_field","alloc","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","current","dealloc","deref","drop","drop","from","from","from","from","get_top","into","into","into","into","kernel_stack_position","new","new","pid","pid_alloc","push_on_top","recycled","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","PROCESSOR","Processor","__private_field","borrow","borrow","borrow_mut","borrow_mut","current","current","current_task","current_trap_cx","current_user_token","deref","from","from","get_idle_task_cx_ptr","idle_task_cx","into","into","new","run_tasks","schedule","take_current","take_current_task","try_from","try_from","try_into","try_into","type_id","type_id","__switch","Ready","Running","TaskControlBlock","TaskControlBlockInner","TaskStatus","Zombie","alloc_fd","base_size","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","children","clone","clone_into","eq","exec","exit_code","fd_table","fork","from","from","from","get_status","get_trap_cx","get_user_token","getpid","inner","inner_exclusive_access","into","into","into","is_zombie","kernel_stack","memory_set","new","parent","pid","task_cx","task_status","to_owned","trap_cx_ppn","try_from","try_from","try_from","try_into","try_into","try_into","type_id","type_id","type_id","MSEC_PER_SEC","TICKS_PER_SEC","get_time","get_time_ms","set_next_trigger","TrapContext","context","enable_timer_interrupt","init","kernel_satp","kernel_sp","sepc","set_kernel_trap_entry","set_user_trap_entry","sstatus","trap_from_kernel","trap_handler","trap_handler","trap_return","x","TrapContext","app_init_context","borrow","borrow_mut","fmt","from","into","kernel_satp","kernel_sp","sepc","set_sp","sstatus","trap_handler","try_from","try_into","type_id","x"],"q":[[0,"os"],[17,"os::board"],[21,"os::config"],[31,"os::console"],[41,"os::drivers"],[44,"os::drivers::block"],[57,"os::drivers::block::virtio_blk"],[91,"os::fs"],[108,"os::fs::inode"],[209,"os::fs::stdio"],[233,"os::lang_items"],[234,"os::mm"],[276,"os::mm::address"],[399,"os::mm::frame_allocator"],[448,"os::mm::heap_allocator"],[453,"os::mm::memory_set"],[586,"os::mm::page_table"],[713,"os::sbi"],[717,"os::sync"],[721,"os::sync::up"],[743,"os::syscall"],[757,"os::syscall::fs"],[761,"os::syscall::process"],[768,"os::task"],[812,"os::task::context"],[825,"os::task::manager"],[849,"os::task::pid"],[896,"os::task::processor"],[926,"os::task::switch"],[927,"os::task::task"],[980,"os::timer"],[985,"os::trap"],[1000,"os::trap::context"],[1017,"core::fmt"],[1018,"core::result"],[1019,"core::any"],[1020,"core::fmt"],[1021,"alloc::sync"],[1022,"alloc::vec"],[1023,"core::option"],[1024,"core::cmp"],[1025,"easy_fs::vfs"],[1026,"core::iter::traits::collect"],[1027,"core::fmt"],[1028,"core::panic::panic_info"],[1029,"alloc::string"],[1030,"core::marker"],[1031,"core::cmp"],[1032,"core::alloc::layout"],[1033,"core::cell"],[1034,"core::marker"]],"d":["","clear BSS segment","Constants used in rCore","SBI console driver, for text output","","File system in os","The panic handler","Memory management implementation","print string macro","println string macro","the rust entry-point of os","SBI call wrappers","Synchronization and interior mutability primitives","Implementation of syscalls","Task management implementation","RISC-V timer-related functionality","Trap handling functionality","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","Calls U::from(self).","","","","","","","","","","","","","","","","Returns the argument unchanged.","Calls U::from(self).","","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","","","","","File trait","A wrapper around a filesystem inode to implement File …","Open file flags","Standard input","Standard output","","","Arc<Inode> -> OSInodeInner: In order to open files …","List all files in the filesystems","Open file with flags","Read file to UserBuffer","If readable","","Stdin & Stdout","If writable","","Write UserBuffer to file","","Allow create","","A wrapper around a filesystem inode to implement File …","The OS inode inner in ‘UPSafeCell’","Open file flags","Read only","Read & Write","","Clear file and return an empty one","Write only","","Returns the set containing all flags.","Returns the intersection between the two sets of flags.","Disables all flags disabled in the set.","Returns the union of the two sets of flags.","Adds the set of flags.","Returns the raw value of the flags currently stored.","","Returns the left flags, but with all the right flags …","Toggles the set of flags.","","","","","","","","","","","","","","Returns the complement of this set of flags.","Returns true if all of the flags in other are contained …","","Returns the difference between the flags in self and other.","Returns an empty set of flags.","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Convert from underlying bit representation, unless that …","Convert from underlying bit representation, dropping any …","Convert from underlying bit representation, preserving all …","","","","","","Inserts the specified flags in-place.","Returns the intersection between the flags in self and …","Returns true if there are flags common to both self and …","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Returns true if all flags are currently set.","Returns true if no flags are currently stored.","List all files in the filesystems","Construct an OS inode from a inode","Returns the complement of this set of flags.","","Open file with flags","","","Read all data inside a inode into vector","Do not check validity for simplicity Return (readable, …","","","Removes the specified flags in-place.","Inserts or removes the specified flags depending on the …","Returns the set difference of the two sets of flags.","Disables all flags enabled in the set.","Returns the symmetric difference between the flags in self …","","Toggles the specified flags in-place.","","","","","","","","","","","","","Returns the union of between the flags in self and other.","","","","Standard input","Standard output","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","","","","","","manage a frame which has the same lifecycle as the tracker","","","a memory set instance through lazy_static! managing kernel …","map permission corresponding to that in pte: R W X U","memory set structure, controls virtual-memory space","Record root ppn and has the same lifetime as 1 and 2 level …","page table entry structure","Definitions","phiscal page number","Add value by one","Array of u8 slice that user communicate with os","Iterator of UserBuffer","virtual address","virtual page number","","Implementation of physical and virtual address and page …","","","PTE","U8 vec","","","","allocate a frame","Implementation of FrameAllocator which controls all the …","deallocate a frame","","The global allocator","initiate heap allocator, frame allocator and kernel space","Get kernelspace root ppn","Implementation of MapArea and MemorySet.","Implementation of PageTableEntry and PageTable.","","","Check PageTable running correctly","","Add value by one","Translate a pointer to a mutable u8 Vec through page table","Translate a generic through page table and return a …","Translate a generic through page table and return a …","Translate a pointer to a mutable u8 Vec end with \\\\0 …","","","Definitions","phiscal page number","a simple range structure for type T","iterator for the simple range structure","Add value by one","","a simple range structure for virtual page number","","virtual address","virtual page number","Check page aligned","Check page aligned","","","","","","","","","","","","","PhysAddr->PhysPageNum","VirtAddr->VirtPageNum","","","","","","","","","","","","","","","","","","","","","PhysAddr->PhysPageNum","VirtAddr->VirtPageNum","","","","","Returns the argument unchanged.","","Returns the argument unchanged.","","","Returns the argument unchanged.","","","","Returns the argument unchanged.","Returns the argument unchanged.","","","Returns the argument unchanged.","Get u8 array on PhysPageNum","","Get mutable reference to PhysAddr value","Get Get mutable reference to PhysAddr value on PhysPageNum","Get PageTableEntry on PhysPageNum","Get reference to PhysAddr value","","Return VPN 3 level index","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","","","","","","Get page offset","Get page offset","","","","","","","Add value by one","","","","","","","","","","","","","","","","","","","","","","","","","","frame allocator instance through lazy_static!","","","manage a frame which has the same lifecycle as the tracker","an implementation for frame allocator","","","","","","","","","","","","","","","","","","","allocate a frame","a simple test for frame allocator","deallocate a frame","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","initiate the frame allocator using ekernel and MEMORY_END","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","Create an empty FrameTracker","","","","","","","","","","","","","","heap allocator instance","heap space ([u8; KERNEL_HEAP_SIZE])","panic when heap allocation error occurs","","initiate heap allocator","","","a memory set instance through lazy_static! managing kernel …","map area structure, controls a contiguous piece of virtual …","map permission corresponding to that in pte: R W X U","map type for memory set: identical or framed","memory set structure, controls virtual-memory space","Readable","Accessible in U mode","Writable","Excutable","","Refresh TLB with sfence.vma","Returns the set containing all flags.","","Returns the intersection between the two sets of flags.","Disables all flags disabled in the set.","Returns the union of the two sets of flags.","Adds the set of flags.","Returns the raw value of the flags currently stored.","","Returns the left flags, but with all the right flags …","Toggles the set of flags.","","","","","","","","","","","","","","","","Returns the complement of this set of flags.","Returns true if all of the flags in other are contained …","data: start-aligned but maybe with shorter length assume …","","","Returns the difference between the flags in self and other.","","","","Returns an empty set of flags.","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","Convert from underlying bit representation, unless that …","Convert from underlying bit representation, dropping any …","Convert from underlying bit representation, preserving all …","Include sections in elf and trampoline and TrapContext and …","Clone a same MemorySet","","","Inserts the specified flags in-place.","Assume that no conflicts.","Returns the intersection between the flags in self and …","Returns true if there are flags common to both self and …","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Returns true if all flags are currently set.","Returns true if no flags are currently stored.","Get kernelspace root ppn","","","","Mention that trampoline is not collected by areas.","","","Create an empty MemorySet","Without kernel stacks.","Returns the complement of this set of flags.","","","","Remove all MapArea","Check PageTable running correctly","Removes the specified flags in-place.","Remove MapArea that starts with start_vpn","","","Inserts or removes the specified flags depending on the …","","","","Returns the set difference of the two sets of flags.","Disables all flags enabled in the set.","Returns the symmetric difference between the flags in self …","","","Toggles the specified flags in-place.","Get pagetable root_ppn","Translate throuth pagetable","","","","","","","","","","","","","","","","Returns the union of between the flags in self and other.","","","","","","","","Record root ppn and has the same lifetime as 1 and 2 level …","page table entry structure","","","Array of u8 slice that user communicate with os","Iterator of UserBuffer","","","","Returns the set containing all flags.","Returns the intersection between the two sets of flags.","Disables all flags disabled in the set.","Returns the union of the two sets of flags.","Adds the set of flags.","Returns the raw value of the flags currently stored.","","PTE","Returns the left flags, but with all the right flags …","Toggles the set of flags.","","","","","","","","","","","U8 vec","","","","","","","Returns the complement of this set of flags.","Returns true if all of the flags in other are contained …","","","Returns the difference between the flags in self and other.","Returns an empty set of flags.","Return an empty PTE","","Check PTE executable","","Find phsical address by virtual address","Find phsical address by virtual address, create a frame if …","Return 10bit flag","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Convert from underlying bit representation, unless that …","Convert from underlying bit representation, dropping any …","Convert from underlying bit representation, preserving all …","","Temporarily used to get arguments from user space.","","Inserts the specified flags in-place.","Returns the intersection between the flags in self and …","Returns true if there are flags common to both self and …","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","Returns true if all flags are currently set.","Returns true if no flags are currently stored.","Check PTE valid","Length of UserBuffer","Create a mapping form vpn to ppn","Create an empty PageTable","Create a UserBuffer by parameter","Create a PTE from ppn","","Returns the complement of this set of flags.","","Return 44bit ppn","Check PTE readable","Removes the specified flags in-place.","","Inserts or removes the specified flags depending on the …","Returns the set difference of the two sets of flags.","Disables all flags enabled in the set.","Returns the symmetric difference between the flags in self …","","","Toggles the specified flags in-place.","Get root ppn","Translate VirtPageNum to PageTableEntry","Translate VirtAddr to PhysAddr","Translate a pointer to a mutable u8 Vec through page table","Translate a generic through page table and return a …","Translate a generic through page table and return a …","Translate a pointer to a mutable u8 Vec end with \\\\0 …","","","","","","","","","","","","","","","","Returns the union of between the flags in self and other.","Delete a mapping form vpn","Check PTE writable","use sbi call to getchar from console (qemu uart handler)","use sbi call to putchar in console (qemu uart handler)","use sbi call to set timer","use sbi call to shutdown the kernel","The sync primitive used by easy-fs.","Wrap a static data structure inside it so that we are able …","inner data","Uniprocessor interior mutability primitives","The sync primitive used by easy-fs.","Wrap a static data structure inside it so that we are able …","","","","","Exclusive access inner data in UPSafeCell. Panic if the …","Returns the argument unchanged.","Returns the argument unchanged.","inner data","Calls U::from(self).","Calls U::from(self).","","User is responsible to guarantee that inner struct is only …","","","","","","","","","","","","","","","","","","","","File and filesystem-related syscalls","","handle syscall exception with syscall_id and other …","","","","","","","","","","If there is not a child process whose pid is same as …","","pid of usertests app in make run TEST=1","Globle process that init user shell","Kernelstack for app","Pid Allocator struct","Bind pid lifetime to PidHandle","Processor management structure","task context structure containing some registers","A array of TaskControlBlock that is thread-safe","","Add init process to the manager","Interface offered to add task","","","Implementation of TaskContext","","The task currently executing on the current processor","Get running task","Get the mutable reference to trap context of current task","Get token of the address space of current task","","Exit the current ‘Running’ task and run the next task …","Interface offered to pop the first task","Returns the argument unchanged.","The basic control flow of each core, helping to select and …","Calls U::from(self).","Implementation of TaskManager","Implementation of PidAllocator","","Allocate a pid from PID_ALLOCATOR","Implementation of Processor and Intersection of control …","return address ( e.g. __restore ) of __switch ASM function","","","The main part of process execution and scheduling Loop …","s0-11 register, callee saved","Return to idle control flow for new scheduling","kernel stack pointer of app","Suspend the current ‘Running’ task and run the next …","Wrap switch.S as a function","Take the current task,leaving a None in its place","Implementation of TaskControlBlock","","","","task context structure containing some registers","","","Returns the argument unchanged.","set Task Context{__restore ASM funciton: trap_return, sp: …","Calls U::from(self).","return address ( e.g. __restore ) of __switch ASM function","s0-11 register, callee saved","kernel stack pointer of app","","","","init task context","","A array of TaskControlBlock that is thread-safe","","Add a task to TaskManager","Interface offered to add task","","","","","","Remove the first task and return it,or None if TaskManager …","Interface offered to pop the first task","Returns the argument unchanged.","Returns the argument unchanged.","Calls U::from(self).","Calls U::from(self).","Creat an empty TaskManager","","","","","","","","Kernelstack for app","","Pid Allocator struct","Bind pid lifetime to PidHandle","","Allocate a pid","","","","","","","","","","Recycle a pid","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Get the value on the top of kernelstack","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Return (bottom, top) of a kernel stack in kernel space.","Create an empty PidAllocator","Create a kernelstack from pid","","Allocate a pid from PID_ALLOCATOR","Push a value on top of kernelstack","","","","","","","","","","","","","","","Processor management structure","","","","","","Get current task in cloning semanteme","The task currently executing on the current processor","Get running task","Get the mutable reference to trap context of current task","Get token of the address space of current task","","Returns the argument unchanged.","Returns the argument unchanged.","Get mutable reference to idle_task_cx","The basic control flow of each core, helping to select and …","Calls U::from(self).","Calls U::from(self).","Create an empty Processor","The main part of process execution and scheduling Loop …","Return to idle control flow for new scheduling","Get current task in moving semanteme","Take the current task,leaving a None in its place","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","","","","","","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","","","","","","","","","","","","get current time","get current time in microseconds","set the next timer interrupt","trap context structure containing sstatus, sepc and …","Implementation of TrapContext","enable timer interrupt in sie CSR","initialize CSR stvec as the entry of __alltraps","Addr of Page Table","kernel stack","CSR sepc","","","CSR sstatus ","Unimplement: traps/interrupts/exceptions from kernel mode …","handle an interrupt, exception, or system call from user …","Addr of trap_handler function","set the new addr of __restore asm function in TRAMPOLINE …","general regs[0..31]","trap context structure containing sstatus, sepc and …","init app context","","","","Returns the argument unchanged.","Calls U::from(self).","Addr of Page Table","kernel stack","CSR sepc","set stack pointer to x_2 reg (sp)","CSR sstatus ","Addr of trap_handler function","","","","general regs[0..31]"],"i":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6,6,6,0,6,6,6,6,0,0,0,0,0,9,0,9,9,9,9,9,9,9,9,0,0,0,0,0,12,18,80,12,18,80,12,12,80,80,18,80,12,18,80,12,18,80,18,18,80,12,18,80,12,18,80,12,80,18,0,0,0,0,0,21,22,0,0,0,81,81,22,0,81,22,81,0,21,0,0,0,0,21,21,0,21,21,28,21,21,21,21,21,21,21,21,21,82,82,22,83,28,21,22,83,28,21,21,21,21,21,21,28,21,21,21,21,21,21,21,21,21,22,83,28,21,21,21,21,21,82,21,22,83,21,21,21,22,83,28,21,21,21,0,22,21,83,0,21,22,22,21,22,22,21,21,21,21,21,21,21,22,83,28,21,22,83,28,21,22,83,28,21,21,22,22,22,0,0,34,35,34,35,34,35,34,35,34,35,34,35,34,35,34,35,34,35,34,35,34,35,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,60,0,55,56,49,24,62,62,62,0,0,0,59,0,0,0,0,0,55,13,0,59,43,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,39,40,51,39,40,37,41,42,51,39,40,37,41,42,39,40,39,40,37,41,42,39,40,37,41,42,39,40,37,41,51,51,39,40,37,41,39,40,39,40,37,41,51,39,39,39,40,40,40,37,37,37,41,41,41,42,37,42,39,37,37,39,42,41,51,39,40,37,41,42,51,42,84,42,51,42,51,39,40,39,40,37,41,84,42,43,37,41,39,40,37,41,42,51,39,40,37,41,42,51,39,40,37,41,42,51,39,40,37,41,42,0,0,0,0,0,53,85,52,13,52,53,13,52,53,52,86,85,52,53,13,52,86,13,0,0,0,13,52,53,52,0,13,52,53,85,13,52,13,52,86,13,52,53,13,52,53,13,52,53,0,0,0,0,0,57,57,0,0,0,0,0,56,56,56,56,60,55,56,55,56,56,56,56,56,56,56,56,55,58,60,57,56,55,58,60,57,56,57,56,57,56,56,56,56,58,58,60,56,0,0,0,56,57,56,0,0,56,57,56,56,56,56,56,55,58,60,57,56,58,56,56,56,55,55,56,56,56,55,56,56,55,58,60,57,56,56,56,0,58,58,58,55,58,58,55,55,56,55,56,55,55,0,56,55,0,0,56,0,0,0,56,56,56,57,56,56,55,55,55,58,60,57,56,55,58,60,57,56,55,58,60,57,56,56,58,58,58,61,61,61,0,0,0,61,61,0,0,61,61,61,61,61,61,61,61,61,61,49,61,61,59,24,62,61,49,59,24,62,61,49,24,62,61,49,61,49,61,61,61,62,62,61,61,49,61,49,61,59,59,49,61,61,61,61,61,59,59,24,62,61,49,61,61,61,61,59,61,61,61,61,59,24,62,61,49,24,62,61,61,49,24,59,59,24,49,62,61,61,49,49,61,59,61,61,61,61,61,49,61,59,59,59,0,0,0,0,59,24,62,61,49,59,24,62,61,49,59,24,62,61,49,61,59,49,0,0,0,0,0,0,15,0,0,0,15,29,15,29,15,15,29,15,15,29,29,15,15,29,15,29,29,15,29,29,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,67,0,0,67,67,0,72,76,0,0,0,67,0,0,67,76,67,0,0,74,0,0,69,70,72,0,69,0,69,0,0,0,0,67,67,67,0,69,69,69,69,69,69,69,69,69,69,69,69,0,0,71,70,0,70,71,70,71,71,70,0,70,71,70,71,70,70,70,71,70,71,70,71,0,0,0,0,73,72,72,68,74,73,72,68,74,73,72,72,73,68,74,72,68,74,73,74,72,68,74,73,0,72,74,74,0,74,72,72,68,74,73,72,68,74,73,72,68,74,73,0,0,77,76,77,76,77,76,76,0,0,0,77,76,77,76,76,76,77,76,0,0,76,0,76,77,76,77,76,77,0,79,79,0,0,0,79,78,78,65,78,79,65,78,79,78,79,79,79,65,78,78,65,65,78,79,78,78,78,65,65,65,65,78,79,78,65,78,65,78,65,78,78,79,78,65,78,79,65,78,79,65,78,79,0,0,0,0,0,0,0,0,0,66,66,66,0,0,66,0,0,66,0,66,0,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66],"f":[0,[[],1],0,0,0,0,0,0,0,0,[[],2],0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-1,[]],[-1,-2,[],[]],[3,1],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,5,[]],[[6,7],8],0,0,0,0,0,0,[[],1],[-1,-2,[],[]],[-1,-2,[],[]],[9,[[11,[10]]]],[-1,-1,[]],[-1,-2,[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,5,[]],0,0,0,0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[12,[[15,[[14,[13]]]]]],[16,16],[[16,16],17],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[[],18],[16,16],[[18,16,[20,[19]]],1],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,5,[]],[-1,5,[]],[-1,5,[]],[16,16],[[18,16,[20,[19]]],1],0,0,0,0,0,0,0,0,[[],1],[[7,21],[[23,[[11,[22]]]]]],[[-1,24],16,[]],[-1,25,[]],0,0,[-1,25,[]],0,[[-1,24],16,[]],0,0,0,0,0,0,0,0,0,0,0,0,[[],21],[[21,21],21],[[21,21],1],[[21,21],21],[[21,21],1],[21,26],0,[[21,21],21],[[21,21],1],0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[21,21],[[-1,-2],1,[],[]],[[21,21],27],[21,21],[[21,21],25],[28,[[11,[[30,[29,29,29]]]]]],[[21,21],21],[[],21],[[21,21],25],[[21,-1],1,31],[[21,32],8],[[21,32],8],[[21,32],8],[[21,32],8],[[21,32],8],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[26,[[23,[21]]]],[26,21],[26,21],[-1,21,31],0,[[21,-1],1,33],0,0,[[21,21],1],[[21,21],21],[[21,21],25],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[21,25],[21,25],[[],1],[[25,25,[11,[[30,[29,29,29]]]]],22],[21,21],0,[[7,21],[[23,[[11,[22]]]]]],[[21,21],[[23,[27]]]],[[22,24],16],[22,[[14,[19]]]],[21,[[1,[25,25]]]],[22,25],0,[[21,21],1],[[21,21,25],1],[[21,21],21],[[21,21],1],[[21,21],21],[-1,-2,[],[]],[[21,21],1],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,5,[]],[-1,5,[]],[-1,5,[]],[-1,5,[]],[[21,21],21],[22,25],0,[[22,24],16],0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-1,[]],[-1,-1,[]],[-1,-2,[],[]],[-1,-2,[],[]],[[34,24],16],[[35,24],16],[34,25],[35,25],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,5,[]],[-1,5,[]],[34,25],[35,25],[[34,24],16],[[35,24],16],[36,2],0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[[],[[23,[13]]]],0,[37,1],0,0,[[],1],[[],16],0,0,0,0,[[],1],0,[-1,1,[]],[[16,19,16],[[14,[[20,[19]]]]]],[16,-1,[]],[16,-1,[]],[[16,19],38],0,0,0,0,0,0,0,0,0,0,0,0,[39,25],[40,25],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[39,37],[40,41],[39,39],[40,40],[37,37],[41,41],[[[42,[-1]]],[[42,[-1]]],[43,44,45,46,47,48]],[[-1,-2],1,[],[]],[[-1,-2],1,[],[]],[[-1,-2],1,[],[]],[[-1,-2],1,[],[]],[[-1,-2],1,[],[]],[[39,39],27],[[40,40],27],[[37,37],27],[[41,41],27],0,0,[[39,39],25],[[40,40],25],[[37,37],25],[[41,41],25],[39,37],[40,41],[[39,32],8],[[40,32],8],[[37,32],8],[[41,32],8],[-1,-1,[]],[37,39],[-1,-1,[]],[16,39],[41,40],[-1,-1,[]],[16,40],[16,37],[39,37],[-1,-1,[]],[-1,-1,[]],[16,41],[40,41],[-1,-1,[]],[37,[[20,[19]]]],[[[42,[-1]]],-1,[43,44,45,46,47]],[39,-1,[]],[37,-1,[]],[37,[[20,[49]]]],[39,-1,[]],[[[42,[-1]]],-1,[43,44,45,46,47]],[41,[[50,[16]]]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[[[42,[-1]]],[],[43,44,45,46,47]],0,0,[[-1,-1],[[51,[-1]]],[43,44,45,46,47]],[[-1,-1],[[42,[-1]]],[43,44,45,46,47]],[[[51,[-1]]],23,[43,44,45,46,47]],[39,16],[40,16],[[39,39],[[23,[27]]]],[[40,40],[[23,[27]]]],[[37,37],[[23,[27]]]],[[41,41],[[23,[27]]]],0,0,[-1,1,[]],[37,1],[41,1],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,5,[]],[-1,5,[]],[-1,5,[]],[-1,5,[]],[-1,5,[]],[-1,5,[]],0,0,0,0,0,0,[-1,[[23,[37]]],[]],[52,[[23,[37]]]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],0,0,[[-1,37],1,[]],[[52,37],1],[53,[[15,[52]]]],[13,1],0,0,[[13,32],8],[[],[[23,[13]]]],[[],1],[37,1],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[[52,37,37],1],[[],1],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[[],-1,[]],[37,13],[[],52],0,0,0,[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,5,[]],[-1,5,[]],[-1,5,[]],0,0,[54,2],[[],1],[[],1],0,0,0,0,0,0,0,0,0,0,0,0,[55,1],[[],56],0,[[56,56],56],[[56,56],1],[[56,56],56],[[56,56],1],[56,19],0,[[56,56],56],[[56,56],1],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[57,57],[56,56],[[-1,-2],1,[],[]],[[-1,-2],1,[],[]],[[56,56],27],[56,56],[[56,56],25],[[58,59,[20,[19]]],1],0,[60,[[11,[[15,[55]]]]]],[[56,56],56],0,0,0,[[],56],[[57,57],25],[[56,56],25],0,0,[[56,-1],1,31],[[57,32],8],[[56,32],8],[[56,32],8],[[56,32],8],[[56,32],8],[[56,32],8],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[58,58],[19,[[23,[56]]]],[19,56],[19,56],[[[20,[19]]],[[1,[55,16,16]]]],[55,55],[-1,56,31],[[56,-1],1,33],[[56,56],1],[[55,40,40,56],1],[[56,56],56],[[56,56],25],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[56,25],[56,25],[[],16],[[58,59],1],[[58,59,41],1],0,[55,1],0,[[40,40,57,56],58],[[],55],[[],55],[56,56],0,[[56,56],[[23,[27]]]],[[55,58,[23,[[20,[19]]]]],1],[55,1],[[],1],[[56,56],1],[[55,41],1],0,0,[[56,56,25],1],0,0,0,[[56,56],56],[[56,56],1],[[56,56],56],[-1,-2,[],[]],[-1,-2,[],[]],[[56,56],1],[55,16],[[55,41],[[23,[49]]]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,5,[]],[-1,5,[]],[-1,5,[]],[-1,5,[]],[-1,5,[]],[[56,56],56],[[58,59],1],[[58,59,41],1],0,0,0,0,0,0,0,0,0,0,0,0,0,0,[[],61],[[61,61],61],[[61,61],1],[[61,61],61],[[61,61],1],[61,19],0,0,[[61,61],61],[[61,61],1],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],0,0,[61,61],[49,49],[[-1,-2],1,[],[]],[[-1,-2],1,[],[]],[[61,61],27],[61,61],[[61,61],25],0,0,[[61,61],61],[[],61],[[],49],[[61,61],25],[49,25],[[61,-1],1,31],[[59,41],[[23,[49]]]],[[59,41],[[23,[49]]]],[49,61],[[61,32],8],[[61,32],8],[[61,32],8],[[61,32],8],[[61,32],8],0,[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[19,[[23,[61]]]],[19,61],[19,61],[-1,61,31],[16,59],[[61,-1],1,33],[[61,61],1],[[61,61],61],[[61,61],25],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[24],[-1,-2,[],[]],[61,25],[61,25],[49,25],[24,16],[[59,41,37,61],1],[[],59],[[[14,[[20,[19]]]]],24],[[37,61],49],[62,23],[61,61],[[61,61],[[23,[27]]]],[49,37],[49,25],[[61,61],1],0,[[61,61,25],1],[[61,61],61],[[61,61],1],[[61,61],61],[-1,-2,[],[]],[-1,-2,[],[]],[[61,61],1],[59,16],[[59,41],[[23,[49]]]],[[59,40],[[23,[39]]]],[[16,19,16],[[14,[[20,[19]]]]]],[16,-1,[]],[16,-1,[]],[[16,19],38],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,5,[]],[-1,5,[]],[-1,5,[]],[-1,5,[]],[-1,5,[]],[[61,61],61],[[59,41],1],[49,25],[[],16],[16,1],[16,1],[25,2],0,0,0,0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[[[15,[-1]]],[[63,[-1]]],[]],[-1,-1,[]],[-1,-1,[]],0,[-1,-2,[],[]],[-1,-2,[],[]],[29,1],[-1,[[15,[-1]]],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[29,25],[-1,5,[]],[-1,5,[]],[29,1],0,0,0,0,0,0,0,0,0,0,0,0,0,[[16,[50,[16]]],64],[16,64],[[19,26],64],[[16,19,16],64],[[16,19,16],64],[19,64],[17,2],[[],64],[[],64],[[],64],[[64,17],64],[[],64],0,0,0,0,0,0,0,0,0,[[],1],[[[11,[65]]],1],[-1,-2,[],[]],[-1,-2,[],[]],0,0,0,[[],[[23,[[11,[65]]]]]],[[],66],[[],16],[67,[[11,[65]]]],[17,1],[[],[[23,[[11,[65]]]]]],[-1,-1,[]],0,[-1,-2,[],[]],0,0,0,[[],68],0,0,0,0,[[],1],0,[69,1],0,[[],1],0,[[],[[23,[[11,[65]]]]]],0,[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,5,[]],0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-1,[]],[16,69],[-1,-2,[],[]],0,0,0,[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,5,[]],[[],69],0,0,0,[[70,[11,[65]]],1],[[[11,[65]]],1],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[71,[[15,[70]]]],[70,[[23,[[11,[65]]]]]],[[],[[23,[[11,[65]]]]]],[-1,-1,[]],[-1,-1,[]],[-1,-2,[],[]],[-1,-2,[],[]],[[],70],0,[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,5,[]],[-1,5,[]],0,0,0,0,0,[72,68],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],0,[[72,16],1],[73,[[15,[72]]]],[68,1],[74,1],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[74,16],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[16,[[1,[16,16]]]],[[],72],[68,74],0,[[],68],[[74,-1],[],75],0,[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,5,[]],[-1,5,[]],[-1,5,[]],[-1,5,[]],0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[76,[[23,[[11,[65]]]]]],0,[[],[[23,[[11,[65]]]]]],[[],66],[[],16],[77,[[15,[76]]]],[-1,-1,[]],[-1,-1,[]],[76,69],0,[-1,-2,[],[]],[-1,-2,[],[]],[[],76],[[],1],[69,1],[76,[[23,[[11,[65]]]]]],[[],[[23,[[11,[65]]]]]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,5,[]],[-1,5,[]],0,0,0,0,0,0,0,[78,16],0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],0,[79,79],[[-1,-2],1,[],[]],[[79,79],25],[[65,[20,[19]]],1],0,0,[[[11,[65]]],[[11,[65]]]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[78,79],[78,66],[78,16],[65,16],0,[65,[[63,[78]]]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[78,25],0,0,[[[20,[19]]],65],0,0,0,0,[-1,-2,[],[]],0,[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,5,[]],[-1,5,[]],[-1,5,[]],0,0,[[],16],[[],16],[[],1],0,0,[[],1],[[],1],0,0,0,[[],1],[[],1],0,[[],2],[[],2],0,[[],2],0,0,[[16,16,16,16,16],66],[-1,-2,[],[]],[-1,-2,[],[]],[[66,32],8],[-1,-1,[]],[-1,-2,[],[]],0,0,0,[[66,16],1],0,0,[-1,[[4,[-2]]],[],[]],[-1,[[4,[-2]]],[],[]],[-1,5,[]],0],"c":[],"p":[[15,"tuple"],[15,"never"],[3,"Arguments",1017],[4,"Result",1018],[3,"TypeId",1019],[3,"Stdout",31],[15,"str"],[6,"Result",1017],[3,"BLOCK_DEVICE",44],[8,"BlockDevice",1020],[3,"Arc",1021],[3,"QUEUE_FRAMES",57],[3,"FrameTracker",399],[3,"Vec",1022],[3,"UPSafeCell",721],[15,"usize"],[15,"i32"],[3,"VirtIOBlock",57],[15,"u8"],[15,"slice"],[3,"OpenFlags",108],[3,"OSInode",108],[4,"Option",1023],[3,"UserBuffer",586],[15,"bool"],[15,"u32"],[4,"Ordering",1024],[3,"ROOT_INODE",108],[3,"RawExclusiveLock",721],[3,"Inode",1025],[8,"IntoIterator",1026],[3,"Formatter",1017],[8,"Hasher",1027],[3,"Stdin",209],[3,"Stdout",209],[3,"PanicInfo",1028],[3,"PhysPageNum",276],[3,"String",1029],[3,"PhysAddr",276],[3,"VirtAddr",276],[3,"VirtPageNum",276],[3,"SimpleRange",276],[8,"StepByOne",276],[8,"Copy",1030],[8,"PartialEq",1024],[8,"PartialOrd",1024],[8,"Debug",1017],[8,"Clone",1031],[3,"PageTableEntry",586],[15,"array"],[3,"SimpleRangeIterator",276],[3,"StackFrameAllocator",399],[3,"FRAME_ALLOCATOR",399],[3,"Layout",1032],[3,"MemorySet",453],[3,"MapPermission",453],[4,"MapType",453],[3,"MapArea",453],[3,"PageTable",586],[3,"KERNEL_SPACE",453],[3,"PTEFlags",586],[3,"UserBufferIterator",586],[3,"RefMut",1033],[15,"isize"],[3,"TaskControlBlock",927],[3,"TrapContext",1000],[3,"INITPROC",768],[3,"PidHandle",849],[3,"TaskContext",812],[3,"TaskManager",825],[3,"TASK_MANAGER",825],[3,"PidAllocator",849],[3,"PID_ALLOCATOR",849],[3,"KernelStack",849],[8,"Sized",1030],[3,"Processor",896],[3,"PROCESSOR",896],[3,"TaskControlBlockInner",927],[4,"TaskStatus",927],[3,"VirtioHal",57],[8,"File",91],[6,"InodeType",108],[3,"OSInodeInner",108],[6,"VPNRange",276],[8,"FrameAllocator",399],[6,"FrameAllocatorImpl",399]]}\ }'); -if (window.initSearch) {window.initSearch(searchIndex)}; \ No newline at end of file +if (typeof window !== 'undefined' && window.initSearch) {window.initSearch(searchIndex)}; +if (typeof exports !== 'undefined') {exports.searchIndex = searchIndex}; diff --git a/ch6-dev/search.js b/ch6-dev/search.js deleted file mode 100644 index a8026db5..00000000 --- a/ch6-dev/search.js +++ /dev/null @@ -1,2 +0,0 @@ -(function(){var itemTypes=["mod","externcrate","import","struct","enum","fn","type","static","trait","impl","tymethod","method","structfield","variant","macro","primitive","associatedtype","constant","associatedconstant","union","foreigntype","keyword","existential","attr","derive","traitalias",];var TY_PRIMITIVE=itemTypes.indexOf("primitive");var TY_KEYWORD=itemTypes.indexOf("keyword");function printTab(nb){if(nb===0||nb===1||nb===2){searchState.currentTab=nb}var nb_copy=nb;onEachLazy(document.getElementById("titles").childNodes,function(elem){if(nb_copy===0){addClass(elem,"selected")}else{removeClass(elem,"selected")}nb_copy-=1});onEachLazy(document.getElementById("results").childNodes,function(elem){if(nb===0){addClass(elem,"active")}else{removeClass(elem,"active")}nb-=1})}function removeEmptyStringsFromArray(x){for(var i=0,len=x.length;i-1){var obj=searchIndex[result.id];obj.lev=result.lev;var res=buildHrefAndPath(obj);obj.displayPath=pathSplitter(res[0]);obj.fullPath=obj.displayPath+obj.name;obj.fullPath+="|"+obj.ty;if(duplicates[obj.fullPath]){continue}duplicates[obj.fullPath]=true;obj.href=res[1];out.push(obj);if(out.length>=MAX_RESULTS){break}}}return out}function sortResults(results,isType){var ar=[];for(var entry in results){if(hasOwnPropertyRustdoc(results,entry)){var result=results[entry];result.word=searchWords[result.id];result.item=searchIndex[result.id]||{};ar.push(result)}}results=ar;if(results.length===0){return[]}results.sort(function(aaa,bbb){var a,b;a=(aaa.word!==val);b=(bbb.word!==val);if(a!==b){return a-b}a=(aaa.lev);b=(bbb.lev);if(a!==b){return a-b}a=(aaa.item.crate!==window.currentCrate);b=(bbb.item.crate!==window.currentCrate);if(a!==b){return a-b}a=aaa.word.length;b=bbb.word.length;if(a!==b){return a-b}a=aaa.word;b=bbb.word;if(a!==b){return(a>b?+1:-1)}a=(aaa.index<0);b=(bbb.index<0);if(a!==b){return a-b}a=aaa.index;b=bbb.index;if(a!==b){return a-b}if((aaa.item.ty===TY_PRIMITIVE&&bbb.item.ty!==TY_KEYWORD)||(aaa.item.ty===TY_KEYWORD&&bbb.item.ty!==TY_PRIMITIVE)){return-1}if((bbb.item.ty===TY_PRIMITIVE&&aaa.item.ty!==TY_PRIMITIVE)||(bbb.item.ty===TY_KEYWORD&&aaa.item.ty!==TY_KEYWORD)){return 1}a=(aaa.item.desc==="");b=(bbb.item.desc==="");if(a!==b){return a-b}a=aaa.item.ty;b=bbb.item.ty;if(a!==b){return a-b}a=aaa.item.path;b=bbb.item.path;if(a!==b){return(a>b?+1:-1)}return 0});for(var i=0,len=results.length;i"));return{name:val.substring(0,val.indexOf("<")),generics:values.split(/\s*,\s*/),}}return{name:val,generics:[],}}function checkGenerics(obj,val){var tmp_lev,elem_name;if(val.generics.length>0){if(obj.length>GENERICS_DATA&&obj[GENERICS_DATA].length>=val.generics.length){var elems=Object.create(null);var elength=obj[GENERICS_DATA].length;for(var x=0;xGENERICS_DATA&&obj[GENERICS_DATA].length>0){var elems=Object.create(null);len=obj[GENERICS_DATA].length;for(x=0;xGENERICS_DATA&&obj[GENERICS_DATA].length!==0){tmp_lev=checkGenerics(obj,val);if(tmp_lev<=MAX_LEV_DISTANCE){return tmp_lev}}}}else if(literalSearch){var found=false;if((!val.generics||val.generics.length===0)&&obj.length>GENERICS_DATA&&obj[GENERICS_DATA].length>0){found=obj[GENERICS_DATA].some(function(gen){return gen[NAME]===val.name})}return found?0:MAX_LEV_DISTANCE+1}lev_distance=Math.min(levenshtein(obj[NAME],val.name),lev_distance);if(lev_distance<=MAX_LEV_DISTANCE){lev_distance=Math.ceil((checkGenerics(obj,val)+lev_distance)/2)}if(obj.length>GENERICS_DATA&&obj[GENERICS_DATA].length>0){var olength=obj[GENERICS_DATA].length;for(x=0;x0){var length=obj.type[INPUTS_DATA].length;for(var i=0;iOUTPUT_DATA){var ret=obj.type[OUTPUT_DATA];if(typeof ret[0]==="string"){ret=[ret]}for(var x=0,len=ret.length;xlength){return MAX_LEV_DISTANCE+1}for(var i=0;ilength){break}var lev_total=0;var aborted=false;for(var x=0;xMAX_LEV_DISTANCE){aborted=true;break}lev_total+=lev}if(!aborted){ret_lev=Math.min(ret_lev,Math.round(lev_total/clength))}}return ret_lev}function typePassesFilter(filter,type){if(filter<=NO_TYPE_FILTER||filter===type)return true;var name=itemTypes[type];switch(itemTypes[filter]){case"constant":return name==="associatedconstant";case"fn":return name==="method"||name==="tymethod";case"type":return name==="primitive"||name==="associatedtype";case"trait":return name==="traitalias"}return false}function createAliasFromItem(item){return{crate:item.crate,name:item.name,path:item.path,desc:item.desc,ty:item.ty,parent:item.parent,type:item.type,is_alias:true,}}function handleAliases(ret,query,filterCrates){var aliases=[];var crateAliases=[];if(filterCrates!==null){if(ALIASES[filterCrates]&&ALIASES[filterCrates][query.search]){var query_aliases=ALIASES[filterCrates][query.search];var len=query_aliases.length;for(var i=0;iMAX_RESULTS){ret.others.pop()}};onEach(aliases,pushFunc);onEach(crateAliases,pushFunc)}function addIntoResults(isExact,res,fullId,id,index,lev){if(lev===0||(!isExact&&lev<=MAX_LEV_DISTANCE)){if(res[fullId]!==undefined){var result=res[fullId];if(result.dontValidate||result.lev<=lev){return}}res[fullId]={id:id,index:index,dontValidate:isExact,lev:lev,}}}var nSearchWords=searchWords.length;var i,it;var ty;var fullId;var returned;var in_args;var len;if((val.charAt(0)==="\""||val.charAt(0)==="'")&&val.charAt(val.length-1)===val.charAt(0)){val=extractGenerics(val.substr(1,val.length-2));for(i=0;i")>-1){var trimmer=function(s){return s.trim()};var parts=val.split("->").map(trimmer);var input=parts[0];var inputs=input.split(",").map(trimmer).sort();for(i=0,len=inputs.length;i0){firstNonZeroDistance=distance;break}}in_args=firstNonZeroDistance}addIntoResults(true,results_in_args,fullId,i,-1,in_args);addIntoResults(true,results_returned,fullId,i,-1,returned);if(is_module){addIntoResults(true,results,fullId,i,-1,0)}}}query.inputs=inputs.map(function(input){return input.name});query.output=output.name}else{query.inputs=[val];query.output=val;query.search=val;val=val.replace(/_/g,"");var valGenerics=extractGenerics(val);var paths=valLower.split("::");removeEmptyStringsFromArray(paths);val=paths[paths.length-1];var contains=paths.slice(0,paths.length>1?paths.length-1:1);var lev,j;for(j=0;j1){lev=checkPath(contains,paths[paths.length-1],ty);if(lev>MAX_LEV_DISTANCE){continue}else if(lev>0){lev_add=lev/10}}returned=MAX_LEV_DISTANCE+1;in_args=MAX_LEV_DISTANCE+1;var index=-1;lev=MAX_LEV_DISTANCE+1;fullId=ty.id;if(searchWords[j].indexOf(split[i])>-1||searchWords[j].indexOf(val)>-1||ty.normalizedName.indexOf(val)>-1){if(typePassesFilter(typeFilter,ty.ty)&&results[fullId]===undefined){index=ty.normalizedName.indexOf(val)}}if((lev=levenshtein(searchWords[j],val))<=MAX_LEV_DISTANCE){if(typePassesFilter(typeFilter,ty.ty)){lev+=1}else{lev=MAX_LEV_DISTANCE+1}}in_args=findArg(ty,valGenerics,false,typeFilter);returned=checkReturned(ty,valGenerics,false,typeFilter);lev+=lev_add;if(lev>0&&val.length>3&&searchWords[j].indexOf(val)>-1){if(val.length<6){lev-=1}else{lev=0}}addIntoResults(false,results_in_args,fullId,j,index,in_args);addIntoResults(false,results_returned,fullId,j,index,returned);if(typePassesFilter(typeFilter,ty.ty)&&(index!==-1||lev<=MAX_LEV_DISTANCE)){if(index!==-1&&paths.length<2){lev=0}addIntoResults(false,results,fullId,j,index,lev)}}}var ret={"in_args":sortResults(results_in_args,true),"returned":sortResults(results_returned,true),"others":sortResults(results,false),};handleAliases(ret,query,filterCrates);return ret}function validateResult(name,path,keys,parent){for(var i=0,len=keys.length;i-1||path.indexOf(keys[i])>-1||(parent!==undefined&&parent.name!==undefined&&parent.name.toLowerCase().indexOf(keys[i])>-1)||levenshtein(name,keys[i])<=MAX_LEV_DISTANCE)){return false}}return true}function getQuery(raw){var matches,type="",query;query=raw;matches=query.match(/^(fn|mod|struct|enum|trait|type|const|macro)\s*:\s*/i);if(matches){type=matches[1].replace(/^const$/,"constant");query=query.substring(matches[0].length)}return{raw:raw,query:query,type:type,id:query+type}}function nextTab(direction){var next=(searchState.currentTab+direction+3)%searchState.focusedByTab.length;searchState.focusedByTab[searchState.currentTab]=document.activeElement;printTab(next);focusSearchResult()}function focusSearchResult(){var target=searchState.focusedByTab[searchState.currentTab]||document.querySelectorAll(".search-results.active a").item(0)||document.querySelectorAll("#titles > button").item(searchState.currentTab);if(target){target.focus()}}function buildHrefAndPath(item){var displayPath;var href;var type=itemTypes[item.ty];var name=item.name;var path=item.path;if(type==="mod"){displayPath=path+"::";href=window.rootPath+path.replace(/::/g,"/")+"/"+name+"/index.html"}else if(type==="primitive"||type==="keyword"){displayPath="";href=window.rootPath+path.replace(/::/g,"/")+"/"+type+"."+name+".html"}else if(type==="externcrate"){displayPath="";href=window.rootPath+name+"/index.html"}else if(item.parent!==undefined){var myparent=item.parent;var anchor="#"+type+"."+name;var parentType=itemTypes[myparent.ty];var pageType=parentType;var pageName=myparent.name;if(parentType==="primitive"){displayPath=myparent.name+"::"}else if(type==="structfield"&&parentType==="variant"){var enumNameIdx=item.path.lastIndexOf("::");var enumName=item.path.substr(enumNameIdx+2);path=item.path.substr(0,enumNameIdx);displayPath=path+"::"+enumName+"::"+myparent.name+"::";anchor="#variant."+myparent.name+".field."+name;pageType="enum";pageName=enumName}else{displayPath=path+"::"+myparent.name+"::"}href=window.rootPath+path.replace(/::/g,"/")+"/"+pageType+"."+pageName+".html"+anchor}else{displayPath=item.path+"::";href=window.rootPath+item.path.replace(/::/g,"/")+"/"+type+"."+name+".html"}return[displayPath,href]}function escape(content){var h1=document.createElement("h1");h1.textContent=content;return h1.innerHTML}function pathSplitter(path){var tmp=""+path.replace(/::/g,"::");if(tmp.endsWith("")){return tmp.slice(0,tmp.length-6)}return tmp}function addTab(array,query,display){var extraClass="";if(display===true){extraClass=" active"}var output=document.createElement("div");var length=0;if(array.length>0){output.className="search-results "+extraClass;array.forEach(function(item){var name=item.name;var type=itemTypes[item.ty];length+=1;var extra="";if(type==="primitive"){extra=" (primitive type)"}else if(type==="keyword"){extra=" (keyword)"}var link=document.createElement("a");link.className="result-"+type;link.href=item.href;var wrapper=document.createElement("div");var resultName=document.createElement("div");resultName.className="result-name";if(item.is_alias){var alias=document.createElement("span");alias.className="alias";var bold=document.createElement("b");bold.innerText=item.alias;alias.appendChild(bold);alias.insertAdjacentHTML("beforeend"," - see ");resultName.appendChild(alias)}resultName.insertAdjacentHTML("beforeend",item.displayPath+""+name+extra+"");wrapper.appendChild(resultName);var description=document.createElement("div");description.className="desc";var spanDesc=document.createElement("span");spanDesc.insertAdjacentHTML("beforeend",item.desc);description.appendChild(spanDesc);wrapper.appendChild(description);link.appendChild(wrapper);output.appendChild(link)})}else{output.className="search-failed"+extraClass;output.innerHTML="No results :(
    "+"Try on DuckDuckGo?

    "+"Or try looking in one of these:"}return[output,length]}function makeTabHeader(tabNb,text,nbElems){if(searchState.currentTab===tabNb){return""}return""}function showResults(results,go_to_first,filterCrates){var search=searchState.outputElement();if(go_to_first||(results.others.length===1&&getSettingValue("go-to-only-result")==="true"&&(!search.firstChild||search.firstChild.innerText!==searchState.loadingText))){var elem=document.createElement("a");elem.href=results.others[0].href;removeClass(elem,"active");document.body.appendChild(elem);elem.click();return}var query=getQuery(searchState.input.value);currentResults=query.id;var ret_others=addTab(results.others,query,true);var ret_in_args=addTab(results.in_args,query,false);var ret_returned=addTab(results.returned,query,false);var currentTab=searchState.currentTab;if((currentTab===0&&ret_others[1]===0)||(currentTab===1&&ret_in_args[1]===0)||(currentTab===2&&ret_returned[1]===0)){if(ret_others[1]!==0){currentTab=0}else if(ret_in_args[1]!==0){currentTab=1}else if(ret_returned[1]!==0){currentTab=2}}let crates="";if(window.ALL_CRATES.length>1){crates=` in `}var output=`
    -

    Results for ${escape(query.query)} `+(query.type?" (type: "+escape(query.type)+")":"")+"

    "+crates+`
    `+makeTabHeader(0,"In Names",ret_others[1])+makeTabHeader(1,"In Parameters",ret_in_args[1])+makeTabHeader(2,"In Return Types",ret_returned[1])+"
    ";var resultsElem=document.createElement("div");resultsElem.id="results";resultsElem.appendChild(ret_others[0]);resultsElem.appendChild(ret_in_args[0]);resultsElem.appendChild(ret_returned[0]);search.innerHTML=output;let crateSearch=document.getElementById("crate-search");if(crateSearch){crateSearch.addEventListener("input",updateCrate)}search.appendChild(resultsElem);searchState.focusedByTab=[null,null,null];searchState.showResults(search);var elems=document.getElementById("titles").childNodes;elems[0].onclick=function(){printTab(0)};elems[1].onclick=function(){printTab(1)};elems[2].onclick=function(){printTab(2)};printTab(currentTab)}function execSearch(query,searchWords,filterCrates){query=query.raw.trim();var results={"in_args":[],"returned":[],"others":[],};if(query.length!==0){var tmp=execQuery(getQuery(query),searchWords,filterCrates);results.in_args.push(tmp.in_args);results.returned.push(tmp.returned);results.others.push(tmp.others)}return{"in_args":results.in_args[0],"returned":results.returned[0],"others":results.others[0],}}function search(e,forced){var params=searchState.getQueryStringParams();var query=getQuery(searchState.input.value.trim());if(e){e.preventDefault()}if(query.query.length===0){return}if(!forced&&query.id===currentResults){if(query.query.length>0){putBackSearch()}return}var filterCrates=getFilterCrates();if(filterCrates===null&¶ms["filter-crate"]!==undefined){filterCrates=params["filter-crate"]}searchState.title="Results for "+query.query+" - Rust";if(searchState.browserSupportsHistoryApi()){var newURL=buildUrl(query.raw,filterCrates);if(!history.state&&!params.search){history.pushState(null,"",newURL)}else{history.replaceState(null,"",newURL)}}showResults(execSearch(query,searchWords,filterCrates),params["go_to_first"],filterCrates)}function buildIndex(rawSearchIndex){searchIndex=[];var searchWords=[];var i,word;var currentIndex=0;var id=0;for(var crate in rawSearchIndex){if(!hasOwnPropertyRustdoc(rawSearchIndex,crate)){continue}var crateSize=0;var crateCorpus=rawSearchIndex[crate];searchWords.push(crate);var crateRow={crate:crate,ty:1,name:crate,path:"",desc:crateCorpus.doc,parent:undefined,type:null,id:id,normalizedName:crate.indexOf("_")===-1?crate:crate.replace(/_/g,""),};id+=1;searchIndex.push(crateRow);currentIndex+=1;var itemTypes=crateCorpus.t;var itemNames=crateCorpus.n;var itemPaths=crateCorpus.q;var itemDescs=crateCorpus.d;var itemParentIdxs=crateCorpus.i;var itemFunctionSearchTypes=crateCorpus.f;var paths=crateCorpus.p;var aliases=crateCorpus.a;var len=paths.length;for(i=0;i0?paths[itemParentIdxs[i]-1]:undefined,type:itemFunctionSearchTypes[i],id:id,normalizedName:word.indexOf("_")===-1?word:word.replace(/_/g,""),};id+=1;searchIndex.push(row);lastPath=row.path;crateSize+=1}if(aliases){ALIASES[crate]={};var j,local_aliases;for(var alias_name in aliases){if(!hasOwnPropertyRustdoc(aliases,alias_name)){continue}if(!hasOwnPropertyRustdoc(ALIASES[crate],alias_name)){ALIASES[crate][alias_name]=[]}local_aliases=aliases[alias_name];for(j=0,len=local_aliases.length;j0){searchState.input.value=params.search;search(e)}else{searchState.input.value="";searchState.hideResults()}})}window.onpageshow=function(){var qSearch=searchState.getQueryStringParams().search;if(searchState.input.value===""&&qSearch){searchState.input.value=qSearch}search()}}function updateCrate(ev){if(ev.target.value==="All crates"){var params=searchState.getQueryStringParams();var query=searchState.input.value.trim();if(!history.state&&!params.search){history.pushState(null,"",buildUrl(query,null))}else{history.replaceState(null,"",buildUrl(query,null))}}currentResults=null;search(undefined,true)}searchWords=buildIndex(rawSearchIndex);registerSearchEvents();function runSearchIfNeeded(){if(searchState.getQueryStringParams().search){search()}}runSearchIfNeeded()};if(window.searchIndex!==undefined){initSearch(window.searchIndex)}})() \ No newline at end of file diff --git a/ch6-dev/settings.css b/ch6-dev/settings.css deleted file mode 100644 index 35df7bce..00000000 --- a/ch6-dev/settings.css +++ /dev/null @@ -1 +0,0 @@ -.setting-line{margin:0.6em 0 0.6em 0.3em;position:relative;}.setting-line>div{display:inline-block;vertical-align:top;font-size:17px;padding-top:2px;}.setting-line>.title{font-size:19px;width:100%;max-width:none;border-bottom:1px solid;}.setting-line .radio-line,.setting-line .choices{display:flex;flex-wrap:wrap;}.setting-line .radio-line .setting-name{flex-grow:1;margin-top:auto;margin-bottom:auto;}.setting-line .radio-line input{margin-right:0.3em;}.radio-line .choice{border-radius:0.1em;border:1px solid;margin-left:0.5em;margin-top:0.1em;margin-bottom:0.1em;min-width:3.8em;padding:0.3em;}.toggle{position:relative;display:inline-block;width:45px;height:27px;margin-right:20px;}.toggle input{opacity:0;position:absolute;}.select-wrapper{float:right;position:relative;height:27px;min-width:25%;}.select-wrapper select{appearance:none;-moz-appearance:none;-webkit-appearance:none;background:none;border:2px solid #ccc;padding-right:28px;width:100%;}.select-wrapper img{pointer-events:none;position:absolute;right:0;bottom:0;background:#ccc;height:100%;width:28px;padding:0px 4px;}.select-wrapper select option{color:initial;}.slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:#ccc;-webkit-transition:.3s;transition:.3s;}.slider:before{position:absolute;content:"";height:19px;width:19px;left:4px;bottom:4px;background-color:white;-webkit-transition:.3s;transition:.3s;}input:checked+.slider{background-color:#2196F3;}input:focus+.slider{box-shadow:0 0 0 2px #0a84ff,0 0 0 6px rgba(10,132,255,0.3);}input:checked+.slider:before{-webkit-transform:translateX(19px);-ms-transform:translateX(19px);transform:translateX(19px);}.setting-line>.sub-settings{padding-left:42px;width:100%;display:block;} \ No newline at end of file diff --git a/ch6-dev/settings.html b/ch6-dev/settings.html index a433d003..44145da1 100644 --- a/ch6-dev/settings.html +++ b/ch6-dev/settings.html @@ -1,17 +1 @@ -Rustdoc settings - -
    -

    Rustdoc settings

    Back
    Use system theme
    Theme
    Preferred light theme
    Preferred dark theme
    Auto-hide item contents for large items.
    Auto-hide item methods' documentation
    Auto-hide trait implementation documentation
    Directly go to item in search if there is only one result
    Show line numbers on code examples
    Disable keyboard shortcuts
    - \ No newline at end of file +Rustdoc settings

    Rustdoc settings

    Back
    \ No newline at end of file diff --git a/ch6-dev/settings.js b/ch6-dev/settings.js deleted file mode 100644 index 80471891..00000000 --- a/ch6-dev/settings.js +++ /dev/null @@ -1 +0,0 @@ -(function(){function changeSetting(settingName,value){updateLocalStorage(settingName,value);switch(settingName){case"theme":case"preferred-dark-theme":case"preferred-light-theme":case"use-system-theme":updateSystemTheme();updateLightAndDark();break}}function handleKey(ev){if(ev.ctrlKey||ev.altKey||ev.metaKey){return}switch(getVirtualKey(ev)){case"Enter":case"Return":case"Space":ev.target.checked=!ev.target.checked;ev.preventDefault();break}}function showLightAndDark(){addClass(document.getElementById("theme").parentElement,"hidden");removeClass(document.getElementById("preferred-light-theme").parentElement,"hidden");removeClass(document.getElementById("preferred-dark-theme").parentElement,"hidden")}function hideLightAndDark(){addClass(document.getElementById("preferred-light-theme").parentElement,"hidden");addClass(document.getElementById("preferred-dark-theme").parentElement,"hidden");removeClass(document.getElementById("theme").parentElement,"hidden")}function updateLightAndDark(){if(getSettingValue("use-system-theme")!=="false"){showLightAndDark()}else{hideLightAndDark()}}function setEvents(){updateLightAndDark();onEachLazy(document.getElementsByClassName("slider"),function(elem){var toggle=elem.previousElementSibling;var settingId=toggle.id;var settingValue=getSettingValue(settingId);if(settingValue!==null){toggle.checked=settingValue==="true"}toggle.onchange=function(){changeSetting(this.id,this.checked)};toggle.onkeyup=handleKey;toggle.onkeyrelease=handleKey});onEachLazy(document.getElementsByClassName("select-wrapper"),function(elem){var select=elem.getElementsByTagName("select")[0];var settingId=select.id;var settingValue=getSettingValue(settingId);if(settingValue!==null){select.value=settingValue}select.onchange=function(){changeSetting(this.id,this.value)}});onEachLazy(document.querySelectorAll("input[type=\"radio\"]"),function(elem){const settingId=elem.name;const settingValue=getSettingValue(settingId);if(settingValue!==null&&settingValue!=="null"){elem.checked=settingValue===elem.value}elem.addEventListener("change",function(ev){changeSetting(ev.target.name,ev.target.value)})});document.getElementById("back").addEventListener("click",function(){history.back()})}window.addEventListener("DOMContentLoaded",setEvents)})() \ No newline at end of file diff --git a/ch6-dev/source-files.js b/ch6-dev/source-files.js deleted file mode 100644 index fe18d3e6..00000000 --- a/ch6-dev/source-files.js +++ /dev/null @@ -1,3 +0,0 @@ -var N = null;var sourcesIndex = {}; -sourcesIndex["os"] = {"name":"","dirs":[{"name":"boards","files":["qemu.rs"]},{"name":"drivers","dirs":[{"name":"block","files":["mod.rs","sdcard.rs","virtio_blk.rs"]}],"files":["mod.rs"]},{"name":"fs","files":["inode.rs","mod.rs","stdio.rs"]},{"name":"mm","files":["address.rs","frame_allocator.rs","heap_allocator.rs","memory_set.rs","mod.rs","page_table.rs"]},{"name":"sync","files":["mod.rs","up.rs"]},{"name":"syscall","files":["fs.rs","mod.rs","process.rs"]},{"name":"task","files":["context.rs","manager.rs","mod.rs","pid.rs","processor.rs","switch.rs","task.rs"]},{"name":"trap","files":["context.rs","mod.rs"]}],"files":["config.rs","console.rs","lang_items.rs","main.rs","sbi.rs","timer.rs"]}; -createSourceSidebar(); diff --git a/ch6-dev/source-script.js b/ch6-dev/source-script.js deleted file mode 100644 index 9faf492c..00000000 --- a/ch6-dev/source-script.js +++ /dev/null @@ -1 +0,0 @@ -(function(){function getCurrentFilePath(){var parts=window.location.pathname.split("/");var rootPathParts=window.rootPath.split("/");for(var i=0,len=rootPathParts.length;i"){sidebar.classList.add("expanded");child.innerText="<";updateLocalStorage("source-sidebar-show","true")}else{sidebar.classList.remove("expanded");child.innerText=">";updateLocalStorage("source-sidebar-show","false")}}function createSidebarToggle(){var sidebarToggle=document.createElement("div");sidebarToggle.id="sidebar-toggle";sidebarToggle.onclick=toggleSidebar;var inner=document.createElement("div");if(getCurrentValue("source-sidebar-show")==="true"){inner.innerText="<"}else{inner.innerText=">"}sidebarToggle.appendChild(inner);return sidebarToggle}function createSourceSidebar(){if(!window.rootPath.endsWith("/")){window.rootPath+="/"}var container=document.querySelector("nav.sidebar");var sidebarToggle=createSidebarToggle();container.insertBefore(sidebarToggle,container.firstChild);var sidebar=document.createElement("div");sidebar.id="source-sidebar";if(getCurrentValue("source-sidebar-show")!=="true"){container.classList.remove("expanded")}else{container.classList.add("expanded")}var currentFile=getCurrentFilePath();var hasFoundFile=false;var title=document.createElement("div");title.className="title";title.innerText="Files";sidebar.appendChild(title);Object.keys(sourcesIndex).forEach(function(key){sourcesIndex[key].name=key;hasFoundFile=createDirEntry(sourcesIndex[key],sidebar,"",currentFile,hasFoundFile)});container.appendChild(sidebar);var selected_elem=sidebar.getElementsByClassName("selected")[0];if(typeof selected_elem!=="undefined"){selected_elem.focus()}}var lineNumbersRegex=/^#?(\d+)(?:-(\d+))?$/;function highlightSourceLines(match){if(typeof match==="undefined"){match=window.location.hash.match(lineNumbersRegex)}if(!match){return}var from=parseInt(match[1],10);var to=from;if(typeof match[2]!=="undefined"){to=parseInt(match[2],10)}if(tocur_line_id){var tmp=prev_line_id;prev_line_id=cur_line_id;cur_line_id=tmp}set_fragment(prev_line_id+"-"+cur_line_id)}else{prev_line_id=cur_line_id;set_fragment(cur_line_id)}}}());window.addEventListener("hashchange",function(){var match=window.location.hash.match(lineNumbersRegex);if(match){return highlightSourceLines(match)}});onEachLazy(document.getElementsByClassName("line-numbers"),function(el){el.addEventListener("click",handleSourceHighlight)});highlightSourceLines();window.createSourceSidebar=createSourceSidebar})() \ No newline at end of file diff --git a/ch6-dev/src-files.js b/ch6-dev/src-files.js new file mode 100644 index 00000000..45440865 --- /dev/null +++ b/ch6-dev/src-files.js @@ -0,0 +1,4 @@ +var srcIndex = JSON.parse('{\ +"os":["",[["boards",[],["qemu.rs"]],["drivers",[["block",[],["mod.rs","virtio_blk.rs"]]],["mod.rs"]],["fs",[],["inode.rs","mod.rs","stdio.rs"]],["mm",[],["address.rs","frame_allocator.rs","heap_allocator.rs","memory_set.rs","mod.rs","page_table.rs"]],["sync",[],["mod.rs","up.rs"]],["syscall",[],["fs.rs","mod.rs","process.rs"]],["task",[],["context.rs","manager.rs","mod.rs","pid.rs","processor.rs","switch.rs","task.rs"]],["trap",[],["context.rs","mod.rs"]]],["config.rs","console.rs","lang_items.rs","main.rs","sbi.rs","timer.rs"]]\ +}'); +createSrcSidebar(); diff --git a/ch6-dev/src/os/boards/qemu.rs.html b/ch6-dev/src/os/boards/qemu.rs.html index 7ccb8f34..255ec82f 100644 --- a/ch6-dev/src/os/boards/qemu.rs.html +++ b/ch6-dev/src/os/boards/qemu.rs.html @@ -1,186 +1,19 @@ -qemu.rs - source - -
    1
    -2
    -3
    -4
    -5
    -6
    -7
    -8
    -9
    -10
    -11
    -12
    -13
    -14
    -15
    -16
    -17
    -18
    -19
    -20
    -21
    -22
    -23
    -24
    -25
    -26
    -27
    -28
    -29
    -30
    -31
    -32
    -33
    -34
    -35
    -36
    -37
    -38
    -39
    -40
    -41
    -42
    -43
    -44
    -45
    -46
    -47
    -48
    -49
    -50
    -51
    -52
    -53
    -54
    -55
    -56
    -57
    -58
    -59
    -60
    -61
    -62
    -63
    -64
    -65
    -66
    -67
    -68
    -69
    -70
    -71
    -72
    -73
    -74
    -75
    -76
    -77
    -78
    -79
    -80
    -81
    -82
    -83
    -84
    -85
    -86
    -87
    -88
    -89
    -
    pub const CLOCK_FREQ: usize = 12500000;
    -pub const MEMORY_END: usize = 0x801000000;
    +qemu.rs - source
    1
    +2
    +3
    +4
    +5
    +6
    +7
    +8
    +9
    +
    pub const CLOCK_FREQ: usize = 12500000;
    +pub const MEMORY_END: usize = 0x88000000;
     
    -pub const MMIO: &[(usize, usize)] = &[
    -    (0x0010_0000, 0x00_2000), // VIRT_TEST/RTC  in virt machine
    -    (0x1000_1000, 0x00_1000), // Virtio Block in virt machine
    -];
    +pub const MMIO: &[(usize, usize)] = &[
    +    (0x0010_0000, 0x00_2000), // VIRT_TEST/RTC  in virt machine
    +    (0x1000_1000, 0x00_1000), // Virtio Block in virt machine
    +];
     
    -pub type BlockDeviceImpl = crate::drivers::block::VirtIOBlock;
    -
    -//ref:: https://github.com/andre-richter/qemu-exit
    -use core::arch::asm;
    -
    -const EXIT_SUCCESS: u32 = 0x5555; // Equals `exit(0)`. qemu successful exit
    -
    -const EXIT_FAILURE_FLAG: u32 = 0x3333;
    -const EXIT_FAILURE: u32 = exit_code_encode(1); // Equals `exit(1)`. qemu failed exit
    -const EXIT_RESET: u32 = 0x7777; // qemu reset
    -
    -pub trait QEMUExit {
    -    /// Exit with specified return code.
    -    ///
    -    /// Note: For `X86`, code is binary-OR'ed with `0x1` inside QEMU.
    -    fn exit(&self, code: u32) -> !;
    -
    -    /// Exit QEMU using `EXIT_SUCCESS`, aka `0`, if possible.
    -    ///
    -    /// Note: Not possible for `X86`.
    -    fn exit_success(&self) -> !;
    -
    -    /// Exit QEMU using `EXIT_FAILURE`, aka `1`.
    -    fn exit_failure(&self) -> !;
    -}
    -
    -/// RISCV64 configuration
    -pub struct RISCV64 {
    -    /// Address of the sifive_test mapped device.
    -    addr: u64,
    -}
    -
    -/// Encode the exit code using EXIT_FAILURE_FLAG.
    -const fn exit_code_encode(code: u32) -> u32 {
    -    (code << 16) | EXIT_FAILURE_FLAG
    -}
    -
    -impl RISCV64 {
    -    /// Create an instance.
    -    pub const fn new(addr: u64) -> Self {
    -        RISCV64 { addr }
    -    }
    -}
    -
    -impl QEMUExit for RISCV64 {
    -    /// Exit qemu with specified exit code.
    -    fn exit(&self, code: u32) -> ! {
    -        // If code is not a special value, we need to encode it with EXIT_FAILURE_FLAG.
    -        let code_new = match code {
    -            EXIT_SUCCESS | EXIT_FAILURE | EXIT_RESET => code,
    -            _ => exit_code_encode(code),
    -        };
    -
    -        unsafe {
    -            asm!(
    -                "sw {0}, 0({1})",
    -                in(reg)code_new, in(reg)self.addr
    -            );
    -
    -            // For the case that the QEMU exit attempt did not work, transition into an infinite
    -            // loop. Calling `panic!()` here is unfeasible, since there is a good chance
    -            // this function here is the last expression in the `panic!()` handler
    -            // itself. This prevents a possible infinite loop.
    -            loop {
    -                asm!("wfi", options(nomem, nostack));
    -            }
    -        }
    -    }
    -
    -    fn exit_success(&self) -> ! {
    -        self.exit(EXIT_SUCCESS);
    -    }
    -
    -    fn exit_failure(&self) -> ! {
    -        self.exit(EXIT_FAILURE);
    -    }
    -}
    -
    -const VIRT_TEST: u64 = 0x100000;
    -
    -pub const QEMU_EXIT_HANDLE: RISCV64 = RISCV64::new(VIRT_TEST);
    -
    -
    - \ No newline at end of file +pub type BlockDeviceImpl = crate::drivers::block::VirtIOBlock; + \ No newline at end of file diff --git a/ch6-dev/src/os/config.rs.html b/ch6-dev/src/os/config.rs.html index 432397fa..a868372d 100644 --- a/ch6-dev/src/os/config.rs.html +++ b/ch6-dev/src/os/config.rs.html @@ -1,36 +1,29 @@ -config.rs - source - -
    1
    -2
    -3
    -4
    -5
    -6
    -7
    -8
    -9
    -10
    -11
    -12
    -13
    -14
    -
    //! Constants used in rCore
    -#[allow(unused)]
    +config.rs - source
    1
    +2
    +3
    +4
    +5
    +6
    +7
    +8
    +9
    +10
    +11
    +12
    +13
    +14
    +
    //! Constants used in rCore
    +#[allow(unused)]
     
    -pub const USER_STACK_SIZE: usize = 4096 * 2;
    -pub const KERNEL_STACK_SIZE: usize = 4096 * 2;
    -pub const KERNEL_HEAP_SIZE: usize = 0x20_0000;
    +pub const USER_STACK_SIZE: usize = 4096 * 2;
    +pub const KERNEL_STACK_SIZE: usize = 4096 * 2;
    +pub const KERNEL_HEAP_SIZE: usize = 0x20_0000;
     
    -pub const PAGE_SIZE: usize = 0x1000;
    -pub const PAGE_SIZE_BITS: usize = 0xc;
    +pub const PAGE_SIZE: usize = 0x1000;
    +pub const PAGE_SIZE_BITS: usize = 0xc;
     
    -pub const TRAMPOLINE: usize = usize::MAX - PAGE_SIZE + 1;
    -pub const TRAP_CONTEXT: usize = TRAMPOLINE - PAGE_SIZE;
    +pub const TRAMPOLINE: usize = usize::MAX - PAGE_SIZE + 1;
    +pub const TRAP_CONTEXT: usize = TRAMPOLINE - PAGE_SIZE;
     
    -pub use crate::board::{CLOCK_FREQ, MEMORY_END, MMIO};
    -
    -
    - \ No newline at end of file +pub use crate::board::{CLOCK_FREQ, MEMORY_END, MMIO}; + \ No newline at end of file diff --git a/ch6-dev/src/os/console.rs.html b/ch6-dev/src/os/console.rs.html index 5022b66b..c1f9f845 100644 --- a/ch6-dev/src/os/console.rs.html +++ b/ch6-dev/src/os/console.rs.html @@ -1,76 +1,69 @@ -console.rs - source - -
    1
    -2
    -3
    -4
    -5
    -6
    -7
    -8
    -9
    -10
    -11
    -12
    -13
    -14
    -15
    -16
    -17
    -18
    -19
    -20
    -21
    -22
    -23
    -24
    -25
    -26
    -27
    -28
    -29
    -30
    -31
    -32
    -33
    -34
    -
    //! SBI console driver, for text output
    -use crate::sbi::console_putchar;
    -use core::fmt::{self, Write};
    +console.rs - source
    1
    +2
    +3
    +4
    +5
    +6
    +7
    +8
    +9
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +
    //! SBI console driver, for text output
    +use crate::sbi::console_putchar;
    +use core::fmt::{self, Write};
     
    -struct Stdout;
    +struct Stdout;
     
    -impl Write for Stdout {
    -    fn write_str(&mut self, s: &str) -> fmt::Result {
    -        for c in s.chars() {
    -            console_putchar(c as usize);
    +impl Write for Stdout {
    +    fn write_str(&mut self, s: &str) -> fmt::Result {
    +        for c in s.chars() {
    +            console_putchar(c as usize);
             }
             Ok(())
         }
     }
     
    -pub fn print(args: fmt::Arguments) {
    -    Stdout.write_fmt(args).unwrap();
    +pub fn print(args: fmt::Arguments) {
    +    Stdout.write_fmt(args).unwrap();
     }
     
    -#[macro_export]
    -/// print string macro
    -macro_rules! print {
    -    ($fmt: literal $(, $($arg: tt)+)?) => {
    -        $crate::console::print(format_args!($fmt $(, $($arg)+)?));
    +#[macro_export]
    +/// print string macro
    +macro_rules! print {
    +    ($fmt: literal $(, $($arg: tt)+)?) => {
    +        $crate::console::print(format_args!($fmt $(, $($arg)+)?));
         }
     }
     
    -#[macro_export]
    -/// println string macro
    -macro_rules! println {
    -    ($fmt: literal $(, $($arg: tt)+)?) => {
    -        $crate::console::print(format_args!(concat!($fmt, "\n") $(, $($arg)+)?));
    +#[macro_export]
    +/// println string macro
    +macro_rules! println {
    +    ($fmt: literal $(, $($arg: tt)+)?) => {
    +        $crate::console::print(format_args!(concat!($fmt, "\n") $(, $($arg)+)?));
         }
     }
    -
    -
    - \ No newline at end of file + \ No newline at end of file diff --git a/ch6-dev/src/os/drivers/block/mod.rs.html b/ch6-dev/src/os/drivers/block/mod.rs.html index bdff2da9..aea2f303 100644 --- a/ch6-dev/src/os/drivers/block/mod.rs.html +++ b/ch6-dev/src/os/drivers/block/mod.rs.html @@ -1,68 +1,57 @@ -mod.rs - source - -
    1
    -2
    -3
    -4
    -5
    -6
    -7
    -8
    -9
    -10
    -11
    -12
    -13
    -14
    -15
    -16
    -17
    -18
    -19
    -20
    -21
    -22
    -23
    -24
    -25
    -26
    -27
    -28
    -29
    -30
    -
    mod sdcard;
    -mod virtio_blk;
    +mod.rs - source
    1
    +2
    +3
    +4
    +5
    +6
    +7
    +8
    +9
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +
    mod virtio_blk;
     
    -pub use sdcard::SDCardWrapper;
    -pub use virtio_blk::VirtIOBlock;
    +pub use virtio_blk::VirtIOBlock;
     
    -use crate::board::BlockDeviceImpl;
    -use alloc::sync::Arc;
    -use easy_fs::BlockDevice;
    -use lazy_static::*;
    +use crate::board::BlockDeviceImpl;
    +use alloc::sync::Arc;
    +use easy_fs::BlockDevice;
    +use lazy_static::*;
     
    -lazy_static! {
    -    pub static ref BLOCK_DEVICE: Arc<dyn BlockDevice> = Arc::new(BlockDeviceImpl::new());
    +lazy_static! {
    +    pub static ref BLOCK_DEVICE: Arc<dyn BlockDevice> = Arc::new(BlockDeviceImpl::new());
     }
     
    -#[allow(unused)]
    -pub fn block_device_test() {
    -    let block_device = BLOCK_DEVICE.clone();
    -    let mut write_buffer = [0u8; 512];
    -    let mut read_buffer = [0u8; 512];
    -    for i in 0..512 {
    -        for byte in write_buffer.iter_mut() {
    -            *byte = i as u8;
    +#[allow(unused)]
    +pub fn block_device_test() {
    +    let block_device = BLOCK_DEVICE.clone();
    +    let mut write_buffer = [0u8; 512];
    +    let mut read_buffer = [0u8; 512];
    +    for i in 0..512 {
    +        for byte in write_buffer.iter_mut() {
    +            *byte = i as u8;
             }
    -        block_device.write_block(i as usize, &write_buffer);
    -        block_device.read_block(i as usize, &mut read_buffer);
    -        assert_eq!(write_buffer, read_buffer);
    +        block_device.write_block(i as usize, &write_buffer);
    +        block_device.read_block(i as usize, &mut read_buffer);
    +        assert_eq!(write_buffer, read_buffer);
         }
         println!("block device test passed!");
     }
    -
    -
    - \ No newline at end of file + \ No newline at end of file diff --git a/ch6-dev/src/os/drivers/block/sdcard.rs.html b/ch6-dev/src/os/drivers/block/sdcard.rs.html deleted file mode 100644 index 51359824..00000000 --- a/ch6-dev/src/os/drivers/block/sdcard.rs.html +++ /dev/null @@ -1,1536 +0,0 @@ -sdcard.rs - source - -
    1
    -2
    -3
    -4
    -5
    -6
    -7
    -8
    -9
    -10
    -11
    -12
    -13
    -14
    -15
    -16
    -17
    -18
    -19
    -20
    -21
    -22
    -23
    -24
    -25
    -26
    -27
    -28
    -29
    -30
    -31
    -32
    -33
    -34
    -35
    -36
    -37
    -38
    -39
    -40
    -41
    -42
    -43
    -44
    -45
    -46
    -47
    -48
    -49
    -50
    -51
    -52
    -53
    -54
    -55
    -56
    -57
    -58
    -59
    -60
    -61
    -62
    -63
    -64
    -65
    -66
    -67
    -68
    -69
    -70
    -71
    -72
    -73
    -74
    -75
    -76
    -77
    -78
    -79
    -80
    -81
    -82
    -83
    -84
    -85
    -86
    -87
    -88
    -89
    -90
    -91
    -92
    -93
    -94
    -95
    -96
    -97
    -98
    -99
    -100
    -101
    -102
    -103
    -104
    -105
    -106
    -107
    -108
    -109
    -110
    -111
    -112
    -113
    -114
    -115
    -116
    -117
    -118
    -119
    -120
    -121
    -122
    -123
    -124
    -125
    -126
    -127
    -128
    -129
    -130
    -131
    -132
    -133
    -134
    -135
    -136
    -137
    -138
    -139
    -140
    -141
    -142
    -143
    -144
    -145
    -146
    -147
    -148
    -149
    -150
    -151
    -152
    -153
    -154
    -155
    -156
    -157
    -158
    -159
    -160
    -161
    -162
    -163
    -164
    -165
    -166
    -167
    -168
    -169
    -170
    -171
    -172
    -173
    -174
    -175
    -176
    -177
    -178
    -179
    -180
    -181
    -182
    -183
    -184
    -185
    -186
    -187
    -188
    -189
    -190
    -191
    -192
    -193
    -194
    -195
    -196
    -197
    -198
    -199
    -200
    -201
    -202
    -203
    -204
    -205
    -206
    -207
    -208
    -209
    -210
    -211
    -212
    -213
    -214
    -215
    -216
    -217
    -218
    -219
    -220
    -221
    -222
    -223
    -224
    -225
    -226
    -227
    -228
    -229
    -230
    -231
    -232
    -233
    -234
    -235
    -236
    -237
    -238
    -239
    -240
    -241
    -242
    -243
    -244
    -245
    -246
    -247
    -248
    -249
    -250
    -251
    -252
    -253
    -254
    -255
    -256
    -257
    -258
    -259
    -260
    -261
    -262
    -263
    -264
    -265
    -266
    -267
    -268
    -269
    -270
    -271
    -272
    -273
    -274
    -275
    -276
    -277
    -278
    -279
    -280
    -281
    -282
    -283
    -284
    -285
    -286
    -287
    -288
    -289
    -290
    -291
    -292
    -293
    -294
    -295
    -296
    -297
    -298
    -299
    -300
    -301
    -302
    -303
    -304
    -305
    -306
    -307
    -308
    -309
    -310
    -311
    -312
    -313
    -314
    -315
    -316
    -317
    -318
    -319
    -320
    -321
    -322
    -323
    -324
    -325
    -326
    -327
    -328
    -329
    -330
    -331
    -332
    -333
    -334
    -335
    -336
    -337
    -338
    -339
    -340
    -341
    -342
    -343
    -344
    -345
    -346
    -347
    -348
    -349
    -350
    -351
    -352
    -353
    -354
    -355
    -356
    -357
    -358
    -359
    -360
    -361
    -362
    -363
    -364
    -365
    -366
    -367
    -368
    -369
    -370
    -371
    -372
    -373
    -374
    -375
    -376
    -377
    -378
    -379
    -380
    -381
    -382
    -383
    -384
    -385
    -386
    -387
    -388
    -389
    -390
    -391
    -392
    -393
    -394
    -395
    -396
    -397
    -398
    -399
    -400
    -401
    -402
    -403
    -404
    -405
    -406
    -407
    -408
    -409
    -410
    -411
    -412
    -413
    -414
    -415
    -416
    -417
    -418
    -419
    -420
    -421
    -422
    -423
    -424
    -425
    -426
    -427
    -428
    -429
    -430
    -431
    -432
    -433
    -434
    -435
    -436
    -437
    -438
    -439
    -440
    -441
    -442
    -443
    -444
    -445
    -446
    -447
    -448
    -449
    -450
    -451
    -452
    -453
    -454
    -455
    -456
    -457
    -458
    -459
    -460
    -461
    -462
    -463
    -464
    -465
    -466
    -467
    -468
    -469
    -470
    -471
    -472
    -473
    -474
    -475
    -476
    -477
    -478
    -479
    -480
    -481
    -482
    -483
    -484
    -485
    -486
    -487
    -488
    -489
    -490
    -491
    -492
    -493
    -494
    -495
    -496
    -497
    -498
    -499
    -500
    -501
    -502
    -503
    -504
    -505
    -506
    -507
    -508
    -509
    -510
    -511
    -512
    -513
    -514
    -515
    -516
    -517
    -518
    -519
    -520
    -521
    -522
    -523
    -524
    -525
    -526
    -527
    -528
    -529
    -530
    -531
    -532
    -533
    -534
    -535
    -536
    -537
    -538
    -539
    -540
    -541
    -542
    -543
    -544
    -545
    -546
    -547
    -548
    -549
    -550
    -551
    -552
    -553
    -554
    -555
    -556
    -557
    -558
    -559
    -560
    -561
    -562
    -563
    -564
    -565
    -566
    -567
    -568
    -569
    -570
    -571
    -572
    -573
    -574
    -575
    -576
    -577
    -578
    -579
    -580
    -581
    -582
    -583
    -584
    -585
    -586
    -587
    -588
    -589
    -590
    -591
    -592
    -593
    -594
    -595
    -596
    -597
    -598
    -599
    -600
    -601
    -602
    -603
    -604
    -605
    -606
    -607
    -608
    -609
    -610
    -611
    -612
    -613
    -614
    -615
    -616
    -617
    -618
    -619
    -620
    -621
    -622
    -623
    -624
    -625
    -626
    -627
    -628
    -629
    -630
    -631
    -632
    -633
    -634
    -635
    -636
    -637
    -638
    -639
    -640
    -641
    -642
    -643
    -644
    -645
    -646
    -647
    -648
    -649
    -650
    -651
    -652
    -653
    -654
    -655
    -656
    -657
    -658
    -659
    -660
    -661
    -662
    -663
    -664
    -665
    -666
    -667
    -668
    -669
    -670
    -671
    -672
    -673
    -674
    -675
    -676
    -677
    -678
    -679
    -680
    -681
    -682
    -683
    -684
    -685
    -686
    -687
    -688
    -689
    -690
    -691
    -692
    -693
    -694
    -695
    -696
    -697
    -698
    -699
    -700
    -701
    -702
    -703
    -704
    -705
    -706
    -707
    -708
    -709
    -710
    -711
    -712
    -713
    -714
    -715
    -716
    -717
    -718
    -719
    -720
    -721
    -722
    -723
    -724
    -725
    -726
    -727
    -728
    -729
    -730
    -731
    -732
    -733
    -734
    -735
    -736
    -737
    -738
    -739
    -740
    -741
    -742
    -743
    -744
    -745
    -746
    -747
    -748
    -749
    -750
    -751
    -752
    -753
    -754
    -755
    -756
    -757
    -758
    -759
    -760
    -761
    -762
    -763
    -764
    -
    #![allow(non_snake_case)]
    -#![allow(non_camel_case_types)]
    -#![allow(unused)]
    -
    -use super::BlockDevice;
    -use crate::sync::UPSafeCell;
    -use core::convert::TryInto;
    -use k210_hal::prelude::*;
    -use k210_pac::{Peripherals, SPI0};
    -use k210_soc::{
    -    fpioa::{self, io},
    -    //dmac::{dma_channel, DMAC, DMACExt},
    -    gpio,
    -    gpiohs,
    -    sleep::usleep,
    -    spi::{aitm, frame_format, tmod, work_mode, SPIExt, SPIImpl, SPI},
    -    sysctl,
    -};
    -use lazy_static::*;
    -
    -pub struct SDCard<SPI> {
    -    spi: SPI,
    -    spi_cs: u32,
    -    cs_gpionum: u8,
    -    //dmac: &'a DMAC,
    -    //channel: dma_channel,
    -}
    -
    -/*
    - * Start Data tokens:
    - *         Tokens (necessary because at nop/idle (and CS active) only 0xff is
    - *         on the data/command line)
    - */
    -/** Data token start byte, Start Single Block Read */
    -pub const SD_START_DATA_SINGLE_BLOCK_READ: u8 = 0xFE;
    -/** Data token start byte, Start Multiple Block Read */
    -pub const SD_START_DATA_MULTIPLE_BLOCK_READ: u8 = 0xFE;
    -/** Data token start byte, Start Single Block Write */
    -pub const SD_START_DATA_SINGLE_BLOCK_WRITE: u8 = 0xFE;
    -/** Data token start byte, Start Multiple Block Write */
    -pub const SD_START_DATA_MULTIPLE_BLOCK_WRITE: u8 = 0xFC;
    -
    -pub const SEC_LEN: usize = 512;
    -
    -/** SD commands */
    -#[repr(u8)]
    -#[derive(Debug, PartialEq, Eq, Copy, Clone)]
    -#[allow(unused)]
    -pub enum CMD {
    -    /** Software reset */
    -    CMD0 = 0,
    -    /** Check voltage range (SDC V2) */
    -    CMD8 = 8,
    -    /** Read CSD register */
    -    CMD9 = 9,
    -    /** Read CID register */
    -    CMD10 = 10,
    -    /** Stop to read data */
    -    CMD12 = 12,
    -    /** Change R/W block size */
    -    CMD16 = 16,
    -    /** Read block */
    -    CMD17 = 17,
    -    /** Read multiple blocks */
    -    CMD18 = 18,
    -    /** Number of blocks to erase (SDC) */
    -    ACMD23 = 23,
    -    /** Write a block */
    -    CMD24 = 24,
    -    /** Write multiple blocks */
    -    CMD25 = 25,
    -    /** Initiate initialization process (SDC) */
    -    ACMD41 = 41,
    -    /** Leading command for ACMD* */
    -    CMD55 = 55,
    -    /** Read OCR */
    -    CMD58 = 58,
    -    /** Enable/disable CRC check */
    -    CMD59 = 59,
    -}
    -
    -#[allow(unused)]
    -#[derive(Debug, Copy, Clone)]
    -pub enum InitError {
    -    CMDFailed(CMD, u8),
    -    CardCapacityStatusNotSet([u8; 4]),
    -    CannotGetCardInfo,
    -}
    -
    -/**
    - * Card Specific Data: CSD Register
    - */
    -#[derive(Debug, Copy, Clone)]
    -pub struct SDCardCSD {
    -    pub CSDStruct: u8,        /* CSD structure */
    -    pub SysSpecVersion: u8,   /* System specification version */
    -    pub Reserved1: u8,        /* Reserved */
    -    pub TAAC: u8,             /* Data read access-time 1 */
    -    pub NSAC: u8,             /* Data read access-time 2 in CLK cycles */
    -    pub MaxBusClkFrec: u8,    /* Max. bus clock frequency */
    -    pub CardComdClasses: u16, /* Card command classes */
    -    pub RdBlockLen: u8,       /* Max. read data block length */
    -    pub PartBlockRead: u8,    /* Partial blocks for read allowed */
    -    pub WrBlockMisalign: u8,  /* Write block misalignment */
    -    pub RdBlockMisalign: u8,  /* Read block misalignment */
    -    pub DSRImpl: u8,          /* DSR implemented */
    -    pub Reserved2: u8,        /* Reserved */
    -    pub DeviceSize: u32,      /* Device Size */
    -    //MaxRdCurrentVDDMin: u8,   /* Max. read current @ VDD min */
    -    //MaxRdCurrentVDDMax: u8,   /* Max. read current @ VDD max */
    -    //MaxWrCurrentVDDMin: u8,   /* Max. write current @ VDD min */
    -    //MaxWrCurrentVDDMax: u8,   /* Max. write current @ VDD max */
    -    //DeviceSizeMul: u8,        /* Device size multiplier */
    -    pub EraseGrSize: u8,         /* Erase group size */
    -    pub EraseGrMul: u8,          /* Erase group size multiplier */
    -    pub WrProtectGrSize: u8,     /* Write protect group size */
    -    pub WrProtectGrEnable: u8,   /* Write protect group enable */
    -    pub ManDeflECC: u8,          /* Manufacturer default ECC */
    -    pub WrSpeedFact: u8,         /* Write speed factor */
    -    pub MaxWrBlockLen: u8,       /* Max. write data block length */
    -    pub WriteBlockPaPartial: u8, /* Partial blocks for write allowed */
    -    pub Reserved3: u8,           /* Reserded */
    -    pub ContentProtectAppli: u8, /* Content protection application */
    -    pub FileFormatGroup: u8,     /* File format group */
    -    pub CopyFlag: u8,            /* Copy flag (OTP) */
    -    pub PermWrProtect: u8,       /* Permanent write protection */
    -    pub TempWrProtect: u8,       /* Temporary write protection */
    -    pub FileFormat: u8,          /* File Format */
    -    pub ECC: u8,                 /* ECC code */
    -    pub CSD_CRC: u8,             /* CSD CRC */
    -    pub Reserved4: u8,           /* always 1*/
    -}
    -
    -/**
    - * Card Identification Data: CID Register
    - */
    -#[derive(Debug, Copy, Clone)]
    -pub struct SDCardCID {
    -    pub ManufacturerID: u8, /* ManufacturerID */
    -    pub OEM_AppliID: u16,   /* OEM/Application ID */
    -    pub ProdName1: u32,     /* Product Name part1 */
    -    pub ProdName2: u8,      /* Product Name part2*/
    -    pub ProdRev: u8,        /* Product Revision */
    -    pub ProdSN: u32,        /* Product Serial Number */
    -    pub Reserved1: u8,      /* Reserved1 */
    -    pub ManufactDate: u16,  /* Manufacturing Date */
    -    pub CID_CRC: u8,        /* CID CRC */
    -    pub Reserved2: u8,      /* always 1 */
    -}
    -
    -/**
    - * Card information
    - */
    -#[derive(Debug, Copy, Clone)]
    -pub struct SDCardInfo {
    -    pub SD_csd: SDCardCSD,
    -    pub SD_cid: SDCardCID,
    -    pub CardCapacity: u64,  /* Card Capacity */
    -    pub CardBlockSize: u64, /* Card Block Size */
    -}
    -
    -impl</*'a,*/ X: SPI> SDCard</*'a,*/ X> {
    -    pub fn new(
    -        spi: X,
    -        spi_cs: u32,
    -        cs_gpionum: u8, /*, dmac: &'a DMAC, channel: dma_channel*/
    -    ) -> Self {
    -        Self {
    -            spi,
    -            spi_cs,
    -            cs_gpionum,
    -            /*
    -            dmac,
    -            channel,
    -             */
    -        }
    -    }
    -
    -    fn CS_HIGH(&self) {
    -        gpiohs::set_pin(self.cs_gpionum, true);
    -    }
    -
    -    fn CS_LOW(&self) {
    -        gpiohs::set_pin(self.cs_gpionum, false);
    -    }
    -
    -    fn HIGH_SPEED_ENABLE(&self) {
    -        self.spi.set_clk_rate(10000000);
    -    }
    -
    -    fn lowlevel_init(&self) {
    -        gpiohs::set_direction(self.cs_gpionum, gpio::direction::OUTPUT);
    -        self.spi.set_clk_rate(200000);
    -    }
    -
    -    fn write_data(&self, data: &[u8]) {
    -        self.spi.configure(
    -            work_mode::MODE0,
    -            frame_format::STANDARD,
    -            8, /* data bits */
    -            0, /* endian */
    -            0, /*instruction length*/
    -            0, /*address length*/
    -            0, /*wait cycles*/
    -            aitm::STANDARD,
    -            tmod::TRANS,
    -        );
    -        self.spi.send_data(self.spi_cs, data);
    -    }
    -
    -    /*
    -    fn write_data_dma(&self, data: &[u32]) {
    -        self.spi.configure(
    -            work_mode::MODE0,
    -            frame_format::STANDARD,
    -            8, /* data bits */
    -            0, /* endian */
    -            0, /*instruction length*/
    -            0, /*address length*/
    -            0, /*wait cycles*/
    -            aitm::STANDARD,
    -            tmod::TRANS,
    -        );
    -        self.spi
    -            .send_data_dma(self.dmac, self.channel, self.spi_cs, data);
    -    }
    -     */
    -
    -    fn read_data(&self, data: &mut [u8]) {
    -        self.spi.configure(
    -            work_mode::MODE0,
    -            frame_format::STANDARD,
    -            8, /* data bits */
    -            0, /* endian */
    -            0, /*instruction length*/
    -            0, /*address length*/
    -            0, /*wait cycles*/
    -            aitm::STANDARD,
    -            tmod::RECV,
    -        );
    -        self.spi.recv_data(self.spi_cs, data);
    -    }
    -
    -    /*
    -    fn read_data_dma(&self, data: &mut [u32]) {
    -        self.spi.configure(
    -            work_mode::MODE0,
    -            frame_format::STANDARD,
    -            8, /* data bits */
    -            0, /* endian */
    -            0, /*instruction length*/
    -            0, /*address length*/
    -            0, /*wait cycles*/
    -            aitm::STANDARD,
    -            tmod::RECV,
    -        );
    -        self.spi
    -            .recv_data_dma(self.dmac, self.channel, self.spi_cs, data);
    -    }
    -     */
    -
    -    /*
    -     * Send 5 bytes command to the SD card.
    -     * @param  cmd: The user expected command to send to SD card.
    -     * @param  arg: The command argument.
    -     * @param  crc: The CRC.
    -     * @retval None
    -     */
    -    fn send_cmd(&self, cmd: CMD, arg: u32, crc: u8) {
    -        /* SD chip select low */
    -        self.CS_LOW();
    -        /* Send the Cmd bytes */
    -        self.write_data(&[
    -            /* Construct byte 1 */
    -            ((cmd as u8) | 0x40),
    -            /* Construct byte 2 */
    -            (arg >> 24) as u8,
    -            /* Construct byte 3 */
    -            ((arg >> 16) & 0xff) as u8,
    -            /* Construct byte 4 */
    -            ((arg >> 8) & 0xff) as u8,
    -            /* Construct byte 5 */
    -            (arg & 0xff) as u8,
    -            /* Construct CRC: byte 6 */
    -            crc,
    -        ]);
    -    }
    -
    -    /* Send end-command sequence to SD card */
    -    fn end_cmd(&self) {
    -        /* SD chip select high */
    -        self.CS_HIGH();
    -        /* Send the cmd byte */
    -        self.write_data(&[0xff]);
    -    }
    -
    -    /*
    -     * Returns the SD response.
    -     * @param  None
    -     * @retval The SD Response:
    -     *         - 0xFF: Sequence failed
    -     *         - 0: Sequence succeed
    -     */
    -    fn get_response(&self) -> u8 {
    -        let result = &mut [0u8];
    -        let mut timeout = 0x0FFF;
    -        /* Check if response is got or a timeout is happen */
    -        while timeout != 0 {
    -            self.read_data(result);
    -            /* Right response got */
    -            if result[0] != 0xFF {
    -                return result[0];
    -            }
    -            timeout -= 1;
    -        }
    -        /* After time out */
    -        0xFF
    -    }
    -
    -    /*
    -     * Get SD card data response.
    -     * @param  None
    -     * @retval The SD status: Read data response xxx0<status>1
    -     *         - status 010: Data accecpted
    -     *         - status 101: Data rejected due to a crc error
    -     *         - status 110: Data rejected due to a Write error.
    -     *         - status 111: Data rejected due to other error.
    -     */
    -    fn get_dataresponse(&self) -> u8 {
    -        let response = &mut [0u8];
    -        /* Read resonse */
    -        self.read_data(response);
    -        /* Mask unused bits */
    -        response[0] &= 0x1F;
    -        if response[0] != 0x05 {
    -            return 0xFF;
    -        }
    -        /* Wait null data */
    -        self.read_data(response);
    -        while response[0] == 0 {
    -            self.read_data(response);
    -        }
    -        /* Return response */
    -        0
    -    }
    -
    -    /*
    -     * Read the CSD card register
    -     *         Reading the contents of the CSD register in SPI mode is a simple
    -     *         read-block transaction.
    -     * @param  SD_csd: pointer on an SCD register structure
    -     * @retval The SD Response:
    -     *         - `Err()`: Sequence failed
    -     *         - `Ok(info)`: Sequence succeed
    -     */
    -    fn get_csdregister(&self) -> Result<SDCardCSD, ()> {
    -        let mut csd_tab = [0u8; 18];
    -        /* Send CMD9 (CSD register) */
    -        self.send_cmd(CMD::CMD9, 0, 0);
    -        /* Wait for response in the R1 format (0x00 is no errors) */
    -        if self.get_response() != 0x00 {
    -            self.end_cmd();
    -            return Err(());
    -        }
    -        if self.get_response() != SD_START_DATA_SINGLE_BLOCK_READ {
    -            self.end_cmd();
    -            return Err(());
    -        }
    -        /* Store CSD register value on csd_tab */
    -        /* Get CRC bytes (not really needed by us, but required by SD) */
    -        self.read_data(&mut csd_tab);
    -        self.end_cmd();
    -        /* see also: https://cdn-shop.adafruit.com/datasheets/TS16GUSDHC6.pdf */
    -        Ok(SDCardCSD {
    -            /* Byte 0 */
    -            CSDStruct: (csd_tab[0] & 0xC0) >> 6,
    -            SysSpecVersion: (csd_tab[0] & 0x3C) >> 2,
    -            Reserved1: csd_tab[0] & 0x03,
    -            /* Byte 1 */
    -            TAAC: csd_tab[1],
    -            /* Byte 2 */
    -            NSAC: csd_tab[2],
    -            /* Byte 3 */
    -            MaxBusClkFrec: csd_tab[3],
    -            /* Byte 4, 5 */
    -            CardComdClasses: (u16::from(csd_tab[4]) << 4) | ((u16::from(csd_tab[5]) & 0xF0) >> 4),
    -            /* Byte 5 */
    -            RdBlockLen: csd_tab[5] & 0x0F,
    -            /* Byte 6 */
    -            PartBlockRead: (csd_tab[6] & 0x80) >> 7,
    -            WrBlockMisalign: (csd_tab[6] & 0x40) >> 6,
    -            RdBlockMisalign: (csd_tab[6] & 0x20) >> 5,
    -            DSRImpl: (csd_tab[6] & 0x10) >> 4,
    -            Reserved2: 0,
    -            // DeviceSize: (csd_tab[6] & 0x03) << 10,
    -            /* Byte 7, 8, 9 */
    -            DeviceSize: ((u32::from(csd_tab[7]) & 0x3F) << 16)
    -                | (u32::from(csd_tab[8]) << 8)
    -                | u32::from(csd_tab[9]),
    -            /* Byte 10 */
    -            EraseGrSize: (csd_tab[10] & 0x40) >> 6,
    -            /* Byte 10, 11 */
    -            EraseGrMul: ((csd_tab[10] & 0x3F) << 1) | ((csd_tab[11] & 0x80) >> 7),
    -            /* Byte 11 */
    -            WrProtectGrSize: (csd_tab[11] & 0x7F),
    -            /* Byte 12 */
    -            WrProtectGrEnable: (csd_tab[12] & 0x80) >> 7,
    -            ManDeflECC: (csd_tab[12] & 0x60) >> 5,
    -            WrSpeedFact: (csd_tab[12] & 0x1C) >> 2,
    -            /* Byte 12,13 */
    -            MaxWrBlockLen: ((csd_tab[12] & 0x03) << 2) | ((csd_tab[13] & 0xC0) >> 6),
    -            /* Byte 13 */
    -            WriteBlockPaPartial: (csd_tab[13] & 0x20) >> 5,
    -            Reserved3: 0,
    -            ContentProtectAppli: (csd_tab[13] & 0x01),
    -            /* Byte 14 */
    -            FileFormatGroup: (csd_tab[14] & 0x80) >> 7,
    -            CopyFlag: (csd_tab[14] & 0x40) >> 6,
    -            PermWrProtect: (csd_tab[14] & 0x20) >> 5,
    -            TempWrProtect: (csd_tab[14] & 0x10) >> 4,
    -            FileFormat: (csd_tab[14] & 0x0C) >> 2,
    -            ECC: (csd_tab[14] & 0x03),
    -            /* Byte 15 */
    -            CSD_CRC: (csd_tab[15] & 0xFE) >> 1,
    -            Reserved4: 1,
    -            /* Return the reponse */
    -        })
    -    }
    -
    -    /*
    -     * Read the CID card register.
    -     *         Reading the contents of the CID register in SPI mode is a simple
    -     *         read-block transaction.
    -     * @param  SD_cid: pointer on an CID register structure
    -     * @retval The SD Response:
    -     *         - `Err()`: Sequence failed
    -     *         - `Ok(info)`: Sequence succeed
    -     */
    -    fn get_cidregister(&self) -> Result<SDCardCID, ()> {
    -        let mut cid_tab = [0u8; 18];
    -        /* Send CMD10 (CID register) */
    -        self.send_cmd(CMD::CMD10, 0, 0);
    -        /* Wait for response in the R1 format (0x00 is no errors) */
    -        if self.get_response() != 0x00 {
    -            self.end_cmd();
    -            return Err(());
    -        }
    -        if self.get_response() != SD_START_DATA_SINGLE_BLOCK_READ {
    -            self.end_cmd();
    -            return Err(());
    -        }
    -        /* Store CID register value on cid_tab */
    -        /* Get CRC bytes (not really needed by us, but required by SD) */
    -        self.read_data(&mut cid_tab);
    -        self.end_cmd();
    -        Ok(SDCardCID {
    -            /* Byte 0 */
    -            ManufacturerID: cid_tab[0],
    -            /* Byte 1, 2 */
    -            OEM_AppliID: (u16::from(cid_tab[1]) << 8) | u16::from(cid_tab[2]),
    -            /* Byte 3, 4, 5, 6 */
    -            ProdName1: (u32::from(cid_tab[3]) << 24)
    -                | (u32::from(cid_tab[4]) << 16)
    -                | (u32::from(cid_tab[5]) << 8)
    -                | u32::from(cid_tab[6]),
    -            /* Byte 7 */
    -            ProdName2: cid_tab[7],
    -            /* Byte 8 */
    -            ProdRev: cid_tab[8],
    -            /* Byte 9, 10, 11, 12 */
    -            ProdSN: (u32::from(cid_tab[9]) << 24)
    -                | (u32::from(cid_tab[10]) << 16)
    -                | (u32::from(cid_tab[11]) << 8)
    -                | u32::from(cid_tab[12]),
    -            /* Byte 13, 14 */
    -            Reserved1: (cid_tab[13] & 0xF0) >> 4,
    -            ManufactDate: ((u16::from(cid_tab[13]) & 0x0F) << 8) | u16::from(cid_tab[14]),
    -            /* Byte 15 */
    -            CID_CRC: (cid_tab[15] & 0xFE) >> 1,
    -            Reserved2: 1,
    -        })
    -    }
    -
    -    /*
    -     * Returns information about specific card.
    -     * @param  cardinfo: pointer to a SD_CardInfo structure that contains all SD
    -     *         card information.
    -     * @retval The SD Response:
    -     *         - `Err(())`: Sequence failed
    -     *         - `Ok(info)`: Sequence succeed
    -     */
    -    fn get_cardinfo(&self) -> Result<SDCardInfo, ()> {
    -        let mut info = SDCardInfo {
    -            SD_csd: self.get_csdregister()?,
    -            SD_cid: self.get_cidregister()?,
    -            CardCapacity: 0,
    -            CardBlockSize: 0,
    -        };
    -        info.CardBlockSize = 1 << u64::from(info.SD_csd.RdBlockLen);
    -        info.CardCapacity = (u64::from(info.SD_csd.DeviceSize) + 1) * 1024 * info.CardBlockSize;
    -
    -        Ok(info)
    -    }
    -
    -    /*
    -     * Initializes the SD/SD communication in SPI mode.
    -     * @param  None
    -     * @retval The SD Response info if succeeeded, otherwise Err
    -     */
    -    pub fn init(&self) -> Result<SDCardInfo, InitError> {
    -        /* Initialize SD_SPI */
    -        self.lowlevel_init();
    -        /* SD chip select high */
    -        self.CS_HIGH();
    -        /* NOTE: this reset doesn't always seem to work if the SD access was broken off in the
    -         * middle of an operation: CMDFailed(CMD0, 127). */
    -
    -        /* Send dummy byte 0xFF, 10 times with CS high */
    -        /* Rise CS and MOSI for 80 clocks cycles */
    -        /* Send dummy byte 0xFF */
    -        self.write_data(&[0xff; 10]);
    -        /*------------Put SD in SPI mode--------------*/
    -        /* SD initialized and set to SPI mode properly */
    -
    -        /* Send software reset */
    -        self.send_cmd(CMD::CMD0, 0, 0x95);
    -        let result = self.get_response();
    -        self.end_cmd();
    -        if result != 0x01 {
    -            return Err(InitError::CMDFailed(CMD::CMD0, result));
    -        }
    -
    -        /* Check voltage range */
    -        self.send_cmd(CMD::CMD8, 0x01AA, 0x87);
    -        /* 0x01 or 0x05 */
    -        let result = self.get_response();
    -        let mut frame = [0u8; 4];
    -        self.read_data(&mut frame);
    -        self.end_cmd();
    -        if result != 0x01 {
    -            return Err(InitError::CMDFailed(CMD::CMD8, result));
    -        }
    -        let mut index = 255;
    -        while index != 0 {
    -            /* <ACMD> */
    -            self.send_cmd(CMD::CMD55, 0, 0);
    -            let result = self.get_response();
    -            self.end_cmd();
    -            if result != 0x01 {
    -                return Err(InitError::CMDFailed(CMD::CMD55, result));
    -            }
    -            /* Initiate SDC initialization process */
    -            self.send_cmd(CMD::ACMD41, 0x40000000, 0);
    -            let result = self.get_response();
    -            self.end_cmd();
    -            if result == 0x00 {
    -                break;
    -            }
    -            index -= 1;
    -        }
    -        if index == 0 {
    -            return Err(InitError::CMDFailed(CMD::ACMD41, result));
    -        }
    -        index = 255;
    -        let mut frame = [0u8; 4];
    -        while index != 0 {
    -            /* Read OCR */
    -            self.send_cmd(CMD::CMD58, 0, 1);
    -            let result = self.get_response();
    -            self.read_data(&mut frame);
    -            self.end_cmd();
    -            if result == 0 {
    -                break;
    -            }
    -            index -= 1;
    -        }
    -        if index == 0 {
    -            return Err(InitError::CMDFailed(CMD::CMD58, result));
    -        }
    -        if (frame[0] & 0x40) == 0 {
    -            return Err(InitError::CardCapacityStatusNotSet(frame));
    -        }
    -        self.HIGH_SPEED_ENABLE();
    -        self.get_cardinfo()
    -            .map_err(|_| InitError::CannotGetCardInfo)
    -    }
    -
    -    /*
    -     * Reads a block of data from the SD.
    -     * @param  data_buf: slice that receives the data read from the SD.
    -     * @param  sector: SD's internal address to read from.
    -     * @retval The SD Response:
    -     *         - `Err(())`: Sequence failed
    -     *         - `Ok(())`: Sequence succeed
    -     */
    -    pub fn read_sector(&self, data_buf: &mut [u8], sector: u32) -> Result<(), ()> {
    -        assert!(data_buf.len() >= SEC_LEN && (data_buf.len() % SEC_LEN) == 0);
    -        /* Send CMD17 to read one block, or CMD18 for multiple */
    -        let flag = if data_buf.len() == SEC_LEN {
    -            self.send_cmd(CMD::CMD17, sector, 0);
    -            false
    -        } else {
    -            self.send_cmd(CMD::CMD18, sector, 0);
    -            true
    -        };
    -        /* Check if the SD acknowledged the read block command: R1 response (0x00: no errors) */
    -        if self.get_response() != 0x00 {
    -            self.end_cmd();
    -            return Err(());
    -        }
    -        let mut error = false;
    -        //let mut dma_chunk = [0u32; SEC_LEN];
    -        let mut tmp_chunk = [0u8; SEC_LEN];
    -        for chunk in data_buf.chunks_mut(SEC_LEN) {
    -            if self.get_response() != SD_START_DATA_SINGLE_BLOCK_READ {
    -                error = true;
    -                break;
    -            }
    -            /* Read the SD block data : read NumByteToRead data */
    -            //self.read_data_dma(&mut dma_chunk);
    -            self.read_data(&mut tmp_chunk);
    -            /* Place the data received as u32 units from DMA into the u8 target buffer */
    -            for (a, b) in chunk.iter_mut().zip(/*dma_chunk*/ tmp_chunk.iter()) {
    -                //*a = (b & 0xff) as u8;
    -                *a = *b;
    -            }
    -            /* Get CRC bytes (not really needed by us, but required by SD) */
    -            let mut frame = [0u8; 2];
    -            self.read_data(&mut frame);
    -        }
    -        self.end_cmd();
    -        if flag {
    -            self.send_cmd(CMD::CMD12, 0, 0);
    -            self.get_response();
    -            self.end_cmd();
    -            self.end_cmd();
    -        }
    -        /* It is an error if not everything requested was read */
    -        if error {
    -            Err(())
    -        } else {
    -            Ok(())
    -        }
    -    }
    -
    -    /*
    -     * Writes a block to the SD
    -     * @param  data_buf: slice containing the data to be written to the SD.
    -     * @param  sector: address to write on.
    -     * @retval The SD Response:
    -     *         - `Err(())`: Sequence failed
    -     *         - `Ok(())`: Sequence succeed
    -     */
    -    pub fn write_sector(&self, data_buf: &[u8], sector: u32) -> Result<(), ()> {
    -        assert!(data_buf.len() >= SEC_LEN && (data_buf.len() % SEC_LEN) == 0);
    -        let mut frame = [0xff, 0x00];
    -        if data_buf.len() == SEC_LEN {
    -            frame[1] = SD_START_DATA_SINGLE_BLOCK_WRITE;
    -            self.send_cmd(CMD::CMD24, sector, 0);
    -        } else {
    -            frame[1] = SD_START_DATA_MULTIPLE_BLOCK_WRITE;
    -            self.send_cmd(
    -                CMD::ACMD23,
    -                (data_buf.len() / SEC_LEN).try_into().unwrap(),
    -                0,
    -            );
    -            self.get_response();
    -            self.end_cmd();
    -            self.send_cmd(CMD::CMD25, sector, 0);
    -        }
    -        /* Check if the SD acknowledged the write block command: R1 response (0x00: no errors) */
    -        if self.get_response() != 0x00 {
    -            self.end_cmd();
    -            return Err(());
    -        }
    -        //let mut dma_chunk = [0u32; SEC_LEN];
    -        let mut tmp_chunk = [0u8; SEC_LEN];
    -        for chunk in data_buf.chunks(SEC_LEN) {
    -            /* Send the data token to signify the start of the data */
    -            self.write_data(&frame);
    -            /* Write the block data to SD : write count data by block */
    -            for (a, &b) in /*dma_chunk*/ tmp_chunk.iter_mut().zip(chunk.iter()) {
    -                //*a = b.into();
    -                *a = b;
    -            }
    -            //self.write_data_dma(&mut dma_chunk);
    -            self.write_data(&tmp_chunk);
    -            /* Put dummy CRC bytes */
    -            self.write_data(&[0xff, 0xff]);
    -            /* Read data response */
    -            if self.get_dataresponse() != 0x00 {
    -                self.end_cmd();
    -                return Err(());
    -            }
    -        }
    -        self.end_cmd();
    -        self.end_cmd();
    -        Ok(())
    -    }
    -}
    -
    -/** GPIOHS GPIO number to use for controlling the SD card CS pin */
    -const SD_CS_GPIONUM: u8 = 7;
    -/** CS value passed to SPI controller, this is a dummy value as SPI0_CS3 is not mapping to anything
    - * in the FPIOA */
    -const SD_CS: u32 = 3;
    -
    -/** Connect pins to internal functions */
    -fn io_init() {
    -    fpioa::set_function(io::SPI0_SCLK, fpioa::function::SPI0_SCLK);
    -    fpioa::set_function(io::SPI0_MOSI, fpioa::function::SPI0_D0);
    -    fpioa::set_function(io::SPI0_MISO, fpioa::function::SPI0_D1);
    -    fpioa::set_function(io::SPI0_CS0, fpioa::function::gpiohs(SD_CS_GPIONUM));
    -    fpioa::set_io_pull(io::SPI0_CS0, fpioa::pull::DOWN); // GPIO output=pull down
    -}
    -
    -lazy_static! {
    -    static ref PERIPHERALS: UPSafeCell<Peripherals> =
    -        unsafe { UPSafeCell::new(Peripherals::take().unwrap()) };
    -}
    -
    -fn init_sdcard() -> SDCard<SPIImpl<SPI0>> {
    -    // wait previous output
    -    usleep(100000);
    -    let peripherals = unsafe { Peripherals::steal() };
    -    sysctl::pll_set_freq(sysctl::pll::PLL0, 800_000_000).unwrap();
    -    sysctl::pll_set_freq(sysctl::pll::PLL1, 300_000_000).unwrap();
    -    sysctl::pll_set_freq(sysctl::pll::PLL2, 45_158_400).unwrap();
    -    let clocks = k210_hal::clock::Clocks::new();
    -    peripherals.UARTHS.configure(115_200.bps(), &clocks);
    -    io_init();
    -
    -    let spi = peripherals.SPI0.constrain();
    -    let sd = SDCard::new(spi, SD_CS, SD_CS_GPIONUM);
    -    let info = sd.init().unwrap();
    -    let num_sectors = info.CardCapacity / 512;
    -    assert!(num_sectors > 0);
    -
    -    println!("init sdcard!");
    -    sd
    -}
    -
    -pub struct SDCardWrapper(UPSafeCell<SDCard<SPIImpl<SPI0>>>);
    -
    -impl SDCardWrapper {
    -    pub fn new() -> Self {
    -        unsafe { Self(UPSafeCell::new(init_sdcard())) }
    -    }
    -}
    -
    -impl BlockDevice for SDCardWrapper {
    -    fn read_block(&self, block_id: usize, buf: &mut [u8]) {
    -        self.0
    -            .exclusive_access()
    -            .read_sector(buf, block_id as u32)
    -            .unwrap();
    -    }
    -    fn write_block(&self, block_id: usize, buf: &[u8]) {
    -        self.0
    -            .exclusive_access()
    -            .write_sector(buf, block_id as u32)
    -            .unwrap();
    -    }
    -}
    -
    -
    - \ No newline at end of file diff --git a/ch6-dev/src/os/drivers/block/virtio_blk.rs.html b/ch6-dev/src/os/drivers/block/virtio_blk.rs.html index f71d2899..6b83359f 100644 --- a/ch6-dev/src/os/drivers/block/virtio_blk.rs.html +++ b/ch6-dev/src/os/drivers/block/virtio_blk.rs.html @@ -1,168 +1,167 @@ -virtio_blk.rs - source - -
    1
    -2
    -3
    -4
    -5
    -6
    -7
    -8
    -9
    -10
    -11
    -12
    -13
    -14
    -15
    -16
    -17
    -18
    -19
    -20
    -21
    -22
    -23
    -24
    -25
    -26
    -27
    -28
    -29
    -30
    -31
    -32
    -33
    -34
    -35
    -36
    -37
    -38
    -39
    -40
    -41
    -42
    -43
    -44
    -45
    -46
    -47
    -48
    -49
    -50
    -51
    -52
    -53
    -54
    -55
    -56
    -57
    -58
    -59
    -60
    -61
    -62
    -63
    -64
    -65
    -66
    -67
    -68
    -69
    -70
    -71
    -72
    -73
    -74
    -75
    -76
    -77
    -78
    -79
    -80
    -
    use super::BlockDevice;
    -use crate::mm::{
    -    frame_alloc, frame_dealloc, kernel_token, FrameTracker, PageTable, PhysAddr, PhysPageNum,
    -    StepByOne, VirtAddr,
    +virtio_blk.rs - source
    1
    +2
    +3
    +4
    +5
    +6
    +7
    +8
    +9
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    +47
    +48
    +49
    +50
    +51
    +52
    +53
    +54
    +55
    +56
    +57
    +58
    +59
    +60
    +61
    +62
    +63
    +64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    +79
    +80
    +81
    +82
    +83
    +
    use super::BlockDevice;
    +use crate::mm::{
    +    frame_alloc, frame_dealloc, kernel_token, FrameTracker, PageTable, PhysAddr, PhysPageNum,
    +    StepByOne, VirtAddr,
     };
    -use crate::sync::UPSafeCell;
    -use alloc::vec::Vec;
    -use lazy_static::*;
    -use virtio_drivers::{VirtIOBlk, VirtIOHeader};
    +use crate::sync::UPSafeCell;
    +use alloc::vec::Vec;
    +use lazy_static::*;
    +use virtio_drivers::{Hal, VirtIOBlk, VirtIOHeader};
     
    -#[allow(unused)]
    -const VIRTIO0: usize = 0x10001000;
    +#[allow(unused)]
    +const VIRTIO0: usize = 0x10001000;
     
    -pub struct VirtIOBlock(UPSafeCell<VirtIOBlk<'static>>);
    +pub struct VirtIOBlock(UPSafeCell<VirtIOBlk<'static, VirtioHal>>);
     
    -lazy_static! {
    -    static ref QUEUE_FRAMES: UPSafeCell<Vec<FrameTracker>> = unsafe { UPSafeCell::new(Vec::new()) };
    +lazy_static! {
    +    static ref QUEUE_FRAMES: UPSafeCell<Vec<FrameTracker>> = unsafe { UPSafeCell::new(Vec::new()) };
     }
     
    -impl BlockDevice for VirtIOBlock {
    -    fn read_block(&self, block_id: usize, buf: &mut [u8]) {
    -        self.0
    -            .exclusive_access()
    -            .read_block(block_id, buf)
    -            .expect("Error when reading VirtIOBlk");
    +impl BlockDevice for VirtIOBlock {
    +    fn read_block(&self, block_id: usize, buf: &mut [u8]) {
    +        self.0
    +            .exclusive_access()
    +            .read_block(block_id, buf)
    +            .expect("Error when reading VirtIOBlk");
         }
    -    fn write_block(&self, block_id: usize, buf: &[u8]) {
    -        self.0
    -            .exclusive_access()
    -            .write_block(block_id, buf)
    -            .expect("Error when writing VirtIOBlk");
    +    fn write_block(&self, block_id: usize, buf: &[u8]) {
    +        self.0
    +            .exclusive_access()
    +            .write_block(block_id, buf)
    +            .expect("Error when writing VirtIOBlk");
         }
     }
     
    -impl VirtIOBlock {
    -    #[allow(unused)]
    -    pub fn new() -> Self {
    -        unsafe {
    -            Self(UPSafeCell::new(
    -                VirtIOBlk::new(&mut *(VIRTIO0 as *mut VirtIOHeader)).unwrap(),
    +impl VirtIOBlock {
    +    #[allow(unused)]
    +    pub fn new() -> Self {
    +        unsafe {
    +            Self(UPSafeCell::new(
    +                VirtIOBlk::<VirtioHal>::new(&mut *(VIRTIO0 as *mut VirtIOHeader)).unwrap(),
                 ))
             }
         }
     }
     
    -#[no_mangle]
    -pub extern "C" fn virtio_dma_alloc(pages: usize) -> PhysAddr {
    -    let mut ppn_base = PhysPageNum(0);
    -    for i in 0..pages {
    -        let frame = frame_alloc().unwrap();
    -        if i == 0 {
    -            ppn_base = frame.ppn;
    +pub struct VirtioHal;
    +
    +impl Hal for VirtioHal {
    +    fn dma_alloc(pages: usize) -> usize {
    +        let mut ppn_base = PhysPageNum(0);
    +        for i in 0..pages {
    +            let frame = frame_alloc().unwrap();
    +            if i == 0 {
    +                ppn_base = frame.ppn;
    +            }
    +            assert_eq!(frame.ppn.0, ppn_base.0 + i);
    +            QUEUE_FRAMES.exclusive_access().push(frame);
             }
    -        assert_eq!(frame.ppn.0, ppn_base.0 + i);
    -        QUEUE_FRAMES.exclusive_access().push(frame);
    +        let pa: PhysAddr = ppn_base.into();
    +        pa.0
    +    }
    +
    +    fn dma_dealloc(pa: usize, pages: usize) -> i32 {
    +        let pa = PhysAddr::from(pa);
    +        let mut ppn_base: PhysPageNum = pa.into();
    +        for _ in 0..pages {
    +            frame_dealloc(ppn_base);
    +            ppn_base.step();
    +        }
    +        0
    +    }
    +
    +    fn phys_to_virt(addr: usize) -> usize {
    +        addr
         }
    -    ppn_base.into()
    -}
     
    -#[no_mangle]
    -pub extern "C" fn virtio_dma_dealloc(pa: PhysAddr, pages: usize) -> i32 {
    -    let mut ppn_base: PhysPageNum = pa.into();
    -    for _ in 0..pages {
    -        frame_dealloc(ppn_base);
    -        ppn_base.step();
    -    }
    -    0
    +    fn virt_to_phys(vaddr: usize) -> usize {
    +        PageTable::from_token(kernel_token())
    +            .translate_va(VirtAddr::from(vaddr))
    +            .unwrap()
    +            .0
    +    }
     }
    -
    -#[no_mangle]
    -pub extern "C" fn virtio_phys_to_virt(paddr: PhysAddr) -> VirtAddr {
    -    VirtAddr(paddr.0)
    -}
    -
    -#[no_mangle]
    -pub extern "C" fn virtio_virt_to_phys(vaddr: VirtAddr) -> PhysAddr {
    -    PageTable::from_token(kernel_token())
    -        .translate_va(vaddr)
    -        .unwrap()
    -}
    -
    -
    - \ No newline at end of file + \ No newline at end of file diff --git a/ch6-dev/src/os/drivers/mod.rs.html b/ch6-dev/src/os/drivers/mod.rs.html index f24e962d..0a15419b 100644 --- a/ch6-dev/src/os/drivers/mod.rs.html +++ b/ch6-dev/src/os/drivers/mod.rs.html @@ -1,14 +1,7 @@ -mod.rs - source - -
    1
    -2
    -3
    -
    pub mod block;
    +mod.rs - source
    1
    +2
    +3
    +
    pub mod block;
     
    -pub use block::BLOCK_DEVICE;
    -
    -
    - \ No newline at end of file +pub use block::BLOCK_DEVICE; + \ No newline at end of file diff --git a/ch6-dev/src/os/fs/inode.rs.html b/ch6-dev/src/os/fs/inode.rs.html index c51bc605..ffaffd63 100644 --- a/ch6-dev/src/os/fs/inode.rs.html +++ b/ch6-dev/src/os/fs/inode.rs.html @@ -1,316 +1,329 @@ -inode.rs - source - -
    1
    -2
    -3
    -4
    -5
    -6
    -7
    -8
    -9
    -10
    -11
    -12
    -13
    -14
    -15
    -16
    -17
    -18
    -19
    -20
    -21
    -22
    -23
    -24
    -25
    -26
    -27
    -28
    -29
    -30
    -31
    -32
    -33
    -34
    -35
    -36
    -37
    -38
    -39
    -40
    -41
    -42
    -43
    -44
    -45
    -46
    -47
    -48
    -49
    -50
    -51
    -52
    -53
    -54
    -55
    -56
    -57
    -58
    -59
    -60
    -61
    -62
    -63
    -64
    -65
    -66
    -67
    -68
    -69
    -70
    -71
    -72
    -73
    -74
    -75
    -76
    -77
    -78
    -79
    -80
    -81
    -82
    -83
    -84
    -85
    -86
    -87
    -88
    -89
    -90
    -91
    -92
    -93
    -94
    -95
    -96
    -97
    -98
    -99
    -100
    -101
    -102
    -103
    -104
    -105
    -106
    -107
    -108
    -109
    -110
    -111
    -112
    -113
    -114
    -115
    -116
    -117
    -118
    -119
    -120
    -121
    -122
    -123
    -124
    -125
    -126
    -127
    -128
    -129
    -130
    -131
    -132
    -133
    -134
    -135
    -136
    -137
    -138
    -139
    -140
    -141
    -142
    -143
    -144
    -145
    -146
    -147
    -148
    -149
    -150
    -151
    -152
    -153
    -154
    -
    //! `Arc<Inode>` -> `OSInodeInner`: In order to open files concurrently
    -//! we need to wrap `Inode` into `Arc`,but `Mutex` in `Inode` prevents
    -//! file systems from being accessed simultaneously
    -//!
    -//! `UPSafeCell<OSInodeInner>` -> `OSInode`: for static `ROOT_INODE`,we
    -//! need to wrap `OSInodeInner` into `UPSafeCell`
    -use super::File;
    -use crate::drivers::BLOCK_DEVICE;
    -use crate::mm::UserBuffer;
    -use crate::sync::UPSafeCell;
    -use alloc::sync::Arc;
    -use alloc::vec::Vec;
    -use bitflags::*;
    -use easy_fs::{EasyFileSystem, Inode};
    -use lazy_static::*;
    -/// A wrapper around a filesystem inode
    -/// to implement File trait atop
    -pub struct OSInode {
    -    readable: bool,
    -    writable: bool,
    -    inner: UPSafeCell<OSInodeInner>,
    +inode.rs - source
    1
    +2
    +3
    +4
    +5
    +6
    +7
    +8
    +9
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    +47
    +48
    +49
    +50
    +51
    +52
    +53
    +54
    +55
    +56
    +57
    +58
    +59
    +60
    +61
    +62
    +63
    +64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    +79
    +80
    +81
    +82
    +83
    +84
    +85
    +86
    +87
    +88
    +89
    +90
    +91
    +92
    +93
    +94
    +95
    +96
    +97
    +98
    +99
    +100
    +101
    +102
    +103
    +104
    +105
    +106
    +107
    +108
    +109
    +110
    +111
    +112
    +113
    +114
    +115
    +116
    +117
    +118
    +119
    +120
    +121
    +122
    +123
    +124
    +125
    +126
    +127
    +128
    +129
    +130
    +131
    +132
    +133
    +134
    +135
    +136
    +137
    +138
    +139
    +140
    +141
    +142
    +143
    +144
    +145
    +146
    +147
    +148
    +149
    +150
    +151
    +152
    +153
    +154
    +155
    +156
    +157
    +158
    +159
    +160
    +161
    +162
    +163
    +164
    +
    //! `Arc<Inode>` -> `OSInodeInner`: In order to open files concurrently
    +//! we need to wrap `Inode` into `Arc`,but `Mutex` in `Inode` prevents
    +//! file systems from being accessed simultaneously
    +//!
    +//! `UPSafeCell<OSInodeInner>` -> `OSInode`: for static `ROOT_INODE`,we
    +//! need to wrap `OSInodeInner` into `UPSafeCell`
    +use super::File;
    +use crate::drivers::BLOCK_DEVICE;
    +use crate::mm::UserBuffer;
    +use crate::sync::{RawExclusiveLock, UPSafeCell};
    +use alloc::sync::Arc;
    +use alloc::vec::Vec;
    +use bitflags::*;
    +use easy_fs::{BlockCacheMgr, EasyFileSystem, Inode};
    +use lazy_static::*;
    +
    +const BLOCK_CACHE_SIZE: usize = 64;
    +type InodeType = Inode<RawExclusiveLock, BLOCK_CACHE_SIZE, RawExclusiveLock, RawExclusiveLock>;
    +
    +/// A wrapper around a filesystem inode
    +/// to implement File trait atop
    +pub struct OSInode {
    +    readable: bool,
    +    writable: bool,
    +    inner: UPSafeCell<OSInodeInner>,
     }
    -/// The OS inode inner in 'UPSafeCell'
    -pub struct OSInodeInner {
    -    offset: usize,
    -    inode: Arc<Inode>,
    +/// The OS inode inner in 'UPSafeCell'
    +pub struct OSInodeInner {
    +    offset: usize,
    +    inode: Arc<InodeType>,
     }
     
    -impl OSInode {
    -    /// Construct an OS inode from a inode
    -    pub fn new(readable: bool, writable: bool, inode: Arc<Inode>) -> Self {
    -        Self {
    -            readable,
    -            writable,
    -            inner: unsafe { UPSafeCell::new(OSInodeInner { offset: 0, inode }) },
    +impl OSInode {
    +    /// Construct an OS inode from a inode
    +    pub fn new(readable: bool, writable: bool, inode: Arc<InodeType>) -> Self {
    +        Self {
    +            readable,
    +            writable,
    +            inner: unsafe { UPSafeCell::new(OSInodeInner { offset: 0, inode }) },
             }
         }
    -    /// Read all data inside a inode into vector
    -    pub fn read_all(&self) -> Vec<u8> {
    -        let mut inner = self.inner.exclusive_access();
    -        let mut buffer = [0u8; 512];
    -        let mut v: Vec<u8> = Vec::new();
    -        loop {
    -            let len = inner.inode.read_at(inner.offset, &mut buffer);
    -            if len == 0 {
    +    /// Read all data inside a inode into vector
    +    pub fn read_all(&self) -> Vec<u8> {
    +        let mut inner = self.inner.exclusive_access();
    +        let mut buffer = [0u8; 512];
    +        let mut v: Vec<u8> = Vec::new();
    +        loop {
    +            let len = inner.inode.read_at(inner.offset, &mut buffer);
    +            if len == 0 {
                     break;
                 }
    -            inner.offset += len;
    -            v.extend_from_slice(&buffer[..len]);
    +            inner.offset += len;
    +            v.extend_from_slice(&buffer[..len]);
             }
    -        v
    +        v
         }
     }
     
    -lazy_static! {
    -    pub static ref ROOT_INODE: Arc<Inode> = {
    -        let efs = EasyFileSystem::open(BLOCK_DEVICE.clone());
    -        Arc::new(EasyFileSystem::root_inode(&efs))
    +lazy_static! {
    +    pub static ref ROOT_INODE: Arc<InodeType> = {
    +        let block_dev = BLOCK_DEVICE.clone();
    +        let bcache_mgr: BlockCacheMgr<BLOCK_CACHE_SIZE, RawExclusiveLock> =
    +            BlockCacheMgr::new(&block_dev);
    +        let efs: EasyFileSystem<BLOCK_CACHE_SIZE, RawExclusiveLock, _> =
    +            EasyFileSystem::open(bcache_mgr);
    +        let efs = Arc::new(lock_api::Mutex::<RawExclusiveLock, _>::new(efs));
    +        Arc::new(Inode::root_inode(&efs))
         };
     }
    -/// List all files in the filesystems
    -pub fn list_apps() {
    +/// List all files in the filesystems
    +#[allow(warnings)]
    +pub fn list_apps() {
         println!("/**** APPS ****");
    -    for app in ROOT_INODE.ls() {
    -        println!("{}", app);
    +    for app in ROOT_INODE.listdir() {
    +        println!("{}", app);
         }
         println!("**************/");
     }
     
    -bitflags! {
    -    ///Open file flags
    -    pub struct OpenFlags: u32 {
    -        ///Read only
    -        const RDONLY = 0;
    -        ///Write only
    -        const WRONLY = 1 << 0;
    -        ///Read & Write
    -        const RDWR = 1 << 1;
    -        ///Allow create
    -        const CREATE = 1 << 9;
    -        ///Clear file and return an empty one
    -        const TRUNC = 1 << 10;
    +bitflags! {
    +    ///Open file flags
    +    pub struct OpenFlags: u32 {
    +        ///Read only
    +        const RDONLY = 0;
    +        ///Write only
    +        const WRONLY = 1 << 0;
    +        ///Read & Write
    +        const RDWR = 1 << 1;
    +        ///Allow create
    +        const CREATE = 1 << 9;
    +        ///Clear file and return an empty one
    +        const TRUNC = 1 << 10;
         }
     }
     
    -impl OpenFlags {
    -    /// Do not check validity for simplicity
    -    /// Return (readable, writable)
    -    pub fn read_write(&self) -> (bool, bool) {
    -        if self.is_empty() {
    +impl OpenFlags {
    +    /// Do not check validity for simplicity
    +    /// Return (readable, writable)
    +    pub fn read_write(&self) -> (bool, bool) {
    +        if self.is_empty() {
                 (true, false)
    -        } else if self.contains(Self::WRONLY) {
    +        } else if self.contains(Self::WRONLY) {
                 (false, true)
    -        } else {
    +        } else {
                 (true, true)
             }
         }
     }
    -///Open file with flags
    -pub fn open_file(name: &str, flags: OpenFlags) -> Option<Arc<OSInode>> {
    -    let (readable, writable) = flags.read_write();
    -    if flags.contains(OpenFlags::CREATE) {
    -        if let Some(inode) = ROOT_INODE.find(name) {
    -            // clear size
    -            inode.clear();
    -            Some(Arc::new(OSInode::new(readable, writable, inode)))
    -        } else {
    -            // create file
    -            ROOT_INODE
    -                .create(name)
    -                .map(|inode| Arc::new(OSInode::new(readable, writable, inode)))
    +///Open file with flags
    +pub fn open_file(name: &str, flags: OpenFlags) -> Option<Arc<OSInode>> {
    +    let (readable, writable) = flags.read_write();
    +    if flags.contains(OpenFlags::CREATE) {
    +        if let Some(inode) = ROOT_INODE.find(name) {
    +            // clear size
    +            inode.clear();
    +            Some(Arc::new(OSInode::new(readable, writable, inode)))
    +        } else {
    +            // create file
    +            ROOT_INODE
    +                .create(name)
    +                .map(|inode| Arc::new(OSInode::new(readable, writable, inode)))
             }
    -    } else {
    -        ROOT_INODE.find(name).map(|inode| {
    -            if flags.contains(OpenFlags::TRUNC) {
    -                inode.clear();
    +    } else {
    +        ROOT_INODE.find(name).map(|inode| {
    +            if flags.contains(OpenFlags::TRUNC) {
    +                inode.clear();
                 }
    -            Arc::new(OSInode::new(readable, writable, inode))
    +            Arc::new(OSInode::new(readable, writable, inode))
             })
         }
     }
     
    -impl File for OSInode {
    -    fn readable(&self) -> bool {
    -        self.readable
    +impl File for OSInode {
    +    fn readable(&self) -> bool {
    +        self.readable
         }
    -    fn writable(&self) -> bool {
    -        self.writable
    +    fn writable(&self) -> bool {
    +        self.writable
         }
    -    fn read(&self, mut buf: UserBuffer) -> usize {
    -        let mut inner = self.inner.exclusive_access();
    -        let mut total_read_size = 0usize;
    -        for slice in buf.buffers.iter_mut() {
    -            let read_size = inner.inode.read_at(inner.offset, *slice);
    -            if read_size == 0 {
    +    fn read(&self, mut buf: UserBuffer) -> usize {
    +        let mut inner = self.inner.exclusive_access();
    +        let mut total_read_size = 0usize;
    +        for slice in buf.buffers.iter_mut() {
    +            let read_size = inner.inode.read_at(inner.offset, *slice);
    +            if read_size == 0 {
                     break;
                 }
    -            inner.offset += read_size;
    -            total_read_size += read_size;
    +            inner.offset += read_size;
    +            total_read_size += read_size;
             }
    -        total_read_size
    +        total_read_size
         }
    -    fn write(&self, buf: UserBuffer) -> usize {
    -        let mut inner = self.inner.exclusive_access();
    -        let mut total_write_size = 0usize;
    -        for slice in buf.buffers.iter() {
    -            let write_size = inner.inode.write_at(inner.offset, *slice);
    -            assert_eq!(write_size, slice.len());
    -            inner.offset += write_size;
    -            total_write_size += write_size;
    +    fn write(&self, buf: UserBuffer) -> usize {
    +        let mut inner = self.inner.exclusive_access();
    +        let mut total_write_size = 0usize;
    +        for slice in buf.buffers.iter() {
    +            let write_size = inner.inode.write_at(inner.offset, *slice);
    +            assert_eq!(write_size, slice.len());
    +            inner.offset += write_size;
    +            total_write_size += write_size;
             }
    -        total_write_size
    +        total_write_size
         }
     }
    -
    -
    - \ No newline at end of file + \ No newline at end of file diff --git a/ch6-dev/src/os/fs/mod.rs.html b/ch6-dev/src/os/fs/mod.rs.html index bb72ccc9..48b9d6b2 100644 --- a/ch6-dev/src/os/fs/mod.rs.html +++ b/ch6-dev/src/os/fs/mod.rs.html @@ -1,46 +1,39 @@ -mod.rs - source - -
    1
    -2
    -3
    -4
    -5
    -6
    -7
    -8
    -9
    -10
    -11
    -12
    -13
    -14
    -15
    -16
    -17
    -18
    -19
    -
    //! File system in os
    -mod inode;
    -mod stdio;
    +mod.rs - source
    1
    +2
    +3
    +4
    +5
    +6
    +7
    +8
    +9
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +
    //! File system in os
    +mod inode;
    +mod stdio;
     
    -use crate::mm::UserBuffer;
    -/// File trait
    -pub trait File: Send + Sync {
    -    /// If readable
    -    fn readable(&self) -> bool;
    -    /// If writable
    -    fn writable(&self) -> bool;
    -    /// Read file to `UserBuffer`
    -    fn read(&self, buf: UserBuffer) -> usize;
    -    /// Write `UserBuffer` to file
    -    fn write(&self, buf: UserBuffer) -> usize;
    +use crate::mm::UserBuffer;
    +/// File trait
    +pub trait File: Send + Sync {
    +    /// If readable
    +    fn readable(&self) -> bool;
    +    /// If writable
    +    fn writable(&self) -> bool;
    +    /// Read file to `UserBuffer`
    +    fn read(&self, buf: UserBuffer) -> usize;
    +    /// Write `UserBuffer` to file
    +    fn write(&self, buf: UserBuffer) -> usize;
     }
     
    -pub use inode::{list_apps, open_file, OSInode, OpenFlags};
    -pub use stdio::{Stdin, Stdout};
    -
    -
    - \ No newline at end of file +pub use inode::{list_apps, open_file, OSInode, OpenFlags}; +pub use stdio::{Stdin, Stdout}; + \ No newline at end of file diff --git a/ch6-dev/src/os/fs/stdio.rs.html b/ch6-dev/src/os/fs/stdio.rs.html index 782a65b1..22ff1b65 100644 --- a/ch6-dev/src/os/fs/stdio.rs.html +++ b/ch6-dev/src/os/fs/stdio.rs.html @@ -1,124 +1,117 @@ -stdio.rs - source - -
    1
    -2
    -3
    -4
    -5
    -6
    -7
    -8
    -9
    -10
    -11
    -12
    -13
    -14
    -15
    -16
    -17
    -18
    -19
    -20
    -21
    -22
    -23
    -24
    -25
    -26
    -27
    -28
    -29
    -30
    -31
    -32
    -33
    -34
    -35
    -36
    -37
    -38
    -39
    -40
    -41
    -42
    -43
    -44
    -45
    -46
    -47
    -48
    -49
    -50
    -51
    -52
    -53
    -54
    -55
    -56
    -57
    -58
    -
    //!Stdin & Stdout
    -use super::File;
    -use crate::mm::UserBuffer;
    -use crate::sbi::console_getchar;
    -use crate::task::suspend_current_and_run_next;
    -///Standard input
    -pub struct Stdin;
    -///Standard output
    -pub struct Stdout;
    +stdio.rs - source
    1
    +2
    +3
    +4
    +5
    +6
    +7
    +8
    +9
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    +47
    +48
    +49
    +50
    +51
    +52
    +53
    +54
    +55
    +56
    +57
    +58
    +
    //!Stdin & Stdout
    +use super::File;
    +use crate::mm::UserBuffer;
    +use crate::sbi::console_getchar;
    +use crate::task::suspend_current_and_run_next;
    +///Standard input
    +pub struct Stdin;
    +///Standard output
    +pub struct Stdout;
     
    -impl File for Stdin {
    -    fn readable(&self) -> bool {
    -        true
    -    }
    -    fn writable(&self) -> bool {
    -        false
    -    }
    -    fn read(&self, mut user_buf: UserBuffer) -> usize {
    -        assert_eq!(user_buf.len(), 1);
    -        // busy loop
    -        let mut c: usize;
    -        loop {
    -            c = console_getchar();
    -            if c == 0 {
    -                suspend_current_and_run_next();
    +impl File for Stdin {
    +    fn readable(&self) -> bool {
    +        true
    +    }
    +    fn writable(&self) -> bool {
    +        false
    +    }
    +    fn read(&self, mut user_buf: UserBuffer) -> usize {
    +        assert_eq!(user_buf.len(), 1);
    +        // busy loop
    +        let mut c: usize;
    +        loop {
    +            c = console_getchar();
    +            if c == 0 {
    +                suspend_current_and_run_next();
                     continue;
    -            } else {
    +            } else {
                     break;
                 }
             }
    -        let ch = c as u8;
    -        unsafe {
    -            user_buf.buffers[0].as_mut_ptr().write_volatile(ch);
    +        let ch = c as u8;
    +        unsafe {
    +            user_buf.buffers[0].as_mut_ptr().write_volatile(ch);
             }
    -        1
    -    }
    -    fn write(&self, _user_buf: UserBuffer) -> usize {
    +        1
    +    }
    +    fn write(&self, _user_buf: UserBuffer) -> usize {
             panic!("Cannot write to stdin!");
         }
     }
     
    -impl File for Stdout {
    -    fn readable(&self) -> bool {
    -        false
    -    }
    -    fn writable(&self) -> bool {
    -        true
    -    }
    -    fn read(&self, _user_buf: UserBuffer) -> usize {
    +impl File for Stdout {
    +    fn readable(&self) -> bool {
    +        false
    +    }
    +    fn writable(&self) -> bool {
    +        true
    +    }
    +    fn read(&self, _user_buf: UserBuffer) -> usize {
             panic!("Cannot read from stdout!");
         }
    -    fn write(&self, user_buf: UserBuffer) -> usize {
    -        for buffer in user_buf.buffers.iter() {
    -            print!("{}", core::str::from_utf8(*buffer).unwrap());
    +    fn write(&self, user_buf: UserBuffer) -> usize {
    +        for buffer in user_buf.buffers.iter() {
    +            print!("{}", core::str::from_utf8(*buffer).unwrap());
             }
    -        user_buf.len()
    +        user_buf.len()
         }
     }
    -
    -
    - \ No newline at end of file + \ No newline at end of file diff --git a/ch6-dev/src/os/lang_items.rs.html b/ch6-dev/src/os/lang_items.rs.html index 7e0aedab..5fe215bd 100644 --- a/ch6-dev/src/os/lang_items.rs.html +++ b/ch6-dev/src/os/lang_items.rs.html @@ -1,44 +1,39 @@ -lang_items.rs - source - -
    1
    -2
    -3
    -4
    -5
    -6
    -7
    -8
    -9
    -10
    -11
    -12
    -13
    -14
    -15
    -16
    -17
    -18
    -
    //! The panic handler
    -use crate::sbi::shutdown;
    -use core::panic::PanicInfo;
    +lang_items.rs - source
    1
    +2
    +3
    +4
    +5
    +6
    +7
    +8
    +9
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +
    //! The panic handler
    +use crate::sbi::shutdown;
    +use core::panic::PanicInfo;
    +use log::*;
     
    -#[panic_handler]
    -fn panic(info: &PanicInfo) -> ! {
    -    if let Some(location) = info.location() {
    -        println!(
    +#[panic_handler]
    +fn panic(info: &PanicInfo) -> ! {
    +    if let Some(location) = info.location() {
    +        error!(
                 "[kernel] Panicked at {}:{} {}",
    -            location.file(),
    -            location.line(),
    -            info.message().unwrap()
    +            location.file(),
    +            location.line(),
    +            info.message().unwrap()
             );
    -    } else {
    -        println!("[kernel] Panicked: {}", info.message().unwrap());
    +    } else {
    +        error!("[kernel] Panicked: {}", info.message().unwrap());
         }
    -    shutdown()
    +    shutdown(true)
     }
    -
    -
    - \ No newline at end of file + \ No newline at end of file diff --git a/ch6-dev/src/os/main.rs.html b/ch6-dev/src/os/main.rs.html index 14a99ed8..2e34423e 100644 --- a/ch6-dev/src/os/main.rs.html +++ b/ch6-dev/src/os/main.rs.html @@ -1,176 +1,161 @@ -main.rs - source - -
    1
    -2
    -3
    -4
    -5
    -6
    -7
    -8
    -9
    -10
    -11
    -12
    -13
    -14
    -15
    -16
    -17
    -18
    -19
    -20
    -21
    -22
    -23
    -24
    -25
    -26
    -27
    -28
    -29
    -30
    -31
    -32
    -33
    -34
    -35
    -36
    -37
    -38
    -39
    -40
    -41
    -42
    -43
    -44
    -45
    -46
    -47
    -48
    -49
    -50
    -51
    -52
    -53
    -54
    -55
    -56
    -57
    -58
    -59
    -60
    -61
    -62
    -63
    -64
    -65
    -66
    -67
    -68
    -69
    -70
    -71
    -72
    -73
    -74
    -75
    -76
    -77
    -78
    -79
    -80
    -81
    -82
    -83
    -84
    -
    //! The main module and entrypoint
    -//!
    -//! Various facilities of the kernels are implemented as submodules. The most
    -//! important ones are:
    -//!
    -//! - [`trap`]: Handles all cases of switching from userspace to the kernel
    -//! - [`task`]: Task management
    -//! - [`syscall`]: System call handling and implementation
    -//! - [`mm`]: Address map using SV39
    -//! - [`sync`]: Wrap a static data structure inside it so that we are able to access it without any `unsafe`.
    -//! - [`fs`]: Separate user from file system with some structures
    -//!
    -//! The operating system also starts in this module. Kernel code starts
    -//! executing from `entry.asm`, after which [`rust_main()`] is called to
    -//! initialize various pieces of functionality. (See its source code for
    -//! details.)
    -//!
    -//! We then call [`task::run_tasks()`] and for the first time go to
    -//! userspace.
    +main.rs - source
    1
    +2
    +3
    +4
    +5
    +6
    +7
    +8
    +9
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    +47
    +48
    +49
    +50
    +51
    +52
    +53
    +54
    +55
    +56
    +57
    +58
    +59
    +60
    +61
    +62
    +63
    +64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    +79
    +80
    +
    //! The main module and entrypoint
    +//!
    +//! Various facilities of the kernels are implemented as submodules. The most
    +//! important ones are:
    +//!
    +//! - [`trap`]: Handles all cases of switching from userspace to the kernel
    +//! - [`task`]: Task management
    +//! - [`syscall`]: System call handling and implementation
    +//! - [`mm`]: Address map using SV39
    +//! - [`sync`]: Wrap a static data structure inside it so that we are able to access it without any `unsafe`.
    +//! - [`fs`]: Separate user from file system with some structures
    +//!
    +//! The operating system also starts in this module. Kernel code starts
    +//! executing from `entry.asm`, after which [`rust_main()`] is called to
    +//! initialize various pieces of functionality. (See its source code for
    +//! details.)
    +//!
    +//! We then call [`task::run_tasks()`] and for the first time go to
    +//! userspace.
     
    -#![deny(missing_docs)]
    -#![deny(warnings)]
    -#![allow(unused_imports)]
    -#![no_std]
    -#![no_main]
    -#![feature(panic_info_message)]
    -#![feature(alloc_error_handler)]
    +#![deny(missing_docs)]
    +#![deny(warnings)]
    +#![allow(unused_imports)]
    +#![no_std]
    +#![no_main]
    +#![feature(panic_info_message)]
    +#![feature(alloc_error_handler)]
     
    -extern crate alloc;
    +extern crate alloc;
     
    -#[macro_use]
    -extern crate bitflags;
    +#[macro_use]
    +extern crate bitflags;
     
    -#[cfg(feature = "board_k210")]
    -#[path = "boards/k210.rs"]
    -mod board;
    -#[cfg(not(any(feature = "board_k210")))]
    -#[path = "boards/qemu.rs"]
    -mod board;
    +#[path = "boards/qemu.rs"]
    +mod board;
     
    -#[macro_use]
    -mod console;
    -mod config;
    -mod drivers;
    -pub mod fs;
    -pub mod lang_items;
    -pub mod mm;
    -pub mod sbi;
    -pub mod sync;
    -pub mod syscall;
    -pub mod task;
    -pub mod timer;
    -pub mod trap;
    +#[macro_use]
    +mod console;
    +mod config;
    +mod drivers;
    +pub mod fs;
    +pub mod lang_items;
    +pub mod mm;
    +pub mod sbi;
    +pub mod sync;
    +pub mod syscall;
    +pub mod task;
    +pub mod timer;
    +pub mod trap;
     
    -use core::arch::global_asm;
    +use core::arch::global_asm;
     
     global_asm!(include_str!("entry.asm"));
    -/// clear BSS segment
    -fn clear_bss() {
    -    extern "C" {
    -        fn sbss();
    -        fn ebss();
    +/// clear BSS segment
    +fn clear_bss() {
    +    extern "C" {
    +        fn sbss();
    +        fn ebss();
         }
    -    unsafe {
    -        core::slice::from_raw_parts_mut(sbss as usize as *mut u8, ebss as usize - sbss as usize)
    -            .fill(0);
    +    unsafe {
    +        core::slice::from_raw_parts_mut(sbss as usize as *mut u8, ebss as usize - sbss as usize)
    +            .fill(0);
         }
     }
     
    -#[no_mangle]
    -/// the rust entry-point of os
    -pub fn rust_main() -> ! {
    -    clear_bss();
    +#[no_mangle]
    +/// the rust entry-point of os
    +pub fn rust_main() -> ! {
    +    clear_bss();
         println!("[kernel] Hello, world!");
    -    mm::init();
    -    mm::remap_test();
    -    trap::init();
    -    trap::enable_timer_interrupt();
    -    timer::set_next_trigger();
    -    fs::list_apps();
    -    task::add_initproc();
    -    task::run_tasks();
    +    mm::init();
    +    mm::remap_test();
    +    trap::init();
    +    trap::enable_timer_interrupt();
    +    timer::set_next_trigger();
    +    fs::list_apps();
    +    task::add_initproc();
    +    task::run_tasks();
         panic!("Unreachable in rust_main!");
     }
    -
    -
    - \ No newline at end of file + \ No newline at end of file diff --git a/ch6-dev/src/os/mm/address.rs.html b/ch6-dev/src/os/mm/address.rs.html index db6464b2..357a7485 100644 --- a/ch6-dev/src/os/mm/address.rs.html +++ b/ch6-dev/src/os/mm/address.rs.html @@ -1,576 +1,585 @@ -address.rs - source - -
    1
    -2
    -3
    -4
    -5
    -6
    -7
    -8
    -9
    -10
    -11
    -12
    -13
    -14
    -15
    -16
    -17
    -18
    -19
    -20
    -21
    -22
    -23
    -24
    -25
    -26
    -27
    -28
    -29
    -30
    -31
    -32
    -33
    -34
    -35
    -36
    -37
    -38
    -39
    -40
    -41
    -42
    -43
    -44
    -45
    -46
    -47
    -48
    -49
    -50
    -51
    -52
    -53
    -54
    -55
    -56
    -57
    -58
    -59
    -60
    -61
    -62
    -63
    -64
    -65
    -66
    -67
    -68
    -69
    -70
    -71
    -72
    -73
    -74
    -75
    -76
    -77
    -78
    -79
    -80
    -81
    -82
    -83
    -84
    -85
    -86
    -87
    -88
    -89
    -90
    -91
    -92
    -93
    -94
    -95
    -96
    -97
    -98
    -99
    -100
    -101
    -102
    -103
    -104
    -105
    -106
    -107
    -108
    -109
    -110
    -111
    -112
    -113
    -114
    -115
    -116
    -117
    -118
    -119
    -120
    -121
    -122
    -123
    -124
    -125
    -126
    -127
    -128
    -129
    -130
    -131
    -132
    -133
    -134
    -135
    -136
    -137
    -138
    -139
    -140
    -141
    -142
    -143
    -144
    -145
    -146
    -147
    -148
    -149
    -150
    -151
    -152
    -153
    -154
    -155
    -156
    -157
    -158
    -159
    -160
    -161
    -162
    -163
    -164
    -165
    -166
    -167
    -168
    -169
    -170
    -171
    -172
    -173
    -174
    -175
    -176
    -177
    -178
    -179
    -180
    -181
    -182
    -183
    -184
    -185
    -186
    -187
    -188
    -189
    -190
    -191
    -192
    -193
    -194
    -195
    -196
    -197
    -198
    -199
    -200
    -201
    -202
    -203
    -204
    -205
    -206
    -207
    -208
    -209
    -210
    -211
    -212
    -213
    -214
    -215
    -216
    -217
    -218
    -219
    -220
    -221
    -222
    -223
    -224
    -225
    -226
    -227
    -228
    -229
    -230
    -231
    -232
    -233
    -234
    -235
    -236
    -237
    -238
    -239
    -240
    -241
    -242
    -243
    -244
    -245
    -246
    -247
    -248
    -249
    -250
    -251
    -252
    -253
    -254
    -255
    -256
    -257
    -258
    -259
    -260
    -261
    -262
    -263
    -264
    -265
    -266
    -267
    -268
    -269
    -270
    -271
    -272
    -273
    -274
    -275
    -276
    -277
    -278
    -279
    -280
    -281
    -282
    -283
    -284
    -
    //! Implementation of physical and virtual address and page number.
    -use super::PageTableEntry;
    -use crate::config::{PAGE_SIZE, PAGE_SIZE_BITS};
    -use core::fmt::{self, Debug, Formatter};
    +address.rs - source
    1
    +2
    +3
    +4
    +5
    +6
    +7
    +8
    +9
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    +47
    +48
    +49
    +50
    +51
    +52
    +53
    +54
    +55
    +56
    +57
    +58
    +59
    +60
    +61
    +62
    +63
    +64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    +79
    +80
    +81
    +82
    +83
    +84
    +85
    +86
    +87
    +88
    +89
    +90
    +91
    +92
    +93
    +94
    +95
    +96
    +97
    +98
    +99
    +100
    +101
    +102
    +103
    +104
    +105
    +106
    +107
    +108
    +109
    +110
    +111
    +112
    +113
    +114
    +115
    +116
    +117
    +118
    +119
    +120
    +121
    +122
    +123
    +124
    +125
    +126
    +127
    +128
    +129
    +130
    +131
    +132
    +133
    +134
    +135
    +136
    +137
    +138
    +139
    +140
    +141
    +142
    +143
    +144
    +145
    +146
    +147
    +148
    +149
    +150
    +151
    +152
    +153
    +154
    +155
    +156
    +157
    +158
    +159
    +160
    +161
    +162
    +163
    +164
    +165
    +166
    +167
    +168
    +169
    +170
    +171
    +172
    +173
    +174
    +175
    +176
    +177
    +178
    +179
    +180
    +181
    +182
    +183
    +184
    +185
    +186
    +187
    +188
    +189
    +190
    +191
    +192
    +193
    +194
    +195
    +196
    +197
    +198
    +199
    +200
    +201
    +202
    +203
    +204
    +205
    +206
    +207
    +208
    +209
    +210
    +211
    +212
    +213
    +214
    +215
    +216
    +217
    +218
    +219
    +220
    +221
    +222
    +223
    +224
    +225
    +226
    +227
    +228
    +229
    +230
    +231
    +232
    +233
    +234
    +235
    +236
    +237
    +238
    +239
    +240
    +241
    +242
    +243
    +244
    +245
    +246
    +247
    +248
    +249
    +250
    +251
    +252
    +253
    +254
    +255
    +256
    +257
    +258
    +259
    +260
    +261
    +262
    +263
    +264
    +265
    +266
    +267
    +268
    +269
    +270
    +271
    +272
    +273
    +274
    +275
    +276
    +277
    +278
    +279
    +280
    +281
    +282
    +283
    +284
    +285
    +286
    +287
    +288
    +289
    +290
    +291
    +292
    +
    //! Implementation of physical and virtual address and page number.
    +use super::PageTableEntry;
    +use crate::config::{PAGE_SIZE, PAGE_SIZE_BITS};
    +use core::fmt::{self, Debug, Formatter};
     
    -const PA_WIDTH_SV39: usize = 56;
    -const VA_WIDTH_SV39: usize = 39;
    -const PPN_WIDTH_SV39: usize = PA_WIDTH_SV39 - PAGE_SIZE_BITS;
    -const VPN_WIDTH_SV39: usize = VA_WIDTH_SV39 - PAGE_SIZE_BITS;
    +const PA_WIDTH_SV39: usize = 56;
    +const VA_WIDTH_SV39: usize = 39;
    +const PPN_WIDTH_SV39: usize = PA_WIDTH_SV39 - PAGE_SIZE_BITS;
    +const VPN_WIDTH_SV39: usize = VA_WIDTH_SV39 - PAGE_SIZE_BITS;
     
    -/// Definitions
    -#[repr(C)]
    -#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq)]
    -pub struct PhysAddr(pub usize);
    +/// Definitions
    +#[repr(C)]
    +#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq)]
    +pub struct PhysAddr(pub usize);
     
    -#[repr(C)]
    -#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq)]
    -///virtual address
    -pub struct VirtAddr(pub usize);
    +#[repr(C)]
    +#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq)]
    +///virtual address
    +pub struct VirtAddr(pub usize);
     
    -#[repr(C)]
    -#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq)]
    -///phiscal page number
    -pub struct PhysPageNum(pub usize);
    +#[repr(C)]
    +#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq)]
    +///phiscal page number
    +pub struct PhysPageNum(pub usize);
     
    -#[repr(C)]
    -#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq)]
    -///virtual page number
    -pub struct VirtPageNum(pub usize);
    +#[repr(C)]
    +#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq)]
    +///virtual page number
    +pub struct VirtPageNum(pub usize);
     
    -/// Debugging
    +/// Debugging
     
    -impl Debug for VirtAddr {
    -    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
    -        f.write_fmt(format_args!("VA:{:#x}", self.0))
    +impl Debug for VirtAddr {
    +    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
    +        f.write_fmt(format_args!("VA:{:#x}", self.0))
         }
     }
    -impl Debug for VirtPageNum {
    -    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
    -        f.write_fmt(format_args!("VPN:{:#x}", self.0))
    +impl Debug for VirtPageNum {
    +    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
    +        f.write_fmt(format_args!("VPN:{:#x}", self.0))
         }
     }
    -impl Debug for PhysAddr {
    -    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
    -        f.write_fmt(format_args!("PA:{:#x}", self.0))
    +impl Debug for PhysAddr {
    +    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
    +        f.write_fmt(format_args!("PA:{:#x}", self.0))
         }
     }
    -impl Debug for PhysPageNum {
    -    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
    -        f.write_fmt(format_args!("PPN:{:#x}", self.0))
    +impl Debug for PhysPageNum {
    +    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
    +        f.write_fmt(format_args!("PPN:{:#x}", self.0))
         }
     }
     
    -/// T: {PhysAddr, VirtAddr, PhysPageNum, VirtPageNum}
    -/// T -> usize: T.0
    -/// usize -> T: usize.into()
    +/// T: {PhysAddr, VirtAddr, PhysPageNum, VirtPageNum}
    +/// T -> usize: T.0
    +/// usize -> T: usize.into()
     
    -impl From<usize> for PhysAddr {
    -    fn from(v: usize) -> Self {
    -        Self(v & ((1 << PA_WIDTH_SV39) - 1))
    +impl From<usize> for PhysAddr {
    +    fn from(v: usize) -> Self {
    +        Self(v & ((1 << PA_WIDTH_SV39) - 1))
         }
     }
    -impl From<usize> for PhysPageNum {
    -    fn from(v: usize) -> Self {
    -        Self(v & ((1 << PPN_WIDTH_SV39) - 1))
    +impl From<usize> for PhysPageNum {
    +    fn from(v: usize) -> Self {
    +        Self(v & ((1 << PPN_WIDTH_SV39) - 1))
         }
     }
    -impl From<usize> for VirtAddr {
    -    fn from(v: usize) -> Self {
    -        Self(v & ((1 << VA_WIDTH_SV39) - 1))
    +impl From<usize> for VirtAddr {
    +    fn from(v: usize) -> Self {
    +        Self(v & ((1 << VA_WIDTH_SV39) - 1))
         }
     }
    -impl From<usize> for VirtPageNum {
    -    fn from(v: usize) -> Self {
    -        Self(v & ((1 << VPN_WIDTH_SV39) - 1))
    +impl From<usize> for VirtPageNum {
    +    fn from(v: usize) -> Self {
    +        Self(v & ((1 << VPN_WIDTH_SV39) - 1))
         }
     }
    -impl From<PhysAddr> for usize {
    -    fn from(v: PhysAddr) -> Self {
    -        v.0
    +impl From<PhysAddr> for usize {
    +    fn from(v: PhysAddr) -> Self {
    +        v.0
    +    }
    +}
    +impl From<PhysPageNum> for usize {
    +    fn from(v: PhysPageNum) -> Self {
    +        v.0
    +    }
    +}
    +impl From<VirtAddr> for usize {
    +    fn from(v: VirtAddr) -> Self {
    +        if v.0 >= (1 << (VA_WIDTH_SV39 - 1)) {
    +            v.0 | (!((1 << VA_WIDTH_SV39) - 1))
    +        } else {
    +            v.0
    +        }
         }
     }
    -impl From<PhysPageNum> for usize {
    -    fn from(v: PhysPageNum) -> Self {
    -        v.0
    +impl From<VirtPageNum> for usize {
    +    fn from(v: VirtPageNum) -> Self {
    +        v.0
    +    }
    +}
    +///
    +impl VirtAddr {
    +    ///`VirtAddr`->`VirtPageNum`
    +    pub fn floor(&self) -> VirtPageNum {
    +        VirtPageNum(self.0 / PAGE_SIZE)
    +    }
    +    ///`VirtAddr`->`VirtPageNum`
    +    pub fn ceil(&self) -> VirtPageNum {
    +        if self.0 == 0 {
    +            VirtPageNum(0)
    +        } else {
    +            VirtPageNum((self.0 - 1 + PAGE_SIZE) / PAGE_SIZE)
    +        }
    +    }
    +    ///Get page offset
    +    pub fn page_offset(&self) -> usize {
    +        self.0 & (PAGE_SIZE - 1)
    +    }
    +    ///Check page aligned
    +    pub fn aligned(&self) -> bool {
    +        self.page_offset() == 0
    +    }
    +}
    +impl From<VirtAddr> for VirtPageNum {
    +    fn from(v: VirtAddr) -> Self {
    +        assert_eq!(v.page_offset(), 0);
    +        v.floor()
         }
     }
    -impl From<VirtAddr> for usize {
    -    fn from(v: VirtAddr) -> Self {
    -        if v.0 >= (1 << (VA_WIDTH_SV39 - 1)) {
    -            v.0 | (!((1 << VA_WIDTH_SV39) - 1))
    -        } else {
    -            v.0
    +impl From<VirtPageNum> for VirtAddr {
    +    fn from(v: VirtPageNum) -> Self {
    +        Self(v.0 << PAGE_SIZE_BITS)
    +    }
    +}
    +impl PhysAddr {
    +    ///`PhysAddr`->`PhysPageNum`
    +    pub fn floor(&self) -> PhysPageNum {
    +        PhysPageNum(self.0 / PAGE_SIZE)
    +    }
    +    ///`PhysAddr`->`PhysPageNum`
    +    pub fn ceil(&self) -> PhysPageNum {
    +        if self.0 == 0 {
    +            PhysPageNum(0)
    +        } else {
    +            PhysPageNum((self.0 - 1 + PAGE_SIZE) / PAGE_SIZE)
    +        }
    +    }
    +    ///Get page offset
    +    pub fn page_offset(&self) -> usize {
    +        self.0 & (PAGE_SIZE - 1)
    +    }
    +    ///Check page aligned
    +    pub fn aligned(&self) -> bool {
    +        self.page_offset() == 0
    +    }
    +}
    +impl From<PhysAddr> for PhysPageNum {
    +    fn from(v: PhysAddr) -> Self {
    +        assert_eq!(v.page_offset(), 0);
    +        v.floor()
    +    }
    +}
    +impl From<PhysPageNum> for PhysAddr {
    +    fn from(v: PhysPageNum) -> Self {
    +        Self(v.0 << PAGE_SIZE_BITS)
    +    }
    +}
    +
    +impl VirtPageNum {
    +    ///Return VPN 3 level index
    +    pub fn indexes(&self) -> [usize; 3] {
    +        let mut vpn = self.0;
    +        let mut idx = [0usize; 3];
    +        for i in (0..3).rev() {
    +            idx[i] = vpn & 511;
    +            vpn >>= 9;
    +        }
    +        idx
    +    }
    +}
    +
    +impl PhysAddr {
    +    ///Get reference to `PhysAddr` value
    +    pub fn get_ref<T>(&self) -> &'static T {
    +        unsafe { (self.0 as *const T).as_ref().unwrap() }
    +    }
    +    ///Get mutable reference to `PhysAddr` value
    +    pub fn get_mut<T>(&self) -> &'static mut T {
    +        unsafe { (self.0 as *mut T).as_mut().unwrap() }
    +    }
    +}
    +impl PhysPageNum {
    +    ///Get `PageTableEntry` on `PhysPageNum`
    +    pub fn get_pte_array(&self) -> &'static mut [PageTableEntry] {
    +        let pa: PhysAddr = (*self).into();
    +        unsafe { core::slice::from_raw_parts_mut(pa.0 as *mut PageTableEntry, 512) }
    +    }
    +    ///Get u8 array on `PhysPageNum`
    +    pub fn get_bytes_array(&self) -> &'static mut [u8] {
    +        let pa: PhysAddr = (*self).into();
    +        unsafe { core::slice::from_raw_parts_mut(pa.0 as *mut u8, 4096) }
    +    }
    +    ///Get Get mutable reference to `PhysAddr` value on `PhysPageNum`
    +    pub fn get_mut<T>(&self) -> &'static mut T {
    +        let pa: PhysAddr = (*self).into();
    +        pa.get_mut()
    +    }
    +}
    +///Add value by one
    +pub trait StepByOne {
    +    ///Add value by one
    +    fn step(&mut self);
    +}
    +impl StepByOne for VirtPageNum {
    +    fn step(&mut self) {
    +        self.0 += 1;
    +    }
    +}
    +impl StepByOne for PhysPageNum {
    +    fn step(&mut self) {
    +        self.0 += 1;
    +    }
    +}
    +
    +#[derive(Copy, Clone)]
    +/// a simple range structure for type T
    +pub struct SimpleRange<T>
    +where
    +    T: StepByOne + Copy + PartialEq + PartialOrd + Debug,
    +{
    +    l: T,
    +    r: T,
    +}
    +impl<T> SimpleRange<T>
    +where
    +    T: StepByOne + Copy + PartialEq + PartialOrd + Debug,
    +{
    +    pub fn new(start: T, end: T) -> Self {
    +        assert!(start <= end, "start {:?} > end {:?}!", start, end);
    +        Self { l: start, r: end }
    +    }
    +    pub fn get_start(&self) -> T {
    +        self.l
    +    }
    +    pub fn get_end(&self) -> T {
    +        self.r
    +    }
    +}
    +impl<T> IntoIterator for SimpleRange<T>
    +where
    +    T: StepByOne + Copy + PartialEq + PartialOrd + Debug,
    +{
    +    type Item = T;
    +    type IntoIter = SimpleRangeIterator<T>;
    +    fn into_iter(self) -> Self::IntoIter {
    +        SimpleRangeIterator::new(self.l, self.r)
    +    }
    +}
    +/// iterator for the simple range structure
    +pub struct SimpleRangeIterator<T>
    +where
    +    T: StepByOne + Copy + PartialEq + PartialOrd + Debug,
    +{
    +    current: T,
    +    end: T,
    +}
    +impl<T> SimpleRangeIterator<T>
    +where
    +    T: StepByOne + Copy + PartialEq + PartialOrd + Debug,
    +{
    +    pub fn new(l: T, r: T) -> Self {
    +        Self { current: l, end: r }
    +    }
    +}
    +impl<T> Iterator for SimpleRangeIterator<T>
    +where
    +    T: StepByOne + Copy + PartialEq + PartialOrd + Debug,
    +{
    +    type Item = T;
    +    fn next(&mut self) -> Option<Self::Item> {
    +        if self.current == self.end {
    +            None
    +        } else {
    +            let t = self.current;
    +            self.current.step();
    +            Some(t)
             }
         }
     }
    -impl From<VirtPageNum> for usize {
    -    fn from(v: VirtPageNum) -> Self {
    -        v.0
    -    }
    -}
    -///
    -impl VirtAddr {
    -    ///`VirtAddr`->`VirtPageNum`
    -    pub fn floor(&self) -> VirtPageNum {
    -        VirtPageNum(self.0 / PAGE_SIZE)
    -    }
    -    ///`VirtAddr`->`VirtPageNum`
    -    pub fn ceil(&self) -> VirtPageNum {
    -        VirtPageNum((self.0 - 1 + PAGE_SIZE) / PAGE_SIZE)
    -    }
    -    ///Get page offset
    -    pub fn page_offset(&self) -> usize {
    -        self.0 & (PAGE_SIZE - 1)
    -    }
    -    ///Check page aligned
    -    pub fn aligned(&self) -> bool {
    -        self.page_offset() == 0
    -    }
    -}
    -impl From<VirtAddr> for VirtPageNum {
    -    fn from(v: VirtAddr) -> Self {
    -        assert_eq!(v.page_offset(), 0);
    -        v.floor()
    -    }
    -}
    -impl From<VirtPageNum> for VirtAddr {
    -    fn from(v: VirtPageNum) -> Self {
    -        Self(v.0 << PAGE_SIZE_BITS)
    -    }
    -}
    -impl PhysAddr {
    -    ///`PhysAddr`->`PhysPageNum`
    -    pub fn floor(&self) -> PhysPageNum {
    -        PhysPageNum(self.0 / PAGE_SIZE)
    -    }
    -    ///`PhysAddr`->`PhysPageNum`
    -    pub fn ceil(&self) -> PhysPageNum {
    -        PhysPageNum((self.0 - 1 + PAGE_SIZE) / PAGE_SIZE)
    -    }
    -    ///Get page offset
    -    pub fn page_offset(&self) -> usize {
    -        self.0 & (PAGE_SIZE - 1)
    -    }
    -    ///Check page aligned
    -    pub fn aligned(&self) -> bool {
    -        self.page_offset() == 0
    -    }
    -}
    -impl From<PhysAddr> for PhysPageNum {
    -    fn from(v: PhysAddr) -> Self {
    -        assert_eq!(v.page_offset(), 0);
    -        v.floor()
    -    }
    -}
    -impl From<PhysPageNum> for PhysAddr {
    -    fn from(v: PhysPageNum) -> Self {
    -        Self(v.0 << PAGE_SIZE_BITS)
    -    }
    -}
    -
    -impl VirtPageNum {
    -    ///Return VPN 3 level index
    -    pub fn indexes(&self) -> [usize; 3] {
    -        let mut vpn = self.0;
    -        let mut idx = [0usize; 3];
    -        for i in (0..3).rev() {
    -            idx[i] = vpn & 511;
    -            vpn >>= 9;
    -        }
    -        idx
    -    }
    -}
    -
    -impl PhysAddr {
    -    ///Get reference to `PhysAddr` value
    -    pub fn get_ref<T>(&self) -> &'static T {
    -        unsafe { (self.0 as *const T).as_ref().unwrap() }
    -    }
    -    ///Get mutable reference to `PhysAddr` value
    -    pub fn get_mut<T>(&self) -> &'static mut T {
    -        unsafe { (self.0 as *mut T).as_mut().unwrap() }
    -    }
    -}
    -impl PhysPageNum {
    -    ///Get `PageTableEntry` on `PhysPageNum`
    -    pub fn get_pte_array(&self) -> &'static mut [PageTableEntry] {
    -        let pa: PhysAddr = (*self).into();
    -        unsafe { core::slice::from_raw_parts_mut(pa.0 as *mut PageTableEntry, 512) }
    -    }
    -    ///Get u8 array on `PhysPageNum`
    -    pub fn get_bytes_array(&self) -> &'static mut [u8] {
    -        let pa: PhysAddr = (*self).into();
    -        unsafe { core::slice::from_raw_parts_mut(pa.0 as *mut u8, 4096) }
    -    }
    -    ///Get Get mutable reference to `PhysAddr` value on `PhysPageNum`
    -    pub fn get_mut<T>(&self) -> &'static mut T {
    -        let pa: PhysAddr = (*self).into();
    -        pa.get_mut()
    -    }
    -}
    -///Add value by one
    -pub trait StepByOne {
    -    ///Add value by one
    -    fn step(&mut self);
    -}
    -impl StepByOne for VirtPageNum {
    -    fn step(&mut self) {
    -        self.0 += 1;
    -    }
    -}
    -impl StepByOne for PhysPageNum {
    -    fn step(&mut self) {
    -        self.0 += 1;
    -    }
    -}
    -
    -#[derive(Copy, Clone)]
    -/// a simple range structure for type T
    -pub struct SimpleRange<T>
    -where
    -    T: StepByOne + Copy + PartialEq + PartialOrd + Debug,
    -{
    -    l: T,
    -    r: T,
    -}
    -impl<T> SimpleRange<T>
    -where
    -    T: StepByOne + Copy + PartialEq + PartialOrd + Debug,
    -{
    -    pub fn new(start: T, end: T) -> Self {
    -        assert!(start <= end, "start {:?} > end {:?}!", start, end);
    -        Self { l: start, r: end }
    -    }
    -    pub fn get_start(&self) -> T {
    -        self.l
    -    }
    -    pub fn get_end(&self) -> T {
    -        self.r
    -    }
    -}
    -impl<T> IntoIterator for SimpleRange<T>
    -where
    -    T: StepByOne + Copy + PartialEq + PartialOrd + Debug,
    -{
    -    type Item = T;
    -    type IntoIter = SimpleRangeIterator<T>;
    -    fn into_iter(self) -> Self::IntoIter {
    -        SimpleRangeIterator::new(self.l, self.r)
    -    }
    -}
    -/// iterator for the simple range structure
    -pub struct SimpleRangeIterator<T>
    -where
    -    T: StepByOne + Copy + PartialEq + PartialOrd + Debug,
    -{
    -    current: T,
    -    end: T,
    -}
    -impl<T> SimpleRangeIterator<T>
    -where
    -    T: StepByOne + Copy + PartialEq + PartialOrd + Debug,
    -{
    -    pub fn new(l: T, r: T) -> Self {
    -        Self { current: l, end: r }
    -    }
    -}
    -impl<T> Iterator for SimpleRangeIterator<T>
    -where
    -    T: StepByOne + Copy + PartialEq + PartialOrd + Debug,
    -{
    -    type Item = T;
    -    fn next(&mut self) -> Option<Self::Item> {
    -        if self.current == self.end {
    -            None
    -        } else {
    -            let t = self.current;
    -            self.current.step();
    -            Some(t)
    -        }
    -    }
    -}
    -/// a simple range structure for virtual page number
    -pub type VPNRange = SimpleRange<VirtPageNum>;
    -
    -
    - \ No newline at end of file +/// a simple range structure for virtual page number +pub type VPNRange = SimpleRange<VirtPageNum>; + \ No newline at end of file diff --git a/ch6-dev/src/os/mm/frame_allocator.rs.html b/ch6-dev/src/os/mm/frame_allocator.rs.html index 3a6d2c63..22973cfd 100644 --- a/ch6-dev/src/os/mm/frame_allocator.rs.html +++ b/ch6-dev/src/os/mm/frame_allocator.rs.html @@ -1,276 +1,269 @@ -frame_allocator.rs - source - -
    1
    -2
    -3
    -4
    -5
    -6
    -7
    -8
    -9
    -10
    -11
    -12
    -13
    -14
    -15
    -16
    -17
    -18
    -19
    -20
    -21
    -22
    -23
    -24
    -25
    -26
    -27
    -28
    -29
    -30
    -31
    -32
    -33
    -34
    -35
    -36
    -37
    -38
    -39
    -40
    -41
    -42
    -43
    -44
    -45
    -46
    -47
    -48
    -49
    -50
    -51
    -52
    -53
    -54
    -55
    -56
    -57
    -58
    -59
    -60
    -61
    -62
    -63
    -64
    -65
    -66
    -67
    -68
    -69
    -70
    -71
    -72
    -73
    -74
    -75
    -76
    -77
    -78
    -79
    -80
    -81
    -82
    -83
    -84
    -85
    -86
    -87
    -88
    -89
    -90
    -91
    -92
    -93
    -94
    -95
    -96
    -97
    -98
    -99
    -100
    -101
    -102
    -103
    -104
    -105
    -106
    -107
    -108
    -109
    -110
    -111
    -112
    -113
    -114
    -115
    -116
    -117
    -118
    -119
    -120
    -121
    -122
    -123
    -124
    -125
    -126
    -127
    -128
    -129
    -130
    -131
    -132
    -133
    -134
    -
    //! Implementation of [`FrameAllocator`] which
    -//! controls all the frames in the operating system.
    -use super::{PhysAddr, PhysPageNum};
    -use crate::config::MEMORY_END;
    -use crate::sync::UPSafeCell;
    -use alloc::vec::Vec;
    -use core::fmt::{self, Debug, Formatter};
    -use lazy_static::*;
    +frame_allocator.rs - source
    1
    +2
    +3
    +4
    +5
    +6
    +7
    +8
    +9
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    +47
    +48
    +49
    +50
    +51
    +52
    +53
    +54
    +55
    +56
    +57
    +58
    +59
    +60
    +61
    +62
    +63
    +64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    +79
    +80
    +81
    +82
    +83
    +84
    +85
    +86
    +87
    +88
    +89
    +90
    +91
    +92
    +93
    +94
    +95
    +96
    +97
    +98
    +99
    +100
    +101
    +102
    +103
    +104
    +105
    +106
    +107
    +108
    +109
    +110
    +111
    +112
    +113
    +114
    +115
    +116
    +117
    +118
    +119
    +120
    +121
    +122
    +123
    +124
    +125
    +126
    +127
    +128
    +129
    +130
    +131
    +132
    +133
    +134
    +
    //! Implementation of [`FrameAllocator`] which
    +//! controls all the frames in the operating system.
    +use super::{PhysAddr, PhysPageNum};
    +use crate::config::MEMORY_END;
    +use crate::sync::UPSafeCell;
    +use alloc::vec::Vec;
    +use core::fmt::{self, Debug, Formatter};
    +use lazy_static::*;
     
    -/// manage a frame which has the same lifecycle as the tracker
    -pub struct FrameTracker {
    -    ///
    -    pub ppn: PhysPageNum,
    +/// manage a frame which has the same lifecycle as the tracker
    +pub struct FrameTracker {
    +    ///
    +    pub ppn: PhysPageNum,
     }
     
    -impl FrameTracker {
    -    ///Create an empty `FrameTracker`
    -    pub fn new(ppn: PhysPageNum) -> Self {
    -        // page cleaning
    -        let bytes_array = ppn.get_bytes_array();
    -        for i in bytes_array {
    -            *i = 0;
    +impl FrameTracker {
    +    ///Create an empty `FrameTracker`
    +    pub fn new(ppn: PhysPageNum) -> Self {
    +        // page cleaning
    +        let bytes_array = ppn.get_bytes_array();
    +        for i in bytes_array {
    +            *i = 0;
             }
    -        Self { ppn }
    +        Self { ppn }
         }
     }
     
    -impl Debug for FrameTracker {
    -    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
    -        f.write_fmt(format_args!("FrameTracker:PPN={:#x}", self.ppn.0))
    +impl Debug for FrameTracker {
    +    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
    +        f.write_fmt(format_args!("FrameTracker:PPN={:#x}", self.ppn.0))
         }
     }
     
    -impl Drop for FrameTracker {
    -    fn drop(&mut self) {
    -        frame_dealloc(self.ppn);
    +impl Drop for FrameTracker {
    +    fn drop(&mut self) {
    +        frame_dealloc(self.ppn);
         }
     }
     
    -trait FrameAllocator {
    -    fn new() -> Self;
    -    fn alloc(&mut self) -> Option<PhysPageNum>;
    -    fn dealloc(&mut self, ppn: PhysPageNum);
    +trait FrameAllocator {
    +    fn new() -> Self;
    +    fn alloc(&mut self) -> Option<PhysPageNum>;
    +    fn dealloc(&mut self, ppn: PhysPageNum);
     }
    -/// an implementation for frame allocator
    -pub struct StackFrameAllocator {
    -    current: usize,
    -    end: usize,
    -    recycled: Vec<usize>,
    +/// an implementation for frame allocator
    +pub struct StackFrameAllocator {
    +    current: usize,
    +    end: usize,
    +    recycled: Vec<usize>,
     }
     
    -impl StackFrameAllocator {
    -    pub fn init(&mut self, l: PhysPageNum, r: PhysPageNum) {
    -        self.current = l.0;
    -        self.end = r.0;
    -        println!("last {} Physical Frames.", self.end - self.current);
    +impl StackFrameAllocator {
    +    pub fn init(&mut self, l: PhysPageNum, r: PhysPageNum) {
    +        self.current = l.0;
    +        self.end = r.0;
    +        println!("last {} Physical Frames.", self.end - self.current);
         }
     }
    -impl FrameAllocator for StackFrameAllocator {
    -    fn new() -> Self {
    -        Self {
    -            current: 0,
    -            end: 0,
    -            recycled: Vec::new(),
    +impl FrameAllocator for StackFrameAllocator {
    +    fn new() -> Self {
    +        Self {
    +            current: 0,
    +            end: 0,
    +            recycled: Vec::new(),
             }
         }
    -    fn alloc(&mut self) -> Option<PhysPageNum> {
    -        if let Some(ppn) = self.recycled.pop() {
    -            Some(ppn.into())
    -        } else if self.current == self.end {
    -            None
    -        } else {
    -            self.current += 1;
    -            Some((self.current - 1).into())
    +    fn alloc(&mut self) -> Option<PhysPageNum> {
    +        if let Some(ppn) = self.recycled.pop() {
    +            Some(ppn.into())
    +        } else if self.current == self.end {
    +            None
    +        } else {
    +            self.current += 1;
    +            Some((self.current - 1).into())
             }
         }
    -    fn dealloc(&mut self, ppn: PhysPageNum) {
    -        let ppn = ppn.0;
    -        // validity check
    -        if ppn >= self.current || self.recycled.iter().any(|&v| v == ppn) {
    -            panic!("Frame ppn={:#x} has not been allocated!", ppn);
    +    fn dealloc(&mut self, ppn: PhysPageNum) {
    +        let ppn = ppn.0;
    +        // validity check
    +        if ppn >= self.current || self.recycled.iter().any(|&v| v == ppn) {
    +            panic!("Frame ppn={:#x} has not been allocated!", ppn);
             }
    -        // recycle
    -        self.recycled.push(ppn);
    +        // recycle
    +        self.recycled.push(ppn);
         }
     }
     
    -type FrameAllocatorImpl = StackFrameAllocator;
    +type FrameAllocatorImpl = StackFrameAllocator;
     
    -lazy_static! {
    -    /// frame allocator instance through lazy_static!
    -    pub static ref FRAME_ALLOCATOR: UPSafeCell<FrameAllocatorImpl> =
    -        unsafe { UPSafeCell::new(FrameAllocatorImpl::new()) };
    +lazy_static! {
    +    /// frame allocator instance through lazy_static!
    +    pub static ref FRAME_ALLOCATOR: UPSafeCell<FrameAllocatorImpl> =
    +        unsafe { UPSafeCell::new(FrameAllocatorImpl::new()) };
     }
    -/// initiate the frame allocator using `ekernel` and `MEMORY_END`
    -pub fn init_frame_allocator() {
    -    extern "C" {
    -        fn ekernel();
    +/// initiate the frame allocator using `ekernel` and `MEMORY_END`
    +pub fn init_frame_allocator() {
    +    extern "C" {
    +        fn ekernel();
         }
    -    FRAME_ALLOCATOR.exclusive_access().init(
    -        PhysAddr::from(ekernel as usize).ceil(),
    -        PhysAddr::from(MEMORY_END).floor(),
    +    FRAME_ALLOCATOR.exclusive_access().init(
    +        PhysAddr::from(ekernel as usize).ceil(),
    +        PhysAddr::from(MEMORY_END).floor(),
         );
     }
    -/// allocate a frame
    -pub fn frame_alloc() -> Option<FrameTracker> {
    -    FRAME_ALLOCATOR
    -        .exclusive_access()
    -        .alloc()
    -        .map(FrameTracker::new)
    +/// allocate a frame
    +pub fn frame_alloc() -> Option<FrameTracker> {
    +    FRAME_ALLOCATOR
    +        .exclusive_access()
    +        .alloc()
    +        .map(FrameTracker::new)
     }
    -/// deallocate a frame
    -pub fn frame_dealloc(ppn: PhysPageNum) {
    -    FRAME_ALLOCATOR.exclusive_access().dealloc(ppn);
    +/// deallocate a frame
    +pub fn frame_dealloc(ppn: PhysPageNum) {
    +    FRAME_ALLOCATOR.exclusive_access().dealloc(ppn);
     }
     
    -#[allow(unused)]
    -/// a simple test for frame allocator
    -pub fn frame_allocator_test() {
    -    let mut v: Vec<FrameTracker> = Vec::new();
    -    for i in 0..5 {
    -        let frame = frame_alloc().unwrap();
    -        println!("{:?}", frame);
    -        v.push(frame);
    +#[allow(unused)]
    +/// a simple test for frame allocator
    +pub fn frame_allocator_test() {
    +    let mut v: Vec<FrameTracker> = Vec::new();
    +    for i in 0..5 {
    +        let frame = frame_alloc().unwrap();
    +        println!("{:?}", frame);
    +        v.push(frame);
         }
    -    v.clear();
    -    for i in 0..5 {
    -        let frame = frame_alloc().unwrap();
    -        println!("{:?}", frame);
    -        v.push(frame);
    +    v.clear();
    +    for i in 0..5 {
    +        let frame = frame_alloc().unwrap();
    +        println!("{:?}", frame);
    +        v.push(frame);
         }
    -    drop(v);
    +    drop(v);
         println!("frame_allocator_test passed!");
     }
    -
    -
    - \ No newline at end of file + \ No newline at end of file diff --git a/ch6-dev/src/os/mm/heap_allocator.rs.html b/ch6-dev/src/os/mm/heap_allocator.rs.html index bf02b012..50696648 100644 --- a/ch6-dev/src/os/mm/heap_allocator.rs.html +++ b/ch6-dev/src/os/mm/heap_allocator.rs.html @@ -1,104 +1,97 @@ -heap_allocator.rs - source - -
    1
    -2
    -3
    -4
    -5
    -6
    -7
    -8
    -9
    -10
    -11
    -12
    -13
    -14
    -15
    -16
    -17
    -18
    -19
    -20
    -21
    -22
    -23
    -24
    -25
    -26
    -27
    -28
    -29
    -30
    -31
    -32
    -33
    -34
    -35
    -36
    -37
    -38
    -39
    -40
    -41
    -42
    -43
    -44
    -45
    -46
    -47
    -48
    -
    //! The global allocator
    -use crate::config::KERNEL_HEAP_SIZE;
    -use buddy_system_allocator::LockedHeap;
    +heap_allocator.rs - source
    1
    +2
    +3
    +4
    +5
    +6
    +7
    +8
    +9
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    +47
    +48
    +
    //! The global allocator
    +use crate::config::KERNEL_HEAP_SIZE;
    +use buddy_system_allocator::LockedHeap;
     
    -#[global_allocator]
    -/// heap allocator instance
    -static HEAP_ALLOCATOR: LockedHeap = LockedHeap::empty();
    +#[global_allocator]
    +/// heap allocator instance
    +static HEAP_ALLOCATOR: LockedHeap = LockedHeap::empty();
     
    -#[alloc_error_handler]
    -/// panic when heap allocation error occurs
    -pub fn handle_alloc_error(layout: core::alloc::Layout) -> ! {
    -    panic!("Heap allocation error, layout = {:?}", layout);
    +#[alloc_error_handler]
    +/// panic when heap allocation error occurs
    +pub fn handle_alloc_error(layout: core::alloc::Layout) -> ! {
    +    panic!("Heap allocation error, layout = {:?}", layout);
     }
    -/// heap space ([u8; KERNEL_HEAP_SIZE])
    -static mut HEAP_SPACE: [u8; KERNEL_HEAP_SIZE] = [0; KERNEL_HEAP_SIZE];
    -/// initiate heap allocator
    -pub fn init_heap() {
    -    unsafe {
    -        HEAP_ALLOCATOR
    -            .lock()
    -            .init(HEAP_SPACE.as_ptr() as usize, KERNEL_HEAP_SIZE);
    +/// heap space ([u8; KERNEL_HEAP_SIZE])
    +static mut HEAP_SPACE: [u8; KERNEL_HEAP_SIZE] = [0; KERNEL_HEAP_SIZE];
    +/// initiate heap allocator
    +pub fn init_heap() {
    +    unsafe {
    +        HEAP_ALLOCATOR
    +            .lock()
    +            .init(HEAP_SPACE.as_ptr() as usize, KERNEL_HEAP_SIZE);
         }
     }
     
    -#[allow(unused)]
    -pub fn heap_test() {
    -    use alloc::boxed::Box;
    -    use alloc::vec::Vec;
    -    extern "C" {
    -        fn sbss();
    -        fn ebss();
    +#[allow(unused)]
    +pub fn heap_test() {
    +    use alloc::boxed::Box;
    +    use alloc::vec::Vec;
    +    extern "C" {
    +        fn sbss();
    +        fn ebss();
         }
    -    let bss_range = sbss as usize..ebss as usize;
    -    let a = Box::new(5);
    -    assert_eq!(*a, 5);
    -    assert!(bss_range.contains(&(a.as_ref() as *const _ as usize)));
    -    drop(a);
    -    let mut v: Vec<usize> = Vec::new();
    -    for i in 0..500 {
    -        v.push(i);
    +    let bss_range = sbss as usize..ebss as usize;
    +    let a = Box::new(5);
    +    assert_eq!(*a, 5);
    +    assert!(bss_range.contains(&(a.as_ref() as *const _ as usize)));
    +    drop(a);
    +    let mut v: Vec<usize> = Vec::new();
    +    for i in 0..500 {
    +        v.push(i);
         }
    -    for (i, val) in v.iter().take(500).enumerate() {
    -        assert_eq!(*val, i);
    +    for (i, val) in v.iter().take(500).enumerate() {
    +        assert_eq!(*val, i);
         }
    -    assert!(bss_range.contains(&(v.as_ptr() as usize)));
    -    drop(v);
    +    assert!(bss_range.contains(&(v.as_ptr() as usize)));
    +    drop(v);
         println!("heap_test passed!");
     }
    -
    -
    - \ No newline at end of file + \ No newline at end of file diff --git a/ch6-dev/src/os/mm/memory_set.rs.html b/ch6-dev/src/os/mm/memory_set.rs.html index 9d273a07..353c3652 100644 --- a/ch6-dev/src/os/mm/memory_set.rs.html +++ b/ch6-dev/src/os/mm/memory_set.rs.html @@ -1,824 +1,817 @@ -memory_set.rs - source - -
    1
    -2
    -3
    -4
    -5
    -6
    -7
    -8
    -9
    -10
    -11
    -12
    -13
    -14
    -15
    -16
    -17
    -18
    -19
    -20
    -21
    -22
    -23
    -24
    -25
    -26
    -27
    -28
    -29
    -30
    -31
    -32
    -33
    -34
    -35
    -36
    -37
    -38
    -39
    -40
    -41
    -42
    -43
    -44
    -45
    -46
    -47
    -48
    -49
    -50
    -51
    -52
    -53
    -54
    -55
    -56
    -57
    -58
    -59
    -60
    -61
    -62
    -63
    -64
    -65
    -66
    -67
    -68
    -69
    -70
    -71
    -72
    -73
    -74
    -75
    -76
    -77
    -78
    -79
    -80
    -81
    -82
    -83
    -84
    -85
    -86
    -87
    -88
    -89
    -90
    -91
    -92
    -93
    -94
    -95
    -96
    -97
    -98
    -99
    -100
    -101
    -102
    -103
    -104
    -105
    -106
    -107
    -108
    -109
    -110
    -111
    -112
    -113
    -114
    -115
    -116
    -117
    -118
    -119
    -120
    -121
    -122
    -123
    -124
    -125
    -126
    -127
    -128
    -129
    -130
    -131
    -132
    -133
    -134
    -135
    -136
    -137
    -138
    -139
    -140
    -141
    -142
    -143
    -144
    -145
    -146
    -147
    -148
    -149
    -150
    -151
    -152
    -153
    -154
    -155
    -156
    -157
    -158
    -159
    -160
    -161
    -162
    -163
    -164
    -165
    -166
    -167
    -168
    -169
    -170
    -171
    -172
    -173
    -174
    -175
    -176
    -177
    -178
    -179
    -180
    -181
    -182
    -183
    -184
    -185
    -186
    -187
    -188
    -189
    -190
    -191
    -192
    -193
    -194
    -195
    -196
    -197
    -198
    -199
    -200
    -201
    -202
    -203
    -204
    -205
    -206
    -207
    -208
    -209
    -210
    -211
    -212
    -213
    -214
    -215
    -216
    -217
    -218
    -219
    -220
    -221
    -222
    -223
    -224
    -225
    -226
    -227
    -228
    -229
    -230
    -231
    -232
    -233
    -234
    -235
    -236
    -237
    -238
    -239
    -240
    -241
    -242
    -243
    -244
    -245
    -246
    -247
    -248
    -249
    -250
    -251
    -252
    -253
    -254
    -255
    -256
    -257
    -258
    -259
    -260
    -261
    -262
    -263
    -264
    -265
    -266
    -267
    -268
    -269
    -270
    -271
    -272
    -273
    -274
    -275
    -276
    -277
    -278
    -279
    -280
    -281
    -282
    -283
    -284
    -285
    -286
    -287
    -288
    -289
    -290
    -291
    -292
    -293
    -294
    -295
    -296
    -297
    -298
    -299
    -300
    -301
    -302
    -303
    -304
    -305
    -306
    -307
    -308
    -309
    -310
    -311
    -312
    -313
    -314
    -315
    -316
    -317
    -318
    -319
    -320
    -321
    -322
    -323
    -324
    -325
    -326
    -327
    -328
    -329
    -330
    -331
    -332
    -333
    -334
    -335
    -336
    -337
    -338
    -339
    -340
    -341
    -342
    -343
    -344
    -345
    -346
    -347
    -348
    -349
    -350
    -351
    -352
    -353
    -354
    -355
    -356
    -357
    -358
    -359
    -360
    -361
    -362
    -363
    -364
    -365
    -366
    -367
    -368
    -369
    -370
    -371
    -372
    -373
    -374
    -375
    -376
    -377
    -378
    -379
    -380
    -381
    -382
    -383
    -384
    -385
    -386
    -387
    -388
    -389
    -390
    -391
    -392
    -393
    -394
    -395
    -396
    -397
    -398
    -399
    -400
    -401
    -402
    -403
    -404
    -405
    -406
    -407
    -408
    -
    //! Implementation of [`MapArea`] and [`MemorySet`].
    -use super::{frame_alloc, FrameTracker};
    -use super::{PTEFlags, PageTable, PageTableEntry};
    -use super::{PhysAddr, PhysPageNum, VirtAddr, VirtPageNum};
    -use super::{StepByOne, VPNRange};
    -use crate::config::{MEMORY_END, MMIO, PAGE_SIZE, TRAMPOLINE, TRAP_CONTEXT, USER_STACK_SIZE};
    -use crate::sync::UPSafeCell;
    -use alloc::collections::BTreeMap;
    -use alloc::sync::Arc;
    -use alloc::vec::Vec;
    -use core::arch::asm;
    -use lazy_static::*;
    -use riscv::register::satp;
    +memory_set.rs - source
    1
    +2
    +3
    +4
    +5
    +6
    +7
    +8
    +9
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    +47
    +48
    +49
    +50
    +51
    +52
    +53
    +54
    +55
    +56
    +57
    +58
    +59
    +60
    +61
    +62
    +63
    +64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    +79
    +80
    +81
    +82
    +83
    +84
    +85
    +86
    +87
    +88
    +89
    +90
    +91
    +92
    +93
    +94
    +95
    +96
    +97
    +98
    +99
    +100
    +101
    +102
    +103
    +104
    +105
    +106
    +107
    +108
    +109
    +110
    +111
    +112
    +113
    +114
    +115
    +116
    +117
    +118
    +119
    +120
    +121
    +122
    +123
    +124
    +125
    +126
    +127
    +128
    +129
    +130
    +131
    +132
    +133
    +134
    +135
    +136
    +137
    +138
    +139
    +140
    +141
    +142
    +143
    +144
    +145
    +146
    +147
    +148
    +149
    +150
    +151
    +152
    +153
    +154
    +155
    +156
    +157
    +158
    +159
    +160
    +161
    +162
    +163
    +164
    +165
    +166
    +167
    +168
    +169
    +170
    +171
    +172
    +173
    +174
    +175
    +176
    +177
    +178
    +179
    +180
    +181
    +182
    +183
    +184
    +185
    +186
    +187
    +188
    +189
    +190
    +191
    +192
    +193
    +194
    +195
    +196
    +197
    +198
    +199
    +200
    +201
    +202
    +203
    +204
    +205
    +206
    +207
    +208
    +209
    +210
    +211
    +212
    +213
    +214
    +215
    +216
    +217
    +218
    +219
    +220
    +221
    +222
    +223
    +224
    +225
    +226
    +227
    +228
    +229
    +230
    +231
    +232
    +233
    +234
    +235
    +236
    +237
    +238
    +239
    +240
    +241
    +242
    +243
    +244
    +245
    +246
    +247
    +248
    +249
    +250
    +251
    +252
    +253
    +254
    +255
    +256
    +257
    +258
    +259
    +260
    +261
    +262
    +263
    +264
    +265
    +266
    +267
    +268
    +269
    +270
    +271
    +272
    +273
    +274
    +275
    +276
    +277
    +278
    +279
    +280
    +281
    +282
    +283
    +284
    +285
    +286
    +287
    +288
    +289
    +290
    +291
    +292
    +293
    +294
    +295
    +296
    +297
    +298
    +299
    +300
    +301
    +302
    +303
    +304
    +305
    +306
    +307
    +308
    +309
    +310
    +311
    +312
    +313
    +314
    +315
    +316
    +317
    +318
    +319
    +320
    +321
    +322
    +323
    +324
    +325
    +326
    +327
    +328
    +329
    +330
    +331
    +332
    +333
    +334
    +335
    +336
    +337
    +338
    +339
    +340
    +341
    +342
    +343
    +344
    +345
    +346
    +347
    +348
    +349
    +350
    +351
    +352
    +353
    +354
    +355
    +356
    +357
    +358
    +359
    +360
    +361
    +362
    +363
    +364
    +365
    +366
    +367
    +368
    +369
    +370
    +371
    +372
    +373
    +374
    +375
    +376
    +377
    +378
    +379
    +380
    +381
    +382
    +383
    +384
    +385
    +386
    +387
    +388
    +389
    +390
    +391
    +392
    +393
    +394
    +395
    +396
    +397
    +398
    +399
    +400
    +401
    +402
    +403
    +404
    +405
    +406
    +407
    +408
    +
    //! Implementation of [`MapArea`] and [`MemorySet`].
    +use super::{frame_alloc, FrameTracker};
    +use super::{PTEFlags, PageTable, PageTableEntry};
    +use super::{PhysAddr, PhysPageNum, VirtAddr, VirtPageNum};
    +use super::{StepByOne, VPNRange};
    +use crate::config::{MEMORY_END, MMIO, PAGE_SIZE, TRAMPOLINE, TRAP_CONTEXT, USER_STACK_SIZE};
    +use crate::sync::UPSafeCell;
    +use alloc::collections::BTreeMap;
    +use alloc::sync::Arc;
    +use alloc::vec::Vec;
    +use core::arch::asm;
    +use lazy_static::*;
    +use riscv::register::satp;
     
    -extern "C" {
    -    fn stext();
    -    fn etext();
    -    fn srodata();
    -    fn erodata();
    -    fn sdata();
    -    fn edata();
    -    fn sbss_with_stack();
    -    fn ebss();
    -    fn ekernel();
    -    fn strampoline();
    +extern "C" {
    +    fn stext();
    +    fn etext();
    +    fn srodata();
    +    fn erodata();
    +    fn sdata();
    +    fn edata();
    +    fn sbss_with_stack();
    +    fn ebss();
    +    fn ekernel();
    +    fn strampoline();
     }
     
    -lazy_static! {
    -    /// a memory set instance through lazy_static! managing kernel space
    -    pub static ref KERNEL_SPACE: Arc<UPSafeCell<MemorySet>> =
    -        Arc::new(unsafe { UPSafeCell::new(MemorySet::new_kernel()) });
    +lazy_static! {
    +    /// a memory set instance through lazy_static! managing kernel space
    +    pub static ref KERNEL_SPACE: Arc<UPSafeCell<MemorySet>> =
    +        Arc::new(unsafe { UPSafeCell::new(MemorySet::new_kernel()) });
     }
    -///Get kernelspace root ppn
    -pub fn kernel_token() -> usize {
    -    KERNEL_SPACE.exclusive_access().token()
    +///Get kernelspace root ppn
    +pub fn kernel_token() -> usize {
    +    KERNEL_SPACE.exclusive_access().token()
     }
    -/// memory set structure, controls virtual-memory space
    -pub struct MemorySet {
    -    page_table: PageTable,
    -    areas: Vec<MapArea>,
    +/// memory set structure, controls virtual-memory space
    +pub struct MemorySet {
    +    page_table: PageTable,
    +    areas: Vec<MapArea>,
     }
     
    -impl MemorySet {
    -    ///Create an empty `MemorySet`
    -    pub fn new_bare() -> Self {
    -        Self {
    -            page_table: PageTable::new(),
    -            areas: Vec::new(),
    +impl MemorySet {
    +    ///Create an empty `MemorySet`
    +    pub fn new_bare() -> Self {
    +        Self {
    +            page_table: PageTable::new(),
    +            areas: Vec::new(),
             }
         }
    -    ///Get pagetable `root_ppn`
    -    pub fn token(&self) -> usize {
    -        self.page_table.token()
    +    ///Get pagetable `root_ppn`
    +    pub fn token(&self) -> usize {
    +        self.page_table.token()
         }
    -    /// Assume that no conflicts.
    -    pub fn insert_framed_area(
    -        &mut self,
    -        start_va: VirtAddr,
    -        end_va: VirtAddr,
    -        permission: MapPermission,
    +    /// Assume that no conflicts.
    +    pub fn insert_framed_area(
    +        &mut self,
    +        start_va: VirtAddr,
    +        end_va: VirtAddr,
    +        permission: MapPermission,
         ) {
    -        self.push(
    -            MapArea::new(start_va, end_va, MapType::Framed, permission),
    +        self.push(
    +            MapArea::new(start_va, end_va, MapType::Framed, permission),
                 None,
             );
         }
    -    ///Remove `MapArea` that starts with `start_vpn`
    -    pub fn remove_area_with_start_vpn(&mut self, start_vpn: VirtPageNum) {
    -        if let Some((idx, area)) = self
    -            .areas
    -            .iter_mut()
    -            .enumerate()
    -            .find(|(_, area)| area.vpn_range.get_start() == start_vpn)
    +    ///Remove `MapArea` that starts with `start_vpn`
    +    pub fn remove_area_with_start_vpn(&mut self, start_vpn: VirtPageNum) {
    +        if let Some((idx, area)) = self
    +            .areas
    +            .iter_mut()
    +            .enumerate()
    +            .find(|(_, area)| area.vpn_range.get_start() == start_vpn)
             {
    -            area.unmap(&mut self.page_table);
    -            self.areas.remove(idx);
    +            area.unmap(&mut self.page_table);
    +            self.areas.remove(idx);
             }
         }
    -    fn push(&mut self, mut map_area: MapArea, data: Option<&[u8]>) {
    -        map_area.map(&mut self.page_table);
    -        if let Some(data) = data {
    -            map_area.copy_data(&mut self.page_table, data);
    +    fn push(&mut self, mut map_area: MapArea, data: Option<&[u8]>) {
    +        map_area.map(&mut self.page_table);
    +        if let Some(data) = data {
    +            map_area.copy_data(&mut self.page_table, data);
             }
    -        self.areas.push(map_area);
    +        self.areas.push(map_area);
         }
    -    /// Mention that trampoline is not collected by areas.
    -    fn map_trampoline(&mut self) {
    -        self.page_table.map(
    -            VirtAddr::from(TRAMPOLINE).into(),
    -            PhysAddr::from(strampoline as usize).into(),
    -            PTEFlags::R | PTEFlags::X,
    +    /// Mention that trampoline is not collected by areas.
    +    fn map_trampoline(&mut self) {
    +        self.page_table.map(
    +            VirtAddr::from(TRAMPOLINE).into(),
    +            PhysAddr::from(strampoline as usize).into(),
    +            PTEFlags::R | PTEFlags::X,
             );
         }
    -    /// Without kernel stacks.
    -    pub fn new_kernel() -> Self {
    -        let mut memory_set = Self::new_bare();
    -        // map trampoline
    -        memory_set.map_trampoline();
    -        // map kernel sections
    -        println!(".text [{:#x}, {:#x})", stext as usize, etext as usize);
    -        println!(".rodata [{:#x}, {:#x})", srodata as usize, erodata as usize);
    -        println!(".data [{:#x}, {:#x})", sdata as usize, edata as usize);
    +    /// Without kernel stacks.
    +    pub fn new_kernel() -> Self {
    +        let mut memory_set = Self::new_bare();
    +        // map trampoline
    +        memory_set.map_trampoline();
    +        // map kernel sections
    +        println!(".text [{:#x}, {:#x})", stext as usize, etext as usize);
    +        println!(".rodata [{:#x}, {:#x})", srodata as usize, erodata as usize);
    +        println!(".data [{:#x}, {:#x})", sdata as usize, edata as usize);
             println!(
                 ".bss [{:#x}, {:#x})",
    -            sbss_with_stack as usize, ebss as usize
    +            sbss_with_stack as usize, ebss as usize
             );
             println!("mapping .text section");
    -        memory_set.push(
    -            MapArea::new(
    -                (stext as usize).into(),
    -                (etext as usize).into(),
    -                MapType::Identical,
    -                MapPermission::R | MapPermission::X,
    +        memory_set.push(
    +            MapArea::new(
    +                (stext as usize).into(),
    +                (etext as usize).into(),
    +                MapType::Identical,
    +                MapPermission::R | MapPermission::X,
                 ),
                 None,
             );
             println!("mapping .rodata section");
    -        memory_set.push(
    -            MapArea::new(
    -                (srodata as usize).into(),
    -                (erodata as usize).into(),
    -                MapType::Identical,
    -                MapPermission::R,
    +        memory_set.push(
    +            MapArea::new(
    +                (srodata as usize).into(),
    +                (erodata as usize).into(),
    +                MapType::Identical,
    +                MapPermission::R,
                 ),
                 None,
             );
             println!("mapping .data section");
    -        memory_set.push(
    -            MapArea::new(
    -                (sdata as usize).into(),
    -                (edata as usize).into(),
    -                MapType::Identical,
    -                MapPermission::R | MapPermission::W,
    +        memory_set.push(
    +            MapArea::new(
    +                (sdata as usize).into(),
    +                (edata as usize).into(),
    +                MapType::Identical,
    +                MapPermission::R | MapPermission::W,
                 ),
                 None,
             );
             println!("mapping .bss section");
    -        memory_set.push(
    -            MapArea::new(
    -                (sbss_with_stack as usize).into(),
    -                (ebss as usize).into(),
    -                MapType::Identical,
    -                MapPermission::R | MapPermission::W,
    +        memory_set.push(
    +            MapArea::new(
    +                (sbss_with_stack as usize).into(),
    +                (ebss as usize).into(),
    +                MapType::Identical,
    +                MapPermission::R | MapPermission::W,
                 ),
                 None,
             );
             println!("mapping physical memory");
    -        memory_set.push(
    -            MapArea::new(
    -                (ekernel as usize).into(),
    -                MEMORY_END.into(),
    -                MapType::Identical,
    -                MapPermission::R | MapPermission::W,
    +        memory_set.push(
    +            MapArea::new(
    +                (ekernel as usize).into(),
    +                MEMORY_END.into(),
    +                MapType::Identical,
    +                MapPermission::R | MapPermission::W,
                 ),
                 None,
             );
             println!("mapping memory-mapped registers");
    -        for pair in MMIO {
    -            memory_set.push(
    -                MapArea::new(
    -                    (*pair).0.into(),
    -                    ((*pair).0 + (*pair).1).into(),
    -                    MapType::Identical,
    -                    MapPermission::R | MapPermission::W,
    +        for pair in MMIO {
    +            memory_set.push(
    +                MapArea::new(
    +                    (*pair).0.into(),
    +                    ((*pair).0 + (*pair).1).into(),
    +                    MapType::Identical,
    +                    MapPermission::R | MapPermission::W,
                     ),
                     None,
                 );
             }
    -        memory_set
    +        memory_set
         }
    -    /// Include sections in elf and trampoline and TrapContext and user stack,
    -    /// also returns user_sp and entry point.
    -    pub fn from_elf(elf_data: &[u8]) -> (Self, usize, usize) {
    -        let mut memory_set = Self::new_bare();
    -        // map trampoline
    -        memory_set.map_trampoline();
    -        // map program headers of elf, with U flag
    -        let elf = xmas_elf::ElfFile::new(elf_data).unwrap();
    -        let elf_header = elf.header;
    -        let magic = elf_header.pt1.magic;
    -        assert_eq!(magic, [0x7f, 0x45, 0x4c, 0x46], "invalid elf!");
    -        let ph_count = elf_header.pt2.ph_count();
    -        let mut max_end_vpn = VirtPageNum(0);
    -        for i in 0..ph_count {
    -            let ph = elf.program_header(i).unwrap();
    -            if ph.get_type().unwrap() == xmas_elf::program::Type::Load {
    -                let start_va: VirtAddr = (ph.virtual_addr() as usize).into();
    -                let end_va: VirtAddr = ((ph.virtual_addr() + ph.mem_size()) as usize).into();
    -                let mut map_perm = MapPermission::U;
    -                let ph_flags = ph.flags();
    -                if ph_flags.is_read() {
    -                    map_perm |= MapPermission::R;
    +    /// Include sections in elf and trampoline and TrapContext and user stack,
    +    /// also returns user_sp and entry point.
    +    pub fn from_elf(elf_data: &[u8]) -> (Self, usize, usize) {
    +        let mut memory_set = Self::new_bare();
    +        // map trampoline
    +        memory_set.map_trampoline();
    +        // map program headers of elf, with U flag
    +        let elf = xmas_elf::ElfFile::new(elf_data).unwrap();
    +        let elf_header = elf.header;
    +        let magic = elf_header.pt1.magic;
    +        assert_eq!(magic, [0x7f, 0x45, 0x4c, 0x46], "invalid elf!");
    +        let ph_count = elf_header.pt2.ph_count();
    +        let mut max_end_vpn = VirtPageNum(0);
    +        for i in 0..ph_count {
    +            let ph = elf.program_header(i).unwrap();
    +            if ph.get_type().unwrap() == xmas_elf::program::Type::Load {
    +                let start_va: VirtAddr = (ph.virtual_addr() as usize).into();
    +                let end_va: VirtAddr = ((ph.virtual_addr() + ph.mem_size()) as usize).into();
    +                let mut map_perm = MapPermission::U;
    +                let ph_flags = ph.flags();
    +                if ph_flags.is_read() {
    +                    map_perm |= MapPermission::R;
                     }
    -                if ph_flags.is_write() {
    -                    map_perm |= MapPermission::W;
    +                if ph_flags.is_write() {
    +                    map_perm |= MapPermission::W;
                     }
    -                if ph_flags.is_execute() {
    -                    map_perm |= MapPermission::X;
    +                if ph_flags.is_execute() {
    +                    map_perm |= MapPermission::X;
                     }
    -                let map_area = MapArea::new(start_va, end_va, MapType::Framed, map_perm);
    -                max_end_vpn = map_area.vpn_range.get_end();
    -                memory_set.push(
    -                    map_area,
    -                    Some(&elf.input[ph.offset() as usize..(ph.offset() + ph.file_size()) as usize]),
    +                let map_area = MapArea::new(start_va, end_va, MapType::Framed, map_perm);
    +                max_end_vpn = map_area.vpn_range.get_end();
    +                memory_set.push(
    +                    map_area,
    +                    Some(&elf.input[ph.offset() as usize..(ph.offset() + ph.file_size()) as usize]),
                     );
                 }
             }
    -        // map user stack with U flags
    -        let max_end_va: VirtAddr = max_end_vpn.into();
    -        let mut user_stack_bottom: usize = max_end_va.into();
    -        // guard page
    -        user_stack_bottom += PAGE_SIZE;
    -        let user_stack_top = user_stack_bottom + USER_STACK_SIZE;
    -        memory_set.push(
    -            MapArea::new(
    -                user_stack_bottom.into(),
    -                user_stack_top.into(),
    -                MapType::Framed,
    -                MapPermission::R | MapPermission::W | MapPermission::U,
    +        // map user stack with U flags
    +        let max_end_va: VirtAddr = max_end_vpn.into();
    +        let mut user_stack_bottom: usize = max_end_va.into();
    +        // guard page
    +        user_stack_bottom += PAGE_SIZE;
    +        let user_stack_top = user_stack_bottom + USER_STACK_SIZE;
    +        memory_set.push(
    +            MapArea::new(
    +                user_stack_bottom.into(),
    +                user_stack_top.into(),
    +                MapType::Framed,
    +                MapPermission::R | MapPermission::W | MapPermission::U,
                 ),
                 None,
             );
    -        // map TrapContext
    -        memory_set.push(
    -            MapArea::new(
    -                TRAP_CONTEXT.into(),
    -                TRAMPOLINE.into(),
    -                MapType::Framed,
    -                MapPermission::R | MapPermission::W,
    +        // map TrapContext
    +        memory_set.push(
    +            MapArea::new(
    +                TRAP_CONTEXT.into(),
    +                TRAMPOLINE.into(),
    +                MapType::Framed,
    +                MapPermission::R | MapPermission::W,
                 ),
                 None,
             );
             (
    -            memory_set,
    -            user_stack_top,
    -            elf.header.pt2.entry_point() as usize,
    +            memory_set,
    +            user_stack_top,
    +            elf.header.pt2.entry_point() as usize,
             )
         }
    -    ///Clone a same `MemorySet`
    -    pub fn from_existed_user(user_space: &MemorySet) -> MemorySet {
    -        let mut memory_set = Self::new_bare();
    -        // map trampoline
    -        memory_set.map_trampoline();
    -        // copy data sections/trap_context/user_stack
    -        for area in user_space.areas.iter() {
    -            let new_area = MapArea::from_another(area);
    -            memory_set.push(new_area, None);
    -            // copy data from another space
    -            for vpn in area.vpn_range {
    -                let src_ppn = user_space.translate(vpn).unwrap().ppn();
    -                let dst_ppn = memory_set.translate(vpn).unwrap().ppn();
    -                dst_ppn
    -                    .get_bytes_array()
    -                    .copy_from_slice(src_ppn.get_bytes_array());
    +    ///Clone a same `MemorySet`
    +    pub fn from_existed_user(user_space: &MemorySet) -> MemorySet {
    +        let mut memory_set = Self::new_bare();
    +        // map trampoline
    +        memory_set.map_trampoline();
    +        // copy data sections/trap_context/user_stack
    +        for area in user_space.areas.iter() {
    +            let new_area = MapArea::from_another(area);
    +            memory_set.push(new_area, None);
    +            // copy data from another space
    +            for vpn in area.vpn_range {
    +                let src_ppn = user_space.translate(vpn).unwrap().ppn();
    +                let dst_ppn = memory_set.translate(vpn).unwrap().ppn();
    +                dst_ppn
    +                    .get_bytes_array()
    +                    .copy_from_slice(src_ppn.get_bytes_array());
                 }
             }
    -        memory_set
    +        memory_set
         }
    -    ///Refresh TLB with `sfence.vma`
    -    pub fn activate(&self) {
    -        let satp = self.page_table.token();
    -        unsafe {
    -            satp::write(satp);
    +    ///Refresh TLB with `sfence.vma`
    +    pub fn activate(&self) {
    +        let satp = self.page_table.token();
    +        unsafe {
    +            satp::write(satp);
                 asm!("sfence.vma");
             }
         }
    -    ///Translate throuth pagetable
    -    pub fn translate(&self, vpn: VirtPageNum) -> Option<PageTableEntry> {
    -        self.page_table.translate(vpn)
    +    ///Translate throuth pagetable
    +    pub fn translate(&self, vpn: VirtPageNum) -> Option<PageTableEntry> {
    +        self.page_table.translate(vpn)
         }
    -    ///Remove all `MapArea`
    -    pub fn recycle_data_pages(&mut self) {
    -        //*self = Self::new_bare();
    -        self.areas.clear();
    +    ///Remove all `MapArea`
    +    pub fn recycle_data_pages(&mut self) {
    +        //*self = Self::new_bare();
    +        self.areas.clear();
         }
     }
    -/// map area structure, controls a contiguous piece of virtual memory
    -pub struct MapArea {
    -    vpn_range: VPNRange,
    -    data_frames: BTreeMap<VirtPageNum, FrameTracker>,
    -    map_type: MapType,
    -    map_perm: MapPermission,
    +/// map area structure, controls a contiguous piece of virtual memory
    +pub struct MapArea {
    +    vpn_range: VPNRange,
    +    data_frames: BTreeMap<VirtPageNum, FrameTracker>,
    +    map_type: MapType,
    +    map_perm: MapPermission,
     }
     
    -impl MapArea {
    -    pub fn new(
    -        start_va: VirtAddr,
    -        end_va: VirtAddr,
    -        map_type: MapType,
    -        map_perm: MapPermission,
    -    ) -> Self {
    -        let start_vpn: VirtPageNum = start_va.floor();
    -        let end_vpn: VirtPageNum = end_va.ceil();
    -        Self {
    -            vpn_range: VPNRange::new(start_vpn, end_vpn),
    -            data_frames: BTreeMap::new(),
    -            map_type,
    -            map_perm,
    +impl MapArea {
    +    pub fn new(
    +        start_va: VirtAddr,
    +        end_va: VirtAddr,
    +        map_type: MapType,
    +        map_perm: MapPermission,
    +    ) -> Self {
    +        let start_vpn: VirtPageNum = start_va.floor();
    +        let end_vpn: VirtPageNum = end_va.ceil();
    +        Self {
    +            vpn_range: VPNRange::new(start_vpn, end_vpn),
    +            data_frames: BTreeMap::new(),
    +            map_type,
    +            map_perm,
             }
         }
    -    pub fn from_another(another: &MapArea) -> Self {
    -        Self {
    -            vpn_range: VPNRange::new(another.vpn_range.get_start(), another.vpn_range.get_end()),
    -            data_frames: BTreeMap::new(),
    -            map_type: another.map_type,
    -            map_perm: another.map_perm,
    +    pub fn from_another(another: &MapArea) -> Self {
    +        Self {
    +            vpn_range: VPNRange::new(another.vpn_range.get_start(), another.vpn_range.get_end()),
    +            data_frames: BTreeMap::new(),
    +            map_type: another.map_type,
    +            map_perm: another.map_perm,
             }
         }
    -    pub fn map_one(&mut self, page_table: &mut PageTable, vpn: VirtPageNum) {
    -        let ppn: PhysPageNum;
    -        match self.map_type {
    -            MapType::Identical => {
    -                ppn = PhysPageNum(vpn.0);
    +    pub fn map_one(&mut self, page_table: &mut PageTable, vpn: VirtPageNum) {
    +        let ppn: PhysPageNum;
    +        match self.map_type {
    +            MapType::Identical => {
    +                ppn = PhysPageNum(vpn.0);
                 }
    -            MapType::Framed => {
    -                let frame = frame_alloc().unwrap();
    -                ppn = frame.ppn;
    -                self.data_frames.insert(vpn, frame);
    +            MapType::Framed => {
    +                let frame = frame_alloc().unwrap();
    +                ppn = frame.ppn;
    +                self.data_frames.insert(vpn, frame);
                 }
             }
    -        let pte_flags = PTEFlags::from_bits(self.map_perm.bits).unwrap();
    -        page_table.map(vpn, ppn, pte_flags);
    +        let pte_flags = PTEFlags::from_bits(self.map_perm.bits).unwrap();
    +        page_table.map(vpn, ppn, pte_flags);
         }
    -    pub fn unmap_one(&mut self, page_table: &mut PageTable, vpn: VirtPageNum) {
    -        if self.map_type == MapType::Framed {
    -            self.data_frames.remove(&vpn);
    +    pub fn unmap_one(&mut self, page_table: &mut PageTable, vpn: VirtPageNum) {
    +        if self.map_type == MapType::Framed {
    +            self.data_frames.remove(&vpn);
             }
    -        page_table.unmap(vpn);
    +        page_table.unmap(vpn);
         }
    -    pub fn map(&mut self, page_table: &mut PageTable) {
    -        for vpn in self.vpn_range {
    -            self.map_one(page_table, vpn);
    +    pub fn map(&mut self, page_table: &mut PageTable) {
    +        for vpn in self.vpn_range {
    +            self.map_one(page_table, vpn);
             }
         }
    -    pub fn unmap(&mut self, page_table: &mut PageTable) {
    -        for vpn in self.vpn_range {
    -            self.unmap_one(page_table, vpn);
    +    pub fn unmap(&mut self, page_table: &mut PageTable) {
    +        for vpn in self.vpn_range {
    +            self.unmap_one(page_table, vpn);
             }
         }
    -    /// data: start-aligned but maybe with shorter length
    -    /// assume that all frames were cleared before
    -    pub fn copy_data(&mut self, page_table: &mut PageTable, data: &[u8]) {
    -        assert_eq!(self.map_type, MapType::Framed);
    -        let mut start: usize = 0;
    -        let mut current_vpn = self.vpn_range.get_start();
    -        let len = data.len();
    -        loop {
    -            let src = &data[start..len.min(start + PAGE_SIZE)];
    -            let dst = &mut page_table
    -                .translate(current_vpn)
    -                .unwrap()
    -                .ppn()
    -                .get_bytes_array()[..src.len()];
    -            dst.copy_from_slice(src);
    -            start += PAGE_SIZE;
    -            if start >= len {
    +    /// data: start-aligned but maybe with shorter length
    +    /// assume that all frames were cleared before
    +    pub fn copy_data(&mut self, page_table: &mut PageTable, data: &[u8]) {
    +        assert_eq!(self.map_type, MapType::Framed);
    +        let mut start: usize = 0;
    +        let mut current_vpn = self.vpn_range.get_start();
    +        let len = data.len();
    +        loop {
    +            let src = &data[start..len.min(start + PAGE_SIZE)];
    +            let dst = &mut page_table
    +                .translate(current_vpn)
    +                .unwrap()
    +                .ppn()
    +                .get_bytes_array()[..src.len()];
    +            dst.copy_from_slice(src);
    +            start += PAGE_SIZE;
    +            if start >= len {
                     break;
                 }
    -            current_vpn.step();
    +            current_vpn.step();
             }
         }
     }
     
    -#[derive(Copy, Clone, PartialEq, Debug)]
    -/// map type for memory set: identical or framed
    -pub enum MapType {
    -    Identical,
    -    Framed,
    +#[derive(Copy, Clone, PartialEq, Debug)]
    +/// map type for memory set: identical or framed
    +pub enum MapType {
    +    Identical,
    +    Framed,
     }
     
    -bitflags! {
    -    /// map permission corresponding to that in pte: `R W X U`
    -    pub struct MapPermission: u8 {
    -        ///Readable
    -        const R = 1 << 1;
    -        ///Writable
    -        const W = 1 << 2;
    -        ///Excutable
    -        const X = 1 << 3;
    -        ///Accessible in U mode
    -        const U = 1 << 4;
    +bitflags! {
    +    /// map permission corresponding to that in pte: `R W X U`
    +    pub struct MapPermission: u8 {
    +        ///Readable
    +        const R = 1 << 1;
    +        ///Writable
    +        const W = 1 << 2;
    +        ///Excutable
    +        const X = 1 << 3;
    +        ///Accessible in U mode
    +        const U = 1 << 4;
         }
     }
     
    -#[allow(unused)]
    -///Check PageTable running correctly
    -pub fn remap_test() {
    -    let mut kernel_space = KERNEL_SPACE.exclusive_access();
    -    let mid_text: VirtAddr = ((stext as usize + etext as usize) / 2).into();
    -    let mid_rodata: VirtAddr = ((srodata as usize + erodata as usize) / 2).into();
    -    let mid_data: VirtAddr = ((sdata as usize + edata as usize) / 2).into();
    -    assert!(!kernel_space
    -        .page_table
    -        .translate(mid_text.floor())
    -        .unwrap()
    -        .writable(),);
    -    assert!(!kernel_space
    -        .page_table
    -        .translate(mid_rodata.floor())
    -        .unwrap()
    -        .writable(),);
    -    assert!(!kernel_space
    -        .page_table
    -        .translate(mid_data.floor())
    -        .unwrap()
    -        .executable(),);
    +#[allow(unused)]
    +///Check PageTable running correctly
    +pub fn remap_test() {
    +    let mut kernel_space = KERNEL_SPACE.exclusive_access();
    +    let mid_text: VirtAddr = ((stext as usize + etext as usize) / 2).into();
    +    let mid_rodata: VirtAddr = ((srodata as usize + erodata as usize) / 2).into();
    +    let mid_data: VirtAddr = ((sdata as usize + edata as usize) / 2).into();
    +    assert!(!kernel_space
    +        .page_table
    +        .translate(mid_text.floor())
    +        .unwrap()
    +        .writable(),);
    +    assert!(!kernel_space
    +        .page_table
    +        .translate(mid_rodata.floor())
    +        .unwrap()
    +        .writable(),);
    +    assert!(!kernel_space
    +        .page_table
    +        .translate(mid_data.floor())
    +        .unwrap()
    +        .executable(),);
         println!("remap_test passed!");
     }
    -
    -
    - \ No newline at end of file + \ No newline at end of file diff --git a/ch6-dev/src/os/mm/mod.rs.html b/ch6-dev/src/os/mm/mod.rs.html index 830fc941..aea3529f 100644 --- a/ch6-dev/src/os/mm/mod.rs.html +++ b/ch6-dev/src/os/mm/mod.rs.html @@ -1,66 +1,59 @@ -mod.rs - source - -
    1
    -2
    -3
    -4
    -5
    -6
    -7
    -8
    -9
    -10
    -11
    -12
    -13
    -14
    -15
    -16
    -17
    -18
    -19
    -20
    -21
    -22
    -23
    -24
    -25
    -26
    -27
    -28
    -29
    -
    //! Memory management implementation
    -//!
    -//! SV39 page-based virtual-memory architecture for RV64 systems, and
    -//! everything about memory management, like frame allocator, page table,
    -//! map area and memory set, is implemented here.
    -//!
    -//! Every task or process has a memory_set to control its virtual memory.
    -mod address;
    -mod frame_allocator;
    -mod heap_allocator;
    -mod memory_set;
    -mod page_table;
    +mod.rs - source
    1
    +2
    +3
    +4
    +5
    +6
    +7
    +8
    +9
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +
    //! Memory management implementation
    +//!
    +//! SV39 page-based virtual-memory architecture for RV64 systems, and
    +//! everything about memory management, like frame allocator, page table,
    +//! map area and memory set, is implemented here.
    +//!
    +//! Every task or process has a memory_set to control its virtual memory.
    +mod address;
    +mod frame_allocator;
    +mod heap_allocator;
    +mod memory_set;
    +mod page_table;
     
    -use address::VPNRange;
    -pub use address::{PhysAddr, PhysPageNum, StepByOne, VirtAddr, VirtPageNum};
    -pub use frame_allocator::{frame_alloc, frame_dealloc, FrameTracker};
    -pub use memory_set::remap_test;
    -pub use memory_set::{kernel_token, MapPermission, MemorySet, KERNEL_SPACE};
    -use page_table::PTEFlags;
    -pub use page_table::{
    -    translated_byte_buffer, translated_ref, translated_refmut, translated_str, PageTable,
    -    PageTableEntry, UserBuffer, UserBufferIterator,
    +use address::VPNRange;
    +pub use address::{PhysAddr, PhysPageNum, StepByOne, VirtAddr, VirtPageNum};
    +pub use frame_allocator::{frame_alloc, frame_dealloc, FrameTracker};
    +pub use memory_set::remap_test;
    +pub use memory_set::{kernel_token, MapPermission, MemorySet, KERNEL_SPACE};
    +use page_table::PTEFlags;
    +pub use page_table::{
    +    translated_byte_buffer, translated_ref, translated_refmut, translated_str, PageTable,
    +    PageTableEntry, UserBuffer, UserBufferIterator,
     };
    -/// initiate heap allocator, frame allocator and kernel space
    -pub fn init() {
    -    heap_allocator::init_heap();
    -    frame_allocator::init_frame_allocator();
    -    KERNEL_SPACE.exclusive_access().activate();
    +/// initiate heap allocator, frame allocator and kernel space
    +pub fn init() {
    +    heap_allocator::init_heap();
    +    frame_allocator::init_frame_allocator();
    +    KERNEL_SPACE.exclusive_access().activate();
     }
    -
    -
    - \ No newline at end of file + \ No newline at end of file diff --git a/ch6-dev/src/os/mm/page_table.rs.html b/ch6-dev/src/os/mm/page_table.rs.html index ce64c2e6..77c1ab7f 100644 --- a/ch6-dev/src/os/mm/page_table.rs.html +++ b/ch6-dev/src/os/mm/page_table.rs.html @@ -1,554 +1,547 @@ -page_table.rs - source - -
    1
    -2
    -3
    -4
    -5
    -6
    -7
    -8
    -9
    -10
    -11
    -12
    -13
    -14
    -15
    -16
    -17
    -18
    -19
    -20
    -21
    -22
    -23
    -24
    -25
    -26
    -27
    -28
    -29
    -30
    -31
    -32
    -33
    -34
    -35
    -36
    -37
    -38
    -39
    -40
    -41
    -42
    -43
    -44
    -45
    -46
    -47
    -48
    -49
    -50
    -51
    -52
    -53
    -54
    -55
    -56
    -57
    -58
    -59
    -60
    -61
    -62
    -63
    -64
    -65
    -66
    -67
    -68
    -69
    -70
    -71
    -72
    -73
    -74
    -75
    -76
    -77
    -78
    -79
    -80
    -81
    -82
    -83
    -84
    -85
    -86
    -87
    -88
    -89
    -90
    -91
    -92
    -93
    -94
    -95
    -96
    -97
    -98
    -99
    -100
    -101
    -102
    -103
    -104
    -105
    -106
    -107
    -108
    -109
    -110
    -111
    -112
    -113
    -114
    -115
    -116
    -117
    -118
    -119
    -120
    -121
    -122
    -123
    -124
    -125
    -126
    -127
    -128
    -129
    -130
    -131
    -132
    -133
    -134
    -135
    -136
    -137
    -138
    -139
    -140
    -141
    -142
    -143
    -144
    -145
    -146
    -147
    -148
    -149
    -150
    -151
    -152
    -153
    -154
    -155
    -156
    -157
    -158
    -159
    -160
    -161
    -162
    -163
    -164
    -165
    -166
    -167
    -168
    -169
    -170
    -171
    -172
    -173
    -174
    -175
    -176
    -177
    -178
    -179
    -180
    -181
    -182
    -183
    -184
    -185
    -186
    -187
    -188
    -189
    -190
    -191
    -192
    -193
    -194
    -195
    -196
    -197
    -198
    -199
    -200
    -201
    -202
    -203
    -204
    -205
    -206
    -207
    -208
    -209
    -210
    -211
    -212
    -213
    -214
    -215
    -216
    -217
    -218
    -219
    -220
    -221
    -222
    -223
    -224
    -225
    -226
    -227
    -228
    -229
    -230
    -231
    -232
    -233
    -234
    -235
    -236
    -237
    -238
    -239
    -240
    -241
    -242
    -243
    -244
    -245
    -246
    -247
    -248
    -249
    -250
    -251
    -252
    -253
    -254
    -255
    -256
    -257
    -258
    -259
    -260
    -261
    -262
    -263
    -264
    -265
    -266
    -267
    -268
    -269
    -270
    -271
    -272
    -273
    -
    //! Implementation of [`PageTableEntry`] and [`PageTable`].
    -use super::{frame_alloc, FrameTracker, PhysAddr, PhysPageNum, StepByOne, VirtAddr, VirtPageNum};
    -use alloc::string::String;
    -use alloc::vec;
    -use alloc::vec::Vec;
    -use bitflags::*;
    +page_table.rs - source
    1
    +2
    +3
    +4
    +5
    +6
    +7
    +8
    +9
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    +47
    +48
    +49
    +50
    +51
    +52
    +53
    +54
    +55
    +56
    +57
    +58
    +59
    +60
    +61
    +62
    +63
    +64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    +79
    +80
    +81
    +82
    +83
    +84
    +85
    +86
    +87
    +88
    +89
    +90
    +91
    +92
    +93
    +94
    +95
    +96
    +97
    +98
    +99
    +100
    +101
    +102
    +103
    +104
    +105
    +106
    +107
    +108
    +109
    +110
    +111
    +112
    +113
    +114
    +115
    +116
    +117
    +118
    +119
    +120
    +121
    +122
    +123
    +124
    +125
    +126
    +127
    +128
    +129
    +130
    +131
    +132
    +133
    +134
    +135
    +136
    +137
    +138
    +139
    +140
    +141
    +142
    +143
    +144
    +145
    +146
    +147
    +148
    +149
    +150
    +151
    +152
    +153
    +154
    +155
    +156
    +157
    +158
    +159
    +160
    +161
    +162
    +163
    +164
    +165
    +166
    +167
    +168
    +169
    +170
    +171
    +172
    +173
    +174
    +175
    +176
    +177
    +178
    +179
    +180
    +181
    +182
    +183
    +184
    +185
    +186
    +187
    +188
    +189
    +190
    +191
    +192
    +193
    +194
    +195
    +196
    +197
    +198
    +199
    +200
    +201
    +202
    +203
    +204
    +205
    +206
    +207
    +208
    +209
    +210
    +211
    +212
    +213
    +214
    +215
    +216
    +217
    +218
    +219
    +220
    +221
    +222
    +223
    +224
    +225
    +226
    +227
    +228
    +229
    +230
    +231
    +232
    +233
    +234
    +235
    +236
    +237
    +238
    +239
    +240
    +241
    +242
    +243
    +244
    +245
    +246
    +247
    +248
    +249
    +250
    +251
    +252
    +253
    +254
    +255
    +256
    +257
    +258
    +259
    +260
    +261
    +262
    +263
    +264
    +265
    +266
    +267
    +268
    +269
    +270
    +271
    +272
    +273
    +
    //! Implementation of [`PageTableEntry`] and [`PageTable`].
    +use super::{frame_alloc, FrameTracker, PhysAddr, PhysPageNum, StepByOne, VirtAddr, VirtPageNum};
    +use alloc::string::String;
    +use alloc::vec;
    +use alloc::vec::Vec;
    +use bitflags::*;
     
    -bitflags! {
    -    pub struct PTEFlags: u8 {
    -        const V = 1 << 0;
    -        const R = 1 << 1;
    -        const W = 1 << 2;
    -        const X = 1 << 3;
    -        const U = 1 << 4;
    -        const G = 1 << 5;
    -        const A = 1 << 6;
    -        const D = 1 << 7;
    +bitflags! {
    +    pub struct PTEFlags: u8 {
    +        const V = 1 << 0;
    +        const R = 1 << 1;
    +        const W = 1 << 2;
    +        const X = 1 << 3;
    +        const U = 1 << 4;
    +        const G = 1 << 5;
    +        const A = 1 << 6;
    +        const D = 1 << 7;
         }
     }
     
    -#[derive(Copy, Clone)]
    -#[repr(C)]
    -/// page table entry structure
    -pub struct PageTableEntry {
    -    ///PTE
    -    pub bits: usize,
    +#[derive(Copy, Clone)]
    +#[repr(C)]
    +/// page table entry structure
    +pub struct PageTableEntry {
    +    ///PTE
    +    pub bits: usize,
     }
     
    -impl PageTableEntry {
    -    ///Create a PTE from ppn
    -    pub fn new(ppn: PhysPageNum, flags: PTEFlags) -> Self {
    -        PageTableEntry {
    -            bits: ppn.0 << 10 | flags.bits as usize,
    +impl PageTableEntry {
    +    ///Create a PTE from ppn
    +    pub fn new(ppn: PhysPageNum, flags: PTEFlags) -> Self {
    +        PageTableEntry {
    +            bits: ppn.0 << 10 | flags.bits as usize,
             }
         }
    -    ///Return an empty PTE
    -    pub fn empty() -> Self {
    -        PageTableEntry { bits: 0 }
    +    ///Return an empty PTE
    +    pub fn empty() -> Self {
    +        PageTableEntry { bits: 0 }
         }
    -    ///Return 44bit ppn
    -    pub fn ppn(&self) -> PhysPageNum {
    -        (self.bits >> 10 & ((1usize << 44) - 1)).into()
    +    ///Return 44bit ppn
    +    pub fn ppn(&self) -> PhysPageNum {
    +        (self.bits >> 10 & ((1usize << 44) - 1)).into()
         }
    -    ///Return 10bit flag
    -    pub fn flags(&self) -> PTEFlags {
    -        PTEFlags::from_bits(self.bits as u8).unwrap()
    +    ///Return 10bit flag
    +    pub fn flags(&self) -> PTEFlags {
    +        PTEFlags::from_bits(self.bits as u8).unwrap()
         }
    -    ///Check PTE valid
    -    pub fn is_valid(&self) -> bool {
    -        (self.flags() & PTEFlags::V) != PTEFlags::empty()
    +    ///Check PTE valid
    +    pub fn is_valid(&self) -> bool {
    +        (self.flags() & PTEFlags::V) != PTEFlags::empty()
         }
    -    ///Check PTE readable
    -    pub fn readable(&self) -> bool {
    -        (self.flags() & PTEFlags::R) != PTEFlags::empty()
    +    ///Check PTE readable
    +    pub fn readable(&self) -> bool {
    +        (self.flags() & PTEFlags::R) != PTEFlags::empty()
         }
    -    ///Check PTE writable
    -    pub fn writable(&self) -> bool {
    -        (self.flags() & PTEFlags::W) != PTEFlags::empty()
    +    ///Check PTE writable
    +    pub fn writable(&self) -> bool {
    +        (self.flags() & PTEFlags::W) != PTEFlags::empty()
         }
    -    ///Check PTE executable
    -    pub fn executable(&self) -> bool {
    -        (self.flags() & PTEFlags::X) != PTEFlags::empty()
    +    ///Check PTE executable
    +    pub fn executable(&self) -> bool {
    +        (self.flags() & PTEFlags::X) != PTEFlags::empty()
         }
     }
    -///Record root ppn and has the same lifetime as 1 and 2 level `PageTableEntry`
    -pub struct PageTable {
    -    root_ppn: PhysPageNum,
    -    frames: Vec<FrameTracker>,
    +///Record root ppn and has the same lifetime as 1 and 2 level `PageTableEntry`
    +pub struct PageTable {
    +    root_ppn: PhysPageNum,
    +    frames: Vec<FrameTracker>,
     }
     
    -/// Assume that it won't oom when creating/mapping.
    -impl PageTable {
    -    /// Create an empty `PageTable`
    -    pub fn new() -> Self {
    -        let frame = frame_alloc().unwrap();
    -        PageTable {
    -            root_ppn: frame.ppn,
    -            frames: vec![frame],
    +/// Assume that it won't oom when creating/mapping.
    +impl PageTable {
    +    /// Create an empty `PageTable`
    +    pub fn new() -> Self {
    +        let frame = frame_alloc().unwrap();
    +        PageTable {
    +            root_ppn: frame.ppn,
    +            frames: vec![frame],
             }
         }
    -    /// Temporarily used to get arguments from user space.
    -    pub fn from_token(satp: usize) -> Self {
    -        Self {
    -            root_ppn: PhysPageNum::from(satp & ((1usize << 44) - 1)),
    -            frames: Vec::new(),
    +    /// Temporarily used to get arguments from user space.
    +    pub fn from_token(satp: usize) -> Self {
    +        Self {
    +            root_ppn: PhysPageNum::from(satp & ((1usize << 44) - 1)),
    +            frames: Vec::new(),
             }
         }
    -    /// Find phsical address by virtual address, create a frame if not exist
    -    fn find_pte_create(&mut self, vpn: VirtPageNum) -> Option<&mut PageTableEntry> {
    -        let idxs = vpn.indexes();
    -        let mut ppn = self.root_ppn;
    -        let mut result: Option<&mut PageTableEntry> = None;
    -        for (i, idx) in idxs.iter().enumerate() {
    -            let pte = &mut ppn.get_pte_array()[*idx];
    -            if i == 2 {
    -                result = Some(pte);
    +    /// Find phsical address by virtual address, create a frame if not exist
    +    fn find_pte_create(&mut self, vpn: VirtPageNum) -> Option<&mut PageTableEntry> {
    +        let idxs = vpn.indexes();
    +        let mut ppn = self.root_ppn;
    +        let mut result: Option<&mut PageTableEntry> = None;
    +        for (i, idx) in idxs.iter().enumerate() {
    +            let pte = &mut ppn.get_pte_array()[*idx];
    +            if i == 2 {
    +                result = Some(pte);
                     break;
                 }
    -            if !pte.is_valid() {
    -                let frame = frame_alloc().unwrap();
    -                *pte = PageTableEntry::new(frame.ppn, PTEFlags::V);
    -                self.frames.push(frame);
    +            if !pte.is_valid() {
    +                let frame = frame_alloc().unwrap();
    +                *pte = PageTableEntry::new(frame.ppn, PTEFlags::V);
    +                self.frames.push(frame);
                 }
    -            ppn = pte.ppn();
    +            ppn = pte.ppn();
             }
    -        result
    +        result
         }
    -    /// Find phsical address by virtual address
    -    fn find_pte(&self, vpn: VirtPageNum) -> Option<&mut PageTableEntry> {
    -        let idxs = vpn.indexes();
    -        let mut ppn = self.root_ppn;
    -        let mut result: Option<&mut PageTableEntry> = None;
    -        for (i, idx) in idxs.iter().enumerate() {
    -            let pte = &mut ppn.get_pte_array()[*idx];
    -            if i == 2 {
    -                result = Some(pte);
    +    /// Find phsical address by virtual address
    +    fn find_pte(&self, vpn: VirtPageNum) -> Option<&mut PageTableEntry> {
    +        let idxs = vpn.indexes();
    +        let mut ppn = self.root_ppn;
    +        let mut result: Option<&mut PageTableEntry> = None;
    +        for (i, idx) in idxs.iter().enumerate() {
    +            let pte = &mut ppn.get_pte_array()[*idx];
    +            if i == 2 {
    +                result = Some(pte);
                     break;
                 }
    -            if !pte.is_valid() {
    -                return None;
    +            if !pte.is_valid() {
    +                return None;
                 }
    -            ppn = pte.ppn();
    +            ppn = pte.ppn();
             }
    -        result
    +        result
         }
    -    #[allow(unused)]
    -    /// Create a mapping form `vpn` to `ppn`
    -    pub fn map(&mut self, vpn: VirtPageNum, ppn: PhysPageNum, flags: PTEFlags) {
    -        let pte = self.find_pte_create(vpn).unwrap();
    -        assert!(!pte.is_valid(), "vpn {:?} is mapped before mapping", vpn);
    -        *pte = PageTableEntry::new(ppn, flags | PTEFlags::V);
    +    #[allow(unused)]
    +    /// Create a mapping form `vpn` to `ppn`
    +    pub fn map(&mut self, vpn: VirtPageNum, ppn: PhysPageNum, flags: PTEFlags) {
    +        let pte = self.find_pte_create(vpn).unwrap();
    +        assert!(!pte.is_valid(), "vpn {:?} is mapped before mapping", vpn);
    +        *pte = PageTableEntry::new(ppn, flags | PTEFlags::V);
         }
    -    #[allow(unused)]
    -    /// Delete a mapping form `vpn`
    -    pub fn unmap(&mut self, vpn: VirtPageNum) {
    -        let pte = self.find_pte(vpn).unwrap();
    -        assert!(pte.is_valid(), "vpn {:?} is invalid before unmapping", vpn);
    -        *pte = PageTableEntry::empty();
    +    #[allow(unused)]
    +    /// Delete a mapping form `vpn`
    +    pub fn unmap(&mut self, vpn: VirtPageNum) {
    +        let pte = self.find_pte(vpn).unwrap();
    +        assert!(pte.is_valid(), "vpn {:?} is invalid before unmapping", vpn);
    +        *pte = PageTableEntry::empty();
         }
    -    /// Translate `VirtPageNum` to `PageTableEntry`
    -    pub fn translate(&self, vpn: VirtPageNum) -> Option<PageTableEntry> {
    -        self.find_pte(vpn).map(|pte| *pte)
    +    /// Translate `VirtPageNum` to `PageTableEntry`
    +    pub fn translate(&self, vpn: VirtPageNum) -> Option<PageTableEntry> {
    +        self.find_pte(vpn).map(|pte| *pte)
         }
    -    /// Translate `VirtAddr` to `PhysAddr`
    -    pub fn translate_va(&self, va: VirtAddr) -> Option<PhysAddr> {
    -        self.find_pte(va.clone().floor()).map(|pte| {
    -            let aligned_pa: PhysAddr = pte.ppn().into();
    -            let offset = va.page_offset();
    -            let aligned_pa_usize: usize = aligned_pa.into();
    -            (aligned_pa_usize + offset).into()
    +    /// Translate `VirtAddr` to `PhysAddr`
    +    pub fn translate_va(&self, va: VirtAddr) -> Option<PhysAddr> {
    +        self.find_pte(va.clone().floor()).map(|pte| {
    +            let aligned_pa: PhysAddr = pte.ppn().into();
    +            let offset = va.page_offset();
    +            let aligned_pa_usize: usize = aligned_pa.into();
    +            (aligned_pa_usize + offset).into()
             })
         }
    -    /// Get root ppn
    -    pub fn token(&self) -> usize {
    -        8usize << 60 | self.root_ppn.0
    -    }
    +    /// Get root ppn
    +    pub fn token(&self) -> usize {
    +        8usize << 60 | self.root_ppn.0
    +    }
     }
    -/// Translate a pointer to a mutable u8 Vec through page table
    -pub fn translated_byte_buffer(token: usize, ptr: *const u8, len: usize) -> Vec<&'static mut [u8]> {
    -    let page_table = PageTable::from_token(token);
    -    let mut start = ptr as usize;
    -    let end = start + len;
    -    let mut v = Vec::new();
    -    while start < end {
    -        let start_va = VirtAddr::from(start);
    -        let mut vpn = start_va.floor();
    -        let ppn = page_table.translate(vpn).unwrap().ppn();
    -        vpn.step();
    -        let mut end_va: VirtAddr = vpn.into();
    -        end_va = end_va.min(VirtAddr::from(end));
    -        if end_va.page_offset() == 0 {
    -            v.push(&mut ppn.get_bytes_array()[start_va.page_offset()..]);
    -        } else {
    -            v.push(&mut ppn.get_bytes_array()[start_va.page_offset()..end_va.page_offset()]);
    +/// Translate a pointer to a mutable u8 Vec through page table
    +pub fn translated_byte_buffer(token: usize, ptr: *const u8, len: usize) -> Vec<&'static mut [u8]> {
    +    let page_table = PageTable::from_token(token);
    +    let mut start = ptr as usize;
    +    let end = start + len;
    +    let mut v = Vec::new();
    +    while start < end {
    +        let start_va = VirtAddr::from(start);
    +        let mut vpn = start_va.floor();
    +        let ppn = page_table.translate(vpn).unwrap().ppn();
    +        vpn.step();
    +        let mut end_va: VirtAddr = vpn.into();
    +        end_va = end_va.min(VirtAddr::from(end));
    +        if end_va.page_offset() == 0 {
    +            v.push(&mut ppn.get_bytes_array()[start_va.page_offset()..]);
    +        } else {
    +            v.push(&mut ppn.get_bytes_array()[start_va.page_offset()..end_va.page_offset()]);
             }
    -        start = end_va.into();
    +        start = end_va.into();
         }
    -    v
    +    v
     }
     
    -/// Translate a pointer to a mutable u8 Vec end with `\0` through page table to a `String`
    -pub fn translated_str(token: usize, ptr: *const u8) -> String {
    -    let page_table = PageTable::from_token(token);
    -    let mut string = String::new();
    -    let mut va = ptr as usize;
    -    loop {
    -        let ch: u8 = *(page_table
    -            .translate_va(VirtAddr::from(va))
    -            .unwrap()
    -            .get_mut());
    -        if ch == 0 {
    +/// Translate a pointer to a mutable u8 Vec end with `\0` through page table to a `String`
    +pub fn translated_str(token: usize, ptr: *const u8) -> String {
    +    let page_table = PageTable::from_token(token);
    +    let mut string = String::new();
    +    let mut va = ptr as usize;
    +    loop {
    +        let ch: u8 = *(page_table
    +            .translate_va(VirtAddr::from(va))
    +            .unwrap()
    +            .get_mut());
    +        if ch == 0 {
                 break;
             }
    -        string.push(ch as char);
    -        va += 1;
    +        string.push(ch as char);
    +        va += 1;
         }
    -    string
    +    string
     }
     
    -#[allow(unused)]
    -///Translate a generic through page table and return a reference
    -pub fn translated_ref<T>(token: usize, ptr: *const T) -> &'static T {
    -    let page_table = PageTable::from_token(token);
    -    page_table
    -        .translate_va(VirtAddr::from(ptr as usize))
    -        .unwrap()
    -        .get_ref()
    +#[allow(unused)]
    +///Translate a generic through page table and return a reference
    +pub fn translated_ref<T>(token: usize, ptr: *const T) -> &'static T {
    +    let page_table = PageTable::from_token(token);
    +    page_table
    +        .translate_va(VirtAddr::from(ptr as usize))
    +        .unwrap()
    +        .get_ref()
     }
    -///Translate a generic through page table and return a mutable reference
    -pub fn translated_refmut<T>(token: usize, ptr: *mut T) -> &'static mut T {
    -    let page_table = PageTable::from_token(token);
    -    let va = ptr as usize;
    -    page_table
    -        .translate_va(VirtAddr::from(va))
    -        .unwrap()
    -        .get_mut()
    +///Translate a generic through page table and return a mutable reference
    +pub fn translated_refmut<T>(token: usize, ptr: *mut T) -> &'static mut T {
    +    let page_table = PageTable::from_token(token);
    +    let va = ptr as usize;
    +    page_table
    +        .translate_va(VirtAddr::from(va))
    +        .unwrap()
    +        .get_mut()
     }
    -///Array of u8 slice that user communicate with os
    -pub struct UserBuffer {
    -    ///U8 vec
    -    pub buffers: Vec<&'static mut [u8]>,
    +///Array of u8 slice that user communicate with os
    +pub struct UserBuffer {
    +    ///U8 vec
    +    pub buffers: Vec<&'static mut [u8]>,
     }
     
    -impl UserBuffer {
    -    ///Create a `UserBuffer` by parameter
    -    pub fn new(buffers: Vec<&'static mut [u8]>) -> Self {
    -        Self { buffers }
    +impl UserBuffer {
    +    ///Create a `UserBuffer` by parameter
    +    pub fn new(buffers: Vec<&'static mut [u8]>) -> Self {
    +        Self { buffers }
         }
    -    ///Length of `UserBuffer`
    -    pub fn len(&self) -> usize {
    -        let mut total: usize = 0;
    -        for b in self.buffers.iter() {
    -            total += b.len();
    +    ///Length of `UserBuffer`
    +    pub fn len(&self) -> usize {
    +        let mut total: usize = 0;
    +        for b in self.buffers.iter() {
    +            total += b.len();
             }
    -        total
    +        total
         }
     }
     
    -impl IntoIterator for UserBuffer {
    -    type Item = *mut u8;
    -    type IntoIter = UserBufferIterator;
    -    fn into_iter(self) -> Self::IntoIter {
    -        UserBufferIterator {
    -            buffers: self.buffers,
    -            current_buffer: 0,
    -            current_idx: 0,
    +impl IntoIterator for UserBuffer {
    +    type Item = *mut u8;
    +    type IntoIter = UserBufferIterator;
    +    fn into_iter(self) -> Self::IntoIter {
    +        UserBufferIterator {
    +            buffers: self.buffers,
    +            current_buffer: 0,
    +            current_idx: 0,
             }
         }
     }
    -/// Iterator of `UserBuffer`
    -pub struct UserBufferIterator {
    -    buffers: Vec<&'static mut [u8]>,
    -    current_buffer: usize,
    -    current_idx: usize,
    +/// Iterator of `UserBuffer`
    +pub struct UserBufferIterator {
    +    buffers: Vec<&'static mut [u8]>,
    +    current_buffer: usize,
    +    current_idx: usize,
     }
     
    -impl Iterator for UserBufferIterator {
    -    type Item = *mut u8;
    -    fn next(&mut self) -> Option<Self::Item> {
    -        if self.current_buffer >= self.buffers.len() {
    -            None
    -        } else {
    -            let r = &mut self.buffers[self.current_buffer][self.current_idx] as *mut _;
    -            if self.current_idx + 1 == self.buffers[self.current_buffer].len() {
    -                self.current_idx = 0;
    -                self.current_buffer += 1;
    -            } else {
    -                self.current_idx += 1;
    +impl Iterator for UserBufferIterator {
    +    type Item = *mut u8;
    +    fn next(&mut self) -> Option<Self::Item> {
    +        if self.current_buffer >= self.buffers.len() {
    +            None
    +        } else {
    +            let r = &mut self.buffers[self.current_buffer][self.current_idx] as *mut _;
    +            if self.current_idx + 1 == self.buffers[self.current_buffer].len() {
    +                self.current_idx = 0;
    +                self.current_buffer += 1;
    +            } else {
    +                self.current_idx += 1;
                 }
    -            Some(r)
    +            Some(r)
             }
         }
     }
    -
    -
    - \ No newline at end of file + \ No newline at end of file diff --git a/ch6-dev/src/os/sbi.rs.html b/ch6-dev/src/os/sbi.rs.html index bd95b413..ca251be2 100644 --- a/ch6-dev/src/os/sbi.rs.html +++ b/ch6-dev/src/os/sbi.rs.html @@ -1,102 +1,61 @@ -sbi.rs - source - -
    1
    -2
    -3
    -4
    -5
    -6
    -7
    -8
    -9
    -10
    -11
    -12
    -13
    -14
    -15
    -16
    -17
    -18
    -19
    -20
    -21
    -22
    -23
    -24
    -25
    -26
    -27
    -28
    -29
    -30
    -31
    -32
    -33
    -34
    -35
    -36
    -37
    -38
    -39
    -40
    -41
    -42
    -43
    -44
    -45
    -46
    -47
    -
    //! SBI call wrappers
    -#![allow(unused)]
    +sbi.rs - source
    1
    +2
    +3
    +4
    +5
    +6
    +7
    +8
    +9
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +
    //! SBI call wrappers
    +#![allow(unused)]
     
    -use core::arch::asm;
    +/// use sbi call to putchar in console (qemu uart handler)
    +pub fn console_putchar(c: usize) {
    +    #[allow(deprecated)]
    +    sbi_rt::legacy::console_putchar(c);
    +}
     
    -const SBI_SET_TIMER: usize = 0;
    -const SBI_CONSOLE_PUTCHAR: usize = 1;
    -const SBI_CONSOLE_GETCHAR: usize = 2;
    -const SBI_CLEAR_IPI: usize = 3;
    -const SBI_SEND_IPI: usize = 4;
    -const SBI_REMOTE_FENCE_I: usize = 5;
    -const SBI_REMOTE_SFENCE_VMA: usize = 6;
    -const SBI_REMOTE_SFENCE_VMA_ASID: usize = 7;
    -const SBI_SHUTDOWN: usize = 8;
    -/// general sbi call
    -#[inline(always)]
    -fn sbi_call(which: usize, arg0: usize, arg1: usize, arg2: usize) -> usize {
    -    let mut ret;
    -    unsafe {
    -        asm!(
    -            "li x16, 0",
    -            "ecall",
    -            inlateout("x10") arg0 => ret,
    -            in("x11") arg1,
    -            in("x12") arg2,
    -            in("x17") which,
    -        );
    +/// use sbi call to getchar from console (qemu uart handler)
    +pub fn console_getchar() -> usize {
    +    #[allow(deprecated)]
    +    sbi_rt::legacy::console_getchar()
    +}
    +
    +/// use sbi call to set timer
    +pub fn set_timer(timer: usize) {
    +    sbi_rt::set_timer(timer as _);
    +}
    +
    +/// use sbi call to shutdown the kernel
    +pub fn shutdown(failure: bool) -> ! {
    +    use sbi_rt::{system_reset, NoReason, Shutdown, SystemFailure};
    +    if !failure {
    +        system_reset(Shutdown, NoReason);
    +    } else {
    +        system_reset(Shutdown, SystemFailure);
         }
    -    ret
    +    unreachable!()
     }
    -/// use sbi call to set timer
    -pub fn set_timer(timer: usize) {
    -    sbi_call(SBI_SET_TIMER, timer, 0, 0);
    -}
    -/// use sbi call to putchar in console (qemu uart handler)
    -pub fn console_putchar(c: usize) {
    -    sbi_call(SBI_CONSOLE_PUTCHAR, c, 0, 0);
    -}
    -/// use sbi call to getchar from console (qemu uart handler)
    -pub fn console_getchar() -> usize {
    -    sbi_call(SBI_CONSOLE_GETCHAR, 0, 0, 0)
    -}
    -/// use sbi call to shutdown the kernel
    -pub fn shutdown() -> ! {
    -    sbi_call(SBI_SHUTDOWN, 0, 0, 0);
    -    panic!("It should shutdown!");
    -}
    -
    -
    - \ No newline at end of file + \ No newline at end of file diff --git a/ch6-dev/src/os/sync/mod.rs.html b/ch6-dev/src/os/sync/mod.rs.html index ddac4110..65cc1f4a 100644 --- a/ch6-dev/src/os/sync/mod.rs.html +++ b/ch6-dev/src/os/sync/mod.rs.html @@ -1,16 +1,9 @@ -mod.rs - source - -
    1
    -2
    -3
    -4
    -
    //! Synchronization and interior mutability primitives
    -mod up;
    +mod.rs - source
    1
    +2
    +3
    +4
    +
    //! Synchronization and interior mutability primitives
    +mod up;
     
    -pub use up::UPSafeCell;
    -
    -
    - \ No newline at end of file +pub use up::{RawExclusiveLock, UPSafeCell}; + \ No newline at end of file diff --git a/ch6-dev/src/os/sync/up.rs.html b/ch6-dev/src/os/sync/up.rs.html index ebbd89d3..60f88e72 100644 --- a/ch6-dev/src/os/sync/up.rs.html +++ b/ch6-dev/src/os/sync/up.rs.html @@ -1,68 +1,103 @@ -up.rs - source - -
    1
    -2
    -3
    -4
    -5
    -6
    -7
    -8
    -9
    -10
    -11
    -12
    -13
    -14
    -15
    -16
    -17
    -18
    -19
    -20
    -21
    -22
    -23
    -24
    -25
    -26
    -27
    -28
    -29
    -30
    -
    //! Uniprocessor interior mutability primitives
    -use core::cell::{RefCell, RefMut};
    +up.rs - source
    1
    +2
    +3
    +4
    +5
    +6
    +7
    +8
    +9
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    +47
    +48
    +49
    +50
    +51
    +
    //! Uniprocessor interior mutability primitives
    +use core::cell::{RefCell, RefMut};
    +use core::sync::atomic::{AtomicBool, Ordering};
     
    -/// Wrap a static data structure inside it so that we are
    -/// able to access it without any `unsafe`.
    -///
    -/// We should only use it in uniprocessor.
    -///
    -/// In order to get mutable reference of inner data, call
    -/// `exclusive_access`.
    -pub struct UPSafeCell<T> {
    -    /// inner data
    -    inner: RefCell<T>,
    +/// Wrap a static data structure inside it so that we are
    +/// able to access it without any `unsafe`.
    +///
    +/// We should only use it in uniprocessor.
    +///
    +/// In order to get mutable reference of inner data, call
    +/// `exclusive_access`.
    +pub struct UPSafeCell<T> {
    +    /// inner data
    +    inner: RefCell<T>,
     }
     
    -unsafe impl<T> Sync for UPSafeCell<T> {}
    +unsafe impl<T> Sync for UPSafeCell<T> {}
     
    -impl<T> UPSafeCell<T> {
    -    /// User is responsible to guarantee that inner struct is only used in
    -    /// uniprocessor.
    -    pub unsafe fn new(value: T) -> Self {
    -        Self {
    -            inner: RefCell::new(value),
    +impl<T> UPSafeCell<T> {
    +    /// User is responsible to guarantee that inner struct is only used in
    +    /// uniprocessor.
    +    pub unsafe fn new(value: T) -> Self {
    +        Self {
    +            inner: RefCell::new(value),
             }
         }
    -    /// Exclusive access inner data in UPSafeCell. Panic if the data has been borrowed.
    -    pub fn exclusive_access(&self) -> RefMut<'_, T> {
    -        self.inner.borrow_mut()
    +    /// Exclusive access inner data in UPSafeCell. Panic if the data has been borrowed.
    +    pub fn exclusive_access(&self) -> RefMut<'_, T> {
    +        self.inner.borrow_mut()
         }
     }
    -
    -
    - \ No newline at end of file + +/// The sync primitive used by easy-fs. +pub struct RawExclusiveLock(AtomicBool); + +unsafe impl lock_api::RawMutex for RawExclusiveLock { + const INIT: Self = Self(AtomicBool::new(false)); + type GuardMarker = lock_api::GuardNoSend; + fn lock(&self) { + assert_eq!(self.0.load(Ordering::Relaxed), false); + self.0.store(true, Ordering::Relaxed); + } + fn try_lock(&self) -> bool { + self.0 + .compare_exchange(false, true, Ordering::Relaxed, Ordering::Relaxed) + .is_ok() + } + unsafe fn unlock(&self) { + self.0.store(false, Ordering::Relaxed); + } +} + \ No newline at end of file diff --git a/ch6-dev/src/os/syscall/fs.rs.html b/ch6-dev/src/os/syscall/fs.rs.html index 086ed642..25c62d8c 100644 --- a/ch6-dev/src/os/syscall/fs.rs.html +++ b/ch6-dev/src/os/syscall/fs.rs.html @@ -1,150 +1,143 @@ -fs.rs - source - -
    1
    -2
    -3
    -4
    -5
    -6
    -7
    -8
    -9
    -10
    -11
    -12
    -13
    -14
    -15
    -16
    -17
    -18
    -19
    -20
    -21
    -22
    -23
    -24
    -25
    -26
    -27
    -28
    -29
    -30
    -31
    -32
    -33
    -34
    -35
    -36
    -37
    -38
    -39
    -40
    -41
    -42
    -43
    -44
    -45
    -46
    -47
    -48
    -49
    -50
    -51
    -52
    -53
    -54
    -55
    -56
    -57
    -58
    -59
    -60
    -61
    -62
    -63
    -64
    -65
    -66
    -67
    -68
    -69
    -70
    -71
    -
    //! File and filesystem-related syscalls
    -use crate::fs::{open_file, OpenFlags};
    -use crate::mm::{translated_byte_buffer, translated_str, UserBuffer};
    -use crate::task::{current_task, current_user_token};
    +fs.rs - source
    1
    +2
    +3
    +4
    +5
    +6
    +7
    +8
    +9
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    +47
    +48
    +49
    +50
    +51
    +52
    +53
    +54
    +55
    +56
    +57
    +58
    +59
    +60
    +61
    +62
    +63
    +64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +
    //! File and filesystem-related syscalls
    +use crate::fs::{open_file, OpenFlags};
    +use crate::mm::{translated_byte_buffer, translated_str, UserBuffer};
    +use crate::task::{current_task, current_user_token};
     
    -pub fn sys_write(fd: usize, buf: *const u8, len: usize) -> isize {
    -    let token = current_user_token();
    -    let task = current_task().unwrap();
    -    let inner = task.inner_exclusive_access();
    -    if fd >= inner.fd_table.len() {
    -        return -1;
    +pub fn sys_write(fd: usize, buf: *const u8, len: usize) -> isize {
    +    let token = current_user_token();
    +    let task = current_task().unwrap();
    +    let inner = task.inner_exclusive_access();
    +    if fd >= inner.fd_table.len() {
    +        return -1;
         }
    -    if let Some(file) = &inner.fd_table[fd] {
    -        if !file.writable() {
    -            return -1;
    +    if let Some(file) = &inner.fd_table[fd] {
    +        if !file.writable() {
    +            return -1;
             }
    -        let file = file.clone();
    -        // release current task TCB manually to avoid multi-borrow
    -        drop(inner);
    -        file.write(UserBuffer::new(translated_byte_buffer(token, buf, len))) as isize
    -    } else {
    -        -1
    -    }
    +        let file = file.clone();
    +        // release current task TCB manually to avoid multi-borrow
    +        drop(inner);
    +        file.write(UserBuffer::new(translated_byte_buffer(token, buf, len))) as isize
    +    } else {
    +        -1
    +    }
     }
     
    -pub fn sys_read(fd: usize, buf: *const u8, len: usize) -> isize {
    -    let token = current_user_token();
    -    let task = current_task().unwrap();
    -    let inner = task.inner_exclusive_access();
    -    if fd >= inner.fd_table.len() {
    -        return -1;
    +pub fn sys_read(fd: usize, buf: *const u8, len: usize) -> isize {
    +    let token = current_user_token();
    +    let task = current_task().unwrap();
    +    let inner = task.inner_exclusive_access();
    +    if fd >= inner.fd_table.len() {
    +        return -1;
         }
    -    if let Some(file) = &inner.fd_table[fd] {
    -        let file = file.clone();
    -        if !file.readable() {
    -            return -1;
    +    if let Some(file) = &inner.fd_table[fd] {
    +        let file = file.clone();
    +        if !file.readable() {
    +            return -1;
             }
    -        // release current task TCB manually to avoid multi-borrow
    -        drop(inner);
    -        file.read(UserBuffer::new(translated_byte_buffer(token, buf, len))) as isize
    -    } else {
    -        -1
    -    }
    +        // release current task TCB manually to avoid multi-borrow
    +        drop(inner);
    +        file.read(UserBuffer::new(translated_byte_buffer(token, buf, len))) as isize
    +    } else {
    +        -1
    +    }
     }
     
    -pub fn sys_open(path: *const u8, flags: u32) -> isize {
    -    let task = current_task().unwrap();
    -    let token = current_user_token();
    -    let path = translated_str(token, path);
    -    if let Some(inode) = open_file(path.as_str(), OpenFlags::from_bits(flags).unwrap()) {
    -        let mut inner = task.inner_exclusive_access();
    -        let fd = inner.alloc_fd();
    -        inner.fd_table[fd] = Some(inode);
    -        fd as isize
    -    } else {
    -        -1
    -    }
    +pub fn sys_open(path: *const u8, flags: u32) -> isize {
    +    let task = current_task().unwrap();
    +    let token = current_user_token();
    +    let path = translated_str(token, path);
    +    if let Some(inode) = open_file(path.as_str(), OpenFlags::from_bits(flags).unwrap()) {
    +        let mut inner = task.inner_exclusive_access();
    +        let fd = inner.alloc_fd();
    +        inner.fd_table[fd] = Some(inode);
    +        fd as isize
    +    } else {
    +        -1
    +    }
     }
     
    -pub fn sys_close(fd: usize) -> isize {
    -    let task = current_task().unwrap();
    -    let mut inner = task.inner_exclusive_access();
    -    if fd >= inner.fd_table.len() {
    -        return -1;
    +pub fn sys_close(fd: usize) -> isize {
    +    let task = current_task().unwrap();
    +    let mut inner = task.inner_exclusive_access();
    +    if fd >= inner.fd_table.len() {
    +        return -1;
         }
    -    if inner.fd_table[fd].is_none() {
    -        return -1;
    +    if inner.fd_table[fd].is_none() {
    +        return -1;
         }
    -    inner.fd_table[fd].take();
    -    0
    -}
    -
    -
    - \ No newline at end of file + inner.fd_table[fd].take(); + 0 +} + \ No newline at end of file diff --git a/ch6-dev/src/os/syscall/mod.rs.html b/ch6-dev/src/os/syscall/mod.rs.html index f64ae49a..ea62a67b 100644 --- a/ch6-dev/src/os/syscall/mod.rs.html +++ b/ch6-dev/src/os/syscall/mod.rs.html @@ -1,98 +1,91 @@ -mod.rs - source - -
    1
    -2
    -3
    -4
    -5
    -6
    -7
    -8
    -9
    -10
    -11
    -12
    -13
    -14
    -15
    -16
    -17
    -18
    -19
    -20
    -21
    -22
    -23
    -24
    -25
    -26
    -27
    -28
    -29
    -30
    -31
    -32
    -33
    -34
    -35
    -36
    -37
    -38
    -39
    -40
    -41
    -42
    -43
    -44
    -45
    -
    //! Implementation of syscalls
    -//!
    -//! The single entry point to all system calls, [`syscall()`], is called
    -//! whenever userspace wishes to perform a system call using the `ecall`
    -//! instruction. In this case, the processor raises an 'Environment call from
    -//! U-mode' exception, which is handled as one of the cases in
    -//! [`crate::trap::trap_handler`].
    -//!
    -//! For clarity, each single syscall is implemented as its own function, named
    -//! `sys_` then the name of the syscall. You can find functions like this in
    -//! submodules, and you should also implement syscalls this way.
    -const SYSCALL_OPEN: usize = 56;
    -const SYSCALL_CLOSE: usize = 57;
    -const SYSCALL_READ: usize = 63;
    -const SYSCALL_WRITE: usize = 64;
    -const SYSCALL_EXIT: usize = 93;
    -const SYSCALL_YIELD: usize = 124;
    -const SYSCALL_GET_TIME: usize = 169;
    -const SYSCALL_GETPID: usize = 172;
    -const SYSCALL_FORK: usize = 220;
    -const SYSCALL_EXEC: usize = 221;
    -const SYSCALL_WAITPID: usize = 260;
    +mod.rs - source
    1
    +2
    +3
    +4
    +5
    +6
    +7
    +8
    +9
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +
    //! Implementation of syscalls
    +//!
    +//! The single entry point to all system calls, [`syscall()`], is called
    +//! whenever userspace wishes to perform a system call using the `ecall`
    +//! instruction. In this case, the processor raises an 'Environment call from
    +//! U-mode' exception, which is handled as one of the cases in
    +//! [`crate::trap::trap_handler`].
    +//!
    +//! For clarity, each single syscall is implemented as its own function, named
    +//! `sys_` then the name of the syscall. You can find functions like this in
    +//! submodules, and you should also implement syscalls this way.
    +const SYSCALL_OPEN: usize = 56;
    +const SYSCALL_CLOSE: usize = 57;
    +const SYSCALL_READ: usize = 63;
    +const SYSCALL_WRITE: usize = 64;
    +const SYSCALL_EXIT: usize = 93;
    +const SYSCALL_YIELD: usize = 124;
    +const SYSCALL_GET_TIME: usize = 169;
    +const SYSCALL_GETPID: usize = 172;
    +const SYSCALL_FORK: usize = 220;
    +const SYSCALL_EXEC: usize = 221;
    +const SYSCALL_WAITPID: usize = 260;
     
    -mod fs;
    -mod process;
    +mod fs;
    +mod process;
     
    -use fs::*;
    -use process::*;
    -/// handle syscall exception with `syscall_id` and other arguments
    -pub fn syscall(syscall_id: usize, args: [usize; 3]) -> isize {
    -    match syscall_id {
    -        SYSCALL_OPEN => sys_open(args[0] as *const u8, args[1] as u32),
    -        SYSCALL_CLOSE => sys_close(args[0]),
    -        SYSCALL_READ => sys_read(args[0], args[1] as *const u8, args[2]),
    -        SYSCALL_WRITE => sys_write(args[0], args[1] as *const u8, args[2]),
    -        SYSCALL_EXIT => sys_exit(args[0] as i32),
    -        SYSCALL_YIELD => sys_yield(),
    -        SYSCALL_GET_TIME => sys_get_time(),
    -        SYSCALL_GETPID => sys_getpid(),
    -        SYSCALL_FORK => sys_fork(),
    -        SYSCALL_EXEC => sys_exec(args[0] as *const u8),
    -        SYSCALL_WAITPID => sys_waitpid(args[0] as isize, args[1] as *mut i32),
    -        _ => panic!("Unsupported syscall_id: {}", syscall_id),
    +use fs::*;
    +use process::*;
    +/// handle syscall exception with `syscall_id` and other arguments
    +pub fn syscall(syscall_id: usize, args: [usize; 3]) -> isize {
    +    match syscall_id {
    +        SYSCALL_OPEN => sys_open(args[0] as *const u8, args[1] as u32),
    +        SYSCALL_CLOSE => sys_close(args[0]),
    +        SYSCALL_READ => sys_read(args[0], args[1] as *const u8, args[2]),
    +        SYSCALL_WRITE => sys_write(args[0], args[1] as *const u8, args[2]),
    +        SYSCALL_EXIT => sys_exit(args[0] as i32),
    +        SYSCALL_YIELD => sys_yield(),
    +        SYSCALL_GET_TIME => sys_get_time(),
    +        SYSCALL_GETPID => sys_getpid(),
    +        SYSCALL_FORK => sys_fork(),
    +        SYSCALL_EXEC => sys_exec(args[0] as *const u8),
    +        SYSCALL_WAITPID => sys_waitpid(args[0] as isize, args[1] as *mut i32),
    +        _ => panic!("Unsupported syscall_id: {}", syscall_id),
         }
     }
    -
    -
    - \ No newline at end of file + \ No newline at end of file diff --git a/ch6-dev/src/os/syscall/process.rs.html b/ch6-dev/src/os/syscall/process.rs.html index 1fe6caf7..5b6abc9d 100644 --- a/ch6-dev/src/os/syscall/process.rs.html +++ b/ch6-dev/src/os/syscall/process.rs.html @@ -1,188 +1,181 @@ -process.rs - source - -
    1
    -2
    -3
    -4
    -5
    -6
    -7
    -8
    -9
    -10
    -11
    -12
    -13
    -14
    -15
    -16
    -17
    -18
    -19
    -20
    -21
    -22
    -23
    -24
    -25
    -26
    -27
    -28
    -29
    -30
    -31
    -32
    -33
    -34
    -35
    -36
    -37
    -38
    -39
    -40
    -41
    -42
    -43
    -44
    -45
    -46
    -47
    -48
    -49
    -50
    -51
    -52
    -53
    -54
    -55
    -56
    -57
    -58
    -59
    -60
    -61
    -62
    -63
    -64
    -65
    -66
    -67
    -68
    -69
    -70
    -71
    -72
    -73
    -74
    -75
    -76
    -77
    -78
    -79
    -80
    -81
    -82
    -83
    -84
    -85
    -86
    -87
    -88
    -89
    -90
    -
    use crate::fs::{open_file, OpenFlags};
    -use crate::mm::{translated_refmut, translated_str};
    -use crate::task::{
    -    add_task, current_task, current_user_token, exit_current_and_run_next,
    -    suspend_current_and_run_next,
    +process.rs - source
    1
    +2
    +3
    +4
    +5
    +6
    +7
    +8
    +9
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    +47
    +48
    +49
    +50
    +51
    +52
    +53
    +54
    +55
    +56
    +57
    +58
    +59
    +60
    +61
    +62
    +63
    +64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    +79
    +80
    +81
    +82
    +83
    +84
    +85
    +86
    +87
    +88
    +89
    +90
    +
    use crate::fs::{open_file, OpenFlags};
    +use crate::mm::{translated_refmut, translated_str};
    +use crate::task::{
    +    add_task, current_task, current_user_token, exit_current_and_run_next,
    +    suspend_current_and_run_next,
     };
    -use crate::timer::get_time_ms;
    -use alloc::sync::Arc;
    +use crate::timer::get_time_ms;
    +use alloc::sync::Arc;
     
    -pub fn sys_exit(exit_code: i32) -> ! {
    -    exit_current_and_run_next(exit_code);
    +pub fn sys_exit(exit_code: i32) -> ! {
    +    exit_current_and_run_next(exit_code);
         panic!("Unreachable in sys_exit!");
     }
     
    -pub fn sys_yield() -> isize {
    -    suspend_current_and_run_next();
    -    0
    +pub fn sys_yield() -> isize {
    +    suspend_current_and_run_next();
    +    0
    +}
    +
    +pub fn sys_get_time() -> isize {
    +    get_time_ms() as isize
     }
     
    -pub fn sys_get_time() -> isize {
    -    get_time_ms() as isize
    +pub fn sys_getpid() -> isize {
    +    current_task().unwrap().pid.0 as isize
     }
     
    -pub fn sys_getpid() -> isize {
    -    current_task().unwrap().pid.0 as isize
    +pub fn sys_fork() -> isize {
    +    let current_task = current_task().unwrap();
    +    let new_task = current_task.fork();
    +    let new_pid = new_task.pid.0;
    +    // modify trap context of new_task, because it returns immediately after switching
    +    let trap_cx = new_task.inner_exclusive_access().get_trap_cx();
    +    // we do not have to move to next instruction since we have done it before
    +    // for child process, fork returns 0
    +    trap_cx.x[10] = 0;
    +    // add new task to scheduler
    +    add_task(new_task);
    +    new_pid as isize
     }
     
    -pub fn sys_fork() -> isize {
    -    let current_task = current_task().unwrap();
    -    let new_task = current_task.fork();
    -    let new_pid = new_task.pid.0;
    -    // modify trap context of new_task, because it returns immediately after switching
    -    let trap_cx = new_task.inner_exclusive_access().get_trap_cx();
    -    // we do not have to move to next instruction since we have done it before
    -    // for child process, fork returns 0
    -    trap_cx.x[10] = 0;
    -    // add new task to scheduler
    -    add_task(new_task);
    -    new_pid as isize
    +pub fn sys_exec(path: *const u8) -> isize {
    +    let token = current_user_token();
    +    let path = translated_str(token, path);
    +    if let Some(app_inode) = open_file(path.as_str(), OpenFlags::RDONLY) {
    +        let all_data = app_inode.read_all();
    +        let task = current_task().unwrap();
    +        task.exec(all_data.as_slice());
    +        0
    +    } else {
    +        -1
    +    }
     }
     
    -pub fn sys_exec(path: *const u8) -> isize {
    -    let token = current_user_token();
    -    let path = translated_str(token, path);
    -    if let Some(app_inode) = open_file(path.as_str(), OpenFlags::RDONLY) {
    -        let all_data = app_inode.read_all();
    -        let task = current_task().unwrap();
    -        task.exec(all_data.as_slice());
    -        0
    -    } else {
    -        -1
    -    }
    -}
    +/// If there is not a child process whose pid is same as given, return -1.
    +/// Else if there is a child process but it is still running, return -2.
    +pub fn sys_waitpid(pid: isize, exit_code_ptr: *mut i32) -> isize {
    +    let task = current_task().unwrap();
    +    // find a child process
     
    -/// If there is not a child process whose pid is same as given, return -1.
    -/// Else if there is a child process but it is still running, return -2.
    -pub fn sys_waitpid(pid: isize, exit_code_ptr: *mut i32) -> isize {
    -    let task = current_task().unwrap();
    -    // find a child process
    -
    -    // ---- access current PCB exclusively
    -    let mut inner = task.inner_exclusive_access();
    -    if !inner
    -        .children
    -        .iter()
    -        .any(|p| pid == -1 || pid as usize == p.getpid())
    +    // ---- access current PCB exclusively
    +    let mut inner = task.inner_exclusive_access();
    +    if !inner
    +        .children
    +        .iter()
    +        .any(|p| pid == -1 || pid as usize == p.getpid())
         {
    -        return -1;
    -        // ---- release current PCB
    -    }
    -    let pair = inner.children.iter().enumerate().find(|(_, p)| {
    -        // ++++ temporarily access child PCB exclusively
    -        p.inner_exclusive_access().is_zombie() && (pid == -1 || pid as usize == p.getpid())
    -        // ++++ release child PCB
    -    });
    -    if let Some((idx, _)) = pair {
    -        let child = inner.children.remove(idx);
    -        // confirm that child will be deallocated after being removed from children list
    -        assert_eq!(Arc::strong_count(&child), 1);
    -        let found_pid = child.getpid();
    -        // ++++ temporarily access child PCB exclusively
    -        let exit_code = child.inner_exclusive_access().exit_code;
    -        // ++++ release child PCB
    -        *translated_refmut(inner.memory_set.token(), exit_code_ptr) = exit_code;
    -        found_pid as isize
    -    } else {
    -        -2
    -    }
    -    // ---- release current PCB automatically
    -}
    -
    -
    - \ No newline at end of file + return -1; + // ---- release current PCB + } + let pair = inner.children.iter().enumerate().find(|(_, p)| { + // ++++ temporarily access child PCB exclusively + p.inner_exclusive_access().is_zombie() && (pid == -1 || pid as usize == p.getpid()) + // ++++ release child PCB + }); + if let Some((idx, _)) = pair { + let child = inner.children.remove(idx); + // confirm that child will be deallocated after being removed from children list + assert_eq!(Arc::strong_count(&child), 1); + let found_pid = child.getpid(); + // ++++ temporarily access child PCB exclusively + let exit_code = child.inner_exclusive_access().exit_code; + // ++++ release child PCB + *translated_refmut(inner.memory_set.token(), exit_code_ptr) = exit_code; + found_pid as isize + } else { + -2 + } + // ---- release current PCB automatically +} + \ No newline at end of file diff --git a/ch6-dev/src/os/task/context.rs.html b/ch6-dev/src/os/task/context.rs.html index 74f63852..f6f78874 100644 --- a/ch6-dev/src/os/task/context.rs.html +++ b/ch6-dev/src/os/task/context.rs.html @@ -1,72 +1,65 @@ -context.rs - source - -
    1
    -2
    -3
    -4
    -5
    -6
    -7
    -8
    -9
    -10
    -11
    -12
    -13
    -14
    -15
    -16
    -17
    -18
    -19
    -20
    -21
    -22
    -23
    -24
    -25
    -26
    -27
    -28
    -29
    -30
    -31
    -32
    -
    //! Implementation of [`TaskContext`]
    -use crate::trap::trap_return;
    +context.rs - source
    1
    +2
    +3
    +4
    +5
    +6
    +7
    +8
    +9
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +
    //! Implementation of [`TaskContext`]
    +use crate::trap::trap_return;
     
    -#[repr(C)]
    -/// task context structure containing some registers
    -pub struct TaskContext {
    -    /// return address ( e.g. __restore ) of __switch ASM function
    -    ra: usize,
    -    /// kernel stack pointer of app
    -    sp: usize,
    -    /// s0-11 register, callee saved
    -    s: [usize; 12],
    +#[repr(C)]
    +/// task context structure containing some registers
    +pub struct TaskContext {
    +    /// return address ( e.g. __restore ) of __switch ASM function
    +    ra: usize,
    +    /// kernel stack pointer of app
    +    sp: usize,
    +    /// s0-11 register, callee saved
    +    s: [usize; 12],
     }
     
    -impl TaskContext {
    -    /// init task context
    -    pub fn zero_init() -> Self {
    -        Self {
    -            ra: 0,
    -            sp: 0,
    -            s: [0; 12],
    +impl TaskContext {
    +    /// init task context
    +    pub fn zero_init() -> Self {
    +        Self {
    +            ra: 0,
    +            sp: 0,
    +            s: [0; 12],
             }
         }
    -    /// set Task Context{__restore ASM funciton: trap_return, sp: kstack_ptr, s: s_0..12}
    -    pub fn goto_trap_return(kstack_ptr: usize) -> Self {
    -        Self {
    -            ra: trap_return as usize,
    -            sp: kstack_ptr,
    -            s: [0; 12],
    +    /// set Task Context{__restore ASM funciton: trap_return, sp: kstack_ptr, s: s_0..12}
    +    pub fn goto_trap_return(kstack_ptr: usize) -> Self {
    +        Self {
    +            ra: trap_return as usize,
    +            sp: kstack_ptr,
    +            s: [0; 12],
             }
         }
     }
    -
    -
    - \ No newline at end of file + \ No newline at end of file diff --git a/ch6-dev/src/os/task/manager.rs.html b/ch6-dev/src/os/task/manager.rs.html index 7b725e41..47b41f43 100644 --- a/ch6-dev/src/os/task/manager.rs.html +++ b/ch6-dev/src/os/task/manager.rs.html @@ -1,90 +1,83 @@ -manager.rs - source - -
    1
    -2
    -3
    -4
    -5
    -6
    -7
    -8
    -9
    -10
    -11
    -12
    -13
    -14
    -15
    -16
    -17
    -18
    -19
    -20
    -21
    -22
    -23
    -24
    -25
    -26
    -27
    -28
    -29
    -30
    -31
    -32
    -33
    -34
    -35
    -36
    -37
    -38
    -39
    -40
    -41
    -
    //!Implementation of [`TaskManager`]
    -use super::TaskControlBlock;
    -use crate::sync::UPSafeCell;
    -use alloc::collections::VecDeque;
    -use alloc::sync::Arc;
    -use lazy_static::*;
    -///A array of `TaskControlBlock` that is thread-safe
    -pub struct TaskManager {
    -    ready_queue: VecDeque<Arc<TaskControlBlock>>,
    +manager.rs - source
    1
    +2
    +3
    +4
    +5
    +6
    +7
    +8
    +9
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +
    //!Implementation of [`TaskManager`]
    +use super::TaskControlBlock;
    +use crate::sync::UPSafeCell;
    +use alloc::collections::VecDeque;
    +use alloc::sync::Arc;
    +use lazy_static::*;
    +///A array of `TaskControlBlock` that is thread-safe
    +pub struct TaskManager {
    +    ready_queue: VecDeque<Arc<TaskControlBlock>>,
     }
     
    -/// A simple FIFO scheduler.
    -impl TaskManager {
    -    ///Creat an empty TaskManager
    -    pub fn new() -> Self {
    -        Self {
    -            ready_queue: VecDeque::new(),
    +/// A simple FIFO scheduler.
    +impl TaskManager {
    +    ///Creat an empty TaskManager
    +    pub fn new() -> Self {
    +        Self {
    +            ready_queue: VecDeque::new(),
             }
         }
    -    ///Add a task to `TaskManager`
    -    pub fn add(&mut self, task: Arc<TaskControlBlock>) {
    -        self.ready_queue.push_back(task);
    +    ///Add a task to `TaskManager`
    +    pub fn add(&mut self, task: Arc<TaskControlBlock>) {
    +        self.ready_queue.push_back(task);
         }
    -    ///Remove the first task and return it,or `None` if `TaskManager` is empty
    -    pub fn fetch(&mut self) -> Option<Arc<TaskControlBlock>> {
    -        self.ready_queue.pop_front()
    +    ///Remove the first task and return it,or `None` if `TaskManager` is empty
    +    pub fn fetch(&mut self) -> Option<Arc<TaskControlBlock>> {
    +        self.ready_queue.pop_front()
         }
     }
     
    -lazy_static! {
    -    pub static ref TASK_MANAGER: UPSafeCell<TaskManager> =
    -        unsafe { UPSafeCell::new(TaskManager::new()) };
    +lazy_static! {
    +    pub static ref TASK_MANAGER: UPSafeCell<TaskManager> =
    +        unsafe { UPSafeCell::new(TaskManager::new()) };
     }
    -///Interface offered to add task
    -pub fn add_task(task: Arc<TaskControlBlock>) {
    -    TASK_MANAGER.exclusive_access().add(task);
    +///Interface offered to add task
    +pub fn add_task(task: Arc<TaskControlBlock>) {
    +    TASK_MANAGER.exclusive_access().add(task);
     }
    -///Interface offered to pop the first task
    -pub fn fetch_task() -> Option<Arc<TaskControlBlock>> {
    -    TASK_MANAGER.exclusive_access().fetch()
    +///Interface offered to pop the first task
    +pub fn fetch_task() -> Option<Arc<TaskControlBlock>> {
    +    TASK_MANAGER.exclusive_access().fetch()
     }
    -
    -
    - \ No newline at end of file + \ No newline at end of file diff --git a/ch6-dev/src/os/task/mod.rs.html b/ch6-dev/src/os/task/mod.rs.html index 99701463..7830ef34 100644 --- a/ch6-dev/src/os/task/mod.rs.html +++ b/ch6-dev/src/os/task/mod.rs.html @@ -1,264 +1,249 @@ -mod.rs - source - -
    1
    -2
    -3
    -4
    -5
    -6
    -7
    -8
    -9
    -10
    -11
    -12
    -13
    -14
    -15
    -16
    -17
    -18
    -19
    -20
    -21
    -22
    -23
    -24
    -25
    -26
    -27
    -28
    -29
    -30
    -31
    -32
    -33
    -34
    -35
    -36
    -37
    -38
    -39
    -40
    -41
    -42
    -43
    -44
    -45
    -46
    -47
    -48
    -49
    -50
    -51
    -52
    -53
    -54
    -55
    -56
    -57
    -58
    -59
    -60
    -61
    -62
    -63
    -64
    -65
    -66
    -67
    -68
    -69
    -70
    -71
    -72
    -73
    -74
    -75
    -76
    -77
    -78
    -79
    -80
    -81
    -82
    -83
    -84
    -85
    -86
    -87
    -88
    -89
    -90
    -91
    -92
    -93
    -94
    -95
    -96
    -97
    -98
    -99
    -100
    -101
    -102
    -103
    -104
    -105
    -106
    -107
    -108
    -109
    -110
    -111
    -112
    -113
    -114
    -115
    -116
    -117
    -118
    -119
    -120
    -121
    -122
    -123
    -124
    -125
    -126
    -127
    -128
    -
    //! Task management implementation
    -//!
    -//! Everything about task management, like starting and switching tasks is
    -//! implemented here.
    -//!
    -//! A single global instance of [`TaskManager`] called `TASK_MANAGER` controls
    -//! all the tasks in the whole operating system.
    -//!
    -//! A single global instance of [`Processor`] called `PROCESSOR` monitors running
    -//! task(s) for each core.
    -//!
    -//! A single global instance of [`PidAllocator`] called `PID_ALLOCATOR` allocates
    -//! pid for user apps.
    -//!
    -//! Be careful when you see `__switch` ASM function in `switch.S`. Control flow around this function
    -//! might not be what you expect.
    -mod context;
    -mod manager;
    -mod pid;
    -mod processor;
    -mod switch;
    -#[allow(clippy::module_inception)]
    -#[allow(rustdoc::private_intra_doc_links)]
    -mod task;
    +mod.rs - source
    1
    +2
    +3
    +4
    +5
    +6
    +7
    +8
    +9
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    +47
    +48
    +49
    +50
    +51
    +52
    +53
    +54
    +55
    +56
    +57
    +58
    +59
    +60
    +61
    +62
    +63
    +64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    +79
    +80
    +81
    +82
    +83
    +84
    +85
    +86
    +87
    +88
    +89
    +90
    +91
    +92
    +93
    +94
    +95
    +96
    +97
    +98
    +99
    +100
    +101
    +102
    +103
    +104
    +105
    +106
    +107
    +108
    +109
    +110
    +111
    +112
    +113
    +114
    +115
    +116
    +117
    +118
    +119
    +120
    +121
    +122
    +123
    +124
    +
    //! Task management implementation
    +//!
    +//! Everything about task management, like starting and switching tasks is
    +//! implemented here.
    +//!
    +//! A single global instance of [`TaskManager`] called `TASK_MANAGER` controls
    +//! all the tasks in the whole operating system.
    +//!
    +//! A single global instance of [`Processor`] called `PROCESSOR` monitors running
    +//! task(s) for each core.
    +//!
    +//! A single global instance of [`PidAllocator`] called `PID_ALLOCATOR` allocates
    +//! pid for user apps.
    +//!
    +//! Be careful when you see `__switch` ASM function in `switch.S`. Control flow around this function
    +//! might not be what you expect.
    +mod context;
    +mod manager;
    +mod pid;
    +mod processor;
    +mod switch;
    +#[allow(clippy::module_inception)]
    +#[allow(rustdoc::private_intra_doc_links)]
    +mod task;
     
    -use crate::fs::{open_file, OpenFlags};
    -use alloc::sync::Arc;
    -pub use context::TaskContext;
    -use lazy_static::*;
    -pub use manager::{fetch_task, TaskManager};
    -use switch::__switch;
    -use task::{TaskControlBlock, TaskStatus};
    +use crate::fs::{open_file, OpenFlags};
    +use crate::sbi::shutdown;
    +use alloc::sync::Arc;
    +pub use context::TaskContext;
    +use lazy_static::*;
    +pub use manager::{fetch_task, TaskManager};
    +use switch::__switch;
    +use task::{TaskControlBlock, TaskStatus};
     
    -pub use manager::add_task;
    -pub use pid::{pid_alloc, KernelStack, PidAllocator, PidHandle};
    -pub use processor::{
    -    current_task, current_trap_cx, current_user_token, run_tasks, schedule, take_current_task,
    -    Processor,
    +pub use manager::add_task;
    +pub use pid::{pid_alloc, KernelStack, PidAllocator, PidHandle};
    +pub use processor::{
    +    current_task, current_trap_cx, current_user_token, run_tasks, schedule, take_current_task,
    +    Processor,
     };
    -/// Suspend the current 'Running' task and run the next task in task list.
    -pub fn suspend_current_and_run_next() {
    -    // There must be an application running.
    -    let task = take_current_task().unwrap();
    +/// Suspend the current 'Running' task and run the next task in task list.
    +pub fn suspend_current_and_run_next() {
    +    // There must be an application running.
    +    let task = take_current_task().unwrap();
     
    -    // ---- access current TCB exclusively
    -    let mut task_inner = task.inner_exclusive_access();
    -    let task_cx_ptr = &mut task_inner.task_cx as *mut TaskContext;
    -    // Change status to Ready
    -    task_inner.task_status = TaskStatus::Ready;
    -    drop(task_inner);
    -    // ---- release current PCB
    +    // ---- access current TCB exclusively
    +    let mut task_inner = task.inner_exclusive_access();
    +    let task_cx_ptr = &mut task_inner.task_cx as *mut TaskContext;
    +    // Change status to Ready
    +    task_inner.task_status = TaskStatus::Ready;
    +    drop(task_inner);
    +    // ---- release current PCB
     
    -    // push back to ready queue.
    -    add_task(task);
    -    // jump to scheduling cycle
    -    schedule(task_cx_ptr);
    +    // push back to ready queue.
    +    add_task(task);
    +    // jump to scheduling cycle
    +    schedule(task_cx_ptr);
     }
     
    -/// pid of usertests app in make run TEST=1
    -pub const IDLE_PID: usize = 0;
    +/// pid of usertests app in make run TEST=1
    +pub const IDLE_PID: usize = 0;
     
    -#[cfg(feature = "board_qemu")]
    -use crate::board::QEMUExit;
    +/// Exit the current 'Running' task and run the next task in task list.
    +pub fn exit_current_and_run_next(exit_code: i32) {
    +    // take from Processor
    +    let task = take_current_task().unwrap();
     
    -/// Exit the current 'Running' task and run the next task in task list.
    -pub fn exit_current_and_run_next(exit_code: i32) {
    -    // take from Processor
    -    let task = take_current_task().unwrap();
    -
    -    #[cfg(feature = "board_qemu")]
    -    let pid = task.getpid();
    -    #[cfg(feature = "board_qemu")]
    -    if pid == IDLE_PID {
    +    let pid = task.getpid();
    +    if pid == IDLE_PID {
             println!(
                 "[kernel] Idle process exit with exit_code {} ...",
    -            exit_code
    +            exit_code
             );
    -        if exit_code != 0 {
    -            //crate::sbi::shutdown(255); //255 == -1 for err hint
    -            crate::board::QEMU_EXIT_HANDLE.exit_failure();
    -        } else {
    -            //crate::sbi::shutdown(0); //0 for success hint
    -            crate::board::QEMU_EXIT_HANDLE.exit_success();
    +        if exit_code != 0 {
    +            //crate::sbi::shutdown(255); //255 == -1 for err hint
    +            shutdown(true)
    +        } else {
    +            //crate::sbi::shutdown(0); //0 for success hint
    +            shutdown(false)
             }
         }
     
    -    // **** access current TCB exclusively
    -    let mut inner = task.inner_exclusive_access();
    -    // Change status to Zombie
    -    inner.task_status = TaskStatus::Zombie;
    -    // Record exit code
    -    inner.exit_code = exit_code;
    -    // do not move to its parent but under initproc
    +    // **** access current TCB exclusively
    +    let mut inner = task.inner_exclusive_access();
    +    // Change status to Zombie
    +    inner.task_status = TaskStatus::Zombie;
    +    // Record exit code
    +    inner.exit_code = exit_code;
    +    // do not move to its parent but under initproc
     
    -    // ++++++ access initproc TCB exclusively
    -    {
    -        let mut initproc_inner = INITPROC.inner_exclusive_access();
    -        for child in inner.children.iter() {
    -            child.inner_exclusive_access().parent = Some(Arc::downgrade(&INITPROC));
    -            initproc_inner.children.push(child.clone());
    +    // ++++++ access initproc TCB exclusively
    +    {
    +        let mut initproc_inner = INITPROC.inner_exclusive_access();
    +        for child in inner.children.iter() {
    +            child.inner_exclusive_access().parent = Some(Arc::downgrade(&INITPROC));
    +            initproc_inner.children.push(child.clone());
             }
         }
    -    // ++++++ release parent PCB
    +    // ++++++ release parent PCB
     
    -    inner.children.clear();
    -    // deallocate user space
    -    inner.memory_set.recycle_data_pages();
    -    drop(inner);
    -    // **** release current PCB
    -    // drop task manually to maintain rc correctly
    -    drop(task);
    -    // we do not have to save task context
    -    let mut _unused = TaskContext::zero_init();
    -    schedule(&mut _unused as *mut _);
    +    inner.children.clear();
    +    // deallocate user space
    +    inner.memory_set.recycle_data_pages();
    +    drop(inner);
    +    // **** release current PCB
    +    // drop task manually to maintain rc correctly
    +    drop(task);
    +    // we do not have to save task context
    +    let mut _unused = TaskContext::zero_init();
    +    schedule(&mut _unused as *mut _);
     }
     
    -lazy_static! {
    -    ///Globle process that init user shell
    -    pub static ref INITPROC: Arc<TaskControlBlock> = Arc::new({
    -        let inode = open_file("initproc", OpenFlags::RDONLY).unwrap();
    -        let v = inode.read_all();
    -        TaskControlBlock::new(v.as_slice())
    +lazy_static! {
    +    ///Globle process that init user shell
    +    pub static ref INITPROC: Arc<TaskControlBlock> = Arc::new({
    +        let inode = open_file("initproc", OpenFlags::RDONLY).unwrap();
    +        let v = inode.read_all();
    +        TaskControlBlock::new(v.as_slice())
         });
     }
    -///Add init process to the manager
    -pub fn add_initproc() {
    -    add_task(INITPROC.clone());
    +///Add init process to the manager
    +pub fn add_initproc() {
    +    add_task(INITPROC.clone());
     }
    -
    -
    - \ No newline at end of file + \ No newline at end of file diff --git a/ch6-dev/src/os/task/pid.rs.html b/ch6-dev/src/os/task/pid.rs.html index 69239241..4d55c2bf 100644 --- a/ch6-dev/src/os/task/pid.rs.html +++ b/ch6-dev/src/os/task/pid.rs.html @@ -1,230 +1,223 @@ -pid.rs - source - -
    1
    -2
    -3
    -4
    -5
    -6
    -7
    -8
    -9
    -10
    -11
    -12
    -13
    -14
    -15
    -16
    -17
    -18
    -19
    -20
    -21
    -22
    -23
    -24
    -25
    -26
    -27
    -28
    -29
    -30
    -31
    -32
    -33
    -34
    -35
    -36
    -37
    -38
    -39
    -40
    -41
    -42
    -43
    -44
    -45
    -46
    -47
    -48
    -49
    -50
    -51
    -52
    -53
    -54
    -55
    -56
    -57
    -58
    -59
    -60
    -61
    -62
    -63
    -64
    -65
    -66
    -67
    -68
    -69
    -70
    -71
    -72
    -73
    -74
    -75
    -76
    -77
    -78
    -79
    -80
    -81
    -82
    -83
    -84
    -85
    -86
    -87
    -88
    -89
    -90
    -91
    -92
    -93
    -94
    -95
    -96
    -97
    -98
    -99
    -100
    -101
    -102
    -103
    -104
    -105
    -106
    -107
    -108
    -109
    -110
    -111
    -
    //!Implementation of [`PidAllocator`]
    -use crate::config::{KERNEL_STACK_SIZE, PAGE_SIZE, TRAMPOLINE};
    -use crate::mm::{MapPermission, VirtAddr, KERNEL_SPACE};
    -use crate::sync::UPSafeCell;
    -use alloc::vec::Vec;
    -use lazy_static::*;
    -///Pid Allocator struct
    -pub struct PidAllocator {
    -    current: usize,
    -    recycled: Vec<usize>,
    +pid.rs - source
    1
    +2
    +3
    +4
    +5
    +6
    +7
    +8
    +9
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    +47
    +48
    +49
    +50
    +51
    +52
    +53
    +54
    +55
    +56
    +57
    +58
    +59
    +60
    +61
    +62
    +63
    +64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    +79
    +80
    +81
    +82
    +83
    +84
    +85
    +86
    +87
    +88
    +89
    +90
    +91
    +92
    +93
    +94
    +95
    +96
    +97
    +98
    +99
    +100
    +101
    +102
    +103
    +104
    +105
    +106
    +107
    +108
    +109
    +110
    +111
    +
    //!Implementation of [`PidAllocator`]
    +use crate::config::{KERNEL_STACK_SIZE, PAGE_SIZE, TRAMPOLINE};
    +use crate::mm::{MapPermission, VirtAddr, KERNEL_SPACE};
    +use crate::sync::UPSafeCell;
    +use alloc::vec::Vec;
    +use lazy_static::*;
    +///Pid Allocator struct
    +pub struct PidAllocator {
    +    current: usize,
    +    recycled: Vec<usize>,
     }
     
    -impl PidAllocator {
    -    ///Create an empty `PidAllocator`
    -    pub fn new() -> Self {
    -        PidAllocator {
    -            current: 0,
    -            recycled: Vec::new(),
    +impl PidAllocator {
    +    ///Create an empty `PidAllocator`
    +    pub fn new() -> Self {
    +        PidAllocator {
    +            current: 0,
    +            recycled: Vec::new(),
             }
         }
    -    ///Allocate a pid
    -    pub fn alloc(&mut self) -> PidHandle {
    -        if let Some(pid) = self.recycled.pop() {
    -            PidHandle(pid)
    -        } else {
    -            self.current += 1;
    -            PidHandle(self.current - 1)
    +    ///Allocate a pid
    +    pub fn alloc(&mut self) -> PidHandle {
    +        if let Some(pid) = self.recycled.pop() {
    +            PidHandle(pid)
    +        } else {
    +            self.current += 1;
    +            PidHandle(self.current - 1)
             }
         }
    -    ///Recycle a pid
    -    pub fn dealloc(&mut self, pid: usize) {
    -        assert!(pid < self.current);
    +    ///Recycle a pid
    +    pub fn dealloc(&mut self, pid: usize) {
    +        assert!(pid < self.current);
             assert!(
    -            !self.recycled.iter().any(|ppid| *ppid == pid),
    +            !self.recycled.iter().any(|ppid| *ppid == pid),
                 "pid {} has been deallocated!",
    -            pid
    +            pid
             );
    -        self.recycled.push(pid);
    +        self.recycled.push(pid);
         }
     }
     
    -lazy_static! {
    -    pub static ref PID_ALLOCATOR: UPSafeCell<PidAllocator> =
    -        unsafe { UPSafeCell::new(PidAllocator::new()) };
    +lazy_static! {
    +    pub static ref PID_ALLOCATOR: UPSafeCell<PidAllocator> =
    +        unsafe { UPSafeCell::new(PidAllocator::new()) };
     }
    -///Bind pid lifetime to `PidHandle`
    -pub struct PidHandle(pub usize);
    +///Bind pid lifetime to `PidHandle`
    +pub struct PidHandle(pub usize);
     
    -impl Drop for PidHandle {
    -    fn drop(&mut self) {
    -        //println!("drop pid {}", self.0);
    -        PID_ALLOCATOR.exclusive_access().dealloc(self.0);
    +impl Drop for PidHandle {
    +    fn drop(&mut self) {
    +        //println!("drop pid {}", self.0);
    +        PID_ALLOCATOR.exclusive_access().dealloc(self.0);
         }
     }
    -///Allocate a pid from PID_ALLOCATOR
    -pub fn pid_alloc() -> PidHandle {
    -    PID_ALLOCATOR.exclusive_access().alloc()
    +///Allocate a pid from PID_ALLOCATOR
    +pub fn pid_alloc() -> PidHandle {
    +    PID_ALLOCATOR.exclusive_access().alloc()
     }
     
    -/// Return (bottom, top) of a kernel stack in kernel space.
    -pub fn kernel_stack_position(app_id: usize) -> (usize, usize) {
    -    let top = TRAMPOLINE - app_id * (KERNEL_STACK_SIZE + PAGE_SIZE);
    -    let bottom = top - KERNEL_STACK_SIZE;
    -    (bottom, top)
    +/// Return (bottom, top) of a kernel stack in kernel space.
    +pub fn kernel_stack_position(app_id: usize) -> (usize, usize) {
    +    let top = TRAMPOLINE - app_id * (KERNEL_STACK_SIZE + PAGE_SIZE);
    +    let bottom = top - KERNEL_STACK_SIZE;
    +    (bottom, top)
     }
    -///Kernelstack for app
    -pub struct KernelStack {
    -    pid: usize,
    +///Kernelstack for app
    +pub struct KernelStack {
    +    pid: usize,
     }
     
    -impl KernelStack {
    -    ///Create a kernelstack from pid
    -    pub fn new(pid_handle: &PidHandle) -> Self {
    -        let pid = pid_handle.0;
    -        let (kernel_stack_bottom, kernel_stack_top) = kernel_stack_position(pid);
    -        KERNEL_SPACE.exclusive_access().insert_framed_area(
    -            kernel_stack_bottom.into(),
    -            kernel_stack_top.into(),
    -            MapPermission::R | MapPermission::W,
    +impl KernelStack {
    +    ///Create a kernelstack from pid
    +    pub fn new(pid_handle: &PidHandle) -> Self {
    +        let pid = pid_handle.0;
    +        let (kernel_stack_bottom, kernel_stack_top) = kernel_stack_position(pid);
    +        KERNEL_SPACE.exclusive_access().insert_framed_area(
    +            kernel_stack_bottom.into(),
    +            kernel_stack_top.into(),
    +            MapPermission::R | MapPermission::W,
             );
    -        KernelStack { pid: pid_handle.0 }
    +        KernelStack { pid: pid_handle.0 }
         }
    -    #[allow(unused)]
    -    ///Push a value on top of kernelstack
    -    pub fn push_on_top<T>(&self, value: T) -> *mut T
    -    where
    -        T: Sized,
    +    #[allow(unused)]
    +    ///Push a value on top of kernelstack
    +    pub fn push_on_top<T>(&self, value: T) -> *mut T
    +    where
    +        T: Sized,
         {
    -        let kernel_stack_top = self.get_top();
    -        let ptr_mut = (kernel_stack_top - core::mem::size_of::<T>()) as *mut T;
    -        unsafe {
    -            *ptr_mut = value;
    +        let kernel_stack_top = self.get_top();
    +        let ptr_mut = (kernel_stack_top - core::mem::size_of::<T>()) as *mut T;
    +        unsafe {
    +            *ptr_mut = value;
             }
    -        ptr_mut
    +        ptr_mut
         }
    -    ///Get the value on the top of kernelstack
    -    pub fn get_top(&self) -> usize {
    -        let (_, kernel_stack_top) = kernel_stack_position(self.pid);
    -        kernel_stack_top
    +    ///Get the value on the top of kernelstack
    +    pub fn get_top(&self) -> usize {
    +        let (_, kernel_stack_top) = kernel_stack_position(self.pid);
    +        kernel_stack_top
         }
     }
     
    -impl Drop for KernelStack {
    -    fn drop(&mut self) {
    -        let (kernel_stack_bottom, _) = kernel_stack_position(self.pid);
    -        let kernel_stack_bottom_va: VirtAddr = kernel_stack_bottom.into();
    -        KERNEL_SPACE
    -            .exclusive_access()
    -            .remove_area_with_start_vpn(kernel_stack_bottom_va.into());
    +impl Drop for KernelStack {
    +    fn drop(&mut self) {
    +        let (kernel_stack_bottom, _) = kernel_stack_position(self.pid);
    +        let kernel_stack_bottom_va: VirtAddr = kernel_stack_bottom.into();
    +        KERNEL_SPACE
    +            .exclusive_access()
    +            .remove_area_with_start_vpn(kernel_stack_bottom_va.into());
         }
     }
    -
    -
    - \ No newline at end of file + \ No newline at end of file diff --git a/ch6-dev/src/os/task/processor.rs.html b/ch6-dev/src/os/task/processor.rs.html index c9d0690a..39c529dc 100644 --- a/ch6-dev/src/os/task/processor.rs.html +++ b/ch6-dev/src/os/task/processor.rs.html @@ -1,194 +1,187 @@ -processor.rs - source - -
    1
    -2
    -3
    -4
    -5
    -6
    -7
    -8
    -9
    -10
    -11
    -12
    -13
    -14
    -15
    -16
    -17
    -18
    -19
    -20
    -21
    -22
    -23
    -24
    -25
    -26
    -27
    -28
    -29
    -30
    -31
    -32
    -33
    -34
    -35
    -36
    -37
    -38
    -39
    -40
    -41
    -42
    -43
    -44
    -45
    -46
    -47
    -48
    -49
    -50
    -51
    -52
    -53
    -54
    -55
    -56
    -57
    -58
    -59
    -60
    -61
    -62
    -63
    -64
    -65
    -66
    -67
    -68
    -69
    -70
    -71
    -72
    -73
    -74
    -75
    -76
    -77
    -78
    -79
    -80
    -81
    -82
    -83
    -84
    -85
    -86
    -87
    -88
    -89
    -90
    -91
    -92
    -93
    -
    //!Implementation of [`Processor`] and Intersection of control flow
    -use super::__switch;
    -use super::{fetch_task, TaskStatus};
    -use super::{TaskContext, TaskControlBlock};
    -use crate::sync::UPSafeCell;
    -use crate::trap::TrapContext;
    -use alloc::sync::Arc;
    -use lazy_static::*;
    -///Processor management structure
    -pub struct Processor {
    -    ///The task currently executing on the current processor
    -    current: Option<Arc<TaskControlBlock>>,
    -    ///The basic control flow of each core, helping to select and switch process
    -    idle_task_cx: TaskContext,
    +processor.rs - source
    1
    +2
    +3
    +4
    +5
    +6
    +7
    +8
    +9
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    +47
    +48
    +49
    +50
    +51
    +52
    +53
    +54
    +55
    +56
    +57
    +58
    +59
    +60
    +61
    +62
    +63
    +64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    +79
    +80
    +81
    +82
    +83
    +84
    +85
    +86
    +87
    +88
    +89
    +90
    +91
    +92
    +93
    +
    //!Implementation of [`Processor`] and Intersection of control flow
    +use super::__switch;
    +use super::{fetch_task, TaskStatus};
    +use super::{TaskContext, TaskControlBlock};
    +use crate::sync::UPSafeCell;
    +use crate::trap::TrapContext;
    +use alloc::sync::Arc;
    +use lazy_static::*;
    +///Processor management structure
    +pub struct Processor {
    +    ///The task currently executing on the current processor
    +    current: Option<Arc<TaskControlBlock>>,
    +    ///The basic control flow of each core, helping to select and switch process
    +    idle_task_cx: TaskContext,
     }
     
    -impl Processor {
    -    ///Create an empty Processor
    -    pub fn new() -> Self {
    -        Self {
    -            current: None,
    -            idle_task_cx: TaskContext::zero_init(),
    +impl Processor {
    +    ///Create an empty Processor
    +    pub fn new() -> Self {
    +        Self {
    +            current: None,
    +            idle_task_cx: TaskContext::zero_init(),
             }
         }
    -    ///Get mutable reference to `idle_task_cx`
    -    fn get_idle_task_cx_ptr(&mut self) -> *mut TaskContext {
    -        &mut self.idle_task_cx as *mut _
    +    ///Get mutable reference to `idle_task_cx`
    +    fn get_idle_task_cx_ptr(&mut self) -> *mut TaskContext {
    +        &mut self.idle_task_cx as *mut _
    +    }
    +    ///Get current task in moving semanteme
    +    pub fn take_current(&mut self) -> Option<Arc<TaskControlBlock>> {
    +        self.current.take()
         }
    -    ///Get current task in moving semanteme
    -    pub fn take_current(&mut self) -> Option<Arc<TaskControlBlock>> {
    -        self.current.take()
    -    }
    -    ///Get current task in cloning semanteme
    -    pub fn current(&self) -> Option<Arc<TaskControlBlock>> {
    -        self.current.as_ref().map(Arc::clone)
    +    ///Get current task in cloning semanteme
    +    pub fn current(&self) -> Option<Arc<TaskControlBlock>> {
    +        self.current.as_ref().map(Arc::clone)
         }
     }
     
    -lazy_static! {
    -    pub static ref PROCESSOR: UPSafeCell<Processor> = unsafe { UPSafeCell::new(Processor::new()) };
    +lazy_static! {
    +    pub static ref PROCESSOR: UPSafeCell<Processor> = unsafe { UPSafeCell::new(Processor::new()) };
     }
    -///The main part of process execution and scheduling
    -///Loop `fetch_task` to get the process that needs to run, and switch the process through `__switch`
    -pub fn run_tasks() {
    -    loop {
    -        let mut processor = PROCESSOR.exclusive_access();
    -        if let Some(task) = fetch_task() {
    -            let idle_task_cx_ptr = processor.get_idle_task_cx_ptr();
    -            // access coming task TCB exclusively
    -            let mut task_inner = task.inner_exclusive_access();
    -            let next_task_cx_ptr = &task_inner.task_cx as *const TaskContext;
    -            task_inner.task_status = TaskStatus::Running;
    -            drop(task_inner);
    -            // release coming task TCB manually
    -            processor.current = Some(task);
    -            // release processor manually
    -            drop(processor);
    -            unsafe {
    -                __switch(idle_task_cx_ptr, next_task_cx_ptr);
    +///The main part of process execution and scheduling
    +///Loop `fetch_task` to get the process that needs to run, and switch the process through `__switch`
    +pub fn run_tasks() {
    +    loop {
    +        let mut processor = PROCESSOR.exclusive_access();
    +        if let Some(task) = fetch_task() {
    +            let idle_task_cx_ptr = processor.get_idle_task_cx_ptr();
    +            // access coming task TCB exclusively
    +            let mut task_inner = task.inner_exclusive_access();
    +            let next_task_cx_ptr = &task_inner.task_cx as *const TaskContext;
    +            task_inner.task_status = TaskStatus::Running;
    +            drop(task_inner);
    +            // release coming task TCB manually
    +            processor.current = Some(task);
    +            // release processor manually
    +            drop(processor);
    +            unsafe {
    +                __switch(idle_task_cx_ptr, next_task_cx_ptr);
                 }
             }
         }
     }
    -///Take the current task,leaving a None in its place
    -pub fn take_current_task() -> Option<Arc<TaskControlBlock>> {
    -    PROCESSOR.exclusive_access().take_current()
    +///Take the current task,leaving a None in its place
    +pub fn take_current_task() -> Option<Arc<TaskControlBlock>> {
    +    PROCESSOR.exclusive_access().take_current()
     }
    -///Get running task
    -pub fn current_task() -> Option<Arc<TaskControlBlock>> {
    -    PROCESSOR.exclusive_access().current()
    +///Get running task
    +pub fn current_task() -> Option<Arc<TaskControlBlock>> {
    +    PROCESSOR.exclusive_access().current()
     }
    -///Get token of the address space of current task
    -pub fn current_user_token() -> usize {
    -    let task = current_task().unwrap();
    -    let token = task.inner_exclusive_access().get_user_token();
    -    token
    +///Get token of the address space of current task
    +pub fn current_user_token() -> usize {
    +    let task = current_task().unwrap();
    +    let token = task.inner_exclusive_access().get_user_token();
    +    token
     }
    -///Get the mutable reference to trap context of current task
    -pub fn current_trap_cx() -> &'static mut TrapContext {
    -    current_task()
    -        .unwrap()
    -        .inner_exclusive_access()
    -        .get_trap_cx()
    +///Get the mutable reference to trap context of current task
    +pub fn current_trap_cx() -> &'static mut TrapContext {
    +    current_task()
    +        .unwrap()
    +        .inner_exclusive_access()
    +        .get_trap_cx()
     }
    -///Return to idle control flow for new scheduling
    -pub fn schedule(switched_task_cx_ptr: *mut TaskContext) {
    -    let mut processor = PROCESSOR.exclusive_access();
    -    let idle_task_cx_ptr = processor.get_idle_task_cx_ptr();
    -    drop(processor);
    -    unsafe {
    -        __switch(switched_task_cx_ptr, idle_task_cx_ptr);
    +///Return to idle control flow for new scheduling
    +pub fn schedule(switched_task_cx_ptr: *mut TaskContext) {
    +    let mut processor = PROCESSOR.exclusive_access();
    +    let idle_task_cx_ptr = processor.get_idle_task_cx_ptr();
    +    drop(processor);
    +    unsafe {
    +        __switch(switched_task_cx_ptr, idle_task_cx_ptr);
         }
     }
    -
    -
    - \ No newline at end of file + \ No newline at end of file diff --git a/ch6-dev/src/os/task/switch.rs.html b/ch6-dev/src/os/task/switch.rs.html index d2bb7497..a14b8a8e 100644 --- a/ch6-dev/src/os/task/switch.rs.html +++ b/ch6-dev/src/os/task/switch.rs.html @@ -1,26 +1,19 @@ -switch.rs - source - -
    1
    -2
    -3
    -4
    -5
    -6
    -7
    -8
    -9
    -
    //!Wrap `switch.S` as a function
    -use super::TaskContext;
    -use core::arch::global_asm;
    +switch.rs - source
    1
    +2
    +3
    +4
    +5
    +6
    +7
    +8
    +9
    +
    //!Wrap `switch.S` as a function
    +use super::TaskContext;
    +use core::arch::global_asm;
     
     global_asm!(include_str!("switch.S"));
     
    -extern "C" {
    -    pub fn __switch(current_task_cx_ptr: *mut TaskContext, next_task_cx_ptr: *const TaskContext);
    +extern "C" {
    +    pub fn __switch(current_task_cx_ptr: *mut TaskContext, next_task_cx_ptr: *const TaskContext);
     }
    -
    -
    - \ No newline at end of file + \ No newline at end of file diff --git a/ch6-dev/src/os/task/task.rs.html b/ch6-dev/src/os/task/task.rs.html index 399795a6..e4ea6891 100644 --- a/ch6-dev/src/os/task/task.rs.html +++ b/ch6-dev/src/os/task/task.rs.html @@ -1,392 +1,385 @@ -task.rs - source - -
    1
    -2
    -3
    -4
    -5
    -6
    -7
    -8
    -9
    -10
    -11
    -12
    -13
    -14
    -15
    -16
    -17
    -18
    -19
    -20
    -21
    -22
    -23
    -24
    -25
    -26
    -27
    -28
    -29
    -30
    -31
    -32
    -33
    -34
    -35
    -36
    -37
    -38
    -39
    -40
    -41
    -42
    -43
    -44
    -45
    -46
    -47
    -48
    -49
    -50
    -51
    -52
    -53
    -54
    -55
    -56
    -57
    -58
    -59
    -60
    -61
    -62
    -63
    -64
    -65
    -66
    -67
    -68
    -69
    -70
    -71
    -72
    -73
    -74
    -75
    -76
    -77
    -78
    -79
    -80
    -81
    -82
    -83
    -84
    -85
    -86
    -87
    -88
    -89
    -90
    -91
    -92
    -93
    -94
    -95
    -96
    -97
    -98
    -99
    -100
    -101
    -102
    -103
    -104
    -105
    -106
    -107
    -108
    -109
    -110
    -111
    -112
    -113
    -114
    -115
    -116
    -117
    -118
    -119
    -120
    -121
    -122
    -123
    -124
    -125
    -126
    -127
    -128
    -129
    -130
    -131
    -132
    -133
    -134
    -135
    -136
    -137
    -138
    -139
    -140
    -141
    -142
    -143
    -144
    -145
    -146
    -147
    -148
    -149
    -150
    -151
    -152
    -153
    -154
    -155
    -156
    -157
    -158
    -159
    -160
    -161
    -162
    -163
    -164
    -165
    -166
    -167
    -168
    -169
    -170
    -171
    -172
    -173
    -174
    -175
    -176
    -177
    -178
    -179
    -180
    -181
    -182
    -183
    -184
    -185
    -186
    -187
    -188
    -189
    -190
    -191
    -192
    -
    //!Implementation of [`TaskControlBlock`]
    -use super::TaskContext;
    -use super::{pid_alloc, KernelStack, PidHandle};
    -use crate::config::TRAP_CONTEXT;
    -use crate::fs::{File, Stdin, Stdout};
    -use crate::mm::{MemorySet, PhysPageNum, VirtAddr, KERNEL_SPACE};
    -use crate::sync::UPSafeCell;
    -use crate::trap::{trap_handler, TrapContext};
    -use alloc::sync::{Arc, Weak};
    -use alloc::vec;
    -use alloc::vec::Vec;
    -use core::cell::RefMut;
    +task.rs - source
    1
    +2
    +3
    +4
    +5
    +6
    +7
    +8
    +9
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    +47
    +48
    +49
    +50
    +51
    +52
    +53
    +54
    +55
    +56
    +57
    +58
    +59
    +60
    +61
    +62
    +63
    +64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    +79
    +80
    +81
    +82
    +83
    +84
    +85
    +86
    +87
    +88
    +89
    +90
    +91
    +92
    +93
    +94
    +95
    +96
    +97
    +98
    +99
    +100
    +101
    +102
    +103
    +104
    +105
    +106
    +107
    +108
    +109
    +110
    +111
    +112
    +113
    +114
    +115
    +116
    +117
    +118
    +119
    +120
    +121
    +122
    +123
    +124
    +125
    +126
    +127
    +128
    +129
    +130
    +131
    +132
    +133
    +134
    +135
    +136
    +137
    +138
    +139
    +140
    +141
    +142
    +143
    +144
    +145
    +146
    +147
    +148
    +149
    +150
    +151
    +152
    +153
    +154
    +155
    +156
    +157
    +158
    +159
    +160
    +161
    +162
    +163
    +164
    +165
    +166
    +167
    +168
    +169
    +170
    +171
    +172
    +173
    +174
    +175
    +176
    +177
    +178
    +179
    +180
    +181
    +182
    +183
    +184
    +185
    +186
    +187
    +188
    +189
    +190
    +191
    +192
    +
    //!Implementation of [`TaskControlBlock`]
    +use super::TaskContext;
    +use super::{pid_alloc, KernelStack, PidHandle};
    +use crate::config::TRAP_CONTEXT;
    +use crate::fs::{File, Stdin, Stdout};
    +use crate::mm::{MemorySet, PhysPageNum, VirtAddr, KERNEL_SPACE};
    +use crate::sync::UPSafeCell;
    +use crate::trap::{trap_handler, TrapContext};
    +use alloc::sync::{Arc, Weak};
    +use alloc::vec;
    +use alloc::vec::Vec;
    +use core::cell::RefMut;
     
    -pub struct TaskControlBlock {
    -    // immutable
    -    pub pid: PidHandle,
    -    pub kernel_stack: KernelStack,
    -    // mutable
    -    inner: UPSafeCell<TaskControlBlockInner>,
    +pub struct TaskControlBlock {
    +    // immutable
    +    pub pid: PidHandle,
    +    pub kernel_stack: KernelStack,
    +    // mutable
    +    inner: UPSafeCell<TaskControlBlockInner>,
     }
     
    -pub struct TaskControlBlockInner {
    -    pub trap_cx_ppn: PhysPageNum,
    -    pub base_size: usize,
    -    pub task_cx: TaskContext,
    -    pub task_status: TaskStatus,
    -    pub memory_set: MemorySet,
    -    pub parent: Option<Weak<TaskControlBlock>>,
    -    pub children: Vec<Arc<TaskControlBlock>>,
    -    pub exit_code: i32,
    -    pub fd_table: Vec<Option<Arc<dyn File + Send + Sync>>>,
    +pub struct TaskControlBlockInner {
    +    pub trap_cx_ppn: PhysPageNum,
    +    pub base_size: usize,
    +    pub task_cx: TaskContext,
    +    pub task_status: TaskStatus,
    +    pub memory_set: MemorySet,
    +    pub parent: Option<Weak<TaskControlBlock>>,
    +    pub children: Vec<Arc<TaskControlBlock>>,
    +    pub exit_code: i32,
    +    pub fd_table: Vec<Option<Arc<dyn File + Send + Sync>>>,
     }
     
    -impl TaskControlBlockInner {
    -    pub fn get_trap_cx(&self) -> &'static mut TrapContext {
    -        self.trap_cx_ppn.get_mut()
    +impl TaskControlBlockInner {
    +    pub fn get_trap_cx(&self) -> &'static mut TrapContext {
    +        self.trap_cx_ppn.get_mut()
         }
    -    pub fn get_user_token(&self) -> usize {
    -        self.memory_set.token()
    +    pub fn get_user_token(&self) -> usize {
    +        self.memory_set.token()
         }
    -    fn get_status(&self) -> TaskStatus {
    -        self.task_status
    +    fn get_status(&self) -> TaskStatus {
    +        self.task_status
         }
    -    pub fn is_zombie(&self) -> bool {
    -        self.get_status() == TaskStatus::Zombie
    +    pub fn is_zombie(&self) -> bool {
    +        self.get_status() == TaskStatus::Zombie
         }
    -    pub fn alloc_fd(&mut self) -> usize {
    -        if let Some(fd) = (0..self.fd_table.len()).find(|fd| self.fd_table[*fd].is_none()) {
    -            fd
    -        } else {
    -            self.fd_table.push(None);
    -            self.fd_table.len() - 1
    -        }
    +    pub fn alloc_fd(&mut self) -> usize {
    +        if let Some(fd) = (0..self.fd_table.len()).find(|fd| self.fd_table[*fd].is_none()) {
    +            fd
    +        } else {
    +            self.fd_table.push(None);
    +            self.fd_table.len() - 1
    +        }
         }
     }
     
    -impl TaskControlBlock {
    -    pub fn inner_exclusive_access(&self) -> RefMut<'_, TaskControlBlockInner> {
    -        self.inner.exclusive_access()
    +impl TaskControlBlock {
    +    pub fn inner_exclusive_access(&self) -> RefMut<'_, TaskControlBlockInner> {
    +        self.inner.exclusive_access()
         }
    -    pub fn new(elf_data: &[u8]) -> Self {
    -        // memory_set with elf program headers/trampoline/trap context/user stack
    -        let (memory_set, user_sp, entry_point) = MemorySet::from_elf(elf_data);
    -        let trap_cx_ppn = memory_set
    -            .translate(VirtAddr::from(TRAP_CONTEXT).into())
    -            .unwrap()
    -            .ppn();
    -        // alloc a pid and a kernel stack in kernel space
    -        let pid_handle = pid_alloc();
    -        let kernel_stack = KernelStack::new(&pid_handle);
    -        let kernel_stack_top = kernel_stack.get_top();
    -        let task_control_block = Self {
    -            pid: pid_handle,
    -            kernel_stack,
    -            inner: unsafe {
    -                UPSafeCell::new(TaskControlBlockInner {
    -                    trap_cx_ppn,
    -                    base_size: user_sp,
    -                    task_cx: TaskContext::goto_trap_return(kernel_stack_top),
    -                    task_status: TaskStatus::Ready,
    -                    memory_set,
    -                    parent: None,
    -                    children: Vec::new(),
    -                    exit_code: 0,
    -                    fd_table: vec![
    -                        // 0 -> stdin
    -                        Some(Arc::new(Stdin)),
    -                        // 1 -> stdout
    -                        Some(Arc::new(Stdout)),
    -                        // 2 -> stderr
    -                        Some(Arc::new(Stdout)),
    +    pub fn new(elf_data: &[u8]) -> Self {
    +        // memory_set with elf program headers/trampoline/trap context/user stack
    +        let (memory_set, user_sp, entry_point) = MemorySet::from_elf(elf_data);
    +        let trap_cx_ppn = memory_set
    +            .translate(VirtAddr::from(TRAP_CONTEXT).into())
    +            .unwrap()
    +            .ppn();
    +        // alloc a pid and a kernel stack in kernel space
    +        let pid_handle = pid_alloc();
    +        let kernel_stack = KernelStack::new(&pid_handle);
    +        let kernel_stack_top = kernel_stack.get_top();
    +        let task_control_block = Self {
    +            pid: pid_handle,
    +            kernel_stack,
    +            inner: unsafe {
    +                UPSafeCell::new(TaskControlBlockInner {
    +                    trap_cx_ppn,
    +                    base_size: user_sp,
    +                    task_cx: TaskContext::goto_trap_return(kernel_stack_top),
    +                    task_status: TaskStatus::Ready,
    +                    memory_set,
    +                    parent: None,
    +                    children: Vec::new(),
    +                    exit_code: 0,
    +                    fd_table: vec![
    +                        // 0 -> stdin
    +                        Some(Arc::new(Stdin)),
    +                        // 1 -> stdout
    +                        Some(Arc::new(Stdout)),
    +                        // 2 -> stderr
    +                        Some(Arc::new(Stdout)),
                         ],
                     })
                 },
             };
    -        // prepare TrapContext in user space
    -        let trap_cx = task_control_block.inner_exclusive_access().get_trap_cx();
    -        *trap_cx = TrapContext::app_init_context(
    -            entry_point,
    -            user_sp,
    -            KERNEL_SPACE.exclusive_access().token(),
    -            kernel_stack_top,
    -            trap_handler as usize,
    +        // prepare TrapContext in user space
    +        let trap_cx = task_control_block.inner_exclusive_access().get_trap_cx();
    +        *trap_cx = TrapContext::app_init_context(
    +            entry_point,
    +            user_sp,
    +            KERNEL_SPACE.exclusive_access().token(),
    +            kernel_stack_top,
    +            trap_handler as usize,
             );
    -        task_control_block
    +        task_control_block
         }
    -    pub fn exec(&self, elf_data: &[u8]) {
    -        // memory_set with elf program headers/trampoline/trap context/user stack
    -        let (memory_set, user_sp, entry_point) = MemorySet::from_elf(elf_data);
    -        let trap_cx_ppn = memory_set
    -            .translate(VirtAddr::from(TRAP_CONTEXT).into())
    -            .unwrap()
    -            .ppn();
    +    pub fn exec(&self, elf_data: &[u8]) {
    +        // memory_set with elf program headers/trampoline/trap context/user stack
    +        let (memory_set, user_sp, entry_point) = MemorySet::from_elf(elf_data);
    +        let trap_cx_ppn = memory_set
    +            .translate(VirtAddr::from(TRAP_CONTEXT).into())
    +            .unwrap()
    +            .ppn();
     
    -        // **** access current TCB exclusively
    -        let mut inner = self.inner_exclusive_access();
    -        // substitute memory_set
    -        inner.memory_set = memory_set;
    -        // update trap_cx ppn
    -        inner.trap_cx_ppn = trap_cx_ppn;
    -        // initialize trap_cx
    -        let trap_cx = TrapContext::app_init_context(
    -            entry_point,
    -            user_sp,
    -            KERNEL_SPACE.exclusive_access().token(),
    -            self.kernel_stack.get_top(),
    -            trap_handler as usize,
    +        // **** access current TCB exclusively
    +        let mut inner = self.inner_exclusive_access();
    +        // substitute memory_set
    +        inner.memory_set = memory_set;
    +        // update trap_cx ppn
    +        inner.trap_cx_ppn = trap_cx_ppn;
    +        // initialize trap_cx
    +        let trap_cx = TrapContext::app_init_context(
    +            entry_point,
    +            user_sp,
    +            KERNEL_SPACE.exclusive_access().token(),
    +            self.kernel_stack.get_top(),
    +            trap_handler as usize,
             );
    -        *inner.get_trap_cx() = trap_cx;
    -        // **** release current PCB
    -    }
    -    pub fn fork(self: &Arc<TaskControlBlock>) -> Arc<TaskControlBlock> {
    -        // ---- hold parent PCB lock
    -        let mut parent_inner = self.inner_exclusive_access();
    -        // copy user space(include trap context)
    -        let memory_set = MemorySet::from_existed_user(&parent_inner.memory_set);
    -        let trap_cx_ppn = memory_set
    -            .translate(VirtAddr::from(TRAP_CONTEXT).into())
    -            .unwrap()
    -            .ppn();
    -        // alloc a pid and a kernel stack in kernel space
    -        let pid_handle = pid_alloc();
    -        let kernel_stack = KernelStack::new(&pid_handle);
    -        let kernel_stack_top = kernel_stack.get_top();
    -        // copy fd table
    -        let mut new_fd_table: Vec<Option<Arc<dyn File + Send + Sync>>> = Vec::new();
    -        for fd in parent_inner.fd_table.iter() {
    -            if let Some(file) = fd {
    -                new_fd_table.push(Some(file.clone()));
    -            } else {
    -                new_fd_table.push(None);
    +        *inner.get_trap_cx() = trap_cx;
    +        // **** release current PCB
    +    }
    +    pub fn fork(self: &Arc<TaskControlBlock>) -> Arc<TaskControlBlock> {
    +        // ---- hold parent PCB lock
    +        let mut parent_inner = self.inner_exclusive_access();
    +        // copy user space(include trap context)
    +        let memory_set = MemorySet::from_existed_user(&parent_inner.memory_set);
    +        let trap_cx_ppn = memory_set
    +            .translate(VirtAddr::from(TRAP_CONTEXT).into())
    +            .unwrap()
    +            .ppn();
    +        // alloc a pid and a kernel stack in kernel space
    +        let pid_handle = pid_alloc();
    +        let kernel_stack = KernelStack::new(&pid_handle);
    +        let kernel_stack_top = kernel_stack.get_top();
    +        // copy fd table
    +        let mut new_fd_table: Vec<Option<Arc<dyn File + Send + Sync>>> = Vec::new();
    +        for fd in parent_inner.fd_table.iter() {
    +            if let Some(file) = fd {
    +                new_fd_table.push(Some(file.clone()));
    +            } else {
    +                new_fd_table.push(None);
                 }
             }
    -        let task_control_block = Arc::new(TaskControlBlock {
    -            pid: pid_handle,
    -            kernel_stack,
    -            inner: unsafe {
    -                UPSafeCell::new(TaskControlBlockInner {
    -                    trap_cx_ppn,
    -                    base_size: parent_inner.base_size,
    -                    task_cx: TaskContext::goto_trap_return(kernel_stack_top),
    -                    task_status: TaskStatus::Ready,
    -                    memory_set,
    -                    parent: Some(Arc::downgrade(self)),
    -                    children: Vec::new(),
    -                    exit_code: 0,
    -                    fd_table: new_fd_table,
    +        let task_control_block = Arc::new(TaskControlBlock {
    +            pid: pid_handle,
    +            kernel_stack,
    +            inner: unsafe {
    +                UPSafeCell::new(TaskControlBlockInner {
    +                    trap_cx_ppn,
    +                    base_size: parent_inner.base_size,
    +                    task_cx: TaskContext::goto_trap_return(kernel_stack_top),
    +                    task_status: TaskStatus::Ready,
    +                    memory_set,
    +                    parent: Some(Arc::downgrade(self)),
    +                    children: Vec::new(),
    +                    exit_code: 0,
    +                    fd_table: new_fd_table,
                     })
                 },
             });
    -        // add child
    -        parent_inner.children.push(task_control_block.clone());
    -        // modify kernel_sp in trap_cx
    -        // **** access child PCB exclusively
    -        let trap_cx = task_control_block.inner_exclusive_access().get_trap_cx();
    -        trap_cx.kernel_sp = kernel_stack_top;
    -        // return
    -        task_control_block
    -        // **** release child PCB
    -        // ---- release parent PCB
    -    }
    -    pub fn getpid(&self) -> usize {
    -        self.pid.0
    -    }
    +        // add child
    +        parent_inner.children.push(task_control_block.clone());
    +        // modify kernel_sp in trap_cx
    +        // **** access child PCB exclusively
    +        let trap_cx = task_control_block.inner_exclusive_access().get_trap_cx();
    +        trap_cx.kernel_sp = kernel_stack_top;
    +        // return
    +        task_control_block
    +        // **** release child PCB
    +        // ---- release parent PCB
    +    }
    +    pub fn getpid(&self) -> usize {
    +        self.pid.0
    +    }
     }
     
    -#[derive(Copy, Clone, PartialEq)]
    -pub enum TaskStatus {
    -    Ready,
    -    Running,
    -    Zombie,
    +#[derive(Copy, Clone, PartialEq)]
    +pub enum TaskStatus {
    +    Ready,
    +    Running,
    +    Zombie,
     }
    -
    -
    - \ No newline at end of file + \ No newline at end of file diff --git a/ch6-dev/src/os/timer.rs.html b/ch6-dev/src/os/timer.rs.html index 739147fb..d4830ce5 100644 --- a/ch6-dev/src/os/timer.rs.html +++ b/ch6-dev/src/os/timer.rs.html @@ -1,48 +1,41 @@ -timer.rs - source - -
    1
    -2
    -3
    -4
    -5
    -6
    -7
    -8
    -9
    -10
    -11
    -12
    -13
    -14
    -15
    -16
    -17
    -18
    -19
    -20
    -
    //! RISC-V timer-related functionality
    +timer.rs - source
    1
    +2
    +3
    +4
    +5
    +6
    +7
    +8
    +9
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +
    //! RISC-V timer-related functionality
     
    -use crate::config::CLOCK_FREQ;
    -use crate::sbi::set_timer;
    -use riscv::register::time;
    +use crate::config::CLOCK_FREQ;
    +use crate::sbi::set_timer;
    +use riscv::register::time;
     
    -const TICKS_PER_SEC: usize = 100;
    -const MSEC_PER_SEC: usize = 1000;
    -///get current time
    -pub fn get_time() -> usize {
    -    time::read()
    +const TICKS_PER_SEC: usize = 100;
    +const MSEC_PER_SEC: usize = 1000;
    +///get current time
    +pub fn get_time() -> usize {
    +    time::read()
     }
    -/// get current time in microseconds
    -pub fn get_time_ms() -> usize {
    -    time::read() / (CLOCK_FREQ / MSEC_PER_SEC)
    +/// get current time in microseconds
    +pub fn get_time_ms() -> usize {
    +    time::read() / (CLOCK_FREQ / MSEC_PER_SEC)
     }
    -/// set the next timer interrupt
    -pub fn set_next_trigger() {
    -    set_timer(get_time() + CLOCK_FREQ / TICKS_PER_SEC);
    +/// set the next timer interrupt
    +pub fn set_next_trigger() {
    +    set_timer(get_time() + CLOCK_FREQ / TICKS_PER_SEC);
     }
    -
    -
    - \ No newline at end of file + \ No newline at end of file diff --git a/ch6-dev/src/os/trap/context.rs.html b/ch6-dev/src/os/trap/context.rs.html index c48f3c3c..b67846ac 100644 --- a/ch6-dev/src/os/trap/context.rs.html +++ b/ch6-dev/src/os/trap/context.rs.html @@ -1,106 +1,99 @@ -context.rs - source - -
    1
    -2
    -3
    -4
    -5
    -6
    -7
    -8
    -9
    -10
    -11
    -12
    -13
    -14
    -15
    -16
    -17
    -18
    -19
    -20
    -21
    -22
    -23
    -24
    -25
    -26
    -27
    -28
    -29
    -30
    -31
    -32
    -33
    -34
    -35
    -36
    -37
    -38
    -39
    -40
    -41
    -42
    -43
    -44
    -45
    -46
    -47
    -48
    -49
    -
    //! Implementation of [`TrapContext`]
    -use riscv::register::sstatus::{self, Sstatus, SPP};
    +context.rs - source
    1
    +2
    +3
    +4
    +5
    +6
    +7
    +8
    +9
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    +47
    +48
    +49
    +
    //! Implementation of [`TrapContext`]
    +use riscv::register::sstatus::{self, Sstatus, SPP};
     
    -#[repr(C)]
    -#[derive(Debug)]
    -///trap context structure containing sstatus, sepc and registers
    -pub struct TrapContext {
    -    /// general regs[0..31]
    -    pub x: [usize; 32],
    -    /// CSR sstatus      
    -    pub sstatus: Sstatus,
    -    /// CSR sepc
    -    pub sepc: usize,
    -    /// Addr of Page Table
    -    pub kernel_satp: usize,
    -    /// kernel stack
    -    pub kernel_sp: usize,
    -    /// Addr of trap_handler function
    -    pub trap_handler: usize,
    +#[repr(C)]
    +#[derive(Debug)]
    +///trap context structure containing sstatus, sepc and registers
    +pub struct TrapContext {
    +    /// general regs[0..31]
    +    pub x: [usize; 32],
    +    /// CSR sstatus      
    +    pub sstatus: Sstatus,
    +    /// CSR sepc
    +    pub sepc: usize,
    +    /// Addr of Page Table
    +    pub kernel_satp: usize,
    +    /// kernel stack
    +    pub kernel_sp: usize,
    +    /// Addr of trap_handler function
    +    pub trap_handler: usize,
     }
     
    -impl TrapContext {
    -    ///set stack pointer to x_2 reg (sp)
    -    pub fn set_sp(&mut self, sp: usize) {
    -        self.x[2] = sp;
    +impl TrapContext {
    +    ///set stack pointer to x_2 reg (sp)
    +    pub fn set_sp(&mut self, sp: usize) {
    +        self.x[2] = sp;
         }
    -    ///init app context
    -    pub fn app_init_context(
    -        entry: usize,
    -        sp: usize,
    -        kernel_satp: usize,
    -        kernel_sp: usize,
    -        trap_handler: usize,
    -    ) -> Self {
    -        let mut sstatus = sstatus::read();
    -        // set CPU privilege to User after trapping back
    -        sstatus.set_spp(SPP::User);
    -        let mut cx = Self {
    -            x: [0; 32],
    -            sstatus,
    -            sepc: entry,
    -            kernel_satp,
    -            kernel_sp,
    -            trap_handler,
    +    ///init app context
    +    pub fn app_init_context(
    +        entry: usize,
    +        sp: usize,
    +        kernel_satp: usize,
    +        kernel_sp: usize,
    +        trap_handler: usize,
    +    ) -> Self {
    +        let mut sstatus = sstatus::read();
    +        // set CPU privilege to User after trapping back
    +        sstatus.set_spp(SPP::User);
    +        let mut cx = Self {
    +            x: [0; 32],
    +            sstatus,
    +            sepc: entry,
    +            kernel_satp,
    +            kernel_sp,
    +            trap_handler,
             };
    -        cx.set_sp(sp);
    -        cx
    +        cx.set_sp(sp);
    +        cx
         }
     }
    -
    -
    - \ No newline at end of file + \ No newline at end of file diff --git a/ch6-dev/src/os/trap/mod.rs.html b/ch6-dev/src/os/trap/mod.rs.html index 5d6b5d9a..f78d2292 100644 --- a/ch6-dev/src/os/trap/mod.rs.html +++ b/ch6-dev/src/os/trap/mod.rs.html @@ -1,288 +1,281 @@ -mod.rs - source - -
    1
    -2
    -3
    -4
    -5
    -6
    -7
    -8
    -9
    -10
    -11
    -12
    -13
    -14
    -15
    -16
    -17
    -18
    -19
    -20
    -21
    -22
    -23
    -24
    -25
    -26
    -27
    -28
    -29
    -30
    -31
    -32
    -33
    -34
    -35
    -36
    -37
    -38
    -39
    -40
    -41
    -42
    -43
    -44
    -45
    -46
    -47
    -48
    -49
    -50
    -51
    -52
    -53
    -54
    -55
    -56
    -57
    -58
    -59
    -60
    -61
    -62
    -63
    -64
    -65
    -66
    -67
    -68
    -69
    -70
    -71
    -72
    -73
    -74
    -75
    -76
    -77
    -78
    -79
    -80
    -81
    -82
    -83
    -84
    -85
    -86
    -87
    -88
    -89
    -90
    -91
    -92
    -93
    -94
    -95
    -96
    -97
    -98
    -99
    -100
    -101
    -102
    -103
    -104
    -105
    -106
    -107
    -108
    -109
    -110
    -111
    -112
    -113
    -114
    -115
    -116
    -117
    -118
    -119
    -120
    -121
    -122
    -123
    -124
    -125
    -126
    -127
    -128
    -129
    -130
    -131
    -132
    -133
    -134
    -135
    -136
    -137
    -138
    -139
    -140
    -
    //! Trap handling functionality
    -//!
    -//! For rCore, we have a single trap entry point, namely `__alltraps`. At
    -//! initialization in [`init()`], we set the `stvec` CSR to point to it.
    -//!
    -//! All traps go through `__alltraps`, which is defined in `trap.S`. The
    -//! assembly language code does just enough work restore the kernel space
    -//! context, ensuring that Rust code safely runs, and transfers control to
    -//! [`trap_handler()`].
    -//!
    -//! It then calls different functionality based on what exactly the exception
    -//! was. For example, timer interrupts trigger task preemption, and syscalls go
    -//! to [`syscall()`].
    -mod context;
    +mod.rs - source
    1
    +2
    +3
    +4
    +5
    +6
    +7
    +8
    +9
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    +47
    +48
    +49
    +50
    +51
    +52
    +53
    +54
    +55
    +56
    +57
    +58
    +59
    +60
    +61
    +62
    +63
    +64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    +79
    +80
    +81
    +82
    +83
    +84
    +85
    +86
    +87
    +88
    +89
    +90
    +91
    +92
    +93
    +94
    +95
    +96
    +97
    +98
    +99
    +100
    +101
    +102
    +103
    +104
    +105
    +106
    +107
    +108
    +109
    +110
    +111
    +112
    +113
    +114
    +115
    +116
    +117
    +118
    +119
    +120
    +121
    +122
    +123
    +124
    +125
    +126
    +127
    +128
    +129
    +130
    +131
    +132
    +133
    +134
    +135
    +136
    +137
    +138
    +139
    +140
    +
    //! Trap handling functionality
    +//!
    +//! For rCore, we have a single trap entry point, namely `__alltraps`. At
    +//! initialization in [`init()`], we set the `stvec` CSR to point to it.
    +//!
    +//! All traps go through `__alltraps`, which is defined in `trap.S`. The
    +//! assembly language code does just enough work restore the kernel space
    +//! context, ensuring that Rust code safely runs, and transfers control to
    +//! [`trap_handler()`].
    +//!
    +//! It then calls different functionality based on what exactly the exception
    +//! was. For example, timer interrupts trigger task preemption, and syscalls go
    +//! to [`syscall()`].
    +mod context;
     
    -use crate::config::{TRAMPOLINE, TRAP_CONTEXT};
    -use crate::syscall::syscall;
    -use crate::task::{
    -    current_trap_cx, current_user_token, exit_current_and_run_next, suspend_current_and_run_next,
    +use crate::config::{TRAMPOLINE, TRAP_CONTEXT};
    +use crate::syscall::syscall;
    +use crate::task::{
    +    current_trap_cx, current_user_token, exit_current_and_run_next, suspend_current_and_run_next,
     };
    -use crate::timer::set_next_trigger;
    -use core::arch::{asm, global_asm};
    -use riscv::register::{
    -    mtvec::TrapMode,
    -    scause::{self, Exception, Interrupt, Trap},
    -    sie, stval, stvec,
    +use crate::timer::set_next_trigger;
    +use core::arch::{asm, global_asm};
    +use riscv::register::{
    +    mtvec::TrapMode,
    +    scause::{self, Exception, Interrupt, Trap},
    +    sie, stval, stvec,
     };
     
     global_asm!(include_str!("trap.S"));
    -/// initialize CSR `stvec` as the entry of `__alltraps`
    -pub fn init() {
    -    set_kernel_trap_entry();
    +/// initialize CSR `stvec` as the entry of `__alltraps`
    +pub fn init() {
    +    set_kernel_trap_entry();
     }
     
    -fn set_kernel_trap_entry() {
    -    unsafe {
    -        stvec::write(trap_from_kernel as usize, TrapMode::Direct);
    +fn set_kernel_trap_entry() {
    +    unsafe {
    +        stvec::write(trap_from_kernel as usize, TrapMode::Direct);
         }
     }
     
    -fn set_user_trap_entry() {
    -    unsafe {
    -        stvec::write(TRAMPOLINE as usize, TrapMode::Direct);
    +fn set_user_trap_entry() {
    +    unsafe {
    +        stvec::write(TRAMPOLINE as usize, TrapMode::Direct);
         }
     }
    -/// enable timer interrupt in sie CSR
    -pub fn enable_timer_interrupt() {
    -    unsafe {
    -        sie::set_stimer();
    +/// enable timer interrupt in sie CSR
    +pub fn enable_timer_interrupt() {
    +    unsafe {
    +        sie::set_stimer();
         }
     }
     
    -#[no_mangle]
    -/// handle an interrupt, exception, or system call from user space
    -pub fn trap_handler() -> ! {
    -    set_kernel_trap_entry();
    -    let scause = scause::read();
    -    let stval = stval::read();
    -    match scause.cause() {
    -        Trap::Exception(Exception::UserEnvCall) => {
    -            // jump to next instruction anyway
    -            let mut cx = current_trap_cx();
    -            cx.sepc += 4;
    -            // get system call return value
    -            let result = syscall(cx.x[17], [cx.x[10], cx.x[11], cx.x[12]]);
    -            // cx is changed during sys_exec, so we have to call it again
    -            cx = current_trap_cx();
    -            cx.x[10] = result as usize;
    +#[no_mangle]
    +/// handle an interrupt, exception, or system call from user space
    +pub fn trap_handler() -> ! {
    +    set_kernel_trap_entry();
    +    let scause = scause::read();
    +    let stval = stval::read();
    +    match scause.cause() {
    +        Trap::Exception(Exception::UserEnvCall) => {
    +            // jump to next instruction anyway
    +            let mut cx = current_trap_cx();
    +            cx.sepc += 4;
    +            // get system call return value
    +            let result = syscall(cx.x[17], [cx.x[10], cx.x[11], cx.x[12]]);
    +            // cx is changed during sys_exec, so we have to call it again
    +            cx = current_trap_cx();
    +            cx.x[10] = result as usize;
             }
    -        Trap::Exception(Exception::StoreFault)
    -        | Trap::Exception(Exception::StorePageFault)
    -        | Trap::Exception(Exception::InstructionFault)
    -        | Trap::Exception(Exception::InstructionPageFault)
    -        | Trap::Exception(Exception::LoadFault)
    -        | Trap::Exception(Exception::LoadPageFault) => {
    +        Trap::Exception(Exception::StoreFault)
    +        | Trap::Exception(Exception::StorePageFault)
    +        | Trap::Exception(Exception::InstructionFault)
    +        | Trap::Exception(Exception::InstructionPageFault)
    +        | Trap::Exception(Exception::LoadFault)
    +        | Trap::Exception(Exception::LoadPageFault) => {
                 println!(
                     "[kernel] {:?} in application, bad addr = {:#x}, bad instruction = {:#x}, kernel killed it.",
    -                scause.cause(),
    -                stval,
    -                current_trap_cx().sepc,
    +                scause.cause(),
    +                stval,
    +                current_trap_cx().sepc,
                 );
    -            // page fault exit code
    -            exit_current_and_run_next(-2);
    +            // page fault exit code
    +            exit_current_and_run_next(-2);
             }
    -        Trap::Exception(Exception::IllegalInstruction) => {
    +        Trap::Exception(Exception::IllegalInstruction) => {
                 println!("[kernel] IllegalInstruction in application, kernel killed it.");
    -            // illegal instruction exit code
    -            exit_current_and_run_next(-3);
    +            // illegal instruction exit code
    +            exit_current_and_run_next(-3);
             }
    -        Trap::Interrupt(Interrupt::SupervisorTimer) => {
    -            set_next_trigger();
    -            suspend_current_and_run_next();
    +        Trap::Interrupt(Interrupt::SupervisorTimer) => {
    +            set_next_trigger();
    +            suspend_current_and_run_next();
             }
    -        _ => {
    +        _ => {
                 panic!(
                     "Unsupported trap {:?}, stval = {:#x}!",
    -                scause.cause(),
    -                stval
    +                scause.cause(),
    +                stval
                 );
             }
         }
    -    //println!("before trap_return");
    -    trap_return();
    +    //println!("before trap_return");
    +    trap_return();
     }
     
    -#[no_mangle]
    -/// set the new addr of __restore asm function in TRAMPOLINE page,
    -/// set the reg a0 = trap_cx_ptr, reg a1 = phy addr of usr page table,
    -/// finally, jump to new addr of __restore asm function
    -pub fn trap_return() -> ! {
    -    set_user_trap_entry();
    -    let trap_cx_ptr = TRAP_CONTEXT;
    -    let user_satp = current_user_token();
    -    extern "C" {
    -        fn __alltraps();
    -        fn __restore();
    +#[no_mangle]
    +/// set the new addr of __restore asm function in TRAMPOLINE page,
    +/// set the reg a0 = trap_cx_ptr, reg a1 = phy addr of usr page table,
    +/// finally, jump to new addr of __restore asm function
    +pub fn trap_return() -> ! {
    +    set_user_trap_entry();
    +    let trap_cx_ptr = TRAP_CONTEXT;
    +    let user_satp = current_user_token();
    +    extern "C" {
    +        fn __alltraps();
    +        fn __restore();
         }
    -    let restore_va = __restore as usize - __alltraps as usize + TRAMPOLINE;
    -    unsafe {
    +    let restore_va = __restore as usize - __alltraps as usize + TRAMPOLINE;
    +    unsafe {
             asm!(
                 "fence.i",
                 "jr {restore_va}",
    -            restore_va = in(reg) restore_va,
    -            in("a0") trap_cx_ptr,
    -            in("a1") user_satp,
    -            options(noreturn)
    +            restore_va = in(reg) restore_va,
    +            in("a0") trap_cx_ptr,
    +            in("a1") user_satp,
    +            options(noreturn)
             );
         }
     }
     
    -#[no_mangle]
    -/// Unimplement: traps/interrupts/exceptions from kernel mode
    -/// Todo: Chapter 9: I/O device
    -pub fn trap_from_kernel() -> ! {
    -    use riscv::register::sepc;
    -    println!("stval = {:#x}, sepc = {:#x}", stval::read(), sepc::read());
    -    panic!("a trap {:?} from kernel!", scause::read().cause());
    +#[no_mangle]
    +/// Unimplement: traps/interrupts/exceptions from kernel mode
    +/// Todo: Chapter 9: I/O device
    +pub fn trap_from_kernel() -> ! {
    +    use riscv::register::sepc;
    +    println!("stval = {:#x}, sepc = {:#x}", stval::read(), sepc::read());
    +    panic!("a trap {:?} from kernel!", scause::read().cause());
     }
     
    -pub use context::TrapContext;
    -
    -
    - \ No newline at end of file +pub use context::TrapContext; + \ No newline at end of file diff --git a/ch6-dev/COPYRIGHT.txt b/ch6-dev/static.files/COPYRIGHT-23e9bde6c69aea69.txt similarity index 83% rename from ch6-dev/COPYRIGHT.txt rename to ch6-dev/static.files/COPYRIGHT-23e9bde6c69aea69.txt index c2629a83..1447df79 100644 --- a/ch6-dev/COPYRIGHT.txt +++ b/ch6-dev/static.files/COPYRIGHT-23e9bde6c69aea69.txt @@ -1,9 +1,10 @@ +# REUSE-IgnoreStart + These documentation pages include resources by third parties. This copyright file applies only to those resources. The following third party resources are included, and carry their own copyright notices and license terms: -* Fira Sans (FiraSans-Regular.woff2, FiraSans-Medium.woff2, - FiraSans-Regular.woff, FiraSans-Medium.woff): +* Fira Sans (FiraSans-Regular.woff2, FiraSans-Medium.woff2): Copyright (c) 2014, Mozilla Foundation https://mozilla.org/ with Reserved Font Name Fira Sans. @@ -25,9 +26,7 @@ included, and carry their own copyright notices and license terms: Licensed under the MIT license (see LICENSE-MIT.txt). * Source Code Pro (SourceCodePro-Regular.ttf.woff2, - SourceCodePro-Semibold.ttf.woff2, SourceCodePro-It.ttf.woff2, - SourceCodePro-Regular.ttf.woff, SourceCodePro-Semibold.ttf.woff, - SourceCodePro-It.ttf.woff): + SourceCodePro-Semibold.ttf.woff2, SourceCodePro-It.ttf.woff2): Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark @@ -37,8 +36,7 @@ included, and carry their own copyright notices and license terms: See SourceCodePro-LICENSE.txt. * Source Serif 4 (SourceSerif4-Regular.ttf.woff2, SourceSerif4-Bold.ttf.woff2, - SourceSerif4-It.ttf.woff2, SourceSerif4-Regular.ttf.woff, - SourceSerif4-Bold.ttf.woff, SourceSerif4-It.ttf.woff): + SourceSerif4-It.ttf.woff2): Copyright 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe in the United @@ -48,3 +46,5 @@ included, and carry their own copyright notices and license terms: See SourceSerif4-LICENSE.md. This copyright file is intended to be distributed with rustdoc output. + +# REUSE-IgnoreEnd diff --git a/ch6-dev/FiraSans-LICENSE.txt b/ch6-dev/static.files/FiraSans-LICENSE-db4b642586e02d97.txt similarity index 99% rename from ch6-dev/FiraSans-LICENSE.txt rename to ch6-dev/static.files/FiraSans-LICENSE-db4b642586e02d97.txt index ff9afab0..d7e9c149 100644 --- a/ch6-dev/FiraSans-LICENSE.txt +++ b/ch6-dev/static.files/FiraSans-LICENSE-db4b642586e02d97.txt @@ -1,3 +1,5 @@ +// REUSE-IgnoreStart + Digitized data copyright (c) 2012-2015, The Mozilla Foundation and Telefonica S.A. with Reserved Font Name < Fira >, @@ -92,3 +94,5 @@ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE. + +// REUSE-IgnoreEnd diff --git a/ch6-dev/FiraSans-Medium.woff2 b/ch6-dev/static.files/FiraSans-Medium-8f9a781e4970d388.woff2 similarity index 100% rename from ch6-dev/FiraSans-Medium.woff2 rename to ch6-dev/static.files/FiraSans-Medium-8f9a781e4970d388.woff2 diff --git a/ch6-dev/FiraSans-Regular.woff2 b/ch6-dev/static.files/FiraSans-Regular-018c141bf0843ffd.woff2 similarity index 100% rename from ch6-dev/FiraSans-Regular.woff2 rename to ch6-dev/static.files/FiraSans-Regular-018c141bf0843ffd.woff2 diff --git a/ch6-dev/LICENSE-APACHE.txt b/ch6-dev/static.files/LICENSE-APACHE-b91fa81cba47b86a.txt similarity index 100% rename from ch6-dev/LICENSE-APACHE.txt rename to ch6-dev/static.files/LICENSE-APACHE-b91fa81cba47b86a.txt diff --git a/ch6-dev/LICENSE-MIT.txt b/ch6-dev/static.files/LICENSE-MIT-65090b722b3f6c56.txt similarity index 100% rename from ch6-dev/LICENSE-MIT.txt rename to ch6-dev/static.files/LICENSE-MIT-65090b722b3f6c56.txt diff --git a/ch6-dev/NanumBarunGothic.ttf.woff2 b/ch6-dev/static.files/NanumBarunGothic-0f09457c7a19b7c6.ttf.woff2 similarity index 100% rename from ch6-dev/NanumBarunGothic.ttf.woff2 rename to ch6-dev/static.files/NanumBarunGothic-0f09457c7a19b7c6.ttf.woff2 diff --git a/ch6-dev/NanumBarunGothic-LICENSE.txt b/ch6-dev/static.files/NanumBarunGothic-LICENSE-18c5adf4b52b4041.txt similarity index 99% rename from ch6-dev/NanumBarunGothic-LICENSE.txt rename to ch6-dev/static.files/NanumBarunGothic-LICENSE-18c5adf4b52b4041.txt index 0bf46682..4b3edc29 100644 --- a/ch6-dev/NanumBarunGothic-LICENSE.txt +++ b/ch6-dev/static.files/NanumBarunGothic-LICENSE-18c5adf4b52b4041.txt @@ -1,3 +1,5 @@ +// REUSE-IgnoreStart + Copyright (c) 2010, NAVER Corporation (https://www.navercorp.com/), with Reserved Font Name Nanum, Naver Nanum, NanumGothic, Naver NanumGothic, @@ -97,3 +99,5 @@ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE. + +// REUSE-IgnoreEnd diff --git a/ch6-dev/SourceCodePro-It.ttf.woff2 b/ch6-dev/static.files/SourceCodePro-It-1cc31594bf4f1f79.ttf.woff2 similarity index 100% rename from ch6-dev/SourceCodePro-It.ttf.woff2 rename to ch6-dev/static.files/SourceCodePro-It-1cc31594bf4f1f79.ttf.woff2 diff --git a/ch6-dev/SourceCodePro-LICENSE.txt b/ch6-dev/static.files/SourceCodePro-LICENSE-d180d465a756484a.txt similarity index 99% rename from ch6-dev/SourceCodePro-LICENSE.txt rename to ch6-dev/static.files/SourceCodePro-LICENSE-d180d465a756484a.txt index 07542572..0d2941e1 100644 --- a/ch6-dev/SourceCodePro-LICENSE.txt +++ b/ch6-dev/static.files/SourceCodePro-LICENSE-d180d465a756484a.txt @@ -1,3 +1,5 @@ +// REUSE-IgnoreStart + Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries. This Font Software is licensed under the SIL Open Font License, Version 1.1. @@ -91,3 +93,5 @@ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE. + +// REUSE-IgnoreEnd diff --git a/ch6-dev/SourceCodePro-Regular.ttf.woff2 b/ch6-dev/static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2 similarity index 100% rename from ch6-dev/SourceCodePro-Regular.ttf.woff2 rename to ch6-dev/static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2 diff --git a/ch6-dev/SourceCodePro-Semibold.ttf.woff2 b/ch6-dev/static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2 similarity index 100% rename from ch6-dev/SourceCodePro-Semibold.ttf.woff2 rename to ch6-dev/static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2 diff --git a/ch6-dev/static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2 b/ch6-dev/static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2 new file mode 100644 index 00000000..181a07f6 Binary files /dev/null and b/ch6-dev/static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2 differ diff --git a/ch6-dev/static.files/SourceSerif4-It-acdfaf1a8af734b1.ttf.woff2 b/ch6-dev/static.files/SourceSerif4-It-acdfaf1a8af734b1.ttf.woff2 new file mode 100644 index 00000000..2ae08a7b Binary files /dev/null and b/ch6-dev/static.files/SourceSerif4-It-acdfaf1a8af734b1.ttf.woff2 differ diff --git a/ch6-dev/SourceSerif4-LICENSE.md b/ch6-dev/static.files/SourceSerif4-LICENSE-3bb119e13b1258b7.md similarity index 94% rename from ch6-dev/SourceSerif4-LICENSE.md rename to ch6-dev/static.files/SourceSerif4-LICENSE-3bb119e13b1258b7.md index 68ea1892..175fa4f4 100644 --- a/ch6-dev/SourceSerif4-LICENSE.md +++ b/ch6-dev/static.files/SourceSerif4-LICENSE-3bb119e13b1258b7.md @@ -1,4 +1,7 @@ + + Copyright 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe in the United States and/or other countries. +Copyright 2014 - 2023 Adobe (http://www.adobe.com/), with Reserved Font Name ‘Source’. All Rights Reserved. Source is a trademark of Adobe in the United States and/or other countries. This Font Software is licensed under the SIL Open Font License, Version 1.1. @@ -91,3 +94,5 @@ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE. + + diff --git a/ch6-dev/static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2 b/ch6-dev/static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2 new file mode 100644 index 00000000..0263fc30 Binary files /dev/null and b/ch6-dev/static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2 differ diff --git a/ch6-dev/clipboard.svg b/ch6-dev/static.files/clipboard-7571035ce49a181d.svg similarity index 100% rename from ch6-dev/clipboard.svg rename to ch6-dev/static.files/clipboard-7571035ce49a181d.svg diff --git a/ch6-dev/favicon-16x16.png b/ch6-dev/static.files/favicon-16x16-8b506e7a72182f1c.png similarity index 100% rename from ch6-dev/favicon-16x16.png rename to ch6-dev/static.files/favicon-16x16-8b506e7a72182f1c.png diff --git a/ch6-dev/favicon.svg b/ch6-dev/static.files/favicon-2c020d218678b618.svg similarity index 100% rename from ch6-dev/favicon.svg rename to ch6-dev/static.files/favicon-2c020d218678b618.svg diff --git a/ch6-dev/favicon-32x32.png b/ch6-dev/static.files/favicon-32x32-422f7d1d52889060.png similarity index 100% rename from ch6-dev/favicon-32x32.png rename to ch6-dev/static.files/favicon-32x32-422f7d1d52889060.png diff --git a/ch6-dev/static.files/main-c5bd66d33317d69f.js b/ch6-dev/static.files/main-c5bd66d33317d69f.js new file mode 100644 index 00000000..43133d66 --- /dev/null +++ b/ch6-dev/static.files/main-c5bd66d33317d69f.js @@ -0,0 +1,12 @@ +"use strict";window.RUSTDOC_TOOLTIP_HOVER_MS=300;window.RUSTDOC_TOOLTIP_HOVER_EXIT_MS=450;function resourcePath(basename,extension){return getVar("root-path")+basename+getVar("resource-suffix")+extension}function hideMain(){addClass(document.getElementById(MAIN_ID),"hidden")}function showMain(){removeClass(document.getElementById(MAIN_ID),"hidden")}function elemIsInParent(elem,parent){while(elem&&elem!==document.body){if(elem===parent){return true}elem=elem.parentElement}return false}function blurHandler(event,parentElem,hideCallback){if(!elemIsInParent(document.activeElement,parentElem)&&!elemIsInParent(event.relatedTarget,parentElem)){hideCallback()}}window.rootPath=getVar("root-path");window.currentCrate=getVar("current-crate");function setMobileTopbar(){const mobileTopbar=document.querySelector(".mobile-topbar");const locationTitle=document.querySelector(".sidebar h2.location");if(mobileTopbar&&locationTitle){const mobileTitle=document.createElement("h2");mobileTitle.innerHTML=locationTitle.innerHTML;mobileTopbar.appendChild(mobileTitle)}}function getVirtualKey(ev){if("key"in ev&&typeof ev.key!=="undefined"){return ev.key}const c=ev.charCode||ev.keyCode;if(c===27){return"Escape"}return String.fromCharCode(c)}const MAIN_ID="main-content";const SETTINGS_BUTTON_ID="settings-menu";const ALTERNATIVE_DISPLAY_ID="alternative-display";const NOT_DISPLAYED_ID="not-displayed";const HELP_BUTTON_ID="help-button";function getSettingsButton(){return document.getElementById(SETTINGS_BUTTON_ID)}function getHelpButton(){return document.getElementById(HELP_BUTTON_ID)}function getNakedUrl(){return window.location.href.split("?")[0].split("#")[0]}function insertAfter(newNode,referenceNode){referenceNode.parentNode.insertBefore(newNode,referenceNode.nextSibling)}function getOrCreateSection(id,classes){let el=document.getElementById(id);if(!el){el=document.createElement("section");el.id=id;el.className=classes;insertAfter(el,document.getElementById(MAIN_ID))}return el}function getAlternativeDisplayElem(){return getOrCreateSection(ALTERNATIVE_DISPLAY_ID,"content hidden")}function getNotDisplayedElem(){return getOrCreateSection(NOT_DISPLAYED_ID,"hidden")}function switchDisplayedElement(elemToDisplay){const el=getAlternativeDisplayElem();if(el.children.length>0){getNotDisplayedElem().appendChild(el.firstElementChild)}if(elemToDisplay===null){addClass(el,"hidden");showMain();return}el.appendChild(elemToDisplay);hideMain();removeClass(el,"hidden")}function browserSupportsHistoryApi(){return window.history&&typeof window.history.pushState==="function"}function preLoadCss(cssUrl){const link=document.createElement("link");link.href=cssUrl;link.rel="preload";link.as="style";document.getElementsByTagName("head")[0].appendChild(link)}(function(){const isHelpPage=window.location.pathname.endsWith("/help.html");function loadScript(url){const script=document.createElement("script");script.src=url;document.head.append(script)}getSettingsButton().onclick=event=>{if(event.ctrlKey||event.altKey||event.metaKey){return}window.hideAllModals(false);addClass(getSettingsButton(),"rotate");event.preventDefault();loadScript(getVar("static-root-path")+getVar("settings-js"));setTimeout(()=>{const themes=getVar("themes").split(",");for(const theme of themes){if(theme!==""){preLoadCss(getVar("root-path")+theme+".css")}}},0)};window.searchState={loadingText:"Loading search results...",input:document.getElementsByClassName("search-input")[0],outputElement:()=>{let el=document.getElementById("search");if(!el){el=document.createElement("section");el.id="search";getNotDisplayedElem().appendChild(el)}return el},title:document.title,titleBeforeSearch:document.title,timeout:null,currentTab:0,focusedByTab:[null,null,null],clearInputTimeout:()=>{if(searchState.timeout!==null){clearTimeout(searchState.timeout);searchState.timeout=null}},isDisplayed:()=>searchState.outputElement().parentElement.id===ALTERNATIVE_DISPLAY_ID,focus:()=>{searchState.input.focus()},defocus:()=>{searchState.input.blur()},showResults:search=>{if(search===null||typeof search==="undefined"){search=searchState.outputElement()}switchDisplayedElement(search);searchState.mouseMovedAfterSearch=false;document.title=searchState.title},removeQueryParameters:()=>{document.title=searchState.titleBeforeSearch;if(browserSupportsHistoryApi()){history.replaceState(null,"",getNakedUrl()+window.location.hash)}},hideResults:()=>{switchDisplayedElement(null);searchState.removeQueryParameters()},getQueryStringParams:()=>{const params={};window.location.search.substring(1).split("&").map(s=>{const pair=s.split("=");params[decodeURIComponent(pair[0])]=typeof pair[1]==="undefined"?null:decodeURIComponent(pair[1])});return params},setup:()=>{const search_input=searchState.input;if(!searchState.input){return}let searchLoaded=false;function loadSearch(){if(!searchLoaded){searchLoaded=true;loadScript(getVar("static-root-path")+getVar("search-js"));loadScript(resourcePath("search-index",".js"))}}search_input.addEventListener("focus",()=>{search_input.origPlaceholder=search_input.placeholder;search_input.placeholder="Type your search here.";loadSearch()});if(search_input.value!==""){loadSearch()}const params=searchState.getQueryStringParams();if(params.search!==undefined){searchState.setLoadingSearch();loadSearch()}},setLoadingSearch:()=>{const search=searchState.outputElement();search.innerHTML="

    "+searchState.loadingText+"

    ";searchState.showResults(search)},};const toggleAllDocsId="toggle-all-docs";let savedHash="";function handleHashes(ev){if(ev!==null&&searchState.isDisplayed()&&ev.newURL){switchDisplayedElement(null);const hash=ev.newURL.slice(ev.newURL.indexOf("#")+1);if(browserSupportsHistoryApi()){history.replaceState(null,"",getNakedUrl()+window.location.search+"#"+hash)}const elem=document.getElementById(hash);if(elem){elem.scrollIntoView()}}const pageId=window.location.hash.replace(/^#/,"");if(savedHash!==pageId){savedHash=pageId;if(pageId!==""){expandSection(pageId)}}}function onHashChange(ev){hideSidebar();handleHashes(ev)}function openParentDetails(elem){while(elem){if(elem.tagName==="DETAILS"){elem.open=true}elem=elem.parentNode}}function expandSection(id){openParentDetails(document.getElementById(id))}function handleEscape(ev){searchState.clearInputTimeout();searchState.hideResults();ev.preventDefault();searchState.defocus();window.hideAllModals(true)}function handleShortcut(ev){const disableShortcuts=getSettingValue("disable-shortcuts")==="true";if(ev.ctrlKey||ev.altKey||ev.metaKey||disableShortcuts){return}if(document.activeElement.tagName==="INPUT"&&document.activeElement.type!=="checkbox"&&document.activeElement.type!=="radio"){switch(getVirtualKey(ev)){case"Escape":handleEscape(ev);break}}else{switch(getVirtualKey(ev)){case"Escape":handleEscape(ev);break;case"s":case"S":ev.preventDefault();searchState.focus();break;case"+":ev.preventDefault();expandAllDocs();break;case"-":ev.preventDefault();collapseAllDocs();break;case"?":showHelp();break;default:break}}}document.addEventListener("keypress",handleShortcut);document.addEventListener("keydown",handleShortcut);function addSidebarItems(){if(!window.SIDEBAR_ITEMS){return}const sidebar=document.getElementsByClassName("sidebar-elems")[0];function block(shortty,id,longty){const filtered=window.SIDEBAR_ITEMS[shortty];if(!filtered){return}const h3=document.createElement("h3");h3.innerHTML=`${longty}`;const ul=document.createElement("ul");ul.className="block "+shortty;for(const name of filtered){let path;if(shortty==="mod"){path=name+"/index.html"}else{path=shortty+"."+name+".html"}const current_page=document.location.href.split("/").pop();const link=document.createElement("a");link.href=path;if(path===current_page){link.className="current"}link.textContent=name;const li=document.createElement("li");li.appendChild(link);ul.appendChild(li)}sidebar.appendChild(h3);sidebar.appendChild(ul)}if(sidebar){block("primitive","primitives","Primitive Types");block("mod","modules","Modules");block("macro","macros","Macros");block("struct","structs","Structs");block("enum","enums","Enums");block("union","unions","Unions");block("constant","constants","Constants");block("static","static","Statics");block("trait","traits","Traits");block("fn","functions","Functions");block("type","types","Type Aliases");block("foreigntype","foreign-types","Foreign Types");block("keyword","keywords","Keywords");block("traitalias","trait-aliases","Trait Aliases")}}window.register_implementors=imp=>{const implementors=document.getElementById("implementors-list");const synthetic_implementors=document.getElementById("synthetic-implementors-list");const inlined_types=new Set();const TEXT_IDX=0;const SYNTHETIC_IDX=1;const TYPES_IDX=2;if(synthetic_implementors){onEachLazy(synthetic_implementors.getElementsByClassName("impl"),el=>{const aliases=el.getAttribute("data-aliases");if(!aliases){return}aliases.split(",").forEach(alias=>{inlined_types.add(alias)})})}let currentNbImpls=implementors.getElementsByClassName("impl").length;const traitName=document.querySelector(".main-heading h1 > .trait").textContent;const baseIdName="impl-"+traitName+"-";const libs=Object.getOwnPropertyNames(imp);const script=document.querySelector("script[data-ignore-extern-crates]");const ignoreExternCrates=new Set((script?script.getAttribute("data-ignore-extern-crates"):"").split(","));for(const lib of libs){if(lib===window.currentCrate||ignoreExternCrates.has(lib)){continue}const structs=imp[lib];struct_loop:for(const struct of structs){const list=struct[SYNTHETIC_IDX]?synthetic_implementors:implementors;if(struct[SYNTHETIC_IDX]){for(const struct_type of struct[TYPES_IDX]){if(inlined_types.has(struct_type)){continue struct_loop}inlined_types.add(struct_type)}}const code=document.createElement("h3");code.innerHTML=struct[TEXT_IDX];addClass(code,"code-header");onEachLazy(code.getElementsByTagName("a"),elem=>{const href=elem.getAttribute("href");if(href&&!/^(?:[a-z+]+:)?\/\//.test(href)){elem.setAttribute("href",window.rootPath+href)}});const currentId=baseIdName+currentNbImpls;const anchor=document.createElement("a");anchor.href="#"+currentId;addClass(anchor,"anchor");const display=document.createElement("div");display.id=currentId;addClass(display,"impl");display.appendChild(anchor);display.appendChild(code);list.appendChild(display);currentNbImpls+=1}}};if(window.pending_implementors){window.register_implementors(window.pending_implementors)}function addSidebarCrates(){if(!window.ALL_CRATES){return}const sidebarElems=document.getElementsByClassName("sidebar-elems")[0];if(!sidebarElems){return}const h3=document.createElement("h3");h3.innerHTML="Crates";const ul=document.createElement("ul");ul.className="block crate";for(const crate of window.ALL_CRATES){const link=document.createElement("a");link.href=window.rootPath+crate+"/index.html";if(window.rootPath!=="./"&&crate===window.currentCrate){link.className="current"}link.textContent=crate;const li=document.createElement("li");li.appendChild(link);ul.appendChild(li)}sidebarElems.appendChild(h3);sidebarElems.appendChild(ul)}function expandAllDocs(){const innerToggle=document.getElementById(toggleAllDocsId);removeClass(innerToggle,"will-expand");onEachLazy(document.getElementsByClassName("toggle"),e=>{if(!hasClass(e,"type-contents-toggle")&&!hasClass(e,"more-examples-toggle")){e.open=true}});innerToggle.title="collapse all docs";innerToggle.children[0].innerText="\u2212"}function collapseAllDocs(){const innerToggle=document.getElementById(toggleAllDocsId);addClass(innerToggle,"will-expand");onEachLazy(document.getElementsByClassName("toggle"),e=>{if(e.parentNode.id!=="implementations-list"||(!hasClass(e,"implementors-toggle")&&!hasClass(e,"type-contents-toggle"))){e.open=false}});innerToggle.title="expand all docs";innerToggle.children[0].innerText="+"}function toggleAllDocs(){const innerToggle=document.getElementById(toggleAllDocsId);if(!innerToggle){return}if(hasClass(innerToggle,"will-expand")){expandAllDocs()}else{collapseAllDocs()}}(function(){const toggles=document.getElementById(toggleAllDocsId);if(toggles){toggles.onclick=toggleAllDocs}const hideMethodDocs=getSettingValue("auto-hide-method-docs")==="true";const hideImplementations=getSettingValue("auto-hide-trait-implementations")==="true";const hideLargeItemContents=getSettingValue("auto-hide-large-items")!=="false";function setImplementorsTogglesOpen(id,open){const list=document.getElementById(id);if(list!==null){onEachLazy(list.getElementsByClassName("implementors-toggle"),e=>{e.open=open})}}if(hideImplementations){setImplementorsTogglesOpen("trait-implementations-list",false);setImplementorsTogglesOpen("blanket-implementations-list",false)}onEachLazy(document.getElementsByClassName("toggle"),e=>{if(!hideLargeItemContents&&hasClass(e,"type-contents-toggle")){e.open=true}if(hideMethodDocs&&hasClass(e,"method-toggle")){e.open=false}})}());window.rustdoc_add_line_numbers_to_examples=()=>{onEachLazy(document.getElementsByClassName("rust-example-rendered"),x=>{const parent=x.parentNode;const line_numbers=parent.querySelectorAll(".example-line-numbers");if(line_numbers.length>0){return}const count=x.textContent.split("\n").length;const elems=[];for(let i=0;i{onEachLazy(document.getElementsByClassName("rust-example-rendered"),x=>{const parent=x.parentNode;const line_numbers=parent.querySelectorAll(".example-line-numbers");for(const node of line_numbers){parent.removeChild(node)}})};if(getSettingValue("line-numbers")==="true"){window.rustdoc_add_line_numbers_to_examples()}function showSidebar(){window.hideAllModals(false);const sidebar=document.getElementsByClassName("sidebar")[0];addClass(sidebar,"shown")}function hideSidebar(){const sidebar=document.getElementsByClassName("sidebar")[0];removeClass(sidebar,"shown")}window.addEventListener("resize",()=>{if(window.CURRENT_TOOLTIP_ELEMENT){const base=window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE;const force_visible=base.TOOLTIP_FORCE_VISIBLE;hideTooltip(false);if(force_visible){showTooltip(base);base.TOOLTIP_FORCE_VISIBLE=true}}});const mainElem=document.getElementById(MAIN_ID);if(mainElem){mainElem.addEventListener("click",hideSidebar)}onEachLazy(document.querySelectorAll("a[href^='#']"),el=>{el.addEventListener("click",()=>{expandSection(el.hash.slice(1));hideSidebar()})});onEachLazy(document.querySelectorAll(".toggle > summary:not(.hideme)"),el=>{el.addEventListener("click",e=>{if(e.target.tagName!=="SUMMARY"&&e.target.tagName!=="A"){e.preventDefault()}})});function showTooltip(e){const notable_ty=e.getAttribute("data-notable-ty");if(!window.NOTABLE_TRAITS&¬able_ty){const data=document.getElementById("notable-traits-data");if(data){window.NOTABLE_TRAITS=JSON.parse(data.innerText)}else{throw new Error("showTooltip() called with notable without any notable traits!")}}if(window.CURRENT_TOOLTIP_ELEMENT&&window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE===e){clearTooltipHoverTimeout(window.CURRENT_TOOLTIP_ELEMENT);return}window.hideAllModals(false);const wrapper=document.createElement("div");if(notable_ty){wrapper.innerHTML="
    "+window.NOTABLE_TRAITS[notable_ty]+"
    "}else{if(e.getAttribute("title")!==null){e.setAttribute("data-title",e.getAttribute("title"));e.removeAttribute("title")}if(e.getAttribute("data-title")!==null){const titleContent=document.createElement("div");titleContent.className="content";titleContent.appendChild(document.createTextNode(e.getAttribute("data-title")));wrapper.appendChild(titleContent)}}wrapper.className="tooltip popover";const focusCatcher=document.createElement("div");focusCatcher.setAttribute("tabindex","0");focusCatcher.onfocus=hideTooltip;wrapper.appendChild(focusCatcher);const pos=e.getBoundingClientRect();wrapper.style.top=(pos.top+window.scrollY+pos.height)+"px";wrapper.style.left=0;wrapper.style.right="auto";wrapper.style.visibility="hidden";const body=document.getElementsByTagName("body")[0];body.appendChild(wrapper);const wrapperPos=wrapper.getBoundingClientRect();const finalPos=pos.left+window.scrollX-wrapperPos.width+24;if(finalPos>0){wrapper.style.left=finalPos+"px"}else{wrapper.style.setProperty("--popover-arrow-offset",(wrapperPos.right-pos.right+4)+"px")}wrapper.style.visibility="";window.CURRENT_TOOLTIP_ELEMENT=wrapper;window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE=e;clearTooltipHoverTimeout(window.CURRENT_TOOLTIP_ELEMENT);wrapper.onpointerenter=ev=>{if(ev.pointerType!=="mouse"){return}clearTooltipHoverTimeout(e)};wrapper.onpointerleave=ev=>{if(ev.pointerType!=="mouse"){return}if(!e.TOOLTIP_FORCE_VISIBLE&&!elemIsInParent(ev.relatedTarget,e)){setTooltipHoverTimeout(e,false);addClass(wrapper,"fade-out")}}}function setTooltipHoverTimeout(element,show){clearTooltipHoverTimeout(element);if(!show&&!window.CURRENT_TOOLTIP_ELEMENT){return}if(show&&window.CURRENT_TOOLTIP_ELEMENT){return}if(window.CURRENT_TOOLTIP_ELEMENT&&window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE!==element){return}element.TOOLTIP_HOVER_TIMEOUT=setTimeout(()=>{if(show){showTooltip(element)}else if(!element.TOOLTIP_FORCE_VISIBLE){hideTooltip(false)}},show?window.RUSTDOC_TOOLTIP_HOVER_MS:window.RUSTDOC_TOOLTIP_HOVER_EXIT_MS)}function clearTooltipHoverTimeout(element){if(element.TOOLTIP_HOVER_TIMEOUT!==undefined){removeClass(window.CURRENT_TOOLTIP_ELEMENT,"fade-out");clearTimeout(element.TOOLTIP_HOVER_TIMEOUT);delete element.TOOLTIP_HOVER_TIMEOUT}}function tooltipBlurHandler(event){if(window.CURRENT_TOOLTIP_ELEMENT&&!elemIsInParent(document.activeElement,window.CURRENT_TOOLTIP_ELEMENT)&&!elemIsInParent(event.relatedTarget,window.CURRENT_TOOLTIP_ELEMENT)&&!elemIsInParent(document.activeElement,window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE)&&!elemIsInParent(event.relatedTarget,window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE)){setTimeout(()=>hideTooltip(false),0)}}function hideTooltip(focus){if(window.CURRENT_TOOLTIP_ELEMENT){if(window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE.TOOLTIP_FORCE_VISIBLE){if(focus){window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE.focus()}window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE.TOOLTIP_FORCE_VISIBLE=false}const body=document.getElementsByTagName("body")[0];body.removeChild(window.CURRENT_TOOLTIP_ELEMENT);clearTooltipHoverTimeout(window.CURRENT_TOOLTIP_ELEMENT);window.CURRENT_TOOLTIP_ELEMENT=null}}onEachLazy(document.getElementsByClassName("tooltip"),e=>{e.onclick=()=>{e.TOOLTIP_FORCE_VISIBLE=e.TOOLTIP_FORCE_VISIBLE?false:true;if(window.CURRENT_TOOLTIP_ELEMENT&&!e.TOOLTIP_FORCE_VISIBLE){hideTooltip(true)}else{showTooltip(e);window.CURRENT_TOOLTIP_ELEMENT.setAttribute("tabindex","0");window.CURRENT_TOOLTIP_ELEMENT.focus();window.CURRENT_TOOLTIP_ELEMENT.onblur=tooltipBlurHandler}return false};e.onpointerenter=ev=>{if(ev.pointerType!=="mouse"){return}setTooltipHoverTimeout(e,true)};e.onpointermove=ev=>{if(ev.pointerType!=="mouse"){return}setTooltipHoverTimeout(e,true)};e.onpointerleave=ev=>{if(ev.pointerType!=="mouse"){return}if(!e.TOOLTIP_FORCE_VISIBLE&&!elemIsInParent(ev.relatedTarget,window.CURRENT_TOOLTIP_ELEMENT)){setTooltipHoverTimeout(e,false);addClass(window.CURRENT_TOOLTIP_ELEMENT,"fade-out")}}});const sidebar_menu_toggle=document.getElementsByClassName("sidebar-menu-toggle")[0];if(sidebar_menu_toggle){sidebar_menu_toggle.addEventListener("click",()=>{const sidebar=document.getElementsByClassName("sidebar")[0];if(!hasClass(sidebar,"shown")){showSidebar()}else{hideSidebar()}})}function helpBlurHandler(event){blurHandler(event,getHelpButton(),window.hidePopoverMenus)}function buildHelpMenu(){const book_info=document.createElement("span");const channel=getVar("channel");book_info.className="top";book_info.innerHTML=`You can find more information in \ +the rustdoc book.`;const shortcuts=[["?","Show this help dialog"],["S","Focus the search field"],["↑","Move up in search results"],["↓","Move down in search results"],["← / →","Switch result tab (when results focused)"],["⏎","Go to active search result"],["+","Expand all sections"],["-","Collapse all sections"],].map(x=>"
    "+x[0].split(" ").map((y,index)=>((index&1)===0?""+y+"":" "+y+" ")).join("")+"
    "+x[1]+"
    ").join("");const div_shortcuts=document.createElement("div");addClass(div_shortcuts,"shortcuts");div_shortcuts.innerHTML="

    Keyboard Shortcuts

    "+shortcuts+"
    ";const infos=[`For a full list of all search features, take a look here.`,"Prefix searches with a type followed by a colon (e.g., fn:) to \ + restrict the search to a given item kind.","Accepted kinds are: fn, mod, struct, \ + enum, trait, type, macro, \ + and const.","Search functions by type signature (e.g., vec -> usize or \ + -> vec or String, enum:Cow -> bool)","You can look for items with an exact name by putting double quotes around \ + your request: \"string\"","Look for functions that accept or return \ + slices and \ + arrays by writing \ + square brackets (e.g., -> [u8] or [] -> Option)","Look for items inside another one by searching for a path: vec::Vec",].map(x=>"

    "+x+"

    ").join("");const div_infos=document.createElement("div");addClass(div_infos,"infos");div_infos.innerHTML="

    Search Tricks

    "+infos;const rustdoc_version=document.createElement("span");rustdoc_version.className="bottom";const rustdoc_version_code=document.createElement("code");rustdoc_version_code.innerText="rustdoc "+getVar("rustdoc-version");rustdoc_version.appendChild(rustdoc_version_code);const container=document.createElement("div");if(!isHelpPage){container.className="popover"}container.id="help";container.style.display="none";const side_by_side=document.createElement("div");side_by_side.className="side-by-side";side_by_side.appendChild(div_shortcuts);side_by_side.appendChild(div_infos);container.appendChild(book_info);container.appendChild(side_by_side);container.appendChild(rustdoc_version);if(isHelpPage){const help_section=document.createElement("section");help_section.appendChild(container);document.getElementById("main-content").appendChild(help_section);container.style.display="block"}else{const help_button=getHelpButton();help_button.appendChild(container);container.onblur=helpBlurHandler;help_button.onblur=helpBlurHandler;help_button.children[0].onblur=helpBlurHandler}return container}window.hideAllModals=switchFocus=>{hideSidebar();window.hidePopoverMenus();hideTooltip(switchFocus)};window.hidePopoverMenus=()=>{onEachLazy(document.querySelectorAll(".search-form .popover"),elem=>{elem.style.display="none"})};function getHelpMenu(buildNeeded){let menu=getHelpButton().querySelector(".popover");if(!menu&&buildNeeded){menu=buildHelpMenu()}return menu}function showHelp(){getHelpButton().querySelector("a").focus();const menu=getHelpMenu(true);if(menu.style.display==="none"){window.hideAllModals();menu.style.display=""}}if(isHelpPage){showHelp();document.querySelector(`#${HELP_BUTTON_ID} > a`).addEventListener("click",event=>{const target=event.target;if(target.tagName!=="A"||target.parentElement.id!==HELP_BUTTON_ID||event.ctrlKey||event.altKey||event.metaKey){return}event.preventDefault()})}else{document.querySelector(`#${HELP_BUTTON_ID} > a`).addEventListener("click",event=>{const target=event.target;if(target.tagName!=="A"||target.parentElement.id!==HELP_BUTTON_ID||event.ctrlKey||event.altKey||event.metaKey){return}event.preventDefault();const menu=getHelpMenu(true);const shouldShowHelp=menu.style.display==="none";if(shouldShowHelp){showHelp()}else{window.hidePopoverMenus()}})}setMobileTopbar();addSidebarItems();addSidebarCrates();onHashChange(null);window.addEventListener("hashchange",onHashChange);searchState.setup()}());(function(){let reset_button_timeout=null;const but=document.getElementById("copy-path");if(!but){return}but.onclick=()=>{const parent=but.parentElement;const path=[];onEach(parent.childNodes,child=>{if(child.tagName==="A"){path.push(child.textContent)}});const el=document.createElement("textarea");el.value=path.join("::");el.setAttribute("readonly","");el.style.position="absolute";el.style.left="-9999px";document.body.appendChild(el);el.select();document.execCommand("copy");document.body.removeChild(el);but.children[0].style.display="none";let tmp;if(but.childNodes.length<2){tmp=document.createTextNode("✓");but.appendChild(tmp)}else{onEachLazy(but.childNodes,e=>{if(e.nodeType===Node.TEXT_NODE){tmp=e;return true}});tmp.textContent="✓"}if(reset_button_timeout!==null){window.clearTimeout(reset_button_timeout)}function reset_button(){tmp.textContent="";reset_button_timeout=null;but.children[0].style.display=""}reset_button_timeout=window.setTimeout(reset_button,1000)}}()) \ No newline at end of file diff --git a/ch6-dev/normalize.css b/ch6-dev/static.files/normalize-76eba96aa4d2e634.css similarity index 100% rename from ch6-dev/normalize.css rename to ch6-dev/static.files/normalize-76eba96aa4d2e634.css diff --git a/ch6-dev/static.files/noscript-5d8b3c7633ad77ba.css b/ch6-dev/static.files/noscript-5d8b3c7633ad77ba.css new file mode 100644 index 00000000..8c63ef06 --- /dev/null +++ b/ch6-dev/static.files/noscript-5d8b3c7633ad77ba.css @@ -0,0 +1 @@ + #main-content .attributes{margin-left:0 !important;}#copy-path{display:none;}nav.sub{display:none;}.src .sidebar{display:none;}.notable-traits{display:none;}:root{--main-background-color:white;--main-color:black;--settings-input-color:#2196f3;--settings-input-border-color:#717171;--settings-button-color:#000;--settings-button-border-focus:#717171;--sidebar-background-color:#f5f5f5;--sidebar-background-color-hover:#e0e0e0;--code-block-background-color:#f5f5f5;--scrollbar-track-background-color:#dcdcdc;--scrollbar-thumb-background-color:rgba(36,37,39,0.6);--scrollbar-color:rgba(36,37,39,0.6) #d9d9d9;--headings-border-bottom-color:#ddd;--border-color:#e0e0e0;--button-background-color:#fff;--right-side-color:grey;--code-attribute-color:#999;--toggles-color:#999;--toggle-filter:none;--search-input-focused-border-color:#66afe9;--copy-path-button-color:#999;--copy-path-img-filter:invert(50%);--copy-path-img-hover-filter:invert(35%);--codeblock-error-hover-color:rgb(255,0,0);--codeblock-error-color:rgba(255,0,0,.5);--codeblock-ignore-hover-color:rgb(255,142,0);--codeblock-ignore-color:rgba(255,142,0,.6);--warning-border-color:#ff8e00;--type-link-color:#ad378a;--trait-link-color:#6e4fc9;--assoc-item-link-color:#3873ad;--function-link-color:#ad7c37;--macro-link-color:#068000;--keyword-link-color:#3873ad;--mod-link-color:#3873ad;--link-color:#3873ad;--sidebar-link-color:#356da4;--sidebar-current-link-background-color:#fff;--search-result-link-focus-background-color:#ccc;--search-result-border-color:#aaa3;--search-color:#000;--search-error-code-background-color:#d0cccc;--search-results-alias-color:#000;--search-results-grey-color:#999;--search-tab-title-count-color:#888;--search-tab-button-not-selected-border-top-color:#e6e6e6;--search-tab-button-not-selected-background:#e6e6e6;--search-tab-button-selected-border-top-color:#0089ff;--search-tab-button-selected-background:#fff;--stab-background-color:#fff5d6;--stab-code-color:#000;--code-highlight-kw-color:#8959a8;--code-highlight-kw-2-color:#4271ae;--code-highlight-lifetime-color:#b76514;--code-highlight-prelude-color:#4271ae;--code-highlight-prelude-val-color:#c82829;--code-highlight-number-color:#718c00;--code-highlight-string-color:#718c00;--code-highlight-literal-color:#c82829;--code-highlight-attribute-color:#c82829;--code-highlight-self-color:#c82829;--code-highlight-macro-color:#3e999f;--code-highlight-question-mark-color:#ff9011;--code-highlight-comment-color:#8e908c;--code-highlight-doc-comment-color:#4d4d4c;--src-line-numbers-span-color:#c67e2d;--src-line-number-highlighted-background-color:#fdffd3;--test-arrow-color:#f5f5f5;--test-arrow-background-color:rgba(78,139,202,0.2);--test-arrow-hover-color:#f5f5f5;--test-arrow-hover-background-color:rgb(78,139,202);--target-background-color:#fdffd3;--target-border-color:#ad7c37;--kbd-color:#000;--kbd-background:#fafbfc;--kbd-box-shadow-color:#c6cbd1;--rust-logo-filter:initial;--crate-search-div-filter:invert(100%) sepia(0%) saturate(4223%) hue-rotate(289deg) brightness(114%) contrast(76%);--crate-search-div-hover-filter:invert(44%) sepia(18%) saturate(23%) hue-rotate(317deg) brightness(96%) contrast(93%);--crate-search-hover-border:#717171;--src-sidebar-background-selected:#fff;--src-sidebar-background-hover:#e0e0e0;--table-alt-row-background-color:#f5f5f5;--codeblock-link-background:#eee;--scrape-example-toggle-line-background:#ccc;--scrape-example-toggle-line-hover-background:#999;--scrape-example-code-line-highlight:#fcffd6;--scrape-example-code-line-highlight-focus:#f6fdb0;--scrape-example-help-border-color:#555;--scrape-example-help-color:#333;--scrape-example-help-hover-border-color:#000;--scrape-example-help-hover-color:#000;--scrape-example-code-wrapper-background-start:rgba(255,255,255,1);--scrape-example-code-wrapper-background-end:rgba(255,255,255,0);}@media (prefers-color-scheme:dark){:root{--main-background-color:#353535;--main-color:#ddd;--settings-input-color:#2196f3;--settings-input-border-color:#999;--settings-button-color:#000;--settings-button-border-focus:#ffb900;--sidebar-background-color:#505050;--sidebar-background-color-hover:#676767;--code-block-background-color:#2A2A2A;--scrollbar-track-background-color:#717171;--scrollbar-thumb-background-color:rgba(32,34,37,.6);--scrollbar-color:rgba(32,34,37,.6) #5a5a5a;--headings-border-bottom-color:#d2d2d2;--border-color:#e0e0e0;--button-background-color:#f0f0f0;--right-side-color:grey;--code-attribute-color:#999;--toggles-color:#999;--toggle-filter:invert(100%);--search-input-focused-border-color:#008dfd;--copy-path-button-color:#999;--copy-path-img-filter:invert(50%);--copy-path-img-hover-filter:invert(65%);--codeblock-error-hover-color:rgb(255,0,0);--codeblock-error-color:rgba(255,0,0,.5);--codeblock-ignore-hover-color:rgb(255,142,0);--codeblock-ignore-color:rgba(255,142,0,.6);--warning-border-color:#ff8e00;--type-link-color:#2dbfb8;--trait-link-color:#b78cf2;--assoc-item-link-color:#d2991d;--function-link-color:#2bab63;--macro-link-color:#09bd00;--keyword-link-color:#d2991d;--mod-link-color:#d2991d;--link-color:#d2991d;--sidebar-link-color:#fdbf35;--sidebar-current-link-background-color:#444;--search-result-link-focus-background-color:#616161;--search-result-border-color:#aaa3;--search-color:#111;--search-error-code-background-color:#484848;--search-results-alias-color:#fff;--search-results-grey-color:#ccc;--search-tab-title-count-color:#888;--search-tab-button-not-selected-border-top-color:#252525;--search-tab-button-not-selected-background:#252525;--search-tab-button-selected-border-top-color:#0089ff;--search-tab-button-selected-background:#353535;--stab-background-color:#314559;--stab-code-color:#e6e1cf;--code-highlight-kw-color:#ab8ac1;--code-highlight-kw-2-color:#769acb;--code-highlight-lifetime-color:#d97f26;--code-highlight-prelude-color:#769acb;--code-highlight-prelude-val-color:#ee6868;--code-highlight-number-color:#83a300;--code-highlight-string-color:#83a300;--code-highlight-literal-color:#ee6868;--code-highlight-attribute-color:#ee6868;--code-highlight-self-color:#ee6868;--code-highlight-macro-color:#3e999f;--code-highlight-question-mark-color:#ff9011;--code-highlight-comment-color:#8d8d8b;--code-highlight-doc-comment-color:#8ca375;--src-line-numbers-span-color:#3b91e2;--src-line-number-highlighted-background-color:#0a042f;--test-arrow-color:#dedede;--test-arrow-background-color:rgba(78,139,202,0.2);--test-arrow-hover-color:#dedede;--test-arrow-hover-background-color:#4e8bca;--target-background-color:#494a3d;--target-border-color:#bb7410;--kbd-color:#000;--kbd-background:#fafbfc;--kbd-box-shadow-color:#c6cbd1;--rust-logo-filter:drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff);--crate-search-div-filter:invert(94%) sepia(0%) saturate(721%) hue-rotate(255deg) brightness(90%) contrast(90%);--crate-search-div-hover-filter:invert(69%) sepia(60%) saturate(6613%) hue-rotate(184deg) brightness(100%) contrast(91%);--crate-search-hover-border:#2196f3;--src-sidebar-background-selected:#333;--src-sidebar-background-hover:#444;--table-alt-row-background-color:#2a2a2a;--codeblock-link-background:#333;--scrape-example-toggle-line-background:#999;--scrape-example-toggle-line-hover-background:#c5c5c5;--scrape-example-code-line-highlight:#5b3b01;--scrape-example-code-line-highlight-focus:#7c4b0f;--scrape-example-help-border-color:#aaa;--scrape-example-help-color:#eee;--scrape-example-help-hover-border-color:#fff;--scrape-example-help-hover-color:#fff;--scrape-example-code-wrapper-background-start:rgba(53,53,53,1);--scrape-example-code-wrapper-background-end:rgba(53,53,53,0);}} \ No newline at end of file diff --git a/ch6-dev/rust-logo.svg b/ch6-dev/static.files/rust-logo-151179464ae7ed46.svg similarity index 100% rename from ch6-dev/rust-logo.svg rename to ch6-dev/static.files/rust-logo-151179464ae7ed46.svg diff --git a/ch6-dev/static.files/rustdoc-fa3bb1812debf86c.css b/ch6-dev/static.files/rustdoc-fa3bb1812debf86c.css new file mode 100644 index 00000000..2dd5cebc --- /dev/null +++ b/ch6-dev/static.files/rustdoc-fa3bb1812debf86c.css @@ -0,0 +1,10 @@ + :root{--nav-sub-mobile-padding:8px;--search-typename-width:6.75rem;}@font-face {font-family:'Fira Sans';font-style:normal;font-weight:400;src:local('Fira Sans'),url("FiraSans-Regular-018c141bf0843ffd.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Fira Sans';font-style:normal;font-weight:500;src:local('Fira Sans Medium'),url("FiraSans-Medium-8f9a781e4970d388.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:normal;font-weight:400;src:local('Source Serif 4'),url("SourceSerif4-Regular-46f98efaafac5295.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:italic;font-weight:400;src:local('Source Serif 4 Italic'),url("SourceSerif4-It-acdfaf1a8af734b1.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:normal;font-weight:700;src:local('Source Serif 4 Bold'),url("SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:normal;font-weight:400;src:url("SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:italic;font-weight:400;src:url("SourceCodePro-It-1cc31594bf4f1f79.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:normal;font-weight:600;src:url("SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'NanumBarunGothic';src:url("NanumBarunGothic-0f09457c7a19b7c6.ttf.woff2") format("woff2");font-display:swap;unicode-range:U+AC00-D7AF,U+1100-11FF,U+3130-318F,U+A960-A97F,U+D7B0-D7FF;}*{box-sizing:border-box;}body{font:1rem/1.5 "Source Serif 4",NanumBarunGothic,serif;margin:0;position:relative;overflow-wrap:break-word;overflow-wrap:anywhere;font-feature-settings:"kern","liga";background-color:var(--main-background-color);color:var(--main-color);}h1{font-size:1.5rem;}h2{font-size:1.375rem;}h3{font-size:1.25rem;}h1,h2,h3,h4,h5,h6{font-weight:500;}h1,h2,h3,h4{margin:25px 0 15px 0;padding-bottom:6px;}.docblock h3,.docblock h4,h5,h6{margin:15px 0 5px 0;}.docblock>h2:first-child,.docblock>h3:first-child,.docblock>h4:first-child,.docblock>h5:first-child,.docblock>h6:first-child{margin-top:0;}.main-heading h1{margin:0;padding:0;flex-grow:1;overflow-wrap:break-word;overflow-wrap:anywhere;}.main-heading{display:flex;flex-wrap:wrap;padding-bottom:6px;margin-bottom:15px;}.content h2,.top-doc .docblock>h3,.top-doc .docblock>h4{border-bottom:1px solid var(--headings-border-bottom-color);}h1,h2{line-height:1.25;padding-top:3px;padding-bottom:9px;}h3.code-header{font-size:1.125rem;}h4.code-header{font-size:1rem;}.code-header{font-weight:600;margin:0;padding:0;white-space:pre-wrap;}#crate-search,h1,h2,h3,h4,h5,h6,.sidebar,.mobile-topbar,.search-input,.search-results .result-name,.item-name>a,.out-of-band,span.since,a.src,#help-button>a,summary.hideme,.scraped-example-list,ul.all-items{font-family:"Fira Sans",Arial,NanumBarunGothic,sans-serif;}#toggle-all-docs,a.anchor,.small-section-header a,#src-sidebar a,.rust a,.sidebar h2 a,.sidebar h3 a,.mobile-topbar h2 a,h1 a,.search-results a,.stab,.result-name i{color:var(--main-color);}span.enum,a.enum,span.struct,a.struct,span.union,a.union,span.primitive,a.primitive,span.type,a.type,span.foreigntype,a.foreigntype{color:var(--type-link-color);}span.trait,a.trait,span.traitalias,a.traitalias{color:var(--trait-link-color);}span.associatedtype,a.associatedtype,span.constant,a.constant,span.static,a.static{color:var(--assoc-item-link-color);}span.fn,a.fn,span.method,a.method,span.tymethod,a.tymethod{color:var(--function-link-color);}span.attr,a.attr,span.derive,a.derive,span.macro,a.macro{color:var(--macro-link-color);}span.mod,a.mod{color:var(--mod-link-color);}span.keyword,a.keyword{color:var(--keyword-link-color);}a{color:var(--link-color);text-decoration:none;}ol,ul{padding-left:24px;}ul ul,ol ul,ul ol,ol ol{margin-bottom:.625em;}p,.docblock>.warning{margin:0 0 .75em 0;}p:last-child,.docblock>.warning:last-child{margin:0;}button{padding:1px 6px;cursor:pointer;}button#toggle-all-docs{padding:0;background:none;border:none;-webkit-appearance:none;opacity:1;}.rustdoc{display:flex;flex-direction:row;flex-wrap:nowrap;}main{position:relative;flex-grow:1;padding:10px 15px 40px 45px;min-width:0;}.src main{padding:15px;}.width-limiter{max-width:960px;margin-right:auto;}details:not(.toggle) summary{margin-bottom:.6em;}code,pre,a.test-arrow,.code-header{font-family:"Source Code Pro",monospace;}.docblock code,.docblock-short code{border-radius:3px;padding:0 0.125em;}.docblock pre code,.docblock-short pre code{padding:0;}pre{padding:14px;line-height:1.5;}pre.item-decl{overflow-x:auto;}.item-decl .type-contents-toggle{contain:initial;}.src .content pre{padding:20px;}.rustdoc.src .example-wrap pre.src-line-numbers{padding:20px 0 20px 4px;}img{max-width:100%;}.sub-logo-container,.logo-container{line-height:0;display:block;}.sub-logo-container{margin-right:32px;}.sub-logo-container>img{height:60px;width:60px;object-fit:contain;}.rust-logo{filter:var(--rust-logo-filter);}.sidebar{font-size:0.875rem;flex:0 0 200px;overflow-y:scroll;overscroll-behavior:contain;position:sticky;height:100vh;top:0;left:0;}.rustdoc.src .sidebar{flex-basis:50px;border-right:1px solid;overflow-x:hidden;overflow-y:hidden;z-index:1;}.sidebar,.mobile-topbar,.sidebar-menu-toggle,#src-sidebar-toggle,#src-sidebar{background-color:var(--sidebar-background-color);}#src-sidebar-toggle>button:hover,#src-sidebar-toggle>button:focus{background-color:var(--sidebar-background-color-hover);}.src .sidebar>*:not(#src-sidebar-toggle){visibility:hidden;}.src-sidebar-expanded .src .sidebar{overflow-y:auto;flex-basis:300px;}.src-sidebar-expanded .src .sidebar>*:not(#src-sidebar-toggle){visibility:visible;}#all-types{margin-top:1em;}*{scrollbar-width:initial;scrollbar-color:var(--scrollbar-color);}.sidebar{scrollbar-width:thin;scrollbar-color:var(--scrollbar-color);}::-webkit-scrollbar{width:12px;}.sidebar::-webkit-scrollbar{width:8px;}::-webkit-scrollbar-track{-webkit-box-shadow:inset 0;background-color:var(--scrollbar-track-background-color);}.sidebar::-webkit-scrollbar-track{background-color:var(--scrollbar-track-background-color);}::-webkit-scrollbar-thumb,.sidebar::-webkit-scrollbar-thumb{background-color:var(--scrollbar-thumb-background-color);}.hidden{display:none !important;}.sidebar .logo-container{margin-top:10px;margin-bottom:10px;text-align:center;}.version{overflow-wrap:break-word;}.logo-container>img{height:100px;width:100px;}ul.block,.block li{padding:0;margin:0;list-style:none;}.sidebar-elems a,.sidebar>h2 a{display:block;padding:0.25rem;margin-left:-0.25rem;}.sidebar h2{overflow-wrap:anywhere;padding:0;margin:0.7rem 0;}.sidebar h3{font-size:1.125rem;padding:0;margin:0;}.sidebar-elems,.sidebar>h2{padding-left:24px;}.sidebar a{color:var(--sidebar-link-color);}.sidebar .current,.sidebar a:hover:not(.logo-container){background-color:var(--sidebar-current-link-background-color);}.sidebar-elems .block{margin-bottom:2em;}.sidebar-elems .block li a{white-space:nowrap;text-overflow:ellipsis;overflow:hidden;}.mobile-topbar{display:none;}.rustdoc .example-wrap{display:flex;position:relative;margin-bottom:10px;}.rustdoc .example-wrap:last-child{margin-bottom:0px;}.rustdoc .example-wrap pre{margin:0;flex-grow:1;}.rustdoc:not(.src) .example-wrap pre{overflow:auto hidden;}.rustdoc .example-wrap pre.example-line-numbers,.rustdoc .example-wrap pre.src-line-numbers{flex-grow:0;min-width:fit-content;overflow:initial;text-align:right;-webkit-user-select:none;user-select:none;padding:14px 8px;color:var(--src-line-numbers-span-color);}.rustdoc .example-wrap pre.src-line-numbers{padding:14px 0;}.src-line-numbers a,.src-line-numbers span{color:var(--src-line-numbers-span-color);padding:0 8px;}.src-line-numbers :target{background-color:transparent;border-right:none;padding:0 8px;}.src-line-numbers .line-highlighted{background-color:var(--src-line-number-highlighted-background-color);}.search-loading{text-align:center;}.docblock-short{overflow-wrap:break-word;overflow-wrap:anywhere;}.docblock :not(pre)>code,.docblock-short code{white-space:pre-wrap;}.top-doc .docblock h2{font-size:1.375rem;}.top-doc .docblock h3{font-size:1.25rem;}.top-doc .docblock h4,.top-doc .docblock h5{font-size:1.125rem;}.top-doc .docblock h6{font-size:1rem;}.docblock h5{font-size:1rem;}.docblock h6{font-size:0.875rem;}.docblock{margin-left:24px;position:relative;}.docblock>:not(.more-examples-toggle):not(.example-wrap){max-width:100%;overflow-x:auto;}.out-of-band{flex-grow:0;font-size:1.125rem;}.docblock code,.docblock-short code,pre,.rustdoc.src .example-wrap{background-color:var(--code-block-background-color);}#main-content{position:relative;}.docblock table{margin:.5em 0;border-collapse:collapse;}.docblock table td,.docblock table th{padding:.5em;border:1px solid var(--border-color);}.docblock table tbody tr:nth-child(2n){background:var(--table-alt-row-background-color);}.method .where,.fn .where,.where.fmt-newline{display:block;white-space:pre-wrap;font-size:0.875rem;}.item-info{display:block;margin-left:24px;}.item-info code{font-size:0.875rem;}#main-content>.item-info{margin-left:0;}nav.sub{flex-grow:1;flex-flow:row nowrap;margin:4px 0 25px 0;display:flex;align-items:center;}.search-form{position:relative;display:flex;height:34px;flex-grow:1;}.src nav.sub{margin:0 0 15px 0;}.small-section-header{display:block;position:relative;}.small-section-header:hover>.anchor,.impl:hover>.anchor,.trait-impl:hover>.anchor,.variant:hover>.anchor{display:initial;}.anchor{display:none;position:absolute;left:-0.5em;background:none !important;}.anchor.field{left:-5px;}.small-section-header>.anchor{left:-15px;padding-right:8px;}h2.small-section-header>.anchor{padding-right:6px;}.main-heading a:hover,.example-wrap .rust a:hover,.all-items a:hover,.docblock a:not(.test-arrow):not(.scrape-help):not(.tooltip):hover,.docblock-short a:not(.test-arrow):not(.scrape-help):not(.tooltip):hover,.item-info a{text-decoration:underline;}.crate.block a.current{font-weight:500;}table,.item-table{overflow-wrap:break-word;}.item-table{display:table;padding:0;margin:0;}.item-table>li{display:table-row;}.item-table>li>div{display:table-cell;}.item-table>li>.item-name{padding-right:1.25rem;}.search-results-title{margin-top:0;white-space:nowrap;display:flex;align-items:baseline;}#crate-search-div{position:relative;min-width:5em;}#crate-search{min-width:115px;padding:0 23px 0 4px;max-width:100%;text-overflow:ellipsis;border:1px solid var(--border-color);border-radius:4px;outline:none;cursor:pointer;-moz-appearance:none;-webkit-appearance:none;text-indent:0.01px;background-color:var(--main-background-color);color:inherit;line-height:1.5;font-weight:500;}#crate-search:hover,#crate-search:focus{border-color:var(--crate-search-hover-border);}#crate-search-div::after{pointer-events:none;width:100%;height:100%;position:absolute;top:0;left:0;content:"";background-repeat:no-repeat;background-size:20px;background-position:calc(100% - 2px) 56%;background-image:url('data:image/svg+xml, \ + ');filter:var(--crate-search-div-filter);}#crate-search-div:hover::after,#crate-search-div:focus-within::after{filter:var(--crate-search-div-hover-filter);}#crate-search>option{font-size:1rem;}.search-input{-webkit-appearance:none;outline:none;border:1px solid var(--border-color);border-radius:2px;padding:8px;font-size:1rem;flex-grow:1;background-color:var(--button-background-color);color:var(--search-color);}.search-input:focus{border-color:var(--search-input-focused-border-color);}.search-results{display:none;}.search-results.active{display:block;}.search-results>a{display:flex;margin-left:2px;margin-right:2px;border-bottom:1px solid var(--search-result-border-color);gap:1em;}.search-results>a>div.desc{white-space:nowrap;text-overflow:ellipsis;overflow:hidden;flex:2;}.search-results a:hover,.search-results a:focus{background-color:var(--search-result-link-focus-background-color);}.search-results .result-name{display:flex;align-items:center;justify-content:start;flex:3;}.search-results .result-name .alias{color:var(--search-results-alias-color);}.search-results .result-name .grey{color:var(--search-results-grey-color);}.search-results .result-name .typename{color:var(--search-results-grey-color);font-size:0.875rem;width:var(--search-typename-width);}.search-results .result-name .path{word-break:break-all;max-width:calc(100% - var(--search-typename-width));display:inline-block;}.search-results .result-name .path>*{display:inline;}.popover{position:absolute;top:100%;right:0;z-index:2;margin-top:7px;border-radius:3px;border:1px solid var(--border-color);background-color:var(--main-background-color);color:var(--main-color);--popover-arrow-offset:11px;}.popover::before{content:'';position:absolute;right:var(--popover-arrow-offset);border:solid var(--border-color);border-width:1px 1px 0 0;background-color:var(--main-background-color);padding:4px;transform:rotate(-45deg);top:-5px;}.setting-line{margin:1.2em 0.6em;}.setting-radio input,.setting-check input{margin-right:0.3em;height:1.2rem;width:1.2rem;border:2px solid var(--settings-input-border-color);outline:none;-webkit-appearance:none;cursor:pointer;}.setting-radio input{border-radius:50%;}.setting-radio span,.setting-check span{padding-bottom:1px;}.setting-radio{margin-top:0.1em;margin-bottom:0.1em;min-width:3.8em;padding:0.3em;display:inline-flex;align-items:center;cursor:pointer;}.setting-radio+.setting-radio{margin-left:0.5em;}.setting-check{margin-right:20px;display:flex;align-items:center;cursor:pointer;}.setting-radio input:checked{box-shadow:inset 0 0 0 3px var(--main-background-color);background-color:var(--settings-input-color);}.setting-check input:checked{background-color:var(--settings-input-color);border-width:1px;content:url('data:image/svg+xml,\ + \ + ');}.setting-radio input:focus,.setting-check input:focus{box-shadow:0 0 1px 1px var(--settings-input-color);}.setting-radio input:checked:focus{box-shadow:inset 0 0 0 3px var(--main-background-color),0 0 2px 2px var(--settings-input-color);}.setting-radio input:hover,.setting-check input:hover{border-color:var(--settings-input-color) !important;}#help.popover{max-width:600px;--popover-arrow-offset:48px;}#help dt{float:left;clear:left;margin-right:0.5rem;}#help span.top,#help span.bottom{text-align:center;display:block;font-size:1.125rem;}#help span.top{margin:10px 0;border-bottom:1px solid var(--border-color);padding-bottom:4px;margin-bottom:6px;}#help span.bottom{clear:both;border-top:1px solid var(--border-color);}.side-by-side>div{width:50%;float:left;padding:0 20px 20px 17px;}.item-info .stab{min-height:36px;display:flex;padding:3px;margin-bottom:5px;align-items:center;vertical-align:text-bottom;}.item-name .stab{margin-left:0.3125em;}.stab{padding:0 2px;font-size:0.875rem;font-weight:normal;color:var(--main-color);background-color:var(--stab-background-color);width:fit-content;white-space:pre-wrap;border-radius:3px;display:inline;}.stab.portability>code{background:none;color:var(--stab-code-color);}.stab .emoji{font-size:1.25rem;margin-right:0.3rem;}.emoji{text-shadow:1px 0 0 black,-1px 0 0 black,0 1px 0 black,0 -1px 0 black;}.since{font-weight:normal;font-size:initial;}.rightside{padding-left:12px;float:right;}.rightside:not(a),.out-of-band{color:var(--right-side-color);}pre.rust{tab-size:4;-moz-tab-size:4;}pre.rust .kw{color:var(--code-highlight-kw-color);}pre.rust .kw-2{color:var(--code-highlight-kw-2-color);}pre.rust .lifetime{color:var(--code-highlight-lifetime-color);}pre.rust .prelude-ty{color:var(--code-highlight-prelude-color);}pre.rust .prelude-val{color:var(--code-highlight-prelude-val-color);}pre.rust .string{color:var(--code-highlight-string-color);}pre.rust .number{color:var(--code-highlight-number-color);}pre.rust .bool-val{color:var(--code-highlight-literal-color);}pre.rust .self{color:var(--code-highlight-self-color);}pre.rust .attr{color:var(--code-highlight-attribute-color);}pre.rust .macro,pre.rust .macro-nonterminal{color:var(--code-highlight-macro-color);}pre.rust .question-mark{font-weight:bold;color:var(--code-highlight-question-mark-color);}pre.rust .comment{color:var(--code-highlight-comment-color);}pre.rust .doccomment{color:var(--code-highlight-doc-comment-color);}.rustdoc.src .example-wrap pre.rust a{background:var(--codeblock-link-background);}.example-wrap.compile_fail,.example-wrap.should_panic{border-left:2px solid var(--codeblock-error-color);}.ignore.example-wrap{border-left:2px solid var(--codeblock-ignore-color);}.example-wrap.compile_fail:hover,.example-wrap.should_panic:hover{border-left:2px solid var(--codeblock-error-hover-color);}.example-wrap.ignore:hover{border-left:2px solid var(--codeblock-ignore-hover-color);}.example-wrap.compile_fail .tooltip,.example-wrap.should_panic .tooltip{color:var(--codeblock-error-color);}.example-wrap.ignore .tooltip{color:var(--codeblock-ignore-color);}.example-wrap.compile_fail:hover .tooltip,.example-wrap.should_panic:hover .tooltip{color:var(--codeblock-error-hover-color);}.example-wrap.ignore:hover .tooltip{color:var(--codeblock-ignore-hover-color);}.example-wrap .tooltip{position:absolute;display:block;left:-25px;top:5px;margin:0;line-height:1;}.example-wrap.compile_fail .tooltip,.example-wrap.should_panic .tooltip,.example-wrap.ignore .tooltip{font-weight:bold;font-size:1.25rem;}.content .docblock .warning{border-left:2px solid var(--warning-border-color);padding:14px;position:relative;overflow-x:visible !important;}.content .docblock .warning::before{color:var(--warning-border-color);content:"ⓘ";position:absolute;left:-25px;top:5px;font-weight:bold;font-size:1.25rem;}a.test-arrow{visibility:hidden;position:absolute;padding:5px 10px 5px 10px;border-radius:5px;font-size:1.375rem;top:5px;right:5px;z-index:1;color:var(--test-arrow-color);background-color:var(--test-arrow-background-color);}a.test-arrow:hover{color:var(--test-arrow-hover-color);background-color:var(--test-arrow-hover-background-color);}.example-wrap:hover .test-arrow{visibility:visible;}.code-attribute{font-weight:300;color:var(--code-attribute-color);}.item-spacer{width:100%;height:12px;display:block;}.out-of-band>span.since{font-size:1.25rem;}.sub-variant h4{font-size:1rem;font-weight:400;margin-top:0;margin-bottom:0;}.sub-variant{margin-left:24px;margin-bottom:40px;}.sub-variant>.sub-variant-field{margin-left:24px;}:target{padding-right:3px;background-color:var(--target-background-color);border-right:3px solid var(--target-border-color);}.code-header a.tooltip{color:inherit;margin-right:15px;position:relative;}.code-header a.tooltip:hover{color:var(--link-color);}a.tooltip:hover::after{position:absolute;top:calc(100% - 10px);left:-15px;right:-15px;height:20px;content:"\00a0";}.fade-out{opacity:0;transition:opacity 0.45s cubic-bezier(0,0,0.1,1.0);}.popover.tooltip .content{margin:0.25em 0.5em;}.popover.tooltip .content pre,.popover.tooltip .content code{background:transparent;margin:0;padding:0;font-size:1.25rem;white-space:pre-wrap;}.popover.tooltip .content>h3:first-child{margin:0 0 5px 0;}.search-failed{text-align:center;margin-top:20px;display:none;}.search-failed.active{display:block;}.search-failed>ul{text-align:left;max-width:570px;margin-left:auto;margin-right:auto;}#search-tabs{display:flex;flex-direction:row;gap:1px;margin-bottom:4px;}#search-tabs button{text-align:center;font-size:1.125rem;border:0;border-top:2px solid;flex:1;line-height:1.5;color:inherit;}#search-tabs button:not(.selected){background-color:var(--search-tab-button-not-selected-background);border-top-color:var(--search-tab-button-not-selected-border-top-color);}#search-tabs button:hover,#search-tabs button.selected{background-color:var(--search-tab-button-selected-background);border-top-color:var(--search-tab-button-selected-border-top-color);}#search-tabs .count{font-size:1rem;font-variant-numeric:tabular-nums;color:var(--search-tab-title-count-color);}#search .error code{border-radius:3px;background-color:var(--search-error-code-background-color);}.search-corrections{font-weight:normal;}#src-sidebar-toggle{position:sticky;top:0;left:0;font-size:1.25rem;border-bottom:1px solid;display:flex;height:40px;justify-content:stretch;align-items:stretch;z-index:10;}#src-sidebar{width:100%;overflow:auto;}#src-sidebar>.title{font-size:1.5rem;text-align:center;border-bottom:1px solid var(--border-color);margin-bottom:6px;}#src-sidebar div.files>a:hover,details.dir-entry summary:hover,#src-sidebar div.files>a:focus,details.dir-entry summary:focus{background-color:var(--src-sidebar-background-hover);}#src-sidebar div.files>a.selected{background-color:var(--src-sidebar-background-selected);}#src-sidebar-toggle>button{font-size:inherit;font-weight:bold;background:none;color:inherit;text-align:center;border:none;outline:none;flex:1 1;-webkit-appearance:none;opacity:1;}#settings-menu,#help-button{margin-left:4px;display:flex;}#settings-menu>a,#help-button>a{display:flex;align-items:center;justify-content:center;background-color:var(--button-background-color);border:1px solid var(--border-color);border-radius:2px;color:var(--settings-button-color);font-size:20px;width:33px;}#settings-menu>a:hover,#settings-menu>a:focus,#help-button>a:hover,#help-button>a:focus{border-color:var(--settings-button-border-focus);}#copy-path{color:var(--copy-path-button-color);background:var(--main-background-color);height:34px;margin-left:10px;padding:0;padding-left:2px;border:0;width:33px;}#copy-path>img{filter:var(--copy-path-img-filter);}#copy-path:hover>img{filter:var(--copy-path-img-hover-filter);}@keyframes rotating{from{transform:rotate(0deg);}to{transform:rotate(360deg);}}#settings-menu.rotate>a img{animation:rotating 2s linear infinite;}kbd{display:inline-block;padding:3px 5px;font:15px monospace;line-height:10px;vertical-align:middle;border:solid 1px var(--border-color);border-radius:3px;color:var(--kbd-color);background-color:var(--kbd-background);box-shadow:inset 0 -1px 0 var(--kbd-box-shadow-color);}ul.all-items>li{list-style:none;}details.dir-entry{padding-left:4px;}details.dir-entry>summary{margin:0 0 0 -4px;padding:0 0 0 4px;cursor:pointer;}details.dir-entry div.folders,details.dir-entry div.files{padding-left:23px;}details.dir-entry a{display:block;}details.toggle{contain:layout;position:relative;}details.toggle>summary.hideme{cursor:pointer;font-size:1rem;}details.toggle>summary{list-style:none;outline:none;}details.toggle>summary::-webkit-details-marker,details.toggle>summary::marker{display:none;}details.toggle>summary.hideme>span{margin-left:9px;}details.toggle>summary::before{background:url('data:image/svg+xml,') no-repeat top left;content:"";cursor:pointer;width:16px;height:16px;display:inline-block;vertical-align:middle;opacity:.5;filter:var(--toggle-filter);}details.toggle>summary.hideme>span,.more-examples-toggle summary,.more-examples-toggle .hide-more{color:var(--toggles-color);}details.toggle>summary::after{content:"Expand";overflow:hidden;width:0;height:0;position:absolute;}details.toggle>summary.hideme::after{content:"";}details.toggle>summary:focus::before,details.toggle>summary:hover::before{opacity:1;}details.toggle>summary:focus-visible::before{outline:1px dotted #000;outline-offset:1px;}details.non-exhaustive{margin-bottom:8px;}details.toggle>summary.hideme::before{position:relative;}details.toggle>summary:not(.hideme)::before{position:absolute;left:-24px;top:4px;}.impl-items>details.toggle>summary:not(.hideme)::before{position:absolute;left:-24px;}details.toggle[open] >summary.hideme{position:absolute;}details.toggle[open] >summary.hideme>span{display:none;}details.toggle[open] >summary::before{background:url('data:image/svg+xml,') no-repeat top left;}details.toggle[open] >summary::after{content:"Collapse";}.docblock summary>*{display:inline-block;}.docblock>.example-wrap:first-child .tooltip{margin-top:16px;}@media (max-width:850px){#search-tabs .count{display:block;}}@media (max-width:700px){*[id]{scroll-margin-top:45px;}.rustdoc{display:block;}main{padding-left:15px;padding-top:0px;}.main-heading{flex-direction:column;}.out-of-band{text-align:left;margin-left:initial;padding:initial;}.out-of-band .since::before{content:"Since ";}.sidebar .logo-container,.sidebar .location{display:none;}.sidebar{position:fixed;top:45px;left:-1000px;z-index:11;height:calc(100vh - 45px);width:200px;}.src main,.rustdoc.src .sidebar{top:0;padding:0;height:100vh;border:0;}.sidebar.shown,.src-sidebar-expanded .src .sidebar,.rustdoc:not(.src) .sidebar:focus-within{left:0;}.mobile-topbar h2{padding-bottom:0;margin:auto 0.5em auto auto;overflow:hidden;font-size:24px;}.mobile-topbar h2 a{display:block;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;}.mobile-topbar .logo-container>img{max-width:35px;max-height:35px;margin:5px 0 5px 20px;}.mobile-topbar{display:flex;flex-direction:row;position:sticky;z-index:10;font-size:2rem;height:45px;width:100%;left:0;top:0;}.sidebar-menu-toggle{width:45px;font-size:32px;border:none;color:var(--main-color);}.sidebar-elems{margin-top:1em;}.anchor{display:none !important;}#main-content>details.toggle>summary::before,#main-content>div>details.toggle>summary::before{left:-11px;}#src-sidebar-toggle{position:fixed;left:1px;top:100px;width:30px;font-size:1.5rem;padding:0;z-index:10;border-top-right-radius:3px;border-bottom-right-radius:3px;border:1px solid;border-left:0;}.src-sidebar-expanded #src-sidebar-toggle{left:unset;top:unset;width:unset;border-top-right-radius:unset;border-bottom-right-radius:unset;position:sticky;border:0;border-bottom:1px solid;}#copy-path,#help-button{display:none;}.item-table,.item-row,.item-table>li,.item-table>li>div,.search-results>a,.search-results>a>div{display:block;}.search-results>a{padding:5px 0px;}.search-results>a>div.desc,.item-table>li>div.desc{padding-left:2em;}.search-results .result-name{display:block;}.search-results .result-name .typename{width:initial;margin-right:0;}.search-results .result-name .typename,.search-results .result-name .path{display:inline;}.src-sidebar-expanded .src .sidebar{max-width:100vw;width:100vw;}details.toggle:not(.top-doc)>summary{margin-left:10px;}.impl-items>details.toggle>summary:not(.hideme)::before,#main-content>details.toggle:not(.top-doc)>summary::before,#main-content>div>details.toggle>summary::before{left:-11px;}.impl-items>.item-info{margin-left:34px;}.src nav.sub{margin:0;padding:var(--nav-sub-mobile-padding);}}@media (min-width:701px){.scraped-example-title{position:absolute;z-index:10;background:var(--main-background-color);bottom:8px;right:5px;padding:2px 4px;box-shadow:0 0 4px var(--main-background-color);}}@media print{nav.sidebar,nav.sub,.out-of-band,a.src,#copy-path,details.toggle[open] >summary::before,details.toggle>summary::before,details.toggle.top-doc>summary{display:none;}.docblock{margin-left:0;}main{padding:10px;}}@media (max-width:464px){.docblock{margin-left:12px;}.docblock code{overflow-wrap:break-word;overflow-wrap:anywhere;}nav.sub{flex-direction:column;}.search-form{align-self:stretch;}.sub-logo-container>img{height:35px;width:35px;margin-bottom:var(--nav-sub-mobile-padding);}}.variant,.implementors-toggle>summary,.impl,#implementors-list>.docblock,.impl-items>section,.impl-items>.toggle>summary,.methods>section,.methods>.toggle>summary{margin-bottom:0.75em;}.variants>.docblock,.implementors-toggle>.docblock,.impl-items>.toggle[open]:not(:last-child),.methods>.toggle[open]:not(:last-child),.implementors-toggle[open]:not(:last-child){margin-bottom:2em;}#trait-implementations-list .impl-items>.toggle:not(:last-child),#synthetic-implementations-list .impl-items>.toggle:not(:last-child),#blanket-implementations-list .impl-items>.toggle:not(:last-child){margin-bottom:1em;}.scraped-example-list .scrape-help{margin-left:10px;padding:0 4px;font-weight:normal;font-size:12px;position:relative;bottom:1px;border:1px solid var(--scrape-example-help-border-color);border-radius:50px;color:var(--scrape-example-help-color);}.scraped-example-list .scrape-help:hover{border-color:var(--scrape-example-help-hover-border-color);color:var(--scrape-example-help-hover-color);}.scraped-example{position:relative;}.scraped-example .code-wrapper{position:relative;display:flex;flex-direction:row;flex-wrap:wrap;width:100%;}.scraped-example:not(.expanded) .code-wrapper{max-height:calc(1.5em * 5 + 10px);}.scraped-example:not(.expanded) .code-wrapper pre{overflow-y:hidden;padding-bottom:0;max-height:calc(1.5em * 5 + 10px);}.more-scraped-examples .scraped-example:not(.expanded) .code-wrapper,.more-scraped-examples .scraped-example:not(.expanded) .code-wrapper pre{max-height:calc(1.5em * 10 + 10px);}.scraped-example .code-wrapper .next,.scraped-example .code-wrapper .prev,.scraped-example .code-wrapper .expand{color:var(--main-color);position:absolute;top:0.25em;z-index:1;padding:0;background:none;border:none;-webkit-appearance:none;opacity:1;}.scraped-example .code-wrapper .prev{right:2.25em;}.scraped-example .code-wrapper .next{right:1.25em;}.scraped-example .code-wrapper .expand{right:0.25em;}.scraped-example:not(.expanded) .code-wrapper::before,.scraped-example:not(.expanded) .code-wrapper::after{content:" ";width:100%;height:5px;position:absolute;z-index:1;}.scraped-example:not(.expanded) .code-wrapper::before{top:0;background:linear-gradient(to bottom,var(--scrape-example-code-wrapper-background-start),var(--scrape-example-code-wrapper-background-end));}.scraped-example:not(.expanded) .code-wrapper::after{bottom:0;background:linear-gradient(to top,var(--scrape-example-code-wrapper-background-start),var(--scrape-example-code-wrapper-background-end));}.scraped-example .code-wrapper .example-wrap{width:100%;overflow-y:hidden;margin-bottom:0;}.scraped-example:not(.expanded) .code-wrapper .example-wrap{overflow-x:hidden;}.scraped-example .example-wrap .rust span.highlight{background:var(--scrape-example-code-line-highlight);}.scraped-example .example-wrap .rust span.highlight.focus{background:var(--scrape-example-code-line-highlight-focus);}.more-examples-toggle{max-width:calc(100% + 25px);margin-top:10px;margin-left:-25px;}.more-examples-toggle .hide-more{margin-left:25px;cursor:pointer;}.more-scraped-examples{margin-left:25px;position:relative;}.toggle-line{position:absolute;top:5px;bottom:0;right:calc(100% + 10px);padding:0 4px;cursor:pointer;}.toggle-line-inner{min-width:2px;height:100%;background:var(--scrape-example-toggle-line-background);}.toggle-line:hover .toggle-line-inner{background:var(--scrape-example-toggle-line-hover-background);}.more-scraped-examples .scraped-example,.example-links{margin-top:20px;}.more-scraped-examples .scraped-example:first-child{margin-top:5px;}.example-links ul{margin-bottom:0;}:root[data-theme="light"]{--main-background-color:white;--main-color:black;--settings-input-color:#2196f3;--settings-input-border-color:#717171;--settings-button-color:#000;--settings-button-border-focus:#717171;--sidebar-background-color:#f5f5f5;--sidebar-background-color-hover:#e0e0e0;--code-block-background-color:#f5f5f5;--scrollbar-track-background-color:#dcdcdc;--scrollbar-thumb-background-color:rgba(36,37,39,0.6);--scrollbar-color:rgba(36,37,39,0.6) #d9d9d9;--headings-border-bottom-color:#ddd;--border-color:#e0e0e0;--button-background-color:#fff;--right-side-color:grey;--code-attribute-color:#999;--toggles-color:#999;--toggle-filter:none;--search-input-focused-border-color:#66afe9;--copy-path-button-color:#999;--copy-path-img-filter:invert(50%);--copy-path-img-hover-filter:invert(35%);--codeblock-error-hover-color:rgb(255,0,0);--codeblock-error-color:rgba(255,0,0,.5);--codeblock-ignore-hover-color:rgb(255,142,0);--codeblock-ignore-color:rgba(255,142,0,.6);--warning-border-color:#ff8e00;--type-link-color:#ad378a;--trait-link-color:#6e4fc9;--assoc-item-link-color:#3873ad;--function-link-color:#ad7c37;--macro-link-color:#068000;--keyword-link-color:#3873ad;--mod-link-color:#3873ad;--link-color:#3873ad;--sidebar-link-color:#356da4;--sidebar-current-link-background-color:#fff;--search-result-link-focus-background-color:#ccc;--search-result-border-color:#aaa3;--search-color:#000;--search-error-code-background-color:#d0cccc;--search-results-alias-color:#000;--search-results-grey-color:#999;--search-tab-title-count-color:#888;--search-tab-button-not-selected-border-top-color:#e6e6e6;--search-tab-button-not-selected-background:#e6e6e6;--search-tab-button-selected-border-top-color:#0089ff;--search-tab-button-selected-background:#fff;--stab-background-color:#fff5d6;--stab-code-color:#000;--code-highlight-kw-color:#8959a8;--code-highlight-kw-2-color:#4271ae;--code-highlight-lifetime-color:#b76514;--code-highlight-prelude-color:#4271ae;--code-highlight-prelude-val-color:#c82829;--code-highlight-number-color:#718c00;--code-highlight-string-color:#718c00;--code-highlight-literal-color:#c82829;--code-highlight-attribute-color:#c82829;--code-highlight-self-color:#c82829;--code-highlight-macro-color:#3e999f;--code-highlight-question-mark-color:#ff9011;--code-highlight-comment-color:#8e908c;--code-highlight-doc-comment-color:#4d4d4c;--src-line-numbers-span-color:#c67e2d;--src-line-number-highlighted-background-color:#fdffd3;--test-arrow-color:#f5f5f5;--test-arrow-background-color:rgba(78,139,202,0.2);--test-arrow-hover-color:#f5f5f5;--test-arrow-hover-background-color:rgb(78,139,202);--target-background-color:#fdffd3;--target-border-color:#ad7c37;--kbd-color:#000;--kbd-background:#fafbfc;--kbd-box-shadow-color:#c6cbd1;--rust-logo-filter:initial;--crate-search-div-filter:invert(100%) sepia(0%) saturate(4223%) hue-rotate(289deg) brightness(114%) contrast(76%);--crate-search-div-hover-filter:invert(44%) sepia(18%) saturate(23%) hue-rotate(317deg) brightness(96%) contrast(93%);--crate-search-hover-border:#717171;--src-sidebar-background-selected:#fff;--src-sidebar-background-hover:#e0e0e0;--table-alt-row-background-color:#f5f5f5;--codeblock-link-background:#eee;--scrape-example-toggle-line-background:#ccc;--scrape-example-toggle-line-hover-background:#999;--scrape-example-code-line-highlight:#fcffd6;--scrape-example-code-line-highlight-focus:#f6fdb0;--scrape-example-help-border-color:#555;--scrape-example-help-color:#333;--scrape-example-help-hover-border-color:#000;--scrape-example-help-hover-color:#000;--scrape-example-code-wrapper-background-start:rgba(255,255,255,1);--scrape-example-code-wrapper-background-end:rgba(255,255,255,0);}:root[data-theme="dark"]{--main-background-color:#353535;--main-color:#ddd;--settings-input-color:#2196f3;--settings-input-border-color:#999;--settings-button-color:#000;--settings-button-border-focus:#ffb900;--sidebar-background-color:#505050;--sidebar-background-color-hover:#676767;--code-block-background-color:#2A2A2A;--scrollbar-track-background-color:#717171;--scrollbar-thumb-background-color:rgba(32,34,37,.6);--scrollbar-color:rgba(32,34,37,.6) #5a5a5a;--headings-border-bottom-color:#d2d2d2;--border-color:#e0e0e0;--button-background-color:#f0f0f0;--right-side-color:grey;--code-attribute-color:#999;--toggles-color:#999;--toggle-filter:invert(100%);--search-input-focused-border-color:#008dfd;--copy-path-button-color:#999;--copy-path-img-filter:invert(50%);--copy-path-img-hover-filter:invert(65%);--codeblock-error-hover-color:rgb(255,0,0);--codeblock-error-color:rgba(255,0,0,.5);--codeblock-ignore-hover-color:rgb(255,142,0);--codeblock-ignore-color:rgba(255,142,0,.6);--warning-border-color:#ff8e00;--type-link-color:#2dbfb8;--trait-link-color:#b78cf2;--assoc-item-link-color:#d2991d;--function-link-color:#2bab63;--macro-link-color:#09bd00;--keyword-link-color:#d2991d;--mod-link-color:#d2991d;--link-color:#d2991d;--sidebar-link-color:#fdbf35;--sidebar-current-link-background-color:#444;--search-result-link-focus-background-color:#616161;--search-result-border-color:#aaa3;--search-color:#111;--search-error-code-background-color:#484848;--search-results-alias-color:#fff;--search-results-grey-color:#ccc;--search-tab-title-count-color:#888;--search-tab-button-not-selected-border-top-color:#252525;--search-tab-button-not-selected-background:#252525;--search-tab-button-selected-border-top-color:#0089ff;--search-tab-button-selected-background:#353535;--stab-background-color:#314559;--stab-code-color:#e6e1cf;--code-highlight-kw-color:#ab8ac1;--code-highlight-kw-2-color:#769acb;--code-highlight-lifetime-color:#d97f26;--code-highlight-prelude-color:#769acb;--code-highlight-prelude-val-color:#ee6868;--code-highlight-number-color:#83a300;--code-highlight-string-color:#83a300;--code-highlight-literal-color:#ee6868;--code-highlight-attribute-color:#ee6868;--code-highlight-self-color:#ee6868;--code-highlight-macro-color:#3e999f;--code-highlight-question-mark-color:#ff9011;--code-highlight-comment-color:#8d8d8b;--code-highlight-doc-comment-color:#8ca375;--src-line-numbers-span-color:#3b91e2;--src-line-number-highlighted-background-color:#0a042f;--test-arrow-color:#dedede;--test-arrow-background-color:rgba(78,139,202,0.2);--test-arrow-hover-color:#dedede;--test-arrow-hover-background-color:#4e8bca;--target-background-color:#494a3d;--target-border-color:#bb7410;--kbd-color:#000;--kbd-background:#fafbfc;--kbd-box-shadow-color:#c6cbd1;--rust-logo-filter:drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff);--crate-search-div-filter:invert(94%) sepia(0%) saturate(721%) hue-rotate(255deg) brightness(90%) contrast(90%);--crate-search-div-hover-filter:invert(69%) sepia(60%) saturate(6613%) hue-rotate(184deg) brightness(100%) contrast(91%);--crate-search-hover-border:#2196f3;--src-sidebar-background-selected:#333;--src-sidebar-background-hover:#444;--table-alt-row-background-color:#2a2a2a;--codeblock-link-background:#333;--scrape-example-toggle-line-background:#999;--scrape-example-toggle-line-hover-background:#c5c5c5;--scrape-example-code-line-highlight:#5b3b01;--scrape-example-code-line-highlight-focus:#7c4b0f;--scrape-example-help-border-color:#aaa;--scrape-example-help-color:#eee;--scrape-example-help-hover-border-color:#fff;--scrape-example-help-hover-color:#fff;--scrape-example-code-wrapper-background-start:rgba(53,53,53,1);--scrape-example-code-wrapper-background-end:rgba(53,53,53,0);}:root[data-theme="ayu"]{--main-background-color:#0f1419;--main-color:#c5c5c5;--settings-input-color:#ffb454;--settings-input-border-color:#999;--settings-button-color:#fff;--settings-button-border-focus:#e0e0e0;--sidebar-background-color:#14191f;--sidebar-background-color-hover:rgba(70,70,70,0.33);--code-block-background-color:#191f26;--scrollbar-track-background-color:transparent;--scrollbar-thumb-background-color:#5c6773;--scrollbar-color:#5c6773 #24292f;--headings-border-bottom-color:#5c6773;--border-color:#5c6773;--button-background-color:#141920;--right-side-color:grey;--code-attribute-color:#999;--toggles-color:#999;--toggle-filter:invert(100%);--search-input-focused-border-color:#5c6773;--copy-path-button-color:#fff;--copy-path-img-filter:invert(70%);--copy-path-img-hover-filter:invert(100%);--codeblock-error-hover-color:rgb(255,0,0);--codeblock-error-color:rgba(255,0,0,.5);--codeblock-ignore-hover-color:rgb(255,142,0);--codeblock-ignore-color:rgba(255,142,0,.6);--warning-border-color:#ff8e00;--type-link-color:#ffa0a5;--trait-link-color:#39afd7;--assoc-item-link-color:#39afd7;--function-link-color:#fdd687;--macro-link-color:#a37acc;--keyword-link-color:#39afd7;--mod-link-color:#39afd7;--link-color:#39afd7;--sidebar-link-color:#53b1db;--sidebar-current-link-background-color:transparent;--search-result-link-focus-background-color:#3c3c3c;--search-result-border-color:#aaa3;--search-color:#fff;--search-error-code-background-color:#4f4c4c;--search-results-alias-color:#c5c5c5;--search-results-grey-color:#999;--search-tab-title-count-color:#888;--search-tab-button-not-selected-border-top-color:none;--search-tab-button-not-selected-background:transparent !important;--search-tab-button-selected-border-top-color:none;--search-tab-button-selected-background:#141920 !important;--stab-background-color:#314559;--stab-code-color:#e6e1cf;--code-highlight-kw-color:#ff7733;--code-highlight-kw-2-color:#ff7733;--code-highlight-lifetime-color:#ff7733;--code-highlight-prelude-color:#69f2df;--code-highlight-prelude-val-color:#ff7733;--code-highlight-number-color:#b8cc52;--code-highlight-string-color:#b8cc52;--code-highlight-literal-color:#ff7733;--code-highlight-attribute-color:#e6e1cf;--code-highlight-self-color:#36a3d9;--code-highlight-macro-color:#a37acc;--code-highlight-question-mark-color:#ff9011;--code-highlight-comment-color:#788797;--code-highlight-doc-comment-color:#a1ac88;--src-line-numbers-span-color:#5c6773;--src-line-number-highlighted-background-color:rgba(255,236,164,0.06);--test-arrow-color:#788797;--test-arrow-background-color:rgba(57,175,215,0.09);--test-arrow-hover-color:#c5c5c5;--test-arrow-hover-background-color:rgba(57,175,215,0.368);--target-background-color:rgba(255,236,164,0.06);--target-border-color:rgba(255,180,76,0.85);--kbd-color:#c5c5c5;--kbd-background:#314559;--kbd-box-shadow-color:#5c6773;--rust-logo-filter:drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff);--crate-search-div-filter:invert(41%) sepia(12%) saturate(487%) hue-rotate(171deg) brightness(94%) contrast(94%);--crate-search-div-hover-filter:invert(98%) sepia(12%) saturate(81%) hue-rotate(343deg) brightness(113%) contrast(76%);--crate-search-hover-border:#e0e0e0;--src-sidebar-background-selected:#14191f;--src-sidebar-background-hover:#14191f;--table-alt-row-background-color:#191f26;--codeblock-link-background:#333;--scrape-example-toggle-line-background:#999;--scrape-example-toggle-line-hover-background:#c5c5c5;--scrape-example-code-line-highlight:#5b3b01;--scrape-example-code-line-highlight-focus:#7c4b0f;--scrape-example-help-border-color:#aaa;--scrape-example-help-color:#eee;--scrape-example-help-hover-border-color:#fff;--scrape-example-help-hover-color:#fff;--scrape-example-code-wrapper-background-start:rgba(15,20,25,1);--scrape-example-code-wrapper-background-end:rgba(15,20,25,0);}:root[data-theme="ayu"] h1,:root[data-theme="ayu"] h2,:root[data-theme="ayu"] h3,:root[data-theme="ayu"] h4,:where(:root[data-theme="ayu"]) h1 a,:root[data-theme="ayu"] .sidebar h2 a,:root[data-theme="ayu"] .sidebar h3 a,:root[data-theme="ayu"] #source-sidebar>.title{color:#fff;}:root[data-theme="ayu"] .docblock code{color:#ffb454;}:root[data-theme="ayu"] .docblock a>code{color:#39AFD7 !important;}:root[data-theme="ayu"] .code-header,:root[data-theme="ayu"] .docblock pre>code,:root[data-theme="ayu"] pre,:root[data-theme="ayu"] pre>code,:root[data-theme="ayu"] .item-info code,:root[data-theme="ayu"] .rustdoc.source .example-wrap{color:#e6e1cf;}:root[data-theme="ayu"] .sidebar .current,:root[data-theme="ayu"] .sidebar a:hover,:root[data-theme="ayu"] #src-sidebar div.files>a:hover,:root[data-theme="ayu"] details.dir-entry summary:hover,:root[data-theme="ayu"] #src-sidebar div.files>a:focus,:root[data-theme="ayu"] details.dir-entry summary:focus,:root[data-theme="ayu"] #src-sidebar div.files>a.selected{color:#ffb44c;}:root[data-theme="ayu"] .sidebar-elems .location{color:#ff7733;}:root[data-theme="ayu"] .src-line-numbers .line-highlighted{color:#708090;padding-right:7px;border-right:1px solid #ffb44c;}:root[data-theme="ayu"] .search-results a:hover,:root[data-theme="ayu"] .search-results a:focus{color:#fff !important;background-color:#3c3c3c;}:root[data-theme="ayu"] .search-results a{color:#0096cf;}:root[data-theme="ayu"] .search-results a div.desc{color:#c5c5c5;}:root[data-theme="ayu"] .result-name .primitive>i,:root[data-theme="ayu"] .result-name .keyword>i{color:#788797;}:root[data-theme="ayu"] #search-tabs>button.selected{border-bottom:1px solid #ffb44c !important;border-top:none;}:root[data-theme="ayu"] #search-tabs>button:not(.selected){border:none;background-color:transparent !important;}:root[data-theme="ayu"] #search-tabs>button:hover{border-bottom:1px solid rgba(242,151,24,0.3);}:root[data-theme="ayu"] #settings-menu>a img{filter:invert(100);} \ No newline at end of file diff --git a/ch6-dev/static.files/scrape-examples-ef1e698c1d417c0c.js b/ch6-dev/static.files/scrape-examples-ef1e698c1d417c0c.js new file mode 100644 index 00000000..ba830e37 --- /dev/null +++ b/ch6-dev/static.files/scrape-examples-ef1e698c1d417c0c.js @@ -0,0 +1 @@ +"use strict";(function(){const DEFAULT_MAX_LINES=5;const HIDDEN_MAX_LINES=10;function scrollToLoc(elt,loc,isHidden){const lines=elt.querySelector(".src-line-numbers");let scrollOffset;const maxLines=isHidden?HIDDEN_MAX_LINES:DEFAULT_MAX_LINES;if(loc[1]-loc[0]>maxLines){const line=Math.max(0,loc[0]-1);scrollOffset=lines.children[line].offsetTop}else{const wrapper=elt.querySelector(".code-wrapper");const halfHeight=wrapper.offsetHeight/2;const offsetTop=lines.children[loc[0]].offsetTop;const lastLine=lines.children[loc[1]];const offsetBot=lastLine.offsetTop+lastLine.offsetHeight;const offsetMid=(offsetTop+offsetBot)/2;scrollOffset=offsetMid-halfHeight}lines.scrollTo(0,scrollOffset);elt.querySelector(".rust").scrollTo(0,scrollOffset)}function updateScrapedExample(example,isHidden){const locs=JSON.parse(example.attributes.getNamedItem("data-locs").textContent);let locIndex=0;const highlights=Array.prototype.slice.call(example.querySelectorAll(".highlight"));const link=example.querySelector(".scraped-example-title a");if(locs.length>1){const onChangeLoc=changeIndex=>{removeClass(highlights[locIndex],"focus");changeIndex();scrollToLoc(example,locs[locIndex][0],isHidden);addClass(highlights[locIndex],"focus");const url=locs[locIndex][1];const title=locs[locIndex][2];link.href=url;link.innerHTML=title};example.querySelector(".prev").addEventListener("click",()=>{onChangeLoc(()=>{locIndex=(locIndex-1+locs.length)%locs.length})});example.querySelector(".next").addEventListener("click",()=>{onChangeLoc(()=>{locIndex=(locIndex+1)%locs.length})})}const expandButton=example.querySelector(".expand");if(expandButton){expandButton.addEventListener("click",()=>{if(hasClass(example,"expanded")){removeClass(example,"expanded");scrollToLoc(example,locs[0][0],isHidden)}else{addClass(example,"expanded")}})}scrollToLoc(example,locs[0][0],isHidden)}const firstExamples=document.querySelectorAll(".scraped-example-list > .scraped-example");onEachLazy(firstExamples,el=>updateScrapedExample(el,false));onEachLazy(document.querySelectorAll(".more-examples-toggle"),toggle=>{onEachLazy(toggle.querySelectorAll(".toggle-line, .hide-more"),button=>{button.addEventListener("click",()=>{toggle.open=false})});const moreExamples=toggle.querySelectorAll(".scraped-example");toggle.querySelector("summary").addEventListener("click",()=>{setTimeout(()=>{onEachLazy(moreExamples,el=>updateScrapedExample(el,true))})},{once:true})})})() \ No newline at end of file diff --git a/ch6-dev/static.files/search-5f5ec5419eadd0c9.js b/ch6-dev/static.files/search-5f5ec5419eadd0c9.js new file mode 100644 index 00000000..e25c1820 --- /dev/null +++ b/ch6-dev/static.files/search-5f5ec5419eadd0c9.js @@ -0,0 +1,5 @@ +"use strict";if(!Array.prototype.toSpliced){Array.prototype.toSpliced=function(){const me=this.slice();Array.prototype.splice.apply(me,arguments);return me}}(function(){const itemTypes=["mod","externcrate","import","struct","enum","fn","type","static","trait","impl","tymethod","method","structfield","variant","macro","primitive","associatedtype","constant","associatedconstant","union","foreigntype","keyword","existential","attr","derive","traitalias","generic",];const longItemTypes=["module","extern crate","re-export","struct","enum","function","type alias","static","trait","","trait method","method","struct field","enum variant","macro","primitive type","assoc type","constant","assoc const","union","foreign type","keyword","existential type","attribute macro","derive macro","trait alias",];const TY_PRIMITIVE=itemTypes.indexOf("primitive");const TY_KEYWORD=itemTypes.indexOf("keyword");const TY_GENERIC=itemTypes.indexOf("generic");const ROOT_PATH=typeof window!=="undefined"?window.rootPath:"../";function hasOwnPropertyRustdoc(obj,property){return Object.prototype.hasOwnProperty.call(obj,property)}function printTab(nb){let iter=0;let foundCurrentTab=false;let foundCurrentResultSet=false;onEachLazy(document.getElementById("search-tabs").childNodes,elem=>{if(nb===iter){addClass(elem,"selected");foundCurrentTab=true}else{removeClass(elem,"selected")}iter+=1});const isTypeSearch=(nb>0||iter===1);iter=0;onEachLazy(document.getElementById("results").childNodes,elem=>{if(nb===iter){addClass(elem,"active");foundCurrentResultSet=true}else{removeClass(elem,"active")}iter+=1});if(foundCurrentTab&&foundCurrentResultSet){searchState.currentTab=nb;const correctionsElem=document.getElementsByClassName("search-corrections");if(isTypeSearch){removeClass(correctionsElem[0],"hidden")}else{addClass(correctionsElem[0],"hidden")}}else if(nb!==0){printTab(0)}}const editDistanceState={current:[],prev:[],prevPrev:[],calculate:function calculate(a,b,limit){if(a.lengthlimit){return limit+1}while(b.length>0&&b[0]===a[0]){a=a.substring(1);b=b.substring(1)}while(b.length>0&&b[b.length-1]===a[a.length-1]){a=a.substring(0,a.length-1);b=b.substring(0,b.length-1)}if(b.length===0){return minDist}const aLength=a.length;const bLength=b.length;for(let i=0;i<=bLength;++i){this.current[i]=0;this.prev[i]=i;this.prevPrev[i]=Number.MAX_VALUE}for(let i=1;i<=aLength;++i){this.current[0]=i;const aIdx=i-1;for(let j=1;j<=bLength;++j){const bIdx=j-1;const substitutionCost=a[aIdx]===b[bIdx]?0:1;this.current[j]=Math.min(this.prev[j]+1,this.current[j-1]+1,this.prev[j-1]+substitutionCost);if((i>1)&&(j>1)&&(a[aIdx]===b[bIdx-1])&&(a[aIdx-1]===b[bIdx])){this.current[j]=Math.min(this.current[j],this.prevPrev[j-2]+1)}}const prevPrevTmp=this.prevPrev;this.prevPrev=this.prev;this.prev=this.current;this.current=prevPrevTmp}const distance=this.prev[bLength];return distance<=limit?distance:(limit+1)},};function editDistance(a,b,limit){return editDistanceState.calculate(a,b,limit)}function initSearch(rawSearchIndex){const MAX_RESULTS=200;const NO_TYPE_FILTER=-1;let searchIndex;let currentResults;let typeNameIdMap;const ALIASES=new Map();let typeNameIdOfArray;let typeNameIdOfSlice;let typeNameIdOfArrayOrSlice;function buildTypeMapIndex(name){if(name===""||name===null){return null}if(typeNameIdMap.has(name)){return typeNameIdMap.get(name)}else{const id=typeNameIdMap.size;typeNameIdMap.set(name,id);return id}}function isWhitespace(c){return" \t\n\r".indexOf(c)!==-1}function isSpecialStartCharacter(c){return"<\"".indexOf(c)!==-1}function isEndCharacter(c){return",>-]".indexOf(c)!==-1}function isStopCharacter(c){return isEndCharacter(c)}function isErrorCharacter(c){return"()".indexOf(c)!==-1}function itemTypeFromName(typename){const index=itemTypes.findIndex(i=>i===typename);if(index<0){throw["Unknown type filter ",typename]}return index}function getStringElem(query,parserState,isInGenerics){if(isInGenerics){throw["Unexpected ","\""," in generics"]}else if(query.literalSearch){throw["Cannot have more than one literal search element"]}else if(parserState.totalElems-parserState.genericsElems>0){throw["Cannot use literal search when there is more than one element"]}parserState.pos+=1;const start=parserState.pos;const end=getIdentEndPosition(parserState);if(parserState.pos>=parserState.length){throw["Unclosed ","\""]}else if(parserState.userQuery[end]!=="\""){throw["Unexpected ",parserState.userQuery[end]," in a string element"]}else if(start===end){throw["Cannot have empty string element"]}parserState.pos+=1;query.literalSearch=true}function isPathStart(parserState){return parserState.userQuery.slice(parserState.pos,parserState.pos+2)==="::"}function isReturnArrow(parserState){return parserState.userQuery.slice(parserState.pos,parserState.pos+2)==="->"}function isIdentCharacter(c){return(c==="_"||(c>="0"&&c<="9")||(c>="a"&&c<="z")||(c>="A"&&c<="Z"))}function isSeparatorCharacter(c){return c===","}function isPathSeparator(c){return c===":"||isWhitespace(c)}function prevIs(parserState,lookingFor){let pos=parserState.pos;while(pos>0){const c=parserState.userQuery[pos-1];if(c===lookingFor){return true}else if(!isWhitespace(c)){break}pos-=1}return false}function isLastElemGeneric(elems,parserState){return(elems.length>0&&elems[elems.length-1].generics.length>0)||prevIs(parserState,">")}function skipWhitespace(parserState){while(parserState.pos0){throw["Cannot have more than one element if you use quotes"]}const typeFilter=parserState.typeFilter;parserState.typeFilter=null;if(name==="!"){if(typeFilter!==null&&typeFilter!=="primitive"){throw["Invalid search type: primitive never type ","!"," and ",typeFilter," both specified",]}if(generics.length!==0){throw["Never type ","!"," does not accept generic parameters",]}return{name:"never",id:null,fullPath:["never"],pathWithoutLast:[],pathLast:"never",generics:[],typeFilter:"primitive",}}if(path.startsWith("::")){throw["Paths cannot start with ","::"]}else if(path.endsWith("::")){throw["Paths cannot end with ","::"]}else if(path.includes("::::")){throw["Unexpected ","::::"]}else if(path.includes(" ::")){throw["Unexpected "," ::"]}else if(path.includes(":: ")){throw["Unexpected ",":: "]}const pathSegments=path.split(/::|\s+/);if(pathSegments.length===0||(pathSegments.length===1&&pathSegments[0]==="")){if(generics.length>0||prevIs(parserState,">")){throw["Found generics without a path"]}else{throw["Unexpected ",parserState.userQuery[parserState.pos]]}}for(const[i,pathSegment]of pathSegments.entries()){if(pathSegment==="!"){if(i!==0){throw["Never type ","!"," is not associated item"]}pathSegments[i]="never"}}parserState.totalElems+=1;if(isInGenerics){parserState.genericsElems+=1}return{name:name.trim(),id:null,fullPath:pathSegments,pathWithoutLast:pathSegments.slice(0,pathSegments.length-1),pathLast:pathSegments[pathSegments.length-1],generics:generics,typeFilter,}}function getIdentEndPosition(parserState){const start=parserState.pos;let end=parserState.pos;let foundExclamation=-1;while(parserState.pos=end){throw["Found generics without a path"]}parserState.pos+=1;getItemsBefore(query,parserState,generics,">")}if(isStringElem){skipWhitespace(parserState)}if(start>=end&&generics.length===0){return}elems.push(createQueryElement(query,parserState,parserState.userQuery.slice(start,end),generics,isInGenerics))}}function getItemsBefore(query,parserState,elems,endChar){let foundStopChar=true;let start=parserState.pos;const oldTypeFilter=parserState.typeFilter;parserState.typeFilter=null;let extra="";if(endChar===">"){extra="<"}else if(endChar==="]"){extra="["}else if(endChar===""){extra="->"}else{extra=endChar}while(parserState.pos"]}else if(prevIs(parserState,"\"")){throw["Cannot have more than one element if you use quotes"]}if(endChar!==""){throw["Expected ",","," or ",endChar,...extra,", found ",c,]}throw["Expected ",",",...extra,", found ",c,]}const posBefore=parserState.pos;start=parserState.pos;getNextElem(query,parserState,elems,endChar!=="");if(endChar!==""&&parserState.pos>=parserState.length){throw["Unclosed ",extra]}if(posBefore===parserState.pos){parserState.pos+=1}foundStopChar=false}if(parserState.pos>=parserState.length&&endChar!==""){throw["Unclosed ",extra]}parserState.pos+=1;parserState.typeFilter=oldTypeFilter}function checkExtraTypeFilterCharacters(start,parserState){const query=parserState.userQuery.slice(start,parserState.pos).trim();for(const c in query){if(!isIdentCharacter(query[c])){throw["Unexpected ",query[c]," in type filter (before ",":",")",]}}}function parseInput(query,parserState){let foundStopChar=true;let start=parserState.pos;while(parserState.pos"){if(isReturnArrow(parserState)){break}throw["Unexpected ",c," (did you mean ","->","?)"]}throw["Unexpected ",c]}else if(c===":"&&!isPathStart(parserState)){if(parserState.typeFilter!==null){throw["Unexpected ",":"," (expected path after type filter ",parserState.typeFilter+":",")",]}else if(query.elems.length===0){throw["Expected type filter before ",":"]}else if(query.literalSearch){throw["Cannot use quotes on type filter"]}const typeFilterElem=query.elems.pop();checkExtraTypeFilterCharacters(start,parserState);parserState.typeFilter=typeFilterElem.name;parserState.pos+=1;parserState.totalElems-=1;query.literalSearch=false;foundStopChar=true;continue}else if(isWhitespace(c)){skipWhitespace(parserState);continue}if(!foundStopChar){let extra="";if(isLastElemGeneric(query.elems,parserState)){extra=[" after ",">"]}else if(prevIs(parserState,"\"")){throw["Cannot have more than one element if you use quotes"]}if(parserState.typeFilter!==null){throw["Expected ",","," or ","->",...extra,", found ",c,]}throw["Expected ",",",", ",":"," or ","->",...extra,", found ",c,]}const before=query.elems.length;start=parserState.pos;getNextElem(query,parserState,query.elems,false);if(query.elems.length===before){parserState.pos+=1}foundStopChar=false}if(parserState.typeFilter!==null){throw["Unexpected ",":"," (expected path after type filter ",parserState.typeFilter+":",")",]}while(parserState.pos"]}break}else{parserState.pos+=1}}}function newParsedQuery(userQuery){return{original:userQuery,userQuery:userQuery.toLowerCase(),elems:[],returned:[],foundElems:0,totalElems:0,literalSearch:false,error:null,correction:null,proposeCorrectionFrom:null,proposeCorrectionTo:null,}}function buildUrl(search,filterCrates){let extra="?search="+encodeURIComponent(search);if(filterCrates!==null){extra+="&filter-crate="+encodeURIComponent(filterCrates)}return getNakedUrl()+extra+window.location.hash}function getFilterCrates(){const elem=document.getElementById("crate-search");if(elem&&elem.value!=="all crates"&&hasOwnPropertyRustdoc(rawSearchIndex,elem.value)){return elem.value}return null}function parseQuery(userQuery){function convertTypeFilterOnElem(elem){if(elem.typeFilter!==null){let typeFilter=elem.typeFilter;if(typeFilter==="const"){typeFilter="constant"}elem.typeFilter=itemTypeFromName(typeFilter)}else{elem.typeFilter=NO_TYPE_FILTER}for(const elem2 of elem.generics){convertTypeFilterOnElem(elem2)}}userQuery=userQuery.trim();const parserState={length:userQuery.length,pos:0,totalElems:0,genericsElems:0,typeFilter:null,userQuery:userQuery.toLowerCase(),};let query=newParsedQuery(userQuery);try{parseInput(query,parserState);for(const elem of query.elems){convertTypeFilterOnElem(elem)}for(const elem of query.returned){convertTypeFilterOnElem(elem)}}catch(err){query=newParsedQuery(userQuery);query.error=err;return query}if(!query.literalSearch){query.literalSearch=parserState.totalElems>1}query.foundElems=query.elems.length+query.returned.length;query.totalElems=parserState.totalElems;return query}function createQueryResults(results_in_args,results_returned,results_others,parsedQuery){return{"in_args":results_in_args,"returned":results_returned,"others":results_others,"query":parsedQuery,}}function execQuery(parsedQuery,searchWords,filterCrates,currentCrate){const results_others=new Map(),results_in_args=new Map(),results_returned=new Map();function transformResults(results){const duplicates=new Set();const out=[];for(const result of results){if(result.id!==-1){const obj=searchIndex[result.id];obj.dist=result.dist;const res=buildHrefAndPath(obj);obj.displayPath=pathSplitter(res[0]);obj.fullPath=obj.displayPath+obj.name;obj.fullPath+="|"+obj.ty;if(duplicates.has(obj.fullPath)){continue}duplicates.add(obj.fullPath);obj.href=res[1];out.push(obj);if(out.length>=MAX_RESULTS){break}}}return out}function sortResults(results,isType,preferredCrate){if(results.size===0){return[]}const userQuery=parsedQuery.userQuery;const result_list=[];for(const result of results.values()){result.word=searchWords[result.id];result.item=searchIndex[result.id]||{};result_list.push(result)}result_list.sort((aaa,bbb)=>{let a,b;a=(aaa.word!==userQuery);b=(bbb.word!==userQuery);if(a!==b){return a-b}a=(aaa.index<0);b=(bbb.index<0);if(a!==b){return a-b}a=aaa.path_dist;b=bbb.path_dist;if(a!==b){return a-b}a=aaa.index;b=bbb.index;if(a!==b){return a-b}a=(aaa.dist);b=(bbb.dist);if(a!==b){return a-b}a=aaa.item.deprecated;b=bbb.item.deprecated;if(a!==b){return a-b}a=(aaa.item.crate!==preferredCrate);b=(bbb.item.crate!==preferredCrate);if(a!==b){return a-b}a=aaa.word.length;b=bbb.word.length;if(a!==b){return a-b}a=aaa.word;b=bbb.word;if(a!==b){return(a>b?+1:-1)}if((aaa.item.ty===TY_PRIMITIVE&&bbb.item.ty!==TY_KEYWORD)||(aaa.item.ty===TY_KEYWORD&&bbb.item.ty!==TY_PRIMITIVE)){return-1}if((bbb.item.ty===TY_PRIMITIVE&&aaa.item.ty!==TY_PRIMITIVE)||(bbb.item.ty===TY_KEYWORD&&aaa.item.ty!==TY_KEYWORD)){return 1}a=(aaa.item.desc==="");b=(bbb.item.desc==="");if(a!==b){return a-b}a=aaa.item.ty;b=bbb.item.ty;if(a!==b){return a-b}a=aaa.item.path;b=bbb.item.path;if(a!==b){return(a>b?+1:-1)}return 0});let nameSplit=null;if(parsedQuery.elems.length===1){const hasPath=typeof parsedQuery.elems[0].path==="undefined";nameSplit=hasPath?null:parsedQuery.elems[0].path}for(const result of result_list){if(result.dontValidate){continue}const name=result.item.name.toLowerCase(),path=result.item.path.toLowerCase(),parent=result.item.parent;if(!isType&&!validateResult(name,path,nameSplit,parent)){result.id=-1}}return transformResults(result_list)}function checkGenerics(fnType,queryElem,whereClause,mgensInout){return unifyFunctionTypes(fnType.generics,queryElem.generics,whereClause,mgensInout,mgens=>{if(mgensInout){for(const[fid,qid]of mgens.entries()){mgensInout.set(fid,qid)}}return true})}function unifyFunctionTypes(fnTypesIn,queryElems,whereClause,mgensIn,solutionCb){let mgens=new Map(mgensIn);if(queryElems.length===0){return!solutionCb||solutionCb(mgens)}if(!fnTypesIn||fnTypesIn.length===0){return false}const ql=queryElems.length;let fl=fnTypesIn.length;let fnTypes=fnTypesIn.slice();const backtracking=[];let i=0;let j=0;const backtrack=()=>{while(backtracking.length!==0){const{fnTypesScratch,mgensScratch,queryElemsOffset,fnTypesOffset,unbox,}=backtracking.pop();mgens=new Map(mgensScratch);const fnType=fnTypesScratch[fnTypesOffset];const queryElem=queryElems[queryElemsOffset];if(unbox){if(fnType.id<0){if(mgens.has(fnType.id)&&mgens.get(fnType.id)!==0){continue}mgens.set(fnType.id,0)}const generics=fnType.id<0?whereClause[(-fnType.id)-1]:fnType.generics;fnTypes=fnTypesScratch.toSpliced(fnTypesOffset,1,...generics);fl=fnTypes.length;i=queryElemsOffset-1}else{if(fnType.id<0){if(mgens.has(fnType.id)&&mgens.get(fnType.id)!==queryElem.id){continue}mgens.set(fnType.id,queryElem.id)}fnTypes=fnTypesScratch.slice();fl=fnTypes.length;const tmp=fnTypes[queryElemsOffset];fnTypes[queryElemsOffset]=fnTypes[fnTypesOffset];fnTypes[fnTypesOffset]=tmp;i=queryElemsOffset}return true}return false};for(i=0;i!==ql;++i){const queryElem=queryElems[i];const matchCandidates=[];let fnTypesScratch=null;let mgensScratch=null;for(j=i;j!==fl;++j){const fnType=fnTypes[j];if(unifyFunctionTypeIsMatchCandidate(fnType,queryElem,whereClause,mgens)){if(!fnTypesScratch){fnTypesScratch=fnTypes.slice()}unifyFunctionTypes(fnType.generics,queryElem.generics,whereClause,mgens,mgensScratch=>{matchCandidates.push({fnTypesScratch,mgensScratch,queryElemsOffset:i,fnTypesOffset:j,unbox:false,});return false})}if(unifyFunctionTypeIsUnboxCandidate(fnType,queryElem,whereClause,mgens)){if(!fnTypesScratch){fnTypesScratch=fnTypes.slice()}if(!mgensScratch){mgensScratch=new Map(mgens)}backtracking.push({fnTypesScratch,mgensScratch,queryElemsOffset:i,fnTypesOffset:j,unbox:true,})}}if(matchCandidates.length===0){if(backtrack()){continue}else{return false}}const{fnTypesOffset:candidate,mgensScratch:mgensNew}=matchCandidates.pop();if(fnTypes[candidate].id<0&&queryElems[i].id<0){mgens.set(fnTypes[candidate].id,queryElems[i].id)}for(const[fid,qid]of mgensNew){mgens.set(fid,qid)}const tmp=fnTypes[candidate];fnTypes[candidate]=fnTypes[i];fnTypes[i]=tmp;for(const otherCandidate of matchCandidates){backtracking.push(otherCandidate)}while(i===(ql-1)&&solutionCb&&!solutionCb(mgens)){if(!backtrack()){return false}}}return true}function unifyFunctionTypeIsMatchCandidate(fnType,queryElem,whereClause,mgens){if(!typePassesFilter(queryElem.typeFilter,fnType.ty)){return false}if(fnType.id<0&&queryElem.id<0){if(mgens.has(fnType.id)&&mgens.get(fnType.id)!==queryElem.id){return false}for(const[fid,qid]of mgens.entries()){if(fnType.id!==fid&&queryElem.id===qid){return false}if(fnType.id===fid&&queryElem.id!==qid){return false}}}else{if(queryElem.id===typeNameIdOfArrayOrSlice&&(fnType.id===typeNameIdOfSlice||fnType.id===typeNameIdOfArray)){}else if(fnType.id!==queryElem.id){return false}if(fnType.generics.length===0&&queryElem.generics.length!==0){return false}const queryElemPathLength=queryElem.pathWithoutLast.length;if(queryElemPathLength>0){const fnTypePath=fnType.path!==undefined&&fnType.path!==null?fnType.path.split("::"):[];if(queryElemPathLength>fnTypePath.length){return false}let i=0;for(const path of fnTypePath){if(path===queryElem.pathWithoutLast[i]){i+=1;if(i>=queryElemPathLength){break}}}if(i=0){if(!whereClause){return false}if(mgens.has(fnType.id)&&mgens.get(fnType.id)!==0){return false}return checkIfInList(whereClause[(-fnType.id)-1],queryElem,whereClause)}else if(fnType.generics&&fnType.generics.length>0){return checkIfInList(fnType.generics,queryElem,whereClause)}return false}function checkIfInList(list,elem,whereClause){for(const entry of list){if(checkType(entry,elem,whereClause)){return true}}return false}function checkType(row,elem,whereClause){if(row.id===null){return row.generics.length>0?checkIfInList(row.generics,elem,whereClause):false}if(row.id<0&&elem.id>=0){const gid=(-row.id)-1;return checkIfInList(whereClause[gid],elem,whereClause)}if(row.id<0&&elem.id<0){return true}const matchesExact=row.id===elem.id;const matchesArrayOrSlice=elem.id===typeNameIdOfArrayOrSlice&&(row.id===typeNameIdOfSlice||row.id===typeNameIdOfArray);if((matchesExact||matchesArrayOrSlice)&&typePassesFilter(elem.typeFilter,row.ty)){if(elem.generics.length>0){return checkGenerics(row,elem,whereClause,new Map())}return true}return checkIfInList(row.generics,elem,whereClause)}function checkPath(contains,ty,maxEditDistance){if(contains.length===0){return 0}let ret_dist=maxEditDistance+1;const path=ty.path.split("::");if(ty.parent&&ty.parent.name){path.push(ty.parent.name.toLowerCase())}const length=path.length;const clength=contains.length;if(clength>length){return maxEditDistance+1}for(let i=0;ilength){break}let dist_total=0;let aborted=false;for(let x=0;xmaxEditDistance){aborted=true;break}dist_total+=dist}if(!aborted){ret_dist=Math.min(ret_dist,Math.round(dist_total/clength))}}return ret_dist}function typePassesFilter(filter,type){if(filter<=NO_TYPE_FILTER||filter===type)return true;const name=itemTypes[type];switch(itemTypes[filter]){case"constant":return name==="associatedconstant";case"fn":return name==="method"||name==="tymethod";case"type":return name==="primitive"||name==="associatedtype";case"trait":return name==="traitalias"}return false}function createAliasFromItem(item){return{crate:item.crate,name:item.name,path:item.path,desc:item.desc,ty:item.ty,parent:item.parent,type:item.type,is_alias:true,deprecated:item.deprecated,}}function handleAliases(ret,query,filterCrates,currentCrate){const lowerQuery=query.toLowerCase();const aliases=[];const crateAliases=[];if(filterCrates!==null){if(ALIASES.has(filterCrates)&&ALIASES.get(filterCrates).has(lowerQuery)){const query_aliases=ALIASES.get(filterCrates).get(lowerQuery);for(const alias of query_aliases){aliases.push(createAliasFromItem(searchIndex[alias]))}}}else{for(const[crate,crateAliasesIndex]of ALIASES){if(crateAliasesIndex.has(lowerQuery)){const pushTo=crate===currentCrate?crateAliases:aliases;const query_aliases=crateAliasesIndex.get(lowerQuery);for(const alias of query_aliases){pushTo.push(createAliasFromItem(searchIndex[alias]))}}}}const sortFunc=(aaa,bbb)=>{if(aaa.path{alias.alias=query;const res=buildHrefAndPath(alias);alias.displayPath=pathSplitter(res[0]);alias.fullPath=alias.displayPath+alias.name;alias.href=res[1];ret.others.unshift(alias);if(ret.others.length>MAX_RESULTS){ret.others.pop()}};aliases.forEach(pushFunc);crateAliases.forEach(pushFunc)}function addIntoResults(results,fullId,id,index,dist,path_dist,maxEditDistance){const inBounds=dist<=maxEditDistance||index!==-1;if(dist===0||(!parsedQuery.literalSearch&&inBounds)){if(results.has(fullId)){const result=results.get(fullId);if(result.dontValidate||result.dist<=dist){return}}results.set(fullId,{id:id,index:index,dontValidate:parsedQuery.literalSearch,dist:dist,path_dist:path_dist,})}}function handleSingleArg(row,pos,elem,results_others,results_in_args,results_returned,maxEditDistance){if(!row||(filterCrates!==null&&row.crate!==filterCrates)){return}let index=-1,path_dist=0;const fullId=row.id;const searchWord=searchWords[pos];const in_args=row.type&&row.type.inputs&&checkIfInList(row.type.inputs,elem,row.type.where_clause);if(in_args){addIntoResults(results_in_args,fullId,pos,-1,0,0,maxEditDistance)}const returned=row.type&&row.type.output&&checkIfInList(row.type.output,elem,row.type.where_clause);if(returned){addIntoResults(results_returned,fullId,pos,-1,0,0,maxEditDistance)}if(!typePassesFilter(elem.typeFilter,row.ty)){return}const row_index=row.normalizedName.indexOf(elem.pathLast);const word_index=searchWord.indexOf(elem.pathLast);if(row_index===-1){index=word_index}else if(word_index===-1){index=row_index}else if(word_index1){path_dist=checkPath(elem.pathWithoutLast,row,maxEditDistance);if(path_dist>maxEditDistance){return}}if(parsedQuery.literalSearch){if(searchWord===elem.name){addIntoResults(results_others,fullId,pos,index,0,path_dist)}return}const dist=editDistance(searchWord,elem.pathLast,maxEditDistance);if(index===-1&&dist+path_dist>maxEditDistance){return}addIntoResults(results_others,fullId,pos,index,dist,path_dist,maxEditDistance)}function handleArgs(row,pos,results){if(!row||(filterCrates!==null&&row.crate!==filterCrates)||!row.type){return}if(!unifyFunctionTypes(row.type.inputs,parsedQuery.elems,row.type.where_clause,null,mgens=>{return unifyFunctionTypes(row.type.output,parsedQuery.returned,row.type.where_clause,mgens)})){return}addIntoResults(results,row.id,pos,0,0,0,Number.MAX_VALUE)}function innerRunQuery(){let elem,i,nSearchWords,in_returned,row;let queryLen=0;for(const elem of parsedQuery.elems){queryLen+=elem.name.length}for(const elem of parsedQuery.returned){queryLen+=elem.name.length}const maxEditDistance=Math.floor(queryLen/3);const genericSymbols=new Map();function convertNameToId(elem){if(typeNameIdMap.has(elem.pathLast)){elem.id=typeNameIdMap.get(elem.pathLast)}else if(!parsedQuery.literalSearch){let match=null;let matchDist=maxEditDistance+1;let matchName="";for(const[name,id]of typeNameIdMap){const dist=editDistance(name,elem.pathLast,maxEditDistance);if(dist<=matchDist&&dist<=maxEditDistance){if(dist===matchDist&&matchName>name){continue}match=id;matchDist=dist;matchName=name}}if(match!==null){parsedQuery.correction=matchName}elem.id=match}if((elem.id===null&&parsedQuery.totalElems>1&&elem.typeFilter===-1&&elem.generics.length===0)||elem.typeFilter===TY_GENERIC){if(genericSymbols.has(elem.name)){elem.id=genericSymbols.get(elem.name)}else{elem.id=-(genericSymbols.size+1);genericSymbols.set(elem.name,elem.id)}if(elem.typeFilter===-1&&elem.name.length>=3){const maxPartDistance=Math.floor(elem.name.length/3);let matchDist=maxPartDistance+1;let matchName="";for(const name of typeNameIdMap.keys()){const dist=editDistance(name,elem.name,maxPartDistance);if(dist<=matchDist&&dist<=maxPartDistance){if(dist===matchDist&&matchName>name){continue}matchDist=dist;matchName=name}}if(matchName!==""){parsedQuery.proposeCorrectionFrom=elem.name;parsedQuery.proposeCorrectionTo=matchName}}elem.typeFilter=TY_GENERIC}if(elem.generics.length>0&&elem.typeFilter===TY_GENERIC){parsedQuery.error=["Generic type parameter ",elem.name," does not accept generic parameters",]}for(const elem2 of elem.generics){convertNameToId(elem2)}}for(const elem of parsedQuery.elems){convertNameToId(elem)}for(const elem of parsedQuery.returned){convertNameToId(elem)}if(parsedQuery.foundElems===1){if(parsedQuery.elems.length===1){elem=parsedQuery.elems[0];for(i=0,nSearchWords=searchWords.length;i0){for(i=0,nSearchWords=searchWords.length;i-1||path.indexOf(key)>-1||(parent!==undefined&&parent.name!==undefined&&parent.name.toLowerCase().indexOf(key)>-1)||editDistance(name,key,maxEditDistance)<=maxEditDistance)){return false}}return true}function nextTab(direction){const next=(searchState.currentTab+direction+3)%searchState.focusedByTab.length;searchState.focusedByTab[searchState.currentTab]=document.activeElement;printTab(next);focusSearchResult()}function focusSearchResult(){const target=searchState.focusedByTab[searchState.currentTab]||document.querySelectorAll(".search-results.active a").item(0)||document.querySelectorAll("#search-tabs button").item(searchState.currentTab);searchState.focusedByTab[searchState.currentTab]=null;if(target){target.focus()}}function buildHrefAndPath(item){let displayPath;let href;const type=itemTypes[item.ty];const name=item.name;let path=item.path;if(type==="mod"){displayPath=path+"::";href=ROOT_PATH+path.replace(/::/g,"/")+"/"+name+"/index.html"}else if(type==="import"){displayPath=item.path+"::";href=ROOT_PATH+item.path.replace(/::/g,"/")+"/index.html#reexport."+name}else if(type==="primitive"||type==="keyword"){displayPath="";href=ROOT_PATH+path.replace(/::/g,"/")+"/"+type+"."+name+".html"}else if(type==="externcrate"){displayPath="";href=ROOT_PATH+name+"/index.html"}else if(item.parent!==undefined){const myparent=item.parent;let anchor="#"+type+"."+name;const parentType=itemTypes[myparent.ty];let pageType=parentType;let pageName=myparent.name;if(parentType==="primitive"){displayPath=myparent.name+"::"}else if(type==="structfield"&&parentType==="variant"){const enumNameIdx=item.path.lastIndexOf("::");const enumName=item.path.substr(enumNameIdx+2);path=item.path.substr(0,enumNameIdx);displayPath=path+"::"+enumName+"::"+myparent.name+"::";anchor="#variant."+myparent.name+".field."+name;pageType="enum";pageName=enumName}else{displayPath=path+"::"+myparent.name+"::"}href=ROOT_PATH+path.replace(/::/g,"/")+"/"+pageType+"."+pageName+".html"+anchor}else{displayPath=item.path+"::";href=ROOT_PATH+item.path.replace(/::/g,"/")+"/"+type+"."+name+".html"}return[displayPath,href]}function pathSplitter(path){const tmp=""+path.replace(/::/g,"::");if(tmp.endsWith("")){return tmp.slice(0,tmp.length-6)}return tmp}function addTab(array,query,display){let extraClass="";if(display===true){extraClass=" active"}const output=document.createElement("div");let length=0;if(array.length>0){output.className="search-results "+extraClass;array.forEach(item=>{const name=item.name;const type=itemTypes[item.ty];const longType=longItemTypes[item.ty];const typeName=longType.length!==0?`${longType}`:"?";length+=1;const link=document.createElement("a");link.className="result-"+type;link.href=item.href;const resultName=document.createElement("div");resultName.className="result-name";resultName.insertAdjacentHTML("beforeend",`${typeName}`);link.appendChild(resultName);let alias=" ";if(item.is_alias){alias=`
    \ +${item.alias} - see \ +
    `}resultName.insertAdjacentHTML("beforeend",`
    ${alias}\ +${item.displayPath}${name}\ +
    `);const description=document.createElement("div");description.className="desc";description.insertAdjacentHTML("beforeend",item.desc);link.appendChild(description);output.appendChild(link)})}else if(query.error===null){output.className="search-failed"+extraClass;output.innerHTML="No results :(
    "+"Try on DuckDuckGo?

    "+"Or try looking in one of these:"}return[output,length]}function makeTabHeader(tabNb,text,nbElems){const fmtNbElems=nbElems<10?`\u{2007}(${nbElems})\u{2007}\u{2007}`:nbElems<100?`\u{2007}(${nbElems})\u{2007}`:`\u{2007}(${nbElems})`;if(searchState.currentTab===tabNb){return""}return""}function showResults(results,go_to_first,filterCrates){const search=searchState.outputElement();if(go_to_first||(results.others.length===1&&getSettingValue("go-to-only-result")==="true")){window.onunload=()=>{};searchState.removeQueryParameters();const elem=document.createElement("a");elem.href=results.others[0].href;removeClass(elem,"active");document.body.appendChild(elem);elem.click();return}if(results.query===undefined){results.query=parseQuery(searchState.input.value)}currentResults=results.query.userQuery;const ret_others=addTab(results.others,results.query,true);const ret_in_args=addTab(results.in_args,results.query,false);const ret_returned=addTab(results.returned,results.query,false);let currentTab=searchState.currentTab;if((currentTab===0&&ret_others[1]===0)||(currentTab===1&&ret_in_args[1]===0)||(currentTab===2&&ret_returned[1]===0)){if(ret_others[1]!==0){currentTab=0}else if(ret_in_args[1]!==0){currentTab=1}else if(ret_returned[1]!==0){currentTab=2}}let crates="";const crates_list=Object.keys(rawSearchIndex);if(crates_list.length>1){crates=" in 
    "}let output=`

    Results${crates}

    `;if(results.query.error!==null){const error=results.query.error;error.forEach((value,index)=>{value=value.split("<").join("<").split(">").join(">");if(index%2!==0){error[index]=`${value.replaceAll(" ", " ")}`}else{error[index]=value}});output+=`

    Query parser error: "${error.join("")}".

    `;output+="
    "+makeTabHeader(0,"In Names",ret_others[1])+"
    ";currentTab=0}else if(results.query.foundElems<=1&&results.query.returned.length===0){output+="
    "+makeTabHeader(0,"In Names",ret_others[1])+makeTabHeader(1,"In Parameters",ret_in_args[1])+makeTabHeader(2,"In Return Types",ret_returned[1])+"
    "}else{const signatureTabTitle=results.query.elems.length===0?"In Function Return Types":results.query.returned.length===0?"In Function Parameters":"In Function Signatures";output+="
    "+makeTabHeader(0,signatureTabTitle,ret_others[1])+"
    ";currentTab=0}if(results.query.correction!==null){const orig=results.query.returned.length>0?results.query.returned[0].name:results.query.elems[0].name;output+="

    "+`Type "${orig}" not found. `+"Showing results for closest type name "+`"${results.query.correction}" instead.

    `}if(results.query.proposeCorrectionFrom!==null){const orig=results.query.proposeCorrectionFrom;const targ=results.query.proposeCorrectionTo;output+="

    "+`Type "${orig}" not found and used as generic parameter. `+`Consider searching for "${targ}" instead.

    `}const resultsElem=document.createElement("div");resultsElem.id="results";resultsElem.appendChild(ret_others[0]);resultsElem.appendChild(ret_in_args[0]);resultsElem.appendChild(ret_returned[0]);search.innerHTML=output;const crateSearch=document.getElementById("crate-search");if(crateSearch){crateSearch.addEventListener("input",updateCrate)}search.appendChild(resultsElem);searchState.showResults(search);const elems=document.getElementById("search-tabs").childNodes;searchState.focusedByTab=[];let i=0;for(const elem of elems){const j=i;elem.onclick=()=>printTab(j);searchState.focusedByTab.push(null);i+=1}printTab(currentTab)}function updateSearchHistory(url){if(!browserSupportsHistoryApi()){return}const params=searchState.getQueryStringParams();if(!history.state&&!params.search){history.pushState(null,"",url)}else{history.replaceState(null,"",url)}}function search(e,forced){if(e){e.preventDefault()}const query=parseQuery(searchState.input.value.trim());let filterCrates=getFilterCrates();if(!forced&&query.userQuery===currentResults){if(query.userQuery.length>0){putBackSearch()}return}searchState.setLoadingSearch();const params=searchState.getQueryStringParams();if(filterCrates===null&¶ms["filter-crate"]!==undefined){filterCrates=params["filter-crate"]}searchState.title="Results for "+query.original+" - Rust";updateSearchHistory(buildUrl(query.original,filterCrates));showResults(execQuery(query,searchWords,filterCrates,window.currentCrate),params.go_to_first,filterCrates)}function buildItemSearchTypeAll(types,lowercasePaths){return types.map(type=>buildItemSearchType(type,lowercasePaths))}function buildItemSearchType(type,lowercasePaths){const PATH_INDEX_DATA=0;const GENERICS_DATA=1;let pathIndex,generics;if(typeof type==="number"){pathIndex=type;generics=[]}else{pathIndex=type[PATH_INDEX_DATA];generics=buildItemSearchTypeAll(type[GENERICS_DATA],lowercasePaths)}if(pathIndex<0){return{id:pathIndex,ty:TY_GENERIC,path:null,generics,}}if(pathIndex===0){return{id:null,ty:null,path:null,generics,}}const item=lowercasePaths[pathIndex-1];return{id:buildTypeMapIndex(item.name),ty:item.ty,path:item.path,generics,}}function buildFunctionSearchType(functionSearchType,lowercasePaths){const INPUTS_DATA=0;const OUTPUT_DATA=1;if(functionSearchType===0){return null}let inputs,output;if(typeof functionSearchType[INPUTS_DATA]==="number"){inputs=[buildItemSearchType(functionSearchType[INPUTS_DATA],lowercasePaths)]}else{inputs=buildItemSearchTypeAll(functionSearchType[INPUTS_DATA],lowercasePaths)}if(functionSearchType.length>1){if(typeof functionSearchType[OUTPUT_DATA]==="number"){output=[buildItemSearchType(functionSearchType[OUTPUT_DATA],lowercasePaths)]}else{output=buildItemSearchTypeAll(functionSearchType[OUTPUT_DATA],lowercasePaths)}}else{output=[]}const where_clause=[];const l=functionSearchType.length;for(let i=2;i2){path=itemPaths.has(elem[2])?itemPaths.get(elem[2]):lastPath;lastPath=path}lowercasePaths.push({ty:ty,name:name.toLowerCase(),path:path});paths[i]={ty:ty,name:name,path:path}}lastPath="";len=itemTypes.length;for(let i=0;i0?paths[itemParentIdxs[i]-1]:undefined,type:buildFunctionSearchType(itemFunctionSearchTypes[i],lowercasePaths),id:id,normalizedName:word.indexOf("_")===-1?word:word.replace(/_/g,""),deprecated:deprecatedItems.has(i),};id+=1;searchIndex.push(row);lastPath=row.path;crateSize+=1}if(aliases){const currentCrateAliases=new Map();ALIASES.set(crate,currentCrateAliases);for(const alias_name in aliases){if(!hasOwnPropertyRustdoc(aliases,alias_name)){continue}let currentNameAliases;if(currentCrateAliases.has(alias_name)){currentNameAliases=currentCrateAliases.get(alias_name)}else{currentNameAliases=[];currentCrateAliases.set(alias_name,currentNameAliases)}for(const local_alias of aliases[alias_name]){currentNameAliases.push(local_alias+currentIndex)}}}currentIndex+=crateSize}return searchWords}function onSearchSubmit(e){e.preventDefault();searchState.clearInputTimeout();search()}function putBackSearch(){const search_input=searchState.input;if(!searchState.input){return}if(search_input.value!==""&&!searchState.isDisplayed()){searchState.showResults();if(browserSupportsHistoryApi()){history.replaceState(null,"",buildUrl(search_input.value,getFilterCrates()))}document.title=searchState.title}}function registerSearchEvents(){const params=searchState.getQueryStringParams();if(searchState.input.value===""){searchState.input.value=params.search||""}const searchAfter500ms=()=>{searchState.clearInputTimeout();if(searchState.input.value.length===0){searchState.hideResults()}else{searchState.timeout=setTimeout(search,500)}};searchState.input.onkeyup=searchAfter500ms;searchState.input.oninput=searchAfter500ms;document.getElementsByClassName("search-form")[0].onsubmit=onSearchSubmit;searchState.input.onchange=e=>{if(e.target!==document.activeElement){return}searchState.clearInputTimeout();setTimeout(search,0)};searchState.input.onpaste=searchState.input.onchange;searchState.outputElement().addEventListener("keydown",e=>{if(e.altKey||e.ctrlKey||e.shiftKey||e.metaKey){return}if(e.which===38){const previous=document.activeElement.previousElementSibling;if(previous){previous.focus()}else{searchState.focus()}e.preventDefault()}else if(e.which===40){const next=document.activeElement.nextElementSibling;if(next){next.focus()}const rect=document.activeElement.getBoundingClientRect();if(window.innerHeight-rect.bottom{if(e.which===40){focusSearchResult();e.preventDefault()}});searchState.input.addEventListener("focus",()=>{putBackSearch()});searchState.input.addEventListener("blur",()=>{searchState.input.placeholder=searchState.input.origPlaceholder});if(browserSupportsHistoryApi()){const previousTitle=document.title;window.addEventListener("popstate",e=>{const params=searchState.getQueryStringParams();document.title=previousTitle;currentResults=null;if(params.search&¶ms.search.length>0){searchState.input.value=params.search;search(e)}else{searchState.input.value="";searchState.hideResults()}})}window.onpageshow=()=>{const qSearch=searchState.getQueryStringParams().search;if(searchState.input.value===""&&qSearch){searchState.input.value=qSearch}search()}}function updateCrate(ev){if(ev.target.value==="all crates"){const query=searchState.input.value.trim();updateSearchHistory(buildUrl(query,null))}currentResults=null;search(undefined,true)}const searchWords=buildIndex(rawSearchIndex);if(typeof window!=="undefined"){registerSearchEvents();if(window.searchState.getQueryStringParams().search){search()}}if(typeof exports!=="undefined"){exports.initSearch=initSearch;exports.execQuery=execQuery;exports.parseQuery=parseQuery}return searchWords}if(typeof window!=="undefined"){window.initSearch=initSearch;if(window.searchIndex!==undefined){initSearch(window.searchIndex)}}else{initSearch({})}})() \ No newline at end of file diff --git a/ch6-dev/static.files/settings-74424d7eec62a23e.js b/ch6-dev/static.files/settings-74424d7eec62a23e.js new file mode 100644 index 00000000..3014f75c --- /dev/null +++ b/ch6-dev/static.files/settings-74424d7eec62a23e.js @@ -0,0 +1,17 @@ +"use strict";(function(){const isSettingsPage=window.location.pathname.endsWith("/settings.html");function changeSetting(settingName,value){if(settingName==="theme"){const useSystem=value==="system preference"?"true":"false";updateLocalStorage("use-system-theme",useSystem)}updateLocalStorage(settingName,value);switch(settingName){case"theme":case"preferred-dark-theme":case"preferred-light-theme":updateTheme();updateLightAndDark();break;case"line-numbers":if(value===true){window.rustdoc_add_line_numbers_to_examples()}else{window.rustdoc_remove_line_numbers_from_examples()}break}}function showLightAndDark(){removeClass(document.getElementById("preferred-light-theme"),"hidden");removeClass(document.getElementById("preferred-dark-theme"),"hidden")}function hideLightAndDark(){addClass(document.getElementById("preferred-light-theme"),"hidden");addClass(document.getElementById("preferred-dark-theme"),"hidden")}function updateLightAndDark(){const useSystem=getSettingValue("use-system-theme");if(useSystem==="true"||(useSystem===null&&getSettingValue("theme")===null)){showLightAndDark()}else{hideLightAndDark()}}function setEvents(settingsElement){updateLightAndDark();onEachLazy(settingsElement.querySelectorAll("input[type=\"checkbox\"]"),toggle=>{const settingId=toggle.id;const settingValue=getSettingValue(settingId);if(settingValue!==null){toggle.checked=settingValue==="true"}toggle.onchange=()=>{changeSetting(toggle.id,toggle.checked)}});onEachLazy(settingsElement.querySelectorAll("input[type=\"radio\"]"),elem=>{const settingId=elem.name;let settingValue=getSettingValue(settingId);if(settingId==="theme"){const useSystem=getSettingValue("use-system-theme");if(useSystem==="true"||settingValue===null){settingValue=useSystem==="false"?"light":"system preference"}}if(settingValue!==null&&settingValue!=="null"){elem.checked=settingValue===elem.value}elem.addEventListener("change",ev=>{changeSetting(ev.target.name,ev.target.value)})})}function buildSettingsPageSections(settings){let output="";for(const setting of settings){const js_data_name=setting["js_name"];const setting_name=setting["name"];if(setting["options"]!==undefined){output+=`\ +
    +
    ${setting_name}
    +
    `;onEach(setting["options"],option=>{const checked=option===setting["default"]?" checked":"";const full=`${js_data_name}-${option.replace(/ /g,"-")}`;output+=`\ + `});output+=`\ +
    +
    `}else{const checked=setting["default"]===true?" checked":"";output+=`\ +
    \ + \ +
    `}}return output}function buildSettingsPage(){const theme_names=getVar("themes").split(",").filter(t=>t);theme_names.push("light","dark","ayu");const settings=[{"name":"Theme","js_name":"theme","default":"system preference","options":theme_names.concat("system preference"),},{"name":"Preferred light theme","js_name":"preferred-light-theme","default":"light","options":theme_names,},{"name":"Preferred dark theme","js_name":"preferred-dark-theme","default":"dark","options":theme_names,},{"name":"Auto-hide item contents for large items","js_name":"auto-hide-large-items","default":true,},{"name":"Auto-hide item methods' documentation","js_name":"auto-hide-method-docs","default":false,},{"name":"Auto-hide trait implementation documentation","js_name":"auto-hide-trait-implementations","default":false,},{"name":"Directly go to item in search if there is only one result","js_name":"go-to-only-result","default":false,},{"name":"Show line numbers on code examples","js_name":"line-numbers","default":false,},{"name":"Disable keyboard shortcuts","js_name":"disable-shortcuts","default":false,},];const elementKind=isSettingsPage?"section":"div";const innerHTML=`
    ${buildSettingsPageSections(settings)}
    `;const el=document.createElement(elementKind);el.id="settings";if(!isSettingsPage){el.className="popover"}el.innerHTML=innerHTML;if(isSettingsPage){document.getElementById(MAIN_ID).appendChild(el)}else{el.setAttribute("tabindex","-1");getSettingsButton().appendChild(el)}return el}const settingsMenu=buildSettingsPage();function displaySettings(){settingsMenu.style.display=""}function settingsBlurHandler(event){blurHandler(event,getSettingsButton(),window.hidePopoverMenus)}if(isSettingsPage){getSettingsButton().onclick=event=>{event.preventDefault()}}else{const settingsButton=getSettingsButton();const settingsMenu=document.getElementById("settings");settingsButton.onclick=event=>{if(elemIsInParent(event.target,settingsMenu)){return}event.preventDefault();const shouldDisplaySettings=settingsMenu.style.display==="none";window.hideAllModals();if(shouldDisplaySettings){displaySettings()}};settingsButton.onblur=settingsBlurHandler;settingsButton.querySelector("a").onblur=settingsBlurHandler;onEachLazy(settingsMenu.querySelectorAll("input"),el=>{el.onblur=settingsBlurHandler});settingsMenu.onblur=settingsBlurHandler}setTimeout(()=>{setEvents(settingsMenu);if(!isSettingsPage){displaySettings()}removeClass(getSettingsButton(),"rotate")},0)})() \ No newline at end of file diff --git a/ch6-dev/static.files/src-script-3280b574d94e47b4.js b/ch6-dev/static.files/src-script-3280b574d94e47b4.js new file mode 100644 index 00000000..9ea88921 --- /dev/null +++ b/ch6-dev/static.files/src-script-3280b574d94e47b4.js @@ -0,0 +1 @@ +"use strict";(function(){const rootPath=getVar("root-path");const NAME_OFFSET=0;const DIRS_OFFSET=1;const FILES_OFFSET=2;const RUSTDOC_MOBILE_BREAKPOINT=700;function closeSidebarIfMobile(){if(window.innerWidth"){addClass(document.documentElement,"src-sidebar-expanded");child.innerText="<";updateLocalStorage("source-sidebar-show","true")}else{removeClass(document.documentElement,"src-sidebar-expanded");child.innerText=">";updateLocalStorage("source-sidebar-show","false")}}function createSidebarToggle(){const sidebarToggle=document.createElement("div");sidebarToggle.id="src-sidebar-toggle";const inner=document.createElement("button");if(getCurrentValue("source-sidebar-show")==="true"){inner.innerText="<"}else{inner.innerText=">"}inner.onclick=toggleSidebar;sidebarToggle.appendChild(inner);return sidebarToggle}function createSrcSidebar(){const container=document.querySelector("nav.sidebar");const sidebarToggle=createSidebarToggle();container.insertBefore(sidebarToggle,container.firstChild);const sidebar=document.createElement("div");sidebar.id="src-sidebar";let hasFoundFile=false;const title=document.createElement("div");title.className="title";title.innerText="Files";sidebar.appendChild(title);Object.keys(srcIndex).forEach(key=>{srcIndex[key][NAME_OFFSET]=key;hasFoundFile=createDirEntry(srcIndex[key],sidebar,"",hasFoundFile)});container.appendChild(sidebar);const selected_elem=sidebar.getElementsByClassName("selected")[0];if(typeof selected_elem!=="undefined"){selected_elem.focus()}}const lineNumbersRegex=/^#?(\d+)(?:-(\d+))?$/;function highlightSrcLines(match){if(typeof match==="undefined"){match=window.location.hash.match(lineNumbersRegex)}if(!match){return}let from=parseInt(match[1],10);let to=from;if(typeof match[2]!=="undefined"){to=parseInt(match[2],10)}if(to{onEachLazy(e.getElementsByTagName("a"),i_e=>{removeClass(i_e,"line-highlighted")})});for(let i=from;i<=to;++i){elem=document.getElementById(i);if(!elem){break}addClass(elem,"line-highlighted")}}const handleSrcHighlight=(function(){let prev_line_id=0;const set_fragment=name=>{const x=window.scrollX,y=window.scrollY;if(browserSupportsHistoryApi()){history.replaceState(null,null,"#"+name);highlightSrcLines()}else{location.replace("#"+name)}window.scrollTo(x,y)};return ev=>{let cur_line_id=parseInt(ev.target.id,10);if(isNaN(cur_line_id)||ev.ctrlKey||ev.altKey||ev.metaKey){return}ev.preventDefault();if(ev.shiftKey&&prev_line_id){if(prev_line_id>cur_line_id){const tmp=prev_line_id;prev_line_id=cur_line_id;cur_line_id=tmp}set_fragment(prev_line_id+"-"+cur_line_id)}else{prev_line_id=cur_line_id;set_fragment(cur_line_id)}}}());window.addEventListener("hashchange",()=>{const match=window.location.hash.match(lineNumbersRegex);if(match){return highlightSrcLines(match)}});onEachLazy(document.getElementsByClassName("src-line-numbers"),el=>{el.addEventListener("click",handleSrcHighlight)});highlightSrcLines();window.createSrcSidebar=createSrcSidebar})() \ No newline at end of file diff --git a/ch6-dev/static.files/storage-fec3eaa3851e447d.js b/ch6-dev/static.files/storage-fec3eaa3851e447d.js new file mode 100644 index 00000000..a687118f --- /dev/null +++ b/ch6-dev/static.files/storage-fec3eaa3851e447d.js @@ -0,0 +1 @@ +"use strict";const builtinThemes=["light","dark","ayu"];const darkThemes=["dark","ayu"];window.currentTheme=document.getElementById("themeStyle");const settingsDataset=(function(){const settingsElement=document.getElementById("default-settings");return settingsElement&&settingsElement.dataset?settingsElement.dataset:null})();function getSettingValue(settingName){const current=getCurrentValue(settingName);if(current===null&&settingsDataset!==null){const def=settingsDataset[settingName.replace(/-/g,"_")];if(def!==undefined){return def}}return current}const localStoredTheme=getSettingValue("theme");function hasClass(elem,className){return elem&&elem.classList&&elem.classList.contains(className)}function addClass(elem,className){if(elem&&elem.classList){elem.classList.add(className)}}function removeClass(elem,className){if(elem&&elem.classList){elem.classList.remove(className)}}function onEach(arr,func,reversed){if(arr&&arr.length>0){if(reversed){for(let i=arr.length-1;i>=0;--i){if(func(arr[i])){return true}}}else{for(const elem of arr){if(func(elem)){return true}}}}return false}function onEachLazy(lazyArray,func,reversed){return onEach(Array.prototype.slice.call(lazyArray),func,reversed)}function updateLocalStorage(name,value){try{window.localStorage.setItem("rustdoc-"+name,value)}catch(e){}}function getCurrentValue(name){try{return window.localStorage.getItem("rustdoc-"+name)}catch(e){return null}}const getVar=(function getVar(name){const el=document.querySelector("head > meta[name='rustdoc-vars']");return el?el.attributes["data-"+name].value:null});function switchTheme(newThemeName,saveTheme){if(saveTheme){updateLocalStorage("theme",newThemeName)}document.documentElement.setAttribute("data-theme",newThemeName);if(builtinThemes.indexOf(newThemeName)!==-1){if(window.currentTheme){window.currentTheme.parentNode.removeChild(window.currentTheme);window.currentTheme=null}}else{const newHref=getVar("root-path")+newThemeName+getVar("resource-suffix")+".css";if(!window.currentTheme){if(document.readyState==="loading"){document.write(``);window.currentTheme=document.getElementById("themeStyle")}else{window.currentTheme=document.createElement("link");window.currentTheme.rel="stylesheet";window.currentTheme.id="themeStyle";window.currentTheme.href=newHref;document.documentElement.appendChild(window.currentTheme)}}else if(newHref!==window.currentTheme.href){window.currentTheme.href=newHref}}}const updateTheme=(function(){const mql=window.matchMedia("(prefers-color-scheme: dark)");function updateTheme(){if(getSettingValue("use-system-theme")!=="false"){const lightTheme=getSettingValue("preferred-light-theme")||"light";const darkTheme=getSettingValue("preferred-dark-theme")||"dark";updateLocalStorage("use-system-theme","true");switchTheme(mql.matches?darkTheme:lightTheme,true)}else{switchTheme(getSettingValue("theme"),false)}}mql.addEventListener("change",updateTheme);return updateTheme})();if(getSettingValue("use-system-theme")!=="false"&&window.matchMedia){if(getSettingValue("use-system-theme")===null&&getSettingValue("preferred-dark-theme")===null&&darkThemes.indexOf(localStoredTheme)>=0){updateLocalStorage("preferred-dark-theme",localStoredTheme)}}updateTheme();if(getSettingValue("source-sidebar-show")==="true"){addClass(document.documentElement,"src-sidebar-expanded")}window.addEventListener("pageshow",ev=>{if(ev.persisted){setTimeout(updateTheme,0)}}) \ No newline at end of file diff --git a/ch6-dev/static.files/wheel-7b819b6101059cd0.svg b/ch6-dev/static.files/wheel-7b819b6101059cd0.svg new file mode 100644 index 00000000..83c07f63 --- /dev/null +++ b/ch6-dev/static.files/wheel-7b819b6101059cd0.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ch6-dev/storage.js b/ch6-dev/storage.js deleted file mode 100644 index c6d070de..00000000 --- a/ch6-dev/storage.js +++ /dev/null @@ -1 +0,0 @@ -var darkThemes=["dark","ayu"];window.currentTheme=document.getElementById("themeStyle");window.mainTheme=document.getElementById("mainThemeStyle");var settingsDataset=(function(){var settingsElement=document.getElementById("default-settings");if(settingsElement===null){return null}var dataset=settingsElement.dataset;if(dataset===undefined){return null}return dataset})();function getSettingValue(settingName){var current=getCurrentValue(settingName);if(current!==null){return current}if(settingsDataset!==null){var def=settingsDataset[settingName.replace(/-/g,'_')];if(def!==undefined){return def}}return null}var localStoredTheme=getSettingValue("theme");var savedHref=[];function hasClass(elem,className){return elem&&elem.classList&&elem.classList.contains(className)}function addClass(elem,className){if(!elem||!elem.classList){return}elem.classList.add(className)}function removeClass(elem,className){if(!elem||!elem.classList){return}elem.classList.remove(className)}function onEach(arr,func,reversed){if(arr&&arr.length>0&&func){var length=arr.length;var i;if(reversed){for(i=length-1;i>=0;--i){if(func(arr[i])){return true}}}else{for(i=0;i=0){updateLocalStorage("preferred-dark-theme",localStoredTheme)}updateSystemTheme()}else{switchToSavedTheme()}window.addEventListener("pageshow",function(ev){if(ev.persisted){setTimeout(switchToSavedTheme,0)}}) \ No newline at end of file diff --git a/ch6-dev/toggle-minus.svg b/ch6-dev/toggle-minus.svg deleted file mode 100644 index 73154788..00000000 --- a/ch6-dev/toggle-minus.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ch6-dev/toggle-plus.svg b/ch6-dev/toggle-plus.svg deleted file mode 100644 index 08b17033..00000000 --- a/ch6-dev/toggle-plus.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ch6-dev/wheel.svg b/ch6-dev/wheel.svg deleted file mode 100644 index 01da3b24..00000000 --- a/ch6-dev/wheel.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file