Add a null check to scePsmfPlayerGetAudioData().

Crimson Gem Saga was passing a NULL, maybe a glitch, but we do NULL
checks elsewhere.
Fix sema and event flag refer to check size.

If it's zero, write nothing, just like the others.
Don't allow attr 0x400 for mutexes, report less.

Seems like 0 is ignored afaict, which makes sense from other funcs.
Not sure if anyone calls it with a value.
Report less for semaphores options with no size.
Report unimplemented but known HLE functions.
Implement sceKernelExtendThreadStack().

Fixes #1833.  Implemented using fake nids instead of callbacks since
it's simpler to get them (and waits and recursion) right.
Add a safety check to prevent leaks.
Update tests.
Merge pull request #1841 from unknownbrackets/thread-funcs

Implement sceKernelExtendThreadStack() + some minor + report unimpl