Commit Graph

69 Commits

Author SHA1 Message Date
Gliniak
b9061e6292 [LINT] Linted files + Added lint job to CI 2024-03-12 19:19:30 +01:00
disjtqz
6a08208dc8 Proper misalignment for AllocatePool, add guest object table 2023-10-14 19:29:25 +02:00
disjtqz
a7b047b2a2 Implement kernel processes 2023-10-12 22:13:40 +02:00
chss95cs@gmail.com
90c771526d "Fix" debug console, we were checking the cvar before any cvars were loaded, and the condition it checks in AttachConsole is somehow always false
Remove dead #if 0'd code in math.h

On amd64, page_size == 4096 constant, on amd64 w/ win32, allocation_granularity == 65536. These values for x86 windows havent changed over the last 20 years so this is probably safe
and gives a modest code size reduction

Enable XE_USE_KUSER_SHARED. This sources host time from KUSER_SHARED instead of from QueryPerformanceCounter, which is far faster, but only has a granularity of 100 nanoseconds.

In some games seemingly random crashes were happening that were hard to trace because
the faulting thread was actually not the one that was misbehaving, another threads stack was underflowing into the faulting thread.

Added a bunch of code to synchronize the guest stack and host stack so that if a guest longjmps the host's stack will be adjusted.
Changes were also made to allow the guest to call into a piece of an existing x64 function.

This synchronization might have a slight performance impact on lower end cpus, to disable it set enable_host_guest_stack_synchronization to false.
It is possible it may have introduced regressions, but i dont know of any yet

So far, i know the synchronization change fixes the "hub crash" in super sonic and allows the game "london 2012" to go ingame.

Removed emit_useless_fpscr_updates, not emitting these updates breaks the raiden game

MapGuestAddressToMachineCode now returns nullptr if no address was found, instead of the start of the function

add Processor::LookupModule

Add Backend::DeinitializeBackendContext
Use WriteRegisterRangeFromRing_WithKnownBound<0, 0xFFFF> in WriteRegisterRangeFromRing for inlining (previously regressed on performance of ExecutePacketType0)

add notes about flags that trap in XamInputGetCapabilities

0 == 3 in XamInputGetCapabilities

Name arg 2 of XamInputSetState

PrefetchW in critical section kernel funcs if available & doing cmpxchg

Add terminated field to X_KTHREAD, set it on termination

Expanded the logic of NtResumeThread/NtSuspendThread to include checking the type of the handle (in release, LookupObject doesnt seem to do anything with the type)
and returning X_STATUS_OBJECT_TYPE_MISMATCH if invalid. Do termination check in NtSuspendThread.

Add basic host exception messagebox, need to flesh it out more (maybe use the new stack tracking stuff if on guest thrd?)

Add rdrand patching hack, mostly affects users with nvidia cards who have many threads on zen

Use page_size_shift in more places

Once again disable precompilation! Raiden is mostly weird ppc asm which probably breaks the precompilation. The code is still useful for running the compiler over the whole of an xex in debug to test for issues
"Fix" debug console, we were checking the cvar before any cvars were loaded, and the condition it checks in AttachConsole is somehow always false

Remove dead #if 0'd code in math.h

On amd64, page_size == 4096 constant, on amd64 w/ win32, allocation_granularity == 65536. These values for x86 windows havent changed over the last 20 years so this is probably safe
and gives a modest code size reduction

Enable XE_USE_KUSER_SHARED. This sources host time from KUSER_SHARED instead of from QueryPerformanceCounter, which is far faster, but only has a granularity of 100 nanoseconds.

In some games seemingly random crashes were happening that were hard to trace because
the faulting thread was actually not the one that was misbehaving, another threads stack was underflowing into the faulting thread.

Added a bunch of code to synchronize the guest stack and host stack so that if a guest longjmps the host's stack will be adjusted.
Changes were also made to allow the guest to call into a piece of an existing x64 function.

This synchronization might have a slight performance impact on lower end cpus, to disable it set enable_host_guest_stack_synchronization to false.
It is possible it may have introduced regressions, but i dont know of any yet

So far, i know the synchronization change fixes the "hub crash" in super sonic and allows the game "london 2012" to go ingame.

Removed emit_useless_fpscr_updates, not emitting these updates breaks the raiden game

MapGuestAddressToMachineCode now returns nullptr if no address was found, instead of the start of the function

add Processor::LookupModule

Add Backend::DeinitializeBackendContext
Use WriteRegisterRangeFromRing_WithKnownBound<0, 0xFFFF> in WriteRegisterRangeFromRing for inlining (previously regressed on performance of ExecutePacketType0)

add notes about flags that trap in XamInputGetCapabilities

0 == 3 in XamInputGetCapabilities

Name arg 2 of XamInputSetState

PrefetchW in critical section kernel funcs if available & doing cmpxchg

Add terminated field to X_KTHREAD, set it on termination

Expanded the logic of NtResumeThread/NtSuspendThread to include checking the type of the handle (in release, LookupObject doesnt seem to do anything with the type)
and returning X_STATUS_OBJECT_TYPE_MISMATCH if invalid. Do termination check in NtSuspendThread.

Add basic host exception messagebox, need to flesh it out more (maybe use the new stack tracking stuff if on guest thrd?)

Add rdrand patching hack, mostly affects users with nvidia cards who have many threads on zen

Use page_size_shift in more places

Once again disable precompilation! Raiden is mostly weird ppc asm which probably breaks the precompilation. The code is still useful for running the compiler over the whole of an xex in debug to test for issues
2022-11-27 09:39:33 -08:00
Gliniak
1d00372e6b Merge branch 'master' of https://github.com/xenia-project/xenia into canary_experimental 2022-07-10 10:50:39 +02:00
Triang3l
d51fafd07c [Base] Linux Arm64 exception handler 2022-07-05 20:46:49 +03:00
Gliniak
371441ec3a [XModule] Remove module and its functions while unloading 2021-12-27 09:18:44 +01:00
Joel Linn
a86d7173e1 Refactor FourCC magic uses
- Use new fourcc_t type
- Improves compiler compatibility by removing multi chars
2021-06-02 22:28:43 -05:00
gibbed
5bf0b34445 C++17ification.
C++17ification!

- Filesystem interaction now uses std::filesystem::path.
- Usage of const char*, std::string have been changed to
  std::string_view where appropriate.
- Usage of printf-style functions changed to use fmt.
2020-04-07 16:09:41 -05:00
Jonathan Goyvaerts
c1af632562 Replace all gflag implementations with cvar implementations 2019-08-03 02:34:07 +02:00
DrChat
d43e2c7ff8 xenia-cpu-ppc-tests is now building on linux 2017-02-10 23:54:10 -06:00
Dr. Chat
4c55039c22 Remove xenia-cpu dependency on xenia-kernel 2017-02-06 21:57:18 -06:00
Ben Vanik
6777ce6668 Reconcile debugger and save state stuff into a single implementation.
Fixes #497 and fixes #496.
Still rough edges, but at least less duplication.
2016-01-18 11:48:21 -08:00
Dr. Chat
41d5b41523 Automatically install any CPU breakpoints in any newly-defined functions if necessary. 2015-12-29 12:32:01 -08:00
Dr. Chat
28468f8a18 cpu::Processor now tracks a pointer to the emulator. 2015-12-29 12:32:00 -08:00
Dr. Chat
7d59258839 Processor::ExecuteRaw
Changed the breakpoint lock to a recursive mutex.
2015-12-29 12:28:57 -08:00
Dr. Chat
e383e2f101 Processor breakpoint support 2015-12-29 12:28:56 -08:00
Ben Vanik
15816327b4 Renaming xe::cpu::frontend to xe::cpu::ppc. 2015-12-14 21:17:55 -08:00
Ben Vanik
3c96b6fa0a DANGER DANGER. Switching to global critical region.
This changes almost all locks held by guest threads to use a single global
critical region. This emulates the behavior on the PPC of disabling
interrupts (by calls like KeRaiseIrqlToDpcLevel or masking interrupts),
and prevents deadlocks from occuring when threads are suspended or
otherwise blocked.
This has performance implications and a pass is needed to ensure the
locking is as granular as possible. It could also break everything
because it's fundamentally unsound. We'll see.
2015-09-06 09:30:54 -07:00
Ben Vanik
f5e374f9b5 Changing the way the global lock works. Some things are better, I think.
Regressions are likely.
2015-09-01 09:45:32 -07:00
Ben Vanik
5e08889d93 More style cleanup. 2015-08-06 20:17:01 -07:00
Ben Vanik
eaa1a8ee3a Refactoring SymbolInfo/FunctionInfo/Function into Symbol/Function. 2015-08-05 21:50:02 -07:00
Ben Vanik
e657276996 Mostly working stack walking (besides issue #372). 2015-07-29 00:15:52 -07:00
Ben Vanik
d01abd4694 Starting debugger rework, adding base async socket, removing flatbuffers. 2015-07-22 00:01:36 -07:00
Ben Vanik
ecd4af10c9 Fixing some clang warnings/errors. 2015-07-15 23:26:58 -07:00
Ben Vanik
dbcdc5b543 Function lookup is slow - replacing with a faster test. 2015-06-08 23:44:38 -07:00
Ben Vanik
6b52f6715a Adding tests for branch/carry and logging disasm on test failure. 2015-06-06 10:59:43 -07:00
Ben Vanik
9c3d2b54fb Cleanup before kernel export refactor. 2015-05-31 16:31:19 -07:00
Ben Vanik
41cee3d337 Switching vsync to custom thread. 2015-05-25 21:12:27 -07:00
Ben Vanik
f5a2b85d42 Switching to xe::mutex. 2015-05-25 00:52:21 -07:00
Ben Vanik
576d6492dc Basic debugger networking. 2015-05-25 00:51:22 -07:00
Ben Vanik
94c62b91d0 --trace_functions and --trace_function_coverage 2015-05-05 22:44:36 -07:00
Ben Vanik
ade5388728 bool-ifying xe::cpu 2015-05-05 18:52:54 -07:00
Ben Vanik
499bed21c0 Moving debugger. 2015-05-05 18:52:53 -07:00
Ben Vanik
78921c1a7e Merging Runtime into Processor. 2015-05-03 22:28:25 -07:00
Ben Vanik
642259e16f Code cleanup: moving ExportResolver to xe::cpu 2015-05-02 02:11:11 -07:00
Ben Vanik
30f7effa73 Code cleanup: removing common.h 2015-05-02 01:25:59 -07:00
Ben Vanik
281abea955 Converting addresses in xe::cpu to 32bit. 2015-03-24 19:41:29 -07:00
Ben Vanik
9281d62106 Moving cpu/runtime/ to cpu/. 2015-03-24 08:25:58 -07:00
Ben Vanik
00e4a4fe1b Fix #include format. 2015-01-31 22:49:47 -08:00
Ben Vanik
a0eebf8898 Removing old run loop/ref/core/etc. 2014-12-31 19:26:51 -08:00
Ben Vanik
a337ce33ed Getting ppc tests building again (big surprise: they are failing). 2014-09-09 20:25:38 -07:00
Ben Vanik
6f802c2432 Fixing many clang warnings. 2014-08-21 23:10:08 -07:00
Ben Vanik
244e8a8745 Removing the last of XEDECLARECLASS. 2014-08-20 22:50:10 -07:00
Ben Vanik
48a0e5c601 Shrinking alloy memory interface so that alloy-sandbox doesn't need xe. 2014-08-19 21:02:15 -07:00
Ben Vanik
bca49bed4b Removing xe_mutex_t. 2014-08-16 00:56:50 -07:00
Ben Vanik
296bb5c87a Dummy IRQL stuff to silence warnings. 2014-08-04 15:39:42 -07:00
Ben Vanik
6b197c4c92 Removing the debugger and dependencies. Needs rethinking. 2014-07-09 21:21:40 -07:00
Ben Vanik
d5f27dbf34 Better arg passing for Execute and experimenting with APCs. 2014-07-02 15:39:49 -07:00
Ben Vanik
0e3854555d Pure dynamic MMIO access. Prep for more complex GPU memory management. 2014-06-01 23:36:18 -07:00