Page 1 of 1

How can I remap the physical memory

Posted: Sat May 19, 2012 9:23 am
by LindusSystem
I recieve the memory map from my bootloader.I have purposely installed a RAM in slot 0 and slot 2.I want to remap the memory (RAM) so that I can use the Solt 2 RAM as Slot 1 and remove the holes between Slot 0 and 2.

Is there any way for this?

Re: How can I remap the physical memory

Posted: Sat May 19, 2012 9:37 am
by NickJohnson
First off, you should be able to handle situations when the free memory is not contiguous. Second, I'm pretty sure that on all reasonable systems, the memory controller will make any sticks of RAM you put in contiguous in the physical address space, regardless of their physical position (assuming the memory controller is okay with you not pairing sticks in the first place.)

Re: How can I remap the physical memory

Posted: Sat May 19, 2012 9:39 am
by Nable
Chipset (memory controller, to be precise) maps physical memory to physical addresses. So, you need documentation for all chipsets you want to support. In most cases it's not public.
In recent CPUs memory controller is integrated into CPU so it's easier to obtain its documentation, although this manuals are always huge and rather difficult to understand. So, think twice before deciding to use physical memory remapping.
Really, why do you need it? If you use protected/long mode, the code will use virtual addresses and it's rather easy to map non-contiguos physical memory into contiguos virtual memory region.

Re: How can I remap the physical memory

Posted: Sat May 19, 2012 9:40 am
by LindusSystem
When I probed memory, I get holes after the last byte of the RAM at solt 0, I thought that hole is becaz of the RAM Positions.
What are those holes?Am I wrong that it is because of the RAM position?

Re: How can I remap the physical memory

Posted: Sat May 19, 2012 9:49 am
by Brendan
Hi,
LindusSystem wrote:I recieve the memory map from my bootloader.I have purposely installed a RAM in slot 0 and slot 2.I want to remap the memory (RAM) so that I can use the Solt 2 RAM as Slot 1 and remove the holes between Slot 0 and 2.

Is there any way for this?
My guess is that the hole you're talking about is the one below 0x100000000 that exists for things like PCI devices, APICs and firmware ROM.

The hole you're trying to get rid of has nothing to do with what RAM is in which slot. You could fill every RAM slot with as much RAM as possible and the hole would still be there.

There's also no easy way to tell how the motherboard maps actual RAM chips into the physical address space. For all you know it could be interleaved, so that the 64 bytes of RAM at 0x00000000 is "slot 0", the next 64 bytes of RAM at 0x00000040 is "slot 2", the next 64 bytes is "slot 0" again, etc.
LindusSystem wrote:When I probed memory, I get holes after the last byte of the RAM at solt 0, I thought that hole is becaz of the RAM Positions.
What are those holes?Am I wrong that it is because of the RAM position?
Why would you probe to begin with? What does the real memory map (as reported by the firmware via. "int 0x15, eax=0xE820") look like? Where is this hole?
LindusSystem wrote:Am I wrong that it is because of the RAM position?
Yes.


Cheers,

Brendan

Re: How can I remap the physical memory

Posted: Sat May 19, 2012 10:04 am
by LindusSystem
Thanks all, I have corrected my mis-undrestanding of the physical memory.Sorry for this post!