Reputation: 285
I have some questions regarding how address translation happens in big real mode, as http://wiki.osdev.org/Unreal_Mode says
Unreal mode consist of breaking the '64Kb' limit of real mode segments, but still keeping 16 bits instruction and segment*16+offset address formation by tweaking the descriptor caches
But my question is how the gdt is used in the process or even is it used at all while translation to linear address. If anyone can point to some specification or some other reference for switching to big real mode it will be very helpful, also if someone can provide some insight regarding how to switch back to real mode it will be very good.
Regards,
Arka
Upvotes: 2
Views: 637
Reputation: 289
Yes, I'm pretty sure the GDT is used since you need to create it first. Wikipedia says:
To put an 80386 or higher microprocessor into unreal mode, a program must first enter protected mode, find or create a flat descriptor in the GDT or LDT, load some of the data segment registers with the respective protected mode "selector", and then switch back to real mode. After returning to real mode, the processor will continue using the cached descriptors as established in protected mode, thus allowing access to 4 GiB of "extended" memory from real mode.
Starting with the 80386, real mode programs can use the 32 bit registers with the Operand Size Override Prefix. This allows programs to use an address like DS:[EAX]. In normal real mode, a fault occurs if EAX exceeds 0xFFFF. In unreal mode, the access is allowed.
As a side note, the link you've provided should be good enough to get you into unreal mode. Technically, you can't go "back" into real mode, since unreal mode and real mode exist together. Probably the only major difference between them is their ability to address memory. If you want to "go back" to real mode, just address the memory as you normally would in real mode.
Basically, you just need to remember this to tell the difference:
In normal real mode, a fault occurs if EAX exceeds 0xFFFF. In unreal mode, the access is allowed.
I hope this helps!
Upvotes: 1