linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* how to tell linux (on x86) to ignore 1M or memory
@ 2007-04-19 14:18 Bart Trojanowski
  2007-04-19 14:30 ` Paolo Ornati
  2007-04-20 19:01 ` Rene Herman
  0 siblings, 2 replies; 8+ messages in thread
From: Bart Trojanowski @ 2007-04-19 14:18 UTC (permalink / raw)
  To: linux-kernel

I need to preserve some state from the bios before entering protected
mode.  For now I want to copy it into some ram accessible by real-mode,
say the last megabyte visible in real-mode.

What's the easiest way to have linux ignore the megabyte starting at 15M?

Cheers,
-Bart

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: how to tell linux (on x86) to ignore 1M or memory
  2007-04-19 14:18 how to tell linux (on x86) to ignore 1M or memory Bart Trojanowski
@ 2007-04-19 14:30 ` Paolo Ornati
  2007-04-20 19:01 ` Rene Herman
  1 sibling, 0 replies; 8+ messages in thread
From: Paolo Ornati @ 2007-04-19 14:30 UTC (permalink / raw)
  To: Bart Trojanowski; +Cc: linux-kernel

On Thu, 19 Apr 2007 10:18:04 -0400
Bart Trojanowski <bart@jukie.net> wrote:

> I need to preserve some state from the bios before entering protected
> mode.  For now I want to copy it into some ram accessible by real-mode,
> say the last megabyte visible in real-mode.
> 
> What's the easiest way to have linux ignore the megabyte starting at 15M?
> 

Documentation/kernel-parameters.txt:

        memmap=nn[KMG]$ss[KMG]
                        [KNL,ACPI] Mark specific memory as reserved.
                        Region of memory to be used, from ss to ss+nn.


So adding this to kernel boot parameters should do the trick:

	memmap=15M$1M

-- 
	Paolo Ornati
	Linux 2.6.21-rc7-CFS-v3-g6262cd9f on x86_64

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: how to tell linux (on x86) to ignore 1M or memory
  2007-04-19 14:18 how to tell linux (on x86) to ignore 1M or memory Bart Trojanowski
  2007-04-19 14:30 ` Paolo Ornati
@ 2007-04-20 19:01 ` Rene Herman
  2007-06-22  1:46   ` H. Peter Anvin
  1 sibling, 1 reply; 8+ messages in thread
From: Rene Herman @ 2007-04-20 19:01 UTC (permalink / raw)
  To: Bart Trojanowski; +Cc: linux-kernel

On 04/19/2007 04:18 PM, Bart Trojanowski wrote:

> I need to preserve some state from the bios before entering protected 
> mode.  For now I want to copy it into some ram accessible by real-mode, 
> say the last megabyte visible in real-mode.
> 
> What's the easiest way to have linux ignore the megabyte starting at 15M?

Note that real-mode can only access the first megabyte (*) and not the first 
16. 16MB is the 16-bit protected mode (286) limit.

(*) well, the first 1M + 64K - 16 bytes using segment FFFF assuming A20 is 
enabled and x > 1 in x86...

Rene.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: how to tell linux (on x86) to ignore 1M or memory
  2007-04-20 19:01 ` Rene Herman
@ 2007-06-22  1:46   ` H. Peter Anvin
  2007-06-22 13:16     ` Rene Herman
  0 siblings, 1 reply; 8+ messages in thread
From: H. Peter Anvin @ 2007-06-22  1:46 UTC (permalink / raw)
  To: Rene Herman; +Cc: Bart Trojanowski, linux-kernel

Rene Herman wrote:
> On 04/19/2007 04:18 PM, Bart Trojanowski wrote:
> 
>> I need to preserve some state from the bios before entering protected
>> mode.  For now I want to copy it into some ram accessible by
>> real-mode, say the last megabyte visible in real-mode.
>>
>> What's the easiest way to have linux ignore the megabyte starting at 15M?
> 
> Note that real-mode can only access the first megabyte (*) and not the
> first 16. 16MB is the 16-bit protected mode (286) limit.
> 

No, 16-bit protected mode (on 386+) is not limited to 16 MB.

The main reason there is a 16 MB limit in some current systems is that
ISA, and the ISA DMA controller only had 24 address lines.

	-hpa

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: how to tell linux (on x86) to ignore 1M or memory
  2007-06-22  1:46   ` H. Peter Anvin
@ 2007-06-22 13:16     ` Rene Herman
  0 siblings, 0 replies; 8+ messages in thread
From: Rene Herman @ 2007-06-22 13:16 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: Bart Trojanowski, linux-kernel

On 06/22/2007 03:46 AM, H. Peter Anvin wrote:

> Rene Herman wrote:
>> On 04/19/2007 04:18 PM, Bart Trojanowski wrote:
>>
>>> I need to preserve some state from the bios before entering protected
>>> mode.  For now I want to copy it into some ram accessible by
>>> real-mode, say the last megabyte visible in real-mode.
>>>
>>> What's the easiest way to have linux ignore the megabyte starting at 15M?
>> Note that real-mode can only access the first megabyte (*) and not the
>> first 16. 16MB is the 16-bit protected mode (286) limit.
>>
> 
> No, 16-bit protected mode (on 386+) is not limited to 16 MB.

That all depends on one's definition of 16-bit protected mode. The "(286)" 
after mine meant I was talking about the definition in which descriptors 
have a 24-bit base (and 16-bit limit) field -- ie, real 286 and arguably, 
"real 16-bit protected mode".

Yes, I guess another valid definition is "code with a 16-bit address and 
operand size default" on a 386+ and sure, that's just flipping a bit away.
In the context of Linux I agree it's also a sensible definition, so, well, 
whatever. The point was that real mode could only access the first 1M, not 
the first 16... :-)

Rene.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: how to tell linux (on x86) to ignore 1M or memory
  2007-06-22 23:00       ` Bodo Eggert
@ 2007-06-22 23:04         ` Rene Herman
  0 siblings, 0 replies; 8+ messages in thread
From: Rene Herman @ 2007-06-22 23:04 UTC (permalink / raw)
  To: 7eggert; +Cc: H. Peter Anvin, Bart Trojanowski, linux-kernel

On 06/23/2007 01:00 AM, Bodo Eggert wrote:

> The real mode on i386+ can actually access the whole 4GB address range
> due to a former-bug-now-feature in the i386+.

Generally called "unreal mode". Yes, sure. Just a hack though.

Rene.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: how to tell linux (on x86) to ignore 1M or memory
       [not found]     ` <8yRnb-4XE-23@gated-at.bofh.it>
@ 2007-06-22 23:00       ` Bodo Eggert
  2007-06-22 23:04         ` Rene Herman
  0 siblings, 1 reply; 8+ messages in thread
From: Bodo Eggert @ 2007-06-22 23:00 UTC (permalink / raw)
  To: Rene Herman, H. Peter Anvin, Bart Trojanowski, linux-kernel

Rene Herman <rene.herman@gmail.com> wrote:

> The point was that real mode could only access the first 1M, not
> the first 16... :-)

The real mode on i386+ can actually access the whole 4GB address range due to
a former-bug-now-feature in the i386+. This "bug" causes the segment limit
to not be reset on return to real mode, but only on subsequent assigns to
the segment registers/selectors. Using a rarely used segment register like
GS, you could use extended memory in your program.

Obviously this needs 1) Entering and returning from protected mode, 2) all
programs to agree not to clobber GS and 3) not using v86 mode (EMM386.exe).
Therefore and because it was discovered in the late days of DOS it was not
in widespread use. Some DOS extenders were reported to use it ...

http://www.programmersheaven.com/mb/x86_asm/344953/344953/readmessage.aspx
-- 
The programmer's National Anthem is 'AAAAAAAAHHHHHHHH' 

Friß, Spammer: vO9EZegbA@hBtpA.7eggert.dyndns.org
 maFsnwE@Fvznj.7eggert.dyndns.org mhF-@PoxRjk.7eggert.dyndns.org

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: how to tell linux (on x86) to ignore 1M or memory
       [not found] ` <8c6EE-4Jj-5@gated-at.bofh.it>
@ 2007-04-20 21:39   ` Bodo Eggert
       [not found]   ` <8yGrK-4vX-7@gated-at.bofh.it>
  1 sibling, 0 replies; 8+ messages in thread
From: Bodo Eggert @ 2007-04-20 21:39 UTC (permalink / raw)
  To: Rene Herman, Dave Jones, Neil Brown, Andrew Morton,
	Kyle McMartin, linux-kernel, alan, bcollins, pjones

Rene Herman <rene.herman@gmail.com> wrote:
> On 04/19/2007 04:18 PM, Bart Trojanowski wrote:

>> I need to preserve some state from the bios before entering protected
>> mode.  For now I want to copy it into some ram accessible by real-mode,
>> say the last megabyte visible in real-mode.
>> 
>> What's the easiest way to have linux ignore the megabyte starting at 15M?
> 
> Note that real-mode can only access the first megabyte (*) and not the first
> 16. 16MB is the 16-bit protected mode (286) limit.
> 
> (*) well, the first 1M + 64K - 16 bytes using segment FFFF assuming A20 is
> enabled and x > 1 in x86...

Interrupt 15h, function 87h allows copying from/to extended memory.
You might like to look into Ralph Brown's interrupt list for more details.

You could also cpio-gzip the data and append it to the initramfs.
-- 
Fun things to slip into your budget
Does that line item say 'Personal Massage System' Oops, it's supposed to be
'Message'. Go ahead and sign the authorization, Boss; I'll correct it later.
(Iike Hell I will)

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-06-22 23:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-19 14:18 how to tell linux (on x86) to ignore 1M or memory Bart Trojanowski
2007-04-19 14:30 ` Paolo Ornati
2007-04-20 19:01 ` Rene Herman
2007-06-22  1:46   ` H. Peter Anvin
2007-06-22 13:16     ` Rene Herman
     [not found] <8bFEz-3B4-39@gated-at.bofh.it>
     [not found] ` <8c6EE-4Jj-5@gated-at.bofh.it>
2007-04-20 21:39   ` Bodo Eggert
     [not found]   ` <8yGrK-4vX-7@gated-at.bofh.it>
     [not found]     ` <8yRnb-4XE-23@gated-at.bofh.it>
2007-06-22 23:00       ` Bodo Eggert
2007-06-22 23:04         ` Rene Herman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).