Annotation of 43BSDReno/contrib/emacs-18.55/gdb/m-hp9k320.h, revision 1.1.1.1

1.1       root        1: /* Parameters for execution on an HP 9000 model 320, for GDB, the GNU debugger.
                      2:    Copyright (C) 1986, 1987 Free Software Foundation, Inc.
                      3: 
                      4: GDB is distributed in the hope that it will be useful, but WITHOUT ANY
                      5: WARRANTY.  No author or distributor accepts responsibility to anyone
                      6: for the consequences of using it or for whether it serves any
                      7: particular purpose or works at all, unless he says so in writing.
                      8: Refer to the GDB General Public License for full details.
                      9: 
                     10: Everyone is granted permission to copy, modify and redistribute GDB,
                     11: but only under the conditions described in the GDB General Public
                     12: License.  A copy of this license is supposed to have been given to you
                     13: along with GDB so you can know your rights and responsibilities.  It
                     14: should be in a file named COPYING.  Among other things, the copyright
                     15: notice and this notice must be preserved on all copies.
                     16: 
                     17: In other words, go ahead and share GDB, but don't try to stop
                     18: anyone else from sharing it farther.  Help stamp out software hoarding!
                     19: */
                     20: 
                     21: #ifndef HP9K320
                     22: #define HP9K320
                     23: #endif
                     24: 
                     25: /* Set flag to indicate whether HP's assembler is in use. */
                     26: #ifdef __GNU__
                     27: #ifdef __HPUX_ASM__
                     28: #define HPUX_ASM
                     29: #endif
                     30: #else
                     31: #define HPUX_ASM
                     32: #endif
                     33: 
                     34: /* Define this for versions of hp-ux older than 6.0 */
                     35: /* #define HPUX_VERSION_5 */
                     36: 
                     37: #define HAVE_TERMIO
                     38: 
                     39: /* Get rid of any system-imposed stack limit if possible.  */
                     40: 
                     41: /* #define SET_STACK_LIMIT_HUGE */
                     42: 
                     43: /* Define this if the C compiler puts an underscore at the front
                     44:    of external names before giving them to the linker.  */
                     45: 
                     46: #define NAMES_HAVE_UNDERSCORE
                     47: 
                     48: /* Debugger information will be in DBX format.  */
                     49: 
                     50: #define READ_DBX_FORMAT
                     51: 
                     52: /* Offset from address of function to start of its code.
                     53:    Zero on most machines.  */
                     54: 
                     55: #define FUNCTION_START_OFFSET 0
                     56: 
                     57: /* Advance PC across any function entry prologue instructions
                     58:    to reach some "real" code.  */
                     59: 
                     60: #define SKIP_PROLOGUE(pc)   \
                     61: { register int op = read_memory_integer (pc, 2);       \
                     62:   if (op == 0047126)                           \
                     63:     pc += 4;   /* Skip link #word */                   \
                     64:   else if (op == 0044016)                      \
                     65:     pc += 6;   /* Skip link #long */                   \
                     66: }
                     67: 
                     68: /* Immediately after a function call, return the saved pc.
                     69:    Can't go through the frames for this because on some machines
                     70:    the new frame is not set up until the new function executes
                     71:    some instructions.  */
                     72: 
                     73: #define SAVED_PC_AFTER_CALL(frame) \
                     74: read_memory_integer (read_register (SP_REGNUM), 4)
                     75: 
                     76: /* This is the amount to subtract from u.u_ar0
                     77:    to get the offset in the core file of the register values.  */
                     78: 
                     79: #ifdef HPUX_VERSION_5
                     80: #define KERNEL_U_ADDR 0x00979000
                     81: #else
                     82: #define KERNEL_U_ADDR 0x00C01000
                     83: #endif
                     84: 
                     85: /* Address of end of stack space.  */
                     86: 
                     87: #define STACK_END_ADDR 0xFFF00000
                     88: 
                     89: /* Stack grows downward.  */
                     90: 
                     91: #define INNER_THAN <
                     92: 
                     93: /* Sequence of bytes for breakpoint instruction.  */
                     94: 
                     95: #define BREAKPOINT {0x4e, 0x41}
                     96: 
                     97: /* Amount PC must be decremented by after a breakpoint.
                     98:    This is often the number of bytes in BREAKPOINT
                     99:    but not always.  */
                    100: 
                    101: #define DECR_PC_AFTER_BREAK 2
                    102: 
                    103: /* Nonzero if instruction at PC is a return instruction.  */
                    104: 
                    105: #define ABOUT_TO_RETURN(pc) (read_memory_integer (pc, 2) == 0x4e75)
                    106: 
                    107: /* Return 1 if P points to an invalid floating point value.  */
                    108: 
                    109: #define INVALID_FLOAT(p, len) 0   /* Just a first guess; not checked */
                    110: 
                    111: /* Say how long (ordinary) registers are.  */
                    112: 
                    113: #define REGISTER_TYPE long
                    114: 
                    115: /* Number of machine registers */
                    116: 
                    117: #define NUM_REGS 29
                    118: 
                    119: /* Initializer for an array of names of registers.
                    120:    There should be NUM_REGS strings in this initializer.  */
                    121: 
                    122: #define REGISTER_NAMES  \
                    123:  {"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", \
                    124:   "a0", "a1", "a2", "a3", "a4", "a5", "fp", "sp", \
                    125:   "ps", "pc",  \
                    126:   "fp0", "fp1", "fp2", "fp3", "fp4", "fp5", "fp6", "fp7", \
                    127:   "fpcontrol", "fpstatus", "fpiaddr" }
                    128: 
                    129: /* Register numbers of various important registers.
                    130:    Note that some of these values are "real" register numbers,
                    131:    and correspond to the general registers of the machine,
                    132:    and some are "phony" register numbers which are too large
                    133:    to be actual register numbers as far as the user is concerned
                    134:    but do serve to get the desired values when passed to read_register.  */
                    135: 
                    136: #define FP_REGNUM 14           /* Contains address of executing stack frame */
                    137: #define SP_REGNUM 15           /* Contains address of top of stack */
                    138: #define PS_REGNUM 16           /* Contains processor status */
                    139: #define PC_REGNUM 17           /* Contains program counter */
                    140: #define FP0_REGNUM 18          /* Floating point register 0 */
                    141: #define FPC_REGNUM 26          /* 68881 control register */
                    142: 
                    143: /* Total amount of space needed to store our copies of the machine's
                    144:    register state, the array `registers'.  */
                    145: #define REGISTER_BYTES (16*4+8*12+8+12)
                    146: 
                    147: /* Index within `registers' of the first byte of the space for
                    148:    register N.  */
                    149: 
                    150: #define REGISTER_BYTE(N)  \
                    151:  ((N) >= FPC_REGNUM ? (((N) - FPC_REGNUM) * 4) + 168   \
                    152:   : (N) >= FP0_REGNUM ? (((N) - FP0_REGNUM) * 12) + 72 \
                    153:   : (N) * 4)
                    154: 
                    155: /* Number of bytes of storage in the actual machine representation
                    156:    for register N.  On the 68000, all regs are 4 bytes
                    157:    except the floating point regs which are 12 bytes.  */
                    158: 
                    159: #define REGISTER_RAW_SIZE(N) (((unsigned)(N) - FP0_REGNUM) < 8 ? 12 : 4)
                    160: 
                    161: /* Number of bytes of storage in the program's representation
                    162:    for register N.  On the 68000, all regs are 4 bytes
                    163:    except the floating point regs which are 8-byte doubles.  */
                    164: 
                    165: #define REGISTER_VIRTUAL_SIZE(N) (((unsigned)(N) - FP0_REGNUM) < 8 ? 8 : 4)
                    166: 
                    167: /* Largest value REGISTER_RAW_SIZE can have.  */
                    168: 
                    169: #define MAX_REGISTER_RAW_SIZE 12
                    170: 
                    171: /* Largest value REGISTER_VIRTUAL_SIZE can have.  */
                    172: 
                    173: #define MAX_REGISTER_VIRTUAL_SIZE 8
                    174: 
                    175: /* Nonzero if register N requires conversion
                    176:    from raw format to virtual format.  */
                    177: 
                    178: #define REGISTER_CONVERTIBLE(N) (((unsigned)(N) - FP0_REGNUM) < 8)
                    179: 
                    180: /* Convert data from raw format for register REGNUM
                    181:    to virtual format for register REGNUM.  */
                    182: 
                    183: #define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO)    \
                    184: { if ((REGNUM) >= FP0_REGNUM && (REGNUM) < FPC_REGNUM) \
                    185:     convert_from_68881 ((FROM), (TO)); \
                    186:   else                                 \
                    187:     bcopy ((FROM), (TO), 4); }
                    188: 
                    189: /* Convert data from virtual format for register REGNUM
                    190:    to raw format for register REGNUM.  */
                    191: 
                    192: #define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO)        \
                    193: { if ((REGNUM) >= FP0_REGNUM && (REGNUM) < FPC_REGNUM) \
                    194:     convert_to_68881 ((FROM), (TO));   \
                    195:   else                                 \
                    196:     bcopy ((FROM), (TO), 4); }
                    197: 
                    198: /* Return the GDB type object for the "standard" data type
                    199:    of data in register N.  */
                    200: 
                    201: #define REGISTER_VIRTUAL_TYPE(N) \
                    202:  (((unsigned)(N) - FP0_REGNUM) < 8 ? builtin_type_double : builtin_type_int)
                    203: 
                    204: /* Extract from an array REGBUF containing the (raw) register state
                    205:    a function return value of type TYPE, and copy that, in virtual format,
                    206:    into VALBUF.  */
                    207: 
                    208: #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
                    209:   bcopy (REGBUF, VALBUF, TYPE_LENGTH (TYPE))
                    210: 
                    211: /* Write into appropriate registers a function return value
                    212:    of type TYPE, given in virtual format.  */
                    213: 
                    214: #define STORE_RETURN_VALUE(TYPE,VALBUF) \
                    215:   write_register_bytes (0, VALBUF, TYPE_LENGTH (TYPE))
                    216: 
                    217: /* Extract from an array REGBUF containing the (raw) register state
                    218:    the address in which a function should return its structure value,
                    219:    as a CORE_ADDR (or an expression that can be used as one).  */
                    220: 
                    221: #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(int *)(REGBUF))
                    222: 
                    223: #define REGISTER_ADDR(u_ar0, regno)                                    \
                    224:   (((regno) < PS_REGNUM)                                               \
                    225:    ? (&((struct exception_stack *) (u_ar0))->e_regs[(regno + R0)])     \
                    226:    : (((regno) == PS_REGNUM)                                           \
                    227:       ? ((int *) (&((struct exception_stack *) (u_ar0))->e_PS))                \
                    228:       : (&((struct exception_stack *) (u_ar0))->e_PC)))
                    229: 
                    230: #define FP_REGISTER_ADDR(u, regno)                                     \
                    231:   (((regno) < FPC_REGNUM)                                              \
                    232:    ? (&u.u_pcb.pcb_mc68881[FMC68881_R0 + (((regno) - FP0_REGNUM) * 3)])        \
                    233:    : (&u.u_pcb.pcb_mc68881[FMC68881_C + ((regno) - FPC_REGNUM)]))
                    234: 
                    235: /* It is safe to look for symsegs on a Sun, because Sun's ld
                    236:    does not screw up with random garbage at end of file.  */
                    237: 
                    238: #define READ_GDB_SYMSEGS
                    239: 
                    240: /* Describe the pointer in each stack frame to the previous stack frame
                    241:    (its caller).  */
                    242: 
                    243: /* FRAME_CHAIN takes a frame's nominal address
                    244:    and produces the frame's chain-pointer.
                    245: 
                    246:    FRAME_CHAIN_COMBINE takes the chain pointer and the frame's nominal address
                    247:    and produces the nominal address of the caller frame.
                    248: 
                    249:    However, if FRAME_CHAIN_VALID returns zero,
                    250:    it means the given frame is the outermost one and has no caller.
                    251:    In that case, FRAME_CHAIN_COMBINE is not used.  */
                    252: 
                    253: /* In the case of the Sun, the frame's nominal address
                    254:    is the address of a 4-byte word containing the calling frame's address.  */
                    255: 
                    256: #define FRAME_CHAIN(thisframe)  (read_memory_integer (thisframe, 4))
                    257: 
                    258: #define FRAME_CHAIN_VALID(chain, thisframe) \
                    259:   (chain != 0 && (FRAME_SAVED_PC (thisframe) >= first_object_file_end))
                    260: 
                    261: #define FRAME_CHAIN_COMBINE(chain, thisframe) (chain)
                    262: 
                    263: /* Define other aspects of the stack frame.  */
                    264: 
                    265: #define FRAME_SAVED_PC(frame) (read_memory_integer (frame + 4, 4))
                    266: 
                    267: #define FRAME_ARGS_ADDRESS(fi) (fi.frame)
                    268: 
                    269: #define FRAME_LOCALS_ADDRESS(fi) (fi.frame)
                    270: 
                    271: /* Set VAL to the number of args passed to frame described by FI.
                    272:    Can set VAL to -1, meaning no way to tell.  */
                    273: 
                    274: /* We can't tell how many args there are
                    275:    now that the C compiler delays popping them.  */
                    276: #define FRAME_NUM_ARGS(val,fi) (val = -1)
                    277: 
                    278: #if 0
                    279: #define FRAME_NUM_ARGS(val, fi)  \
                    280: { register CORE_ADDR pc = FRAME_SAVED_PC (fi.frame);           \
                    281:   register int insn = 0177777 & read_memory_integer (pc, 2);   \
                    282:   val = 0;                                                     \
                    283:   if (insn == 0047757 || insn == 0157374)  /* lea W(sp),sp or addaw #W,sp */ \
                    284:     val = read_memory_integer (pc + 2, 2);                     \
                    285:   else if ((insn & 0170777) == 0050217 /* addql #N, sp */      \
                    286:           || (insn & 0170777) == 0050117)  /* addqw */         \
                    287:     { val = (insn >> 9) & 7; if (val == 0) val = 8; }          \
                    288:   else if (insn == 0157774) /* addal #WW, sp */                        \
                    289:     val = read_memory_integer (pc + 2, 4);                     \
                    290:   val >>= 2; }
                    291: #endif
                    292: 
                    293: /* Return number of bytes at start of arglist that are not really args.  */
                    294: 
                    295: #define FRAME_ARGS_SKIP 8
                    296: 
                    297: /* Put here the code to store, into a struct frame_saved_regs,
                    298:    the addresses of the saved registers of frame described by FRAME_INFO.
                    299:    This includes special registers such as pc and fp saved in special
                    300:    ways in the stack frame.  sp is even more special:
                    301:    the address we return for it IS the sp for the next frame.  */
                    302: 
                    303: #define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs)            \
                    304: { register int regnum;                                                 \
                    305:   register int regmask;                                                        \
                    306:   register CORE_ADDR next_addr;                                                \
                    307:   register CORE_ADDR pc;                                               \
                    308:   int nextinsn;                                                                \
                    309:   bzero (&frame_saved_regs, sizeof frame_saved_regs);                  \
                    310:   if ((frame_info).pc >= (frame_info).frame - CALL_DUMMY_LENGTH - FP_REGNUM*4 - 8*12 - 4 \
                    311:       && (frame_info).pc <= (frame_info).frame)                                \
                    312:     { next_addr = (frame_info).frame;                                  \
                    313:       pc = (frame_info).frame - CALL_DUMMY_LENGTH - FP_REGNUM * 4 - 8*12 - 4; }\
                    314:   else                                                                 \
                    315:     { pc = get_pc_function_start ((frame_info).pc);                    \
                    316:       /* Verify we have a link a6 instruction next;                    \
                    317:         if not we lose.  If we win, find the address above the saved   \
                    318:         regs using the amount of storage from the link instruction.  */\
                    319:       if (044016 == read_memory_integer (pc, 2))                       \
                    320:        next_addr = (frame_info).frame + read_memory_integer (pc += 2, 4), pc+=4; \
                    321:       else if (047126 == read_memory_integer (pc, 2))                  \
                    322:        next_addr = (frame_info).frame + read_memory_integer (pc += 2, 2), pc+=2; \
                    323:       else goto lose;                                                  \
                    324:       /* If have an addal #-n, sp next, adjust next_addr.  */          \
                    325:       if ((0177777 & read_memory_integer (pc, 2)) == 0157774)          \
                    326:        next_addr += read_memory_integer (pc += 2, 4), pc += 4;         \
                    327:     }                                                                  \
                    328:   /* next should be a moveml to (sp) or -(sp) or a movl r,-(sp) */     \
                    329:   regmask = read_memory_integer (pc + 2, 2);                           \
                    330:   /* But before that can come an fmovem.  Check for it.  */            \
                    331:   nextinsn = 0xffff & read_memory_integer (pc, 2);                     \
                    332:   if (0xf227 == nextinsn                                               \
                    333:       && (regmask & 0xff00) == 0xe000)                                 \
                    334:     { pc += 4; /* Regmask's low bit is for register fp7, the first pushed */ \
                    335:       for (regnum = FP0_REGNUM + 7; regnum >= FP0_REGNUM; regnum--, regmask >>= 1)             \
                    336:        if (regmask & 1)                                                \
                    337:           (frame_saved_regs).regs[regnum] = (next_addr -= 12);         \
                    338:       regmask = read_memory_integer (pc + 2, 2); }                     \
                    339:   if (0044327 == read_memory_integer (pc, 2))                          \
                    340:     { pc += 4; /* Regmask's low bit is for register 0, the first written */ \
                    341:       for (regnum = 0; regnum < 16; regnum++, regmask >>= 1)           \
                    342:        if (regmask & 1)                                                \
                    343:           (frame_saved_regs).regs[regnum] = (next_addr += 4) - 4; }    \
                    344:   else if (0044347 == read_memory_integer (pc, 2))                     \
                    345:     { pc += 4; /* Regmask's low bit is for register 15, the first pushed */ \
                    346:       for (regnum = 15; regnum >= 0; regnum--, regmask >>= 1)          \
                    347:        if (regmask & 1)                                                \
                    348:           (frame_saved_regs).regs[regnum] = (next_addr -= 4); }                \
                    349:   else if (0x2f00 == 0xfff0 & read_memory_integer (pc, 2))             \
                    350:     { regnum = 0xf & read_memory_integer (pc, 2); pc += 2;             \
                    351:       (frame_saved_regs).regs[regnum] = (next_addr -= 4); }            \
                    352:   /* fmovemx to index of sp may follow.  */                            \
                    353:   regmask = read_memory_integer (pc + 2, 2);                           \
                    354:   nextinsn = 0xffff & read_memory_integer (pc, 2);                     \
                    355:   if (0xf236 == nextinsn                                               \
                    356:       && (regmask & 0xff00) == 0xf000)                                 \
                    357:     { pc += 10; /* Regmask's low bit is for register fp0, the first written */ \
                    358:       for (regnum = FP0_REGNUM + 7; regnum >= FP0_REGNUM; regnum--, regmask >>= 1)             \
                    359:        if (regmask & 1)                                                \
                    360:           (frame_saved_regs).regs[regnum] = (next_addr += 12) - 12;    \
                    361:       regmask = read_memory_integer (pc + 2, 2); }                     \
                    362:   /* clrw -(sp); movw ccr,-(sp) may follow.  */                                \
                    363:   if (0x426742e7 == read_memory_integer (pc, 4))                       \
                    364:     (frame_saved_regs).regs[PS_REGNUM] = (next_addr -= 4);             \
                    365:   lose: ;                                                              \
                    366:   (frame_saved_regs).regs[SP_REGNUM] = (frame_info).frame + 8;         \
                    367:   (frame_saved_regs).regs[FP_REGNUM] = (frame_info).frame;             \
                    368:   (frame_saved_regs).regs[PC_REGNUM] = (frame_info).frame + 4;         \
                    369: }
                    370: 
                    371: /* Things needed for making the inferior call functions.  */
                    372: 
                    373: /* Push an empty stack frame, to record the current PC, etc.  */
                    374: 
                    375: #define PUSH_DUMMY_FRAME \
                    376: { register CORE_ADDR sp = read_register (SP_REGNUM);                   \
                    377:   register int regnum;                                                 \
                    378:   char raw_buffer[12];                                                 \
                    379:   sp = push_word (sp, read_register (PC_REGNUM));                      \
                    380:   sp = push_word (sp, read_register (FP_REGNUM));                      \
                    381:   write_register (FP_REGNUM, sp);                                      \
                    382:   for (regnum = FP0_REGNUM + 7; regnum >= FP0_REGNUM; regnum--)                \
                    383:     { read_register_bytes (REGISTER_BYTE (regnum), raw_buffer, 12);    \
                    384:       sp = push_bytes (sp, raw_buffer, 12); }                          \
                    385:   for (regnum = FP_REGNUM - 1; regnum >= 0; regnum--)                  \
                    386:     sp = push_word (sp, read_register (regnum));                       \
                    387:   sp = push_word (sp, read_register (PS_REGNUM));                      \
                    388:   write_register (SP_REGNUM, sp);  }
                    389: 
                    390: /* Discard from the stack the innermost frame, 
                    391:    restoring all saved registers.  */
                    392: 
                    393: #define POP_FRAME  \
                    394: { register CORE_ADDR fp = read_register (FP_REGNUM);            \
                    395:   register int regnum;                                          \
                    396:   struct frame_saved_regs fsr;                                  \
                    397:   struct frame_info fi;                                                 \
                    398:   char raw_buffer[12];                                          \
                    399:   fi = get_frame_info (fp);                                     \
                    400:   get_frame_saved_regs (&fi, &fsr);                             \
                    401:   for (regnum = FP0_REGNUM + 7; regnum >= FP0_REGNUM; regnum--)         \
                    402:     if (fsr.regs[regnum])                                       \
                    403:       { read_memory (fsr.regs[regnum], raw_buffer, 12);                 \
                    404:         write_register_bytes (REGISTER_BYTE (regnum), raw_buffer, 12); }\
                    405:   for (regnum = FP_REGNUM - 1; regnum >= 0; regnum--)           \
                    406:     if (fsr.regs[regnum])                                       \
                    407:       write_register (regnum, read_memory_integer (fsr.regs[regnum], 4)); \
                    408:   if (fsr.regs[PS_REGNUM])                                      \
                    409:     write_register (PS_REGNUM, read_memory_integer (fsr.regs[PS_REGNUM], 4)); \
                    410:   write_register (FP_REGNUM, read_memory_integer (fp, 4));      \
                    411:   write_register (PC_REGNUM, read_memory_integer (fp + 4, 4));   \
                    412:   write_register (SP_REGNUM, fp + 8);                           \
                    413:   set_current_frame (read_register (FP_REGNUM)); }
                    414: 
                    415: /* This sequence of words is the instructions
                    416:      fmovem 0xff,-(sp)
                    417:      moveml 0xfffc,-(sp)
                    418:      clrw -(sp)
                    419:      movew ccr,-(sp)
                    420:      /..* The arguments are pushed at this point by GDB;
                    421:        no code is needed in the dummy for this.
                    422:        The CALL_DUMMY_START_OFFSET gives the position of 
                    423:        the following jsr instruction.  *../
                    424:      jsr @#32323232
                    425:      addl #69696969,sp
                    426:      bpt
                    427:      nop
                    428: Note this is 28 bytes.
                    429: We actually start executing at the jsr, since the pushing of the
                    430: registers is done by PUSH_DUMMY_FRAME.  If this were real code,
                    431: the arguments for the function called by the jsr would be pushed
                    432: between the moveml and the jsr, and we could allow it to execute through.
                    433: But the arguments have to be pushed by GDB after the PUSH_DUMMY_FRAME is done,
                    434: and we cannot allow the moveml to push the registers again lest they be
                    435: taken for the arguments.  */
                    436: 
                    437: #define CALL_DUMMY {0xf227e0ff, 0x48e7fffc, 0x426742e7, 0x4eb93232, 0x3232dffc, 0x69696969, 0x4e414e71}
                    438: 
                    439: #define CALL_DUMMY_LENGTH 28
                    440: 
                    441: #define CALL_DUMMY_START_OFFSET 12
                    442: 
                    443: /* Insert the specified number of args and function address
                    444:    into a call sequence of the above form stored at DUMMYNAME.  */
                    445: 
                    446: #define FIX_CALL_DUMMY(dummyname, fun, nargs)     \
                    447: { *(int *)((char *) dummyname + 20) = nargs * 4;  \
                    448:   *(int *)((char *) dummyname + 14) = fun; }
                    449: 
                    450: /* Interface definitions for kernel debugger KDB.  */
                    451: 
                    452: /* Map machine fault codes into signal numbers.
                    453:    First subtract 0, divide by 4, then index in a table.
                    454:    Faults for which the entry in this table is 0
                    455:    are not handled by KDB; the program's own trap handler
                    456:    gets to handle then.  */
                    457: 
                    458: #define FAULT_CODE_ORIGIN 0
                    459: #define FAULT_CODE_UNITS 4
                    460: #define FAULT_TABLE    \
                    461: { 0, 0, 0, 0, SIGTRAP, 0, 0, 0, \
                    462:   0, SIGTRAP, 0, 0, 0, 0, 0, SIGKILL, \
                    463:   0, 0, 0, 0, 0, 0, 0, 0, \
                    464:   SIGILL }
                    465: 
                    466: #ifndef HPUX_ASM
                    467: 
                    468: /* Start running with a stack stretching from BEG to END.
                    469:    BEG and END should be symbols meaningful to the assembler.
                    470:    This is used only for kdb.  */
                    471: 
                    472: #define INIT_STACK(beg, end)  \
                    473: { asm (".globl end");         \
                    474:   asm ("movel $ end, sp");      \
                    475:   asm ("clrl fp"); }
                    476: 
                    477: /* Push the frame pointer register on the stack.  */
                    478: #define PUSH_FRAME_PTR        \
                    479:   asm ("movel fp, -(sp)");
                    480: 
                    481: /* Copy the top-of-stack to the frame pointer register.  */
                    482: #define POP_FRAME_PTR  \
                    483:   asm ("movl (sp), fp");
                    484: 
                    485: /* After KDB is entered by a fault, push all registers
                    486:    that GDB thinks about (all NUM_REGS of them),
                    487:    so that they appear in order of ascending GDB register number.
                    488:    The fault code will be on the stack beyond the last register.  */
                    489: 
                    490: #define PUSH_REGISTERS        \
                    491: { asm ("clrw -(sp)");        \
                    492:   asm ("pea 10(sp)");        \
                    493:   asm ("movem $ 0xfffe,-(sp)"); }
                    494: 
                    495: /* Assuming the registers (including processor status) have been
                    496:    pushed on the stack in order of ascending GDB register number,
                    497:    restore them and return to the address in the saved PC register.  */
                    498: 
                    499: #define POP_REGISTERS          \
                    500: { asm ("subil $8,28(sp)");     \
                    501:   asm ("movem (sp),$ 0xffff"); \
                    502:   asm ("rte"); }
                    503: 
                    504: #else /* HPUX_ASM */
                    505: 
                    506: /* Start running with a stack stretching from BEG to END.
                    507:    BEG and END should be symbols meaningful to the assembler.
                    508:    This is used only for kdb.  */
                    509: 
                    510: #define INIT_STACK(beg, end)                                           \
                    511: { asm ("global end");                                                  \
                    512:   asm ("mov.l &end,%sp");                                              \
                    513:   asm ("clr.l %a6"); }
                    514: 
                    515: /* Push the frame pointer register on the stack.  */
                    516: #define PUSH_FRAME_PTR                                                 \
                    517:   asm ("mov.l %fp,-(%sp)");
                    518: 
                    519: /* Copy the top-of-stack to the frame pointer register.  */
                    520: #define POP_FRAME_PTR                                                  \
                    521:   asm ("mov.l (%sp),%fp");
                    522: 
                    523: /* After KDB is entered by a fault, push all registers
                    524:    that GDB thinks about (all NUM_REGS of them),
                    525:    so that they appear in order of ascending GDB register number.
                    526:    The fault code will be on the stack beyond the last register.  */
                    527: 
                    528: #define PUSH_REGISTERS                                                 \
                    529: { asm ("clr.w -(%sp)");                                                        \
                    530:   asm ("pea 10(%sp)");                                                 \
                    531:   asm ("movm.l &0xfffe,-(%sp)"); }
                    532: 
                    533: /* Assuming the registers (including processor status) have been
                    534:    pushed on the stack in order of ascending GDB register number,
                    535:    restore them and return to the address in the saved PC register.  */
                    536: 
                    537: #define POP_REGISTERS                                                  \
                    538: { asm ("subi.l &8,28(%sp)");                                           \
                    539:   asm ("mov.m (%sp),&0xffff");                                         \
                    540:   asm ("rte"); }
                    541: 
                    542: #endif /* HPUX_ASM */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.