git.ucc.asn.au
/
tpg
/
acess2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Working on GUI, side changes to the message passing
[tpg/acess2.git]
/
Kernel
/
arch
/
x86
/
mm_virt.c
diff --git
a/Kernel/arch/x86/mm_virt.c
b/Kernel/arch/x86/mm_virt.c
index
4f272e7
..
958b9f1
100644
(file)
--- a/
Kernel/arch/x86/mm_virt.c
+++ b/
Kernel/arch/x86/mm_virt.c
@@
-10,6
+10,7
@@
* 0xFF - System Calls / Kernel's User Code
*/
#define DEBUG 1
* 0xFF - System Calls / Kernel's User Code
*/
#define DEBUG 1
+#define SANITY 1
#include <acess.h>
#include <mm_phys.h>
#include <proc.h>
#include <acess.h>
#include <mm_phys.h>
#include <proc.h>
@@
-105,10
+106,8
@@
Uint32 gWorkerStacks[(NUM_WORKER_STACKS+31)/32];
void MM_PreinitVirtual()
{
#if USE_PAE
void MM_PreinitVirtual()
{
#if USE_PAE
- gaInitPDPT[ 0 ] = 0;
gaInitPageDir[ ((PAGE_TABLE_ADDR >> TAB)-3*512+3)*2 ] = ((tTabEnt)&gaInitPageDir - KERNEL_BASE) | 3;
#else
gaInitPageDir[ ((PAGE_TABLE_ADDR >> TAB)-3*512+3)*2 ] = ((tTabEnt)&gaInitPageDir - KERNEL_BASE) | 3;
#else
- gaInitPageDir[ 0 ] = 0;
gaInitPageDir[ PAGE_TABLE_ADDR >> 22 ] = ((tTabEnt)&gaInitPageDir - KERNEL_BASE) | 3;
#endif
INVLPG( PAGE_TABLE_ADDR );
gaInitPageDir[ PAGE_TABLE_ADDR >> 22 ] = ((tTabEnt)&gaInitPageDir - KERNEL_BASE) | 3;
#endif
INVLPG( PAGE_TABLE_ADDR );
@@
-156,6
+155,18
@@
void MM_InstallVirtual()
#endif
}
#endif
}
+/**
+ * \brief Cleans up the SMP required mappings
+ */
+void MM_FinishVirtualInit()
+{
+ #if USE_PAE
+ gaInitPDPT[ 0 ] = 0;
+ #else
+ gaInitPageDir[ 0 ] = 0;
+ #endif
+}
+
/**
* \fn void MM_PageFault(tVAddr Addr, Uint ErrorCode, tRegs *Regs)
* \brief Called on a page fault
/**
* \fn void MM_PageFault(tVAddr Addr, Uint ErrorCode, tRegs *Regs)
* \brief Called on a page fault
@@
-177,6
+188,7
@@
void MM_PageFault(tVAddr Addr, Uint ErrorCode, tRegs *Regs)
}
else
{
}
else
{
+ //Log("MM_PageFault: COW - MM_DuplicatePage(0x%x)", Addr);
paddr = MM_DuplicatePage( Addr );
MM_DerefPhys( gaPageTable[Addr>>12] & ~0xFFF );
gaPageTable[Addr>>12] &= PF_USER;
paddr = MM_DuplicatePage( Addr );
MM_DerefPhys( gaPageTable[Addr>>12] & ~0xFFF );
gaPageTable[Addr>>12] &= PF_USER;
@@
-318,7
+330,7
@@
tPAddr MM_Allocate(tVAddr VAddr)
//LOG("paddr = 0x%llx (new table)", paddr);
if( paddr == 0 ) {
Warning("MM_Allocate - Out of Memory (Called by %p)", __builtin_return_address(0));
//LOG("paddr = 0x%llx (new table)", paddr);
if( paddr == 0 ) {
Warning("MM_Allocate - Out of Memory (Called by %p)", __builtin_return_address(0));
- LEAVE('i',0);
+
//
LEAVE('i',0);
return 0;
}
// Map
return 0;
}
// Map
@@
-524,7
+536,7
@@
tPAddr MM_Clone()
memsetd( gaTmpDir, 0, 1024 );
// Copy Tables
memsetd( gaTmpDir, 0, 1024 );
// Copy Tables
- for(
i=0;i<768;i
++)
+ for(
i = 0; i < 768; i
++)
{
// Check if table is allocated
if( !(gaPageDir[i] & PF_PRESENT) ) {
{
// Check if table is allocated
if( !(gaPageDir[i] & PF_PRESENT) ) {
@@
-802,6
+814,8
@@
tPAddr MM_DuplicatePage(tVAddr VAddr)
Uint temp;
int wasRO = 0;
Uint temp;
int wasRO = 0;
+ //ENTER("xVAddr", VAddr);
+
// Check if mapped
if( !(gaPageDir [VAddr >> 22] & PF_PRESENT) ) return 0;
if( !(gaPageTable[VAddr >> 12] & PF_PRESENT) ) return 0;
// Check if mapped
if( !(gaPageDir [VAddr >> 22] & PF_PRESENT) ) return 0;
if( !(gaPageTable[VAddr >> 12] & PF_PRESENT) ) return 0;
@@
-826,6
+840,7
@@
tPAddr MM_DuplicatePage(tVAddr VAddr)
if(!wasRO) gaPageTable[VAddr >> 12] |= PF_WRITE;
INVLPG(VAddr);
if(!wasRO) gaPageTable[VAddr >> 12] |= PF_WRITE;
INVLPG(VAddr);
+ //LEAVE('X', ret);
return ret;
}
return ret;
}
@@
-958,21
+973,12
@@
tVAddr MM_AllocDMA(int Pages, int MaxBits, tPAddr *PhysAddr)
}
// Slow Allocate
}
// Slow Allocate
- phys = MM_AllocPhysRange(Pages);
+ phys = MM_AllocPhysRange(Pages
, MaxBits
);
// - Was it allocated?
if(phys == 0) {
LEAVE('i', 0);
return 0;
}
// - Was it allocated?
if(phys == 0) {
LEAVE('i', 0);
return 0;
}
- // - Check if the memory is OK
- if(phys + (Pages-1)*0x1000 > maxCheck)
- {
- // Deallocate and return 0
- for(;Pages--;phys+=0x1000)
- MM_DerefPhys(phys);
- LEAVE('i', 0);
- return 0;
- }
// Allocated successfully, now map
ret = MM_MapHWPage(phys, Pages);
// Allocated successfully, now map
ret = MM_MapHWPage(phys, Pages);
UCC
git Repository :: git.ucc.asn.au