From owner-svn-src-stable-7@FreeBSD.ORG Mon Nov 3 21:41:35 2008 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 89BBA106567A; Mon, 3 Nov 2008 21:41:35 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 75C698FC12; Mon, 3 Nov 2008 21:41:35 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mA3LfZ08076801; Mon, 3 Nov 2008 21:41:35 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mA3LfZsk076797; Mon, 3 Nov 2008 21:41:35 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200811032141.mA3LfZsk076797@svn.freebsd.org> From: Marius Strobl Date: Mon, 3 Nov 2008 21:41:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184603 - in stable/7/sys: . sparc64/sparc64 sun4v/sun4v X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Nov 2008 21:41:35 -0000 Author: marius Date: Mon Nov 3 21:41:35 2008 New Revision: 184603 URL: http://svn.freebsd.org/changeset/base/184603 Log: MFC: r184376 - In GCC 4.2 __builtin_frame_address() was fixed to include the V9 stack bias so we no longer need to add it in db_backtrace() and stack_capture() respectively. This also reverts r182168, which kludged around the resulting unaligned access. - Sync the sun4v versions of db_trace.c and stack_machdep.c with the sparc64 ones and fix some style bugs. Approved by: re (kib) Modified: stable/7/sys/ (props changed) stable/7/sys/sparc64/sparc64/db_trace.c stable/7/sys/sparc64/sparc64/stack_machdep.c stable/7/sys/sun4v/sun4v/db_trace.c stable/7/sys/sun4v/sun4v/stack_machdep.c Modified: stable/7/sys/sparc64/sparc64/db_trace.c ============================================================================== --- stable/7/sys/sparc64/sparc64/db_trace.c Mon Nov 3 21:17:18 2008 (r184602) +++ stable/7/sys/sparc64/sparc64/db_trace.c Mon Nov 3 21:41:35 2008 (r184603) @@ -276,10 +276,9 @@ db_backtrace(struct thread *td, struct f void db_trace_self(void) { - db_expr_t addr; - addr = (db_expr_t)__builtin_frame_address(1); - db_backtrace(curthread, (struct frame *)(addr + SPOFF), -1); + db_backtrace(curthread, + (struct frame *)__builtin_frame_address(1), -1); } int @@ -288,5 +287,6 @@ db_trace_thread(struct thread *td, int c struct pcb *ctx; ctx = kdb_thr_ctx(td); - return (db_backtrace(td, (struct frame*)(ctx->pcb_sp + SPOFF), count)); + return (db_backtrace(td, + (struct frame *)(ctx->pcb_sp + SPOFF), count)); } Modified: stable/7/sys/sparc64/sparc64/stack_machdep.c ============================================================================== --- stable/7/sys/sparc64/sparc64/stack_machdep.c Mon Nov 3 21:17:18 2008 (r184602) +++ stable/7/sys/sparc64/sparc64/stack_machdep.c Mon Nov 3 21:41:35 2008 (r184603) @@ -28,31 +28,24 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include #include -#include -#include -#include - -#include #include #include -#include #include +static void stack_capture(struct stack *st, struct frame *fp); + static void -stack_capture(struct stack *st, uint64_t addr) +stack_capture(struct stack *st, struct frame *fp) { vm_offset_t callpc; stack_zero(st); while (1) { - addr += SPOFF; - callpc = - be64dec((void *)(addr + offsetof(struct frame, fr_pc))); + callpc = fp->fr_pc; if (!INKERNEL(callpc)) break; /* Don't bother traversing trap frames. */ @@ -63,30 +56,25 @@ stack_capture(struct stack *st, uint64_t break; if (stack_put(st, callpc) == -1) break; - addr = - be64dec((void *)(addr + offsetof(struct frame, fr_fp))); + fp = v9next_frame(fp); } } void stack_save_td(struct stack *st, struct thread *td) { - uint64_t addr; if (TD_IS_SWAPPED(td)) panic("stack_save_td: swapped"); if (TD_IS_RUNNING(td)) panic("stack_save_td: running"); - addr = td->td_pcb->pcb_sp; - stack_capture(st, addr); + stack_capture(st, (struct frame *)(td->td_pcb->pcb_sp + SPOFF)); } void stack_save(struct stack *st) { - uint64_t addr; - addr = (uint64_t)__builtin_frame_address(1); - stack_capture(st, addr); + stack_capture(st, (struct frame *)__builtin_frame_address(1)); } Modified: stable/7/sys/sun4v/sun4v/db_trace.c ============================================================================== --- stable/7/sys/sun4v/sun4v/db_trace.c Mon Nov 3 21:17:18 2008 (r184602) +++ stable/7/sys/sun4v/sun4v/db_trace.c Mon Nov 3 21:41:35 2008 (r184603) @@ -22,10 +22,11 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ +#include +__FBSDID("$FreeBSD$"); + #include #include #include @@ -241,7 +242,6 @@ db_backtrace(struct thread *td, struct f db_addr_t pc; int trap; int user; - int quit; if (count == -1) count = 1024; @@ -249,7 +249,6 @@ db_backtrace(struct thread *td, struct f trap = 0; user = 0; npc = 0; - quit = 0; while (count-- && !user && !db_pager_quit) { pc = (db_addr_t)db_get_value((db_addr_t)&fp->fr_pc, sizeof(fp->fr_pc), FALSE); @@ -288,10 +287,9 @@ db_backtrace(struct thread *td, struct f void db_trace_self(void) { - db_expr_t addr; - addr = (db_expr_t)__builtin_frame_address(1); - db_backtrace(curthread, (struct frame *)(addr + SPOFF), -1); + db_backtrace(curthread, + (struct frame *)__builtin_frame_address(1), -1); } int @@ -300,5 +298,6 @@ db_trace_thread(struct thread *td, int c struct pcb *ctx; ctx = kdb_thr_ctx(td); - return (db_backtrace(td, (struct frame*)(ctx->pcb_sp + SPOFF), count)); + return (db_backtrace(td, + (struct frame *)(ctx->pcb_sp + SPOFF), count)); } Modified: stable/7/sys/sun4v/sun4v/stack_machdep.c ============================================================================== --- stable/7/sys/sun4v/sun4v/stack_machdep.c Mon Nov 3 21:17:18 2008 (r184602) +++ stable/7/sys/sun4v/sun4v/stack_machdep.c Mon Nov 3 21:41:35 2008 (r184603) @@ -32,54 +32,43 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include -#include - -#include #include #include -#include #include +static void stack_capture(struct stack *st, struct frame *fp); + static void -stack_capture(struct stack *st, uint64_t addr) +stack_capture(struct stack *st, struct frame *fp) { - struct frame *fp; vm_offset_t callpc; stack_zero(st); - fp = (struct frame *)(addr + SPOFF); while (1) { callpc = fp->fr_pc; if (!INKERNEL(callpc)) break; if (stack_put(st, callpc) == -1) break; - fp = (struct frame *)(fp->fr_fp + SPOFF); + fp = v9next_frame(fp); } - } void stack_save_td(struct stack *st, struct thread *td) { - uint64_t addr; if (TD_IS_SWAPPED(td)) panic("stack_save_td: swapped"); if (TD_IS_RUNNING(td)) panic("stack_save_td: running"); - addr = td->td_pcb->pcb_sp; - stack_capture(st, addr); + stack_capture(st, (struct frame *)(td->td_pcb->pcb_sp + SPOFF)); } void stack_save(struct stack *st) { - uint64_t addr; - addr = (uint64_t)__builtin_frame_address(1); - stack_capture(st, addr); + stack_capture(st, (struct frame *)__builtin_frame_address(1)); }