Commit graph

44 commits

Author SHA1 Message Date
Liam 45c87c7e6e core: refactor emulated cpu core activation 2023-12-04 10:37:16 -05:00
GPUCode 1cde01c8c8 arm: Print backtrace on data abort 2023-11-25 00:47:36 -05:00
Liam e3b510a4b4 core: check for thread dpc before eret 2023-11-13 11:28:23 -05:00
Liam 8c59543ee3 kernel: update KProcess 2023-10-21 20:03:41 -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 82568412f6 arm_interface: correct breakpoint rewind condition 2023-07-09 12:03:25 -04:00
Liam 8506915208 core: decouple ARM interface from Dynarmic 2023-06-12 22:11:51 -04:00
Liam 41d99aa89d memory: rename global memory references to application memory 2023-03-23 20:28:47 -04:00
Liam fb49ec19c1 kernel: use KTypedAddress for addresses 2023-03-22 09:35:16 -04:00
Liam ceda2d280e general: rename CurrentProcess to ApplicationProcess 2023-02-13 19:03:12 -05:00
Kelebek1 42b16bb33a Be careful of mangled out of bounds read 2023-01-14 19:53:55 +00:00
Kelebek1 80a55c1663 Add stacktrace symbol demangling 2023-01-14 04:43:21 +00:00
Liam 6072b22a0b core: add option to break on unmapped access 2022-12-02 08:25:45 -05:00
bunnei 57a77e9ff4 core: hle: kernel: k_thread: Implement thread termination DPC. 2022-10-18 19:13:34 -07:00
Morph 591d1f1b09
Merge pull request #8549 from liamwhite/kscheduler-sc
kernel: use KScheduler from Mesosphere
2022-07-25 12:00:31 -04:00
Merry 40e39ddd46 dynarmic: Abort watchpoints ASAP 2022-07-15 10:03:30 +01:00
Liam 0624c880bd kernel: use KScheduler from mesosphere 2022-07-14 22:47:18 -04:00
Mai 313f047f97
Merge pull request #8501 from liamwhite/backtrace-again
core/arm: better support for backtrace generation
2022-07-07 23:49:54 -04:00
Morph 78ce053b4d
Merge pull request #8490 from liamwhite/read-code-stop
dynarmic: Stop ReadCode callbacks to unmapped addresses
2022-06-30 20:57:39 -07:00
Liam 8f8c0b69dc core/arm: better support for backtrace generation 2022-06-25 12:54:24 -04:00
Liam 2c56e94702 kernel: make current thread pointer thread local 2022-06-23 00:28:00 -04:00
Liam 1fd194141a dynarmic: Stop ReadCode callbacks to unmapped addresses 2022-06-21 20:01:43 -04:00
Liam 208ed712f4 core/debugger: memory breakpoint support 2022-06-16 13:18:07 -04:00
Liam 20eab9fed9 core: centralize profile scope for Dynarmic 2022-06-14 18:19:04 -04:00
Liam 989d4a7a41 core/debugger: Improved stepping mechanism and misc fixes 2022-06-01 02:15:15 -04:00
Liam fb4b3c127f core/debugger: Implement new GDB stub debugger 2022-06-01 00:01:25 -04:00
Morph 99ceb03a1c general: Convert source file copyright comments over to SPDX
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.
2022-04-23 05:55:32 -04:00
Liam 0ca4dff62c core/arm: separate backtrace collection 2022-04-20 21:39:42 -04:00
Liam b29242862b core: extract symbol reading 2022-04-09 02:16:34 -04:00
Lioncash 5553bd3ba2 General: Resolve a few missing initializer warnings
Resolves a few -Wmissing-initializer warnings.
2020-10-29 19:37:07 -04:00
bunnei 3d592972dc
Revert "core: Fix clang build" 2020-10-20 19:07:39 -07:00
Lioncash be1954e04c core: Fix clang build
Recent changes to the build system that made more warnings be flagged as
errors caused building via clang to break.

Fixes #4795
2020-10-17 19:50:39 -04:00
Fernando Sahmkow 7b18174eef ARM/WaitTree: Better track the CallStack for each thread. 2020-06-27 11:35:54 -04:00
bunnei 4caff51710 core: memory: Move to Core::Memory namespace.
- helpful to disambiguate Kernel::Memory namespace.
2020-04-17 00:59:28 -04:00
Lioncash 1c340c6efa CMakeLists: Specify -Wextra on linux builds
Allows reporting more cases where logic errors may exist, such as
implicit fallthrough cases, etc.

We currently ignore unused parameters, since we currently have many
cases where this is intentional (virtual interfaces).

While we're at it, we can also tidy up any existing code that causes
warnings. This also uncovered a few bugs as well.
2020-04-15 21:33:46 -04:00
Lioncash b05bfc6036 core/memory: Migrate over Read{8, 16, 32, 64, Block} to the Memory class
With all of the trivial parts of the memory interface moved over, we can
get right into moving over the bits that are used.

Note that this does require the use of GetInstance from the global
system instance to be used within hle_ipc.cpp and the gdbstub. This is
fine for the time being, as they both already rely on the global system
instance in other functions. These will be removed in a change directed
at both of these respectively.

For now, it's sufficient, as it still accomplishes the goal of
de-globalizing the memory code.
2019-11-26 21:55:39 -05:00
Lioncash 536fc7f0ea core: Prepare various classes for memory read/write migration
Amends a few interfaces to be able to handle the migration over to the
new Memory class by passing the class by reference as a function
parameter where necessary.

Notably, within the filesystem services, this eliminates two ReadBlock()
calls by using the helper functions of HLERequestContext to do that for
us.
2019-11-26 21:55:37 -05:00
Zach Hilman b77fde7c5c loader: Move NSO module tracking to AppLoader
Also cleanup of general stuff
2019-05-26 11:40:46 -04:00
Zach Hilman 5574be21cc arm_interface: Expand backtrace generation
Returns results as a vector of entries for further processing. Logs addresses, offsets, and mangled name.
2019-05-25 16:06:53 -04:00
Lioncash 039e58a984 arm_interface: Make include path relative for arm_interface.h
Makes it consistent with the rest of the includes.
2018-12-30 20:46:29 -05:00
Lioncash a17dd30057 arm_interface: Make LogBacktrace() a const member function
This function doesn't modify instance state, so it can be made const.
2018-12-30 20:44:48 -05:00
Lioncash 776ce5d74c arm_interface: Mark variables as const where applicable in LogBacktrace()
Two of these variables have fixed values, so we can make that
immediately obvious from the get-go.
2018-12-30 20:43:17 -05:00
Lioncash 387bffda5e arm_interface: Remove unnecessary semicolon
Namespaces don't require the use of a semicolon. Silences a -Wextra-semi
warning.
2018-12-30 20:41:33 -05:00
David Marcec 22d4e10664 Moved log backtrace to arm_interface.cpp. Added printing of error code to fatal 2018-12-29 12:55:19 +11:00