Page 2 of 2
Re: x86 real mode - memory addressing
Posted: Sat Feb 26, 2011 4:02 pm
by a5498828
berkus wrote:In real 16 bits mode segment offset can never exceed 0xffff, hence the segment limit is always fixed at this value.
The way Intel implemented real mode works using the same gdt registers format as in pmode, so loading a segment register with GDT entry will cache it internally in CPU - and these values will be reused until you reload this register again, even if you switch pmode->rmode.
What will happen if i use 0x67 in non unreal mode?
It wont be ignored, so real mode know it exist. Real mode wont throw GPF. 8086 has gdt?
Re: x86 real mode - memory addressing
Posted: Sat Feb 26, 2011 4:11 pm
by Tosi
No, the 8086 has no GDT. There is no protected mode, so there is no unreal mode, which means there is no way of having an address space greater than that allowed by real mode segmentation.
Re: x86 real mode - memory addressing
Posted: Sat Feb 26, 2011 4:19 pm
by a5498828
ok i get it.
but what heppens when i TRY to use 0x67 on 80286+? Cpu will cach fire?
Re: x86 real mode - memory addressing
Posted: Sat Feb 26, 2011 8:06 pm
by a5498828
So unreal mode is just an convenience, so i can setup default operand/address size. But accessing memory above HMA doesnt work on bochs. I wont test it on real hardware because there is no sense, as i would now konw what happend. Will i get an exception? Will i go through normal extended memory? Or cpu will reset. I do not know.
//just checked. works as expected. No exception 13, no nothing. Its even overflowing from 0xffffffff to 0.
So why bother with unreal mode? And when exception 13 is triggered? of course real mode 13.
I have a last question here, when i have < 3gb memory and try to write on unmapped address, what happens? I assume that unmapped might be any address, not the highest one.
Re: x86 real mode - memory addressing
Posted: Sun Feb 27, 2011 7:13 am
by Gigasoft
What limit, wtf. limit = protected mode.
No, limits are checked in real mode as well. Limits are only disabled in 64-bit mode.
but what heppens when i TRY to use 0x67 on 80286+? Cpu will cach fire?
There is no 66h/67h prefix on the 80286. It will generate an invalid opcode exception. It was introduced with the 80386.
I have a last question here, when i have < 3gb memory and try to write on unmapped address, what happens?
Nothing happens at all.
In real 16 bits mode segment offset can never exceed 0xffff, hence the segment limit is always fixed at this value.
In
virtual 8086 mode, the segment limits are all fixed at 0xffff. However, in real-address mode, they retain their last setting (but are initialized to 0xffff on reset).
Re: x86 real mode - memory addressing
Posted: Sun Feb 27, 2011 12:04 pm
by a5498828
I belive my bios is booting me in unreal mode. Ive tested it, and i can assume it has already expanded limits. If i lower them, it works as expected.
Re: x86 real mode - memory addressing
Posted: Sun Feb 27, 2011 1:03 pm
by a5498828
yes there is a limit in real mode.
exception 12 and 13 are for it.
80268 was the 1st cpu to make limits, previous masked address.
so limit exists only if cpu support pmode. and default is ffff.