summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/process.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* core: hle: kernel: object: Implement Finalize() virtual method.bunnei2021-01-291-0/+2
|
* hle: kernel: KThread: Clean up thread priorities.bunnei2021-01-291-1/+6
|
* core: hle: kernel: Rename Thread to KThread.bunnei2021-01-291-5/+5
|
* core: hle: Integrate new KConditionVariable and KAddressArbiter implementations.bunnei2021-01-111-28/+22
|
* core: hle: kernel: Update KSynchronizationObject.bunnei2021-01-111-8/+6
|
* hle: kernel: Process: Various style fixes based on code review feedback.bunnei2020-12-061-2/+2
|
* hle: kernel: process: Add schedule count tracking, to be used for yield impl.bunnei2020-12-061-0/+13
|
* kernel/process: Move name and system context to the bottom of the member listLioncash2020-07-151-6/+6
| | | | | | These aren't directly important or commonly used within the process, so we can move these to the bottom to allow everything else to be more likely to be within a cache line.
* kernel: process: Updates for new VMM.bunnei2020-04-171-18/+27
|
* Kernel: Refactor synchronization to better match REFernando Sahmkow2020-02-111-4/+0
|
* Kernel: Change WaitObject to Synchronization object. In order to better reflect RE.Fernando Sahmkow2020-02-111-2/+2
|
* kernel: Replace usage of boost::intrusive_ptr with std::shared_ptr for kernel objects. (#3154)bunnei2019-11-251-10/+11
| | | | | | * 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/+2
|
* Kernel: Correct behavior of Condition Variables to be more similar to real hardware.Fernando Sahmkow2019-11-211-0/+12
| | | | | | | 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.
* Merge pull request #2687 from lioncash/tls-processbunnei2019-07-181-0/+11
|\ | | | | kernel/process: Allocate the process' TLS region during initialization
| * kernel/process: Allocate the process' TLS region during initializationLioncash2019-07-071-0/+8
| | | | | | | | | | | | | | | | | | | | | | Prior to execution within a process beginning, the process establishes its own TLS region for uses (as far as I can tell) related to exception handling. Now that TLS creation was decoupled from threads themselves, we can add this behavior to our Process class. This is also good, as it allows us to remove a stub within svcGetInfo, namely querying the address of that region.
| * kernel/process: Move main thread stack allocation to its own functionLioncash2019-07-071-0/+3
| | | | | | | | Keeps this particular set of behavior isolated to its own function.
* | address review commentaryMichael Scire2019-07-071-4/+19
| |
* | Implement MapPhysicalMemory/UnmapPhysicalMemoryMichael Scire2019-07-071-3/+8
|/ | | | | | | | | | | | | | | | | | | | | | | | | | This implements svcMapPhysicalMemory/svcUnmapPhysicalMemory for Yuzu, which can be used to map memory at a desired address by games since 3.0.0. It also properly parses SystemResourceSize from NPDM, and makes information available via svcGetInfo. This is needed for games like Super Smash Bros. and Diablo 3 -- this PR's implementation does not run into the "ASCII reads" issue mentioned in the comments of #2626, which was caused by the following bugs in Yuzu's memory management that this PR also addresses: * Yuzu's memory coalescing does not properly merge blocks. This results in a polluted address space/svcQueryMemory results that would be impossible to replicate on hardware, which can lead to game code making the wrong assumptions about memory layout. * This implements better merging for AllocatedMemoryBlocks. * Yuzu's implementation of svcMirrorMemory unprotected the entire virtual memory range containing the range being mirrored. This could lead to games attempting to map data at that unprotected range/attempting to access that range after yuzu improperly unmapped it. * This PR fixes it by simply calling ReprotectRange instead of Reprotect.
* kernel/process: Default initialize all member variablesLioncash2019-07-041-2/+2
| | | | | Ensures a Process instance is always created with a deterministic initial state.
* kernel/process: Decouple TLS handling from threadsLioncash2019-07-041-4/+4
| | | | | | | | | | | Extracts out all of the thread local storage management from thread instances themselves and makes the owning process handle the management of the memory. This brings the memory management slightly more in line with how the kernel handles these allocations. Furthermore, this also makes the TLS page management a little more readable compared to the lingering implementation that was carried over from Citra.
* kernel: Differentiate kernel and user processes when picking IDZach Hilman2019-06-101-1/+7
| | | | 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 #2571 from lioncash/refZach Hilman2019-06-101-1/+1
|\ | | | | kernel/process: Make Create()'s name parameter be taken by value
| * kernel/process: Make Create()'s name parameter be taken by valueLioncash2019-06-101-1/+1
| | | | | | | | | | Makes the interface more flexible in terms of how Create() may be called, while still allowing the parameter itself to be moved into.
* | kernel/svc: Implement TotalMemoryUsedWithoutMmHeap/TotalMemoryAvailableWithoutMmHeapLioncash2019-06-101-0/+11
|/ | | | | | | | | Given we don't currently implement the personal heap yet, the existing memory querying functions are essentially doing what the memory querying types introduced in 6.0.0 do. So, we can build the necessary machinery over the top of those and just use them as part of info types.
* kernel/process: Remove unused boost header includeLioncash2019-06-051-1/+0
| | | | | Boost headers typically include a lot of other headers, so removing this can prevent a bit of unnecessary compiler churn when building.
* core/core: Move process execution start to System's Load()Lioncash2019-04-121-2/+5
| | | | | | | | | This gives us significantly more control over where in the initialization process we start execution of the main process. Previously we were running the main process before the CPU or GPU threads were initialized (not good). This amends execution to start after all of our threads are properly set up.
* kernel: Make handle type declarations constexprLioncash2019-04-111-1/+1
| | | | | | | Some objects declare their handle type as const, while others declare it as constexpr. This makes the const ones constexpr for consistency, and prevent unexpected compilation errors if these happen to be attempted to be used within a constexpr context.
* Merge pull request #2314 from lioncash/constbunnei2019-04-031-1/+1
|\ | | | | kernel/thread: Minor interface cleanup
| * kernel/wait_object: Make ShouldWait() take thread members by pointer-to-constLioncash2019-04-021-1/+1
| | | | | | | | | | Given this is intended as a querying function, it doesn't make sense to allow the implementer to modify the state of the given thread.
* | kernel/svc: Implement svcGetThreadListLioncash2019-04-021-0/+17
|/ | | | | | | | | | | | | Similarly like svcGetProcessList, this retrieves the list of threads from the current process. In the kernel itself, a process instance maintains a list of threads, which are used within this function. Threads are registered to a process' thread list at thread initialization, and unregistered from the list upon thread destruction (if said thread has a non-null owning process). We assert on the debug event case, as we currently don't implement kernel debug objects.
* kernel/process: Report total physical memory used to svcGetInfoLioncash2019-03-291-0/+3
| | | | | | | Reports the (mostly) correct size through svcGetInfo now for queries to total used physical memory. This still doesn't correctly handle memory allocated via svcMapPhysicalMemory, however, we don't currently handle that case anyways.
* kernel/process: Store the total size of the code memory loadedLioncash2019-03-291-0/+3
| | | | | This will be necessary to properly report the used memory size in svcGetInfo.
* kernel/process: Store the main thread stack size to a data memberLioncash2019-03-281-0/+3
| | | | | This will be necessary in order to properly report memory usage within svcGetInfo.
* kernel/process: Make Run's stack size parameter a u64Lioncash2019-03-281-1/+1
| | | | | | This will make operating with the process-related SVC commands much nicer in the future (the parameter representing the stack size in svcStartProcess is a 64-bit value).
* kernel/process: Remove unused AddressMapping structLioncash2019-03-241-8/+0
| | | | Another leftover from citra that's now no longer necessary.
* Merge pull request #2234 from lioncash/mutexbunnei2019-03-221-0/+16
|\ | | | | core/hle/kernel: Make Mutex a per-process class.
| * core/hle/kernel: Make Mutex a per-process class.Lioncash2019-03-151-0/+16
| | | | | | | | | | | | | | Makes it an instantiable class like it is in the actual kernel. This will also allow removing reliance on global accessors in a following change, now that we can encapsulate a reference to the system instance in the class.
* | kernel: Move CodeSet structure to its own source filesLioncash2019-03-201-41/+2
|/ | | | | | | | Given this is utilized by the loaders, this allows avoiding inclusion of the kernel process definitions where avoidable. This also keeps the loading format for all executable data separate from the kernel objects.
* kernel/process: Remove use of global system accessorsLioncash2019-03-131-1/+5
| | | | | Now that we pass in a reference to the system instance, we can utilize it to eliminate the global accessors in Process-related code.
* kernel: Make the address arbiter instance per-processLioncash2019-03-081-2/+20
| | | | | | | | | | 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.
* core/kernel: Remove unnecessary inclusionsLioncash2019-01-011-1/+1
| | | | Gets rid of a few unnecessary header dependencies in some source files.
* kernel/process: Rename GetAllowedProcessorMask() and GetAllowedThreadPriorityMask()Lioncash2018-12-311-3/+3
| | | | Makes them consistent with their kernel capability counterparts.
* Merge pull request #1956 from lioncash/process-threadSebastian Valle2018-12-311-5/+5
|\ | | | | kernel/process: Start the main thread using the specified ideal core
| * kernel: Rename 'default' CPU core to 'ideal' coreLioncash2018-12-281-5/+5
| | | | | | | | | | | | This makes the naming more closely match its meaning. It's just a preferred core, not a required default core. This also makes the usages of this term consistent across the thread and process implementations.
* | kernel/process: Remove most allocation functions from Process' interfaceLioncash2018-12-281-8/+1
|/ | | | | | | | | | | | | | | In all cases that these functions are needed, the VMManager can just be retrieved and used instead of providing the same functions in Process' interface. This also makes it a little nicer dependency-wise, since it gets rid of cases where the VMManager interface was being used, and then switched over to using the interface for a Process instance. Instead, it makes all accesses uniform and uses the VMManager instance for all necessary tasks. All the basic memory mapping functions did was forward to the Process' VMManager instance anyways.
* Merge pull request #1928 from lioncash/capsbunnei2018-12-271-45/+13
|\ | | | | kernel: Handle kernel capability descriptors
| * kernel/process: Hook up the process capability parser to the process itselfLioncash2018-12-211-45/+13
| | | | | | | | | | While we're at it, we can also toss out the leftover capability parsing from Citra.
* | kernel/kernel: Use correct initial PID for userland Process instancesLioncash2018-12-191-0/+12
| | | | | | | | | | | | 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/process: Make process_id a 64-bit valueLioncash2018-12-191-3/+3
|/ | | | | In the actual kernel, this is a 64-bit value, so we shouldn't be using a 32-bit type to handle it.
* vm_manager: Amend MemoryState enum membersLioncash2018-12-121-2/+1
| | | | | | | | Amends the MemoryState enum to use the same values like the actual kernel does. Also provides the necessary operators to operate on them. This will be necessary in the future for implementing svcSetMemoryAttribute, as memory block state is checked before applying the attribute.
* kernel/process: Make Process a WaitObjectLioncash2018-12-051-2/+28
| | | | | | | Process instances can be waited upon for state changes. This is also utilized by svcResetSignal, which will be modified in an upcoming change. This simply puts all of the WaitObject related machinery in place.
* kernel/svc: Implement the resource limit svcGetInfo optionLioncash2018-12-041-8/+1
| | | | | Allows a process to register the resource limit as part of its handle table.
* kernel/process: Move <random> include to the cpp fileLioncash2018-11-201-1/+0
| | | | | | <random> isn't necesary directly within the header and can be placed in the cpp file where its needed. Avoids propagating random generation utilities via a header file.
* process: Make MirrorMemory take state to map new memory asZach Hilman2018-11-151-1/+2
| | | | Credits to Subv
* Merge pull request #1679 from DarkLordZach/deterministic-rng-2bunnei2018-11-141-0/+11
|\ | | | | svc: Use proper random entropy generation algorithm
| * svc: Use proper random entropy generation algorithmZach Hilman2018-11-131-0/+11
| |
* | kernel/process: Migrate heap-related memory management out of the process class and into the vm managerLioncash2018-11-131-11/+0
|/ | | | | Avoids a breach of responsibilities in the interface and keeps the direct code for memory management within the VMManager class.
* svc: Implement svcGetInfo command 0xF0000002Lioncash2018-10-261-0/+13
| | | | | | | | | | This retrieves: if (curr_thread == handle_thread) { result = total_thread_ticks + (hardware_tick_count - last_context_switch_ticks); } else if (curr_thread == handle_thread && sub_id == current_core_index) { result = hardware_tick_count - last_context_switch_ticks; }
* kernel/process: Make the handle table per-processLioncash2018-10-201-0/+14
| | | | | | | | 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.
* svc: Implement svcGetProcessInfoLioncash2018-10-131-3/+18
| | | | | | | A fairly basic service function, which only appears to currently support retrieving the process state. This also alters the ProcessStatus enum to contain all of the values that a kernel process seems to be able of reporting with regards to state.
* kernel/process: Make CodeSet a regular non-inherited objectLioncash2018-10-121-23/+5
| | | | | | | | 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.
* kernel/process: Add a data member to determine if a process is 64-bit or not.Lioncash2018-09-301-0/+10
| | | | | | | | | | | This will be necessary for the implementation of svcGetThreadContext(), as the kernel checks whether or not the process that owns the thread that has it context being retrieved is a 64-bit or 32-bit process. If the process is 32-bit, then the upper 15 general-purpose registers and upper 16 vector registers are cleared to zero (as AArch32 only has 15 GPRs and 16 128-bit vector registers. not 31 general-purpose registers and 32 128-bit vector registers like AArch64).
* kernel/process: Make data member variables privateLioncash2018-09-301-26/+71
| | | | | | | Makes the public interface consistent in terms of how accesses are done on a process object. It also makes it slightly nicer to reason about the logic of the process class, as we don't want to expose everything to external code.
* process/vm_manager: Amend API to allow reading parameters from NPDM metadataLioncash2018-09-241-0/+12
| | | | | | | | | Rather than hard-code the address range to be 36-bit, we can derive the parameters from supplied NPDM metadata if the supplied exectuable supports it. This is the bare minimum necessary for this to be possible. The following commits will rework the memory code further to adjust to this.
* svc: Move most process termination code to its own function within ProcessLioncash2018-09-211-5/+22
| | | | | Reduces the use of Process class members externally and keeps most code related to tearing down a process with the rest of the process code.
* thread/process: Move TLS slot marking/freeing to the process classLioncash2018-09-211-11/+17
| | | | | | Allows making several members of the process class private, it also avoids going through Core::CurrentProcess() just to retrieve the owning process.
* Port #4182 from Citra: "Prefix all size_t with std::"fearlessTobi2018-09-151-2/+2
|
* kernel: Eliminate kernel global stateLioncash2018-08-291-13/+8
| | | | | | | | | | | | | | | | | | | | | | 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/process: Use std::array where applicableLioncash2018-08-031-1/+2
|
* kernel/process: Use accessors instead of class members for referencing segment arrayLioncash2018-08-031-12/+32
| | | | | | | Using member variables for referencing the segments array increases the size of the class in memory for little benefit. The same behavior can be achieved through the use of accessors that just return the relevant segment.
* core/memory: Get rid of 3DS leftoversLioncash2018-08-031-13/+4
| | | | Removes leftover code from citra that isn't needed.
* kernel: Move object class to its own source filesLioncash2018-08-021-1/+1
| | | | | | 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.
* core: Move process creation out of global state.bunnei2018-03-141-2/+1
|
* Kernel: Store the program id in the Process class instead of the CodeSet class.Subv2018-03-021-4/+5
| | | | There may be many CodeSets per Process, so it's wasteful and overcomplicated to store the program id in each of them.
* Added more svcGetInfo pairsDavid Marcec2018-01-161-0/+2
|
* Threads: Added enum values for the Switch's 4 cpu cores and implemented svcGetInfo(AllowedCpuIdBitmask)Subv2018-01-101-0/+4
|
* svc: Implement svcExitProcess.bunnei2018-01-011-2/+11
|
* svc: Implement svcUnmapMemory.bunnei2017-12-311-0/+3
|
* kernel: Various 64-bit fixes in memory/process/threadbunnei2017-12-291-3/+3
|
* process: Add method to mirror a memory region.bunnei2017-12-291-0/+2
|
* nso: Refactor and allocate .bss section.bunnei2017-09-301-4/+5
|
* process: Support loading multiple codesets.bunnei2017-09-301-1/+7
|
* Kernel: Map special regions according to ExHeaderYuri Kunde Schlesner2017-05-101-1/+1
| | | | | | | This replaces the hardcoded VRAM/DSP mappings with ones made based on the ExHeader ARM11 Kernel caps list. While this has no visible effect for most applications (since they use a standard set of mappings) it does improve support for system modules and n3DS exclusives.
* Remove empty newlines in #include blocks.Emmanuel Gil Peyrot2016-09-211-3/+0
| | | | | | | 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-18/+32
|
* Merge pull request #1695 from Subv/tls_allocbunnei2016-05-131-2/+5
|\ | | | | Kernel/Threads: Dynamically allocate the TLS region for threads.
| * Kernel/Threads: Dynamically allocate the TLS region for threads in the BASE region of the linear heap.Subv2016-05-071-2/+5
| | | | | | | | | | | | Each thread gets a 0x200-byte area from the 0x1000-sized page, when all 8 thread slots in a single page are used up, the kernel allocates a new page to hold another 8 entries. This is consistent with what the real kernel does.
* | Kernel/Threading: Warn when a thread can be scheduled in the Syscore (Core 1).Subv2016-05-071-0/+2
|/ | | | We do not currently implement any cores other than the AppCore (Core 0).
* Memory: Do correct Phys->Virt address translation for non-APP linheapYuri Kunde Schlesner2016-03-061-0/+1
|
* Kernel: Implement svcGetProcessInfo in a basic wayYuri Kunde Schlesner2015-08-161-0/+2
| | | | | This also adds some basic memory usage accounting. These two types are used by Super Smash Bros. during startup.
* Kernel: Add more infrastructure to support different memory layoutsYuri Kunde Schlesner2015-08-161-1/+5
| | | | | | 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.
* Process: Store kernel compatibility version during loadingYuri Kunde Schlesner2015-08-161-0/+2
|
* Kernel: Properly implement ControlMemory FREE and COMMITYuri Kunde Schlesner2015-08-161-5/+26
|
* Core: Fix applet includes using iwyu.Emmanuel Gil Peyrot2015-07-121-0/+1
|
* Core: Properly configure address space when loading a binaryYuri Kunde Schlesner2015-07-121-7/+36
| | | | | | 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.
* Core: Cleanup file_sys includes.Emmanuel Gil Peyrot2015-06-281-1/+2
|
* Core/ResourceLimits: Implemented the basic structure of ResourceLimits.Subv2015-05-151-0/+4
| | | | | | 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.
* Core/Memory: Add TLS support for creating up to 300 threadsSubv2015-05-121-0/+3
|
* fixup!Subv2015-05-121-6/+0
|
* Core/HLE: Implemented the SVCs GetProcessId and GetProcessIdOfThreadSubv2015-05-111-0/+11
|
* Process: Rename StaticAddressMapping => AddressMappingYuri Kunde Schlesner2015-05-091-2/+2
|
* Process: Add more documentation to the class membersYuri Kunde Schlesner2015-05-091-2/+16
|
* Process: Use BitField to store process flagsYuri Kunde Schlesner2015-05-091-6/+20
|
* Process: Support parsing of exheader kernel capsYuri Kunde Schlesner2015-05-091-1/+2
|
* Kernel: Introduce skeleton Process class to hold process dataYuri Kunde Schlesner2015-05-091-0/+61