Page 1 of 3
Mem above 1 MB
Posted: Thu Aug 11, 2005 8:12 pm
by HardEnough
hi guys
is there is any mem above 1MB which i don't have to touch ???
Re:Mem above 1 MB
Posted: Thu Aug 11, 2005 8:31 pm
by Ushma
You mean mustn't touch? One way to find that out is to get a memory map, which will make holes and other hazards apparent. A simpler way would be to get the extended memory size, which would indicate the presence of that much memory past 1MB. A problem with this is that if there is a hole (like the 1MB at 15MB OS/2 thing), you will only get memory up to that hole, and could be missing memory past it.
Re:Mem above 1 MB
Posted: Thu Aug 11, 2005 8:40 pm
by HardEnough
thus there exists memory after 1 MB which i mustn't touch ?
so how can the memory manager avoid this pieces of mem ???
if it's memory mapping, how can this be done ?
Re:Mem above 1 MB
Posted: Thu Aug 11, 2005 8:53 pm
by QuiTeVexat
The memory manager never allocates those pieces of memory (it only considers useable memory for allocation).
If you mean *you* mapping memory, just don't map any of those places into any address spaces.
If you mean things like memory mapped devices and the video memory, they won't show up as useable memory on the map.
Re:Mem above 1 MB
Posted: Thu Aug 11, 2005 9:02 pm
by HardEnough
no i meant a memory map containing the unusable pieces of ram that shouldn't be used in any way , the memory map should also contain the pieces of ram that i can allocate.
how can i find the area that can't be done ?
below 1 MB : i always never touch
after 1MB: ???
Re:Mem above 1 MB
Posted: Thu Aug 11, 2005 9:09 pm
by QuiTeVexat
A memory map entry usually consists of a base, length, and type. Type will tell you whether it is useable.
Refer to this page:
http://www.osdev.org/osfaq2/index.php/H ... f%20RAM%3F
Re:Mem above 1 MB
Posted: Thu Aug 11, 2005 9:20 pm
by HardEnough
i don't need to do so manually , i like to use grub to get the memory size and limit for both low, high mem, but how about the holes.
e.g. if memory @ 5 MB mark is used by a certian hardware device, how can i know it's reserved for this device and prevent the acess to it ??
Re:Mem above 1 MB
Posted: Thu Aug 11, 2005 9:45 pm
by QuiTeVexat
The extended memory size that grub gives you will not go through any holes. I have a machine with the option of making the 1 MB hole at 15MB. On that machine, with the option enabled, grub reports 14MB of extended memory. Without the option enabled, grub reports 127MB of extended memory (the full quantity).
Preventing access to it involves using the protection mechanisms. Not using the memory is as simple as that: don't allocate it, don't use it.
Re:Mem above 1 MB
Posted: Thu Aug 11, 2005 10:32 pm
by HardEnough
i need to know where this hole to not use it
Re:Mem above 1 MB
Posted: Thu Aug 11, 2005 10:44 pm
by QuiTeVexat
I will repeat: The extended memory size that grub gives you will not go through any holes.
Thus, you can rest assured that there will be no holes from the 1MB mark + howevermuch extended memory grub reports. Note that the default is *lack* of useable memory, and that you should only use addresses that you know point to useable memory, rather than not use addresses that point to a hole. The memory manager should only consider known useable areas for allocation.
Re:Mem above 1 MB
Posted: Thu Aug 11, 2005 10:49 pm
by HardEnough
so if grub reports that i've 64 MB which means the address from 0x100000 -> 64 MB can be used normally without any holes in the middle?
Re:Mem above 1 MB
Posted: Fri Aug 12, 2005 12:28 am
by AR
yes, but to do it properly and work your way around holes you must use the memory map from the BIOS (Which GRUB kindly gets for you and gives you a pointer to in the multiboot info structure).
Re:Mem above 1 MB
Posted: Fri Aug 12, 2005 12:38 am
by Tora OS
just out of curiosity...what would happen if you did write to one of these holes?
Re:Mem above 1 MB
Posted: Fri Aug 12, 2005 12:42 am
by AR
It will either cause "undefined behaviour" on the device mapped in that space, or if there is no device it will just cause the bus to float. (When the bus floats, the last value written gets "stuck", you can read it back but the value will be lost when another value is written IIRC)
Re:Mem above 1 MB
Posted: Sun Aug 14, 2005 11:28 pm
by Freanan
Having to use the memory map is bad...
Because out of some reason the flag in the multiboot structure that indicates the validity of those maps is always set to null and i only get one small memory area if i try to read the map anyway
(and yes, the multiboot struct as a whole is valid, i can print the right commandline and the lower/upper memory from grub in my kernel).
I am using bochs and i heard that some things just don't work in bochs.
Is the memory map one of them?