aboutsummaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/k_process.h
Commit message (Collapse)AuthorAgeFilesLines
* core: use the 12 GiB layout and auto-stub IPC for Switch 2 titlesTakoroka6 days1-0/+5
| | | | | | | | | Switch 2 titles size their heap from the total memory and stop at the first unimplemented command, so they only booted with the 12 GiB layout and EDEN_NX2_AUTO_STUB set by hand. Detect them from main.npdm before the kernel starts and apply the layout as a per-game value (the configured layout comes back once the game is closed), and auto-stub unknown commands from Switch 2 processes.
* Revert "Import experimental NS2 support and accumulated GPU fixes"Takoroka6 days1-5/+0
| | | | | This reverts commit 535b676970. The Switch 2 support comes from the nx2 work instead, merged next.
* Import experimental NS2 support and accumulated GPU fixesyumekiru6 days1-0/+5
| | | | | | | | | | | Bring the NS2 patch and local follow-up fixes onto Eglantine master. Includes native graphics services, instruction translation, syncpoint cancellation acknowledgement, texture handling and diagnostics. Experimental checkpoint; not ready to merge. The original Eden build passed, but this rebased branch has not been built or tested. Assisted-by: OpenAI Codex (implementation, debugging, tests and PR preparation)
* [common] Switch to boost::unordered_flat containers (#4326)crueter2026-08-311-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* [video_core, hle] remove redundant parent references in system structs (#3908)lizzie2026-06-231-65/+58
| | | | | | | | | | 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>
* [hle] support passing arguments to homebrew applications (#4013)xbzk2026-06-151-0/+13
| | | | | | | | | | | | | | | | | | | Homebrew (.NRO) program args support Adds a 'program_args' setting and delivers it to NRO homebrews via libnx's homebrew ABI. NROs previously had no way to receive CLI flags (e.g. NZ:P's -noglsl). Setting: program_args, Category::System, startup-only. Surfaced in Qt + Android Debug sections. NRO loader: builds a 4-entry 'ConfigEntry' table + argv at the data segment tail; prepends 'homebrew ' so user args land at argv[1]; scans for 'svc #7' to use as LR. Drops the stale NSO-style argdata append. KProcess: stores loader-provided guest addresses; 'Run' switches to the homebrew entry (x0=config_ptr, x1=-1, lr=svc7) and patches the real MainThreadHandle into the ConfigEntry slot. Legacy NSO path unchanged. Tested on NZP — args reach 'argv' correctly. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4013 Reviewed-by: Lizzie <lizzie@eden-emu.dev> Reviewed-by: MaranBr <maranbr@eden-emu.dev>
* [hle] Fixes for nxident, nxmp and nxplay, remove hbl.nsp workarounds (#3996)lizzie2026-06-121-7/+1
| | | | | | | | | | | | | | | adds `gpio` and `i2c` services implements `IApplicationFunctions::SetMediaPlaybackStateForApplicatio` stubs `IBtmSystemCore::GetDiscoveredAudioDevice` implements `nvhost_ctrl_gpu::PmuGetGpuLoad` IOCTL (0x20) implements `PSM::GetBatteryAgePercentage`, `PSM::GetBatteryVoltageState` and `PSM::GetBatteryChargeInfoFields` implements `ISystemSettingsServer::GetConsoleInformationUploadFlag`, `ISystemSettingsServer::SetConsoleInformationUploadFlag`, `ISystemSettingsServer::GetAutomaticApplicationDownloadFlag`, `ISystemSettingsServer::SetAutomaticApplicationDownloadFlag`, `&ISystemSettingsServer::GetUsb30EnableFlag`, `ISystemSettingsServer::SetUsb30EnableFlag` removes `hbl.nsp` specific workarounds Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3996 Reviewed-by: MaranBr <maranbr@eden-emu.dev> Reviewed-by: crueter <crueter@eden-emu.dev>
* [*] change all std::unordered_map and std::unordered_set into ↵lizzie2026-02-101-3/+3
| | | | | | | | | | | | | | | | | | | 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-39/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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/loader] Implement a bit improper ASLR (#2945)lizzie2025-11-041-1/+1
| | | | | | | | | | | | | | A bit improper of an ASLR - it does something but something good? Who knows... All I know is that there is a non-uniform distrobution for rand() and that rng_seed is likely a better solution? I don't know Signed-off-by: lizzie lizzie@eden-emu.dev Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2945 Reviewed-by: Maufeat <sahyno1996@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>
* [meta] fix license headers (#2547)lizzie2025-09-211-0/+3
| | | | | | | Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2547 Reviewed-by: MaranBr <maranbr@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>
* Merge https://git.eden-emu.dev/eden-emu/edenMrPurple6662025-04-301-0/+9
|\
| * service: sm/kernel/loader: Implement QueryPointerBufferSize, automatic ↵JPikachu2025-04-301-0/+9
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | pointer buffer sizing, and SM service improvements This commit introduces multiple improvements to IPC handling and system management services, enhancing game compatibility and emulator stability. --- 1. Fully Implemented QueryPointerBufferSize Service: - Exposes the per-process IPC pointer buffer size through `QueryPointerBufferSize` instead of returning stubbed values. - Added `m_pointer_buffer_size` field to `KProcess`, initialized with a safe default (0x8000). - Introduced getter and setter methods (`GetPointerBufferSize()` / `SetPointerBufferSize()`). - Registered new handler in `sm_controller` for handling QueryPointerBufferSize requests. - Ensures accurate buffer size reporting for games relying on this service. --- 2. Automatic Pointer Buffer Sizing Per-Game: - Automatically determines heap size by parsing `main.npdm` from the game’s ExeFS: - Heap size > 1 GiB → pointer buffer size set to `0x10000`. - Heap size > 512 MiB → pointer buffer size set to `0xC000`. - Otherwise, defaults to `0x8000`. - Gracefully handles missing or malformed `main.npdm` by falling back to default settings. - Automatically configures pointer buffer size during `AppLoader_NCA::Load`. - Added logging for heap size detection and buffer size configuration for easier debugging. --- 3. SM Service Improvements: - Added full implementation of `QueryPointerBufferSize` within the SM service framework. - Cleaned up stubbed methods and ensured correct domain handling. - Registered new service commands (e.g., `SetPointerBufferSize` and `QueryPointerBufferSize`) in `sm_controller`. - Improved session handling with proper conversion to domain objects where necessary. --- Benefits: - Greatly improves compatibility with games that require larger IPC pointer buffers - Eliminates the need for manual per-game pointer buffer overrides. - More accurate emulation of Switch system services, improving stability for both commercial titles and homebrew. - Provides cleaner logging for easier debugging and maintenance. - Future-proofs IPC handling for upcoming titles with higher memory demands. --- Additional Notes: - Default pointer buffer size remains 0x8000 for smaller titles or if heap size cannot be determined. - Falls back to safe defaults without affecting overall emulator performance. - All new service calls properly registered and integrated without breaking existing functionality.
* Core: Make sure GPU Dirty Managers ae shared by all processes.Fernando Sahmkow2024-01-181-4/+0
|
* kernel: remove unecessary process member from handle tableLiam2023-12-241-1/+1
|
* general: properly support multiple memory instancesLiam2023-12-221-1/+1
|
* kernel: instantiate memory separately for each guest processLiam2023-12-221-1/+14
|
* core: refactor emulated cpu core activationLiam2023-12-041-0/+9
|
* core: Define HAS_NCE macroGPUCode2023-11-251-1/+5
|
* Address some review commentsGPUCode2023-11-251-4/+0
|
* arm: Implement native code execution backendLiam2023-11-251-0/+9
|
* kernel: Manually specify aslr region startLiam2023-11-251-2/+3
|
* kernel: add KPageTableBaseLiam2023-11-101-7/+7
| | | | Co-authored-by: Kelebek1 <eeeedddccc@hotmail.co.uk>
* kernel: update KProcessLiam2023-10-211-370/+354
|
* core: improve debug workflowLiam2023-09-141-1/+7
|
* kernel: offset code entry point for 39-bit address space type (#11326)liamwhite2023-08-251-0/+7
|
* k_process: PageTable -> GetPageTableLiam2023-07-141-10/+0
|
* memory: rename global memory references to application memoryLiam2023-03-231-5/+10
|
* kernel: use KTypedAddress for addressesLiam2023-03-221-20/+23
|
* kernel: convert KProcess to new styleLiam2023-03-121-88/+98
|
* kernel: remove kernel_Liam2023-03-121-1/+1
|
* kernel: convert KPort, KSessionLiam2023-03-121-0/+6
|
* general: fix spelling mistakesLiam2023-03-121-1/+1
|
* hle: rename legacy errors to ResultsLiam2023-03-061-2/+2
|
* kernel: process: Implement GetFreeThreadCountNarr the Reg2022-12-151-0/+3
| | | | Used by Just Dance® 2023 Edition
* core: hle: kernel: Migrate ProcessState to enum class.bunnei2022-10-191-8/+8
|
* core: hle: kernel: Use result macros for new/changed code.bunnei2022-10-181-5/+11
|
* core: hle: kernel: k_process: Improve management of page table & cleanup.bunnei2022-10-181-12/+19
|
* core: hle: kernel: k_process: Change Status -> State.bunnei2022-10-181-25/+15
|
* chore: make yuzu REUSE compliantAndrea Pappacoda2022-07-271-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [REUSE] is a specification that aims at making file copyright information consistent, so that it can be both human and machine readable. It basically requires that all files have a header containing copyright and licensing information. When this isn't possible, like when dealing with binary assets, generated files or embedded third-party dependencies, it is permitted to insert copyright information in the `.reuse/dep5` file. Oh, and it also requires that all the licenses used in the project are present in the `LICENSES` folder, that's why the diff is so huge. This can be done automatically with `reuse download --all`. The `reuse` tool also contains a handy subcommand that analyzes the project and tells whether or not the project is (still) compliant, `reuse lint`. Following REUSE has a few advantages over the current approach: - Copyright information is easy to access for users / downstream - Files like `dist/license.md` do not need to exist anymore, as `.reuse/dep5` is used instead - `reuse lint` makes it easy to ensure that copyright information of files like binary assets / images is always accurate and up to date To add copyright information of files that didn't have it I looked up who committed what and when, for each file. As yuzu contributors do not have to sign a CLA or similar I couldn't assume that copyright ownership was of the "yuzu Emulator Project", so I used the name and/or email of the commit author instead. [REUSE]: https://reuse.software Follow-up to b2eb10382941bef0914f4a0a4685b9033440aa9f
* core: Replace all instances of ResultCode with Resultgerman772022-06-261-16/+15
|
* core/debugger: memory breakpoint supportLiam2022-06-161-0/+30
|
* kernel: implement KProcess suspensionLiam2022-06-141-4/+12
|
* k_process: Fix data racelat9nq2022-04-031-1/+1
| | | | | | TSan reported a race between thread 36 and thread 34, a read at :225 and a write at :225 respectively. Make total_proces_running_time_ticks atomic to avoid this race.
* core: Reduce unused includesameerj2022-03-191-1/+0
|
* core: hle: kernel: k_process: Implement thread local storage accurately.bunnei2022-03-141-9/+9
|
* core: hle: kernel: KProcess: Pass in KResourceLimit on process creation.bunnei2022-02-211-1/+1
| | | | - This allows us to have a resource limit per process, rather than use the global system resource limit.
* hle: kernel: KThread: Improve Increment/Decrement RunningThreadCount.bunnei2022-01-221-5/+3
| | | | - Previously implementation was incorrect, and would occasionally underflow.
* core: hle: kernel: KProcess: Integrate with KWorkerTask and add ↵bunnei2022-01-141-2/+4
| | | | unimplemented DoWorkerTaskImpl.