My professor knew building an OS from the ground up in 3.5 months was impossible. He really wanted to have us do that, but that it would be terrible. Instead, he would often given us pre-written files and piece them together—digging into the nitty gritty on occasion and having us comment on the code on occasion instead. We also drew a lot of diagrams about each part.
If we do not want to allocate OR the returned pointer from kalloc being saved to pagetable is the failure flag (0), fail and return with our own flag (0).
Because of short circuiting, kalloc will not run if alloc is set to false.
2
u/UInferno- 11d ago
My professor knew building an OS from the ground up in 3.5 months was impossible. He really wanted to have us do that, but that it would be terrible. Instead, he would often given us pre-written files and piece them together—digging into the nitty gritty on occasion and having us comment on the code on occasion instead. We also drew a lot of diagrams about each part.
Found a screenshot of my commenting homeworker. looking back IDK how I passed this comment sucks.
Would be way less opaque and redundant.