From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32038 invoked by alias); 28 Feb 2004 21:56:07 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 32026 invoked from network); 28 Feb 2004 21:56:05 -0000 Received: from unknown (HELO walton.kettenis.dyndns.org) (213.93.115.144) by sources.redhat.com with SMTP; 28 Feb 2004 21:56:05 -0000 Received: from elgar.kettenis.dyndns.org (elgar.kettenis.dyndns.org [192.168.0.2]) by walton.kettenis.dyndns.org (8.12.6p3/8.12.6) with ESMTP id i1SLtq6C000438; Sat, 28 Feb 2004 22:55:52 +0100 (CET) (envelope-from kettenis@elgar.kettenis.dyndns.org) Received: from elgar.kettenis.dyndns.org (localhost [127.0.0.1]) by elgar.kettenis.dyndns.org (8.12.6p3/8.12.6) with ESMTP id i1SLtqbk006159; Sat, 28 Feb 2004 22:55:52 +0100 (CET) (envelope-from kettenis@elgar.kettenis.dyndns.org) Received: (from kettenis@localhost) by elgar.kettenis.dyndns.org (8.12.6p3/8.12.6/Submit) id i1SLtqGg006156; Sat, 28 Feb 2004 22:55:52 +0100 (CET) Date: Sat, 28 Feb 2004 21:56:00 -0000 Message-Id: <200402282155.i1SLtqGg006156@elgar.kettenis.dyndns.org> From: Mark Kettenis To: cagney@gnu.org CC: ac131313@redhat.com, gdb-patches@sources.redhat.com In-reply-to: <4040FC93.9000100@gnu.org> (message from Andrew Cagney on Sat, 28 Feb 2004 15:39:47 -0500) Subject: [PATCH] Re: [rfa/amd64] Zero fill 32-bit registers References: <403E9BC3.2030807@redhat.com> <200402281046.i1SAkhhe000441@elgar.kettenis.dyndns.org> <4040B0F8.2050803@gnu.org> <200402281734.i1SHYvol017921@elgar.kettenis.dyndns.org> <4040E96F.4010809@gnu.org> <200402282025.i1SKPdRr000430@elgar.kettenis.dyndns.org> <4040FC93.9000100@gnu.org> X-SW-Source: 2004-02/txt/msg00864.txt.bz2 Date: Sat, 28 Feb 2004 15:39:47 -0500 From: Andrew Cagney > Could you live with just zero-extending the 16 general-purpose > registers and the instruction pointer? I'll implement it for you. It is certainly an improvement! Can you test it? I've tested the attached on SuSE 8.2, with -m32. No changes in the testoutput for me, but the threaded stuff doesn't work very well on the system (and probably no at all in on 32x64-bit). I committed it anyway, since I can't imagine this making things worse for the threaded stuff if it works for the non-threaded stuff. I'd appreciate it if you could test whether this fixed the problems you were seeing. Mark Index: ChangeLog from Mark Kettenis * amd64-nat.c: Include "gdb_string.h". (amd64_collect_native_gregset): Zero-extend the 32-bit general-purpose registers and %eip. Index: amd64-nat.c =================================================================== RCS file: /cvs/src/src/gdb/amd64-nat.c,v retrieving revision 1.4 diff -u -p -r1.4 amd64-nat.c --- amd64-nat.c 25 Feb 2004 20:59:12 -0000 1.4 +++ amd64-nat.c 28 Feb 2004 21:54:26 -0000 @@ -24,6 +24,7 @@ #include "regcache.h" #include "gdb_assert.h" +#include "gdb_string.h" #include "i386-tdep.h" #include "amd64-tdep.h" @@ -128,7 +129,17 @@ amd64_collect_native_gregset (const stru int i; if (gdbarch_ptr_bit (gdbarch) == 32) - num_regs = amd64_native_gregset32_num_regs; + { + num_regs = amd64_native_gregset32_num_regs; + + /* Make sure %eax, %ebx, %ecx, %edx, %esi, %edi, %ebp, %esp and + %eip get zero-extended to 64 bits. */ + for (i = 0; i <= I386_EIP_REGNUM; i++) + { + if (regnum == -1 || regnum == i) + memset (regs + amd64_native_gregset_reg_offset (i), 0, 8); + } + } if (num_regs > NUM_REGS) num_regs = NUM_REGS;