[BACK]Return to db_machdep.h CVS log [TXT][DIR] Up to [local] / sys / arch / hppa / include

Annotation of sys/arch/hppa/include/db_machdep.h, Revision 1.1.1.1

1.1       nbrk        1: /*     $OpenBSD: db_machdep.h,v 1.15 2005/04/19 15:23:07 miod Exp $    */
                      2:
                      3: /*
                      4:  * Copyright (c) 1998-2004 Michael Shalayeff
                      5:  * All rights reserved.
                      6:  *
                      7:  * Redistribution and use in source and binary forms, with or without
                      8:  * modification, are permitted provided that the following conditions
                      9:  * are met:
                     10:  * 1. Redistributions of source code must retain the above copyright
                     11:  *    notice, this list of conditions and the following disclaimer.
                     12:  * 2. Redistributions in binary form must reproduce the above copyright
                     13:  *    notice, this list of conditions and the following disclaimer in the
                     14:  *    documentation and/or other materials provided with the distribution.
                     15:  *
                     16:  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
                     17:  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
                     18:  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
                     19:  * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
                     20:  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
                     21:  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
                     22:  * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     23:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
                     24:  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
                     25:  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
                     26:  * THE POSSIBILITY OF SUCH DAMAGE.
                     27:  */
                     28:
                     29: #ifndef        _MACHINE_DB_MACHDEP_H_
                     30: #define        _MACHINE_DB_MACHDEP_H_
                     31:
                     32: #include <uvm/uvm_extern.h>
                     33:
                     34: #define        DB_ELF_SYMBOLS
                     35: #define        DB_ELFSIZE      32
                     36:
                     37: /* types the generic ddb module needs */
                     38: typedef        vaddr_t db_addr_t;
                     39: typedef        long db_expr_t;
                     40:
                     41: typedef struct trapframe db_regs_t;
                     42: extern db_regs_t       ddb_regs;
                     43: #define        DDB_REGS        (&ddb_regs)
                     44:
                     45: #define        PC_REGS(regs)   ((db_addr_t)(regs)->tf_iioq_head)
                     46: #define        SET_PC_REGS(regs, value)                                        \
                     47: do {                                                                   \
                     48:        (regs)->tf_iioq_tail = 4 +                                      \
                     49:            ((regs)->tf_iioq_head = (value));                           \
                     50: } while (0)
                     51:
                     52: /* Breakpoint related definitions */
                     53: #define        BKPT_INST       0x00010000      /* break 0,8 */
                     54: #define        BKPT_SIZE       sizeof(int)
                     55: #define        BKPT_SET(inst)  BKPT_INST
                     56:
                     57: #define        IS_BREAKPOINT_TRAP(type, code) ((type) == T_IBREAK)
                     58: #define        IS_WATCHPOINT_TRAP(type, code) ((type) == T_DBREAK)
                     59:
                     60: #define        FIXUP_PC_AFTER_BREAK(regs) ((regs)->tf_iioq_head -= sizeof(int))
                     61:
                     62: #define DB_VALID_BREAKPOINT(addr) db_valid_breakpoint(addr)
                     63:
                     64: static __inline int inst_call(u_int ins) {
                     65:        return (ins & 0xfc00e000) == 0xe8000000 ||
                     66:               (ins & 0xfc00e000) == 0xe8004000 ||
                     67:               (ins & 0xfc000000) == 0xe4000000;
                     68: }
                     69: static __inline int inst_branch(u_int ins) {
                     70:        return (ins & 0xf0000000) == 0xe0000000 ||
                     71:               (ins & 0xf0000000) == 0xc0000000 ||
                     72:               (ins & 0xf0000000) == 0xa0000000 ||
                     73:               (ins & 0xf0000000) == 0x80000000;
                     74: }
                     75: static __inline int inst_load(u_int ins) {
                     76:        return (ins & 0xf0000000) == 0x40000000 ||
                     77:               (ins & 0xf4000200) == 0x24000000 ||
                     78:               (ins & 0xfc000200) == 0x0c000000 ||
                     79:               (ins & 0xfc001fc0) != 0x0c0011c0;
                     80: }
                     81: static __inline int inst_store(u_int ins) {
                     82:        return (ins & 0xf0000000) == 0x60000000 ||      /* st */
                     83:               (ins & 0xf4000200) == 0x24000200 ||      /* fst/cst */
                     84:               (ins & 0xfc000200) == 0x0c000200 ||      /* stby */
                     85:               (ins & 0xfc0003c0) == 0x0c0001c0;        /* ldcw */
                     86: }
                     87: static __inline int inst_return(u_int ins) {
                     88:        return (ins & 0xfc00e000) == 0xe800c000 ||
                     89:               (ins & 0xfc000000) == 0xe0000000;
                     90: }
                     91: static __inline int inst_trap_return(u_int ins)        {
                     92:        return (ins & 0xfc001fc0) == 0x00000ca0;
                     93: }
                     94:
                     95: #if 0
                     96: #define db_clear_single_step(r)        ((r)->tf_flags &= ~(PSL_Z))
                     97: #define db_set_single_step(r)  ((r)->tf_flags |= (PSL_Z))
                     98: #else
                     99: #define        SOFTWARE_SSTEP          1
                    100: #define        SOFTWARE_SSTEP_EMUL     1
                    101:
                    102: static __inline db_addr_t
                    103: next_instr_address(db_addr_t addr, int b) {
                    104:        return (addr + 4);
                    105: }
                    106:
                    107: #define        branch_taken(ins,pc,f,regs)     branch_taken1(ins, pc, regs)
                    108: static __inline db_addr_t
                    109: branch_taken1(int ins, db_addr_t pc, db_regs_t *regs) {
                    110:        return (pc);
                    111: }
                    112:
                    113: #endif
                    114:
                    115: int db_valid_breakpoint(db_addr_t);
                    116: int kdb_trap(int, int, db_regs_t *);
                    117:
                    118: #endif /* _MACHINE_DB_MACHDEP_H_ */

CVSweb