I decided to get my kernel to the higher half of a memory. Everything went good with using a bit modified Higher_Half_bare_bones example. The only thing that suprised me was that I wasn't able to perform operations on video memory without adding 3 GB to it's address (while tutorial says that lower 4 MB are identity-mapped). However, never mind it.
The real problem is: I set up GDT, IDT and I want to set up my own paging (replacing boot page directory). As I decided to use 4 KB paging, it seemed obvious that I need to disable 4 MB pages in CR4 register. So I did:
Code: Select all
asm volatile(
"mov %%cr4, %%eax \n\t"
"xor $0x00000010, %%eax \n\t"
"mov %%eax, %%cr4 \n\t"
:::);
Code: Select all
asm volatile("mov %0, %%cr3 \n\t": : "r" (a));
Unfortunately, it didn't work. Bosch fires an exception 14 on next instruction performed after leaving first ASM block - the one where a is copied to some register. I also tried putting these instructions in one block, didn't work as well.
So, the problem is: how to go from 4 MB to 4 KB paging and change page directory.
If you wish, I may send my paging and memory allocation unit, but I think it isn't necessary for now.
Thank's for your time .