[BACK]Return to debug.s CVS log [TXT][DIR] Up to [local] / sys / arch / alpha / alpha

Annotation of sys/arch/alpha/alpha/debug.s, Revision 1.1.1.1

1.1       nbrk        1: /* $OpenBSD: debug.s,v 1.3 2006/04/13 14:37:26 brad Exp $ */
                      2: /* $NetBSD: debug.s,v 1.5 1999/06/18 18:11:56 thorpej Exp $ */
                      3:
                      4: /*-
                      5:  * Copyright (c) 1999 The NetBSD Foundation, Inc.
                      6:  * All rights reserved.
                      7:  *
                      8:  * This code is derived from software contributed to The NetBSD Foundation
                      9:  * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
                     10:  * NASA Ames Research Center.
                     11:  *
                     12:  * Redistribution and use in source and binary forms, with or without
                     13:  * modification, are permitted provided that the following conditions
                     14:  * are met:
                     15:  * 1. Redistributions of source code must retain the above copyright
                     16:  *    notice, this list of conditions and the following disclaimer.
                     17:  * 2. Redistributions in binary form must reproduce the above copyright
                     18:  *    notice, this list of conditions and the following disclaimer in the
                     19:  *    documentation and/or other materials provided with the distribution.
                     20:  * 3. All advertising materials mentioning features or use of this software
                     21:  *    must display the following acknowledgement:
                     22:  *     This product includes software developed by the NetBSD
                     23:  *     Foundation, Inc. and its contributors.
                     24:  * 4. Neither the name of The NetBSD Foundation nor the names of its
                     25:  *    contributors may be used to endorse or promote products derived
                     26:  *    from this software without specific prior written permission.
                     27:  *
                     28:  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
                     29:  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
                     30:  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
                     31:  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
                     32:  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
                     33:  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
                     34:  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
                     35:  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
                     36:  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
                     37:  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
                     38:  * POSSIBILITY OF SUCH DAMAGE.
                     39:  */
                     40:
                     41: /*
                     42:  * Debugger glue.
                     43:  */
                     44:
                     45:        .text
                     46: inc6:  .stabs  __FILE__,132,0,0,inc6; .loc     1 __LINE__
                     47:
                     48: /*
                     49:  * Debugger stack.
                     50:  */
                     51: #define        DEBUG_STACK_SIZE        8192
                     52: BSS(debug_stack_bottom, DEBUG_STACK_SIZE)
                     53: ABS(debug_stack_top, debug_stack_bottom + DEBUG_STACK_SIZE)
                     54:
                     55: /*
                     56:  * alpha_debug:
                     57:  *
                     58:  *     Single debugger entry point, handling the housekeeping
                     59:  *     chores we need to deal with.
                     60:  *
                     61:  *     Arguments are:
                     62:  *
                     63:  *             a0      a0 from trap
                     64:  *             a1      a1 from trap
                     65:  *             a2      a2 from trap
                     66:  *             a3      kernel trap entry point
                     67:  *             a4      frame pointer
                     68:  */
                     69: NESTED_NOPROFILE(alpha_debug, 5, 32, ra, IM_RA|IM_S0, 0)
                     70:        br      pv, 1f
                     71: 1:     LDGP(pv)
                     72:        lda     t0, FRAME_SIZE*8(a4)    /* what would sp have been? */
                     73:        stq     t0, FRAME_SP*8(a4)      /* belatedly save sp for ddb view */
                     74:        lda     sp, -32(sp)             /* set up stack frame */
                     75:        stq     ra, (32-8)(sp)          /* save ra */
                     76:        stq     s0, (32-16)(sp)         /* save s0 */
                     77:
                     78:        /* Remember our current stack pointer. */
                     79:        mov     sp, s0
                     80:
                     81: #if defined(MULTIPROCESSOR)
                     82:        /*
                     83:         * XXX PAUSE ALL OTHER CPUs.
                     84:         */
                     85: #endif
                     86:
                     87:        /*
                     88:         * Switch to the debug stack if we're not on it already.
                     89:         */
                     90:        lda     t0, debug_stack_bottom
                     91:        cmpule  sp, t0, t1              /* sp <= debug_stack_bottom */
                     92:        bne     t1, 2f                  /* yes, switch now */
                     93:
                     94:        lda     t0, debug_stack_top
                     95:        cmpule  t0, sp, t1              /* debug_stack_top <= sp? */
                     96:        bne     t1, 3f                  /* yes, we're on the debug stack */
                     97:
                     98: 2:     lda     sp, debug_stack_top     /* sp <- debug_stack_top */
                     99:
                    100: 3:     /* Dispatch to the debugger - arguments are already in place. */
                    101:        CALL(ddb_trap)
                    102:
                    103:        /* Debugger return value in v0; switch back to our previous stack. */
                    104:        mov     s0, sp
                    105:
                    106: #if defined(MULTIPROCESSOR)
                    107:        /*
                    108:         * XXX RESUME ALL OTHER CPUs.
                    109:         */
                    110: #endif
                    111:
                    112:        ldq     ra, (32-8)(sp)          /* restore ra */
                    113:        ldq     s0, (32-16)(sp)         /* restore s0 */
                    114:        lda     sp, 32(sp)              /* pop stack frame */
                    115:        RET
                    116:        END(alpha_debug)

CVSweb