Use special physical memory access for dma transfers
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2086
This commit is contained in:
parent
d1d89dc803
commit
fba8482ce1
3 changed files with 36 additions and 12 deletions
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: paging.h,v 1.12 2004-10-12 10:45:10 harekiet Exp $ */
|
||||
/* $Id: paging.h,v 1.13 2004-12-22 19:49:24 harekiet Exp $ */
|
||||
|
||||
#ifndef _PAGING_H_
|
||||
#define _PAGING_H_
|
||||
|
@ -117,7 +117,8 @@ struct PagingBlock {
|
|||
Bitu used;
|
||||
Bit32u entries[PAGING_LINKS];
|
||||
} links;
|
||||
bool enabled;
|
||||
Bit32u firstmb[LINK_START];
|
||||
bool enabled;
|
||||
};
|
||||
|
||||
extern PagingBlock paging;
|
||||
|
|
|
@ -31,7 +31,8 @@
|
|||
#define LINK_TOTAL (64*1024)
|
||||
|
||||
PagingBlock paging;
|
||||
static Bit32u mapfirstmb[LINK_START];
|
||||
|
||||
|
||||
|
||||
Bitu PageHandler::readb(PhysPt addr) {
|
||||
E_Exit("No byte handler for read from %d",addr);
|
||||
|
@ -191,7 +192,7 @@ public:
|
|||
phys_writed(entry_addr,entry.load);
|
||||
phys_page=entry.block.base;
|
||||
} else {
|
||||
if (lin_page<LINK_START) phys_page=mapfirstmb[lin_page];
|
||||
if (lin_page<LINK_START) phys_page=paging.firstmb[lin_page];
|
||||
else phys_page=lin_page;
|
||||
}
|
||||
PAGING_LinkPage(lin_page,phys_page);
|
||||
|
@ -210,7 +211,7 @@ bool PAGING_MakePhysPage(Bitu & page) {
|
|||
if (!entry.block.p) return false;
|
||||
page=entry.block.base;
|
||||
} else {
|
||||
if (page<LINK_START) page=mapfirstmb[page];
|
||||
if (page<LINK_START) page=paging.firstmb[page];
|
||||
//Else keep it the same
|
||||
}
|
||||
return true;
|
||||
|
@ -275,7 +276,7 @@ void PAGING_LinkPage(Bitu lin_page,Bitu phys_page) {
|
|||
|
||||
void PAGING_MapPage(Bitu lin_page,Bitu phys_page) {
|
||||
if (lin_page<LINK_START) {
|
||||
mapfirstmb[lin_page]=phys_page;
|
||||
paging.firstmb[lin_page]=phys_page;
|
||||
paging.tlb.read[lin_page]=0;
|
||||
paging.tlb.write[lin_page]=0;
|
||||
paging.tlb.handler[lin_page]=&init_page_handler;
|
||||
|
@ -324,7 +325,7 @@ void PAGING_Init(Section * sec) {
|
|||
PAGING_InitTLB();
|
||||
Bitu i;
|
||||
for (i=0;i<LINK_START;i++) {
|
||||
mapfirstmb[i]=i;
|
||||
paging.firstmb[i]=i;
|
||||
}
|
||||
pf_queue.used=0;
|
||||
}
|
||||
|
|
|
@ -22,10 +22,31 @@
|
|||
#include "inout.h"
|
||||
#include "dma.h"
|
||||
#include "pic.h"
|
||||
#include "paging.h"
|
||||
|
||||
DmaChannel *DmaChannels[8];
|
||||
DmaController *DmaControllers[2];
|
||||
|
||||
static void DMA_BlockRead(PhysPt pt,void * data,Bitu size) {
|
||||
Bit8u * write=(Bit8u *) data;
|
||||
for ( ; size ; size--, pt++) {
|
||||
Bitu page = pt >> 12;
|
||||
if (page < LINK_START)
|
||||
page = paging.firstmb[page];
|
||||
*write++=phys_readb(page*4096 + (pt & 4095));
|
||||
}
|
||||
}
|
||||
|
||||
static void DMA_BlockWrite(PhysPt pt,void * data,Bitu size) {
|
||||
Bit8u * read=(Bit8u *) data;
|
||||
for ( ; size ; size--, pt++) {
|
||||
Bitu page = pt >> 12;
|
||||
if (page < LINK_START)
|
||||
page = paging.firstmb[page];
|
||||
phys_writeb(page*4096 + (pt & 4095), *read++);
|
||||
}
|
||||
}
|
||||
|
||||
static void DMA_WriteControllerReg(DmaController * cont,Bitu reg,Bitu val,Bitu len) {
|
||||
DmaChannel * chan;Bitu i;
|
||||
Bitu base=cont->chanbase;
|
||||
|
@ -121,7 +142,8 @@ static Bitu DMA_ReadControllerReg(DmaController * cont,Bitu reg,Bitu len) {
|
|||
}
|
||||
return ret;
|
||||
default:
|
||||
LOG_MSG("Trying to read undefined DMA Red %x",reg);
|
||||
LOG_MSG("Trying to read undefined DMA port %x",reg);
|
||||
break;
|
||||
}
|
||||
return 0xffffffff;
|
||||
}
|
||||
|
@ -180,12 +202,12 @@ Bitu DmaChannel::Read(Bitu want, Bit8u * buffer) {
|
|||
again:
|
||||
Bitu left=(currcnt+1);
|
||||
if (want<left) {
|
||||
MEM_BlockRead(pagebase+(curraddr << DMA16),buffer,want << DMA16);
|
||||
DMA_BlockRead(pagebase+(curraddr << DMA16),buffer,want << DMA16);
|
||||
done+=want;
|
||||
curraddr+=want;
|
||||
currcnt-=want;
|
||||
} else {
|
||||
MEM_BlockRead(pagebase+(curraddr << DMA16),buffer,left << DMA16);
|
||||
DMA_BlockRead(pagebase+(curraddr << DMA16),buffer,left << DMA16);
|
||||
buffer+=left << DMA16;
|
||||
want-=left;
|
||||
done+=left;
|
||||
|
@ -208,12 +230,12 @@ Bitu DmaChannel::Write(Bitu want, Bit8u * buffer) {
|
|||
again:
|
||||
Bitu left=(currcnt+1);
|
||||
if (want<left) {
|
||||
MEM_BlockWrite(pagebase+(curraddr << DMA16),buffer,want << DMA16);
|
||||
DMA_BlockWrite(pagebase+(curraddr << DMA16),buffer,want << DMA16);
|
||||
done+=want;
|
||||
curraddr+=want;
|
||||
currcnt-=want;
|
||||
} else {
|
||||
MEM_BlockWrite(pagebase+(curraddr << DMA16),buffer,left << DMA16);
|
||||
DMA_BlockWrite(pagebase+(curraddr << DMA16),buffer,left << DMA16);
|
||||
buffer+=left << DMA16;
|
||||
want-=left;
|
||||
done+=left;
|
||||
|
|
Loading…
Add table
Reference in a new issue