670 Commits

Author SHA1 Message Date
dingusdev
a6b6fc1b61 Add missing returns to mfspr + mtspr 2025-09-15 07:54:15 -07:00
Maxim Poliakovski
049c843891 ppcopcodes: support reading the time base using TBL_S/TBU_S.
This is required by BeOS kernel.
2025-09-15 01:57:13 +02:00
joevt
2f0f264ef2 ppcdisasm: Add missing MPC601 register duplicates. 2025-07-30 21:30:31 -07:00
joevt
facbd05b9e ppcopcodes: Add missing break. 2025-07-25 07:14:05 -07:00
joevt
1b719f2d8f ppcmmu: Delete blank line. 2025-07-25 07:09:09 -07:00
joevt
1b7ec272d8 ppcmmu: Don't crash on MPC601 DBAT access. 2025-07-25 07:05:41 -07:00
Mihai Parparita
26724feff1 ppcmmu: fix tlb_flush_secondary_entry
It would iterate over all of the entries in the two-way line, but only
check the first one.

Fixes 10.1 kernel panic on boot after c317ed8b42.
2025-07-03 16:31:20 -07:00
joevt
5412fbc198 Remove superfluous semicolons. 2025-06-27 19:01:14 -07:00
Maxim Poliakovski
c317ed8b42 ppcmmu: fix TLB invalidation again. 2025-06-17 13:08:31 +02:00
Maxim Poliakovski
101d8aa885 ppcmmu: fix TLB invalidation.
The PowerPC manual says that `tlbie` only considers
bits 4-19 of the EA. Set the mask accordingly.
2025-05-21 18:42:57 +02:00
joevt
6c430b7d83 poweropcodes: Use ROTR_32 where possible. 2025-04-24 19:16:43 -07:00
dingusdev
2ce4e13170 ROTL_32 header fixes 2025-04-24 06:36:11 -07:00
joevt
746f461c5b ppcopcodes: Use ROTL_32 where possible. 2025-04-24 06:34:52 -07:00
joevt
5b3043c372 ppcfpopcodes: Remove redundant expression. 2025-04-24 06:33:22 -07:00
dingusdev
c1ed416b58 Revert "display: Remove resizing flag."
This reverts commit c781ba8fab.
2025-04-23 21:08:45 -07:00
joevt
c781ba8fab display: Remove resizing flag.
It doesn't do anything useful yet and setting the resizing flag to true stops updates if the window doesn't actually change size.
2025-04-23 06:50:24 -07:00
joevt
c6013f076a ppcmmu: Fix DMA for adjacent cross region ranges.
If a DMA range extends beyond the end of a region into a second region of the same type (either RAM or ROM), and the regions are adjacent in both the guest and host address spaces, then allow the DMA to proceed.
2025-04-23 06:32:28 -07:00
joevt
9c6a7de45f ppcopcodes: Remove unnecessary type casts. 2025-04-23 06:15:38 -07:00
joevt
47c66666bb display: Add zoom and fullscreen no letterbox.
Added a third full screen mode which removes letterbox or pillarbox black bars.
Added Control-- and control-+ to decrease or increase the scale by a factor of 2^(1/8). This means the scale doubles or halves after pressing the same key 8 times.

drawable_w and drawable_h are floating point so that scaling is reversible (i.e. scaling from 100% to 800% and back to 100% gives 100% instead of 99 or 101%).
default_scale_x

Handle switching host resolution between Retina (HiDPI) and Low resolution modes. This involves updating the window scale factor.

Add window scale factor to window title.
2025-04-22 06:36:04 -07:00
dingusdev
88b5b2ec66 Prep for Alpha 1.0.3 2025-04-18 21:22:19 -07:00
Maxim Poliakovski
d315624d54 ppcopcodes: refactor rfi to reduce code duplication. 2025-04-16 00:58:27 +02:00
joevt
ec6fa9360c ppcopcodes: Cleanup ppc_rfi.
Reduce the number of operations by 1
and make more clear what is happening.
2025-04-16 00:51:13 +02:00
joevt
0fe6ffeb6f ppcemu: reformat and extend MSR enum. 2025-04-15 18:52:52 +02:00
joevt
b280da81bc ppc: Timing calculation changes.
Note: all timings are relative to virtual time which is 16 ns per instruction. 8 ns per instruction is too fast for the PDM 'mach' gestalt calculation in firmware.

- For MPC601, bit 7 of RTC and DEC changes at 7.8336 MHz so bit 0 would change at 1.0027008 GHz. Therefore multiply time base frequency by 128. For MPC601, DEC now changes at 1.0027008 GHz instead of 7.8336 MHz.
- Add tbr_freq_shift for cases where time base frequency exceeds 1GHz.
- Change calc_rtcl_value to use time base frequency. For MPC601, RTC now changes at 1.0027008 GHz instead 1GHz.
- For MPC601, the 7 least significant bits of DEC are not implemented so make them not getable or setable.
2025-04-08 19:46:48 -07:00
joevt
6363eef32f ppcexec: Make opcode macros depend on OPr. 2025-04-08 19:46:20 -07:00
joevt
ba9bbb32c3 Catch all errors for debug read/write methods. 2025-03-23 16:14:31 -07:00
dingusdev
130beabf2a Re-insert code for tlbia
BeOS uses this as part of its boot handler.
2025-03-21 18:57:17 -07:00
dingusdev
a7170f4956 Removing code for tlbia
Seems to be causing a regression in Mac OS X 10.0
2025-03-21 18:42:56 -07:00
joevt
ae605157db debugger: Add fregs command. 2025-03-10 07:15:44 -07:00
dingusdev
6e74146466 Don't forget to update CR1 in edge case of fdiv 2025-03-02 10:42:31 -07:00
dingusdev
a972bd26f7 Corrected handling of MMU Mode 1 2025-03-02 10:41:42 -07:00
dingusdev
b09dfa22ec Fix regression in fdiv(s)(.) 2025-03-01 15:18:24 -07:00
dingusdev
f3dec30c27 Add missing PR bit checks 2025-02-26 20:40:41 -07:00
dingusdev
a848eb9e76 Fixed accidental removal in ppc_exec_until 2025-02-16 06:35:24 -07:00
dingusdev
d82d9ac7b9 Added missing header - chrono 2025-02-15 16:02:32 -07:00
joevt
82a48899f0 Change ppc_opcode_grabber to a variable. 2025-02-10 07:01:32 -07:00
joevt
2f30395d00 Break long lines.
Make them 130 characters or less.
2025-01-30 06:30:51 -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
joevt
e63f928a3c ppcexec: Simplify ppc_exec_inner.
One while loop instead of two.
One call to ppc_read_instruction instead of four.
2024-12-17 19:01:34 -07:00
joevt
7b1ea17fb8 ppcmmu: Fix compiler warning. 2024-12-17 18:46:53 -07:00
dingusdev
240ec95a74 bench1: Set power_off_reason. 2024-12-17 18:46:20 -07:00
joevt
e4d9cb95b4 ppcexec: Make ppc_exec template functions. 2024-12-14 06:32:07 -07:00
joevt
98c7e224fe ppcmacros: Make rot_sh unsigned. 2024-12-14 06:31:59 -07:00
joevt
ac0faf78fd poweropcodes: Fix more compiler warnings. 2024-12-14 06:31:51 -07:00
joevt
d48eefceb0 poweropcodes: Remove undefined behavior.
Shift 32 is undefined.
-2^31 - 1 is undefined.
2024-12-12 08:03:47 -07:00
joevt
78f62c8db8 ppcfpopcodes: Use macros for ppcstate.
Helps with abstraction.
2024-12-10 18:18:32 -07:00
joevt
a64b000459 ppcfpopcodes: Remove extra space. 2024-12-10 18:18:23 -07:00
joevt
1da7cb1c2f ppcmacros: Remove semicolon from one line macros. 2024-12-10 18:18:12 -07:00
joevt
49b8c4c39f ppcfpopcodes: Fix Revert Tweak.
Fixes lfsu, lfsux, lfdu, lfdux so they correctly update rA as before.
2024-12-11 00:19:06 +01:00