Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Hi guys, I am currently trying to enable paging for my kernel but I am facing a strange problem, if I use the code in the wiki for paging it works just fine but this code is really simple so I tried to enable paging using the code from jamesMolly tutorial but when I enable paging using the code from the tutorial my OS crashes and restarts in qemu I checked the value laoded to cr3 register many times and it is right, this in my case is 0x10e000 contains a pointer to the first page table at address 0x111000 and the pages are set up right I verified that using gdb debugger, This is my code:
1. Bochs has very good debugging messages and facilities.
2. http://wiki.osdev.org/James_Molloy%27s_ ... Known_Bugs
3. Your code is causing light form of eye-bleeding. Those random indentation, absence of packing attribute/pragma, custom type names instead of stdint.h's ones...
I would agree with Nable, while I am not the best to comment about code tidiness (since I code really bad code, which cost me a lot), it is best you develop your own coding style (how code looks like). An example would be something like this https://www.kernel.org/doc/Documentation/CodingStyle. You don't have to follow it exactly, it is just an example, but you would need to have a consistent coding style. For example, in your code, I see things like this
Both which are one line returns but having a different look (with me not being able to tell what you are returning in the first one in the first glance). Perhaps you want to standardize this along with other things which can be very messy (like what Nable mentioned, indentations). Remember that good code will help you a lot in the future when you look back to understand what the code does. (something I learnt looking at my old code) Or while you are trying to debug for that matter, so I do suggest spending some time looking around and standardizing your code style.
CookieOS. Want a cookie? Its only black and white for now though, probably as bad as my baking skills.