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

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

unix.superglobalmegacorp.com

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