Commit graph

286 commits

Author SHA1 Message Date
Nekotekina 1641be5e0c Fix UTF-8 BOM in vm.cpp 2019-06-25 22:21:56 +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
Eladash 806a7bbf04 Fixup for #6115 (#6120) 2019-06-22 12:10:47 +03:00
Eladash ade291e73d Fix potential overflow in sys_vm 2019-06-21 00:02:52 +03:00
Nekotekina 5d45a3e47d Implement cpu_thread::suspend_all
Remove Accurate PUTLLC option.
Implement fallback path for SPU transactions.
2019-06-19 20:36:12 +03:00
eladash b307aff9eb Prefetch byteswapped opcodes in ppu interpreter 2019-04-11 17:47:52 +03:00
eladash 182054b8af Implement sys_vm_append/return_memory 2019-03-31 14:57:21 +03:00
eladash a3f65084df Fix sys_process_exit2 when SPUs are at av handler 2019-03-31 14:57:21 +03:00
eladash 6502d933df Fix stack memory view on the debugger
the debugger uses super ptr which was unmapped for stack.
2019-03-31 14:57:21 +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 e38b7aee5a check address in sys_rsx_context_iomap
* Fix 0 vm page flags to behave like 1m flags, follows c8a681e60
* check if address exists and valid for rsx io allcations (must be allocated on 1m pages)
2019-03-05 21:23:24 +03:00
eladash d4a24433e8 Fix DECR mode allocations (sys_memory) 2019-01-31 16:03:38 +03:00
Nekotekina 2b66abaf10 Implement atomic_t<>::release
More relaxed store with release memory order
2019-01-29 03:32:16 +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 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
Rui Pinheiro f3029b2b42 Change Cell->RSX map/unmap notifications
This allows for further flexibility on the RSX side, allowing us to fix
some bugs and crashes in later commits.
2018-09-24 15:26:40 +03:00
Nekotekina ed9fb8405b Move rotate/cntlz/cnttz helpers to Utilities/asm.h 2018-09-08 00:32:04 +03:00
Nekotekina 8abe6489ed Mega-cleanup for atomic_t<> and named bit-sets bs_t<>
Remove "atomic operator" classes
Remove test, test_and_set, test_and_reset, test_and_complement global functions
Simplify atomic_t<> with constexpr if, remove some garbage
Redesign bs_t<> to use class, mark its methods constexpr
Implement atomic_bs_t<> for optimizations
Remove unused __bitwise_ops concept (should be in other header anyway)
Bitsets can now be tested via safe bool conversion
2018-09-03 21:40:36 +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 e8d144f399 Improve vm::reader_lock
Add upgrade() method
2018-08-18 21:14:52 +03:00
Nekotekina 6ec4a88eb5 Hardcode vm::user64k location 2018-08-18 21:02:16 +03:00
Nekotekina 182c04b59d Improve vm::unmap
Prevent unmapping predefined locations
2018-08-18 21:01:32 +03:00
eladash 061c787e56 rsx-capture: unbreak 2018-08-16 03:27:11 +04:00
Nekotekina 5e20d4b481 Fix vm regression from #4975
Incorrect vector management
2018-08-14 23:57:20 +03: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
eladash 449888b9db Rsx/vm: fix base addresses 2018-08-13 16:16:34 +03:00
eladash f349695a75 Rsx: rewrite address translation 2018-08-13 16:16:34 +03:00
Nekotekina 1ac203a958 Funny workaround 2018-07-05 22:26:35 +03:00
eladash b456955688 rsx: fix hardcoded rsx allocation address 2018-06-24 10:57:30 +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 367f039523 Build transactions at runtime
Drop _xbegin family intrinsics due to bad codegen
Implemented `notifier` class, replacing vm::notify
Minor optimization: detach transactions from global mutex on TSX path
Minor optimization: don't acquire vm::passive_lock on PPU on TSX path
2018-05-16 17:31:58 +03:00
Nekotekina 5d15d64ec8 Memory mirror support
Implemented utils::memory_release (not used)
Implemented utils::shm class (handler for shared memory)
Improved sys_mmapper syscalls
Rewritten ppu_patch function
Implemented vm::get_super_ptr (ignores memory protection)
Minimal allocation alignment increased to 0x10000
2018-05-09 23:35:34 +03:00
Nekotekina 3681507136 Rewrite vm::reservation
Use flat virtual memory area
2018-04-07 20:51:21 +03:00
Nekotekina 2b5cf2455f SPU: improve TSX usage
Reduce transaction failure amount
Remove vm::try_to_lock
2018-04-06 21:47:54 +03:00
Nekotekina d392379c7a Use vm::passive_lock for SPU threads 2018-04-06 15:47:00 +03:00
Nekotekina cce0ad0c35 Clean vm::ps3 namespace use 2018-02-09 17:49:37 +03:00
Nekotekina 76be7d40ac Remove PSP2 2018-02-09 15:24:46 +03:00
Nekotekina df2fc13b7a Add PPU instruction stat dumper
Needs PPU Debug option to activate and PPU Interpreter
Dumps after Resume (after Pause)
Fix utils::memory_decommit, clean vm.cpp
2017-10-11 20:06:33 +03:00
Nekotekina 22d8b57027 Improve lv2_memory object 2017-09-14 00:23:23 +03:00
kd-11 1da732bbf5 rsx/gl/vk: Invalidate texture regions when memory is unmapped
- Free GPU resources immediately if mappings change to avoid leaking VRAM
2017-08-16 23:58:30 +03:00
Nekotekina af11ad6253 Fix deadlock in vm::unmap 2017-08-13 21:39:08 +03:00
Nekotekina 7b4c044480 Relax allocations in ppu_load_exec 2017-08-04 14:33:53 +03:00
Jake d9a693019b rsx/gcm: Implement rsx dma. Refactor gcm/rsx to not be as codependent 2017-08-02 01:33:12 +03:00
Nekotekina b24eb621ae Use RTM instructions (skylake+) 2017-07-20 17:22:09 +03:00
Nekotekina 0ee454f44b vm: decommit by exec_addr 2017-07-12 14:00:38 +03:00
Nekotekina aea094730b PPU LLVM: paradigm shift
For now, compile only one block at time
Use tail calls to move between blocks
Fully write PPU context (except CIA)

This fixes many compatibility problems
2017-06-23 20:09:33 +03:00
Inviuz 22e679e23e cellSave fix plus bugfixes (#2631)
* cellSave fix plus bugfixes

allows allocation of last byte in memory block
prevents rpcs3 from crashing when closing non existent socket

* Fix overflow

* add more socket options
fix typo

prevent sys_net from operating on nullptr sockets
2017-04-05 16:08:58 +03:00
Nekotekina 37a97a71e3 vm::g_exec_addr added
s_ppu_compiled renamed
Exception handling enabled
2017-03-27 01:15:41 +03:00
Nekotekina 1ede0f4706 Minor optimization 2017-03-13 15:02:18 +03:00
Nekotekina 78703cfe47 Use utils::memory_protect 2017-03-13 13:16:22 +03:00
Nekotekina d09dd29054 utils::memory_protect 2017-03-13 13:16:22 +03:00
Inviuz b70a1edbc7 Mmapper with Neko's review fixes (#2503) 2017-03-12 03:15:22 +03:00
Nekotekina 4739eb3601 Reservation fix 2017-03-11 15:48:43 +03:00
Nekotekina 5e3bacbd9b New reservations
Memory system cleanup
sys_memory_get_page_attribute
2017-03-10 15:51:40 +03:00
Nekotekina 0f87c4485d Silly macro removed-2 2016-08-14 18:19:42 +03:00
Nekotekina fc56e70172 vm::ptr<char> formatting 2016-08-11 16:47:20 +03:00
Nekotekina bdeccd889f cpu_type removed, system_type added
cpu_state -> cpu_flag
vm::stack_allocator template improved
ppu_cmd type changed to enum, cmd64 type added
2016-08-09 17:14:41 +03:00
Nekotekina a7e808b35b EXCEPTION macro removed
fmt::throw_exception<> implemented
::narrow improved
Minor fixes
2016-08-08 19:19:32 +03:00
Nekotekina 5a36c57c57 Formatting system improved
`unveil<>` renamed to `fmt_unveil<>`, now packs args to u64 imitating va_args
`bijective...` removed, `cfg::enum_entry` now uses formatting system
`fmt_class_string<>` added, providing type-specific "%s" handler function
Added `fmt::append`, removed `fmt::narrow` (too obscure)
Utilities/cfmt.h: C-style format template function (WIP)
Minor formatting fixes and cleanup
2016-08-04 21:34:00 +03:00
Nekotekina f8719c1230 PPUThread refactoring
`CallbackManager` removed, added _gcm_intr_thread for cellGcmSys
`PPUThread` renamed to `ppu_thread`, inheritance allowed
Added lightweight command queue for `ppu_thread`
Implemented call stack dump for PPU
`get_current_thread_mutex` removed
`thread_ctrl::spawn`: minor initialization fix
`thread_ctrl::wait_for` added
`named_thread`: some methods added
`cpu_thread::run` added
Some bugs fixes, including SPU channels
2016-07-30 16:35:02 +03:00
Nekotekina 96728a83f6 Partial commit: sys_memory, sys_mmapper 2016-07-16 14:46:01 +03:00
Nekotekina 266db1336d The rest 2016-05-23 16:22:25 +03:00
Ivan da7472fe81 Optimizations (#1680)
* Optimizations

1) Some headers simplified for better compilation time
2) Some templates simplified for smaller executable size
3) Eliminate std::future to fix compilation for mingw64
4) PKG installation can be cancelled now
5) cellGame fixes
6) XAudio2 fix for mingw64
7) PPUInterpreter bug fixed (Clang)

* any_pod<> implemented

Aliases: any16, any32, any64
rsx::make_command fixed
2016-04-25 13:49:12 +03:00
Nekotekina 0c7f763889 Partial commit: Memory 2016-04-15 19:22:43 +03:00
Nekotekina b3e3c68f15 File utility improved
+ minor fixes
2016-01-13 14:12:04 +03:00
Nekotekina 3ed603074c Changes done by [DH] rewritten
Added rsx_program_decompiler submodule
Added fs::dir iterator
Added fmt::match
2015-12-22 23:11:20 +03:00
Nekotekina a666318b95 Error messages improved 2015-12-20 15:41:09 +03:00
Nekotekina ca6783ba9a Threads improved, ID manager improved 2015-12-04 23:37:34 +03:00
Nekotekina a974ee009e vm::var improved, cleanup
Mostly vm::var initialization introduced.
Added vm::make_var function.
2015-10-14 18:17:37 +03:00
Nekotekina 8ae3401ffa Some things improved
shared_mutex_t implemented
GUI Emu Callbacks rewritten
fxm::import, fxm::import_always implemented
cellMsgDialog rewritten
Emu.CallAfter improved (returns std::future)
2015-09-22 16:48:21 +03:00
Nekotekina 817fec9684 SPU Cleanup
SPURecompiler improved
Old SPU decoder removed
SPU Interpreters merged
2015-09-02 00:38:44 +03:00
Nekotekina 5e14310071 noexcept usage fixed
thread_t renamed to named_thread_t
2015-08-24 21:22:48 +03:00
Nekotekina d9403c2ed2 thread_t cleanup 2015-08-24 21:22:37 +03:00
Nekotekina c7ee8cadde cellFont, cellFs, cellGcmSys funcs added, minor cleanup 2015-08-24 21:22:14 +03:00
Nekotekina 16b7d204d2 decode_x64_reg_op: MOVUPS support 2015-08-01 14:38:59 +03:00
Nekotekina 71a378a3fb vm::wait_op improved
Now it accepts thread_t and its descendants (but may require adding
friend vm::waiter_lock_t class)
2015-08-01 14:38:55 +03:00
Nekotekina 2f7fe35f5c Minor style change 2015-07-21 23:14:31 +03:00
Nekotekina 8175630619 sys_cond/sys_mutex improved 2015-07-21 23:14:29 +03:00
Nekotekina 9913c9059c Very bugfix
I reverted cellSaveData changes since they were relying on the
uninitialized local variable `save_entry` and thus were almost
completely wrong.
2015-07-21 23:14:26 +03:00
Nekotekina 5bd83516ba SPU Interrupt Enable Status implemented
SPU Interrupts are still NOT implemented
2015-07-21 23:14:25 +03:00
Nekotekina 1519a2b468 Exceptions passed to wait_op caller 2015-07-21 23:14:23 +03:00
Nekotekina a7668ff57f SPU_EVENT_LR improved 2015-07-21 23:14:22 +03:00
Nekotekina 1e021cdbba waiter_map reintroduced, combined with vm 2015-07-21 23:14:20 +03:00
Nekotekina a8fcf71f9c Minor bugfix, cleanup 2015-07-21 23:14:04 +03:00
Nekotekina b8a27d8a4c Silly bugs fixed 2015-07-18 03:12:08 +03:00
Nekotekina 48c75105e2 "Memory" eliminated 2015-07-18 03:12:06 +03:00
Nekotekina 82781e620a Small fixes 2015-07-10 04:31:36 +03:00
Nekotekina c0f13f7084 sleep_queue_t rewritten, used in sys_cond/sys_mutex
Some synchronization fixes
2015-07-10 04:31:34 +03:00
Nekotekina 83321c5be7 sys_time_get_current_time fixed, CALL_FUNC draft 2015-07-10 04:31:30 +03:00
Nekotekina 22e1da5e76 Minor cleanup 2015-07-10 04:31:29 +03:00
Nekotekina 3064cf8101 CHECK_EMU_STATUS, autojoin_thread_t 2015-07-10 04:31:27 +03:00
Nekotekina 721ad404d2 VM_CAST macro 2015-07-10 04:31:23 +03:00
Nekotekina 32d3d1fbe5 EXCEPTION() macro usage, sceNpTrophy improved 2015-07-10 04:31:20 +03:00
Nekotekina 6f1e76198a Some fixes 2015-07-10 04:31:18 +03:00
Nekotekina 3aefa2b4e1 ThreadBase rewritten (wip) 2015-07-10 04:31:16 +03:00
Nekotekina c598fe7aa9 atomic_op() rewritten, atomic.h refactoring
cellSync refactoring, wait_op() rewritten, bugfixes
2015-07-10 04:31:10 +03:00
Nekotekina a7f77c27f7 ARMv7Context used through multiple inheritance
Forgive me...
2015-07-10 04:30:49 +03:00
vlj 972515938c Memory: Fix virtualProtect protecting too much memory. 2015-07-03 17:08:06 +02:00
Nekotekina 78fdcf75e7 Attribute macro changed
__forceinline -> force_inline
__noinline -> never_inline
printf_alike(x,y) added
2015-05-28 18:14:22 +03:00
Nekotekina 22b78fec71 IdManager improved, atomic_t improved
Various changes
2015-05-27 06:11:59 +03:00
Nekotekina 935302b620 Bugfix 2015-04-20 02:49:13 +03:00
Nekotekina b1f7543436 PPU stack fixed (2) 2015-04-18 04:35:58 +03:00
Nekotekina 8587ae5883 Compilation fix 2015-03-03 02:34:49 +03:00
Nekotekina 942d984dc5 sys_process_get_paramsfo implemented 2015-02-28 17:41:15 +03:00
S Gopal Rajagopal 85648da706 Merge remote-tracking branch 'upstream/master' 2015-02-18 23:43:37 +05:30
Nekotekina 20dce26b1d Reservations improved 2015-02-17 03:08:23 +03:00
S Gopal Rajagopal e7f278b5d2 PPUJIT: Support exception based MMIO and reservations 2015-02-16 22:49:17 +05:30
Nekotekina e6c628caba Memory (unfinished) 2015-02-16 04:53:53 +03:00
Nekotekina ba83767706 Small fix 2015-02-13 18:26:42 +03:00
Nekotekina 267de68441 Memory cleanup, page flags implemented
RSXCMDMem, SPRXMem, MmaperMem removed
MainMem range fixed
2015-02-13 17:04:03 +03:00
Nekotekina 31bbf56ff1 Reservations improved 2015-02-08 18:25:50 +03:00
Nekotekina 19acaf3f86 Bugfix, ECIWX/ECOWX disabled 2015-02-08 16:38:08 +03:00
Nekotekina fcbbdc87fc Bugfix 2015-02-08 01:09:23 +03:00
Nekotekina 90c021fc31 Small fix 2015-02-07 23:06:35 +03:00
Nekotekina e70875ad5c Linux fix 2015-02-07 18:35:54 +03:00
Nekotekina 6aef58318c Fix 2 2015-02-07 17:13:32 +03:00
Nekotekina c9f994d92d Fix 1 2015-02-07 17:12:39 +03:00
Nekotekina c71c5eb422 Compilation fix 2015-02-07 16:59:10 +03:00
Nekotekina 39db6bb461 Reservations improved 2015-02-07 16:46:42 +03:00
Nekotekina 1af4848324 New reservations (not finished) 2015-02-07 02:39:51 +03:00
Nekotekina 5225ca8fc2 ARMv7: branch instrs fixed, new instructions
BIC_IMM, BIC_REG, RSB_IMM, LDR_LIT, STRB_REG, STRH_REG
Fixed initial stack size
2015-02-03 00:00:05 +03:00
Nekotekina 23c7028b2a ARMv7: ARM encoding introduced; bugfixes 2015-02-02 12:14:49 +03:00
Nekotekina e5dd03dbcb ARMv7: argc, argv setting, LDRSB_IMM, bugfixes 2015-02-01 16:52:34 +03:00
Nekotekina 62c8f2ac34 ARMv7: stubs for other modules, loader improved 2015-01-29 18:48:05 +03:00
Nekotekina 5195b2b1b4 RealToVirtualAddr became vm::get_addr() 2015-01-19 22:41:31 +03:00
Nekotekina 3f44e07b7c vm::stackvar (experimental)
Should be convenient for small allocations which would be done on stack
on real console
2015-01-07 05:14:00 +03:00
DHrpcs3 795729a0b7 Fixed vm_ptr
Improved elf64 loader.
Minor improvements to vm.
Added hotkeys to MainFrame.
2014-11-24 20:12:04 +02:00
DHrpcs3 cdfef3bf9e Fixed compilation errors
Implemented converter_le_be
2014-11-20 21:41:04 +02:00
DHrpcs3 598d929aba Implemented LLE Modules Manager (draft)
Improved loader core.
Implemented *_thread wrappers.
Minor fixes.
Temporary disabled ELF Compiler & DisAsm frame.
2014-11-19 16:16:30 +02:00
DHrpcs3 eada1fe12c Improved be_t
Fixed NV4097_SET_TWO_SIDE_LIGHT_EN
Added LIS, ORI, NOP & BLR to PPU Jit
2014-10-01 12:45:43 +03:00
Nekotekina ebc4fa3e81 Compilation fix 2014-08-31 15:18:32 +04:00
Nekotekina 571bd63644 Test 2014-08-31 13:54:12 +04:00
Nekotekina ff3df64a26 Compilation fix 2014-08-31 03:06:43 +04:00
DHrpcs3 7411012db9 Fixed compilation errors
Implemented vm::ptr & vm::ref
2014-08-01 19:27:48 +03:00