diff --git a/ch4-dev/.lock b/ch4-dev/.lock new file mode 100755 index 00000000..e69de29b diff --git a/ch4-dev/COPYRIGHT.txt b/ch4-dev/COPYRIGHT.txt new file mode 100644 index 00000000..c2629a83 --- /dev/null +++ b/ch4-dev/COPYRIGHT.txt @@ -0,0 +1,50 @@ +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): + + Copyright (c) 2014, Mozilla Foundation https://mozilla.org/ + with Reserved Font Name Fira Sans. + + Copyright (c) 2014, Telefonica S.A. + + Licensed under the SIL Open Font License, Version 1.1. + See FiraSans-LICENSE.txt. + +* rustdoc.css, main.js, and playpen.js: + + Copyright 2015 The Rust Developers. + Licensed under the Apache License, Version 2.0 (see LICENSE-APACHE.txt) or + the MIT license (LICENSE-MIT.txt) at your option. + +* normalize.css: + + Copyright (c) Nicolas Gallagher and Jonathan Neal. + 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): + + 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. + + Licensed under the SIL Open Font License, Version 1.1. + 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): + + 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. + + Licensed under the SIL Open Font License, Version 1.1. + See SourceSerif4-LICENSE.md. + +This copyright file is intended to be distributed with rustdoc output. diff --git a/ch4-dev/FiraSans-LICENSE.txt b/ch4-dev/FiraSans-LICENSE.txt new file mode 100644 index 00000000..ff9afab0 --- /dev/null +++ b/ch4-dev/FiraSans-LICENSE.txt @@ -0,0 +1,94 @@ +Digitized data copyright (c) 2012-2015, The Mozilla Foundation and Telefonica S.A. +with Reserved Font Name < Fira >, + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +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/ch4-dev/FiraSans-Medium.woff b/ch4-dev/FiraSans-Medium.woff new file mode 100644 index 00000000..7d742c5f Binary files /dev/null and b/ch4-dev/FiraSans-Medium.woff differ diff --git a/ch4-dev/FiraSans-Medium.woff2 b/ch4-dev/FiraSans-Medium.woff2 new file mode 100644 index 00000000..7a1e5fc5 Binary files /dev/null and b/ch4-dev/FiraSans-Medium.woff2 differ diff --git a/ch4-dev/FiraSans-Regular.woff b/ch4-dev/FiraSans-Regular.woff new file mode 100644 index 00000000..d8e0363f Binary files /dev/null and b/ch4-dev/FiraSans-Regular.woff differ diff --git a/ch4-dev/FiraSans-Regular.woff2 b/ch4-dev/FiraSans-Regular.woff2 new file mode 100644 index 00000000..e766e06c Binary files /dev/null and b/ch4-dev/FiraSans-Regular.woff2 differ diff --git a/ch4-dev/LICENSE-APACHE.txt b/ch4-dev/LICENSE-APACHE.txt new file mode 100644 index 00000000..16fe87b0 --- /dev/null +++ b/ch4-dev/LICENSE-APACHE.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/ch4-dev/LICENSE-MIT.txt b/ch4-dev/LICENSE-MIT.txt new file mode 100644 index 00000000..31aa7938 --- /dev/null +++ b/ch4-dev/LICENSE-MIT.txt @@ -0,0 +1,23 @@ +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/ch4-dev/NanumBarunGothic-LICENSE.txt b/ch4-dev/NanumBarunGothic-LICENSE.txt new file mode 100644 index 00000000..0bf46682 --- /dev/null +++ b/ch4-dev/NanumBarunGothic-LICENSE.txt @@ -0,0 +1,99 @@ +Copyright (c) 2010, NAVER Corporation (https://www.navercorp.com/), + +with Reserved Font Name Nanum, Naver Nanum, NanumGothic, Naver NanumGothic, +NanumMyeongjo, Naver NanumMyeongjo, NanumBrush, Naver NanumBrush, NanumPen, +Naver NanumPen, Naver NanumGothicEco, NanumGothicEco, Naver NanumMyeongjoEco, +NanumMyeongjoEco, Naver NanumGothicLight, NanumGothicLight, NanumBarunGothic, +Naver NanumBarunGothic, NanumSquareRound, NanumBarunPen, MaruBuri + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +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/ch4-dev/NanumBarunGothic.ttf.woff b/ch4-dev/NanumBarunGothic.ttf.woff new file mode 100644 index 00000000..fb063e8f Binary files /dev/null and b/ch4-dev/NanumBarunGothic.ttf.woff differ diff --git a/ch4-dev/NanumBarunGothic.ttf.woff2 b/ch4-dev/NanumBarunGothic.ttf.woff2 new file mode 100644 index 00000000..1866ad4b Binary files /dev/null and b/ch4-dev/NanumBarunGothic.ttf.woff2 differ diff --git a/ch4-dev/SourceCodePro-It.ttf.woff b/ch4-dev/SourceCodePro-It.ttf.woff new file mode 100644 index 00000000..8d68f2fe Binary files /dev/null and b/ch4-dev/SourceCodePro-It.ttf.woff differ diff --git a/ch4-dev/SourceCodePro-It.ttf.woff2 b/ch4-dev/SourceCodePro-It.ttf.woff2 new file mode 100644 index 00000000..462c34ef Binary files /dev/null and b/ch4-dev/SourceCodePro-It.ttf.woff2 differ diff --git a/ch4-dev/SourceCodePro-LICENSE.txt b/ch4-dev/SourceCodePro-LICENSE.txt new file mode 100644 index 00000000..07542572 --- /dev/null +++ b/ch4-dev/SourceCodePro-LICENSE.txt @@ -0,0 +1,93 @@ +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. + +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +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/ch4-dev/SourceCodePro-Regular.ttf.woff b/ch4-dev/SourceCodePro-Regular.ttf.woff new file mode 100644 index 00000000..7be076e1 Binary files /dev/null and b/ch4-dev/SourceCodePro-Regular.ttf.woff differ diff --git a/ch4-dev/SourceCodePro-Regular.ttf.woff2 b/ch4-dev/SourceCodePro-Regular.ttf.woff2 new file mode 100644 index 00000000..10b558e0 Binary files /dev/null and b/ch4-dev/SourceCodePro-Regular.ttf.woff2 differ diff --git a/ch4-dev/SourceCodePro-Semibold.ttf.woff b/ch4-dev/SourceCodePro-Semibold.ttf.woff new file mode 100644 index 00000000..61bc67b8 Binary files /dev/null and b/ch4-dev/SourceCodePro-Semibold.ttf.woff differ diff --git a/ch4-dev/SourceCodePro-Semibold.ttf.woff2 b/ch4-dev/SourceCodePro-Semibold.ttf.woff2 new file mode 100644 index 00000000..5ec64eef Binary files /dev/null and b/ch4-dev/SourceCodePro-Semibold.ttf.woff2 differ diff --git a/ch4-dev/SourceSerif4-Bold.ttf.woff b/ch4-dev/SourceSerif4-Bold.ttf.woff new file mode 100644 index 00000000..8ad41888 Binary files /dev/null and b/ch4-dev/SourceSerif4-Bold.ttf.woff differ diff --git a/ch4-dev/SourceSerif4-Bold.ttf.woff2 b/ch4-dev/SourceSerif4-Bold.ttf.woff2 new file mode 100644 index 00000000..db57d214 Binary files /dev/null and b/ch4-dev/SourceSerif4-Bold.ttf.woff2 differ diff --git a/ch4-dev/SourceSerif4-It.ttf.woff b/ch4-dev/SourceSerif4-It.ttf.woff new file mode 100644 index 00000000..2a34b5c4 Binary files /dev/null and b/ch4-dev/SourceSerif4-It.ttf.woff differ diff --git a/ch4-dev/SourceSerif4-It.ttf.woff2 b/ch4-dev/SourceSerif4-It.ttf.woff2 new file mode 100644 index 00000000..1cbc021a Binary files /dev/null and b/ch4-dev/SourceSerif4-It.ttf.woff2 differ diff --git a/ch4-dev/SourceSerif4-LICENSE.md b/ch4-dev/SourceSerif4-LICENSE.md new file mode 100644 index 00000000..68ea1892 --- /dev/null +++ b/ch4-dev/SourceSerif4-LICENSE.md @@ -0,0 +1,93 @@ +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. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. + +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +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/ch4-dev/SourceSerif4-Regular.ttf.woff b/ch4-dev/SourceSerif4-Regular.ttf.woff new file mode 100644 index 00000000..45a5521a Binary files /dev/null and b/ch4-dev/SourceSerif4-Regular.ttf.woff differ diff --git a/ch4-dev/SourceSerif4-Regular.ttf.woff2 b/ch4-dev/SourceSerif4-Regular.ttf.woff2 new file mode 100644 index 00000000..2db73fe2 Binary files /dev/null and b/ch4-dev/SourceSerif4-Regular.ttf.woff2 differ diff --git a/ch4-dev/ayu.css b/ch4-dev/ayu.css new file mode 100644 index 00000000..50d893e2 --- /dev/null +++ b/ch4-dev/ayu.css @@ -0,0 +1 @@ + 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/ch4-dev/brush.svg b/ch4-dev/brush.svg new file mode 100644 index 00000000..ea266e85 --- /dev/null +++ b/ch4-dev/brush.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ch4-dev/clipboard.svg b/ch4-dev/clipboard.svg new file mode 100644 index 00000000..8adbd996 --- /dev/null +++ b/ch4-dev/clipboard.svg @@ -0,0 +1 @@ + diff --git a/ch4-dev/crates.js b/ch4-dev/crates.js new file mode 100644 index 00000000..58e198fb --- /dev/null +++ b/ch4-dev/crates.js @@ -0,0 +1 @@ +window.ALL_CRATES = ["os"]; \ No newline at end of file diff --git a/ch4-dev/dark.css b/ch4-dev/dark.css new file mode 100644 index 00000000..a31f453f --- /dev/null +++ b/ch4-dev/dark.css @@ -0,0 +1 @@ +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/ch4-dev/down-arrow.svg b/ch4-dev/down-arrow.svg new file mode 100644 index 00000000..35437e77 --- /dev/null +++ b/ch4-dev/down-arrow.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ch4-dev/favicon-16x16.png b/ch4-dev/favicon-16x16.png new file mode 100644 index 00000000..ea4b45ca Binary files /dev/null and b/ch4-dev/favicon-16x16.png differ diff --git a/ch4-dev/favicon-32x32.png b/ch4-dev/favicon-32x32.png new file mode 100644 index 00000000..69b8613c Binary files /dev/null and b/ch4-dev/favicon-32x32.png differ diff --git a/ch4-dev/favicon.svg b/ch4-dev/favicon.svg new file mode 100644 index 00000000..8b34b511 --- /dev/null +++ b/ch4-dev/favicon.svg @@ -0,0 +1,24 @@ + + + + + diff --git a/ch4-dev/implementors/core/clone/trait.Clone.js b/ch4-dev/implementors/core/clone/trait.Clone.js new file mode 100644 index 00000000..a6c27053 --- /dev/null +++ b/ch4-dev/implementors/core/clone/trait.Clone.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["os"] = [{"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 diff --git a/ch4-dev/implementors/core/cmp/trait.Eq.js b/ch4-dev/implementors/core/cmp/trait.Eq.js new file mode 100644 index 00000000..e54db2a2 --- /dev/null +++ b/ch4-dev/implementors/core/cmp/trait.Eq.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["os"] = [{"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 diff --git a/ch4-dev/implementors/core/cmp/trait.Ord.js b/ch4-dev/implementors/core/cmp/trait.Ord.js new file mode 100644 index 00000000..ee509dd4 --- /dev/null +++ b/ch4-dev/implementors/core/cmp/trait.Ord.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["os"] = [{"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 diff --git a/ch4-dev/implementors/core/cmp/trait.PartialEq.js b/ch4-dev/implementors/core/cmp/trait.PartialEq.js new file mode 100644 index 00000000..ec6cdba8 --- /dev/null +++ b/ch4-dev/implementors/core/cmp/trait.PartialEq.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["os"] = [{"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 diff --git a/ch4-dev/implementors/core/cmp/trait.PartialOrd.js b/ch4-dev/implementors/core/cmp/trait.PartialOrd.js new file mode 100644 index 00000000..38191d91 --- /dev/null +++ b/ch4-dev/implementors/core/cmp/trait.PartialOrd.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["os"] = [{"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 diff --git a/ch4-dev/implementors/core/convert/trait.From.js b/ch4-dev/implementors/core/convert/trait.From.js new file mode 100644 index 00000000..d2fbb8c0 --- /dev/null +++ b/ch4-dev/implementors/core/convert/trait.From.js @@ -0,0 +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 diff --git a/ch4-dev/implementors/core/fmt/trait.Binary.js b/ch4-dev/implementors/core/fmt/trait.Binary.js new file mode 100644 index 00000000..ad893e11 --- /dev/null +++ b/ch4-dev/implementors/core/fmt/trait.Binary.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["os"] = [{"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 diff --git a/ch4-dev/implementors/core/fmt/trait.Debug.js b/ch4-dev/implementors/core/fmt/trait.Debug.js new file mode 100644 index 00000000..d29d3145 --- /dev/null +++ b/ch4-dev/implementors/core/fmt/trait.Debug.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["os"] = [{"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"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch4-dev/implementors/core/fmt/trait.LowerHex.js b/ch4-dev/implementors/core/fmt/trait.LowerHex.js new file mode 100644 index 00000000..eec0f7cb --- /dev/null +++ b/ch4-dev/implementors/core/fmt/trait.LowerHex.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["os"] = [{"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 diff --git a/ch4-dev/implementors/core/fmt/trait.Octal.js b/ch4-dev/implementors/core/fmt/trait.Octal.js new file mode 100644 index 00000000..0a023864 --- /dev/null +++ b/ch4-dev/implementors/core/fmt/trait.Octal.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["os"] = [{"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 diff --git a/ch4-dev/implementors/core/fmt/trait.UpperHex.js b/ch4-dev/implementors/core/fmt/trait.UpperHex.js new file mode 100644 index 00000000..0e55c8ef --- /dev/null +++ b/ch4-dev/implementors/core/fmt/trait.UpperHex.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["os"] = [{"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 diff --git a/ch4-dev/implementors/core/fmt/trait.Write.js b/ch4-dev/implementors/core/fmt/trait.Write.js new file mode 100644 index 00000000..0d40b97a --- /dev/null +++ b/ch4-dev/implementors/core/fmt/trait.Write.js @@ -0,0 +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 diff --git a/ch4-dev/implementors/core/hash/trait.Hash.js b/ch4-dev/implementors/core/hash/trait.Hash.js new file mode 100644 index 00000000..f8f1bed7 --- /dev/null +++ b/ch4-dev/implementors/core/hash/trait.Hash.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["os"] = [{"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 diff --git a/ch4-dev/implementors/core/iter/traits/collect/trait.Extend.js b/ch4-dev/implementors/core/iter/traits/collect/trait.Extend.js new file mode 100644 index 00000000..8f3dc77c --- /dev/null +++ b/ch4-dev/implementors/core/iter/traits/collect/trait.Extend.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["os"] = [{"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 diff --git a/ch4-dev/implementors/core/iter/traits/collect/trait.FromIterator.js b/ch4-dev/implementors/core/iter/traits/collect/trait.FromIterator.js new file mode 100644 index 00000000..18bb59c7 --- /dev/null +++ b/ch4-dev/implementors/core/iter/traits/collect/trait.FromIterator.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["os"] = [{"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 diff --git a/ch4-dev/implementors/core/iter/traits/collect/trait.IntoIterator.js b/ch4-dev/implementors/core/iter/traits/collect/trait.IntoIterator.js new file mode 100644 index 00000000..d4d1dc9e --- /dev/null +++ b/ch4-dev/implementors/core/iter/traits/collect/trait.IntoIterator.js @@ -0,0 +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"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch4-dev/implementors/core/iter/traits/iterator/trait.Iterator.js b/ch4-dev/implementors/core/iter/traits/iterator/trait.Iterator.js new file mode 100644 index 00000000..d9226361 --- /dev/null +++ b/ch4-dev/implementors/core/iter/traits/iterator/trait.Iterator.js @@ -0,0 +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"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch4-dev/implementors/core/marker/trait.Copy.js b/ch4-dev/implementors/core/marker/trait.Copy.js new file mode 100644 index 00000000..250f562d --- /dev/null +++ b/ch4-dev/implementors/core/marker/trait.Copy.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["os"] = [{"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 diff --git a/ch4-dev/implementors/core/marker/trait.Freeze.js b/ch4-dev/implementors/core/marker/trait.Freeze.js new file mode 100644 index 00000000..bc4bea37 --- /dev/null +++ b/ch4-dev/implementors/core/marker/trait.Freeze.js @@ -0,0 +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 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<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 TaskControlBlock","synthetic":true,"types":["os::task::task::TaskControlBlock"]},{"text":"impl Freeze for TaskStatus","synthetic":true,"types":["os::task::task::TaskStatus"]},{"text":"impl !Freeze for TaskManager","synthetic":true,"types":["os::task::TaskManager"]},{"text":"impl Freeze for TaskManagerInner","synthetic":true,"types":["os::task::TaskManagerInner"]},{"text":"impl Freeze for TASK_MANAGER","synthetic":true,"types":["os::task::TASK_MANAGER"]},{"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 diff --git a/ch4-dev/implementors/core/marker/trait.Send.js b/ch4-dev/implementors/core/marker/trait.Send.js new file mode 100644 index 00000000..f91a3be7 --- /dev/null +++ b/ch4-dev/implementors/core/marker/trait.Send.js @@ -0,0 +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 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<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 TaskControlBlock","synthetic":true,"types":["os::task::task::TaskControlBlock"]},{"text":"impl Send for TaskStatus","synthetic":true,"types":["os::task::task::TaskStatus"]},{"text":"impl Send for TaskManager","synthetic":true,"types":["os::task::TaskManager"]},{"text":"impl Send for TaskManagerInner","synthetic":true,"types":["os::task::TaskManagerInner"]},{"text":"impl Send for TASK_MANAGER","synthetic":true,"types":["os::task::TASK_MANAGER"]},{"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 diff --git a/ch4-dev/implementors/core/marker/trait.StructuralEq.js b/ch4-dev/implementors/core/marker/trait.StructuralEq.js new file mode 100644 index 00000000..a8001b08 --- /dev/null +++ b/ch4-dev/implementors/core/marker/trait.StructuralEq.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["os"] = [{"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 diff --git a/ch4-dev/implementors/core/marker/trait.StructuralPartialEq.js b/ch4-dev/implementors/core/marker/trait.StructuralPartialEq.js new file mode 100644 index 00000000..71226479 --- /dev/null +++ b/ch4-dev/implementors/core/marker/trait.StructuralPartialEq.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["os"] = [{"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 diff --git a/ch4-dev/implementors/core/marker/trait.Sync.js b/ch4-dev/implementors/core/marker/trait.Sync.js new file mode 100644 index 00000000..13959b22 --- /dev/null +++ b/ch4-dev/implementors/core/marker/trait.Sync.js @@ -0,0 +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 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 TaskContext","synthetic":true,"types":["os::task::context::TaskContext"]},{"text":"impl Sync for TaskControlBlock","synthetic":true,"types":["os::task::task::TaskControlBlock"]},{"text":"impl Sync for TaskStatus","synthetic":true,"types":["os::task::task::TaskStatus"]},{"text":"impl Sync for TaskManager","synthetic":true,"types":["os::task::TaskManager"]},{"text":"impl Sync for TaskManagerInner","synthetic":true,"types":["os::task::TaskManagerInner"]},{"text":"impl Sync for TASK_MANAGER","synthetic":true,"types":["os::task::TASK_MANAGER"]},{"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 diff --git a/ch4-dev/implementors/core/marker/trait.Unpin.js b/ch4-dev/implementors/core/marker/trait.Unpin.js new file mode 100644 index 00000000..977e8b92 --- /dev/null +++ b/ch4-dev/implementors/core/marker/trait.Unpin.js @@ -0,0 +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 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<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 TaskControlBlock","synthetic":true,"types":["os::task::task::TaskControlBlock"]},{"text":"impl Unpin for TaskStatus","synthetic":true,"types":["os::task::task::TaskStatus"]},{"text":"impl Unpin for TaskManager","synthetic":true,"types":["os::task::TaskManager"]},{"text":"impl Unpin for TaskManagerInner","synthetic":true,"types":["os::task::TaskManagerInner"]},{"text":"impl Unpin for TASK_MANAGER","synthetic":true,"types":["os::task::TASK_MANAGER"]},{"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 diff --git a/ch4-dev/implementors/core/ops/arith/trait.Sub.js b/ch4-dev/implementors/core/ops/arith/trait.Sub.js new file mode 100644 index 00000000..e8fee344 --- /dev/null +++ b/ch4-dev/implementors/core/ops/arith/trait.Sub.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["os"] = [{"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 diff --git a/ch4-dev/implementors/core/ops/arith/trait.SubAssign.js b/ch4-dev/implementors/core/ops/arith/trait.SubAssign.js new file mode 100644 index 00000000..eeea4dea --- /dev/null +++ b/ch4-dev/implementors/core/ops/arith/trait.SubAssign.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["os"] = [{"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 diff --git a/ch4-dev/implementors/core/ops/bit/trait.BitAnd.js b/ch4-dev/implementors/core/ops/bit/trait.BitAnd.js new file mode 100644 index 00000000..e5a4a43f --- /dev/null +++ b/ch4-dev/implementors/core/ops/bit/trait.BitAnd.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["os"] = [{"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 diff --git a/ch4-dev/implementors/core/ops/bit/trait.BitAndAssign.js b/ch4-dev/implementors/core/ops/bit/trait.BitAndAssign.js new file mode 100644 index 00000000..d922a56a --- /dev/null +++ b/ch4-dev/implementors/core/ops/bit/trait.BitAndAssign.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["os"] = [{"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 diff --git a/ch4-dev/implementors/core/ops/bit/trait.BitOr.js b/ch4-dev/implementors/core/ops/bit/trait.BitOr.js new file mode 100644 index 00000000..d9be1d89 --- /dev/null +++ b/ch4-dev/implementors/core/ops/bit/trait.BitOr.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["os"] = [{"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 diff --git a/ch4-dev/implementors/core/ops/bit/trait.BitOrAssign.js b/ch4-dev/implementors/core/ops/bit/trait.BitOrAssign.js new file mode 100644 index 00000000..81aa0e5a --- /dev/null +++ b/ch4-dev/implementors/core/ops/bit/trait.BitOrAssign.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["os"] = [{"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 diff --git a/ch4-dev/implementors/core/ops/bit/trait.BitXor.js b/ch4-dev/implementors/core/ops/bit/trait.BitXor.js new file mode 100644 index 00000000..617e24a1 --- /dev/null +++ b/ch4-dev/implementors/core/ops/bit/trait.BitXor.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["os"] = [{"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 diff --git a/ch4-dev/implementors/core/ops/bit/trait.BitXorAssign.js b/ch4-dev/implementors/core/ops/bit/trait.BitXorAssign.js new file mode 100644 index 00000000..a93c80ab --- /dev/null +++ b/ch4-dev/implementors/core/ops/bit/trait.BitXorAssign.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["os"] = [{"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 diff --git a/ch4-dev/implementors/core/ops/bit/trait.Not.js b/ch4-dev/implementors/core/ops/bit/trait.Not.js new file mode 100644 index 00000000..dbcdf767 --- /dev/null +++ b/ch4-dev/implementors/core/ops/bit/trait.Not.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["os"] = [{"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 diff --git a/ch4-dev/implementors/core/ops/deref/trait.Deref.js b/ch4-dev/implementors/core/ops/deref/trait.Deref.js new file mode 100644 index 00000000..d9563f2f --- /dev/null +++ b/ch4-dev/implementors/core/ops/deref/trait.Deref.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["os"] = [{"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::TASK_MANAGER"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch4-dev/implementors/core/ops/drop/trait.Drop.js b/ch4-dev/implementors/core/ops/drop/trait.Drop.js new file mode 100644 index 00000000..cc314b1f --- /dev/null +++ b/ch4-dev/implementors/core/ops/drop/trait.Drop.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["os"] = [{"text":"impl Drop for FrameTracker","synthetic":false,"types":["os::mm::frame_allocator::FrameTracker"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch4-dev/implementors/core/panic/unwind_safe/trait.RefUnwindSafe.js b/ch4-dev/implementors/core/panic/unwind_safe/trait.RefUnwindSafe.js new file mode 100644 index 00000000..b851f3d2 --- /dev/null +++ b/ch4-dev/implementors/core/panic/unwind_safe/trait.RefUnwindSafe.js @@ -0,0 +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 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<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 TaskControlBlock","synthetic":true,"types":["os::task::task::TaskControlBlock"]},{"text":"impl RefUnwindSafe for TaskStatus","synthetic":true,"types":["os::task::task::TaskStatus"]},{"text":"impl !RefUnwindSafe for TaskManager","synthetic":true,"types":["os::task::TaskManager"]},{"text":"impl RefUnwindSafe for TaskManagerInner","synthetic":true,"types":["os::task::TaskManagerInner"]},{"text":"impl RefUnwindSafe for TASK_MANAGER","synthetic":true,"types":["os::task::TASK_MANAGER"]},{"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 diff --git a/ch4-dev/implementors/core/panic/unwind_safe/trait.UnwindSafe.js b/ch4-dev/implementors/core/panic/unwind_safe/trait.UnwindSafe.js new file mode 100644 index 00000000..cf813eed --- /dev/null +++ b/ch4-dev/implementors/core/panic/unwind_safe/trait.UnwindSafe.js @@ -0,0 +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 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<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 TaskControlBlock","synthetic":true,"types":["os::task::task::TaskControlBlock"]},{"text":"impl UnwindSafe for TaskStatus","synthetic":true,"types":["os::task::task::TaskStatus"]},{"text":"impl UnwindSafe for TaskManager","synthetic":true,"types":["os::task::TaskManager"]},{"text":"impl UnwindSafe for TaskManagerInner","synthetic":true,"types":["os::task::TaskManagerInner"]},{"text":"impl UnwindSafe for TASK_MANAGER","synthetic":true,"types":["os::task::TASK_MANAGER"]},{"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 diff --git a/ch4-dev/implementors/lazy_static/trait.LazyStatic.js b/ch4-dev/implementors/lazy_static/trait.LazyStatic.js new file mode 100644 index 00000000..f92704b0 --- /dev/null +++ b/ch4-dev/implementors/lazy_static/trait.LazyStatic.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["os"] = [{"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::TASK_MANAGER"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/ch4-dev/implementors/os/board/trait.QEMUExit.js b/ch4-dev/implementors/os/board/trait.QEMUExit.js new file mode 100644 index 00000000..34fffcbd --- /dev/null +++ b/ch4-dev/implementors/os/board/trait.QEMUExit.js @@ -0,0 +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 diff --git a/ch4-dev/implementors/os/mm/address/trait.StepByOne.js b/ch4-dev/implementors/os/mm/address/trait.StepByOne.js new file mode 100644 index 00000000..34fffcbd --- /dev/null +++ b/ch4-dev/implementors/os/mm/address/trait.StepByOne.js @@ -0,0 +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 diff --git a/ch4-dev/implementors/os/mm/frame_allocator/trait.FrameAllocator.js b/ch4-dev/implementors/os/mm/frame_allocator/trait.FrameAllocator.js new file mode 100644 index 00000000..34fffcbd --- /dev/null +++ b/ch4-dev/implementors/os/mm/frame_allocator/trait.FrameAllocator.js @@ -0,0 +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 diff --git a/ch4-dev/light.css b/ch4-dev/light.css new file mode 100644 index 00000000..289f10cf --- /dev/null +++ b/ch4-dev/light.css @@ -0,0 +1 @@ + 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/ch4-dev/main.js b/ch4-dev/main.js new file mode 100644 index 00000000..5c0ce8ad --- /dev/null +++ b/ch4-dev/main.js @@ -0,0 +1,8 @@ +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/ch4-dev/normalize.css b/ch4-dev/normalize.css new file mode 100644 index 00000000..469959f1 --- /dev/null +++ b/ch4-dev/normalize.css @@ -0,0 +1,2 @@ + /*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */ +html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:0.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type="button"],[type="reset"],[type="submit"],button{-webkit-appearance:button}[type="button"]::-moz-focus-inner,[type="reset"]::-moz-focus-inner,[type="submit"]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type="button"]:-moz-focusring,[type="reset"]:-moz-focusring,[type="submit"]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:0.35em 0.75em 0.625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type="checkbox"],[type="radio"]{box-sizing:border-box;padding:0}[type="number"]::-webkit-inner-spin-button,[type="number"]::-webkit-outer-spin-button{height:auto}[type="search"]{-webkit-appearance:textfield;outline-offset:-2px}[type="search"]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none} \ No newline at end of file diff --git a/ch4-dev/noscript.css b/ch4-dev/noscript.css new file mode 100644 index 00000000..8ad88640 --- /dev/null +++ b/ch4-dev/noscript.css @@ -0,0 +1 @@ + #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/ch4-dev/os/all.html b/ch4-dev/os/all.html new file mode 100644 index 00000000..64bffd46 --- /dev/null +++ b/ch4-dev/os/all.html @@ -0,0 +1,7 @@ +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 diff --git a/ch4-dev/os/board/constant.CLOCK_FREQ.html b/ch4-dev/os/board/constant.CLOCK_FREQ.html new file mode 100644 index 00000000..d272ebed --- /dev/null +++ b/ch4-dev/os/board/constant.CLOCK_FREQ.html @@ -0,0 +1,8 @@ +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/ch4-dev/os/board/constant.EXIT_FAILURE.html b/ch4-dev/os/board/constant.EXIT_FAILURE.html new file mode 100644 index 00000000..f185b767 --- /dev/null +++ b/ch4-dev/os/board/constant.EXIT_FAILURE.html @@ -0,0 +1,8 @@ +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/ch4-dev/os/board/constant.EXIT_FAILURE_FLAG.html b/ch4-dev/os/board/constant.EXIT_FAILURE_FLAG.html new file mode 100644 index 00000000..def6b350 --- /dev/null +++ b/ch4-dev/os/board/constant.EXIT_FAILURE_FLAG.html @@ -0,0 +1,8 @@ +EXIT_FAILURE_FLAG in os::board - Rust + +
const EXIT_FAILURE_FLAG: u32 = 0x3333;
+ \ No newline at end of file diff --git a/ch4-dev/os/board/constant.EXIT_RESET.html b/ch4-dev/os/board/constant.EXIT_RESET.html new file mode 100644 index 00000000..477664c3 --- /dev/null +++ b/ch4-dev/os/board/constant.EXIT_RESET.html @@ -0,0 +1,8 @@ +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/ch4-dev/os/board/constant.EXIT_SUCCESS.html b/ch4-dev/os/board/constant.EXIT_SUCCESS.html new file mode 100644 index 00000000..2530fe06 --- /dev/null +++ b/ch4-dev/os/board/constant.EXIT_SUCCESS.html @@ -0,0 +1,8 @@ +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/ch4-dev/os/board/constant.MMIO.html b/ch4-dev/os/board/constant.MMIO.html new file mode 100644 index 00000000..fbad7f43 --- /dev/null +++ b/ch4-dev/os/board/constant.MMIO.html @@ -0,0 +1,8 @@ +MMIO in os::board - Rust + +
+

Constant os::board::MMIO

source · []
pub const MMIO: &[(usize, usize)];
+ \ No newline at end of file diff --git a/ch4-dev/os/board/constant.QEMU_EXIT_HANDLE.html b/ch4-dev/os/board/constant.QEMU_EXIT_HANDLE.html new file mode 100644 index 00000000..69245d71 --- /dev/null +++ b/ch4-dev/os/board/constant.QEMU_EXIT_HANDLE.html @@ -0,0 +1,8 @@ +QEMU_EXIT_HANDLE in os::board - Rust + +
pub const QEMU_EXIT_HANDLE: RISCV64;
+ \ No newline at end of file diff --git a/ch4-dev/os/board/constant.VIRT_TEST.html b/ch4-dev/os/board/constant.VIRT_TEST.html new file mode 100644 index 00000000..dc7828f7 --- /dev/null +++ b/ch4-dev/os/board/constant.VIRT_TEST.html @@ -0,0 +1,8 @@ +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/ch4-dev/os/board/fn.exit_code_encode.html b/ch4-dev/os/board/fn.exit_code_encode.html new file mode 100644 index 00000000..85e919c4 --- /dev/null +++ b/ch4-dev/os/board/fn.exit_code_encode.html @@ -0,0 +1,9 @@ +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/ch4-dev/os/board/index.html b/ch4-dev/os/board/index.html new file mode 100644 index 00000000..10850b95 --- /dev/null +++ b/ch4-dev/os/board/index.html @@ -0,0 +1,15 @@ +os::board - Rust + +
+

Module os::board

source · []
Expand description

Constants used in rCore for qemu

+

Structs

+

RISCV64 configuration

+

Constants

+

Traits

+

Functions

+

Encode the exit code using EXIT_FAILURE_FLAG.

+
+ \ No newline at end of file diff --git a/ch4-dev/os/board/sidebar-items.js b/ch4-dev/os/board/sidebar-items.js new file mode 100644 index 00000000..748f2c5f --- /dev/null +++ b/ch4-dev/os/board/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"constant":[["CLOCK_FREQ",""],["EXIT_FAILURE",""],["EXIT_FAILURE_FLAG",""],["EXIT_RESET",""],["EXIT_SUCCESS",""],["MMIO",""],["QEMU_EXIT_HANDLE",""],["VIRT_TEST",""]],"fn":[["exit_code_encode","Encode the exit code using EXIT_FAILURE_FLAG."]],"struct":[["RISCV64","RISCV64 configuration"]],"trait":[["QEMUExit",""]]}); \ No newline at end of file diff --git a/ch4-dev/os/board/struct.RISCV64.html b/ch4-dev/os/board/struct.RISCV64.html new file mode 100644 index 00000000..b4f10fc3 --- /dev/null +++ b/ch4-dev/os/board/struct.RISCV64.html @@ -0,0 +1,27 @@ +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/ch4-dev/os/board/trait.QEMUExit.html b/ch4-dev/os/board/trait.QEMUExit.html new file mode 100644 index 00000000..cc37cb42 --- /dev/null +++ b/ch4-dev/os/board/trait.QEMUExit.html @@ -0,0 +1,17 @@ +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/ch4-dev/os/config/constant.KERNEL_HEAP_SIZE.html b/ch4-dev/os/config/constant.KERNEL_HEAP_SIZE.html new file mode 100644 index 00000000..d77b42c0 --- /dev/null +++ b/ch4-dev/os/config/constant.KERNEL_HEAP_SIZE.html @@ -0,0 +1,8 @@ +KERNEL_HEAP_SIZE in os::config - Rust + +
pub const KERNEL_HEAP_SIZE: usize = 0x30_0000;
+ \ No newline at end of file diff --git a/ch4-dev/os/config/constant.KERNEL_STACK_SIZE.html b/ch4-dev/os/config/constant.KERNEL_STACK_SIZE.html new file mode 100644 index 00000000..1e547346 --- /dev/null +++ b/ch4-dev/os/config/constant.KERNEL_STACK_SIZE.html @@ -0,0 +1,8 @@ +KERNEL_STACK_SIZE in os::config - Rust + +
pub const KERNEL_STACK_SIZE: usize = 4096 * 2; // 8_192usize
+ \ No newline at end of file diff --git a/ch4-dev/os/config/constant.MEMORY_END.html b/ch4-dev/os/config/constant.MEMORY_END.html new file mode 100644 index 00000000..5ab07242 --- /dev/null +++ b/ch4-dev/os/config/constant.MEMORY_END.html @@ -0,0 +1,8 @@ +MEMORY_END in os::config - Rust + +
+

Constant os::config::MEMORY_END

source · []
pub const MEMORY_END: usize = 0x80800000;
+ \ No newline at end of file diff --git a/ch4-dev/os/config/constant.PAGE_SIZE.html b/ch4-dev/os/config/constant.PAGE_SIZE.html new file mode 100644 index 00000000..91a51506 --- /dev/null +++ b/ch4-dev/os/config/constant.PAGE_SIZE.html @@ -0,0 +1,8 @@ +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/ch4-dev/os/config/constant.PAGE_SIZE_BITS.html b/ch4-dev/os/config/constant.PAGE_SIZE_BITS.html new file mode 100644 index 00000000..0a0d83fd --- /dev/null +++ b/ch4-dev/os/config/constant.PAGE_SIZE_BITS.html @@ -0,0 +1,8 @@ +PAGE_SIZE_BITS in os::config - Rust + +
pub const PAGE_SIZE_BITS: usize = 0xc;
+ \ No newline at end of file diff --git a/ch4-dev/os/config/constant.TRAMPOLINE.html b/ch4-dev/os/config/constant.TRAMPOLINE.html new file mode 100644 index 00000000..420fd50c --- /dev/null +++ b/ch4-dev/os/config/constant.TRAMPOLINE.html @@ -0,0 +1,8 @@ +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 diff --git a/ch4-dev/os/config/constant.TRAP_CONTEXT.html b/ch4-dev/os/config/constant.TRAP_CONTEXT.html new file mode 100644 index 00000000..6f262eda --- /dev/null +++ b/ch4-dev/os/config/constant.TRAP_CONTEXT.html @@ -0,0 +1,8 @@ +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 diff --git a/ch4-dev/os/config/constant.USER_STACK_SIZE.html b/ch4-dev/os/config/constant.USER_STACK_SIZE.html new file mode 100644 index 00000000..2c8a959e --- /dev/null +++ b/ch4-dev/os/config/constant.USER_STACK_SIZE.html @@ -0,0 +1,8 @@ +USER_STACK_SIZE in os::config - Rust + +
pub const USER_STACK_SIZE: usize = 4096 * 2; // 8_192usize
+ \ No newline at end of file diff --git a/ch4-dev/os/config/fn.kernel_stack_position.html b/ch4-dev/os/config/fn.kernel_stack_position.html new file mode 100644 index 00000000..a154d187 --- /dev/null +++ b/ch4-dev/os/config/fn.kernel_stack_position.html @@ -0,0 +1,9 @@ +kernel_stack_position in os::config - 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 diff --git a/ch4-dev/os/config/index.html b/ch4-dev/os/config/index.html new file mode 100644 index 00000000..1751fbb0 --- /dev/null +++ b/ch4-dev/os/config/index.html @@ -0,0 +1,13 @@ +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::MMIO;

Constants

+

Functions

+

Return (bottom, top) of a kernel stack in kernel space.

+
+ \ No newline at end of file diff --git a/ch4-dev/os/config/sidebar-items.js b/ch4-dev/os/config/sidebar-items.js new file mode 100644 index 00000000..20bbb3d7 --- /dev/null +++ b/ch4-dev/os/config/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"constant":[["KERNEL_HEAP_SIZE",""],["KERNEL_STACK_SIZE",""],["MEMORY_END",""],["PAGE_SIZE",""],["PAGE_SIZE_BITS",""],["TRAMPOLINE",""],["TRAP_CONTEXT",""],["USER_STACK_SIZE",""]],"fn":[["kernel_stack_position","Return (bottom, top) of a kernel stack in kernel space."]]}); \ No newline at end of file diff --git a/ch4-dev/os/console/fn.print.html b/ch4-dev/os/console/fn.print.html new file mode 100644 index 00000000..d819b5cb --- /dev/null +++ b/ch4-dev/os/console/fn.print.html @@ -0,0 +1,8 @@ +print in os::console - Rust + +
+

Function os::console::print

source · []
pub fn print(args: Arguments<'_>)
+ \ No newline at end of file diff --git a/ch4-dev/os/console/index.html b/ch4-dev/os/console/index.html new file mode 100644 index 00000000..9b605120 --- /dev/null +++ b/ch4-dev/os/console/index.html @@ -0,0 +1,11 @@ +os::console - Rust + +
+

Module os::console

source · []
Expand description

SBI console driver, for text output

+

Structs

+
Stdout 🔒

Functions

+
+ \ No newline at end of file diff --git a/ch4-dev/os/console/sidebar-items.js b/ch4-dev/os/console/sidebar-items.js new file mode 100644 index 00000000..32906922 --- /dev/null +++ b/ch4-dev/os/console/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"fn":[["print",""]],"struct":[["Stdout",""]]}); \ No newline at end of file diff --git a/ch4-dev/os/console/struct.Stdout.html b/ch4-dev/os/console/struct.Stdout.html new file mode 100644 index 00000000..5aad587d --- /dev/null +++ b/ch4-dev/os/console/struct.Stdout.html @@ -0,0 +1,23 @@ +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).

+

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/ch4-dev/os/fn.clear_bss.html b/ch4-dev/os/fn.clear_bss.html new file mode 100644 index 00000000..6d1dd4bd --- /dev/null +++ b/ch4-dev/os/fn.clear_bss.html @@ -0,0 +1,9 @@ +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/ch4-dev/os/fn.rust_main.html b/ch4-dev/os/fn.rust_main.html new file mode 100644 index 00000000..abb274a6 --- /dev/null +++ b/ch4-dev/os/fn.rust_main.html @@ -0,0 +1,10 @@ +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/ch4-dev/os/index.html b/ch4-dev/os/index.html new file mode 100644 index 00000000..8bcad510 --- /dev/null +++ b/ch4-dev/os/index.html @@ -0,0 +1,41 @@ +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
  • +
+

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_first_task() and for the first time go to +userspace.

+

Modules

+
board 🔒

Constants used in rCore for qemu

+
config 🔒

Constants used in rCore

+
console 🔒

SBI console driver, for text output

+
lang_items 🔒

The panic handler

+
loader 🔒

Loading user applications into memory

+
mm 🔒

Memory management implementation

+
sbi 🔒

SBI call wrappers

+
sync 🔒

Synchronization and interior mutability primitives

+

Implementation of syscalls

+

Task management implementation

+
timer 🔒

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 diff --git a/ch4-dev/os/lang_items/fn.panic.html b/ch4-dev/os/lang_items/fn.panic.html new file mode 100644 index 00000000..d2dffb5e --- /dev/null +++ b/ch4-dev/os/lang_items/fn.panic.html @@ -0,0 +1,9 @@ +panic in os::lang_items - Rust + +
+

Function os::lang_items::panic

source · []
fn panic(info: &PanicInfo<'_>) -> !
Expand description

panic handler

+
+ \ No newline at end of file diff --git a/ch4-dev/os/lang_items/index.html b/ch4-dev/os/lang_items/index.html new file mode 100644 index 00000000..f9cf75cf --- /dev/null +++ b/ch4-dev/os/lang_items/index.html @@ -0,0 +1,11 @@ +os::lang_items - Rust + +
+

Module os::lang_items

source · []
Expand description

The panic handler

+

Functions

+
panic 🔒

panic handler

+
+ \ No newline at end of file diff --git a/ch4-dev/os/lang_items/sidebar-items.js b/ch4-dev/os/lang_items/sidebar-items.js new file mode 100644 index 00000000..b06753b5 --- /dev/null +++ b/ch4-dev/os/lang_items/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"fn":[["panic","panic handler"]]}); \ No newline at end of file diff --git a/ch4-dev/os/loader/fn.get_app_data.html b/ch4-dev/os/loader/fn.get_app_data.html new file mode 100644 index 00000000..c9dd8604 --- /dev/null +++ b/ch4-dev/os/loader/fn.get_app_data.html @@ -0,0 +1,9 @@ +get_app_data in os::loader - Rust + +
pub fn get_app_data(app_id: usize) -> &'static [u8]
Expand description

get applications data

+
+ \ No newline at end of file diff --git a/ch4-dev/os/loader/fn.get_num_app.html b/ch4-dev/os/loader/fn.get_num_app.html new file mode 100644 index 00000000..d1bea9c7 --- /dev/null +++ b/ch4-dev/os/loader/fn.get_num_app.html @@ -0,0 +1,9 @@ +get_num_app in os::loader - Rust + +
+

Function os::loader::get_num_app

source · []
pub fn get_num_app() -> usize
Expand description

Get the total number of applications.

+
+ \ No newline at end of file diff --git a/ch4-dev/os/loader/index.html b/ch4-dev/os/loader/index.html new file mode 100644 index 00000000..33786af9 --- /dev/null +++ b/ch4-dev/os/loader/index.html @@ -0,0 +1,12 @@ +os::loader - Rust + +
+

Module os::loader

source · []
Expand description

Loading user applications into memory

+

Functions

+

get applications data

+

Get the total number of applications.

+
+ \ No newline at end of file diff --git a/ch4-dev/os/loader/sidebar-items.js b/ch4-dev/os/loader/sidebar-items.js new file mode 100644 index 00000000..45183026 --- /dev/null +++ b/ch4-dev/os/loader/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"fn":[["get_app_data","get applications data"],["get_num_app","Get the total number of applications."]]}); \ No newline at end of file diff --git a/ch4-dev/os/macro.print!.html b/ch4-dev/os/macro.print!.html new file mode 100644 index 00000000..0d57e6ea --- /dev/null +++ b/ch4-dev/os/macro.print!.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to macro.print.html...

+ + + \ No newline at end of file diff --git a/ch4-dev/os/macro.print.html b/ch4-dev/os/macro.print.html new file mode 100644 index 00000000..611aa0bd --- /dev/null +++ b/ch4-dev/os/macro.print.html @@ -0,0 +1,12 @@ +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/ch4-dev/os/macro.println!.html b/ch4-dev/os/macro.println!.html new file mode 100644 index 00000000..268c2ae6 --- /dev/null +++ b/ch4-dev/os/macro.println!.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to macro.println.html...

+ + + \ No newline at end of file diff --git a/ch4-dev/os/macro.println.html b/ch4-dev/os/macro.println.html new file mode 100644 index 00000000..d931685c --- /dev/null +++ b/ch4-dev/os/macro.println.html @@ -0,0 +1,12 @@ +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/ch4-dev/os/mm/address/constant.PA_WIDTH_SV39.html b/ch4-dev/os/mm/address/constant.PA_WIDTH_SV39.html new file mode 100644 index 00000000..85d3966b --- /dev/null +++ b/ch4-dev/os/mm/address/constant.PA_WIDTH_SV39.html @@ -0,0 +1,9 @@ +PA_WIDTH_SV39 in os::mm::address - Rust + +
const PA_WIDTH_SV39: usize = 56;
Expand description

physical address

+
+ \ No newline at end of file diff --git a/ch4-dev/os/mm/address/constant.PPN_WIDTH_SV39.html b/ch4-dev/os/mm/address/constant.PPN_WIDTH_SV39.html new file mode 100644 index 00000000..4cc98f51 --- /dev/null +++ b/ch4-dev/os/mm/address/constant.PPN_WIDTH_SV39.html @@ -0,0 +1,8 @@ +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 diff --git a/ch4-dev/os/mm/address/constant.VA_WIDTH_SV39.html b/ch4-dev/os/mm/address/constant.VA_WIDTH_SV39.html new file mode 100644 index 00000000..0d180a29 --- /dev/null +++ b/ch4-dev/os/mm/address/constant.VA_WIDTH_SV39.html @@ -0,0 +1,8 @@ +VA_WIDTH_SV39 in os::mm::address - Rust + +
const VA_WIDTH_SV39: usize = 39;
+ \ No newline at end of file diff --git a/ch4-dev/os/mm/address/constant.VPN_WIDTH_SV39.html b/ch4-dev/os/mm/address/constant.VPN_WIDTH_SV39.html new file mode 100644 index 00000000..c48409eb --- /dev/null +++ b/ch4-dev/os/mm/address/constant.VPN_WIDTH_SV39.html @@ -0,0 +1,8 @@ +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 diff --git a/ch4-dev/os/mm/address/index.html b/ch4-dev/os/mm/address/index.html new file mode 100644 index 00000000..2d2a5c30 --- /dev/null +++ b/ch4-dev/os/mm/address/index.html @@ -0,0 +1,21 @@ +os::mm::address - Rust + +
+

Module os::mm::address

source · []
Expand description

Implementation of physical and virtual address and page number.

+

Structs

+

Definitions

+

physical page number

+

a simple range structure for type T

+

iterator for the simple range structure

+

virtual address

+

virtual page number

+

Constants

+

physical address

+

Traits

+

Type Definitions

+

a simple range structure for virtual page number

+
+ \ No newline at end of file diff --git a/ch4-dev/os/mm/address/sidebar-items.js b/ch4-dev/os/mm/address/sidebar-items.js new file mode 100644 index 00000000..26da70c7 --- /dev/null +++ b/ch4-dev/os/mm/address/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"constant":[["PA_WIDTH_SV39","physical address"],["PPN_WIDTH_SV39",""],["VA_WIDTH_SV39",""],["VPN_WIDTH_SV39",""]],"struct":[["PhysAddr","Definitions"],["PhysPageNum","physical 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",""]],"type":[["VPNRange","a simple range structure for virtual page number"]]}); \ No newline at end of file diff --git a/ch4-dev/os/mm/address/struct.PhysAddr.html b/ch4-dev/os/mm/address/struct.PhysAddr.html new file mode 100644 index 00000000..2b9a11af --- /dev/null +++ b/ch4-dev/os/mm/address/struct.PhysAddr.html @@ -0,0 +1,47 @@ +PhysAddr in os::mm::address - Rust + +
+

Struct os::mm::address::PhysAddr

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

Definitions

+

Tuple Fields

0: usize

Implementations

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} +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).

+

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/ch4-dev/os/mm/address/struct.PhysPageNum.html b/ch4-dev/os/mm/address/struct.PhysPageNum.html new file mode 100644 index 00000000..b6df6bdf --- /dev/null +++ b/ch4-dev/os/mm/address/struct.PhysPageNum.html @@ -0,0 +1,44 @@ +PhysPageNum in os::mm::address - Rust + +
pub struct PhysPageNum(pub usize);
Expand description

physical page number

+

Tuple Fields

0: usize

Implementations

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

+

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/ch4-dev/os/mm/address/struct.SimpleRange.html b/ch4-dev/os/mm/address/struct.SimpleRange.html new file mode 100644 index 00000000..7590ea6a --- /dev/null +++ b/ch4-dev/os/mm/address/struct.SimpleRange.html @@ -0,0 +1,31 @@ +SimpleRange in os::mm::address - Rust + +
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).

+

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/ch4-dev/os/mm/address/struct.SimpleRangeIterator.html b/ch4-dev/os/mm/address/struct.SimpleRangeIterator.html new file mode 100644 index 00000000..5962f942 --- /dev/null +++ b/ch4-dev/os/mm/address/struct.SimpleRangeIterator.html @@ -0,0 +1,138 @@ +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 +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).

+

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 diff --git a/ch4-dev/os/mm/address/struct.VirtAddr.html b/ch4-dev/os/mm/address/struct.VirtAddr.html new file mode 100644 index 00000000..6443f83e --- /dev/null +++ b/ch4-dev/os/mm/address/struct.VirtAddr.html @@ -0,0 +1,45 @@ +VirtAddr in os::mm::address - Rust + +
+

Struct os::mm::address::VirtAddr

source · []
pub struct VirtAddr(pub usize);
Expand description

virtual address

+

Tuple Fields

0: usize

Implementations

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).

+

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/ch4-dev/os/mm/address/struct.VirtPageNum.html b/ch4-dev/os/mm/address/struct.VirtPageNum.html new file mode 100644 index 00000000..93c0cab4 --- /dev/null +++ b/ch4-dev/os/mm/address/struct.VirtPageNum.html @@ -0,0 +1,44 @@ +VirtPageNum in os::mm::address - Rust + +
pub struct VirtPageNum(pub usize);
Expand description

virtual page number

+

Tuple Fields

0: usize

Implementations

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

+

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/ch4-dev/os/mm/address/trait.StepByOne.html b/ch4-dev/os/mm/address/trait.StepByOne.html new file mode 100644 index 00000000..eeaa3a0f --- /dev/null +++ b/ch4-dev/os/mm/address/trait.StepByOne.html @@ -0,0 +1,10 @@ +StepByOne in os::mm::address - Rust + +
pub trait StepByOne {
+    fn step(&mut self);
+}

Required methods

Implementors

+ \ No newline at end of file diff --git a/ch4-dev/os/mm/address/type.VPNRange.html b/ch4-dev/os/mm/address/type.VPNRange.html new file mode 100644 index 00000000..daa6ea0f --- /dev/null +++ b/ch4-dev/os/mm/address/type.VPNRange.html @@ -0,0 +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 diff --git a/ch4-dev/os/mm/fn.init.html b/ch4-dev/os/mm/fn.init.html new file mode 100644 index 00000000..8ed418d9 --- /dev/null +++ b/ch4-dev/os/mm/fn.init.html @@ -0,0 +1,9 @@ +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/ch4-dev/os/mm/frame_allocator/fn.frame_alloc.html b/ch4-dev/os/mm/frame_allocator/fn.frame_alloc.html new file mode 100644 index 00000000..13b991f6 --- /dev/null +++ b/ch4-dev/os/mm/frame_allocator/fn.frame_alloc.html @@ -0,0 +1,9 @@ +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 diff --git a/ch4-dev/os/mm/frame_allocator/fn.frame_allocator_test.html b/ch4-dev/os/mm/frame_allocator/fn.frame_allocator_test.html new file mode 100644 index 00000000..6b29de3a --- /dev/null +++ b/ch4-dev/os/mm/frame_allocator/fn.frame_allocator_test.html @@ -0,0 +1,9 @@ +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/ch4-dev/os/mm/frame_allocator/fn.frame_dealloc.html b/ch4-dev/os/mm/frame_allocator/fn.frame_dealloc.html new file mode 100644 index 00000000..5789f1e6 --- /dev/null +++ b/ch4-dev/os/mm/frame_allocator/fn.frame_dealloc.html @@ -0,0 +1,9 @@ +frame_dealloc in os::mm::frame_allocator - Rust + +
fn frame_dealloc(ppn: PhysPageNum)
Expand description

deallocate a frame

+
+ \ No newline at end of file diff --git a/ch4-dev/os/mm/frame_allocator/fn.init_frame_allocator.html b/ch4-dev/os/mm/frame_allocator/fn.init_frame_allocator.html new file mode 100644 index 00000000..b853fd2a --- /dev/null +++ b/ch4-dev/os/mm/frame_allocator/fn.init_frame_allocator.html @@ -0,0 +1,9 @@ +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/ch4-dev/os/mm/frame_allocator/index.html b/ch4-dev/os/mm/frame_allocator/index.html new file mode 100644 index 00000000..d705d956 --- /dev/null +++ b/ch4-dev/os/mm/frame_allocator/index.html @@ -0,0 +1,21 @@ +os::mm::frame_allocator - Rust + +
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 diff --git a/ch4-dev/os/mm/frame_allocator/sidebar-items.js b/ch4-dev/os/mm/frame_allocator/sidebar-items.js new file mode 100644 index 00000000..91a50bd8 --- /dev/null +++ b/ch4-dev/os/mm/frame_allocator/sidebar-items.js @@ -0,0 +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 diff --git a/ch4-dev/os/mm/frame_allocator/struct.FRAME_ALLOCATOR.html b/ch4-dev/os/mm/frame_allocator/struct.FRAME_ALLOCATOR.html new file mode 100644 index 00000000..1eec2f7e --- /dev/null +++ b/ch4-dev/os/mm/frame_allocator/struct.FRAME_ALLOCATOR.html @@ -0,0 +1,25 @@ +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).

+

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/ch4-dev/os/mm/frame_allocator/struct.FrameTracker.html b/ch4-dev/os/mm/frame_allocator/struct.FrameTracker.html new file mode 100644 index 00000000..d2295eed --- /dev/null +++ b/ch4-dev/os/mm/frame_allocator/struct.FrameTracker.html @@ -0,0 +1,24 @@ +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

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).

+

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/ch4-dev/os/mm/frame_allocator/struct.StackFrameAllocator.html b/ch4-dev/os/mm/frame_allocator/struct.StackFrameAllocator.html new file mode 100644 index 00000000..7705fe29 --- /dev/null +++ b/ch4-dev/os/mm/frame_allocator/struct.StackFrameAllocator.html @@ -0,0 +1,24 @@ +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).

+

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/ch4-dev/os/mm/frame_allocator/trait.FrameAllocator.html b/ch4-dev/os/mm/frame_allocator/trait.FrameAllocator.html new file mode 100644 index 00000000..ce4592b1 --- /dev/null +++ b/ch4-dev/os/mm/frame_allocator/trait.FrameAllocator.html @@ -0,0 +1,12 @@ +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 diff --git a/ch4-dev/os/mm/frame_allocator/type.FrameAllocatorImpl.html b/ch4-dev/os/mm/frame_allocator/type.FrameAllocatorImpl.html new file mode 100644 index 00000000..4c3f6369 --- /dev/null +++ b/ch4-dev/os/mm/frame_allocator/type.FrameAllocatorImpl.html @@ -0,0 +1,8 @@ +FrameAllocatorImpl in os::mm::frame_allocator - Rust + +
type FrameAllocatorImpl = StackFrameAllocator;
+ \ No newline at end of file diff --git a/ch4-dev/os/mm/heap_allocator/fn.handle_alloc_error.html b/ch4-dev/os/mm/heap_allocator/fn.handle_alloc_error.html new file mode 100644 index 00000000..c4ff68c9 --- /dev/null +++ b/ch4-dev/os/mm/heap_allocator/fn.handle_alloc_error.html @@ -0,0 +1,9 @@ +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/ch4-dev/os/mm/heap_allocator/fn.heap_test.html b/ch4-dev/os/mm/heap_allocator/fn.heap_test.html new file mode 100644 index 00000000..896d07de --- /dev/null +++ b/ch4-dev/os/mm/heap_allocator/fn.heap_test.html @@ -0,0 +1,8 @@ +heap_test in os::mm::heap_allocator - Rust + +
pub fn heap_test()
+ \ No newline at end of file diff --git a/ch4-dev/os/mm/heap_allocator/fn.init_heap.html b/ch4-dev/os/mm/heap_allocator/fn.init_heap.html new file mode 100644 index 00000000..1d73dd5f --- /dev/null +++ b/ch4-dev/os/mm/heap_allocator/fn.init_heap.html @@ -0,0 +1,9 @@ +init_heap in os::mm::heap_allocator - Rust + +
pub fn init_heap()
Expand description

initiate heap allocator

+
+ \ No newline at end of file diff --git a/ch4-dev/os/mm/heap_allocator/index.html b/ch4-dev/os/mm/heap_allocator/index.html new file mode 100644 index 00000000..615d9b68 --- /dev/null +++ b/ch4-dev/os/mm/heap_allocator/index.html @@ -0,0 +1,15 @@ +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 diff --git a/ch4-dev/os/mm/heap_allocator/sidebar-items.js b/ch4-dev/os/mm/heap_allocator/sidebar-items.js new file mode 100644 index 00000000..a400d729 --- /dev/null +++ b/ch4-dev/os/mm/heap_allocator/sidebar-items.js @@ -0,0 +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 diff --git a/ch4-dev/os/mm/heap_allocator/static.HEAP_ALLOCATOR.html b/ch4-dev/os/mm/heap_allocator/static.HEAP_ALLOCATOR.html new file mode 100644 index 00000000..9e67f29e --- /dev/null +++ b/ch4-dev/os/mm/heap_allocator/static.HEAP_ALLOCATOR.html @@ -0,0 +1,9 @@ +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/ch4-dev/os/mm/heap_allocator/static.HEAP_SPACE.html b/ch4-dev/os/mm/heap_allocator/static.HEAP_SPACE.html new file mode 100644 index 00000000..2477fea1 --- /dev/null +++ b/ch4-dev/os/mm/heap_allocator/static.HEAP_SPACE.html @@ -0,0 +1,9 @@ +HEAP_SPACE in os::mm::heap_allocator - Rust + +
static mut HEAP_SPACE: [u8; 3145728]
Expand description

heap space ([u8; KERNEL_HEAP_SIZE])

+
+ \ No newline at end of file diff --git a/ch4-dev/os/mm/index.html b/ch4-dev/os/mm/index.html new file mode 100644 index 00000000..54917980 --- /dev/null +++ b/ch4-dev/os/mm/index.html @@ -0,0 +1,23 @@ +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.

+

Re-exports

+
pub use address::PhysAddr;
pub use address::PhysPageNum;
pub use address::VirtAddr;
pub use address::VirtPageNum;
pub use frame_allocator::frame_alloc;
pub use frame_allocator::FrameTracker;
pub use memory_set::remap_test;
pub use memory_set::MapPermission;
pub use memory_set::MemorySet;
pub use memory_set::KERNEL_SPACE;
pub use memory_set::KERNEL_SPACE;
pub use page_table::translated_byte_buffer;
pub use page_table::PageTableEntry;

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.

+

Functions

+

initiate heap allocator, frame allocator and kernel space

+
+ \ No newline at end of file diff --git a/ch4-dev/os/mm/memory_set/enum.MapType.html b/ch4-dev/os/mm/memory_set/enum.MapType.html new file mode 100644 index 00000000..52e79dc2 --- /dev/null +++ b/ch4-dev/os/mm/memory_set/enum.MapType.html @@ -0,0 +1,32 @@ +MapType in os::mm::memory_set - Rust + +
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).

+

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/ch4-dev/os/mm/memory_set/fn.ebss.html b/ch4-dev/os/mm/memory_set/fn.ebss.html new file mode 100644 index 00000000..c176efd5 --- /dev/null +++ b/ch4-dev/os/mm/memory_set/fn.ebss.html @@ -0,0 +1,8 @@ +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/ch4-dev/os/mm/memory_set/fn.edata.html b/ch4-dev/os/mm/memory_set/fn.edata.html new file mode 100644 index 00000000..d70995f6 --- /dev/null +++ b/ch4-dev/os/mm/memory_set/fn.edata.html @@ -0,0 +1,8 @@ +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/ch4-dev/os/mm/memory_set/fn.ekernel.html b/ch4-dev/os/mm/memory_set/fn.ekernel.html new file mode 100644 index 00000000..670628a2 --- /dev/null +++ b/ch4-dev/os/mm/memory_set/fn.ekernel.html @@ -0,0 +1,8 @@ +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/ch4-dev/os/mm/memory_set/fn.erodata.html b/ch4-dev/os/mm/memory_set/fn.erodata.html new file mode 100644 index 00000000..103e005a --- /dev/null +++ b/ch4-dev/os/mm/memory_set/fn.erodata.html @@ -0,0 +1,8 @@ +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/ch4-dev/os/mm/memory_set/fn.etext.html b/ch4-dev/os/mm/memory_set/fn.etext.html new file mode 100644 index 00000000..f0ba6136 --- /dev/null +++ b/ch4-dev/os/mm/memory_set/fn.etext.html @@ -0,0 +1,8 @@ +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/ch4-dev/os/mm/memory_set/fn.remap_test.html b/ch4-dev/os/mm/memory_set/fn.remap_test.html new file mode 100644 index 00000000..7807d0c9 --- /dev/null +++ b/ch4-dev/os/mm/memory_set/fn.remap_test.html @@ -0,0 +1,8 @@ +remap_test in os::mm::memory_set - Rust + +
pub fn remap_test()
+ \ No newline at end of file diff --git a/ch4-dev/os/mm/memory_set/fn.sbss_with_stack.html b/ch4-dev/os/mm/memory_set/fn.sbss_with_stack.html new file mode 100644 index 00000000..142f28ff --- /dev/null +++ b/ch4-dev/os/mm/memory_set/fn.sbss_with_stack.html @@ -0,0 +1,8 @@ +sbss_with_stack in os::mm::memory_set - Rust + +
unsafe extern "C" fn sbss_with_stack()
+ \ No newline at end of file diff --git a/ch4-dev/os/mm/memory_set/fn.sdata.html b/ch4-dev/os/mm/memory_set/fn.sdata.html new file mode 100644 index 00000000..2d04a752 --- /dev/null +++ b/ch4-dev/os/mm/memory_set/fn.sdata.html @@ -0,0 +1,8 @@ +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/ch4-dev/os/mm/memory_set/fn.srodata.html b/ch4-dev/os/mm/memory_set/fn.srodata.html new file mode 100644 index 00000000..4876d607 --- /dev/null +++ b/ch4-dev/os/mm/memory_set/fn.srodata.html @@ -0,0 +1,8 @@ +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/ch4-dev/os/mm/memory_set/fn.stext.html b/ch4-dev/os/mm/memory_set/fn.stext.html new file mode 100644 index 00000000..7b7c17c1 --- /dev/null +++ b/ch4-dev/os/mm/memory_set/fn.stext.html @@ -0,0 +1,8 @@ +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/ch4-dev/os/mm/memory_set/fn.strampoline.html b/ch4-dev/os/mm/memory_set/fn.strampoline.html new file mode 100644 index 00000000..7b9e5f4f --- /dev/null +++ b/ch4-dev/os/mm/memory_set/fn.strampoline.html @@ -0,0 +1,8 @@ +strampoline in os::mm::memory_set - Rust + +
unsafe extern "C" fn strampoline()
+ \ No newline at end of file diff --git a/ch4-dev/os/mm/memory_set/index.html b/ch4-dev/os/mm/memory_set/index.html new file mode 100644 index 00000000..01073ab1 --- /dev/null +++ b/ch4-dev/os/mm/memory_set/index.html @@ -0,0 +1,17 @@ +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/ch4-dev/os/mm/memory_set/sidebar-items.js b/ch4-dev/os/mm/memory_set/sidebar-items.js new file mode 100644 index 00000000..8445e938 --- /dev/null +++ b/ch4-dev/os/mm/memory_set/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"enum":[["MapType","map type for memory set: identical or framed"]],"fn":[["ebss",""],["edata",""],["ekernel",""],["erodata",""],["etext",""],["remap_test",""],["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 diff --git a/ch4-dev/os/mm/memory_set/struct.KERNEL_SPACE.html b/ch4-dev/os/mm/memory_set/struct.KERNEL_SPACE.html new file mode 100644 index 00000000..c320d618 --- /dev/null +++ b/ch4-dev/os/mm/memory_set/struct.KERNEL_SPACE.html @@ -0,0 +1,24 @@ +KERNEL_SPACE in os::mm::memory_set - Rust + +
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).

+

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/ch4-dev/os/mm/memory_set/struct.MapArea.html b/ch4-dev/os/mm/memory_set/struct.MapArea.html new file mode 100644 index 00000000..0811802f --- /dev/null +++ b/ch4-dev/os/mm/memory_set/struct.MapArea.html @@ -0,0 +1,27 @@ +MapArea in os::mm::memory_set - Rust + +
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 +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).

+

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/ch4-dev/os/mm/memory_set/struct.MapPermission.html b/ch4-dev/os/mm/memory_set/struct.MapPermission.html new file mode 100644 index 00000000..c79d912d --- /dev/null +++ b/ch4-dev/os/mm/memory_set/struct.MapPermission.html @@ -0,0 +1,124 @@ +MapPermission in os::mm::memory_set - Rust + +
pub struct MapPermission {
+    bits: u8,
+}
Expand description

map permission corresponding to that in pte: R W X U

+

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 +representation contains bits that do not correspond to a flag.

+

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

+

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 +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 +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.

+

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 +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.

+

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 +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 +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.

+

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)

+

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).

+

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/ch4-dev/os/mm/memory_set/struct.MemorySet.html b/ch4-dev/os/mm/memory_set/struct.MemorySet.html new file mode 100644 index 00000000..2a29122d --- /dev/null +++ b/ch4-dev/os/mm/memory_set/struct.MemorySet.html @@ -0,0 +1,28 @@ +MemorySet in os::mm::memory_set - Rust + +
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

Assume that no conflicts.

+

Mention that trampoline is not collected by areas.

+

Without kernel stacks.

+

Include sections in elf and trampoline and TrapContext and user stack, +also returns user_sp and entry point.

+

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/ch4-dev/os/mm/page_table/fn.translated_byte_buffer.html b/ch4-dev/os/mm/page_table/fn.translated_byte_buffer.html new file mode 100644 index 00000000..946e8c90 --- /dev/null +++ b/ch4-dev/os/mm/page_table/fn.translated_byte_buffer.html @@ -0,0 +1,9 @@ +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/ch4-dev/os/mm/page_table/index.html b/ch4-dev/os/mm/page_table/index.html new file mode 100644 index 00000000..b5b1e108 --- /dev/null +++ b/ch4-dev/os/mm/page_table/index.html @@ -0,0 +1,15 @@ +os::mm::page_table - Rust + +
+

Module os::mm::page_table

source · []
Expand description

Implementation of PageTableEntry and PageTable.

+

Structs

+

page table entry flags

+

page table structure

+

page table entry structure

+

Functions

+

translate a pointer to a mutable u8 Vec through page table

+
+ \ No newline at end of file diff --git a/ch4-dev/os/mm/page_table/sidebar-items.js b/ch4-dev/os/mm/page_table/sidebar-items.js new file mode 100644 index 00000000..d66f2651 --- /dev/null +++ b/ch4-dev/os/mm/page_table/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"fn":[["translated_byte_buffer","translate a pointer to a mutable u8 Vec through page table"]],"struct":[["PTEFlags","page table entry flags"],["PageTable","page table structure"],["PageTableEntry","page table entry structure"]]}); \ No newline at end of file diff --git a/ch4-dev/os/mm/page_table/struct.PTEFlags.html b/ch4-dev/os/mm/page_table/struct.PTEFlags.html new file mode 100644 index 00000000..0797238b --- /dev/null +++ b/ch4-dev/os/mm/page_table/struct.PTEFlags.html @@ -0,0 +1,124 @@ +PTEFlags in os::mm::page_table - Rust + +
pub struct PTEFlags {
+    bits: u8,
+}
Expand description

page table entry flags

+

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 +representation contains bits that do not correspond to a flag.

+

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

+

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 +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 +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.

+

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 +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.

+

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 +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 +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.

+

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)

+

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).

+

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/ch4-dev/os/mm/page_table/struct.PageTable.html b/ch4-dev/os/mm/page_table/struct.PageTable.html new file mode 100644 index 00000000..89061bb6 --- /dev/null +++ b/ch4-dev/os/mm/page_table/struct.PageTable.html @@ -0,0 +1,25 @@ +PageTable in os::mm::page_table - Rust + +
pub struct PageTable {
+    root_ppn: PhysPageNum,
+    frames: Vec<FrameTracker>,
+}
Expand description

page table structure

+

Fields

root_ppn: PhysPageNumframes: Vec<FrameTracker>

Implementations

Assume that it won’t oom when creating/mapping.

+

Temporarily used to get arguments from user space.

+

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/ch4-dev/os/mm/page_table/struct.PageTableEntry.html b/ch4-dev/os/mm/page_table/struct.PageTableEntry.html new file mode 100644 index 00000000..4209230c --- /dev/null +++ b/ch4-dev/os/mm/page_table/struct.PageTableEntry.html @@ -0,0 +1,27 @@ +PageTableEntry in os::mm::page_table - Rust + +
#[repr(C)]
pub struct PageTableEntry { + pub bits: usize, +}
Expand description

page table entry structure

+

Fields

bits: usize

Implementations

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).

+

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/ch4-dev/os/mm/sidebar-items.js b/ch4-dev/os/mm/sidebar-items.js new file mode 100644 index 00000000..daa14a0e --- /dev/null +++ b/ch4-dev/os/mm/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"fn":[["init","initiate heap allocator, frame allocator and kernel space"]],"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`]."]]}); \ No newline at end of file diff --git a/ch4-dev/os/sbi/constant.SBI_CONSOLE_PUTCHAR.html b/ch4-dev/os/sbi/constant.SBI_CONSOLE_PUTCHAR.html new file mode 100644 index 00000000..fca7335b --- /dev/null +++ b/ch4-dev/os/sbi/constant.SBI_CONSOLE_PUTCHAR.html @@ -0,0 +1,8 @@ +SBI_CONSOLE_PUTCHAR in os::sbi - Rust + +
const SBI_CONSOLE_PUTCHAR: usize = 1;
+ \ No newline at end of file diff --git a/ch4-dev/os/sbi/constant.SBI_SET_TIMER.html b/ch4-dev/os/sbi/constant.SBI_SET_TIMER.html new file mode 100644 index 00000000..5fcd7bc4 --- /dev/null +++ b/ch4-dev/os/sbi/constant.SBI_SET_TIMER.html @@ -0,0 +1,8 @@ +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/ch4-dev/os/sbi/fn.console_putchar.html b/ch4-dev/os/sbi/fn.console_putchar.html new file mode 100644 index 00000000..a12b56d9 --- /dev/null +++ b/ch4-dev/os/sbi/fn.console_putchar.html @@ -0,0 +1,9 @@ +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 diff --git a/ch4-dev/os/sbi/fn.sbi_call.html b/ch4-dev/os/sbi/fn.sbi_call.html new file mode 100644 index 00000000..8ff256dd --- /dev/null +++ b/ch4-dev/os/sbi/fn.sbi_call.html @@ -0,0 +1,9 @@ +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/ch4-dev/os/sbi/fn.set_timer.html b/ch4-dev/os/sbi/fn.set_timer.html new file mode 100644 index 00000000..3045a210 --- /dev/null +++ b/ch4-dev/os/sbi/fn.set_timer.html @@ -0,0 +1,9 @@ +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/ch4-dev/os/sbi/fn.shutdown.html b/ch4-dev/os/sbi/fn.shutdown.html new file mode 100644 index 00000000..bd570877 --- /dev/null +++ b/ch4-dev/os/sbi/fn.shutdown.html @@ -0,0 +1,9 @@ +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 diff --git a/ch4-dev/os/sbi/index.html b/ch4-dev/os/sbi/index.html new file mode 100644 index 00000000..e085a2b4 --- /dev/null +++ b/ch4-dev/os/sbi/index.html @@ -0,0 +1,15 @@ +os::sbi - Rust + +
+

Module os::sbi

source · []
Expand description

SBI call wrappers

+

Constants

+

Functions

+

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 diff --git a/ch4-dev/os/sbi/sidebar-items.js b/ch4-dev/os/sbi/sidebar-items.js new file mode 100644 index 00000000..48e70326 --- /dev/null +++ b/ch4-dev/os/sbi/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"constant":[["SBI_CONSOLE_PUTCHAR",""],["SBI_SET_TIMER",""]],"fn":[["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 diff --git a/ch4-dev/os/sidebar-items.js b/ch4-dev/os/sidebar-items.js new file mode 100644 index 00000000..e1b5afc1 --- /dev/null +++ b/ch4-dev/os/sidebar-items.js @@ -0,0 +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","Constants used in rCore for qemu"],["config","Constants used in rCore"],["console","SBI console driver, for text output"],["lang_items","The panic handler"],["loader","Loading user applications into memory"],["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 diff --git a/ch4-dev/os/sync/index.html b/ch4-dev/os/sync/index.html new file mode 100644 index 00000000..b4e8e4a0 --- /dev/null +++ b/ch4-dev/os/sync/index.html @@ -0,0 +1,12 @@ +os::sync - Rust + +
+

Module os::sync

source · []
Expand description

Synchronization and interior mutability primitives

+

Re-exports

+
pub use up::UPSafeCell;

Modules

+
up 🔒

Uniprocessor interior mutability primitives

+
+ \ No newline at end of file diff --git a/ch4-dev/os/sync/sidebar-items.js b/ch4-dev/os/sync/sidebar-items.js new file mode 100644 index 00000000..09d6027e --- /dev/null +++ b/ch4-dev/os/sync/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"mod":[["up","Uniprocessor interior mutability primitives"]]}); \ No newline at end of file diff --git a/ch4-dev/os/sync/up/index.html b/ch4-dev/os/sync/up/index.html new file mode 100644 index 00000000..9de9fbd4 --- /dev/null +++ b/ch4-dev/os/sync/up/index.html @@ -0,0 +1,12 @@ +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 diff --git a/ch4-dev/os/sync/up/sidebar-items.js b/ch4-dev/os/sync/up/sidebar-items.js new file mode 100644 index 00000000..d34252dd --- /dev/null +++ b/ch4-dev/os/sync/up/sidebar-items.js @@ -0,0 +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 diff --git a/ch4-dev/os/sync/up/struct.UPSafeCell.html b/ch4-dev/os/sync/up/struct.UPSafeCell.html new file mode 100644 index 00000000..71f5082b --- /dev/null +++ b/ch4-dev/os/sync/up/struct.UPSafeCell.html @@ -0,0 +1,30 @@ +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 +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 +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).

+

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/ch4-dev/os/syscall/constant.SYSCALL_EXIT.html b/ch4-dev/os/syscall/constant.SYSCALL_EXIT.html new file mode 100644 index 00000000..e46f4bcc --- /dev/null +++ b/ch4-dev/os/syscall/constant.SYSCALL_EXIT.html @@ -0,0 +1,8 @@ +SYSCALL_EXIT in os::syscall - Rust + +
const SYSCALL_EXIT: usize = 93;
+ \ No newline at end of file diff --git a/ch4-dev/os/syscall/constant.SYSCALL_GET_TIME.html b/ch4-dev/os/syscall/constant.SYSCALL_GET_TIME.html new file mode 100644 index 00000000..3930aa98 --- /dev/null +++ b/ch4-dev/os/syscall/constant.SYSCALL_GET_TIME.html @@ -0,0 +1,8 @@ +SYSCALL_GET_TIME in os::syscall - Rust + +
const SYSCALL_GET_TIME: usize = 169;
+ \ No newline at end of file diff --git a/ch4-dev/os/syscall/constant.SYSCALL_WRITE.html b/ch4-dev/os/syscall/constant.SYSCALL_WRITE.html new file mode 100644 index 00000000..b7777110 --- /dev/null +++ b/ch4-dev/os/syscall/constant.SYSCALL_WRITE.html @@ -0,0 +1,8 @@ +SYSCALL_WRITE in os::syscall - Rust + +
const SYSCALL_WRITE: usize = 64;
+ \ No newline at end of file diff --git a/ch4-dev/os/syscall/constant.SYSCALL_YIELD.html b/ch4-dev/os/syscall/constant.SYSCALL_YIELD.html new file mode 100644 index 00000000..a976cfa6 --- /dev/null +++ b/ch4-dev/os/syscall/constant.SYSCALL_YIELD.html @@ -0,0 +1,8 @@ +SYSCALL_YIELD in os::syscall - Rust + +
const SYSCALL_YIELD: usize = 124;
+ \ No newline at end of file diff --git a/ch4-dev/os/syscall/fn.syscall.html b/ch4-dev/os/syscall/fn.syscall.html new file mode 100644 index 00000000..31ac27b0 --- /dev/null +++ b/ch4-dev/os/syscall/fn.syscall.html @@ -0,0 +1,9 @@ +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/ch4-dev/os/syscall/fs/constant.FD_STDOUT.html b/ch4-dev/os/syscall/fs/constant.FD_STDOUT.html new file mode 100644 index 00000000..6e494fa8 --- /dev/null +++ b/ch4-dev/os/syscall/fs/constant.FD_STDOUT.html @@ -0,0 +1,8 @@ +FD_STDOUT in os::syscall::fs - Rust + +
+

Constant os::syscall::fs::FD_STDOUT

source · []
const FD_STDOUT: usize = 1;
+ \ No newline at end of file diff --git a/ch4-dev/os/syscall/fs/fn.sys_write.html b/ch4-dev/os/syscall/fs/fn.sys_write.html new file mode 100644 index 00000000..5d240723 --- /dev/null +++ b/ch4-dev/os/syscall/fs/fn.sys_write.html @@ -0,0 +1,9 @@ +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
Expand description

write buf of length len to a file with fd

+
+ \ No newline at end of file diff --git a/ch4-dev/os/syscall/fs/index.html b/ch4-dev/os/syscall/fs/index.html new file mode 100644 index 00000000..98af0c25 --- /dev/null +++ b/ch4-dev/os/syscall/fs/index.html @@ -0,0 +1,12 @@ +os::syscall::fs - Rust + +
+

Module os::syscall::fs

source · []
Expand description

File and filesystem-related syscalls

+

Constants

+
FD_STDOUT 🔒

Functions

+

write buf of length len to a file with fd

+
+ \ No newline at end of file diff --git a/ch4-dev/os/syscall/fs/sidebar-items.js b/ch4-dev/os/syscall/fs/sidebar-items.js new file mode 100644 index 00000000..99a1dcdc --- /dev/null +++ b/ch4-dev/os/syscall/fs/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"constant":[["FD_STDOUT",""]],"fn":[["sys_write","write buf of length `len` to a file with `fd`"]]}); \ No newline at end of file diff --git a/ch4-dev/os/syscall/index.html b/ch4-dev/os/syscall/index.html new file mode 100644 index 00000000..9fb7fcdc --- /dev/null +++ b/ch4-dev/os/syscall/index.html @@ -0,0 +1,23 @@ +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.

+

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 🔒

Process management syscalls

+

Constants

+

Functions

+

handle syscall exception with syscall_id and other arguments

+
+ \ No newline at end of file diff --git a/ch4-dev/os/syscall/process/fn.sys_exit.html b/ch4-dev/os/syscall/process/fn.sys_exit.html new file mode 100644 index 00000000..772c59a7 --- /dev/null +++ b/ch4-dev/os/syscall/process/fn.sys_exit.html @@ -0,0 +1,9 @@ +sys_exit in os::syscall::process - Rust + +
pub fn sys_exit(exit_code: i32) -> !
Expand description

task exits and submit an exit code

+
+ \ No newline at end of file diff --git a/ch4-dev/os/syscall/process/fn.sys_get_time.html b/ch4-dev/os/syscall/process/fn.sys_get_time.html new file mode 100644 index 00000000..20a69383 --- /dev/null +++ b/ch4-dev/os/syscall/process/fn.sys_get_time.html @@ -0,0 +1,9 @@ +sys_get_time in os::syscall::process - Rust + +
pub fn sys_get_time() -> isize
Expand description

get current time

+
+ \ No newline at end of file diff --git a/ch4-dev/os/syscall/process/fn.sys_yield.html b/ch4-dev/os/syscall/process/fn.sys_yield.html new file mode 100644 index 00000000..333a032f --- /dev/null +++ b/ch4-dev/os/syscall/process/fn.sys_yield.html @@ -0,0 +1,9 @@ +sys_yield in os::syscall::process - Rust + +
pub fn sys_yield() -> isize
Expand description

current task gives up resources for other tasks

+
+ \ No newline at end of file diff --git a/ch4-dev/os/syscall/process/index.html b/ch4-dev/os/syscall/process/index.html new file mode 100644 index 00000000..e931af9e --- /dev/null +++ b/ch4-dev/os/syscall/process/index.html @@ -0,0 +1,13 @@ +os::syscall::process - Rust + +
+

Module os::syscall::process

source · []
Expand description

Process management syscalls

+

Functions

+

task exits and submit an exit code

+

get current time

+

current task gives up resources for other tasks

+
+ \ No newline at end of file diff --git a/ch4-dev/os/syscall/process/sidebar-items.js b/ch4-dev/os/syscall/process/sidebar-items.js new file mode 100644 index 00000000..fff834a4 --- /dev/null +++ b/ch4-dev/os/syscall/process/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"fn":[["sys_exit","task exits and submit an exit code"],["sys_get_time","get current time"],["sys_yield","current task gives up resources for other tasks"]]}); \ No newline at end of file diff --git a/ch4-dev/os/syscall/sidebar-items.js b/ch4-dev/os/syscall/sidebar-items.js new file mode 100644 index 00000000..31dc0ea8 --- /dev/null +++ b/ch4-dev/os/syscall/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"constant":[["SYSCALL_EXIT",""],["SYSCALL_GET_TIME",""],["SYSCALL_WRITE",""],["SYSCALL_YIELD",""]],"fn":[["syscall","handle syscall exception with `syscall_id` and other arguments"]],"mod":[["fs","File and filesystem-related syscalls"],["process","Process management syscalls"]]}); \ No newline at end of file diff --git a/ch4-dev/os/task/context/index.html b/ch4-dev/os/task/context/index.html new file mode 100644 index 00000000..209177cd --- /dev/null +++ b/ch4-dev/os/task/context/index.html @@ -0,0 +1,11 @@ +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/ch4-dev/os/task/context/sidebar-items.js b/ch4-dev/os/task/context/sidebar-items.js new file mode 100644 index 00000000..c68c1891 --- /dev/null +++ b/ch4-dev/os/task/context/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"struct":[["TaskContext","task context structure containing some registers"]]}); \ No newline at end of file diff --git a/ch4-dev/os/task/context/struct.TaskContext.html b/ch4-dev/os/task/context/struct.TaskContext.html new file mode 100644 index 00000000..5b41b9bd --- /dev/null +++ b/ch4-dev/os/task/context/struct.TaskContext.html @@ -0,0 +1,29 @@ +TaskContext in os::task::context - Rust + +
#[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]

callee saved registers: s 0..11

+

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).

+

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/ch4-dev/os/task/fn.current_trap_cx.html b/ch4-dev/os/task/fn.current_trap_cx.html new file mode 100644 index 00000000..27fb2fa2 --- /dev/null +++ b/ch4-dev/os/task/fn.current_trap_cx.html @@ -0,0 +1,9 @@ +current_trap_cx in os::task - Rust + +
pub fn current_trap_cx() -> &'static mut TrapContext
Expand description

Get the current ‘Running’ task’s trap contexts.

+
+ \ No newline at end of file diff --git a/ch4-dev/os/task/fn.current_user_token.html b/ch4-dev/os/task/fn.current_user_token.html new file mode 100644 index 00000000..0d1fd255 --- /dev/null +++ b/ch4-dev/os/task/fn.current_user_token.html @@ -0,0 +1,9 @@ +current_user_token in os::task - Rust + +
pub fn current_user_token() -> usize
Expand description

Get the current ‘Running’ task’s token.

+
+ \ No newline at end of file diff --git a/ch4-dev/os/task/fn.exit_current_and_run_next.html b/ch4-dev/os/task/fn.exit_current_and_run_next.html new file mode 100644 index 00000000..7f88aa80 --- /dev/null +++ b/ch4-dev/os/task/fn.exit_current_and_run_next.html @@ -0,0 +1,9 @@ +exit_current_and_run_next in os::task - Rust + +
pub fn exit_current_and_run_next()
Expand description

Exit the current ‘Running’ task and run the next task in task list.

+
+ \ No newline at end of file diff --git a/ch4-dev/os/task/fn.mark_current_exited.html b/ch4-dev/os/task/fn.mark_current_exited.html new file mode 100644 index 00000000..40a396ec --- /dev/null +++ b/ch4-dev/os/task/fn.mark_current_exited.html @@ -0,0 +1,9 @@ +mark_current_exited in os::task - Rust + +
fn mark_current_exited()
Expand description

Change the status of current Running task into Exited.

+
+ \ No newline at end of file diff --git a/ch4-dev/os/task/fn.mark_current_suspended.html b/ch4-dev/os/task/fn.mark_current_suspended.html new file mode 100644 index 00000000..e9c47604 --- /dev/null +++ b/ch4-dev/os/task/fn.mark_current_suspended.html @@ -0,0 +1,9 @@ +mark_current_suspended in os::task - Rust + +
fn mark_current_suspended()
Expand description

Change the status of current Running task into Ready.

+
+ \ No newline at end of file diff --git a/ch4-dev/os/task/fn.run_first_task.html b/ch4-dev/os/task/fn.run_first_task.html new file mode 100644 index 00000000..9956f331 --- /dev/null +++ b/ch4-dev/os/task/fn.run_first_task.html @@ -0,0 +1,9 @@ +run_first_task in os::task - Rust + +
pub fn run_first_task()
Expand description

Run the first task in task list.

+
+ \ No newline at end of file diff --git a/ch4-dev/os/task/fn.run_next_task.html b/ch4-dev/os/task/fn.run_next_task.html new file mode 100644 index 00000000..e6fe533b --- /dev/null +++ b/ch4-dev/os/task/fn.run_next_task.html @@ -0,0 +1,10 @@ +run_next_task in os::task - Rust + +
+

Function os::task::run_next_task

source · []
fn run_next_task()
Expand description

Switch current Running task to the task we have found, +or there is no Ready task and we can exit with all applications completed

+
+ \ No newline at end of file diff --git a/ch4-dev/os/task/fn.suspend_current_and_run_next.html b/ch4-dev/os/task/fn.suspend_current_and_run_next.html new file mode 100644 index 00000000..e27a9a0d --- /dev/null +++ b/ch4-dev/os/task/fn.suspend_current_and_run_next.html @@ -0,0 +1,9 @@ +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/ch4-dev/os/task/index.html b/ch4-dev/os/task/index.html new file mode 100644 index 00000000..39e7f49f --- /dev/null +++ b/ch4-dev/os/task/index.html @@ -0,0 +1,34 @@ +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 +all the tasks in the operating system.

+

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

+
switch 🔒

Rust wrapper around __switch.

+
task 🔒

Types related to task management

+

Structs

+

a TaskManager global instance through lazy_static!

+

task context structure containing some registers

+

The task manager, where all the tasks are managed.

+

The task manager inner in ‘UPSafeCell’

+

Functions

+

Get the current ‘Running’ task’s trap contexts.

+

Get the current ‘Running’ task’s token.

+

Exit the current ‘Running’ task and run the next task in task list.

+

Change the status of current Running task into Exited.

+

Change the status of current Running task into Ready.

+

Run the first task in task list.

+

Switch current Running task to the task we have found, +or there is no Ready task and we can exit with all applications completed

+

Suspend the current ‘Running’ task and run the next task in task list.

+
+ \ No newline at end of file diff --git a/ch4-dev/os/task/sidebar-items.js b/ch4-dev/os/task/sidebar-items.js new file mode 100644 index 00000000..c6bcc072 --- /dev/null +++ b/ch4-dev/os/task/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"fn":[["current_trap_cx","Get the current ‘Running’ task’s trap contexts."],["current_user_token","Get the current ‘Running’ task’s token."],["exit_current_and_run_next","Exit the current ‘Running’ task and run the next task in task list."],["mark_current_exited","Change the status of current `Running` task into `Exited`."],["mark_current_suspended","Change the status of current `Running` task into `Ready`."],["run_first_task","Run the first task in task list."],["run_next_task","Switch current `Running` task to the task we have found, or there is no `Ready` task and we can exit with all applications completed"],["suspend_current_and_run_next","Suspend the current ‘Running’ task and run the next task in task list."]],"mod":[["context","Implementation of [`TaskContext`]"],["switch","Rust wrapper around `__switch`."],["task","Types related to task management"]],"struct":[["TASK_MANAGER","a `TaskManager` global instance through lazy_static!"],["TaskContext","task context structure containing some registers"],["TaskManager","The task manager, where all the tasks are managed."],["TaskManagerInner","The task manager inner in ‘UPSafeCell’"]]}); \ No newline at end of file diff --git a/ch4-dev/os/task/struct.TASK_MANAGER.html b/ch4-dev/os/task/struct.TASK_MANAGER.html new file mode 100644 index 00000000..3cf4af4d --- /dev/null +++ b/ch4-dev/os/task/struct.TASK_MANAGER.html @@ -0,0 +1,35 @@ +TASK_MANAGER in os::task - Rust + +
pub struct TASK_MANAGER {
+    __private_field: (),
+}
Expand description

a TaskManager global instance through lazy_static!

+

Fields

__private_field: ()

Methods from Deref<Target = TaskManager>

Run the first task in task list.

+

Generally, the first task in task list is an idle task (we call it zero process later). +But in ch4, we load apps statically, so the first task is a real app.

+

Change the status of current Running task into Ready.

+

Change the status of current Running task into Exited.

+

Find next task to run and return task id.

+

In this case, we only return the first Ready task in task list.

+

Get the current ‘Running’ task’s token.

+

Get the current ‘Running’ task’s trap contexts.

+

Switch current Running task to the task we have found, +or there is no Ready task and we can exit with all applications completed

+

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/ch4-dev/os/task/struct.TaskContext.html b/ch4-dev/os/task/struct.TaskContext.html new file mode 100644 index 00000000..926bae71 --- /dev/null +++ b/ch4-dev/os/task/struct.TaskContext.html @@ -0,0 +1,29 @@ +TaskContext in os::task - Rust + +
#[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]

callee saved registers: s 0..11

+

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).

+

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/ch4-dev/os/task/struct.TaskManager.html b/ch4-dev/os/task/struct.TaskManager.html new file mode 100644 index 00000000..3586b6b6 --- /dev/null +++ b/ch4-dev/os/task/struct.TaskManager.html @@ -0,0 +1,42 @@ +TaskManager in os::task - Rust + +
pub struct TaskManager {
+    num_app: usize,
+    inner: UPSafeCell<TaskManagerInner>,
+}
Expand description

The task manager, where all the tasks are managed.

+

Functions implemented on TaskManager deals with all task state transitions +and task context switching. For convenience, you can find wrappers around it +in the module level.

+

Most of TaskManager are hidden behind the field inner, to defer +borrowing checks to runtime. You can see examples on how to use inner in +existing functions on TaskManager.

+

Fields

num_app: usize

total number of tasks

+
inner: UPSafeCell<TaskManagerInner>

use inner value to get mutable access

+

Implementations

Run the first task in task list.

+

Generally, the first task in task list is an idle task (we call it zero process later). +But in ch4, we load apps statically, so the first task is a real app.

+

Change the status of current Running task into Ready.

+

Change the status of current Running task into Exited.

+

Find next task to run and return task id.

+

In this case, we only return the first Ready task in task list.

+

Get the current ‘Running’ task’s token.

+

Get the current ‘Running’ task’s trap contexts.

+

Switch current Running task to the task we have found, +or there is no Ready task and we can exit with all applications completed

+

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/ch4-dev/os/task/struct.TaskManagerInner.html b/ch4-dev/os/task/struct.TaskManagerInner.html new file mode 100644 index 00000000..f08176df --- /dev/null +++ b/ch4-dev/os/task/struct.TaskManagerInner.html @@ -0,0 +1,25 @@ +TaskManagerInner in os::task - Rust + +
struct TaskManagerInner {
+    tasks: Vec<TaskControlBlock>,
+    current_task: usize,
+}
Expand description

The task manager inner in ‘UPSafeCell’

+

Fields

tasks: Vec<TaskControlBlock>

task list

+
current_task: usize

id of current Running task

+

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/ch4-dev/os/task/switch/fn.__switch.html b/ch4-dev/os/task/switch/fn.__switch.html new file mode 100644 index 00000000..a1b1fa71 --- /dev/null +++ b/ch4-dev/os/task/switch/fn.__switch.html @@ -0,0 +1,10 @@ +__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
)
Expand description

Switch to the context of next_task_cx_ptr, saving the current context +in current_task_cx_ptr.

+
+ \ No newline at end of file diff --git a/ch4-dev/os/task/switch/index.html b/ch4-dev/os/task/switch/index.html new file mode 100644 index 00000000..317c993a --- /dev/null +++ b/ch4-dev/os/task/switch/index.html @@ -0,0 +1,16 @@ +os::task::switch - Rust + +
+

Module os::task::switch

source · []
Expand description

Rust wrapper around __switch.

+

Switching to a different task’s context happens here. The actual +implementation must not be in Rust and (essentially) has to be in assembly +language (Do you know why?), so this module really is just a wrapper around +switch.S.

+

Functions

+

Switch to the context of next_task_cx_ptr, saving the current context +in current_task_cx_ptr.

+
+ \ No newline at end of file diff --git a/ch4-dev/os/task/switch/sidebar-items.js b/ch4-dev/os/task/switch/sidebar-items.js new file mode 100644 index 00000000..e12d73ff --- /dev/null +++ b/ch4-dev/os/task/switch/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"fn":[["__switch","Switch to the context of `next_task_cx_ptr`, saving the current context in `current_task_cx_ptr`."]]}); \ No newline at end of file diff --git a/ch4-dev/os/task/task/enum.TaskStatus.html b/ch4-dev/os/task/task/enum.TaskStatus.html new file mode 100644 index 00000000..064affcb --- /dev/null +++ b/ch4-dev/os/task/task/enum.TaskStatus.html @@ -0,0 +1,32 @@ +TaskStatus in os::task::task - Rust + +
pub enum TaskStatus {
+    Ready,
+    Running,
+    Exited,
+}
Expand description

task status: UnInit, Ready, Running, Exited

+

Variants

Ready

Running

Exited

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).

+

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/ch4-dev/os/task/task/index.html b/ch4-dev/os/task/task/index.html new file mode 100644 index 00000000..546306e0 --- /dev/null +++ b/ch4-dev/os/task/task/index.html @@ -0,0 +1,13 @@ +os::task::task - Rust + +
+

Module os::task::task

source · []
Expand description

Types related to task management

+

Structs

+

task control block structure

+

Enums

+

task status: UnInit, Ready, Running, Exited

+
+ \ No newline at end of file diff --git a/ch4-dev/os/task/task/sidebar-items.js b/ch4-dev/os/task/task/sidebar-items.js new file mode 100644 index 00000000..369a3801 --- /dev/null +++ b/ch4-dev/os/task/task/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"enum":[["TaskStatus","task status: UnInit, Ready, Running, Exited"]],"struct":[["TaskControlBlock","task control block structure"]]}); \ No newline at end of file diff --git a/ch4-dev/os/task/task/struct.TaskControlBlock.html b/ch4-dev/os/task/task/struct.TaskControlBlock.html new file mode 100644 index 00000000..7521c25d --- /dev/null +++ b/ch4-dev/os/task/task/struct.TaskControlBlock.html @@ -0,0 +1,26 @@ +TaskControlBlock in os::task::task - Rust + +
pub struct TaskControlBlock {
+    pub task_status: TaskStatus,
+    pub task_cx: TaskContext,
+    pub memory_set: MemorySet,
+    pub trap_cx_ppn: PhysPageNum,
+    pub base_size: usize,
+}
Expand description

task control block structure

+

Fields

task_status: TaskStatustask_cx: TaskContextmemory_set: MemorySettrap_cx_ppn: PhysPageNumbase_size: usize

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/ch4-dev/os/timer/constant.MSEC_PER_SEC.html b/ch4-dev/os/timer/constant.MSEC_PER_SEC.html new file mode 100644 index 00000000..5cf83142 --- /dev/null +++ b/ch4-dev/os/timer/constant.MSEC_PER_SEC.html @@ -0,0 +1,8 @@ +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/ch4-dev/os/timer/constant.TICKS_PER_SEC.html b/ch4-dev/os/timer/constant.TICKS_PER_SEC.html new file mode 100644 index 00000000..f75f843f --- /dev/null +++ b/ch4-dev/os/timer/constant.TICKS_PER_SEC.html @@ -0,0 +1,8 @@ +TICKS_PER_SEC in os::timer - Rust + +
const TICKS_PER_SEC: usize = 100;
+ \ No newline at end of file diff --git a/ch4-dev/os/timer/fn.get_time.html b/ch4-dev/os/timer/fn.get_time.html new file mode 100644 index 00000000..51ee925f --- /dev/null +++ b/ch4-dev/os/timer/fn.get_time.html @@ -0,0 +1,8 @@ +get_time in os::timer - Rust + +
+

Function os::timer::get_time

source · []
pub fn get_time() -> usize
+ \ No newline at end of file diff --git a/ch4-dev/os/timer/fn.get_time_ms.html b/ch4-dev/os/timer/fn.get_time_ms.html new file mode 100644 index 00000000..d438c352 --- /dev/null +++ b/ch4-dev/os/timer/fn.get_time_ms.html @@ -0,0 +1,9 @@ +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/ch4-dev/os/timer/fn.set_next_trigger.html b/ch4-dev/os/timer/fn.set_next_trigger.html new file mode 100644 index 00000000..03dce4da --- /dev/null +++ b/ch4-dev/os/timer/fn.set_next_trigger.html @@ -0,0 +1,9 @@ +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 diff --git a/ch4-dev/os/timer/index.html b/ch4-dev/os/timer/index.html new file mode 100644 index 00000000..27ba6dce --- /dev/null +++ b/ch4-dev/os/timer/index.html @@ -0,0 +1,13 @@ +os::timer - Rust + +
+

Module os::timer

source · []
Expand description

RISC-V timer-related functionality

+

Constants

+

Functions

+

get current time in microseconds

+

set the next timer interrupt

+
+ \ No newline at end of file diff --git a/ch4-dev/os/timer/sidebar-items.js b/ch4-dev/os/timer/sidebar-items.js new file mode 100644 index 00000000..a66b0248 --- /dev/null +++ b/ch4-dev/os/timer/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"constant":[["MSEC_PER_SEC",""],["TICKS_PER_SEC",""]],"fn":[["get_time",""],["get_time_ms","get current time in microseconds"],["set_next_trigger","set the next timer interrupt"]]}); \ No newline at end of file diff --git a/ch4-dev/os/trap/context/index.html b/ch4-dev/os/trap/context/index.html new file mode 100644 index 00000000..d2e47c65 --- /dev/null +++ b/ch4-dev/os/trap/context/index.html @@ -0,0 +1,11 @@ +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/ch4-dev/os/trap/context/sidebar-items.js b/ch4-dev/os/trap/context/sidebar-items.js new file mode 100644 index 00000000..3f97d83e --- /dev/null +++ b/ch4-dev/os/trap/context/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"struct":[["TrapContext","trap context structure containing sstatus, sepc and registers"]]}); \ No newline at end of file diff --git a/ch4-dev/os/trap/context/struct.TrapContext.html b/ch4-dev/os/trap/context/struct.TrapContext.html new file mode 100644 index 00000000..7acfe48a --- /dev/null +++ b/ch4-dev/os/trap/context/struct.TrapContext.html @@ -0,0 +1,35 @@ +TrapContext in os::trap::context - Rust + +
#[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

+

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/ch4-dev/os/trap/fn.enable_timer_interrupt.html b/ch4-dev/os/trap/fn.enable_timer_interrupt.html new file mode 100644 index 00000000..5e85e8cf --- /dev/null +++ b/ch4-dev/os/trap/fn.enable_timer_interrupt.html @@ -0,0 +1,9 @@ +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/ch4-dev/os/trap/fn.init.html b/ch4-dev/os/trap/fn.init.html new file mode 100644 index 00000000..d0623663 --- /dev/null +++ b/ch4-dev/os/trap/fn.init.html @@ -0,0 +1,9 @@ +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/ch4-dev/os/trap/fn.set_kernel_trap_entry.html b/ch4-dev/os/trap/fn.set_kernel_trap_entry.html new file mode 100644 index 00000000..3e8e33b7 --- /dev/null +++ b/ch4-dev/os/trap/fn.set_kernel_trap_entry.html @@ -0,0 +1,8 @@ +set_kernel_trap_entry in os::trap - Rust + +
fn set_kernel_trap_entry()
+ \ No newline at end of file diff --git a/ch4-dev/os/trap/fn.set_user_trap_entry.html b/ch4-dev/os/trap/fn.set_user_trap_entry.html new file mode 100644 index 00000000..6b82ac2b --- /dev/null +++ b/ch4-dev/os/trap/fn.set_user_trap_entry.html @@ -0,0 +1,8 @@ +set_user_trap_entry in os::trap - Rust + +
fn set_user_trap_entry()
+ \ No newline at end of file diff --git a/ch4-dev/os/trap/fn.trap_from_kernel.html b/ch4-dev/os/trap/fn.trap_from_kernel.html new file mode 100644 index 00000000..ed9e5d15 --- /dev/null +++ b/ch4-dev/os/trap/fn.trap_from_kernel.html @@ -0,0 +1,11 @@ +trap_from_kernel in os::trap - Rust + +
#[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 diff --git a/ch4-dev/os/trap/fn.trap_handler.html b/ch4-dev/os/trap/fn.trap_handler.html new file mode 100644 index 00000000..dc8ebb4e --- /dev/null +++ b/ch4-dev/os/trap/fn.trap_handler.html @@ -0,0 +1,10 @@ +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/ch4-dev/os/trap/fn.trap_return.html b/ch4-dev/os/trap/fn.trap_return.html new file mode 100644 index 00000000..b91b1fb3 --- /dev/null +++ b/ch4-dev/os/trap/fn.trap_return.html @@ -0,0 +1,12 @@ +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 diff --git a/ch4-dev/os/trap/index.html b/ch4-dev/os/trap/index.html new file mode 100644 index 00000000..86976316 --- /dev/null +++ b/ch4-dev/os/trap/index.html @@ -0,0 +1,31 @@ +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.

+

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().

+

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, +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 diff --git a/ch4-dev/os/trap/sidebar-items.js b/ch4-dev/os/trap/sidebar-items.js new file mode 100644 index 00000000..b082e657 --- /dev/null +++ b/ch4-dev/os/trap/sidebar-items.js @@ -0,0 +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 diff --git a/ch4-dev/os/trap/struct.TrapContext.html b/ch4-dev/os/trap/struct.TrapContext.html new file mode 100644 index 00000000..a0c54605 --- /dev/null +++ b/ch4-dev/os/trap/struct.TrapContext.html @@ -0,0 +1,35 @@ +TrapContext in os::trap - Rust + +
#[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

+

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/ch4-dev/rust-logo.svg b/ch4-dev/rust-logo.svg new file mode 100644 index 00000000..62424d8f --- /dev/null +++ b/ch4-dev/rust-logo.svg @@ -0,0 +1,61 @@ + + + diff --git a/ch4-dev/rustdoc.css b/ch4-dev/rustdoc.css new file mode 100644 index 00000000..674a5af6 --- /dev/null +++ b/ch4-dev/rustdoc.css @@ -0,0 +1 @@ + @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/ch4-dev/search-index.js b/ch4-dev/search-index.js new file mode 100644 index 00000000..94d1be38 --- /dev/null +++ b/ch4-dev/search-index.js @@ -0,0 +1,4 @@ +var searchIndex = JSON.parse('{\ +"os":{"doc":"The main module and entrypoint","t":[0,5,0,0,0,0,0,14,14,5,0,0,0,0,0,0,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,17,5,3,11,11,11,11,5,11,11,11,11,5,5,5,0,0,0,5,0,0,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,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,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,12,11,12,11,11,11,11,11,12,11,11,5,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,18,18,18,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,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,12,11,11,11,11,11,11,11,11,11,5,11,11,11,11,11,11,11,11,11,11,11,11,17,17,5,5,5,5,0,3,11,11,11,11,12,11,11,11,11,11,17,17,17,17,0,0,5,17,5,5,5,5,3,3,3,3,12,11,11,11,11,11,11,0,12,5,5,11,5,11,11,11,11,11,11,12,11,11,11,5,11,5,11,12,12,5,11,5,11,12,12,5,0,0,12,11,11,11,11,11,11,11,11,11,3,11,11,11,11,11,12,12,12,11,11,11,11,5,13,13,13,3,4,12,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,12,12,11,12,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,12,12,12,11,12,12,11,11,11,12],"n":["board","clear_bss","config","console","lang_items","loader","mm","print","println","rust_main","sbi","sync","syscall","task","timer","trap","CLOCK_FREQ","EXIT_FAILURE","EXIT_FAILURE_FLAG","EXIT_RESET","EXIT_SUCCESS","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","MEMORY_END","PAGE_SIZE","PAGE_SIZE_BITS","TRAMPOLINE","TRAP_CONTEXT","USER_STACK_SIZE","kernel_stack_position","Stdout","borrow","borrow_mut","from","into","print","try_from","try_into","type_id","write_str","panic","get_app_data","get_num_app","address","frame_allocator","heap_allocator","init","memory_set","page_table","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_pte_array","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","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_bits","from_bits_truncate","from_bits_unchecked","from_elf","from_iter","hash","insert","insert_framed_area","intersection","intersects","into","into","into","into","into","is_all","is_empty","map","map_one","map_perm","map_trampoline","map_type","ne","new","new_bare","new_kernel","not","page_table","partial_cmp","push","remap_test","remove","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","V","W","X","all","bitand","bitand_assign","bitor","bitor_assign","bits","bits","bits","bitxor","bitxor_assign","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","clone","clone","clone_into","clone_into","cmp","complement","contains","difference","empty","empty","eq","executable","extend","find_pte","find_pte_create","flags","fmt","fmt","fmt","fmt","fmt","frames","from","from","from","from_bits","from_bits_truncate","from_bits_unchecked","from_iter","from_token","hash","insert","intersection","intersects","into","into","into","is_all","is_empty","is_valid","map","ne","new","new","not","partial_cmp","ppn","readable","remove","root_ppn","set","sub","sub_assign","symmetric_difference","to_owned","to_owned","toggle","token","translate","translated_byte_buffer","try_from","try_from","try_from","try_into","try_into","try_into","type_id","type_id","type_id","union","unmap","writable","SBI_CONSOLE_PUTCHAR","SBI_SET_TIMER","console_putchar","sbi_call","set_timer","shutdown","up","UPSafeCell","borrow","borrow_mut","exclusive_access","from","inner","into","new","try_from","try_into","type_id","SYSCALL_EXIT","SYSCALL_GET_TIME","SYSCALL_WRITE","SYSCALL_YIELD","fs","process","syscall","FD_STDOUT","sys_write","sys_exit","sys_get_time","sys_yield","TASK_MANAGER","TaskContext","TaskManager","TaskManagerInner","__private_field","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","context","current_task","current_trap_cx","current_user_token","deref","exit_current_and_run_next","find_next_task","from","from","from","get_current_token","get_current_trap_cx","inner","into","into","into","mark_current_exited","mark_current_exited","mark_current_suspended","mark_current_suspended","num_app","ra","run_first_task","run_first_task","run_next_task","run_next_task","s","sp","suspend_current_and_run_next","switch","task","tasks","try_from","try_from","try_from","try_into","try_into","try_into","type_id","type_id","type_id","TaskContext","borrow","borrow_mut","from","goto_trap_return","into","ra","s","sp","try_from","try_into","type_id","zero_init","__switch","Exited","Ready","Running","TaskControlBlock","TaskStatus","base_size","borrow","borrow","borrow_mut","borrow_mut","clone","clone_into","eq","from","from","get_trap_cx","get_user_token","into","into","memory_set","new","task_cx","task_status","to_owned","trap_cx_ppn","try_from","try_from","try_into","try_into","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","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::lang_items","os::loader","","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::switch","os::task::task","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","os::timer","","","","","os::trap","","","","","","","","","","","","","","","os::trap::context","","","","","","","","","","","","","","",""],"d":["Constants used in rCore for qemu","clear BSS segment","Constants used in rCore","SBI console driver, for text output","The panic handler","Loading user applications into memory","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.","","","","","","","","","","","","Return (bottom, top) of a kernel stack in kernel space.","","","","Returns the argument unchanged.","Calls U::from(self).","","","","","","panic handler","get applications data","Get the total number of applications.","Implementation of physical and virtual address and page …","Implementation of FrameAllocator which controls all the …","The global allocator","initiate heap allocator, frame allocator and kernel space","Implementation of MapArea and MemorySet.","Implementation of PageTableEntry and PageTable.","","","","","physical address","","Definitions","physical page number","a simple range structure for type T","iterator for the simple range structure","","","a simple range structure for virtual page number","","virtual address","virtual page number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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).","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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).","","","","","","","","","","","","","","","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","","","","","","","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 …","","","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.","","","","Mention that trampoline is not collected by areas.","","","","","Without kernel stacks.","Returns the complement of this set of flags.","","","","","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.","","","","","","","page table entry flags","page table structure","page table entry structure","","","","","","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.","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).","Returns true if all flags are currently set.","Returns true if no flags are currently stored.","","","","","","Returns the complement of this set of flags.","","","","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.","","","translate a pointer to a mutable u8 Vec through page table","","","","","","","","","","Returns the union of between the flags in self and other.","","","","","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","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","Process management syscalls","handle syscall exception with syscall_id and other …","","write buf of length len to a file with fd","task exits and submit an exit code","get current time","current task gives up resources for other tasks","a TaskManager global instance through lazy_static!","task context structure containing some registers","The task manager, where all the tasks are managed.","The task manager inner in ‘UPSafeCell’","","","","","","","","Implementation of TaskContext","id of current Running task","Get the current ‘Running’ task’s trap contexts.","Get the current ‘Running’ task’s token.","","Exit the current ‘Running’ task and run the next task …","Find next task to run and return task id.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Get the current ‘Running’ task’s token.","Get the current ‘Running’ task’s trap contexts.","use inner value to get mutable access","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Change the status of current Running task into Exited.","Change the status of current Running task into Exited.","Change the status of current Running task into Ready.","Change the status of current Running task into Ready.","total number of tasks","return address ( e.g. __restore ) of __switch ASM function","Run the first task in task list.","Run the first task in task list.","Switch current Running task to the task we have found, or …","Switch current Running task to the task we have found, or …","callee saved registers: s 0..11","kernel stack pointer of app","Suspend the current ‘Running’ task and run the next …","Rust wrapper around __switch.","Types related to task management","task list","","","","","","","","","","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","callee saved registers: s 0..11","kernel stack pointer of app","","","","init task context","Switch to the context of next_task_cx_ptr, saving the …","","","","task control block structure","task status: UnInit, Ready, Running, Exited","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","","","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","","","","","","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,1,1,1,2,1,0,2,1,2,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,3,3,3,3,0,3,3,3,3,0,0,0,0,0,0,0,0,0,4,5,6,7,0,0,0,0,0,0,0,0,0,0,0,0,4,5,8,4,5,6,7,9,8,4,5,6,7,9,4,5,4,5,6,7,9,4,5,6,7,9,4,5,6,7,8,8,4,5,6,7,4,5,4,5,6,7,8,4,4,4,5,5,5,6,6,6,7,7,7,9,6,9,6,6,9,7,8,4,5,6,7,9,8,9,9,4,5,6,7,8,9,8,4,5,4,5,6,7,9,10,7,4,5,6,7,9,8,4,5,6,7,9,8,4,5,6,7,9,8,4,5,6,7,9,0,0,0,0,0,11,12,13,14,13,11,14,13,11,13,12,13,11,14,13,14,0,0,0,14,13,11,13,0,14,13,11,12,14,13,14,13,14,13,11,14,13,11,14,13,11,0,0,0,0,0,15,15,0,0,0,0,0,16,16,16,16,17,18,16,18,16,16,16,16,16,16,16,16,18,19,17,15,16,18,19,17,15,16,15,16,15,16,16,16,16,19,19,17,16,0,0,0,16,15,16,0,0,16,15,16,16,16,16,16,18,19,17,15,16,16,16,16,18,16,16,16,18,16,16,18,19,17,15,16,16,16,19,19,19,18,19,16,19,18,18,16,18,16,18,0,16,0,0,16,0,0,0,16,16,16,15,16,16,18,18,18,19,17,15,16,18,19,17,15,16,18,19,17,15,16,16,19,19,19,20,20,20,0,0,0,20,20,20,20,20,20,20,20,20,20,20,20,21,20,20,22,20,21,22,20,21,20,21,20,21,20,20,20,20,20,21,20,21,20,22,22,21,20,20,20,20,20,22,22,20,21,20,20,20,20,22,20,20,20,20,22,20,21,20,20,21,22,20,22,21,20,20,21,21,20,22,20,20,20,20,20,21,20,22,22,0,22,20,21,22,20,21,22,20,21,20,22,21,0,0,0,0,0,0,0,0,23,23,23,23,23,23,23,23,23,23,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,25,26,24,25,26,24,0,26,0,0,24,0,25,25,26,24,25,25,25,25,26,24,0,25,0,25,25,27,0,25,0,25,27,27,0,0,0,26,25,26,24,25,26,24,25,26,24,0,27,27,27,27,27,27,27,27,27,27,27,27,0,28,28,28,0,0,29,29,28,29,28,28,28,28,29,28,29,29,29,28,29,29,29,29,28,29,29,28,29,28,29,28,0,0,0,0,0,0,0,0,0,30,30,30,0,0,30,0,0,30,0,30,0,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30],"f":[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,[[["",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,[[["usize",0]]],null,[[["",0]],["",0]],[[["",0]],["",0]],[[]],[[]],[[["arguments",3]]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],[[["",0],["str",0]],["result",6]],[[["panicinfo",3]],["never",0]],[[["usize",0]]],[[],["usize",0]],null,null,null,[[]],null,null,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]]],[[["virtaddr",3]]],[[]],[[["usize",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]]],[[],["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]],[[]],[[]],[[]],[[]],[[]],[[["u8",0]],["option",4]],[[["u8",0]]],[[["u8",0]]],[[]],[[["intoiterator",8]]],[[["",0],["",0]]],[[["",0]]],[[["",0],["virtaddr",3],["virtaddr",3],["mappermission",3]]],[[]],[[["",0]],["bool",0]],[[]],[[]],[[]],[[]],[[]],[[["",0]],["bool",0]],[[["",0]],["bool",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]]],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,[[]],[[]],[[["",0]]],[[["pteflags",3]]],[[["",0]]],[[["",0]],["u8",0]],null,null,[[]],[[["",0]]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["pteflags",3]],[[["",0]],["pagetableentry",3]],[[["",0],["",0]]],[[["",0],["",0]]],[[["",0],["pteflags",3]],["ordering",4]],[[]],[[["",0]],["bool",0]],[[]],[[]],[[]],[[["",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],["virtpagenum",3],["physpagenum",3],["pteflags",3]]],[[["",0],["pteflags",3]],["bool",0]],[[]],[[["physpagenum",3],["pteflags",3]]],[[]],[[["",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]]]],[[["usize",0],["usize",0]],["vec",3]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[]],[[["",0],["virtpagenum",3]]],[[["",0]],["bool",0]],null,null,[[["usize",0]]],[[["usize",0],["usize",0],["usize",0],["usize",0]],["usize",0]],[[["usize",0]]],[[],["never",0]],null,null,[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["refmut",3]],[[]],null,[[]],[[]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],null,null,null,null,null,null,[[["usize",0]],["isize",0]],null,[[["usize",0],["usize",0]],["isize",0]],[[["i32",0]],["never",0]],[[],["isize",0]],[[],["isize",0]],null,null,null,null,null,[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],null,null,[[],["trapcontext",3]],[[],["usize",0]],[[["",0]],["taskmanager",3]],[[]],[[["",0]],["option",4,[["usize",0]]]],[[]],[[]],[[]],[[["",0]],["usize",0]],[[["",0]],["trapcontext",3]],null,[[]],[[]],[[]],[[]],[[["",0]]],[[]],[[["",0]]],null,null,[[]],[[["",0]],["never",0]],[[]],[[["",0]]],null,null,[[]],null,null,null,[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],null,[[["",0]],["",0]],[[["",0]],["",0]],[[]],[[["usize",0]]],[[]],null,null,null,[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],[[]],null,null,null,null,null,null,null,[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["taskstatus",4]],[[["",0],["",0]]],[[["",0],["taskstatus",4]],["bool",0]],[[]],[[]],[[["",0]],["trapcontext",3]],[[["",0]],["usize",0]],[[]],[[]],null,[[["usize",0]]],null,null,[[["",0]]],null,[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[["",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]],[[]],[[]],null,null,null,[[["",0],["usize",0]]],null,null,[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],null],"p":[[3,"RISCV64"],[8,"QEMUExit"],[3,"Stdout"],[3,"PhysAddr"],[3,"VirtAddr"],[3,"PhysPageNum"],[3,"VirtPageNum"],[3,"SimpleRangeIterator"],[3,"SimpleRange"],[8,"StepByOne"],[3,"FRAME_ALLOCATOR"],[8,"FrameAllocator"],[3,"StackFrameAllocator"],[3,"FrameTracker"],[4,"MapType"],[3,"MapPermission"],[3,"KERNEL_SPACE"],[3,"MemorySet"],[3,"MapArea"],[3,"PTEFlags"],[3,"PageTableEntry"],[3,"PageTable"],[3,"UPSafeCell"],[3,"TASK_MANAGER"],[3,"TaskManager"],[3,"TaskManagerInner"],[3,"TaskContext"],[4,"TaskStatus"],[3,"TaskControlBlock"],[3,"TrapContext"]]}\ +}'); +if (window.initSearch) {window.initSearch(searchIndex)}; \ No newline at end of file diff --git a/ch4-dev/search.js b/ch4-dev/search.js new file mode 100644 index 00000000..a8026db5 --- /dev/null +++ b/ch4-dev/search.js @@ -0,0 +1,2 @@ +(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/ch4-dev/settings.css b/ch4-dev/settings.css new file mode 100644 index 00000000..35df7bce --- /dev/null +++ b/ch4-dev/settings.css @@ -0,0 +1 @@ +.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/ch4-dev/settings.html b/ch4-dev/settings.html new file mode 100644 index 00000000..a433d003 --- /dev/null +++ b/ch4-dev/settings.html @@ -0,0 +1,17 @@ +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 diff --git a/ch4-dev/settings.js b/ch4-dev/settings.js new file mode 100644 index 00000000..80471891 --- /dev/null +++ b/ch4-dev/settings.js @@ -0,0 +1 @@ +(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/ch4-dev/source-files.js b/ch4-dev/source-files.js new file mode 100644 index 00000000..9c25dd20 --- /dev/null +++ b/ch4-dev/source-files.js @@ -0,0 +1,3 @@ +var N = null;var sourcesIndex = {}; +sourcesIndex["os"] = {"name":"","dirs":[{"name":"boards","files":["qemu.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","mod.rs","switch.rs","task.rs"]},{"name":"trap","files":["context.rs","mod.rs"]}],"files":["config.rs","console.rs","lang_items.rs","loader.rs","main.rs","sbi.rs","timer.rs"]}; +createSourceSidebar(); diff --git a/ch4-dev/source-script.js b/ch4-dev/source-script.js new file mode 100644 index 00000000..9faf492c --- /dev/null +++ b/ch4-dev/source-script.js @@ -0,0 +1 @@ +(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/ch4-dev/src/os/boards/qemu.rs.html b/ch4-dev/src/os/boards/qemu.rs.html new file mode 100644 index 00000000..4bc86d37 --- /dev/null +++ b/ch4-dev/src/os/boards/qemu.rs.html @@ -0,0 +1,182 @@ +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
+
//! Constants used in rCore for qemu
+
+pub const CLOCK_FREQ: usize = 12500000;
+
+pub const MMIO: &[(usize, usize)] = &[
+    (0x0010_0000, 0x00_2000), // VIRT_TEST/RTC  in virt machine
+];
+
+//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 diff --git a/ch4-dev/src/os/config.rs.html b/ch4-dev/src/os/config.rs.html new file mode 100644 index 00000000..73b5350c --- /dev/null +++ b/ch4-dev/src/os/config.rs.html @@ -0,0 +1,46 @@ +config.rs - source + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+
//! Constants used in rCore
+
+pub const USER_STACK_SIZE: usize = 4096 * 2;
+pub const KERNEL_STACK_SIZE: usize = 4096 * 2;
+pub const KERNEL_HEAP_SIZE: usize = 0x30_0000;
+pub const MEMORY_END: usize = 0x80800000;
+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;
+/// 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)
+}
+
+pub use crate::board::{CLOCK_FREQ, MMIO};
+
+
+ \ No newline at end of file diff --git a/ch4-dev/src/os/console.rs.html b/ch4-dev/src/os/console.rs.html new file mode 100644 index 00000000..e227b699 --- /dev/null +++ b/ch4-dev/src/os/console.rs.html @@ -0,0 +1,78 @@ +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
+35
+
//! SBI console driver, for text output
+
+use crate::sbi::console_putchar;
+use core::fmt::{self, Write};
+
+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);
+        }
+        Ok(())
+    }
+}
+
+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]
+/// 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 diff --git a/ch4-dev/src/os/lang_items.rs.html b/ch4-dev/src/os/lang_items.rs.html new file mode 100644 index 00000000..6e4f8525 --- /dev/null +++ b/ch4-dev/src/os/lang_items.rs.html @@ -0,0 +1,48 @@ +lang_items.rs - source + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+
//! The panic handler
+
+use crate::sbi::shutdown;
+use core::panic::PanicInfo;
+
+#[panic_handler]
+/// panic handler
+fn panic(info: &PanicInfo) -> ! {
+    if let Some(location) = info.location() {
+        println!(
+            "[kernel] Panicked at {}:{} {}",
+            location.file(),
+            location.line(),
+            info.message().unwrap()
+        );
+    } else {
+        println!("[kernel] Panicked: {}", info.message().unwrap());
+    }
+    shutdown()
+}
+
+
+ \ No newline at end of file diff --git a/ch4-dev/src/os/loader.rs.html b/ch4-dev/src/os/loader.rs.html new file mode 100644 index 00000000..9ae4578d --- /dev/null +++ b/ch4-dev/src/os/loader.rs.html @@ -0,0 +1,60 @@ +loader.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
+
//! Loading user applications into memory
+
+/// Get the total number of applications.
+pub fn get_num_app() -> usize {
+    extern "C" {
+        fn _num_app();
+    }
+    unsafe { (_num_app as usize as *const usize).read_volatile() }
+}
+
+/// get applications data
+pub fn get_app_data(app_id: usize) -> &'static [u8] {
+    extern "C" {
+        fn _num_app();
+    }
+    let num_app_ptr = _num_app as usize as *const usize;
+    let num_app = get_num_app();
+    let app_start = unsafe { core::slice::from_raw_parts(num_app_ptr.add(1), num_app + 1) };
+    assert!(app_id < num_app);
+    unsafe {
+        core::slice::from_raw_parts(
+            app_start[app_id] as *const u8,
+            app_start[app_id + 1] - app_start[app_id],
+        )
+    }
+}
+
+
+ \ No newline at end of file diff --git a/ch4-dev/src/os/main.rs.html b/ch4-dev/src/os/main.rs.html new file mode 100644 index 00000000..cc4601e6 --- /dev/null +++ b/ch4-dev/src/os/main.rs.html @@ -0,0 +1,166 @@ +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
+
//! 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
+//!
+//! 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_first_task()`] and for the first time go to
+//! userspace.
+
+#![deny(missing_docs)]
+#![deny(warnings)]
+#![no_std]
+#![no_main]
+#![feature(panic_info_message)]
+#![feature(alloc_error_handler)]
+
+extern crate alloc;
+
+#[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;
+
+#[macro_use]
+mod console;
+mod config;
+mod lang_items;
+mod loader;
+mod mm;
+mod sbi;
+mod sync;
+pub mod syscall;
+pub mod task;
+mod timer;
+pub mod trap;
+
+core::arch::global_asm!(include_str!("entry.asm"));
+core::arch::global_asm!(include_str!("link_app.S"));
+
+/// 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);
+    }
+}
+
+#[no_mangle]
+/// the rust entry-point of os
+pub fn rust_main() -> ! {
+    clear_bss();
+    println!("[kernel] Hello, world!");
+    mm::init();
+    println!("[kernel] back to world!");
+    mm::remap_test();
+    trap::init();
+    //trap::enable_interrupt();
+    trap::enable_timer_interrupt();
+    timer::set_next_trigger();
+    task::run_first_task();
+    panic!("Unreachable in rust_main!");
+}
+
+
+ \ No newline at end of file diff --git a/ch4-dev/src/os/mm/address.rs.html b/ch4-dev/src/os/mm/address.rs.html new file mode 100644 index 00000000..d52f7c79 --- /dev/null +++ b/ch4-dev/src/os/mm/address.rs.html @@ -0,0 +1,518 @@ +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
+
//! 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};
+
+/// physical address
+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
+#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq)]
+pub struct PhysAddr(pub usize);
+
+/// virtual address
+#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq)]
+pub struct VirtAddr(pub usize);
+
+/// physical page number
+#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq)]
+pub struct PhysPageNum(pub usize);
+
+/// virtual page number
+#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq)]
+pub struct VirtPageNum(pub usize);
+
+/// 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 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 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()
+
+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 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<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<VirtPageNum> for usize {
+    fn from(v: VirtPageNum) -> Self {
+        v.0
+    }
+}
+
+impl VirtAddr {
+    pub fn floor(&self) -> VirtPageNum {
+        VirtPageNum(self.0 / PAGE_SIZE)
+    }
+    pub fn ceil(&self) -> VirtPageNum {
+        VirtPageNum((self.0 - 1 + PAGE_SIZE) / PAGE_SIZE)
+    }
+    pub fn page_offset(&self) -> usize {
+        self.0 & (PAGE_SIZE - 1)
+    }
+    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 {
+    pub fn floor(&self) -> PhysPageNum {
+        PhysPageNum(self.0 / PAGE_SIZE)
+    }
+    pub fn ceil(&self) -> PhysPageNum {
+        PhysPageNum((self.0 - 1 + PAGE_SIZE) / PAGE_SIZE)
+    }
+    pub fn page_offset(&self) -> usize {
+        self.0 & (PAGE_SIZE - 1)
+    }
+    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 {
+    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 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) }
+    }
+    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) }
+    }
+    pub fn get_mut<T>(&self) -> &'static mut T {
+        let pa: PhysAddr = (*self).into();
+        unsafe { (pa.0 as *mut T).as_mut().unwrap() }
+    }
+}
+
+pub trait StepByOne {
+    fn step(&mut self);
+}
+impl StepByOne for VirtPageNum {
+    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 diff --git a/ch4-dev/src/os/mm/frame_allocator.rs.html b/ch4-dev/src/os/mm/frame_allocator.rs.html new file mode 100644 index 00000000..d4edbce5 --- /dev/null +++ b/ch4-dev/src/os/mm/frame_allocator.rs.html @@ -0,0 +1,280 @@ +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
+135
+136
+
//! 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,
+}
+
+impl 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 }
+    }
+}
+
+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);
+    }
+}
+
+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>,
+}
+
+impl StackFrameAllocator {
+    pub fn init(&mut self, l: PhysPageNum, r: PhysPageNum) {
+        self.current = l.0;
+        self.end = r.0;
+    }
+}
+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 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);
+    }
+}
+
+type FrameAllocatorImpl = StackFrameAllocator;
+
+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();
+    }
+    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)
+}
+
+/// deallocate a frame
+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);
+    }
+    v.clear();
+    for i in 0..5 {
+        let frame = frame_alloc().unwrap();
+        println!("{:?}", frame);
+        v.push(frame);
+    }
+    drop(v);
+    println!("frame_allocator_test passed!");
+}
+
+
+ \ No newline at end of file diff --git a/ch4-dev/src/os/mm/heap_allocator.rs.html b/ch4-dev/src/os/mm/heap_allocator.rs.html new file mode 100644 index 00000000..0b60ac51 --- /dev/null +++ b/ch4-dev/src/os/mm/heap_allocator.rs.html @@ -0,0 +1,110 @@ +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
+49
+50
+51
+
//! 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();
+
+#[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);
+    }
+}
+
+#[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);
+    }
+    for (i, val) in v.iter().take(500).enumerate() {
+        assert_eq!(*val, i);
+    }
+    assert!(bss_range.contains(&(v.as_ptr() as usize)));
+    drop(v);
+    println!("heap_test passed!");
+}
+
+
+ \ No newline at end of file diff --git a/ch4-dev/src/os/mm/memory_set.rs.html b/ch4-dev/src/os/mm/memory_set.rs.html new file mode 100644 index 00000000..6d6a932a --- /dev/null +++ b/ch4-dev/src/os/mm/memory_set.rs.html @@ -0,0 +1,718 @@ +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
+
//! 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();
+}
+
+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()) });
+}
+
+/// memory set structure, controls virtual-memory space
+pub struct MemorySet {
+    page_table: PageTable,
+    areas: Vec<MapArea>,
+}
+
+impl MemorySet {
+    pub fn new_bare() -> Self {
+        Self {
+            page_table: PageTable::new(),
+            areas: Vec::new(),
+        }
+    }
+    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,
+    ) {
+        self.push(
+            MapArea::new(start_va, end_va, MapType::Framed, permission),
+            None,
+        );
+    }
+    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);
+    }
+    /// 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);
+        println!(
+            ".bss [{:#x}, {:#x})",
+            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,
+            ),
+            None,
+        );
+        println!("mapping .rodata section");
+        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,
+            ),
+            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,
+            ),
+            None,
+        );
+        println!("mapping physical memory");
+        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,
+                ),
+                None,
+            );
+        }
+        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;
+                }
+                if ph_flags.is_write() {
+                    map_perm |= MapPermission::W;
+                }
+                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]),
+                );
+            }
+        }
+        // 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,
+            ),
+            None,
+        );
+        (
+            memory_set,
+            user_stack_top,
+            elf.header.pt2.entry_point() as usize,
+        )
+    }
+    pub fn activate(&self) {
+        let satp = self.page_table.token();
+        unsafe {
+            satp::write(satp);
+            asm!("sfence.vma");
+        }
+    }
+    pub fn translate(&self, vpn: VirtPageNum) -> Option<PageTableEntry> {
+        self.page_table.translate(vpn)
+    }
+}
+
+/// 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,
+        }
+    }
+    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);
+            }
+        }
+        let pte_flags = PTEFlags::from_bits(self.map_perm.bits).unwrap();
+        page_table.map(vpn, ppn, pte_flags);
+    }
+    #[allow(unused)]
+    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);
+    }
+    pub fn map(&mut self, page_table: &mut PageTable) {
+        for vpn in self.vpn_range {
+            self.map_one(page_table, vpn);
+        }
+    }
+    #[allow(unused)]
+    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 {
+                break;
+            }
+            current_vpn.step();
+        }
+    }
+}
+
+#[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 {
+        const R = 1 << 1;
+        const W = 1 << 2;
+        const X = 1 << 3;
+        const U = 1 << 4;
+    }
+}
+
+#[allow(unused)]
+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 diff --git a/ch4-dev/src/os/mm/mod.rs.html b/ch4-dev/src/os/mm/mod.rs.html new file mode 100644 index 00000000..3ee11368 --- /dev/null +++ b/ch4-dev/src/os/mm/mod.rs.html @@ -0,0 +1,64 @@ +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
+
//! 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;
+
+pub use address::{PhysAddr, PhysPageNum, VirtAddr, VirtPageNum};
+use address::{StepByOne, VPNRange};
+pub use frame_allocator::{frame_alloc, FrameTracker};
+pub use memory_set::remap_test;
+pub use memory_set::{MapPermission, MemorySet, KERNEL_SPACE};
+pub use page_table::{translated_byte_buffer, PageTableEntry};
+use page_table::{PTEFlags, PageTable};
+
+/// 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 diff --git a/ch4-dev/src/os/mm/page_table.rs.html b/ch4-dev/src/os/mm/page_table.rs.html new file mode 100644 index 00000000..5ff1a51b --- /dev/null +++ b/ch4-dev/src/os/mm/page_table.rs.html @@ -0,0 +1,322 @@ +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
+
//! Implementation of [`PageTableEntry`] and [`PageTable`].
+
+use super::{frame_alloc, FrameTracker, PhysPageNum, StepByOne, VirtAddr, VirtPageNum};
+use alloc::vec;
+use alloc::vec::Vec;
+use bitflags::*;
+
+bitflags! {
+    /// page table entry flags
+    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 {
+    pub bits: usize,
+}
+
+impl PageTableEntry {
+    pub fn new(ppn: PhysPageNum, flags: PTEFlags) -> Self {
+        PageTableEntry {
+            bits: ppn.0 << 10 | flags.bits as usize,
+        }
+    }
+    pub fn empty() -> Self {
+        PageTableEntry { bits: 0 }
+    }
+    pub fn ppn(&self) -> PhysPageNum {
+        (self.bits >> 10 & ((1usize << 44) - 1)).into()
+    }
+    pub fn flags(&self) -> PTEFlags {
+        PTEFlags::from_bits(self.bits as u8).unwrap()
+    }
+    pub fn is_valid(&self) -> bool {
+        (self.flags() & PTEFlags::V) != PTEFlags::empty()
+    }
+    pub fn readable(&self) -> bool {
+        (self.flags() & PTEFlags::R) != PTEFlags::empty()
+    }
+    pub fn writable(&self) -> bool {
+        (self.flags() & PTEFlags::W) != PTEFlags::empty()
+    }
+    pub fn executable(&self) -> bool {
+        (self.flags() & PTEFlags::X) != PTEFlags::empty()
+    }
+}
+
+/// page table structure
+pub struct PageTable {
+    root_ppn: PhysPageNum,
+    frames: Vec<FrameTracker>,
+}
+
+/// Assume that it won't oom when creating/mapping.
+impl 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(),
+        }
+    }
+    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);
+            }
+            ppn = pte.ppn();
+        }
+        result
+    }
+    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;
+            }
+            ppn = pte.ppn();
+        }
+        result
+    }
+    #[allow(unused)]
+    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)]
+    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();
+    }
+    pub fn translate(&self, vpn: VirtPageNum) -> Option<PageTableEntry> {
+        self.find_pte(vpn).map(|pte| *pte)
+    }
+    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()]);
+        }
+        start = end_va.into();
+    }
+    v
+}
+
+
+ \ No newline at end of file diff --git a/ch4-dev/src/os/sbi.rs.html b/ch4-dev/src/os/sbi.rs.html new file mode 100644 index 00000000..bc76b909 --- /dev/null +++ b/ch4-dev/src/os/sbi.rs.html @@ -0,0 +1,130 @@ +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
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+
//! SBI call wrappers
+
+use core::arch::asm;
+
+const SBI_SET_TIMER: usize = 0;
+const SBI_CONSOLE_PUTCHAR: usize = 1;
+
+#[cfg(feature = "board_k210")]
+const SBI_SHUTDOWN: usize = 8;
+// 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;
+
+#[inline(always)]
+/// general sbi call
+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,
+        );
+    }
+    ret
+}
+
+/// 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)
+// }
+
+#[cfg(feature = "board_qemu")]
+use crate::board::QEMUExit;
+/// use sbi call to shutdown the kernel
+pub fn shutdown() -> ! {
+    #[cfg(feature = "board_k210")]
+    sbi_call(SBI_SHUTDOWN, 0, 0, 0);
+
+    #[cfg(feature = "board_qemu")]
+    crate::board::QEMU_EXIT_HANDLE.exit_failure();
+
+    #[cfg(feature = "board_k210")]
+    panic!("It should shutdown!");
+}
+
+
+ \ No newline at end of file diff --git a/ch4-dev/src/os/sync/mod.rs.html b/ch4-dev/src/os/sync/mod.rs.html new file mode 100644 index 00000000..d80ddf18 --- /dev/null +++ b/ch4-dev/src/os/sync/mod.rs.html @@ -0,0 +1,18 @@ +mod.rs - source + +
1
+2
+3
+4
+5
+
//! Synchronization and interior mutability primitives
+
+mod up;
+
+pub use up::UPSafeCell;
+
+
+ \ No newline at end of file diff --git a/ch4-dev/src/os/sync/up.rs.html b/ch4-dev/src/os/sync/up.rs.html new file mode 100644 index 00000000..dfa03fe8 --- /dev/null +++ b/ch4-dev/src/os/sync/up.rs.html @@ -0,0 +1,70 @@ +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
+
//! Uniprocessor interior mutability primitives
+
+use core::cell::{RefCell, RefMut};
+
+/// 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> {}
+
+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()
+    }
+}
+
+
+ \ No newline at end of file diff --git a/ch4-dev/src/os/syscall/fs.rs.html b/ch4-dev/src/os/syscall/fs.rs.html new file mode 100644 index 00000000..7dfee53d --- /dev/null +++ b/ch4-dev/src/os/syscall/fs.rs.html @@ -0,0 +1,52 @@ +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
+
//! File and filesystem-related syscalls
+
+use crate::mm::translated_byte_buffer;
+use crate::task::current_user_token;
+
+const FD_STDOUT: usize = 1;
+
+/// write buf of length `len`  to a file with `fd`
+pub fn sys_write(fd: usize, buf: *const u8, len: usize) -> isize {
+    match fd {
+        FD_STDOUT => {
+            let buffers = translated_byte_buffer(current_user_token(), buf, len);
+            for buffer in buffers {
+                print!("{}", core::str::from_utf8(buffer).unwrap());
+            }
+            len as isize
+        }
+        _ => {
+            panic!("Unsupported fd in sys_write!");
+        }
+    }
+}
+
+
+ \ No newline at end of file diff --git a/ch4-dev/src/os/syscall/mod.rs.html b/ch4-dev/src/os/syscall/mod.rs.html new file mode 100644 index 00000000..31635f7b --- /dev/null +++ b/ch4-dev/src/os/syscall/mod.rs.html @@ -0,0 +1,74 @@ +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
+
//! 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_WRITE: usize = 64;
+const SYSCALL_EXIT: usize = 93;
+const SYSCALL_YIELD: usize = 124;
+const SYSCALL_GET_TIME: usize = 169;
+
+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_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(),
+        _ => panic!("Unsupported syscall_id: {}", syscall_id),
+    }
+}
+
+
+ \ No newline at end of file diff --git a/ch4-dev/src/os/syscall/process.rs.html b/ch4-dev/src/os/syscall/process.rs.html new file mode 100644 index 00000000..b44a0354 --- /dev/null +++ b/ch4-dev/src/os/syscall/process.rs.html @@ -0,0 +1,52 @@ +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
+
//! Process management syscalls
+
+use crate::task::{exit_current_and_run_next, suspend_current_and_run_next};
+use crate::timer::get_time_ms;
+
+/// task exits and submit an exit code
+pub fn sys_exit(exit_code: i32) -> ! {
+    println!("[kernel] Application exited with code {}", exit_code);
+    exit_current_and_run_next();
+    panic!("Unreachable in sys_exit!");
+}
+
+/// current task gives up resources for other tasks
+pub fn sys_yield() -> isize {
+    suspend_current_and_run_next();
+    0
+}
+
+/// get current time
+pub fn sys_get_time() -> isize {
+    get_time_ms() as isize
+}
+
+
+ \ No newline at end of file diff --git a/ch4-dev/src/os/task/context.rs.html b/ch4-dev/src/os/task/context.rs.html new file mode 100644 index 00000000..a0814d0e --- /dev/null +++ b/ch4-dev/src/os/task/context.rs.html @@ -0,0 +1,72 @@ +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,
+    /// callee saved registers:  s 0..11
+    s: [usize; 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],
+        }
+    }
+}
+
+
+ \ No newline at end of file diff --git a/ch4-dev/src/os/task/mod.rs.html b/ch4-dev/src/os/task/mod.rs.html new file mode 100644 index 00000000..a4665001 --- /dev/null +++ b/ch4-dev/src/os/task/mod.rs.html @@ -0,0 +1,408 @@ +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
+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
+
//! 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 operating system.
+//!
+//! 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 switch;
+#[allow(clippy::module_inception)]
+mod task;
+
+use crate::loader::{get_app_data, get_num_app};
+use crate::sync::UPSafeCell;
+use crate::trap::TrapContext;
+use alloc::vec::Vec;
+use lazy_static::*;
+use switch::__switch;
+use task::{TaskControlBlock, TaskStatus};
+
+pub use context::TaskContext;
+
+/// The task manager, where all the tasks are managed.
+///
+/// Functions implemented on `TaskManager` deals with all task state transitions
+/// and task context switching. For convenience, you can find wrappers around it
+/// in the module level.
+///
+/// Most of `TaskManager` are hidden behind the field `inner`, to defer
+/// borrowing checks to runtime. You can see examples on how to use `inner` in
+/// existing functions on `TaskManager`.
+pub struct TaskManager {
+    /// total number of tasks
+    num_app: usize,
+    /// use inner value to get mutable access
+    inner: UPSafeCell<TaskManagerInner>,
+}
+
+/// The task manager inner in 'UPSafeCell'
+struct TaskManagerInner {
+    /// task list
+    tasks: Vec<TaskControlBlock>,
+    /// id of current `Running` task
+    current_task: usize,
+}
+
+lazy_static! {
+    /// a `TaskManager` global instance through lazy_static!
+    pub static ref TASK_MANAGER: TaskManager = {
+        println!("init TASK_MANAGER");
+        let num_app = get_num_app();
+        println!("num_app = {}", num_app);
+        let mut tasks: Vec<TaskControlBlock> = Vec::new();
+        for i in 0..num_app {
+            tasks.push(TaskControlBlock::new(get_app_data(i), i));
+        }
+        TaskManager {
+            num_app,
+            inner: unsafe {
+                UPSafeCell::new(TaskManagerInner {
+                    tasks,
+                    current_task: 0,
+                })
+            },
+        }
+    };
+}
+
+impl TaskManager {
+    /// Run the first task in task list.
+    ///
+    /// Generally, the first task in task list is an idle task (we call it zero process later).
+    /// But in ch4, we load apps statically, so the first task is a real app.
+    fn run_first_task(&self) -> ! {
+        let mut inner = self.inner.exclusive_access();
+        let next_task = &mut inner.tasks[0];
+        next_task.task_status = TaskStatus::Running;
+        let next_task_cx_ptr = &next_task.task_cx as *const TaskContext;
+        drop(inner);
+        let mut _unused = TaskContext::zero_init();
+        // before this, we should drop local variables that must be dropped manually
+        unsafe {
+            __switch(&mut _unused as *mut _, next_task_cx_ptr);
+        }
+        panic!("unreachable in run_first_task!");
+    }
+
+    /// Change the status of current `Running` task into `Ready`.
+    fn mark_current_suspended(&self) {
+        let mut inner = self.inner.exclusive_access();
+        let cur = inner.current_task;
+        inner.tasks[cur].task_status = TaskStatus::Ready;
+    }
+
+    /// Change the status of current `Running` task into `Exited`.
+    fn mark_current_exited(&self) {
+        let mut inner = self.inner.exclusive_access();
+        let cur = inner.current_task;
+        inner.tasks[cur].task_status = TaskStatus::Exited;
+    }
+
+    /// Find next task to run and return task id.
+    ///
+    /// In this case, we only return the first `Ready` task in task list.
+    fn find_next_task(&self) -> Option<usize> {
+        let inner = self.inner.exclusive_access();
+        let current = inner.current_task;
+        (current + 1..current + self.num_app + 1)
+            .map(|id| id % self.num_app)
+            .find(|id| inner.tasks[*id].task_status == TaskStatus::Ready)
+    }
+
+    /// Get the current 'Running' task's token.
+    fn get_current_token(&self) -> usize {
+        let inner = self.inner.exclusive_access();
+        inner.tasks[inner.current_task].get_user_token()
+    }
+
+    /// Get the current 'Running' task's trap contexts.
+    fn get_current_trap_cx(&self) -> &'static mut TrapContext {
+        let inner = self.inner.exclusive_access();
+        inner.tasks[inner.current_task].get_trap_cx()
+    }
+
+    /// Switch current `Running` task to the task we have found,
+    /// or there is no `Ready` task and we can exit with all applications completed
+    fn run_next_task(&self) {
+        if let Some(next) = self.find_next_task() {
+            let mut inner = self.inner.exclusive_access();
+            let current = inner.current_task;
+            inner.tasks[next].task_status = TaskStatus::Running;
+            inner.current_task = next;
+            let current_task_cx_ptr = &mut inner.tasks[current].task_cx as *mut TaskContext;
+            let next_task_cx_ptr = &inner.tasks[next].task_cx as *const TaskContext;
+            drop(inner);
+            // before this, we should drop local variables that must be dropped manually
+            unsafe {
+                __switch(current_task_cx_ptr, next_task_cx_ptr);
+            }
+            // go back to user mode
+        } else {
+            println!("All applications completed!");
+
+            #[cfg(feature = "board_qemu")]
+            use crate::board::QEMUExit;
+            #[cfg(feature = "board_qemu")]
+            crate::board::QEMU_EXIT_HANDLE.exit_success();
+
+            #[cfg(feature = "board_k210")]
+            panic!("All applications completed!");
+        }
+    }
+}
+
+/// Run the first task in task list.
+pub fn run_first_task() {
+    TASK_MANAGER.run_first_task();
+}
+
+/// Switch current `Running` task to the task we have found,
+/// or there is no `Ready` task and we can exit with all applications completed
+fn run_next_task() {
+    TASK_MANAGER.run_next_task();
+}
+
+/// Change the status of current `Running` task into `Ready`.
+fn mark_current_suspended() {
+    TASK_MANAGER.mark_current_suspended();
+}
+
+/// Change the status of current `Running` task into `Exited`.
+fn mark_current_exited() {
+    TASK_MANAGER.mark_current_exited();
+}
+
+/// Suspend the current 'Running' task and run the next task in task list.
+pub fn suspend_current_and_run_next() {
+    mark_current_suspended();
+    run_next_task();
+}
+
+/// Exit the current 'Running' task and run the next task in task list.
+pub fn exit_current_and_run_next() {
+    mark_current_exited();
+    run_next_task();
+}
+
+/// Get the current 'Running' task's token.
+pub fn current_user_token() -> usize {
+    TASK_MANAGER.get_current_token()
+}
+
+/// Get the current 'Running' task's trap contexts.
+pub fn current_trap_cx() -> &'static mut TrapContext {
+    TASK_MANAGER.get_current_trap_cx()
+}
+
+
+ \ No newline at end of file diff --git a/ch4-dev/src/os/task/switch.rs.html b/ch4-dev/src/os/task/switch.rs.html new file mode 100644 index 00000000..18454a05 --- /dev/null +++ b/ch4-dev/src/os/task/switch.rs.html @@ -0,0 +1,38 @@ +switch.rs - source + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+
//! Rust wrapper around `__switch`.
+//!
+//! Switching to a different task's context happens here. The actual
+//! implementation must not be in Rust and (essentially) has to be in assembly
+//! language (Do you know why?), so this module really is just a wrapper around
+//! `switch.S`.
+
+core::arch::global_asm!(include_str!("switch.S"));
+use super::TaskContext;
+
+extern "C" {
+    /// Switch to the context of `next_task_cx_ptr`, saving the current context
+    /// in `current_task_cx_ptr`.
+    pub fn __switch(current_task_cx_ptr: *mut TaskContext, next_task_cx_ptr: *const TaskContext);
+}
+
+
+ \ No newline at end of file diff --git a/ch4-dev/src/os/task/task.rs.html b/ch4-dev/src/os/task/task.rs.html new file mode 100644 index 00000000..7ff002ed --- /dev/null +++ b/ch4-dev/src/os/task/task.rs.html @@ -0,0 +1,136 @@ +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
+
//! Types related to task management
+use super::TaskContext;
+use crate::config::{kernel_stack_position, TRAP_CONTEXT};
+use crate::mm::{MapPermission, MemorySet, PhysPageNum, VirtAddr, KERNEL_SPACE};
+use crate::trap::{trap_handler, TrapContext};
+
+/// task control block structure
+pub struct TaskControlBlock {
+    pub task_status: TaskStatus,
+    pub task_cx: TaskContext,
+    pub memory_set: MemorySet,
+    pub trap_cx_ppn: PhysPageNum,
+    pub base_size: usize,
+}
+
+impl TaskControlBlock {
+    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 new(elf_data: &[u8], app_id: usize) -> 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();
+        let task_status = TaskStatus::Ready;
+        // map a kernel-stack in kernel space
+        let (kernel_stack_bottom, kernel_stack_top) = kernel_stack_position(app_id);
+        KERNEL_SPACE.exclusive_access().insert_framed_area(
+            kernel_stack_bottom.into(),
+            kernel_stack_top.into(),
+            MapPermission::R | MapPermission::W,
+        );
+        let task_control_block = Self {
+            task_status,
+            task_cx: TaskContext::goto_trap_return(kernel_stack_top),
+            memory_set,
+            trap_cx_ppn,
+            base_size: user_sp,
+        };
+        // prepare TrapContext in user space
+        let trap_cx = task_control_block.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
+    }
+}
+
+#[derive(Copy, Clone, PartialEq)]
+/// task status: UnInit, Ready, Running, Exited
+pub enum TaskStatus {
+    Ready,
+    Running,
+    Exited,
+}
+
+
+ \ No newline at end of file diff --git a/ch4-dev/src/os/timer.rs.html b/ch4-dev/src/os/timer.rs.html new file mode 100644 index 00000000..bac26340 --- /dev/null +++ b/ch4-dev/src/os/timer.rs.html @@ -0,0 +1,52 @@ +timer.rs - source + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+
//! RISC-V timer-related functionality
+
+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;
+
+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)
+}
+
+/// 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 diff --git a/ch4-dev/src/os/trap/context.rs.html b/ch4-dev/src/os/trap/context.rs.html new file mode 100644 index 00000000..708c3072 --- /dev/null +++ b/ch4-dev/src/os/trap/context.rs.html @@ -0,0 +1,104 @@ +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
+
//! Implementation of [`TrapContext`]
+
+use riscv::register::sstatus::{self, Sstatus, SPP};
+
+#[repr(C)]
+/// 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;
+    }
+    /// 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(); // CSR sstatus
+        sstatus.set_spp(SPP::User); //previous privilege mode: user mode
+        let mut cx = Self {
+            x: [0; 32],
+            sstatus,
+            sepc: entry,  // entry point of app
+            kernel_satp,  // addr of page table
+            kernel_sp,    // kernel stack
+            trap_handler, // addr of trap_handler function
+        };
+        cx.set_sp(sp); // app's user stack pointer
+        cx // return initial Trap Context of app
+    }
+}
+
+
+ \ No newline at end of file diff --git a/ch4-dev/src/os/trap/mod.rs.html b/ch4-dev/src/os/trap/mod.rs.html new file mode 100644 index 00000000..c23d3f9c --- /dev/null +++ b/ch4-dev/src/os/trap/mod.rs.html @@ -0,0 +1,258 @@ +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
+
//! 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::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();
+}
+
+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);
+    }
+}
+
+/// 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 cx = current_trap_cx();
+    let scause = scause::read();
+    let stval = stval::read();
+    match scause.cause() {
+        Trap::Exception(Exception::UserEnvCall) => {
+            cx.sepc += 4;
+            cx.x[10] = syscall(cx.x[17], [cx.x[10], cx.x[11], cx.x[12]]) as usize;
+        }
+        Trap::Exception(Exception::StoreFault)
+        | Trap::Exception(Exception::StorePageFault)
+        | Trap::Exception(Exception::LoadFault)
+        | Trap::Exception(Exception::LoadPageFault) => {
+            println!("[kernel] PageFault in application, bad addr = {:#x}, bad instruction = {:#x}, kernel killed it.", stval, cx.sepc);
+            exit_current_and_run_next();
+        }
+        Trap::Exception(Exception::IllegalInstruction) => {
+            println!("[kernel] IllegalInstruction in application, kernel killed it.");
+            exit_current_and_run_next();
+        }
+        Trap::Interrupt(Interrupt::SupervisorTimer) => {
+            set_next_trigger();
+            suspend_current_and_run_next();
+        }
+        _ => {
+            panic!(
+                "Unsupported trap {:?}, stval = {:#x}!",
+                scause.cause(),
+                stval
+            );
+        }
+    }
+    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();
+    }
+    let restore_va = __restore as usize - __alltraps as usize + TRAMPOLINE;
+    unsafe {
+        asm!(
+            "fence.i",
+            "jr {restore_va}",             // jump to new addr of __restore asm function
+            restore_va = in(reg) restore_va,
+            in("a0") trap_cx_ptr,      // a0 = virt addr of Trap Context
+            in("a1") user_satp,        // a1 = phy addr of usr page table
+            options(noreturn)
+        );
+    }
+}
+
+#[no_mangle]
+/// Unimplement: traps/interrupts/exceptions from kernel mode
+/// Todo: Chapter 9: I/O device
+pub fn trap_from_kernel() -> ! {
+    panic!("a trap from kernel!");
+}
+
+pub use context::TrapContext;
+
+
+ \ No newline at end of file diff --git a/ch4-dev/storage.js b/ch4-dev/storage.js new file mode 100644 index 00000000..c6d070de --- /dev/null +++ b/ch4-dev/storage.js @@ -0,0 +1 @@ +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/ch4-dev/toggle-minus.svg b/ch4-dev/toggle-minus.svg new file mode 100644 index 00000000..73154788 --- /dev/null +++ b/ch4-dev/toggle-minus.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ch4-dev/toggle-plus.svg b/ch4-dev/toggle-plus.svg new file mode 100644 index 00000000..08b17033 --- /dev/null +++ b/ch4-dev/toggle-plus.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ch4-dev/wheel.svg b/ch4-dev/wheel.svg new file mode 100644 index 00000000..01da3b24 --- /dev/null +++ b/ch4-dev/wheel.svg @@ -0,0 +1 @@ + \ No newline at end of file