Hi,
davidv1992 wrote:in the first mb, what is safe to use (cause there are bit's of video mem there and some other things as the DBA, what can i use as conventional ram and what not)
For the first 1 MB of RAM, it's always safe to use the first 512 KB. Some things (e.g. netboot) use RAM at 0x00080000, and there's no real limit for the size of the EBDA (which is sometimes 1 KB from 0x0009FC00 to 0x9FFFF, but has been growing due to ACPI, can be much larger on big servers, and can grow in future).
davidv1992 wrote:asume i have 512 mb of memory in my system, until where is it save to use the ram?
From 1 MB to 15 MB (or from 0x00100000 to 0x000FFFFF) should be safe on all systems that have 16 MB or more RAM. After that, there may be a "hole" for memory mapped ISA from 0x00F00000 to 0x00FFFFFF (which is rare now that ISA is almost obsolete).
After that there's no real guarantee - your 512 MB of RAM could (in theory) be split into 32 seperate chunks spread everywhere (even though it's likely that there's almost 511 MB of usable RAM at 1 MB).
Also, the BIOS uses some RAM for it's own purposes (ACPI mostly). Typically you'll find ACPI tables and an ACPI NVRAM area at the top of RAM (but there's nothing in any specifications to say these things can't be somewhere else instead).
In future, I'm expecting more space at the top of RAM to be used by the BIOS for SMI/SMM memory. The RAM in the area between 0x000A0000 to 0x000BFFFF (*underneath* the video display memory) is currently used for this (with some chipset tricks to prevent software from accessing it), however each CPU needs it's own SMRAM space, and this area isn't big enough for "lots" of CPUs.
Just below 4 GB you'll normally have the BIOS's ROM. Below that is a space that's usually used for I/O APICs, local APICs and HPET (if any of these are present). Below that there's space reserved for memory mapped PCI devices. This means that in a computer with 8 GB of RAM you get a hole below 4 GB. It also means that a computer with 4 GB of RAM might have 3 GB of RAM below 4 GB and another 1 GB of RAM above 4 GB.
davidv1992 wrote:I've seen two memory maps, but they are not really clear to me, if someone could explain them i would also be very happy.
There's a reason for that - there's no real standard that hardware manufacturers and BIOS writers must comply with, except for ACPI (which says nothing about physical memory layout) and backwards compatability.
Because of backwards compatability, the first 1MB of the physical address space will look like this:
0x00000000 to 0x0007FFFF - safe, usable RAM
0x00080000 to 0x0009FFFF - use
BIOS INT 0x12 to find out how much usable RAM is here
0x000A0000 to 0x000BFFFF - used by video display memory and BIOS SMI/SMM
0x000C0000 to 0x000FFFFF - used by ROMs
For anything above 1 MB you need to ask the BIOS what is where. See
BIOS INT 15, eax = 0xE820 (and older BIOS functions if that isn't supported).
Cheers,
Brendan