Hi to everyone,
this is my case. I have compiled a simple code to run at 0xC0100000
(3Gb+1Mb) and I put it at 0x100000 (1Mb).
Addresses of the data structures inside assembly are patched (eg. real
address of GDT is GDT-3Gb) all jumps are near (or short). Debug confirms
that everithing is ok with data references.
This little code starts within pmode with paging enabled and memory
identically mapped.
I set the vir-to-phys value (or the base adddress of the code/data segment
in the new GDT) to 0x40000000 (1Gb).
Reloading GDT and the new stack doesn't hurt but when jumping in the new
code segment I get a triple fault.
The strange thing is that, with provious GDT, I defined a test dataseg, and
writing to 0xc00b8000 works as expected putting a letter in the left corner
of the screen, but I can't use the dataseg of the new GDT.
I think error resides in paging structures, can somebody explain me how they
must be set? Addresses starting from 0x40000000 must be valid? Or they have
to be remapped to 0? Or whatever?
Thx for help,
Matteo
[long] Address translation
-
Chase
RE:[long] Address translation
Two probably dumb questions...
If you have memory identically mapped how does a write to data_selector:0xc00b8000 end up getting back to 0xb8000?
When you do your second lgdt you are using the real physical address of the new gdt right?
-Chase
If you have memory identically mapped how does a write to data_selector:0xc00b8000 end up getting back to 0xb8000?
When you do your second lgdt you are using the real physical address of the new gdt right?
-Chase
-
fallendreamer
RE:[long] Address translation
Take a look at Linux kernel: It 'belives' to be loaded at 0xc0000000 (3Gb). If you provide a segment base address of 0x40000000 (1Gb) when accessing a data at offset 0xc00b8000 the processor add this value to the base segment, so 1Gb+0xb8000+3Gb result in 4Gb+0xb8000. But addresses are generally 32 bytes long (4Gb addresses exceed this size) so 4gb+0xb8000 is truncated at the 32th bit resulting in 0xb8000. Try it, all you have to do is add one "strange" base segment on yor GDT.
Of course I'm using a real address, intel docs are clear!
Hope to be clear and simple,
Hi
Matteo
Of course I'm using a real address, intel docs are clear!
Hope to be clear and simple,
Hi
Matteo
-
Chase
RE:[long] Address translation
Ahhh, I misunderstood.
I thought you had some virtual address translation going on in the beginning. I can't say that I've ever had segements that crossed over the 4 gig real memory limit.
>> Addresses starting from 0x40000000 must be valid?
I *guessing* that you just need the first two megs identically mapped(plus your stack area). You shouldn't be able to virtualy map over 4 gigs with 4k pages since that would imply more then 1024 page tables so if that isn't working I'd guess there is something screwy with you second gdt.
Course it's just a guess, I'd be curious to know what you have to do to fix it once you figure it out.
-Chase
I thought you had some virtual address translation going on in the beginning. I can't say that I've ever had segements that crossed over the 4 gig real memory limit.
>> Addresses starting from 0x40000000 must be valid?
I *guessing* that you just need the first two megs identically mapped(plus your stack area). You shouldn't be able to virtualy map over 4 gigs with 4k pages since that would imply more then 1024 page tables so if that isn't working I'd guess there is something screwy with you second gdt.
Course it's just a guess, I'd be curious to know what you have to do to fix it once you figure it out.
-Chase