From: John Hodge Date: Fri, 2 Apr 2010 12:42:27 +0000 (+0800) Subject: Fixes to x86 error and interrupt handling X-Git-Tag: rel0.06~257 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=54746c855c6e2fe42fde9f93b0ce3f41aeefc2e5;p=tpg%2Facess2.git Fixes to x86 error and interrupt handling - Fixed double fault handler so it actually works - I (thePowersGang/John Hodge) am an idiot, As you will see from Kernel/arch/x86/desctab.asm I forgot to set the data segment selectors to kernel values when handling interrupts, this caused IRQs and faults that occured in vm8086 mode to triple fault. - Other changes to logging, moving more log/notice messages to the Log_* functions - Untested fixes to TCP's Acknowledgement number code > TODO Check wether to ACK a packet on arrival, or once it's added to the client buffer. - Also fixed some bugs in the thread Sleep/Wake functions that were exposed by the vm8086 driver. --- diff --git a/Kernel/Doxyfile.api b/Kernel/Doxyfile.api index 56b80d2c..d4454162 100644 --- a/Kernel/Doxyfile.api +++ b/Kernel/Doxyfile.api @@ -572,7 +572,9 @@ INPUT = include/apidoc_mainpage.h \ include/vfs.h include/vfs_ext.h \ include/fs_devfs.h \ include/iocache.h \ - include/apidoc/arch_x86.h + include/apidoc/arch_x86.h \ + include/tpl_drv_common.h \ + include/tpl_drv_video.h # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is diff --git a/Kernel/Makefile.BuildNum b/Kernel/Makefile.BuildNum index a5712863..6bf24dd5 100644 --- a/Kernel/Makefile.BuildNum +++ b/Kernel/Makefile.BuildNum @@ -1 +1 @@ -BUILD_NUM = 1696 +BUILD_NUM = 1740 diff --git a/Kernel/arch/x86/desctab.asm b/Kernel/arch/x86/desctab.asm index 737570b0..43bd8e4c 100644 --- a/Kernel/arch/x86/desctab.asm +++ b/Kernel/arch/x86/desctab.asm @@ -29,6 +29,7 @@ gGDTPtr: dd gGDT ; IDT ALIGN 8 +[global gIDT] gIDT: times 256 dd 0x00080000,0x00000F00 [global gIDTPtr] @@ -146,7 +147,6 @@ Isr%1: %macro DEF_IRQ 1 [global Isr%1] Isr%1: - ;cli ; HACK! push 0 push %1 jmp IRQCommon @@ -212,6 +212,12 @@ ErrorCommon: push fs push gs + mov ax, 0x10 + mov ds, ax + mov es, ax + mov fs, ax + mov gs, ax + push esp call ErrorHandler add esp, 4 @@ -258,6 +264,12 @@ IRQCommon: push fs push gs + mov ax, 0x10 + mov ds, ax + mov es, ax + mov fs, ax + mov gs, ax + push esp call IRQ_Handler add esp, 4 @@ -281,6 +293,12 @@ SchedulerBase: push fs push gs + mov ax, 0x10 + mov ds, ax + mov es, ax + mov fs, ax + mov gs, ax + mov eax, [esp+12*4] ; CPU Number push eax ; Pus as argument diff --git a/Kernel/arch/x86/errors.c b/Kernel/arch/x86/errors.c index b53807aa..31c385fc 100644 --- a/Kernel/arch/x86/errors.c +++ b/Kernel/arch/x86/errors.c @@ -43,10 +43,14 @@ void __stack_chk_fail() void ErrorHandler(tRegs *Regs) { Uint cr; - __asm__ __volatile__ ("cli"); + //if( Regs && !(Regs->int_num == 13 && Regs->eflags & 0x20000) ) + // __asm__ __volatile__ ("xchg %bx, %bx"); + //Log_Debug("X86", "Regs = %p", Regs); //Log_Debug("X86", "Error %i at 0x%08x", Regs->int_num, Regs->eip); + __asm__ __volatile__ ("cli"); + // Page Fault if(Regs->int_num == 14) { @@ -65,7 +69,10 @@ void ErrorHandler(tRegs *Regs) Warning("CPU Error %i - %s, Code: 0x%x", Regs->int_num, csaERROR_NAMES[Regs->int_num], Regs->err_code); Warning(" CS:EIP = 0x%04x:%08x", Regs->cs, Regs->eip); - Warning(" SS:ESP = 0x%04x:%08x", Regs->ss, Regs->esp); + if(Regs->cs == 0x08) + Warning(" SS:ESP = 0x0010:%08x", 0x10, (Uint)Regs+sizeof(tRegs)); + else + Warning(" SS:ESP = 0x%04x:%08x", Regs->ss, Regs->esp); Warning(" EFLAGS = 0x%08x", Regs->eflags); Warning(" EAX %08x ECX %08x EDX %08x EBX %08x", Regs->eax, Regs->ecx, Regs->edx, Regs->ebx); @@ -84,7 +91,7 @@ void ErrorHandler(tRegs *Regs) switch( Regs->int_num ) { - case 6: + case 6: // #UD Warning(" Offending bytes: %02x %02x %02x %02x", *(Uint8*)Regs->eip+0, *(Uint8*)Regs->eip+1, *(Uint8*)Regs->eip+2, *(Uint8*)Regs->eip+3); diff --git a/Kernel/arch/x86/include/arch.h b/Kernel/arch/x86/include/arch.h index 996f4185..4007a71f 100644 --- a/Kernel/arch/x86/include/arch.h +++ b/Kernel/arch/x86/include/arch.h @@ -98,18 +98,6 @@ typedef struct { Uint Resvd4[1]; // SS } tSyscallRegs; -typedef struct { - Uint16 LimitLow; - Uint16 BaseLow; - Uint8 BaseMid; - Uint8 Access; - struct { - unsigned LimitHi: 4; - unsigned Flags: 4; - } __attribute__ ((packed)); - Uint8 BaseHi; -} __attribute__ ((packed)) tGDT; - typedef struct { #if USE_PAE Uint PDPT[4]; diff --git a/Kernel/arch/x86/include/desctab.h b/Kernel/arch/x86/include/desctab.h new file mode 100644 index 00000000..47a462aa --- /dev/null +++ b/Kernel/arch/x86/include/desctab.h @@ -0,0 +1,25 @@ +/** + */ +#ifndef _DESCTAB_H_ +#define _DESCTAB_H_ + +typedef struct { + Uint16 LimitLow; + Uint16 BaseLow; + Uint8 BaseMid; + Uint8 Access; + struct { + unsigned LimitHi: 4; + unsigned Flags: 4; + } __attribute__ ((packed)); + Uint8 BaseHi; +} __attribute__ ((packed)) tGDT; + +typedef struct { + Uint16 OffsetLo; + Uint16 CS; + Uint16 Flags; + Uint16 OffsetHi; +} __attribute__ ((packed)) tIDT; + +#endif diff --git a/Kernel/arch/x86/mm_virt.c b/Kernel/arch/x86/mm_virt.c index 6976c657..cf77b875 100644 --- a/Kernel/arch/x86/mm_virt.c +++ b/Kernel/arch/x86/mm_virt.c @@ -9,7 +9,7 @@ * 0xFE - Unused * 0xFF - System Calls / Kernel's User Code */ -#define DEBUG 1 +#define DEBUG 0 #define SANITY 1 #include #include @@ -208,7 +208,7 @@ void MM_PageFault(tVAddr Addr, Uint ErrorCode, tRegs *Regs) (ErrorCode&1?"bad/locked":"non-present"), (ErrorCode&16?" (Instruction Fetch)":"") ); - Warning("User Pagefault: Instruction at %p accessed %p", Regs->eip, Addr); + Warning("User Pagefault: Instruction at %04x:%08x accessed %p", Regs->cs, Regs->eip, Addr); __asm__ __volatile__ ("sti"); // Restart IRQs Threads_SegFault(Addr); return ; diff --git a/Kernel/arch/x86/proc.c b/Kernel/arch/x86/proc.c index b2f7f8f5..3b5ceb2f 100644 --- a/Kernel/arch/x86/proc.c +++ b/Kernel/arch/x86/proc.c @@ -4,6 +4,7 @@ */ #include #include +#include #include #include #if USE_MP @@ -20,6 +21,7 @@ // === IMPORTS === extern tGDT gGDT[]; +extern tIDT gIDT[]; extern void APStartup(); // 16-bit AP startup code extern Uint GetEIP(); // start.asm extern Uint32 gaInitPageDir[1024]; // start.asm @@ -36,7 +38,7 @@ extern tThread *gDeleteThreads; extern tThread *Threads_GetNextToRun(int CPU); extern void Threads_Dump(); extern tThread *Threads_CloneTCB(Uint *Err, Uint Flags); -extern void Isr7(); +extern void Isr8(); // Double Fault // === PROTOTYPES === void ArchThreads_Init(); @@ -72,7 +74,12 @@ char gaDoubleFaultStack[1024]; tTSS gDoubleFault_TSS = { .ESP0 = (Uint)&gaDoubleFaultStack[1023], .SS0 = 0x10, - .EIP = (Uint)Isr7 + .CR3 = (Uint)gaInitPageDir - KERNEL_BASE, + .EIP = (Uint)Isr8, + .ESP = (Uint)&gaDoubleFaultStack[1023], + .CS = 0x08, .SS = 0x10, + .DS = 0x10, .ES = 0x10, + .FS = 0x10, .GS = 0x10, }; // === CODE === @@ -277,6 +284,17 @@ void ArchThreads_Init() gGDT[5].BaseMid = (Uint)&gDoubleFault_TSS >> 16; gGDT[5].BaseHi = (Uint)&gDoubleFault_TSS >> 24; + Log_Debug("Proc", "gIDT[8] = {OffsetLo:%04x, CS:%04x, Flags:%04x, OffsetHi:%04x}", + gIDT[8].OffsetLo, gIDT[8].CS, gIDT[8].Flags, gIDT[8].OffsetHi); + gIDT[8].OffsetLo = 0; + gIDT[8].CS = 5<<3; + gIDT[8].Flags = 0x8500; + gIDT[8].OffsetHi = 0; + Log_Debug("Proc", "gIDT[8] = {OffsetLo:%04x, CS:%04x, Flags:%04x, OffsetHi:%04x}", + gIDT[8].OffsetLo, gIDT[8].CS, gIDT[8].Flags, gIDT[8].OffsetHi); + + //__asm__ __volatile__ ("xchg %bx, %bx"); + #if USE_MP // Initialise Normal TSS(s) for(pos=0;posesp -= 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; @@ -211,7 +213,7 @@ void VM8086_GPF(tRegs *Regs) } break; - case 0xCF: //IRET + case VM8086_OP_IRET: //IRET Regs->eip = *(Uint16*)( Regs->ss*16 + (Regs->esp&0xFFFF) ); Regs->esp += 2; Regs->cs = *(Uint16*)( Regs->ss*16 + (Regs->esp&0xFFFF) ); Regs->esp += 2; #if TRACE_EMU @@ -219,6 +221,46 @@ void VM8086_GPF(tRegs *Regs) #endif break; + + case VM8086_OP_IN_AD: //IN AL, DX + Regs->eax &= 0xFFFFFF00; + Regs->eax |= inb(Regs->edx&0xFFFF); + #if TRACE_EMU + Log_Debug("VM8086", "Emulated IN AL, DX (Port 0x%x)\n", Regs->edx&0xFFFF); + #endif + break; + case VM8086_OP_IN_ADX: //IN AX, DX + Regs->eax &= 0xFFFF0000; + Regs->eax |= inw(Regs->edx&0xFFFF); + #if TRACE_EMU + Log_Debug("VM8086", "Emulated IN AX, DX (Port 0x%x)\n", Regs->edx&0xFFFF); + #endif + break; + + case 0xEE: //OUT DX, AL + outb(Regs->edx&0xFFFF, Regs->eax&0xFF); + #if TRACE_EMU + Log_Debug("VM8086", "Emulated OUT DX, AL (*0x%04x = 0x%02x)\n", Regs->edx&0xFFFF, Regs->eax&0xFF); + #endif + break; + case 0xEF: //OUT DX, AX + outw(Regs->edx&0xFFFF, Regs->eax&0xFFFF); + #if TRACE_EMU + Log_Debug("VM8086", "Emulated OUT DX, AX (*0x%04x = 0x%04x)\n", Regs->edx&0xFFFF, Regs->eax&0xFFFF); + #endif + break; + + // TODO: Decide on allowing VM8086 Apps to enable/disable interrupts + case 0xFA: //CLI + break; + case 0xFB: //STI + break; + + case 0x66: + Log_Warning("VM8086", "Code at %04x:%04x attempted to use an operand override, ignored", + Regs->cs, Regs->eip); + break; + default: Log_Error("VM8086", "Error - Unknown opcode %02x caused a GPF at %04x:%04x", opcode, Regs->cs, Regs->eip); diff --git a/Kernel/debug.c b/Kernel/debug.c index f71e889e..12adc22a 100644 --- a/Kernel/debug.c +++ b/Kernel/debug.c @@ -264,7 +264,7 @@ void Debug_SetKTerminal(char *File) if(giDebug_KTerm != -1) VFS_Close(giDebug_KTerm); giDebug_KTerm = VFS_Open(File, VFS_OPENFLAG_WRITE); - Log("Opened '%s' as 0x%x", File, giDebug_KTerm); + Log_Log("Debug", "Opened '%s' as 0x%x", File, giDebug_KTerm); } void Debug_Enter(char *FuncName, char *ArgTypes, ...) diff --git a/Kernel/drv/kb.c b/Kernel/drv/kb.c index 950f7228..f6a73132 100644 --- a/Kernel/drv/kb.c +++ b/Kernel/drv/kb.c @@ -84,7 +84,7 @@ void KB_IRQHandler() //if( inportb(0x64) & 0x20 ) return; scancode = inb(0x60); // Read from the keyboard's data buffer - Log_Debug("KB", "scancode = %02x"); + //Log_Debug("Keyboard", "scancode = %02x", scancode); //Log("KB_IRQHandler: scancode = 0x%02x", scancode); @@ -126,7 +126,7 @@ void KB_IRQHandler() //keyNum = giKB_KeyLayer * 256 + scancode; // Check for unknown key if(!ch && !gbKB_KeyUp) - Warning("UNK %i %x", giKB_KeyLayer, scancode); + Log_Warning("Keyboard", "UNK %i %x", giKB_KeyLayer, scancode); // Key Up? if (gbKB_KeyUp) @@ -173,11 +173,11 @@ void KB_IRQHandler() #if USE_KERNEL_MAGIC if(ch == KEY_LCTRL) { gbKB_MagicState |= 1; - Log_Log("KB", "Kernel Magic LCTRL Down\n"); + //Log_Log("Keyboard", "Kernel Magic LCTRL Down\n"); } if(ch == KEY_LALT) { gbKB_MagicState |= 2; - Log_Log("KB", "Kernel Magic LALT Down\n"); + //Log_Log("Keyboard", "Kernel Magic LALT Down\n"); } if(gbKB_MagicState == 3) { diff --git a/Kernel/drv/pci.c b/Kernel/drv/pci.c index dfbc8ca2..e205d4f4 100644 --- a/Kernel/drv/pci.c +++ b/Kernel/drv/pci.c @@ -116,7 +116,7 @@ int PCI_Install(char **Arguments) if(devInfo.oc == PCI_OC_PCIBRIDGE) { #if LIST_DEVICES - Log("[PCI ] Bridge @ %i,%i:%i (0x%x:0x%x)", + Log_Log("PCI", "Bridge @ %i,%i:%i (0x%x:0x%x)", bus, dev, fcn, devInfo.vendor, devInfo.device); #endif giPCI_BusCount++; @@ -124,7 +124,7 @@ int PCI_Install(char **Arguments) else { #if LIST_DEVICES - Log("[PCI ] Device %i,%i:%i %04x => 0x%04x:0x%04x", + Log_Log("PCI", "Device %i,%i:%i %04x => 0x%04x:0x%04x", bus, dev, fcn, devInfo.oc, devInfo.vendor, devInfo.device); #endif } @@ -156,7 +156,7 @@ int PCI_Install(char **Arguments) return MODULE_ERR_MALLOC; gPCI_Devices = tmpPtr; - // Complete Driver Structure + // Complete Driver Structure gPCI_DriverStruct.RootNode.Size = giPCI_DeviceCount; // And add to DevFS diff --git a/Kernel/drv/vterm.c b/Kernel/drv/vterm.c index cedcb33e..ff116f3e 100644 --- a/Kernel/drv/vterm.c +++ b/Kernel/drv/vterm.c @@ -157,8 +157,8 @@ int VT_Install(char **Arguments) if(!gsVT_OutputDevice) gsVT_OutputDevice = "/Devices/"DEFAULT_OUTPUT; if(!gsVT_InputDevice) gsVT_InputDevice = "/Devices/"DEFAULT_INPUT; - LOG("Using '%s' as output", gsVT_OutputDevice); - LOG("Using '%s' as input", gsVT_InputDevice); + Log_Log("VTerm", "Using '%s' as output", gsVT_OutputDevice); + Log_Log("VTerm", "Using '%s' as input", gsVT_InputDevice); // Create Nodes for( i = 0; i < NUM_VTS; i++ ) @@ -474,7 +474,7 @@ void VT_SetTerminal(int ID) VFS_IOCtl( giVT_OutputDevHandle, VIDEO_IOCTL_GETSETMODE, &modeNum ); // Update current terminal ID - Log("Changed terminal from %i to %i", giVT_CurrentTerminal, ID); + Log_Log("VTerm", "Changed terminal from %i to %i", giVT_CurrentTerminal, ID); giVT_CurrentTerminal = ID; // Update the screen diff --git a/Kernel/system.c b/Kernel/system.c index 8b1cb8e0..2097f9ba 100644 --- a/Kernel/system.c +++ b/Kernel/system.c @@ -48,7 +48,7 @@ void System_Init(char *ArgString) System_ParseCommandLine(ArgString); // - Execute the Config Script - Log_Log("CFG", "Executing config script..."); + Log_Log("Config", "Executing config script..."); System_ExecuteScript(); } @@ -63,7 +63,7 @@ void System_ParseCommandLine(char *ArgString) int i; char *str; - Log_Log("CFG", "Kernel Invocation \"%s\"", ArgString); + Log_Log("Config", "Kernel Invocation \"%s\"", ArgString); // --- Get Arguments --- str = ArgString; @@ -114,7 +114,7 @@ void System_ParseVFS(char *Arg) // Check if the equals was found if( *value == '\0' ) { - Log_Warning("CFG", "Expected '=' in the string '%s'", Arg); + Log_Warning("Config", "Expected '=' in the string '%s'", Arg); return ; } @@ -125,7 +125,7 @@ void System_ParseVFS(char *Arg) // - Symbolic Link = if(value[0] == '/') { - Log_Log("CFG", "Symbolic link '%s' pointing to '%s'", Arg, value); + Log_Log("Config", "Symbolic link '%s' pointing to '%s'", Arg, value); VFS_Symlink(Arg, value); } // - Mount =: @@ -140,13 +140,13 @@ void System_ParseVFS(char *Arg) } // Create Mountpoint if( (fd = VFS_Open(Arg, 0)) == -1 ) { - Log_Log("CFG", "Creating directory '%s'", Arg, value); + Log_Log("Config", "Creating directory '%s'", Arg, value); VFS_MkDir( Arg ); } else { VFS_Close(fd); } // Mount - Log_Log("CFG", "Mounting '%s' to '%s' ('%s')", dev, Arg, value); + Log_Log("Config", "Mounting '%s' to '%s' ('%s')", dev, Arg, value); VFS_Mount(dev, Arg, value, ""); } } @@ -168,7 +168,7 @@ void System_ParseSetting(char *Arg) { //if(strcmp(Arg, "") == 0) { //} else { - Log_Warning("CFG", "Kernel flag '%s' is not recognised", Arg); + Log_Warning("Config", "Kernel flag '%s' is not recognised", Arg); //} } else @@ -177,10 +177,10 @@ void System_ParseSetting(char *Arg) value ++; // and eat it's position if(strcmp(Arg, "SCRIPT") == 0) { - Log_Log("CFG", "Config Script: '%s'", value); + Log_Log("Config", "Config Script: '%s'", value); gsConfigScript = value; } else { - Log_Warning("CFG", "Kernel config setting '%s' is not recognised", Arg); + Log_Warning("Config", "Kernel config setting '%s' is not recognised", Arg); } } @@ -201,7 +201,7 @@ void System_ExecuteScript() // Open Script fp = VFS_Open(gsConfigScript, VFS_OPENFLAG_READ); if(fp == -1) { - Log_Warning("CFG", "Passed script '%s' does not exist", gsConfigScript); + Log_Warning("Config", "Passed script '%s' does not exist", gsConfigScript); return; } @@ -229,11 +229,11 @@ void System_ExecuteScript() if( strcmp(line->Parts[0], "mount") == 0 ) { if( line->nParts != 4 ) { - Log_Warning("CFG", "Configuration command 'mount' requires 3 arguments, %i given", + Log_Warning("Config", "Configuration command 'mount' requires 3 arguments, %i given", line->nParts-1); continue; } - //Log_Log("CFG", "Mount '%s' to '%s' (%s)", + //Log_Log("Config", "Mount '%s' to '%s' (%s)", // line->Parts[1], line->Parts[2], line->Parts[3]); //! \todo Use an optional 4th argument for the options string VFS_Mount(line->Parts[1], line->Parts[2], line->Parts[3], ""); @@ -256,33 +256,33 @@ void System_ExecuteScript() else if(strcmp(line->Parts[0], "udimod") == 0) { if( line->nParts != 2 ) { - Log_Warning("CFG", "Configuration command 'udimod' requires 1 argument, %i given", + Log_Warning("Config", "Configuration command 'udimod' requires 1 argument, %i given", line->nParts-1); continue; } - Log_Log("CFG", "Load UDI Module '%s'", line->Parts[1]); + Log_Log("Config", "Load UDI Module '%s'", line->Parts[1]); Module_LoadFile(line->Parts[1], ""); } // Load a EDI Module else if(strcmp(line->Parts[0], "edimod") == 0) { if( line->nParts != 2 ) { - Log_Warning("CFG", "Configuration command 'edimod' requires 1 argument, %i given", + Log_Warning("Config", "Configuration command 'edimod' requires 1 argument, %i given", line->nParts-1); continue; } - Log_Log("CFG", "Load EDI Module '%s'", line->Parts[1]); + Log_Log("Config", "Load EDI Module '%s'", line->Parts[1]); Module_LoadFile(line->Parts[1], ""); } // Create a Symbolic Link else if(strcmp(line->Parts[0], "symlink") == 0) { if( line->nParts != 3 ) { - Log_Warning("CFG", "Configuration command 'symlink' requires 2 arguments, %i given", + Log_Warning("Config", "Configuration command 'symlink' requires 2 arguments, %i given", line->nParts-1); continue; } - Log_Log("CFG", "Symlink '%s' pointing to '%s'", + Log_Log("Config", "Symlink '%s' pointing to '%s'", line->Parts[1], line->Parts[2]); VFS_Symlink(line->Parts[1], line->Parts[2]); } @@ -290,26 +290,26 @@ void System_ExecuteScript() else if(strcmp(line->Parts[0], "mkdir") == 0) { if( line->nParts != 2 ) { - Log_Warning("CFG", "Configuration command 'mkdir' requires 1 argument, %i given", + Log_Warning("Config", "Configuration command 'mkdir' requires 1 argument, %i given", line->nParts-1); continue; } - Log_Log("CFG", "New Directory '%s'", line->Parts[1]); + Log_Log("Config", "New Directory '%s'", line->Parts[1]); VFS_MkDir(line->Parts[1]); } // Spawn a process else if(strcmp(line->Parts[0], "spawn") == 0) { if( line->nParts != 2 ) { - Log_Warning("CFG", "Configuration command 'spawn' requires 1 argument, %i given", + Log_Warning("Config", "Configuration command 'spawn' requires 1 argument, %i given", line->nParts-1); continue; } - Log_Log("CFG", "Starting '%s' as a new task", line->Parts[1]); + Log_Log("Config", "Starting '%s' as a new task", line->Parts[1]); Proc_Spawn(line->Parts[1]); } else { - Log_Warning("CFG", "Unknown configuration command '%s' on line %i", + Log_Warning("Config", "Unknown configuration command '%s' on line %i", line->Parts[0], line->TrueLine ); diff --git a/Kernel/threads.c b/Kernel/threads.c index 1ab70296..96a38dac 100644 --- a/Kernel/threads.c +++ b/Kernel/threads.c @@ -468,7 +468,7 @@ void Threads_Sleep() tThread *cur = Proc_GetCurThread(); tThread *thread; - Log_Log("Threads", "%i going to sleep", cur->TID); + //Log_Log("Threads", "%i going to sleep", cur->TID); // Acquire Spinlock LOCK( &giThreadListLock ); @@ -507,9 +507,7 @@ void Threads_Sleep() // Release Spinlock RELEASE( &giThreadListLock ); - while(cur->Status == THREAD_STAT_SLEEPING) HALT(); - //HALT(); - Log_Debug("VM8086", "What a lovely sleep"); + while(cur->Status != THREAD_STAT_ACTIVE) HALT(); } @@ -524,7 +522,7 @@ void Threads_Wake(tThread *Thread) { case THREAD_STAT_ACTIVE: break; case THREAD_STAT_SLEEPING: - Log_Log("Threads", "Waking %i (%p) from sleeping", Thread->TID, Thread); + //Log_Log("Threads", "Waking %i (%p) from sleeping", Thread->TID, Thread); LOCK( &giThreadListLock ); prev = Threads_int_GetPrev(&gSleepingThreads, Thread); prev->Next = Thread->Next; // Remove from sleeping queue diff --git a/Modules/Display/BochsGA/bochsvbe.c b/Modules/Display/BochsGA/bochsvbe.c index d1d78a5c..1ed46ccb 100644 --- a/Modules/Display/BochsGA/bochsvbe.c +++ b/Modules/Display/BochsGA/bochsvbe.c @@ -1,7 +1,6 @@ /** * \file drv_bochsvbe.c - * \brief BGA (Bochs Graphic Adapter) Driver - * \note for Acess2 + * \brief BGA (Bochs Graphic Adapter) Driver for Acess2 * \warning This driver does NOT support the Bochs PCI VGA driver */ #define DEBUG 0 diff --git a/Modules/IPStack/main.c b/Modules/IPStack/main.c index 9b132ec8..6fe92f45 100644 --- a/Modules/IPStack/main.c +++ b/Modules/IPStack/main.c @@ -97,7 +97,7 @@ int IPStack_Install(char **Arguments) */ int IPStack_AddFile(tSocketFile *File) { - Log("IPStack_AddFile: %s", File->Name); + Log_Log("IPStack", "Added file '%s'", File->Name); File->Next = gIP_FileTemplates; gIP_FileTemplates = File; return 0; diff --git a/Modules/IPStack/tcp.c b/Modules/IPStack/tcp.c index 9c26767b..741ec140 100644 --- a/Modules/IPStack/tcp.c +++ b/Modules/IPStack/tcp.c @@ -339,7 +339,10 @@ void TCP_INT_HandleConnectionPacket(tTCPConnection *Connection, tTCPHeader *Head { // Ooh, Goodie! Add it to the recieved list TCP_INT_AppendRecieved(Connection, pkt); - Connection->NextSequenceRcv ++; + if(dataLen) + Connection->NextSequenceRcv += dataLen; + else + Connection->NextSequenceRcv += 1; // TODO: This should be moved out of the watcher thread, // so that a single lost packet on one connection doesn't cause @@ -348,7 +351,7 @@ void TCP_INT_HandleConnectionPacket(tTCPConnection *Connection, tTCPHeader *Head } // TODO: Check ACK code validity - Header->AcknowlegementNumber = ntohl(pkt->Sequence); + Header->AcknowlegementNumber = ntohl(pkt->Sequence) + dataLen; Header->SequenceNumber = ntohl(Connection->NextSequenceSend); Header->Flags &= TCP_FLAG_SYN; Header->Flags = TCP_FLAG_ACK; diff --git a/Modules/USB/Makefile.tpl b/Modules/USB/Makefile.tpl new file mode 100644 index 00000000..8df70988 --- /dev/null +++ b/Modules/USB/Makefile.tpl @@ -0,0 +1,3 @@ +CATEGORY = USB + +-include ../../Makefile.tpl