aboutsummaryrefslogtreecommitdiff
path: root/src/core/hle/kernel
AgeCommit message (Collapse)Author
2018-09-06core: Migrate current_process pointer to the kernelLioncash
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.
2018-09-02service: Migrate global named port map to the KernelCore classLioncash
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.
2018-08-31core/core: Replace includes with forward declarations where applicableLioncash
The follow-up to e2457418dae19b889b2ad85255bb95d4cd0e4bff, which replaces most of the includes in the core header with forward declarations. This makes it so that if any of the headers the core header was previously including change, then no one will need to rebuild the bulk of the core, due to core.h being quite a prevalent inclusion. This should make turnaround for changes much faster for developers.
2018-08-28kernel: Eliminate kernel global stateLioncash
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-27Merge pull request #1177 from lioncash/errbunnei
kernel/error: Amend several error codes
2018-08-27Merge pull request #1175 from lioncash/nsbunnei
core: Namespace all code in the arm subdirectory under the Core namespace
2018-08-25kernel/error: Amend error code for ERR_MAX_CONNECTIONS_REACHEDLioncash
We can make this error code an alias of the resource limit exceeded error code, allowing us to get rid of the lingering 3DS error code of the same type.
2018-08-25kernel/error: Amend error code for ERR_PORT_NAME_TOO_LONGLioncash
We can treat this as an alias of TooLarge for documentation purposes. This also lets us get rid of another lingering 3DS-related error code.
2018-08-25kernel/error: Add error code for the handle table being fullLioncash
This replaces the lingering 3DS constant with the proper one, and utilizes it within HandleTable's Create() member function.
2018-08-25kernel/error: Add error code for invalid memory permissionsLioncash
2018-08-25kernel/error: Correct kernel error code for invalid combinationLioncash
2018-08-25svc: Return process title ID if queried in GetInfo()Lioncash
We already have the variable itself set up to perform this task, so we can just return its value from the currently executing process instead of always stubbing it to zero.
2018-08-24core: Namespace all code in the arm subdirectory under the Core namespaceLioncash
Gets all of these types and interfaces out of the global namespace.
2018-08-15Merge pull request #1051 from B3n30/UnscheduleEventThreadsafebunnei
Core::CoreTiming: add UnscheduleEventThreadsafe
2018-08-15kernel/server_session: Add IsSession() member functionLioncash
Allows querying the inverse of IsDomain() to make things more readable. This will likely also be usable in the event of implementing ConvertDomainToSession().
2018-08-14kernel/svc: Log svcBreak parametersLioncash
Given if we hit here all is lost, we should probably be logging the break reason code and associated information to distinguish between the causes.
2018-08-13Core::CoreTiming: add UnscheduleEventThreadsafeB3n30
2018-08-13kernel/object: Tighten object against data racesLioncash
Despite being covered by a global mutex, we should still ensure that the class handles its reference counts properly. This avoids potential shenanigans when it comes to data races. Given this is the root object that drives quite a bit of the kernel object hierarchy, ensuring we always have the correct behavior (and no races) is a good thing.
2018-08-12Merge pull request #1043 from Subv/timingbunnei
Use an approximated amortized amount of ticks when advancing timing.
2018-08-12Merge pull request #1036 from lioncash/threadbunnei
scheduler: Make HaveReadyThreads() a const member function
2018-08-12Merge pull request #1042 from Subv/racesbunnei
Fixed a bunch of race conditions when running in multicore mode.
2018-08-12Kernel/SVC: Don't reschedule the current core when creating a new thread.Subv
The current core may have nothing to do with the core where the new thread was scheduled to run. In case it's the same core, then the following PrepareReshedule call will take care of that.
2018-08-12Kernel/Threads: Lock the HLE mutex when executing the wakeup callback.Subv
Another thread might be in the middle of a reschedule, thus altering the state of the schedulers.
2018-08-12Kernel/Thread: Always use the threadsafe option when scheduling wakeups.Subv
WakeAfterDelay might be called from any host thread, so err on the side of caution and use the thread-safe CoreTiming::ScheduleEventThreadsafe. Note that CoreTiming is still far from thread-safe, there may be more things we have to work on for it to be up to par with what we want.
2018-08-12Kernel/Mutex: Don't duplicate threads in the mutex waiter list.Subv
Exit from AddMutexWaiter early if the thread is already waiting for a mutex owned by the owner thread. This accounts for the possibility of a thread that is waiting on a condition variable being awakened twice in a row. Also added more validation asserts. This should fix one of the random crashes in Breath Of The Wild.
2018-08-12scheduler: Make HaveReadyThreads() a const member functionLioncash
This function doesn't modify instance state, so the const qualifier can be added to it.
2018-08-11server_session: Provide more useful information and don't crash on bad IPC ↵bunnei
request.
2018-08-09hle_ipc: Make WriteToOutgoingCommandBuffer()'s reference parameter constLioncash
This function doesn't modify anything within the reference Thread instance.
2018-08-06client_port: Make all data members privateLioncash
These members don't need to be entirely exposed, we can instead expose an API to operate on them without directly needing to mutate them We can also guard against overflow/API misuse this way as well, given active_sessions is an unsigned value.
2018-08-06kernel/event: Make data members privateLioncash
Instead we can simply provide accessors to the required data instead of giving external read/write access to the variables directly.
2018-08-05address_arbiter: Return by value from GetThreadsWaitingOnAddress()Lioncash
In all cases the vector being supplied is empty, so we can just return by value in these instances.
2018-08-04Merge pull request #914 from lioncash/codesetbunnei
kernel/process: Use accessors instead of class members for referencing segment array
2018-08-03kernel/thread: Fix potential crashes introduced in ↵Lioncash
26de4bb521b1ace7af76eff4f6956cb23ac0d58c This amends cases where crashes can occur that were missed due to the odd way the previous code was set up (using 3DS memory regions that don't exist).
2018-08-03kernel/process: Use std::array where applicableLioncash
2018-08-03kernel/process: Use accessors instead of class members for referencing ↵Lioncash
segment array 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 leftoversLioncash
Removes leftover code from citra that isn't needed.
2018-08-03Merge pull request #894 from lioncash/objectbunnei
kernel: Move object class to its own source files
2018-08-03Merge pull request #904 from lioncash/staticbunnei
kernel/thread: Minor changes
2018-08-02kernel/vm_manager: Convert loop into std::any_of()Lioncash
2018-08-02kernel/vm_manager: Use const where applicableLioncash
Makes our immutable state explicit.
2018-08-02kernel/vm_manager: Use the VAddr type alias in CarveVMA()Lioncash
These two variables correspond to address ranges.
2018-08-02kernel/thread: Make GetFreeThreadLocalSlot()'s loop indices size_tLioncash
Avoids using a u32 to compare against a range of size_t, which can be a source of warnings. While we're at it, compress a std::tie into a structured binding.
2018-08-02kernel/thread: Make GetFreeThreadLocalSlot() reference parameter a const ↵Lioncash
reference This function only reads the data being referenced, it doesn't modify it, so we can turn the reference into a const reference.
2018-08-02kernel/thread: Make GetFreeThreadLocalSlot() internally linkedLioncash
This function isn't used outside of this translation unit, so we can make it internally linked.
2018-08-01kernel: Move object class to its own source filesLioncash
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-31kernel/thread: Remove unimplemented function prototypeLioncash
Given there's no implementation, we may as well remove the code entirely.
2018-07-31Merge pull request #877 from lioncash/removebunnei
kernel: Remove unused object_address_table.cpp/.h
2018-07-31kernel: Remove unused object_address_table.cpp/.hLioncash
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.
2018-07-31kernel: Remove unnecessary includesLioncash
Removes unnecessary direct dependencies in some headers and also gets rid of indirect dependencies that were being relied on to be included.
2018-07-26kernel/timer: Make data members private where applicableLioncash
Instead, we can just expose functions that return the queryable state instead of letting anything modify it.