Commit Graph

103 Commits

Author SHA1 Message Date
joevt
177098c957 debugger: Fix interrupt signal.
Typing Control-C in Terminal app causes an interrupt signal that should enter the DPPC debugger but this only worked once since the signal handler never returned. Even if the signal handler reenabled the signal somehow, it calls enter_debugger recursively which is strange since the earlier calls to enter_debugger would never return.

Now the signal handler just sets a flag (power_on) which can be used to exit any loop (emulator loops, stepping loops, disassembly loops, dumping loops).

Main always calls enter_debugger now which calls the ppc_exec loop. The power_on flag will exit the ppc_exec loop to return to the debugger. Recursion of enter_debugger is eliminated except for calls to loguru's ABORT_F.

An enum power_off_reason is used to indicate why the power_on flag is set to false and to determine what happens next.
2024-03-02 12:57:02 -07:00
joevt
888df0ac53 debugger: Add more register names for reg_op.
So the debugger can output their values.
2024-02-29 07:46:16 -07:00
dingusdev
d71a213c4b Continued clean-up, part 3 2024-02-22 19:46:34 -07:00
dingusdev
8e9123bdce Slightly less clumsy check for compiler 2024-02-21 07:14:21 -07:00
joevt
cf4ce01ddd ppcopcodes: set DSISR for alignment exception. 2024-02-20 01:22:55 +01:00
joevt
ff895aa8a4 ppcfpopcodes: Remove some globals.
ppc_result64_d and ppc_dblresult64_d don't need to be globals. The rest are unused.
2024-02-10 13:56:07 -07:00
joevt
4fcb357e2f ppcfpopcodes: add 601 variant of mffs. 2024-02-10 12:51:48 -07:00
joevt
ddb5259464 ppcexec: Make illegal operations per CPU model. 2024-02-10 12:51:00 -07:00
dingusdev
a5ce6a806f CPU clean-up 2024-01-07 17:04:51 -07:00
dingusdev
f3a759c80d CPU code clean-up 2024-01-05 15:11:37 -07:00
joevt
0100e67ebf ppcfpopcodes: Fix fctiw/fctiwz. 2024-01-03 01:07:53 +01:00
Maxim Poliakovski
cb85d358d1 Remove unused globals. 2024-01-02 17:51:12 +01:00
Maxim Poliakovski
750f91e339 ppcemu.h: add enum for XER bits. 2023-12-19 14:57:41 +01:00
Maxim Poliakovski
d24b5d21b8 CRx_bit enum stores masks for now. 2023-12-19 14:27:57 +01:00
Maxim Poliakovski
9dbfde1a4c Cleanup previous commit. 2023-12-19 13:15:10 +01:00
joevt
7f229b0fe8 ppcfpopcodes: Fix fcmpo/fcmpu.
It was always changing CR1 (starting at CR bit 4) instead of the CR selected by crfD.
Also, it was clearing all but the FL,FG,FE,FU bits of FPRF of FPSCR.
2023-12-19 13:15:10 +01:00
Maxim Poliakovski
99ae0c3d31 ppcemu.h: add PVR definition for MPC604e. 2023-12-03 20:05:19 +01:00
Mihai Parparita
6582536591 Inline ppc_set_cur_instruction
It's used in the main emulator loop (ppc_exec_inner), and the function
call overhead adds up.

By inlining it, time to boot to the Finder using a 7.1.2 install CD
and a 6100 ROM goes from ~6700ms to ~6400ms (with clang 14 on a
M2 Max)
2023-12-02 15:12:02 -08:00
Maxim Poliakovski
a1d8f8aa4e ppctests: fix test cases with SNaN/QNaN operands. 2023-11-30 17:44:46 +01:00
Maxim Poliakovski
6abb07e61b Add rounding control for the host FPU. 2023-11-30 12:06:44 +01:00
Maxim Poliakovski
d49d03846f ppcemu: fix and beatify FPSCR enum. 2023-11-30 12:06:44 +01:00
dingusdev
7835aec034 Further CPU cleanup 2023-11-21 08:06:50 -07:00
dingusdev
d92ae6136a CPU code clean-up in progress
Happened to fix one case in the process.
2023-11-19 17:56:30 -07:00
Maxim Poliakovski
c47cbb354d Add is_601 flag for selecting MPC601 specific behavior. 2023-09-18 21:20:59 +02:00
joevt
300965ab10 Decrementer exception changes. 2023-08-10 00:46:04 +02:00
dingusdev
4364c89fd4 Slight clean-up for execution type 2023-06-19 22:36:27 -07:00
Maxim Poliakovski
597c077b19 Implement PPC decrementer. 2023-02-15 02:36:40 +01:00
Maxim Poliakovski
7ba8921649 ppcemu: add PVR for 603ev. 2022-12-23 17:19:46 +01:00
joevt
6f0d3b48ba Fix TBR range
Fixed an issue where TBR doesn't have full 64-bit range. The original calculation was 64 bit and ended with a ÷ 10^9. This means the max for the upper 32 bits is 2^32/10^9 = 4. The solution is to use a multiplication method that supports a 96 bit product. core/mathutils.h contains functions for that. TBR driving frequency is assumed to be less than 1 GHz. Some minor modification is required for future > 1 GHz support.
2022-09-15 21:22:37 -07:00
joevt
01d7d6bac3 Make accessing RTC or TBR not affect the other
Fixed an issue where the following would cause inconsistent results (tb in the left column would sometimes decrement instead of always incrementing):
2 0 do 2 0 do cr tb@ 8 u.r ." ." 8 u.r loop 2 0 do cr 12 spaces rtc@ 8 u.r ." ." 8 u.r loop 2 0 do cr tb@ 8 u.r ." ." 8 u.r space rtc@ 8 u.r ." ." 8 u.r loop loop

RTC and TBR could not be used simultaneously because they are both incremented by an amount based on the last time stamp but that time stamp can be changed by accessing either RTC or TBR. The solution is to have a different time stamp for each.
2022-09-15 20:21:54 -07:00
Maxim Poliakovski
b38d00ce2d cpu/ppc: improve support for external interrupts.
Support generating of external interrupt exception
in MTMSR and RFI when MSR[EE] is re-enabled and
external interrupt still pending.
2022-08-24 14:15:47 +02:00
Maxim Poliakovski
8c0f391548 ppcemu: add enums for HID0 and HID1. 2022-08-15 14:45:55 +02:00
Maxim Poliakovski
b47de8b042 Implement MPC601 style RTC. 2022-05-21 14:51:27 +02:00
Maxim Poliakovski
646880cbf2 Interpreter loop is now controlled by exec_flags. 2022-03-02 16:55:20 +01:00
Maxim Poliakovski
f1ed56ae9a debugger: a couple of cosmetic improvements. 2022-02-26 10:57:13 +01:00
Maxim Poliakovski
d8c3cfc38e Fix next instruction address after external exceptions. 2022-01-20 01:38:41 +01:00
Maxim Poliakovski
aefc66d118 Fix external exception processing. 2022-01-10 17:56:24 +01:00
Maxim Poliakovski
339db4a078 Add timers management. 2022-01-10 17:56:24 +01:00
Maxim Poliakovski
087402290d Implement virtual time based on instruction counting. 2021-12-20 00:10:02 +01:00
dingusdev
c2a63bab09 FP Opcode Test Fixes 2021-10-30 16:43:13 -07:00
Maxim Poliakovski
c0cd6eb38f Add missing licence headers, update license date. 2021-10-23 21:00:31 +02:00
Maxim Poliakovski
9329d56d83 Move devices into dedicated subdirectories. 2021-10-23 20:17:47 +02:00
dingusdev
7919cd0590
Merge pull request #21 from dingusdev/floating-point
Floating point fixes. Rehauled floating-point emulation code. Fixed a test suite for floating points.
2021-10-19 07:18:21 -07:00
dingusdev
fb277945c2 Floating point test fixes 2021-10-19 07:16:15 -07:00
Maxim Poliakovski
e53296f7a9 Implement all required context-synchronizing events. 2021-10-13 20:58:09 +02:00
dingusdev
5672a154cb Floating-point refactor, part 3
Condensed code to shorten enum names and remove casting.

Condensed mffs and partially fixed NAN checks for FADD(S).
2021-10-10 07:48:49 -07:00
dingusdev
2d65ed47fc Floating point overhaul, part 2
Further formatting fixes. Removed obsoleted separation definitions. Fixed rounding to nearest.
2021-10-09 19:42:25 -07:00
dingusdev
e344b089b3 Floating point overhaul, part 1
Cleaned up formatting and reworked the INF/NAN checks
2021-10-09 15:08:53 -07:00
dingusdev
f605c484dd ecowx and eciwx added 2021-10-05 17:40:09 -07:00
Maxim Poliakovski
22827642e4 ppcmmu: implement 601-style BAT. 2021-09-27 12:37:35 +02:00