New dynamic paging implementation (4) #67
This commit is contained in:
parent
334e1bbae5
commit
5ae13125bc
|
@ -182,7 +182,7 @@ void MmInitPaging(void)
|
|||
//
|
||||
// Get a page from an address
|
||||
//
|
||||
static pte_t MmGetPageDescriptor(void *virtualAddr)
|
||||
static pte_t MmGetPageDescriptorFromVirtual(void *virtualAddr)
|
||||
{
|
||||
ulong virtAddrPage = (ulong)virtualAddr & ( ~(KPAGESIZE - 1));
|
||||
|
||||
|
@ -210,7 +210,7 @@ static pte_t MmGetPageDescriptor(void *virtualAddr)
|
|||
void *MmTransVirtToPhyAddr(void* virtualAddr)
|
||||
{
|
||||
ulong virtAddrPage = (ulong)virtualAddr & ( ~(KPAGESIZE - 1));
|
||||
pte_t page = MmGetPageDescriptor(virtualAddr);
|
||||
pte_t page = MmGetPageDescriptorFromVirtual(virtualAddr);
|
||||
|
||||
if (page == (page & ~(KPAGESIZE - 1))) {
|
||||
return NULL;
|
||||
|
@ -229,7 +229,7 @@ void *MmTransPhyToVirtAddr(void* physicalAddr)
|
|||
//
|
||||
void MmSetPage(void* virtualAddr, ulong flags)
|
||||
{
|
||||
pte_t page = MmGetPageDescriptor(virtualAddr);
|
||||
pte_t page = MmGetPageDescriptorFromVirtual(virtualAddr);
|
||||
|
||||
page |= flags;
|
||||
|
||||
|
@ -241,7 +241,7 @@ void MmSetPage(void* virtualAddr, ulong flags)
|
|||
//
|
||||
void MmUnsetPage(void* virtualAddr, ulong flags)
|
||||
{
|
||||
pte_t page = MmGetPageDescriptor(virtualAddr);
|
||||
pte_t page = MmGetPageDescriptorFromVirtual(virtualAddr);
|
||||
|
||||
page &= (~flags);
|
||||
|
||||
|
@ -253,7 +253,11 @@ void MmUnsetPage(void* virtualAddr, ulong flags)
|
|||
//
|
||||
void MmMapPage(void* virtualAddr, void* physicalAddr, ulong flags)
|
||||
{
|
||||
pte_t page = MmGetPageDescriptorFromVirtual(virtualAddr);
|
||||
|
||||
page = ((ulong)physicalAddr & ~(KPAGESIZE - 1)) | flags;
|
||||
|
||||
KeFlushTlbSingle(page);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -261,7 +265,11 @@ void MmMapPage(void* virtualAddr, void* physicalAddr, ulong flags)
|
|||
//
|
||||
void MmUnmapPage(void* virtualAddr)
|
||||
{
|
||||
pte_t page = MmGetPageDescriptorFromVirtual(virtualAddr);
|
||||
|
||||
page = 0;
|
||||
|
||||
KeFlushTlbSingle(page);
|
||||
}
|
||||
|
||||
//-----------
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue