Commit graph

2329 commits

Author SHA1 Message Date
Liam
0441853d0f k_page_table: implement PermissionLocked 2023-10-20 02:34:15 -04:00
Liam
60a1c6b95b k_page_table: add new CheckMemoryState helper 2023-10-20 02:34:15 -04:00
Liam
794e6c7a96 kernel: split Io memory state, add PermissionLocked attribute 2023-10-20 02:34:15 -04:00
Liam
22afa2c7a3 kernel: reshuffle ini1 size, add slab clear note 2023-10-20 02:34:15 -04:00
liamwhite
c00b63b9e1
Merge pull request #11766 from liamwhite/open-sesame
k_page_table: add missing page group open when locking memory
2023-10-13 09:29:05 -04:00
Liam
c4ec76edba k_page_table: add missing page group open when locking memory 2023-10-12 15:00:26 -04:00
Liam
2212c9653d kernel: mark TLS accessors as noinline for non-MSVC LTO 2023-10-12 09:16:22 -04:00
Liam
e797a917a9 kernel: implement transfer memory 2023-10-04 22:32:27 -04:00
Liam
0448eb6f0f ci: fix new codespell errors 2023-10-02 18:03:05 -04:00
Liam
8fb13372c2 k_page_table: skip page table clearing on finalization 2023-10-01 23:38:56 -04:00
Kelebek1
8992a62da4 Reduce core timing mutex contention 2023-09-19 23:10:03 +01:00
Liam
3ef9673360 core: improve debug workflow 2023-09-14 16:44:15 -04:00
Danila Malyutin
785e480b62 msvc: set warning level to /W4 globally
And fix a bunch of warnings
2023-09-03 18:42:10 +04:00
liamwhite
18ad55be0b
kernel: offset code entry point for 39-bit address space type (#11326) 2023-08-25 23:59:32 +02:00
Liam
0bd9a4456c kernel: remove relative task registration 2023-08-14 18:12:06 -04:00
Liam
84cb20bc72 core: remove ResultVal type 2023-08-08 11:09:37 -04:00
liamwhite
fca7d975fd
Merge pull request #10839 from lat9nq/pgc-plus
general: Reimplement per-game configurations
2023-08-02 14:25:52 -04:00
liamwhite
d3da1e6517
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
9f3f615e05 core: reduce TOCTTOU memory access 2023-07-22 11:19:29 -04:00
liamwhite
b1aed2c5b7
Merge pull request #11094 from liamwhite/get
kernel: misc cleanup of page table accessors
2023-07-22 11:17:36 -04:00
Liam
05bc024260 core: remove remaining uses of dynamic_cast 2023-07-21 19:37:29 -04:00
lat9nq
8e91554e11 k_system_control: Always return some memory size 2023-07-21 10:56:55 -04:00
lat9nq
127b3da0f1 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
4133165607 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
71b3b2a2f0 general: Silence -Wshadow{,-uncaptured-local} warnings
These occur in the latest commits in LLVM Clang.
2023-07-18 19:31:35 -04:00
comex
d7c532d889 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
474db2d8da kernel: reduce page table region checking 2023-07-14 22:33:10 -04:00
Liam
a85ce8ea56 k_process: PageTable -> GetPageTable 2023-07-14 21:43:15 -04:00
Liam
4540bcfaf7 k_server_session: translate special header for non-HLE requests 2023-07-08 01:01:49 -04:00
Morph
b94e576653 kernel: Synchronize 2023-07-01 16:21:22 -04:00
Kelebek1
5da70f7197 Remove memory allocations in some hot paths 2023-06-22 08:05:10 +01:00
bunnei
e3122c5b46
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
e34e1b1c95 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
2e1e725443 core_timing: Fix SingleCore cycle timer 2023-06-07 21:44:42 -04:00
Morph
8e56a84566 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
7cdeaa90af device_memory: Use smaller virtual reservation size for compatibility with 39-bit paging 2023-06-03 00:05:28 -07:00
Liam
5e3b3c6643 k_memory_block_manager: remove auditing calls 2023-05-23 09:15:16 -04:00
bunnei
737e1ca101
Merge pull request #10117 from liamwhite/sync-register
kernel: match calls to Register and Unregister
2023-05-03 09:07:19 -07:00
Morph
627022bef9
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
2cd9e1ecb6 settings: rename extended memory layout to unsafe, move from general to system 2023-04-30 14:24:22 -04:00
Liam
b143ce8134 kernel: remove general boost lists 2023-04-29 22:11:32 -04:00
Liam
1b5c87ab6a kernel: match calls to Register and Unregister 2023-04-29 21:52:26 -04:00
Liam
baf4d1c22e kernel: move more memory to application in 8GB arrangement 2023-04-09 19:50:27 -04:00
Liam
abb785f269 kernel: switch extended memory setting to 8GB arrangement 2023-04-08 17:47:26 -04:00
Liam
9efd95cda5 kernel: fix unbounded stack usage in atomics 2023-03-28 22:28:27 -04:00
Liam
41d99aa89d memory: rename global memory references to application memory 2023-03-23 20:28:47 -04:00
liamwhite
c41a4baf06
Merge pull request #9964 from liamwhite/typed-address
kernel: use KTypedAddress for addresses
2023-03-23 10:00:19 -04:00
Liam
fb49ec19c1 kernel: use KTypedAddress for addresses 2023-03-22 09:35:16 -04:00
Liam
43d909949e kernel: fix LOG_TRACE in ipc 2023-03-19 10:02:20 -04:00
Liam
c352381ce9 kernel: additional style fixes to KThread, KProcess 2023-03-12 22:10:27 -04:00