old post removed
old post removed
old post removed
Last edited by Octacone on Sun Feb 19, 2017 4:14 am, edited 2 times in total.
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
- hgoel
- Member
- Posts: 89
- Joined: Sun Feb 09, 2014 7:11 pm
- Libera.chat IRC: hgoel
- Location: Within a meter of a computer
Re: Paging && Triple Fault && JamesM && Again
Looks like you don't have the identity map setup correctly.
Make sure your code to build the page table is correct.
Make sure your code to build the page table is correct.
"If the truth is a cruel mistress, than a lie must be a nice girl"
Working on Cardinal
Find me at [url=irc://chat.freenode.net:6697/Cardinal-OS]#Cardinal-OS[/url] on freenode!
Working on Cardinal
Find me at [url=irc://chat.freenode.net:6697/Cardinal-OS]#Cardinal-OS[/url] on freenode!
Re: Paging && Triple Fault && JamesM && Again
removed
Last edited by Octacone on Sun Feb 19, 2017 4:15 am, edited 1 time in total.
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
- BrightLight
- Member
- Posts: 901
- Joined: Sat Dec 27, 2014 9:11 am
- Location: Maadi, Cairo, Egypt
- Contact:
Re: Paging && Triple Fault && JamesM && Again
Practically thinking, you shouldn't use a tutorial for something as important as paging. Paging is something that plays such a role in design, that you should design it yourself. Personally, the first time I enabled paging, I did so by trial and error without tutorials. Just the Paging Wiki entry was good enough for me.
I don't know much about JamesM's tutorial's design, but how do you have kmalloc() without paging?
I don't know much about JamesM's tutorial's design, but how do you have kmalloc() without paging?
You know your OS is advanced when you stop using the Intel programming guide as a reference.
Re: Paging && Triple Fault && JamesM && Again
Rule of thumb: Never, ever copy and paste memory management code. It simply doesn't work. Farther, never, ever copy and paste code unless you completely understand what the code does inside and out and can actually already build it yourself and are only doing it to save some time. Memory management code tends to rely on many hidden details since it ties so close with your system architecture and structure that copying and pasting it almost never works.
If you don't know or don't have access to a good debugger such as bochsdbg, I'd advise getting access before going any farther. Posting code and hoping someone sees problems can only go so far. The Bochs debugger has a nice set of paging commands that you can use to view the page tables and page mappings.
If you don't know or don't have access to a good debugger such as bochsdbg, I'd advise getting access before going any farther. Posting code and hoping someone sees problems can only go so far. The Bochs debugger has a nice set of paging commands that you can use to view the page tables and page mappings.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
- BrightLight
- Member
- Posts: 901
- Joined: Sat Dec 27, 2014 9:11 am
- Location: Maadi, Cairo, Egypt
- Contact:
Re: Paging && Triple Fault && JamesM && Again
Never, ever copy and paste any code.neon wrote:Never, ever copy and paste memory management code.
Fixed it for you.
You know your OS is advanced when you stop using the Intel programming guide as a reference.
Re: Paging && Triple Fault && JamesM && Again
I used to hold that stance but remember getting into a debate here about that some time ago. Personally I don't see the problem as long as you know what the code does and why. Note I use the term know here - i.e. you can already write the code in your sleep.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
Re: Paging && Triple Fault && JamesM && Again
* GetPage returns a pointer to the PTE corresponding to the given address i. If AllocateFrame fills that PTE, it needs to know i. It is not sent i.
* Use bochsdbg to reach the insn just before the crash, and print the paging structures.
* Use bochsdbg to reach the insn just before the crash, and print the paging structures.
Re: Paging && Triple Fault && JamesM && Again
removed
Last edited by Octacone on Sun Feb 19, 2017 4:15 am, edited 1 time in total.
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
Re: Paging && Triple Fault && JamesM && Again
removed
Last edited by Octacone on Sun Feb 19, 2017 4:15 am, edited 2 times in total.
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
Re: Paging && Triple Fault && JamesM && Again
It was mentioned earlier that the code stops working right after SwitchPageDirectory enables paging.octacone wrote: I can't get any output from int i because my code never reaches there I think.
Here is something interesting (take a look at kernel directory at the top/bottom output):
But the screenshot shows that InstallPaging (and therefore SwitchPageDirectory too) runs to completion.
Did the problem change? Regardless of any changes, bochsdbg should help.
The screenshot output can be explained by this portion of InstallPaging:
Code: Select all
. . .
WriteOutputToQemu(kernelDirectory); //debugging
. . .
kernelDirectory = (page_directory_t*) kmallocA(sizeof(page_directory_t));
. . .
WriteOutputToQemu(IntToString(kernelDirectory)); //debugging
. . .
Re: Paging && Triple Fault && JamesM && Again
I think you are quite correct. You have been given some good tips as to how to debug your problem. Now, get to it and start learning!octacone wrote: This is my way of learning: see a tutorial, try to reproduce it, start fixing bugs and adapting code, that makes you understand stuff better, because debugging makes your learn stuff you don't get.
Re: Paging && Triple Fault && JamesM && Again
removed fixed
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader