Page 3 of 3

Re:Maybe a Stupid Question

Posted: Thu Feb 17, 2005 4:30 am
by distantvoices
you should use the virtual address. :-)

Where in virtual address space have you mapped your kernel? from 0xc0000000 or somewhere different? Identity mapped?

Re:Maybe a Stupid Question

Posted: Thu Feb 17, 2005 4:39 am
by ich_will
identy mapped

it is loaded at 0x10000 by bochs (I think bochs doesn't enable paging)

Re:Maybe a Stupid Question

Posted: Thu Feb 17, 2005 4:47 am
by Pype.Clicker
ich_will wrote: f.e. if the page with the virtual_address 0x617000 is set (page-index 1559):

from_addr + i*4096 is 0xC30000
0x617000 + 1559*4096 --> 0xC30000 (you shouldn't use this address for invlpg, i think)
I may have misunderstood your use of 'i' ...

Let's say you want to clear pages from 0x617000 to 0x619000, you need to call (among other things) the following sequence.

Code: Select all

   _invlpg(0x617000);
   _invlpg(0x618000);
   _invlpg(0x619000);
CLR_12_BITS(...) == 0x617000 *only* because you have 1:1 mapping for that region, but it won't work any longer after this ...

(checking my own code for a hopefully correct nasm-like "invlpg" ...)

Re:Maybe a Stupid Question

Posted: Thu Feb 17, 2005 4:53 am
by ich_will
thx, i'll try

Re:Maybe a Stupid Question

Posted: Thu Feb 17, 2005 5:02 am
by ich_will
AAAAAAARRRRGGGGGH, I found the mistake, all the paging things seems to work fine, but I've never tried to write to one page (I've played to much with the loop code):

Code: Select all

for(i = 0; i > 4096; i++)
    { *((char*)(0x617000 + i)) = '1'; }
do this i > 4096, i will never be bigger than 4096 if it starts by zero.

Thanks alot, first the mistake was the not existing invlpg call.

Now all works. F***.
It's better if you can read.