diff --git a/Kernel/debug/commands.c~ b/Kernel/debug/commands.c~ deleted file mode 100644 index 3c95cd3..0000000 --- a/Kernel/debug/commands.c~ +++ /dev/null @@ -1,255 +0,0 @@ -#include -#include -#include -#include -#include "../hal/mouse/mouse.h" -#include "../drivers/floppy/floppy.h" - -string ConsoleCommands[] = -{ - "osver", - "time", - "cls", - "help", - "dump", - "mem", - "crash", - "mouse", - "read", - "reboot", - "restart", -}; - -int32 ConsoleCommandsCount = 11; - -/***************************************** - * osver - get os info * - *****************************************/ -void CommandOsver() -{ - ConsoleWrite ("%#%s%# 32bit operating system\n", Color(0,ColorYellow), OS_STRING, Color(0,ColorLightGray)); - - int32 i = 0; - for (i = 0; i < 30; i++) - ConsoleWrite ("%#%c", ColorDarkGray, 205); - - ConsoleWrite ("\n%#OS version: %#%s\n", ColorDarkGray, ColorLightGray, OS_VERSION); - ConsoleWrite ("%#Build: %#%s ", ColorDarkGray, ColorLightGray, OS_BUILD); - ConsoleWrite ("%#built on %#%s %#at %#%s\n", ColorDarkGray, ColorLightGray, OS_BUILD_DATE, ColorDarkGray, ColorLightGray, OS_BUILD_TIME); - ConsoleWrite ("%#(c) Copyright %#CTA Systems Inc.\n", ColorDarkGray ,ColorLightGray); -} - - -/***************************************** - * time - get date and time * - *****************************************/ -void CommandTime() -{ - const char* Months[] = { - "", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" - }; - - const char* Weekdays[] = { - "", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" - }; - - - Time time = TimeConvertToTime(TimeGetInternalTime()); - - ConsoleWrite ("Current time: "); - ConsoleWrite ("%#%d:%d%d:%d%d.%d%d%d\n", Color(0,ColorLightGreen) ,(int)time.Hour, - time.Minute/10, time.Minute%10, time.Second/10, time.Second%10, time.Milisecond/100, (time.Milisecond/10)%10, time.Milisecond%10); - - ConsoleWrite ("Date: %#%s, %s %d, %d\n", Color(0,ColorLightGreen), Weekdays[time.WeekDay], - Months[time.Month], time.Day, time.Year); - -} - - -/***************************************** - * help - help provider * - *****************************************/ -void CommandHelp(string params[], int32 count) -{ - if (count <= 1) - { - ConsoleWrite ("Available commands:\n"); - - int i; - for (i = 0; i < ConsoleCommandsCount; i++) - ConsoleWrite(" > %#%s\n", Color(0,ColorWhite), ConsoleCommands[i]); - - return; - } - - ConsoleWrite("%#! Help for %s command is not implemented yet.\n", Color(0,ColorLightRed), params[1]); -} - - -/***************************************** - * dump - dumps memory content * - *****************************************/ -inline char hex (int32 digit) -{ - return (digit < 10) ? (digit + '0') : (digit - 10 + 'A'); -} - -void CommandDump (string argv[], int32 argc) -{ - unsigned pause = 1, i = 0; - - // Verify correct number of arguments - if (argc < 3) { - ConsoleWrite("%#! Correct syntax: %#dump %#[start_address] [end_address]\n", - ColorLightRed, ColorWhite, ColorLightGray); - ConsoleWrite("%#Start %#and %#end %#addresses are in hex.\n", - ColorLightGray, ColorDarkGray, ColorLightGray, ColorDarkGray); - return; - } - - // Disable pause - if (argc==4 && strcmp(argv[3], "!p") == 0) - pause = 0; - - // Dump memory - unsigned char *start, *end; - start = (unsigned char *) ConvertStringToIntHex(argv[1]); - end = (unsigned char *) ConvertStringToIntHex(argv[2]); - unsigned char* count; - - while (start <= end) { - // Write address - ConsoleWrite("%#%x%#: ", Color(0,ColorLightMagenta), (unsigned int)start, Color(0,ColorLightGray)); - - // Write hex data - for (count = start; count < start+16; count++) { - if (*count == 0) ConsoleWrite ("%#00 ", Color(0,ColorDarkGray)); - else ConsoleWrite ("%#%c%c ", Color(0,ColorWhite), hex(*count/16), hex(*count%16)); - } - - // Write ASCII data - ConsoleWrite(" "); - for (count = start; count < start+16; count++) { - if (*count < 32) ConsoleWrite("."); - else ConsoleWrite("%#%c", Color(0,ColorLightGreen), *count); - } - - // New line - ConsoleWrite("\n\r"); - start+=16; i++; - - // Pause - if ((i%22 == 0) && (pause==1)) { - ConsoleWrite("\n\r%#Press %#any key %#to continue scrolling, %#Esc %#to exit.", - 0x8, 0x7, 0x8, 0x7, 0x8); - Key k = ReadKey(); - if (k.Scancode == KeyboardKeyEscape) return; - ConsoleWrite("\n\n\r"); - } - } -} - - -#define _CommandMemTotalRows 10 -void _CommandMemPrintMemmap() -{ - uint8 color = Color(ColorGreen, ColorRed); - uint32 total = MemoryGetFramesTotal(); - - char c = ' '; - - // Print memory map - int32 i, old = 0, n = 0, blocks, used; - for (i = 0; i < 80; i++) - ConsoleWrite("%#%c", ColorLightGray, 220); - - for (i = 1; i <= 80*_CommandMemTotalRows; i++, old++) - { - n = (total * i) / (80 * _CommandMemTotalRows); - - blocks = n - old; - used = 0; - for (; old < n; old++) - used += (MemPhGetFrame(old) != 0); - - if (used <= blocks / 5) c = ' '; - else if (used > 4 * blocks / 5) c = 219; - else if (used <= 2 * blocks / 5) c = 176; - else if (used <= 3 * blocks / 5) c = 177; - else c = 178; - - ConsoleWrite("%#%c", color, c); - } - - for (i = 0; i < 80; i++) - ConsoleWrite("%#%c", ColorDarkGray, 223); -} - -void CommandMem (string argv[], int32 argc) -{ - if (argc < 2) - { - ConsoleWrite ("Memory map:\n"); - - _CommandMemPrintMemmap(); - - ConsoleWrite ("Free space: %#%ukb (%u frames)\n", ColorLightMagenta, MemoryGetFree(), MemoryGetFramesFree()); - ConsoleWrite ("Used space: %#%ukb (%u frames)\n\n", ColorLightMagenta, MemoryGetUsed(), MemoryGetFramesUsed()); - ConsoleWrite ("Total space: %#%ukb (%u frames)\n", ColorLightMagenta, MemoryGetTotal(), MemoryGetFramesTotal()); - - return; - } - - if (strcmp(argv[1], "alloc") == 0) - { - uint32 addr = 0; - if (argc < 3) addr = (uint32)kmalloc(0x4); - else addr = (uint32)kmalloc(ConvertStringToUInt(argv[2])); - - ConsoleWrite("Returned address: %#0x%x\n", ColorWhite, addr); - } - - else if (strcmp(argv[1], "free") == 0) - { - if (argc < 3) { - ConsoleWrite ("%#! Missing parameter: address to free.", ColorRed); - return; - } - - kfree((void*)ConvertStringToIntHex(argv[2])); - ConsoleWrite("Done.\n"); - } - - else ConsoleWrite("%#! Invalid command. Available commands are: alloc, free.", ColorLightRed); -} - -void CommandCrash() -{ - int a = 10, b = 0; - ConsoleWrite ("%d", a/b); -} - -void CommandMouse() -{ - MouseState s = MouseGetState(); - ConsoleWrite("X=%d Y=%d Buttons=", s.Position.X, s.Position.Y); - - if (!s.Buttons) ConsoleWrite(""); - if (s.Buttons & 1) ConsoleWrite(""); - if (s.Buttons & 2) ConsoleWrite(""); - if (s.Buttons & 4) ConsoleWrite(""); - - ConsoleWrite("\n"); -} - -void CommandRead(string argv[], int32 argc) -{ - if (argc < 2) - { - ConsoleWrite("%#! Missing parameter - sector!\n", ColorLightRed); - return; - } - - uint32 sector = ConvertStringToUInt(argv[1]); - ConsoleWrite("Returned value: 0x%x\n", FloppyRead(0, sector)); -} diff --git a/Kernel/hal/crash.c~ b/Kernel/hal/crash.c~ deleted file mode 100644 index e6044d0..0000000 --- a/Kernel/hal/crash.c~ +++ /dev/null @@ -1,97 +0,0 @@ -/* - * crash.c - * - * Created on: Aug 19, 2011 - * Author: Tiberiu - */ - -#include - -string errorCodes[] = -{ - "Division by zero", //0 - "Debugger", //1 - "Non maskable interrupt", //2 - "Breakpoint", //3 - "Overflow", //4 - "Bounds", //5 - "Invalid opcode", //6 - "Coprocessor not available", //7 - "Double fault", //8 - "Coprocessor segment overrun",//9 - "Invalid task state segment", //A - "Segment not present", //B - "Stack fault", //C - "General protection fault", //D - "Page fault", //E - "", //F - "Math fault", //10 - "Alignment check", //11 - "Machine check", //12 - "SIMD floating-point exception" //13 -}; - -void CrashMessage(_RegsStack32 *r) -{ - ConsoleSetDefaultColor(ColorLightRed); - - ConsoleWrite("\n"); uint32 i; - for (i = 0; i < 80; i++) ConsoleWrite("%c", 205); - - ConsoleWrite("%#\t\t\t\tSomething went terribly wrong :(\n\n", ColorWhite); - ConsoleWrite("There was an unhandled exception: "); - - if (r->int_no < 20) - ConsoleWrite("%#%s (INT%u)", ColorWhite, errorCodes[r->int_no], r->int_no); - else ConsoleWrite("%#INT%u", ColorWhite, r->int_no); - - ConsoleWrite("\nTo protect your computer, it had to be halted.\n\n"); - ConsoleWrite("Here, this might help find the problem:\n"); - - Point a = {4, -1}, b = {22, -1}, c = {40, -1}, d = {58, -1}; - - ConsoleSetDefaultColor(ColorWhite); - ConsoleCursorGoto(a); ConsoleWrite("eax=0x%x", r->eax); - ConsoleCursorGoto(b); ConsoleWrite("ebx=0x%x", r->ebx); - ConsoleCursorGoto(c); ConsoleWrite("ecx=0x%x", r->ecx); - ConsoleCursorGoto(d); ConsoleWrite("edx=0x%x\n", r->edx); - - ConsoleCursorGoto(a); ConsoleWrite("edi=0x%x", r->edi); - ConsoleCursorGoto(b); ConsoleWrite("esi=0x%x", r->esi); - ConsoleCursorGoto(c); ConsoleWrite("ebp=0x%x", r->ebp); - ConsoleCursorGoto(d); ConsoleWrite("esp=0x%x\n", r->esp); - - ConsoleCursorGoto(a); ConsoleWrite("gs=0x%x", r->gs); - ConsoleCursorGoto(b); ConsoleWrite("fs=0x%x", r->fs); - ConsoleCursorGoto(c); ConsoleWrite("es=0x%x", r->es); - ConsoleCursorGoto(d); ConsoleWrite("ds=0x%x\n", r->ds); - - ConsoleCursorGoto(a); ConsoleWrite("eip=0x%x", r->eip); - ConsoleCursorGoto(b); ConsoleWrite("cs=0x%x", r->cs); - ConsoleCursorGoto(c); ConsoleWrite("eflags=0x%x", r->eflags); - ConsoleCursorGoto(d); ConsoleWrite("useresp=0x%x\n", r->useresp); - - ConsoleCursorGoto(a); ConsoleWrite("gs=0x%x", r->ss); - ConsoleCursorGoto(b); ConsoleWrite("fs=0x%x", r->int_no); - ConsoleCursorGoto(c); ConsoleWrite("err_code=0x%x", r->err_code); - - // Useful info about page fault - if (r->int_no == 0xE) - { - uint32 faulting_address; - asm volatile("mov %%cr2, %0" : "=r" (faulting_address)); - - ConsoleCursorGoto(d); ConsoleWrite("address=0x%x\n", faulting_address); - ConsoleCursorGoto(a); ConsoleWrite("reason: "); - - if (!(r->err_code & 1)) ConsoleWrite("%#PAGE_NOT_PRESENT; ", ColorLightGray); - if (r->err_code & 2) ConsoleWrite("%#WRITE_OPERATION; ", ColorLightGray); - if (r->err_code & 4) ConsoleWrite("%#CPU_IN_USER_MODE; ", ColorLightGray); - if (r->err_code & 8) ConsoleWrite("%#CPU_RESERVED_PAGE_ENTRY_OVERWRITTEN; ", ColorLightGray); - if (r->err_code & 0x10) ConsoleWrite("%#INSTRUCTION_FETCH; ", ColorLightGray); - } - - ConsoleSetDefaultColor(ColorLightRed); - ConsoleWrite("\n"); - for (i = 0; i < 80; i++) ConsoleWrite("%c", 205); -} diff --git a/Kernel/loader.asm~ b/Kernel/loader.asm~ deleted file mode 100644 index 68763ef..0000000 --- a/Kernel/loader.asm~ +++ /dev/null @@ -1,99 +0,0 @@ -bits 32 - -global start - -; multiboot header -MODULEALIGN equ 1<<0 -MEMINFO equ 1<<1 -VIDEOINFO equ 1<<2 -FLAGS equ MODULEALIGN | MEMINFO | VIDEOINFO -MAGIC equ 0x1BADB002 -CHECKSUM equ -(MAGIC + FLAGS) - - -section .__mbHeader -align 4 -MultiBootHeader: - dd MAGIC - dd FLAGS - dd CHECKSUM - -section .text - -STACKSIZE equ 0x4000 ; that's 16k. - -start: - XCHG BX, BX ; magic breakpoint - - 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 - mov esp, stack+STACKSIZE - - cmp ecx, 0x2BADB002 - jne .bad - - push ebx - - extern k_main - call k_main - -; Show error message, and halt system -.bad: - - extern ConsoleClear - extern ConsoleWrite - extern CommandOsver - - call ConsoleClear - call CommandOsver - - mov eax, [ErrorColor] - push eax - push ErrorString - call ConsoleWrite - - cli - hlt - - -; some variables -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 diff --git a/Kernel/main.c~ b/Kernel/main.c~ deleted file mode 100644 index 5d7d17f..0000000 --- a/Kernel/main.c~ +++ /dev/null @@ -1,27 +0,0 @@ -#include "hal/hal.h" -#include "drivers/drivers.h" -#include -#include -#include -#include -#include -#include - -extern uint32 _end; - -void k_main(MultibootInfo* info) -{ - uint32 KernelEnd = (uint32)&_end; - MemoryTempInitialize(KernelEnd); - - ConsoleClear(); - HalInitialize(); - DriversInstall(); - - // Set up memory manager - MemoryInitialize(&info_new); - - Log("All ready. Starting console...\n\n"); - - ConsoleMain(); -} diff --git a/Modules/Rom image maker/.dep.inc b/Modules/Rom image maker/DEP~1.INC similarity index 100% rename from Modules/Rom image maker/.dep.inc rename to Modules/Rom image maker/DEP~1.INC diff --git a/Modules/Rom image maker/build/Debug/MinGW-Windows/info.o.d b/Modules/Rom image maker/build/Debug/MinGW-Windows/INFOO~1.D similarity index 100% rename from Modules/Rom image maker/build/Debug/MinGW-Windows/info.o.d rename to Modules/Rom image maker/build/Debug/MinGW-Windows/INFOO~1.D diff --git a/Modules/Rom image maker/build/Debug/MinGW-Windows/main.o.d b/Modules/Rom image maker/build/Debug/MinGW-Windows/MAINO~1.D similarity index 100% rename from Modules/Rom image maker/build/Debug/MinGW-Windows/main.o.d rename to Modules/Rom image maker/build/Debug/MinGW-Windows/MAINO~1.D diff --git a/Modules/Rom image maker/nbproject/private/private.properties b/Modules/Rom image maker/nbproject/private/private.properties deleted file mode 100644 index e69de29..0000000 diff --git a/Modules/Rom image maker/nbproject/project.properties b/Modules/Rom image maker/nbproject/project.properties deleted file mode 100644 index e69de29..0000000 diff --git a/.project b/PROJEC~1 similarity index 100% rename from .project rename to PROJEC~1 diff --git a/bochs/.bochsrc~ b/bochs/.bochsrc~ deleted file mode 100644 index 490468d..0000000 --- a/bochs/.bochsrc~ +++ /dev/null @@ -1,10 +0,0 @@ -megs: 32 -romimage: file="/usr/share/bochs/BIOS-bochs-latest" -vgaromimage: file="C:\Program Files\Bochs-2.4.6\VGABIOS-lgpl-latest" - -floppya: 1_44=../luxos.img, status=inserted -boot: a -log: bochs_run.log -mouse: enabled=0 -magic_break: enabled=1 -display_library: x, options="gui_debug" \ No newline at end of file diff --git a/bochs/.bochsrc b/bochs/BOCHSR~1 similarity index 100% rename from bochs/.bochsrc rename to bochs/BOCHSR~1 diff --git a/bochs/bochsrc.bxrc b/bochs/BOCHSR~1.BX~ similarity index 100% rename from bochs/bochsrc.bxrc rename to bochs/BOCHSR~1.BX~ diff --git a/build/crash.o b/build/crash.o deleted file mode 100644 index cb49ef3..0000000 Binary files a/build/crash.o and /dev/null differ diff --git a/build/keyboard.o b/build/keyboard.o deleted file mode 100644 index 1d40772..0000000 Binary files a/build/keyboard.o and /dev/null differ diff --git a/luxos.img b/luxos.img new file mode 100644 index 0000000..4c6c5cf Binary files /dev/null and b/luxos.img differ diff --git a/scripts/build.bat b/scripts/build.bat index 781c088..69a4e86 100644 --- a/scripts/build.bat +++ b/scripts/build.bat @@ -1,7 +1,7 @@ @echo off -C: -chdir C:\Dev\lux +E: +chdir E:\Software\OsDev set CYGWIN=nodosfilewarning -C:\cygwin\bin\bash /cygdrive/c/Dev/lux/build.sh +bash /cygdrive/e/Software/OsDev/lux/build.sh diff --git a/scripts/pack.bat b/scripts/pack.bat index 666a8c3..8a43926 100644 --- a/scripts/pack.bat +++ b/scripts/pack.bat @@ -1,6 +1,6 @@ @echo off -C: -chdir C:\Dev\lux +E: +chdir E:\Software\OsDev\lux -C:\cygwin\bin\bash /cygdrive/c/Dev/lux/scripts/pack.sh +bash /cygdrive/e/Software/OsDev/lux/scripts/pack.sh diff --git a/scripts/pack.sh b/scripts/pack.sh index 931d8f2..b5d0e79 100644 --- a/scripts/pack.sh +++ b/scripts/pack.sh @@ -1,6 +1,6 @@ #!/bin/sh -cd /cygdrive/c/Dev +cd /cygdrive/e/Software/OsDev # Get version number read version < ./lux/Kernel/include/version.h