diff --git a/include/paging.h b/include/paging.h index f35c3fcc..d9935b14 100644 --- a/include/paging.h +++ b/include/paging.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2007 The DOSBox Team + * Copyright (C) 2002-2008 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: paging.h,v 1.30 2007-12-10 22:11:13 c2woody Exp $ */ +/* $Id: paging.h,v 1.31 2008-01-05 21:04:43 c2woody Exp $ */ #ifndef DOSBOX_PAGING_H #define DOSBOX_PAGING_H @@ -93,6 +93,7 @@ void PAGING_UnlinkPages(Bitu lin_page,Bitu pages); /* This maps the page directly, only use when paging is disabled */ void PAGING_MapPage(Bitu lin_page,Bitu phys_page); bool PAGING_MakePhysPage(Bitu & page); +bool PAGING_ForcePageInit(Bitu lin_addr); void MEM_SetLFB(Bitu page, Bitu pages, PageHandler *handler, PageHandler *mmiohandler); void MEM_SetPageHandler(Bitu phys_page, Bitu pages, PageHandler * handler); diff --git a/src/cpu/core_dyn_x86/decoder.h b/src/cpu/core_dyn_x86/decoder.h index 8ef2330a..4f23c0ad 100644 --- a/src/cpu/core_dyn_x86/decoder.h +++ b/src/cpu/core_dyn_x86/decoder.h @@ -60,8 +60,17 @@ static bool MakeCodePage(Bitu lin_addr,CodePageHandler * &cph) { return false; } if (handler->flags & PFLAG_NOCODE) { - LOG_MSG("DYNX86:Can't run code in this page"); - cph=0; return false; + if (PAGING_ForcePageInit(lin_addr)) { + handler=get_tlb_readhandler(lin_addr); + 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!"); + cph=0; return false; + } } Bitu lin_page=lin_addr >> 12; Bitu phys_page=lin_page; diff --git a/src/cpu/core_dynrec/decoder_basic.h b/src/cpu/core_dynrec/decoder_basic.h index 1f25c474..c3d95773 100644 --- a/src/cpu/core_dynrec/decoder_basic.h +++ b/src/cpu/core_dynrec/decoder_basic.h @@ -139,9 +139,18 @@ static bool MakeCodePage(Bitu lin_addr,CodePageHandlerDynRec * &cph) { return false; } if (handler->flags & PFLAG_NOCODE) { - LOG_MSG("DYNREC:Can't run code in this page"); - cph=0; - return false; + if (PAGING_ForcePageInit(lin_addr)) { + handler=get_tlb_readhandler(lin_addr); + if (handler->flags & PFLAG_HASCODE) { + cph=(CodePageHandlerDynRec *)handler; + return false; + } + } + if (handler->flags & PFLAG_NOCODE) { + LOG_MSG("DYNREC:Can't run code in this page"); + cph=0; + return false; + } } Bitu lin_page=lin_addr>>12; Bitu phys_page=lin_page; diff --git a/src/cpu/paging.cpp b/src/cpu/paging.cpp index 57ce9e9a..fc7bfa85 100644 --- a/src/cpu/paging.cpp +++ b/src/cpu/paging.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2007 The DOSBox Team + * Copyright (C) 2002-2008 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: paging.cpp,v 1.32 2007-12-29 20:22:22 c2woody Exp $ */ +/* $Id: paging.cpp,v 1.33 2008-01-05 21:05:06 c2woody Exp $ */ #include #include @@ -391,6 +391,30 @@ public: } return true; } + void InitPageForced(Bitu lin_addr) { + Bitu lin_page=lin_addr >> 12; + Bitu phys_page; + if (paging.enabled) { + X86PageEntry table; + X86PageEntry entry; + InitPageCheckPresence(lin_addr,false,table,entry); + + if (!table.block.a) { + table.block.a=1; //Set access + phys_writed((paging.base.page<<12)+(lin_page >> 10)*4,table.load); + } + if (!entry.block.a) { + entry.block.a=1; //Set access + phys_writed((table.block.base<<12)+(lin_page & 0x3ff)*4,entry.load); + } + phys_page=entry.block.base; + // maybe use read-only page here if possible + } else { + if (lin_page> 12; + Bitu phys_page; + if (paging.enabled) { + X86PageEntry table; + X86PageEntry entry; + InitPageCheckPresence(lin_addr,true,table,entry); + + if (!table.block.a) { + table.block.a=1; //Set access + phys_writed((paging.base.page<<12)+(lin_page >> 10)*4,table.load); + } + if (!entry.block.a) { + entry.block.a=1; //Set access + phys_writed((table.block.base<<12)+(lin_page & 0x3ff)*4,entry.load); + } + phys_page=entry.block.base; + } else { + if (lin_page>12,1); + init_page_handler_userro.InitPageForced(lin_addr); + return true; + } + return false; +} + #if defined(USE_FULL_TLB) void PAGING_InitTLB(void) { for (Bitu i=0;i