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.
I'm making an OS. and I made the code that enables paging.
before enabling paging, it initilizes page directory and page table
I cannot found what wrong is/
below is my paging source code.(sorry, the annotations are korean..)
Run your code under a debugger. Set a breakpoint just before you enable paging and check your page tables to see that they contain what you think they should. You should also check your GDT and IDT to see that they look reasonable. Also set breakpoints at the start of your handlers for page fault exceptions and GPF exceptions. That way you can tell the nature of the initial fault and, if it is a page fault, the address causing that fault.
With that information at you disposal it should be easy to review your code to see where the error lies.
int init_image_area()
{
//이미지 크기를 불러온 후에 이미지 만큼의 크기는 실제 물리 공간에 연결
//0~5M 4kb까지 연결 5M 4KB / 4KB - 1 을 인덱스로 해서 매핑
for(int i, addr = 0; i < 1280; i++){ //1024*1024(Image & Stack) + 4096(pgd) + 4096*1024(pmd) - 1 = 1280
mmap(addr, addr, 3);
addr+=4096;
}
return 1;
}
You didn't initialise the variable i
If a trainstation is where trains stop, what is a workstation ?
iansjack wrote:Run your code under a debugger. Set a breakpoint just before you enable paging and check your page tables to see that they contain what you think they should. You should also check your GDT and IDT to see that they look reasonable. Also set breakpoints at the start of your handlers for page fault exceptions and GPF exceptions. That way you can tell the nature of the initial fault and, if it is a page fault, the address causing that fault.
With that information at you disposal it should be easy to review your code to see where the error lies.
int init_image_area()
{
//이미지 크기를 불러온 후에 이미지 만큼의 크기는 실제 물리 공간에 연결
//0~5M 4kb까지 연결 5M 4KB / 4KB - 1 을 인덱스로 해서 매핑
for(int i, addr = 0; i < 1280; i++){ //1024*1024(Image & Stack) + 4096(pgd) + 4096*1024(pmd) - 1 = 1280
mmap(addr, addr, 3);
addr+=4096;
}
return 1;
}