From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KI8BX-0001xh-Pm for qemu-devel@nongnu.org; Sun, 13 Jul 2008 16:28:43 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KI8BW-0001vb-3a for qemu-devel@nongnu.org; Sun, 13 Jul 2008 16:28:43 -0400 Received: from [199.232.76.173] (port=40912 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KI8BV-0001vL-Ua for qemu-devel@nongnu.org; Sun, 13 Jul 2008 16:28:41 -0400 Received: from fmmailgate01.web.de ([217.72.192.221]:45938) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KI8BV-0006zi-NC for qemu-devel@nongnu.org; Sun, 13 Jul 2008 16:28:42 -0400 Received: from smtp08.web.de (fmsmtp08.dlan.cinetic.de [172.20.5.216]) by fmmailgate01.web.de (Postfix) with ESMTP id AD94AE7D3A48 for ; Sun, 13 Jul 2008 22:28:40 +0200 (CEST) Received: from [88.64.30.223] (helo=[192.168.1.198]) by smtp08.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.109 #226) id 1KI8BU-0005mA-00 for qemu-devel@nongnu.org; Sun, 13 Jul 2008 22:28:40 +0200 Message-ID: <487A6578.8020501@web.de> Date: Sun, 13 Jul 2008 22:28:40 +0200 From: Jan Kiszka MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Sender: jan.kiszka@web.de Subject: [Qemu-devel] [PATCH] linux-user: Turn gdt_table into local variable 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 qemu_malloc[z] does not return memory suited for direct guest access, but that is mandatory for gdt_table. Local host variables are safe, so re-convert that (small) table. This patch, together with the one for page_find_alloc, fixes the reported qemu-i386 regression [1]. [1] http://permalink.gmane.org/gmane.comp.emulators.qemu/26987 Signed-off-by: Jan Kiszka --- linux-user/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) Index: b/linux-user/main.c =================================================================== --- a/linux-user/main.c +++ b/linux-user/main.c @@ -258,6 +258,8 @@ void fork_end(int child) /***********************************************************/ /* CPUX86 core interface */ +uint64_t gdt_table[TARGET_GDT_ENTRIES]; + void cpu_smm_update(CPUState *env) { } @@ -2470,9 +2472,7 @@ int main(int argc, char **argv) /* linux segment setup */ { - uint64_t *gdt_table; - gdt_table = qemu_mallocz(sizeof(uint64_t) * TARGET_GDT_ENTRIES); - env->gdt.base = h2g((unsigned long)gdt_table); + env->gdt.base = h2g(gdt_table); env->gdt.limit = sizeof(uint64_t) * TARGET_GDT_ENTRIES - 1; #ifdef TARGET_ABI32 write_dt(&gdt_table[__USER_CS >> 3], 0, 0xfffff,