home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / gdb-4.9 / gdb / config / m68k / xm-hp300hpux.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-05-12  |  5.4 KB  |  169 lines

  1. /* Parameters for HP 9000 model 320 hosting, for GDB, the GNU debugger.
  2.    Copyright (C) 1986, 1987, 1989, 1992 Free Software Foundation, Inc.
  3.  
  4. This file is part of GDB.
  5.  
  6. This program 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 2 of the License, or
  9. (at your option) any later version.
  10.  
  11. This program 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 this program; if not, write to the Free Software
  18. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. #define HOST_BYTE_ORDER BIG_ENDIAN
  21.  
  22. /* HPUX 8.0, in its infinite wisdom, has chosen to prototype ptrace
  23.    with five arguments, so programs written for normal ptrace lose.
  24.  
  25.    Idiots.
  26.  
  27.    (They should have just made it varadic).  */
  28. #define FIVE_ARG_PTRACE
  29.  
  30. /* Define this to indicate problems with traps after continuing.  */
  31. #define HP_OS_BUG
  32.  
  33. /* Set flag to indicate whether HP's assembler is in use. */
  34. #ifdef __GNUC__
  35. #ifdef __HPUX_ASM__
  36. #define HPUX_ASM
  37. #endif
  38. #else /* not GNU C.  */
  39. #define HPUX_ASM
  40. #endif /* not GNU C.  */
  41.  
  42. /* Define this for versions of hp-ux older than 6.0 */
  43. /* #define HPUX_VERSION_5 */
  44.  
  45. /* define USG if you are using sys5 /usr/include's */
  46. #undef USG    /* In case it was defined in the Makefile for cplus-dem.c */
  47. #define USG
  48.  
  49. /* The mem functions are in <string.h>.  */
  50. #undef MEM_FNS_DECLARED
  51. #define MEM_FNS_DECLARED 1
  52.  
  53. #define HAVE_TERMIO
  54.  
  55. /* Get rid of any system-imposed stack limit if possible.  */
  56. /* The hp9k320.h doesn't seem to have this feature.  */
  57. /* #define SET_STACK_LIMIT_HUGE */
  58. /* So we'll just have to avoid big alloca's.  */
  59. #define BROKEN_LARGE_ALLOCA
  60.  
  61. #define REGISTER_ADDR(u_ar0, regno)                    \
  62.   (unsigned int)                            \
  63.   (((regno) < PS_REGNUM)                        \
  64.    ? (&((struct exception_stack *) (u_ar0))->e_regs[(regno + R0)])    \
  65.    : (((regno) == PS_REGNUM)                        \
  66.       ? ((int *) (&((struct exception_stack *) (u_ar0))->e_PS))        \
  67.       : (&((struct exception_stack *) (u_ar0))->e_PC)))
  68.  
  69. #define FP_REGISTER_ADDR(u, regno)                    \
  70.   (((char *)                                \
  71.     (((regno) < FPC_REGNUM)                        \
  72.      ? (&u.u_pcb.pcb_mc68881[FMC68881_R0 + (((regno) - FP0_REGNUM) * 3)]) \
  73.      : (&u.u_pcb.pcb_mc68881[FMC68881_C + ((regno) - FPC_REGNUM)])))    \
  74.    - ((char *) (& u)))
  75.  
  76. /* Interface definitions for kernel debugger KDB.  */
  77.  
  78. /* Map machine fault codes into signal numbers.
  79.    First subtract 0, divide by 4, then index in a table.
  80.    Faults for which the entry in this table is 0
  81.    are not handled by KDB; the program's own trap handler
  82.    gets to handle then.  */
  83.  
  84. #define FAULT_CODE_ORIGIN 0
  85. #define FAULT_CODE_UNITS 4
  86. #define FAULT_TABLE    \
  87. { 0, 0, 0, 0, SIGTRAP, 0, 0, 0, \
  88.   0, SIGTRAP, 0, 0, 0, 0, 0, SIGKILL, \
  89.   0, 0, 0, 0, 0, 0, 0, 0, \
  90.   SIGILL }
  91.  
  92. #ifndef HPUX_ASM
  93.  
  94. /* Start running with a stack stretching from BEG to END.
  95.    BEG and END should be symbols meaningful to the assembler.
  96.    This is used only for kdb.  */
  97.  
  98. #define INIT_STACK(beg, end)  \
  99. { asm (".globl end");         \
  100.   asm ("movel $ end, sp");      \
  101.   asm ("clrl fp"); }
  102.  
  103. /* Push the frame pointer register on the stack.  */
  104. #define PUSH_FRAME_PTR        \
  105.   asm ("movel fp, -(sp)");
  106.  
  107. /* Copy the top-of-stack to the frame pointer register.  */
  108. #define POP_FRAME_PTR  \
  109.   asm ("movl (sp), fp");
  110.  
  111. /* After KDB is entered by a fault, push all registers
  112.    that GDB thinks about (all NUM_REGS of them),
  113.    so that they appear in order of ascending GDB register number.
  114.    The fault code will be on the stack beyond the last register.  */
  115.  
  116. #define PUSH_REGISTERS        \
  117. { asm ("clrw -(sp)");          \
  118.   asm ("pea 10(sp)");          \
  119.   asm ("movem $ 0xfffe,-(sp)"); }
  120.  
  121. /* Assuming the registers (including processor status) have been
  122.    pushed on the stack in order of ascending GDB register number,
  123.    restore them and return to the address in the saved PC register.  */
  124.  
  125. #define POP_REGISTERS          \
  126. { asm ("subil $8,28(sp)");     \
  127.   asm ("movem (sp),$ 0xffff"); \
  128.   asm ("rte"); }
  129.  
  130. #else /* HPUX_ASM */
  131.  
  132. /* Start running with a stack stretching from BEG to END.
  133.    BEG and END should be symbols meaningful to the assembler.
  134.    This is used only for kdb.  */
  135.  
  136. #define INIT_STACK(beg, end)                        \
  137. { asm ("global end");                            \
  138.   asm ("mov.l &end,%sp");                        \
  139.   asm ("clr.l %a6"); }
  140.  
  141. /* Push the frame pointer register on the stack.  */
  142. #define PUSH_FRAME_PTR                            \
  143.   asm ("mov.l %fp,-(%sp)");
  144.  
  145. /* Copy the top-of-stack to the frame pointer register.  */
  146. #define POP_FRAME_PTR                            \
  147.   asm ("mov.l (%sp),%fp");
  148.  
  149. /* After KDB is entered by a fault, push all registers
  150.    that GDB thinks about (all NUM_REGS of them),
  151.    so that they appear in order of ascending GDB register number.
  152.    The fault code will be on the stack beyond the last register.  */
  153.  
  154. #define PUSH_REGISTERS                            \
  155. { asm ("clr.w -(%sp)");                            \
  156.   asm ("pea 10(%sp)");                            \
  157.   asm ("movm.l &0xfffe,-(%sp)"); }
  158.  
  159. /* Assuming the registers (including processor status) have been
  160.    pushed on the stack in order of ascending GDB register number,
  161.    restore them and return to the address in the saved PC register.  */
  162.  
  163. #define POP_REGISTERS                            \
  164. { asm ("subi.l &8,28(%sp)");                        \
  165.   asm ("mov.m (%sp),&0xffff");                        \
  166.   asm ("rte"); }
  167.  
  168. #endif /* HPUX_ASM */
  169.