Commit Graph

41 Commits (c22bac6398ff1705992fc44b2c29775c84cff662)

Author SHA1 Message Date
bunnei c22bac6398 Kernel: Added WaitObject and changed "waitable" objects inherit from it. 11 years ago
Lioncash a3f5e5605c core: Fix a few docstrings 11 years ago
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
Yuri Kunde Schlesner ba72208cd4 Kernel: Move Thread's definition to the header file 11 years ago
bunnei d46f650036 Merge pull request #255 from Subv/cbranch_3
Implemented timers
11 years ago
Subv 07044651ef SVC: Implemented the Timer service calls. 11 years ago
Subv dfc440785a SVC: Fixed SleepThread.
It will now properly wait the specified number of nanoseconds and then wake up the thread.
11 years ago
Subv 60a373a786 Threads: Use a dummy idle thread when no other are ready.
This thread will not actually execute instructions, it will only advance the timing/events and try to yield immediately to the next ready thread, if there aren't any ready threads then it will be rescheduled and start its job again.
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
bunnei 0de6a08d75 Merge pull request #291 from purpasmart96/license
License change
11 years ago
purpasmart96 ebfd831ccb License change 11 years ago
bunnei 4fcdbed9f6 Thread: Wait current thread on svc_SleepThread
- Removed unused VBLANK sleep mode
- Added error log for bad context switch
- Renamed VerifyWait to CheckWaitType to be more clear
11 years ago
Yuri Kunde Schlesner adee775f44 Kernel: Implement support for current thread pseudo-handle
This boots a few (mostly Nintendo 1st party) games further.
11 years ago
bunnei dd203f7068 Thread: Fixed to wait on address when in arbitration. 11 years ago
Subv ef1d5cda06 Threads: Implemented a sequential thread id 11 years ago
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.
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
bunnei d4bd2f2e5d Thread: Added more descriptive comment to WaitCurrentThread. 11 years ago
bunnei ba840d3200 Thread: Added functions to resume threads from address arbitration.
Thread: Cleaned up arbitrate address functions.

Thread: Cleaned up ArbitrateAllThreads function.
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.
12 years ago
bunnei 3fb31fbc57 svc: added GetThreadPriority and SetThreadPriority, added (incomplete) DuplicateHandle support 12 years ago
bunnei b99ac2c3d6 thread: renamed "WaitCurThread" to "WaitCurrentThread", removed unused "reason" argument 12 years ago
bunnei 7c0b006076 thread: removed unused SwitchContext/Reschedule reason field, added missing arg parameter to SVC CreateThread 12 years ago
bunnei d26f3d4c1f kernel: refactored function naming to remove "__" prefix 12 years ago
bunnei 14bd37c5dc thread: moved ThreadStatus/WaitType to header, added support for arg on CreateThread, added correct CPSR reset 12 years ago
bunnei 203541da11 thread: added correct lowest thread priority, added a thread priority check, and added some comments 12 years ago
bunnei bed4e920fa thread: exposed ResumeThreadFromWait function for use in other kernel modules 12 years ago
bunnei 75c6d2a8fa thread: moved threading calls to the Kernel namespace 12 years ago
bunnei f654a03f1f thread: whitespace change - fixed * and & placement 12 years ago
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
12 years ago
bunnei f5a119a367 thread: added declaration for __KernelReschedule to be used by syscall module 12 years ago
bunnei 09b8e8fb6a changed a comment 12 years ago
bunnei 14ae026386 - added enum ThreadProcessorId
- reorganized some kernel thread functions
- added placeholder __KernelWaitThread_Synchronization function
12 years ago
bunnei 7cdb705059 - replaced KERNELOBJECT_MAX_NAME_LENGTH with KERNEL_MAX_NAME_LENGTH
- added KERNEL_DEFAULT_STACK_SIZE definition (0x4000)
12 years ago
bunnei 940330c6e1 completely gutted/refactored threading code to be simpler 12 years ago
bunnei b99a5da65b - added helper function for __KernelCreateThread
- added __KernelSwitchToThread for enabling a thread
- added __KernelRotateThreadReadyQueue
12 years ago
bunnei 7d078189da various cleanups / remove unused code 12 years ago
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 12 years ago
bunnei 6b264518a5 added initial kernel/thread modules 12 years ago