Dan Cross wrote:   
   > In article <34818e6d-23a5-4c02-a6ef-6dfeaaf1ce3fn@googlegroups.com>,   
   > ? ? ??? ? ? ??? ? ? ? wrote:   
   > >First of all, thank you all for replying, I really appreciate it.   
   > >   
   > >James:   
   > >> 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?   
   > >   
   > >Yes, I mean no instructions are happening after I set CR0. Didn't know it   
   needs to JMP to a new line of code after it, I thought the jump at   
   > >the end of the scope of the function is enough, but it makes a lot of sense   
   I should identity-map the kernel's code into virtual mode. But I   
   > >reckon it's not my only problem there.   
   >   
   > This is for x86, but the same principle applies generally: once   
   > you turn on paging by setting the PG bit in %cr0, the next   
   > instruction must necessarily come from an address that is mapped   
   > in the address space described by the page tables that you are   
   > pointing to in %cr3. There is no jumping around permitted; the   
   > next instruction is either mapped or you get a page fault.   
   >   
   > Perhaps you were thinking of a long-jump between segments?   
   > Once you're turning on 32-bit paging, that's not generally at   
   > play anymore.   
      
   386 is special here: one have to jump to make sure that processor   
   view of state of the world is consistent. And yes, page tables   
   have to be correctly set up with 1-1 mapping of currently   
   executing code.   
      
   --   
    Waldek Hebisch   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|