Commit Graph

616 Commits

Author SHA1 Message Date
joevt
b512702fbb ppcopcodes: Fix indent in ppc_mtsr. 2024-12-03 06:52:20 -07:00
joevt
47fca9f4ff ppcexec: Fix absolute address comment. 2024-12-03 06:52:09 -07:00
joevt
ee8c912397 poweropcodes: Fix clcs for MPC601.
These output values will pass the current set of risu tests which tests all 32 input values multiple times.
2024-12-03 06:51:56 -07:00
joevt
3fd422008e ppcfpopcodes: Use enums instead of literals. 2024-12-03 06:51:15 -07:00
joevt
bce4c98475 ppcfpopcodes: Fix fdiv for MPC601. 2024-12-03 06:50:57 -07:00
joevt
b45b0a8df4 ppcopcodes: Fix divw for MPC601. 2024-12-03 06:50:17 -07:00
joevt
b8af8d387c ppcopcodes: Fix divu for MPC601. 2024-12-03 06:50:08 -07:00
joevt
84075c5988 ppcopcodes: Fix lswx for MPC601. 2024-12-03 06:49:53 -07:00
dingusdev
35919802f3 Tweak fsel
Inspired by a similar fix toxieainc committed for Supermodel
2024-12-03 06:49:08 -07:00
joevt
80b763ecc3 ppcexec: Fix OP59d.
Some of these accept a 4th register "C" so they exist in the opcode table 32 times.
Some of these don't accept a 4th register "C" so they exist in the opcode table once.
2024-12-03 12:12:56 +01:00
dingusdev
f355fb0dfe
Merge pull request #127 from mihaip/upstream-opcode-dispatcher
ppc: Use a unified opcode lookup table
2024-11-30 12:51:08 -07:00
Mihai Parparita
b759f25d87 ppc: Use a unified opcode lookup table
Instead of a primary opcode lookup table with 64 entries and a few
smaller tables with 4-2048 entries, use a single 64 * 2048 (128K)
entry table to dispatch opcodes.

Helps with performance, since we avoid the function call overhead for
some frequently-used instructions (e.g. branch, integer, floating point).
Saves ~2 seconds from the time to Welcome to Macintosh (same measurement
methodology as #125)

Secondarily also makes opcode registration/decoding a bit more uniform,
and scannable, since it's now all in initialize_ppc_opcode_table.
2024-11-30 20:37:26 +01:00
Maxim Poliakovski
aa17bf06de ppcmmu: implement mem_write_dbg method. 2024-11-30 11:55:16 +01:00
Mihai Parparita
bf92b04d6c debugger: Use a named constant when we don't have a current instruction 2024-11-29 18:33:22 +01: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
Mihai Parparita
2d90aff408 ppc: Remove unncesessary function declarations
ppc_opcode16 and other functions are only needed in the implementation in
ppcexec.cpp, they don't need to be in the header.

fp_return_double and fp_return_uint64 have no uses (as of 2141a72b87)
can can thus be removed altogether.

Similarly ppc_fpu_off has no uses (as of bb3f4e596e)
and can be removed.
2024-11-28 22:12:16 +01:00
joevt
820da037da ppcmacros: Add missing space. 2024-11-28 07:25:23 -07:00
joevt
00f38133e9 ppcfpopcodes: fnabs fix.
fnabs sets the sign bit regardless of nan status.
2024-11-28 07:25:14 -07:00
joevt
e231dc4dec ppcfpopcodes: fabs fix.
fabs clears the sign bit regardless of nan status.
2024-11-28 07:25:06 -07:00
joevt
549cb2284c Revert "Tweaking conditional branch instructions"
This reverts commit 0835e6f9f4.
2024-11-27 08:20:05 -07:00
joevt
d41287c320 ppcfpopcodes: fneg fix.
fneg inverts the sign bit regardless of nan status.
2024-11-27 08:06:31 -07:00
joevt
b38b1731a0 ppcopcodes: Don't change MQ if not MPC601.
MQ should not be writable if not doing MPC601.
Fix is_601 and include_601.
This fixes risu tests.
2024-11-27 07:59:19 -07:00
Maxim Poliakovski
04280ecda4 Revert "Fix LR update in bc instructions"
This reverts commit 5a0a7b12e4.
2024-11-25 21:56:32 +01:00
dingusdev
5a0a7b12e4 Fix LR update in bc instructions
Only executes when the branch path is taken.
2024-11-20 20:53:59 -07:00
dingusdev
0835e6f9f4 Tweaking conditional branch instructions 2024-11-20 18:23:03 -07:00
Mihai Parparita
f65f9b9845 Add a deterministic execution mode
Adds support for a --deterministic command-line option that makes
repeated runs the same:
- Keyboard and mouse input is ignored
- The sound server does a periodic pull from the DMA channel (so that
  it gets drained), but only does so via a periodic timer (instead of
  being driven by a cubeb callback, which could arrive at different
  times)
- Disk image writes are disabled (reads of a modified area still
  work via an in-memory copy)
- NVRAM writes are disabled
- The current time that ViaCuda initializes the guest OS is always the
  same.

This makes execution exactly the same each time, which should
make debugging of more subtle issues easier.

To validate that the deterministic mode is working, I've added a
periodic log of the current "time" (measured in cycle count), PC
and opcode. When comparing two runs with --log-no-uptime, the generated
log files are identical.
2024-11-09 22:48:06 -08:00
dingusdev
6ca5b738d5 More FPU refactoring
Now down to 520 tests
2024-11-01 21:28:13 -07:00
dingusdev
f660efcd54 Continued FPU fixes 2024-10-30 07:46:44 -07:00
dingusdev
5f826d6a9d More floating point fixes
Down to 752 failing tests
2024-10-27 12:51:16 -07:00
dingusdev
873f8632e4 More floating point fixes
Confirmed to partially fix Mac OS X installation screen errors
2024-10-26 16:16:52 -07:00
dingusdev
af7c22e7b3 Compile fixes, pt. 2 2024-10-17 19:50:15 -07:00
dingusdev
28ec650e4f Compile fixes 2024-10-17 19:41:58 -07:00
dingusdev
329bcc68b1 Floating-point fix-ups
Largely to fix setting flags, but partially to fix the incorrect nan emulation
2024-10-17 08:00:27 -07: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
dingusdev
01ceaef8d7 Slightly delaying a race condition 2024-09-24 21:10:10 -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
dingusdev
e2ad753f4a More clean-up 2024-09-15 18:31:36 -07:00
dingusdev
2ab23546ea One-line fix-up 2024-09-08 15:22:04 -07:00
dingusdev
9d9e826bb3 More code clean-up 2024-09-08 13:19:07 -07:00
Rairii
8cc67b09c2 ppcmmu: Different expressions. 2024-09-03 06:09:45 -07:00
joevt
bb3e89e3af ppcexceptions: Remove unused label. 2024-09-03 06:09:10 -07:00
joevt
78da2457e8 ppcexec: Simplify next event time calculation. 2024-09-02 19:00:33 -07:00
joevt
7e70432495 ppcexec: Remove unused g_icycles_base. 2024-09-02 18:58:07 -07:00
joevt
f09710a5f7 viacuda: Do shutdown.
Shutdown will enter the debugger or quit depending on the execution mode.
Quit is different from shutdown since it is triggered outside the guest by using the host Quit menu item.
2024-08-31 18:09:12 -07:00
dingusdev
b5850f1cd2 Slight clean-up to ppcexec 2024-08-26 06:48:40 -07:00
Maxim Poliakovski
e1acf5d160 Rename ppc_effective_address to ea. 2024-08-19 21:11:22 +02:00
Mihai Parparita
bdbeb742d4 ppc: remove two unused global variables
Last use of grab_return was removed in f204caa907.
grab_breakpoint was added in 2bd717e293 but
never used.
2024-08-18 22:46:52 -07:00
Mihai Parparita
e7d8e71297 ppc: make ppc_effective_address into a local
There's no reason for it to be a global, we always set it and use it
in instruction implementations, and we never read it directly.

Perhaps the compiler could optimize this away, but it's better to be
simpler (and also be easier to read).
2024-08-18 22:38:50 -07:00