[????] BUILD 0.1.1.??? DATE 9/0?/2011 AT ?:?? ??

====================================================
Mainly changed: Tasking
+ Implemented multitasking
This commit is contained in:
Tiberiu Chibici 2021-09-14 18:54:59 +03:00
parent 04449cb787
commit e3b3584734
36 changed files with 427 additions and 400 deletions

View File

@ -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

View File

@ -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

Binary file not shown.

View File

@ -173,7 +173,7 @@ void _CommandMemPrintMemmap()
blocks = n - old; blocks = n - old;
used = 0; used = 0;
for (; old < n; old++) for (; old < n; old++)
used += (MemPhGetFrame(old) != 0); used += (MemPhGetBlock (old) != 0);
if (used <= blocks / 5) c = ' '; if (used <= blocks / 5) c = ' ';
else if (used > 4 * blocks / 5) c = 219; else if (used > 4 * blocks / 5) c = 219;

View File

@ -55,7 +55,7 @@ Point ConsoleGetCursor()
return ConsoleCursor; return ConsoleCursor;
} }
extern void ConsoleSetCursor(Point p) void ConsoleSetCursor(Point p)
{ {
ConsoleCursor = p; ConsoleCursor = p;
} }

View File

@ -29,6 +29,7 @@ void DriversInstall()
DriversInstall_Clock(); DriversInstall_Clock();
// Install fdc // Install fdc
IrqInstallHandler(6, FloppyIrqHandler); Error ("Floppy", "Floppy driver is currently disabled.\n");
FloppyInitialize(); //IrqInstallHandler(6, FloppyIrqHandler);
//FloppyInitialize();
} }

View File

@ -180,13 +180,16 @@ void luxInitrdInstall (MultibootInfo* info)
VfsInstallFs(&fs); VfsInstallFs(&fs);
// Check for multiboot info flags to see if any modules are loaded // 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 // Loop through each module and if it is an initrd image, mount it
MultibootModule* modules = (MultibootModule*) info->ModulesAddress; MultibootModule* modules = (MultibootModule*) info->ModulesAddress;
for (i = 0; i < info->ModulesCount; i++) for (i = 0; i < info->ModulesCount; i++)
if ((*(uint32*) modules[i].ModuleStart) == LUXMAGIC) if (*((uint32*) modules[i].ModuleStart) == LUXMAGIC)
{ {
// Mount the device // Mount the device
Log("Initrd", "Found initrd image at 0x%x.\n", modules[i].ModuleStart); 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[0] = modules[i].ModuleStart;
mp->FsData[1] = modules[i].ModuleEnd; mp->FsData[1] = modules[i].ModuleEnd;
} }
else {
Log("Initrd", "Found module @ 0x%x, but not initrd image.\n", modules[i].ModuleStart);
}
} }

View File

@ -34,7 +34,7 @@ void HalInitialize()
KeyboardInstallB(); Log("HAL", "%#[2/2]\n", ColorLightGreen); KeyboardInstallB(); Log("HAL", "%#[2/2]\n", ColorLightGreen);
// Install mouse driver // Install mouse driver
MouseInstall(); Log("HAL", "Installed mouse driver\n"); //MouseInstall(); Log("HAL", "Installed mouse driver\n");
// Install VFS // Install VFS
VfsInstall(); VfsInstall();

View File

@ -228,6 +228,10 @@ DirectoryEntry* VfsReadDirectory (FILE* handle, uint32 index)
if (!handle) return NULL; if (!handle) return NULL;
MountPoint* mp = &(mpArray[handle->DeviceId]); 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; if (!fsArray[mp->FsId].ReadDirectory) return NULL;
return fsArray[mp->FsId].ReadDirectory(mp, handle, index); return fsArray[mp->FsId].ReadDirectory(mp, handle, index);
} }

View File

@ -33,8 +33,6 @@ enum PageFlags
PageFrame = 0xFFFFF000 PageFrame = 0xFFFFF000
}; };
typedef struct { typedef struct {
Page Pages[1024]; Page Pages[1024];
} PageTable; } PageTable;
@ -48,25 +46,28 @@ typedef struct {
extern PageDirectory* CurrentDirectory; extern PageDirectory* CurrentDirectory;
extern PageDirectory* KernelDirectory; extern PageDirectory* KernelDirectory;
extern void PagingInitialize(uint32 SystemMemory); extern void PagingEnable ();
extern void PagingSwitchPageDirectory (PageDirectory* dir); extern void PagingDisable ();
extern Page* PagingGetPage(uint32 addr, uint8 make, PageDirectory* dir); 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 * * Physical memory manager *
***************************************************/ ***************************************************/
extern uint32 TotalFrames; extern uint32 TotalBlocks;
extern uint32 TotalMemory; extern uint32 TotalMemory;
extern uint32 UsedFrames; extern uint32 UsedBlocks;
void MemPhInitialize(uint32 SystemMemoryKb); extern void MemPhInitialize (uint32 SystemMemoryKb);
extern void MemPhSetFrame (uint32 frame, uint8 value); extern void MemPhSetBlock (uint32 Block, uint8 value);
uint32 MemPhGetFrame (uint32 frame); extern uint32 MemPhGetBlock (uint32 Block);
uint32 MemPhFindFreeFrame(); extern uint32 MemPhAllocateBlock ();
void MemPhAllocFrame(Page* page, uint8 isKernel, uint8 isWriteable); extern void MemPhFreeBlock (uint32 addr);
void MemPhFreeFrame(Page* page); extern void MemPhReserveBlocks (uint32 address, uint32 length);
void MemPhReserveFrames (uint32 address, uint32 length);
/*************************************************** /***************************************************
@ -84,9 +85,9 @@ extern MemHeap* KernelHeap;
extern uint32 MemHeapFindSmallestHole (uint32 size, uint8 page_align, MemHeap* heap); extern uint32 MemHeapFindSmallestHole (uint32 size, uint8 page_align, MemHeap* heap);
extern int32 MemHeapCompare (uint32 a, uint32 b); extern int32 MemHeapCompare (uint32 a, uint32 b);
extern MemHeap* MemHeapCreate(uint32 start, uint32 end, uint32 max, uint8 flags); extern MemHeap* MemHeapCreate (uint32 start, uint32 end, uint32 max, uint8 flags);
extern void MemHeapExpand(uint32 newsz, MemHeap* heap, PageDirectory* pd); extern uint32 MemHeapExpand (uint32 newsz, MemHeap* heap, PageDirectory* pd);
extern uint32 MemHeapContract(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 uint32 MemHeapAlloc (uint32 size, uint8 isPageAligned, MemHeap* heap, PageDirectory* pd);
extern void MemHeapFree (uint32 address, MemHeap* heap, PageDirectory* pd); extern void MemHeapFree (uint32 address, MemHeap* heap, PageDirectory* pd);

View File

@ -1 +1 @@
#define OS_BUILD "0.1.0.601" #define OS_BUILD "0.1.0.629"

View File

@ -28,8 +28,7 @@ uint32 _malloc_init2 (uint32 size, uint8 page_aligned, uint32* phys)
if (phys) if (phys)
{ {
Page *pg = PagingGetPage(ret, 0, KernelDirectory); *phys = PagingGetPhysical(ret, KernelDirectory) + (ret & 0xFFF);
*phys = (*pg & PageFrame) + (ret & 0xFFF);
Log("Mem","%#Allocated %u bytes (%spage aligned) at address 0x%x (phys=%x).\n", ColorLightMagenta, size, ((page_aligned) ? "" : "not "), ret, *phys); Log("Mem","%#Allocated %u bytes (%spage aligned) at address 0x%x (phys=%x).\n", ColorLightMagenta, size, ((page_aligned) ? "" : "not "), ret, *phys);
} }

View File

@ -6,7 +6,6 @@
*/ */
#include <memory-add.h> #include <memory-add.h>
// MemoryGetFree(), MemoryGetTotal(), MemoryGet blah blah...
// Returns total physical memory in bytes // Returns total physical memory in bytes
uint32 MemoryGetTotal() uint32 MemoryGetTotal()
@ -17,13 +16,13 @@ uint32 MemoryGetTotal()
// Returns total free physical memory in bytes // Returns total free physical memory in bytes
uint32 MemoryGetFree() uint32 MemoryGetFree()
{ {
return (TotalFrames - UsedFrames) * 0x4; return (TotalBlocks - UsedBlocks) * 0x4;
} }
// Total used physical memory in bytes // Total used physical memory in bytes
uint32 MemoryGetUsed() uint32 MemoryGetUsed()
{ {
return UsedFrames * 0x4; return UsedBlocks * 0x4;
} }
// Same as above functions, but in frames // Same as above functions, but in frames
@ -34,15 +33,15 @@ uint32 MemoryGetFrameSize()
uint32 MemoryGetFramesTotal() uint32 MemoryGetFramesTotal()
{ {
return TotalFrames; return TotalBlocks;
} }
uint32 MemoryGetFramesUsed() uint32 MemoryGetFramesUsed()
{ {
return UsedFrames; return UsedBlocks;
} }
uint32 MemoryGetFramesFree() uint32 MemoryGetFramesFree()
{ {
return (TotalFrames - UsedFrames); return (TotalBlocks - UsedBlocks);
} }

View File

@ -10,7 +10,6 @@
#include "../../drivers/cmos/cmos.h" #include "../../drivers/cmos/cmos.h"
#include <stdio.h> #include <stdio.h>
uint32 mem_kernel_end = 0; uint32 mem_kernel_end = 0;
uint8 mem_initialized = 0; uint8 mem_initialized = 0;
@ -42,7 +41,7 @@ void _memory_reserve_system(MultibootInfo* info)
while ((uint32)location < (info->MemoryMapAddress + info->MemoryMapLength)) while ((uint32)location < (info->MemoryMapAddress + info->MemoryMapLength))
{ {
if (location->Type > 1) 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)); 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); Error("Mem", "%#Missing %#memory map%# info from bootloader.\n", ColorLightRed, ColorWhite, ColorLightRed);
// Standard memory hole at 15mb // 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) void MemoryInitialize (MultibootInfo* info)
{ {
// Get total system memory
uint32 totalSystemMemory = _memory_get_total_mem(info); uint32 totalSystemMemory = _memory_get_total_mem(info);
// Initialize physical & virtual memory managers
uint32 end = mem_kernel_end + 0x80000;
MemPhInitialize(totalSystemMemory); MemPhInitialize(totalSystemMemory);
PagingInitialize(0x200000); PagingInitialize(&end);
// Reserve physical blocks
_memory_reserve_system(info); _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 KernelHeap = MemHeapCreate(KERNEL_HEAP_START, KERNEL_HEAP_START
+ KERNEL_HEAP_INITIAL_SIZE, 0xCFFFF000, 3); // is kernel, writeable + KERNEL_HEAP_INITIAL_SIZE, 0xCFFFF000, 3); // is kernel, writeable
Log("Mem", "Done initializing memory!"); Log("Mem", "Done initializing memory!\n");
mem_initialized = 2; mem_initialized = 2;
} }
@ -84,5 +89,5 @@ void MemoryTempInitialize (uint32 kernel_end)
{ {
mem_initialized = 1; mem_initialized = 1;
mem_kernel_end = kernel_end; 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);
} }

View File

@ -26,29 +26,22 @@ start:
mov ecx, eax mov ecx, eax
; lgdt [trickgdt] ; setup initial stack
; 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
mov esp, stack+STACKSIZE mov esp, stack+STACKSIZE
; Verify booted with multiboot compliant bootloader
cmp ecx, 0x2BADB002 cmp ecx, 0x2BADB002
jne .bad jne .bad
push esp
push ebx push ebx
extern k_main extern k_main
call k_main call k_main
cli
hlt
; Show error message, and halt system ; Show error message, and halt system
.bad: .bad:
@ -72,27 +65,8 @@ HigherHalf:
ErrorString db 0xA, "%#! Fatal error: Not booted with multiboot compliant bootloader (e.g. GRUB).", 0x0 ErrorString db 0xA, "%#! Fatal error: Not booted with multiboot compliant bootloader (e.g. GRUB).", 0x0
ErrorColor db 0x0C 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 ; stack
section .bss section .bss
align 32 align 32
stack: stack:
resb STACKSIZE ; This reserves 64KBytes of memory here resb STACKSIZE ; This reserves memory for stack

View File

@ -6,9 +6,6 @@
#define MEMHEAP_INDEX_SIZE 0x20000 #define MEMHEAP_INDEX_SIZE 0x20000
#define MEMHEAP_MINIM_SIZE 0x70000 #define MEMHEAP_MINIM_SIZE 0x70000
#define FlagsKernel 1
#define FlagsWriteable 2
typedef struct typedef struct
{ {
uint32 Magic; 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 & 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; uint32 i;
for (i = heap->EndAddress - heap->StartAddress; i < heap->StartAddress + newsz; i+=0x1000) for (i = heap->EndAddress; i < heap->StartAddress + newsz; i+=0x1000)
MemPhAllocFrame(PagingGetPage(i, 1, pd), heap->Flags & FlagsKernel, heap->Flags & FlagsWriteable); PagingMapPage(MemPhAllocateBlock(), i, heap->Flags, pd);
heap->EndAddress = heap->StartAddress + newsz; heap->EndAddress = heap->StartAddress + newsz;
return newsz;
} }
uint32 MemHeapContract(uint32 newsz, MemHeap* heap, PageDirectory* pd) 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 if (newsz & 0xfff) newsz = (newsz & 0xfffff000) + 0x1000; // page align
newsz = Max(newsz, MEMHEAP_MINIM_SIZE); newsz = Max(newsz, MEMHEAP_MINIM_SIZE);
uint32 i; uint32 i;
for (i = heap->EndAddress - heap->StartAddress - 0x1000; i > newsz; i-=0x1000) for (i = heap->EndAddress - 0x1000; i > heap->StartAddress + newsz; i-=0x1000)
MemPhFreeFrame(PagingGetPage(i, 0, pd)); PagingUnmapPage(i, pd);
heap->EndAddress = heap->StartAddress + newsz; heap->EndAddress = heap->StartAddress + newsz;
return newsz; return newsz;

View File

@ -6,69 +6,123 @@
*/ */
#include <memory-add.h> #include <memory-add.h>
#include <stdio.h> #include <stdio.h>
/******************************* /*******************************
* Data * * Data *
*******************************/ *******************************/
PageDirectory* CurrentDirectory; PageDirectory* CurrentDirectory;
PageDirectory* KernelDirectory; PageDirectory* KernelDirectory;
/******************************* void PagingEnable()
* Useful routines *
*******************************/
void PagingInitialize(uint32 kernel_used)
{ {
Log("Mem", "Virtual memory manager initialization started. End of kernel = 0x%x\n", kernel_used); uint32 tmp;
PageDirectory* kernelPd = (PageDirectory*) kmalloc_a(sizeof(PageDirectory)); asm volatile ("mov %%cr0, %0" : "=r"(tmp));
memset(kernelPd, 0, sizeof(PageDirectory)); tmp |= 0x80000000;
asm volatile ("mov %0, %%cr0" : : "r"(tmp));
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);
} }
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; CurrentDirectory = dir;
asm volatile ("mov %0, %%cr3":: "r"(&dir->TablesPhysical)); asm volatile ("mov %0, %%cr3" : : "r"(dir->PhysicalAddr));
uint32 cr0;
asm volatile ("mov %%cr0, %0": "=r"(cr0));
cr0 |= 0x80000000;
asm volatile ("mov %0, %%cr0":: "r"(cr0));
Log("Mem", "Enabled paging.\n");
} }
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]) KernelDirectory = kdir;
return &dir->Tables[tableIndex]->Pages[addr&0x3ff];
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; PagingMapPage(i, i, PageWriteable, kdir);
dir->Tables[tableIndex] = (PageTable*)kmalloc_ap(sizeof(PageTable), &temp); i += 0x1000;
memset (dir->Tables[tableIndex], 0, 0x1000);
dir->TablesPhysical[tableIndex] = temp | 0x7;
return &dir->Tables[tableIndex]->Pages[addr&0x3ff];
} }
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);
}

View File

@ -6,103 +6,89 @@
*/ */
#include <memory-add.h> #include <memory-add.h>
uint32* FrameMap; uint32* BlockMap;
uint32 TotalFrames; uint32 TotalBlocks;
uint32 TotalMemory; 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); *address = (index >> 5);
*offset = index & 0x1f; *offset = index & 0x1f;
} }
inline uint32 ConvertFrameToIndex (uint32 address, uint32 offset) inline uint32 ConvertBlockToIndex (uint32 address, uint32 offset)
{ {
return (address<<5) | offset; return (address<<5) | offset;
} }
void MemPhSetFrame (uint32 frame, uint8 value) void MemPhSetBlock (uint32 Block, uint8 value)
{ {
uint32 addr, off; uint32 addr, off;
ConvertIndexToFrame(frame, &addr, &off); ConvertIndexToBlock(Block, &addr, &off);
if (value) { if (value) {
if ((FrameMap[addr] & (1<<off)) == 0) UsedFrames++; if ((BlockMap[addr] & (1<<off)) == 0) UsedBlocks++;
FrameMap[addr] |= 1<<off; BlockMap[addr] |= 1<<off;
} }
else { else {
if (FrameMap[addr] & (1<<off)) UsedFrames--; if (BlockMap[addr] & (1<<off)) UsedBlocks--;
FrameMap[addr] &= ~(1<<off); BlockMap[addr] &= ~(1<<off);
} }
} }
uint32 MemPhGetFrame (uint32 frame) uint32 MemPhGetBlock (uint32 Block)
{ {
uint32 addr, off; uint32 addr, off;
ConvertIndexToFrame(frame, &addr, &off); ConvertIndexToBlock(Block, &addr, &off);
return FrameMap[addr] & (1<<off); return BlockMap[addr] & (1<<off);
} }
uint32 MemPhFindFreeFrame() uint32 MemPhAllocateBlock()
{ {
uint32 addr, pos; uint32 addr, pos;
for (addr = 0; addr < TotalFrames >> 5; addr++) for (addr = 0; addr < TotalBlocks >> 5; addr++)
if (FrameMap[addr] != 0xffffffff) if (BlockMap[addr] != 0xffffffff)
{ {
for (pos = 0; (FrameMap[addr] & (1<<pos)) != 0; pos++) ; for (pos = 0; (BlockMap[addr] & (1<<pos)) != 0; pos++) ;
return ConvertFrameToIndex(addr, pos); uint32 index = ConvertBlockToIndex(addr, pos);
MemPhSetBlock(index, 1);
// Return address
return (index<<12);
} }
return 0xffffffff; return 0xffffffff;
} }
void MemPhAllocFrame(Page* page, uint8 isKernel, uint8 isWriteable) void MemPhFreeBlock(uint32 addr)
{ {
if ((*page & PageFrame) != 0) return; uint32 Block = addr >> 12;
if (!Block) return;
uint32 free = MemPhFindFreeFrame(); MemPhSetBlock(Block, 0);
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;
} }
void MemPhInitialize(uint32 SystemMemoryKb) void MemPhInitialize(uint32 SystemMemoryKb)
{ {
TotalFrames = SystemMemoryKb >> 2; TotalBlocks = SystemMemoryKb >> 2;
TotalMemory = SystemMemoryKb; TotalMemory = SystemMemoryKb;
FrameMap = (uint32*) kmalloc(sizeof(uint32) * (1 + (TotalFrames>>5))); BlockMap = (uint32*) kmalloc(sizeof(uint32) * (1 + (TotalBlocks>>5)));
memset(FrameMap, 0, sizeof(uint32) * (1 + (TotalFrames>>5))); memset(BlockMap, 0, sizeof(uint32) * (1 + (TotalBlocks>>5)));
Log("Mem", "%#Started physical memory manager ok!, found %ukb\n", ColorLightGreen, SystemMemoryKb); 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; address >>= 12;
length = (length>>12) + ((length & 0xfff) > 0); length = (length>>12) + ((length & 0xfff) > 0);
uint32 end = address + length; uint32 end = address + length;
for (; address < end ; address++) for (; address < end ; address++)
MemPhSetFrame(address, 1); MemPhSetBlock(address, 1);
} }

View File

@ -1,16 +1,16 @@
00000000000i[ ] Bochs x86 Emulator 2.4.6 00000000000i[ ] Bochs x86 Emulator 2.4.6
00000000000i[ ] Build from CVS snapshot, on February 22, 2011 00000000000i[ ] Build from CVS snapshot, on February 22, 2011
00000000000i[ ] Compiled at Aug 28 2011, 16:32:50 00000000000i[ ] Compiled at Feb 22 2011, 19:57:47
00000000000i[ ] System configuration 00000000000i[ ] System configuration
00000000000i[ ] processors: 1 (cores=1, HT threads=1) 00000000000i[ ] processors: 1 (cores=1, HT threads=1)
00000000000i[ ] A20 line support: yes 00000000000i[ ] A20 line support: yes
00000000000i[ ] CPU configuration 00000000000i[ ] CPU configuration
00000000000i[ ] level: 6 00000000000i[ ] level: 6
00000000000i[ ] SMP support: yes, quantum=5 00000000000i[ ] SMP support: no
00000000000i[ ] APIC support: yes 00000000000i[ ] APIC support: yes
00000000000i[ ] FPU support: yes 00000000000i[ ] FPU support: yes
00000000000i[ ] MMX support: yes 00000000000i[ ] MMX support: yes
00000000000i[ ] 3dnow! support: yes 00000000000i[ ] 3dnow! support: no
00000000000i[ ] SEP support: yes 00000000000i[ ] SEP support: yes
00000000000i[ ] SSE support: sse2 00000000000i[ ] SSE support: sse2
00000000000i[ ] XSAVE support: no 00000000000i[ ] XSAVE support: no
@ -18,44 +18,42 @@
00000000000i[ ] MOVBE support: no 00000000000i[ ] MOVBE support: no
00000000000i[ ] x86-64 support: yes 00000000000i[ ] x86-64 support: yes
00000000000i[ ] 1G paging support: no 00000000000i[ ] 1G paging support: no
00000000000i[ ] VMX support: 1 00000000000i[ ] VMX support: no
00000000000i[ ] Optimization configuration 00000000000i[ ] Optimization configuration
00000000000i[ ] RepeatSpeedups support: yes 00000000000i[ ] RepeatSpeedups support: yes
00000000000i[ ] Trace cache support: yes 00000000000i[ ] Trace cache support: yes
00000000000i[ ] Fast function calls: yes 00000000000i[ ] Fast function calls: yes
00000000000i[ ] Devices configuration 00000000000i[ ] Devices configuration
00000000000i[ ] ACPI support: yes 00000000000i[ ] ACPI support: yes
00000000000i[ ] NE2000 support: no 00000000000i[ ] NE2000 support: yes
00000000000i[ ] PCI support: yes, enabled=yes 00000000000i[ ] PCI support: yes, enabled=yes
00000000000i[ ] SB16 support: yes 00000000000i[ ] SB16 support: yes
00000000000i[ ] USB support: no 00000000000i[ ] USB support: yes
00000000000i[ ] VGA extension support: vbe 00000000000i[ ] VGA extension support: vbe cirrus
00000000000i[MEM0 ] allocated memory at 0xb4116008. after alignment, vector=0xb4117000 00000000000i[MEM0 ] allocated memory at 028A0020. after alignment, vector=028A1000
00000000000i[MEM0 ] 32.00MB 00000000000i[MEM0 ] 32.00MB
00000000000i[MEM0 ] mem block size = 0x00100000, blocks=32 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 0xfffe0000/131072 ('C:\Program Files\Bochs-2.4.6\BIOS-bochs-latest')
00000000000i[MEM0 ] rom at 0xc0000/40448 ('/usr/local/share/bochs/VGABIOS-lgpl-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 ] Using local time for initial clock
00000000000i[CMOS ] Setting initial clock to: Mon Aug 29 10:21:59 2011 (time0=1314602519) 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 4 used by cascade
00000000000i[DMA ] channel 2 used by Floppy Drive 00000000000i[DMA ] channel 2 used by Floppy Drive
00000000000i[FDD ] fd0: '../luxos.img' ro=0, h=2,t=80,spt=18 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 ] 440FX Host bridge present at device 0, function 0
00000000000i[PCI ] PIIX3 PCI-to-ISA bridge present at device 1, 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[MEM0 ] Register memory access handlers: 0x00000000000a0000 - 0x00000000000bffff
00000000000i[XGUI ] test_alloc_colors: 16 colors available out of 16 colors tried 00000000000i[WGUI ] Desktop Window dimensions: 1366 x 768
00000000000i[XGUI ] font 8 wide x 16 high, display depth = 24 00000000000i[WGUI ] Number of Mouse Buttons = 5
00000000000i[WGUI ] IME disabled
00000000000i[MEM0 ] Register memory access handlers: 0x00000000e0000000 - 0x00000000e0ffffff 00000000000i[MEM0 ] Register memory access handlers: 0x00000000e0000000 - 0x00000000e0ffffff
00000000000i[VGA ] VBE Bochs Display Extension Enabled 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 'unmapped' plugin device by virtual method
00000000000i[ ] init_dev of 'biosdev' 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 '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 'extfpuirq' plugin device by virtual method
00000000000i[ ] init_dev of 'gameport' 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[ ] init_dev of 'pci_ide' plugin device by virtual method
00000000000i[PCI ] PIIX3 PCI IDE controller present at device 1, function 1 00000000000i[PCI ] PIIX3 PCI IDE controller present at device 1, function 1
00000000000i[ ] init_dev of 'acpi' plugin device by virtual method 00000000000i[ ] init_dev of 'acpi' plugin device by virtual method
@ -77,7 +75,6 @@
00000000000i[ ] register state of 'speaker' 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 'extfpuirq' plugin device by virtual method
00000000000i[ ] register state of 'gameport' 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 'pci_ide' plugin device by virtual method
00000000000i[ ] register state of 'acpi' 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 'ioapic' plugin device by virtual method
@ -88,19 +85,17 @@
00000000000i[SYS ] bx_pc_system_c::Reset(HARDWARE) called 00000000000i[SYS ] bx_pc_system_c::Reset(HARDWARE) called
00000000000i[CPU0 ] cpu hardware reset 00000000000i[CPU0 ] cpu hardware reset
00000000000i[APIC0] allocate APIC id=0 (MMIO enabled) to 0x00000000fee00000 00000000000i[APIC0] allocate APIC id=0 (MMIO enabled) to 0x00000000fee00000
00000000000i[CPU0 ] CPU[0] is the bootstrap processor 00000000000i[CPU0 ] CPUID[0x00000000]: 00000003 756e6547 6c65746e 49656e69
00000000000i[CPU0 ] CPUID[0x00000000]: 00000003 68747541 444d4163 69746e65 00000000000i[CPU0 ] CPUID[0x00000001]: 00000f23 00000800 00002000 07cbfbff
00000000000i[CPU0 ] CPUID[0x00000001]: 00000f23 00000800 00002020 07cbfbff 00000000000i[CPU0 ] CPUID[0x00000002]: 00410601 00000000 00000000 00000000
00000000000i[CPU0 ] CPUID[0x00000002]: 00000000 00000000 00000000 00000000
00000000000i[CPU0 ] CPUID[0x00000003]: 00000000 00000000 00000000 00000000 00000000000i[CPU0 ] CPUID[0x00000003]: 00000000 00000000 00000000 00000000
00000000000i[CPU0 ] CPUID[0x00000004]: 00000000 00000000 00000000 00000000 00000000000i[CPU0 ] CPUID[0x00000004]: 00000000 00000000 00000000 00000000
00000000000i[CPU0 ] CPUID[0x00000007]: 00000000 00000000 00000000 00000000 00000000000i[CPU0 ] CPUID[0x00000007]: 00000000 00000000 00000000 00000000
00000000000i[CPU0 ] CPUID[0x80000000]: 80000008 68747541 444d4163 69746e65 00000000000i[CPU0 ] CPUID[0x80000000]: 80000008 00000000 00000000 00000000
00000000000i[CPU0 ] CPUID[0x80000001]: 00000f23 00000000 00000001 ebd3fbff 00000000000i[CPU0 ] CPUID[0x80000001]: 00000000 00000000 00000001 2a100800
00000000000i[CPU0 ] CPUID[0x80000002]: 20444d41 6c687441 74286e6f 7020296d 00000000000i[CPU0 ] CPUID[0x80000002]: 20202020 20202020 20202020 6e492020
00000000000i[CPU0 ] CPUID[0x80000003]: 65636f72 726f7373 00000000 00000000 00000000000i[CPU0 ] CPUID[0x80000003]: 286c6574 50202952 69746e65 52286d75
00000000000i[CPU0 ] CPUID[0x80000004]: 00000000 00000000 00000000 00000000 00000000000i[CPU0 ] CPUID[0x80000004]: 20342029 20555043 20202020 00202020
00000000000i[CPU0 ] CPUID[0x80000005]: 01ff01ff 01ff01ff 40020140 40020140
00000000000i[CPU0 ] CPUID[0x80000006]: 00000000 42004200 02008140 00000000 00000000000i[CPU0 ] CPUID[0x80000006]: 00000000 42004200 02008140 00000000
00000000000i[CPU0 ] CPUID[0x80000007]: 00000000 00000000 00000000 00000000 00000000000i[CPU0 ] CPUID[0x80000007]: 00000000 00000000 00000000 00000000
00000000000i[CPU0 ] CPUID[0x80000008]: 00003028 00000000 00000000 00000000 00000000000i[CPU0 ] CPUID[0x80000008]: 00003028 00000000 00000000 00000000
@ -109,7 +104,6 @@
00000000000i[ ] reset of 'speaker' 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 'extfpuirq' plugin device by virtual method
00000000000i[ ] reset of 'gameport' 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 'pci_ide' plugin device by virtual method
00000000000i[ ] reset of 'acpi' 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 'ioapic' plugin device by virtual method
@ -117,90 +111,84 @@
00000000000i[ ] reset of 'harddrv' 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 'serial' plugin device by virtual method
00000000000i[ ] reset of 'parallel' 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 $ 00000003305i[BIOS ] $Revision: 1.257 $ $Date: 2011/01/26 09:52:02 $
00000318072i[KBD ] reset-disable command received 00000200000i[WGUI ] dimension update x=720 y=400 fontheight=16 fontwidth=9 bpp=8
00000444792i[VBIOS] VGABios $Id: vgabios.c,v 1.69 2009/04/07 18:18:20 vruppert Exp $ 00000318042i[KBD ] reset-disable command received
00000444863i[VGA ] VBE known Display Interface b0c0 00000444800i[VBIOS] VGABios $Id: vgabios.c,v 1.69 2009/04/07 18:18:20 vruppert Exp $
00000444895i[VGA ] VBE known Display Interface b0c5 00000444871i[CLVGA] VBE known Display Interface b0c0
00000447820i[VBIOS] VBE Bios $Id: vbe.c,v 1.62 2009/01/25 15:46:25 vruppert Exp $ 00000444903i[CLVGA] VBE known Display Interface b0c5
00000600000i[XGUI ] charmap update. Font Height is 16 00000447828i[VBIOS] VBE Bios $Id: vbe.c,v 1.62 2009/01/25 15:46:25 vruppert Exp $
00000760509i[BIOS ] Starting rombios32 00000760517i[BIOS ] Starting rombios32
00000761006i[BIOS ] Shutdown flag 0 00000761014i[BIOS ] Shutdown flag 0
00000761687i[BIOS ] ram_size=0x02000000 00000761695i[BIOS ] ram_size=0x02000000
00000762165i[BIOS ] ram_end=32MB 00000762173i[BIOS ] ram_end=32MB
00000802749i[BIOS ] Found 1 cpu(s) 00000802745i[BIOS ] Found 1 cpu(s)
00000821736i[BIOS ] bios_table_addr: 0x000fb928 end=0x000fcc00 00000821732i[BIOS ] bios_table_addr: 0x000fb928 end=0x000fcc00
00000821839i[PCI ] 440FX PMC write to PAM register 59 (TLB Flush) 00000821835i[PCI ] 440FX PMC write to PAM register 59 (TLB Flush)
00001149536i[PCI ] 440FX PMC write to PAM register 59 (TLB Flush) 00001149532i[PCI ] 440FX PMC write to PAM register 59 (TLB Flush)
00001477464i[P2I ] PCI IRQ routing: PIRQA# set to 0x0b 00001477460i[P2I ] PCI IRQ routing: PIRQA# set to 0x0b
00001477485i[P2I ] PCI IRQ routing: PIRQB# set to 0x09 00001477481i[P2I ] PCI IRQ routing: PIRQB# set to 0x09
00001477506i[P2I ] PCI IRQ routing: PIRQC# set to 0x0b 00001477502i[P2I ] PCI IRQ routing: PIRQC# set to 0x0b
00001477527i[P2I ] PCI IRQ routing: PIRQD# set to 0x09 00001477523i[P2I ] PCI IRQ routing: PIRQD# set to 0x09
00001477537i[P2I ] write: ELCR2 = 0x0a 00001477533i[P2I ] write: ELCR2 = 0x0a
00001478422i[BIOS ] PIIX3/PIIX4 init: elcr=00 0a 00001478418i[BIOS ] PIIX3/PIIX4 init: elcr=00 0a
00001486380i[BIOS ] PCI: bus=0 devfn=0x00: vendor_id=0x8086 device_id=0x1237 class=0x0600 00001486376i[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 00001488938i[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 00001491339i[BIOS ] PCI: bus=0 devfn=0x09: vendor_id=0x8086 device_id=0x7010 class=0x0101
00001491573i[PIDE ] new BM-DMA address: 0xc000 00001491569i[PIDE ] new BM-DMA address: 0xc000
00001492277i[BIOS ] region 4: 0x0000c000 00001492273i[BIOS ] region 4: 0x0000c000
00001494587i[BIOS ] PCI: bus=0 devfn=0x0b: vendor_id=0x8086 device_id=0x7113 class=0x0680 00001494583i[BIOS ] PCI: bus=0 devfn=0x0b: vendor_id=0x8086 device_id=0x7113 class=0x0680
00001494825i[ACPI ] new irq line = 11 00001494821i[ACPI ] new irq line = 11
00001494839i[ACPI ] new irq line = 9 00001494835i[ACPI ] new irq line = 9
00001494869i[ACPI ] new PM base address: 0xb000 00001494865i[ACPI ] new PM base address: 0xb000
00001494883i[ACPI ] new SM base address: 0xb100 00001494879i[ACPI ] new SM base address: 0xb100
00001494911i[PCI ] setting SMRAM control register to 0x4a 00001494907i[PCI ] setting SMRAM control register to 0x4a
00001659005i[CPU0 ] Enter to System Management Mode 00001659001i[CPU0 ] Enter to System Management Mode
00001659005i[CPU0 ] enter_system_management_mode: temporary disable VMX while in SMM mode 00001659011i[CPU0 ] RSM: Resuming from System Management Mode
00001659015i[CPU0 ] RSM: Resuming from System Management Mode 00001823031i[PCI ] setting SMRAM control register to 0x0a
00001823035i[PCI ] setting SMRAM control register to 0x0a 00001832202i[BIOS ] MP table addr=0x000fba00 MPC table addr=0x000fb930 size=0xd0
00001832206i[BIOS ] MP table addr=0x000fba00 MPC table addr=0x000fb930 size=0xd0 00001834261i[BIOS ] SMBIOS table addr=0x000fba10
00001834265i[BIOS ] SMBIOS table addr=0x000fba10 00001836649i[BIOS ] ACPI tables: RSDP addr=0x000fbb30 ACPI DATA addr=0x01ff0000 size=0x988
00001836653i[BIOS ] ACPI tables: RSDP addr=0x000fbb30 ACPI DATA addr=0x01ff0000 size=0x988 00001839887i[BIOS ] Firmware waking vector 0x1ff00cc
00001839891i[BIOS ] Firmware waking vector 0x1ff00cc 00001851000i[PCI ] 440FX PMC write to PAM register 59 (TLB Flush)
00001851004i[PCI ] 440FX PMC write to PAM register 59 (TLB Flush) 00001851844i[BIOS ] bios_table_cur_addr: 0x000fbb54
00001851848i[BIOS ] bios_table_cur_addr: 0x000fbb54 00014041548i[BIOS ] Booting from 0000:7c00
00014041552i[BIOS ] Booting from 0000:7c00 00023137418i[BIOS ] int13_harddisk: function 41, unmapped device for ELDL=80
00023137422i[BIOS ] int13_harddisk: function 41, unmapped device for ELDL=80 00023142199i[BIOS ] int13_harddisk: function 08, unmapped device for ELDL=80
00023142203i[BIOS ] int13_harddisk: function 08, unmapped device for ELDL=80 00023146850i[BIOS ] *** int 15h function AX=00c0, BX=0000 not yet supported!
00023146854i[BIOS ] *** int 15h function AX=00c0, BX=0000 not yet supported! 00043965427i[KBD ] setting typematic info
00037427421i[CPU0 ] [37427421] Stopped on MAGIC BREAKPOINT 00043965445i[KBD ] setting delay to 500 mS (unused)
00037475097i[KBD ] setting typematic info 00043965445i[KBD ] setting repeat rate to 10.9 cps (unused)
00037475122i[KBD ] setting delay to 500 mS (unused) 00043965488i[KBD ] Switched to scancode set 2
00037475122i[KBD ] setting repeat rate to 10.9 cps (unused) 00043965551i[KBD ] keyboard: scan convert turned off
00037475183i[KBD ] Switched to scancode set 2 01748376000p[WGUI ] >>PANIC<< POWER button turned off.
00037475271i[KBD ] keyboard: scan convert turned off 01748376000i[CPU0 ] CPU is in protected mode (active)
00037475895i[KBD ] keyboard: scan convert turned off 01748376000i[CPU0 ] CS.d_b = 32 bit
00037491918i[FDD ] controller reset in software 01748376000i[CPU0 ] SS.d_b = 32 bit
00039078683i[FDD ] io_write: config control register: 0x00 01748376000i[CPU0 ] EFER = 0x00000000
00055400059i[CPU0 ] [55400059] Stopped on MAGIC BREAKPOINT 01748376000i[CPU0 ] | RAX=00000000001108ff RBX=0000000000000066
00165600000i[ ] dbg: Quit 01748376000i[CPU0 ] | RCX=00000000000003d4 RDX=0000000000000308
00165600000i[CPU0 ] CPU is in protected mode (active) 01748376000i[CPU0 ] | RSP=00000000001107c8 RBP=0000000000000018
00165600000i[CPU0 ] CS.d_b = 32 bit 01748376000i[CPU0 ] | RSI=0000000000110806 RDI=0000000000000002
00165600000i[CPU0 ] SS.d_b = 32 bit 01748376000i[CPU0 ] | R8=0000000000000000 R9=0000000000000000
00165600000i[CPU0 ] EFER = 0x00000000 01748376000i[CPU0 ] | R10=0000000000000000 R11=0000000000000000
00165600000i[CPU0 ] | RAX=00000000000000ff RBX=000000000010d78c 01748376000i[CPU0 ] | R12=0000000000000000 R13=0000000000000000
00165600000i[CPU0 ] | RCX=00000000000003d4 RDX=000000000010d6ca 01748376000i[CPU0 ] | R14=0000000000000000 R15=0000000000000000
00165600000i[CPU0 ] | RSP=000000000010d68c RBP=000000000010d6a4 01748376000i[CPU0 ] | IOPL=0 id vip vif ac vm rf nt of df IF tf sf ZF af PF cf
00165600000i[CPU0 ] | RSI=000000000010d6ca RDI=0000000000000002 01748376000i[CPU0 ] | SEG selector base limit G D
00165600000i[CPU0 ] | R8=0000000000000000 R9=0000000000000000 01748376000i[CPU0 ] | SEG sltr(index|ti|rpl) base limit G D
00165600000i[CPU0 ] | R10=0000000000000000 R11=0000000000000000 01748376000i[CPU0 ] | CS:0008( 0001| 0| 0) 00000000 ffffffff 1 1
00165600000i[CPU0 ] | R12=0000000000000000 R13=0000000000000000 01748376000i[CPU0 ] | DS:0010( 0002| 0| 0) 00000000 ffffffff 1 1
00165600000i[CPU0 ] | R14=0000000000000000 R15=0000000000000000 01748376000i[CPU0 ] | SS:0010( 0002| 0| 0) 00000000 ffffffff 1 1
00165600000i[CPU0 ] | IOPL=0 id vip vif ac vm rf nt of df IF tf sf ZF af PF cf 01748376000i[CPU0 ] | ES:0010( 0002| 0| 0) 00000000 ffffffff 1 1
00165600000i[CPU0 ] | SEG selector base limit G D 01748376000i[CPU0 ] | FS:0010( 0002| 0| 0) 00000000 ffffffff 1 1
00165600000i[CPU0 ] | SEG sltr(index|ti|rpl) base limit G D 01748376000i[CPU0 ] | GS:0010( 0002| 0| 0) 00000000 ffffffff 1 1
00165600000i[CPU0 ] | CS:0008( 0001| 0| 0) 00000000 ffffffff 1 1 01748376000i[CPU0 ] | MSR_FS_BASE:0000000000000000
00165600000i[CPU0 ] | DS:0010( 0002| 0| 0) 00000000 ffffffff 1 1 01748376000i[CPU0 ] | MSR_GS_BASE:0000000000000000
00165600000i[CPU0 ] | SS:0010( 0002| 0| 0) 00000000 ffffffff 1 1 01748376000i[CPU0 ] | RIP=0000000000108a0a (0000000000108a0a)
00165600000i[CPU0 ] | ES:0010( 0002| 0| 0) 00000000 ffffffff 1 1 01748376000i[CPU0 ] | CR0=0xe0000011 CR2=0x0000000000000000
00165600000i[CPU0 ] | FS:0010( 0002| 0| 0) 00000000 ffffffff 1 1 01748376000i[CPU0 ] | CR3=0x0011a000 CR4=0x00000000
00165600000i[CPU0 ] | GS:0010( 0002| 0| 0) 00000000 ffffffff 1 1 01748376000i[CPU0 ] 0x0000000000108a0a>> mov al, byte ptr ds:0x10c9dd : A0DDC91000
00165600000i[CPU0 ] | MSR_FS_BASE:0000000000000000 01748376000i[CMOS ] Last time is 1315486137 (Thu Sep 08 15:48:57 2011)
00165600000i[CPU0 ] | MSR_GS_BASE:0000000000000000 01748376000i[ ] restoring default signal behavior
00165600000i[CPU0 ] | RIP=0000000000105eb4 (0000000000105eb4) 01748376000i[CTRL ] quit_sim called with exit code 1
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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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 [GOOD] BUILD 0.1.0.590 DATE 9/05/2011 AT 2:40 PM
==================================================== ====================================================
Mainly changed: FS.Initrd Mainly changed: FS.Initrd

Binary file not shown.

View File

@ -11,15 +11,6 @@ SECTIONS
*(.__mbHeader) *(.__mbHeader)
} }
.setup :
{
*(.setup)
}
/* . += 0xC0000000; */
.text : /* AT(ADDR(.text) - 0xC0000000) */ .text : /* AT(ADDR(.text) - 0xC0000000) */
{ {
_code = .; _code = .;

BIN
luxos.img

Binary file not shown.

View File

@ -1 +1 @@
601 629