Clear paging link cache when full
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@1946
This commit is contained in:
parent
d94017a7b1
commit
78a0e947ae
1 changed files with 7 additions and 2 deletions
|
@ -254,16 +254,21 @@ void PAGING_UnlinkPages(Bitu lin_page,Bitu pages) {
|
|||
void PAGING_LinkPage(Bitu lin_page,Bitu phys_page) {
|
||||
PageHandler * handler=MEM_GetPageHandler(phys_page);
|
||||
Bitu lin_base=lin_page << 12;
|
||||
|
||||
if (lin_page>=TLB_SIZE || phys_page>=TLB_SIZE)
|
||||
E_Exit("Illegal page");
|
||||
|
||||
if (paging.links.used>=PAGING_LINKS) {
|
||||
LOG(LOG_PAGING,LOG_NORMAL)("Not enough paging links, resetting cache");
|
||||
PAGING_ClearTLB();
|
||||
}
|
||||
|
||||
HostPt host_mem=handler->GetHostPt(phys_page);
|
||||
paging.tlb.phys_page[lin_page]=phys_page;
|
||||
if (handler->flags & PFLAG_READABLE) paging.tlb.read[lin_page]=host_mem-lin_base;
|
||||
else paging.tlb.read[lin_page]=0;
|
||||
if (handler->flags & PFLAG_WRITEABLE) paging.tlb.write[lin_page]=host_mem-lin_base;
|
||||
else paging.tlb.write[lin_page]=0;
|
||||
if (paging.links.used>=PAGING_LINKS) E_Exit("Not enough paging links");
|
||||
|
||||
paging.links.entries[paging.links.used++]=lin_page;
|
||||
paging.tlb.handler[lin_page]=handler;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue