summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/handle_table.cpp (unfollow)
Commit message (Collapse)AuthorFilesLines
2021-05-06hle: kernel: Migrate to KHandleTable.bunnei1-125/+0
2021-05-06hle: kernel: Rename Process to KProcess.bunnei1-1/+1
2021-05-06hle: kernel: HandleTable: Remove deprecated APIs.bunnei1-68/+9
2021-05-06hle: kernel: Migrate KTransferMemory to KAutoObject.bunnei1-1/+2
2021-05-06hle: kernel: Migrate KSession, KClientSession, and KServerSession to KAutoObject.bunnei1-1/+4
2021-05-06hle: kernel: svc_results: Update naming..bunnei1-2/+2
2021-05-06hle: kernel: Migrate KReadableEvent and KWritableEvent to KAutoObject.bunnei1-1/+3
2021-05-06hle: kernel: Migrate KEvent to KAutoObject.bunnei1-0/+1
2021-05-06hle: kernel: Migrate KSharedMemory to KAutoObject.bunnei1-4/+16
2021-05-06hle: kernel: Migrate KProcess to KAutoObject.bunnei1-5/+5
2021-05-06hle: kernel: Migrate more of KThread to KAutoObject.bunnei1-7/+41
2021-02-13kernel: Unify result codes (#5890)Chloe1-5/+5
* kernel: Unify result codes Drop the usage of ERR_NAME convention in kernel for ResultName. Removed seperation between svc_results.h & errors.h as we mainly include both most of the time anyways. * oops * rename errors to svc_results
2021-01-29core: hle: kernel: object: Implement Finalize() virtual method.bunnei1-0/+4
2021-01-29core: hle: kernel: Rename Thread to KThread.bunnei1-1/+1
2020-12-06hle: kernel: Rewrite scheduler implementation based on Mesopshere.bunnei1-2/+2
2020-10-21Revert "core: Fix clang build"bunnei1-1/+1
2020-10-18core: Fix clang buildLioncash1-1/+1
Recent changes to the build system that made more warnings be flagged as errors caused building via clang to break. Fixes #4795
2020-10-13core/CMakeLists: Make some warnings errorsLioncash1-1/+1
Makes our error coverage a little more consistent across the board by applying it to Linux side of things as well. This also makes it more consistent with the warning settings in other libraries in the project. This also updates httplib to 0.7.9, as there are several warning cleanups made that allow us to enable several warnings as errors.
2020-07-15kernel/handle_table: Remove usages of the global system instanceLioncash1-4/+5
Removes even more usages of the global system instance, trimming away more dependencies on global variables and making them explicit in the interface.
2020-07-15kernel/thread: Remove global GetCurrentThread()Lioncash1-1/+2
This is only used in one place, so we can fold it into the calling code, eliminating a place for the global system instance to be used.
2020-04-29kernel: Don't fail silentlyDavid Marcec1-0/+2
2019-11-25kernel: Replace usage of boost::intrusive_ptr with std::shared_ptr for kernel objects. (#3154)bunnei1-5/+5
* 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-10-06core: Remove Core::CurrentProcess()Lioncash1-1/+1
This only encourages the use of the global system instance (which will be phased out long-term). Instead, we use the direct system function call directly to remove the appealing but discouraged short-hand.
2019-02-25kernel/handle_table: Make local variables as const where applicableLioncash1-4/+5
Makes immutable state explicit.
2019-02-25kernel/handle_table: Allow process capabilities to limit the handle table sizeLioncash1-5/+21
The kernel allows restricting the total size of the handle table through the process capability descriptors. Until now, this functionality wasn't hooked up. With this, the process handle tables become properly restricted. In the case of metadata-less executables, the handle table will assume the maximum size is requested, preserving the behavior that existed before these changes.
2019-02-25kernel/handle-table: In-class initialize data membersLioncash1-1/+0
Directly initializes members where applicable.
2019-02-25kernel/handle_table: Resolve truncation warningsLioncash1-2/+2
Avoids implicit truncation warnings from u32 -> u16 (the truncation is desirable behavior here).
2018-12-04kernel/handle_table: Amend reference to CTR-OS in Create()Lioncash1-2/+3
Another hold-over from Citra.
2018-11-22kernel/handle_table: Move private static functions into the cpp fileLioncash1-0/+9
These don't depend on class state, and are effectively implementation details, so they can go into the cpp file .
2018-11-22kernel/handle_table: Default destructor in the cpp fileLioncash1-0/+2
We don't need to potentially inline the teardown logic of all of the handle instances.
2018-09-15Port #4182 from Citra: "Prefix all size_t with std::"fearlessTobi1-1/+1
2018-08-29kernel: Eliminate kernel global stateLioncash1-2/+0
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-25kernel/error: Add error code for the handle table being fullLioncash1-1/+1
This replaces the lingering 3DS constant with the proper one, and utilizes it within HandleTable's Create() member function.
2018-08-02kernel: Move object class to its own source filesLioncash1-1/+0
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-07-03Rename logging macro back to LOG_*James Rowe1-2/+2
2018-04-26kernel: Migrate logging macros to fmt-compatible onesLioncash1-2/+2
2018-03-14core: Move process creation out of global state.bunnei1-1/+2
2018-01-25handle_table: Remove ConvertSessionToDomain.bunnei1-10/+0
2018-01-21Format: Run the new clang format on everythingJames Rowe1-1/+1
2017-12-29kernel: Fix implementation of ConvertSessionToDomain.bunnei1-0/+10
2017-05-30Kernel: Move HandleTable to a separate fileYuri Kunde Schlesner1-36/+2
2017-05-30Kernel: Move WaitObject to a separate fileYuri Kunde Schlesner1-79/+0
Now that HandleTable doesn't directly depend on WaitObject anymore, this can be separated from the main kernel.h header.
2017-05-25Kernel: Centralize error definitions in errors.hYuri Kunde Schlesner1-0/+1
2017-01-05Kernel: Add some asserts to enforce the invariants in the scheduler.Subv1-0/+8
2017-01-05Kernel: Remove a thread from all of its waiting objects' waiting_threads list when it is awoken.Subv1-18/+4
This fixes a potential bug where threads would not get removed from said list if they awoke after waiting with WaitSynchronizationN with wait_all = false
2017-01-05Kernel: Remove Thread::wait_objects_index and use wait_objects to hold all the objects that a thread is waiting on.Subv1-1/+7
2017-01-04Kernel/Mutex: Update a mutex priority when a thread stops waiting on it.Subv1-8/+15
2017-01-04Kernel: Object ShouldWait and Acquire calls now take a thread as a parameter.Subv1-8/+6
This will be useful when implementing mutex priority inheritance.
2016-12-16Kernel: remove object's waiting thread if it is deadwwylele1-1/+2
2016-12-14Fixed the codestyle to match our clang-format rules.Subv1-4/+5
2016-12-10Properly remove a thread from its wait_objects' waitlist when it is awoken by a timeout.Subv1-1/+6
2016-12-09WaitSynch: Removed unused variables and reduced SharedPtr copies.Subv1-10/+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-07Use boost remove_erase_if instead of the erase-remove idiomSubv1-2/+3
2016-12-07Improved the algorithm for GetHighestPriorityReadyThread.Subv1-14/+13
2016-12-04Threading: Added some utility functions and const correctness.Subv1-7/+6
2016-12-04Threading: Reworked the way our scheduler works.Subv1-5/+54
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-11-20Kernel/Loader: Grab the system mode from the NCCH ExHeader.Subv1-4/+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-22implement wait tree widgetwwylele1-0/+4
2016-09-21Use negative priorities to avoid special-casing the self-includeYuri Kunde Schlesner1-1/+1
2016-09-21Remove empty newlines in #include blocks.Emmanuel Gil Peyrot1-3/+1
This makes clang-format useful on those. Also add a bunch of forgotten transitive includes, which otherwise prevented compilation.
2016-09-18Sources: Run clang-format on everything.Emmanuel Gil Peyrot1-1/+2
2015-08-16Kernel: Add more infrastructure to support different memory layoutsYuri Kunde Schlesner1-3/+16
This adds some structures necessary to support multiple memory regions in the future. It also adds support for different system memory types and the new linear heap mapping at 0x30000000.
2015-06-28Common: Cleanup key_map includes.Emmanuel Gil Peyrot1-2/+0
2015-06-17kernel: Fix svcWaitSynch to always acquire requested wait objects.bunnei1-18/+4
2015-05-15Core/ResourceLimits: Implemented the basic structure of ResourceLimits.Subv1-0/+3
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-12fixup!Subv1-1/+3
2015-05-11Core/HLE: Implemented the SVCs GetProcessId and GetProcessIdOfThreadSubv1-2/+2
2015-05-09Kernel: Remove unused g_main_thread variableYuri Kunde Schlesner1-2/+0
2015-05-09Kernel: Remove g_program_idYuri Kunde Schlesner1-2/+0
This has been obsoleted by the field in Process.
2015-05-09Kernel: Introduce skeleton Process class to hold process dataYuri Kunde Schlesner1-12/+2
2015-05-07Common: Remove common.hYuri Kunde Schlesner1-1/+2
2015-05-02Kernel: Properly initialize and shutdown all modules.bunnei1-4/+7
2015-04-10Kernel: Fixed default thread priority.bunnei1-1/+1
2015-02-12Build: Fixed some warningsSubv1-2/+2
2015-02-11Asserts: break/crash program, fit to style guide; log.h->assert.harchshift1-2/+2
Involves making asserts use printf instead of the log functions (log functions are asynchronous and, as such, the log won't be printed in time) As such, the log type argument was removed (printf obviously can't use it, and it's made obsolete by the file and line printing) Also removed some GEKKO cruft.
2015-02-10Scheduler refactor Pt. 1Kevin Hartman1-5/+1
* Simplifies scheduling logic, specifically regarding thread status. It should be much clearer which statuses are valid for a thread at any given point in the system. * Removes dead code from thread.cpp. * Moves the implementation of resetting a ThreadContext to the corresponding core's implementation. Other changes: * Fixed comments in arm interfaces. * Updated comments in thread.cpp * Removed confusing, useless, functions like MakeReady() and ChangeStatus() from thread.cpp. * Removed stack_size from Thread. In the CTR kernel, the thread's stack would be allocated before thread creation.
2015-02-03core: Fix some warnings on OSXLioncash1-1/+0
2015-02-02Kernel: Make WaitObjects share ownership of Threads waiting on themYuri Kunde Schlesner1-4/+4
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: Fix bug in HandleTable::CloseYuri Kunde Schlesner1-1/+1
2015-02-02Kernel: Remove Object::GetHandle (it's not used anymore :D)Yuri Kunde Schlesner1-4/+1
2015-02-02Kernel: Introduce unique Object ids for debuggingYuri Kunde Schlesner1-0/+2
2015-01-22Kernel: Renamed some functions for clarity.bunnei1-1/+1
- ReleaseNextThread->WakeupNextThread - ReleaseAllWaitingThreads->WakeupAllWaitingThreads.
2015-01-22Session: Change to a WaitObject.bunnei1-1/+1
2015-01-22Kernel: Reschedule on SignalEvent and SendSyncRequest, fix some bugs.bunnei1-1/+1
2015-01-22AddressArbiter: Changed to Kernel::Object, big cleanup, removed code that made no sense.bunnei1-1/+1
2015-01-22Kernel: Get rid of WaitTypes and simplify lots of code, removing hacks.bunnei1-2/+4
2015-01-22WaitSynchronizationN: Implement return valuesbunnei1-2/+2
2015-01-22WaitObject: Added RemoveWaitingThread, fixed a bug, and cleanup.bunnei1-3/+10
2015-01-22Kernel: Added WaitObject and changed "waitable" objects inherit from it.bunnei1-0/+26
2015-01-09Kernel: Start using boost::intrusive_ptr for lifetime managementYuri Kunde Schlesner1-13/+10
2015-01-09Kernel: Don't re-assign object's handle when duplicating oneYuri Kunde Schlesner1-1/+2
2015-01-09Thread: Reduce use of Handles and move some funcs to inside the class.Yuri Kunde Schlesner1-1/+1
2015-01-09Kernel: Move Thread's definition to the header fileYuri Kunde Schlesner1-2/+1
2015-01-09Move ThreadContext to core/core.h and deal with the falloutYuri Kunde Schlesner1-0/+1
2015-01-09SVC: Implemented the Timer service calls.Subv1-1/+3
2015-01-08Threads: Use a dummy idle thread when no other are ready.Subv1-0/+2
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.
2014-12-28Kernel: New handle managerYuri Kunde Schlesner1-51/+67
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-28Rename ObjectPool to HandleTableYuri Kunde Schlesner1-10/+10
2014-12-21License changepurpasmart961-2/+2
2014-12-18Filesystem/Archives: Implemented the SaveData archiveSubv1-0/+1
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-16HLE: Rename namespaces to match move & fix initialization orderYuri Kunde Schlesner1-5/+0
2014-12-16HLE: Move kernel/archive.* to service/fs/Yuri Kunde Schlesner1-1/+1
2014-12-13Convert old logging calls to new logging macrosYuri Kunde Schlesner1-4/+4
2014-12-04kernel: Shorten GetCountLioncash1-6/+3
2014-12-04kernel: Make some functions constLioncash1-2/+2
2014-11-19Remove trailing spaces in every file but the ones imported from SkyEye, AOSP or generatedEmmanuel Gil Peyrot1-3/+3
2014-09-15Core: Get rid of unnecessary switch statement in KernelLioncash1-41/+2
2014-09-09core: Prune redundant includesarchshift1-2/+0
2014-08-19Core: Use std::array for managing kernel object spaceLioncash1-2/+1
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-2/+2
Most functions already operate on std::strings. This also removes the need to manually null terminate thread names.
2014-07-05Archive: Added Init/Shutdown methods to reset kernel archive state.bunnei1-0/+3
2014-06-13Kernel: Removed unnecessary "#pragma once".bunnei1-2/+0
2014-06-13Kernel: Added freeing of kernel objects on emulator shutdown.bunnei1-0/+4
2014-06-13HLE: Updated all uses of NULL to nullptr (to be C++11 compliant)bunnei1-1/+1
2014-06-05kernel: changed current default thread priority back to 0x30 - I think this is more correctbunnei1-1/+1
2014-06-02kernel: changed main thread priority to default, updated Kernel::Reschedule to use PrepareReschedulebunnei1-1/+2
2014-05-23kernel: refactored function naming to remove "__" prefixbunnei1-5/+10
2014-05-21thread: moved threading calls to the Kernel namespacebunnei1-3/+3
2014-05-21- created a Kernel namespacebunnei1-25/+24
- cleaned up Kernel code a bit (moved stuff into namespace, fixed whitespace issues) - added handle types for all different CTROS handles
2014-05-16changed "UID" to "Handle" to be a little more consistent with CTR namingbunnei1-5/+5
2014-05-15changed primary thread priority to 0x30 - this is typical, not 0x31bunnei1-1/+2
2014-05-14- added __KernelLoadExec functionbunnei1-0/+11
- fixed some logging
2014-05-10added initial kernel/thread modulesbunnei1-0/+142