Commit Graph

129 Commits

Author SHA1 Message Date
bunnei 11febb02d6 hle: kernel: Unify and integrate reference tracking for KServerPort/KServerSession.
- These are not managed elsewhere, and need to be tracked and closed on emulation shutdown.
2022-04-08 14:13:22 -07:00
bunnei 2878df391c hle: kernel: hle_ipc: HasSessionRequestHandler: Check if domain handler is expired rather than locking. 2022-04-08 14:11:39 -07:00
bunnei 75e39568a0 hle: service: Add option for service interfaces to create or use the default thread. 2022-04-02 01:24:30 -04:00
ameerj 22e01068e1 core: Reduce unused includes 2022-03-19 02:23:32 -04:00
bunnei 29924a999e core: hle: kernel: Remove server session tracking.
- These are now allocated/managed by emulated memory, so we do not need to track and free them on shutdown.
2022-03-14 18:14:54 -07:00
bunnei 8421193857 core: hle: kernel: Use weak_ptr where possible for SessionRequestHandler and SessionRequestManager. 2022-03-14 18:14:53 -07:00
ameerj d27abf5546 core: Remove unused includes 2021-11-03 21:42:57 -04:00
Morph 6bc7f27655 kernel: hle_ipc: Foward declare KAutoObject 2021-10-07 13:32:36 -04:00
bunnei beeed68944 hle: kernel: Track and release server sessions, and protect methods with locks. 2021-07-20 18:54:56 -07:00
bunnei 6c84a78d74 hle: kernel: KServerSession: Fix client disconnected.
- Prevents a cloned session's handler from being overwritten by another disconnected session.
- Fixes session handler nullptr asserts with Pokemon Sword & Shield.
2021-06-09 21:37:11 -07:00
bunnei 4ad8a148ee hle: kernel: hle_ipc: Ensure SessionRequestHandler is valid. 2021-06-07 21:55:37 -07:00
bunnei ea1ca74e7a hle: kernel: hle_ipc: Use default destructor for SessionRequestManager. 2021-06-06 15:41:16 -07:00
bunnei 8bf7b19d1d hle: kernel: Refactor to allocate a ServiceThread per service handler.
- Previously, we would allocate a thread per session, which adds new threads on CloneCurrentObject.
- This results in race conditions with N sessions queuing requests to the same service interface.
- Fixes Pokken Tournament DX crashes/softlocks, which were regressed by #6347.
2021-06-04 19:26:48 -07:00
Morph 7ebc38a6d1 general: Replace RESULT_SUCCESS with ResultSuccess
Transition to PascalCase for result names.
2021-06-02 00:39:27 -04:00
bunnei 14f50729e2 hle: kernel: hle_ipc: Simplify incoming/outgoing move/copy/domain objects. 2021-05-20 21:41:52 -07:00
bunnei 6e3c9d2b06 hle: kernel: Implement CloneCurrentObject and improve session management. 2021-05-20 21:41:49 -07:00
Morph c4f16c8e14 hle_ipc: unsigned -> u32
This is more concise and consistent with the rest of the codebase.
2021-05-16 04:11:00 -04:00
Morph 29ce6e48ed hle_ipc: Add a getter for PID 2021-05-16 04:10:42 -04:00
bunnei 006a51c86b hle: kernel: hle_ipc: Fix outgoing IPC response size calculation. 2021-05-11 12:27:43 -07:00
bunnei 232102c794 hle: kernel: hle_ipc: Improve IPC code and add initial support for TIPC.
- Fixes our move handles implementation to actually move objects.
- Simplifies the traditional IPC path.
2021-05-10 20:34:38 -07:00
bunnei 4a781928dd hle: kernel: Further cleanup and add TIPC helpers. 2021-05-10 15:05:10 -07:00
Lioncash e019da0487 kernel: Eliminate variable shadowing
Now that the large kernel refactor is merged, we can eliminate the
remaining variable shadowing cases.
2021-05-08 12:33:26 -04:00
bunnei 47224d3864 hle: kernel: Migrate to KHandleTable. 2021-05-05 16:40:53 -07:00
bunnei ad048de3d6 hle: kernel: Rename Process to KProcess. 2021-05-05 16:40:52 -07:00
bunnei 796dddf78f hle: kernel: Remove deprecated Object class. 2021-05-05 16:40:52 -07:00
bunnei d6844cf75f hle: kernel: Migrate KPort, KClientPort, and KServerPort to KAutoObject. 2021-05-05 16:40:52 -07:00
bunnei 944eb14d69 hle: kernel: HandleTable: Remove deprecated APIs. 2021-05-05 16:40:52 -07:00
bunnei 83b96b7264 hle: kernel: Migrate KSession, KClientSession, and KServerSession to KAutoObject. 2021-05-05 16:40:51 -07:00
bunnei 11f9080d2e hle: kernel: Migrate KSharedMemory to KAutoObject. 2021-05-05 16:40:50 -07:00
bunnei 8b224f05c9 hle: kernel: Refactor IPC interfaces to not use std::shared_ptr. 2021-05-05 16:40:50 -07:00
bunnei 07939c59a6 hle: kernel: Refactor out various KThread std::shared_ptr usage. 2021-05-05 16:40:50 -07:00
Morph e1702e2844 hle_ipc: Add helper functions to get copy/move handles 2021-04-15 01:53:16 -04:00
Chloe e62886ead0 kernel: Unify result codes (#5890)
* kernel: Unify result codes

Drop the usage of ERR_NAME convention in kernel for ResultName. Removed seperation between svc_results.h & errors.h as we mainly include both most of the time anyways.

* oops

* rename errors to svc_results
2021-02-12 15:43:01 -08:00
bunnei 80d0eb3bbd hle: kernel: Rename WritableEvent to KWritableEvent. 2021-02-05 14:00:36 -08:00
bunnei 284a4d9283 hle: kernel: Rename ReadableEvent to KReadableEvent. 2021-02-05 14:00:36 -08:00
bunnei 3d70b4a4ea core: hle: kernel: Rename Thread to KThread. 2021-01-28 21:42:25 -08:00
Morph afa0d5efb3 hle_ipc: Add Can(Read, Write)Buffer
Allows us to test whether a buffer can be read from or written to memory
2021-01-28 01:32:24 -05:00
bunnei 846f35c4ad hle: kernel: hle_ipc: Remove SleepClientThread.
- This was kind of hacky, and no longer is necessary with service threads.
2020-12-28 16:33:48 -08:00
bunnei 61e017a026 hle: kernel: Separate KScopedSchedulerLockAndSleep from k_scheduler. 2020-12-06 00:03:24 -08:00
bunnei 039844bbb9 hle: kernel: Rewrite scheduler implementation based on Mesopshere. 2020-12-06 00:03:24 -08:00
bunnei deb3536936 Revert "core: Fix clang build" 2020-10-20 19:07:39 -07:00
Lioncash 18636013c9 core: Fix clang build
Recent changes to the build system that made more warnings be flagged as
errors caused building via clang to break.

Fixes #4795
2020-10-17 19:50:39 -04:00
Lioncash 78ddcbe3ba General: Tidy up clang-format warnings part 2 2020-08-13 14:19:08 -04:00
Fernando Sahmkow b2109333c6 HLE_IPC: Correct HLE Event behavior on timeout. 2020-06-27 11:36:03 -04:00
Fernando Sahmkow da260b9d2e Core: Correct HLE Event Callbacks and other issues. 2020-06-27 11:35:22 -04:00
Fernando Sahmkow 85ca7b2bdb SVC: Correct SendSyncRequest. 2020-06-27 11:35:14 -04:00
David Marcec df001e73c2 Mark invalid IPC buffers as ASSERT_OR_EXECUTE_MSG
Previously if applications would send faulty buffers(example homebrew) it would lead to us returning uninitalized data. Switching from ASSERT_MSG to ASSERT_OR_EXECUTE_MSG allows us to have a fail safe to prevent crashes but also continue execution without introducing undefined behavior
2020-06-24 22:50:27 +10:00
Lioncash ccfac6d992 hle_ipc: Eliminate core memory globals
We can just pass the required instances into the constructor of the
request, eliminating all usages of the global system accessor.
2020-05-03 12:57:40 -04:00
Lioncash f8fe53c9f9 hle_ipc: Remove std::size_t casts where applicable
These were added in the change that enabled -Wextra on linux builds so
as not to introduce interface changes in the same change as a
build-system flag addition.

Now that the flags are enabled, we can freely change the interface to
make these unnecessary.
2020-04-16 22:02:10 -04:00
Lioncash 02e095313a CMakeLists: Specify -Wextra on linux builds
Allows reporting more cases where logic errors may exist, such as
implicit fallthrough cases, etc.

We currently ignore unused parameters, since we currently have many
cases where this is intentional (virtual interfaces).

While we're at it, we can also tidy up any existing code that causes
warnings. This also uncovered a few bugs as well.
2020-04-15 21:33:46 -04:00