[solved] I have followed a tutorial and it does not work

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.
Post Reply
wellwell
Posts: 8
Joined: Wed Jul 24, 2019 6:26 am

[solved] I have followed a tutorial and it does not work

Post by wellwell »

I am fallowing the tutorial to build a kernel, http://www.jamesmolloy.co.uk/tutorial_html/, however, the kernel crashed on activated paging. the kernel crashed on executing the code

Code: Select all

 asm volatile("mov %0, %%cr0":: "r"(cr0));
what's up?


I used gdb to debug this kernel, and returned Cannot find bounds of current function, when executing this code.

i finally reached the part of multithread and could print A and B at the same time but without paging <_<. Thanks all, and good lucks.

Image

printed by A B C D four threads
Image


Solved finally!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

with paging,
Image

the heap
Image

user mode
Image


file system
Image
Image
Last edited by wellwell on Wed Sep 11, 2019 4:05 am, edited 12 times in total.
Octocontrabass
Member
Member
Posts: 5581
Joined: Mon Mar 25, 2013 7:01 pm

Re: kernel crashed on activated paging

Post by Octocontrabass »

Have you read this list of known bugs in the tutorial? Keep in mind this list is not complete.
wellwell
Posts: 8
Joined: Wed Jul 24, 2019 6:26 am

Re: kernel crashed on activated paging

Post by wellwell »

Octocontrabass wrote:Have you read this list of known bugs in the tutorial? Keep in mind this list is not complete.
Many Thanks, Is there any other tutorials for beginner?
User avatar
TheCool1Kevin
Posts: 24
Joined: Fri Oct 14, 2016 7:37 pm
Location: Canada
Contact:

Re: kernel crashed on activated paging

Post by TheCool1Kevin »

Hello and welcome to OSDev.

I believe this humorously titled post may help: I have followed a tutorial and it does not work

Unfortunately, I must redirect you to this post Beginner Mistakes before you become utterly overwhelmed by this subject after spending countless hours going in circles. Please understand that this is a very difficult subject and there are no tutorials that can cover paging to the depth that it deserves.

OSDev tutorials should only serve as a jumping-off point in your development. I highly urge you to abandon any tutorial code after you have a general grasp on the topics. A good place to go after would be the Intel Software Developer Manuals (namely volume 3, section 4).

Good luck :D
GMorgan
Posts: 22
Joined: Sun Jul 14, 2019 4:27 pm

Re: kernel crashed on activated paging

Post by GMorgan »

It is likely your paging structure is invalid or your GDT is set up incorrectly.

When I last did something like this I moved some code from NASM to GAS and bugs emerged from that (moving 5 in NASM means the value 5, in GAS the value at memory location 5). Check you are actually putting what you expect into each page table record.
Post Reply