From f0b06cece87e5f73678413cbbc1e3100ddf6e247 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Mon, 11 Oct 2010 10:19:32 +0800 Subject: [PATCH] Fixing to get x86_64 build to compile after threading overhaul --- Kernel/Makefile | 3 ++- Kernel/arch/x86_64/Makefile | 2 ++ Kernel/arch/x86_64/include/arch.h | 1 + Kernel/arch/x86_64/link.ld | 3 +++ Kernel/arch/x86_64/mm_phys.c | 6 +++--- Kernel/arch/x86_64/proc.c | 2 +- 6 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Kernel/Makefile b/Kernel/Makefile index ec925729..2d558fca 100644 --- a/Kernel/Makefile +++ b/Kernel/Makefile @@ -52,7 +52,7 @@ all: $(BIN) clean: @$(RM) $(BIN) ../Acess2.$(ARCH).gz $(BIN).dsm ../Map.$(ARCH).txt LineCounts.$(ARCH).txt $(OBJ) $(DEPFILES) -install: $(BIN) +install: $(BIN) gzip -c $(BIN) > ../Acess2.$(ARCH).gz $(xCP) ../Acess2.$(ARCH).gz $(DISTROOT) @@ -65,6 +65,7 @@ $(BIN): $(OBJ) $(MODS) arch/$(ARCHDIR)/link.ld Makefile $(DISASM) -S $(BIN) > $(BIN).dsm @wc -l $(SRCFILES) include/*.h > LineCounts.$(ARCH).txt @echo BUILD_NUM = $$(( $(BUILD_NUM) + 1 )) > Makefile.BuildNum.$(ARCH) + $(POSTBUILD) @$(STRIP) $(BIN) %.ao.$(ARCH): %.asm Makefile diff --git a/Kernel/arch/x86_64/Makefile b/Kernel/arch/x86_64/Makefile index 22ad8c93..e30bf8d6 100644 --- a/Kernel/arch/x86_64/Makefile +++ b/Kernel/arch/x86_64/Makefile @@ -24,3 +24,5 @@ endif A_OBJ = start32.ao start64.ao desctab.ao A_OBJ += main.o lib.o proc.o mm_virt.o mm_phys.o vm8086.o A_OBJ += kernelpanic.o errors.o + +POSTBUILD = objcopy $(BIN) -F elf32 $(BIN) diff --git a/Kernel/arch/x86_64/include/arch.h b/Kernel/arch/x86_64/include/arch.h index 6b75a7df..3993fe9c 100644 --- a/Kernel/arch/x86_64/include/arch.h +++ b/Kernel/arch/x86_64/include/arch.h @@ -34,6 +34,7 @@ typedef Uint64 tPAddr; typedef Uint64 tVAddr; typedef Uint64 size_t; +typedef char BOOL; #define __ASM__ __asm__ __volatile__ diff --git a/Kernel/arch/x86_64/link.ld b/Kernel/arch/x86_64/link.ld index ce537f90..8f75ddb6 100644 --- a/Kernel/arch/x86_64/link.ld +++ b/Kernel/arch/x86_64/link.ld @@ -7,8 +7,11 @@ /* -2 GiB */ _kernel_base = 0xFFFFFFFF80000000; +/* OUTPUT_FORMAT(elf32-i386) OUTPUT_ARCH(i386:x86-64) +*/ +OUTPUT_FORMAT(elf64) ENTRY(start) SECTIONS { diff --git a/Kernel/arch/x86_64/mm_phys.c b/Kernel/arch/x86_64/mm_phys.c index 0130773f..f3cdceb5 100644 --- a/Kernel/arch/x86_64/mm_phys.c +++ b/Kernel/arch/x86_64/mm_phys.c @@ -390,7 +390,7 @@ tPAddr MM_AllocPhysRange(int Pages, int MaxBits) nFree ++; addr ++; LOG("nFree(%i) == %i (0x%x)", nFree, Pages, addr); - if(nFree == Num) + if(nFree == Pages) break; } LOG("nFree = %i", nFree); @@ -409,10 +409,10 @@ tPAddr MM_AllocPhysRange(int Pages, int MaxBits) Mutex_Release(&glPhysicalPages); // TODO: Page out // ATM. Just Warning - Warning(" MM_AllocPhysRange: Out of memory (unable to fulfil request for %i pages)", Num); + Warning(" MM_AllocPhysRange: Out of memory (unable to fulfil request for %i pages)", Pages); Log_Warning("Arch", "Out of memory (unable to fulfil request for %i pages)", - Num + Pages ); LEAVE('i', 0); return 0; diff --git a/Kernel/arch/x86_64/proc.c b/Kernel/arch/x86_64/proc.c index c5c0c18e..1d1513be 100644 --- a/Kernel/arch/x86_64/proc.c +++ b/Kernel/arch/x86_64/proc.c @@ -387,7 +387,7 @@ void Proc_Start(void) { gaCPUs[0].IdleThread = Proc_GetCurThread(); gaCPUs[0].IdleThread->ThreadName = "Idle Thread"; - gaCPUs[0].IdleThread->NumTickets = 0; // Never called randomly + Threads_SetPriority( gaCPUs[0].IdleThread, -1 ); // Never called randomly gaCPUs[0].IdleThread->Quantum = 1; // 1 slice quantum for(;;) HALT(); // Just yeilds } -- 2.20.1