aboutsummaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/kernel.cpp
Commit message (Collapse)AuthorAgeFilesLines
* kernel: define thread-local state out of line for LTOsnowstormxd33 hours1-1/+3
| | | | | | Give the implementation-local TLS object one definition so ThinLTO retains its dynamic initializer. The state and its lifetime are unchanged. Assisted by Codex.
* kernel: clear the fastmem arena when the application process is closedTakoroka5 days1-0/+14
| | | | | | | | | | | | | | | Loading a Switch 2 game after another one in the same window hung or crashed it at boot. The first game's process still had 55-60 references at kernel shutdown, so it was never finalized and its memory stayed mapped in the fastmem arena. The next game's mappings at the same addresses then failed ("Failed to split placeholder" / "Failed to map placeholder"), and it ran on the first game's memory: Mario Kart World loaded after another Switch 2 game jumped to a garbage address from rtld, or hung. Detach the closed process from the arena (a late finalize must not unmap the next game's memory), unmap the whole arena, and log when the process was still referenced.
* core: emulate six CPU coresTakoroka7 days1-1/+1
| | | | | | | Switch 2 applications are given cores 0..5 (title 4's npdm) and start a job worker per core. With four emulated cores, 4 and 5 were folded onto 0 and 1, so two cores ran two workers each. Switch 1 titles keep using cores 0..3; core 3 stays the shared system core.
* [common] Switch to boost::unordered_flat containers (#4326)crueter2026-08-311-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Replaces all instances of ankerl's unordered map/set with boost's `unordered_flat_*` classes. This uses std::hash since boost::hash is actually a lot slower. Also adds an abstraction layer in `Common` so future changes are quicker and easier. Other implementation details: - ankerl provided hash specializations for tuple and pair, so those were ported here - std::erase_if doesn't work on boost, so just used the ADL'd erase_if This should be about equal or superior performance as unordered_dense for everything except iteration. Signed-off-by: crueter <crueter@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/4326 Reviewed-by: Lizzie and Samuel <lizzie@eden-emu.dev> Reviewed-by: MaranBr <maranbr@eden-emu.dev>
* [core, hle, video_core, memory] Improve multi-process, display layers, ↵Maufeat2026-08-291-4/+21
| | | | | | | | | | | | | | | | | | | | | dynamic shader cache and rework overlay (#4238) - [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. ------------------- - Dynamic shader cache reloading capability for qlaunch - Multi-process improvements (thanks to @frank1734), instead of just using the main application we now respect caller process (also did it for HID devices while I was at it) - Layer stack masks & shared buffer screenshot for video core, added different masks (screenshot, recording, etc.) this was discovered as an issue due to how in qlaunch the transition was not right between applications. May not be perfect but also fixes screenshots while using qlaunch - Reworked overlay display management (input and visibility) - instead of random numbers as I've previously did, I decided to add an AppletZIndex enum for better readability. Also split capability of input by touch and gamepad. - etc. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4238 Reviewed-by: Samuel <lizzie@eden-emu.dev> 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-52/+43
| | | | | | | | | | 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>
* [core/hle/kernel] Remove redundant TLS load/stores, reuse computed ↵lizzie2026-05-091-10/+9
| | | | | | | | | | | | | | segment+address instead (#3932) While originally for MSVC, this also should help clang/gcc not die trying to make codegen for the load/store of fields for the tls_data should help to reuse computed values instead of recomputing shit for no reason Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3932 Reviewed-by: MaranBr <maranbr@eden-emu.dev> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
* [common/logging] Simplify logging logic and fix issues when logging before ↵lizzie2026-03-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* [*] change all std::unordered_map and std::unordered_set into ↵lizzie2026-02-101-4/+4
| | | | | | | | | | | | | | | | | | | ankerl::unordered_dense::map/set variants (#3442) mainly doing this to reduce memory footprint; we all know how nice ankerl::unordered_dense is in theory 4x faster - in practice these maps arent that "hot" anyways so not likely to have much perf gained i just want to reduce mem fragmentation to ease my porting process, plus it helps other platforms as well (ahem weak Mediatek devices) :) Signed-off-by: lizzie <lizzie@eden-emu.dev> Co-authored-by: Caio Oliveira <caiooliveirafarias0@gmail.com> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3442 Reviewed-by: DraVee <dravee@eden-emu.dev> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [common, core] remove uneeded memory indirection overhead at startup (#3306)lizzie2026-01-161-62/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | for core stuff: just remove unique ptrs that dont need any pointer stability at all (afterall its an allocation within an allocation so yeah) for fibers: Main reasoning behind this is because virtualBuffer<> is stupidly fucking expensive and it also clutters my fstat view ALSO mmap is a syscall, syscalls are bad for performance or whatever ALSO std::vector<> is better suited for handling this kind of "fixed size thing where its like big but not THAT big" (512 KiB isn't going to kill your memory usage for each fiber...) for core.cpp stuff - inlines stuff into std::optional<> as opposed to std::unique_ptr<> (because yknow, we are making the Impl from an unique_ptr, allocating within an allocation is unnecessary) - reorganizes the structures a bit so padding doesnt screw us up (it's not perfect but eh saves a measly 44 bytes) - removes unused/dead code - uses std::vector<> instead of std::deque<> no perf impact expected, maybe some initialisation boost but very minimal impact nonethless lto gets rid of most calls anyways - the heavy issue is with shared_ptr and the cache coherency from the atomics... but i clumped them together because well, they kinda do not suffer from cache coherency - hopefully not a mistake this balloons the size of Impl to about 1.67 MB - which is fine because we throw it in the stack anyways REST OF INTERFACES: most of them ballooned in size as well, but overhead is ok since its an allocation within an alloc, no stack is used (when it comes to storing these i mean) Signed-off-by: lizzie lizzie@eden-emu.dev Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3306 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: MaranBr <maranbr@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [core/hle/kernel] coalesce TLS from KernelCore to reduce query times (#3283)lizzie2026-01-101-83/+78
| | | | | | | | | | | | | | - each time you reference TLS data the compiler generates calls to register _atexit() for them - it also uses `mov %fs:%rax` or whatever, segmented moves are EXPENSIVE since they break pipeline - occupies less TLS slots for windows :) Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3283 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>
* [qt_common, core, audio] remove duplicate string literal definitions, inline ↵lizzie2025-11-171-12/+11
| | | | | | | | | | | | | | SystemManager::threadfunc, increase latency of audio shutdown (#3030) Very small code cleanup, also remove `[[unlikely]]` because it doesn't matter + increase latency of audio render when shutting down Signed-off-by: lizzie lizzie@eden-emu.dev Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3030 Reviewed-by: Caio Oliveira <caiooliveirafarias0@gmail.com> Reviewed-by: crueter <crueter@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [common, hle/kernel] Remove LTO_NOINLINE (#2908)lizzie2025-10-311-9/+8
| | | | | | | | | | | | | - Dont just tell the compiler what to inline/what not to inline; the compiler will be pissed off and make bad codegen Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2908 Reviewed-by: Caio Oliveira <caiooliveirafarias0@gmail.com> Reviewed-by: Maufeat <sahyno1996@gmail.com> Reviewed-by: MaranBr <maranbr@eden-emu.dev> Reviewed-by: crueter <crueter@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [cmake] enable clang-cl and WoA builds (#348)lizzie2025-09-091-1/+1
| | | | | | | | | | | | | | Compilation and CMake fixes for both Windows on ARM and clang-cl, meaning Windows can now be built on both MSVC and clang on both amd64 and aarch64. Compiling on clang is *dramatically* faster so this should be useful for CI. Co-authored-by: crueter <crueter@eden-emu.dev> Co-authored-by: crueter <crueter@crueter.xyz> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/348 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: crueter <crueter@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [meta] remove MicroProfile (#185)crueter2025-08-061-13/+3
| | | | | | Signed-off-by: crueter <crueter@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/185 Reviewed-by: Lizzie <lizzie@eden-emu.dev>
* Add cmake option to enable microprofile (#179)Gamer642025-08-021-0/+2
| | | | | | | | | | | | Backported from https://github.com/azahar-emu/azahar/commit/dd9c743041308112c8dc349c5c237c04b2c4c75f. Co-authored-by: PabloMK7 <hackyglitch2@gmail.com> Co-authored-by: Shinmegumi <shinmegumi@eden-emu.dev> Co-authored-by: Gamer64 <76565986+Gamer64ytb@users.noreply.github.com> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/179 Co-authored-by: Gamer64 <gamer64@eden-emu.dev> Co-committed-by: Gamer64 <gamer64@eden-emu.dev>
* scope_exit: Make constexprFearlessTobi2024-02-191-3/+9
| | | | | Allows the use of the macro in constexpr-contexts. Also avoids some potential problems when nesting braces inside it.
* kernel: add and enable system suspend typeLiam2024-02-141-24/+33
|
* am: migrate global state to per-applet state structureLiam2024-01-291-16/+14
|
* kernel: fix debugger and process list lifetimeLiam2024-01-121-3/+28
|
* Merge pull request #12454 from liamwhite/ct-stuffNarr the Reg2024-01-011-1/+1
|\ | | | | core_timing: minor refactors
| * core_timing: remove user data valueLiam2023-12-231-1/+1
| |
* | general: properly support multiple memory instancesLiam2023-12-221-21/+0
| |
* | kernel: instantiate memory separately for each guest processLiam2023-12-221-13/+0
|/
* service: hid: Allow to create multiple instances of shared memoryNarr the Reg2023-12-131-15/+0
|
* kernel: implement light IPCLiam2023-12-071-0/+4
|
* core: refactor emulated cpu core activationLiam2023-12-041-27/+1
|
* kernel: fix extraneous refLiam2023-10-211-1/+0
|
* kernel: update KProcessLiam2023-10-211-29/+25
|
* kernel: make check fully constexpr for broken msvc constant foldingLiam2023-10-201-1/+1
|
* kernel: update KMemoryRegionType valuesLiam2023-10-201-2/+21
|
* kernel: mark TLS accessors as noinline for non-MSVC LTOLiam2023-10-121-8/+8
|
* kernel: remove relative task registrationLiam2023-08-141-1/+1
|
* general: Silence -Wshadow{,-uncaptured-local} warningslat9nq2023-07-181-3/+3
| | | | These occur in the latest commits in LLVM Clang.
* kernel: match calls to Register and UnregisterLiam2023-04-291-3/+28
|
* memory: rename global memory references to application memoryLiam2023-03-231-2/+2
|
* kernel: use KTypedAddress for addressesLiam2023-03-221-51/+57
|
* kernel: fix clang buildLiam2023-03-121-2/+2
|
* kernel: convert KThread to new styleLiam2023-03-121-3/+0
|
* kernel: remove KLinkedListLiam2023-03-121-4/+0
|
* kernel: convert KPort, KSessionLiam2023-03-121-6/+5
|
* kernel: refactor priority inheritance to represent locks as C++ objectsLiam2023-03-011-0/+93
|
* service: refactor server architectureLiam2023-02-211-104/+103
| | | | Converts services to have their own processes
* Merge pull request #9771 from ameerj/host-thread-idliamwhite2023-02-191-27/+18
|\ | | | | kernel: Refactor thread_local variable usage
| * kernel: Refactor thread_local variable usageameerj2023-02-101-27/+18
| | | | | | | | | | | | On MSVC at least, there seems to be a non-trivial overhead to calling GetHostThreadId(). This slightly reworks the host_thread_id variable to reduce some of the complexity around its usage, along with some small refactors around current_thread and dummy thread
* | kernel: add KObjectNameLiam2023-02-171-0/+14
| |
* | general: rename CurrentProcess to ApplicationProcessLiam2023-02-131-23/+23
| |
* | core: kernel: k_process: Use application system resource.bunnei2023-02-101-0/+8
|/
* kernel: fix incorrect locking order in suspensionLiam2023-01-231-16/+23
|
* kernel: workaround static shared memory initializationLiam2022-12-231-29/+14
|