Hollis Blanchard <[EMAIL PROTECTED]> writes: >> The idea is very good. But I don't like that loaded areas are always >> allocated >> from the heap. GRUB has a staging area for OS images on i386-pc, and I >> prefer >> to load an image directly instead of consuming the heap. > > Actually I'm not using the heap, I'm just directly copying wherever > phdr->p_paddr says to. That's not a good thing actually; in the future > we should add some error checking to make sure we don't clobber GRUB > itself.
Have you looked at how EFI solves this? They keep track of all memory regions, and with each region is a "memory type" associated. Whenever you allocate memory you change the type of the region (from "free") to some that makes sense (could be "loader data", "disk cache", ...). You can only allocate memory that is marked "conventional", meaning it is considered free. The memory region database is later feed to the operating system. We could do the same. Is this case we could allocate the regions specified by the ELF image. If any of the allocations fail we know there is something already loaded there, or the image is faulty. ~j
pgpg1QzNSXV0d.pgp
Description: PGP signature
_______________________________________________ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel