Commit Graph

32 Commits (a3f5e5605c06898acbda2257fc480846ae42b47e)

Author SHA1 Message Date
Yuri Kunde Schlesner 8ad41775cc Kernel: Start using boost::intrusive_ptr for lifetime management 11 years ago
Yuri Kunde Schlesner 9bf8462b96 Thread: Reduce use of Handles and move some funcs to inside the class. 11 years ago
Subv ea80363cc2 Mutex: Add the calling thread to the waiting list when needed
This will happen when the mutex is already owned by another thread. Should fix some issues with games being stuck due to waiting threads not being awoken.
11 years ago
Yuri Kunde Schlesner 7e2903cb74 Kernel: New handle manager
This handle manager more closely mirrors the behaviour of the CTR-OS
one. In addition object ref-counts and support for DuplicateHandle have
been added.

Note that support for DuplicateHandle is still experimental, since parts
of the kernel still use Handles internally, which will likely cause
troubles if two different handles to the same object are used to e.g.
wait on a synchronization primitive.
11 years ago
Yuri Kunde Schlesner 23f2142009 Kernel: Replace GetStaticHandleType by HANDLE_TYPE constants 11 years ago
Yuri Kunde Schlesner 73fba22c01 Rename ObjectPool to HandleTable 11 years ago
purpasmart96 ebfd831ccb License change 11 years ago
Subv bc318c464b Mutex: Remove some forward declarations
Moved Mutex::WaitSynchronization to the end of the file.
11 years ago
Subv 64128aa61a Mutex: Release all held mutexes when a thread exits. 11 years ago
Subv e3c8e4901c Mutex: Properly lock the mutex when a thread enters it
Also resume only the next immediate thread waiting for the mutex when it is released, instead of resuming them all.
11 years ago
bunnei a449e0e11a Mutex: Changed behavior to always release mutex for all threads. 11 years ago
Yuri Kunde Schlesner 22c86824a4 Remove duplicated docs/update them for changed parameters. 11 years ago
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.
11 years ago
Emmanuel Gil Peyrot f5d38649c7 Remove trailing spaces in every file but the ones imported from SkyEye, AOSP or generated 11 years ago
Yuri Kunde Schlesner d72708c1f5 Add `override` keyword through the code.
This was automated using `clang-modernize`.
11 years ago
Lioncash 98fa3f7cba Core: Alter the kernel string functions to use std::string instead of const char*.
Most functions already operate on std::strings. This also removes the need to manually null terminate thread names.
11 years ago
bunnei 7a1f813be1 Kernel: Updated Event and Mutex to specify handle that they are blocking for. 11 years ago
bunnei c95972275e HLE: Updated all uses of NULL to nullptr (to be C++11 compliant) 11 years ago
bunnei 5365ca157d Kernel: Updated various kernel function "name" arguments to be const references. 11 years ago
bunnei d7363322c7 HLE: Updated various handle debug assertions to be more clear. 11 years ago
bunnei 780a443b08 Mutex: Moved ReleaseMutex iterator declaration to be inside while loop. 11 years ago
bunnei 8cac527c94 Kernel: Updated several member functions to be const 11 years ago
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.
11 years ago
bunnei b78aff8585 svc: added optional name field to Event and Mutex (used for debugging) 11 years ago
bunnei d8a2c8c657 mutex: fixed typo in ReleaseMutex 11 years ago
bunnei 2ed6652f10 mutex: added preliminary SyncRequest/WaitSynchronization, added some comments/assertions 11 years ago
bunnei a432dc8f39 kernel: added WaitSynchronization method to Kernel::Object 11 years ago
bunnei 58a3adcdd2 kernel: updated SyncRequest to take boolean thread wait result as a parameter 11 years ago
bunnei d73d782ba7 kernel: add a SyncRequest method to KernelObject for use with svcSendSyncRequest 11 years ago
bunnei d26f3d4c1f kernel: refactored function naming to remove "__" prefix 11 years ago
bunnei eb537c560a mutex: refactored the interface to code to return a Mutex* handle 11 years ago
bunnei 978e1d4653 mutex: initial commit of HLE module 11 years ago