From: John Hodge Date: Thu, 27 May 2010 05:57:16 +0000 (+0800) Subject: Bugfixing X-Git-Tag: rel0.06~179 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=587078c9b833b5fa1cae8b445475000706de8441;p=tpg%2Facess2.git Bugfixing --- diff --git a/Kernel/Makefile b/Kernel/Makefile index 6bf4b9f2..6be6a135 100644 --- a/Kernel/Makefile +++ b/Kernel/Makefile @@ -15,7 +15,7 @@ KERNEL_VERSION = 0.5 MAKEDEP = $(CC) -M CPPFLAGS += -I./include -I./arch/$(ARCHDIR)/include -CPPFLAGS += -DARCH=$(ARCH) -DARCHDIR=$(ARCHDIR) -DKERNEL_VERSION=$(KERNEL_VERSION) -DBUILD_NUM=$(BUILD_NUM) +CPPFLAGS += -DARCH=$(ARCH) -DARCHDIR=$(ARCHDIR) -DKERNEL_VERSION=$(KERNEL_VERSION) -DBUILD_NUM=$(BUILD_NUM) CFLAGS += -Wall -Werror -O3 -fno-stack-protector -fno-builtin ASFLAGS += -D ARCH=\"$(ARCH)\" -D ARCHDIR=\"$(ARCHDIR)\" LDFLAGS += -T arch/$(ARCHDIR)/link.ld @@ -61,7 +61,7 @@ $(BIN): $(OBJ) $(MODS) arch/$(ARCHDIR)/link.ld Makefile @echo --- LD -o $(BIN) @$(LD) $(LDFLAGS) -o $(BIN) $(OBJ) $(MODS) -Map ../Map.$(ARCH).txt @objdump $(BIN) -D -S > $(BIN).dsm - @wc -l $(SRCFILES) > LineCounts.$(ARCH).txt + @wc -l $(SRCFILES) include/*.h > LineCounts.$(ARCH).txt @echo BUILD_NUM = `calc $(BUILD_NUM)+1` > Makefile.BuildNum %.ao.$(ARCH): %.asm Makefile diff --git a/Kernel/Makefile.BuildNum b/Kernel/Makefile.BuildNum index d780e7e4..41882050 100644 --- a/Kernel/Makefile.BuildNum +++ b/Kernel/Makefile.BuildNum @@ -1 +1 @@ -BUILD_NUM = 2164 +BUILD_NUM = 2183 diff --git a/Kernel/arch/x86/main.c b/Kernel/arch/x86/main.c index 2dca5635..6baec034 100644 --- a/Kernel/arch/x86/main.c +++ b/Kernel/arch/x86/main.c @@ -125,7 +125,7 @@ void Arch_LoadBootModules(void) if( !Module_LoadMem( gaArch_BootModules[i].Base, gaArch_BootModules[i].Size, gaArch_BootModules[i].ArgString ) ) { - Log_Warning("Arch", "Unable to load module\n"); + Log_Warning("Arch", "Unable to load module"); } } Log_Log("Arch", "Boot modules loaded"); diff --git a/Kernel/arch/x86/vm8086.c b/Kernel/arch/x86/vm8086.c index 1816eacf..1f4f1f43 100644 --- a/Kernel/arch/x86/vm8086.c +++ b/Kernel/arch/x86/vm8086.c @@ -47,7 +47,7 @@ MODULE_DEFINE(0, 0x100, VM8086, VM8086_Install, NULL, NULL); tSpinlock glVM8086_Process; tPID gVM8086_WorkerPID; tTID gVM8086_CallingThread; -tVM8086 * volatile gpVM8086_State = (void*)-1; // Set to -1 to avoid race conditions +tVM8086 volatile * volatile gpVM8086_State = (void*)-1; // Set to -1 to avoid race conditions // === FUNCTIONS === int VM8086_Install(char **Arguments) @@ -66,8 +66,8 @@ int VM8086_Install(char **Arguments) } if(pid == 0) { - Uint *stacksetup; // Initialising Stack - Uint16 *rmstack; // Real Mode Stack + Uint * volatile stacksetup; // Initialising Stack + Uint16 * volatile rmstack; // Real Mode Stack int i; // Set Image Name @@ -91,32 +91,32 @@ int VM8086_Install(char **Arguments) *(Uint8*)(0x100003) = 0xCB; // RET FAR rmstack = (Uint16*)(VM8086_STACK_SEG*16 + VM8086_STACK_OFS); - *rmstack-- = 0xFFFF; //CS - *rmstack-- = 0x0010; //IP + rmstack--; *rmstack = 0xFFFF; //CS + rmstack--; *rmstack = 0x0010; //IP // Setup Stack stacksetup = (Uint*)0x101000; - *--stacksetup = VM8086_STACK_SEG; // GS - *--stacksetup = VM8086_STACK_SEG; // FS - *--stacksetup = VM8086_STACK_SEG; // DS - *--stacksetup = VM8086_STACK_SEG; // ES - *--stacksetup = VM8086_STACK_SEG; // SS - *--stacksetup = VM8086_STACK_OFS-2; // SP - *--stacksetup = 0x20202; // FLAGS - *--stacksetup = 0xFFFF; // CS - *--stacksetup = 0x10; // IP - *--stacksetup = 0xAAAA; // AX - *--stacksetup = 0xCCCC; // CX - *--stacksetup = 0xDDDD; // DX - *--stacksetup = 0xBBBB; // BX - *--stacksetup = 0x5454; // SP - *--stacksetup = 0xB4B4; // BP - *--stacksetup = 0x5151; // SI - *--stacksetup = 0xD1D1; // DI - *--stacksetup = 0x20|3; // DS - Kernel - *--stacksetup = 0x20|3; // ES - Kernel - *--stacksetup = 0x20|3; // FS - *--stacksetup = 0x20|3; // GS + stacksetup--; *stacksetup = VM8086_STACK_SEG; // GS + stacksetup--; *stacksetup = VM8086_STACK_SEG; // FS + stacksetup--; *stacksetup = VM8086_STACK_SEG; // DS + stacksetup--; *stacksetup = VM8086_STACK_SEG; // ES + stacksetup--; *stacksetup = VM8086_STACK_SEG; // SS + stacksetup--; *stacksetup = VM8086_STACK_OFS-2; // SP + stacksetup--; *stacksetup = 0x20202; // FLAGS + stacksetup--; *stacksetup = 0xFFFF; // CS + stacksetup--; *stacksetup = 0x10; // IP + stacksetup--; *stacksetup = 0xAAAA; // AX + stacksetup--; *stacksetup = 0xCCCC; // CX + stacksetup--; *stacksetup = 0xDDDD; // DX + stacksetup--; *stacksetup = 0xBBBB; // BX + stacksetup--; *stacksetup = 0x5454; // SP + stacksetup--; *stacksetup = 0xB4B4; // BP + stacksetup--; *stacksetup = 0x5151; // SI + stacksetup--; *stacksetup = 0xD1D1; // DI + stacksetup--; *stacksetup = 0x20|3; // DS - Kernel + stacksetup--; *stacksetup = 0x20|3; // ES - Kernel + stacksetup--; *stacksetup = 0x20|3; // FS + stacksetup--; *stacksetup = 0x20|3; // GS __asm__ __volatile__ ( "mov %%eax,%%esp;\n\t" // Set stack pointer "pop %%gs;\n\t" @@ -168,12 +168,12 @@ void VM8086_GPF(tRegs *Regs) } //Log_Log("VM8086", "We have a task (%p)", gpVM8086_State); - Regs->esp -= 2; *(Uint16*)( (Regs->ss<<4) + (Regs->esp&0xFFFF) ) = VM8086_MAGIC_CS; - Regs->esp -= 2; *(Uint16*)( (Regs->ss<<4) + (Regs->esp&0xFFFF) ) = VM8086_MAGIC_IP; - Regs->esp -= 2; *(Uint16*)( (Regs->ss<<4) + (Regs->esp&0xFFFF) ) = gpVM8086_State->CS; - Regs->esp -= 2; *(Uint16*)( (Regs->ss<<4) + (Regs->esp&0xFFFF) ) = gpVM8086_State->IP; - Regs->esp -= 2; *(Uint16*)( (Regs->ss<<4) + (Regs->esp&0xFFFF) ) = gpVM8086_State->DS; - Regs->esp -= 2; *(Uint16*)( (Regs->ss<<4) + (Regs->esp&0xFFFF) ) = gpVM8086_State->ES; + Regs->esp -= 2; *(Uint16*volatile)( (Regs->ss<<4) + (Regs->esp&0xFFFF) ) = VM8086_MAGIC_CS; + Regs->esp -= 2; *(Uint16*volatile)( (Regs->ss<<4) + (Regs->esp&0xFFFF) ) = VM8086_MAGIC_IP; + Regs->esp -= 2; *(Uint16*volatile)( (Regs->ss<<4) + (Regs->esp&0xFFFF) ) = gpVM8086_State->CS; + Regs->esp -= 2; *(Uint16*volatile)( (Regs->ss<<4) + (Regs->esp&0xFFFF) ) = gpVM8086_State->IP; + Regs->esp -= 2; *(Uint16*volatile)( (Regs->ss<<4) + (Regs->esp&0xFFFF) ) = gpVM8086_State->DS; + Regs->esp -= 2; *(Uint16*volatile)( (Regs->ss<<4) + (Regs->esp&0xFFFF) ) = gpVM8086_State->ES; // Set Registers Regs->eip = 0x11; Regs->cs = 0xFFFF; @@ -212,8 +212,8 @@ void VM8086_GPF(tRegs *Regs) id = *(Uint8*)( Regs->cs*16 +(Regs->eip&0xFFFF)); Regs->eip ++; - Regs->esp -= 2; *(Uint16*)( Regs->ss*16 + (Regs->esp&0xFFFF) ) = Regs->cs; - Regs->esp -= 2; *(Uint16*)( Regs->ss*16 + (Regs->esp&0xFFFF) ) = Regs->eip; + Regs->esp -= 2; *(Uint16*volatile)( Regs->ss*16 + (Regs->esp&0xFFFF) ) = Regs->cs; + Regs->esp -= 2; *(Uint16*volatile)( Regs->ss*16 + (Regs->esp&0xFFFF) ) = Regs->eip; Regs->cs = *(Uint16*)(4*id + 2); Regs->eip = *(Uint16*)(4*id); diff --git a/Kernel/include/vfs.h b/Kernel/include/vfs.h index ab0bd35b..057f7f4c 100644 --- a/Kernel/include/vfs.h +++ b/Kernel/include/vfs.h @@ -67,7 +67,7 @@ */ /** - * \brief VFS Node + * \brief Represents a node (file or directory) in the VFS tree * * This structure provides the VFS with the functions required to read/write * the file (or directory) that it represents. @@ -99,8 +99,9 @@ typedef struct sVFS_Node Uint32 Flags; //!< File Flags /** - * Pointer to cached data (FS Specific) - * \note Inode_* will free when the node is uncached this if needed + * \brief Pointer to cached data (FS Specific) + * \note The Inode_* functions will free when the node is uncached + * this if needed */ void *Data; /** @@ -160,7 +161,7 @@ typedef struct sVFS_Node int (*IOCtl)(struct sVFS_Node *Node, int Id, void *Data); /** - * } + * \} */ /** @@ -190,7 +191,7 @@ typedef struct sVFS_Node Uint64 (*Write)(struct sVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer); /** - * } + * \} */ /** @@ -247,7 +248,7 @@ typedef struct sVFS_Node int (*Link)(struct sVFS_Node *Node, struct sVFS_Node *Child, char *NewName); /** - * } + * \} */ } tVFS_Node; diff --git a/Kernel/logging.c b/Kernel/logging.c index 747094d2..54f16cad 100644 --- a/Kernel/logging.c +++ b/Kernel/logging.c @@ -65,6 +65,7 @@ EXPORT(Log_Debug); // === GLOBALS === tSpinlock glLog; +tSpinlock glLogOutput; tLogList gLog; tLogList gLog_Levels[NUM_LOG_LEVELS]; diff --git a/Kernel/modules.c b/Kernel/modules.c index 41fb5143..4b095bc5 100644 --- a/Kernel/modules.c +++ b/Kernel/modules.c @@ -88,7 +88,8 @@ int Module_int_Initialise(tModule *Module, char *ArgString) break; } if( mod ) { - Log_Warning("Module", "Circular dependency detected"); + Log_Warning("Module", "Circular dependency detected (%s and %s)", + mod->Name, Module->Name); LEAVE_RET('i', -1); } @@ -99,7 +100,8 @@ int Module_int_Initialise(tModule *Module, char *ArgString) break; } if( i == giNumBuiltinModules ) { - Log_Warning("Module", "Dependency '%s' for module '%s' failed"); + Log_Warning("Module", "Dependency '%s' for module '%s' failed", + deps[j], Module->Name); return -1; } @@ -132,6 +134,9 @@ int Module_int_Initialise(tModule *Module, char *ArgString) if(args) free(args); + // Remove from loading list + gLoadingModules = gLoadingModules->Next; + if( ret != MODULE_ERR_OK ) { switch(ret) { @@ -153,9 +158,6 @@ int Module_int_Initialise(tModule *Module, char *ArgString) } LOG("ret = %i", ret); - // Remove from loading list - gLoadingModules = gLoadingModules->Next; - // Add to loaded list LOCK( &glModuleSpinlock ); Module->Next = gLoadedModules; diff --git a/Makefile.cfg b/Makefile.cfg index b2957a0d..35080e9c 100644 --- a/Makefile.cfg +++ b/Makefile.cfg @@ -33,7 +33,7 @@ FILESYSTEMS := DRIVERS := MODULES := Storage/ATA Storage/FDD MODULES += Network/NE2000 -#MODULES += Display/VESA +MODULES += Display/VESA MODULES += Display/BochsGA MODULES += Filesystems/Ext2 MODULES += Filesystems/FAT