diff --git a/src/sys/include/sys/idt.h b/src/sys/include/sys/idt.h index 2a57da8..2673e21 100644 --- a/src/sys/include/sys/idt.h +++ b/src/sys/include/sys/idt.h @@ -38,31 +38,20 @@ #define EFLAG_IOPL3 0x3000 #define EFLAG_VM 0x20000 -int idt_init(); -void setVector(void *handler, unsigned char interrupt, unsigned short controlMajor); -void setTaskVector(uInt8 interrupt,uInt16 controlMajor,uInt8 selector); -void intNull(); +int idt_init(); +void idt_setVector(void *handler, unsigned char interrupt, unsigned short controlMajor); +void idt_setTaskVector(uInt8 interrupt,uInt16 controlMajor,uInt8 selector); -void _int0(); -void _int1(); -void _int2(); -void _int3(); -void _int4(); -void _int5(); -void _int6(); -void _int7(); -void _int8(); -void _int9(); -void _int10(); -void _int11(); -void _int12(); -void _int13(); void timerInt(); #endif /*** $Log$ + Revision 1.3 2004/07/09 13:16:41 reddawg + idt: idtInit to idt_init + Adjusted Startup Routines + Revision 1.2 2004/05/21 15:12:17 reddawg Cleaned up diff --git a/src/sys/include/vfs/mount.h b/src/sys/include/vfs/mount.h index f047c88..117ad98 100644 --- a/src/sys/include/vfs/mount.h +++ b/src/sys/include/vfs/mount.h @@ -35,8 +35,8 @@ typedef struct vfs_mountPoint { struct vfs_mountPoint *prev; struct vfs_mountPoint *next; - struct fileSystem *fs; - struct device_node *device; + struct fileSystem *fs; + struct device_node *device; struct ubixDiskLabel *diskLabel; void *fsInfo; int partition; diff --git a/src/sys/init/main.c b/src/sys/init/main.c index 10682ca..3e2ea66 100644 --- a/src/sys/init/main.c +++ b/src/sys/init/main.c @@ -81,7 +81,9 @@ *****************************************************************************************/ int main() { int i = 0x0; - clearScreen(); /* Do A Clear Screen Just To Make The TEXT Buffer Nice And Empty */ + + /* Do A Clear Screen Just To Make The TEXT Buffer Nice And Empty */ + clearScreen(); /* Modify src/sys/include/ubixos/init.h to add a startup routine */ for (i=0x0;ifreePages); kprintf("MemoryMap: [0x%X]\n",vmmMemoryMap); kprintf("Starting Os\n"); irqEnable(0x0); - while (1); + while (0x1) + asm("nop"); return(0x0); } /*** $Log$ + Revision 1.79 2004/08/25 22:02:41 reddawg + task switching - We now are using software switching to be consistant with the rest of the world because all of this open source freaks gave me a hard time about something I liked. There doesn't seem to be any gain in performance but it is working fine and flawlessly + Revision 1.78 2004/08/24 23:33:45 reddawg Fixed diff --git a/src/sys/init/start.S b/src/sys/init/start.S index 89fc321..643d4bf 100644 --- a/src/sys/init/start.S +++ b/src/sys/init/start.S @@ -46,8 +46,8 @@ lldt %ax mov $0x20,%ax ltr %ax - ljmp $0x08,$next -next: + ljmp $0x08,$start_next +start_next: call main .data @@ -55,6 +55,12 @@ /*** $Log$ + Revision 1.3 2004/07/21 23:05:05 reddawg + last round of fixed + main.c: removed kernel stack + start.S: added kernel stack thanks to tip off from BJ about .comm + init.h: re-enabled ipStack + Revision 1.2 2004/07/21 22:01:24 reddawg Fixed diff --git a/src/sys/isa/atkbd.c b/src/sys/isa/atkbd.c index 2b4241a..e31b1c3 100644 --- a/src/sys/isa/atkbd.c +++ b/src/sys/isa/atkbd.c @@ -150,7 +150,7 @@ ************************************************************************/ int atkbd_init() { /* Insert the IDT vector for the keyboard handler */ - setVector(&atkbd_isr, mVec+0x1, dPresent + dInt + dDpl0); + idt_setVector(&atkbd_isr, mVec+0x1, dPresent + dInt + dDpl0); /* Set the LEDS to their defaults */ setLED(); @@ -314,6 +314,9 @@ /*** $Log$ + Revision 1.23 2004/08/21 23:47:50 reddawg + *** empty log message *** + Revision 1.22 2004/08/09 12:58:05 reddawg let me know when you got the surce diff --git a/src/sys/isa/fdc.c b/src/sys/isa/fdc.c index 71b8e84..4867383 100644 --- a/src/sys/isa/fdc.c +++ b/src/sys/isa/fdc.c @@ -62,7 +62,7 @@ int fdc_init() { struct device_interface *devInfo = (struct device_interface *)kmalloc(sizeof(struct device_interface)); - setVector(floppyIsr, mVec+6, (dInt+dPresent)); + idt_setVector(floppyIsr, mVec+6, (dInt+dPresent)); irqEnable(6); reset(); devInfo->major = 0x0; @@ -314,6 +314,9 @@ /*** $Log$ + Revision 1.22 2004/08/21 20:06:28 reddawg + ok check out exec.c + Revision 1.21 2004/08/15 16:47:49 reddawg Fixed diff --git a/src/sys/isa/mouse.c b/src/sys/isa/mouse.c index a26b4c1..2f23d3d 100644 --- a/src/sys/isa/mouse.c +++ b/src/sys/isa/mouse.c @@ -115,7 +115,7 @@ kbdWrite(0x64, 0xD4); kbdWriteRead(0x60, 0xF4,"\xFA"); - setVector(&mouseISR, mVec+12, dPresent + dInt + dDpl3); + idt_setVector(&mouseISR, mVec+12, dPresent + dInt + dDpl3); outportByte(mPic, eoi); outportByte(sPic, eoi); @@ -149,6 +149,9 @@ /*** $Log$ + Revision 1.1 2004/06/04 10:20:53 reddawg + mouse drive: fixed a few bugs works a bit better now + END ***/ diff --git a/src/sys/isa/ne2k.c b/src/sys/isa/ne2k.c index 989a76d..d7edcba 100644 --- a/src/sys/isa/ne2k.c +++ b/src/sys/isa/ne2k.c @@ -68,7 +68,7 @@ mDev = (struct device *)kmalloc(sizeof(struct device)); mDev->ioAddr = 0x280; mDev->irq = 10; - setVector(&ne2kISR, mVec+10, dPresent + dInt + dDpl3); + idt_setVector(&ne2kISR, mVec+10, dPresent + dInt + dDpl3); irqEnable(10); // kprintf("ne0 - irq: %i, ioAddr: 0x%X MAC: %X:%X:%X:%X:%X:%X\n",dev->irq,dev->ioAddr,dev->net->mac[0] & 0xFF,dev->net->mac[1] & 0xFF,dev->net->mac[2] & 0xFF,dev->net->mac[3] & 0xFF,dev->net->mac[4] & 0xFF,dev->net->mac[5] & 0xFF); @@ -343,6 +343,9 @@ /*** $Log$ + Revision 1.17 2004/08/01 20:40:45 reddawg + Net related fixes + Revision 1.16 2004/07/28 22:23:02 reddawg make sure it still works before I goto bed diff --git a/src/sys/kernel/fork.c b/src/sys/kernel/fork.c index b29fc1d..f3492f7 100644 --- a/src/sys/kernel/fork.c +++ b/src/sys/kernel/fork.c @@ -66,8 +66,6 @@ ); int forkCopyProcess(struct taskStruct *newProcess,long ebp,long edi,long esi,long none,long ebx,long ecx,long edx,long eip,long cs,long eflags,long esp,long ss) { - assert(newProcess); - assert(_current); sprintf(newProcess->oInfo.cwd,_current->oInfo.cwd); newProcess->oInfo.vmStart = _current->oInfo.vmStart; @@ -76,10 +74,10 @@ newProcess->gid = _current->gid; newProcess->parentPid = _current->id; newProcess->term->owner = newProcess->id; - newProcess->iframe->gs = 0x33;//_current->iframe->gs; - newProcess->iframe->fs = 0x33;//_current->iframe->gs; - newProcess->iframe->es = 0x33;//_current->iframe->es; - newProcess->iframe->ds = 0x33;//_current->iframe->ds; + newProcess->iframe->gs = 0x33; + newProcess->iframe->fs = 0x33; + newProcess->iframe->es = 0x33; + newProcess->iframe->ds = 0x33; newProcess->iframe->ss = 0x10; newProcess->iframe->edi = edi; newProcess->iframe->esi = esi; @@ -109,6 +107,24 @@ /*** $Log$ + Revision 1.29 2004/08/26 22:51:18 reddawg + TCA touched me :( i think he likes men.... + + + sched.h: kTask_t added parentPid + endtask.c: fixed term back to parentPid + exec.c: cleaned warnings + fork.c: fixed term to childPid + sched.c: clean up for dead tasks + systemtask.c: clean up dead tasks + kmalloc.c: cleaned up warnings + udp.c: cleaned up warnings + bot.c: cleaned up warnings + shell.c: cleaned up warnings + tcpdump.c: took a dump + hd.c: cleaned up warnings + ubixfs.c: stopped prning debug info + Revision 1.28 2004/08/25 22:02:41 reddawg task switching - We now are using software switching to be consistant with the rest of the world because all of this open source freaks gave me a hard time about something I liked. There doesn't seem to be any gain in performance but it is working fine and flawlessly diff --git a/src/sys/kernel/timer.S b/src/sys/kernel/timer.S index 466c2c0..b82e5ab 100644 --- a/src/sys/kernel/timer.S +++ b/src/sys/kernel/timer.S @@ -38,17 +38,17 @@ push %fs push %gs movl systemVitals,%ecx /* Put Location Of System Vitals Into ECX */ - incl 4(%ecx) /* Increment sysTicks our 1000ms counter */ - movl 4(%ecx),%eax /* Increment our sysUptime by 1S if 1000MS */ + incl 0x4(%ecx) /* Increment sysTicks our 1000ms counter */ + movl 0x4(%ecx),%eax /* Increment our sysUptime by 1S if 1000MS */ movl $200,%ebx /* Have Passed */ xor %edx,%edx div %ebx test %edx,%edx - jnz next - incl 8(%ecx) -next: - movl 4(%ecx),%eax /* Test If quantum Has Passed If So Then */ - movl 12(%ecx),%ebx /* We Can CALL sched */ + jnz timer_next + incl 0x8(%ecx) +timer_next: + movl 0x4(%ecx),%eax /* Test If quantum Has Passed If So Then */ + movl 0xC(%ecx),%ebx /* We Can CALL sched */ xor %edx,%edx div %ebx test %edx,%edx @@ -69,6 +69,12 @@ /*** $Log$ + Revision 1.10 2004/08/29 21:43:06 reddawg + sched: we now yeild almost propper + syscall: it still uses ebx,ecx,edx + + Boys don't cry + Revision 1.9 2004/08/24 05:24:37 reddawg TCA Is A BONER!!!! diff --git a/src/sys/kernel/vitals.c b/src/sys/kernel/vitals.c index 3a6f393..ad44726 100644 --- a/src/sys/kernel/vitals.c +++ b/src/sys/kernel/vitals.c @@ -31,6 +31,7 @@ #include #include #include +#include vitalsNode *systemVitals = 0x0; @@ -54,16 +55,10 @@ } /* Set all default values */ - systemVitals->freePages = 0x0; - systemVitals->sysTicks = 0x0; - systemVitals->sysUptime = 0x0; + memset(systemVitals,0x0,sizeof(vitalsNode)); + systemVitals->quantum = 8; systemVitals->dQuantum = 8; - systemVitals->fileSystems = 0x0; - systemVitals->mountPoints = 0x0; - systemVitals->timeStart = 0x0; - systemVitals->screen = 0x0; - systemVitals->font = 0x0; /* Print Out Info For Vitals: */ kprintf("vitals0 - Address: [0x%X]\n",systemVitals); @@ -74,6 +69,9 @@ /*** $Log$ + Revision 1.10 2004/08/14 11:23:02 reddawg + Changes + Revision 1.9 2004/07/19 01:56:56 reddawg vitals: cleaned up all defaults this should not cause any problems in the future diff --git a/src/sys/lib/kmalloc.c b/src/sys/lib/kmalloc.c index c71d9e0..149c55d 100644 --- a/src/sys/lib/kmalloc.c +++ b/src/sys/lib/kmalloc.c @@ -180,6 +180,7 @@ 03/05/03 - We Have A Problem It Seems The First Block Is Limit 0x0 ************************************************************************/ +#if 0 static void mergeMemBlocks() { struct memDescriptor *tmpDesc1 = 0x0; struct memDescriptor *tmpDesc2 = 0x0; @@ -230,6 +231,7 @@ } return; } +#endif /************************************************************************ @@ -367,7 +369,7 @@ kprintf("kfree tmpDesc1: [%i]\n",tmpDesc1->limit); insertFreeDesc(tmpDesc1); - mergeMemBlocks(); + //mergeMemBlocks(); spinUnlock(&mallocSpinLock); return; } @@ -379,6 +381,24 @@ /*** $Log$ + Revision 1.22 2004/08/26 22:51:18 reddawg + TCA touched me :( i think he likes men.... + + + sched.h: kTask_t added parentPid + endtask.c: fixed term back to parentPid + exec.c: cleaned warnings + fork.c: fixed term to childPid + sched.c: clean up for dead tasks + systemtask.c: clean up dead tasks + kmalloc.c: cleaned up warnings + udp.c: cleaned up warnings + bot.c: cleaned up warnings + shell.c: cleaned up warnings + tcpdump.c: took a dump + hd.c: cleaned up warnings + ubixfs.c: stopped prning debug info + Revision 1.21 2004/07/28 15:05:43 reddawg Major: Pages now have strict security enforcement. diff --git a/src/sys/sys/idt.c b/src/sys/sys/idt.c index f8ecf7f..ccf472e 100644 --- a/src/sys/sys/idt.c +++ b/src/sys/sys/idt.c @@ -51,188 +51,72 @@ (256 * sizeof(union descriptorTableUnion) - 1), ubixIDT }; -/************************************************************************ - -Function: int idtInit() -Description: This function is used to enable our IDT subsystem -Notes: - -02/20/2004 - Approved for quality - -************************************************************************/ -int idt_init() { - int i = 0x0; - - struct tssStruct *sfTSS = (struct tssStruct *)0x6200; - struct tssStruct *gpfTSS = (struct tssStruct *)0x4200; - - /* Set up default vector table for all possible 256 interrupts */ - - for (i = 0x0; i < 256; i++) { - setVector(intNull, i, dPresent + dInt + dDpl3); - } - - /* Load the IDT into the system */ - asm volatile( - "cli \n" - "lidt (%0) \n" /* Load the IDT */ - "pushfl \n" /* Clear the NT flag */ - "andl $0xffffbfff,(%%esp) \n" - "popfl \n" - "sti \n" - : - : "r" ((char *)&loadidt) - ); - - /* Set up the basic vectors for the reserved ints */ - setVector(_int0, 0, dPresent + dInt + dDpl0); - setVector(_int1, 1, dPresent + dInt + dDpl0); - setVector(_int2, 2, dPresent + dInt + dDpl0); - setVector(_int3, 3, dPresent + dInt + dDpl0); - setVector(_int4, 4, dPresent + dInt + dDpl0); - setVector(_int5, 5, dPresent + dInt + dDpl0); - setVector(_int6, 6, dPresent + dInt + dDpl0); - setVector(_int7,7,dPresent + dInt + dDpl0); - setTaskVector(8,dPresent + dTask + dDpl0, 0x40); - setVector(_int9, 9, dPresent + dInt + dDpl0); - setVector(_int10, 10, dPresent + dInt + dDpl0); - setVector(_int11, 11, dPresent + dInt + dDpl0); - setVector(_int12, 12, dPresent + dInt + dDpl0); - setTaskVector(13, dPresent + dTask + dDpl0, 0x38); - setVector(_vmm_pageFault, 14, dPresent + dInt + dDpl0); - setVector(_sysCall, 128, dPresent + dTrap + dDpl3); - setVector(_sysCallNew, 0x90, dPresent + dTrap + dDpl3); - setVector(timerInt, 0x68, (dInt + dPresent + dDpl0)); - - - gpfTSS->back_link = 0x0; - gpfTSS->esp0 = 0x0; - gpfTSS->ss0 = 0x0; - gpfTSS->esp1 = 0x0; - gpfTSS->ss1 = 0x0; - gpfTSS->esp2 = 0x0; - gpfTSS->ss2 = 0x0; - gpfTSS->cr3 = (unsigned int)kernelPageDirectory; - gpfTSS->eip = (unsigned int)&_int13; - gpfTSS->eflags = 0x206; - gpfTSS->esp = 0x1D000; - gpfTSS->ebp = 0x1D000; - gpfTSS->esi = 0x0; - gpfTSS->edi = 0x0; - gpfTSS->es = 0x10; - gpfTSS->cs = 0x08; - gpfTSS->ss = 0x10; - gpfTSS->ds = 0x10; - gpfTSS->fs = 0x10; - gpfTSS->gs = 0x10; - gpfTSS->ldt = 0x0; - gpfTSS->trace_bitmap = 0x0000; - gpfTSS->io_map = 0x8000; - - memset(sfTSS,0x0,sizeof(struct tssStruct)); - sfTSS->cr3 = (unsigned int)kernelPageDirectory; - sfTSS->eip = (unsigned int)&_int8; - sfTSS->eflags = 0x206; - sfTSS->esp = 0x1C000; - sfTSS->ebp = 0x1C000; - sfTSS->es = 0x10; - sfTSS->cs = 0x08; - sfTSS->ss = 0x10; - sfTSS->ds = 0x10; - sfTSS->fs = 0x10; - sfTSS->gs = 0x10; - sfTSS->io_map = 0x8000; - - /* Print out information for the IDT */ - kprintf("idt0 - Address: [0x%X]\n", &ubixIDT); - - /* Return so we know all went well */ - return (0x0); - } - - -/* Sets Up IDT Vector */ -void setVector(void *handler, unsigned char interrupt, unsigned short controlMajor) { - unsigned short codesegment = 0x08; - asm volatile ("movw %%cs,%0":"=g" (codesegment)); - - ubixIDT[interrupt].gate.offsetLow = (unsigned short)(((unsigned long)handler) & 0xffff); - ubixIDT[interrupt].gate.selector = codesegment; - ubixIDT[interrupt].gate.access = controlMajor; - ubixIDT[interrupt].gate.offsetHigh = (unsigned short)(((unsigned long)handler) >> 16); -} - -/************************************************************************ - -Function: void setTaskVector(uInt8,uInt16,uInt8); -Description: This Function Sets Up An IDT Task Vector -Notes: - -************************************************************************/ -void -setTaskVector(uInt8 interrupt, uInt16 controlMajor, uInt8 selector) -{ - uInt16 codesegment = 0x08; - asm volatile ("movw %%cs,%0":"=g" (codesegment)); - - ubixIDT[interrupt].gate.offsetLow = 0x0; - ubixIDT[interrupt].gate.selector = selector; - ubixIDT[interrupt].gate.access = controlMajor; - ubixIDT[interrupt].gate.offsetHigh = 0x0; -} - +void sched_yield_new(); /* Null Intterupt Descriptor */ -void intNull() { +static void intNull() { kpanic("Invalid Interrupt[%i]\n",_current->id); - while (1); endTask(_current->id); sched_yield(); } -void _int0() { +static void _int0() { kpanic("int0: Divide-by-Zero [%i]\n",_current->id); endTask(_current->id); sched_yield(); } -void _int1() { +static void _int1() { kpanic("int1: Debug exception [%i]\n",_current->id); endTask(_current->id); sched_yield(); } -void _int2() { +static void _int2() { kpanic("int2: unknown error [%i]\n",_current->id); endTask(_current->id); sched_yield(); } -void _int3() { +static void _int3() { kpanic("int3: Breakpoint [%i]\n",_current->id); endTask(_current->id); sched_yield(); } -void _int4(){ +static void _int4(){ kpanic("int4: Overflow [%i]\n",_current->id); endTask(_current->id); sched_yield(); } -void _int5() { +static void _int5() { kpanic("int5: Bounds check [%i]\n",_current->id); endTask(_current->id); sched_yield(); } -void _int6() { +static void _int6() { kpanic("int6: Invalid opcode! [%i]\n",_current->id); endTask(_current->id); sched_yield(); } + +static void _int7(); +asm( + "_int7: \n" + " pushl %eax \n" + " clts \n" + " movl _current,%eax \n" + " cmpl _usedMath,%eax \n" + " je mathDone \n" + " call mathStateRestore \n" + "mathDone: \n" + " popl %eax \n" + " iret \n" + ); -void _int8() { +static void _int8() { struct tssStruct *sfTSS = (struct tssStruct *)0x6200; kpanic("int8: Double Fault! [%i]\n",_current->id); sfTSS->cr3 = (unsigned int)kernelPageDirectory; @@ -250,38 +134,38 @@ while (1); } -void _int9() { +static void _int9() { kpanic("int9: Coprocessor Segment Overrun! [%i]\n",_current->id); endTask(_current->id); sched_yield(); } -void _int10() { +static void _int10() { kpanic("int10: Invalid TSS! [%i]\n",_current->id); endTask(_current->id); sched_yield(); } -void _int11() { +static void _int11() { kpanic("int11: Segment Not Present! [%i]\n",_current->id); endTask(_current->id); sched_yield(); } -void _int12() { +static void _int12() { kpanic("int12: Stack-Segment Fault! [%i]\n",_current->id); endTask(_current->id); sched_yield(); } -void _int13() { +static void _int13() { uInt8 *ip = 0x0; uInt16 *stack = 0x0, *ivt = 0x0; uInt32 *stack32 = 0x0; bool isOperand32 = FALSE, isAddress32 = FALSE; struct tssStruct *gpfTSS = (struct tssStruct *)0x4200; - kpanic("GPF!!!\n"); + kpanic("GPF!!! %i\n",_current->id); irqDisable(0x0); @@ -442,24 +326,147 @@ //Return } + +/***************************************************************************************** + Functoin: int idt_init() + + Desc: This function is used to initialize our IDT -void _int7(); -asm( - ".globl _int7 \n" - "_int7: \n" - " pushl %eax \n" - " clts \n" - " movl _current,%eax \n" - " cmpl _usedMath,%eax \n" - " je mathDone \n" - " call mathStateRestore \n" - "mathDone: \n" - " popl %eax \n" - " iret \n" - ); + Notes: + +*****************************************************************************************/ +int idt_init() { + int i = 0x0; + + struct tssStruct *sfTSS = (struct tssStruct *)0x6200; + struct tssStruct *gpfTSS = (struct tssStruct *)0x4200; + + /* Set up default vector table for all possible 256 interrupts */ + + for (i = 0x0; i < 256; i++) { + idt_setVector(intNull, i, dPresent + dInt + dDpl3); + } + + /* Load the IDT into the system */ + asm volatile( + "cli \n" + "lidt (%0) \n" /* Load the IDT */ + "pushfl \n" /* Clear the NT flag */ + "andl $0xffffbfff,(%%esp) \n" + "popfl \n" + "sti \n" + : + : "r" ((char *)&loadidt) + ); + + /* Set up the basic vectors for the reserved ints */ + idt_setVector(_int0, 0, dPresent + dInt + dDpl0); + idt_setVector(_int1, 1, dPresent + dInt + dDpl0); + idt_setVector(_int2, 2, dPresent + dInt + dDpl0); + idt_setVector(_int3, 3, dPresent + dInt + dDpl0); + idt_setVector(_int4, 4, dPresent + dInt + dDpl0); + idt_setVector(_int5, 5, dPresent + dInt + dDpl0); + idt_setVector(_int6, 6, dPresent + dInt + dDpl0); + idt_setVector(_int7,7,dPresent + dInt + dDpl0); + idt_setTaskVector(8,dPresent + dTask + dDpl0, 0x40); + idt_setVector(_int9, 9, dPresent + dInt + dDpl0); + idt_setVector(_int10, 10, dPresent + dInt + dDpl0); + idt_setVector(_int11, 11, dPresent + dInt + dDpl0); + idt_setVector(_int12, 12, dPresent + dInt + dDpl0); + idt_setTaskVector(13, dPresent + dTask + dDpl0, 0x38); + idt_setVector(_vmm_pageFault, 14, dPresent + dInt + dDpl0); + idt_setVector(sched_yield_new,0x69,dPresent + dInt + dDpl3); + idt_setVector(_sysCall, 128, dPresent + dTrap + dDpl3); + idt_setVector(_sysCallNew, 0x90, dPresent + dTrap + dDpl3); + idt_setVector(timerInt, 0x68, (dInt + dPresent + dDpl0)); + + /* Build our GPF TSS */ + memset(gpfTSS,0x0,sizeof(struct tssStruct)); + gpfTSS->cr3 = (unsigned int)kernelPageDirectory; + gpfTSS->eip = (unsigned int)&_int13; + gpfTSS->eflags = 0x206; + gpfTSS->esp = 0x1D000; + gpfTSS->ebp = 0x1D000; + gpfTSS->es = 0x10; + gpfTSS->cs = 0x08; + gpfTSS->ss = 0x10; + gpfTSS->ds = 0x10; + gpfTSS->fs = 0x10; + gpfTSS->gs = 0x10; + gpfTSS->trace_bitmap = 0x0000; + gpfTSS->io_map = 0x8000; + + /* Build our SF TFF */ + memset(sfTSS,0x0,sizeof(struct tssStruct)); + sfTSS->cr3 = (unsigned int)kernelPageDirectory; + sfTSS->eip = (unsigned int)&_int8; + sfTSS->eflags = 0x206; + sfTSS->esp = 0x1C000; + sfTSS->ebp = 0x1C000; + sfTSS->es = 0x10; + sfTSS->cs = 0x08; + sfTSS->ss = 0x10; + sfTSS->ds = 0x10; + sfTSS->fs = 0x10; + sfTSS->gs = 0x10; + sfTSS->io_map = 0x8000; + + /* Print out information for the IDT */ + kprintf("idt0 - Address: [0x%X]\n", &ubixIDT); + + /* Return so we know all went well */ + return (0x0); + } + +/***************************************************************************************** + Functoin: int idt_setVector(handler,interrupt,controlMajor) + + Desc: This function is used to set up a vector in the IDT + + Notes: + +*****************************************************************************************/ +void idt_setVector(void *handler, unsigned char interrupt, unsigned short controlMajor) { + unsigned short codesegment = 0x08; + + asm volatile( + "movw %%cs,%0" + : "=g" (codesegment) + ); + + ubixIDT[interrupt].gate.offsetLow = (unsigned short)(((unsigned long)handler) & 0xffff); + ubixIDT[interrupt].gate.selector = codesegment; + ubixIDT[interrupt].gate.access = controlMajor; + ubixIDT[interrupt].gate.offsetHigh = (unsigned short)(((unsigned long)handler) >> 16); + } + +/***************************************************************************************** + Functoin: int idt_setTaskVector(interrupt,controlMajor,selector) + + Desc: This function is used to set up a task vector in the IDT + + Notes: + +*****************************************************************************************/ +void idt_setTaskVector(uInt8 interrupt, uInt16 controlMajor, uInt8 selector) { + uInt16 codesegment = 0x08; + + asm volatile( + "movw %%cs,%0" + : "=g" (codesegment) + ); + + ubixIDT[interrupt].gate.offsetLow = 0x0; + ubixIDT[interrupt].gate.selector = selector; + ubixIDT[interrupt].gate.access = controlMajor; + ubixIDT[interrupt].gate.offsetHigh = 0x0; + } /*** $Log$ + Revision 1.34 2004/08/25 22:02:41 reddawg + task switching - We now are using software switching to be consistant with the rest of the world because all of this open source freaks gave me a hard time about something I liked. There doesn't seem to be any gain in performance but it is working fine and flawlessly + Revision 1.33 2004/08/24 23:33:45 reddawg Fixed