summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/object.h (unfollow)
Commit message (Collapse)AuthorFilesLines
2021-01-11core: hle: kernel: Update KConditionVariable.bunnei1-0/+5
2019-11-28kernel: Implement a more accurate IPC dispatch.bunnei1-0/+1
2019-11-25kernel: Replace usage of boost::intrusive_ptr with std::shared_ptr for kernel objects. (#3154)bunnei1-21/+9
* kernel: Replace usage of boost::intrusive_ptr with std::shared_ptr for kernel objects. - See https://github.com/citra-emu/citra/pull/4710 for details.
2019-11-03kernel: events: Remove ResetType::Automatic.bunnei1-5/+0
- This does not actually seem to exist in the real kernel - games reset these automatically. # Conflicts: # src/core/hle/service/am/applets/applets.cpp # src/core/hle/service/filesystem/fsp_srv.cpp
2019-05-18core/kernel/object: Rename ResetType enum membersLioncash1-2/+2
Renames the members to more accurately indicate what they signify. "OneShot" and "Sticky" are kind of ambiguous identifiers for the reset types, and can be kind of misleading. Automatic and Manual communicate the kind of reset type in a clearer manner. Either the event is automatically reset, or it isn't and must be manually cleared. The "OneShot" and "Sticky" terminology is just a hold-over from Citra where the kernel had a third type of event reset type known as "Pulse". Given the Switch kernel only has two forms of event reset types, we don't need to keep the old terminology around anymore.
2019-04-03kernel/object: Remove unused handle type entryLioncash1-1/+0
The AddressArbiter type isn't actually used, given the arbiter itself isn't a direct kernel object (or object that implements the wait object facilities). Given this, we can remove the enum entry entirely.
2019-03-13core/hle/kernel: Split transfer memory handling out into its own classLioncash1-0/+1
Within the kernel, shared memory and transfer memory facilities exist as completely different kernel objects. They also have different validity checking as well. Therefore, we shouldn't be treating the two as the same kind of memory. They also differ in terms of their behavioral aspect as well. Shared memory is intended for sharing memory between processes, while transfer memory is intended to be for transferring memory to other processes. This breaks out the handling for transfer memory into its own class and treats it as its own kernel object. This is also important when we consider resource limits as well. Particularly because transfer memory is limited by the resource limit value set for it. While we currently don't handle resource limit testing against objects yet (but we do allow setting them), this will make implementing that behavior much easier in the future, as we don't need to distinguish between shared memory and transfer memory allocations in the same place.
2019-02-01kernel: Remove the Timer classLioncash1-1/+0
A holdover from citra, the Horizon kernel on the switch has no prominent kernel object that functions as a timer. At least not to the degree of sophistication that this class provided. As such, this can be removed entirely. This class also wasn't used at all in any meaningful way within the core, so this was just code sitting around doing nothing. This also allows removing a few things from the main KernelCore class that allows it to use slightly less resources overall (though very minor and not anything really noticeable).
2019-01-04Removed pulse event typeDavid Marcec1-1/+0
Pulse is considered a hack and nothing should be using it. We should completely remove it
2018-12-04kernel/object: Amend handle types to distinguish between readable and writable eventsLioncash1-1/+2
Two kernel object should absolutely never have the same handle ID type. This can cause incorrect behavior when it comes to retrieving object types from the handle table. In this case it allows converting a WritableEvent into a ReadableEvent and vice-versa, which is undefined behavior, since the object types are not the same. This also corrects ClearEvent() to check both kernel types like the kernel itself does.
2018-11-29kernel/object: Add descriptions to ResetTypesZach Hilman1-3/+3
2018-10-12kernel/process: Make CodeSet a regular non-inherited objectLioncash1-1/+0
These only exist to ferry data into a Process instance and end up going out of scope quite early. Because of this, we can just make it a plain struct for holding things and just std::move it into the relevant function. There's no need to make this inherit from the kernel's Object type.
2018-09-28kernel/object: Remove unnecessary std::move from DynamicObjectCast()Lioncash1-2/+1
boost::static_pointer_cast for boost::intrusive_ptr (what SharedPtr is), takes its parameter by const reference. Given that, it means that this std::move doesn't actually do anything other than obscure what the function's actual behavior is, so we can remove this. To clarify, this would only do something if the parameter was either taking its argument by value, by non-const ref, or by rvalue-reference.
2018-08-29kernel: Eliminate kernel global stateLioncash1-3/+7
As means to pave the way for getting rid of global state within core, This eliminates kernel global state by removing all globals. Instead this introduces a KernelCore class which acts as a kernel instance. This instance lives in the System class, which keeps its lifetime contained to the lifetime of the System class. This also forces the kernel types to actually interact with the main kernel instance itself instead of having transient kernel state placed all over several translation units, keeping everything together. It also has a nice consequence of making dependencies much more explicit. This also makes our initialization a tad bit more correct. Previously we were creating a kernel process before the actual kernel was initialized, which doesn't really make much sense. The KernelCore class itself follows the PImpl idiom, which allows keeping all the implementation details sealed away from everything else, which forces the use of the exposed API and allows us to avoid any unnecessary inclusions within the main kernel header.
2018-08-13kernel/object: Tighten object against data racesLioncash1-7/+8
Despite being covered by a global mutex, we should still ensure that the class handles its reference counts properly. This avoids potential shenanigans when it comes to data races. Given this is the root object that drives quite a bit of the kernel object hierarchy, ensuring we always have the correct behavior (and no races) is a good thing.
2018-08-02kernel: Move object class to its own source filesLioncash1-33/+6
General moving to keep kernel object types separate from the direct kernel code. Also essentially a preliminary cleanup before eliminating global kernel state in the kernel code.
2018-04-21Qt: Update the WaitTree widget to show info about the current mutex of each thread.Subv1-4/+0
2018-03-16kernel: Move stack region outside of application heap.bunnei1-4/+0
2018-01-25hle: Remove Domain and SyncObject kernel objects.bunnei1-16/+0
2018-01-16clang-formatMerryMage1-1/+0
2018-01-14kernel: Increase default stack size to 64K.bunnei1-1/+1
2018-01-09kernel: Rename Semaphore to ConditionVariable.bunnei1-2/+2
2017-12-29kernel: Add basic support for Domain object.bunnei1-0/+17
2017-08-22Kernel/HLE: Use a mutex to synchronize access to the HLE kernel state between the cpu thread and any other possible threads that might touch the kernel (network thread, etc).Subv1-1/+1
This mutex is acquired in SVC::CallSVC, ie, as soon as the guest application enters the HLE kernel, and should be acquired by the aforementioned threads before modifying kernel structures.
2017-08-21Warnings: Add UNREACHABLE macros to switches that contemplate all possible values.Subv1-0/+3
2017-05-30Kernel: Move HandleTable to a separate fileYuri Kunde Schlesner1-115/+1
2017-05-30Kernel: Move WaitObject to a separate fileYuri Kunde Schlesner1-53/+0
Now that HandleTable doesn't directly depend on WaitObject anymore, this can be separated from the main kernel.h header.
2017-05-30Kernel: Removed HandleTable::GetWaitObjectYuri Kunde Schlesner1-9/+0
This isn't necessary anymore since plain Get works correctly for WaitObjects.
2017-05-29Kernel: Extract dynamic Object pointer cast into its own functionYuri Kunde Schlesner1-11/+24
2017-05-25Kernel: Centralize error definitions in errors.hYuri Kunde Schlesner1-7/+0
2017-01-05Kernel: Implemented Pulse event and timers.Subv1-1/+1
Closes #1904
2017-01-04Kernel/Mutex: Update a mutex priority when a thread stops waiting on it.Subv1-1/+1
2017-01-04Kernel/Mutex: Implemented priority inheritance.Subv1-1/+1
The implementation is based on reverse engineering of the 3DS's kernel. A mutex holder's priority will be temporarily boosted to the best priority among any threads that want to acquire any of its held mutexes. When the holder releases the mutex, it's priority will be boosted to the best priority among the threads that want to acquire any of its remaining held mutexes.
2017-01-04Kernel: Object ShouldWait and Acquire calls now take a thread as a parameter.Subv1-4/+5
This will be useful when implementing mutex priority inheritance.
2016-12-22core: Remove HLE module, consolidate code & various cleanups.bunnei1-1/+2
2016-12-09WaitSynch: Removed unused variables and reduced SharedPtr copies.Subv1-1/+4
Define a variable with the value of the sync timeout error code. Use a boost::flat_map instead of an unordered_map to hold the equivalence of objects and wait indices in a WaitSynchN call.
2016-12-05Kernel: Remove the Redirection handle type.Subv1-2/+0
2016-12-04Threading: Reworked the way our scheduler works.Subv1-0/+3
Threads will now be awakened when the objects they're waiting on are signaled, instead of repeating the WaitSynchronization call every now and then. The scheduler is now called once after every SVC call, and once after a thread is awakened from sleep by its timeout callback. This new implementation is based off reverse-engineering of the real kernel. See https://gist.github.com/Subv/02f29bd9f1e5deb7aceea1e8f019c8f4 for a more detailed description of how the real kernel handles rescheduling.
2016-12-01Fixed the rebase mistakes.Subv1-18/+16
2016-12-01fixup! Kernel/IPC: Use Ports and Sessions as the fundamental building block of Inter Process Communication.Subv1-2/+3
2016-12-01 Kernel/IPC: Use Ports and Sessions as the fundamental building block of Inter Process Communication.Subv1-17/+19
All handles obtained via srv::GetServiceHandle or svcConnectToPort are references to ClientSessions. Service modules will wait on the counterpart of those ClientSessions (Called ServerSessions) using svcReplyAndReceive or svcWaitSynchronization[1|N], and will be awoken when a SyncRequest is performed. HLE Interfaces are now ClientPorts which override the HandleSyncRequest virtual member function to perform command handling immediately.
2016-11-20Kernel/Loader: Grab the system mode from the NCCH ExHeader.Subv1-2/+2
3dsx and elf files default to system mode 2 (96MB allocated to the application). This allows Home Menu to boot without modifications. Closes #1849
2016-09-22move ResetType to kernel.hwwylele1-0/+6
2016-09-22implement wait tree widgetwwylele1-0/+3
2016-09-21Remove empty newlines in #include blocks.Emmanuel Gil Peyrot1-4/+1
This makes clang-format useful on those. Also add a bunch of forgotten transitive includes, which otherwise prevented compilation.
2016-09-19Manually tweak source formatting and then re-run clang-formatYuri Kunde Schlesner1-2/+1
2016-09-18Sources: Run clang-format on everything.Emmanuel Gil Peyrot1-28/+38
2016-06-11Kernel/SVC: Implemented svcCreatePort.Subv1-1/+2
2016-06-05Kernel: Added ClientPort and ServerPort classes.Subv1-2/+4
This is part of an ongoing effort to implement support for multiple processes.
2015-07-12Kernel: Add CodeSet case to Object::IsWaitableYuri Kunde Schlesner1-0/+1
2015-07-12Core: Properly configure address space when loading a binaryYuri Kunde Schlesner1-0/+1
The code now properly configures the process image to match the loaded binary segments (code, rodata, data) instead of just blindly allocating a large chunk of dummy memory.
2015-06-28Common: Cleanup key_map includes.Emmanuel Gil Peyrot1-4/+3
2015-06-17kernel: Fix svcWaitSynch to always acquire requested wait objects.bunnei1-6/+0
2015-05-21Kernel: Fix a warning introduced with ResourceLimit, and remove the fallback code to prevent it from happening again.Emmanuel Gil Peyrot1-2/+1
2015-05-15Core/ResourceLimits: Implemented the basic structure of ResourceLimits.Subv1-1/+2
Implemented svcs GetResourceLimit, GetResourceLimitCurrentValues and GetResourceLimitLimitValues. Note that the resource limits do not currently keep track of used objects, since we have no way to distinguish between an object created by the application, and an object created by some HLE module once we're inside Kernel::T::Create.
2015-05-09Kernel: Remove g_program_idYuri Kunde Schlesner1-6/+0
This has been obsoleted by the field in Process.
2015-05-09Kernel: Introduce skeleton Process class to hold process dataYuri Kunde Schlesner1-7/+3
2015-05-07Common: Remove common.hYuri Kunde Schlesner1-1/+2
2015-05-07Move typedefs from kernel.h to more appropriate placesYuri Kunde Schlesner1-10/+1
2015-05-02Kernel: Properly initialize and shutdown all modules.bunnei1-2/+3
2015-02-12Build: Fixed some warningsSubv1-1/+1
2015-02-02Kernel: Make WaitObjects share ownership of Threads waiting on themYuri Kunde Schlesner1-5/+5
During normal operation, a thread waiting on an WaitObject and the object hold mutual references to each other for the duration of the wait. If a process is forcefully terminated (The CTR kernel has a SVC to do this, TerminateProcess, though no equivalent exists for threads.) its threads would also be stopped and destroyed, leaving dangling pointers in the WaitObjects. The solution is to simply have the Thread remove itself from WaitObjects when it is stopped. The vector of Threads in WaitObject has also been changed to hold SharedPtrs, just in case. (Better to have a reference cycle than a crash.)
2015-02-02Kernel: Remove Object::GetHandle (it's not used anymore :D)Yuri Kunde Schlesner1-5/+0
2015-02-02Kernel: Introduce unique Object ids for debuggingYuri Kunde Schlesner1-0/+6
2015-01-30Remove result.h InvalidHandleYuri Kunde Schlesner1-1/+2
It was only being used in two places, where it was replaced by a local constant.
2015-01-30Move VAddr/PAddr typedefs to kernel.hYuri Kunde Schlesner1-0/+5
2015-01-22Kernel: Renamed some functions for clarity.bunnei1-4/+4
- ReleaseNextThread->WakeupNextThread - ReleaseAllWaitingThreads->WakeupAllWaitingThreads.
2015-01-22Kernel: Changed "ShouldWait" to return bool and "Acquire" to return void.bunnei1-6/+3
2015-01-22WaitObject: Renamed "Wait" to "ShouldWait", made "ShouldWait" and "Acquire" pure virtual.bunnei1-10/+4
2015-01-22Session: Change to a WaitObject.bunnei1-0/+1
2015-01-22Kernel: Moved Wait and Acquire to WaitObject, added way to retrieve a WaitObject safely.bunnei1-16/+55
2015-01-22Kernel: Get rid of WaitTypes and simplify lots of code, removing hacks.bunnei1-3/+2
2015-01-22WaitSynchronizationN: Refactor to fix several bugsbunnei1-6/+6
- Separate wait checking from waiting the current thread - Resume thread when wait_all=true only if all objects are available at once - Set output to correct wait object index when there are duplicate handles
2015-01-22Kernel: Separate WaitSynchronization into Wait and Acquire methods.bunnei1-2/+11
2015-01-22WaitSynchronizationN: Implement return valuesbunnei1-3/+4
2015-01-22WaitObject: Added RemoveWaitingThread, fixed a bug, and cleanup.bunnei1-1/+7
2015-01-22Kernel: Added WaitObject and changed "waitable" objects inherit from it.bunnei1-0/+25
2015-01-09Kernel: Start using boost::intrusive_ptr for lifetime managementYuri Kunde Schlesner1-8/+13
2015-01-09Kernel: Don't re-assign object's handle when duplicating oneYuri Kunde Schlesner1-1/+1
2015-01-09Thread: Reduce use of Handles and move some funcs to inside the class.Yuri Kunde Schlesner1-1/+3
2015-01-09SVC: Implemented the Timer service calls.Subv1-0/+1
2014-12-28Kernel: New handle managerYuri Kunde Schlesner1-81/+109
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.
2014-12-28Kernel: Replace GetStaticHandleType by HANDLE_TYPE constantsYuri Kunde Schlesner1-1/+1
2014-12-28Rename ObjectPool to HandleTableYuri Kunde Schlesner1-6/+6
2014-12-21License changepurpasmart961-1/+1
2014-12-20Kernel: Implement support for current thread pseudo-handleYuri Kunde Schlesner1-0/+12
This boots a few (mostly Nintendo 1st party) games further.
2014-12-18Filesystem/Archives: Implemented the SaveData archiveSubv1-0/+6
The savedata for each game is stored in /savedata/<ProgramID> for NCCH files. ELF files and 3DSX files use the folder 0 because they have no ID information Got rid of the code duplication in File and Directory Files that deal with the host machine's file system now live in DiskFile, similarly for directories and DiskDirectory and archives with DiskArchive. FS_U: Use the correct error code when a file wasn't found
2014-12-15Remove SyncRequest from K::Object and create a new K::Session typeYuri Kunde Schlesner1-14/+2
This is a first step at fixing the conceptual insanity that is our handling of service and IPC calls. For now, interfaces still directly derived from Session because we don't have the infrastructure to do it properly. (That is, Processes and scheduling them.)
2014-12-13kernel: Remove unused log argumentsLioncash1-3/+3
2014-12-13Convert old logging calls to new logging macrosYuri Kunde Schlesner1-7/+10
2014-12-04kernel: Make some functions constLioncash1-2/+2
2014-11-24HLE: Revamp error handling throrough the HLE codeYuri Kunde Schlesner1-27/+17
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-19Remove trailing spaces in every file but the ones imported from SkyEye, AOSP or generatedEmmanuel Gil Peyrot1-5/+5
2014-11-18Remove extraneous semicolonsLioncash1-1/+1
2014-09-17Kernel: Add a Directory object and a getter for it from an Archive object.Emmanuel Gil Peyrot1-0/+1
2014-08-19Core: Use std::array for managing kernel object spaceLioncash1-3/+4
These avoid relying on memset for clearing the arrays.
2014-08-18Core: Alter the kernel string functions to use std::string instead of const char*.Lioncash1-3/+3
Most functions already operate on std::strings. This also removes the need to manually null terminate thread names.
2014-07-09Kernel: Added preliminary support for address arbiters.bunnei1-1/+1
AddressArbiter: Added documentation comment, fixed whitespace issue. AddressArbiter: Fixed incorrect comment, reordered if-statement to be more clear. SVC: Removed trailing whitespace.
2014-06-27Kernel: Added stubbed code to support creation of kernel Archive objects.bunnei1-0/+1
2014-06-13Kernel: Added freeing of kernel objects on emulator shutdown.bunnei1-0/+6
2014-06-13Kernel: Updated several member functions to be constbunnei1-2/+2
2014-06-13Kernel: Made SyncRequest not pure virtual, with a default implementation of error (as this is not required for all kernel objects)bunnei1-2/+4
2014-06-03kernel: moved position of * for GetTypeName and GetNamebunnei1-2/+2
2014-06-02kernel: changed main thread priority to default, updated Kernel::Reschedule to use PrepareReschedulebunnei1-0/+1
2014-05-27kernel: added WaitSynchronization method to Kernel::Objectbunnei1-0/+7
2014-05-27kernel: updated SyncRequest to take boolean thread wait result as a parameterbunnei1-1/+8
2014-05-27kernel: added enum for known CurrentThread and CurrentProcess handlesbunnei1-0/+5
2014-05-27kernel: add a SyncRequest method to KernelObject for use with svcSendSyncRequestbunnei1-0/+1
2014-05-23kernel: refactored function naming to remove "__" prefixbunnei1-2/+7
2014-05-21kernel: fixed include, in general include "common.h" not "common_types.h"bunnei1-1/+1
2014-05-21- created a Kernel namespacebunnei1-31/+44
- cleaned up Kernel code a bit (moved stuff into namespace, fixed whitespace issues) - added handle types for all different CTROS handles
2014-05-19- updated service(s) to be KernelObject'sbunnei1-4/+5
- various cleanups
2014-05-19- moved Handle/Result definitions to kernel.hbunnei1-1/+2
- added ResetType enum
2014-05-17- replaced KERNELOBJECT_MAX_NAME_LENGTH with KERNEL_MAX_NAME_LENGTHbunnei1-3/+2
- added KERNEL_DEFAULT_STACK_SIZE definition (0x4000)
2014-05-16changed "UID" to "Handle" to be a little more consistent with CTR namingbunnei1-13/+16
2014-05-14- added __KernelLoadExec functionbunnei1-13/+24
- fixed some logging
2014-05-10added initial kernel/thread modulesbunnei1-0/+121