|
|
1.1 ! root 1: /* ! 2: * code to print the name of a signal ! 3: * machine-dependent for less than obvious reasons ! 4: * this for mc68000 ! 5: */ ! 6: ! 7: #include "defs.h" ! 8: #include "space.h" ! 9: #include <signal.h> ! 10: #include <sys/param.h> ! 11: #include <sys/dir.h> ! 12: #include <sys/user.h> ! 13: ! 14: static char *signals[] = { ! 15: "", ! 16: "hangup", ! 17: "interrupt", ! 18: "quit", ! 19: "illegal instruction", ! 20: "trace/BPT", ! 21: "IOT", ! 22: "EMT", ! 23: "floating exception", ! 24: "killed", ! 25: "bus error", ! 26: "memory fault", ! 27: "bad system call", ! 28: "broken pipe", ! 29: "alarm call", ! 30: "terminated", ! 31: "signal 16", ! 32: "stopped", ! 33: "stop (tty)", ! 34: "continue (signal)", ! 35: "child termination", ! 36: "stop (tty input)", ! 37: "stop (tty output)", ! 38: "input available (signal)", ! 39: "cpu timelimit", ! 40: "file sizelimit", ! 41: "signal 26", ! 42: "signal 27", ! 43: "signal 28", ! 44: "signal 29", ! 45: "signal 30", ! 46: "signal 31", ! 47: }; ! 48: ! 49: struct faultcode { ! 50: int fcode; ! 51: char *fname; ! 52: }; ! 53: ! 54: static struct faultcode illinames[] = { ! 55: { 0x10, "illegal instruction fault" }, ! 56: { 0x20, "privilege violation fault" }, ! 57: { 0x34, "coprocesser protocol error fault" }, ! 58: { 0x84, "trap #1 fault" }, ! 59: { 0x88, "trap #2 fault" }, ! 60: { 0x8c, "trap #3 fault" }, ! 61: { 0x90, "trap #4 fault" }, ! 62: { 0x94, "trap #5 fault" }, ! 63: { 0x98, "trap #6 fault" }, ! 64: { 0x9c, "trap #7 fault" }, ! 65: { 0xa0, "trap #8 fault" }, ! 66: { 0xa4, "trap #9 fault" }, ! 67: { 0xa8, "trap #10 fault" }, ! 68: { 0xac, "trap #11 fault" }, ! 69: { 0xb0, "trap #12 fault" }, ! 70: { 0xb4, "trap #13 fault" }, ! 71: { 0xb8, "trap #14 fault" }, ! 72: { 0 } ! 73: }; ! 74: ! 75: static struct faultcode emtnames[] = { ! 76: { 0x28, "line 1010 emulator trap" }, ! 77: { 0x2c, "line 1111 emulator trap" }, ! 78: { 0 } ! 79: }; ! 80: ! 81: static struct faultcode fpenames[] = { ! 82: { 0x14, "integer divide by zero" }, ! 83: { 0x18, "CHK CHK2 instruction" }, ! 84: { 0x1c, "TRAPV cpTRAPcc TRAPcc instr" }, ! 85: { 0xc0, "branch or set on unordered cond" }, ! 86: { 0xc4, "floating inexact result" }, ! 87: { 0xc8, "floating divide by zero" }, ! 88: { 0xcc, "floating underflow" }, ! 89: { 0xd0, "floating operand error" }, ! 90: { 0xd4, "floating overflow" }, ! 91: { 0xd8, "floating Not-A-Number" }, ! 92: { 0 } ! 93: }; ! 94: ! 95: sigprint() ! 96: { ! 97: register struct faultcode *fp; ! 98: ! 99: if ((signo>=0) && (signo<sizeof signals/sizeof signals[0])) ! 100: prints(signals[signo]); ! 101: switch (signo) { ! 102: ! 103: case SIGFPE: ! 104: for (fp = fpenames; fp->fcode; fp++) ! 105: if (sigcode == fp->fcode) { ! 106: printf(" (%s)", fp->fname); ! 107: return; ! 108: } ! 109: break; ! 110: ! 111: case SIGEMT: ! 112: for (fp = emtnames; fp->fcode; fp++) ! 113: if (sigcode == fp->fcode) { ! 114: printf(" (%s)", fp->fname); ! 115: return; ! 116: } ! 117: break; ! 118: ! 119: case SIGILL: ! 120: for (fp = illinames; fp->fcode; fp++) ! 121: if (sigcode == fp->fcode) { ! 122: printf(" (%s)", fp->fname); ! 123: return; ! 124: } ! 125: break; ! 126: ! 127: } ! 128: } ! 129: ! 130: printpc() ! 131: { ! 132: ! 133: dot = (ADDR)rtow(rget(PC)); ! 134: psymoff((WORD)dot, INSTSP, "?%16t"); ! 135: printins(SYMF|INSTSP); ! 136: printc(EOR); ! 137: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.