hi-memory access in real-mode
hi-memory access in real-mode
Dear All;
How do I R/W memory above 16M before switching to protected mode? TIA.
How do I R/W memory above 16M before switching to protected mode? TIA.
Re: hi-memory access in real-mode
In general, you can't.Boba wrote:How do I R/W memory above 16M before switching to protected mode? TIA.
A workaround is Unreal_Mode, which you switched into protected mode first, apply changes to selectors and switch back to real mode.
You can then access the 32-bit address space with a32 prefix and 32-bit registers, until the segment register get reset.
See the wiki for detail and its limitations.
Re: hi-memory access in real-mode
thank you guys. so you're saying bioses (during post) run the memory test in 32-bit mode.
right?
right?
Re: hi-memory access in real-mode
Why do you care how bios do it? How BIOS actually do it is implementation specific.
btw memory tests may be assisted with special hardware function, it's not likely to be a bunch of 32-bit MOVs or TESTs.
btw memory tests may be assisted with special hardware function, it's not likely to be a bunch of 32-bit MOVs or TESTs.
Re: hi-memory access in real-mode
all it tells me it's doable. i thought i could do it as well with no 16/32 switching.
'unreal mode' is something new to me. i'm currently playing with it...
'unreal mode' is something new to me. i'm currently playing with it...
Re: hi-memory access in real-mode
If you're in 16-bit mode you might as well use the BIOS interrupts to get memory. Or if you're going to probe, wait until you are in protected mode. No need to make it harder on yourself then it already is.
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: hi-memory access in real-mode
Given that all non-16-bit x86 implementations that I'm aware of implement descriptor caches, I use unreal mode in my boot loader on systems with BIOS-type firmware. It's not more difficult---on the contrary, you get a 4 GiB address space and are able to use the BIOS interrupt handlers. That means no more switching back and forth.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]
Re: hi-memory access in real-mode
that's what i wish i could do, but my knowledge is limited by 16M (int15.87 to be exact).bubach wrote:If you're in 16-bit mode you might as well use the BIOS interrupts to get memory...
when you say 'interrupts' - what do you mean?
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: hi-memory access in real-mode
There are many ways to detect memory; your primary tool being INT 15h, EAX = E820h (BIOS) or GetMemoryMap() (EFI/UEFI), as defined by ACPI. For very old systems where this method is not supported, you may wish to fall back to on one or more of the other methods. Clicky for the wiki!
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]
Re: hi-memory access in real-mode
Hi,
Regards,
Shikhin!
If the BIOS interrupt handlers, say, reload the segment registers (and you can't be sure that they don't), then wouldn't you need to switch back to unreal mode? I find that to be as bad as constantly switching between real and protected mode.Love4Boobies wrote:... implement descriptor caches, I use unreal mode in my boot loader on systems with BIOS-type firmware. It's not more difficult---on the contrary, you get a 4 GiB address space and are able to use the BIOS interrupt handlers. That means no more switching back and forth.
Regards,
Shikhin!
Re: hi-memory access in real-mode
not sure i'm in line with you: are you using 'unreal mode' in your 'non-16-bit' code?Love4Boobies wrote:Given that all non-16-bit x86 implementations ... implement descriptor caches, I use unreal mode ...
i need to access the upper memory before the pm kicks in. to me, 'non-16-bit' means 32-bit
protected mode. although my target range is very narrow, i'd like to avoid the 'implementation
specific' approach as mentioned by bluemoon.
related to this, i wonder if dos hi-memory drivers (and 32-bit extenders) use pm?
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: hi-memory access in real-mode
I dobut there are many implementations that do that, as much boot loader code relies on this technique; other than that, there would be little reason for the BIOS to do anything of that nature. If you want to play it somewhat safer, only use FS or GS. Either way, if this problem even exists in the real world, it's very uncommon.Shikhin wrote:Hi,
If the BIOS interrupt handlers, say, reload the segment registers (and you can't be sure that they don't), then wouldn't you need to switch back to unreal mode? I find that to be as bad as constantly switching between real and protected mode.Love4Boobies wrote:... implement descriptor caches, I use unreal mode in my boot loader on systems with BIOS-type firmware. It's not more difficult---on the contrary, you get a 4 GiB address space and are able to use the BIOS interrupt handlers. That means no more switching back and forth.
You misunderstand; a non-16-bit x86 implementation is any 32/64-bit x86 CPU (i.e., 80386 or later).Boba wrote:not sure i'm in line with you: are you using 'unreal mode' in your 'non-16-bit' code?Love4Boobies wrote:Given that all non-16-bit x86 implementations ... implement descriptor caches, I use unreal mode ...
i need to access the upper memory before the pm kicks in. to me, 'non-16-bit' means 32-bit
protected mode. although my target range is very narrow, i'd like to avoid the 'implementation
specific' approach as mentioned by bluemoon.
related to this, i wonder if dos hi-memory drivers (and 32-bit extenders) use pm?
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]
Re: hi-memory access in real-mode
... and after detecting it, how do i access it beyond 16M before going 32-bit?Love4Boobies wrote:There are many ways to detect memory; your primary tool being INT 15h, EAX = E820h (BIOS)...
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: hi-memory access in real-mode
You've already been answered: by switching to unreal mode.Boba wrote:... and after detecting it, how do i access it beyond 16M before going 32-bit?Love4Boobies wrote:There are many ways to detect memory; your primary tool being INT 15h, EAX = E820h (BIOS)...
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]