bunnei
864523327f
hle: kernel: Create a default thread for services that do not need their own host thread.
4 years ago
ameerj
ade596121b
core: Reduce unused includes
4 years ago
bunnei
5f3e77d93e
core: hle: kernel: Allocate dummy threads on host thread storage.
- Fixes a crash where on subsequent boots, long-lived host threads would have their dummy threads freed.
4 years ago
bunnei
82a2463062
core: hle: kernel: Downgrade dangling objects warning to debug.
- It is not impossible to leak kernel objects, so this is not really any issue anymore (albeit, still interesting).
4 years ago
bunnei
f7d1929816
core: hle: kernel: Make object list container global and ensure it is reset on each emulation session.
4 years ago
bunnei
51589c5e21
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.
4 years ago
bunnei
a25cd4bb4b
core: hle: kernel: Update init_slab_heap, use device memory, and add KThreadLocalPage and KPageBuffer.
- Refreshes our slab initialization code to latest known behavior.
- Moves all guest kernel slabs into emulated device memory.
- Adds KThreadLocalPage and KPageBuffer, which we will use for accurate TLS management.
4 years ago
bunnei
14d28a043d
hle: kernel: Re-create memory layout at initialization.
- As this can only be derived once.
4 years ago
bunnei
16e5954fcb
hle: kernel: Remove unused pool locals.
4 years ago
bunnei
f87f076162
hle: kernel: k_memory_manager: Rework for latest kernel behavior.
- Updates the KMemoryManager implementation against latest documentation.
- Reworks KMemoryLayout to be accessed throughout the kernel.
- Fixes an issue with pool sizes being incorrectly reported.
4 years ago
bunnei
ca5e843bf6
core: hle: kernel: Remove resource limit hack for PhysicalMemory.
- With prior changes, we now report the correct amount of physical memory available to the emulated process.
4 years ago
bunnei
f6815086a1
hle: kernel: Remove redundant tracking of dummy threads.
- These are already tracked by kernel's registered_objects member.
4 years ago
bunnei
b54cbc985e
hle: kernel: k_memory_manager: Clear pages on allocation & free.
- Heap pages should be zero'd.
- Also explicitly passed along heap allocation option.
4 years ago
bunnei
c905044e1b
core: hle: kernel: Instantiate a kernel instance of KWorkerTaskManager.
4 years ago
bunnei
cc112f971e
hle: kernel: Fix service_threads access to be thread safe V2.
- PR #7699 attempted to fix CreateServiceThread and ReleaseServiceThread to be thread safe, but inadvertently introduced a possible dead-lock.
- With this PR, we use a worker thread to manage the service thread list, allowing it only to be accessed by a single thread, and guaranteeing threads will not destroy themselves.
- Fixes a rare crash in Pokemon Sword/Shield, I've now run this game for ~12 hours non-stop and am quite confident this is a good solution for this issue.
4 years ago
bunnei
2147240e47
hle: kernel: Fix service_threads access to be thread safe.
- CreateServiceThread and ReleaseServiceThread can be accessed by different threads, uses a lock to make this thread safe.
- Fixes a rare crash in Pokemon Sword/Shield that can occur when a new service thread is being created while an old one is being destroyed.
4 years ago
ameerj
55650c5b75
kernel: Manually destroy the current process during shut down
Avoids a memory leak.
4 years ago
FernandoS27
894ed14ebc
hle: kernel: fix timing on thread preemption
4 years ago
bunnei
abbea575cf
hle: kernel: Add a flag for indicating that the kernel is currently shutting down.
4 years ago
bunnei
3239442de6
core: hle: kernel: DisableDispatch on suspend threads.
4 years ago
bunnei
178584e56f
core: hle: kernel: Use CurrentPhysicalCoreIndex as appropriate.
4 years ago
bunnei
3bd5d4b6f8
core: hle: kernel: Ensure idle threads are closed before destroying scheduler.
4 years ago
bunnei
669a2d2c67
core: hle: kernel: Reflect non-emulated threads as core 3.
4 years ago
Adam Heinermann
d8a783a368
Fix crash on exit due to static scoped dummy threads
4 years ago
ameerj
7c4b6aab2e
core: Remove unused includes
4 years ago
Feng Chen
dd29285e35
Fix dangling kernel objects when exiting
4 years ago
Feng Chen
052017e189
Revert PR7009
4 years ago
Feng Chen
a8b0104923
Fix memory leak
4 years ago
bunnei
0c8594b225
Revert "kernel: Various improvements to scheduler"
4 years ago
BreadFish64
14e93f133a
kernel: Optimize GetHostThreadID
4 years ago
bunnei
5051d3c415
core: hle: kernel: DisableDispatch on suspend threads.
4 years ago
bunnei
2dfb07388a
core: hle: kernel: Use CurrentPhysicalCoreIndex as appropriate.
4 years ago
bunnei
2b9560428b
core: hle: kernel: Ensure idle threads are closed before destroying scheduler.
4 years ago
bunnei
68eee94875
core: hle: kernel: Reflect non-emulated threads as core 3.
4 years ago
bunnei
52caa52cc2
hle: kernel: Track and release server sessions, and protect methods with locks.
5 years ago
bunnei
854c7a3c28
hle: kernel: Ensure current running process is closed.
5 years ago
bunnei
ecf3653444
hle: kernel: Ensure global handle table is finalized before closing.
5 years ago
bunnei
fe402d3506
hle: kernel: Ensure global handle table is initialized.
5 years ago
bunnei
929994132a
hle: kernel: Provide methods for tracking dangling kernel objects.
5 years ago
Wunkolo
4569f39c7c
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.
5 years ago
bunnei
a493ab2678
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.
5 years ago
Markus Wick
5a8cd1b118
Fix two GCC 11 warnings: Unneeded copies.
std::move created an unneeded copy.
iterating without reference also created copies.
5 years ago
bunnei
ee099b2697
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.
5 years ago
bunnei
c6de9657be
hle: kernel: Implement named service ports using service interface factory.
- This allows us to create a new interface each time ConnectToNamedPort is called, removing the assumption that these are static.
5 years ago
Lioncash
2f62bae9e3
kernel: Eliminate variable shadowing
Now that the large kernel refactor is merged, we can eliminate the
remaining variable shadowing cases.
5 years ago
bunnei
b805ee653f
hle: kernel: Move slab resource counts to Kernel.
5 years ago
bunnei
da22def511
hle: kernel: Fix un/sign mismatch errors with NUM_CPU_CORES.
5 years ago
bunnei
4b03e6e776
hle: kernel: Migrate to KHandleTable.
5 years ago
bunnei
0b27c721c9
hle: kernel: Improve MapSharedMemory and implement UnmapSharedMemory.
5 years ago
bunnei
2a7eff57a8
hle: kernel: Rename Process to KProcess.
5 years ago