From: John Hodge Date: Mon, 30 Jul 2012 04:11:27 +0000 (+0800) Subject: Kernel - Fixing x86_64 compile errors from MM_GetPhysAddr change X-Git-Tag: rel0.15~706^2~97 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=20611928dd86e55b9ab7021431f36a5017997a3e;p=tpg%2Facess2.git Kernel - Fixing x86_64 compile errors from MM_GetPhysAddr change --- diff --git a/KernelLand/Kernel/arch/x86_64/errors.c b/KernelLand/Kernel/arch/x86_64/errors.c index f7da7f9f..e7812c3e 100644 --- a/KernelLand/Kernel/arch/x86_64/errors.c +++ b/KernelLand/Kernel/arch/x86_64/errors.c @@ -134,14 +134,14 @@ void Error_Backtrace(Uint IP, Uint BP) LogF("Backtrace: %p", IP); //else // LogF("Backtrace: %s+0x%x", str, delta); - if( !MM_GetPhysAddr(BP) ) + if( !MM_GetPhysAddr( (void*)BP ) ) { LogF("\nBacktrace: Invalid BP, stopping\n"); return; } - while( MM_GetPhysAddr(BP) && MM_GetPhysAddr(BP+8+7) && i < MAX_BACKTRACE ) + while( MM_GetPhysAddr( (void*)BP) && MM_GetPhysAddr((void*)(BP+8+7)) && i < MAX_BACKTRACE ) { //str = Debug_GetSymbol(*(Uint*)(ebp+4), &delta); //if(str == NULL) diff --git a/KernelLand/Kernel/arch/x86_64/main.c b/KernelLand/Kernel/arch/x86_64/main.c index 3532c809..4fb66701 100644 --- a/KernelLand/Kernel/arch/x86_64/main.c +++ b/KernelLand/Kernel/arch/x86_64/main.c @@ -9,9 +9,7 @@ extern void Desctab_Init(void); extern void MM_InitVirt(void); extern void Heap_Install(void); -extern void Threads_Init(void); extern int Time_Setup(void); -extern void System_Init(char *Commandline); extern void MM_InitPhys_Multiboot(tMBoot_Info *MBoot); diff --git a/KernelLand/Kernel/arch/x86_64/mm_phys.c b/KernelLand/Kernel/arch/x86_64/mm_phys.c index 274b21c7..b537a9f4 100644 --- a/KernelLand/Kernel/arch/x86_64/mm_phys.c +++ b/KernelLand/Kernel/arch/x86_64/mm_phys.c @@ -440,7 +440,7 @@ tPAddr MM_AllocPhysRange(int Pages, int MaxBits) for( i = 0; i < Pages; i++, addr++ ) { gaMainBitmap[addr >> 6] |= 1LL << (addr & 63); - if( MM_GetPhysAddr( (tVAddr)&gaiPageReferences[addr] ) ) + if( MM_GetPhysAddr( &gaiPageReferences[addr] ) ) gaiPageReferences[addr] = 1; // Log("page %P refcount = %i", MM_GetRefCount(addr<<12)); rangeID = MM_int_GetRangeID(addr << 12); @@ -504,7 +504,7 @@ void MM_RefPhys(tPAddr PAddr) { tVAddr ref_base = ((tVAddr)&gaiPageReferences[ page ]) & ~0xFFF; // Allocate reference page - if( !MM_GetPhysAddr(ref_base) ) + if( !MM_GetPhysAddr(&gaiPageReferences[page]) ) { const int pages_per_refpage = PAGE_SIZE/sizeof(gaiPageReferences[0]); int i; @@ -528,7 +528,7 @@ void MM_RefPhys(tPAddr PAddr) PAGE_ALLOC_SET(page); if( gaMainBitmap[page >> 6] + 1 == 0 ) gaSuperBitmap[page>> 12] |= 1LL << ((page >> 6) & 63); - if( MM_GetPhysAddr( (tVAddr)&gaiPageReferences[page] ) ) + if( MM_GetPhysAddr( &gaiPageReferences[page] ) ) gaiPageReferences[page] = 1; } @@ -546,7 +546,7 @@ void MM_DerefPhys(tPAddr PAddr) if( PAddr >> 12 > giMaxPhysPage ) return ; - if( MM_GetPhysAddr( (tVAddr) &gaiPageReferences[page] ) ) + if( MM_GetPhysAddr( &gaiPageReferences[page] ) ) { gaiPageReferences[ page ] --; if( gaiPageReferences[ page ] == 0 ) @@ -583,7 +583,7 @@ int MM_GetRefCount( tPAddr PAddr ) if( PAddr > giMaxPhysPage ) return 0; - if( MM_GetPhysAddr( (tVAddr)&gaiPageReferences[PAddr] ) ) { + if( MM_GetPhysAddr( &gaiPageReferences[PAddr] ) ) { return gaiPageReferences[PAddr]; } @@ -620,7 +620,7 @@ int MM_SetPageNode(tPAddr PAddr, void *Node) // if( !MM_GetRefCount(PAddr) ) return 1; - if( !MM_GetPhysAddr(node_page) ) { + if( !MM_GetPhysAddr((void*)node_page) ) { if( !MM_Allocate(node_page) ) return -1; memset( (void*)node_page, 0, PAGE_SIZE ); @@ -635,7 +635,7 @@ int MM_GetPageNode(tPAddr PAddr, void **Node) // if( !MM_GetRefCount(PAddr) ) return 1; PAddr >>= 12; - if( !MM_GetPhysAddr( (tVAddr)&gapPageNodes[PAddr] ) ) { + if( !MM_GetPhysAddr( &gapPageNodes[PAddr] ) ) { *Node = NULL; return 0; } diff --git a/KernelLand/Kernel/arch/x86_64/mm_virt.c b/KernelLand/Kernel/arch/x86_64/mm_virt.c index 3d723e19..14117f48 100644 --- a/KernelLand/Kernel/arch/x86_64/mm_virt.c +++ b/KernelLand/Kernel/arch/x86_64/mm_virt.c @@ -269,9 +269,9 @@ void MM_int_DumpTablesEnt(tVAddr RangeStart, size_t Length, tPAddr Expected) #define CANOICAL(addr) ((addr)&0x800000000000?(addr)|0xFFFF000000000000:(addr)) LogF("%016llx => ", CANOICAL(RangeStart)); // LogF("%6llx %6llx %6llx %016llx => ", -// MM_GetPhysAddr( (tVAddr)&PAGEDIRPTR(RangeStart>>30) ), -// MM_GetPhysAddr( (tVAddr)&PAGEDIR(RangeStart>>21) ), -// MM_GetPhysAddr( (tVAddr)&PAGETABLE(RangeStart>>12) ), +// MM_GetPhysAddr( &PAGEDIRPTR(RangeStart>>30) ), +// MM_GetPhysAddr( &PAGEDIR(RangeStart>>21) ), +// MM_GetPhysAddr( &PAGETABLE(RangeStart>>12) ), // CANOICAL(RangeStart) // ); if( gMM_ZeroPage && (PAGETABLE(RangeStart>>12) & PADDR_MASK) == gMM_ZeroPage ) @@ -576,7 +576,7 @@ void MM_Deallocate(tVAddr VAddr) { tPAddr phys; - phys = MM_GetPhysAddr(VAddr); + phys = MM_GetPhysAddr( (void*)VAddr ); if(!phys) return ; MM_Unmap(VAddr); @@ -609,8 +609,9 @@ int MM_GetPageEntry(tVAddr Addr, tPAddr *Phys, Uint *Flags) /** * \brief Get the physical address of a virtual location */ -tPAddr MM_GetPhysAddr(tVAddr Addr) +tPAddr MM_GetPhysAddr(const void *Ptr) { + tVAddr Addr = (tVAddr)Ptr; tPAddr *ptr; int ret; @@ -776,7 +777,8 @@ tVAddr MM_MapHWPages(tPAddr PAddr, Uint Number) { for( num = Number; num -- && ret < MM_HWMAP_TOP; ret += 0x1000 ) { - if( MM_GetPhysAddr(ret) != 0 ) break; + if( MM_GetPhysAddr( (void*)ret ) != 0 ) + break; } if( num >= 0 ) continue; @@ -807,7 +809,7 @@ void MM_UnmapHWPages(tVAddr VAddr, Uint Number) // Log_KernelPanic("MM", "TODO: Implement MM_UnmapHWPages"); while( Number -- ) { - MM_DerefPhys( MM_GetPhysAddr(VAddr) ); + MM_DerefPhys( MM_GetPhysAddr((void*)VAddr) ); MM_Unmap(VAddr); VAddr += 0x1000; } @@ -970,7 +972,7 @@ tPAddr MM_Clone(void) MM_MapEx(kstackbase+i*0x1000, phys, 1, 0); tmpmapping = MM_MapTemp(phys); - if( MM_GetPhysAddr( kstackbase+i*0x1000 ) ) + if( MM_GetPhysAddr( (void*)(kstackbase+i*0x1000) ) ) memcpy(tmpmapping, (void*)(kstackbase+i*0x1000), 0x1000); else memset(tmpmapping, 0, 0x1000); @@ -1088,7 +1090,7 @@ tVAddr MM_NewKStack(void) Uint i; for( ; base < MM_KSTACK_TOP; base += KERNEL_STACK_SIZE ) { - if(MM_GetPhysAddr(base+KERNEL_STACK_SIZE-0x1000) != 0) + if(MM_GetPhysAddr( (void*)(base+KERNEL_STACK_SIZE-0x1000) ) != 0) continue; //Log("MM_NewKStack: Found one at %p", base + KERNEL_STACK_SIZE); diff --git a/KernelLand/Kernel/arch/x86_64/proc.c b/KernelLand/Kernel/arch/x86_64/proc.c index 5f71a45f..518bef3a 100644 --- a/KernelLand/Kernel/arch/x86_64/proc.c +++ b/KernelLand/Kernel/arch/x86_64/proc.c @@ -579,7 +579,7 @@ Uint Proc_MakeUserStack(void) // Check Prospective Space for( i = USER_STACK_SZ >> 12; i--; ) { - if( MM_GetPhysAddr( base + (i<<12) ) != 0 ) + if( MM_GetPhysAddr( (void*)(base + (i<<12)) ) != 0 ) break; }