summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/process.h (unfollow)
Commit message (Collapse)AuthorFilesLines
2021-01-29core: hle: kernel: object: Implement Finalize() virtual method.bunnei1-0/+2
2021-01-29hle: kernel: KThread: Clean up thread priorities.bunnei1-1/+6
2021-01-29core: hle: kernel: Rename Thread to KThread.bunnei1-5/+5
2021-01-11core: hle: Integrate new KConditionVariable and KAddressArbiter implementations.bunnei1-28/+22
2021-01-11core: hle: kernel: Update KSynchronizationObject.bunnei1-8/+6
2020-12-06hle: kernel: Process: Various style fixes based on code review feedback.bunnei1-2/+2
2020-12-06hle: kernel: process: Add schedule count tracking, to be used for yield impl.bunnei1-0/+13
2020-07-15kernel/process: Move name and system context to the bottom of the member listLioncash1-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.
2020-04-17kernel: process: Updates for new VMM.bunnei1-18/+27
2020-02-11Kernel: Refactor synchronization to better match REFernando Sahmkow1-4/+0
2020-02-11Kernel: Change WaitObject to Synchronization object. In order to better reflect RE.Fernando Sahmkow1-2/+2
2019-11-25kernel: Replace usage of boost::intrusive_ptr with std::shared_ptr for kernel objects. (#3154)bunnei1-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.
2019-11-21Kernel: Optimize condition variable threads management.Fernando Sahmkow1-1/+2
2019-11-21Kernel: Correct behavior of Condition Variables to be more similar to real hardware.Fernando Sahmkow1-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.
2019-07-07address review commentaryMichael Scire1-4/+19
2019-07-07Implement MapPhysicalMemory/UnmapPhysicalMemoryMichael Scire1-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.
2019-07-07kernel/process: Allocate the process' TLS region during initializationLioncash1-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.
2019-07-07kernel/process: Move main thread stack allocation to its own functionLioncash1-0/+3
Keeps this particular set of behavior isolated to its own function.
2019-07-04kernel/process: Default initialize all member variablesLioncash1-2/+2
Ensures a Process instance is always created with a deterministic initial state.
2019-07-04kernel/process: Decouple TLS handling from threadsLioncash1-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.
2019-06-10kernel: Differentiate kernel and user processes when picking IDZach Hilman1-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.
2019-06-10kernel/process: Make Create()'s name parameter be taken by valueLioncash1-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.
2019-06-10kernel/svc: Implement TotalMemoryUsedWithoutMmHeap/TotalMemoryAvailableWithoutMmHeapLioncash1-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.
2019-06-05kernel/process: Remove unused boost header includeLioncash1-1/+0
Boost headers typically include a lot of other headers, so removing this can prevent a bit of unnecessary compiler churn when building.
2019-04-12core/core: Move process execution start to System's Load()Lioncash1-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.
2019-04-11kernel: Make handle type declarations constexprLioncash1-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.
2019-04-02kernel/svc: Implement svcGetThreadListLioncash1-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.
2019-04-02kernel/wait_object: Make ShouldWait() take thread members by pointer-to-constLioncash1-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.
2019-03-29kernel/process: Report total physical memory used to svcGetInfoLioncash1-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.
2019-03-29kernel/process: Store the total size of the code memory loadedLioncash1-0/+3
This will be necessary to properly report the used memory size in svcGetInfo.
2019-03-28kernel/process: Store the main thread stack size to a data memberLioncash1-0/+3
This will be necessary in order to properly report memory usage within svcGetInfo.
2019-03-28kernel/process: Make Run's stack size parameter a u64Lioncash1-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).
2019-03-24kernel/process: Remove unused AddressMapping structLioncash1-8/+0
Another leftover from citra that's now no longer necessary.
2019-03-20kernel: Move CodeSet structure to its own source filesLioncash1-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.
2019-03-15core/hle/kernel: Make Mutex a per-process class.Lioncash1-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.
2019-03-13kernel/process: Remove use of global system accessorsLioncash1-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.
2019-03-08kernel: Make the address arbiter instance per-processLioncash1-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.
2019-01-01core/kernel: Remove unnecessary inclusionsLioncash1-1/+1
Gets rid of a few unnecessary header dependencies in some source files.
2018-12-31kernel/process: Rename GetAllowedProcessorMask() and GetAllowedThreadPriorityMask()Lioncash1-3/+3
Makes them consistent with their kernel capability counterparts.
2018-12-28kernel: Rename 'default' CPU core to 'ideal' coreLioncash1-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.
2018-12-28kernel/process: Remove most allocation functions from Process' interfaceLioncash1-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.
2018-12-21kernel/process: Hook up the process capability parser to the process itselfLioncash1-45/+13
While we're at it, we can also toss out the leftover capability parsing from Citra.
2018-12-19kernel/kernel: Use correct initial PID for userland Process instancesLioncash1-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.
2018-12-19kernel/process: Make process_id a 64-bit valueLioncash1-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.
2018-12-12vm_manager: Amend MemoryState enum membersLioncash1-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.
2018-12-05kernel/process: Make Process a WaitObjectLioncash1-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.
2018-12-04kernel/svc: Implement the resource limit svcGetInfo optionLioncash1-8/+1
Allows a process to register the resource limit as part of its handle table.
2018-11-20kernel/process: Move <random> include to the cpp fileLioncash1-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.
2018-11-15process: Make MirrorMemory take state to map new memory asZach Hilman1-1/+2
Credits to Subv
2018-11-13kernel/process: Migrate heap-related memory management out of the process class and into the vm managerLioncash1-11/+0
Avoids a breach of responsibilities in the interface and keeps the direct code for memory management within the VMManager class.
2018-11-13svc: Use proper random entropy generation algorithmZach Hilman1-0/+11
2018-10-26svc: Implement svcGetInfo command 0xF0000002Lioncash1-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; }
2018-10-20kernel/process: Make the handle table per-processLioncash1-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.
2018-10-13svc: Implement svcGetProcessInfoLioncash1-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.
2018-10-12kernel/process: Make CodeSet a regular non-inherited objectLioncash1-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.
2018-09-30kernel/process: Add a data member to determine if a process is 64-bit or not.Lioncash1-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).
2018-09-30kernel/process: Make data member variables privateLioncash1-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.
2018-09-24process/vm_manager: Amend API to allow reading parameters from NPDM metadataLioncash1-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.
2018-09-21svc: Move most process termination code to its own function within ProcessLioncash1-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.
2018-09-21thread/process: Move TLS slot marking/freeing to the process classLioncash1-11/+17
Allows making several members of the process class private, it also avoids going through Core::CurrentProcess() just to retrieve the owning process.
2018-09-15Port #4182 from Citra: "Prefix all size_t with std::"fearlessTobi1-2/+2
2018-08-29kernel: Eliminate kernel global stateLioncash1-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.
2018-08-03kernel/process: Use std::array where applicableLioncash1-1/+2
2018-08-03kernel/process: Use accessors instead of class members for referencing segment arrayLioncash1-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.
2018-08-03core/memory: Get rid of 3DS leftoversLioncash1-13/+4
Removes leftover code from citra that isn't needed.
2018-08-02kernel: Move object class to its own source filesLioncash1-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.
2018-03-14core: Move process creation out of global state.bunnei1-2/+1
2018-03-02Kernel: Store the program id in the Process class instead of the CodeSet class.Subv1-4/+5
There may be many CodeSets per Process, so it's wasteful and overcomplicated to store the program id in each of them.
2018-01-16Added more svcGetInfo pairsDavid Marcec1-0/+2
2018-01-10Threads: Added enum values for the Switch's 4 cpu cores and implemented svcGetInfo(AllowedCpuIdBitmask)Subv1-0/+4
2018-01-01svc: Implement svcExitProcess.bunnei1-2/+11
2017-12-31svc: Implement svcUnmapMemory.bunnei1-0/+3
2017-12-29kernel: Various 64-bit fixes in memory/process/threadbunnei1-3/+3
2017-12-29process: Add method to mirror a memory region.bunnei1-0/+2
2017-09-30nso: Refactor and allocate .bss section.bunnei1-4/+5
2017-09-30process: Support loading multiple codesets.bunnei1-1/+7
2017-05-10Kernel: Map special regions according to ExHeaderYuri Kunde Schlesner1-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.
2016-09-21Remove empty newlines in #include blocks.Emmanuel Gil Peyrot1-3/+0
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-18/+32
2016-05-07Kernel/Threading: Warn when a thread can be scheduled in the Syscore (Core 1).Subv1-0/+2
We do not currently implement any cores other than the AppCore (Core 0).
2016-05-07Kernel/Threads: Dynamically allocate the TLS region for threads in the BASE region of the linear heap.Subv1-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.
2016-03-06Memory: Do correct Phys->Virt address translation for non-APP linheapYuri Kunde Schlesner1-0/+1
2015-08-16Kernel: Implement svcGetProcessInfo in a basic wayYuri Kunde Schlesner1-0/+2
This also adds some basic memory usage accounting. These two types are used by Super Smash Bros. during startup.
2015-08-16Kernel: Add more infrastructure to support different memory layoutsYuri Kunde Schlesner1-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.
2015-08-16Process: Store kernel compatibility version during loadingYuri Kunde Schlesner1-0/+2
2015-08-16Kernel: Properly implement ControlMemory FREE and COMMITYuri Kunde Schlesner1-5/+26
2015-07-12Core: Fix applet includes using iwyu.Emmanuel Gil Peyrot1-0/+1
2015-07-12Core: Properly configure address space when loading a binaryYuri Kunde Schlesner1-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.
2015-06-28Core: Cleanup file_sys includes.Emmanuel Gil Peyrot1-1/+2
2015-05-15Core/ResourceLimits: Implemented the basic structure of ResourceLimits.Subv1-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.
2015-05-12Core/Memory: Add TLS support for creating up to 300 threadsSubv1-0/+3
2015-05-12fixup!Subv1-6/+0
2015-05-11Core/HLE: Implemented the SVCs GetProcessId and GetProcessIdOfThreadSubv1-0/+11
2015-05-09Process: Rename StaticAddressMapping => AddressMappingYuri Kunde Schlesner1-2/+2
2015-05-09Process: Add more documentation to the class membersYuri Kunde Schlesner1-2/+16
2015-05-09Process: Use BitField to store process flagsYuri Kunde Schlesner1-6/+20
2015-05-09Process: Support parsing of exheader kernel capsYuri Kunde Schlesner1-1/+2
2015-05-09Kernel: Introduce skeleton Process class to hold process dataYuri Kunde Schlesner1-0/+61