From owner-freebsd-hackers@FreeBSD.ORG Wed Nov 4 23:07:30 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9677D1065672; Wed, 4 Nov 2009 23:07:30 +0000 (UTC) (envelope-from dclark@engr.scu.edu) Received: from endor.engr.scu.edu (smtp.engr.scu.edu [129.210.16.13]) by mx1.freebsd.org (Postfix) with ESMTP id 64B9F8FC08; Wed, 4 Nov 2009 23:07:28 +0000 (UTC) Received: from nova32.dc.engr.scu.edu (nova32.dc.engr.scu.edu [129.210.16.29]) by endor.engr.scu.edu (8.13.6/8.13.6) with ESMTP id nA4N7QK9001016 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 4 Nov 2009 15:07:28 -0800 Received: from localhost (dclark@localhost) by nova32.dc.engr.scu.edu (8.13.6/8.13.6) with ESMTP id nA4N6HVO029738; Wed, 4 Nov 2009 15:06:17 -0800 (PST) X-Authentication-Warning: nova32.dc.engr.scu.edu: dclark owned process doing -bs Date: Wed, 4 Nov 2009 15:06:17 -0800 (PST) From: "Dorr H. Clark" X-Sender: dclark@nova32.dc.engr.scu.edu To: freebsd-stable@freebsd.org In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Mailman-Approved-At: Wed, 04 Nov 2009 23:32:51 +0000 Cc: freebsd-hackers@freebsd.org, freebsd-bugs@freebsd.org Subject: gdb/libkvm problem - can someone explain this? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2009 23:07:30 -0000 With FreeBSD 4.x, gdb -k is able to read and interpret the last 4 bytes of a page (4k) boundary. In BSD 6.x/7.x/8.x using the kgdb program, if one issues the kgdb command: (gdb) x /x 0xcbed8ffd An "invalid address" error is returned. However, if one issues the command: (gdb) x /10x 0xcbed8ff0 it is able to read the memory (and past) just fine. The following patch returns the usr/src/lib/libkvm/kvm_i386.c behavior closer to the BSD4.x version and seems to remedy this situation. @@ -289,11 +289,13 @@ #define PG_FRAME4M (~PAGE4M_MASK) pde_pa = ((u_long)pde & PG_FRAME4M) + (va & PAGE4M_MASK); s = _kvm_pa2off(kd, pde_pa, &ofs); +#if 0 if (s < sizeof pde) { _kvm_syserr(kd, kd->program, "_kvm_vatop: pde_pa not found"); goto invalid; } +#endif *pa = ofs; return (NBPDR - (va & PAGE4M_MASK)); } Does anyone see any problem or have any comments about this? Paul Lai Engineer Dorr H. Clark Advisor Graduate School of Engineering Santa Clara University Santa Clara, CA. http://www.cse.scu.edu/~dclark/coen_284_FreeBSD/libkvm_problem.txt