Commit Graph
64 Commits
Author SHA1 Message Date
Henrik RydgårdandClaude Sonnet 5 28cbb3a967 Add the scratchpad's missing kernel-mode mirrors, fix a mask bug hiding them
The scratchpad (PSP's repurposed-cache scratch RAM, 0x00010000+) was only
mirrored for user-mode access (cached 0x00010000, uncached 0x40010000) -
kernel-mode code sees it at 0x80010000/0xC0010000 (the kernel bit,
0x80000000, is independent of and combinable with the uncached bit,
0x40000000 - not "the uncached bit" as an earlier doc note in this branch
mistakenly called it). Missing entirely from MemMap.cpp's views[] table,
causing a real SIGSEGV the first time kernel-mode code (flash0:/reboot.bin)
touched it.

Adding the two missing views wasn't sufficient: the scratchpad range check
is duplicated eight times (IsValidAddress/IsValid2AlignedAddress/
IsValid4AlignedAddress/MaxSizeAtAddress in MemMap.h, and four more in
MemMapFunctions.cpp), and all eight used a mask (0xBFFFC000) that cleared
the uncached bit but kept the kernel bit, rejecting 0x80010000 as invalid
before ever reaching the now-mapped memory. Fixed all eight to 0x3FFFC000,
matching Memory::MEMVIEW32_MASK (which the JIT backends already used
correctly for the equivalent runtime check).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GZq8ZtJmFY7bkX5FVkr3P9
2026-08-13 11:36:42 +02:00
Henrik Rydgård c5e4d0d90d Rename the get-memory-pointer functions to make it clear where CPU exceptions can happen. 2026-08-12 14:06:16 +02:00
Henrik Rydgård 0596ee97f6 More memory access cleanup 2026-08-11 20:14:01 +02:00
Henrik Rydgård 3bd41376da More memory cleanup 2026-08-11 20:12:10 +02:00
Henrik Rydgård 66c8bfbcb2 Improve semantics 2026-08-10 10:11:24 +02:00
Henrik Rydgård 878d2aeb0e Fix a bunch of possible crashes due to our VRAM check thinking that VRAM in kernel space is valid (but nothing is mapped there, unless you use masked memory) 2026-07-27 23:44:14 +02:00
Henrik Rydgård 5f7a937466 Rename ValidSize to ClampValidSizeAt 2025-12-30 20:31:07 +01:00
Henrik Rydgård 006210ea71 Minor simplification 2025-04-30 09:54:51 +02:00
Henrik Rydgård a3480f6174 MemmapFunctions.cpp: Remove reporting from WriteToHardware etc. We know the whole user-mode memory map. 2025-04-30 09:54:51 +02:00
Henrik Rydgård d586ec0d5e Don't create Host objects except in headless/unittest 2023-03-25 10:47:01 +01:00
Henrik Rydgård aa80659530 Memory exception: Add facility to track size
Might theoretically help in tracking some things down.

Not fully utilized yet, the fault handler needs to extract the
information from the faulting instruction. But we can use it for
GetPointerRange etc.
2023-01-01 20:30:29 +01:00
Henrik Rydgård a4d3e0ead8 Add range checks in replaced memcpy/memset functions. (#16693)
* Add range checks in replaced memcpy/memset functions.

Keep seeing especially Replace_memcpy as a semi-rare crash in the
reports. Hopefully this will take care of it, though if games hit this,
they're probably on their way to failing somehow anyway.

* Alternate approach, correctly causing memory exceptions if not ignoring
2023-01-01 18:25:40 +00:00
Unknown W. Brackets 49f6c461ad Reporting: Fix some header includes.
Particularly in Common, avoid including Core/Reporting.h.
2022-12-27 14:58:20 -08:00
Henrik Rydgård 861d66a4d4 Separate logging for GetPointer/GetPointerWrite 2022-07-24 13:39:37 +02:00
Henrik Rydgård e6403d7157 Split GetPointer into two versions, to help with const correctness 2022-07-24 13:26:19 +02:00
Unknown W. Brackets 2479d52202 Global: Reduce includes of common headers.
In many places, string, map, or Common.h were included but not needed.
2022-01-30 16:35:33 -08:00
Unknown W. Brackets 744d17e13c Core: Correct ValidSize outside scratchpad.
And simplify all the scratchpad valid checks.
2021-04-21 19:32:22 -07:00
Henrik Rydgård a22181df1c Partially fix Katamari (flicker due to choice of the wrong depth buffer still happening). 2020-09-01 22:54:36 +02:00
Henrik Rydgård 7208cf6900 Some code reformatting/renaming 2020-07-12 15:25:21 +02:00
Henrik Rydgård 8461ea19b1 Centralize handling of memory exceptions a bit 2020-07-12 15:25:20 +02:00
Henrik Rydgård a9befb5496 Remove our custom atomics code entirely. 2020-05-17 13:11:36 +02:00
Unknown W. Brackets b4496f1975 Core: Move config enums to separate file.
These are a bit strewn about and there are constants that aren't
consistently used, which just adds confusion.
2018-06-23 10:59:18 -07:00
Henrik Rydgard b9b3a022fb Switch another enum to enum class 2017-03-02 12:36:54 +01:00
Henrik Rydgard 4e52f613f1 Additional fixes and buildfixes 2016-05-08 22:23:51 +02:00
Henrik Rydgard 492ea5fac4 Address a bunch of comments, thanks for the review 2016-05-08 21:38:03 +02:00
Henrik Rydgard ce8aae5ed1 Make the IRJit core selectable in developer tools 2016-05-08 01:43:27 +02:00
Unknown W. Brackets 0c46d7c081 Correct scratchpad memory range checks. 2015-12-27 14:29:12 -08:00
Unknown W. Brackets 09b9d2ad81 Keep track of ranges that have emuhack ops.
So that we can invalidate them smarter.
2014-07-05 16:25:16 -07:00
Unknown W. Brackets 4b9229a5ba x86jit: Flush the PC before r/w in debug.
This way we get better log output.
2014-07-05 12:57:44 -07:00
Unknown W. Brackets 80cc9d8c0e Mirror memory for VRAM mirrors.
For a long time we've done this with GetPointer() only, but it's better if
it's the same for all methods of memory access.

Technically, we should do the swizzling (and also swizzle the depth data in
softgpu), but there's no indication games depend on this, and GetPointer
would need changes anyway.
2014-05-06 00:45:47 -07:00
Henrik Rydgård ce378b231f Delete CPU.cpp/h , cleanup 2013-12-30 00:11:29 +01:00
Unknown W. Brackets 5b0ece85da Use additional memory map mirrors for 32-bit.
Well, use them always for simplicity, but this works around 32-bit
limitations on mmap() size for Android and Linux.
2013-12-10 23:40:37 -08:00
Henrik Rydgard 84f20a1cad Small optimizations 2013-11-12 14:05:50 +01:00
Henrik Rydgard 5bdb9e976b Track copies of framebuffers in ram created through sceDmacMemcpy, so that we can display them.
Fixes MotoGP while also, in effect, committing #3859.
Removes the horrifying ramDisplayFramebufferPtr hack.
2013-09-21 18:53:55 +02:00
Unknown W. Brackets 38e30e5a67 Fix bugs when memory size is 0x04C00000/etc.
Was experimenting with trying to match my non-phat's ram size.
2013-09-09 00:25:10 -07:00
Unknown W. Brackets ad8da6e02f Report bad memory access (first time only.) 2013-08-21 08:40:30 -07:00
Unknown W. Brackets 5787a2b9f7 KISS and Android buildfix. 2013-08-16 23:48:08 -07:00
Ced2911 c332a4af58 Endian and PPC support 2013-08-16 14:34:15 +02:00
Henrik Rydgard 03c665173f Fix range of newui volume control. Delete some old junk. 2013-07-21 12:12:20 +02:00
The Dax bd0944fc49 Remove a few more unneeded includes and change a loop to use ARRAY_SIZE instead of a variable. 2013-06-26 16:02:53 -04:00
The Dax d11deba3cd Fix HD Remasters and tidy up. This should be the final commit for the preliminary support, no further coding style issues withstanding. 2013-06-26 16:02:53 -04:00
The Dax 8ab734d516 Restructure the hack to be more correct, and add support for double texture coordinates. Fixes #2314.
Also address various coding style issues.
2013-06-26 16:02:52 -04:00
The Dax 96401eae1e Make the hack less intrusive, but there's a chicken and egg problem: Memory::Init is called before LOAD_PSP_ISO, so I'm slightly perplexed on how to proceed at the moment. 2013-06-26 16:02:52 -04:00
The Dax 2da4c01ea9 Fix styling issues. 2013-06-26 16:02:52 -04:00
The Dax f8d309ec99 Add HD Remaster support. It's a HUGE hack right now, and needs to be properly rewritten so that allocation and stuff work better. This is based off the work of BlackDaemon, and I added in the auto check to switch the code on/off depending on if the game is a remaster or not. It does not affect or break any games that I know of. 2013-06-26 16:02:52 -04:00
Sacha 8dd683f63f Fix name collision when building on Windows. Was preventing Blackberry from building. 2013-05-03 16:10:23 +10:00
Unknown W. Brackets 78d14ecd04 Remove some unused/undefined memmap funcs. 2013-03-16 19:46:24 -07:00
Unknown W. Brackets 0ec531587c Fix valid address checking.
Fastmem crashes if it hits these addresses, but they're not reported as
wrong.
2013-03-16 19:43:34 -07:00
Unknown W. Brackets 12e2a56ef2 Fix bIgnoreBadMemAccess ignored in GetPointer. 2013-02-23 12:55:05 -08:00
Henrik Rydgard 37f998407b Replace "Core" with "Jit" in ini. Don't show Open dialog by default (use Ctrl+A or Ctrl+O to open it).
Delete "Slightly Faster Interpreter".
2013-02-16 09:49:33 +01:00