Changed the paging link management
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@1505
This commit is contained in:
parent
c26a547cde
commit
de536dfae0
2 changed files with 12 additions and 20 deletions
|
@ -32,10 +32,14 @@ class PageDirectory;
|
|||
#define PFLAG_HASROM 0x4
|
||||
#define PFLAG_HASCODE 0x8 //Page contains dynamic code
|
||||
#define PFLAG_NOCODE 0x10 //No dynamic code can be generated here
|
||||
#define PFLAG_ILLEGAL 0x20 //No dynamic code can be generated here
|
||||
#define PFLAG_INIT 0x20 //No dynamic code can be generated here
|
||||
|
||||
#define LINK_START ((1024+64)/4) //Start right after the HMA
|
||||
|
||||
//Allow 128 mb of memory to be linked
|
||||
#define PAGING_LINKS (128*1024/4)
|
||||
|
||||
|
||||
class PageHandler {
|
||||
public:
|
||||
virtual Bitu readb(PhysPt addr);
|
||||
|
@ -44,7 +48,6 @@ public:
|
|||
virtual void writeb(PhysPt addr,Bitu val);
|
||||
virtual void writew(PhysPt addr,Bitu val);
|
||||
virtual void writed(PhysPt addr,Bitu val);
|
||||
virtual void AddPageLink(Bitu lin_page, Bitu phys_page)=0;
|
||||
virtual HostPt GetHostPt(Bitu phys_page);
|
||||
Bitu flags;
|
||||
};
|
||||
|
@ -57,15 +60,15 @@ Bitu PAGING_GetDirBase(void);
|
|||
void PAGING_SetDirBase(Bitu cr3);
|
||||
void PAGING_InitTLB(void);
|
||||
void PAGING_ClearTLB(void);
|
||||
void PAGING_ClearTLBEntries(Bitu pages,Bit32u * entries);
|
||||
|
||||
void PAGING_LinkPage(Bitu lin_page,Bitu phys_page);
|
||||
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);
|
||||
|
||||
void MEM_SetLFB(Bitu _page,Bitu _pages,HostPt _pt);
|
||||
void MEM_SetPageHandler(Bitu phys_page,Bitu pages,PageHandler * handler);
|
||||
void MEM_UnlinkPages(void);
|
||||
|
||||
Bit32u MEM_PhysReadD(Bitu addr);
|
||||
|
||||
|
@ -106,6 +109,10 @@ struct PagingBlock {
|
|||
PageHandler * handler[TLB_SIZE];
|
||||
Bit32u phys_page[TLB_SIZE];
|
||||
} tlb;
|
||||
struct {
|
||||
Bitu used;
|
||||
Bit32u entries[PAGING_LINKS];
|
||||
} links;
|
||||
bool enabled;
|
||||
};
|
||||
|
||||
|
|
|
@ -69,11 +69,8 @@ static struct MemoryBlock {
|
|||
|
||||
class IllegalPageHandler : public PageHandler {
|
||||
public:
|
||||
void AddPageLink(Bitu lin_page, Bitu phys_page) {
|
||||
}
|
||||
|
||||
IllegalPageHandler() {
|
||||
flags=PFLAG_ILLEGAL|PFLAG_NOCODE;
|
||||
flags=PFLAG_INIT|PFLAG_NOCODE;
|
||||
}
|
||||
Bitu readb(PhysPt addr) {
|
||||
LOG_MSG("Illegal read from %x",addr);
|
||||
|
@ -89,13 +86,6 @@ public:
|
|||
|
||||
class RAMPageHandler : public PageHandler {
|
||||
public:
|
||||
void AddPageLink(Bitu lin_page, Bitu phys_page) {
|
||||
/* Always clear links in first MB on TLB change */
|
||||
if (lin_page<LINK_START) return;
|
||||
if (memory.links.used<MAX_LINKS) {
|
||||
memory.links.pages[memory.links.used++]=lin_page;
|
||||
} else E_Exit("MEM:Ran out of page links");
|
||||
}
|
||||
RAMPageHandler() {
|
||||
flags=PFLAG_READABLE|PFLAG_WRITEABLE;
|
||||
}
|
||||
|
@ -154,11 +144,6 @@ void MEM_SetPageHandler(Bitu phys_page,Bitu pages,PageHandler * handler) {
|
|||
}
|
||||
}
|
||||
|
||||
void MEM_UnlinkPages(void) {
|
||||
PAGING_ClearTLBEntries(memory.links.used,memory.links.pages);
|
||||
memory.links.used=0;
|
||||
}
|
||||
|
||||
Bitu mem_strlen(PhysPt pt) {
|
||||
Bitu x=0;
|
||||
while (x<1024) {
|
||||
|
|
Loading…
Add table
Reference in a new issue