Commit Graph
700 Commits
Author SHA1 Message Date
dingusdev 7658707bd3 Add missing return statements 2026-07-29 18:49:54 -07:00
dingusdev aef197841b Remove SNAN checks from FABS, FNABS, and FNEG
None of these checks are required
2026-07-05 18:47:37 -07:00
Mihai Parparita c5d24e98a3 ppcexec: Respect CPU-specific POW behavior (#188)
Followup to #186 - select `MSR[POW]` handling mode once during CPU
initialization instead of treating every processor as `HID0`-gated.

We match documented (and QEMU) behavior:
- 603/7xx CPUs require `HID0` doze, nap, or sleep bits before we enter
  the emulator sleep loop
- 604-family CPUs use just for `POW` directly
- 601 does not support `POW` at all
2026-07-03 18:13:10 -07:00
Mihai Parparita 79a06c55a4 ppcexec: Emulate PowerPC sleep on MSR POW (#186)
xnu-123.5 and similar vintage kernls enter the PowerPC 750 powersave mode
when the scheduler has no runnable work. `machine_idle_ppc` selects HID0
doze or nap, records a nap timestamp, then executes mtmsr with MSR[POW]
set. It stays in a loop there (in case the power saving had no effect
immediately) - it expects execution to resume at the `machine_idle_ret`
label (when an interrupt occurs), which ends up returning from the
function.

We model this state explicitly:
- When mtmsr sets MSR[POW] with the HID0 doze/nap/sleep flags, set a new
  EXEF_SLEEP flag.
- When EXEF_SLEEP is set, keep processing host events without advancing
  the guest PC.

Towards getting the 10.0 public beta to boot (#154) - before this we
would enter the DPPC debugger shortly after this instruction (due to a
bogus MSR LE flag eventually being set). Now we make more progress and
end up in a "Still waiting for root device" loop (presumably something
at the ATA layer)
2026-07-02 06:59:43 -07:00
dingusdev 8d1d22416a Further FPU fixes
Now only 472 floating point tests fail
2026-06-26 22:24:48 -07:00
dingusdev 103a06536c Small PPC Floating-Point fixes 2026-06-26 07:44:38 -07:00
Maxim Poliakovski 0e2ffa7863 Move endianswap.h to core/* 2026-06-07 21:10:51 +02:00
Maxim Poliakovski 0e03cac082 Move memaccess.h to core/* 2026-06-07 20:32:46 +02:00
joevt 54a1eb49f7 ppcmmu: Add a debug version of mmu_map_dma_mem.
This is for the DPPC debugger, not for debugging DPPC.
2026-06-02 20:34:26 -07:00
joevt b665629168 ppcemu: Remove unused timebase_counter global. 2026-06-02 20:33:55 -07:00
joevt fe80d14e8a ppcmmu: uintptr_t (not size_t) for host pointers. 2026-05-29 06:51:32 -07:00
Rairii 09c1248be7 CPU and memory controller endian changes.
===============
Rairii changes:

memctrlbase: The memory controller may have an endian swap mode.
mpc106: Only mmio regions need endian swap and only if PCIR_LE_MODE is
set.

videoctrl: Add framebuffer_in_main_memory flag. Use needs_swap_endian.

debugger: Fix disasm for little endian mode.

ppcmmu: little endian mode requires munging of the data and instruction
addresses, affecting the 3 least significant bits.

ppcexec: pc_real is always recalculated during little endian mode
because instructions are swapped every 8 bytes (due to the address
munging).

==============
joevt changes:

Add SUPPORTS_MEMORY_CTRL_ENDIAN_MODE for memory controller.
Use cmake -DDPPC_SUPPORT_PPC_LE=ON to enable.

Add SUPPORTS_PPC_LITTLE_ENDIAN_MODE for CPU.
Use cmake -DDPPC_SUPPORT_MEM_LE=ON to enable.

Add ppc_change_endian to handle endian switch for MPC601 (uses HID0
instead of MSR) and later PPC CPUs.

Add is_LE flag to ppc_state to indicate little endian mode for all
processor versions.

Create separate ppc_exec_inner template functions for little and big
endian.

Switch endian mode in the ppc_exec outer functions when power_off_reason
is po_endian_switch.

Since MPC601 doesn't have ILE and LE bits, remove that code for that
CPU.

videoctrl: Uses templated methods. See next commit for a fix that this
change introduces.
2026-04-12 10:06:32 -07:00
joevt 25860025b0 Add debug option LOG_INSTRUCTIONS.
Adds a log that remembers the last 16 million instructions.
2026-04-12 09:38:14 -07:00
joevt 7aacd5c703 ppcmmu: Initialize bat structs after bat regs.
Needed for machine restart.
2026-04-11 13:36:58 -07:00
joevt 688ec133c5 ppcexec: Initialize int_pin.
Problems happen if this is true after a restart.
2026-04-11 13:22:44 -07:00
joevt e689d62067 debugger: Parse BAT registers. 2026-04-11 10:26:06 -07:00
joevt 91f5ccc3f9 ppcmmu: Simplify pteg address calculation.
Maybe the optimizer can do it or maybe not.
2026-03-31 07:39:45 -07:00
joevt 4ca03953d7 ppcemu: Fix EAR spr exception. 2026-03-08 10:42:22 -07:00
Maxim Poliakovski 6092882a45 ppcopcodes: fix bit test in eciwx/ecowx. 2026-02-22 18:17:29 +01:00
Tim Jarzombek 398e0b025d Fix bugs caught by fuzzing 2026-02-12 21:11:11 -05:00
joevt 60d4750d54 ppcopcodes: Decrementer fixes.
- Always add a tick to the timeout calculation.
- Make sure value of decrementer is < 0 for timed decrementer exception.
- Don't recalculate decrementer write time stamp in the case of an
  immediate decrementer exception.
2026-01-31 13:17:22 +01:00
dingusdev 213dd4c16e Update copyright info further 2026-01-30 08:12:04 -07:00
Maxim Poliakovski 0d22d5cbd8 ppcopcodes: fix decrementer interrupts.
Enable decrementer interrupts for MPC601
required by  MkLinux DR3.
2026-01-30 15:40:15 +01:00
Maxim Poliakovski e75ee8d32a Update copyright year. 2026-01-30 12:15:00 +01:00
joevt 769ef49f67 ppcopcodes: Implement mfspr for tbl_u and tbu_u. 2026-01-29 07:53:37 -07:00
joevt e0677a8a1f ppcexec: Add TBL_U and TBU_U for reg_op. 2026-01-29 07:53:27 -07:00
joevt 356e74f8c2 ppcdisasm: Cleanup spr calculation. 2026-01-29 07:53:17 -07:00
joevt 3e8121c1f5 ppcdisasm: Add tbl_u and tbu_u for mfspr. 2026-01-29 07:53:02 -07:00
dingusdev 742a810624 Restored floating point testing 2026-01-07 18:45:47 -07:00
joevt be04300846 ppcexec: Add missing registers for disassembly. 2026-01-03 11:18:33 -07:00
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