Eladash
b40ed5bdb7
Patches/PPU: Extend and improve patching capabilities (code allocations, jumps to any address) ( #10779 )
...
* Patches/PPU: Implement dynamic code allocation + Any-Address jump patches
Also fix deallocation path of fixed allocation patches.
2021-09-01 13:38:17 +03:00
Nekotekina
2491aad6f2
types.hpp: implement min_v<>, max_v<>, SignedInt, UnsignedInt, FPInt concepts
...
Restrict smax to only work with signed values for consistency.
Cleanup <climits> includes.
Cleanup <limits> includes.
2021-05-23 19:43:51 +03:00
Megamouse
a16d8ba3ea
More random changes
2021-04-11 14:01:51 +03:00
Nekotekina
10bbb7fa1f
Fix some warnings (deprecate enum arithmetics)
2021-04-09 10:26:13 +03:00
Nick Renieris
396c129d41
vm: Flag names (refactoring)
2021-04-06 13:07:54 +03:00
Eladash
1864419561
Fix SPU mapped memory page size
2021-03-19 22:25:08 +03:00
Nekotekina
a69248299d
SPU: Don't use shm::map_critical in SPU LS allocations
...
Use shm::try_map instead until proper area is found.
2021-01-25 17:45:47 +03:00
Eladash
e4c3b1c2bd
vm: Remove vm::dealloc_verbose_nothrow
2021-01-15 17:37:52 +03:00
Eladash
66581d115b
vm: Fix access violations on super memory, support super memory in vm::get_addr
2020-12-26 17:56:49 +03:00
Nekotekina
567d23d856
Implement util/auto_typemap.hpp
...
Used in vm::block_t as an example.
2020-12-24 14:55:25 +03:00
Nekotekina
b7bf316c1a
Don't randomly include "stdafx.h"
...
It's file for precompiled headers.
Include what is used, don't rely on transitive includes.
2020-12-22 14:32:30 +03:00
Nekotekina
e82bef425f
vm: fix warnings and add narrow cast for u64 ptrs
2020-12-15 20:10:16 +03:00
Nekotekina
e321765c54
Split BEType.h to util/v128.hpp and util/to_endian.hpp
2020-12-13 16:34:45 +03:00
Nekotekina
b59f142d4e
Move types.h to util/types.hpp
2020-12-12 15:12:01 +03:00
Nekotekina
36c8654fb8
Remove HERE macro
...
Some cleanup.
Add location to some functions.
2020-12-10 12:30:22 +03:00
RipleyTom
d0c271e534
Simplify g_pages
...
This was done because otherwise msvc runs out of heap space on azure.
2020-12-09 11:15:08 +03:00
RipleyTom
af8c661a64
Remove BOM markers
2020-12-06 15:30:12 +03:00
Nekotekina
ea5f5aea5f
vm: memory locking rewritten
...
Added vm::lock_sudo method (wrapper for utils::memory_lock).
Put locking outside of vm::g_mutex scope.
Prelock sudo memory for RSX, vm::stack, vm::main.
Prelock sudo memory for shared memory objects.
Don't check for TSX path.
2020-11-16 12:46:15 +03:00
Eladash
fefab50e06
Fix vm::range_lock, imporve vm::check_addr
2020-11-11 10:30:09 +03:00
Nekotekina
1c99a2e7fb
vm: add map_self() method to utils::shm
...
Add complementary unmap_self() method.
Move VirtualMemory to util/vm.hpp
Minor associated include cleanup.
Move asm.h to util/asm.hpp
2020-11-08 16:43:15 +03:00
Nekotekina
c7fe8567b8
Experimental squashing of reservation memory area.
...
Enables trivial synchronization between shared mem.
Reduces memory usage, but potentially degrades performance.
Rename an overload of vm::passive_lock to vm::range_lock.
2020-04-16 02:25:43 +03:00
Megamouse
ef6f565dbd
silence some annoying warnings
2019-12-28 15:40:57 +01:00
Nekotekina
2290c389d6
vm: implement vm::try_access, vm::ptr::try_read/write
2019-11-26 00:12:45 +03:00
eladash
730e9cde84
sys_rsx: Improve allocations and error checks
...
* allow sys_rsx_device_map to be called twice: in this case the DEVICE address retrived from the previous call returned
* Add ENOMEM checks for sys_rsx_memory_allocate and sys_rsx_context_allocate
* add EINVAL check for sys_rsx_context_allocate if memory handle is not found
* Separate sys_rsx_device_map allocation from sys_rsx_context_allocate's
* Implement sys_rsx_memory_free; used by cellGcmInit upon failure
* Added context_id checks
* Throw if sys_rsx_context_allocate was called twice.
2019-10-21 15:31:45 +03:00
Nekotekina
feee3838eb
Revert "Revert "Remove shared_cond and simplify reservation waiting""
...
This reverts commit b70c08a2e8 .
2019-09-24 05:01:00 +03:00
Nekotekina
b70c08a2e8
Revert "Remove shared_cond and simplify reservation waiting"
...
This reverts commit 0a96497e13 .
2019-09-14 00:02:48 +03:00
Nekotekina
0a96497e13
Remove shared_cond and simplify reservation waiting
...
Use atomic wait for reservations
Cleanup some obsolete code
2019-09-10 19:25:39 +03:00
Nekotekina
f8f3067deb
Always check page_allocated in vm::check_addr
2019-08-14 20:28:34 +03:00
Eladash
25e47e0de0
Fix vm::check_addr memory state check
2019-08-10 19:47:37 +03:00
Eladash
997e3046e3
vm/sys_overlay Improvements
...
- Implement sys_overlay_load_module_by_fd.
- Implement special segment allocation when ppc_seg flag is specified.
2019-07-28 14:23:58 +03:00
Nekotekina
c01f1a8968
Avoid transitive include of vm_ref.h
...
Add forward declarations of vm::_ref_base
Remove default AT = u32 in _ptr_base and _ref_base (doesn't play well).
2019-07-15 15:46:46 +03:00
Lassi Hämäläinen
c963c51a60
Remove unnecessary header includes
...
- Manually removed lot of unneeded #includes to clean code and reduce
compilation time
- Reordered some of the #includes to be in more logical order
2019-06-25 17:11:10 +03:00
Lassi Hämäläinen
499035512b
Split Emu/Memory into more logical headers
...
- Add vm_locking.h and vm_reservation.h and move relevant functions
and types to these headers.
- Change include order and make vm_ptr.h, vm_var.h and vm_ref.h headers
usable invidually and them including vm.h instead of other way around
- Because usage of vm::ptr now requires including vm_ptr.h instead of
vm.h updated multiple #includes
- Added additional #includes to vm_reservation.h and vm_locking to
where vm::reservation_* and locking related functions are used
2019-06-25 17:11:10 +03:00
Nekotekina
9dc0368079
Rename cond_x16 to shared_cond
...
Extend capacity from 16 to 32.
Remove redundant m_total counter.
2019-06-04 16:37:50 +03:00
Nekotekina
9abb303569
vm: expand reservation lock bit area to 7 bit
...
This is minor change.
2019-05-19 17:46:55 +03:00
eladash
a43e7c172c
Fix shared memory page flags
...
TODO: From hw testing, it seems like sys_memory_get_page_attribute and sys_rsx_context_iomap check page size a little differently
get_page_attribute() always go by area flags, sys_rsx_context_iomap checks page by the page granularity
This means that if the area page size 64k, but shared memory is mapped with SYS_MEMORY_GRANULARITY_1M
It can be mapped for rsxio, but the page attribute will indicate 64k page size :thonk:
rsxio memory is verified to need 1m pages.
2019-03-08 23:44:46 +03:00
eladash
d4a24433e8
Fix DECR mode allocations (sys_memory)
2019-01-31 16:03:38 +03:00
elad
fc92ae4085
SPU/PPU atomics performance and LR event fixes ( #5435 )
...
* Fix SPU LR event setting in atomic commands according to hw test
* MFC: increment timestamp for PUT cmd in non-tsx path
* MFC: fix reservation lost test on non-tsx path in regard to the lock bit
* Reservation notification moved out of writer_lock scope to reduce its lifetime
* Use passive_lock/unlock in ppu atomic inctrustions to reduce redundancy
* Lock only once for dma transfers (non-TSX)
* Don't use RDTSC in reservation update logic
* Remove MFC cmd args passing to process_mfc_cmd
* Reorder check_state cpu_flag::memory check for faster unlocking
* Specialization for 128-byte data copy in SPU dma transfers
* Implement memory range locks and isolate PPU and SPU passive lock logic
2019-01-15 18:31:21 +03:00
Nekotekina
febe4d4a10
Implement class cond_x16
...
Use as reservation notifier
Limited to 16 threads but allows more precise control of contention
2018-11-26 00:23:29 +03:00
Nekotekina
1b37e775be
Migration to named_thread<>
...
Add atomic_t<>::try_dec instead of fetch_dec_sat
Add atomic_t<>::try_inc
GDBDebugServer is broken (needs rewrite)
Removed old_thread class (former named_thread)
Removed storing/rethrowing exceptions from thread
Emu.Stop doesn't inject an exception anymore
task_stack helper class removed
thread_base simplified (no shared_from_this)
thread_ctrl::spawn simplified (creates detached thread)
Implemented overrideable thread detaching logic
Disabled cellAdec, cellDmux, cellFsAio
SPUThread renamed to spu_thread
RawSPUThread removed, spu_thread used instead
Disabled deriving from ppu_thread
Partial support for thread renaming
lv2_timer... simplified, screw it
idm/fxm: butchered support for on_stop/on_init
vm: improved allocation structure (added size)
2018-10-19 22:22:35 +03:00
Nekotekina
da6ce80f4f
Make vm::get_super_ptr return contiguous memory
...
Cleanup RSX code complexity
2018-09-27 23:37:13 +03:00
Nekotekina
306f95a9ae
New named_thread template (preview)
...
Old class named_thread renamed to old_thread
It's too hard to move in a single commit
2018-09-27 14:04:16 +03:00
Nekotekina
a605dd0a3f
Add missing deleted operators
2018-09-27 12:16:43 +03:00
Nekotekina
85fa0942e7
vm: allow 4k-aligned allocations for vm::stack
...
Fix utils::shm::map logic for MapViewOfFileEx
2018-08-30 14:56:45 +03:00
Nekotekina
386e301ea0
Name missing vm::spu location
2018-08-18 21:38:43 +03:00
Nekotekina
e8d144f399
Improve vm::reader_lock
...
Add upgrade() method
2018-08-18 21:14:52 +03:00
eladash
061c787e56
rsx-capture: unbreak
2018-08-16 03:27:11 +04:00
Nekotekina
aa4040bb7b
Implement vm::find_map; improve memory allocation
...
Add vm::user64k and vm::user1m constants
Remove vm::user_space, unreserve it
2018-08-14 15:14:06 +03:00
Nekotekina
72574b11ff
SPU: use reservation spinlocks on writes (non-TSX)
...
This should decrease contention by avoiding global lock
2018-05-21 21:56:14 +03:00
Nekotekina
fb0f5f0c8b
Fix vm::reservation_notifier
2018-05-21 00:18:37 +03:00