Commit Graph

55 Commits

Author SHA1 Message Date
Joel Linn
986dcf4f65 [Base] Check success of sync primitive creation
- Mainly use `assert`s, since failure is very rare
- Forward failure of `CreateSemaphore` to guests because it is more easy
  to trigger with invalid initial parameters.
2022-03-08 12:17:57 -06:00
Wunkolo
1a8068b151 [Base] Add user-literals for several memory sizes
Rather than using `n * 1024 * 1024`, this adds a convenient `_MiB`/`_KiB` user-literal to the new `literals.h` header to concisely describe units of memory in a much more readable way. Any other useful literals can be added to this header. These literals exist in the `xe::literals` namespace so they are opt-in, similar to `std::chrono` literals, and require a `using namespace xe::literals` statement to utilize it within the current scope.

I've done a pass through the codebase to replace trivial instances of `1024 * 1024 * ...` expressions being used but avoided anything that added additional casting complexity from `size_t` to `uint32_t` and such to keep this commit concise.
2022-01-02 11:51:31 -06:00
Triang3l
6ce5330f5f [UI] Loop thread to main thread WindowedAppContext 2021-08-28 19:38:24 +03:00
Gliniak
e9f1a534df [Kernel/Thread] Changed default stack location 2021-06-25 23:45:23 -05:00
emoose
052ce3d389 [Kernel] Make KeEnter/LeaveCriticalRegion only affect the caller thread
Adds a new X_KTHREAD::apc_disable_count field at 0xB0 into X_KTHREAD based on where 360 kernel seems to store it, and made CriticalRegion funcs act on that, instead of locking things between all threads, and changes DeliverAPCs to check that field before running the APCs.

XThread::LockApc/UnlockApc were also updated too as those previously called into EnterCrit/LeaveCrit to work, but AFAIK the code that uses LockApc/UnlockApc does have an actual need for locking between threads, so changed them to work on XThread::global_critical_region_ directly instead.
2021-06-25 23:11:14 -05: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
1513dd235b [Kernel] Code reentrance for guest fibers.
[Kernel] Code reentrance using exceptions for guest fibers.
2020-12-05 14:17:33 -06:00
gibbed
164aa8e8ca [Kernel] Scope object type enum. 2020-11-22 20:34:07 -06:00
Triang3l
b7ba3051f2 [Kernel] Fix null in thread affinity init + ignore affinity when less than 6 cores 2020-11-16 23:15:51 +03:00
Triang3l
a319617185 [Kernel] Thread affinity cleanup 2020-11-14 18:09:47 +03:00
Gliniak
2dc6b0b2ad [Kernel/Thread] Added missing paramteter to KeSetAffinityThread 2020-11-14 17:48:30 +03:00
gibbed
a48bb71c2f Overhaul logging. 2020-04-07 16:09:41 -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
Joel Linn
7e244e0488 [Base] Clock state now unaltered by threading.
- Removed tick and time values from ThreadSavedState.
- Removed affiliated get/set code from Save and Restore.
- Removed dangerous SetGuestTickCount method.
2019-12-01 17:11:58 -06:00
Silent
c5db959154 [Kernel] Retain handles and not objects in XThread
This fixes cases introduced by 52e836d0f81e752ba368717e68773b591adfa9cf
where thread handles get closed before the thread finishes.
Handle was assumed to be alive there, which was not true as
threads self-referenced only their objects, not their handles.

Affected games: Payday 2 Demo
2019-11-30 20:08:30 -06:00
Jonathan Goyvaerts
c1af632562 Replace all gflag implementations with cvar implementations 2019-08-03 02:34:07 +02:00
gibbed
7c7d80103e [Kernel] Use type constant instead of type enum when calling base constructor. 2019-07-29 13:53:44 -05:00
gibbed
18d8a59cfa [Kernel] Initialize COM on all new XThreads. 2019-04-19 04:02:32 -05:00
Margen67
896ac4a682 Update documentation.
- Convert http to https, provide archive link when possible.
- Made CPU-JIT.png more readable on dark themes;
Added a white background so there isn't black text on a black
background.
2018-11-22 09:20:09 -06:00
DrChat
11ae05155d Fix casting between XThread and Thread causing pointer misalignment 2017-02-10 23:35:35 -06:00
Dr. Chat
4c55039c22 Remove xenia-cpu dependency on xenia-kernel 2017-02-06 21:57:18 -06:00
gibbed
dd18112905 Assert the CPU index on set. 2016-06-20 12:53:07 -05:00
gibbed
27610989a2 Fixed fake CPU handling. 2016-06-20 12:52:36 -05:00
Dr. Chat
23b2e25fb8 XThread: Don't release ourselves before calling thread_->Terminate! 2016-06-18 20:58:58 -05:00
sephiroth99
bf910c2d9a Add missing definitions for XAPC constants
Fixes linking errors for these symbols.
2016-01-20 11:26:35 -05: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
Ben Vanik
b02ca62388 Fixing most remaining C++ warnings in clang. 2016-01-01 18:37:33 +00:00
Dr. Chat
c242a01043 Mark XThreads as running before calling Execute 2015-12-29 13:10:02 -08:00
Dr. Chat
5cb591b993 Compensate for static TLS when accessing dynamic TLS. 2015-12-29 13:10:01 -08:00
Dr. Chat
bca5fb5382 XThread acquire mutants on restore 2015-12-29 13:10:00 -08:00
Dr. Chat
eee0bb070c Store thread TLS in guest memory rather than using host APIs 2015-12-29 13:09:58 -08:00
Ben Vanik
383a173a18 REBASE: fixing xthread instruction decoding. 2015-12-29 13:09:50 -08:00
Dr. Chat
a5c22ec214 XThread: Only need to retain a pointer to our object - not a handle. 2015-12-29 13:09:49 -08:00
Dr. Chat
621d3f8abb XThread free stack on destruction 2015-12-29 13:09:49 -08:00
Dr. Chat
07d31862f1 XThread: Special case save/restore for threads no longer running. 2015-12-29 13:09:48 -08:00
Dr. Chat
b58e9afbf1 Fix XThread::StepIntoBranch not properly stepping into blr/bctr 2015-12-29 13:09:48 -08:00
Dr. Chat
44c9e8fe25 Save/Restore the guest clock in XThreads 2015-12-29 13:09:47 -08:00
Dr. Chat
6f4626118e Fix infinite loop in StepToSafePoint after stepping to an address once 2015-12-29 13:09:46 -08:00
Dr. Chat
606aa9af6f XThread: Update the PC when we step out of an export! 2015-12-29 13:09:43 -08:00
Dr. Chat
d2d97fe58f XThread - Fix unconditional conditional branch check 2015-12-29 13:09:42 -08:00
Dr. Chat
3007a98d2d Install false-branch breakpoint only if the opcode is conditional. 2015-12-29 13:09:38 -08:00
Dr. Chat
f9de61ceed XThread::StepToSafePoint - Handle cases where the thread hasn't started yet. 2015-12-29 13:09:37 -08:00
Dr. Chat
a6322c7bf4 NativeList getters/setters 2015-12-29 13:09:36 -08:00
Dr. Chat
290d5d9594 Fix incorrect double-retaining of objects on restore. 2015-12-29 13:09:24 -08:00
Dr. Chat
1e36ea8b69 Use c_str() when passing a string to sprintf! 2015-12-29 13:09:23 -08:00
Dr. Chat
e54850e1f2 XThread::set_name - Use more efficient xe::format_string instead of a StringBuffer 2015-12-29 13:09:22 -08:00
Dr. Chat
442f063ddf XThread Save: Handle emulated instructions/MMIO/etc that call out of guest code 2015-12-29 13:09:20 -08:00
Dr. Chat
4301641bdf XThread Save/Restore 2015-12-29 13:09:16 -08:00
Dr. Chat
666f5543a8 Cleanup ThreadState and XThread 2015-12-29 12:32:46 -08:00
Ben Vanik
4af6c41740 Moving profiling.h to base - UI could be separated for cleanliness. 2015-11-07 12:31:07 -08:00