Commit graph

331 commits

Author SHA1 Message Date
Unknown W. Brackets
1a38f6fa7d Properly remove terminated thread from ready queue.
If we change the priority first, we'll remove from the wrong priority
level, oops.  Gotta change afterward.

Should improve Darkstalkers Chronicle: The Chaos Tower.
2014-01-09 22:05:04 -08:00
Unknown W. Brackets
183b4cb45c Add a static method for creating PSPPointers.
This is still kinda ugly, but the assignment thing was just too ugly, I
couldn't do it anymore.
2013-12-16 23:50:52 -08:00
Unknown W. Brackets
e73d43c434 Correct sceKernelTlspl func names, etc.
This is mostly pedantic but it's nice to have the right names.
2013-12-02 23:40:16 -08:00
Unknown W. Brackets
7dedf54bc3 Always resched in thread queue rotation.
It might be time to reschedule anyway, some games call this in a loop with
an empty queue.

May help Harukanaru Toki No Naka de Hachiyoushou (#4669.)
2013-11-29 08:59:47 -08:00
Henrik Rydgard
f9f6e9492d Reorder vfpu data in saved kernel contexts when loading in a new version. 2013-11-28 13:27:51 +01:00
Henrik Rydgard
55500d4bb6 Reorder VFPU registers in memory so that we can flush and reload them in bulk more often.
Doesn't actually do that yet, that's for the NEON branch.
2013-11-28 13:27:51 +01:00
Unknown W. Brackets
41a7157aa6 Eat some cycles when changing thread priority.
Some games call this a lot.
2013-11-28 01:01:22 -08:00
Unknown W. Brackets
21c9577801 Initialize fcr31 correctly (even though unsup.) 2013-11-14 23:44:49 -08:00
Unknown W. Brackets
26f5922174 Return the correct value for fcr0/fir.
This is what the PSP actually returns, it's read only.
2013-11-14 23:39:08 -08:00
Unknown W. Brackets
baa82e0a9d Keep syscalls the same in the interpreter.
Rather than having different bugs.
2013-11-04 07:59:36 -08:00
Henrik Rydgård
b2298a9e86 Merge pull request #4420 from unknownbrackets/savestates
Enable rewind feature in UI, fix a savestate bug
2013-11-03 03:21:51 -08:00
Unknown W. Brackets
d400b1a67b Keep track of the current thread obj.
To reduce overhead/improve perf.  Actually, it used to be only the current
thread object, but now it's just a cache with accessors.
2013-11-02 22:12:44 -07:00
Unknown W. Brackets
738dfc84e4 Speed up __GetCurrentThread(), it's called a lot.
This only needs to be an assertion.
2013-11-02 22:12:43 -07:00
Unknown W. Brackets
f716d781b6 Retain threadend waits in savestates.
Oops, been broken since 3fb2c8f654.
2013-11-02 17:40:23 -07:00
Unknown W. Brackets
9ebaf7b68b Fill registers with 0xDEADBEEF after most syscalls.
Some, like sceMpegRingbufferPut(), we don't, since... it's complicated.
But most we do, like a real PSP does.
2013-10-30 00:47:04 -07:00
Unknown W. Brackets
04ec987448 Initialize thread regs with 0xDEADBEEF.
Also initialize the float regs to NaN.
2013-10-29 21:39:24 -07:00
Unknown W. Brackets
95c68ae1e7 Assert some unlikely buffer overflows. 2013-10-26 18:30:55 -07:00
Henrik Rydgard
bf89c01215 When atrac3+ decoding fails, stop decoding silently-ish instead of decoding garbage, spamming the log 2013-10-21 23:10:30 +02:00
Unknown W. Brackets
f5e0d80ead Pass arguments to root threads same as regular.
Before it would have issues or crash if the args were > 256 bytes.
Fixes Ys 1 & 2 Chronicles.
2013-10-16 01:31:58 -07:00
Unknown W. Brackets
e06889069c Don't use the destructor to free thread stacks.
If we do, kernelObjects.clear() will trash perfectly good memory on
loading a state.  I guess it also makes shutdown slower.

Fixes #4186.
2013-10-14 22:09:16 -07:00
Unknown W. Brackets
a194006aad Fix crash deleting a never started thread.
Fixes #4069.
2013-10-08 22:39:49 -07:00
Unknown W. Brackets
5be30fb857 Add support for the clear stack thread attr. 2013-10-06 12:16:58 -07:00
Unknown W. Brackets
b928f50353 Cleanup sceKernelRegisterExitCallback() per tests. 2013-09-29 01:10:07 -07:00
Unknown W. Brackets
a7ec139b5a Savestate the exit callback, reporting.
Seems like LoadExecForUser_362A956B() uses it, so we need to save it.
I have no confidence that function works correctly, so let's report it.
2013-09-29 00:19:54 -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
Unknown W. Brackets
ca6491ea22 Auto resume dispatch at thread start/create. 2013-09-12 08:02:43 -07:00
Unknown W. Brackets
b898e397aa Correct sceKernelGetThreadStackFreeSize().
It was always returning 0.
2013-09-10 01:31:03 -07:00
Unknown W. Brackets
0f7ac377cd Offset the root thread's stack by arg size.
Otherwise it'll just overwrite, right?
2013-09-10 01:12:51 -07:00
Unknown W. Brackets
ada492febe Fix really stupid heap corruption mistake. 2013-09-09 22:33:17 -07:00
Unknown W. Brackets
ccf021cef0 Return a negative error code in __KernelGetWaitID.
This way we can use 0 as a proper wait id.
2013-09-09 21:39:56 -07:00
Unknown W. Brackets
2577f65b80 Reset waits when terminating a thread.
Terminated threads can't be waiting.
2013-09-09 21:39:38 -07:00
Unknown W. Brackets
e19fdef0fd Reset thread priority on terminate. 2013-09-09 21:31:04 -07:00
Unknown W. Brackets
a3637a1cad Set the low mystery bits of the thread attr.
Tests on PSP show this, and I can't find a way to not have them set.
But I don't really know what they mean.

Anyway, since you can refer the status, you can see them, may improve
compatibility.
2013-09-09 20:51:52 -07:00
Unknown W. Brackets
0af3c50924 Eat cycles after creating a thread.
Improves things on some tests, should be more accurate.
Creating a thread sure takes a long time.
2013-09-09 20:49:30 -07:00
Unknown W. Brackets
1481bbdd3b Validate and report some thread attributes. 2013-09-09 20:48:23 -07:00
Unknown W. Brackets
ce4c0d85bb Support some thread stack attr options.
May improve memory management in some games.
2013-09-09 20:46:19 -07:00
Unknown W. Brackets
1040123a97 Delete callbacks when their thread is deleted. 2013-09-09 00:22:00 -07:00
Unknown W. Brackets
4bba276696 Run callbacks in creation order, not notify order. 2013-09-09 00:21:59 -07:00
Unknown W. Brackets
87bd8d59e2 Clean up umd bad callback id errors, oops. 2013-09-09 00:21:53 -07:00
Unknown W. Brackets
64b75ed3ff Decentralize callback registration.
Callbacks are always tied to THEIR thread, and the registration was all
based on the current thread which is just not the right way.
2013-09-09 00:21:15 -07:00
Unknown W. Brackets
94e88943d8 Keep a single list of pending callbacks.
Doing it per type only meant that we'd incorrectly call a callback twice
if it was notified by e.g. scePowerRegisterCallback() and
sceKernelNotifyThread(), which isn't what's supposed to happen.
2013-09-09 00:21:14 -07:00
Unknown W. Brackets
f1b62983b5 Add callback wait handlers for threadend as well. 2013-09-08 12:14:07 -07:00
Unknown W. Brackets
6d8213b0c5 Always specify retval when resuming a thread. 2013-09-08 12:02:18 -07:00
Unknown W. Brackets
4c828cd9a0 Remove __KernelTriggerWait(), no longer used. 2013-09-08 11:58:40 -07:00
Unknown W. Brackets
3fb2c8f654 Use a waitingThreads list for threadend.
The timeout wasn't being correctly written before, actually.
2013-09-08 11:15:09 -07:00
Unknown W. Brackets
b03be16fa6 Refactor thread end/delete a bit. 2013-09-08 10:50:55 -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
d8d8d3b0ec Use a different wait type for async io. 2013-09-07 11:04:42 -07:00
Unknown W. Brackets
2a7e9a5afc Cleanup sceKernelCreateCallback().
And tweak sceKernelReferCallbackStatus().
2013-09-03 22:18:15 -07:00
Unknown W. Brackets
b20bb3b609 Refactor down the begin/end callback stuff. 2013-09-03 01:21:52 -07:00