I botched the linked list implementation pretty badly.
Kudos to TLD for fixing it for me.
This commit is contained in:
parent
0fc3304a35
commit
5d7c6627fd
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: cpu.cc,v 1.31 2002-06-05 21:51:30 yakovlev Exp $
|
||||
// $Id: cpu.cc,v 1.32 2002-06-06 23:03:09 yakovlev Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -237,20 +237,6 @@ async_events_processed:
|
||||
new_phy_addr += i->ilen;
|
||||
} else {
|
||||
// MISS :'(
|
||||
#endif // #if BX_FETCHDECODE_CACHE
|
||||
|
||||
maxisize = 16;
|
||||
if (BX_CPU_THIS_PTR bytesleft < 16) {
|
||||
maxisize = BX_CPU_THIS_PTR bytesleft;
|
||||
}
|
||||
ret = FetchDecode(fetch_ptr, i, maxisize, is_32);
|
||||
|
||||
#if BX_FETCHDECODE_CACHE
|
||||
// The instruction straddles a page boundary.
|
||||
// Not storing such instructions in the cache is probably the
|
||||
// easiest way to handle them
|
||||
if (ret) {
|
||||
Bit32u rpn,rpn_sel,old_rpn;
|
||||
if(BX_CPU_THIS_PTR fdcache_ip[bx_fdcache_sel] != 0xFFFFFFFF) {
|
||||
Bit32u next_ptr=BX_CPU_THIS_PTR fdcache_rpn_list[bx_fdcache_sel].next;
|
||||
Bit32u prev_ptr=BX_CPU_THIS_PTR fdcache_rpn_list[bx_fdcache_sel].prev;
|
||||
@ -264,24 +250,55 @@ async_events_processed:
|
||||
BX_CPU_THIS_PTR fdcache_rpn_start[temp_rpn_sel] = next_ptr;
|
||||
}
|
||||
}
|
||||
#endif // #if BX_FETCHDECODE_CACHE
|
||||
|
||||
maxisize = 16;
|
||||
if (BX_CPU_THIS_PTR bytesleft < 16) {
|
||||
maxisize = BX_CPU_THIS_PTR bytesleft;
|
||||
}
|
||||
ret = FetchDecode(fetch_ptr, i, maxisize, is_32);
|
||||
|
||||
#if BX_FETCHDECODE_CACHE
|
||||
// The instruction straddles a page boundary.
|
||||
// Not storing such instructions in the cache is probably the
|
||||
// easiest way to handle them
|
||||
|
||||
//FIXME: These should not be necessary.
|
||||
BX_CPU_THIS_PTR fdcache_rpn_list[bx_fdcache_sel].next = 0xFFFFFFFF;
|
||||
BX_CPU_THIS_PTR fdcache_rpn_list[bx_fdcache_sel].prev = 0xFFFFFFFF;
|
||||
|
||||
if (ret) {
|
||||
Bit32u rpn,rpn_sel,old_rpn;
|
||||
//FIXME: Leaving because will be needed when above are removed.
|
||||
BX_CPU_THIS_PTR fdcache_rpn_list[bx_fdcache_sel].prev = 0xFFFFFFFF;
|
||||
BX_CPU_THIS_PTR fdcache_ip[bx_fdcache_sel] = bx_fdcache_ip;
|
||||
BX_CPU_THIS_PTR fdcache_is32[bx_fdcache_sel] = is_32;
|
||||
new_phy_addr += i->ilen;
|
||||
|
||||
rpn=bx_fdcache_ip>>12;
|
||||
rpn_sel=rpn & BX_FDCACHE_RPN_MASK;
|
||||
old_rpn=BX_CPU_THIS_PTR fdcache_rpn[rpn_sel];
|
||||
if((old_rpn != rpn) && (old_rpn != 0xFFFFFFFF)) {
|
||||
|
||||
if(old_rpn == 0xFFFFFFFF) {
|
||||
BX_CPU_THIS_PTR fdcache_rpn[rpn_sel] = rpn;
|
||||
BX_CPU_THIS_PTR fdcache_rpn_start[rpn_sel] = bx_fdcache_sel;
|
||||
//FIXME: Leaving because will be needed when above are removed.
|
||||
BX_CPU_THIS_PTR fdcache_rpn_list[bx_fdcache_sel].next=0xFFFFFFFF;
|
||||
} else if (old_rpn != rpn) {
|
||||
Bit32u index = BX_CPU_THIS_PTR fdcache_rpn_start[rpn_sel];
|
||||
for(;index!=0xFFFFFFFF;index=BX_CPU_THIS_PTR fdcache_rpn_list[index].next) {
|
||||
BX_CPU_THIS_PTR fdcache_ip[index] = 0xFFFFFFFF;
|
||||
}
|
||||
BX_CPU_THIS_PTR fdcache_rpn[rpn_sel] = rpn;
|
||||
BX_CPU_THIS_PTR fdcache_rpn_start[rpn_sel] = bx_fdcache_sel;
|
||||
//FIXME: Leaving because will be needed when above are removed.
|
||||
BX_CPU_THIS_PTR fdcache_rpn_list[bx_fdcache_sel].next=0xFFFFFFFF;
|
||||
} else {
|
||||
|
||||
} else { // add to the head of the list
|
||||
Bit32u index = BX_CPU_THIS_PTR fdcache_rpn_start[rpn_sel];
|
||||
BX_CPU_THIS_PTR fdcache_rpn_list[bx_fdcache_sel].next=index;
|
||||
BX_CPU_THIS_PTR fdcache_rpn_list[index].prev = bx_fdcache_sel;
|
||||
BX_CPU_THIS_PTR fdcache_rpn_start[rpn_sel] = bx_fdcache_sel;
|
||||
}
|
||||
} else {
|
||||
// Invalidate cache!
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: memory.cc,v 1.14 2002-06-05 21:51:30 yakovlev Exp $
|
||||
// $Id: memory.cc,v 1.15 2002-06-06 23:03:09 yakovlev Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -61,6 +61,8 @@ BX_MEM_C::write_physical(BX_CPU_C *cpu, Bit32u addr, unsigned len, void *data)
|
||||
// before the write because there COULD be programs which use
|
||||
// jump-in-the-middle-of-an-instruction schemes (esp. copyprotection
|
||||
// schemes)
|
||||
|
||||
|
||||
Bit32u rpn_start = addr >> 12;
|
||||
Bit32u rpn_end = (addr+len-1) >> 12;
|
||||
Bit32u rpn = rpn_start;
|
||||
@ -69,11 +71,14 @@ BX_MEM_C::write_physical(BX_CPU_C *cpu, Bit32u addr, unsigned len, void *data)
|
||||
Bit32u old_rpn = cpu->fdcache_rpn[rpn_sel];
|
||||
if(rpn==old_rpn) {
|
||||
Bit32u index = cpu->fdcache_rpn_start[rpn_sel];
|
||||
for(;index!=0xFFFFFFFF;index=cpu->fdcache_rpn_list[index].next) {
|
||||
//FIXME: We shouldn't need to and this with BX_FDCACHE_MASK
|
||||
for(;index!=0xFFFFFFFF;index=cpu->fdcache_rpn_list[index & BX_FDCACHE_MASK].next) {
|
||||
cpu->fdcache_ip[index] = 0xFFFFFFFF;
|
||||
//FIXME: This shouldn't be necessary.
|
||||
cpu->fdcache_rpn_list[index].prev = 0xFFFFFFFF;
|
||||
}
|
||||
cpu->fdcache_rpn[rpn_sel] = 0xFFFFFFFF;
|
||||
cpu->fdcache_rpn_start[rpn_sel] = 0xFFFFFFFF;
|
||||
// cpu->fdcache_rpn_start[rpn_sel] = 0xFFFFFFFF;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user