Unknown W. Brackets
2a6457b6ab
Cut down on h files including PointerWrap.
...
This makes changes to it a bit faster to build.
2013-02-04 08:26:59 -08:00
Unknown W. Brackets
1cb7a88137
Don't use a dynamic string for wait debugging.
...
Happens in release, and shows up on the profiler.
Not huge, but should save ~0.5% of cpu time.
2013-01-26 11:29:19 -08:00
Unknown W. Brackets
43c8726554
Oops, 0 is a valid timer id.
2013-01-18 01:38:14 -08:00
Unknown W. Brackets
4a56873541
Properly wake semaphores in priority order.
2013-01-18 01:38:13 -08:00
Unknown W. Brackets
305c41c932
Prevent duplicate waiting threads in sema/mutex.
...
If something did a tight loop of a short wait/timeout, it might end
up getting on the waitingThreads list multiple times.
Eventually this caused a massive performance problem.
2012-12-31 23:23:52 -08:00
Unknown W. Brackets
bcecd881b1
Savestate cleanup + be more careful with vectors.
...
For some reason I debugged it going into std::string so I just made
them all more explicit which fixed everything.
2012-12-28 13:55:31 -08:00
Unknown W. Brackets
3ed2045f6b
Add state saving to tertiary kernel modules.
2012-12-28 13:55:25 -08:00
Unknown W. Brackets
595759ef78
Implement a factory for kernel objects.
...
Couldn't think of a better way to do this, maybe there's some fancy
one I don't know about.
Also finished up a couple left over kernel objects.
Maybe a quarter the way there?
2012-12-28 13:55:22 -08:00
Unknown W. Brackets
991243fffd
Add basic DoState() to tertiary kernel objects.
2012-12-28 13:52:52 -08:00
Henrik Rydgård
b2f29992a3
Wrap some functions, clean some stuff
2012-12-26 08:52:40 +01:00
Unknown W. Brackets
9ba0ed46fd
Always create CoreTiming timers during kernel init.
2012-12-23 21:27:26 -08: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
45258bb61f
Cleanup behavior in sceKernel*EventFlag() funcs.
...
Biggest change is just that sceKernelSetEventFlag() rescheds.
2012-12-14 21:25:29 -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
1a77b22e3a
Implement priority signaling for semaphores.
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
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
7164638799
Allow semaphores with waiters to signal.
...
If the max is 1, but there's 1 waiting, it's okay to signal 2.
Really, the final result is what matters.
2012-11-30 22:58:41 -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
Ced2911
6db4ea2ad1
less Memory::GetPointer
2012-11-27 10:18:36 +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
b71d998a20
Broadcast a threadend event to wake mutexes.
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
619a9906de
Remove threads from semaphores when they timeout.
...
This makes wait tests *almost* pass. There's some timing
related issues left, though.
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
40a6ebfabe
Fix sceKernelCancelSema() to handle any negative.
...
So the test isn't failing.
2012-11-20 02:19:21 -08:00
Unknown W. Brackets
157858819b
Additional semaphore fixes with updated tests.
2012-11-17 01:43:01 -08:00
Unknown W. Brackets
2e9e61dfc6
CancelSema: adjust scheduling to match PSP.
2012-11-16 01:50:26 -08:00
Unknown W. Brackets
8517fbe761
PollSema: don't allow values <= 0.
2012-11-16 01:41:54 -08:00
Unknown W. Brackets
71e57043e8
SignalSema: throw an error on overflow.
...
This is what the PSP does.
2012-11-16 01:32:00 -08:00
Unknown W. Brackets
dd14450424
CreateSema: Truncate and validate like the PSP.
2012-11-16 01:26:04 -08:00
Unknown W. Brackets
0ab19c18e5
Wrap sceKernelCreateSema().
2012-11-16 00:06:44 -08:00
Unknown W. Brackets
4191d40187
Add notes about PRIORITY attribute.
...
Not supported yet.
2012-11-15 23:55:23 -08:00
Unknown W. Brackets
306274ffdf
Fix iterator in sceKernelSignalSema().
...
I'm sure we dont' want to change s.
2012-11-14 07:42:21 -08:00
Unknown W. Brackets
5c69d6169f
Use WriteStruct() in sceKernelReferSemaStatus().
2012-11-14 00:13:17 -08:00
Unknown W. Brackets
f37dd7fefe
Fix $v0 on wrong thread in semaphore funcs.
...
Need to RETURN() prior to switching threads or it will write to the
wrong thread, oops.
2012-11-12 07:24:40 -08:00
Unknown W. Brackets
33559d23db
sceKernelDeleteSema() not returning 0?
...
Seems to be a bug outside this func, adding a comment at least.
2012-11-11 19:03:37 -08:00
Unknown W. Brackets
b58032039b
Cleanup sceKernel semaphore funcs.
...
Remove some duplication of code so it's cleaner.
2012-11-11 18:54:06 -08:00
Unknown W. Brackets
a69fd56573
Implement sceKernelCancelSema() based on jpcsp.
...
Don't have any tests/users, but this jpcsp's behavior seems sane.
2012-11-11 18:33:13 -08:00
Unknown W. Brackets
e7b6487c4e
Wrap sceKernel DeleteSema and CancelSema.
...
Also fix copy/paste mistake from SignalSema func.
2012-11-11 18:30:13 -08:00
Unknown W. Brackets
70809bf1f5
Make sceKernelDeleteSema() resume waiting threads.
...
This makes threads/semaphores *almost* pass.
It's now failing from sceKernelStartThread() or something, though.
2012-11-11 18:10:33 -08:00
Unknown W. Brackets
deab1c21b7
Fix sceKernelSignalSema().
...
Handle numWaitThreads and currentCount more correctly.
Well, I'm not 100% sure it's totally right now but it matches the test.
2012-11-11 17:59:15 -08:00