Commit Graph

18 Commits

Author SHA1 Message Date
David Guillen Fandos 4f3c9a5e58 [all] Fix CPSR and CPU modes
gpsp doesn't differentiate between USER and SYSTEM mode, most likely
cause it is not that important for most games. This implements the modes
correctly and adds checks for privileged operations. Still some
bugs/hacks but it mostly fixes CPSR/SPSR reads/writes.

To implement PSR writes we are using a more refined masks and force mode
bit num. 4 to always be one. Reserved bits are forced to zero (this
needs to be validated on a real device).
2023-01-11 21:26:32 +01:00
David Guillen Fandos 8c4196d19e Add MIPS codegen tests 2023-01-05 21:29:20 +01:00
David Guillen Fandos cb9696cb98 Fix blh for arm/mips to use a thumb branch (not dual)
Also fix ARM32 LR offset, was being truncated to 8 bit when it is a 12
bit offset.
2022-01-04 19:11:36 +01:00
David Guillen Fandos ef399b9315 [mips] Remove IWRAM stack optimization hack
Converted the hack into another... hopefully better hack.
Check for IW/EWRAM addr bit and handle accesses to EWRAM by correcting
the base addr and the mirroring range.
Assumes that iwram and ewram buffers are at a distance multiple of 64KB
for speed (so that lw/sw offsets can be shared).

This fixes a variety of games that should have been present in
game_config.txt such as Ninja Cop, Star Wars JPB, Medal of Honor,
Spongebob, etc. Some of them were just missing regional versions of the
cart. It also fixes newer games and homebrew such as GoodBoy Galaxy.
2021-12-30 23:39:09 +01:00
David Guillen Fandos 56f00c162e [mips] Improve SP relative accesses 2021-12-30 00:57:16 +01:00
David Guillen Fandos 3a6ca8d941 Better cycle accounting, taking remainders partially into account 2021-12-21 19:59:33 +01:00
David Guillen Fandos 7b181cb6ff Fix PC calculation for open bus loads
It was pretty much broken in all platforms, just "ok" enough for it to
work on some games though.
2021-12-20 19:31:33 +01:00
David Guillen Fandos cce51c948d Minor code refactor, no-op 2021-12-15 21:01:05 +01:00
David Guillen Fandos 88454e922f [MIPS] Correctly implement adcs/sbcs/rscs
Also fix C flag calculation for immediates.
Fixes a couple of games.
2021-12-15 19:02:02 +01:00
David Guillen Fandos 2419b77b28 Add reg tracing capability (for devs) 2021-12-11 11:27:59 +01:00
David Guillen Fandos 31451d16ff [mips] Fix CPSR store bug during IRQ
Similarly to 61ef776, this fixes the bug for MIPS.
2021-12-10 19:28:06 +01:00
David Guillen Fandos 1667597a43 Fix MIPS s16 unaligned load (although it does not fix any game) 2021-12-09 20:04:56 +01:00
David Guillen Fandos fda42c959f More mips dead code cleanup 2021-11-14 13:19:02 +01:00
David Guillen Fandos c2c57a6cf0 [MIPS] Minor cleanup 2021-11-07 19:24:02 +01:00
David Guillen Fandos e8eb753a73 [mips] Minor cleanup and remove a couple of nested functions 2021-11-06 22:31:42 +01:00
David Guillen Fandos 92180d5d7e Minor unused stuff cleanup 2021-11-06 21:49:08 +01:00
David Guillen Fandos dee9a6ed36 [MIPS] Fix swap implementation
No game seems to use this :P
2021-11-04 20:09:05 +01:00
David Guillen Fandos 15cc02e03c [MIPS] Move and restructure mips backend 2021-10-30 22:59:33 +02:00
Renamed from psp/mips_emit.h (Browse further)