aboutsummaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/k_scheduler.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [k_scheduler] fix for libc++ that lazily initializes mutexes (#4447)lizzie2026-09-171-0/+8
| | | | | | | | | | | | | | | | `__m_` is nullptr when `unlock();` is called, so `try_lock();` will force materialization of the backing mutex. Signed-off-by: lizzie <lizzie@eden-emu.dev> - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4447 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: MaranBr <maranbr@eden-emu.dev>
* [video_core, hle] remove redundant parent references in system structs (#3908)lizzie2026-06-231-80/+72
| | | | | | | | | | reworked a bit to remove references of parent objects and instead pass as arguments to methods to prevent useless reloads Signed-off-by: lizzie <lizzie@eden-emu.dev> Co-authored-by: maufeat <sahyno1996@gmail.com> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3908 Reviewed-by: Maufeat <sahyno1996@gmail.com> Reviewed-by: crueter <crueter@eden-emu.dev>
* [common/logging] Simplify logging logic and fix issues when logging before ↵lizzie2026-03-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | system is created (#3688) - our logging code was bigger than spdlog itself, why???? just keep it simple - fix issues when logging before logging system is even started - removes the "initialized logging twice" issue - removes uneeded indirection in file logging - uses direct formatting instead of jumping hoopla-around the fmt::format() ressult - code duplication and dead code removal as usual I did explore dup2() but I think it's not worth the hassle I did try `fwopen()` but it's better if things are just kept as-is. there is a lot of noise because I removed a bunch of redundant files on logging and just put everything in one file now normally this wouldn't be a good idea, however consider: the complexity of logging; it's less than 500 lines... does it really need a whole subsystem?!?!?! ITS JUST LOGGING Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3688 Reviewed-by: crueter <crueter@eden-emu.dev> Reviewed-by: DraVee <chimera@dravee.dev> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [core/hle] use boost::container::small_vector<> instead of std::set<> of ↵lizzie2025-12-311-24/+16
| | | | | | | | | | | | | | | dummy threads (#3025) 2048 bytes of static storage (128 threads) is more than enough for most applications Highly hit or miss (most likely miss) - check with TOTK beforehand, should bring perf stuff to Android; in theory Signed-off-by: lizzie lizzie@eden-emu.dev Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3025 Reviewed-by: DraVee <dravee@eden-emu.dev> Reviewed-by: Maufeat <sahyno1996@gmail.com> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [hle, kernel] Add support for FW21 and kernel changes (#3004)lizzie2025-11-161-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | - Adapts kernel changes from atmosphere for firmware 21.0.0. - Fixes launch error of firmware 21.0.0 applets. - Adds new commands for `prepo` (New `SaveSystemReport` & `SaveSystemReportWithUser`). - Adds new commands for `IReadOnlyApplicationControlDataInterface` (cmd 19; incomplete!) - Adds `{12010, nullptr, "SetButtonConfigLeft"},` undocumented IHidServer. - Adds new commands for `ngc:u` (`Mask2` and `Check2`) - Adds new commands for system settings server (GetHttpAuthConfig) for webapplet - Removes incompatible firmware popup warning. Signed-off-by: lizzie lizzie@eden-emu.dev Co-authored by: maufeat sahyno1996@gmail.com Co-authored-by: crueter <crueter@eden-emu.dev> Co-authored-by: JPikachu <jpikachu.eden@gmail.com> Co-authored-by: Maufeat <sahyno1996@gmail.com> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3004 Reviewed-by: Maufeat <sahyno1996@gmail.com> Reviewed-by: crueter <crueter@eden-emu.dev> Reviewed-by: MaranBr <maranbr@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* core: refactor emulated cpu core activationLiam2023-12-041-14/+2
|
* kernel: update KProcessLiam2023-10-211-2/+2
|
* Fixes and workarounds to make UBSan happier on macOScomex2023-07-151-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* core_timing: Use CNTPCT as the guest CPU tickMorph2023-06-071-2/+3
| | | | | 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.
* kernel: use KTypedAddress for addressesLiam2023-03-221-1/+1
|
* kernel: convert KThread to new styleLiam2023-03-121-8/+8
|
* kernel: prefer std::addressofLiam2023-03-121-1/+1
|
* kernel: remove kernel_Liam2023-03-121-31/+31
|
* kernel: use GetCurrentProcessLiam2023-02-131-7/+7
|
* Ensure correctness of atomic store orderingLiam2022-11-091-3/+6
|
* kernel: refactor dummy thread wakeupsLiam2022-10-241-2/+24
|
* kernel: Ensure all uses of disable_count are balancedLiam2022-07-141-8/+13
|
* kernel: be more careful about initialization path for HLE threadsLiam2022-07-141-0/+1
|
* kernel: fix single-core preemption pointsLiam2022-07-141-0/+13
|
* kernel: fix issues with single core modeLiam2022-07-141-91/+82
|
* kernel: use KScheduler from mesosphereLiam2022-07-141-347/+376
|
* common/fiber: make fibers easier to useLiam2022-07-021-6/+1
|
* kernel: make current thread pointer thread localLiam2022-06-231-9/+16
|
* Merge pull request #8432 from liamwhite/watchpointbunnei2022-06-211-0/+1
|\ | | | | core/debugger: memory breakpoint support
| * core/debugger: memory breakpoint supportLiam2022-06-161-0/+1
| |
* | kernel: fix some uses of disable_countLiam2022-06-151-0/+1
|/
* general: Convert source file copyright comments over to SPDXMorph2022-04-231-6/+2
| | | | | 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.
* hle: kernel: Use std::mutex instead of spin locks for most kernel locking.bunnei2022-04-111-4/+4
|
* core: Reduce unused includesameerj2022-03-191-1/+0
|
* hle: kernel: KScheduler: Fix deadlock with core waiting for a thread lock ↵bunnei2022-01-271-22/+23
| | | | | | | | | | 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.
* hle: kernel: KThread: Ensure host (dummy) threads block on locking.bunnei2022-01-211-0/+3
| | | | | - But do not enter the priority queue, as otherwise they will be scheduled. - Allows dummy threads to use guest synchronization primitives.
* hle: kernel: KThread: Decrease DummyThread priority to ensure it is never ↵bunnei2022-01-201-0/+1
| | | | scheduled.
* hle: kernel: KScheduler: Ensure dummy threads are never scheduled.bunnei2022-01-201-0/+5
| | | | - These are only used by host threads for locking.
* hle: remove no-op codeValeri2022-01-171-2/+0
| | | Found by static analysis with PVS-Studio. Nobody seems to really know what was it doing there.
* core: hle: kernel: Implement thread pinning.bunnei2021-12-301-0/+8
| | | | | - 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.
* hle: kernel k_scheduler: EnableScheduling: Remove redundant ↵bunnei2021-12-061-3/+5
| | | | GetCurrentThreadPointer calls.
* hle: kernel: fix scheduling ops from HLE host thread.FernandoS272021-12-061-3/+3
|
* hle: kernel: Add a flag for indicating that the kernel is currently shutting ↵bunnei2021-12-061-0/+10
| | | | down.
* core: hle: kernel: k_scheduler: Improve DisableScheduling and EnableScheduling.bunnei2021-12-061-14/+9
|
* core: hle: kernel: k_scheduler: Remove unnecessary MakeCurrentProcess.bunnei2021-12-061-5/+0
|
* core: hle: kernel: k_scheduler: Improve ScheduleImpl.bunnei2021-12-061-6/+7
|
* core: hle: kernel: k_scheduler: Improve Unload.bunnei2021-12-061-17/+29
|
* core: hle: kernel: Ensure idle threads are closed before destroying scheduler.bunnei2021-12-061-1/+5
|
* Revert "kernel: Various improvements to scheduler"bunnei2021-08-251-46/+39
|
* core: hle: kernel: k_scheduler: Improve DisableScheduling and EnableScheduling.bunnei2021-08-071-14/+9
|
* core: hle: kernel: k_scheduler: Remove unnecessary MakeCurrentProcess.bunnei2021-08-071-5/+0
|
* core: hle: kernel: k_scheduler: Improve ScheduleImpl.bunnei2021-08-071-6/+7
|
* core: hle: kernel: k_scheduler: Improve Unload.bunnei2021-08-071-17/+29
|
* core: hle: kernel: Ensure idle threads are closed before destroying scheduler.bunnei2021-08-071-1/+5
|
* core/arm_interface: Call SVC after end of dynarmic block.Markus Wick2021-05-271-1/+0
| | | | | | So we can modify all of dynarmic states within SVC without ExceptionalExit. Especially as the ExceptionalExit hack is dropped on upstream dynarmic.