Commit Graph

194 Commits

Author SHA1 Message Date
dingusdev
a0b1d6394a Another revert
This affects Virtus VR - With the lmw checks, the opening sign doesn't display and the intro crashes sooner
2024-01-07 17:45:05 -07:00
dingusdev
c6af1e31fe Partial revert of previous commit 2024-01-07 17:21:11 -07:00
dingusdev
a5ce6a806f CPU clean-up 2024-01-07 17:04:51 -07:00
dingusdev
a59475af1c Further lha(*) fixes 2024-01-05 19:10:05 -07:00
dingusdev
1cc1ac2e68 Fixing lha(*) opcodes 2024-01-05 17:19:03 -07:00
dingusdev
f3a759c80d CPU code clean-up 2024-01-05 15:11:37 -07:00
Maxim Poliakovski
cb85d358d1 Remove unused globals. 2024-01-02 17:51:12 +01:00
Maxim Poliakovski
5b114c2412 ppcopcodes: refactor mtcrf emulation. 2024-01-02 17:44:35 +01:00
Maxim Poliakovski
593508df22 Refactor subfze. 2024-01-02 13:44:56 +01:00
joevt
1f3505f371 ppcopcodes: Fix subfze. 2024-01-02 13:44:13 +01:00
Maxim Poliakovski
fef5bde0c7 Refactor recent subfme fix. 2023-12-24 02:56:47 +01:00
joevt
dc00879419 ppcopcodes: Fix subfme. 2023-12-24 02:36:34 +01:00
joevt
0a8c1df968 ppcopcodes: Fix sraw. 2023-12-19 16:30:02 +01:00
joevt
4c49558120 ppcopcodes: Fix subfe. 2023-12-19 14:57:41 +01:00
joevt
7f229b0fe8 ppcfpopcodes: Fix fcmpo/fcmpu.
It was always changing CR1 (starting at CR bit 4) instead of the CR selected by crfD.
Also, it was clearing all but the FL,FG,FE,FU bits of FPRF of FPSCR.
2023-12-19 13:15:10 +01:00
Mihai Parparita
e9bc8926ab Avoid some undefined behavior
The `SubOpcode31Grabber[1024] = { ppc_illegalop }` initializer only
populates the first entry with ppc_illegalop (at least on some compilers),
switch to explicitly initializing the entire array with std::fill_n.

Also fix a couple of sign and overflow issues flagged by the Xcode
undefined behavior sanitizer.
2023-12-07 23:59:49 -08:00
dingusdev
dd454689e0 Fixes for condition reg move instructions 2023-11-28 07:06:04 -07:00
dingusdev
7835aec034 Further CPU cleanup 2023-11-21 08:06:50 -07:00
dingusdev
f4f035682c Fixed cfloat include 2023-11-19 20:34:40 -07:00
dingusdev
d1f9b5631a Added missing include for cfloat 2023-11-19 20:07:00 -07:00
Mihai Parparita
35c86ad6bf Clean up #includes
Result of running IWYU (https://include-what-you-use.org/) and
applying most of the suggestions about unncessary includes and
forward declarations.

Was motivated by observing that <thread> was being included in
ppcopcodes.cpp even though it was unused (found while researching
the use of threads), but seems generally good to help with build
times and correctness.
2023-11-03 00:33:47 -07:00
dingusdev
6ffc2b2f10 Optimize string word instructions
Partially unrolled the loop. Boots 7.1.2 Disk Tools slightly faster.
2023-10-29 17:23:31 -07:00
Maxim Poliakovski
6cfde29f00 heathrow: implement native interrupt mode. 2023-09-25 12:22:17 +02:00
Maxim Poliakovski
278799795c Disable decrementer exceptions for MPC601. 2023-09-18 21:20:59 +02:00
Maxim Poliakovski
8ff2125312 Revert "Minor checks for Data Cache opcodes and LMW"
This reverts commit fd6327ab62.
2023-09-18 21:20:59 +02:00
dingusdev
5e32b599d6 Merge branch 'master' of https://github.com/dingusdev/dingusppc 2023-09-04 07:22:27 -07:00
dingusdev
fd6327ab62 Minor checks for Data Cache opcodes and LMW 2023-09-04 07:21:00 -07:00
Maxim Poliakovski
932f2bbceb ppcopcodes: fix stwcx. emulation. 2023-08-21 04:50:02 +02:00
joevt
300965ab10 Decrementer exception changes. 2023-08-10 00:46:04 +02:00
Maxim Poliakovski
73d0356058 ppcopcodes: fix dcbz for BlockZero in Mac OS 8.x 2023-06-17 20:57:48 +02:00
Maxim Poliakovski
03595c3940 Merge remote-tracking branch 'origin/machine-yosemite' 2023-04-21 12:49:58 +02:00
Maxim Poliakovski
cf0d361918 Merge 'hard-disks' branch. 2023-04-17 01:20:38 +02:00
Maxim Poliakovski
597c077b19 Implement PPC decrementer. 2023-02-15 02:36:40 +01:00
joevt
64fec88436 Fix compiler warnings: cast loses precision.
Use explicit cast when converting large integer types to smaller integer types when it is known that the most significant bytes are not required.
For pcidevice, check the ROM file size before casting to int. We'll allow expansion ROM sizes up to 4MB but usually they are 64K, sometimes 128K, rarely 256K.
for machinefactory, change the type to size_t so that it can correctly get the size of files that are larger than 4GB; it already checks the file size is 4MB before we need to cast to uint32_t.
For floppyimg, check the image size before casting to int. For raw images, only allow files up to 2MB. For DiskCopy42 images, it already checks the file size, so do the cast after that.
2023-01-11 01:17:12 -08:00
dingusdev
1ed6e25d1b Removed redundant variable
Slight clean-up for lswi and lswx
2022-11-12 20:16:29 -07:00
joevt
6f0d3b48ba Fix TBR range
Fixed an issue where TBR doesn't have full 64-bit range. The original calculation was 64 bit and ended with a ÷ 10^9. This means the max for the upper 32 bits is 2^32/10^9 = 4. The solution is to use a multiplication method that supports a 96 bit product. core/mathutils.h contains functions for that. TBR driving frequency is assumed to be less than 1 GHz. Some minor modification is required for future > 1 GHz support.
2022-09-15 21:22:37 -07:00
joevt
b665f2cb4e Fix RTC units
Fixed an issue where get-msecs-601 and get-msecs-60x were not returning the same value. RTC was being calculated using timebase frequency instead of nanosecond frequency. 601 uses RTC. 60x uses TBR. On a real Mac, a G3 CPU won't have a RTC and accessing RTC would cause an exception. This is not the case for dingusppc but I don't think that's a problem.
2022-09-15 21:05:08 -07:00
joevt
ed424ad544 Fix setting RTC
Fixed an issue where setting RTC upper or lower doesn't adjust the other (since the current time has changed since the last timestamp).
2022-09-15 20:59:56 -07:00
joevt
50dbd5eccd Fix RTC not always updating
Fixed an issue where RTC was not being updated if only the upper 32 bits (seconds) was read.
Also simplified things by always updating the timestamp instead of only when the seconds changes.
2022-09-15 20:54:22 -07:00
joevt
01d7d6bac3 Make accessing RTC or TBR not affect the other
Fixed an issue where the following would cause inconsistent results (tb in the left column would sometimes decrement instead of always incrementing):
2 0 do 2 0 do cr tb@ 8 u.r ." ." 8 u.r loop 2 0 do cr 12 spaces rtc@ 8 u.r ." ." 8 u.r loop 2 0 do cr tb@ 8 u.r ." ." 8 u.r space rtc@ 8 u.r ." ." 8 u.r loop loop

RTC and TBR could not be used simultaneously because they are both incremented by an amount based on the last time stamp but that time stamp can be changed by accessing either RTC or TBR. The solution is to have a different time stamp for each.
2022-09-15 20:21:54 -07:00
joevt
ce925f5e56 Fix RTC upper
Fixed a typo that caused rtc@ to always return 0 for the upper 32 bits (represents seconds).
The problem could cause the following to hang on Power Mac 7500:
cr 2000 0 do get-msecs u. 1 ms loop
2022-09-15 19:34:46 -07:00
Maxim Poliakovski
b38d00ce2d cpu/ppc: improve support for external interrupts.
Support generating of external interrupt exception
in MTMSR and RFI when MSR[EE] is re-enabled and
external interrupt still pending.
2022-08-24 14:15:47 +02:00
joevt
b76bfedf4b Remove unnecessary linefeeds from log
To remove blank lines in the dingusppc.log file or in the console output when -d is used.
2022-08-14 05:26:56 -07:00
Maxim Poliakovski
0c77cccb9e ppcopcodes: fix mcrf (again). 2022-05-21 14:51:28 +02:00
Maxim Poliakovski
b47de8b042 Implement MPC601 style RTC. 2022-05-21 14:51:27 +02:00
Maxim Poliakovski
646880cbf2 Interpreter loop is now controlled by exec_flags. 2022-03-02 16:55:20 +01:00
Maxim Poliakovski
123f820775 ppcopcodes: fix lswi/stswi emulation. 2022-02-19 23:23:24 +01:00
Maxim Poliakovski
477ad7ddee ppcopcodes: fix lswx/stswx emulation. 2022-02-19 23:23:24 +01:00
dingusdev
3258abe190 crnand and crnor fixes 2022-01-22 22:33:13 -07:00
Maxim Poliakovski
c8d39d5ee5 ppcopcodes: fix creqv emulation. 2022-01-21 16:32:07 +01:00
Maxim Poliakovski
2442bd17b3 ppcopcodes: fix crand emulation. 2022-01-21 14:56:10 +01:00
Maxim Poliakovski
c864b9b7d9 ppcopcodes: fix cror emulation. 2022-01-21 14:37:51 +01:00
Maxim Poliakovski
e1e651966e Revert "Further condition reg opcode patches"
This reverts commit 756d32df07.
2022-01-10 18:10:39 +01:00
Maxim Poliakovski
c12bab9e27 Revert "Quick fix for creqv"
This reverts commit 8efc61e1b9.
2022-01-10 18:01:48 +01:00
Maxim Poliakovski
339db4a078 Add timers management. 2022-01-10 17:56:24 +01:00
dingusdev
8efc61e1b9 Quick fix for creqv 2022-01-08 15:22:27 -07:00
dingusdev
756d32df07
Further condition reg opcode patches 2022-01-07 20:40:07 -07:00
Maxim Poliakovski
9cd7ca0077 ppcopcodes: fix crxor. 2022-01-08 04:21:09 +01:00
Maxim Poliakovski
7bdad7703c Predict TBR values based on elapsed virtual time. 2021-12-20 00:12:44 +01:00
Maxim Poliakovski
c0cd6eb38f Add missing licence headers, update license date. 2021-10-23 21:00:31 +02:00
Maxim Poliakovski
e53296f7a9 Implement all required context-synchronizing events. 2021-10-13 20:58:09 +02:00
dingusdev
1922a20cdd Partial revert for exception handling
This will be for a future update regarding 601 instructions
2021-10-05 17:42:55 -07:00
dingusdev
f605c484dd ecowx and eciwx added 2021-10-05 17:40:09 -07:00
Maxim Poliakovski
69c357b70f ppcopcodes: fix compilation error with Clang 11. 2021-10-05 00:40:12 +02:00
Maxim Poliakovski
84e111290f Fix includes for loguru and SDL. 2021-09-16 00:46:38 +02:00
Maxim Poliakovski
9ce15be106 ppcmmu.c: restructure and clean up. 2021-08-22 21:33:59 +02:00
Maxim Poliakovski
089645e830 Implement SoftTLB for writes. 2021-08-22 17:34:23 +02:00
Maxim Poliakovski
4da95a66d7 Make emulated memory loads to use SoftTLB. 2021-06-20 22:33:10 +02:00
Maxim Poliakovski
7d8f4d4e61 Finalize SoftTLB for reads. 2021-05-16 22:00:00 +02:00
Maxim Poliakovski
a5ddb51a3b ppcmmu: initial TLB implementation for reads. 2021-05-16 00:53:15 +02:00
Maxim Poliakovski
6f9ee10de5 Rework PPC CPU profiler. 2021-04-29 02:26:17 +02:00
dingusdev
7f0acaf3d3 Load and store instruction clean-up 2021-01-25 21:03:17 -07:00
Maxim Poliakovski
fd0f8e2ef5 ppcopcodes: revert inlining of helper functions. 2021-01-24 22:50:07 +01:00
dingusdev
60f84ef0d9 Refactoring interpreter value storage 2021-01-24 11:59:16 -07:00
dingusdev
2539faef7e Small typo fixes 2021-01-23 15:10:08 -07:00
dingusdev
df8ea1b276 Code clean-up for interpreter 2021-01-08 14:34:01 -07:00
Maxim Poliakovski
358f018815 ppcopcodes: fix mcrf. 2021-01-08 21:59:18 +01:00
dingusdev
79e3d398ba mcrf implemented 2021-01-07 20:38:32 -07:00
Maxim Poliakovski
2f3938c23f ppcopcodes: fix dcbz. 2021-01-07 04:25:27 +01:00
Maxim Poliakovski
dbbaf13a78 ppcopcodes: fix cntlzw to compile properly with Clang.
Enable USE_GCC_BUILTINS by default.
2020-12-18 18:33:00 +01:00
Maxim Poliakovski
99641b1b5e ppcopcodes: fix cntlzw with __builtin_clz.
The result of __builtin_clz is undefined when the source operand
is zero. Add a check for this case and handle it accordingly.
2020-12-07 14:37:20 +01:00
Maxim Poliakovski
6c6247b94f Clean up program exceptions. 2020-11-30 20:59:36 +01:00
Maxim Poliakovski
acfa09af65 Illegal opcodes raise program exception. 2020-11-29 23:54:10 +01:00
dingusdev
1fe9ffe3e5 Further refactoring to clean up the interpreter 2020-10-17 21:46:38 -07:00
dingusdev
dc58386237 Started re-refactoring opcode retrieval 2020-10-17 14:30:37 -07:00
Maxim Poliakovski
39a643aff6 Merge branch 'machines'
Also disable SDL for now because it produces build errors.
2020-06-03 18:21:51 +02:00
Maxim Poliakovski
d21fdb25d1 Remove unused variable grab_branch. 2020-06-01 23:12:18 +02:00
Waqar Ahmed
0ab9380be3 clang-format everything 2020-05-12 23:55:45 +05:00
Maxim Poliakovski
64d74228c2 ppcopcodes: fix STMW emulation. 2020-04-21 04:58:21 +02:00
Maxim Poliakovski
3d13bc1ca6 ppcopcodes: fix TWI emulation. 2020-04-21 04:58:21 +02:00
dingusdev
60ffa5bfac Initial attempt at fixing SDL2 building for Windows 2020-03-22 20:15:12 -07:00
dingusdev
4ceed27ccf Simplified prog_counter back to pc 2020-03-05 07:48:10 -07:00
dingusdev
e31f7873f5 Fixed redunant variable names for PPC emulation. 2020-03-04 21:29:04 -07:00
Maxim Poliakovski
0eb557751b ppcopcodes: fix timebase read & write. 2020-03-02 00:01:18 +01:00
dingusdev
354409812e Updating files with proper licensing header 2020-02-28 09:04:28 -07:00
Maxim Poliakovski
90779bd9c6 Remove log messages from cache/TLB instructions. 2020-02-27 16:31:22 +01:00
dingusdev
6c1dc8aaf0 Further logging work 2020-02-24 19:50:52 -07:00
dingusdev
d91950e582 Further logging code. 2020-02-23 22:36:31 -07:00
dingusdev
30b1116393 Implemeted limited simplified mnemonics for rlwinm 2020-02-10 20:02:41 -07:00
Maxim Poliakovski
26bd402f44 ppcopcodes: optimize ppc_changecrf0() a bit. 2020-02-10 23:07:39 +01:00