Page 1 of 1

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

Posted: Wed Jul 24, 2019 6:54 am
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

Re: kernel crashed on activated paging

Posted: Wed Jul 24, 2019 6:59 am
by Octocontrabass
Have you read this list of known bugs in the tutorial? Keep in mind this list is not complete.

Re: kernel crashed on activated paging

Posted: Wed Jul 24, 2019 7:21 am
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?

Re: kernel crashed on activated paging

Posted: Wed Jul 24, 2019 8:38 am
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

Re: kernel crashed on activated paging

Posted: Wed Jul 24, 2019 3:56 pm
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.