Max. no. entries that can be returned by 0xE820
- BrightLight
- Member
- Posts: 901
- Joined: Sat Dec 27, 2014 9:11 am
- Location: Maadi, Cairo, Egypt
- Contact:
Max. no. entries that can be returned by 0xE820
My OS uses BIOS function 0xE820 to detect memory. Before the function starts, I simply have 1024 bytes reserved in my kernel to make space for the memory map. Assuming each entry size is 24 bytes, what is the maximum number of entries that this function can return? I am asking for the sake of keeping my kernel's binary as small as possible.
You know your OS is advanced when you stop using the Intel programming guide as a reference.
Re: Max. no. entries that can be returned by 0xE820
On the systems you will be testing it probably won't exceed 1024 bytes. On huge servers, with TBs of RAM you can expect to have more entries than you can fit in 1024 bytes (I've seen such a machine to have an entry for 8 bytes of memory ).
If you really want to be able to collect all the entries without increasing the kernel binary too much why don't you 'dynamically' allocate this data? In this stage I guest you don't have a memory allocator, but you could pick any unused memory area in the first MB of physical space.
If you really want to be able to collect all the entries without increasing the kernel binary too much why don't you 'dynamically' allocate this data? In this stage I guest you don't have a memory allocator, but you could pick any unused memory area in the first MB of physical space.
- BrightLight
- Member
- Posts: 901
- Joined: Sat Dec 27, 2014 9:11 am
- Location: Maadi, Cairo, Egypt
- Contact:
Re: Max. no. entries that can be returned by 0xE820
My kernel is loaded in the first MB of physical space. It lives in low memory and cannot grow more than 512 KB in size. I will fix this some day when my kernel must get bigger than this limit, but now it's just because I am lazy to write a full 64-bit boot loader for my file system that I am constantly redesigning.alexg wrote:On the systems you will be testing it probably won't exceed 1024 bytes. On huge servers, with TBs of RAM you can expect to have more entries than you can fit in 1024 bytes (I've seen such a machine to have an entry for 8 bytes of memory ).
If you really want to be able to collect all the entries without increasing the kernel binary too much why don't you 'dynamically' allocate this data? In this stage I guest you don't have a memory allocator, but you could pick any unused memory area in the first MB of physical space.
You know your OS is advanced when you stop using the Intel programming guide as a reference.
Re: Max. no. entries that can be returned by 0xE820
The space you store the entries shouldn't be in the kernel, otherwise you're loading zeros that you're just going to overwrite.