I don't really know if this is a stupid question, however, I've been looking at page frame allocation. There are two different parts to it that I see. The first is getting a memory map representing the usable memory (which is outlined here:
https://wiki.osdev.org/Detecting_Memory_(x86)). The second is actually writing a page frame allocator. The second part I've already asked about. The first part I'm not really interested in since there's so much written about it already.
The thing that I am wondering about is how to go about setting aside memory for the memory map list. The wiki page seemed to presuppose that you already have an array of list entries pre-allocated, but it doesn't seem like you can know that until you actually get the number of available entries. I would go through and do the int 0x15 BIOS calls first in order to get the number of entries, and then allocate the number of entries based on that. However, that would pre-suppose having a page frame allocator, since anything I allocate without dynamic memory allocation would go out of scope as soon as I leave the function (unless I'm missing something really obvious).
Another option would be to pre-allocate an array so big that it would cover any number of potential number of entries that could be returned. Given that the number of list entries is stored in %bp, the total number of entries cannot exceed 65535. However, allocating that many list entries would mean dedicating 1,572,840 bytes just for the memory map.
How did you go about setting aside space for the memory map entries, assuming my question isn't a non-starter.