From owner-freebsd-hackers@FreeBSD.ORG Thu Aug 21 17:50:26 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A160D106564A for ; Thu, 21 Aug 2008 17:50:26 +0000 (UTC) (envelope-from jgordeev@dir.bg) Received: from dir.bg (mail.dir.bg [194.145.63.28]) by mx1.freebsd.org (Postfix) with ESMTP id 280EF8FC33 for ; Thu, 21 Aug 2008 17:50:25 +0000 (UTC) (envelope-from jgordeev@dir.bg) Received: from [77.85.117.184] (account jgordeev@dir.bg HELO sometimes2.studgrad.net) by srv.dir.bg (CommuniGate Pro SMTP 5.2.4) with ESMTPSA id 36182615 for freebsd-hackers@FreeBSD.ORG; Thu, 21 Aug 2008 20:20:20 +0300 Message-ID: <48ADA3D1.30802@dir.bg> Date: Thu, 21 Aug 2008 20:20:17 +0300 From: Jordan Gordeev User-Agent: Mozilla/5.0 (X11; U; DragonFly i386; en-US; rv:1.8.1.16) Gecko/20080804 SeaMonkey/1.1.11 MIME-Version: 1.0 To: freebsd-hackers@FreeBSD.ORG References: <200808211637.m7LGbRhJ008358@lurza.secnetix.de> In-Reply-To: <200808211637.m7LGbRhJ008358@lurza.secnetix.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Subject: Re: Boot loader + malloc X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Aug 2008 17:50:26 -0000 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 -= 0x300000; > 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 0x100000) 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.