[pspplayer commit] r583 - trunk/Noxa.Emulation.Psp.Cpu.R4000Ultra

0 views
Skip to first unread message

codesite...@google.com

unread,
Mar 23, 2008, 11:26:00 AM3/23/08
to psppla...@googlegroups.com
Author: ben.vanik
Date: Sun Mar 23 08:25:42 2008
New Revision: 583

Modified:
trunk/Noxa.Emulation.Psp.Cpu.R4000Ultra/R4000Generator_Memory.cpp

Log:
fixed memory errors when memory breakpoints set
was not saving enough - this may actually be too much, but memory
breakpoints are expensive and 4 extra instructions per access won't be noticeable

Modified: trunk/Noxa.Emulation.Psp.Cpu.R4000Ultra/R4000Generator_Memory.cpp
==============================================================================
--- trunk/Noxa.Emulation.Psp.Cpu.R4000Ultra/R4000Generator_Memory.cpp (original)
+++ trunk/Noxa.Emulation.Psp.Cpu.R4000Ultra/R4000Generator_Memory.cpp
Sun Mar 23 08:25:42 2008
@@ -137,28 +137,26 @@
{
g->and( EAX, 0x3FFFFFFF );

-#if 0
- g->cmp( EAX, 0x08A43438 );
- Label* skipDebug = g->DefineLabel();
- g->jne( skipDebug );
- g->int3();
- g->MarkLabel( skipDebug );
-#endif
-
#ifdef DEBUGGING
Label* noBreakpoints = g->DefineLabel();
if( isRead == true )
- g->cmp( g->dword_ptr[ &readBreakpointCount ], 0 );
+ g->cmp( g->dword_ptr[ &readBreakpointCount ], ( uint )0 );
else
- g->cmp( g->dword_ptr[ &writeBreakpointCount ], 0 );
- g->je( noBreakpoints );
+ g->cmp( g->dword_ptr[ &writeBreakpointCount ], ( uint )0 );
+ g->jz( noBreakpoints );
g->push( EAX );
- g->push( (uint)isRead );
+ g->push( EBX );
+ g->push( ECX );
+ g->push( EDX );
+ g->push( ( uint )isRead );
g->push( EAX );
g->push( ( uint )( address - 4 ) );
g->mov( EBX, (int)&__memoryBreakpointCheck );
g->call( EBX );
g->add( ESP, 12 );
+ g->pop( EDX );
+ g->pop( ECX );
+ g->pop( EBX );
g->pop( EAX );
g->MarkLabel( noBreakpoints );
#endif
@@ -231,25 +229,23 @@
// EAX = address, result in EAX
void EmitDirectMemoryRead( R4000GenContext^ context, int address )
{
-#if 0
- g->cmp( EAX, 0x08A43438 );
- Label* skipDebug = g->DefineLabel();
- g->jne( skipDebug );
- g->int3();
- g->MarkLabel( skipDebug );
-#endif
-
#ifdef DEBUGGING
Label* noBreakpoints = g->DefineLabel();
- g->cmp( g->dword_ptr[ &readBreakpointCount ], 0 );
- g->je( noBreakpoints );
+ g->cmp( g->dword_ptr[ &readBreakpointCount ], ( uint )0 );
+ g->jz( noBreakpoints );
g->push( EAX );
- g->push( (uint)1 );
+ g->push( EBX );
+ g->push( ECX );
+ g->push( EDX );
+ g->push( ( uint )1 );
g->push( EAX );
g->push( ( uint )( address - 4 ) );
g->mov( EBX, (int)&__memoryBreakpointCheck );
g->call( EBX );
g->add( ESP, 12 );
+ g->pop( EDX );
+ g->pop( ECX );
+ g->pop( EBX );
g->pop( EAX );
g->MarkLabel( noBreakpoints );
#endif
@@ -322,16 +318,20 @@
{
#ifdef DEBUGGING
Label* noBreakpoints = g->DefineLabel();
- g->cmp( g->dword_ptr[ &writeBreakpointCount ], 0 );
- g->je( noBreakpoints );
+ g->cmp( g->dword_ptr[ &writeBreakpointCount ], ( uint )0 );
+ g->jz( noBreakpoints );
g->push( EAX );
g->push( EBX );
- g->push( EBX );
+ g->push( ECX );
+ g->push( EDX );
+ g->push( ( uint )0 );
g->push( EAX );
g->push( ( uint )( address - 4 ) );
g->mov( EBX, (int)&__memoryBreakpointCheck );
g->call( EBX );
g->add( ESP, 12 );
+ g->pop( EDX );
+ g->pop( ECX );
g->pop( EBX );
g->pop( EAX );
g->MarkLabel( noBreakpoints );
@@ -347,31 +347,6 @@
g->jb( l1 );
g->cmp( EAX, MainMemoryBound );
g->ja( l1 );
-
-#if 0
- Label* skipTest = g->DefineLabel();
- Label* hitTest = g->DefineLabel();
- g->cmp( EAX, 0x08A43438 );
- g->je( hitTest );
- /*g->cmp( EAX, 0x97BF6BD );
- g->je( hitTest );
- g->cmp( EAX, 0x97BF6BE );
- g->je( hitTest );
- g->cmp( EAX, 0x97BF6BF );
- g->je( hitTest );
- g->cmp( EAX, 0x97BF6C0 );
- g->je( hitTest );
- g->cmp( EAX, 0x97BF6C1 );
- g->je( hitTest );*/
- g->jmp( skipTest );
- g->MarkLabel( hitTest );
- g->int3();
- // Just so I know what the PC is
- g->push( EAX );
- g->mov( EAX, ( uint )address );
- g->pop( EAX );
- g->MarkLabel( skipTest );
-#endif

// else, do a direct read
g->sub( EAX, MainMemoryBase ); // get to offset in main memory

Reply all
Reply to author
Forward
0 new messages