diff --git a/src/sys/drivers/pit.c b/src/sys/drivers/pit.c new file mode 100755 index 0000000..14f0664 --- /dev/null +++ b/src/sys/drivers/pit.c @@ -0,0 +1,3 @@ + //outportByte(0x43,0x36); + //outportByte(0x40,((1193180/1000) & 0xFF)); + //outportByte(0x40,(((1193180/1000) << 8) & 0xFF)); \ No newline at end of file diff --git a/src/sys/include/ubixos/io.h b/src/sys/include/ubixos/io.h index ede3edb..9bd7130 100755 --- a/src/sys/include/ubixos/io.h +++ b/src/sys/include/ubixos/io.h @@ -24,9 +24,9 @@ #ifndef _IO_H #define _IO_H -inline unsigned char inportByte(unsigned int port); -inline unsigned char inportWord(unsigned int port); -inline void outportByte(unsigned int port,unsigned char value); -inline void outportWord(unsigned int port,unsigned int value); +inline unsigned char inportByte(unsigned int); +inline unsigned char inportWord(unsigned int); +inline void outportByte(unsigned int,unsigned char); +inline void outportWord(unsigned int,unsigned int); #endif \ No newline at end of file diff --git a/src/sys/init/main.c b/src/sys/init/main.c index 7d26940..a420133 100755 --- a/src/sys/init/main.c +++ b/src/sys/init/main.c @@ -35,84 +35,22 @@ #include #include #include -#include -descriptorTable(GDT,5) { +descriptorTable(GDT,6) { {dummy:0}, standardDescriptor(0x0, 0xFFFFF, (dCode + dRead + dBig + dBiglim)), standardDescriptor(0x0, 0xFFFFF, (dData + dWrite + dBig + dBiglim)), standardDescriptor(0x0, 0xFFFFF, (dLdt)), - standardDescriptor(100000, sizeof(struct tssStruct), (dTss)), -// standardDescriptor(0x4000, sizeof(struct tssStruct), (dTss)), + standardDescriptor(0x100000, sizeof(struct tssStruct), (dTss)), + standardDescriptor(0x4000, sizeof(struct tssStruct), (dTss)), }; struct { unsigned short limit __attribute__ ((packed)); union descriptorTableunion *gdt __attribute__ ((packed)); - } loadGdt = { (5 * sizeof(union descriptorTableunion) - 1), GDT }; + } loadGdt = { (6 * sizeof(union descriptorTableunion) - 1), GDT }; -typedef signed char Int8; -typedef signed short int Int16; -typedef signed long int Int32; - -typedef unsigned char UInt8; -typedef unsigned short int UInt16; -typedef unsigned long int UInt32; - -typedef struct { - UInt16 ModeAttributes; - UInt8 WindowAFlags; - UInt8 WindowBFlags; - UInt16 Granularity; - UInt16 WindowSize; - UInt16 WindowASeg; - UInt16 WindowBSeg; - void* BankSwitch; - UInt16 BytesPerLine; - UInt16 xRes, yRes; - UInt8 CharWidth; - UInt8 CharHeight; - UInt8 NumBitPlanes; - UInt8 BitsPerPixel; - UInt8 NumberOfBanks; - UInt8 MemoryModel; - UInt8 BankSize; - UInt8 NumOfImagePages; - UInt8 Reserved; - // Direct colour fields (required for Direct/6 and YUV/7 memory models - UInt8 RedMaskSize; - UInt8 RedFieldPosition; - UInt8 GreenMaskSize; - UInt8 GreenFieldPosition; - UInt8 BlueMaskSize; - UInt8 BlueFieldPosition; - UInt8 RsvdMaskSize; - UInt8 RsvdFieldPosition; - UInt8 DirectColourMode; - // VESA 2.0 specific fields - UInt32 PhysBasePtr; - void* OffScreenMemOffset; - UInt16 OffScreenMemSize; - UInt8 paddington[461]; - } TMode_Rec; - -typedef struct { - char VBESignature[4]; - UInt8 minVersion; - UInt8 majVersion; - char * OEMStringPtr; - UInt32 Capabilities; - UInt16* VideoModePtr; - UInt16 TotalMemory; - // VESA 2.0 specific fields - UInt16 OEMSoftwareRev; - char * OEMVendorNamePtr; - char * OEMProductNamePtr; - char * OEMProductRevPtr; - UInt8 paddington[474]; - } TVESA_Rec; - int main(); void _start(void) { @@ -150,16 +88,8 @@ 07/30/02 - I'm Considering Making The Kernel Fork Then Execute INIT However It Seems To Be Pretty Stable As Is -************************************************************************/ +************************************************************************/ int main() { - /* - long i = 0x0; - long xx = 0x0,yy = 0x0,zz = 0x0; - uLong *testBuffer = 0x40000000; - TMode_Rec *testVesa = 0x1000; - */ - char *a; - char *b; initMmap(); //Initialize Memory Map clearScreen(); //Clear The Screen outputVersion(); //Display Version Info @@ -168,80 +98,12 @@ init8259(); //Initialize PIC initIdt(); //Initialize IDT initKeyboard(); //Initialize Keyboar - /* - a = kmalloc(3); - b = kmalloc(5); - kprintf("[%x][%x]\n",a,b); - memset(b,'\0',5); - memset(a,'\0',3); - a[0] = 'P'; - a[1] = 'a'; - a[2] = 't'; - b[0] = 's'; - b[1] = 'u'; - b[2] = 'c'; - b[3] = 'k'; - b[4] = 's'; - kprintf("[%s]",a); - kprintf("[%s]",b); - kprintf("\n"); - */ initScheduler(); //Initialize Scheduler initFloppy(); //Initialize Floppy Controller initUbixFS(); //Initialize File System - /* - kprintf("PhysBasePtr: [%i]\n",testVesa->PhysBasePtr); - kprintf("BytesPerLine: [%i]\n",testVesa->BytesPerLine); - kprintf("xRes: [%i]\n",testVesa->xRes); - kprintf("yRes: [%i]\n",testVesa->yRes); - kprintf("BitsPerPixel: [%i]\n",testVesa->BitsPerPixel); - kprintf("NumberOfBanks: [%i]\n",testVesa->NumberOfBanks); - while(1); - */ - - /* - for (i=0;i<=(((testVesa->xRes*testVesa->yRes)*(testVesa->BitsPerPixel/1))+(0x1000-1));i+=0x1000) { - remapPage((testVesa->PhysBasePtr + i),(0x40000000 + i)); - } - while (1) { - for (zz=0; zz<64; zz++) - for (yy=-128; yy<=128; yy++) - for (xx=-128; xx<=128; xx++) - testBuffer[(yy+128)*(800*2)+((xx+128)*2)]=xx*yy*zz; - for (zz=0; zz<64; zz++) - for (yy=128; yy>=-128;yy --) - for (xx=128; xx>=-128; xx--) - testBuffer[(yy+128)*(800*2)+((xx+128)*2)]=xx*yy*zz; - } - */ - /* - for (yy = 0;yy < 256;yy++) { - for (xx = 0;xx < 256;xx++) { - testBuffer[yy*800+xx] = (char)xx; - } - } - */ - /* - for (i=0;i<((testVesa->xRes*testVesa->yRes)*4);i++) { - for (zz=0;zz<=0x10;zz++) { - for (xx=0;xx<=0x10;xx++); - } - testBuffer[i] = i; - } - - for (i=0;i<((testVesa->xRes*testVesa->yRes)*4);i++) { - for (zz=0;zz<=0x10;zz++) { - for (xx=0;xx<=0x10;xx++); - } - testBuffer[i] = (i/2); - } - */ execThread(idleThread,0xAFFF,"Idle Thread"); execFile("init"); kprintf("Free Pages: [%i]\n",freePages); - //outportByte(0x43,0x36); - //outportByte(0x40,((1193180/1000) & 0xFF)); - //outportByte(0x40,(((1193180/1000) << 8) & 0xFF)); enableIrq(0); while (1); } diff --git a/src/sys/kernel/io.c b/src/sys/kernel/io.c index f21a2fc..7f7ae15 100755 --- a/src/sys/kernel/io.c +++ b/src/sys/kernel/io.c @@ -21,7 +21,13 @@ **************************************************************************************/ -/* Input One Byte From A Port */ +/************************************************************************ + +Function: inline unsigned char inportByte(unsigned int port); +Description: This Funciton Will Input One Byte From A Port +Notes: + +************************************************************************/ inline unsigned char inportByte(unsigned int port) { unsigned char retVal; asm volatile( @@ -32,7 +38,13 @@ return(retVal); } -/* Input One Word From A Port */ +/************************************************************************ + +Function: inline unsigned char inportWord(unsigned int port); +Description: This Funciton Will Input One Word From A Port +Notes: + +************************************************************************/ inline unsigned char inportWord(unsigned int port) { unsigned char retVal; asm volatile( @@ -43,7 +55,13 @@ return(retVal); } -/* Output One Byte To A Port */ +/************************************************************************ + +Function: inline void outportByte(unsigned int port,unsigned char value); +Description: This Funciton Will Outputut One Byte To A Port +Notes: + +************************************************************************/ inline void outportByte(unsigned int port,unsigned char value) { asm volatile( "outb %%al,%%dx" @@ -52,7 +70,13 @@ ); } -/* Output On Word To A Port */ +/************************************************************************ + +Function: inline void outportWord(unsigned int port,unsigned char value); +Description: This Funciton Will Outputut One Word To A Port +Notes: + +************************************************************************/ inline void outportWord(unsigned int port,unsigned int value) { asm volatile( "outw %%ax,%%dx" diff --git a/src/sys/vmm/memory.c b/src/sys/vmm/memory.c index c833773..b7c8921 100755 --- a/src/sys/vmm/memory.c +++ b/src/sys/vmm/memory.c @@ -197,7 +197,7 @@ uLong *tmpPageTable = 0x0; uLong *tmpPageDir = (uLong *)parentPageDirAddr; //Check Page Directory For An Avail Page Table - for (i=0;i