From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KqZWG-0004ci-Qp for qemu-devel@nongnu.org; Thu, 16 Oct 2008 16:32:28 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KqZWE-0004cL-HM for qemu-devel@nongnu.org; Thu, 16 Oct 2008 16:32:27 -0400 Received: from [199.232.76.173] (port=43065 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KqZWE-0004cI-Cf for qemu-devel@nongnu.org; Thu, 16 Oct 2008 16:32:26 -0400 Received: from moutng.kundenserver.de ([212.227.126.187]:51023) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KqZWD-0008Gt-HM for qemu-devel@nongnu.org; Thu, 16 Oct 2008 16:32:26 -0400 Message-ID: <48F7A4D6.8070405@mail.berlios.de> Date: Thu, 16 Oct 2008 22:32:22 +0200 From: Stefan Weil MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] Improve symbol lookup References: <48E52067.6080408@mail.berlios.de> <48F79CB9.4090602@mail.berlios.de> In-Reply-To: <48F79CB9.4090602@mail.berlios.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, Blue Swirl Stefan Weil schrieb: > Blue Swirl schrieb: > >> On 10/2/08, Stefan Weil wrote: >> >>> For 64 bit targets, lookup_symbol() compares a 64-bit target address >>> with a 32 bit symbol address. This only works for addresses less than >>> 2^32. >>> >>> MIPS64 kernels use addresses larger than 0xffffffff80000000, >>> so qemu.log never shows symbolic names. >>> >>> My patch is a workaround which works with Qemu's 32 bit address hack. >>> Please apply it to Qemu trunk. >>> >> This applies to all architectures, not just MIPS64, so it need not be >> conditional to TARGET_MIPS64. >> >> >>> Maybe a better solution would use symbol addresses without shortening >>> them to 32 bits. >>> > Here is the better solution (at least I hope so). > >> Yes. That would mean using elf_sym instead of Elf32_sym in places >> where symbols are used and removing the SZ==64 hacks in elf_ops.h. >> >> > So I did. Here is a short summary of my new patch: > > * Use function pointers for symbol lookup (currently for elf32 and > elf64, could be expanded). > This also fixes the bug with mips elf64 symbols in current Qemu trunk. > > * Use quicksort and binary search for symbol lookup. > > * Remove unneeded entries from symbol table. > This reduced a typical table size (linux mips kernel) from 1764487 to > 11656 entries. > > * In disas.c, the patch also fixes some warnings from old fashioned > function prototypes. > > In loader.c, two defines control some compile time options (could be > removed in > production code): > #define CONFIG_BINARY_SYMBOL_SEARCH > #define CONFIG_REDUCE_SYMBOL_TABLE > > I tested the new code using 32 bit and 64 bit linux mips kernels and > Qemu logging (-d in_asm). > The speed improvement is extremely large - both because of the much > smaller table and > the binary search. > > Stefan > > Please note: The current patch only supports system emulation. User emulation needs more fixes to compile again. Stefan