aboutsummaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/k_scheduler.cpp
AgeCommit message (Collapse)Author
2023-12-04core: refactor emulated cpu core activationLiam
2023-10-21kernel: update KProcessLiam
2023-07-15Fixes and workarounds to make UBSan happier on macOScomex
There are still some other issues not addressed here, but it's a start. Workarounds for false-positive reports: - `RasterizerAccelerated`: Put a gigantic array behind a `unique_ptr`, because UBSan has a [hardcoded limit](https://stackoverflow.com/questions/64531383/c-runtime-error-using-fsanitize-undefined-object-has-a-possibly-invalid-vp) of how big it thinks objects can be, specifically when dealing with offset-to-top values used with multiple inheritance. Hopefully this doesn't have a performance impact. - `QueryCacheBase::QueryCacheBase`: Avoid an operation that UBSan thinks is UB even though it at least arguably isn't. See the link in the comment for more information. Fixes for correct reports: - `PageTable`, `Memory`: Use `uintptr_t` values instead of pointers to avoid UB from pointer overflow (when pointer arithmetic wraps around the address space). - `KScheduler::Reload`: `thread->GetOwnerProcess()` can be `nullptr`; avoid calling methods on it in this case. (The existing code returns a garbage reference to a field, which is then passed into `LoadWatchpointArray`, and apparently it's never used, so it's harmless in practice but still triggers UBSan.) - `KAutoObject::Close`: This function calls `this->Destroy()`, which overwrites the beginning of the object with junk (specifically a free list pointer). Then it calls `this->UnregisterWithKernel()`. UBSan complains about a type mismatch because the vtable has been overwritten, and I believe this is indeed UB. `UnregisterWithKernel` also loads `m_kernel` from the 'freed' object, which seems to be technically safe (the overwriting doesn't extend as far as that field), but seems dubious. Switch to a `static` method and load `m_kernel` in advance.
2023-06-07core_timing: Use CNTPCT as the guest CPU tickMorph
Previously, we were mixing the raw CPU frequency and CNTFRQ. The raw CPU frequency (1020 MHz) should've never been used as CNTPCT (whose frequency is CNTFRQ) is the only counter available.
2023-03-22kernel: use KTypedAddress for addressesLiam
2023-03-12kernel: convert KThread to new styleLiam
2023-03-12kernel: prefer std::addressofLiam
2023-03-12kernel: remove kernel_Liam
2023-02-13kernel: use GetCurrentProcessLiam
2022-11-09Ensure correctness of atomic store orderingLiam
2022-10-24kernel: refactor dummy thread wakeupsLiam
2022-07-14kernel: Ensure all uses of disable_count are balancedLiam
2022-07-14kernel: be more careful about initialization path for HLE threadsLiam
2022-07-14kernel: fix single-core preemption pointsLiam
2022-07-14kernel: fix issues with single core modeLiam
2022-07-14kernel: use KScheduler from mesosphereLiam
2022-07-02common/fiber: make fibers easier to useLiam
2022-06-23kernel: make current thread pointer thread localLiam
2022-06-21Merge pull request #8432 from liamwhite/watchpointbunnei
core/debugger: memory breakpoint support
2022-06-16core/debugger: memory breakpoint supportLiam
2022-06-15kernel: fix some uses of disable_countLiam
2022-04-23general: Convert source file copyright comments over to SPDXMorph
This formats all copyright comments according to SPDX formatting guidelines. Additionally, this resolves the remaining GPLv2 only licensed files by relicensing them to GPLv2.0-or-later.
2022-04-11hle: kernel: Use std::mutex instead of spin locks for most kernel locking.bunnei
2022-03-19core: Reduce unused includesameerj
2022-01-27hle: kernel: KScheduler: Fix deadlock with core waiting for a thread lock ↵bunnei
that has migrated. - Previously, it was possible for a thread migration to occur from core A to core B. - Next, core B waits on a guest lock that must be released by a thread queued for core A. - Meanwhile, core A is still waiting on the core B's current thread lock - resulting in a deadlock. - Fix this by try-locking the thread lock. - Fixes softlocks in FF8 and Pokemon Legends Arceus.
2022-01-21hle: kernel: KThread: Ensure host (dummy) threads block on locking.bunnei
- But do not enter the priority queue, as otherwise they will be scheduled. - Allows dummy threads to use guest synchronization primitives.
2022-01-20hle: kernel: KThread: Decrease DummyThread priority to ensure it is never ↵bunnei
scheduled.
2022-01-20hle: kernel: KScheduler: Ensure dummy threads are never scheduled.bunnei
- These are only used by host threads for locking.
2022-01-17hle: remove no-op codeValeri
Found by static analysis with PVS-Studio. Nobody seems to really know what was it doing there.
2021-12-30core: hle: kernel: Implement thread pinning.bunnei
- We largely had the mechanics in place for thread pinning, this change hooks these up. - Validated with tests https://github.com/Atmosphere-NX/Atmosphere/blob/master/tests/TestSvc/source/test_thread_pinning.cpp.
2021-12-06hle: kernel k_scheduler: EnableScheduling: Remove redundant ↵bunnei
GetCurrentThreadPointer calls.
2021-12-06hle: kernel: fix scheduling ops from HLE host thread.FernandoS27
2021-12-06hle: kernel: Add a flag for indicating that the kernel is currently shutting ↵bunnei
down.
2021-12-06core: hle: kernel: k_scheduler: Improve DisableScheduling and EnableScheduling.bunnei
2021-12-06core: hle: kernel: k_scheduler: Remove unnecessary MakeCurrentProcess.bunnei
2021-12-06core: hle: kernel: k_scheduler: Improve ScheduleImpl.bunnei
2021-12-06core: hle: kernel: k_scheduler: Improve Unload.bunnei
2021-12-06core: hle: kernel: Ensure idle threads are closed before destroying scheduler.bunnei
2021-08-25Revert "kernel: Various improvements to scheduler"bunnei
2021-08-07core: hle: kernel: k_scheduler: Improve DisableScheduling and EnableScheduling.bunnei
2021-08-07core: hle: kernel: k_scheduler: Remove unnecessary MakeCurrentProcess.bunnei
2021-08-07core: hle: kernel: k_scheduler: Improve ScheduleImpl.bunnei
2021-08-07core: hle: kernel: k_scheduler: Improve Unload.bunnei
2021-08-07core: hle: kernel: Ensure idle threads are closed before destroying scheduler.bunnei
2021-05-27core/arm_interface: Call SVC after end of dynarmic block.Markus Wick
So we can modify all of dynarmic states within SVC without ExceptionalExit. Especially as the ExceptionalExit hack is dropped on upstream dynarmic.
2021-05-16core: Make variable shadowing a compile-time errorLioncash
Now that we have most of core free of shadowing, we can enable the warning as an error to catch anything that may be remaining and also eliminate this class of logic bug entirely.
2021-05-08kernel: Eliminate variable shadowingLioncash
Now that the large kernel refactor is merged, we can eliminate the remaining variable shadowing cases.
2021-05-05hle: kernel: Rename Process to KProcess.bunnei
2021-05-05hle: kernel: Refactor several threads/events/sharedmemory to use slab heaps.bunnei
2021-05-05hle: kernel: Move slab heap management to KernelCore.bunnei