Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | Fixes and workarounds to make UBSan happier on macOS | comex | 2023-07-15 | 1 | -1/+2 |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. | ||||
* | core_timing: Use CNTPCT as the guest CPU tick | Morph | 2023-06-08 | 1 | -2/+3 |
| | | | | | Previously, we were mixing the raw CPU frequency and CNTFRQ. The raw CPU frequency (1020 MHz) should've never been used as CNTPCT (whose frequency is CNTFRQ) is the only counter available. | ||||
* | kernel: use KTypedAddress for addresses | Liam | 2023-03-22 | 1 | -1/+1 |
| | |||||
* | kernel: convert KThread to new style | Liam | 2023-03-13 | 1 | -8/+8 |
| | |||||
* | kernel: prefer std::addressof | Liam | 2023-03-13 | 1 | -1/+1 |
| | |||||
* | kernel: remove kernel_ | Liam | 2023-03-13 | 1 | -31/+31 |
| | |||||
* | kernel: use GetCurrentProcess | Liam | 2023-02-13 | 1 | -7/+7 |
| | |||||
* | Ensure correctness of atomic store ordering | Liam | 2022-11-09 | 1 | -3/+6 |
| | |||||
* | kernel: refactor dummy thread wakeups | Liam | 2022-10-25 | 1 | -2/+24 |
| | |||||
* | kernel: Ensure all uses of disable_count are balanced | Liam | 2022-07-15 | 1 | -8/+13 |
| | |||||
* | kernel: be more careful about initialization path for HLE threads | Liam | 2022-07-15 | 1 | -0/+1 |
| | |||||
* | kernel: fix single-core preemption points | Liam | 2022-07-15 | 1 | -0/+13 |
| | |||||
* | kernel: fix issues with single core mode | Liam | 2022-07-15 | 1 | -91/+82 |
| | |||||
* | kernel: use KScheduler from mesosphere | Liam | 2022-07-15 | 1 | -347/+376 |
| | |||||
* | common/fiber: make fibers easier to use | Liam | 2022-07-02 | 1 | -6/+1 |
| | |||||
* | kernel: make current thread pointer thread local | Liam | 2022-06-23 | 1 | -9/+16 |
| | |||||
* | Merge pull request #8432 from liamwhite/watchpoint | bunnei | 2022-06-22 | 1 | -0/+1 |
|\ | | | | | core/debugger: memory breakpoint support | ||||
| * | core/debugger: memory breakpoint support | Liam | 2022-06-16 | 1 | -0/+1 |
| | | |||||
* | | kernel: fix some uses of disable_count | Liam | 2022-06-16 | 1 | -0/+1 |
|/ | |||||
* | general: Convert source file copyright comments over to SPDX | Morph | 2022-04-23 | 1 | -6/+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. | ||||
* | hle: kernel: Use std::mutex instead of spin locks for most kernel locking. | bunnei | 2022-04-12 | 1 | -4/+4 |
| | |||||
* | core: Reduce unused includes | ameerj | 2022-03-19 | 1 | -1/+0 |
| | |||||
* | hle: kernel: KScheduler: Fix deadlock with core waiting for a thread lock that has migrated. | bunnei | 2022-01-27 | 1 | -22/+23 |
| | | | | | | | | - Previously, it was possible for a thread migration to occur from core A to core B. - Next, core B waits on a guest lock that must be released by a thread queued for core A. - Meanwhile, core A is still waiting on the core B's current thread lock - resulting in a deadlock. - Fix this by try-locking the thread lock. - Fixes softlocks in FF8 and Pokemon Legends Arceus. | ||||
* | hle: kernel: KThread: Ensure host (dummy) threads block on locking. | bunnei | 2022-01-22 | 1 | -0/+3 |
| | | | | | - But do not enter the priority queue, as otherwise they will be scheduled. - Allows dummy threads to use guest synchronization primitives. | ||||
* | hle: kernel: KThread: Decrease DummyThread priority to ensure it is never scheduled. | bunnei | 2022-01-21 | 1 | -0/+1 |
| | |||||
* | hle: kernel: KScheduler: Ensure dummy threads are never scheduled. | bunnei | 2022-01-21 | 1 | -0/+5 |
| | | | | - These are only used by host threads for locking. | ||||
* | hle: remove no-op code | Valeri | 2022-01-17 | 1 | -2/+0 |
| | | | Found by static analysis with PVS-Studio. Nobody seems to really know what was it doing there. | ||||
* | core: hle: kernel: Implement thread pinning. | bunnei | 2021-12-31 | 1 | -0/+8 |
| | | | | | - 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. | ||||
* | hle: kernel k_scheduler: EnableScheduling: Remove redundant GetCurrentThreadPointer calls. | bunnei | 2021-12-07 | 1 | -3/+5 |
| | |||||
* | hle: kernel: fix scheduling ops from HLE host thread. | FernandoS27 | 2021-12-07 | 1 | -3/+3 |
| | |||||
* | hle: kernel: Add a flag for indicating that the kernel is currently shutting down. | bunnei | 2021-12-07 | 1 | -0/+10 |
| | |||||
* | core: hle: kernel: k_scheduler: Improve DisableScheduling and EnableScheduling. | bunnei | 2021-12-07 | 1 | -14/+9 |
| | |||||
* | core: hle: kernel: k_scheduler: Remove unnecessary MakeCurrentProcess. | bunnei | 2021-12-07 | 1 | -5/+0 |
| | |||||
* | core: hle: kernel: k_scheduler: Improve ScheduleImpl. | bunnei | 2021-12-07 | 1 | -6/+7 |
| | |||||
* | core: hle: kernel: k_scheduler: Improve Unload. | bunnei | 2021-12-07 | 1 | -17/+29 |
| | |||||
* | core: hle: kernel: Ensure idle threads are closed before destroying scheduler. | bunnei | 2021-12-07 | 1 | -1/+5 |
| | |||||
* | Revert "kernel: Various improvements to scheduler" | bunnei | 2021-08-26 | 1 | -46/+39 |
| | |||||
* | core: hle: kernel: k_scheduler: Improve DisableScheduling and EnableScheduling. | bunnei | 2021-08-07 | 1 | -14/+9 |
| | |||||
* | core: hle: kernel: k_scheduler: Remove unnecessary MakeCurrentProcess. | bunnei | 2021-08-07 | 1 | -5/+0 |
| | |||||
* | core: hle: kernel: k_scheduler: Improve ScheduleImpl. | bunnei | 2021-08-07 | 1 | -6/+7 |
| | |||||
* | core: hle: kernel: k_scheduler: Improve Unload. | bunnei | 2021-08-07 | 1 | -17/+29 |
| | |||||
* | core: hle: kernel: Ensure idle threads are closed before destroying scheduler. | bunnei | 2021-08-07 | 1 | -1/+5 |
| | |||||
* | core/arm_interface: Call SVC after end of dynarmic block. | Markus Wick | 2021-05-27 | 1 | -1/+0 |
| | | | | | | So we can modify all of dynarmic states within SVC without ExceptionalExit. Especially as the ExceptionalExit hack is dropped on upstream dynarmic. | ||||
* | core: Make variable shadowing a compile-time error | Lioncash | 2021-05-16 | 1 | -1/+1 |
| | | | | | | Now that we have most of core free of shadowing, we can enable the warning as an error to catch anything that may be remaining and also eliminate this class of logic bug entirely. | ||||
* | kernel: Eliminate variable shadowing | Lioncash | 2021-05-08 | 1 | -10/+10 |
| | | | | | Now that the large kernel refactor is merged, we can eliminate the remaining variable shadowing cases. | ||||
* | hle: kernel: Rename Process to KProcess. | bunnei | 2021-05-06 | 1 | -8/+8 |
| | |||||
* | hle: kernel: Refactor several threads/events/sharedmemory to use slab heaps. | bunnei | 2021-05-06 | 1 | -7/+9 |
| | |||||
* | hle: kernel: Move slab heap management to KernelCore. | bunnei | 2021-05-06 | 1 | -1/+3 |
| | |||||
* | hle: kernel: Ensure all kernel objects with KAutoObject are properly created. | bunnei | 2021-05-06 | 1 | -0/+1 |
| | |||||
* | hle: kernel: Migrate idle threads. | bunnei | 2021-05-06 | 1 | -10/+6 |
| | |||||
* | hle: kernel: Migrate some code from Common::SpinLock to KSpinLock. | bunnei | 2021-03-21 | 1 | -11/+11 |
| | |||||
* | common: Fiber: use a reference for YieldTo. | bunnei | 2021-03-07 | 1 | -8/+3 |
| | | | | - Fixes another small leak. | ||||
* | hle: kernel: KThread: Rework dummy threads & fix memory leak. | bunnei | 2021-03-06 | 1 | -3/+3 |
| | | | | | - 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." | bunnei | 2021-03-06 | 1 | -9/+9 |
| | |||||
* | core: Switch to unique_ptr for usage of Common::Fiber. | bunnei | 2021-02-27 | 1 | -9/+9 |
| | | | | | - 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: Allocate a dummy KThread for each host thread, and use it for scheduling. | bunnei | 2021-01-29 | 1 | -3/+3 |
| | |||||
* | hle: kernel: k_scheduler: Use atomics for current_thread, etc. | bunnei | 2021-01-29 | 1 | -23/+24 |
| | |||||
* | hle: kernel: k_scheduler: Fix for single core mode. | bunnei | 2021-01-29 | 1 | -1/+2 |
| | |||||
* | hle: kernel: KScheduler: Introduce thread context_guard. | bunnei | 2021-01-29 | 1 | -3/+15 |
| | |||||
* | hle: kernel: Recode implementation of KThread to be more accurate. | bunnei | 2021-01-29 | 1 | -63/+81 |
| | |||||
* | hle: kernel: KThread: Clean up thread priorities. | bunnei | 2021-01-29 | 1 | -1/+1 |
| | |||||
* | hle: kernel: KThread: Reorganize thread priority defaults. | bunnei | 2021-01-29 | 1 | -3/+3 |
| | |||||
* | hle: kernel: KThread: Fix ThreadType definition. | bunnei | 2021-01-29 | 1 | -1/+1 |
| | |||||
* | hle: kernel: KThread: Remove thread types that do not exist. | bunnei | 2021-01-29 | 1 | -14/+13 |
| | |||||
* | core: hle: kernel: Rename Thread to KThread. | bunnei | 2021-01-29 | 1 | -35/+35 |
| | |||||
* | common/bit_util: Replace CLZ/CTZ operations with standardized ones | Lioncash | 2021-01-15 | 1 | -3/+5 |
| | | | | Makes for less code that we need to maintain. | ||||
* | hle: kernel: k_scheduler: Cleanup OnThreadPriorityChanged. | bunnei | 2021-01-11 | 1 | -4/+2 |
| | |||||
* | hle: kernel: thread: Replace ThreadStatus/ThreadSchedStatus with a single ThreadState. | bunnei | 2021-01-11 | 1 | -16/+16 |
| | | | | - This is how the real kernel works, and is more accurate and simpler. | ||||
* | core: hle: kernel: Update KSynchronizationObject. | bunnei | 2021-01-11 | 1 | -3/+2 |
| | |||||
* | hle: kernel: KScheduler: Various style fixes based on code review feedback. | bunnei | 2020-12-06 | 1 | -22/+20 |
| | |||||
* | hle: kernel: Use C++ style comments in KScheduler, etc. | bunnei | 2020-12-06 | 1 | -109/+94 |
| | |||||
* | hle: kernel: Migrate to KScopedSchedulerLock. | bunnei | 2020-12-06 | 1 | -9/+6 |
| | |||||
* | hle: kernel: Separate KScopedSchedulerLockAndSleep from k_scheduler. | bunnei | 2020-12-06 | 1 | -24/+1 |
| | |||||
* | hle: kernel: Separate KScheduler from GlobalSchedulerContext class. | bunnei | 2020-12-06 | 1 | -47/+1 |
| | |||||
* | hle: kernel: Rewrite scheduler implementation based on Mesopshere. | bunnei | 2020-12-06 | 1 | -0/+873 |