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!
Paging? Crash!
- eryjus
- Member
- Posts: 286
- Joined: Fri Oct 21, 2011 9:47 pm
- Libera.chat IRC: eryjus
- Location: Tustin, CA USA
Re: Paging? Crash!
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.
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
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
Re: Paging? Crash!
If you haven't already, it's worth reading James Molloy's Tutorial Known Bugs on the wiki first.
Re: Paging? Crash!
Thanks guys, I got it working! I worked with the wiki's stuff, and it works! Thanks again
Re: Paging? Crash!
Ok, new problem. I tried to create a spot in physical memory using malloc() (From James's tutorial), here's what I did:
And it throws a page fault. Entire code is at http://github.com/BiggerOnTheInside/Boom/
Thanks
Code: Select all
char a = '1';
char *b = malloc(sizeof(a));
*b = a;
char c = b;
putch(c);
Thanks
Re: Paging? Crash!
Maybe your pages after 'end' is not mapped or the problem is in the 'putch' function.
Re: Paging? Crash!
Stupid me! I cast (if possible [from Java background]) a char* to a char! Fixed it, error done.
Please excuse my n00bness
Please excuse my n00bness
Re: Paging? Crash!
Hello,
Just to check, what does it mean if ASSERT fails when freeing memory? That is, in James's Malloy's tutorial.
Thanks!
Just to check, what does it mean if ASSERT fails when freeing memory? That is, in James's Malloy's tutorial.
Thanks!