diff --git a/src/sys/include/sys/gdt.h b/src/sys/include/sys/gdt.h index a38e234..ea8c3d3 100644 --- a/src/sys/include/sys/gdt.h +++ b/src/sys/include/sys/gdt.h @@ -70,18 +70,23 @@ unsigned short offsetHigh; /* Offset 16..31 */ } __attribute__ ((packed)); -union descriptorTableunion { +union descriptorTableUnion { struct gdtDescriptor descriptor; /* Normal descriptor */ struct gdtGate gate; /* Gate descriptor */ unsigned long dummy; /* Any other info */ }; -#define descriptorTable(name,length) union descriptorTableunion name[length] = -#define standardDescriptor(base, limit, control) {descriptor: {(limit & 0xffff), (base & 0xffff), ((base >> 16) & 0xff), \ - ((control+dPresent) >> 8), (limit >> 16), \ - ((control & 0xff) >> 4), (base >> 24)}} -#define gateDescriptor(offset, selector, control) {gate: {(offset & 0xffff), selector, \ +#define ubixDescriptorTable(name,length) union descriptorTableUnion name[length] = +#define ubixStandardDescriptor(base, limit, control) {descriptor: \ + {(limit & 0xffff), \ + (base & 0xffff), \ + ((base >> 16) & 0xff), \ + ((control+dPresent) >> 8), \ + (limit >> 16), \ + ((control & 0xff) >> 4), \ + (base >> 24)}} +#define ubixGateDescriptor(offset, selector, control) {gate: {(offset & 0xffff), selector, \ (control+dPresent), (offset >> 16) }} #endif diff --git a/src/sys/init/main.c b/src/sys/init/main.c index 465eb1c..ddd9de8 100644 --- a/src/sys/init/main.c +++ b/src/sys/init/main.c @@ -24,46 +24,16 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. $Log$ - Revision 1.10 2004/04/29 15:32:58 reddawg - I forgot i changed mount format - - Revision 1.9 2004/04/29 15:29:20 reddawg - Fixed All Running Issues - - Revision 1.8 2004/04/28 21:10:40 reddawg - Lots Of changes to make it work with existing os - Revision 1.7 2004/04/26 22:27:36 reddawg Now mounts our harddrive I need to either impliment fstab or do something similar Revision 1.6 2004/04/25 04:35:50 reddawg Minor bug fixes to set default partition information - Revision 1.5 2004/04/20 00:53:16 reddawg - Works - - Revision 1.4 2004/04/19 21:32:14 reddawg - Fixes: - - ne2k: - - we now have allocBuffer() and getBuffer() - alloc gets an avail buffer on the - memory ring for the nic and get will fetch the oldest buffer on there - - Revision 1.3 2004/04/15 12:53:08 reddawg - There Fixed - - Revision 1.2 2004/04/15 12:38:25 reddawg - Fixed to compile - - Revision 1.1.1.1 2004/04/15 12:06:45 reddawg - UbixOS v1.0 - Revision 1.107 2004/04/13 16:36:33 reddawg Changed our copyright, it is all now under a BSD-Style license - $Id$ *****************************************************************************************/ @@ -98,20 +68,20 @@ char kernelStack[8192]; // Stack Space For Our Kernel -descriptorTable(GDT,8) { +ubixDescriptorTable(ubixGDT,8) { {dummy:0}, - standardDescriptor(0x0, 0xFFFFF, (dCode + dRead + dBig + dBiglim)), - standardDescriptor(0x0, 0xFFFFF, (dData + dWrite + dBig + dBiglim)), - standardDescriptor(0x0, 0xFFFFF, (dLdt)), - standardDescriptor(0x4200, (sizeof(struct tssStruct)), (dTss)), - standardDescriptor(0x0, 0xFFFFF, (dCode + dWrite + dBig + dBiglim + dDpl3)), - standardDescriptor(0x0, 0xFFFFF, (dData + dWrite + dBig + dBiglim + dDpl3)), - standardDescriptor(0x4200, (sizeof(struct tssStruct)), (dTss)), + ubixStandardDescriptor(0x0, 0xFFFFF, (dCode + dRead + dBig + dBiglim)), + ubixStandardDescriptor(0x0, 0xFFFFF, (dData + dWrite + dBig + dBiglim)), + ubixStandardDescriptor(0x0, 0xFFFFF, (dLdt)), + ubixStandardDescriptor(0x4200, (sizeof(struct tssStruct)), (dTss)), + ubixStandardDescriptor(0x0, 0xFFFFF, (dCode + dWrite + dBig + dBiglim + dDpl3)), + ubixStandardDescriptor(0x0, 0xFFFFF, (dData + dWrite + dBig + dBiglim + dDpl3)), + ubixStandardDescriptor(0x4200, (sizeof(struct tssStruct)), (dTss)), }; struct { unsigned short limit __attribute__ ((packed)); union descriptorTableunion *gdt __attribute__ ((packed)); - } loadGdt = { (8 * sizeof(union descriptorTableunion) - 1), GDT }; + } loadGDT = { (8 * sizeof(union descriptorTableUnion) - 1), ubixGDT }; int main() { @@ -211,7 +181,7 @@ void _start(void) { asm ("pushl $2; popf"); asm volatile( - "lgdtl (loadGdt) \n" + "lgdtl (loadGDT) \n" "movw $0x10,%%ax \n" // Select Ring 0 Data Segment "movw %%ax,%%ds \n" // Set Default Segment "movw %%ax,%%es \n" // "" "" @@ -229,7 +199,7 @@ "nop\n" "next:\n" : - : "r" (GDT), "p" (kernelStack+8192) + : "r" (ubixGDT), "p" (kernelStack+8192) : "%eax" ); main(); diff --git a/src/sys/kernel/sched.c b/src/sys/kernel/sched.c index afffcc2..682f682 100644 --- a/src/sys/kernel/sched.c +++ b/src/sys/kernel/sched.c @@ -24,6 +24,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. $Log$ + Revision 1.1.1.1 2004/04/15 12:07:19 reddawg + UbixOS v1.0 + Revision 1.19 2004/04/13 16:16:44 reddawg Changed our copyright, it is all now under a BSD-Style license @@ -43,7 +46,7 @@ #include #include -extern union descriptorTableunion GDT[5]; +extern union descriptorTableUnion ubixGDT[5]; kTask_t *taskList = 0x0; uInt32 nextID = -1; @@ -116,10 +119,10 @@ //kprintf("v86Task\n"); irqDisable(0x0); } - GDT[4].descriptor.baseLow = (memAddr & 0xFFFF); - GDT[4].descriptor.baseMed = ((memAddr >> 16) & 0xFF); - GDT[4].descriptor.baseHigh = (memAddr >> 24); - GDT[4].descriptor.access = '\x89'; + ubixGDT[4].descriptor.baseLow = (memAddr & 0xFFFF); + ubixGDT[4].descriptor.baseMed = ((memAddr >> 16) & 0xFF); + ubixGDT[4].descriptor.baseHigh = (memAddr >> 24); + ubixGDT[4].descriptor.access = '\x89'; asm("ljmp $0x20,$0\n"); } return; diff --git a/src/sys/sys/idt.c b/src/sys/sys/idt.c index 32a9eed..b3b99ed 100644 --- a/src/sys/sys/idt.c +++ b/src/sys/sys/idt.c @@ -31,7 +31,6 @@ Changed our copyright, it is all now under a BSD-Style license - $Id$ *****************************************************************************************/ @@ -50,13 +49,13 @@ void mathStateRestore(); -descriptorTable(IDT, 256) { }; +ubixDescriptorTable(ubixIDT, 256) { }; struct { unsigned short limit __attribute__((packed)); - union descriptorTableunion *idt __attribute__((packed)); + union descriptorTableUnion *idt __attribute__((packed)); } loadidt = { - (256 * sizeof(union descriptorTableunion) - 1), IDT + (256 * sizeof(union descriptorTableUnion) - 1), ubixIDT }; /************************************************************************ @@ -137,7 +136,7 @@ /* Print out information for the IDT */ - kprintf("idt0 - Address: [0x%X]\n", &IDT); + kprintf("idt0 - Address: [0x%X]\n", &ubixIDT); /* Return so we know all went well */ return (0x0); @@ -151,10 +150,10 @@ unsigned short codesegment = 0x08; asm volatile ("movw %%cs,%0":"=g" (codesegment)); - IDT[interrupt].gate.offsetLow = (unsigned short)(((unsigned long)handler) & 0xffff); - IDT[interrupt].gate.selector = codesegment; - IDT[interrupt].gate.access = controlMajor; - IDT[interrupt].gate.offsetHigh = (unsigned short)(((unsigned long)handler) >> 16); + 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); } /************************************************************************ @@ -170,10 +169,10 @@ uInt16 codesegment = 0x08; asm volatile ("movw %%cs,%0":"=g" (codesegment)); - IDT[interrupt].gate.offsetLow = 0x0; - IDT[interrupt].gate.selector = selector; - IDT[interrupt].gate.access = controlMajor; - IDT[interrupt].gate.offsetHigh = 0x0; + ubixIDT[interrupt].gate.offsetLow = 0x0; + ubixIDT[interrupt].gate.selector = selector; + ubixIDT[interrupt].gate.access = controlMajor; + ubixIDT[interrupt].gate.offsetHigh = 0x0; }