flayhhh / jos Goto Github PK
View Code? Open in Web Editor NEWsimple unix-like kernel
simple unix-like kernel
OS kernel from MIT 6.828 Also my Graduation Project
某个challenge提出了向kernel monitor加功能的要求,之前只有一些添加debug功能,打印内核数据结构信息的想法。
看了虚拟机的论文之后突然对解释器有点困惑,仔细想了一会儿之后发现解释器只要读取输入然后模拟执行就可以了。当熟悉整个计算模型之后就会发现指令的执行无非就是从内存中取指,然后cpu执行。所以kernel monitor只要将输入的汇编指令翻译成机器指令,然后写到某个内存位置,再跳转到那儿执行就行了。为了让控制权回到kernel monitor手中继续解释下一条指令,还需要在机器指令的末尾添加控制返回的指令。 it's amazing!
为了简化控制权的转移,甚至可以写一个壳函数,生成指令时覆盖函数内容就行了。当然,函数地址后必须有足够大的空间。
虽然很简单,但是在没有提示的情况下“重新发现”是一件很爽的事。我大概是天才吧hhh。
当使用uvpt[pgno]时,本质上是默认 uvpt+4*pgno这个地址能够映射到已经存在的PTE.
但是kern_pgdir中不存在某4M虚拟地址的映射,即不存在某块虚拟地址的页表时,uvpt[pgno]会引起pagefault.在用户态下,pgfault handle经常找到不是cow以外的pgfault应该都是这个问题.
内核态下的致命的kernel pgfault大概也是因为这个.
#define DEBUG_SPINLOCK 存在时
spin_unlock有时会出现page fault.原因暂时不明.
发现这个bug时正在testkbd.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.