Page 1 of 1

Paging? Crash!

Posted: Thu Feb 05, 2015 7:47 pm
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!

Re: Paging? Crash!

Posted: Thu Feb 05, 2015 10:41 pm
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.

Re: Paging? Crash!

Posted: Fri Feb 06, 2015 1:00 am
by madanra
If you haven't already, it's worth reading James Molloy's Tutorial Known Bugs on the wiki first.

Re: Paging? Crash!

Posted: Fri Feb 06, 2015 1:48 pm
by deleted
Thanks guys, I got it working! I worked with the wiki's stuff, and it works! Thanks again :)

Re: Paging? Crash!

Posted: Fri Feb 06, 2015 2:19 pm
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:

Re: Paging? Crash!

Posted: Fri Feb 06, 2015 2:37 pm
by Techel
Maybe your pages after 'end' is not mapped or the problem is in the 'putch' function.

Re: Paging? Crash!

Posted: Fri Feb 06, 2015 2:39 pm
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:

Re: Paging? Crash!

Posted: Sat Feb 07, 2015 9:49 pm
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!