summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/kernel.cpp (follow)
Commit message (Collapse)AuthorAgeFilesLines
* hle: kernel: Move slab resource counts to Kernel.bunnei2021-05-061-1/+11
|
* hle: kernel: Fix un/sign mismatch errors with NUM_CPU_CORES.bunnei2021-05-061-3/+3
|
* hle: kernel: Migrate to KHandleTable.bunnei2021-05-061-10/+10
|
* hle: kernel: Improve MapSharedMemory and implement UnmapSharedMemory.bunnei2021-05-061-12/+12
|
* hle: kernel: Rename Process to KProcess.bunnei2021-05-061-13/+13
|
* hle: kernel: Do not shutdown twice on emulator close.bunnei2021-05-061-3/+1
|
* hle: kernel: Cleanup shutdown of persistent kernel objects.bunnei2021-05-061-14/+12
|
* hle: kernel: Migrate KClientPort to KAutoObject.bunnei2021-05-061-3/+7
|
* hle: kernel: Migrate KResourceLimit to KAutoObject.bunnei2021-05-061-5/+19
|
* hle: kernel: Move slab heaps to their own container.bunnei2021-05-061-0/+1
|
* hle: kernel: Refactor several threads/events/sharedmemory to use slab heaps.bunnei2021-05-061-25/+25
|
* hle: kernel: Ensure all kernel objects with KAutoObject are properly created.bunnei2021-05-061-0/+7
|
* hle: kernel: Use unique_ptr for suspend and dummy threads.bunnei2021-05-061-8/+8
|
* hle: kernel: Migrate KSharedMemory to KAutoObject.bunnei2021-05-061-20/+25
|
* hle: kernel: Migrate KProcess to KAutoObject.bunnei2021-05-061-4/+4
|
* hle: kernel: Migrate more of KThread to KAutoObject.bunnei2021-05-061-24/+48
|
* hle: kernel: Refactor out various KThread std::shared_ptr usage.bunnei2021-05-061-2/+2
|
* k_resource_limit: Minor cleanup of member variables/headersameerj2021-04-141-3/+4
|
* kernel/process: Replace process resource limit instance with the kernel's resource limitameerj2021-04-121-16/+25
| | | | This commit addresses the inaccurate behavior of kernel processes creating their own resource limit, rather than utilizing the kernel's system-wide resource limit instance.
* Merge pull request #6099 from bunnei/derive-membunnei2021-04-101-26/+296
|\ | | | | Kernel Rework: Derive memory regions from board layout.
| * hle: kernel: Breakup InitializeMemoryLayout.bunnei2021-03-241-3/+7
| |
| * common: common_sizes: Move sizes to the Common namespace.bunnei2021-03-241-7/+7
| |
| * hle: kernel: Remove unused variable.bunnei2021-03-211-1/+0
| |
| * hle: kernel: k_memory_layout: Derive memory regions based on board layout.bunnei2021-03-211-26/+293
| |
| * hle: kernel: Move KMemoryRegion to its own module and update.bunnei2021-03-211-10/+10
| |
* | kernel: Increase event and session countsameerj2021-04-071-2/+2
| | | | | | | | 12.x increased the number of available sessions and event resource counts
* | hle: kernel: Initialize preemption task after schedulers.bunnei2021-03-271-1/+1
|/ | | | - Fixes a startup crash that occurs if CoreTiming tries to preempt before kernel initialization completes.
* hle: kernel: KThread: Rework dummy threads & fix memory leak.bunnei2021-03-061-6/+5
| | | | | - Dummy threads are created on thread local storage for all host threads. - Fixes a leak by removing creation of fibers, which are not applicable here.
* Merge pull request #5953 from bunnei/memory-refactor-1bunnei2021-02-271-44/+44
|\ | | | | Kernel Rework: Memory updates and refactoring (Part 1)
| * hle: kernel: Migrate MemoryManager to KMemoryManager.bunnei2021-02-191-8/+8
| |
| * hle: kernel: Migrate to KMemoryBlock, KMemoryBlockManager, and others.bunnei2021-02-191-16/+16
| |
| * hle: kernel: Migrate SlabHeap to KSlabHeap.bunnei2021-02-191-5/+5
| |
| * hle: kernel: Migrate MemoryLayout to KMemoryLayout.bunnei2021-02-191-2/+2
| |
| * hle: kernel: Rename SharedMemory to KSharedMemory.bunnei2021-02-191-17/+17
| |
* | kernel: Fix resource release exception on exitameerj2021-02-211-2/+7
|/ | | | | After rewriting the resource limit, objects releasing reserved resources require a live kernel instance. This commit fixes exceptions that occur due to the kernel being destroyed before some objects released their resources, allowing for a graceful exit.
* kernel: More accurately reserve and release resourcesameerj2021-02-131-3/+12
|
* kernel: Unify result codes (#5890)Chloe2021-02-131-1/+1
| | | | | | | | | * 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
* Simplify limitableresource namesChloe Marcec2021-02-031-10/+6
|
* kernel: Rewrite resource limit to be more accurateChloe Marcec2021-01-301-13/+17
| | | | Matches closer to hardware
* hle: kernel: threading: Fix bug with host thread naming.bunnei2021-01-291-3/+2
|
* hle: kernel: Allocate a dummy KThread for each host thread, and use it for scheduling.bunnei2021-01-291-7/+20
|
* kernel: Fix build errors.bunnei2021-01-291-2/+2
|
* hle: kernel: Recode implementation of KThread to be more accurate.bunnei2021-01-291-5/+5
|
* kernel: k_light_lock: Simplify EmuThreadHandle implementation.bunnei2021-01-291-14/+7
|
* hle: kernel: KThread: Fix ThreadType definition.bunnei2021-01-291-1/+1
|
* hle: kernel: Move single core "phantom mode" out of KThread.bunnei2021-01-291-1/+20
| | | | - This is a workaround that does not belong in a kernel primitive.
* hle: kernel: KThread: Remove thread types that do not exist.bunnei2021-01-291-5/+3
|
* core: hle: kernel: Rename Thread to KThread.bunnei2021-01-291-7/+7
|
* hle: kernel: thread: Preserve thread wait reason for debugging only.bunnei2021-01-111-0/+2
| | | | - This is decoupled from core functionality and used for debugging only.
* hle: kernel: Rename thread "status" to "state".bunnei2021-01-111-2/+2
|
* hle: kernel: thread: Replace ThreadStatus/ThreadSchedStatus with a single ThreadState.bunnei2021-01-111-1/+1
| | | | - This is how the real kernel works, and is more accurate and simpler.
* core: hle: kernel: Update KSynchronizationObject.bunnei2021-01-111-13/+2
|
* hle: kernel: Manage service threads on another thread.bunnei2020-12-301-9/+20
| | | | - This is to allow service threads to defer destruction of themselves.
* hle: kernel: Manage host thread IDs using TLS.bunnei2020-12-301-46/+31
| | | | - Avoids the need to have a large map of host to guest thread IDs.
* hle: kernel: Move ServiceThread ownership to KernelCore.bunnei2020-12-291-1/+20
| | | | - Fixes a circular dependency which prevented threads from being released on shutdown.
* core: hle: kernel: Clear process list on boot.bunnei2020-12-291-2/+2
|
* core: kernel: Clear process list earlier.bunnei2020-12-291-2/+2
|
* core: hle: server_session: Use separate threads for each service connection.bunnei2020-12-291-1/+1
|
* hle: kernel: Migrate to KScopedSchedulerLock.bunnei2020-12-061-2/+2
|
* hle: kernel: Rewrite scheduler implementation based on Mesopshere.bunnei2020-12-061-35/+24
|
* core: arm: Implement InvalidateCacheRange for CPU cache invalidation.bunnei2020-11-291-5/+10
|
* common: fiber: Use boost::context instead of native fibers on Windows.bunnei2020-11-291-1/+1
|
* hle: kernel: multicore: Replace n-JITs impl. with 4 JITs.bunnei2020-11-291-6/+17
|
* hle/kernel: Remove unused registered_core_threads to fix data racesReinUsesLisp2020-10-271-5/+0
| | | | | This member was only used on asserts and it triggered data races. Remove it to fix them.
* Revert "core: Fix clang build"bunnei2020-10-211-1/+1
|
* kernel: Fix build with recent compiler flag changesLioncash2020-10-211-4/+8
| | | | | This slipped through the cracks due to another change being merged before the compiler flag changes.
* Merge pull request #4796 from lioncash/clangLC2020-10-211-1/+1
|\ | | | | core: Fix clang build
| * core: Fix clang buildLioncash2020-10-181-1/+1
| | | | | | | | | | | | | | Recent changes to the build system that made more warnings be flagged as errors caused building via clang to break. Fixes #4795
* | kernel: Implement host thread register methods without lockingReinUsesLisp2020-10-131-28/+38
|/ | | | | | | | | | | | | Locks on GetCurrentHostThreadID were causing performance issues according to Visual Studio's profiler. It was consuming twice the time as arm_interface.Run(). The cost was not in the function itself but in the lockinig it required. Reimplement these functions using atomics and static storage instead of an unordered_map. This is a side effect to avoid locking and using linked lists for reads. Replace unordered_map with a linear search.
* hle/kernel: Fix data race in GetCurrentHostThreadIDReinUsesLisp2020-08-261-1/+2
| | | | | | | | As reported by tsan, host_thread_ids could be read while any of the RegisterHostThread variants were called. To fix this, lock the register mutex when yuzu is running in multicore mode and GetCurrentHostThreadID is called.
* core_timing: Make use of uintptr_t to represent user_dataLioncash2020-07-281-1/+1
| | | | Makes the interface future-proofed for supporting other platforms in the event we ever support platforms with differing pointer sizes. This way, we have a type in place that is always guaranteed to be able to represent a pointer exactly.
* Merge pull request #4348 from lioncash/nanobunnei2020-07-181-3/+5
|\ | | | | core_timing: Make usage of nanoseconds more consistent in the interface
| * core_timing: Make TimedCallback take std::chrono::nanosecondsLioncash2020-07-161-1/+1
| | | | | | | | Enforces our desired time units directly with a concrete type.
| * core_timing: Make use of std::chrono with ScheduleEventLioncash2020-07-161-2/+4
| |
* | cpu_manager: Mark function getters as staticLioncash2020-07-161-5/+6
| | | | | | | | | | All these do are return std::function instances of static functions, so these can be used without an instance of the CPU manager.
* | kernel/handle_table: Remove usages of the global system instanceLioncash2020-07-151-2/+3
|/ | | | | | Removes even more usages of the global system instance, trimming away more dependencies on global variables and making them explicit in the interface.
* Core/Common: Address Feedback.Fernando Sahmkow2020-06-281-9/+5
|
* General: Cleanup legacy code.Fernando Sahmkow2020-06-271-79/+2
|
* Kernel/svcBreak: Implement CacheInvalidation for Singlecore and correct svcBreak.Fernando Sahmkow2020-06-271-1/+11
|
* Scheduler: Correct Reload/UnloadFernando Sahmkow2020-06-271-0/+1
|
* General: Move ARM_Interface into Threads.Fernando Sahmkow2020-06-271-38/+21
|
* Core: Refactor ARM Interface.Fernando Sahmkow2020-06-271-1/+27
|
* SingleCore: Move Host Timing from a sepparate thread to main cpu thread.Fernando Sahmkow2020-06-271-1/+1
|
* General: Fix microprofile on dynarmic/svc, fix wait tree showing which threads were running.Fernando Sahmkow2020-06-271-0/+15
|
* General: Fix Stop functionFernando Sahmkow2020-06-271-0/+15
|
* Kernel: Preempt Single core on redudant yields.Fernando Sahmkow2020-06-271-0/+4
|
* General: Initial Setup for Single Core.Fernando Sahmkow2020-06-271-0/+19
|
* Kernel: Fixes, corrections and asserts to scheduler and different svcs.Fernando Sahmkow2020-06-271-0/+1
|
* General: Recover Prometheus project from harddrive failure Fernando Sahmkow2020-06-271-7/+77
| | | | | | | This commit: Implements CPU Interrupts, Replaces Cycle Timing for Host Timing, Reworks the Kernel's Scheduler, Introduce Idle State and Suspended State, Recreates the bootmanager, Initializes Multicore system.
* kernel: resource_limit: Reserve physical memory.bunnei2020-04-171-1/+6
|
* kernel: Initialize memory layout for new VMM.bunnei2020-04-171-0/+115
|
* CMakeLists: Make -Wreorder a compile-time errorLioncash2020-04-151-1/+1
| | | | | | This can result in silent logic bugs within code, and given the amount of times these kind of warnings are caused, they should be flagged at compile-time so no new code is submitted with them.
* core: Implement separate A32/A64 ARM interfaces.bunnei2020-03-031-0/+4
|
* Kernel: Address Feedback.Fernando Sahmkow2020-02-221-11/+16
|
* Kernel: Implement Time Manager.Fernando Sahmkow2020-02-221-1/+11
|
* Kernel: Rename ThreadCallbackHandleTable and Setup Thread Ids on Kernel.Fernando Sahmkow2020-02-221-12/+76
|
* Kernel: Make global scheduler depend on KernelCoreFernando Sahmkow2020-02-221-3/+11
|
* Kernel: Refactor synchronization to better match REFernando Sahmkow2020-02-111-1/+12
|
* Kernel: Change WaitObject to Synchronization object. In order to better reflect RE.Fernando Sahmkow2020-02-111-2/+2
|
* kernel/physical_core: Remove unused kernel reference member variableLioncash2020-01-311-4/+4
| | | | | | | This isn't used within the class, so it can be removed to simplify the overall interface. While we're in the same area, we can simplify a unique_ptr reset() call.
* System: Address FeedbackFernando Sahmkow2020-01-271-2/+3
|
* ArmInterface: Delegate Exclusive monitor factory to exclusive monitor interfasce.Fernando Sahmkow2020-01-261-15/+2
|
* Core: Refactor CPU Management.Fernando Sahmkow2020-01-251-1/+63
| | | | This commit moves ARM Interface and Scheduler handling into the kernel.
* Kernel: Correct behavior of Address Arbiter threads. (#3165)Fernando Sahmkow2019-12-111-3/+3
| | | | | | | | | | | * Kernel: Correct behavior of Address Arbiter threads. This corrects arbitration threads to behave just like in Horizon OS. They are added into a container and released according to what priority they had when added. Horizon OS does not reorder them if their priority changes. * Kernel: Address Feedback.
* kernel: Remove unnecessary includesLioncash2019-12-081-1/+0
| | | | | | Over the course of the changes to the kernel code, a few includes are no longer necessary, particularly with the change over to std::shared_ptr from Boost's intrusive_ptr.
* core/memory; Migrate over SetCurrentPageTable() to the Memory classLioncash2019-11-271-7/+11
| | | | | | | Now that literally every other API function is converted over to the Memory class, we can just move the file-local page table into the Memory implementation class, finally getting rid of global state within the memory code.
* core_timing: Use better reference tracking for EventType. (#3159)bunnei2019-11-271-6/+7
| | | | | | | * core_timing: Use better reference tracking for EventType. - Moves ownership of the event to the caller, ensuring we don't fire events for destroyed objects. - Removes need for unique names - we won't be using this for save states anyways.
* kernel: Replace usage of boost::intrusive_ptr with std::shared_ptr for kernel objects. (#3154)bunnei2019-11-251-9/+10
| | | | | | * 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.
* Kernel: Optimize condition variable threads management.Fernando Sahmkow2019-11-211-1/+1
|
* Kernel: Correct behavior of Condition Variables to be more similar to real hardware.Fernando Sahmkow2019-11-211-0/+3
| | | | | | | This commit ensures cond var threads act exactly as they do in the real console. The original implementation uses an RBTree and the behavior of cond var threads is that at the same priority level they act like a FIFO.
* Kernel: Reverse global accessor removal.Fernando Sahmkow2019-10-151-8/+0
|
* Kernel Scheduler: Make sure the global scheduler shutdowns correctly.Fernando Sahmkow2019-10-151-0/+2
|
* Kernel: Correct Results in Condition Variables and MutexesFernando Sahmkow2019-10-151-6/+7
|
* Kernel: Remove global system accessor from WaitObjectFernando Sahmkow2019-10-151-0/+8
|
* Kernel: Initial implementation of thread preemption.Fernando Sahmkow2019-10-151-0/+16
|
* Kernel: Style and CorrectionsFernando Sahmkow2019-10-151-1/+1
|
* Add interfacing to the Global SchedulerFernando Sahmkow2019-10-151-0/+10
|
* kernel: Differentiate kernel and user processes when picking IDZach Hilman2019-06-101-4/+10
| | | | This allows kernel internal type processes to be assigned IDs in the KIP range while userland processes are assigned in the user range.
* Merge pull request #2416 from lioncash/waitbunnei2019-04-251-2/+1
|\ | | | | kernel/svc: Clean up wait synchronization related functionality
| * kernel/thread: Unify wait synchronization typesLioncash2019-04-171-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a holdover from Citra, where the 3DS has both WaitSynchronization1 and WaitSynchronizationN. The switch only has one form of wait synchronizing (literally WaitSynchonization). This allows us to throw out code that doesn't apply at all to the Switch kernel. Because of this unnecessary dichotomy within the wait synchronization utilities, we were also neglecting to properly handle waiting on multiple objects. While we're at it, we can also scrub out any lingering references to WaitSynchronization1/WaitSynchronizationN in comments, and change them to WaitSynchronization (or remove them if the mention no longer applies).
* | core/cpu_core_manager: Create threads separately from initialization.Lioncash2019-04-121-1/+6
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Our initialization process is a little wonky than one would expect when it comes to code flow. We initialize the CPU last, as opposed to hardware, where the CPU obviously needs to be first, otherwise nothing else would work, and we have code that adds checks to get around this. For example, in the page table setting code, we check to see if the system is turned on before we even notify the CPU instances of a page table switch. This results in dead code (at the moment), because the only time a page table switch will occur is when the system is *not* running, preventing the emulated CPU instances from being notified of a page table switch in a convenient manner (technically the code path could be taken, but we don't emulate the process creation svc handlers yet). This moves the threads creation into its own member function of the core manager and restores a little order (and predictability) to our initialization process. Previously, in the multi-threaded cases, we'd kick off several threads before even the main kernel process was created and ready to execute (gross!). Now the initialization process is like so: Initialization: 1. Timers 2. CPU 3. Kernel 4. Filesystem stuff (kind of gross, but can be amended trivially) 5. Applet stuff (ditto in terms of being kind of gross) 6. Main process (will be moved into the loading step in a following change) 7. Telemetry (this should be initialized last in the future). 8. Services (4 and 5 should ideally be alongside this). 9. GDB (gross. Uses namespace scope state. Needs to be refactored into a class or booted altogether). 10. Renderer 11. GPU (will also have its threads created in a separate step in a following change). Which... isn't *ideal* per-se, however getting rid of the wonky intertwining of CPU state initialization out of this mix gets rid of most of the footguns when it comes to our initialization process.
* kernel: Handle page table switching within MakeCurrentProcess()Lioncash2019-04-071-0/+2
| | | | | Centralizes the page table switching to one spot, rather than making calling code deal with it everywhere.
* Merge pull request #2270 from lioncash/plistbunnei2019-04-031-0/+4
|\ | | | | kernel/svc: Implement svcGetProcessList and svcGetThreadList
| * kernel/svc: Implement svcGetProcessListLioncash2019-04-021-0/+4
| | | | | | | | | | | | This service function simply copies out a specified number of kernel process IDs, while simultaneously reporting the total number of processes.
* | kernel/resource_limit: Remove the name member from resource limitsLioncash2019-04-011-1/+1
|/ | | | | | | | | | | | This doesn't really provide any benefit to the resource limit interface. There's no way for callers to any of the service functions for resource limits to provide a custom name, so all created instances of resource limits other than the system resource limit would have a name of "Unknown". The system resource limit itself is already trivially identifiable from its limit values, so there's no real need to take up space in the object to identify one object meaningfully out of N total objects.
* general: Use deducation guides for std::lock_guard and std::unique_lockLioncash2019-04-011-1/+1
| | | | | | | Since C++17, the introduction of deduction guides for locking facilities means that we no longer need to hardcode the mutex type into the locks themselves, making it easier to switch mutex types, should it ever be necessary in the future.
* Merge pull request #2266 from FernandoS27/arbitrationbunnei2019-03-291-1/+2
|\ | | | | Kernel: Fixes to Arbitration and SignalProcessWideKey Management
| * Fix small bug that kept a thread as a condvar thread after being signalled.Fernando Sahmkow2019-03-201-1/+2
| |
| * Add CondVar Thread State.Fernando Sahmkow2019-03-201-1/+1
| |
* | core/core_timing: Make callback parameters consistentLioncash2019-03-241-1/+1
|/ | | | | | | | | | | In some cases, our callbacks were using s64 as a parameter, and in other cases, they were using an int, which is inconsistent. To make all callbacks consistent, we can just use an s64 as the type for late cycles, given it gets rid of the need to cast internally. While we're at it, also resolve some signed/unsigned conversions that were occurring related to the callback registration.
* kernel: Make the address arbiter instance per-processLioncash2019-03-081-11/+1
| | | | | | | | | | Now that we have the address arbiter extracted to its own class, we can fix an innaccuracy with the kernel. Said inaccuracy being that there isn't only one address arbiter. Each process instance contains its own AddressArbiter instance in the actual kernel. This fixes that and gets rid of another long-standing issue that could arise when attempting to create more than one process.
* kernel/address_arbiter: Pass in system instance to constructorLioncash2019-03-051-7/+12
| | | | | Allows getting rid of reliance on the global accessor functions and instead operating on the provided system instance.
* kernel/address_arbiter: Convert the address arbiter into a classLioncash2019-03-051-0/+11
| | | | | | Places all of the functions for address arbiter operation into a class. This will be necessary for future deglobalizing efforts related to both the memory and system itself.
* core_timing: Convert core timing into a classLioncash2019-02-161-6/+6
| | | | | | | | | | | Gets rid of the largest set of mutable global state within the core. This also paves a way for eliminating usages of GetInstance() on the System class as a follow-up. Note that no behavioral changes have been made, and this simply extracts the functionality into a class. This also has the benefit of making dependencies on the core timing functionality explicit within the relevant interfaces.
* core_timing: Rename CoreTiming namespace to Core::TimingLioncash2019-02-121-3/+3
| | | | | | Places all of the timing-related functionality under the existing Core namespace to keep things consistent, rather than having the timing utilities sitting in its own completely separate namespace.
* kernel: Remove the Timer classLioncash2019-02-011-42/+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).
* core/kernel: Remove unnecessary inclusionsLioncash2019-01-011-1/+0
| | | | Gets rid of a few unnecessary header dependencies in some source files.
* kernel/kernel: Use correct initial PID for userland Process instancesLioncash2018-12-191-4/+2
| | | | | | Starts the process ID counter off at 81, which is what the kernel itself checks against internally when creating processes. It's actually supposed to panic if the PID is less than 81 for a userland process.
* kernel/thread: Make thread_id a 64-bit valueLioncash2018-12-191-2/+2
| | | | | The kernel uses a 64-bit value for the thread ID, so we shouldn't be using a 32-bit value.
* kernel/process: Make process_id a 64-bit valueLioncash2018-12-191-2/+2
| | | | | In the actual kernel, this is a 64-bit value, so we shouldn't be using a 32-bit type to handle it.
* kernel/resource_limit: Clean up interfaceLioncash2018-11-201-63/+16
| | | | | | | | | | | | | Cleans out the citra/3DS-specific implementation details that don't apply to the Switch. Sets the stage for implementing ResourceLimit instances properly. While we're at it, remove the erroneous checks within CreateThread() and SetThreadPriority(). While these are indeed checked in some capacity, they are not checked via a ResourceLimit instance. In the process of moving out Citra-specifics, this also replaces the system ResourceLimit instance's values with ones from the Switch.
* core: Make System references const where applicableLioncash2018-10-281-2/+2
|
* kernel/process: Make the handle table per-processLioncash2018-10-201-10/+0
| | | | | | | | In the kernel, there isn't a singular handle table that everything gets tossed into or used, rather, each process gets its own handle table that it uses. This currently isn't an issue for us, since we only execute one process at the moment, but we may as well get this out of the way so it's not a headache later on.
* kernel/thread: Use a regular pointer for the owner/current processLioncash2018-10-101-6/+6
| | | | | | | | | | | There's no real need to use a shared pointer in these cases, and only makes object management more fragile in terms of how easy it would be to introduce cycles. Instead, just do the simple thing of using a regular pointer. Much of this is just a hold-over from citra anyways. It also doesn't make sense from a behavioral point of view for a process' thread to prolong the lifetime of the process itself (the process is supposed to own the thread, not the other way around).
* kernel/thread: Make all instance variables privateLioncash2018-10-041-18/+18
| | | | | | | | | | | | | | | | | | | | Many of the member variables of the thread class aren't even used outside of the class itself, so there's no need to make those variables public. This change follows in the steps of the previous changes that made other kernel types' members private. The main motivation behind this is that the Thread class will likely change in the future as emulation becomes more accurate, and letting random bits of the emulator access data members of the Thread class directly makes it a pain to shuffle around and/or modify internals. Having all data members public like this also makes it difficult to reason about certain bits of behavior without first verifying what parts of the core actually use them. Everything being public also generally follows the tendency for changes to be introduced in completely different translation units that would otherwise be better introduced as an addition to the Thread class' public interface.
* core: Migrate current_process pointer to the kernelLioncash2018-09-071-0/+14
| | | | | | | | | | Given we now have the kernel as a class, it doesn't make sense to keep the current process pointer within the System class, as processes are related to the kernel. This also gets rid of a subtle case where memory wouldn't be freed on core shutdown, as the current_process pointer would never be reset, causing the pointed to contents to continue to live.
* service: Migrate global named port map to the KernelCore classLioncash2018-09-021-0/+24
| | | | | | Now that we have a class representing the kernel in some capacity, we now have a place to put the named port map, so we move it over and get rid of another piece of global state within the core.
* kernel: Eliminate kernel global stateLioncash2018-08-291-15/+268
| | | | | | | | | | | | | | | | | | | | | | 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.
* kernel/object: Tighten object against data racesLioncash2018-08-131-1/+1
| | | | | | | | | | 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.
* core/memory: Get rid of 3DS leftoversLioncash2018-08-031-5/+1
| | | | Removes leftover code from citra that isn't needed.
* kernel: Remove unused object_address_table.cpp/.hLioncash2018-07-311-2/+0
| | | | | | These source files were entirely unused throughout the rest of the codebase. This also has the benefit of getting rid of a global variable as well.
* hle: Remove config_mem.h/.cppLioncash2018-07-231-3/+0
| | | | | This is just an unused hold-over from citra, so we can get rid of this to trim off an exposed global, among other things.
* hle: Remove shared_page.h/.cppLioncash2018-07-231-2/+0
| | | | This is a holdover from citra that's essentially unused.
* core: Move process creation out of global state.bunnei2018-03-141-1/+0
|
* kernel: Add ObjectAddressTable class.bunnei2018-01-011-2/+5
|
* Kernel: Move HandleTable to a separate fileYuri Kunde Schlesner2017-05-301-84/+1
|
* Kernel: Move WaitObject to a separate fileYuri Kunde Schlesner2017-05-301-79/+0
| | | | | Now that HandleTable doesn't directly depend on WaitObject anymore, this can be separated from the main kernel.h header.
* Kernel: Centralize error definitions in errors.hYuri Kunde Schlesner2017-05-251-0/+1
|
* Kernel: Add some asserts to enforce the invariants in the scheduler.Subv2017-01-051-0/+8
|
* Kernel: Remove a thread from all of its waiting objects' waiting_threads list when it is awoken.Subv2017-01-051-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
* Kernel: Remove Thread::wait_objects_index and use wait_objects to hold all the objects that a thread is waiting on.Subv2017-01-051-1/+7
|
* Kernel/Mutex: Update a mutex priority when a thread stops waiting on it.Subv2017-01-041-8/+15
|
* Kernel: Object ShouldWait and Acquire calls now take a thread as a parameter.Subv2017-01-041-8/+6
| | | | This will be useful when implementing mutex priority inheritance.
* Kernel: remove object's waiting thread if it is deadwwylele2016-12-161-1/+2
|
* Fixed the codestyle to match our clang-format rules.Subv2016-12-141-4/+5
|
* Properly remove a thread from its wait_objects' waitlist when it is awoken by a timeout.Subv2016-12-101-1/+6
|
* WaitSynch: Removed unused variables and reduced SharedPtr copies.Subv2016-12-091-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.
* Use boost remove_erase_if instead of the erase-remove idiomSubv2016-12-071-2/+3
|
* Improved the algorithm for GetHighestPriorityReadyThread.Subv2016-12-071-14/+13
|
* Threading: Added some utility functions and const correctness.Subv2016-12-041-7/+6
|
* Threading: Reworked the way our scheduler works.Subv2016-12-041-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.
* Kernel/Loader: Grab the system mode from the NCCH ExHeader.Subv2016-11-201-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
* implement wait tree widgetwwylele2016-09-221-0/+4
|
* Use negative priorities to avoid special-casing the self-includeYuri Kunde Schlesner2016-09-211-1/+1
|
* Remove empty newlines in #include blocks.Emmanuel Gil Peyrot2016-09-211-3/+1
| | | | | | | This makes clang-format useful on those. Also add a bunch of forgotten transitive includes, which otherwise prevented compilation.
* Sources: Run clang-format on everything.Emmanuel Gil Peyrot2016-09-181-1/+2
|
* Kernel: Add more infrastructure to support different memory layoutsYuri Kunde Schlesner2015-08-161-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.
* Common: Cleanup key_map includes.Emmanuel Gil Peyrot2015-06-281-2/+0
|
* kernel: Fix svcWaitSynch to always acquire requested wait objects.bunnei2015-06-171-18/+4
|
* Core/ResourceLimits: Implemented the basic structure of ResourceLimits.Subv2015-05-151-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.
* fixup!Subv2015-05-121-1/+3
|
* Core/HLE: Implemented the SVCs GetProcessId and GetProcessIdOfThreadSubv2015-05-111-2/+2
|
* Kernel: Remove unused g_main_thread variableYuri Kunde Schlesner2015-05-091-2/+0
|
* Kernel: Remove g_program_idYuri Kunde Schlesner2015-05-091-2/+0
| | | | This has been obsoleted by the field in Process.
* Kernel: Introduce skeleton Process class to hold process dataYuri Kunde Schlesner2015-05-091-12/+2
|
* Common: Remove common.hYuri Kunde Schlesner2015-05-071-1/+2
|
* Kernel: Properly initialize and shutdown all modules.bunnei2015-05-021-4/+7
|
* Kernel: Fixed default thread priority.bunnei2015-04-101-1/+1
|
* Build: Fixed some warningsSubv2015-02-121-2/+2
|
* Asserts: break/crash program, fit to style guide; log.h->assert.harchshift2015-02-111-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.
* Scheduler refactor Pt. 1Kevin Hartman2015-02-101-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.
* core: Fix some warnings on OSXLioncash2015-02-031-1/+0
|
* Kernel: Make WaitObjects share ownership of Threads waiting on themYuri Kunde Schlesner2015-02-021-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.)
* Kernel: Fix bug in HandleTable::CloseYuri Kunde Schlesner2015-02-021-1/+1
|
* Kernel: Remove Object::GetHandle (it's not used anymore :D)Yuri Kunde Schlesner2015-02-021-4/+1
|
* Kernel: Introduce unique Object ids for debuggingYuri Kunde Schlesner2015-02-021-0/+2
|
* Kernel: Renamed some functions for clarity.bunnei2015-01-221-1/+1
| | | | | - ReleaseNextThread->WakeupNextThread - ReleaseAllWaitingThreads->WakeupAllWaitingThreads.
* Session: Change to a WaitObject.bunnei2015-01-221-1/+1
|
* Kernel: Reschedule on SignalEvent and SendSyncRequest, fix some bugs.bunnei2015-01-221-1/+1
|
* AddressArbiter: Changed to Kernel::Object, big cleanup, removed code that made no sense.bunnei2015-01-221-1/+1
|
* Kernel: Get rid of WaitTypes and simplify lots of code, removing hacks.bunnei2015-01-221-2/+4
|
* WaitSynchronizationN: Implement return valuesbunnei2015-01-221-2/+2
|
* WaitObject: Added RemoveWaitingThread, fixed a bug, and cleanup.bunnei2015-01-221-3/+10
|
* Kernel: Added WaitObject and changed "waitable" objects inherit from it.bunnei2015-01-221-0/+26
|
* Kernel: Start using boost::intrusive_ptr for lifetime managementYuri Kunde Schlesner2015-01-091-13/+10
|
* Kernel: Don't re-assign object's handle when duplicating oneYuri Kunde Schlesner2015-01-091-1/+2
|
* Thread: Reduce use of Handles and move some funcs to inside the class.Yuri Kunde Schlesner2015-01-091-1/+1
|
* Kernel: Move Thread's definition to the header fileYuri Kunde Schlesner2015-01-091-2/+1
|
* Move ThreadContext to core/core.h and deal with the falloutYuri Kunde Schlesner2015-01-091-0/+1
|
* Merge pull request #255 from Subv/cbranch_3bunnei2015-01-091-1/+3
|\ | | | | Implemented timers
| * SVC: Implemented the Timer service calls.Subv2015-01-091-1/+3
| |
* | Threads: Use a dummy idle thread when no other are ready.Subv2015-01-081-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.
* Kernel: New handle managerYuri Kunde Schlesner2014-12-281-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.
* Rename ObjectPool to HandleTableYuri Kunde Schlesner2014-12-281-10/+10
|
* License changepurpasmart962014-12-211-2/+2
|
* Filesystem/Archives: Implemented the SaveData archiveSubv2014-12-181-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
* HLE: Rename namespaces to match move & fix initialization orderYuri Kunde Schlesner2014-12-161-5/+0
|
* HLE: Move kernel/archive.* to service/fs/Yuri Kunde Schlesner2014-12-161-1/+1
|
* Convert old logging calls to new logging macrosYuri Kunde Schlesner2014-12-131-4/+4
|
* kernel: Shorten GetCountLioncash2014-12-041-6/+3
|
* kernel: Make some functions constLioncash2014-12-041-2/+2
|
* Remove trailing spaces in every file but the ones imported from SkyEye, AOSP or generatedEmmanuel Gil Peyrot2014-11-191-3/+3
|
* Core: Get rid of unnecessary switch statement in KernelLioncash2014-09-151-41/+2
|
* core: Prune redundant includesarchshift2014-09-091-2/+0
|
* Core: Use std::array for managing kernel object spaceLioncash2014-08-191-2/+1
| | | | These avoid relying on memset for clearing the arrays.
* Core: Alter the kernel string functions to use std::string instead of const char*.Lioncash2014-08-181-2/+2
| | | | Most functions already operate on std::strings. This also removes the need to manually null terminate thread names.
* Archive: Added Init/Shutdown methods to reset kernel archive state.bunnei2014-07-051-0/+3
|
* Kernel: Removed unnecessary "#pragma once".bunnei2014-06-131-2/+0
|
* Kernel: Added freeing of kernel objects on emulator shutdown.bunnei2014-06-131-0/+4
|
* HLE: Updated all uses of NULL to nullptr (to be C++11 compliant)bunnei2014-06-131-1/+1
|
* kernel: changed current default thread priority back to 0x30 - I think this is more correctbunnei2014-06-051-1/+1
|
* kernel: changed main thread priority to default, updated Kernel::Reschedule to use PrepareReschedulebunnei2014-06-021-1/+2
|
* kernel: refactored function naming to remove "__" prefixbunnei2014-05-231-5/+10
|
* thread: moved threading calls to the Kernel namespacebunnei2014-05-211-3/+3
|
* - created a Kernel namespacebunnei2014-05-211-25/+24
| | | | | - cleaned up Kernel code a bit (moved stuff into namespace, fixed whitespace issues) - added handle types for all different CTROS handles
* changed "UID" to "Handle" to be a little more consistent with CTR namingbunnei2014-05-161-5/+5
|
* changed primary thread priority to 0x30 - this is typical, not 0x31bunnei2014-05-151-1/+2
|
* - added __KernelLoadExec functionbunnei2014-05-141-0/+11
| | | | - fixed some logging
* added initial kernel/thread modulesbunnei2014-05-101-0/+142