Commit Graph
72 Commits
Author SHA1 Message Date
Henrik RydgårdandClaude Opus 5.5 7dd1475ed7 HLE: Pass the MIPSState to syscalls and their implementations
HLEFunc and ReplaceFunc now take the MIPSState they run on. The dispatch
paths (both interpreters and every JIT backend) pass in the state they
belong to, and CallSyscall*, hleFinishSyscall and the HLE mips call
machinery use it instead of currentMIPS.

The wrappers in FunctionWrappers.h take the function as `auto` and call it
through HLECall, which also accepts an implementation with an extra leading
MIPSState * parameter and passes the state to it. Any other signature still
fails to compile, as before. PARAM/RETURN now refer to a local `mips`.

The HLE functions (and replacement functions) that used currentMIPS now take
the state that way. Callers outside a syscall's own frame - CoreTiming
events, the adhoc matching thread, dialogs, PPGe, the debugger UIs - pass
currentMIPS or &mipsr4k explicitly. The kernel's thread internals still use
currentMIPS.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 15:45:14 +02:00
Henrik RydgårdandClaude Opus 5.5 d42f34d3de Kernel: Keep alarm and vtimer queues in step with their pending interrupts
Each due alarm or vtimer queues its id next to a pending interrupt, which
pops it when it runs. An alarm cancelled with its interrupt pending was
never popped, so every later alarm interrupt found the cancelled one at
the front and was dropped: no alarm ran again. Deleting a vtimer erased
its id instead, leaving the last pending interrupt with an empty list.

Both now pop a timer that's gone when its interrupt comes, as
threads/alarm/pending and threads/vtimers/pending show the PSP still runs
the rest, in order.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-19 21:41:48 +02:00
Henrik RydgårdandClaude Opus 5.5 6e0d6f4357 Savestates: Terminate fixed-size name strings on load
Add DoCString() for standalone fixed-size strings, and
TerminateLoadedCString() for names inside structs that are loaded whole.
These all get used as C strings (GetName(), logs, the debugger), and are
always terminated when created. Module names are copied from the ELF with
strncpy, so terminate those on creation too.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-09 15:32:06 +02:00
Henrik Rydgård 5198317e24 Back out some excessive checking in the latest changes. Change TOOD: to TODO: . 2026-08-11 22:27:44 +02:00
Henrik Rydgård 4cd10efe07 More memory access cleanup 2026-08-11 20:12:15 +02:00
Henrik Rydgård 3bd41376da More memory cleanup 2026-08-11 20:12:10 +02:00
Henrik Rydgård 3c81d6b121 More manual Read_U32 cleanup
Buildfix
2026-08-11 10:28:36 +02:00
Henrik Rydgård af9891cd7d More Read_U32 and Read_U64 2026-08-11 09:08:52 +02:00
Henrik Rydgård c99a303646 Fix behavior so we can turn off "IgnoreBadMemAccess" in headless 2026-07-29 18:38:25 +02:00
Henrik Rydgård d6ebfed432 Fix some bugs and warnings from a pass of static analysis 2026-01-29 17:41:54 +01:00
Henrik Rydgård 0f840e6240 Move JPEG error codes to the big enum, some include cleanup 2025-03-21 20:44:46 +01:00
Henrik Rydgård d7fe62badf Fix odd vtimer error code discrepancy 2025-03-05 17:02:46 +01:00
Henrik Rydgård 47ef0e9b6e More logging refactoring 2025-03-05 17:02:46 +01:00
Henrik Rydgård e01ca5b057 Logging API change (refactor) (#19324)
* Rename LogType to Log

* Explicitly use the Log:: enum when logging. Allows for autocomplete when editing.

* Mac/ARM64 buildfix

* Do the same with the hle result log macros

* Rename the log names to mixed case while at it.

* iOS buildfix

* Qt buildfix attempt, ARM32 buildfix
2024-07-14 14:42:59 +02:00
Unknown W. Brackets a7b7bf7826 Global: Set many read-only params as const.
This makes what they do and which args to use clearer, if nothing else.
2022-12-10 21:13:36 -08:00
Unknown W. Brackets e7b968be73 Debugger: Notate Memcpys directly as well. 2021-02-15 15:01:23 -08:00
Unknown W. Brackets b8342fb8ec SaveState: Rename ChunkFile files to Serialize.
Makes more sense and less weird than ChunkFileDoMap, etc.
2020-08-10 08:04:05 +00:00
Unknown W. Brackets 1dc5ee424b SaveState: Split out Do types to reduce headers. 2020-08-10 08:03:44 +00:00
Unknown W. Brackets 4b4e3432cd SaveState: Split Do() into a separate header. 2020-08-10 08:03:41 +00:00
Henrik Rydgård df6d0a8ae7 PSP kernel: Improve logging when accessing bad kernel object handles. 2020-07-20 11:57:11 +02:00
Unknown W. Brackets 2450724be2 Make Memory::Memcpy() execute memchecks directly.
This makes it easier to handle breakpoints in HLE.
2015-04-05 18:09:20 -07:00
Lioncash cac632424c Core: Add missing override specifiers 2014-12-08 15:20:31 -05:00
Lioncash 4ccb838306 Core: Mark some module functions as static 2014-12-08 04:40:08 -05:00
Unknown W. Brackets a42a2864a6 Protect against vtimers scheduled in past. 2014-09-01 20:03:57 -07:00
Unknown W. Brackets 2cad35ad59 Put a 250us minimum on all vtimer scheduling. 2014-09-01 20:03:56 -07:00
Unknown W. Brackets 4e9f54a400 Require 250us lead time to start a vtimer.
Matches tests, improves the threads/vtimers/delete test.
2014-09-01 20:03:56 -07:00
Unknown W. Brackets 05ab192c9c Reduce includes in Core/HLE/.
Especially templates.
2014-03-15 11:22:19 -07:00
Unknown W. Brackets 4803dfdce1 Use CoreTiming::GetGlobalTimeUs() for vtimers. 2013-10-24 01:10:46 -07:00
Unknown W. Brackets 05f2f53358 The vtimer return value is treated as u32. 2013-10-22 22:50:52 -07:00
Unknown W. Brackets 580d4436a3 Fix vtimer uid param type, add algorithm include. 2013-10-22 07:46:33 -07:00
Unknown W. Brackets 47714d4b82 Don't change the vtimer schedule with no handler. 2013-10-22 07:45:53 -07:00
Unknown W. Brackets 0a373b08b7 Return better vtimer errors within interrupts. 2013-10-22 07:45:53 -07:00
Unknown W. Brackets b7fd768ecc Correct vtimer scheduling. 2013-10-22 07:45:52 -07:00
Unknown W. Brackets a47c88d658 Run missed handlers when setting vtimer time. 2013-10-22 07:45:52 -07:00
Unknown W. Brackets 856e3b7071 Fix error code on start vtimer with current. 2013-10-22 07:45:51 -07:00
Unknown W. Brackets 002aed1080 Update current and limit bytes in vtimer refer. 2013-10-22 07:45:50 -07:00
Unknown W. Brackets ea507388ea Return a special error for the running vtimer.
Also, ues 0 when none is running.  This explains the different error code.
2013-10-22 07:45:50 -07:00
Unknown W. Brackets 9bd988e376 Fix doubling of current on vtimer stop. 2013-10-22 07:45:49 -07:00
Unknown W. Brackets 167699ac9e Correct sceKernelGetVTimer*Wide() error value. 2013-10-22 07:45:49 -07:00
Unknown W. Brackets 67cd13702e Correct sceKernelSetVTimerTime*(). 2013-10-22 07:45:48 -07:00
Unknown W. Brackets 29d7d00b08 sceKernelCancelVTimerHandler() resets handler only. 2013-10-22 07:45:48 -07:00
Unknown W. Brackets c9755d7886 Correct errors from sceKernelCancelVTimerHandler(). 2013-10-22 07:45:47 -07:00
Unknown W. Brackets 7edebd1c2f Put vtimer args on the stack, skip allocation.
This is roughly where they are on the PSP based on tests, and it avoids
having to manage memory or etc.
2013-10-22 07:45:47 -07:00
Unknown W. Brackets 50e9e45d65 Check version in each DoState() func.
They bail on PointerWrap error or bad version.
2013-09-14 20:23:03 -07:00
Henrik Rydgard 8c88dff5a4 More log categories, use them (and existing ones). Improve log config. 2013-09-07 22:02:55 +02:00
Unknown W. Brackets 0b5bdeb1d3 Fix some compile failures under big endian. 2013-07-28 21:04:17 -07:00
Unknown W. Brackets 81f7103e0b Use *_le for the sceKernel* funcs. 2013-07-25 08:04:34 -07:00
Henrik Rydgård 87b5f72932 Merge pull request #2698 from unknownbrackets/warnings
Warning fixes
2013-07-08 00:32:11 -07:00
Unknown W. Brackets 2ba976bffb Fix rescheduling of vtimers based on return value. 2013-07-07 21:36:01 -07:00
Unknown W. Brackets b42cb0581c Remove fixed delay, this is just other syscalls. 2013-07-07 21:16:48 -07:00