Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HLE: sceKernelAllocPartitionMemory volatile memory support (partition 5) #16052

Merged
merged 1 commit into from
Sep 20, 2022

Conversation

Crow-bar
Copy link
Contributor

The real psp, when requesting memory from the 5th partition, allocates it in the range 0x08400000 - 0x08800000.
This should fix some homebrew issue.

@unknownbrackets
Copy link
Collaborator

This needs to think about save states, at least. I think there were other restrictions though - might only be kernel mode or when volatile memory is locked?

-[Unknown]

@Crow-bar
Copy link
Contributor Author

This needs to think about save states, at least. I think there were other restrictions though - might only be kernel mode or when volatile memory is locked?

-[Unknown]

Yes
This works in user mode, requires a prior call to sceKernelVolatileMemLock.
When saving or hibernating, psp waits for volatile memory to be unlocked (sceKernelVolatileMemUnlock).

Maybe something is missing in my code.

@hrydgard
Copy link
Owner

Yeah, this looks like something we should support. Unknown is right that it'll need versioning checks in the state save code.

For testing purposes and so forth, could you link to or name some homebrew that uses this?

@hrydgard hrydgard added this to the v1.14.0 milestone Sep 19, 2022
@hrydgard hrydgard added the HLE/Kernel Kernel, memory manager, other HLE issues label Sep 19, 2022
@unknownbrackets
Copy link
Collaborator

I added the save state handling in #16058 (merging that will merge this as well.)

-[Unknown]

@Crow-bar
Copy link
Contributor Author

Crow-bar commented Sep 20, 2022

Yeah, this looks like something we should support. Unknown is right that it'll need versioning checks in the state save code.

For testing purposes and so forth, > Yeah, this looks like something we should support. Unknown is right that it'll need versioning checks in the state save code.

For testing purposes and so forth, could you link to or name some homebrew that uses this?

DaedalusX64 (maybe a bad example)
https://github.com/DaedalusX64/daedalus/blob/master/Source/SysPSP/Utility/VolatileMemPSP.cpp

AGS
https://github.com/adventuregamestudio/ags/blob/master/PSP/malloc/malloc.c

Xash3d will use this):
https://github.com/Crow-bar/xash3d-fwgs

I wrote a small test:
https://github.com/Crow-bar/p5test

@unknownbrackets unknownbrackets merged commit 640ff1c into hrydgard:master Sep 20, 2022
@unknownbrackets
Copy link
Collaborator

It seems like it allows allocating even if you don't lock volatile memory first (of course you'll get a fault if you access it.) I haven't thoroughly tested, but it also seems like locking/unlocking volatile won't reset allocations.

-[Unknown]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
HLE/Kernel Kernel, memory manager, other HLE issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants