| 1 | /* Parameters for execution on a Hewlett-Packard 9000/300, running bsd. |
| 2 | Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc. |
| 3 | |
| 4 | This file is part of GDB. |
| 5 | |
| 6 | GDB is free software; you can redistribute it and/or modify |
| 7 | it under the terms of the GNU General Public License as published by |
| 8 | the Free Software Foundation; either version 1, or (at your option) |
| 9 | any later version. |
| 10 | |
| 11 | GDB is distributed in the hope that it will be useful, |
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | GNU General Public License for more details. |
| 15 | |
| 16 | You should have received a copy of the GNU General Public License |
| 17 | along with GDB; see the file COPYING. If not, write to |
| 18 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ |
| 19 | |
| 20 | /* |
| 21 | * Configuration file for HP9000/300 series machine running |
| 22 | * University of Utah's 4.3bsd port. This is NOT for HP-UX. |
| 23 | * Problems to hpbsd-bugs@cs.utah.edu |
| 24 | */ |
| 25 | |
| 26 | #include <machine/endian.h> |
| 27 | |
| 28 | /* Get rid of any system-imposed stack limit if possible. */ |
| 29 | |
| 30 | #define SET_STACK_LIMIT_HUGE |
| 31 | |
| 32 | /* Get kernel u area address at run-time using BSD style nlist (). */ |
| 33 | #define KERNEL_U_ADDR_BSD |
| 34 | |
| 35 | /* This is a piece of magic that is given a register number REGNO |
| 36 | and as BLOCKEND the address in the system of the end of the user structure |
| 37 | and stores in ADDR the address in the kernel or core dump |
| 38 | of that register. */ |
| 39 | |
| 40 | #define REGISTER_U_ADDR(addr, blockend, regno) \ |
| 41 | { \ |
| 42 | if (regno < PS_REGNUM) \ |
| 43 | addr = (int) &((struct frame *)(blockend))->f_regs[regno]; \ |
| 44 | else if (regno == PS_REGNUM) \ |
| 45 | addr = (int) &((struct frame *)(blockend))->f_stackadj; \ |
| 46 | else if (regno == PC_REGNUM) \ |
| 47 | addr = (int) &((struct frame *)(blockend))->f_pc; \ |
| 48 | else if (regno < FPC_REGNUM) \ |
| 49 | addr = (int) \ |
| 50 | &((struct user *)0)->u_pcb.pcb_fpregs.fpf_regs[((regno)-FP0_REGNUM)*3];\ |
| 51 | else if (regno == FPC_REGNUM) \ |
| 52 | addr = (int) &((struct user *)0)->u_pcb.pcb_fpregs.fpf_fpcr; \ |
| 53 | else if (regno == FPS_REGNUM) \ |
| 54 | addr = (int) &((struct user *)0)->u_pcb.pcb_fpregs.fpf_fpsr; \ |
| 55 | else \ |
| 56 | addr = (int) &((struct user *)0)->u_pcb.pcb_fpregs.fpf_fpiar; \ |
| 57 | } |
| 58 | |
| 59 | /* Compensate for lack of `vprintf' function. */ |
| 60 | #define MISSING_VPRINTF |
| 61 | |
| 62 | \f |
| 63 | /* Interface definitions for kernel debugger KDB. */ |
| 64 | |
| 65 | /* Map machine fault codes into signal numbers. |
| 66 | First subtract 0, divide by 4, then index in a table. |
| 67 | Faults for which the entry in this table is 0 |
| 68 | are not handled by KDB; the program's own trap handler |
| 69 | gets to handle then. */ |
| 70 | |
| 71 | #define FAULT_CODE_ORIGIN 0 |
| 72 | #define FAULT_CODE_UNITS 4 |
| 73 | #define FAULT_TABLE \ |
| 74 | { 0, 0, 0, 0, SIGTRAP, 0, 0, 0, \ |
| 75 | 0, SIGTRAP, 0, 0, 0, 0, 0, SIGKILL, \ |
| 76 | 0, 0, 0, 0, 0, 0, 0, 0, \ |
| 77 | SIGILL } |
| 78 | |
| 79 | /* Start running with a stack stretching from BEG to END. |
| 80 | BEG and END should be symbols meaningful to the assembler. |
| 81 | This is used only for kdb. */ |
| 82 | |
| 83 | #define INIT_STACK(beg, end) \ |
| 84 | { asm (".globl end"); \ |
| 85 | asm ("movel #end, sp"); \ |
| 86 | asm ("movel #0,a6"); } |
| 87 | |
| 88 | /* Push the frame pointer register on the stack. */ |
| 89 | #define PUSH_FRAME_PTR \ |
| 90 | asm ("movel a6,sp@-"); |
| 91 | |
| 92 | /* Copy the top-of-stack to the frame pointer register. */ |
| 93 | #define POP_FRAME_PTR \ |
| 94 | asm ("movl sp@,a6"); |
| 95 | |
| 96 | /* After KDB is entered by a fault, push all registers |
| 97 | that GDB thinks about (all NUM_REGS of them), |
| 98 | so that they appear in order of ascending GDB register number. |
| 99 | The fault code will be on the stack beyond the last register. */ |
| 100 | |
| 101 | #define PUSH_REGISTERS \ |
| 102 | { asm ("clrw -(sp)"); \ |
| 103 | asm ("pea sp@(10)"); \ |
| 104 | asm ("movem #0xfffe,sp@-"); } |
| 105 | |
| 106 | /* Assuming the registers (including processor status) have been |
| 107 | pushed on the stack in order of ascending GDB register number, |
| 108 | restore them and return to the address in the saved PC register. */ |
| 109 | |
| 110 | #define POP_REGISTERS \ |
| 111 | { asm ("subil #8,sp@(28)"); \ |
| 112 | asm ("movem sp@,#0xffff"); \ |
| 113 | asm ("rte"); } |