|
|
1.1 ! root 1: /* ! 2: * db/i386/i386db0.c ! 3: * A debugger. ! 4: * i386 global variables and tables. ! 5: */ ! 6: ! 7: #include <sys/ptrace.h> ! 8: #include "i386db.h" ! 9: ! 10: /* ! 11: * Global variables. ! 12: */ ! 13: BIN bin = { TRAP }; /* Breakpoint instruction */ ! 14: int NDP_flag; /* NDP instructions are usable */ ! 15: ADDR_T sys_add; /* Address of op after syscall */ ! 16: int sys_flag; /* Executing a system call */ ! 17: BIN sys_in; /* Instruction after sys call */ ! 18: UREG ureg; /* Child program registers */ ! 19: ! 20: /* ! 21: * Format strings table. ! 22: */ ! 23: char *formtab[4][4] ={ ! 24: "%4d", /* "bd" */ ! 25: "%3u", /* "bu" */ ! 26: "%04o", /* "bo" */ ! 27: "%02X", /* "bx" */ ! 28: "%6d", /* "wd" */ ! 29: "%5u", /* "wu" */ ! 30: "%07o", /* "wo" */ ! 31: "%04X", /* "wx" */ ! 32: "%10ld", /* "ld" */ ! 33: "%11lu", /* "lu" */ ! 34: "%012lo", /* "lo" */ ! 35: "%08lX", /* "lx" */ ! 36: "%8ld", /* "vd" */ ! 37: "%8lu", /* "vu" */ ! 38: "%09lo", /* "vo" */ ! 39: "%06lX" /* "vx" */ ! 40: }; ! 41: ! 42: /* ! 43: * Register name table. ! 44: * Map register names to pseudo-offsets in user segment; cf. <sys/ptrace.h>. ! 45: * This is used to obtain offsets for ptrace() calls to read/write registers. ! 46: * The register name lookup code in i386db1.c/is_reg() also recognizes ! 47: * "xy" as the word register equivalent of dword register "exy". ! 48: * Code using this table does not reference the copy of the child registers ! 49: * kept in ureg. ! 50: * The order in the table corresponds to the order of printing for :r. ! 51: * Other PTRACE_* entries could be recognized but currently are not. ! 52: */ ! 53: REGNAME reg_name[NREGS] = { ! 54: { RF_16, "cs", PTRACE_CS }, ! 55: { RF_1632, "eip", PTRACE_EIP }, ! 56: { RF_16, "ss", PTRACE_SS }, ! 57: { RF_1632, "fw", PTRACE_EFL }, ! 58: { RF_16, "ds", PTRACE_DS }, ! 59: { RF_16, "es", PTRACE_ES }, ! 60: { RF_16, "fs", PTRACE_FS }, ! 61: { RF_16, "gs", PTRACE_GS }, ! 62: { RF_1632, "eax", PTRACE_EAX }, ! 63: { RF_1632, "ebx", PTRACE_EBX }, ! 64: { RF_1632, "ecx", PTRACE_ECX }, ! 65: { RF_1632, "edx", PTRACE_EDX }, ! 66: { RF_1632, "esp", PTRACE_UESP }, /* UESP */ ! 67: { RF_1632, "ebp", PTRACE_EBP }, ! 68: { RF_1632, "edi", PTRACE_EDI }, ! 69: { RF_1632, "esi", PTRACE_ESI }, ! 70: { RF_NDP, "st0", PTRACE_FP_ST0 }, ! 71: { RF_NDP, "st1", PTRACE_FP_ST1 }, ! 72: { RF_NDP, "st2", PTRACE_FP_ST2 }, ! 73: { RF_NDP, "st3", PTRACE_FP_ST3 }, ! 74: { RF_NDP, "st4", PTRACE_FP_ST4 }, ! 75: { RF_NDP, "st5", PTRACE_FP_ST5 }, ! 76: { RF_NDP, "st6", PTRACE_FP_ST6 }, ! 77: { RF_NDP, "st7", PTRACE_FP_ST7 } ! 78: }; ! 79: ! 80: #if 0 ! 81: /* ! 82: * Table of system calls. ! 83: */ ! 84: char *sysitab[NMICALL] ={ ! 85: NULL, ! 86: "exit", ! 87: "fork", ! 88: "read", ! 89: "write", ! 90: "open", ! 91: "close", ! 92: "wait", ! 93: "creat", ! 94: "link", ! 95: "unlink", ! 96: "exece", ! 97: "chdir", ! 98: NULL, ! 99: "mknod", ! 100: "chmod", ! 101: "chown", ! 102: "brk", ! 103: "stat", ! 104: "lseek", ! 105: "getpid", ! 106: "mount", ! 107: "umount", ! 108: "setuid", ! 109: "getuid", ! 110: "stime", ! 111: "ptrace", ! 112: "alarm", ! 113: "fstat", ! 114: "pause", ! 115: "utime", ! 116: NULL, ! 117: NULL, ! 118: "access", ! 119: "nice", ! 120: "ftime", ! 121: "sync", ! 122: "kill", ! 123: NULL, ! 124: NULL, ! 125: NULL, ! 126: "dup", ! 127: "pipe", ! 128: "times", ! 129: "profil", ! 130: "unique", ! 131: "setgid", ! 132: "getgid", ! 133: "signal", ! 134: NULL, ! 135: NULL, ! 136: "acct", ! 137: NULL, ! 138: NULL, ! 139: "ioctl", ! 140: NULL, ! 141: "getegid", ! 142: "geteuid", ! 143: NULL, ! 144: NULL, ! 145: "umask", ! 146: "chroot", ! 147: "setpgrp", ! 148: "getpgrp", ! 149: "sload", ! 150: "suload", ! 151: "fcntl", ! 152: "poll", ! 153: "msgctl", ! 154: "msgget", ! 155: "msgrcv", ! 156: "msgsnd", ! 157: "alarm2", ! 158: "tick" ! 159: }; ! 160: #endif ! 161: ! 162: /* end of db/i386/i386db0.c */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.