diff --git a/2011-09-08-11-08-21.095-VirtualBox.exe-4800.log b/2011-09-08-11-08-21.095-VirtualBox.exe-4800.log new file mode 100644 index 0000000..ef8748f --- /dev/null +++ b/2011-09-08-11-08-21.095-VirtualBox.exe-4800.log @@ -0,0 +1,4 @@ +Log created: 2011-09-08T11:08:21.957118500Z +Executable: C:\PROGRA~1\oracle\Virtua~1\VirtualBox.exe +Commandline: C:\PROGRA~1\oracle\Virtua~1\\virtualbox --startvm "lux Testbed" --dbg +fatal error in recompiler cpu: triple fault diff --git a/2011-09-08-11-55-49.039-VirtualBox.exe-2220.log b/2011-09-08-11-55-49.039-VirtualBox.exe-2220.log new file mode 100644 index 0000000..8147f0e --- /dev/null +++ b/2011-09-08-11-55-49.039-VirtualBox.exe-2220.log @@ -0,0 +1,4 @@ +Log created: 2011-09-08T11:55:49.393922000Z +Executable: C:\PROGRA~1\oracle\Virtua~1\VirtualBox.exe +Commandline: C:\PROGRA~1\oracle\Virtua~1\\virtualbox --startvm "lux Testbed" --dbg +fatal error in recompiler cpu: triple fault diff --git a/Build/loader.o b/Build/loader.o index c47ad8b..e5acfcb 100644 Binary files a/Build/loader.o and b/Build/loader.o differ diff --git a/Kernel/debug/commands.c b/Kernel/debug/commands.c index 458e582..aba4937 100644 --- a/Kernel/debug/commands.c +++ b/Kernel/debug/commands.c @@ -173,7 +173,7 @@ void _CommandMemPrintMemmap() blocks = n - old; used = 0; for (; old < n; old++) - used += (MemPhGetFrame(old) != 0); + used += (MemPhGetBlock (old) != 0); if (used <= blocks / 5) c = ' '; else if (used > 4 * blocks / 5) c = 219; diff --git a/Kernel/debug/console-base.c b/Kernel/debug/console-base.c index 1eee06a..cb65186 100644 --- a/Kernel/debug/console-base.c +++ b/Kernel/debug/console-base.c @@ -55,7 +55,7 @@ Point ConsoleGetCursor() return ConsoleCursor; } -extern void ConsoleSetCursor(Point p) +void ConsoleSetCursor(Point p) { ConsoleCursor = p; } diff --git a/Kernel/drivers/drivers.c b/Kernel/drivers/drivers.c index ea27307..c344206 100644 --- a/Kernel/drivers/drivers.c +++ b/Kernel/drivers/drivers.c @@ -29,6 +29,7 @@ void DriversInstall() DriversInstall_Clock(); // Install fdc - IrqInstallHandler(6, FloppyIrqHandler); - FloppyInitialize(); + Error ("Floppy", "Floppy driver is currently disabled.\n"); + //IrqInstallHandler(6, FloppyIrqHandler); + //FloppyInitialize(); } diff --git a/Kernel/hal/filesys/initrd/initrd.c b/Kernel/hal/filesys/initrd/initrd.c index 1c7fbd2..2836d20 100644 --- a/Kernel/hal/filesys/initrd/initrd.c +++ b/Kernel/hal/filesys/initrd/initrd.c @@ -180,13 +180,16 @@ void luxInitrdInstall (MultibootInfo* info) VfsInstallFs(&fs); // Check for multiboot info flags to see if any modules are loaded - if ((info->Flags & 8) == 0) return; + if ((info->Flags & 8) == 0) { + Error("Initrd", "No boot modules found!"); + return; + } // Loop through each module and if it is an initrd image, mount it MultibootModule* modules = (MultibootModule*) info->ModulesAddress; for (i = 0; i < info->ModulesCount; i++) - if ((*(uint32*) modules[i].ModuleStart) == LUXMAGIC) + if (*((uint32*) modules[i].ModuleStart) == LUXMAGIC) { // Mount the device Log("Initrd", "Found initrd image at 0x%x.\n", modules[i].ModuleStart); @@ -196,4 +199,7 @@ void luxInitrdInstall (MultibootInfo* info) mp->FsData[0] = modules[i].ModuleStart; mp->FsData[1] = modules[i].ModuleEnd; } + else { + Log("Initrd", "Found module @ 0x%x, but not initrd image.\n", modules[i].ModuleStart); + } } diff --git a/Kernel/hal/hal.c b/Kernel/hal/hal.c index 0569d3e..a6fd502 100644 --- a/Kernel/hal/hal.c +++ b/Kernel/hal/hal.c @@ -34,7 +34,7 @@ void HalInitialize() KeyboardInstallB(); Log("HAL", "%#[2/2]\n", ColorLightGreen); // Install mouse driver - MouseInstall(); Log("HAL", "Installed mouse driver\n"); + //MouseInstall(); Log("HAL", "Installed mouse driver\n"); // Install VFS VfsInstall(); diff --git a/Kernel/hal/vfs.c b/Kernel/hal/vfs.c index b1f8c0d..82d05eb 100644 --- a/Kernel/hal/vfs.c +++ b/Kernel/hal/vfs.c @@ -228,6 +228,10 @@ DirectoryEntry* VfsReadDirectory (FILE* handle, uint32 index) if (!handle) return NULL; MountPoint* mp = &(mpArray[handle->DeviceId]); + // Don't try to read files as directories + if ((handle->Flags & 0x7) == FileFile) return NULL; + + // Ask FS to make the read if (!fsArray[mp->FsId].ReadDirectory) return NULL; return fsArray[mp->FsId].ReadDirectory(mp, handle, index); } diff --git a/Kernel/include/memory-add.h b/Kernel/include/memory-add.h index 08b99a9..6f66cb7 100644 --- a/Kernel/include/memory-add.h +++ b/Kernel/include/memory-add.h @@ -33,8 +33,6 @@ enum PageFlags PageFrame = 0xFFFFF000 }; - - typedef struct { Page Pages[1024]; } PageTable; @@ -48,25 +46,28 @@ typedef struct { extern PageDirectory* CurrentDirectory; extern PageDirectory* KernelDirectory; -extern void PagingInitialize(uint32 SystemMemory); -extern void PagingSwitchPageDirectory (PageDirectory* dir); -extern Page* PagingGetPage(uint32 addr, uint8 make, PageDirectory* dir); - +extern void PagingEnable (); +extern void PagingDisable (); +extern void PagingSwitchDirectory (PageDirectory* dir); +extern void PagingFlushTlb (); +extern void PagingInitialize (uint32* kernelEnd); +extern void PagingMapPage (uint32 phys, uint32 virt, uint32 flags, PageDirectory* pd); +extern void PagingUnmapPage (uint32 virt, PageDirectory* pd); +extern uint32 PagingGetPhysical (uint32 virt, PageDirectory* pd); /*************************************************** * Physical memory manager * ***************************************************/ -extern uint32 TotalFrames; +extern uint32 TotalBlocks; extern uint32 TotalMemory; -extern uint32 UsedFrames; +extern uint32 UsedBlocks; -void MemPhInitialize(uint32 SystemMemoryKb); -extern void MemPhSetFrame (uint32 frame, uint8 value); -uint32 MemPhGetFrame (uint32 frame); -uint32 MemPhFindFreeFrame(); -void MemPhAllocFrame(Page* page, uint8 isKernel, uint8 isWriteable); -void MemPhFreeFrame(Page* page); -void MemPhReserveFrames (uint32 address, uint32 length); +extern void MemPhInitialize (uint32 SystemMemoryKb); +extern void MemPhSetBlock (uint32 Block, uint8 value); +extern uint32 MemPhGetBlock (uint32 Block); +extern uint32 MemPhAllocateBlock (); +extern void MemPhFreeBlock (uint32 addr); +extern void MemPhReserveBlocks (uint32 address, uint32 length); /*************************************************** @@ -82,12 +83,12 @@ typedef struct extern MemHeap* KernelHeap; -extern uint32 MemHeapFindSmallestHole (uint32 size, uint8 page_align, MemHeap* heap); -extern int32 MemHeapCompare (uint32 a, uint32 b); -extern MemHeap* MemHeapCreate(uint32 start, uint32 end, uint32 max, uint8 flags); -extern void MemHeapExpand(uint32 newsz, MemHeap* heap, PageDirectory* pd); -extern uint32 MemHeapContract(uint32 newsz, MemHeap* heap, PageDirectory* pd); -extern uint32 MemHeapAlloc (uint32 size, uint8 isPageAligned, MemHeap* heap, PageDirectory* pd); -extern void MemHeapFree (uint32 address, MemHeap* heap, PageDirectory* pd); +extern uint32 MemHeapFindSmallestHole (uint32 size, uint8 page_align, MemHeap* heap); +extern int32 MemHeapCompare (uint32 a, uint32 b); +extern MemHeap* MemHeapCreate (uint32 start, uint32 end, uint32 max, uint8 flags); +extern uint32 MemHeapExpand (uint32 newsz, MemHeap* heap, PageDirectory* pd); +extern uint32 MemHeapContract (uint32 newsz, MemHeap* heap, PageDirectory* pd); +extern uint32 MemHeapAlloc (uint32 size, uint8 isPageAligned, MemHeap* heap, PageDirectory* pd); +extern void MemHeapFree (uint32 address, MemHeap* heap, PageDirectory* pd); #endif /* MEMORY_ADD_H_ */ diff --git a/Kernel/include/settings.h b/Kernel/include/settings.h index bf7b528..5de2003 100644 --- a/Kernel/include/settings.h +++ b/Kernel/include/settings.h @@ -32,7 +32,7 @@ // Memory manager #define KERNEL_HEAP_START 0xC0000000 #define KERNEL_HEAP_INITIAL_SIZE 0x100000 -#define KERNEL_HEAP_END (KERNEL_HEAP_START + KERNEL_HEAP_INITIAL_SIZE) +#define KERNEL_HEAP_END (KERNEL_HEAP_START + KERNEL_HEAP_INITIAL_SIZE) #endif /* SETTINGS_H_ */ diff --git a/Kernel/include/version.h b/Kernel/include/version.h index 45df4f7..f4ab084 100644 --- a/Kernel/include/version.h +++ b/Kernel/include/version.h @@ -1 +1 @@ -#define OS_BUILD "0.1.0.601" +#define OS_BUILD "0.1.0.629" diff --git a/Kernel/library/memory/memory_alloc.c b/Kernel/library/memory/memory_alloc.c index 4b7c4ea..3ab91f8 100644 --- a/Kernel/library/memory/memory_alloc.c +++ b/Kernel/library/memory/memory_alloc.c @@ -28,8 +28,7 @@ uint32 _malloc_init2 (uint32 size, uint8 page_aligned, uint32* phys) if (phys) { - Page *pg = PagingGetPage(ret, 0, KernelDirectory); - *phys = (*pg & PageFrame) + (ret & 0xFFF); + *phys = PagingGetPhysical(ret, KernelDirectory) + (ret & 0xFFF); Log("Mem","%#Allocated %u bytes (%spage aligned) at address 0x%x (phys=%x).\n", ColorLightMagenta, size, ((page_aligned) ? "" : "not "), ret, *phys); } diff --git a/Kernel/library/memory/memory_info.c b/Kernel/library/memory/memory_info.c index fbcf54a..001d8c6 100644 --- a/Kernel/library/memory/memory_info.c +++ b/Kernel/library/memory/memory_info.c @@ -6,7 +6,6 @@ */ #include -// MemoryGetFree(), MemoryGetTotal(), MemoryGet blah blah... // Returns total physical memory in bytes uint32 MemoryGetTotal() @@ -17,13 +16,13 @@ uint32 MemoryGetTotal() // Returns total free physical memory in bytes uint32 MemoryGetFree() { - return (TotalFrames - UsedFrames) * 0x4; + return (TotalBlocks - UsedBlocks) * 0x4; } // Total used physical memory in bytes uint32 MemoryGetUsed() { - return UsedFrames * 0x4; + return UsedBlocks * 0x4; } // Same as above functions, but in frames @@ -34,15 +33,15 @@ uint32 MemoryGetFrameSize() uint32 MemoryGetFramesTotal() { - return TotalFrames; + return TotalBlocks; } uint32 MemoryGetFramesUsed() { - return UsedFrames; + return UsedBlocks; } uint32 MemoryGetFramesFree() { - return (TotalFrames - UsedFrames); -} \ No newline at end of file + return (TotalBlocks - UsedBlocks); +} diff --git a/Kernel/library/memory/memory_init.c b/Kernel/library/memory/memory_init.c index cb87d01..dec5ac4 100644 --- a/Kernel/library/memory/memory_init.c +++ b/Kernel/library/memory/memory_init.c @@ -10,7 +10,6 @@ #include "../../drivers/cmos/cmos.h" #include - uint32 mem_kernel_end = 0; uint8 mem_initialized = 0; @@ -42,7 +41,7 @@ void _memory_reserve_system(MultibootInfo* info) while ((uint32)location < (info->MemoryMapAddress + info->MemoryMapLength)) { if (location->Type > 1) - MemPhReserveFrames((uint32)location->Address, (uint32)location->Length); + MemPhReserveBlocks((uint32)location->Address, (uint32)location->Length); location = (MultibootMemoryMapEntry*) ((uint32)location + location->Size + sizeof(uint32)); } @@ -53,29 +52,35 @@ void _memory_reserve_system(MultibootInfo* info) Error("Mem", "%#Missing %#memory map%# info from bootloader.\n", ColorLightRed, ColorWhite, ColorLightRed); // Standard memory hole at 15mb - MemPhReserveFrames(0x00F00000, 0x00100000); + MemPhReserveBlocks(0x00F00000, 0x00100000); } - // Standard reserved memory areas - MemPhReserveFrames(0x0, 0x400 + 256); // Real mode IVT, BDA - MemPhReserveFrames(0x1000, 0x2400); // DMA buffer - MemPhReserveFrames(0x9FC00, 385*1024); // EBDA, Video memory, ROM area } void MemoryInitialize (MultibootInfo* info) { + // Get total system memory uint32 totalSystemMemory = _memory_get_total_mem(info); + // Initialize physical & virtual memory managers + uint32 end = mem_kernel_end + 0x80000; MemPhInitialize(totalSystemMemory); - PagingInitialize(0x200000); + PagingInitialize(&end); + // Reserve physical blocks _memory_reserve_system(info); + uint32 i; + // Allocate some space for the kernel heap + for (i = KERNEL_HEAP_START; i <= KERNEL_HEAP_END; i += 0x1000) + PagingMapPage(MemPhAllocateBlock(), i, PageWriteable, KernelDirectory); + + // Create the kernel heap KernelHeap = MemHeapCreate(KERNEL_HEAP_START, KERNEL_HEAP_START + KERNEL_HEAP_INITIAL_SIZE, 0xCFFFF000, 3); // is kernel, writeable - Log("Mem", "Done initializing memory!"); + Log("Mem", "Done initializing memory!\n"); mem_initialized = 2; } @@ -84,5 +89,5 @@ void MemoryTempInitialize (uint32 kernel_end) { mem_initialized = 1; mem_kernel_end = kernel_end; - Log("Mem", "Initialized temporary memory manager, allocating from %#0x%x.\n", kernel_end); + Log("Mem", "Initialized temporary memory manager, allocating from %#0x%x.\n", ColorWhite, mem_kernel_end); } diff --git a/Kernel/loader.asm b/Kernel/loader.asm index 119b3c7..ca583f6 100644 --- a/Kernel/loader.asm +++ b/Kernel/loader.asm @@ -26,29 +26,22 @@ start: mov ecx, eax -; lgdt [trickgdt] -; mov ax, 0x10; -; mov ds, ax -; mov es, ax -; mov fs, ax -; mov gs, ax -; mov ss, ax - -; jmp 0x08:HigherHalf ; NOTE: Must be absolute jump! - -HigherHalf: - - ; Verify booted with multiboot compliant bootloader + ; setup initial stack mov esp, stack+STACKSIZE + ; Verify booted with multiboot compliant bootloader cmp ecx, 0x2BADB002 jne .bad + push esp push ebx extern k_main call k_main + cli + hlt + ; Show error message, and halt system .bad: @@ -72,27 +65,8 @@ HigherHalf: ErrorString db 0xA, "%#! Fatal error: Not booted with multiboot compliant bootloader (e.g. GRUB).", 0x0 ErrorColor db 0x0C - - -; tells the assembler to include this data in the '.setup' section -section .setup - -trickgdt: - dw gdt_end - gdt - 1 ; size of the GDT - dd gdt ; linear address of GDT - -gdt: - dd 0, 0 ; null gate - db 0xFF, 0xFF, 0, 0, 0, 10011010b, 11001111b, 0x40 ; code selector 0x08: base 0x40000000, limit 0xFFFFFFFF, type 0x9A, granularity 0xCF - db 0xFF, 0xFF, 0, 0, 0, 10010010b, 11001111b, 0x40 ; data selector 0x10: base 0x40000000, limit 0xFFFFFFFF, type 0x92, granularity 0xCF - -gdt_end: - - - - ; stack section .bss align 32 stack: - resb STACKSIZE ; This reserves 64KBytes of memory here + resb STACKSIZE ; This reserves memory for stack diff --git a/Kernel/memory/mem-heap.c b/Kernel/memory/mem-heap.c index eac2d6e..dee88e1 100644 --- a/Kernel/memory/mem-heap.c +++ b/Kernel/memory/mem-heap.c @@ -6,9 +6,6 @@ #define MEMHEAP_INDEX_SIZE 0x20000 #define MEMHEAP_MINIM_SIZE 0x70000 -#define FlagsKernel 1 -#define FlagsWriteable 2 - typedef struct { uint32 Magic; @@ -98,30 +95,31 @@ MemHeap* MemHeapCreate(uint32 start, uint32 end, uint32 max, uint8 flags) } -void MemHeapExpand(uint32 newsz, MemHeap* heap, PageDirectory* pd) +uint32 MemHeapExpand(uint32 newsz, MemHeap* heap, PageDirectory* pd) { - if (newsz <= heap->EndAddress - heap->StartAddress) return; + if (newsz <= heap->EndAddress - heap->StartAddress) return heap->EndAddress - heap->StartAddress; if (newsz & 0xfff) newsz = (newsz & 0xfffff000) + 0x1000; - if (newsz + heap->StartAddress >= heap->MaxAddress) return; + if (newsz + heap->StartAddress >= heap->MaxAddress) return heap->EndAddress - heap->StartAddress; uint32 i; - for (i = heap->EndAddress - heap->StartAddress; i < heap->StartAddress + newsz; i+=0x1000) - MemPhAllocFrame(PagingGetPage(i, 1, pd), heap->Flags & FlagsKernel, heap->Flags & FlagsWriteable); + for (i = heap->EndAddress; i < heap->StartAddress + newsz; i+=0x1000) + PagingMapPage(MemPhAllocateBlock(), i, heap->Flags, pd); heap->EndAddress = heap->StartAddress + newsz; + return newsz; } uint32 MemHeapContract(uint32 newsz, MemHeap* heap, PageDirectory* pd) { - if (newsz >= heap->EndAddress - heap->StartAddress) return 0; + if (newsz >= heap->EndAddress - heap->StartAddress) return heap->EndAddress - heap->StartAddress; if (newsz & 0xfff) newsz = (newsz & 0xfffff000) + 0x1000; // page align newsz = Max(newsz, MEMHEAP_MINIM_SIZE); uint32 i; - for (i = heap->EndAddress - heap->StartAddress - 0x1000; i > newsz; i-=0x1000) - MemPhFreeFrame(PagingGetPage(i, 0, pd)); + for (i = heap->EndAddress - 0x1000; i > heap->StartAddress + newsz; i-=0x1000) + PagingUnmapPage(i, pd); heap->EndAddress = heap->StartAddress + newsz; return newsz; diff --git a/Kernel/memory/mem-paging.c b/Kernel/memory/mem-paging.c index f9c3904..c7620cc 100644 --- a/Kernel/memory/mem-paging.c +++ b/Kernel/memory/mem-paging.c @@ -6,69 +6,123 @@ */ #include #include + /******************************* * Data * *******************************/ PageDirectory* CurrentDirectory; PageDirectory* KernelDirectory; -/******************************* - * Useful routines * - *******************************/ -void PagingInitialize(uint32 kernel_used) +void PagingEnable() { - Log("Mem", "Virtual memory manager initialization started. End of kernel = 0x%x\n", kernel_used); - PageDirectory* kernelPd = (PageDirectory*) kmalloc_a(sizeof(PageDirectory)); - memset(kernelPd, 0, sizeof(PageDirectory)); - - CurrentDirectory = kernelPd; - KernelDirectory = kernelPd; - - uint32 i; - for (i = 0; i < kernel_used; i+=0x1000) - MemPhAllocFrame(PagingGetPage(i, 1, kernelPd), 0, 0); - - Log("Mem", "Identity mapped first 0x%x bytes.\n", kernel_used); - - for (i = KERNEL_HEAP_START; i < KERNEL_HEAP_END; i+=0x1000) - MemPhAllocFrame(PagingGetPage(i, 1, kernelPd), 1, 1); - - Log("Mem", "Mapped kernel space.\n"); - - PagingSwitchPageDirectory (kernelPd); + uint32 tmp; + asm volatile ("mov %%cr0, %0" : "=r"(tmp)); + tmp |= 0x80000000; + asm volatile ("mov %0, %%cr0" : : "r"(tmp)); } -void PagingSwitchPageDirectory (PageDirectory* dir) +void PagingDisable() +{ + uint32 tmp; + asm volatile ("mov %%cr0, %0" : "=r"(tmp)); + tmp &= 0x7FFFFFFF; + asm volatile ("mov %0, %%cr0" : : "r"(tmp)); +} + +void PagingSwitchDirectory(PageDirectory* dir) { CurrentDirectory = dir; - asm volatile ("mov %0, %%cr3":: "r"(&dir->TablesPhysical)); - - uint32 cr0; - asm volatile ("mov %%cr0, %0": "=r"(cr0)); - cr0 |= 0x80000000; - asm volatile ("mov %0, %%cr0":: "r"(cr0)); - - Log("Mem", "Enabled paging.\n"); + asm volatile ("mov %0, %%cr3" : : "r"(dir->PhysicalAddr)); } -Page* PagingGetPage(uint32 addr, uint8 make, PageDirectory* dir) +void PagingFlushTlb () { - addr >>= 12; + uint32 tmp; + asm volatile ("mov %%cr3, %0" : "=r"(tmp)); + asm volatile ("mov %0, %%cr3" : : "r" (tmp)); +} - uint32 tableIndex = addr >> 10; +void PagingInitialize(uint32* kernelEnd) +{ + // Create the kernel page directory + PageDirectory* kdir = kmalloc_a(sizeof(PageDirectory)); + memset(kdir, 0, sizeof(PageDirectory)); - if (dir->Tables[tableIndex]) - return &dir->Tables[tableIndex]->Pages[addr&0x3ff]; + KernelDirectory = kdir; - else if (make) + // Set up physical address of PDEs. + kdir->PhysicalAddr = (uint32) kdir->TablesPhysical; + + // Identity map the kernel + uint32 i = 0; + while (i <= *kernelEnd + 1024) { - uint32 temp; - dir->Tables[tableIndex] = (PageTable*)kmalloc_ap(sizeof(PageTable), &temp); - memset (dir->Tables[tableIndex], 0, 0x1000); - dir->TablesPhysical[tableIndex] = temp | 0x7; - return &dir->Tables[tableIndex]->Pages[addr&0x3ff]; + PagingMapPage(i, i, PageWriteable, kdir); + i += 0x1000; } - else return 0; + // Reserve the identity mapped blocks + MemPhReserveBlocks(0x0, *kernelEnd); + + PagingSwitchDirectory(kdir); + PagingEnable(); } +void PagingMapPage (uint32 phys, uint32 virt, uint32 flags, PageDirectory* pd) +{ + // Calculate pde and pte + uint32 pde = virt >> 22; + uint32 pte = (virt >> 12) & 0x3ff; + + phys &= 0xFFFFF000; // Make sure address is page aligned + flags &= 0xFFF; // Make sure flags don't overflow + + // See if page table exists + if (!pd->Tables[pde]) + { + // No? allocate it + uint32 ph; + PageTable* pt = kmalloc_ap(sizeof(PageTable), &ph); + memset(pt, 0, sizeof(PageTable)); + + pd->Tables[pde] = pt; + pd->TablesPhysical[pde] = ph | 0x7; + } + + // Set up the page + pd->Tables[pde]->Pages[pte] = phys | flags | 0x1; // Present, and flags + + // If it is the current directory, flush the tlb to notice the change + if (pd == CurrentDirectory) PagingFlushTlb(); +} + +void PagingUnmapPage (uint32 virt, PageDirectory* pd) +{ + // Calculate pde and pte + uint32 pde = virt >> 22; + uint32 pte = (virt >> 12) & 0x3ff; + + if (!pd->Tables[pde] || !pd->Tables[pde]->Pages[pte]) return; + + // Get physical address + uint32 phys = pd->Tables[pde]->Pages[pte] & PageFrame; + + // Free page + pd->Tables[pde]->Pages[pte] = 0; + MemPhFreeBlock(phys); + + // If it is the current directory, flush the tlb to notice the change + if (pd == CurrentDirectory) PagingFlushTlb(); +} + +uint32 PagingGetPhysical (uint32 virt, PageDirectory* pd) +{ + // Calculate pde and pte + uint32 pde = virt >> 22; + uint32 pte = (virt >> 12) & 0x3ff; + + // Not mapped + if (!pd->Tables[pde] || !pd->Tables[pde]->Pages[pte]) return NULL; + + return (pd->Tables[pde]->Pages[pte] & PageFrame); +} diff --git a/Kernel/memory/mem-phys.c b/Kernel/memory/mem-phys.c index 6f7b47a..974c694 100644 --- a/Kernel/memory/mem-phys.c +++ b/Kernel/memory/mem-phys.c @@ -6,103 +6,89 @@ */ #include -uint32* FrameMap; -uint32 TotalFrames; +uint32* BlockMap; +uint32 TotalBlocks; uint32 TotalMemory; -uint32 UsedFrames; +uint32 UsedBlocks; -inline void ConvertIndexToFrame (uint32 index, uint32* address, uint32* offset) +inline void ConvertIndexToBlock (uint32 index, uint32* address, uint32* offset) { *address = (index >> 5); *offset = index & 0x1f; } -inline uint32 ConvertFrameToIndex (uint32 address, uint32 offset) +inline uint32 ConvertBlockToIndex (uint32 address, uint32 offset) { return (address<<5) | offset; } -void MemPhSetFrame (uint32 frame, uint8 value) +void MemPhSetBlock (uint32 Block, uint8 value) { uint32 addr, off; - ConvertIndexToFrame(frame, &addr, &off); + ConvertIndexToBlock(Block, &addr, &off); if (value) { - if ((FrameMap[addr] & (1<> 5; addr++) - if (FrameMap[addr] != 0xffffffff) + for (addr = 0; addr < TotalBlocks >> 5; addr++) + if (BlockMap[addr] != 0xffffffff) { - for (pos = 0; (FrameMap[addr] & (1<> 12; + if (!Block) return; - uint32 free = MemPhFindFreeFrame(); - if (free == 0xffffffff) { - Panic("Mem", "%#Failed allocation free=0x%x page=0x%x\n", ColorRed, free, *page); - return; - } - - MemPhSetFrame(free, 1); - *page |= PagePresent; - *page |= (isKernel) ? 0 : PageUser; - *page |= (isWriteable) ? PageWriteable : 0; - *page |= (free<<12) & PageFrame; -} - -void MemPhFreeFrame(Page* page) -{ - uint32 frame = *page & PageFrame; - if (!frame) return; - - MemPhSetFrame(frame, 0); - *page &= ~PageFrame; + MemPhSetBlock(Block, 0); } void MemPhInitialize(uint32 SystemMemoryKb) { - TotalFrames = SystemMemoryKb >> 2; + TotalBlocks = SystemMemoryKb >> 2; TotalMemory = SystemMemoryKb; - FrameMap = (uint32*) kmalloc(sizeof(uint32) * (1 + (TotalFrames>>5))); - memset(FrameMap, 0, sizeof(uint32) * (1 + (TotalFrames>>5))); + BlockMap = (uint32*) kmalloc(sizeof(uint32) * (1 + (TotalBlocks>>5))); + memset(BlockMap, 0, sizeof(uint32) * (1 + (TotalBlocks>>5))); Log("Mem", "%#Started physical memory manager ok!, found %ukb\n", ColorLightGreen, SystemMemoryKb); } -void MemPhReserveFrames (uint32 address, uint32 length) +void MemPhReserveBlocks (uint32 address, uint32 length) { address >>= 12; length = (length>>12) + ((length & 0xfff) > 0); uint32 end = address + length; for (; address < end ; address++) - MemPhSetFrame(address, 1); + MemPhSetBlock(address, 1); } diff --git a/bochs/bochs_run.log b/bochs/bochs_run.log index 16cd2dd..da76dfd 100644 --- a/bochs/bochs_run.log +++ b/bochs/bochs_run.log @@ -1,206 +1,194 @@ -00000000000i[ ] Bochs x86 Emulator 2.4.6 -00000000000i[ ] Build from CVS snapshot, on February 22, 2011 -00000000000i[ ] Compiled at Aug 28 2011, 16:32:50 -00000000000i[ ] System configuration -00000000000i[ ] processors: 1 (cores=1, HT threads=1) -00000000000i[ ] A20 line support: yes -00000000000i[ ] CPU configuration -00000000000i[ ] level: 6 -00000000000i[ ] SMP support: yes, quantum=5 -00000000000i[ ] APIC support: yes -00000000000i[ ] FPU support: yes -00000000000i[ ] MMX support: yes -00000000000i[ ] 3dnow! support: yes -00000000000i[ ] SEP support: yes -00000000000i[ ] SSE support: sse2 -00000000000i[ ] XSAVE support: no -00000000000i[ ] AES support: no -00000000000i[ ] MOVBE support: no -00000000000i[ ] x86-64 support: yes -00000000000i[ ] 1G paging support: no -00000000000i[ ] VMX support: 1 -00000000000i[ ] Optimization configuration -00000000000i[ ] RepeatSpeedups support: yes -00000000000i[ ] Trace cache support: yes -00000000000i[ ] Fast function calls: yes -00000000000i[ ] Devices configuration -00000000000i[ ] ACPI support: yes -00000000000i[ ] NE2000 support: no -00000000000i[ ] PCI support: yes, enabled=yes -00000000000i[ ] SB16 support: yes -00000000000i[ ] USB support: no -00000000000i[ ] VGA extension support: vbe -00000000000i[MEM0 ] allocated memory at 0xb4116008. after alignment, vector=0xb4117000 -00000000000i[MEM0 ] 32.00MB -00000000000i[MEM0 ] mem block size = 0x00100000, blocks=32 -00000000000i[MEM0 ] rom at 0xfffe0000/131072 ('/usr/local/share/bochs/BIOS-bochs-latest') -00000000000i[MEM0 ] rom at 0xc0000/40448 ('/usr/local/share/bochs/VGABIOS-lgpl-latest') -00000000000i[CMOS ] Using local time for initial clock -00000000000i[CMOS ] Setting initial clock to: Mon Aug 29 10:21:59 2011 (time0=1314602519) -00000000000i[DMA ] channel 4 used by cascade -00000000000i[DMA ] channel 2 used by Floppy Drive -00000000000i[FDD ] fd0: '../luxos.img' ro=0, h=2,t=80,spt=18 -00000000000i[PCI ] 440FX Host bridge present at device 0, function 0 -00000000000i[PCI ] PIIX3 PCI-to-ISA bridge present at device 1, function 0 -00000000000i[VGA ] interval=50000 -00000000000i[MEM0 ] Register memory access handlers: 0x00000000000a0000 - 0x00000000000bffff -00000000000i[XGUI ] test_alloc_colors: 16 colors available out of 16 colors tried -00000000000i[XGUI ] font 8 wide x 16 high, display depth = 24 -00000000000i[MEM0 ] Register memory access handlers: 0x00000000e0000000 - 0x00000000e0ffffff -00000000000i[VGA ] VBE Bochs Display Extension Enabled -00000000000i[ ] init_dev of 'unmapped' plugin device by virtual method -00000000000i[ ] init_dev of 'biosdev' plugin device by virtual method -00000000000i[ ] init_dev of 'speaker' plugin device by virtual method -00000000000i[SPEAK] Failed to open /dev/console: Resource temporarily unavailable -00000000000i[SPEAK] Deactivating beep on console -00000000000i[ ] init_dev of 'extfpuirq' plugin device by virtual method -00000000000i[ ] init_dev of 'gameport' plugin device by virtual method -00000000000i[ ] init_dev of 'iodebug' plugin device by virtual method -00000000000i[ ] init_dev of 'pci_ide' plugin device by virtual method -00000000000i[PCI ] PIIX3 PCI IDE controller present at device 1, function 1 -00000000000i[ ] init_dev of 'acpi' plugin device by virtual method -00000000000i[PCI ] ACPI Controller present at device 1, function 3 -00000000000i[ ] init_dev of 'ioapic' plugin device by virtual method -00000000000i[IOAP ] initializing I/O APIC -00000000000i[MEM0 ] Register memory access handlers: 0x00000000fec00000 - 0x00000000fec00fff -00000000000i[ ] init_dev of 'keyboard' plugin device by virtual method -00000000000i[KBD ] will paste characters every 1000 keyboard ticks -00000000000i[ ] init_dev of 'harddrv' plugin device by virtual method -00000000000i[HD ] Using boot sequence floppy, none, none -00000000000i[HD ] Floppy boot signature check is enabled -00000000000i[ ] init_dev of 'serial' plugin device by virtual method -00000000000i[SER ] com1 at 0x03f8 irq 4 -00000000000i[ ] init_dev of 'parallel' plugin device by virtual method -00000000000i[PAR ] parallel port 1 at 0x0378 irq 7 -00000000000i[ ] register state of 'unmapped' plugin device by virtual method -00000000000i[ ] register state of 'biosdev' plugin device by virtual method -00000000000i[ ] register state of 'speaker' plugin device by virtual method -00000000000i[ ] register state of 'extfpuirq' plugin device by virtual method -00000000000i[ ] register state of 'gameport' plugin device by virtual method -00000000000i[ ] register state of 'iodebug' plugin device by virtual method -00000000000i[ ] register state of 'pci_ide' plugin device by virtual method -00000000000i[ ] register state of 'acpi' plugin device by virtual method -00000000000i[ ] register state of 'ioapic' plugin device by virtual method -00000000000i[ ] register state of 'keyboard' plugin device by virtual method -00000000000i[ ] register state of 'harddrv' plugin device by virtual method -00000000000i[ ] register state of 'serial' plugin device by virtual method -00000000000i[ ] register state of 'parallel' plugin device by virtual method -00000000000i[SYS ] bx_pc_system_c::Reset(HARDWARE) called -00000000000i[CPU0 ] cpu hardware reset -00000000000i[APIC0] allocate APIC id=0 (MMIO enabled) to 0x00000000fee00000 -00000000000i[CPU0 ] CPU[0] is the bootstrap processor -00000000000i[CPU0 ] CPUID[0x00000000]: 00000003 68747541 444d4163 69746e65 -00000000000i[CPU0 ] CPUID[0x00000001]: 00000f23 00000800 00002020 07cbfbff -00000000000i[CPU0 ] CPUID[0x00000002]: 00000000 00000000 00000000 00000000 -00000000000i[CPU0 ] CPUID[0x00000003]: 00000000 00000000 00000000 00000000 -00000000000i[CPU0 ] CPUID[0x00000004]: 00000000 00000000 00000000 00000000 -00000000000i[CPU0 ] CPUID[0x00000007]: 00000000 00000000 00000000 00000000 -00000000000i[CPU0 ] CPUID[0x80000000]: 80000008 68747541 444d4163 69746e65 -00000000000i[CPU0 ] CPUID[0x80000001]: 00000f23 00000000 00000001 ebd3fbff -00000000000i[CPU0 ] CPUID[0x80000002]: 20444d41 6c687441 74286e6f 7020296d -00000000000i[CPU0 ] CPUID[0x80000003]: 65636f72 726f7373 00000000 00000000 -00000000000i[CPU0 ] CPUID[0x80000004]: 00000000 00000000 00000000 00000000 -00000000000i[CPU0 ] CPUID[0x80000005]: 01ff01ff 01ff01ff 40020140 40020140 -00000000000i[CPU0 ] CPUID[0x80000006]: 00000000 42004200 02008140 00000000 -00000000000i[CPU0 ] CPUID[0x80000007]: 00000000 00000000 00000000 00000000 -00000000000i[CPU0 ] CPUID[0x80000008]: 00003028 00000000 00000000 00000000 -00000000000i[ ] reset of 'unmapped' plugin device by virtual method -00000000000i[ ] reset of 'biosdev' plugin device by virtual method -00000000000i[ ] reset of 'speaker' plugin device by virtual method -00000000000i[ ] reset of 'extfpuirq' plugin device by virtual method -00000000000i[ ] reset of 'gameport' plugin device by virtual method -00000000000i[ ] reset of 'iodebug' plugin device by virtual method -00000000000i[ ] reset of 'pci_ide' plugin device by virtual method -00000000000i[ ] reset of 'acpi' plugin device by virtual method -00000000000i[ ] reset of 'ioapic' plugin device by virtual method -00000000000i[ ] reset of 'keyboard' plugin device by virtual method -00000000000i[ ] reset of 'harddrv' plugin device by virtual method -00000000000i[ ] reset of 'serial' plugin device by virtual method -00000000000i[ ] reset of 'parallel' plugin device by virtual method -00000000000i[XGUI ] [x] Mouse off -00000003305i[BIOS ] $Revision: 1.257 $ $Date: 2011/01/26 09:52:02 $ -00000318072i[KBD ] reset-disable command received -00000444792i[VBIOS] VGABios $Id: vgabios.c,v 1.69 2009/04/07 18:18:20 vruppert Exp $ -00000444863i[VGA ] VBE known Display Interface b0c0 -00000444895i[VGA ] VBE known Display Interface b0c5 -00000447820i[VBIOS] VBE Bios $Id: vbe.c,v 1.62 2009/01/25 15:46:25 vruppert Exp $ -00000600000i[XGUI ] charmap update. Font Height is 16 -00000760509i[BIOS ] Starting rombios32 -00000761006i[BIOS ] Shutdown flag 0 -00000761687i[BIOS ] ram_size=0x02000000 -00000762165i[BIOS ] ram_end=32MB -00000802749i[BIOS ] Found 1 cpu(s) -00000821736i[BIOS ] bios_table_addr: 0x000fb928 end=0x000fcc00 -00000821839i[PCI ] 440FX PMC write to PAM register 59 (TLB Flush) -00001149536i[PCI ] 440FX PMC write to PAM register 59 (TLB Flush) -00001477464i[P2I ] PCI IRQ routing: PIRQA# set to 0x0b -00001477485i[P2I ] PCI IRQ routing: PIRQB# set to 0x09 -00001477506i[P2I ] PCI IRQ routing: PIRQC# set to 0x0b -00001477527i[P2I ] PCI IRQ routing: PIRQD# set to 0x09 -00001477537i[P2I ] write: ELCR2 = 0x0a -00001478422i[BIOS ] PIIX3/PIIX4 init: elcr=00 0a -00001486380i[BIOS ] PCI: bus=0 devfn=0x00: vendor_id=0x8086 device_id=0x1237 class=0x0600 -00001488942i[BIOS ] PCI: bus=0 devfn=0x08: vendor_id=0x8086 device_id=0x7000 class=0x0601 -00001491343i[BIOS ] PCI: bus=0 devfn=0x09: vendor_id=0x8086 device_id=0x7010 class=0x0101 -00001491573i[PIDE ] new BM-DMA address: 0xc000 -00001492277i[BIOS ] region 4: 0x0000c000 -00001494587i[BIOS ] PCI: bus=0 devfn=0x0b: vendor_id=0x8086 device_id=0x7113 class=0x0680 -00001494825i[ACPI ] new irq line = 11 -00001494839i[ACPI ] new irq line = 9 -00001494869i[ACPI ] new PM base address: 0xb000 -00001494883i[ACPI ] new SM base address: 0xb100 -00001494911i[PCI ] setting SMRAM control register to 0x4a -00001659005i[CPU0 ] Enter to System Management Mode -00001659005i[CPU0 ] enter_system_management_mode: temporary disable VMX while in SMM mode -00001659015i[CPU0 ] RSM: Resuming from System Management Mode -00001823035i[PCI ] setting SMRAM control register to 0x0a -00001832206i[BIOS ] MP table addr=0x000fba00 MPC table addr=0x000fb930 size=0xd0 -00001834265i[BIOS ] SMBIOS table addr=0x000fba10 -00001836653i[BIOS ] ACPI tables: RSDP addr=0x000fbb30 ACPI DATA addr=0x01ff0000 size=0x988 -00001839891i[BIOS ] Firmware waking vector 0x1ff00cc -00001851004i[PCI ] 440FX PMC write to PAM register 59 (TLB Flush) -00001851848i[BIOS ] bios_table_cur_addr: 0x000fbb54 -00014041552i[BIOS ] Booting from 0000:7c00 -00023137422i[BIOS ] int13_harddisk: function 41, unmapped device for ELDL=80 -00023142203i[BIOS ] int13_harddisk: function 08, unmapped device for ELDL=80 -00023146854i[BIOS ] *** int 15h function AX=00c0, BX=0000 not yet supported! -00037427421i[CPU0 ] [37427421] Stopped on MAGIC BREAKPOINT -00037475097i[KBD ] setting typematic info -00037475122i[KBD ] setting delay to 500 mS (unused) -00037475122i[KBD ] setting repeat rate to 10.9 cps (unused) -00037475183i[KBD ] Switched to scancode set 2 -00037475271i[KBD ] keyboard: scan convert turned off -00037475895i[KBD ] keyboard: scan convert turned off -00037491918i[FDD ] controller reset in software -00039078683i[FDD ] io_write: config control register: 0x00 -00055400059i[CPU0 ] [55400059] Stopped on MAGIC BREAKPOINT -00165600000i[ ] dbg: Quit -00165600000i[CPU0 ] CPU is in protected mode (active) -00165600000i[CPU0 ] CS.d_b = 32 bit -00165600000i[CPU0 ] SS.d_b = 32 bit -00165600000i[CPU0 ] EFER = 0x00000000 -00165600000i[CPU0 ] | RAX=00000000000000ff RBX=000000000010d78c -00165600000i[CPU0 ] | RCX=00000000000003d4 RDX=000000000010d6ca -00165600000i[CPU0 ] | RSP=000000000010d68c RBP=000000000010d6a4 -00165600000i[CPU0 ] | RSI=000000000010d6ca RDI=0000000000000002 -00165600000i[CPU0 ] | R8=0000000000000000 R9=0000000000000000 -00165600000i[CPU0 ] | R10=0000000000000000 R11=0000000000000000 -00165600000i[CPU0 ] | R12=0000000000000000 R13=0000000000000000 -00165600000i[CPU0 ] | R14=0000000000000000 R15=0000000000000000 -00165600000i[CPU0 ] | IOPL=0 id vip vif ac vm rf nt of df IF tf sf ZF af PF cf -00165600000i[CPU0 ] | SEG selector base limit G D -00165600000i[CPU0 ] | SEG sltr(index|ti|rpl) base limit G D -00165600000i[CPU0 ] | CS:0008( 0001| 0| 0) 00000000 ffffffff 1 1 -00165600000i[CPU0 ] | DS:0010( 0002| 0| 0) 00000000 ffffffff 1 1 -00165600000i[CPU0 ] | SS:0010( 0002| 0| 0) 00000000 ffffffff 1 1 -00165600000i[CPU0 ] | ES:0010( 0002| 0| 0) 00000000 ffffffff 1 1 -00165600000i[CPU0 ] | FS:0010( 0002| 0| 0) 00000000 ffffffff 1 1 -00165600000i[CPU0 ] | GS:0010( 0002| 0| 0) 00000000 ffffffff 1 1 -00165600000i[CPU0 ] | MSR_FS_BASE:0000000000000000 -00165600000i[CPU0 ] | MSR_GS_BASE:0000000000000000 -00165600000i[CPU0 ] | RIP=0000000000105eb4 (0000000000105eb4) -00165600000i[CPU0 ] | CR0=0xe0000011 CR2=0x0000000000000000 -00165600000i[CPU0 ] | CR3=0x00110000 CR4=0x00000000 -00165600000i[CMOS ] Last time is 1314602560 (Mon Aug 29 10:22:40 2011) -00165600000i[XGUI ] Exit -00165600000i[CTRL ] quit_sim called with exit code 0 +00000000000i[ ] Bochs x86 Emulator 2.4.6 +00000000000i[ ] Build from CVS snapshot, on February 22, 2011 +00000000000i[ ] Compiled at Feb 22 2011, 19:57:47 +00000000000i[ ] System configuration +00000000000i[ ] processors: 1 (cores=1, HT threads=1) +00000000000i[ ] A20 line support: yes +00000000000i[ ] CPU configuration +00000000000i[ ] level: 6 +00000000000i[ ] SMP support: no +00000000000i[ ] APIC support: yes +00000000000i[ ] FPU support: yes +00000000000i[ ] MMX support: yes +00000000000i[ ] 3dnow! support: no +00000000000i[ ] SEP support: yes +00000000000i[ ] SSE support: sse2 +00000000000i[ ] XSAVE support: no +00000000000i[ ] AES support: no +00000000000i[ ] MOVBE support: no +00000000000i[ ] x86-64 support: yes +00000000000i[ ] 1G paging support: no +00000000000i[ ] VMX support: no +00000000000i[ ] Optimization configuration +00000000000i[ ] RepeatSpeedups support: yes +00000000000i[ ] Trace cache support: yes +00000000000i[ ] Fast function calls: yes +00000000000i[ ] Devices configuration +00000000000i[ ] ACPI support: yes +00000000000i[ ] NE2000 support: yes +00000000000i[ ] PCI support: yes, enabled=yes +00000000000i[ ] SB16 support: yes +00000000000i[ ] USB support: yes +00000000000i[ ] VGA extension support: vbe cirrus +00000000000i[MEM0 ] allocated memory at 028A0020. after alignment, vector=028A1000 +00000000000i[MEM0 ] 32.00MB +00000000000i[MEM0 ] mem block size = 0x00100000, blocks=32 +00000000000i[MEM0 ] rom at 0xfffe0000/131072 ('C:\Program Files\Bochs-2.4.6\BIOS-bochs-latest') +00000000000i[MEM0 ] rom at 0xc0000/40448 ('C:\Program Files\Bochs-2.4.6\VGABIOS-lgpl-latest') +00000000000i[CMOS ] Using local time for initial clock +00000000000i[CMOS ] Setting initial clock to: Thu Sep 08 15:41:40 2011 (time0=1315485700) +00000000000i[DMA ] channel 4 used by cascade +00000000000i[DMA ] channel 2 used by Floppy Drive +00000000000i[FDD ] fd0: 'a:' ro=0, h=2,t=80,spt=18 +00000000000i[PCI ] 440FX Host bridge present at device 0, function 0 +00000000000i[PCI ] PIIX3 PCI-to-ISA bridge present at device 1, function 0 +00000000000i[MEM0 ] Register memory access handlers: 0x00000000000a0000 - 0x00000000000bffff +00000000000i[WGUI ] Desktop Window dimensions: 1366 x 768 +00000000000i[WGUI ] Number of Mouse Buttons = 5 +00000000000i[WGUI ] IME disabled +00000000000i[MEM0 ] Register memory access handlers: 0x00000000e0000000 - 0x00000000e0ffffff +00000000000i[CLVGA] VBE Bochs Display Extension Enabled +00000000000i[CLVGA] interval=50000 +00000000000i[ ] init_dev of 'unmapped' plugin device by virtual method +00000000000i[ ] init_dev of 'biosdev' plugin device by virtual method +00000000000i[ ] init_dev of 'speaker' plugin device by virtual method +00000000000i[ ] init_dev of 'extfpuirq' plugin device by virtual method +00000000000i[ ] init_dev of 'gameport' plugin device by virtual method +00000000000i[ ] init_dev of 'pci_ide' plugin device by virtual method +00000000000i[PCI ] PIIX3 PCI IDE controller present at device 1, function 1 +00000000000i[ ] init_dev of 'acpi' plugin device by virtual method +00000000000i[PCI ] ACPI Controller present at device 1, function 3 +00000000000i[ ] init_dev of 'ioapic' plugin device by virtual method +00000000000i[IOAP ] initializing I/O APIC +00000000000i[MEM0 ] Register memory access handlers: 0x00000000fec00000 - 0x00000000fec00fff +00000000000i[ ] init_dev of 'keyboard' plugin device by virtual method +00000000000i[KBD ] will paste characters every 1000 keyboard ticks +00000000000i[ ] init_dev of 'harddrv' plugin device by virtual method +00000000000i[HD ] Using boot sequence floppy, none, none +00000000000i[HD ] Floppy boot signature check is enabled +00000000000i[ ] init_dev of 'serial' plugin device by virtual method +00000000000i[SER ] com1 at 0x03f8 irq 4 +00000000000i[ ] init_dev of 'parallel' plugin device by virtual method +00000000000i[PAR ] parallel port 1 at 0x0378 irq 7 +00000000000i[ ] register state of 'unmapped' plugin device by virtual method +00000000000i[ ] register state of 'biosdev' plugin device by virtual method +00000000000i[ ] register state of 'speaker' plugin device by virtual method +00000000000i[ ] register state of 'extfpuirq' plugin device by virtual method +00000000000i[ ] register state of 'gameport' plugin device by virtual method +00000000000i[ ] register state of 'pci_ide' plugin device by virtual method +00000000000i[ ] register state of 'acpi' plugin device by virtual method +00000000000i[ ] register state of 'ioapic' plugin device by virtual method +00000000000i[ ] register state of 'keyboard' plugin device by virtual method +00000000000i[ ] register state of 'harddrv' plugin device by virtual method +00000000000i[ ] register state of 'serial' plugin device by virtual method +00000000000i[ ] register state of 'parallel' plugin device by virtual method +00000000000i[SYS ] bx_pc_system_c::Reset(HARDWARE) called +00000000000i[CPU0 ] cpu hardware reset +00000000000i[APIC0] allocate APIC id=0 (MMIO enabled) to 0x00000000fee00000 +00000000000i[CPU0 ] CPUID[0x00000000]: 00000003 756e6547 6c65746e 49656e69 +00000000000i[CPU0 ] CPUID[0x00000001]: 00000f23 00000800 00002000 07cbfbff +00000000000i[CPU0 ] CPUID[0x00000002]: 00410601 00000000 00000000 00000000 +00000000000i[CPU0 ] CPUID[0x00000003]: 00000000 00000000 00000000 00000000 +00000000000i[CPU0 ] CPUID[0x00000004]: 00000000 00000000 00000000 00000000 +00000000000i[CPU0 ] CPUID[0x00000007]: 00000000 00000000 00000000 00000000 +00000000000i[CPU0 ] CPUID[0x80000000]: 80000008 00000000 00000000 00000000 +00000000000i[CPU0 ] CPUID[0x80000001]: 00000000 00000000 00000001 2a100800 +00000000000i[CPU0 ] CPUID[0x80000002]: 20202020 20202020 20202020 6e492020 +00000000000i[CPU0 ] CPUID[0x80000003]: 286c6574 50202952 69746e65 52286d75 +00000000000i[CPU0 ] CPUID[0x80000004]: 20342029 20555043 20202020 00202020 +00000000000i[CPU0 ] CPUID[0x80000006]: 00000000 42004200 02008140 00000000 +00000000000i[CPU0 ] CPUID[0x80000007]: 00000000 00000000 00000000 00000000 +00000000000i[CPU0 ] CPUID[0x80000008]: 00003028 00000000 00000000 00000000 +00000000000i[ ] reset of 'unmapped' plugin device by virtual method +00000000000i[ ] reset of 'biosdev' plugin device by virtual method +00000000000i[ ] reset of 'speaker' plugin device by virtual method +00000000000i[ ] reset of 'extfpuirq' plugin device by virtual method +00000000000i[ ] reset of 'gameport' plugin device by virtual method +00000000000i[ ] reset of 'pci_ide' plugin device by virtual method +00000000000i[ ] reset of 'acpi' plugin device by virtual method +00000000000i[ ] reset of 'ioapic' plugin device by virtual method +00000000000i[ ] reset of 'keyboard' plugin device by virtual method +00000000000i[ ] reset of 'harddrv' plugin device by virtual method +00000000000i[ ] reset of 'serial' plugin device by virtual method +00000000000i[ ] reset of 'parallel' plugin device by virtual method +00000003305i[BIOS ] $Revision: 1.257 $ $Date: 2011/01/26 09:52:02 $ +00000200000i[WGUI ] dimension update x=720 y=400 fontheight=16 fontwidth=9 bpp=8 +00000318042i[KBD ] reset-disable command received +00000444800i[VBIOS] VGABios $Id: vgabios.c,v 1.69 2009/04/07 18:18:20 vruppert Exp $ +00000444871i[CLVGA] VBE known Display Interface b0c0 +00000444903i[CLVGA] VBE known Display Interface b0c5 +00000447828i[VBIOS] VBE Bios $Id: vbe.c,v 1.62 2009/01/25 15:46:25 vruppert Exp $ +00000760517i[BIOS ] Starting rombios32 +00000761014i[BIOS ] Shutdown flag 0 +00000761695i[BIOS ] ram_size=0x02000000 +00000762173i[BIOS ] ram_end=32MB +00000802745i[BIOS ] Found 1 cpu(s) +00000821732i[BIOS ] bios_table_addr: 0x000fb928 end=0x000fcc00 +00000821835i[PCI ] 440FX PMC write to PAM register 59 (TLB Flush) +00001149532i[PCI ] 440FX PMC write to PAM register 59 (TLB Flush) +00001477460i[P2I ] PCI IRQ routing: PIRQA# set to 0x0b +00001477481i[P2I ] PCI IRQ routing: PIRQB# set to 0x09 +00001477502i[P2I ] PCI IRQ routing: PIRQC# set to 0x0b +00001477523i[P2I ] PCI IRQ routing: PIRQD# set to 0x09 +00001477533i[P2I ] write: ELCR2 = 0x0a +00001478418i[BIOS ] PIIX3/PIIX4 init: elcr=00 0a +00001486376i[BIOS ] PCI: bus=0 devfn=0x00: vendor_id=0x8086 device_id=0x1237 class=0x0600 +00001488938i[BIOS ] PCI: bus=0 devfn=0x08: vendor_id=0x8086 device_id=0x7000 class=0x0601 +00001491339i[BIOS ] PCI: bus=0 devfn=0x09: vendor_id=0x8086 device_id=0x7010 class=0x0101 +00001491569i[PIDE ] new BM-DMA address: 0xc000 +00001492273i[BIOS ] region 4: 0x0000c000 +00001494583i[BIOS ] PCI: bus=0 devfn=0x0b: vendor_id=0x8086 device_id=0x7113 class=0x0680 +00001494821i[ACPI ] new irq line = 11 +00001494835i[ACPI ] new irq line = 9 +00001494865i[ACPI ] new PM base address: 0xb000 +00001494879i[ACPI ] new SM base address: 0xb100 +00001494907i[PCI ] setting SMRAM control register to 0x4a +00001659001i[CPU0 ] Enter to System Management Mode +00001659011i[CPU0 ] RSM: Resuming from System Management Mode +00001823031i[PCI ] setting SMRAM control register to 0x0a +00001832202i[BIOS ] MP table addr=0x000fba00 MPC table addr=0x000fb930 size=0xd0 +00001834261i[BIOS ] SMBIOS table addr=0x000fba10 +00001836649i[BIOS ] ACPI tables: RSDP addr=0x000fbb30 ACPI DATA addr=0x01ff0000 size=0x988 +00001839887i[BIOS ] Firmware waking vector 0x1ff00cc +00001851000i[PCI ] 440FX PMC write to PAM register 59 (TLB Flush) +00001851844i[BIOS ] bios_table_cur_addr: 0x000fbb54 +00014041548i[BIOS ] Booting from 0000:7c00 +00023137418i[BIOS ] int13_harddisk: function 41, unmapped device for ELDL=80 +00023142199i[BIOS ] int13_harddisk: function 08, unmapped device for ELDL=80 +00023146850i[BIOS ] *** int 15h function AX=00c0, BX=0000 not yet supported! +00043965427i[KBD ] setting typematic info +00043965445i[KBD ] setting delay to 500 mS (unused) +00043965445i[KBD ] setting repeat rate to 10.9 cps (unused) +00043965488i[KBD ] Switched to scancode set 2 +00043965551i[KBD ] keyboard: scan convert turned off +01748376000p[WGUI ] >>PANIC<< POWER button turned off. +01748376000i[CPU0 ] CPU is in protected mode (active) +01748376000i[CPU0 ] CS.d_b = 32 bit +01748376000i[CPU0 ] SS.d_b = 32 bit +01748376000i[CPU0 ] EFER = 0x00000000 +01748376000i[CPU0 ] | RAX=00000000001108ff RBX=0000000000000066 +01748376000i[CPU0 ] | RCX=00000000000003d4 RDX=0000000000000308 +01748376000i[CPU0 ] | RSP=00000000001107c8 RBP=0000000000000018 +01748376000i[CPU0 ] | RSI=0000000000110806 RDI=0000000000000002 +01748376000i[CPU0 ] | R8=0000000000000000 R9=0000000000000000 +01748376000i[CPU0 ] | R10=0000000000000000 R11=0000000000000000 +01748376000i[CPU0 ] | R12=0000000000000000 R13=0000000000000000 +01748376000i[CPU0 ] | R14=0000000000000000 R15=0000000000000000 +01748376000i[CPU0 ] | IOPL=0 id vip vif ac vm rf nt of df IF tf sf ZF af PF cf +01748376000i[CPU0 ] | SEG selector base limit G D +01748376000i[CPU0 ] | SEG sltr(index|ti|rpl) base limit G D +01748376000i[CPU0 ] | CS:0008( 0001| 0| 0) 00000000 ffffffff 1 1 +01748376000i[CPU0 ] | DS:0010( 0002| 0| 0) 00000000 ffffffff 1 1 +01748376000i[CPU0 ] | SS:0010( 0002| 0| 0) 00000000 ffffffff 1 1 +01748376000i[CPU0 ] | ES:0010( 0002| 0| 0) 00000000 ffffffff 1 1 +01748376000i[CPU0 ] | FS:0010( 0002| 0| 0) 00000000 ffffffff 1 1 +01748376000i[CPU0 ] | GS:0010( 0002| 0| 0) 00000000 ffffffff 1 1 +01748376000i[CPU0 ] | MSR_FS_BASE:0000000000000000 +01748376000i[CPU0 ] | MSR_GS_BASE:0000000000000000 +01748376000i[CPU0 ] | RIP=0000000000108a0a (0000000000108a0a) +01748376000i[CPU0 ] | CR0=0xe0000011 CR2=0x0000000000000000 +01748376000i[CPU0 ] | CR3=0x0011a000 CR4=0x00000000 +01748376000i[CPU0 ] 0x0000000000108a0a>> mov al, byte ptr ds:0x10c9dd : A0DDC91000 +01748376000i[CMOS ] Last time is 1315486137 (Thu Sep 08 15:48:57 2011) +01748376000i[ ] restoring default signal behavior +01748376000i[CTRL ] quit_sim called with exit code 1 diff --git a/build/console.o b/build/console.o index 68a618d..c3c8fec 100644 Binary files a/build/console.o and b/build/console.o differ diff --git a/build/drivers.o b/build/drivers.o index acdaeca..90974ec 100644 Binary files a/build/drivers.o and b/build/drivers.o differ diff --git a/build/hal.o b/build/hal.o index 024b8e1..b86d4f9 100644 Binary files a/build/hal.o and b/build/hal.o differ diff --git a/build/initrd.o b/build/initrd.o index 7a3cfdd..d613fee 100644 Binary files a/build/initrd.o and b/build/initrd.o differ diff --git a/build/mem-heap.o b/build/mem-heap.o index 412ae35..7766cd0 100644 Binary files a/build/mem-heap.o and b/build/mem-heap.o differ diff --git a/build/mem-paging.o b/build/mem-paging.o index 042d5e9..470c39a 100644 Binary files a/build/mem-paging.o and b/build/mem-paging.o differ diff --git a/build/mem-phys.o b/build/mem-phys.o index 3d7efca..2d1f7d7 100644 Binary files a/build/mem-phys.o and b/build/mem-phys.o differ diff --git a/build/memory_alloc.o b/build/memory_alloc.o index e031b45..6818588 100644 Binary files a/build/memory_alloc.o and b/build/memory_alloc.o differ diff --git a/build/memory_info.o b/build/memory_info.o index 844fad9..e502079 100644 Binary files a/build/memory_info.o and b/build/memory_info.o differ diff --git a/build/memory_init.o b/build/memory_init.o index cd123a8..d0fd266 100644 Binary files a/build/memory_init.o and b/build/memory_init.o differ diff --git a/build/vfs.o b/build/vfs.o index 1d3f66d..48d4b4a 100644 Binary files a/build/vfs.o and b/build/vfs.o differ diff --git a/change.log b/change.log index 38afb4a..2478d61 100644 --- a/change.log +++ b/change.log @@ -1,3 +1,16 @@ +[????] BUILD 0.1.1.??? DATE 9/0?/2011 AT ?:?? ?? +==================================================== +Mainly changed: Tasking ++ Implemented multitasking + +[GOOD] BUILD 0.1.0.601 DATE 9/06/2011 AT 5:20 PM +==================================================== +Mainly changed: bugfixes ++ Added feature: shell automatic completion ++ Fixed 'pink text' bug ++ Fixed 'dir' bug where it tries to read files as directories +? TODO: Fix Vfs bug which allows files to be read as directories + [GOOD] BUILD 0.1.0.590 DATE 9/05/2011 AT 2:40 PM ==================================================== Mainly changed: FS.Initrd diff --git a/kernel.bin b/kernel.bin index 6d57874..2186404 100644 Binary files a/kernel.bin and b/kernel.bin differ diff --git a/link.ld b/link.ld index d0b1666..820ec3b 100644 --- a/link.ld +++ b/link.ld @@ -10,15 +10,6 @@ SECTIONS { *(.__mbHeader) } - - .setup : - { - *(.setup) - } - - /* . += 0xC0000000; */ - - .text : /* AT(ADDR(.text) - 0xC0000000) */ { diff --git a/luxos.img b/luxos.img index 52e5ded..4363054 100644 Binary files a/luxos.img and b/luxos.img differ diff --git a/scripts/version.txt b/scripts/version.txt index 75a2e0d..f075110 100644 --- a/scripts/version.txt +++ b/scripts/version.txt @@ -1 +1 @@ -601 +629