home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.os.development      Operating system development chatter      4,255 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 3,541 of 4,255   
   James Harris to All   
   Re: paging makes OS to reboot infinitely   
   04 Dec 22 21:43:24   
   
   From: james.harris.1@gmail.com   
      
   On 04/12/2022 12:48, אורי ויסבלום wrote:   
      
   > Hello, I'm writing an OS and I can't find my problem. The second i set the   
   CR0 paging bit, the system reboots itself, and goes to an infinite loop.   
      
   A lot can happen in a second. I'll assume you mean that no instructions   
   are executed after you set CR0.PG.   
      
   If in 32-bit mode do you have a page directory and the requisite initial   
   page tables set up (or the equivalent) and do they identity-map the code   
   location you are running at? Are they all marked Present and are all   
   their other bits correct?   
      
   In case of not-present or a protection fault or for debugging (see   
   below) have you got interrupts working and a handler for the paging   
   interrupt? Is the handler's interrupt gate fully correct?   
      
   Have you loaded CR3?   
      
   Do you follow MOV CR0 with a JMP?   
      
      
   > currently i dont care about page allocations, i'll write this part later,   
   for now i want a paging setup that works, even with only one page directory   
   entry.   
   > if you know what might cause this, please let me know.   
   > the kernel calls initPDT with some arbitrary number and goes to an infinite   
   loop.   
      
   IIRC once you enable paging (and execute a JMP) every CPU-controlled   
   memory access will go via paging, including access to the GDT and other   
   system tables.   
      
   You could set up a handler for the paging interrupt and write something   
   to the screen if it gets triggered. Remember to have all memory you use   
   mapped with Present PTEs and Present PDEs.   
      
   I notice you are using inline asm. Some do. But linking a separate asm   
   file can be easier to work with.   
      
      
   --   
   James Harris   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca