From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1LhVs2-0000dQ-6Z for mharc-grub-devel@gnu.org; Wed, 11 Mar 2009 17:21:46 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LhVs0-0000c0-2t for grub-devel@gnu.org; Wed, 11 Mar 2009 17:21:44 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LhVry-0000be-Nv for grub-devel@gnu.org; Wed, 11 Mar 2009 17:21:43 -0400 Received: from [199.232.76.173] (port=43461 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LhVry-0000bb-Jc for grub-devel@gnu.org; Wed, 11 Mar 2009 17:21:42 -0400 Received: from mail-fx0-f176.google.com ([209.85.220.176]:63315) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LhVry-0001s5-2e for grub-devel@gnu.org; Wed, 11 Mar 2009 17:21:42 -0400 Received: by fxm24 with SMTP id 24so173297fxm.42 for ; Wed, 11 Mar 2009 14:21:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=spnQP3+64I2FH+lkcSTcmWoh3aGp3tFUmVexS7qWrqw=; b=PrR4XLXmilvTTpfNykQRO6C5cvotMCyxTtUIBPRwmss7th1kcbJgKvEilN4pSrrUCy pAHedceRj5X1wvrqEltk/iDzu6qBY2Mnr5oEvjP91cE6cFCNl5ZO2e3LDfIZziI6szis evwmyIRtUo5R8FmgYeNVQWxYIvadasmh8cU3E= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; b=NIly3UyNU0vEouht5A0UUq1A5K2oj/AvD50333v7gYHqIwmtgnA16wXOBVPOLA65jW piaAaDoilry4kTW7qgfzUVLe5/8+pe6NC3UBb31FN3F+nx1nW8RJO/f1lzng3R1ffa4l HtL6qs/V4JwI4ICB9R8bdrzAEWfRR4sviKOH8= Received: by 10.86.31.18 with SMTP id e18mr6186350fge.72.1236806501200; Wed, 11 Mar 2009 14:21:41 -0700 (PDT) Received: from ?192.168.1.2? (44-46.3-85.cust.bluewin.ch [85.3.46.44]) by mx.google.com with ESMTPS id 4sm994067fge.24.2009.03.11.14.21.40 (version=SSLv3 cipher=RC4-MD5); Wed, 11 Mar 2009 14:21:40 -0700 (PDT) Message-ID: <49B82B65.3080506@gmail.com> Date: Wed, 11 Mar 2009 22:21:41 +0100 From: phcoder User-Agent: Thunderbird 2.0.0.19 (X11/20090105) MIME-Version: 1.0 To: The development of GRUB 2 References: <49AB29BA.6040609@gmail.com> <20090311211541.GC29956@thorin> In-Reply-To: <20090311211541.GC29956@thorin> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: Re: ELF bugfixes X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Mar 2009 21:21:44 -0000 Robert Millan wrote: > On Mon, Mar 02, 2009 at 01:35:06AM +0100, phcoder wrote: >> + * include/grub/elf.h: added missing attributes > > This should be a bit more descriptive. > >> for (i = 0; i < ehdr->e_phnum; i++) >> if (phdr(i)->p_type == PT_LOAD && phdr(i)->p_filesz != 0) >> { >> - if (phdr(i)->p_paddr < phdr(lowest_segment)->p_paddr) >> + if (lowest_segment == -1 >> + || phdr(i)->p_paddr < phdr(lowest_segment)->p_paddr) >> lowest_segment = i; >> - if (phdr(i)->p_paddr > phdr(highest_segment)->p_paddr) >> + if (highest_segment == -1 >> + || phdr(i)->p_paddr > phdr(highest_segment)->p_paddr) >> highest_segment = i; >> } > > Why? Because if first segment doesn't have the PT_LOAD attribute set then it should be considered in this comparison > >> - grub_multiboot_payload_entry_offset = ehdr->e_entry - phdr(lowest_segment)->p_vaddr; >> + grub_multiboot_payload_entry_offset = ehdr->e_entry - phdr(lowest_segment)->p_paddr; > > Are you sure about this? IIRC e_entry is in the virtual address space. I > think we had some trouble with this (with NetBSD?), which lead to the current > use of p_vaddr in this line. > Actually now thinking I see that the problem is more deep. The section which is loaded at the lowest address isn't necessarily the section which contains entry point. I'll fix this part cleanly and will resubmit the patch -- Regards Vladimir 'phcoder' Serbinenko