Commit graph

45 commits

Author SHA1 Message Date
Unknown W. Brackets
65cfc8de86 Cleanup and fix mutex init, no need for a flag now. 2012-12-23 18:27:07 -08:00
Henrik Rydgård
4a4d126dc7 Init/shutdown mutex 2012-12-23 11:19:55 +01:00
Unknown W. Brackets
87fcdc9080 Use KERNELOBJECT_MAX_NAME_LENGTH for name length.
Just avoiding magic numbers, didn't know there was a constant.
2012-12-16 21:36:52 -08:00
Unknown W. Brackets
bb10140728 Oops, event flags weren't always deleting properly.
Added some comments to explain why removal from waitingThreads is
deferred.  Also had to move things around so the right outBitsPtr
is always written to on timeouts.
2012-12-15 01:36:53 -08:00
Unknown W. Brackets
67f7f6b05d Oops, these flags can be or'd together of course. 2012-12-14 23:24:04 -08:00
Unknown W. Brackets
2ea992f2c4 Validate attr for mutexes, semas, and events. 2012-12-14 12:05:15 -08:00
Unknown W. Brackets
3d57a4c838 Cleanup some wrappers now that rescheds defer. 2012-12-09 01:04:54 -08:00
Unknown W. Brackets
5e8aa4c071 Implement deferred rescheduling/callbacks.
This way most HLE functions can be wrapped normally.  Hurray, sanity.
2012-12-09 01:04:53 -08:00
Unknown W. Brackets
fda41752e8 Simplify the API for HLE funcs to do callbacks.
__KernelWaitCurThread() already (ultimately) calls __KernelCheckCallbacks.
2012-12-09 01:04:52 -08:00
Unknown W. Brackets
ee1a729157 Turns out *CB() fires even when it succeeds. 2012-12-09 01:04:50 -08:00
Unknown W. Brackets
f9b561ee42 Implement priority unlocking for mutexes. 2012-12-09 01:04:49 -08:00
Unknown W. Brackets
a67505761e Mutexes and semaphores were rescheduling twice.
This was causing it to "jump" the correct thread and go to the next.
2012-12-07 00:46:18 -08:00
Unknown W. Brackets
00ca9d8dc7 Make the UMD wait funcs actually wait. 2012-12-01 23:29:24 -08:00
Unknown W. Brackets
998104e2eb Consider threads still waiting until they wake.
This seems to match the actual behavior of timeouts much better.
2012-11-30 23:04:24 -08:00
Unknown W. Brackets
48c5efd0c2 Match hw timing of mutex/sema timeouts better.
Affects some tests passing/not passing due to minor timing issues, ugh.
2012-11-30 22:58:42 -08:00
Unknown W. Brackets
3ab41e515d Mutexes and semaphores don't always reschedule.
It's just the normal rescheduling happening.  Previous tests weren't
correct.

Also some minor cleanup.
2012-11-30 22:58:41 -08:00
Henrik Rydgard
980d13fe50 Assorted GPU fixes: Advance vertex pointer, fixes missing triangles in SPT. More logging. Separate proj matrices for through and normal mode (through matrix don't need to get updated as often). Some cleanup. 2012-11-28 13:45:22 +01:00
Unknown W. Brackets
d3f2d9d10b Use u64 here to avoid warnings, better precision.
The timeout value is u32 anyway, so an int was already a loss.
2012-11-22 16:40:26 -08:00
Unknown W. Brackets
c2c2b77792 Fix threads locking more than one mutex at a time.
Duh, of course they can.  Even my test did, I'm stupid.
2012-11-22 16:33:16 -08:00
Unknown W. Brackets
1bf04790e9 Darn, buildfix for debug. 2012-11-21 07:28:54 -08:00
Unknown W. Brackets
879efb25cc Don't allow unlocking someone else's mutex. 2012-11-21 00:28:29 -08:00
Unknown W. Brackets
fa9b9840d0 Implement LwMutex locking and unlocking. 2012-11-21 00:21:25 -08:00
Unknown W. Brackets
db16f9309e Don't crash if something goes wrong with mutexes.
Probably can't happen but being defensive is good.
2012-11-20 22:57:14 -08:00
Unknown W. Brackets
b71d998a20 Broadcast a threadend event to wake mutexes. 2012-11-20 02:20:16 -08:00
Unknown W. Brackets
dd3db71b61 Forget mutex waiting threads when they timeout. 2012-11-20 02:20:16 -08:00
Unknown W. Brackets
8da2fb074c For mutexes/semaphores, register a global timer.
Instead of leaking one per each.  Should be faster.
Since we can only wait on one thing per thread at a time, this is fine.
2012-11-20 02:20:16 -08:00
Unknown W. Brackets
a81c138004 Create and Delete LwMutex funcs. 2012-11-20 02:20:15 -08:00
Unknown W. Brackets
fd41851503 Implement timeouts on semaphores too. 2012-11-20 02:20:14 -08:00
Unknown W. Brackets
4d71e32193 Update the value when mutexes timeout. 2012-11-20 02:20:14 -08:00
Unknown W. Brackets
aad7e48a1a Oops, turns out mutex timeouts are in micro.
Found it documented as milli somewhere, but it was wrong.
2012-11-20 02:20:14 -08:00
Unknown W. Brackets
d88fa153b7 Implement timeouts on mutexes.
Still need to set timeoutPtr after they expire.
Pretty sure I did this the right way, seems CoreTiming does already
allow/use multiple events for the same type?
2012-11-20 02:20:13 -08:00
Unknown W. Brackets
7b9a8bf766 Minor correctness on create mutex. 2012-11-20 02:20:12 -08:00
Unknown W. Brackets
7fa388952e Refactor mutex locking to simplify. 2012-11-20 02:20:12 -08:00
Unknown W. Brackets
0681c8e5c5 Add overflow error to mutex locking. 2012-11-20 02:20:12 -08:00
Unknown W. Brackets
2290397b94 sceKernelTryLockMutex() and fix other locking. 2012-11-20 02:19:21 -08:00
Unknown W. Brackets
4bfa24eca8 Fix sceKernelCreateMutex() to match tests.
Still have an issue where reusing threads doesn't work.
2012-11-20 02:19:21 -08:00
Unknown W. Brackets
a539580195 Reschedule after acquiring a lock.
This matches the actual test results.
2012-11-20 02:19:20 -08:00
Unknown W. Brackets
2613ed8806 Cleanup mutex func types.
Looks like mutexes reschedule when they lock, so switch to void.
2012-11-20 02:19:20 -08:00
Unknown W. Brackets
429ac9de87 Oops, CreateMutex was missing a parameter. 2012-11-20 02:19:19 -08:00
Unknown W. Brackets
4bab714db5 Mutexes go in FIFO order as expected.
The test was wrong.
2012-11-20 02:19:19 -08:00
Unknown W. Brackets
4cddd3092a Implement basic locking for sceKernel mutexes.
Test still not passing, due to odd order the mutex is unlocked in?
But, at least, it does lock now.
2012-11-20 02:19:19 -08:00
Henrik Rydgard
aea0580297 More reworking of Callbacks, plus some other little fixes. 2012-11-07 15:44:48 +01:00
Henrik Rydgard
83fb5e96de Logging, stubs and fixes 2012-11-06 20:56:19 +01:00
Henrik Rydgard
64cc573703 Switch to "GPL 2.0 or later" for various reasons. I wrote most of the code I imported from Dolphin (which is GPL2-but-not-later), so it should be OK. 2012-11-04 23:24:00 +01:00
Henrik Rydgard
4f7ad15758 Add snapshot of the whole source code. 2012-11-01 16:19:01 +01:00