bunnei
beeed68944
hle: kernel: Track and release server sessions, and protect methods with locks.
2021-07-20 18:54:56 -07:00
bunnei
179243473b
hle: kernel: KProcess: Change process termination assert to a warning.
...
- Since we do not implement multiprocess right now, this should not be a crashing assert.
2021-07-20 18:54:56 -07:00
bunnei
81d111fd1b
hle: kernel: Ensure current running process is closed.
2021-07-20 18:54:56 -07:00
bunnei
88350871df
hle: kernel: Ensure global handle table is finalized before closing.
2021-07-20 18:54:56 -07:00
bunnei
43f2f83c30
kernel: svc: ConnectToNamedPort: Close extra reference to port.
2021-07-20 18:54:56 -07:00
bunnei
66da530a81
hle: kernel: k_process: Close the handle table on shutdown.
2021-07-20 18:54:55 -07:00
bunnei
d144950f11
hle: kernel: k_process: Close main thread reference after it is inserted into handle table.
2021-07-20 18:54:55 -07:00
bunnei
2c96cc5343
hle: kernel: Ensure global handle table is initialized.
2021-07-20 18:54:55 -07:00
bunnei
a4b3202b65
hle: kernel: Provide methods for tracking dangling kernel objects.
2021-07-20 18:54:55 -07:00
Wunkolo
722f9c3cb5
common: Replace common_sizes into user-literals
...
Removes common_sizes.h in favor of having `_KiB`, `_MiB`, `_GiB`, etc
user-literals within literals.h.
To keep the global namespace clean, users will have to use:
```
using namespace Common::Literals;
```
to access these literals.
2021-06-24 09:27:40 -07:00
Morph
3543d65449
kernel: Fix missing peak set in KResourceLimit::SetLimitValue
2021-06-18 07:27:48 -04:00
Morph
006ca28fc8
kernel: Unconditionally set thread state when appropriate
2021-06-11 00:58:04 -04:00
Morph
3509855179
kernel: KLightConditionVariable: Update implementation to 12.x
...
Updates the implementation of KLightConditionVariable to FW 12.x
2021-06-11 00:58:04 -04:00
bunnei
6c3c99c915
hle: kernel: KClientPort: Add an assert for session count.
...
- Prevents us from over decrementing num_sessions.
2021-06-09 22:36:42 -07:00
bunnei
73d30a5446
hle: service: sm: Fix GetService setup of session & port.
2021-06-09 22:29:18 -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
d06f7d9f6c
kernel: svc: Add missing error check to CancelSynchronization.
...
- Avoids a potential crash if the handle is invalid, and also makes this code accurate to real kernel behavior.
2021-06-09 15:24:46 -07:00
bunnei
b270cecbab
hle: kernel: KServerSession: Work-around scenario where session is closed too early.
2021-06-08 13:39:20 -07:00
bunnei
4ad8a148ee
hle: kernel: hle_ipc: Ensure SessionRequestHandler is valid.
2021-06-07 21:55:37 -07:00
bunnei
a3de201dcf
hle: kernel: Remove service thread manager and use weak_ptr.
...
- We no longer need to queue up service threads to be destroyed.
- Fixes a race condition where a thread could be destroyed too early, which caused a crash in Pokemon Sword/Shield.
2021-06-07 21:10:51 -07:00
bunnei
eeb8d0def8
hle: kernel: KServerSession: Use ASSERT_MSG where appropriate.
2021-06-06 22:09:25 -07:00
bunnei
ff57fd7281
hle: kernel: k_server_session: Return service thread by strong pointer.
2021-06-06 17:54:06 -07:00
bunnei
c833ca5fa0
hle: kernel: k_server_session: Ensure service thread is valid before dereference.
2021-06-06 17:03:36 -07:00
bunnei
ea1ca74e7a
hle: kernel: hle_ipc: Use default destructor for SessionRequestManager.
2021-06-06 15:41:16 -07:00
bunnei
38d8bcc574
hle: kernel: KAutoObjectWithListContainer: Use boost::instrusive::rbtree.
...
- Fixes some crashes introduced by our common intrusive red/black tree impl.
2021-06-06 15:39:11 -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
c4d6d9dfd3
general: Replace RESULT_UNKNOWN with ResultUnknown
...
Transition to PascalCase for result names.
2021-06-02 00:39:27 -04:00
Morph
7ebc38a6d1
general: Replace RESULT_SUCCESS with ResultSuccess
...
Transition to PascalCase for result names.
2021-06-02 00:39:27 -04:00
bunnei
3c1b54384e
Merge pull request #6387 from lioncash/class-token
...
k_class_token: Use variable templates where applicable
2021-05-29 23:55:17 -07:00
Lioncash
2197782ecd
k_class_token: Use variable templates where applicable
...
Same behavior, less code.
2021-05-29 05:25:34 -04:00
bunnei
137938f971
Merge pull request #6384 from lioncash/virtual
...
kernel: Add missing override specifiers
2021-05-29 02:11:40 -07:00
bunnei
6864ccfee8
Merge pull request #6382 from lioncash/null
...
k_thread: Move dereference after null check in Initialize()
2021-05-29 01:17:28 -07:00
bunnei
fb86819b39
Merge pull request #6373 from bunnei/use-slabheap-tls
...
hle: kernel: KSlabHeap: Allow host or guest allocations.
2021-05-29 00:17:24 -07:00
Lioncash
a9fcaa9c00
kernel: Add missing override specifiers
...
Over the course of the kernel refactoring a tiny bit of missing
overrides slipped through review, so we can add these.
While we're at it, we can remove redundant virtual keywords where
applicable as well.
2021-05-29 02:58:32 -04:00
Markus Wick
9f92beed0a
Fix two GCC 11 warnings: Unneeded copies.
...
std::move created an unneeded copy.
iterating without reference also created copies.
2021-05-29 08:57:44 +02:00
Lioncash
2d390c1911
k_thread: Move dereference after null check in Initialize()
...
Prevents a -Wnonnull warning on GCC.
2021-05-29 00:31:38 -04:00
bunnei
639baf88f7
hle: kernel: KSlabHeap: Allow host or guest allocations.
...
- Use host allocations for kernel memory, as this is not properly emulated yet.
- Use guest allocations for TLS, as this needs to be backed by DeviceMemory.
2021-05-28 17:42:41 -07:00
Markus Wick
c9f9e77be3
core/arm_interface: Call SVC after end of dynarmic block.
...
So we can modify all of dynarmic states within SVC without ExceptionalExit.
Especially as the ExceptionalExit hack is dropped on upstream dynarmic.
2021-05-27 23:23:23 +02:00
Morph
5eecd49108
kernel: process_capability: Add MapRegion capability
...
- Used by nx-hbloader
2021-05-25 01:44:46 -04:00
bunnei
9d19382daf
hle: kernel: service_thread: Take reference to KServerSession on service request.
2021-05-20 22:39:44 -07:00
bunnei
ea851aaeb8
hle: kernel: k_port: Use AcceptSession to ensure SessionList state is correct.
...
- Fixes a use-after-free, work-around until we fixup session/port management.
2021-05-20 21:41:52 -07:00
bunnei
227f9e5ab2
hle: kernel: Use host memory allocations for KSlabMemory.
...
- There are some issues with the current workaround, we will just use host memory until we have a complete kernel memory implementation.
2021-05-20 21:41:52 -07:00
bunnei
78853f888a
Revert "WORKAROUND: Do not use slab heap while we track down issues with resource management."
...
This reverts commit bb77b5d79f
.
2021-05-20 21:41:52 -07: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
bunnei
7b1c7a5e6a
Revert "WORKAROUND: temp. disable session resource limits while we work out issues"
...
This reverts commit 627eaf8c0e
.
2021-05-20 21:40:30 -07:00
bunnei
53526d2c14
Merge pull request #6320 from Morph1984/get-pid
...
hle_ipc: Add a getter for PID
2021-05-20 21:40:03 -07:00
Morph
bf87c33d40
KTransferMemory: Return size instead of size * PageSize in GetSize()
...
size is already the size in bytes. We do not need to multiply it by the page size
2021-05-18 13:14:28 -04: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