Commit graph

2313 commits

Author SHA1 Message Date
liamwhite
28b236b988 Merge pull request #10839 from lat9nq/pgc-plus
general: Reimplement per-game configurations
2023-08-02 14:25:52 -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
Liam
46234254b1 core: reduce TOCTTOU memory access 2023-07-22 11:19:29 -04:00
liamwhite
de2fb523e3 Merge pull request #11094 from liamwhite/get
kernel: misc cleanup of page table accessors
2023-07-22 11:17:36 -04:00
Liam
545880f71b core: remove remaining uses of dynamic_cast 2023-07-21 19:37:29 -04:00
lat9nq
c1fa82a168 k_system_control: Always return some memory size 2023-07-21 10:56:55 -04:00
lat9nq
e952af53be core,common: Give memory layout setting an enum
Allows for 6GB and 8GB layouts to be selected.
2023-07-21 10:56:55 -04:00
lat9nq
bd8630531e settings,core,config_sys: Remove optional type from custom_rtc, rng_seed
core: Fix MSVC errors
2023-07-21 10:56:07 -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
Liam
b47ce23b31 kernel: reduce page table region checking 2023-07-14 22:33:10 -04:00
Liam
6b6f0b21b9 k_process: PageTable -> GetPageTable 2023-07-14 21:43:15 -04:00
Liam
ac90cfb927 k_server_session: translate special header for non-HLE requests 2023-07-08 01:01:49 -04:00
Morph
abe7f7c0a0 kernel: Synchronize 2023-07-01 16:21:22 -04:00
Kelebek1
c7430e51e3 Remove memory allocations in some hot paths 2023-06-22 08:05:10 +01:00
bunnei
72a469b967 Merge pull request #10086 from Morph1984/coretiming-ng-1
core_timing: Use CNTPCT as the guest CPU tick
2023-06-21 21:12:46 -07: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
Morph
52a219cfe9 core_timing: Fix SingleCore cycle timer 2023-06-07 21:44:42 -04:00
Morph
2856fadaa0 core_timing: Use CNTPCT as the guest CPU tick
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.
2023-06-07 21:44:42 -04:00
Liam
120b8baebb device_memory: Use smaller virtual reservation size for compatibility with 39-bit paging 2023-06-03 00:05:28 -07:00
Liam
d23a532bf4 k_memory_block_manager: remove auditing calls 2023-05-23 09:15:16 -04:00
bunnei
dd78368441 Merge pull request #10117 from liamwhite/sync-register
kernel: match calls to Register and Unregister
2023-05-03 09:07:19 -07:00
Morph
069637f4ff Merge pull request #10124 from liamwhite/pebkac
settings: rename extended memory layout to unsafe, move from general to system
2023-05-03 10:52:45 -04:00
Liam
bdaf10ec9e settings: rename extended memory layout to unsafe, move from general to system 2023-04-30 14:24:22 -04:00
Liam
370a0526a5 kernel: remove general boost lists 2023-04-29 22:11:32 -04:00
Liam
7afcc29ac8 kernel: match calls to Register and Unregister 2023-04-29 21:52:26 -04:00
Liam
07d060c2d4 kernel: move more memory to application in 8GB arrangement 2023-04-09 19:50:27 -04:00
Liam
bfd120b543 kernel: switch extended memory setting to 8GB arrangement 2023-04-08 17:47:26 -04:00
Liam
7121903f4a kernel: fix unbounded stack usage in atomics 2023-03-28 22:28:27 -04:00
Liam
6eaef51cf2 memory: rename global memory references to application memory 2023-03-23 20:28:47 -04:00
liamwhite
2b74ab00aa Merge pull request #9964 from liamwhite/typed-address
kernel: use KTypedAddress for addresses
2023-03-23 10:00:19 -04:00
Liam
156516e399 kernel: use KTypedAddress for addresses 2023-03-22 09:35:16 -04:00
Liam
48f1221b35 kernel: fix LOG_TRACE in ipc 2023-03-19 10:02:20 -04:00
Liam
9d5747fb71 kernel: additional style fixes to KThread, KProcess 2023-03-12 22:10:27 -04:00
Liam
6828f66b42 kernel: fix clang build 2023-03-12 22:10:27 -04:00
Liam
a0867d72ed kernel: remove unnecessary finalize calls 2023-03-12 22:10:27 -04:00
Liam
b8da5b73b2 kernel: convert KProcess to new style 2023-03-12 22:09: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
24077ea160 kernel: convert KResourceLimit 2023-03-12 22:09:09 -04:00
Liam
cf0b407daa kernel: remove kernel_ 2023-03-12 22:09:09 -04:00
Liam
3280ebac7e kernel: remove gratitutous attribute usage 2023-03-12 22:09:09 -04:00
Liam
0c6375446c kernel/svc: convert to new style 2023-03-12 22:09:08 -04:00
Liam
767059b620 kernel: convert miscellaneous 2023-03-12 22:06:53 -04:00
Liam
7893136e74 kernel: conver KScopedLock, KScopedResourceReservation, KSessionRequest, KSharedMemory, KSpinLock 2023-03-12 22:06:53 -04:00
Liam
d41368663b kernel: convert KAbstractSchedulerLock 2023-03-12 22:06:53 -04:00
Liam
8c137e234f kernel: convert KMemoryLayout, KMemoryRegion*, KPageTableSlabHeap, KPriorityQueue 2023-03-12 22:06:53 -04:00
Liam
c72afbd1db kernel: move KMemoryLayout for NX board 2023-03-12 22:06:53 -04:00
Liam
842f5a4ced kernel: remove KLinkedList 2023-03-12 22:06:53 -04:00
Liam
01e79d9399 kernel: convert KConditionVariable, KLightConditionVariable, KLightLock 2023-03-12 22:06:53 -04:00