Triple fault when enabling paging
Re: Triple fault when enabling paging
pgtbl[0] = 0x00000003 is correct however pgdir[0] = 0x0009B803 is not. Assuming the page table is at 0x00137000, pgdir[0] should be 0x137003. Without farther information, I cannot confirm where that 0x0009B803 is coming from - it points to a nonexistent page table at 0x9b000.
In fact, pgtbl[0] = 0x00000003, pgtbl[1] should be 0x00001003, pgtbl[2] should be 0x00002003 ... and pgtbl[1023] should be 0x003ff003. This maps frames 0 - 0x3ff, or addresses 0 - 0x400000 inclusive. If you got these as well, then we can focus on why the page directory is wrong.
In fact, pgtbl[0] = 0x00000003, pgtbl[1] should be 0x00001003, pgtbl[2] should be 0x00002003 ... and pgtbl[1023] should be 0x003ff003. This maps frames 0 - 0x3ff, or addresses 0 - 0x400000 inclusive. If you got these as well, then we can focus on why the page directory is wrong.
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: Triple fault when enabling paging
No, no. You misunderstanded me. The paging problem is in my code, my message about "not my code" is about Bochs crash on GRUB menu, not about paging.iansjack wrote:I'm puzzled. In your initial post you said the problem happened when you turned on paging. Now you are saying that it isn't in your code.
If it's crashing before you can do any debugging then from where are you getting the values that you tell us your page table entries have?
Developing U365.
Source:
only testing: http://gitlab.com/bps-projs/U365/tree/testing
OSDev newbies can copy any code from my repositories, just leave a notice that this code was written by U365 development team, not by you.
Source:
only testing: http://gitlab.com/bps-projs/U365/tree/testing
OSDev newbies can copy any code from my repositories, just leave a notice that this code was written by U365 development team, not by you.
Re: Triple fault when enabling paging
I don't know why, but pgtbl is increases by 0x800, not by 0x1000.neon wrote:pgtbl[0] = 0x00000003 is correct however pgdir[0] = 0x0009B803 is not. Assuming the page table is at 0x00137000, pgdir[0] should be 0x137003. Without farther information, I cannot confirm where that 0x0009B803 is coming from - it points to a nonexistent page table at 0x9b000.
In fact, pgtbl[0] = 0x00000003, pgtbl[1] should be 0x00001003, pgtbl[2] should be 0x00002003 ... and pgtbl[1023] should be 0x003ff003. This maps frames 0 - 0x3ff, or addresses 0 - 0x400000 inclusive. If you got these as well, then we can focus on why the page directory is wrong.
Developing U365.
Source:
only testing: http://gitlab.com/bps-projs/U365/tree/testing
OSDev newbies can copy any code from my repositories, just leave a notice that this code was written by U365 development team, not by you.
Source:
only testing: http://gitlab.com/bps-projs/U365/tree/testing
OSDev newbies can copy any code from my repositories, just leave a notice that this code was written by U365 development team, not by you.
Re: Triple fault when enabling paging
0x00000003, 0x00000803, 0x00001003, ...
Developing U365.
Source:
only testing: http://gitlab.com/bps-projs/U365/tree/testing
OSDev newbies can copy any code from my repositories, just leave a notice that this code was written by U365 development team, not by you.
Source:
only testing: http://gitlab.com/bps-projs/U365/tree/testing
OSDev newbies can copy any code from my repositories, just leave a notice that this code was written by U365 development team, not by you.
Re: Triple fault when enabling paging
Your definition of Page Table entries is wrong. You're missing the PWT bit. And the address field should be 20 bits, not 21
Re: Triple fault when enabling paging
Thanks, fixed. Now pgtbl is increasing by 0x1000. What next, @neon?iansjack wrote:Your definition of Page Table entries is wrong. You're missing the PWT bit. And the address field should be 20 bits, not 21
Developing U365.
Source:
only testing: http://gitlab.com/bps-projs/U365/tree/testing
OSDev newbies can copy any code from my repositories, just leave a notice that this code was written by U365 development team, not by you.
Source:
only testing: http://gitlab.com/bps-projs/U365/tree/testing
OSDev newbies can copy any code from my repositories, just leave a notice that this code was written by U365 development team, not by you.
Re: Triple fault when enabling paging
Make sure that you made the same update to your page directory structure (it follows the same structure as the page table; the address field should also be 20 bits.) What is (uint32_t)pgdir[0] and the address of page directory now?
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: Triple fault when enabling paging
pgdir[0] is changed, now it's 0x00137003. Address is the same - 0x00138000. My page directory structure is:
Code: Select all
struct page_directory_t
{
unsigned int present : 1;
unsigned int rw_flag : 1;
unsigned int access_lvl : 1; //0 is for only ring0. 1 is for anybody.
unsigned int write_through : 1;
unsigned int cache_off : 1;
unsigned int accessed : 1;
unsigned int zero : 1;
unsigned int page_size : 1;
unsigned int unused : 4; //Now it's 4, because of 1 ignored bit (G in wiki article)
unsigned int tbl_addr : 20;
};
Developing U365.
Source:
only testing: http://gitlab.com/bps-projs/U365/tree/testing
OSDev newbies can copy any code from my repositories, just leave a notice that this code was written by U365 development team, not by you.
Source:
only testing: http://gitlab.com/bps-projs/U365/tree/testing
OSDev newbies can copy any code from my repositories, just leave a notice that this code was written by U365 development team, not by you.
Re: Triple fault when enabling paging
Before you told us that the page table was at 0x00137000 not 0x00138000. Please double check which one is correct. pgdir[0] = 0x00137003 is only valid if the page table is at 0x00137000.
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: Triple fault when enabling paging
Yes, that's a my typo The real address of pgdir is 0x00138000 and address of pgtbl is 0x00137000.
Developing U365.
Source:
only testing: http://gitlab.com/bps-projs/U365/tree/testing
OSDev newbies can copy any code from my repositories, just leave a notice that this code was written by U365 development team, not by you.
Source:
only testing: http://gitlab.com/bps-projs/U365/tree/testing
OSDev newbies can copy any code from my repositories, just leave a notice that this code was written by U365 development team, not by you.
Re: Triple fault when enabling paging
Okay, great - this means pgdir[0] is now correct and so is your page table. Now, post the value of the cr3 register. It should be 0x00138000.
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: Triple fault when enabling paging
CR3==0x00138000
YAAAY!
YAAAY!
Developing U365.
Source:
only testing: http://gitlab.com/bps-projs/U365/tree/testing
OSDev newbies can copy any code from my repositories, just leave a notice that this code was written by U365 development team, not by you.
Source:
only testing: http://gitlab.com/bps-projs/U365/tree/testing
OSDev newbies can copy any code from my repositories, just leave a notice that this code was written by U365 development team, not by you.
Re: Triple fault when enabling paging
Does it work without error or still triple fault?
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: Triple fault when enabling paging
Works, I'll go and map the 32 MB of memory. Paging is enabling now, but I inserted the cli; hlt after it, so it cannot access non-accessible yet VBE framebuffer.neon wrote:Does it work without error or still triple fault?
Developing U365.
Source:
only testing: http://gitlab.com/bps-projs/U365/tree/testing
OSDev newbies can copy any code from my repositories, just leave a notice that this code was written by U365 development team, not by you.
Source:
only testing: http://gitlab.com/bps-projs/U365/tree/testing
OSDev newbies can copy any code from my repositories, just leave a notice that this code was written by U365 development team, not by you.
Re: Triple fault when enabling paging
Thank you, neon and iansjack!
Developing U365.
Source:
only testing: http://gitlab.com/bps-projs/U365/tree/testing
OSDev newbies can copy any code from my repositories, just leave a notice that this code was written by U365 development team, not by you.
Source:
only testing: http://gitlab.com/bps-projs/U365/tree/testing
OSDev newbies can copy any code from my repositories, just leave a notice that this code was written by U365 development team, not by you.