Commit Graph

39 Commits

Author SHA1 Message Date
joevt 82a48899f0 Change ppc_opcode_grabber to a variable. 2025-02-10 07:01:32 -07:00
Mihai Parparita 134339ae9d Mitigate performance impact of respecting FP bit
In #135 we switched from a static OpcodeGrabber table to a
curOpcodeGrabber pointer in ppc_main_opcode. This results in an extra
indirection (as far as generated assembly having an additional load),
which reduces execution speed.

Switch to making the opcode grabber into a parameter to
ppc_main_opcode, and make ppc_exec_inner keep it up to date (via an
EXEF_OPCODE exception flag).

Also fixes FPU instructions in ppctests - we now need to set the FP
MSR bit when initializing the CPU.
2025-01-25 17:58:31 -08:00
Mihai Parparita acc6e77ec5 Respect FP bit in MSR when running floating point instructions
Rather than running them normally, they should trigger a "no FPU"
exception. This appears to be required to allow correct graphical
rendering under Mac OS X - the FP bit cleared via mtmsr and rfi
instructions and something else appears to be relying on the exception
to be thrown.

Implemented by maintaining a parallel version of the OpcodeGrabber
table (OpcodeGrabberNoFPU) which contains alternate implementations
for all the floating point instructions. We switch the table whenever
the MSR value changes. This should minimize the overhead of doing
these checks.
2025-01-20 23:19:37 -08:00
Mihai Parparita 564c43c907 Remove ppc_cur_instruction global variable
Replace it wth an explicit opcode parameter that is passed around. That
is both slightly easier to reason about (to trace where it comes from)
and slightly faster, since it can be read from a register.

On my machine takes booting to "Welcome to Macintosh" being output in
a verbose boot of Mac OS X 10.2.8 from 31.8s to 30.6s (average of 5
runs, measured using deterministic mode and looking at when execution
reaches PC 0x90004a88).
2024-11-28 23:41:38 +01:00
dingusdev 02c8c8cde0 Fix bench + test compilation (again) 2024-09-30 20:35:33 -07:00
dingusdev 8c42685e26 Slight compile fix 2024-09-24 21:17:48 -07:00
joevt 55d7c8f09d bench1 fix 2 2024-09-24 21:07:51 -07:00
joevt e14ede2510 bench1: Add benchmark for ppc_exec. 2024-09-24 21:07:35 -07:00
joevt bb3e89e3af ppcexceptions: Remove unused label. 2024-09-03 06:09:10 -07:00
joevt 6267685920 ppcexec: Make EXEF_TIMER separate variable. 2024-03-31 12:15:48 -07:00
joevt cd77e361ab ppcexceptions: Use MSR enums. 2024-03-24 18:53:05 -07:00
dingusdev 9dad9ea38b Revert Memory exceptions use mmu handler. 2024-02-20 18:22:55 -07:00
joevt 61b29f6fab ppcexceptions: Memory exceptions use mmu handler. 2024-02-20 18:07:04 -07:00
joevt cf4ce01ddd ppcopcodes: set DSISR for alignment exception. 2024-02-20 01:22:55 +01:00
joevt 0100e67ebf ppcfpopcodes: Fix fctiw/fctiwz. 2024-01-03 01:07:53 +01:00
dingusdev 4753ba5361 Continued clean-up 2023-11-23 16:56:58 -07:00
joevt 5b366e592c Fix spelling. 2023-10-02 15:06:51 +02:00
joevt 300965ab10 Decrementer exception changes. 2023-08-10 00:46:04 +02:00
Maxim Poliakovski d2e7c9a5df ppcexceptions: fix next address for decrementer exceptions. 2023-08-09 12:53:48 +02:00
Maxim Poliakovski 25150268cd ppcexceptions: fix ISI exception target address. 2023-07-10 14:06:20 +02:00
joevt 19adb54cd8 Fix compiler warnings.
These were detected by github Actions but not by Xcode.
2023-01-11 01:17:13 -08:00
Maxim Poliakovski 646880cbf2 Interpreter loop is now controlled by exec_flags. 2022-03-02 16:55:20 +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 c0cd6eb38f Add missing licence headers, update license date. 2021-10-23 21:00:31 +02:00
Maxim Poliakovski e53296f7a9 Implement all required context-synchronizing events. 2021-10-13 20:58:09 +02:00
Maxim Poliakovski a5ddb51a3b ppcmmu: initial TLB implementation for reads. 2021-05-16 00:53:15 +02:00
Maxim Poliakovski 6f9ee10de5 Rework PPC CPU profiler. 2021-04-29 02:26:17 +02:00
Waqar Ahmed 0ab9380be3 clang-format everything 2020-05-12 23:55:45 +05:00
dingusdev 4ceed27ccf Simplified prog_counter back to pc 2020-03-05 07:48:10 -07:00
dingusdev e31f7873f5 Fixed redunant variable names for PPC emulation. 2020-03-04 21:29:04 -07:00
Maxim Poliakovski 7978d9d59f Fix SRR0 setting in exception handler. 2020-03-01 17:24:50 +01:00
dingusdev 354409812e Updating files with proper licensing header 2020-02-28 09:04:28 -07:00
Maxim Poliakovski 461d859e73 ppcmmu: add debug memory reading function.
This function saves and restores the MMU state
so no invalid user input can break CPU execution.
2020-02-23 16:41:58 +01:00
Maxim Poliakovski fe57beb983 Revert "Disassembler added"
This reverts commit 37078ddfe1.
2020-02-04 14:20:10 +01:00
dingusdev 37078ddfe1 Disassembler added
Created by maximumspatium, with some additions by me.
2020-02-03 08:03:24 -07:00
dingusdev aa20d64b48 SPRs now use symbolic names 2020-01-27 20:39:23 -07:00
dingusdev 6dd8d55577 Profiler + Missing Instruction Added 2020-01-14 20:50:01 -07:00
Maxim Poliakovski 2d5e436ad4 Refactor PPC exception handling, part 1. 2020-01-12 02:35:54 +01:00