ProjectOZ
Copyright (c) Microsoft Corporation<br><br>Overview<br>--------<br>ProjectOZ is an experimental environment based on the SPACE abstractions for<br>the CPU, MMU, and trap mechanisms (search: probert bruno SPACE). ProjectOZ<br>implements these abstractions using the native NTAPI of the Windows kernel,<br>including features specific to building user-mode operating system<br>personalities (aka NT subsystems).<br><br>Because there is a real OS underneath handling the hardware details rather<br>than a simulator, students should find it easier to explore kernels at<br>the algorithm and data structure level rather than worrying about so many<br>low-level details.<br><br>ProjectOZ is provided in source form to universities worldwide. ProjectOZ is<br>continuing to evolve as contributors join the project. Information on downloading<br>the latest version is available at:<br><br> http://www.msdnaacr.net/curriculum/pfv.aspx?ID=6547<br><br>There is also a community forum for discussions related to ProjectOZ:<br><br> http://forums.microsoft.com/WindowsAcademic/ShowForum.aspx?ForumID=196&SiteID=8<br><br>The Windows Kernel and the Windows Academic Program teams can be contacted at<br><br> compsci@microsoft.com<br><br><br>Architecture<br>------------<br>The SPACE abstractions are implemented in a user-mode program (SPACE.exe)<br>which runs as a native subsystem process under Windows. Students run BasicOZ<br>on top of SPACE, using SPACE to provide the basic hardware abstractions.<br>By modifying BasicOZ students implement various projects which improve<br>the rather simple capabilities of BasicOZ.<br><br>Multiple instances of SPACE.exe can run on a single machine, effectively<br>implementing a multicomputer upon which students can experiment<br>with distributed algorithms.<br><br>SPACE.exe supports an extensible set of emulated devices. Each device<br>is presented to BasicOZ as a set of registers. The device emulations can<br>cause interrupts and perform DMA operations to memory<br><br>SPACE Primitives<br>----------------<br>SPACE is based on the idea that threads, virtual memory, and IPC are a bad<br>semantic match as the low-level abstractions in a system. What actually exists<br>in the hardware is the CPU, MMU, and trap/interrupt mechanism. Threads, virtual<br>memory, etc, should be higher-level abstractions built on top of fundamental<br>abstractions representing the hardware:<br><br> CPU - sequences through instructions while referencing memory.<br> MMU - maps CPU virtual addresses into physical addresses, for valid mappings<br> TRAP - an interruption in the normal sequencing of a CPU due to an invalid<br> memory mapping, a trap, exception, or an external interrupt.<br><br> CONTEXT - a set of MMU mappings is represented by a CONTEXT value (e.g. a<br> hardware contextid, or the root of the page table (CR3 on x86). The<br> permissible operations for each mapping are determined by the CPU MODE.<br> MODE - the current CPU MODE selects how permission bits are applied from each<br> mapping in the current CONTEXT (analogous to Ring0..Ring3 on x86 hardware).<br> PORTAL - for each CONTEXT maps hardware TRAPs to a handler, including<br> specification of a new CONTEXT and MODE as well as the handler itself<br> PCB - when a CPU traverses a PORTAL, the previous execution environment (CONTEXT,<br> MODE, Program Counter, and CPU registers) are recorded in a PCB (Processor<br> Control Block). PCBs are normally chained each time a new TRAP occurs.<br><br>SPACE Operations<br>----------------<br>The basic operations implemented by SPACE.exe manipulate the SPACE primitives.<br> MapMemory(ctx, virtual, phys, modeaccess)<br><br> MapPortal(ctx, trap, pctx, pmode, ppc, modeaccess)<br><br> Resume()<br> token = Suspend()<br> Unsuspend(token)<br><br>MapMemory() and MapPortal() set CONTEXT and PORTAL mappings for a specific CONTEXT.<br><br>Portal traversal is implicit in response to a TRAP (including deliberately executing<br>an instruction that causes a TRAP). The interrupt execution environment is recorded<br>in a PCB and subsequent portal traversals chain PCBs as a stack.<br><br>Resume() restores the most recent PCB (analogous to a return-from-interrupt instruction).<br>Suspend() breaks the current chain by assigning a token to it and creating a new chain.<br>Unsuspend() restores a previous chain.<br><br>NT Facilities used to implement SPACE<br>-------------------------------------<br>Objects<br> Threads - NT unit of CPU scheduling<br> Processes - NT virtual address space container<br> Sections - NT sharable memory objects<br> Exception port - NT mechanism for subsystem fault handling<br><br>Functions<br> MapView - Map process addresses to section offsets<br> Wait/Reply port - Receive/Send message to port<br><br>SPACE Implementation<br>--------------------<br>CPUs are implemented using NT threads. MMUs are built using NT processes.<br>Because NT threads are bound to processes, each SPACE CONTEXT/MODE is represented<br>as an NT process with an NT thread for each SPACE CPU.<br>SPACE.exe listens on the exception port for the NT processes, which allows it to<br>manipulate the state of the NT threads to chain PCBs, implement portal traversal<br>(including for memory faults) and other SPACE operations.<br><br>BasicOZ is loaded by SPACE.exe, and then communicates by causing traps which SPACE.exe<br>handles to implement the SPACE 'hardware' emulation.<br><br>Workloads, Instrumentation, Community<br>-------------------------------------<br>If ProjectOZ proves to be a useful environment for teaching operating systems,<br>then over time much of the support will come from the academic community itself.<br>ProjectOZ will be extended to improve the accuracy of the instrumentation available<br>to students, and workloads will be developed that allow student projects to be<br>more accurately contrasted & compared.<br><br>Using WRK, the Windows Kernel itself may be extended to provide some of the<br>facilities that are currently not available to ProjectOZ (such as thread-virtual<br>time, reference & dirty bits for the shared memory section, 64KB pages).<br><br>PREVIEW INFORMATION<br>-------------------<br>The ProjectOZ preview makes information about the NTAPI mechanisms used by ProjectOZ<br>available to interested faculty and our collaborators.<br><br>There is prototype code for SPACE.exe which implements the SPACE primitives. It will<br>boot the skeletal BasicOZ and demonstrate how the trap, MMU, and CPU mechanisms work.<br><br>There will be a continuous stream of drops of ProjectOZ over the summer with increasing<br>amount of functionality in BasicOZ, as well as development of the first projects.<br><br>If you want to build and play with the code, you need the July WRK for the tools:<br> set wrk=the WRK directory<br> set projectoz=the ProjectOZ directory<br> path %wrk%\tools\x86;%path%<br> nmake -nologo x86=<br><br>To get on the list for notification of updates contact me directly, or if you'd rather<br>poll -- just check the curriculum website periodically.<br><br> http://www.msdnaacr.net/curriculum/pfv.aspx?ID=6547<br><br>- DavePr@microsoft.com<br><br>Updated: 2006/07/14<br><br>
- 1
- 小小鸟12212013-06-04很好的源码,感谢楼主分享!
- TFIEFK2015-10-04还好,可以了解nt api的知识。但是,64位系统相关部分还未实现,无法编译。只能使用32位系统运行。
- fdsdfdsf2014-09-29好东西,研究Windows内核必备
- aiethac0012015-01-20一个很大的源代码包,可以作为研究操作系统原理的代码,但是内容比较深,而且整理的一般,可能有些难懂。不过也实在是不好找到,感谢分享了。
- 粉丝: 2
- 资源: 34
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助