mirror of
https://gitee.com/anod/open_agb_firm.git
synced 2025-05-07 06:14:12 +08:00
修改实现core hookpoint的bug
This commit is contained in:
parent
bc6874c278
commit
400b9d2e55
@ -250,6 +250,10 @@ static int end_of_rom( CodeLocation addr, u32 size )
|
|||||||
#define MASK_PC8( m ) (pc[8]&m)
|
#define MASK_PC8( m ) (pc[8]&m)
|
||||||
#define MASK_PC9( m ) (pc[9]&m)
|
#define MASK_PC9( m ) (pc[9]&m)
|
||||||
|
|
||||||
|
#define IRQ_HANDLER_POINTER (0x03007ffc) //see gbatek `BIOS Interrupt handling'
|
||||||
|
#define CORE_HOOKPOINT_RANGE (1<<9)
|
||||||
|
#define CORE_HOOKPOINT_NEARBY (1<<8)
|
||||||
|
|
||||||
static int rom_search_hookpoint( CodeLocation addr, int addrlen, CodeLocation hookpoint[MAX_HOOKPOINT] )
|
static int rom_search_hookpoint( CodeLocation addr, int addrlen, CodeLocation hookpoint[MAX_HOOKPOINT] )
|
||||||
{
|
{
|
||||||
CodeLocation mark[MAX_HOOKPOINT];
|
CodeLocation mark[MAX_HOOKPOINT];
|
||||||
@ -258,7 +262,7 @@ static int rom_search_hookpoint( CodeLocation addr, int addrlen, CodeLocation ho
|
|||||||
for( int i=0; i < addrlen; ++i )
|
for( int i=0; i < addrlen; ++i )
|
||||||
{
|
{
|
||||||
CodeLocation pc = addr + i;
|
CodeLocation pc = addr + i;
|
||||||
if( *pc == 0x03007ffc && mark_idx < MAX_HOOKPOINT )
|
if( *pc == IRQ_HANDLER_POINTER && mark_idx < MAX_HOOKPOINT )
|
||||||
mark[mark_idx++] = pc;
|
mark[mark_idx++] = pc;
|
||||||
|
|
||||||
if( MASK_PC0(0XFFFF0FFF) == 0XE3A00301 &&
|
if( MASK_PC0(0XFFFF0FFF) == 0XE3A00301 &&
|
||||||
@ -311,18 +315,19 @@ static int rom_search_hookpoint( CodeLocation addr, int addrlen, CodeLocation ho
|
|||||||
for( int i=0; i < hookpoint_idx; ++i )
|
for( int i=0; i < hookpoint_idx; ++i )
|
||||||
{
|
{
|
||||||
CodeLocation p = hookpoint[i];
|
CodeLocation p = hookpoint[i];
|
||||||
if( p - addr > (1<<11) ) break;
|
if( p - addr > CORE_HOOKPOINT_RANGE ) break;
|
||||||
|
|
||||||
for( int j = 0; j < mark_idx; ++j )
|
for( int j = 0; j < mark_idx; ++j )
|
||||||
{
|
{
|
||||||
CodeLocation q = mark[j];
|
CodeLocation q = mark[j];
|
||||||
u32 d = p<q ? q-p : p-q;
|
u32 d = p<q ? q-p : p-q;
|
||||||
if( d < (1<<10) )
|
if( d < CORE_HOOKPOINT_NEARBY )
|
||||||
{
|
{
|
||||||
core_hpt = p;
|
core_hpt = p;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if( core_hpt != NULL ) break;
|
||||||
}
|
}
|
||||||
if( core_hpt != NULL )
|
if( core_hpt != NULL )
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user