Annotation of 43BSDReno/contrib/emacs-18.55/gdb/m-news.h, revision 1.1

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

unix.superglobalmegacorp.com

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