Paging? Crash!

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
User avatar
deleted
Member
Member
Posts: 82
Joined: Mon Jul 21, 2014 7:23 pm

Paging? Crash!

Post by deleted »

Hey guys,

I have finally picked back up my OS (not even) again after a break. I scrapped the old one, and restarted from brandon's tutorial. I attempted to implements James Malloy's paging system, but to no avil.

I am using QEMU and i686-pc-elf toolchain, when I try to boot the OS, it won't get past the "Booting" message on QEMU. My code can be found here: https://github.com/BiggerOnTheInside/Boom

Any help would by greatly aprecated!

PS: James's (kmalloc && friends functions) = working!
User avatar
eryjus
Member
Member
Posts: 286
Joined: Fri Oct 21, 2011 9:47 pm
Libera.chat IRC: eryjus
Location: Tustin, CA USA

Re: Paging? Crash!

Post by eryjus »

Hi,

You are not calling paging_install() -- it is commented out. Assuming that was a mistake to commit that code with the function call commented out, I would implement switch_page_directory() as pure assembly. Its current implementation will cause you quite a bit of trouble. I cannot comment on the details of the problems it causes because I stay away from inline assembly. However, you can disassemble your object (or compile to assembly) and compare that against what you intended in the C code and see how the compiler shoots you in the foot.

Now, if I remember correctly, I had all kinds of trouble with that tutorial and it took quite a while to work out the bugs -- if I even got them all. I would check the wiki for more details. You will be better to write your own paging code since you will understand it much better if you do.
Adam

The name is fitting: Century Hobby OS -- At this rate, it's gonna take me that long!
Read about my mistakes and missteps with this iteration: Journal

"Sometimes things just don't make sense until you figure them out." -- Phil Stahlheber
madanra
Member
Member
Posts: 149
Joined: Mon Sep 07, 2009 12:01 pm

Re: Paging? Crash!

Post by madanra »

If you haven't already, it's worth reading James Molloy's Tutorial Known Bugs on the wiki first.
User avatar
deleted
Member
Member
Posts: 82
Joined: Mon Jul 21, 2014 7:23 pm

Re: Paging? Crash!

Post by deleted »

Thanks guys, I got it working! I worked with the wiki's stuff, and it works! Thanks again :)
User avatar
deleted
Member
Member
Posts: 82
Joined: Mon Jul 21, 2014 7:23 pm

Re: Paging? Crash!

Post by deleted »

Ok, new problem. I tried to create a spot in physical memory using malloc() (From James's tutorial), here's what I did:

Code: Select all

char a = '1';
    char *b = malloc(sizeof(a));
    *b = a;
    char c = b;
    
    putch(c);
And it throws a page fault. Entire code is at http://github.com/BiggerOnTheInside/Boom/

Thanks :lol:
Techel
Member
Member
Posts: 215
Joined: Fri Jan 30, 2015 4:57 pm
Location: Germany
Contact:

Re: Paging? Crash!

Post by Techel »

Maybe your pages after 'end' is not mapped or the problem is in the 'putch' function.
User avatar
deleted
Member
Member
Posts: 82
Joined: Mon Jul 21, 2014 7:23 pm

Re: Paging? Crash!

Post by deleted »

Stupid me! I cast (if possible [from Java background]) a char* to a char! Fixed it, error done.

Please excuse my n00bness :oops:
User avatar
deleted
Member
Member
Posts: 82
Joined: Mon Jul 21, 2014 7:23 pm

Re: Paging? Crash!

Post by deleted »

Hello,

Just to check, what does it mean if ASSERT fails when freeing memory? That is, in James's Malloy's tutorial.

Thanks!
Post Reply