2086 Commits

Author SHA1 Message Date
Maxim Poliakovski
6b3a399015
Merge pull request #129 from mihaip/upstream-sdl-revert
Revert unintentional change to imgfile_sdl.cpp
2024-12-03 13:59:26 +01: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
Maxim Poliakovski
85d5b10f61 sc53c94: switch to the new DMA API. 2024-12-03 11:37:18 +01:00
Maxim Poliakovski
5057792d4d dbdma: implement xfer_to_device method. 2024-12-03 11:37:18 +01:00
Mihai Parparita
a1d945a61f Revert unintentional change to imgfile_sdl.cpp
Did not mean to include this in #127
2024-12-02 22:50:03 -08:00
dingusdev
46425faaa9
Merge pull request #128 from mihaip/upstream-using-namespace
Remove `using namespace std` from remaining header files
2024-12-01 07:01:05 -07:00
Mihai Parparita
4479387580 Remove using namespace std from remaining header files
It's somewhat of an anti-pattern, and can lead to conflicts with
other symbols (e.g. the Windows build failure in https://github.com/dingusdev/dingusppc/actions/runs/11762906342/job/32766290288,
I removed `using namespace std` from timermanager.h to fix that one).
2024-11-30 20:01:09 -08: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
f1e56cd353 Make the debugger a global object. 2024-11-30 12:12:32 +01:00
Maxim Poliakovski
04899d6528 dbdma: prevent STOP from updating xferStatus. 2024-11-30 12:12:32 +01:00
Maxim Poliakovski
bd7c424989 dmacore: add xfer_to method. 2024-11-30 11:55:16 +01:00
Maxim Poliakovski
aa17bf06de ppcmmu: implement mem_write_dbg method. 2024-11-30 11:55:16 +01:00
Maxim Poliakovski
6d2872a07f superdrive: add missing break. 2024-11-30 11:55:16 +01:00
Maxim Poliakovski
c12561074c
Merge pull request #126 from mihaip/upstream-named-constant
debugger: Use a named constant when we don't have a current instruction
2024-11-29 18:47:25 +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
Maxim Poliakovski
7e93d2d169 scsihd: add missing phase switch to write(). 2024-11-29 17:47:29 +01:00
Rairii
2bb35dc613 pcihost: Add machine check exception.
A machine check exception happens when attempting to read from an unmapped I/O address.
2024-11-29 07:41:57 -07:00
dingusdev
26aa452c57 Fix benchmark compiling, again 2024-11-29 07:41:45 -07:00
joevt
7a55a81186 pcihost: Fix pci_unregister_device.
Remove the device from the hosts dev_map.
Remove the device from the Machine object.
2024-11-29 07:31:23 -07:00
joevt
c9359592d7 pcihost: Modify name of attached PCI devices.
In case multiple PCI devices of the same type are added, make sure each has a different name for logging.
2024-11-29 07:31:16 -07:00
dingusdev
bf55aa50ce
Merge pull request #125 from mihaip/upstream-curr-instruction
ppc: Remove ppc_cur_instruction global variable
2024-11-28 15:59:32 -07: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
31bc6f79e5 Fix instructions for building with tests 2024-11-28 23:25:57 +01:00
Mihai Parparita
e4c84c5f80 Reduce frequency of deterministic mode instruction logging
Do as the comment says and log every (logical) second only.
2024-11-28 22:12:43 +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 2141a72b873763995b3428353dc7fd9d5bb47abb)
can can thus be removed altogether.

Similarly ppc_fpu_off has no uses (as of bb3f4e596e3f18f9414daa94e3639d2c192e93ec)
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 0835e6f9f474899bce7dd0c901b1119cc51cbfe4.
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
dingusdev
1d807d10e9
Merge pull request #124 from mihaip/upstream-empty-cdrom
Make ImgFile ignore operations before the file is opened
2024-11-25 18:35:31 -07:00
Mihai Parparita
08fa2f887d Make ImgFile ignore operations before the file is opened
Before f65f9b9845ddf0a4050213cc36ef43c9c852a6c7 this would happen
automatically (since the stream member was always valid). It's now a
unique_ptr that's only initialized when the file is opened, so we need
to add guards for all the operations.
2024-11-25 22:37:37 +01:00
Maxim Poliakovski
04280ecda4 Revert "Fix LR update in bc instructions"
This reverts commit 5a0a7b12e4c539ece5c6b745946bb140684554e7.
2024-11-25 21:56:32 +01:00
dingusdev
f4b5ac2d16 Minor fix to page 0x31 2024-11-25 08:11:11 -07:00
dingusdev
c8e2a4d921 Avoid flush on web ports 2024-11-24 15:32:47 -07:00
dingusdev
f6dc704aff Add MODE_SENSE_6 to ATAPI CD-ROM emulation 2024-11-24 15:23:38 -07:00
Maxim Poliakovski
b3f2a6cf20 machineyosemite: remove non-existent Rage128 connection. 2024-11-22 21:29:23 +01:00
dingusdev
ad44ce8ce4
Merge pull request #121 from mihaip/upstream-settings
Add support for specifying properties of dynamically-registered devices via the command line
2024-11-22 07:59:37 -07:00
joevt
4b13af6691 atirage: Change BAR 0 size calculation.
We only need up to BE_FB_OFFSET + this->vram_size.
If vram_size is 8MB, then make sure the last 4K is not mapped to BAR 0 because the macOS driver likes to map BAR 2 at that location.
2024-11-22 07:58:21 -07:00
Mihai Parparita
a941836a4d Add support for specifying properties of dynamically-registered devices via the command line
The previous approach of traversing the machine and its device tree
at startup to register CLI11 options was not working for dynamically
registered devices like PCI cards. This meant that options like
gfxmem_size or mon_id from the video cards could not be set.

Switch to instead registering in MachineFactory a hook function that
provides CLI flag values. We can call it when registering any property,
whether at startup or dynamically.
2024-11-21 22:58:36 -08: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
dingusdev
d279ada718 Revert "dbdma: Schedule interpret_cmd."
This reverts commit e1849a2bfd2ad7140873a95377f806c79ad8eb4e.
2024-11-17 06:49:43 -07:00
joevt
e1849a2bfd dbdma: Schedule interpret_cmd.
Have the entire dbdma program executed by scheduling each iteration in the CPU loop.
This is done only for devices that use the dbdma program to drive data input/output (has_data_callbacks) rather than have the device drive the dbdma program.
2024-11-16 10:30:20 -07:00
joevt
362cfcbc83 atahd: Rename descriptors. 2024-11-15 12:05:50 -07:00
joevt
6c093e141b Add missing override statements. 2024-11-15 10:03:57 -07:00
Rairii
aeac232e12 imgfile_sdl: Flush on write. 2024-11-15 07:54:49 -07:00
joevt
0ce96ffc12 CLI11: Update to v2.4.2. 2024-11-15 06:08:44 -07:00