Boot loader + malloc
Hello, I've got a small question regarding $subject. I'm looking at this code snippet from src/sys/boot/i386/loader/main.c: #if defined(LOADER_BZIP2_SUPPORT) || defined(LOADER_FIREWIRE_SUPPORT) heap_top = PTOV(memtop_copyin); memtop_copyin -= 0x30; heap_bottom = PTOV(memtop_copyin); #else heap_top = (void *)bios_basemem; heap_bottom = (void *)end; #endif setheap(heap_bottom, heap_top); If I understand correctly, the boot loader will use only low memory (i.e. below 0x10) for malloc by default. Extended memory is only used if bzip2 or firewire support are enabled (not default). Is this intentional? Would it make sense to toggle the default and always use extended memory, unless disabled? I'm asking because the upcoming graphics support requires a little bit of memory for fonts and images, but there's only less than about 80 KB left in low memory, which is insufficient except for very trivial things. The loader kept crashing on me in nasty ways because of that. In my p4 branch I modified the above #if to also use extended memory if LOADER_GRAPHICS_SUPPORT is defined, giving me 3 MB of memory to play with, which is plenty. Is that OK, or should I expect trouble? Any comments are appreciated. Best regards Oliver -- Oliver Fromme, secnetix GmbH Co. KG, Marktplatz 29, 85567 Grafing b. M. Handelsregister: Registergericht Muenchen, HRA 74606, Geschäftsfuehrung: secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün- chen, HRB 125758, Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart FreeBSD-Dienstleistungen, -Produkte und mehr: http://www.secnetix.de/bsd One of the main causes of the fall of the Roman Empire was that, lacking zero, they had no way to indicate successful termination of their C programs. -- Robert Firth ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Boot loader + malloc
Oliver Fromme wrote: Hello, I've got a small question regarding $subject. I'm looking at this code snippet from src/sys/boot/i386/loader/main.c: #if defined(LOADER_BZIP2_SUPPORT) || defined(LOADER_FIREWIRE_SUPPORT) heap_top = PTOV(memtop_copyin); memtop_copyin -= 0x30; heap_bottom = PTOV(memtop_copyin); #else heap_top = (void *)bios_basemem; heap_bottom = (void *)end; #endif setheap(heap_bottom, heap_top); If I understand correctly, the boot loader will use only low memory (i.e. below 0x10) for malloc by default. Extended memory is only used if bzip2 or firewire support are enabled (not default). Is this intentional? Would it make sense to toggle the default and always use extended memory, unless disabled? I'm asking because the upcoming graphics support requires a little bit of memory for fonts and images, but there's only less than about 80 KB left in low memory, which is insufficient except for very trivial things. The loader kept crashing on me in nasty ways because of that. In my p4 branch I modified the above #if to also use extended memory if LOADER_GRAPHICS_SUPPORT is defined, giving me 3 MB of memory to play with, which is plenty. Is that OK, or should I expect trouble? Any comments are appreciated. Best regards Oliver At present the amd64 kernel is loaded just above the first megabyte of physical memory. I have no idea if the loader uses malloc()/free() after the kernel is loaded though. ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Boot loader + malloc
Jordan Gordeev wrote: At present the amd64 kernel is loaded just above the first megabyte of physical memory. Yes, I know, and the standard i386 kernel is loaded at 4 MB, and the PAE kernel is loaded at 2 MB. It doesn't matter much, though. I have no idea if the loader uses malloc()/free() after the kernel is loaded though. Yes, it does. By default the loader loads the kernel first, then fires up the beastie menu which causes quite some malloc() activity. FICL uses malloc() internally for various things. Best regards Oliver -- Oliver Fromme, secnetix GmbH Co. KG, Marktplatz 29, 85567 Grafing b. M. Handelsregister: Registergericht Muenchen, HRA 74606, Geschäftsfuehrung: secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün- chen, HRB 125758, Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart FreeBSD-Dienstleistungen, -Produkte und mehr: http://www.secnetix.de/bsd When your hammer is C++, everything begins to look like a thumb. -- Steve Haflich, in comp.lang.c++ ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to [EMAIL PROTECTED]