delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/02/21/21:59:39

Date: Tue, 22 Feb 2000 07:44:38 +0500 (MVT)
From: Prashant TR <prashant_tr AT yahoo DOT com>
X-Sender: prashant_tr AT midpec DOT com
To: djgpp AT delorie DOT com
Subject: Re: real mode & protected mode
Message-ID: <Pine.LNX.4.10.10002220744110.1405-100000@midpec.com>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com

On Mon, 21 Feb 2000, Kalum Somaratna aka Grendel wrote:

> On Fri, 18 Feb 2000, Prashant TR wrote:
> 
> So by manipulating the descriptor
> cache base registers it is possible to access the entire address space
> _wihtout_ switching to protected mode. That means that you can acess
> memory above 1 MB while in real mode!

There are much simpler ways tp access 4GB in real mode. The loadall
instruction has all kinds of crazy fields and it's definitely not worth
the trouble. With a small trick, you *can* get to access 4GB in real mode
using a 16-bit program. But running 32-bit programs with loadall is not
possible AFAIK. You'll still need to set the CR0 value in the pointer to
the tables. Accessing 4GB is *one* of the things a 32-bit program can do.
It's not really a difference b/w a 16-bit and 32-bit programs. It's not
really a difference.

> Actually the loadall insn was used extensively by 286 system programmers
> because unlike the 386 the only way that the 286 could be switched back
> into real mode was by resetting the CPU.

Resetting the CPU... (read below).

> ( a typical "mode switch" for a
> 286 would be switch to protected mode, access the memory, save the cpu
> state to the CMOS,then reset the cpu to come back to real mode).

The 286 and 386 have LMSW that can switch to real or protected mode. The
switch took place by setting some flags in the CMOS and some
manipulations which was really slow.


> So to avoid this timeconsuming mode switch 286 programmers used the
> 286 loadall insn to access >1MB memory.

Not ordinary programs. The BIOSes manily used this. Since the BIOS has to
do lots of hard work before you can actually work on your system, this
seemed like a short cut to them.

> The 386 loadall insn is present on the 386's but INTEL removed it from the
> 486 because of security resons (you can see why!)

Yes. Presently using it gives exception 6.


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019