//ENTER("xAddr bErrorCode", Addr, ErrorCode);
// -- Check for COW --
- if( gaPageDir [Addr>>22] & PF_PRESENT
- && gaPageTable[Addr>>12] & PF_PRESENT
+ if( gaPageDir [Addr>>22] & PF_PRESENT && gaPageTable[Addr>>12] & PF_PRESENT
&& gaPageTable[Addr>>12] & PF_COW )
{
tPAddr paddr;
}
INVLPG( Addr & ~0xFFF );
- //LEAVE('-')
return;
}
{
// Allocate directory
paddr = MM_AllocPhys();
- //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);
return 0;
}
- // Map
+ // Map and mark as user (if needed)
gaPageDir[ VAddr >> 22 ] = paddr | 3;
- // Mark as user
if(VAddr < MM_USER_MAX) gaPageDir[ VAddr >> 22 ] |= PF_USER;
INVLPG( &gaPageDir[ VAddr >> 22 ] );
- //LOG("Clearing new table");
memsetd( &gaPageTable[ (VAddr >> 12) & ~0x3FF ], 0, 1024 );
}
// Check if the page is already allocated
{
Uint i, j;
- // Copy Directories
for( i = 0; i < (MM_USER_MAX>>22); i ++ )
{
// Check if directory is not allocated
continue;
}
-
+ // Deallocate tables
for( j = 0; j < 1024; j ++ )
{
if( gaPageTable[i*1024+j] & 1 )
gaPageTable[i*1024+j] = 0;
}
+ // Deallocate directory
MM_DerefPhys( gaPageDir[i] & ~0xFFF );
gaPageDir[i] = 0;
INVLPG( &gaPageTable[i*1024] );
Uint pos = 0;
LogF("%014lli ", now());
Debug_Puts(1, Header);
- LogF(" (Hexdump of %p)\r\n", Data);
+ LogF(" (Hexdump of %p)\n", Data);
#define CH(n) ((' '<=cdat[(n)]&&cdat[(n)]<0x7F) ? cdat[(n)] : '.')
while(Length >= 16)
{
- Log("%04x: %02x %02x %02x %02x %02x %02x %02x %02x"
+ LogF("%014lli Log: %04x:"
" %02x %02x %02x %02x %02x %02x %02x %02x"
- " %c%c%c%c%c%c%c%c %c%c%c%c%c%c%c%c",
+ " %02x %02x %02x %02x %02x %02x %02x %02x"
+ " %c%c%c%c%c%c%c%c %c%c%c%c%c%c%c%c\n",
+ now(),
pos,
- cdat[0], cdat[1], cdat[2], cdat[3], cdat[4], cdat[5], cdat[6], cdat[7],
- cdat[8], cdat[9], cdat[10], cdat[11], cdat[12], cdat[13], cdat[14], cdat[15],
+ cdat[ 0], cdat[ 1], cdat[ 2], cdat[ 3], cdat[ 4], cdat[ 5], cdat[ 6], cdat[ 7],
+ cdat[ 8], cdat[ 9], cdat[10], cdat[11], cdat[12], cdat[13], cdat[14], cdat[15],
CH(0), CH(1), CH(2), CH(3), CH(4), CH(5), CH(6), CH(7),
CH(8), CH(9), CH(10), CH(11), CH(12), CH(13), CH(14), CH(15)
);
if( i == 8 ) LogF(" ");
LogF("%c", CH(i));
}
- }
- Debug_Putchar('\r');
- Debug_Putchar('\n');
+ Debug_Putchar('\n');
+ }
}
// --- EXPORTS ---