Ask a question about ram in 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
leetow2003
Member
Member
Posts: 70
Joined: Fri Nov 19, 2010 6:54 pm

Ask a question about ram in protected-mode?

Post by leetow2003 »

In real-mode,video ram locates from 0xa0000
to 0xbffff,and bios rom locates from 0xc0000
to 0xfffff.I want to know in protected-mode,
if are video ram and bios rom occupied too?
video ram still display picture and text,
bios rom cannot be written too?
bigorenski
Posts: 14
Joined: Thu May 09, 2013 5:51 pm

Re: Ask a question about ram in protected-mode?

Post by bigorenski »

As far as I know, the memory map its the same in pmode or rmode. Unless you have paging.
User avatar
Nessphoro
Member
Member
Posts: 308
Joined: Sat Apr 30, 2011 12:50 am

Re: Ask a question about ram in protected-mode?

Post by Nessphoro »

Its at the same physical memory.
leetow2003
Member
Member
Posts: 70
Joined: Fri Nov 19, 2010 6:54 pm

Re: Ask a question about ram in protected-mode?

Post by leetow2003 »

bigorenski wrote:As far as I know, the memory map its the same in pmode or rmode. Unless you have paging.
If can the BIOS rom be written?
User avatar
iansjack
Member
Member
Posts: 4711
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Ask a question about ram in protected-mode?

Post by iansjack »

You can never write to the BIOS ROM. Read Only Memory.
leetow2003
Member
Member
Posts: 70
Joined: Fri Nov 19, 2010 6:54 pm

Re: Ask a question about ram in protected-mode?

Post by leetow2003 »

iansjack wrote:You can never write to the BIOS ROM. Read Only Memory.
You mean in protected-mode the memory from 0xc0000 to 0xfffff never be written?
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Ask a question about ram in protected-mode?

Post by Brendan »

Hi,
leetow2003 wrote:
iansjack wrote:You can never write to the BIOS ROM. Read Only Memory.
You mean in protected-mode the memory from 0xc0000 to 0xfffff never be written?
For modern-ish BIOS systems, the memory controller can be configured to send reads/writes in this area to either PCI or to RAM. Normally the firmware copies stuff into the area (e.g. the run-time part of the system ROM, the video card's ROM, etc) and then configures it so that writes go to PCI and reads come from RAM (which effectively makes it "write-only").

It's possible to reconfigure the memory controller so that both reads and writes go to RAM, and then reprogram the MTRRs so that the area uses write-back caching. This effectively makes it just like normal RAM. However:
  • the memory controller is either chipset specific or CPU specific, so you'd need different code for different chipsets/CPUs
  • you can't assume that the firmware's SMM code doesn't rely on things in the run-time part of the system ROM, and therefore must leave that "as is"
  • the remaining area (that is potentially safe to reconfigure as RAM) is only about 128 KiB; which is virtually nothing in modern systems (which have 2 GiB of RAM or more)
Mostly (for modern-ish BIOS systems), it's simply not worth the massive amount of hassle needed to support it (or test it properly) for all the different chipsets/CPUs.

For systems using UEFI, you can't make assumptions about what is using what. The area from 0x000C0000 to 0x000FFFFF may already be configured as usable RAM, might contain completely different things that you can't mess with, or (likely for "BIOS + UEFI hybrid" systems) might be configured by firmware the same as a legacy BIOS system.


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Post Reply