summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/k_thread.cpp (follow)
Commit message (Collapse)AuthorAgeFilesLines
* core: refactor emulated cpu core activationLiam2023-12-041-46/+34
|
* kernel: signal thread on termination completedLiam2023-10-221-4/+7
|
* kernel: add missing TLR clearLiam2023-10-221-0/+1
|
* kernel: update KProcessLiam2023-10-221-7/+9
|
* Merge pull request #10990 from comex/ubsanliamwhite2023-07-261-1/+1
|\ | | | | Fixes and workarounds to make UBSan happier on macOS
| * Fixes and workarounds to make UBSan happier on macOScomex2023-07-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are still some other issues not addressed here, but it's a start. Workarounds for false-positive reports: - `RasterizerAccelerated`: Put a gigantic array behind a `unique_ptr`, because UBSan has a [hardcoded limit](https://stackoverflow.com/questions/64531383/c-runtime-error-using-fsanitize-undefined-object-has-a-possibly-invalid-vp) of how big it thinks objects can be, specifically when dealing with offset-to-top values used with multiple inheritance. Hopefully this doesn't have a performance impact. - `QueryCacheBase::QueryCacheBase`: Avoid an operation that UBSan thinks is UB even though it at least arguably isn't. See the link in the comment for more information. Fixes for correct reports: - `PageTable`, `Memory`: Use `uintptr_t` values instead of pointers to avoid UB from pointer overflow (when pointer arithmetic wraps around the address space). - `KScheduler::Reload`: `thread->GetOwnerProcess()` can be `nullptr`; avoid calling methods on it in this case. (The existing code returns a garbage reference to a field, which is then passed into `LoadWatchpointArray`, and apparently it's never used, so it's harmless in practice but still triggers UBSan.) - `KAutoObject::Close`: This function calls `this->Destroy()`, which overwrites the beginning of the object with junk (specifically a free list pointer). Then it calls `this->UnregisterWithKernel()`. UBSan complains about a type mismatch because the vtable has been overwritten, and I believe this is indeed UB. `UnregisterWithKernel` also loads `m_kernel` from the 'freed' object, which seems to be technically safe (the overwriting doesn't extend as far as that field), but seems dubious. Switch to a `static` method and load `m_kernel` in advance.
* | general: Silence -Wshadow{,-uncaptured-local} warningslat9nq2023-07-191-2/+2
|/ | | | These occur in the latest commits in LLVM Clang.
* Remove memory allocations in some hot pathsKelebek12023-06-221-5/+3
|
* k_thread: Use a mutex and cond_var to sync boollat9nq2023-06-171-4/+11
| | | | | std::atomic<bool> is broken on MinGW and causes deadlocks there. Use a normal cond var in its stead.
* memory: rename global memory references to application memoryLiam2023-03-241-3/+8
|
* kernel: use KTypedAddress for addressesLiam2023-03-221-13/+15
|
* kernel: additional style fixes to KThread, KProcessLiam2023-03-131-17/+17
|
* kernel: convert KThread to new styleLiam2023-03-131-244/+239
|
* kernel: prefer std::addressofLiam2023-03-131-2/+2
|
* kernel: remove kernel_Liam2023-03-131-100/+100
|
* Merge pull request #9923 from liamwhite/khtliamwhite2023-03-101-1/+3
|\ | | | | kernel: add timer pointer to KThreadQueue
| * kernel: add timer pointer to KThreadQueueLiam2023-03-081-1/+3
| |
* | kernel: clone fpu status on CreateThreadLiam2023-03-081-1/+23
|/
* kernel: be more careful about kernel address keysLiam2023-03-011-5/+7
|
* kernel: refactor priority inheritance to represent locks as C++ objectsLiam2023-03-011-84/+185
|
* service: refactor server architectureLiam2023-02-211-0/+20
| | | | Converts services to have their own processes
* kernel: use GetCurrentProcessLiam2023-02-131-0/+8
|
* kernel: split SetAddressKey into user and kernel variantsLiam2023-01-241-4/+4
|
* kernel: fix incorrect locking order in suspensionLiam2023-01-231-13/+0
|
* kernel/svc_types: refreshLiam2022-11-101-2/+2
|
* service_thread: register service threads to the logical owner processLiam2022-11-041-2/+2
|
* k_thread: fix single coreLiam2022-10-301-2/+4
|
* kernel: refactor dummy thread wakeupsLiam2022-10-251-20/+18
|
* core: hle: kernel: Use result macros for new/changed code.bunnei2022-10-191-20/+21
|
* core: hle: kernel: k_thread: Implement thread termination DPC.bunnei2022-10-191-0/+76
|
* kernel: Ensure all uses of disable_count are balancedLiam2022-07-151-2/+6
|
* kernel: be more careful about initialization path for HLE threadsLiam2022-07-151-1/+7
|
* kernel: fix single-core preemption pointsLiam2022-07-151-6/+0
|
* kernel: fix issues with single core modeLiam2022-07-151-2/+3
|
* kernel: use KScheduler from mesosphereLiam2022-07-151-2/+9
|
* kernel: fix usage of waiter_list in FinalizeLiam2022-07-101-3/+9
|
* Merge pull request #8502 from liamwhite/end-waitliamwhite2022-07-071-3/+4
|\ | | | | kernel: clean up waiting implementation
| * kernel: clean up waiting implementationLiam2022-06-251-3/+4
| |
* | common/fiber: make fibers easier to useLiam2022-07-021-10/+5
| |
* | core: Replace all instances of ResultCode with Resultgerman772022-06-271-26/+24
| |
* | kernel: make current thread pointer thread localLiam2022-06-231-4/+8
|/
* Merge pull request #8483 from liamwhite/fire-emblem-three-semaphoresbunnei2022-06-221-0/+13
|\ | | | | kernel: wait for threads to stop on pause
| * kernel: wait for threads to stop on pauseLiam2022-06-181-0/+13
| |
* | kernel: fix some uses of disable_countLiam2022-06-161-3/+1
|/
* kernel: implement KProcess suspensionLiam2022-06-141-4/+4
|
* common: Change semantics of UNREACHABLE to unconditionally crashLiam2022-06-141-1/+1
|
* core/debugger: Support reading guest thread namesLiam2022-06-021-0/+4
|
* general: Convert source file copyright comments over to SPDXMorph2022-04-231-3/+2
| | | | | This formats all copyright comments according to SPDX formatting guidelines. Additionally, this resolves the remaining GPLv2 only licensed files by relicensing them to GPLv2.0-or-later.
* core: hle: kernel: k_thread: Rework dummy thread waiting.bunnei2022-04-121-24/+15
|
* k_thread: Fix data racelat9nq2022-04-041-2/+2
| | | | | TSan reports a data race between writing at cpp:1162 and reading at h:262. Make the thread_state atomic to prevent this.
* core: Reduce unused includesameerj2022-03-191-3/+0
|
* core: hle: kernel: k_process: Implement thread local storage accurately.bunnei2022-03-151-2/+2
|
* core: hle: kernel: k_thread: Ensure host Fiber is freed.bunnei2022-03-151-0/+3
|
* hle: kernel: KThread: Improve Increment/Decrement RunningThreadCount.bunnei2022-01-231-8/+3
| | | | - Previously implementation was incorrect, and would occasionally underflow.
* hle: kernel: KThread: Ensure host (dummy) threads block on locking.bunnei2022-01-221-0/+37
| | | | | - But do not enter the priority queue, as otherwise they will be scheduled. - Allows dummy threads to use guest synchronization primitives.
* hle: kernel: KThread: DummyThread can be waited, ensure wait_queue is not nullptr.bunnei2022-01-211-6/+6
|
* hle: kernel: KThread: Decrease DummyThread priority to ensure it is never scheduled.bunnei2022-01-211-2/+3
|
* hle: kernel: KThread: Ensure dummy threads never call EndWait.bunnei2022-01-211-0/+5
| | | | - These are only used by host threads for locking and will never have a wait_queue.
* hle: kernel: KThread: Rename thread_type_for_debugging -> thread_type.bunnei2022-01-211-1/+1
| | | | - This will be used to ensure that we do not schedule dummy threads.
* core: hle: kernel: KThread: Integrate with KWorkerTask and implement DoWorkerTaskImpl.bunnei2022-01-151-1/+22
| | | | | | - This is used to terminate a thread asynchronously after it has been exited. - This fixes a crash that can occur in Pokemon Sword/Shield because a thread is incorrectly closed on svcExitThread, then, the thread is destroyed on svcCloseHandle while it is still scheduled. - Instead, we now wait for the thread to no longer be scheduled on all cores before destroying it from KWorkerTaskManager, which is accurate to HOS behavior.
* core: hle: kernel: KThread: Replace Suspend with UpdateState & various updates.bunnei2022-01-151-31/+24
| | | | - This makes our implementations of these more closely match HOS.
* core: hle: kernel: Implement thread pinning.bunnei2021-12-311-3/+41
| | | | | - We largely had the mechanics in place for thread pinning, this change hooks these up. - Validated with tests https://github.com/Atmosphere-NX/Atmosphere/blob/master/tests/TestSvc/source/test_thread_pinning.cpp.
* core: hle: kernel: KThread: X18 should be a cryptographically random number.bunnei2021-12-231-0/+2
| | | | | - This was added with firmware 11.0.0 (https://switchbrew.org/wiki/11.0.0). - X18 is OR'd by kernel with 1, to make sure it is odd.
* hle: kernel: Remove unnecessary virtual specifier on CancelWait.bunnei2021-12-071-2/+2
|
* hle: kernel: k_thread: Skip reschedule on DisableDispatch with SC.bunnei2021-12-071-0/+5
|
* hle: kernel: k_thread: Rename sleeping_queue -> wait_queue.bunnei2021-12-071-11/+11
|
* hle: kernel: k_thread: Treat dummy threads as a special type.bunnei2021-12-071-1/+3
|
* hle: kernel: Add a flag for indicating that the kernel is currently shutting down.bunnei2021-12-071-0/+5
|
* hle: kernel: Cleanup to match coding style.bunnei2021-12-071-5/+4
|
* hle: kernel: KThread: Migrate to updated KThreadQueue (part 2).bunnei2021-12-071-29/+19
|
* hle: kernel: KThread: Migrate to updated KThreadQueue (part 1).bunnei2021-12-071-57/+64
|
* hle: kernel: KThread: Remove tracking of sync object from threads.bunnei2021-12-071-5/+2
|
* hle: kernel: Update KThreadQueue and migrate KSynchronizationObject.bunnei2021-12-071-2/+40
|
* core: hle: kernel: Disable dispatch count tracking on single core.bunnei2021-12-071-1/+5
| | | | - This would have limited value, and would be a mess to handle properly.
* core: hle: kernel: k_thread: Add KScopedDisableDispatch.bunnei2021-12-071-1/+16
|
* core: Remove unused includesameerj2021-11-041-4/+0
|
* Revert "kernel: Various improvements to scheduler"bunnei2021-08-261-19/+2
|
* core: hle: kernel: Disable dispatch count tracking on single core.bunnei2021-08-141-1/+3
| | | | - This would have limited value, and would be a mess to handle properly.
* core: hle: kernel: k_thread: Add KScopedDisableDispatch.bunnei2021-08-071-1/+16
|
* general: Replace RESULT_SUCCESS with ResultSuccessMorph2021-06-021-9/+9
| | | | Transition to PascalCase for result names.
* k_thread: Move dereference after null check in Initialize()Lioncash2021-05-291-5/+5
| | | | Prevents a -Wnonnull warning on GCC.
* kernel: Eliminate variable shadowingLioncash2021-05-081-16/+16
| | | | | Now that the large kernel refactor is merged, we can eliminate the remaining variable shadowing cases.
* hle: kernel: Migrate to KHandleTable.bunnei2021-05-061-1/+1
|
* hle: kernel: Rename Process to KProcess.bunnei2021-05-061-5/+5
|
* hle: kernel: Remove deprecated Object class.bunnei2021-05-061-1/+0
|
* hle: kernel: KThread: Remove incorrect resource release.bunnei2021-05-061-2/+1
|
* hle: kernel: KThread: Add missing resource hint release.bunnei2021-05-061-1/+1
|
* hle: kernel: Migrate KSharedMemory to KAutoObject.bunnei2021-05-061-0/+3
|
* hle: kernel: Migrate KThread to KAutoObject.bunnei2021-05-061-52/+48
|
* hle: kernel: KThread: Rework dummy threads & fix memory leak.bunnei2021-03-061-19/+31
| | | | | - Dummy threads are created on thread local storage for all host threads. - Fixes a leak by removing creation of fibers, which are not applicable here.
* Revert "core: Switch to unique_ptr for usage of Common::Fiber."bunnei2021-03-061-1/+5
|
* core: Switch to unique_ptr for usage of Common::Fiber.bunnei2021-02-271-5/+1
| | | | | - With using unique_ptr instead of shared_ptr, we have more explicit ownership of the context. - Fixes a memory leak due to circular reference of the shared pointer.
* hle: kernel: Migrate MemoryLayout to KMemoryLayout.bunnei2021-02-191-4/+4
|
* kernel: Unify result codes (#5890)Chloe2021-02-131-16/+14
| | | | | | | | | * 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
* Simplify limitableresource namesChloe Marcec2021-02-031-1/+1
|
* kernel: Rewrite resource limit to be more accurateChloe Marcec2021-01-301-2/+2
| | | | Matches closer to hardware
* hle: kernel: KThread: Release thread resource on thread exit.bunnei2021-01-291-0/+1
|
* yuzu: debugger: Ignore HLE threads.bunnei2021-01-291-7/+8
|
* hle: kernel: Allocate a dummy KThread for each host thread, and use it for scheduling.bunnei2021-01-291-5/+1
|
* kernel: Fix build errors.bunnei2021-01-291-2/+7
|
* hle: kernel: Recode implementation of KThread to be more accurate.bunnei2021-01-291-197/+796
|
* hle: kernel: KThread: Clean up thread priorities.bunnei2021-01-291-9/+1
|
* hle: kernel: KThread: Reorganize thread priority defaults.bunnei2021-01-291-7/+6
|
* hle: kernel: KThread: Remove thread types that do not exist.bunnei2021-01-291-12/+9
|
* core: hle: kernel: Rename Thread to KThread.bunnei2021-01-291-0/+460