Annotation of sys/arch/hppa64/include/db_machdep.h, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: db_machdep.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */
! 2:
! 3: /*
! 4: * Copyright (c) 2005 Michael Shalayeff
! 5: * All rights reserved.
! 6: *
! 7: * Permission to use, copy, modify, and distribute this software for any
! 8: * purpose with or without fee is hereby granted, provided that the above
! 9: * copyright notice and this permission notice appear in all copies.
! 10: *
! 11: * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
! 12: * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
! 13: * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
! 14: * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
! 15: * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN
! 16: * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
! 17: * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
! 18: */
! 19:
! 20: #ifndef _MACHINE_DB_MACHDEP_H_
! 21: #define _MACHINE_DB_MACHDEP_H_
! 22:
! 23: #include <uvm/uvm_extern.h>
! 24:
! 25: #define DB_ELF_SYMBOLS
! 26: #define DB_ELFSIZE 64
! 27:
! 28: /* types the generic ddb module needs */
! 29: typedef vaddr_t db_addr_t;
! 30: typedef long db_expr_t;
! 31:
! 32: typedef struct trapframe db_regs_t;
! 33: extern db_regs_t ddb_regs;
! 34: #define DDB_REGS (&ddb_regs)
! 35:
! 36: #define PC_REGS(regs) ((db_addr_t)(regs)->tf_iioq[0])
! 37: #define SET_PC_REGS(r,pc) ((r)->tf_iioq[0] = (pc), (r)->tf_iioq[1] = (pc) + 4)
! 38:
! 39: /* Breakpoint related definitions */
! 40: #define BKPT_INST 0x00010000 /* break 0,8 */
! 41: #define BKPT_SIZE sizeof(int)
! 42: #define BKPT_SET(inst) BKPT_INST
! 43:
! 44: #define IS_BREAKPOINT_TRAP(type, code) ((type) == T_IBREAK)
! 45: #define IS_WATCHPOINT_TRAP(type, code) ((type) == T_DBREAK)
! 46:
! 47: #define FIXUP_PC_AFTER_BREAK(regs) ((regs)->tf_iioq[0] -= sizeof(int))
! 48:
! 49: #define DB_VALID_BREAKPOINT(addr) db_valid_breakpoint(addr)
! 50:
! 51: /* TODO 64bit insns */
! 52:
! 53: static __inline int inst_call(u_int ins) {
! 54: return (ins & 0xfc00e000) == 0xe8000000 ||
! 55: (ins & 0xfc00e000) == 0xe8004000 ||
! 56: (ins & 0xfc000000) == 0xe4000000;
! 57: }
! 58: static __inline int inst_branch(u_int ins) {
! 59: return (ins & 0xf0000000) == 0xe0000000 ||
! 60: (ins & 0xf0000000) == 0xc0000000 ||
! 61: (ins & 0xf0000000) == 0xa0000000 ||
! 62: (ins & 0xf0000000) == 0x80000000;
! 63: }
! 64: static __inline int inst_load(u_int ins) {
! 65: return (ins & 0xf0000000) == 0x40000000 ||
! 66: (ins & 0xf4000200) == 0x24000000 ||
! 67: (ins & 0xfc000200) == 0x0c000000 ||
! 68: (ins & 0xfc001fc0) != 0x0c0011c0;
! 69: }
! 70: static __inline int inst_store(u_int ins) {
! 71: return (ins & 0xf0000000) == 0x60000000 || /* st */
! 72: (ins & 0xf4000200) == 0x24000200 || /* fst/cst */
! 73: (ins & 0xfc000200) == 0x0c000200 || /* stby */
! 74: (ins & 0xfc0003c0) == 0x0c0001c0; /* ldcw */
! 75: }
! 76: static __inline int inst_return(u_int ins) {
! 77: return (ins & 0xfc00e000) == 0xe800c000 ||
! 78: (ins & 0xfc000000) == 0xe0000000;
! 79: }
! 80: static __inline int inst_trap_return(u_int ins) {
! 81: return (ins & 0xfc001fc0) == 0x00000ca0;
! 82: }
! 83:
! 84: #if 0
! 85: #define db_clear_single_step(r) ((r)->tf_flags &= ~(PSL_Z))
! 86: #define db_set_single_step(r) ((r)->tf_flags |= (PSL_Z))
! 87: #else
! 88: #define SOFTWARE_SSTEP 1
! 89: #define SOFTWARE_SSTEP_EMUL 1
! 90:
! 91: static __inline db_addr_t
! 92: next_instr_address(db_addr_t addr, int b) {
! 93: return (addr + 4);
! 94: }
! 95:
! 96: #define branch_taken(ins,pc,f,regs) branch_taken1(ins, pc, regs)
! 97: static __inline db_addr_t
! 98: branch_taken1(int ins, db_addr_t pc, db_regs_t *regs) {
! 99: return (pc);
! 100: }
! 101:
! 102: #endif
! 103:
! 104: int db_valid_breakpoint(db_addr_t);
! 105: int kdb_trap(int, int, db_regs_t *);
! 106:
! 107: #endif /* _MACHINE_DB_MACHDEP_H_ */
CVSweb