PCSX2 Documentation/PCSX2 EE Recompiler: Difference between revisions

Line 74: Line 74:
A naive implementation would be to instrument all write to detect corresponding block. However it will cost a big penalty for each memory write. Another one will be to check the content of the instruction block at each execution. Again slow. A more complex implementation will use the page fault signal handler mechanism to detect invalid write. Guess what, we choose the later.
A naive implementation would be to instrument all write to detect corresponding block. However it will cost a big penalty for each memory write. Another one will be to check the content of the instruction block at each execution. Again slow. A more complex implementation will use the page fault signal handler mechanism to detect invalid write. Guess what, we choose the later.


* <code>C++ function: void mmap_MarkCountedRamPage( u32 paddr )</code>
* '''<code>C++ function: void mmap_MarkCountedRamPage( u32 paddr )</code>'''
* <code>C++ function: int mmap_GetRamPageInfo( u32 paddr )</code>
* '''<code>C++ function: int mmap_GetRamPageInfo( u32 paddr )</code>'''
* <code>C++ function: void mmap_ClearCpuBlock( uint offset )</code>
* '''<code>C++ function: void mmap_ClearCpuBlock( uint offset )</code>'''
* <code>C++ function: void dyna_page_reset(u32 start, u32 sz)</code>
* '''<code>C++ function: void dyna_page_reset(u32 start, u32 sz)</code>'''
* <code>C++ function: void dyna_block_discard(u32 start, u32 sz)</code>
* '''<code>C++ function: void dyna_block_discard(u32 start, u32 sz)</code>'''
* <code>C++ function: void recClear(u32 addr, u32 size)</code>
* '''<code>C++ function: void recClear(u32 addr, u32 size)</code>'''
* <code>C++ function: void mmap_PageFaultHandler::OnPageFaultEvent( const PageFaultInfo& info, bool& handled )</code>
* '''<code>C++ function: void mmap_PageFaultHandler::OnPageFaultEvent( const PageFaultInfo& info, bool& handled )</code>'''
* <code>C++ array: u16 manual_page[Ps2MemSize::MainRam >> 12]</code>
* '''<code>C++ array: u16 manual_page[Ps2MemSize::MainRam >> 12]</code>'''
* <code>C++ array: u8 manual_counter[Ps2MemSize::MainRam >> 12]</code>
* '''<code>C++ array: u8 manual_counter[Ps2MemSize::MainRam >> 12]</code>'''
* <code>C++ array: vtlb_PageProtectionInfo m_PageProtectInfo[Ps2MemSize::MainRam >> 12]</code>
* '''<code>C++ array: vtlb_PageProtectionInfo m_PageProtectInfo[Ps2MemSize::MainRam >> 12]</code>'''


==== The Automatic Protection ====
==== The Automatic Protection ====
Line 106: Line 106:


==== Limitation ====
==== Limitation ====
The biggest limitation is the mix of data and code in the same page. Data could just be the global variable of the program often after the code. It could also the thread data stack. Or the kernel area to save register context.


== Code Generation ==
== Code Generation ==
ninja
56

edits