x86 real mode - memory addressing

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.
a5498828
Member
Member
Posts: 99
Joined: Thu Aug 12, 2010 7:25 am

Re: x86 real mode - memory addressing

Post 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? :shock: :shock:
Tosi
Member
Member
Posts: 255
Joined: Tue Jun 15, 2010 9:27 am
Location: Flyover State, United States
Contact:

Re: x86 real mode - memory addressing

Post 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.
a5498828
Member
Member
Posts: 99
Joined: Thu Aug 12, 2010 7:25 am

Re: x86 real mode - memory addressing

Post by a5498828 »

ok i get it.
but what heppens when i TRY to use 0x67 on 80286+? Cpu will cach fire?
a5498828
Member
Member
Posts: 99
Joined: Thu Aug 12, 2010 7:25 am

Re: x86 real mode - memory addressing

Post 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.
Gigasoft
Member
Member
Posts: 856
Joined: Sat Nov 21, 2009 5:11 pm

Re: x86 real mode - memory addressing

Post 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).
a5498828
Member
Member
Posts: 99
Joined: Thu Aug 12, 2010 7:25 am

Re: x86 real mode - memory addressing

Post 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.
a5498828
Member
Member
Posts: 99
Joined: Thu Aug 12, 2010 7:25 am

Re: x86 real mode - memory addressing

Post 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.
Post Reply