diff --git a/src/sys/init/main.c b/src/sys/init/main.c index e084c71..e04c7f3 100644 --- a/src/sys/init/main.c +++ b/src/sys/init/main.c @@ -48,6 +48,21 @@ static char kernelStack[8192]; /* Stack Space For Our Kernel */ + +/***************************************************************************************** + Desc: The Kernels Descriptor table: + 0x00 - Dummy Entry + 0x08 - Ring 0 CS + 0x10 - Ring 0 DS + 0x18 - Dummy LDT + 0x20 - Scheduler TSS + 0x28 - Ring 3 CS + 0x30 - Ring 3 DS + 0x38 - GPF TSS + + Notes: + +*****************************************************************************************/ ubixDescriptorTable(ubixGDT,8) { {dummy:0}, ubixStandardDescriptor(0x0, 0xFFFFF, (dCode + dRead + dBig + dBiglim)), @@ -64,6 +79,8 @@ } loadGDT = { (8 * sizeof(union descriptorTableUnion) - 1), ubixGDT }; /***************************************************************************************** + Functoin: int main() + Desc: This is the entry point into the os where all of the kernels sub systems are started up. @@ -129,7 +146,6 @@ ************************************************************************/ void _start() { - //asm ("pushl $2; popf"); asm volatile( "lgdtl (loadGDT) \n" "movw $0x10,%%ax \n" /* Select Ring 0 Data Segment */ @@ -138,13 +154,13 @@ "movw %%ax,%%fs \n" /* "" "" */ "movw %%ax,%%gs \n" /* "" "" */ "movw %%ax,%%ss \n" /* "" "" */ - "movl %1,%%esp \n" /* Set Default Stack Pointer Its The End Of First Page */ - "movl %1,%%ebp \n" + "movl %1,%%esp \n" /* Set Default Stack Pointer Its The End Of First Page */ + "movl %1,%%ebp \n" "mov $0x18,%%ax \n" /* Set Up Dummy LDT */ "lldt %%ax \n" /* Load The Dummy LDT */ "mov $0x20,%%ax \n" /* Set Up Dummy TSS */ "ltr %%ax \n" /* Load The Dummy TSS */ - "ljmp $0x08,$next \n" + "ljmp $0x08,$next \n" /* This is to make sure we are in ring-0 */ "next: \n" : : "r" (ubixGDT), "p" (kernelStack+8192) @@ -157,6 +173,9 @@ /*** $Log$ + Revision 1.55 2004/07/17 03:38:38 reddawg + Going to laptop to finish up + Revision 1.54 2004/07/17 02:38:31 reddawg Fixed a few problems diff --git a/src/sys/kernel/bioscall.c b/src/sys/kernel/bioscall.c index 45202e7..8121d85 100644 --- a/src/sys/kernel/bioscall.c +++ b/src/sys/kernel/bioscall.c @@ -34,13 +34,16 @@ #include #include #include +#include -asm ( +asm( ".globl bios16Code\n" + ".code16 \n" "bios16Code: \n" "int $0x10 \n" "int $0x69 \n" + ".code32 \n" ); @@ -53,6 +56,7 @@ segment = tmpAddr >> 4; newProcess = schedNewTask(); + assert(newProcess); newProcess->tss.back_link = 0x0; newProcess->tss.esp0 = (uInt32)kmalloc(0x2000)+0x2000; @@ -92,6 +96,9 @@ /*** $Log$ + Revision 1.4 2004/06/15 12:24:07 reddawg + Cleaned Up + Revision 1.3 2004/05/19 04:07:42 reddawg kmalloc(size,pid) no more it is no kmalloc(size); the way it should of been diff --git a/src/sys/lib/kmalloc.c b/src/sys/lib/kmalloc.c index cff9893..d6f27d7 100644 --- a/src/sys/lib/kmalloc.c +++ b/src/sys/lib/kmalloc.c @@ -29,23 +29,24 @@ #include #include -#include #include #include -#include #include +#include +#include static struct memDescriptor *kernDesc = 0x0; static struct memDescriptor *freeKernDesc = 0x0; static struct memDescriptor *emptyKernDesc = 0x0; -static spinLock_t mallocSpinLock = SPIN_LOCK_INITIALIZER; +static spinLock_t mallocSpinLock = SPIN_LOCK_INITIALIZER; void initMalloc() { int i=0; struct memDescriptor *tmpDesc1 = 0x0; struct memDescriptor *tmpDesc2 = 0x0; emptyKernDesc = (struct memDescriptor *)vmmGetFreeKernelPage(sysID,4); + assert(emptyKernDesc); tmpDesc1 = emptyKernDesc; tmpDesc1->prev = 0x0; tmpDesc1->status = 0x0; @@ -131,6 +132,7 @@ kernDesc = tmpDesc1; if (tmpDesc1->limit > (len + 16)) { tmpDesc2 = getEmptyDesc(); + assert(tmpDesc2); tmpDesc2->limit = tmpDesc1->limit - len; tmpDesc1->limit = len; tmpDesc2->baseAddr = tmpDesc1->baseAddr + len; @@ -158,6 +160,7 @@ kernDesc->next->prev = tmpDesc1; if ((len-4096) > 0) { tmpDesc2 = getEmptyDesc(); + assert(tmpDesc2); tmpDesc2->status = 0x0; tmpDesc2->baseAddr = tmpDesc1->baseAddr + tmpDesc1->limit; tmpDesc2->limit = ((len + 4095)/4096)*4096 - tmpDesc1->limit; @@ -329,6 +332,9 @@ /*** $Log$ + Revision 1.8 2004/06/17 14:50:32 reddawg + kmalloc: converted some variables to static + Revision 1.7 2004/06/17 02:54:54 flameshadow chg: fixed cast diff --git a/src/sys/vmm/paging.c b/src/sys/vmm/paging.c index 7176527..d6c689b 100644 --- a/src/sys/vmm/paging.c +++ b/src/sys/vmm/paging.c @@ -24,6 +24,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. $Log$ + Revision 1.4 2004/06/10 22:23:56 reddawg + Volatiles + Revision 1.3 2004/06/10 15:24:35 reddawg Fixed an asm statement @@ -48,6 +51,7 @@ #include #include #include +#include uInt32 *kernelPageDirectory = 0x0; @@ -180,6 +184,7 @@ */ pageDir = (uInt32 *) parentPageDirAddr; /* Check To See If Page Table Exists */ + assert(dest); destPageDirectoryIndex = (dest / (1024 * 4096)); if ((pageDir[destPageDirectoryIndex] & pagePresent) != pagePresent) { /* If Page Table Is Non Existant Then Set It Up */