37 votes

How does the ‘real mode flat model’ work?

I’m assuming you’re asking about x86 processors, not the older 8-bit CPUs. Real mode is always segmented, and everything (CPU, operating system, programs, even peripherals on the CPU bus) has access ...
Stephen Kitt's user avatar
35 votes
Accepted

How much slower was the 286 in protected mode?

Basically, anything that involves changing segments is slower, sometimes significantly so; this is unsurprising since descriptors have to be checked, privilege levels potentially changed etc. Other ...
Stephen Kitt's user avatar
29 votes

80286 can switch from real mode to protected mode - but why not back?

My guess is that it was merely a design decision based upon the assumption that once a protected mode OS is started, there is no need to go back. Most microprocessors at that time already booted in ...
mcleod_ideafix's user avatar
28 votes
Accepted

How can a 32-bit x86 CPU start with reset vector 0xFFFFFFF0 even though it starts in 16-bit real mode?

When x86 boots, it's not strictly in classic real mode, it's in "unreal" mode, with CS.base = 0xFFFF0000 and CS.limit = 64K. On 286 and later, memory addressing doesn't use the segment ...
Peter Cordes's user avatar
  • 2,905
26 votes
Accepted

80286 can switch from real mode to protected mode - but why not back?

This was intentional so that the CPU would support secure operating systems. In a secure operating system with rigorous memory access protections you could not allow any software - user or kernel ...
davidbak's user avatar
  • 5,877
24 votes
Accepted

How can a protected-mode Watcom C program access memory that a real-mode interrupt service returned in a segment:offset register pair?

In OpenWatcom, which was used in the example given in the question, the intr function performs transparent translation between segment values and protected-mode selectors, presumably using DPMI ...
user3840170's user avatar
20 votes
Accepted

Are .COM executable binaries real mode or protected mode?

DOS programs always start in real mode (or an emulation thereof), so it’s best to start disassembling them assuming that. When disassembling, you should assume real mode, with 16-bit data and 16-bit ...
Stephen Kitt's user avatar
16 votes

How can a 32-bit x86 CPU start with reset vector 0xFFFFFFF0 even though it starts in 16-bit real mode?

To understand this, you need to understand the basics of segment:offset addressing in protected mode: the segment value points to a descriptor, which contains a base address, segment limit and various ...
Stephen Kitt's user avatar
10 votes

How can a protected-mode Watcom C program access memory that a real-mode interrupt service returned in a segment:offset register pair?

I've accepted user3840170's answer as it solved my issue but I want to add a second answer that contains just the concepts that I lacked in order to solve my problem: The far keyword is still ...
knol's user avatar
  • 11.3k
9 votes

How does the ‘real mode flat model’ work?

All software sees the full 20bit address space, since there is no distinction between kernel and user land. Flat mode is simply all segment descriptors set to maximum length and base offset 0. This ...
tuomas's user avatar
  • 2,393
8 votes

How can a 32-bit x86 CPU start with reset vector 0xFFFFFFF0 even though it starts in 16-bit real mode?

In short, yes the 386 will boot from 0xFFFFFFF0 address mentioned in real mode, because CS selector base is set to 0xFFFF0000 and IP will be 0x0000FFF0. The value of the CS register itself is ...
Justme's user avatar
  • 27k
7 votes

80286 can switch from real mode to protected mode - but why not back?

Just speculating here, but it might have been a product decision to encourage writing code for protected mode. It's also possible it was a combination of technical difficulties and product priorities. ...
Rico Pajarola's user avatar
7 votes

Are .COM executable binaries real mode or protected mode?

com files are not segmented (its just single segment). They have limitation that it can not cross 64K of code (filesize). They always starts in real mode but I do not think there is any restriction to ...
Spektre's user avatar
  • 7,152
6 votes
Accepted

8086 assembly relative addressing issue

As explained in Justme’s answer, there’s nothing inherently wrong with your code, and building a .COM file with nasm -fbin -oloop.com loop.asm produces a 29-byte file which works fine. However there ...
Stephen Kitt's user avatar
4 votes

8086 assembly relative addressing issue

There is nothing inherently wrong in the source code. Most likely explanation is that the NASM compiler was not told to output the binary in COM format and the memory offset of the variable which ...
Justme's user avatar
  • 27k
2 votes

How does the ‘real mode flat model’ work?

I've not heard the phrase "real mode flat model", but it may be referring to the fact that real mode allows a memory manager to manage memory as a linear sequence of 65,536 16-byte paragraphs (of ...
supercat's user avatar
  • 34.2k
2 votes

How does the ‘real mode flat model’ work?

There's one other legacy mode. On a 286, Windows 3.1 (possibly Windows 3.0), has a 286 protected mode, where GlobalAlloc() and GlobalLock() are used to allocate and lock a large amount of memory ...
rcgldr's user avatar
  • 601
1 vote

How can a 32-bit x86 CPU start with reset vector 0xFFFFFFF0 even though it starts in 16-bit real mode?

I'm putting this in as a separate answer since some people might disagree with my logic and it will give them a chance to downvote me. If you're interested and have the time, I think you'll find https:...
Mark Morgan Lloyd's user avatar
1 vote

How does the ‘real mode flat model’ work?

"Flat model" is simply unsegmented linear address space (3.2.1). https://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-vol-3a-part-1-manual.pdf ...
roentgen's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible