| 1 | // |
| 2 | // exceptionvectortable.cpp - Exception Vector Table |
| 3 | // |
| 4 | // by Jean-Paul Mari |
| 5 | // |
| 6 | // JPM = Jean-Paul Mari <djipi.mari@gmail.com> |
| 7 | // |
| 8 | // Who When What |
| 9 | // --- ---------- ----------------------------------------------------------- |
| 10 | // JPM 05/09/2017 Created this file |
| 11 | // |
| 12 | |
| 13 | // STILL TO DO: |
| 14 | // Better display presentation |
| 15 | // |
| 16 | |
| 17 | #include "debugger/exceptionvectortablebrowser.h" |
| 18 | #include "memory.h" |
| 19 | #include "debugger/DBGManager.h" |
| 20 | |
| 21 | |
| 22 | // |
| 23 | struct ExceptionVectorTable |
| 24 | { |
| 25 | size_t VectorNumber; |
| 26 | size_t Address; |
| 27 | const char *ExceptionName; |
| 28 | }S_ExceptionVectorTable; |
| 29 | |
| 30 | |
| 31 | ExceptionVectorTable TabExceptionVectorTable[] = { |
| 32 | { 0, 0x000000, "RESET - Initial SSP" }, |
| 33 | { 1, 0x000004, "RESET - Initial PC" }, |
| 34 | { 2, 0x000008, "Bus error" }, |
| 35 | { 3, 0x00000C, "Address error" }, |
| 36 | { 4, 0x000010, "Illegal instruction" }, |
| 37 | { 5, 0x000014, "Division by zero" }, |
| 38 | { 6, 0x000018, "CHK instruction" }, |
| 39 | { 7, 0x00001C, "TRAPV instruction" }, |
| 40 | { 8, 0x000020, "Privilege violation" }, |
| 41 | { 9, 0x000024, "Trace" }, |
| 42 | { 10, 0x000028, "Unimplemented instruction" }, |
| 43 | { 11, 0x00002C, "Unimplemented instruction" }, |
| 44 | { 12, 0x000030, "Reserved by Motorola" }, |
| 45 | { 13, 0x000034, "Reserved by Motorola" }, |
| 46 | { 14, 0x000038, "Reserved by Motorola" }, |
| 47 | { 15, 0x00003C, "Uninitialised interrupt vector" }, |
| 48 | { 16, 0x000040, "Reserved by Motorola" }, |
| 49 | { 17, 0x000044, "Reserved by Motorola" }, |
| 50 | { 18, 0x000048, "Reserved by Motorola" }, |
| 51 | { 19, 0x00004C, "Reserved by Motorola" }, |
| 52 | { 20, 0x000050, "Reserved by Motorola" }, |
| 53 | { 21, 0x000054, "Reserved by Motorola" }, |
| 54 | { 22, 0x000058, "Reserved by Motorola" }, |
| 55 | { 23, 0x00005C, "Reserved by Motorola" }, |
| 56 | { 24, 0x000060, "Spurious interrupt" }, |
| 57 | { 25, 0x000064, "Level 1 interrupt autovector" }, |
| 58 | { 26, 0x000068, "Level 2 interrupt autovector" }, |
| 59 | { 27, 0x00006C, "Level 3 interrupt autovector" }, |
| 60 | { 28, 0x000070, "Level 4 interrupt autovector" }, |
| 61 | { 29, 0x000074, "Level 5 interrupt autovector" }, |
| 62 | { 30, 0x000078, "Level 6 interrupt autovector" }, |
| 63 | { 31, 0x00007C, "Level 7 interrupt autovector" }, |
| 64 | { 32, 0x000080, "TRAP #0 instruction" }, |
| 65 | { 33, 0x000084, "TRAP #1 instruction" }, |
| 66 | { 34, 0x000088, "TRAP #2 instruction" }, |
| 67 | { 35, 0x00008C, "TRAP #3 instruction" }, |
| 68 | { 36, 0x000090, "TRAP #4 instruction" }, |
| 69 | { 37, 0x000094, "TRAP #5 instruction" }, |
| 70 | { 38, 0x000098, "TRAP #6 instruction" }, |
| 71 | { 39, 0x00009C, "TRAP #7 instruction" }, |
| 72 | { 40, 0x0000A0, "TRAP #8 instruction" }, |
| 73 | { 41, 0x0000A4, "TRAP #9 instruction" }, |
| 74 | { 42, 0x0000A8, "TRAP #10 instruction" }, |
| 75 | { 43, 0x0000AC, "TRAP #11 instruction" }, |
| 76 | { 44, 0x0000B0, "TRAP #12 instruction" }, |
| 77 | { 45, 0x0000B4, "TRAP #13 instruction" }, |
| 78 | { 46, 0x0000B8, "TRAP #14 instruction" }, |
| 79 | { 47, 0x0000BC, "TRAP #15 instruction" }, |
| 80 | { 48, 0x0000C0, "Reserved by Motorola" }, |
| 81 | { 49, 0x0000C4, "Reserved by Motorola" }, |
| 82 | { 50, 0x0000C8, "Reserved by Motorola" }, |
| 83 | { 51, 0x0000CC, "Reserved by Motorola" }, |
| 84 | { 52, 0x0000D0, "Reserved by Motorola" }, |
| 85 | { 53, 0x0000D4, "Reserved by Motorola" }, |
| 86 | { 54, 0x0000D8, "Reserved by Motorola" }, |
| 87 | { 55, 0x0000DC, "Reserved by Motorola" }, |
| 88 | { 56, 0x0000E0, "Reserved by Motorola" }, |
| 89 | { 57, 0x0000E4, "Reserved by Motorola" }, |
| 90 | { 58, 0x0000E8, "Reserved by Motorola" }, |
| 91 | { 59, 0x0000EC, "Reserved by Motorola" }, |
| 92 | { 60, 0x0000F0, "Reserved by Motorola" }, |
| 93 | { 61, 0x0000F4, "Reserved by Motorola" }, |
| 94 | { 62, 0x0000F8, "Reserved by Motorola" }, |
| 95 | { 63, 0x0000FC, "Reserved by Motorola" }, |
| 96 | { 64, 0x000100, "User interrupt vectors" }, |
| 97 | { 255, 0x0003FC, "User interrupt vectors" } |
| 98 | }; |
| 99 | |
| 100 | |
| 101 | ExceptionVectorTableBrowserWindow::ExceptionVectorTableBrowserWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt::Dialog), |
| 102 | layout(new QVBoxLayout), text(new QTextBrowser), |
| 103 | refresh(new QPushButton(tr("Refresh"))) |
| 104 | { |
| 105 | setWindowTitle(tr("Exception Vector Table")); |
| 106 | |
| 107 | QHBoxLayout *hbox1 = new QHBoxLayout; |
| 108 | hbox1->addWidget(refresh); |
| 109 | |
| 110 | QFont fixedFont("Lucida Console", 8, QFont::Normal); |
| 111 | fixedFont.setStyleHint(QFont::TypeWriter); |
| 112 | text->setFont(fixedFont); |
| 113 | setLayout(layout); |
| 114 | |
| 115 | layout->addWidget(text); |
| 116 | layout->addWidget(refresh); |
| 117 | |
| 118 | connect(refresh, SIGNAL(clicked()), this, SLOT(RefreshContents())); |
| 119 | } |
| 120 | |
| 121 | |
| 122 | // |
| 123 | ExceptionVectorTableBrowserWindow::~ExceptionVectorTableBrowserWindow(void) |
| 124 | { |
| 125 | } |
| 126 | |
| 127 | |
| 128 | // |
| 129 | void ExceptionVectorTableBrowserWindow::RefreshContents(void) |
| 130 | { |
| 131 | char string[1024]; |
| 132 | QString ExceptionVector; |
| 133 | size_t i; |
| 134 | |
| 135 | if (isVisible()) |
| 136 | { |
| 137 | for (i = 0; i < (sizeof(TabExceptionVectorTable) / sizeof(ExceptionVectorTable)); i++) |
| 138 | { |
| 139 | sprintf(string, "%03i : 0x%06X | 0x%06X | %s<br>", (unsigned int)TabExceptionVectorTable[i].VectorNumber, (unsigned int)TabExceptionVectorTable[i].Address, GET32(jaguarMainRAM, TabExceptionVectorTable[i].Address), TabExceptionVectorTable[i].ExceptionName); |
| 140 | ExceptionVector += QString(string); |
| 141 | } |
| 142 | |
| 143 | text->clear(); |
| 144 | text->setText(ExceptionVector); |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | |
| 149 | void ExceptionVectorTableBrowserWindow::keyPressEvent(QKeyEvent * e) |
| 150 | { |
| 151 | if (e->key() == Qt::Key_Escape) |
| 152 | { |
| 153 | hide(); |
| 154 | } |
| 155 | } |