Commit graph

26 commits

Author SHA1 Message Date
Subv ef1d5cda06 Threads: Implemented a sequential thread id 2014-12-04 08:13:53 -05:00
Subv 029ff9f1fd SVC: Implemented GetThreadId.
For now threads are using their Handle value as their Id, it should not really cause any problems because Handle values are unique in Citra, but it should be changed. I left a ToDo there because this is not correct behavior as per hardware.
2014-12-04 00:25:35 -05:00
Yuri Kunde Schlesner c2588403c0 HLE: Revamp error handling throrough the HLE code
All service calls in the CTR OS return result codes indicating the
success or failure of the call. Previous to this commit, Citra's HLE
emulation of services and the kernel universally either ignored errors
or returned dummy -1 error codes.

This commit makes an initial effort to provide an infrastructure for
error reporting and propagation which can be use going forward to make
HLE calls accurately return errors as the original system. A few parts
of the code have been updated to use the new system where applicable.

One part of this effort is the definition of the `ResultCode` type,
which provides facilities for constructing and parsing error codes in
the structured format used by the CTR.

The `ResultVal` type builds on `ResultCode` by providing a container for
values returned by function that can report errors. It enforces that
correct error checking will be done on function returns by preventing
the use of the return value if the function returned an error code.

Currently this change is mostly internal since errors are still
suppressed on the ARM<->HLE border, as a temporary compatibility hack.
As functionality is implemented and tested this hack can be eventually
removed.
2014-11-24 17:08:36 -02:00
Emmanuel Gil Peyrot f5d38649c7 Remove trailing spaces in every file but the ones imported from SkyEye, AOSP or generated 2014-11-19 09:03:07 +00:00
bunnei d4bd2f2e5d Thread: Added more descriptive comment to WaitCurrentThread. 2014-08-06 18:19:59 -04:00
bunnei ba840d3200 Thread: Added functions to resume threads from address arbitration.
Thread: Cleaned up arbitrate address functions.

Thread: Cleaned up ArbitrateAllThreads function.
2014-07-08 18:46:15 -04:00
bunnei f5c7c15434 Kernel: Added real support for thread and event blocking
- SVC: Added ExitThread support
- SVC: Added SignalEvent support
- Thread: Added WAITTYPE_EVENT for waiting threads for event signals
- Thread: Added support for blocking on other threads to finish (e.g. Thread::Join)
- Thread: Added debug function for printing current threads ready for execution
- Thread: Removed hack/broken thread ready state code from Kernel::Reschedule
- Mutex: Moved WaitCurrentThread from SVC to Mutex::WaitSynchronization
- Event: Added support for blocking threads on event signalling

Kernel: Added missing algorithm #include for use of std::find on non-Windows platforms.
2014-06-13 09:51:02 -04:00
bunnei 3fb31fbc57 svc: added GetThreadPriority and SetThreadPriority, added (incomplete) DuplicateHandle support 2014-06-01 22:12:54 -04:00
bunnei b99ac2c3d6 thread: renamed "WaitCurThread" to "WaitCurrentThread", removed unused "reason" argument 2014-05-22 19:36:56 -04:00
bunnei 7c0b006076 thread: removed unused SwitchContext/Reschedule reason field, added missing arg parameter to SVC CreateThread 2014-05-22 19:32:45 -04:00
bunnei d26f3d4c1f kernel: refactored function naming to remove "__" prefix 2014-05-22 19:06:12 -04:00
bunnei 14bd37c5dc thread: moved ThreadStatus/WaitType to header, added support for arg on CreateThread, added correct CPSR reset 2014-05-22 18:50:36 -04:00
bunnei 203541da11 thread: added correct lowest thread priority, added a thread priority check, and added some comments 2014-05-20 21:02:35 -04:00
bunnei bed4e920fa thread: exposed ResumeThreadFromWait function for use in other kernel modules 2014-05-20 21:00:10 -04:00
bunnei 75c6d2a8fa thread: moved threading calls to the Kernel namespace 2014-05-20 19:37:46 -04:00
bunnei f654a03f1f thread: whitespace change - fixed * and & placement 2014-05-20 18:20:35 -04:00
bunnei 44336329ed - created a Kernel namespace
- cleaned up Kernel code a bit (moved stuff into namespace, fixed whitespace issues)
- added handle types for all different CTROS handles
2014-05-20 18:13:25 -04:00
bunnei f5a119a367 thread: added declaration for __KernelReschedule to be used by syscall module 2014-05-19 22:19:48 -04:00
bunnei 09b8e8fb6a changed a comment 2014-05-17 13:47:55 -04:00
bunnei 14ae026386 - added enum ThreadProcessorId
- reorganized some kernel thread functions
- added placeholder __KernelWaitThread_Synchronization function
2014-05-17 00:56:00 -04:00
bunnei 7cdb705059 - replaced KERNELOBJECT_MAX_NAME_LENGTH with KERNEL_MAX_NAME_LENGTH
- added KERNEL_DEFAULT_STACK_SIZE definition (0x4000)
2014-05-16 23:48:15 -04:00
bunnei 940330c6e1 completely gutted/refactored threading code to be simpler 2014-05-15 18:27:08 -04:00
bunnei b99a5da65b - added helper function for __KernelCreateThread
- added __KernelSwitchToThread for enabling a thread
- added __KernelRotateThreadReadyQueue
2014-05-14 20:50:30 -04:00
bunnei 7d078189da various cleanups / remove unused code 2014-05-13 22:29:31 -04:00
bunnei 3838d46b90 added a bunch of threading code, recycled from PPSSPP, with lots of hacks in for 3DS... doesn't really do much yet. Just a jumping off point 2014-05-13 22:00:11 -04:00
bunnei 6b264518a5 added initial kernel/thread modules 2014-05-09 22:11:18 -04:00