MCPcopy Create free account
hub / github.com/BlitterStudio/amiberry / doexcstack

Function doexcstack

src/cputest.cpp:1295–1362  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1293}
1294
1295static void doexcstack(void)
1296{
1297 bool g1 = generates_group1_exception(regs.ir);
1298 uaecptr original_pc = regs.pc;
1299
1300 doexcstack2();
1301 if (test_exception < 4)
1302 return;
1303
1304 // did we got bus error or address error
1305 // when fetching exception vector?
1306 // (bus error not yet tested)
1307 if (!feature_exception_vectors)
1308 return;
1309
1310 int interrupt = test_exception >= 24 && test_exception < 24 + 8;
1311 int original_exception = test_exception;
1312 // odd exception vector
1313 test_exception = 3;
1314 test_exception_addr = feature_exception_vectors;
1315
1316 // store original exception stack (which may not be complete)
1317 uae_u8 *sf = test_memory + test_memory_size + EXTRA_RESERVED_SPACE - exception_stack_frame_size;
1318 exception_extra_frame_size = exception_stack_frame_size;
1319 exception_extra_frame_type = original_exception;
1320 memcpy(exception_extra_frame, sf, exception_extra_frame_size);
1321
1322 MakeSR();
1323 regs.sr |= 0x2000;
1324 regs.sr &= ~(0x8000 | 0x4000);
1325 MakeFromSR();
1326
1327 regs.pc = original_exception * 4;
1328
1329 int flags = 0;
1330 if (cpu_lvl == 1) {
1331 // IF = 1
1332 flags |= 0x40000;
1333 // low word of address
1334 regs.irc = (uae_u16)test_exception_addr;
1335 // low word of address
1336 regs.read_buffer = regs.irc;
1337 // vector offset (not vbr + offset)
1338 regs.write_buffer = original_exception * 4;
1339 regs.pc = original_pc;
1340 }
1341
1342 if (interrupt) {
1343 regs.intmask = original_exception - 24;
1344 regs.ir = original_exception;
1345 if (cpu_lvl == 0) {
1346 flags |= 0x10000 | 0x20000;
1347 } else {
1348 flags |= 0x20000;
1349 }
1350 if (cpu_lvl < 5) {
1351 regs.m = 0;
1352 }

Callers 15

op_illg_1_noretFunction · 0.85
op_unimplFunction · 0.85
exception2_fetchFunction · 0.85
exception2_fetch_opcodeFunction · 0.85
exception2_readFunction · 0.85
exception2_writeFunction · 0.85
exception3_readFunction · 0.85
exception3_writeFunction · 0.85
exception3_read_prefetchFunction · 0.85
ExceptionFunction · 0.85

Calls 5

doexcstack2Function · 0.85
MakeSRFunction · 0.70
MakeFromSRFunction · 0.70
exception3_readFunction · 0.70

Tested by

no test coverage detected