Commit | Line | Data |
---|---|---|
cf76e892 JPM |
1 | // |
2 | // exceptionvectortable.cpp - All Watch | |
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 | // | |
15 | ||
5fe21518 | 16 | #include "debugger/exceptionvectortablebrowser.h" |
cf76e892 | 17 | #include "memory.h" |
5fe21518 | 18 | #include "debugger/DBGManager.h" |
cf76e892 JPM |
19 | |
20 | ||
21 | // | |
22 | struct ExceptionVectorTable | |
23 | { | |
24 | size_t VectorNumber; | |
25 | size_t Address; | |
26 | const char *ExceptionName; | |
27 | }S_ExceptionVectorTable; | |
28 | ||
29 | ||
30 | ExceptionVectorTable TabExceptionVectorTable[] = { | |
31 | { 0, 0x000000, "RESET - Initial SSP" }, | |
32 | { 1, 0x000004, "RESET - Initial PC" }, | |
33 | { 2, 0x000008, "Bus error" }, | |
34 | { 3, 0x00000C, "Address error" }, | |
35 | { 4, 0x000010, "Illegal instruction" }, | |
36 | { 5, 0x000014, "Division by zero" }, | |
37 | { 6, 0x000018, "CHK instruction" }, | |
38 | { 7, 0x00001C, "TRAPV instruction" }, | |
39 | { 8, 0x000020, "Privilege violation" }, | |
40 | { 9, 0x000024, "Trace" }, | |
41 | { 10, 0x000028, "Unimplemented instruction" }, | |
42 | { 11, 0x00002C, "Unimplemented instruction" }, | |
43 | { 12, 0x000030, "Reserved by Motorola" }, | |
44 | { 13, 0x000034, "Reserved by Motorola" }, | |
45 | { 14, 0x000038, "Reserved by Motorola" }, | |
46 | { 15, 0x00003C, "Uninitialised interrupt vector" }, | |
47 | { 16, 0x000040, "Reserved by Motorola" }, | |
48 | { 17, 0x000044, "Reserved by Motorola" }, | |
49 | { 18, 0x000048, "Reserved by Motorola" }, | |
50 | { 19, 0x00004C, "Reserved by Motorola" }, | |
51 | { 20, 0x000050, "Reserved by Motorola" }, | |
52 | { 21, 0x000054, "Reserved by Motorola" }, | |
53 | { 22, 0x000058, "Reserved by Motorola" }, | |
54 | { 23, 0x00005C, "Reserved by Motorola" }, | |
55 | { 24, 0x000060, "Spurious interrupt" }, | |
56 | { 25, 0x000064, "Level 1 interrupt autovector" }, | |
57 | { 26, 0x000068, "Level 2 interrupt autovector" }, | |
58 | { 27, 0x00006C, "Level 3 interrupt autovector" }, | |
59 | { 28, 0x000070, "Level 4 interrupt autovector" }, | |
60 | { 29, 0x000074, "Level 5 interrupt autovector" }, | |
61 | { 30, 0x000078, "Level 6 interrupt autovector" }, | |
62 | { 31, 0x00007C, "Level 7 interrupt autovector" }, | |
63 | { 32, 0x000080, "TRAP #0 instruction" }, | |
64 | { 33, 0x000084, "TRAP #1 instruction" }, | |
65 | { 34, 0x000088, "TRAP #2 instruction" }, | |
66 | { 35, 0x00008C, "TRAP #3 instruction" }, | |
67 | { 36, 0x000090, "TRAP #4 instruction" }, | |
68 | { 37, 0x000094, "TRAP #5 instruction" }, | |
69 | { 38, 0x000098, "TRAP #6 instruction" }, | |
70 | { 39, 0x00009C, "TRAP #7 instruction" }, | |
71 | { 40, 0x0000A0, "TRAP #8 instruction" }, | |
72 | { 41, 0x0000A4, "TRAP #9 instruction" }, | |
73 | { 42, 0x0000A8, "TRAP #10 instruction" }, | |
74 | { 43, 0x0000AC, "TRAP #11 instruction" }, | |
75 | { 44, 0x0000B0, "TRAP #12 instruction" }, | |
76 | { 45, 0x0000B4, "TRAP #13 instruction" }, | |
77 | { 46, 0x0000B8, "TRAP #14 instruction" }, | |
78 | { 47, 0x0000BC, "TRAP #15 instruction" }, | |
79 | { 48, 0x0000C0, "Reserved by Motorola" }, | |
80 | { 49, 0x0000C4, "Reserved by Motorola" }, | |
81 | { 50, 0x0000C8, "Reserved by Motorola" }, | |
82 | { 51, 0x0000CC, "Reserved by Motorola" }, | |
83 | { 52, 0x0000D0, "Reserved by Motorola" }, | |
84 | { 53, 0x0000D4, "Reserved by Motorola" }, | |
85 | { 54, 0x0000D8, "Reserved by Motorola" }, | |
86 | { 55, 0x0000DC, "Reserved by Motorola" }, | |
87 | { 56, 0x0000E0, "Reserved by Motorola" }, | |
88 | { 57, 0x0000E4, "Reserved by Motorola" }, | |
89 | { 58, 0x0000E8, "Reserved by Motorola" }, | |
90 | { 59, 0x0000EC, "Reserved by Motorola" }, | |
91 | { 60, 0x0000F0, "Reserved by Motorola" }, | |
92 | { 61, 0x0000F4, "Reserved by Motorola" }, | |
93 | { 62, 0x0000F8, "Reserved by Motorola" }, | |
94 | { 63, 0x0000FC, "Reserved by Motorola" }, | |
95 | { 64, 0x000100, "User interrupt vectors" }, | |
96 | { 255, 0x0003FC, "User interrupt vectors" } | |
97 | }; | |
98 | ||
99 | ||
100 | ExceptionVectorTableBrowserWindow::ExceptionVectorTableBrowserWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt::Dialog), | |
101 | layout(new QVBoxLayout), text(new QTextBrowser), | |
102 | // layout(new QVBoxLayout), text(new QLabel), | |
103 | refresh(new QPushButton(tr("Refresh"))) | |
104 | // address(new QLineEdit), | |
105 | // go(new QPushButton(tr("Go"))), | |
106 | // memBase(0), | |
107 | // NbWatch(0), | |
108 | // PtrWatchInfo(NULL) | |
109 | { | |
110 | setWindowTitle(tr("Exception Vector Table")); | |
111 | ||
112 | // address->setInputMask("hhhhhh"); | |
113 | QHBoxLayout *hbox1 = new QHBoxLayout; | |
114 | hbox1->addWidget(refresh); | |
115 | // hbox1->addWidget(address); | |
116 | // hbox1->addWidget(go); | |
117 | ||
118 | // Need to set the size as well... | |
119 | // resize(560, 480); | |
120 | ||
121 | QFont fixedFont("Lucida Console", 8, QFont::Normal); | |
122 | // QFont fixedFont("", 8, QFont::Normal); | |
123 | fixedFont.setStyleHint(QFont::TypeWriter); | |
124 | text->setFont(fixedFont); | |
125 | //// layout->setSizeConstraint(QLayout::SetFixedSize); | |
126 | setLayout(layout); | |
127 | ||
128 | layout->addWidget(text); | |
129 | layout->addWidget(refresh); | |
130 | // layout->addLayout(hbox1); | |
131 | ||
132 | connect(refresh, SIGNAL(clicked()), this, SLOT(RefreshContents())); | |
133 | // connect(go, SIGNAL(clicked()), this, SLOT(GoToAddress())); | |
134 | } | |
135 | ||
136 | ||
137 | // | |
138 | ExceptionVectorTableBrowserWindow::~ExceptionVectorTableBrowserWindow(void) | |
139 | { | |
140 | // NbWatch = 0; | |
141 | // free(PtrWatchInfo); | |
142 | } | |
143 | ||
144 | ||
145 | // | |
146 | void ExceptionVectorTableBrowserWindow::RefreshContents(void) | |
147 | { | |
148 | char string[1024]; | |
149 | QString ExceptionVector; | |
150 | size_t i; | |
151 | ||
152 | if (isVisible()) | |
153 | { | |
154 | for (i = 0; i < (sizeof(TabExceptionVectorTable) / sizeof(ExceptionVectorTable)); i++) | |
155 | { | |
156 | 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); | |
157 | ExceptionVector += QString(string); | |
158 | } | |
159 | ||
160 | text->clear(); | |
161 | text->setText(ExceptionVector); | |
162 | } | |
163 | } | |
164 | ||
165 | ||
166 | #if 0 | |
167 | void ExceptionVectorTableBrowserWindow::keyPressEvent(QKeyEvent * e) | |
168 | { | |
169 | if (e->key() == Qt::Key_Escape) | |
170 | hide(); | |
171 | else if (e->key() == Qt::Key_PageUp) | |
172 | { | |
173 | memBase -= 480; | |
174 | ||
175 | if (memBase < 0) | |
176 | memBase = 0; | |
177 | ||
178 | RefreshContents(); | |
179 | } | |
180 | else if (e->key() == Qt::Key_PageDown) | |
181 | { | |
182 | memBase += 480; | |
183 | ||
184 | if (memBase > (0x200000 - 480)) | |
185 | memBase = 0x200000 - 480; | |
186 | ||
187 | RefreshContents(); | |
188 | } | |
189 | else if (e->key() == Qt::Key_Up || e->key() == Qt::Key_Minus) | |
190 | { | |
191 | memBase -= 16; | |
192 | ||
193 | if (memBase < 0) | |
194 | memBase = 0; | |
195 | ||
196 | RefreshContents(); | |
197 | } | |
198 | else if (e->key() == Qt::Key_Down || e->key() == Qt::Key_Equal) | |
199 | { | |
200 | memBase += 16; | |
201 | ||
202 | if (memBase > (0x200000 - 480)) | |
203 | memBase = 0x200000 - 480; | |
204 | ||
205 | RefreshContents(); | |
206 | } | |
207 | } | |
208 | #endif | |
209 | ||
210 | ||
211 | #if 0 | |
212 | void ExceptionVectorTableBrowserWindow::GoToAddress(void) | |
213 | { | |
214 | bool ok; | |
215 | QString newAddress = address->text(); | |
216 | memBase = newAddress.toUInt(&ok, 16); | |
217 | RefreshContents(); | |
218 | } | |
219 | #endif | |
220 |