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.
When I clone a page directory and switch it, I either triple fault or page fault, though I've checked that that cloned directory has kernel pages present and linked properly.
Do you know the difference between linear and physical addresses, and you are using the right ones at the right place? What does bochs' debugger tell you about the exact page table mapping?
P.S. Where can I find the error codes for Protected Mode Exceptions?
Surely you RTFM'd before asking?
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
If you have already enabled paging before, there is no need to do it again when you change the page directory. So the following should do exactly the same:
Combuster wrote:Do you know the difference between linear and physical addresses, and you are using the right ones at the right place? What does bochs' debugger tell you about the exact page table mapping?
P.S. Where can I find the error codes for Protected Mode Exceptions?
Surely you RTFM'd before asking?
I'm sure, I'm using the right address.
Not quite in a good relationship with bochs since never used it - I use QEMU
Nessphoro wrote:I'm sure, I'm using the right address.
Earlier, Nessphoro wrote:I either triple fault or page fault
It is not the right address, your mind is playing tricks on you. It even coerced you into posting a contradiction
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Nessphoro wrote:And secondly it works because I already did switch to a page directory that is a clone of the kernel one, but I can't do that again.
And the page directory you switch to the second time is also a clone of the kernel page directory (so the first 2 MB are identity-mapped)? If you switch to a different page directory where the first 2 MB (and thus the virtual address where you are executing code, i.e., EIP) are not identity mapped, your code will run into nowhere, and thus cause a page fault or even triple fault.
What you posted so far is not a proof. Robbing the same place a second time when you got away with the first also has that tendency to not work.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Running into an issue where GRUB reloads(not triple F) on page init, IE when you flip that paging bit.
Im assigning the kernel directory as physical @ 1023.This is what you didnt mention.
Phys<> always VIRTUAL.
Mine maps @ 4gb unless I do this, no matter what.
By default I get 4GB address, not a 1mb one, mapped or not.(then grub reloads on paging init)
The page_init code can be in pascal, I put it where it is to test a theory, and in part for RING3, I WAS CORRECT. That code HAS to be where it is(but it needs page [1](in this case [1022]..) online or it GPFs with a overflow/div by zero error(DUH!). At least i GET to ring3...
The problem was far more deeper. I was cloning the directory far more early then was required to.
What "my" code does is mov value of cr0 register into a variable called cr0 (I know), then I OR the variable with 0x80000000 to set the bits I need to, and mov it back into cr0 register
P.S. Thats not C you silly, thats inline assembler
P.S.S I don't know Pascal but I read some of your ASM, and it's rather unorthodox, why don't you just push the Magic Number and Bootloader Info on stack?
And in your ISR code "ISRWithoutErrorCode 21 ; Unused- for DOS" - no it's not DOS uses Int 21h (0x21) = 33 decimal, but by all means if it makes sense to you - use it.
IRQ0 - adjust the timer to something more useful than 110ms intervals - but again if thats what you want.
And why do you have code for A20 line? I don't think you'll ever need to disable that - and GRUB enables it for you.
And where you enabled paging "; or eax,0x8000000 ;one too many zeroes??" that's actually one not enough, you need to set the bit 31 - last bit in a DWORD - it's the last( thirty second) one because we use zero-based index