From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M9iaf-0006EP-J1 for qemu-devel@nongnu.org; Thu, 28 May 2009 12:36:25 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M9iab-0006CS-Ad for qemu-devel@nongnu.org; Thu, 28 May 2009 12:36:25 -0400 Received: from [199.232.76.173] (port=46472 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M9iab-0006CP-7D for qemu-devel@nongnu.org; Thu, 28 May 2009 12:36:21 -0400 Received: from mx20.gnu.org ([199.232.41.8]:47961) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1M9iaa-0004QR-7w for qemu-devel@nongnu.org; Thu, 28 May 2009 12:36:20 -0400 Received: from g1t0029.austin.hp.com ([15.216.28.36]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1M9iaZ-0002Ut-3w for qemu-devel@nongnu.org; Thu, 28 May 2009 12:36:19 -0400 From: Alex Williamson Content-Type: text/plain Date: Thu, 28 May 2009 10:36:07 -0600 Message-Id: <1243528568.25164.47.camel@bling> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH] bios: Fix multiple calls into smbios_load_external() List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel , Beth Kon Cc: bochs-developers We're marking the used entry bitmap in smbios_load_external() for each type we check, regardless of whether we loaded anything. This makes subsequent calls behave as if we've already loaded the tables from qemu and can result in missing tables (ex. multiple type4 entries on an SMP guest). Only mark the bitmap if we actually load something. Signed-off-by: Alex Williamson -- diff --git a/bios/rombios32.c b/bios/rombios32.c index f861f81..c869798 100644 --- a/bios/rombios32.c +++ b/bios/rombios32.c @@ -2554,13 +2554,14 @@ smbios_load_external(int type, char **p, unsigned *nr_structs, *max_struct_size = *p - (char *)header; } - /* Mark that we've reported on this type */ - used_bitmap[(type >> 6) & 0x3] |= (1ULL << (type & 0x3f)); + if (start != *p) { + /* Mark that we've reported on this type */ + used_bitmap[(type >> 6) & 0x3] |= (1ULL << (type & 0x3f)); + return 1; + } - return (start != *p); -#else /* !BX_QEMU */ +#endif /* !BX_QEMU */ return 0; -#endif } void smbios_init(void)