PCSX2 Documentation/So maybe it's about time we explained VTLB: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 1: Line 1:
{{DocTabs|Section=3}}
''Originally written by Jake Stine''
''Originally written by Jake Stine''


Line 14: Line 13:
The pseudo-code looks like this, as performed for a write memOp:
The pseudo-code looks like this, as performed for a write memOp:


<nowiki>
<source lang="cpp">
uint page = ps2_addr/4096;
uint page = ps2_addr/4096;
uptr pc_addr = vtlb_lookup[page];
uptr pc_addr = vtlb_lookup[page];
Line 23: Line 22:
{
{
     handler[page]( ps2_addr, data );
     handler[page]( ps2_addr, data );
}</nowiki>
}
</source>


By default, Pcsx2 utilizes the VTLB's handlers for several areas of Ps2 memory that hold hardware registers. Hardware registers are memory addresses that control the whats, whens, and hows of the Ps2 -- write to a specific memory address and the PS2 starts a DMA transfer, or changes the video mode, or plays a new audio sample. These writes have to be intercepted and handled by the emulator. The VTLB allows us to do that very efficiently.
By default, Pcsx2 utilizes the VTLB's handlers for several areas of Ps2 memory that hold hardware registers. Hardware registers are memory addresses that control the whats, whens, and hows of the Ps2 -- write to a specific memory address and the PS2 starts a DMA transfer, or changes the video mode, or plays a new audio sample. These writes have to be intercepted and handled by the emulator. The VTLB allows us to do that very efficiently.
Line 35: Line 35:
The benefits of this model are three-fold: efficiency, extensibility, and ease of debugging. If a game doesn't use the Ps2's TLB, then the VTLB will simply use direct memOps (fast!). If a game does happen to use the TLB, then VTLB can remap the memory as needed, allowing that game to emulate correctly also without having to needlessly burden other games with the overhead of virtual memory remapping logic. And to top it all off, handler mappings can be traced and dumped quickly and easily at any stage of emulation. Smile
The benefits of this model are three-fold: efficiency, extensibility, and ease of debugging. If a game doesn't use the Ps2's TLB, then the VTLB will simply use direct memOps (fast!). If a game does happen to use the TLB, then VTLB can remap the memory as needed, allowing that game to emulate correctly also without having to needlessly burden other games with the overhead of virtual memory remapping logic. And to top it all off, handler mappings can be traced and dumped quickly and easily at any stage of emulation. Smile


{{PCSX2 Developers Blog Navbox}}
 
{{PCSX2 Documentation Navbox}}
ninja
782

edits