directly handle some page faults of MakeCodePage
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2616
This commit is contained in:
parent
77bb709df9
commit
eedd8cc98c
3 changed files with 20 additions and 8 deletions
|
@ -226,7 +226,11 @@ restart_core:
|
|||
#if C_HEAVY_DEBUG
|
||||
if (DEBUG_HeavyIsBreakpoint()) return debugCallback;
|
||||
#endif
|
||||
CodePageHandler * chandler=MakeCodePage(ip_page);
|
||||
CodePageHandler * chandler=0;
|
||||
if (GCC_UNLIKELY(MakeCodePage(ip_page,chandler))) {
|
||||
CPU_Exception(cpu.exception.which,cpu.exception.error);
|
||||
goto restart_core;
|
||||
}
|
||||
if (!chandler) return CPU_Core_Normal_Run();
|
||||
/* Find correct Dynamic Block to run */
|
||||
CacheBlock * block=chandler->FindCacheBlock(ip_point&4095);
|
||||
|
|
|
@ -233,18 +233,23 @@ private:
|
|||
};
|
||||
|
||||
|
||||
static CodePageHandler * MakeCodePage(Bitu lin_page) {
|
||||
mem_readb(lin_page << 12); //Ensure page contains memory
|
||||
static bool MakeCodePage(Bitu lin_page,CodePageHandler * &cph) {
|
||||
Bit8u rdval;
|
||||
//Ensure page contains memory:
|
||||
if (GCC_UNLIKELY(mem_readb_checked_x86(lin_page << 12,&rdval))) return true;
|
||||
PageHandler * handler=paging.tlb.handler[lin_page];
|
||||
if (handler->flags & PFLAG_HASCODE) return ( CodePageHandler *)handler;
|
||||
if (handler->flags & PFLAG_HASCODE) {
|
||||
cph=( CodePageHandler *)handler;
|
||||
return false;
|
||||
}
|
||||
if (handler->flags & PFLAG_NOCODE) {
|
||||
LOG_MSG("DYNX86:Can't run code in this page");
|
||||
return 0;
|
||||
cph=0; return false;
|
||||
}
|
||||
Bitu phys_page=lin_page;
|
||||
if (!PAGING_MakePhysPage(phys_page)) {
|
||||
LOG_MSG("DYNX86:Can't find physpage");
|
||||
return 0;
|
||||
cph=0; return false;
|
||||
}
|
||||
/* Find a free CodePage */
|
||||
if (!cache.free_pages) {
|
||||
|
@ -260,7 +265,8 @@ static CodePageHandler * MakeCodePage(Bitu lin_page) {
|
|||
cpagehandler->SetupAt(phys_page,handler);
|
||||
MEM_SetPageHandler(phys_page,1,cpagehandler);
|
||||
PAGING_UnlinkPages(lin_page,1);
|
||||
return cpagehandler;
|
||||
cph=cpagehandler;
|
||||
return false;
|
||||
}
|
||||
|
||||
static INLINE void cache_addunsedblock(CacheBlock * block) {
|
||||
|
|
|
@ -61,7 +61,9 @@ static Bit8u decode_fetchb(void) {
|
|||
if (decode.page.index>=4096) {
|
||||
/* Advance to the next page */
|
||||
decode.active_block->page.end=4095;
|
||||
decode.page.code=MakeCodePage(++decode.page.first);
|
||||
/* trigger possible page fault here */
|
||||
mem_readb((++decode.page.first) << 12);
|
||||
MakeCodePage(decode.page.first,decode.page.code);
|
||||
CacheBlock * newblock=cache_getblock();
|
||||
decode.active_block->crossblock=newblock;
|
||||
newblock->crossblock=decode.active_block;
|
||||
|
|
Loading…
Add table
Reference in a new issue