From 4065547365ef89e4fee5be2fd5d6c03782d9f338 Mon Sep 17 00:00:00 2001 From: Sjoerd van der Berg Date: Wed, 22 Oct 2003 14:44:41 +0000 Subject: [PATCH] updated ems/dpmi functions for new paging mapping Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@1358 --- src/ints/dpmi.cpp | 29 ++++++++++++++++------------- src/ints/ems.cpp | 10 ++++++++-- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/src/ints/dpmi.cpp b/src/ints/dpmi.cpp index 1f6f8696..79287516 100644 --- a/src/ints/dpmi.cpp +++ b/src/ints/dpmi.cpp @@ -37,6 +37,7 @@ #include "setup.h" #include "inout.h" #include "cpu.h" +#include "paging.h" #include "debug.h" @@ -1485,8 +1486,8 @@ Bitu DPMI::Int31Handler(void) SetDescriptor desc; if (cpu.gdt.GetDescriptor(reg_bx,desc)) { DPMI_LOG("DPMI: 0006: Get Base %04X : B:%08X",reg_bx,desc.GetBase()); - reg_cx = desc.GetBase()>>16; - reg_dx = desc.GetBase()&0xFFFF; + reg_cx = (Bit16u)(desc.GetBase()>>16); + reg_dx = (Bit16u)(desc.GetBase()&0xFFFF); DPMI_CALLBACK_SCF(false); } else { DPMI_LOG_ERROR("DPMI: 0006: Invalid Selector: %04X",reg_bx); @@ -1886,18 +1887,18 @@ Bitu DPMI::Int31Handler(void) DPMI_LOG("DPMI: 0503: Resize Memory: H:%08X (%d KB)",handle,newSize*4); if (MEM_ReAllocatePages(handle,newSize,true)) { linear = handle * DPMI_PAGE_SIZE; - reg_si = handle>>16; - reg_di = handle&0xFFFF; - reg_bx = linear>>16; - reg_cx = linear&0xFFFF; + reg_si = (Bit16u)(handle>>16); + reg_di = (Bit16u)(handle&0xFFFF); + reg_bx = (Bit16u)(linear>>16); + reg_cx = (Bit16u)(linear&0xFFFF); DPMI_CALLBACK_SCF(false); } else if (AllocateMem(newByte,newHandle,linear)) { // Not possible, try to allocate DPMI_LOG("DPMI: 0503: Reallocated Memory: %d KB",newSize*4); - reg_si = newHandle>>16; - reg_di = newHandle&0xFFFF; - reg_bx = linear>>16; - reg_cx = linear&0xFFFF; + reg_si = (Bit16u)(newHandle>>16); + reg_di = (Bit16u)(newHandle&0xFFFF); + reg_bx = (Bit16u)(linear>>16); + reg_cx = (Bit16u)(linear&0xFFFF); // copy contents Bitu size = MEM_AllocatedPages(handle); if (newSize>16; reg_cx = linear & 0xFFFF; diff --git a/src/ints/ems.cpp b/src/ints/ems.cpp index de226fd8..6efb5131 100644 --- a/src/ints/ems.cpp +++ b/src/ints/ems.cpp @@ -156,13 +156,19 @@ static Bit8u EMM_MapPage(Bitu phys_page,Bit16u handle,Bit16u log_page) { /* Mapping it is */ emm_mappings[phys_page].handle=handle; emm_mappings[phys_page].page=log_page; - MEM_MapPagesHandle(EMM_PAGEFRAME4K+phys_page*4,emm_handles[handle].mem,log_page*4,4); + + MemHandle memh=MEM_NextHandleAt(emm_handles[handle].mem,log_page*4);; + for (Bitu i=0;i<4;i++) { + PAGING_MapPage(EMM_PAGEFRAME4K+phys_page*4+i,memh); + memh=MEM_NextHandle(memh); + } return EMM_NO_ERROR; } else if (log_page==NULL_PAGE) { /* Unmapping it is */ emm_mappings[phys_page].handle=NULL_HANDLE; emm_mappings[phys_page].page=NULL_PAGE; - MEM_UnmapPages(EMM_PAGEFRAME4K+phys_page*4,4); + for (Bitu i=0;i<4;i++) + PAGING_MapPage(EMM_PAGEFRAME4K+phys_page*4+i,EMM_PAGEFRAME4K+phys_page*4+i); return EMM_NO_ERROR; } else { /* Illegal logical page it is */