From owner-freebsd-amd64@FreeBSD.ORG Sun Oct 3 14:00:17 2010 Return-Path: Delivered-To: freebsd-amd64@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 461171065675 for ; Sun, 3 Oct 2010 14:00:17 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 1AE488FC0A for ; Sun, 3 Oct 2010 14:00:17 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o93E0GK4008609 for ; Sun, 3 Oct 2010 14:00:16 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o93E0Gvl008603; Sun, 3 Oct 2010 14:00:16 GMT (envelope-from gnats) Date: Sun, 3 Oct 2010 14:00:16 GMT Message-Id: <201010031400.o93E0Gvl008603@freefall.freebsd.org> To: freebsd-amd64@FreeBSD.org From: dfilter@FreeBSD.ORG (dfilter service) X-Mailman-Approved-At: Sun, 03 Oct 2010 14:09:26 +0000 Cc: Subject: Re: amd64/151167: commit references a PR X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: dfilter service List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2010 14:00:17 -0000 The following reply was made to PR amd64/151167; it has been noted by GNATS. From: dfilter@FreeBSD.ORG (dfilter service) To: bug-followup@FreeBSD.org Cc: Subject: Re: amd64/151167: commit references a PR Date: Sun, 3 Oct 2010 13:52:22 +0000 (UTC) Author: kib Date: Sun Oct 3 13:52:17 2010 New Revision: 213382 URL: http://svn.freebsd.org/changeset/base/213382 Log: The makectx() function, used by kdb_trap() to reconstruct pcb from trap frame when trap initiated kdb entry, incorrectly calculated the value of %rsp for trapped thread. According to Intel(R) 64 and IA-32 Architectures Software Developer's Manual Volume 3A: System Programming Guide, Part 1, rev. 035, 6.14.2 64-Bit Mode Stack Frame, "64-bit mode ... pushes SS:RSP unconditionally, rather than only on a CPL change." Even assuming the conditional push of the %ss:%rsp, the calculation was still wrong because sizeof(tf_ss) + sizeof(tf_rsp) == 16 on amd64. Always use the tf_rsp from trap frame. The change supposedly fixes stepping when using kgdb backend for kdb. Submitted by: Zhouyi Zhou PR: amd64/151167 Reviewed by: avg MFC after: 1 week Modified: head/sys/amd64/amd64/machdep.c Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Sun Oct 3 13:13:10 2010 (r213381) +++ head/sys/amd64/amd64/machdep.c Sun Oct 3 13:52:17 2010 (r213382) @@ -1799,7 +1799,7 @@ makectx(struct trapframe *tf, struct pcb pcb->pcb_rbp = tf->tf_rbp; pcb->pcb_rbx = tf->tf_rbx; pcb->pcb_rip = tf->tf_rip; - pcb->pcb_rsp = (ISPL(tf->tf_cs)) ? tf->tf_rsp : (long)(tf + 1) - 8; + pcb->pcb_rsp = tf->tf_rsp; } int _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"