OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 5:31 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: [solved] I have followed a tutorial and it does not work
PostPosted: Wed Jul 24, 2019 6:54 am 
Offline

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

Top
 Profile  
 
 Post subject: Re: kernel crashed on activated paging
PostPosted: Wed Jul 24, 2019 6:59 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
Have you read this list of known bugs in the tutorial? Keep in mind this list is not complete.


Top
 Profile  
 
 Post subject: Re: kernel crashed on activated paging
PostPosted: Wed Jul 24, 2019 7:21 am 
Offline

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


Top
 Profile  
 
 Post subject: Re: kernel crashed on activated paging
PostPosted: Wed Jul 24, 2019 8:38 am 
Offline
User avatar

Joined: Fri Oct 14, 2016 7:37 pm
Posts: 24
Location: Canada
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


Top
 Profile  
 
 Post subject: Re: kernel crashed on activated paging
PostPosted: Wed Jul 24, 2019 3:56 pm 
Offline

Joined: Sun Jul 14, 2019 4:27 pm
Posts: 22
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 69 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group