Commit graph

2344 commits

Author SHA1 Message Date
Liam
b30e19ba24 fix apple clang build again 2023-11-14 11:53:02 -05:00
Liam
a6735cba5f k_capabilities: ignore map region when KTrace is disabled 2023-11-11 10:45:43 -05:00
Liam
875246f5b2 k_page_table: fix shutdown 2023-11-10 12:01:35 -05:00
Liam
b16fefa106 k_page_table: use more precise icache invalidates 2023-11-10 12:01:35 -05:00
Liam
2a255b2d61 kernel: add KPageTableBase
Co-authored-by: Kelebek1 <eeeedddccc@hotmail.co.uk>
2023-11-10 12:01:35 -05:00
Liam
31bffc7299 kernel: fix extraneous ref 2023-10-21 22:16:41 -04:00
Liam
dcfe674ed4 kernel: signal thread on termination completed 2023-10-21 20:03:41 -04:00
Liam
bb195c2c2b kernel: add missing TLR clear 2023-10-21 20:03:41 -04:00
Liam
8c59543ee3 kernel: update KProcess 2023-10-21 20:03:41 -04:00
Fernando S
2e760a9833
Merge pull request #11748 from liamwhite/kern_1700
kernel: update for 17.0.0
2023-10-20 17:08:00 +02:00
Liam
249db0a59b kernel: fix incorrect calculation of used non system memory value 2023-10-20 09:12:10 -04:00
Liam
687158fe00 kernel: fix format string error 2023-10-20 02:41:32 -04:00
Liam
d8507332c1 kernel: make check fully constexpr for broken msvc constant folding 2023-10-20 02:34:15 -04:00
Liam
f21058a6c0 k_page_table: add MapFirstGroup 2023-10-20 02:34:15 -04:00
Liam
b456af31e6 kernel: update KMemoryRegionType values 2023-10-20 02:34:15 -04:00
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