Commit Graph

492 Commits

Author SHA1 Message Date
Unknown W. Brackets
940066db68 Core: Track exception on bad jumps. 2020-07-12 21:59:08 -07:00
Unknown W. Brackets
04c15c82c9 Kernel: Add a bit more thread info on crash. 2020-07-12 21:22:47 -07:00
Henrik Rydgård
1010a07f65 Expose more information on the crash screen (current kernel thread) 2020-07-12 16:47:53 +02:00
Henrik Rydgård
e184ed368d Kernel: Add a little paranoia check on chained mipscalls.
See #13057
2020-07-12 10:39:25 +02:00
sum2012
9900a761f8 oop 2020-05-30 19:44:48 +08:00
sum2012
d347d3b216 Remove log as @unknownbrackets suggest 2020-05-30 19:19:33 +08:00
Unknown W. Brackets
e8b651fbd6 Thread: Default to kernel threads from kernel.
This is an experiment.  In most cases, allowKernel will be false.
2020-05-25 18:59:07 +08:00
Unknown W. Brackets
9cb74691b6 Core: Add argmask for threadhacks to prevent crash.
Every HLEFunction should have an argmask.  Some asserts for shutdown
crashes someone was seeing when calling HLE funcs from a shutdown
function.
2020-03-22 23:33:05 -07:00
Unknown W. Brackets
54e1afda1e HLE: Make calling mips funcs simpler.
This makes their return value handling, scheduling, etc. more
straight-forward.
2020-03-22 06:59:43 -07:00
shenweip
c7db6b6466
Merge branch 'master' into Font-alloc/free 2020-03-16 08:16:50 +08:00
shenweip
2f088d0970 No need to manually decide pending or not for mipscalls. 2020-03-16 07:46:13 +08:00
Unknown W. Brackets
7d36b70a8e Kernel: Rename conflicting kernel object names.
These are names that can often conflict with system headers in ports.
Let's just simplify by prefixing with PSP.

No actual functional/code changes, just syntax and names.
2020-03-15 08:33:40 -07:00
shenweip
3ffb20b66b Font:alloc/free memory for font file and char bitmap.
Following the guide of JPCSP.
2020-03-15 23:05:28 +08:00
Unknown W. Brackets
1422c8d21b Kernel: Delay better in sceKernelReferThreadStatus.
Sometimes this is called in loops, so correct timing for errors.
2020-02-22 04:29:23 -08:00
Unknown W. Brackets
f63daf8185 Io: Change async thread priority if running.
Really thought I'd already done this, must've made a mistake...
Fixes #12400.
2019-10-20 10:26:37 -07:00
Unknown W. Brackets
4065fae262 Io: Destroy async threads on reset.
Oops, this left us in a different state on exit.
2019-10-20 10:25:57 -07:00
Unknown W. Brackets
f1037248f1 Io: Store sceIoChangeAsyncPriority value.
Also some prep for async threaded IO.
2019-09-01 08:16:05 -07:00
Unknown W. Brackets
dd804660c9 Psmf: Use kernel memory for helper thread stack.
Also, thread stacks must be 0x200 or larger.
2019-09-01 08:16:05 -07:00
Unknown W. Brackets
f244b390ae Kernel: Kernel threads can beget kernel threads.
Fixes #7687.
2019-03-23 12:05:06 -07:00
Unknown W. Brackets
fd8a0612fa SaveState: Initialize some memory that is saved.
At the very least, will help them compress better.  Also good not to leak
random memory.
2018-06-22 21:29:18 -07:00
Unknown W. Brackets
5bfba9b284 Debugger: Add HLE API funcs.
Lumping function symbols in here too, they're pretty related...
2018-06-08 06:59:18 -07:00
Unknown W. Brackets
5670fc03ae Debugger: Add debug interfaces for threads.
This way we can switch context.
2018-06-08 06:59:18 -07:00
Unknown W. Brackets
09e307b097 arm64jit: Update rounding mode on thread switch.
Since fcr31 is per-thread, we must update jit state when it changes.
This also fixes the rounding mode on load state and jit/interp switch.
2018-04-01 10:12:32 -07:00
Unknown W. Brackets
6149ac584f jit: Add interface to precompile functions.
This doesn't actually do any preloading yet, it just adds an API.
2018-01-06 16:43:38 -08:00
Henrik Rydgård
d6b7cde718 Fix a use-after-free in sceKernelTerminateDeleteThread 2017-12-03 02:33:50 +01:00
Unknown W. Brackets
9af0397e84 Kernel: Fix delete thread null check. 2017-11-25 14:08:50 -08:00
Henrik Rydgård
4cdbe0b957 Fix an ancient bug in sceKernelExitDeleteThread 2017-03-10 00:11:01 +01:00
latot
7047ad2271 fix sscanf types 2016-12-02 22:46:52 -03:00
Unknown W. Brackets
d876da1a01 Initialize fp correctly on a new thread. 2016-09-05 08:57:09 -07:00
Unknown W. Brackets
1e51a03d5a Point ra to the correct place on a new thread.
Turns out some games read the ra, maybe long jmps or something?
2016-09-05 08:56:27 -07:00
Unknown W. Brackets
8df298f622 Thread: Auto-resume dispatch for worse threads.
Seems this doesn't happen when you start a better priority thread, pretty
reproducibly.
2016-05-31 09:55:20 -07:00
Unknown W. Brackets
197f3393df Thread: Better/minor accuracy for sysclock delay.
Certain negative values shouldn't cause a delay, could help if a game has
a bug.
2016-05-31 09:55:19 -07:00
Unknown W. Brackets
d0d570c6ac ThreadEvent: Delete threads after handler runs.
It should actually run on the thread itself, it seems, but that's probably
not as important as the thread still existing.  This allows the handler to
get the thread name or etc.
2016-05-30 13:00:23 -07:00
Unknown W. Brackets
65820d6184 Thread: Use a short delay for 0us delays after all.
It seems the behavior varies.  Should help #6924 and #6981.
2016-05-29 22:04:47 -07:00
Unknown W. Brackets
4fc12cdd29 ThreadEvent: Handle getting scheduled off a thread. 2016-05-29 00:59:52 -07:00
Unknown W. Brackets
97cce6ccfe ThreadEvent: Trigger handlers for start/exit too.
Start isn't in the right place or on the right thread, and exit isn't on
the right thread either.  But these don't seem very particular about what
thread they run on.
2016-05-28 21:19:28 -07:00
Unknown W. Brackets
c6cd614f2b Thread: Allow mipscalls to be scheduled in a row.
Should be fine to just use the stack to save these things, likely that's
what happens in real firmware.  This fixes issues when a second mipscall
is scheduled in the same HLE syscall.
2016-05-28 21:18:03 -07:00
Unknown W. Brackets
ceb36fc81d ThreadEvent: Allow an exit event handler on self. 2016-05-28 21:17:54 -07:00
Unknown W. Brackets
be1cde15ba ThreadEvent: Initial support for create/delete. 2016-05-28 21:17:36 -07:00
Unknown W. Brackets
e9916bdf0b ThreadEvent: Add management functions.
Currently never being triggered, though.
2016-05-28 21:17:16 -07:00
Unknown W. Brackets
04576189b4 Callbacks: Fix delete when multiple for a thread.
Oops, this was deleting all after the deleted one.
2016-05-28 21:15:25 -07:00
Henrik Rydgard
4197148dc4 Add some paranoid checks hoping to fix crashes reported in Google Play developer console. 2016-04-09 18:27:35 +02:00
Unknown W. Brackets
ef1dc583a2 Fix various minor warnings. 2016-03-20 14:17:51 -07:00
Unknown W. Brackets
8c337850fc Disallow thread termination in interrupts.
But only for certain SDK versions, as per testing.
2015-11-15 11:38:59 -08:00
Unknown W. Brackets
9591db2daa Cleanup RETURN() in __KernelWaitCurThread().
This hasn't been needed for a while.
2015-10-24 13:11:07 -07:00
Henrik Rydgard
b07b002040 Introduce "Compatibility Flags".
These should be used very restrictively, see comment in Compatibility.h.

Should help #8004, by disabling depth rounding in Fight Night round 3.
2015-09-27 01:23:20 +02:00
Unknown W. Brackets
91632a1ea5 Add some fallback logic when scheduling dies. 2015-09-12 13:36:52 -07:00
Unknown W. Brackets
c03b163537 Move ThreadQueueList to a separate file.
Not reused anywhere, but just so it's a little cleaner.
2015-09-12 13:03:15 -07:00
Unknown W. Brackets
a1139a4f45 Add some comments to the thread queue handling. 2015-09-12 12:57:44 -07:00
Unknown W. Brackets
909e4b9bd8 Switch lo and hi so that low comes first.
This way we can treat it as a single 64-bit value.
2015-06-28 10:42:19 -07:00
Henrik Rydgard
8dc77ff32e ARM64: Turn off some debugging stuff, start implementing instructions. Something is wrong though, if I implement more than addiu things break.. 2015-04-06 18:13:09 +02:00
Unknown W. Brackets
2450724be2 Make Memory::Memcpy() execute memchecks directly.
This makes it easier to handle breakpoints in HLE.
2015-04-05 18:09:20 -07:00
Unknown W. Brackets
8d5f843bb8 Cleanup thread start and create logging.
Also report less cases.
2015-03-28 14:46:09 -07:00
Unknown W. Brackets
fc3d6ff04a Disable reporting for some thread funcs.
We know they are misused and it's not giving us extra information.
2015-03-28 14:32:32 -07:00
Unknown W. Brackets
0aaabcaac9 Clear old registered action types on reset. 2015-03-28 13:01:49 -07:00
Unknown W. Brackets
c2153ff976 Add new logging in sceKernelCreateThread(). 2015-03-22 21:22:40 -07:00
Unknown W. Brackets
110cc119ce Change some logging in the last Callback func. 2015-03-22 20:51:56 -07:00
Unknown W. Brackets
52a37c1330 Actually use the table's arg and ret masks. 2015-03-22 20:51:56 -07:00
Unknown W. Brackets
fcf0518223 Update all the HLE tables with arg and ret info. 2015-03-22 20:51:55 -07:00
Unknown W. Brackets
41631eb2b1 Try a different format of HLE logging. 2015-03-22 20:49:42 -07:00
Henrik Rydgard
fd1dcb881f Add ability to flag function to clear a bit of stack. See #6374, idea by JPCSP, pointed out by sum2012. 2015-03-02 01:03:12 +01:00
Chin
22593cddcc Use pre-increment instead of post-increment for iterators, and use auto for some iterators 2015-03-01 16:55:47 +01:00
Unknown W. Brackets
d5c7fb3f0e Avoid an out of bounds mem access. 2015-01-17 18:43:03 -08:00
sum2012
589cf551a0 Revert "Fixed an issue when MipsCall executed on any random thread instead of it's own thread causing some registers to be corrupted and leading to invalid address access"
This reverts commit 8a65d73ad2.
2015-01-04 13:04:05 +01:00
AdamN
1c7152db3a Adding Branch opcode to the MAKE_MIPS
Temp revert old version to fix conflict; Implementing built-in PRO Adhoc Server; Add back sceUsbGps

Implementing more Adhoc functions, and some bug fix (i don't remember them anymore)
2015-01-04 13:04:02 +01:00
AdamN
69fb339a83 Fixed an issue when MipsCall executed on any random thread instead of it's own thread causing some registers to be corrupted and leading to invalid address access 2015-01-04 13:04:01 +01:00
Unknown W. Brackets
e6a50a1371 Initialize vfpu regs are NAN, not 0.0.
This matches tests, the fpu, and seems logical.
2015-01-03 10:40:21 -08:00
Lioncash
cac632424c Core: Add missing override specifiers 2014-12-08 15:20:31 -05:00
Lioncash
4ccb838306 Core: Mark some module functions as static 2014-12-08 04:40:08 -05:00
Unknown W. Brackets
0f45c3516d Skip setting a0 in the idle thread.
We don't need the param for our fake syscall.  This is safe since it's all
savestated.
2014-10-12 12:51:48 -07:00
Unknown W. Brackets
feada0ee65 Adjust some logging.
Report logic op more correctly, cleanup an incorrect log.
2014-09-28 15:13:52 -07:00
Henrik Rydgård
b2f5efaa50 Merge pull request #6822 from unknownbrackets/thread-funcs
Improve some timing / thread funcs
2014-09-02 09:49:46 +02:00
Unknown W. Brackets
c9df66a450 Initialize the VFPU revision from a PSP-3000 value. 2014-09-01 23:16:50 -07:00
Unknown W. Brackets
2923800217 Eat some cycles when starting a thread.
Seems to improve a test a bit, based on tests.
2014-09-01 21:12:13 -07:00
Unknown W. Brackets
909ac62669 Return a proper error for fake TMIDs. 2014-08-17 14:38:56 -07:00
Unknown W. Brackets
6852e32d6b Support other thread TMIDs in uid listing. 2014-08-17 14:38:55 -07:00
Unknown W. Brackets
b8f8707ea1 Allow a bad pts on zero size when listing uids. 2014-08-17 14:38:55 -07:00
Unknown W. Brackets
feeb03b5ff Fix return values in sceKernelGetThreadmanIdList().
Support other object types as well, but not threads/etc. properly yet.
2014-08-17 14:38:54 -07:00
Unknown W. Brackets
292a9ea567 Clear module text and bss on unload.
Text is set to break instructions, data/bss to -1.  Matches results on a
PSP.
2014-07-13 22:00:32 -07:00
Unknown W. Brackets
98d3dc4be8 Typos. 2014-07-12 13:48:30 -07:00
Unknown W. Brackets
ef4847b6f5 Don't double decrease g_inCbCount.
Happened when a thread was deleted, it seems like.  Fixes #6542.
2014-07-12 09:57:13 -07:00
Unknown W. Brackets
0a33eb4c42 Fix missing log semicolons only affecting logging. 2014-06-29 19:09:39 -07:00
Unknown W. Brackets
0078faef8b Fix some log semicolons that might affect logic.
But, these should all be right.
2014-06-29 19:09:38 -07:00
Unknown W. Brackets
1c3b60a8ee Allow changing software skinning at runtime. 2014-06-28 21:46:43 -07:00
Unknown W. Brackets
b4594c7bc5 Avoid Advance() twice, cleanup some comments. 2014-06-28 16:20:35 -07:00
Unknown W. Brackets
b68ad3844e Simplify __KernelReSchedule().
It no longer needs all these checks, and we can Advance within callbacks,
interrupts, etc. safely.
2014-06-28 16:17:52 -07:00
Unknown W. Brackets
0edeb085ab Allow rescheduling within callbacks. 2014-06-28 14:58:56 -07:00
Unknown W. Brackets
10096b94f2 Correctly remember callback status when sleeping.
If a callback triggered right away after a sceKernelSleepThreadCB(), it
would trigger the "current callback" and remember callback status as
false, instead of true (since it was set later.)

This corrects that by ignoring it if both are set.
2014-06-28 03:06:30 -07:00
Unknown W. Brackets
5ab3750186 Reduce the thread switching cost.
Maybe it was actually too high.  Some tests fail with it that high.
2014-06-27 01:00:11 -07:00
Unknown W. Brackets
4626e63294 Wake good pri threads immediately from delays. 2014-06-24 00:45:38 -07:00
Unknown W. Brackets
118736ff75 Don't eat extra cycles when idling.
Rescheduling between threads takes about 3000 cycles, but that's not true
for both sides of e.g. a delay.

Fixes #6409 (assuming 60fps is what a PSP gets.)
2014-06-23 23:02:46 -07:00
Unknown W. Brackets
c1e293fe7c Fix a warning on 32-bit that might be bad... 2014-06-22 22:17:48 -07:00
Unknown W. Brackets
392edb4f84 Eat some cycles when switching threads.
There's a cost and it seems to be at least this much.  Matters for
Wipeout Pure when callbacks are allowed to wait.
2014-06-22 22:17:47 -07:00
Unknown W. Brackets
e8803c4e9b Improve sceKernelDelayThread() timing.
A delay of 0 never reschedules, actually, unless there's a better priority
thread.  A greater delay depends on if a >= or similar check matches, but
generally is at least 200us.

It seems like this actually completes in at least another 10-20us.
2014-06-22 19:47:54 -07:00
Unknown W. Brackets
8851fc1685 Remove savedIdRegister/MIPS_CALL_ID.
We've never trusted it anyway, simpler without dealing with this stuff.
2014-06-22 11:29:47 -07:00
Unknown W. Brackets
c142207a93 Fix a few warnings, mostly type comparisons. 2014-05-31 21:42:57 -07:00
Unknown W. Brackets
b9ede6aade Add a class to create helper threads from HLE.
This should be usable from sceIo as well.
2014-05-22 23:38:21 -07:00
Henrik Rydgard
89fbe8f761 Reduce some logspam 2014-05-08 10:40:58 +02:00
Unknown W. Brackets
641064f0bc Consistently use MIPS_REG_V0 for return values.
This way all instances are a lot easier to search for (was trying to find
where we were writing an incorrect value to v0, turns out to be callback
related of course.)
2014-03-04 08:21:55 -08:00
lioncash
b9886942a7 Fix some vertical alignments in misc Core source files. 2014-03-03 11:16:53 -05:00