Commit Graph
115 Commits
Author SHA1 Message Date
joevt 14bae3d789 timermanager: Add time parameters to callback. 2026-09-23 07:04:04 -07:00
joevt a3b248ea3d ppcemu: Use ppc_off_reason setter.
Makes things slightly cleaner and helps debugging. Changes to
ppc_off_reason can be logged.
2026-08-09 21:04:04 -07:00
joevt db5ab5f63c display_sdl: Make auto grab mouse optional.
Add a command line option to enable auto grab.
Default to the previous behavior before the auto grab feature was added.

Add a debugger command to enable or disable auto grab.

Notes:
Auto grab mouse currently only works for graphics controllers and guest
OSs that use a hardware cursor and only if the emulation sets
cursor_dirty to true (i.e. not emulation that uses cursor_ovl_cb).
2026-08-09 21:01:00 -07:00
Maxim Poliakovski 0e03cac082 Move memaccess.h to core/* 2026-06-07 20:32:46 +02:00
joevt 0e589ce1f6 debugger: Schedule viaint in ppc exec loop. 2026-06-05 19:23:23 -07:00
joevt d94bf01163 debugger: More parsing bat changes.
- For MPC601, ibat#l should be bat#.
- For non-MPC601, ibat#l should be dbat#l for dbats.
- Don't show info for invalid bats on MPC601.
2026-04-18 11:41:54 -07:00
joevt 621150f2f4 debugger: Fix disasm endian changes. 2026-04-15 19:44:10 -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 e689d62067 debugger: Parse BAT registers. 2026-04-11 10:26:06 -07:00
joevt dfea8fa2cd debugger: Show register values during stepping.
So you don't need to use regs after every instruction.
2026-03-31 07:55:21 -07:00
joevt 07f781bf56 debugger: Disassemble instructions while stepping. 2026-03-31 07:54:57 -07:00
dingusdev 213dd4c16e Update copyright info further 2026-01-30 08:12:04 -07:00
Maxim Poliakovski e75ee8d32a Update copyright year. 2026-01-30 12:15:00 +01:00
joevt 74da4e148d debugger: Ensure cout fill changes back to right. 2025-04-29 06:31:15 -07:00
joevt 72dbafdb3f debugger: Format 68K register dump.
Fix alignment and use 8 hex digits for each register.
2025-04-28 07:00:57 -07:00
joevt f55d5c9002 debugger: Use FILENO defines. 2025-04-28 15:05:40 +02:00
joevt e43bb02d9a debugger: Remove unused variable in patch_mem. 2025-03-20 19:31:10 -07:00
joevt c3005cede3 debugger: Catch memory errors while disassembling. 2025-03-14 10:40:49 -07:00
joevt cf0d78fe98 debugger: add regions command.
To dump the list of memory regions.
2025-03-14 10:31:57 -07:00
Maxim Poliakovski 69c4d6489d debugger: implement setmem command. 2025-03-14 17:52:48 +01:00
joevt fd4057ea61 debugger: Fix spelling in regs help. 2025-03-13 19:54:16 -07:00
joevt d6a6c4196f debugger: Add blank line to output. 2025-03-13 19:54:02 -07:00
joevt 04dc129c61 debugger: Add restart command. 2025-03-13 19:52:36 -07:00
dingusdev 77503df677 Code clean-up 2025-03-12 07:58:32 -07:00
joevt 54db971610 debugger: Regs lower case, indent, justify. 2025-03-10 18:55:43 -07:00
joevtandjoevt eef2190e08 Add more spacing for Debugger help
Co-Authored-By: joevt <950609+joevt@users.noreply.github.com>
2025-03-10 18:45:17 -07:00
joevt 470f4a115a debugger: Fix fregs help alignment. 2025-03-10 18:10:35 -07:00
joevt ae605157db debugger: Add fregs command. 2025-03-10 07:15:44 -07:00
Rairii a9e0cd5c5e debugger: Include SRR0 and SRR1 in regs output. 2025-03-10 07:03:26 -07:00
joevt cf0881b843 debugger: Fix compiler warnings. 2025-03-10 07:01:06 -07:00
joevt 6b82e15c14 Use ppc_state instead of get_reg.
Might be a speedup if stepping through a few million instructions.
2025-03-10 06:59:52 -07:00
Mihai Parparita a6e1b8c338 Add CLI flag to allow setting of OpenFirmware environment variables
Allows enabling of verbose booting via the command-line interface (instead of having to drop into the interactive debugger).
2025-03-02 16:10:01 -08:00
joevt eb2253a23a debugger: Output register names as lowercase.
To match the register names in the disassembly.
2025-02-15 17:05:41 -07:00
joevt 50b57b2cc1 debugger: Fix repeating of until command.
It should show the command that is being repeated (including the address) and indicate how many times it was repeated so far.
2025-02-15 17:05:22 -07:00
Maxim Poliakovski a5ba986666 debugger: set maximal 68k instruction length to 12. 2025-01-06 14:30:13 +01:00
Maxim Poliakovski f1e56cd353 Make the debugger a global object. 2024-11-30 12:12:32 +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
joevt 27d389c36a debugger: Erase prompt when repeating command.
Enterring a blank command continues the disassembly or stepping for one instruction. Erasing the prompt saves one line in the console so the disassembly doesn't appear double spaced. I don't know if the terminal control sequence works in Windows.
2024-11-09 06:48:22 -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 606c9dd9a8 More compiler warning fixes 2024-06-24 19:40:20 -07:00
dingusdev c0e28b81a8 Gracefully exit upon EOF
Taken from #94 - Originally fixed by dressupgeekout  and refined by joevt
2024-06-16 07:28:40 -07:00
joevt 7866675a55 debugger: Auto increment after disassemble.
Pressing return after disassembling some instructions should cause the next instruction to disassemble.
2024-03-11 07:13:40 -07:00
joevt 619579bee3 debugger: Add instruction bytes to disassembly.
8 characters for address, 8 characters for instruction hex, followed by instruction.
2024-03-11 07:13:07 -07:00
joevt b5dbaff748 debugger: Don't echo auto-repeated commands. 2024-03-11 07:12:57 -07:00
Mihai Parparita 57e6e90002 Add support for the CUDA_RESTART_SYSTEM command
There are cases where when it's necessary (e.g. given uninitialized NVRAM,
the Beige G3 with the 10.2 install CD inserted will update the boot
device and restart to boot from it).

Restart support was done by wrapping the ppc_exec function in a loop and
checking for a restart power off reason. We also need to disconnect all
event listeners, since they will be recreated when the machine is
re-initialized.
2024-03-07 23:32:23 -08:00
joevt ebb51addd7 debugger: Allow interrupt of disassembly.
Part of the "debugger: Fix interrupt signal." commit.
2024-03-03 14:36:24 -07:00
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 6a51e8a1c9 debugger: regs command needs to reset setfill.
So printenv will fill with spaces after regs.
2024-03-01 07:28:58 -07:00