16-bit protected mode

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.
Post Reply
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

16-bit protected mode

Post by Love4Boobies »

Can anyone please tell me what exactly this 16-bit protected mode is? Please don't answer with something like "that sounds pointless" because I'm only asking out of curiosity... Intel docs don't say anything about this and I'm not even sure if it's something that 80286 CPUs had instead of the current 32-bit protected mode or a mode modern CPUs could still use (which would make sense, bause of compatibility issues). Any knowledge about this?
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
User avatar
lukem95
Member
Member
Posts: 536
Joined: Fri Aug 03, 2007 6:03 am
Location: Cambridge, UK

Post by lukem95 »

It's called unreal mode.

Its where your in PMODE, but the A20 gate has been enabled, so you have access to all 4gigs of memory space.

i think there should be a wiki article on it.
~ Lukem95 [ Cake ]
Release: 0.08b
Image
User avatar
inflater
Member
Member
Posts: 1309
Joined: Thu Sep 28, 2006 10:32 am
Location: Slovakia
Contact:

Post by inflater »

Well unreal mode is a switch to 32bit protected mode and back (once) using a special GDT. Thus, real mode no longer has the 64K segment limit. 16-bit protected mode is 16-bit protected mode, it's not unreal mode. In 16-bit protected mode you can address max. 16 MB of RAM (correct me if i'm wrong). For example Windows 2.0/286, Windows 3.0 and Windows 3.1 could run in 16-bit protected mode or real mode. And yes, pmode was in 80286 too, but slightly different from the 386 one. ;)

I can post you some example asm code in TASM for setting the 16bit pmode back and forth (there wasn't a method how to switch back to real mode on 80286. That's why games for 80286 weren't in pmode [but it wasn't a big deal, since 80286's had ~1 MB RAM installed] - but later, the function how to exit pmode has been "exploited" by Windows.)
My web site: http://inflater.wz.cz (Slovak)
Derrick operating system: http://derrick.xf.cz (Slovak and English :P)
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Post by pcmattman »

Unreal mode simply uses the CPU descriptor caches to allow access to the full 4 GB of RAM by entering PMode, loading a GDT, and setting descriptors so that the caches are updated.

16-bit protected mode is PMode with 16-bit instructions (correct me if I'm wrong).
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post by Combuster »

short answer:
pcmattman wrote:16-bit protected mode is PMode with 16-bit instructions (correct me if I'm wrong).
long answer:
The 286 was the first CPU to feature protected mode - you could put it in that mode, and have process isolation based on segmentation. Since the 286 didn't feature 32-bit registers, the only option was to use 16-bit code and registers. A new register was added, the machine status word, which held the bit to enter protected mode.

in the 386, all registers became 32-bit. They renamed the 32-bit version of the machine status word to cr0. Then they added paging and 32-bit code and new addressing modes on top of the 16-bit versions present.

The current intel manuals are pretty vague about what protected-mode features were present on the 286, and which ones were added on the 386 and later, so I don't have the details on the modifications made to the GDT and IDT to allow for this upgrade. Most likely, parts of the GDT are ignored since IIRC the 286 only had a 24-bit address bus (16MB), while the 386 featured the full 32 bits (4GB)

But yes, 286 protected mode code should still work. The consensus however is to stay away from that infant version of protected mode and either require a 386 or use real or unreal mode (which is a completely different thing, note that unreal mode doesn't exist on a 286 as well)
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Post Reply