Commit graph

110 commits

Author SHA1 Message Date
05ae6b965b
[meta] fix license headers
Signed-off-by: lizzie <lizzie@eden-emu.dev>
2025-09-21 15:01:43 +00:00
9d2681ecc9
[cmake] enable clang-cl and WoA builds (#348)
Compilation and CMake fixes for both Windows on ARM and clang-cl, meaning Windows can now be built on both MSVC and clang on both amd64 and aarch64.

Compiling on clang is *dramatically* faster so this should be useful for CI.

Co-authored-by: crueter <crueter@eden-emu.dev>
Co-authored-by: crueter <crueter@crueter.xyz>
Reviewed-on: #348
Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
Reviewed-by: crueter <crueter@eden-emu.dev>
Co-authored-by: lizzie <lizzie@eden-emu.dev>
Co-committed-by: lizzie <lizzie@eden-emu.dev>
2025-09-09 20:47:49 +02:00
Liam
5942df75fb kernel: clear pinned waiter list on unpin 2024-01-27 22:53:49 -05:00
Merry
d4bb92866b KThread: Send termination interrupt to all cores a thread has affinity to
KThread::RequestTerminate may run from a thread which is not the CurrentCore, and thus
masking this out is erroneous.
2024-01-02 21:34:34 +00:00
Liam
1fdcd70bad general: properly support multiple memory instances 2023-12-22 21:52:49 -05:00
Liam
3d5c6a73cb core: refactor emulated cpu core activation 2023-12-04 10:37:16 -05:00
Liam
f0c6de7dd2 kernel: signal thread on termination completed 2023-10-21 20:03:41 -04:00
Liam
c00faac482 kernel: add missing TLR clear 2023-10-21 20:03:41 -04:00
Liam
62e106dbe8 kernel: update KProcess 2023-10-21 20:03:41 -04:00
liamwhite
a28a0c47f8 Merge pull request #10990 from comex/ubsan
Fixes and workarounds to make UBSan happier on macOS
2023-07-26 10:33:28 -04:00
lat9nq
30e4e8c2f4 general: Silence -Wshadow{,-uncaptured-local} warnings
These occur in the latest commits in LLVM Clang.
2023-07-18 19:31:35 -04:00
comex
85d77f636c Fixes and workarounds to make UBSan happier on macOS
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.
2023-07-15 12:00:28 -07:00
Kelebek1
c7430e51e3 Remove memory allocations in some hot paths 2023-06-22 08:05:10 +01:00
lat9nq
59236a458c k_thread: Use a mutex and cond_var to sync bool
std::atomic<bool> is broken on MinGW and causes deadlocks there.
Use a normal cond var in its stead.
2023-06-17 15:25:36 -04:00
Liam
6eaef51cf2 memory: rename global memory references to application memory 2023-03-23 20:28:47 -04:00
Liam
156516e399 kernel: use KTypedAddress for addresses 2023-03-22 09:35:16 -04:00
Liam
9d5747fb71 kernel: additional style fixes to KThread, KProcess 2023-03-12 22:10:27 -04:00
Liam
46d09ae364 kernel: convert KThread to new style 2023-03-12 22:09:09 -04:00
Liam
d0e11c27d9 kernel: prefer std::addressof 2023-03-12 22:09:09 -04:00
Liam
cf0b407daa kernel: remove kernel_ 2023-03-12 22:09:09 -04:00
liamwhite
e70d580897 Merge pull request #9923 from liamwhite/kht
kernel: add timer pointer to KThreadQueue
2023-03-10 16:19:41 -05:00
Liam
46a6277709 kernel: add timer pointer to KThreadQueue 2023-03-07 20:51:29 -05:00
Liam
1484a6536d kernel: clone fpu status on CreateThread 2023-03-07 19:18:06 -05:00
Liam
63414faea4 kernel: be more careful about kernel address keys 2023-03-01 10:42:45 -05:00
Liam
f4e795193b kernel: refactor priority inheritance to represent locks as C++ objects 2023-03-01 10:42:45 -05:00
Liam
1c3a93e7c4 service: refactor server architecture
Converts services to have their own processes
2023-02-21 12:19:25 -05:00
Liam
832e1e2ca4 kernel: use GetCurrentProcess 2023-02-13 11:05:14 -05:00
Liam
b85a155abd kernel: split SetAddressKey into user and kernel variants 2023-01-23 20:31:03 -05:00
Liam
31945a6e8b kernel: fix incorrect locking order in suspension 2023-01-23 17:14:41 -05:00
Liam
affd5c32f9 kernel/svc_types: refresh 2022-11-09 19:05:08 -05:00
Liam
c835c254a3 service_thread: register service threads to the logical owner process 2022-11-04 09:18:57 -04:00
Liam
e9589c859d k_thread: fix single core 2022-10-30 18:44:29 -04:00
Liam
3980952ab8 kernel: refactor dummy thread wakeups 2022-10-24 19:52:01 -04:00
bunnei
4c2274b2c1 core: hle: kernel: Use result macros for new/changed code. 2022-10-18 19:13:35 -07:00
bunnei
97e4cd1c8f core: hle: kernel: k_thread: Implement thread termination DPC. 2022-10-18 19:13:34 -07:00
Liam
dbb1312876 kernel: Ensure all uses of disable_count are balanced 2022-07-14 22:47:18 -04:00
Liam
e2be660909 kernel: be more careful about initialization path for HLE threads 2022-07-14 22:47:18 -04:00
Liam
21e2063d7d kernel: fix single-core preemption points 2022-07-14 22:47:18 -04:00
Liam
61b26b386d kernel: fix issues with single core mode 2022-07-14 22:47:18 -04:00
Liam
e47bced65d kernel: use KScheduler from mesosphere 2022-07-14 22:47:18 -04:00
Liam
12948cf615 kernel: fix usage of waiter_list in Finalize 2022-07-09 18:54:54 -04:00
liamwhite
79d631b630 Merge pull request #8502 from liamwhite/end-wait
kernel: clean up waiting implementation
2022-07-07 17:31:49 -04:00
Liam
e551960935 common/fiber: make fibers easier to use 2022-07-02 12:33:49 -04:00
german77
c7890ebccc core: Replace all instances of ResultCode with Result 2022-06-26 20:21:37 -05:00
Liam
f70a3ada00 kernel: clean up waiting implementation 2022-06-25 13:36:14 -04:00
Liam
83f1ecb73b kernel: make current thread pointer thread local 2022-06-23 00:28:00 -04:00
bunnei
3f3f5aa93b Merge pull request #8483 from liamwhite/fire-emblem-three-semaphores
kernel: wait for threads to stop on pause
2022-06-22 14:46:33 -07:00
Liam
808ad9eb9f kernel: wait for threads to stop on pause 2022-06-18 16:54:33 -04:00
Liam
6d5cc6b2a2 kernel: fix some uses of disable_count 2022-06-15 20:53:49 -04:00
Liam
59a6d88625 kernel: implement KProcess suspension 2022-06-14 10:04:11 -04:00