OSDN Git Service

バグ修正,メッセージング機能向上
authorvosystems <doradora.motochan@gmail.com>
Wed, 15 Oct 2014 09:28:51 +0000 (18:28 +0900)
committervosystems <doradora.motochan@gmail.com>
Wed, 15 Oct 2014 09:28:51 +0000 (18:28 +0900)
Kernel/Interrupt.c
Kernel/Kernel.vsb
Kernel/Makefile
Kernel/Message.c
Kernel/boot.c
Kernel/scancode.c
Kernel/stdio.c
include/GDT_IDT.h
include/VaneOS.h
include/VaneOS.h~
include/stdio.h

index 1d8980a..6f024ae 100644 (file)
@@ -8,6 +8,7 @@
 #include<KeyBoard.h>
 #include<Interrupt.h>
 #include<scancode.h>
+#include<Message.h>
 //c4000
 #define EFLAGS_VM_CHANGE_86    (0x23000)
 
@@ -36,7 +37,7 @@ void timer_interrupt( void )
 
 void keyboard_interrupt( void )
 {
-       sendmsg(readKbdEncBuffer());
+       sendmsg((int)readKbdEncBuffer(),MSG_NUM_KEYBOARD);
 }
 
 inline void enable()
index 4637cb9..a57d495 100755 (executable)
Binary files a/Kernel/Kernel.vsb and b/Kernel/Kernel.vsb differ
index e47177f..d7818d3 100644 (file)
@@ -1,4 +1,4 @@
-TARGET      = Kernel.vsb
+TARGET      = ../bin/Kernel.vsb
 
 #宣言
 CC                     = gcc
index 83e6e0a..0c387b7 100644 (file)
@@ -4,7 +4,58 @@
 */
 
 #include<VaneOS.h>
+#include<Message.h>
 
+local struct mdt mbi[256];
+local struct Buf buf[256];
+
+void init_all(void)
+{
+       int i,j;
+       for(i=0;i<256;i++)
+       {
+               for(j=0;j<16;j++)
+               {
+                       buf[i].buffer[j]=0;
+               }
+               buf[i].top=0;
+               buf[i].buttom=0;
+       }
+       for(i=0;i<256;i++)
+       {
+               mbi[i].mbi_num=i;
+       }
+}
+
+int getmsg(int msg_num)
+{
+       if(buf[msg_num].buffer[buf[msg_num].top]==0){
+               return 0;
+       }else{
+               int re=buf[msg_num].buffer[buf[msg_num].top];
+               buf[msg_num].buffer[buf[msg_num].top]=0;
+               
+               if(buf[msg_num].top<256){
+                       buf[msg_num].top++;
+               }else{
+                       buf[msg_num].top=0;
+               }
+               return re;
+       }
+}
+
+void sendmsg(int msg,int msg_num)
+{
+       buf[msg_num].buffer[buf[msg_num].buttom]=msg;
+       
+       if(buf[msg_num].buttom<256){
+               buf[msg_num].buttom++;
+       }else{
+               buf[msg_num].buttom=0;
+       }
+       return;
+}
+/*
 struct Buf{
        unsigned short top,buttom;
        int buffer[256];
@@ -29,6 +80,7 @@ int getmsg(void)
        }else{
                kbd.top=0;
        }
+       if(re==0)kbd.top--;
        return re;
 }
 
@@ -42,4 +94,4 @@ void sendmsg(int msg)
                kbd.buttom=0;
        }
        return;
-}
+}*/
index 59246e7..6954ca5 100644 (file)
@@ -1,6 +1,6 @@
 /*!
-       \file boot.c
-       \Desc Kernel and Setting.
+       boot.c
+       Kernel and Setting.
        (C) 2013-2014 VOSystems.
 */
 
 
 #include<multiboot.h>
 #include<VaneOS.h>
+#include<GDT_IDT.h>
 #include<KeyBoard.h>
 #include<Interrupt.h>
-#include<GDT_IDT.h>
 #include<stdio.h>
 #include<scancode.h>
 #include<memory.h>
 #include<Graphic.h>
+#include<Message.h>
 
 /*PROTOTYPE*/
 void outPortByte( unsigned short address, unsigned char value );
@@ -37,9 +38,9 @@ void hlt(void);
        
        Set All & Call shell
        (C)2014 VOSystems.
-       \create 2014/09/23
-       \update 2014/09/27
-       \author 2m
+       create 2014/09/23
+       update 2014/10/15
+       author VOSystems
 */
 void cstart(unsigned long magic, unsigned long addr)
 {
@@ -47,7 +48,6 @@ void cstart(unsigned long magic, unsigned long addr)
        char cmd[100]={0};
        struct MEMMAN *memman=(struct MEMMAN*)MEMMAN_ADDR;
        multiboot_info_t *mbi;
-       drive_info *drv;
        
        mbi = (multiboot_info_t *) addr;
                
@@ -103,8 +103,8 @@ void cstart(unsigned long magic, unsigned long addr)
        keyboardEnableKBD();
        printOK("Init Keyboard.....");
        
-       bufinit();
-       printOK("Init Keyboard Buffer.....");
+       init_all();
+       printOK("Init Messaging Buffer.....");
        
        setPitCounter(100,DEF_PIT_COM_COUNTER0,DEF_PIT_COM_MODE_SQUAREWAVE);
        initPit();
@@ -125,30 +125,15 @@ void cstart(unsigned long magic, unsigned long addr)
        printf("\n~Memory Information~\nLowMemory = %d KiB , UpperMemory = %d KiB , TotalMemory = %d MiB\n\n",mbi->mem_lower,
                mbi->mem_upper,(mbi->mem_lower+mbi->mem_upper+1024)/1024);
        
+       
        printf("Free Memory = %d MiB\n\n",memman_total(memman)/(1024*1024));
        
        puts("KernelShell/Root/>");
+       int num;
+       char aaa[100]={"ASD"};
        scanf("%s",&cmd);
        printf("%s",cmd);
        
-       /*
-       if(Check_VESA()==0){
-               VESA_640_480_SET();
-       }else{
-               scrn320();
-       }*/
-       
-       ScreenVGA_Graphic();
-       printf("Successfully\n");
-       getchar();
-       int scrn_addr=vram_start_address;
-       char* p=(char*)scrn_addr;
-       for(p=(char*)scrn_addr;scrn_addr<=0x000affff;scrn_addr++)
-       {
-               p=(char*)scrn_addr;
-               *p=(char)scrn_addr & 0x0f;
-       }
-       
        while(1)hlt();
        return;
 }
index a1d706d..4d418fc 100644 (file)
@@ -1,12 +1,13 @@
 #include<scancode.h>
 #include<KeyBoard.h>
 #include<stdio.h>
+#include<Message.h>
 
 int shift_flag;
 
 char Generate_Scancode_To_ASCII_Code(void)
 {
-       unsigned char scode=getmsg();
+       int scode=getmsg(MSG_NUM_KEYBOARD);
        
        if(scode==SC_LEFT_SHIFT || scode==SC_RIGHT_SHIFT){
                shift_flag=1;
@@ -447,6 +448,9 @@ char Generate_Scancode_To_ASCII_Code(void)
                }
        }else if(SC_BS==scode){
                return '\b';
+               
+       }else if(SC_SP==scode){
+               return ' ';
        }else{
                input = input | scode;
                input=input<<16;
index acfe7b0..61c7389 100644 (file)
@@ -31,7 +31,7 @@ void scanf(const char* fmt,...)
        va_list arg;
        va_start(arg,char*,fmt);
        char ch=*fmt++;
-       unsigned int charactor_count=0;
+       unsigned int count=0;
        
        while(ch!='\0'){
        
@@ -40,54 +40,55 @@ void scanf(const char* fmt,...)
                        
                        if(ch=='d'){
                                int buf=0;      char chbuf=0;
-                               while(0){
+                               count=0;
+                               while(1){
                                        chbuf=getch();
                                        buf*=10;
                                        
                                        if(chbuf=='1'){
                                                buf+=1;
                                                putchar(chbuf);
-                                               ++charactor_count;
+                                               ++count;
                                        }else if(chbuf=='2'){
                                                buf+=2;
                                                putchar(chbuf);
-                                               ++charactor_count;
+                                               ++count;
                                        }else if(chbuf=='3'){
                                                buf+=3;
                                                putchar(chbuf);
-                                               ++charactor_count;
+                                               ++count;
                                        }else if(chbuf=='4'){
                                                buf+=4;
                                                putchar(chbuf);
-                                               ++charactor_count;
+                                               ++count;
                                        }else if(chbuf=='5'){
                                                buf+=5;
                                                putchar(chbuf);
-                                               ++charactor_count;
+                                               ++count;
                                        }else if(chbuf=='6'){
                                                buf+=6;
                                                putchar(chbuf);
-                                               ++charactor_count;
+                                               ++count;
                                        }else if(chbuf=='7'){
                                                buf+=7;
                                                putchar(chbuf);
-                                               ++charactor_count;
+                                               ++count;
                                        }else if(chbuf=='8'){
                                                buf+=8;
                                                putchar(chbuf);
-                                               ++charactor_count;
+                                               ++count;
                                        }else if(chbuf=='9'){
                                                buf+=9;
                                                putchar(chbuf);
-                                               ++charactor_count;
+                                               ++count;
                                        }else if(chbuf=='0'){
                                                buf+=0;
                                                putchar(chbuf);
-                                               ++charactor_count;
-                                       }else if(chbuf=='\b' && charactor_count>=0){
+                                               ++count;
+                                       }else if(chbuf=='\b' && count>=0){
                                                buf/=10;
                                                putchar(chbuf);
-                                               --charactor_count;
+                                               --count;
                                        }else{
                                                buf/=10;
                                                va_arg(arg,int)=buf;
@@ -96,15 +97,16 @@ void scanf(const char* fmt,...)
                                }
                        }else if(ch=='s'){
                                char *cmd;      cmd=va_arg(arg,char*);
-                               int count=0;
+                               count=0;
                                do{
                                        *cmd=getch();
                                        if(*cmd=='\n'){
                                                putchar(*cmd);
                                                *cmd='\0';
-                                               return;
+                                               break;
                                        }else if(*cmd==' '){
-                                               putchar(*cmd);
+                                               putchar(' ');
+                                               *cmd='\0';
                                                break;
                                        }else if(*cmd=='\b' && count>0){
                                                *cmd-- = '\0';
@@ -161,37 +163,13 @@ void ClearScreen(void)
 void puts(const char* msg)
 {
        
-       char ch,buf;
+       char ch;
        ch=*msg++;
        
        while(ch!='\0')
        {
-               /*
-               if(ch=='\n'){
-                       screen+=(80-X);/*80 charactors * 2byte - X charactors * 2 byte
-                       Y+=1;
-                       X=0;
-                       
-               }else if(ch=='\t'){
-                       *screen++ = (((attr)<<8) | ' ');
-                       *screen++ = (((attr)<<8) | ' ');
-                       X+=2;
-                       
-               }else if(ch=='\r'){
-                       while(X>=0)
-                       {
-                               *screen-- = NUM_NULL;
-                               --X;
-                       }
-               
-                       
-               }else{
-                       *screen++ = (((attr)<<8) | ch);
-                       X+=1;
-               }*/
                putchar(ch);
                ch=*msg++;
-               //MoveCursol();
        }
        return;
 }
@@ -211,22 +189,19 @@ void putchar(const char ch)
        }else if(ch=='\r'){
                while(X>=0)
                {
-                       *screen-- = (unsigned short*)NULL;
+                       *screen-- = (unsigned short)NUM_NULL;
                        --X;
                }
        
        }else if(ch=='\b'){
                screen--;
-               *screen = (unsigned short*)NULL;
+               *screen = (unsigned short)NUM_NULL;
                --X;
                
        }else{
                *screen++ = (((attr)<<8) | ch);
                X+=1;
        }
-       *(screen + (X + Y * COLUMNS) * 2) = ch & 0xFF;
-       *(screen + (X + Y * COLUMNS) * 2 + 1) = ATTRIBUTE;
-       //MoveCursol();
        return;
 }
 
@@ -246,7 +221,7 @@ void printOK(const char* msg)
        return;
 }
 
-void printINFO(const char* msg)
+void printFAIL(const char* msg)
 {
        attr=WHITE;
        puts(msg);
@@ -255,14 +230,14 @@ void printINFO(const char* msg)
                puts(" ");
        }
        puts("[");
-       attr=BLUE;
-       puts("INFO");
+       attr=RED;
+       puts("FAIL");
        attr=WHITE;
        puts("]\n");
        return;
 }
 
-void printFAIL(const char* msg)
+void printWARN(const char* msg)
 {
        attr=WHITE;
        puts(msg);
@@ -271,14 +246,14 @@ void printFAIL(const char* msg)
                puts(" ");
        }
        puts("[");
-       attr=RED;
-       puts("FAIL");
+       attr=YELLOW;
+       puts("WARN");
        attr=WHITE;
        puts("]\n");
        return;
 }
 
-void printWARN(const char* msg)
+void printINFO(const char* msg)
 {
        attr=WHITE;
        puts(msg);
@@ -287,7 +262,7 @@ void printWARN(const char* msg)
                puts(" ");
        }
        puts("[");
-       attr=YELLOW;
+       attr=CH_BLUE;
        puts("WARN");
        attr=WHITE;
        puts("]\n");
@@ -315,43 +290,86 @@ char * uint_to_str(char *buf, unsigned src, int base) {
   return buf;
 }
 
-void printf(char * fmt, ...) {
+void sprintf(char* s,char* fmt,...)
+{
        char **arg = (char **) &fmt;
        char c;
        arg++;
 
        while((c = *fmt++) != 0) {
                if(c != '%'){
-                       putchar(c);
+                       *s++ =c;
                        
                }else{
-               char buf[64];
-               char *p;
-               c = *fmt++;
-               
-               if(c=='d'){
-                       // if value is minus, put '-' in the head
-                       if( 0 > *((int *) arg) ) {
-                               putchar('-');
-                               *((int *) arg) *= -1;
-                       }
-                       p = uint_to_str(buf, *((unsigned *) arg++), 10);
-                       puts(p);
-        
-               }else if(c=='x'){
-                       p = uint_to_str(buf, *((unsigned *) arg++), 16);
-                       puts(p);
+                       char buf[64];
+                       char *p;
+                       c = *fmt++;
+                       
+                       if(c=='d'){
+                               // if value is minus, put '-' in the head
+                               if( 0 > *((int *) arg) ) {
+                                       *s++ ='-';
+                                       *((int *) arg) *= -1;
+                               }
+                               p = uint_to_str(buf, *((unsigned *) arg++), 10);
+                               strcpy(s,p);
         
-               }else if(c=='s'){
-                       p = *arg++;
-                       puts(p);
-        }else if(c=='c'){
-               p=*arg++;
-               char send=*p;
-               putchar(send);
-               }else{
+                       }else if(c=='x'){
+                               p = uint_to_str(buf, *((unsigned *) arg++), 16);
+                               strcpy(s,p);
+               
+                       }else if(c=='s'){
+                               p = *arg++;
+                               puts(p);
+               }else if(c=='c'){
+                       p=*arg++;
+                       char send=*p;
+                       putchar(send);
+                       }else{
+                               putchar(c);
+               }       
+               }
+       }
+}
+
+void printf(char* fmt, ...)
+{
+       char **arg = (char **) &fmt;
+       char c;
+       arg++;
+
+       while((c = *fmt++) != 0) {
+               if(c != '%'){
                        putchar(c);
-      }
-    }
-  }
+                       
+               }else{
+                       char buf[64];
+                       char *p;
+                       c = *fmt++;
+                       
+                       if(c=='d'){
+                               // if value is minus, put '-' in the head
+                               if( 0 > *((int *) arg) ) {
+                                       putchar('-');
+                                       *((int *) arg) *= -1;
+                               }
+                               p = uint_to_str(buf, *((unsigned *) arg++), 10);
+                               puts(p);
+        
+                       }else if(c=='x'){
+                               p = uint_to_str(buf, *((unsigned *) arg++), 16);
+                               puts(p);
+               
+                       }else if(c=='s'){
+                               p = *arg++;
+                               puts(p);
+               }else if(c=='c'){
+                       p=*arg++;
+                       char send=*p;
+                       putchar(send);
+                       }else{
+                               putchar(c);
+               }       
+               }
+       }
 }
index 7e8da6f..957e05f 100644 (file)
 #ifndef _GDT_IDT_VANE_
 #define _GDT_IDT_VANE_
 
+void setupInterruptGate( int int_num, void *interrupt_handler );
+void setupGateDescriptor( int int_num,int base,unsigned short selector,unsigned char flags );
+void load_gdt(void);
+void load_idt(void);
+
+
+/*GDT Segment Descriptor*/
+typedef struct
+{
+       unsigned short  limitLo;
+       unsigned short  baseLo;
+       unsigned char   baseMid;
+       unsigned short  flags;
+       unsigned char   baseHi;
+} __attribute__ ((packed)) SEGMENT_DESCRIPTOR;
+
+
+typedef struct
+{
+       unsigned short          size;
+       SEGMENT_DESCRIPTOR*     base;
+} __attribute__ ((packed)) GDTR;
+
+/*IDT*/
+typedef struct
+{
+       unsigned short  baseLo;
+       unsigned short  selector;
+       unsigned char   reserved;
+       unsigned char   flags;
+       unsigned short  baseHi;
+} __attribute__ ((packed)) GATE_DESCRIPTOR;
+
+typedef struct
+{
+       unsigned short          size;
+       GATE_DESCRIPTOR*        base;
+} __attribute__ ((packed)) IDTR;
+
+/*DEFINES*/
+/*IDT*/
+
+#define        NUM_IDT 256
+
+#define        DEF_IDT_FLAGS_INTGATE_16BIT             0x06
+#define        DEF_IDT_FLAGS_TSKGATE                   0x05
+#define        DEF_IDT_FLAGS_CALL_GATE                 0x0C
+#define        DEF_IDT_FLAGS_INTGATE_32BIT             0x0E
+#define        DEF_IDT_FLAGS_TRPGATE                   0x0F
+#define        DEF_IDT_FLAGS_DPL_LV0                   0x00
+#define        DEF_IDT_FLAGS_DPL_LV1                   0x20
+#define        DEF_IDT_FLAGS_DPL_LV2                   0x40
+#define        DEF_IDT_FLAGS_DPL_LV3                   0x60
+#define        DEF_IDT_FLAGS_PRESENT                   0x80
+
+#define DEF_IDT_INT_NUM_IRQ1                   33
+#define DEF_IDT_INT_NUM_IRQ0                   32
+#define DEF_IDT_INT_NUM_SYSC                   0x30
+#define DEF_IDT_INT_NUM_V86I                   0x31
+#define DEF_IDT_INT_NUM_V86O                   0x32
+
+#define        DEF_IDT_INT_SELECTOR                    0x08
+
+/*GDT*/
+#define        NUM_GDT 3
+#define        NULL_DESCRIPTOR                 0
+#define        CODE_DESCRIPTOR                 1
+#define        DATA_DESCRIPTOR                 2
+#define        TEMP_DESCRIPTOR                 3
+#define        TASK_CODE_DESCRIPTOR    3
+#define        TASK_DATA_DESCRIPTOR    4
+#define        KTSS_DESCRIPTOR                 5
+
+/* Null Descriptor             */
+#define        DEF_GDT_NULL_LIMIT              0x0000
+#define        DEF_GDT_NULL_BASELO             0x0000
+#define        DEF_GDT_NULL_BASEMID    0x00
+#define        DEF_GDT_NULL_FLAGS              0x0000
+#define        DEF_GDT_NULL_BASEHI             0x00
+
+/* Code Descriptor             */
+#define        DEF_GDT_CODE_LIMIT              0xFFFF
+#define        DEF_GDT_CODE_BASELO             0x0000
+#define        DEF_GDT_CODE_BASEMID    0x00
+#define        DEF_GDT_CODE_FLAGS_BL   0x9A
+#define        DEF_GDT_CODE_FLAGS_BH   0xCF
+#define        DEF_GDT_CODE_FLAGS              0xCF9A
+#define        DEF_GDT_CODE_BASEHI             0x00
+
+/* Data Descriptor             */
+#define        DEF_GDT_DATA_LIMIT              0xFFFF
+#define        DEF_GDT_DATA_BASELO             0x0000
+#define        DEF_GDT_DATA_BASEMID    0x00
+#define        DEF_GDT_DATA_FLAGS              0xCF92
+#define        DEF_GDT_DATA_FLAGS_BL   0x92
+#define        DEF_GDT_DATA_FLAGS_BH   0xCF
+#define        DEF_GDT_DATA_BASEHI             0x00
+
+/*PIC*/
+#define        PORT_MASTER_PIC_COMMAND 0x0020
+#define        PORT_MASTER_PIC_STATUS  0x0020
+#define        PORT_MASTER_PIC_DATA    0x0021
+#define        PORT_MASTER_PIC_IMR             0x0021
+#define        PORT_SLAVE_PIC_COMMAND  0x00A0
+#define        PORT_SLAVE_PIC_STATUS   0x00A0
+#define        PORT_SLAVE_PIC_DATA             0x00A1
+#define        PORT_SLAVE_PIC_IMR              0x00A1
+#define        PIC_ICW1                                0x11
+#define        PIC_MASTER_ICW2                 0x20
+#define        PIC_SLAVE_ICW2                  0x28
+#define        PIC_MASTER_ICW3                 0x04
+#define        PIC_SLAVE_ICW3                  0x02
+#define        PIC_MASTER_ICW4                 0x01
+#define        PIC_SLAVE_ICW4                  0x01
+
+/*IRQ*/
+#define        PIC_IMR_MASK_IRQ0               0x01
+#define        PIC_IMR_MASK_IRQ1               0x02
+#define        PIC_IMR_MASK_IRQ2               0x04
+#define        PIC_IMR_MASK_IRQ3               0x08
+#define        PIC_IMR_MASK_IRQ4               0x10
+#define        PIC_IMR_MASK_IRQ5               0x20
+#define        PIC_IMR_MASK_IRQ6               0x40
+#define        PIC_IMR_MASK_IRQ7               0x80
+#define        PIC_IMR_MASK_IRQ_ALL    0xFF
+
+/*PIT*/
+#define        PIT_REG_COUNTER0                        0x0040
+#define        PIT_REG_COUNTER1                        0x0041
+#define        PIT_REG_COUNTER2                        0x0042
+#define        PIT_REG_CONTROL                         0x0043
+#define        DEF_PIT_CLOCK                           1193181.67      
+#define        DEF_PIT_COM_MASK_BINCOUNT       0x01
+#define        DEF_PIT_COM_MASK_MODE           0x0E
+#define        DEF_PIT_COM_MASK_RL                     0x30
+#define        DEF_PIT_COM_MASK_COUNTER        0xC0
+#define        DEF_PIT_COM_BINCOUNT_BIN        0x00
+#define        DEF_PIT_COM_BINCOUNT_BCD        0x01
+#define        DEF_PIT_COM_MODE_TERMINAL       0x00
+#define        DEF_PIT_COM_MODE_PROGONE        0x02
+#define        DEF_PIT_COM_MODE_RATEGEN        0x04
+#define        DEF_PIT_COM_MODE_SQUAREWAVE     0x06
+#define        DEF_PIT_COM_MODE_SOFTTRIG       0x08
+#define        DEF_PIT_COM_MODE_HARDTRIG       0x0A
+#define        DEF_PIT_COM_RL_LATCH            0x00
+#define        DEF_PIT_COM_RL_LSBONLY          0x10
+#define        DEF_PIT_COM_RL_MSBONLY          0x20
+#define        DEF_PIT_COM_RL_DATA                     0x30
+#define DEF_PIT_COM_COUNTER0           0x00
+#define        DEF_PIT_COM_COUNTER1            0x40
+#define        DEF_PIT_COM_COUNTER2            0x80
+
+/*EXTERN*/
 extern IDTR idtr;
 extern GATE_DESCRIPTOR idt[ NUM_IDT ];
 extern SEGMENT_DESCRIPTOR      gdt[ NUM_GDT ];
 extern GDTR gdtr;
 
 
-void setupInterruptGate( int int_num, void *interrupt_handler );
-void setupGateDescriptor( int int_num,int base,unsigned short selector,unsigned char flags );
-void load_gdt(void);
-void load_idt(void);
-
 #endif
index 4177e64..d810e23 100644 (file)
@@ -30,9 +30,9 @@ extern int vram_start_address;
 extern char vmode;
 extern short scrnX,scrnY;
 
-void bufinit(void);
-int getmsg(void);
-void sendmsg(int msg);
+void init_all(void);
+int getmsg(int msg_num);
+void sendmsg(int msg,int msg_num);
 
 #define COL8_000000            0
 #define COL8_FF0000            1
@@ -100,16 +100,6 @@ typedef struct
        char fs_type[8];
 }bpb_data_t;
 
-typedef struct
-{
-       unsigned int size;
-       unsigned char drive_number;
-       unsigned char drive_mode;
-       unsigned short drive_cylinders;
-       unsigned char drive_head;
-       unsigned char drive_sectors;
-}drive_info;
-
 /* fifo.c */
 struct FIFO32 {
        int *buf;
@@ -134,152 +124,4 @@ int fifo32_put(struct FIFO32 *fifo, int data);
 int fifo32_get(struct FIFO32 *fifo);
 int fifo32_status(struct FIFO32 *fifo);
 
-
-/*TYPEDEF*/
-/*GDT Segment Descriptor*/
-typedef struct
-{
-       unsigned short  limitLo;
-       unsigned short  baseLo;
-       unsigned char   baseMid;
-       unsigned short  flags;
-       unsigned char   baseHi;
-} __attribute__ ((packed)) SEGMENT_DESCRIPTOR;
-
-
-typedef struct
-{
-       unsigned short          size;
-       SEGMENT_DESCRIPTOR*     base;
-} __attribute__ ((packed)) GDTR;
-
-/*IDT*/
-typedef struct
-{
-       unsigned short  baseLo;
-       unsigned short  selector;
-       unsigned char   reserved;
-       unsigned char   flags;
-       unsigned short  baseHi;
-} __attribute__ ((packed)) GATE_DESCRIPTOR;
-
-typedef struct
-{
-       unsigned short          size;
-       GATE_DESCRIPTOR*        base;
-} __attribute__ ((packed)) IDTR;
-
-/*DEFINES*/
-/*IDT*/
-
-#define        NUM_IDT 256
-
-#define        DEF_IDT_FLAGS_INTGATE_16BIT             0x06
-#define        DEF_IDT_FLAGS_TSKGATE                   0x05
-#define        DEF_IDT_FLAGS_CALL_GATE                 0x0C
-#define        DEF_IDT_FLAGS_INTGATE_32BIT             0x0E
-#define        DEF_IDT_FLAGS_TRPGATE                   0x0F
-#define        DEF_IDT_FLAGS_DPL_LV0                   0x00
-#define        DEF_IDT_FLAGS_DPL_LV1                   0x20
-#define        DEF_IDT_FLAGS_DPL_LV2                   0x40
-#define        DEF_IDT_FLAGS_DPL_LV3                   0x60
-#define        DEF_IDT_FLAGS_PRESENT                   0x80
-
-#define DEF_IDT_INT_NUM_IRQ1                   33
-#define DEF_IDT_INT_NUM_IRQ0                   32
-#define DEF_IDT_INT_NUM_SYSC                   0x30
-#define DEF_IDT_INT_NUM_V86I                   0x31
-#define DEF_IDT_INT_NUM_V86O                   0x32
-
-#define        DEF_IDT_INT_SELECTOR                    0x08
-
-/*GDT*/
-
-#define        NUM_GDT 3
-#define        NULL_DESCRIPTOR                 0
-#define        CODE_DESCRIPTOR                 1
-#define        DATA_DESCRIPTOR                 2
-#define        TEMP_DESCRIPTOR                 3
-#define        TASK_CODE_DESCRIPTOR    3
-#define        TASK_DATA_DESCRIPTOR    4
-#define        KTSS_DESCRIPTOR                 5
-
-/* Null Descriptor             */
-#define        DEF_GDT_NULL_LIMIT              0x0000
-#define        DEF_GDT_NULL_BASELO             0x0000
-#define        DEF_GDT_NULL_BASEMID    0x00
-#define        DEF_GDT_NULL_FLAGS              0x0000
-#define        DEF_GDT_NULL_BASEHI             0x00
-
-/* Code Descriptor             */
-#define        DEF_GDT_CODE_LIMIT              0xFFFF
-#define        DEF_GDT_CODE_BASELO             0x0000
-#define        DEF_GDT_CODE_BASEMID    0x00
-#define        DEF_GDT_CODE_FLAGS_BL   0x9A
-#define        DEF_GDT_CODE_FLAGS_BH   0xCF
-#define        DEF_GDT_CODE_FLAGS              0xCF9A
-#define        DEF_GDT_CODE_BASEHI             0x00
-
-/* Data Descriptor             */
-#define        DEF_GDT_DATA_LIMIT              0xFFFF
-#define        DEF_GDT_DATA_BASELO             0x0000
-#define        DEF_GDT_DATA_BASEMID    0x00
-#define        DEF_GDT_DATA_FLAGS              0xCF92
-#define        DEF_GDT_DATA_FLAGS_BL   0x92
-#define        DEF_GDT_DATA_FLAGS_BH   0xCF
-#define        DEF_GDT_DATA_BASEHI             0x00
-
-/*PIC*/
-#define        PORT_MASTER_PIC_COMMAND 0x0020
-#define        PORT_MASTER_PIC_STATUS  0x0020
-#define        PORT_MASTER_PIC_DATA    0x0021
-#define        PORT_MASTER_PIC_IMR             0x0021
-#define        PORT_SLAVE_PIC_COMMAND  0x00A0
-#define        PORT_SLAVE_PIC_STATUS   0x00A0
-#define        PORT_SLAVE_PIC_DATA             0x00A1
-#define        PORT_SLAVE_PIC_IMR              0x00A1
-#define        PIC_ICW1                                0x11
-#define        PIC_MASTER_ICW2                 0x20
-#define        PIC_SLAVE_ICW2                  0x28
-#define        PIC_MASTER_ICW3                 0x04
-#define        PIC_SLAVE_ICW3                  0x02
-#define        PIC_MASTER_ICW4                 0x01
-#define        PIC_SLAVE_ICW4                  0x01
-/*IRQ*/
-#define        PIC_IMR_MASK_IRQ0               0x01
-#define        PIC_IMR_MASK_IRQ1               0x02
-#define        PIC_IMR_MASK_IRQ2               0x04
-#define        PIC_IMR_MASK_IRQ3               0x08
-#define        PIC_IMR_MASK_IRQ4               0x10
-#define        PIC_IMR_MASK_IRQ5               0x20
-#define        PIC_IMR_MASK_IRQ6               0x40
-#define        PIC_IMR_MASK_IRQ7               0x80
-#define        PIC_IMR_MASK_IRQ_ALL    0xFF
-
-/*PIT*/
-#define        PIT_REG_COUNTER0                        0x0040
-#define        PIT_REG_COUNTER1                        0x0041
-#define        PIT_REG_COUNTER2                        0x0042
-#define        PIT_REG_CONTROL                         0x0043
-#define        DEF_PIT_CLOCK                           1193181.67      
-#define        DEF_PIT_COM_MASK_BINCOUNT       0x01
-#define        DEF_PIT_COM_MASK_MODE           0x0E
-#define        DEF_PIT_COM_MASK_RL                     0x30
-#define        DEF_PIT_COM_MASK_COUNTER        0xC0
-#define        DEF_PIT_COM_BINCOUNT_BIN        0x00
-#define        DEF_PIT_COM_BINCOUNT_BCD        0x01
-#define        DEF_PIT_COM_MODE_TERMINAL       0x00
-#define        DEF_PIT_COM_MODE_PROGONE        0x02
-#define        DEF_PIT_COM_MODE_RATEGEN        0x04
-#define        DEF_PIT_COM_MODE_SQUAREWAVE     0x06
-#define        DEF_PIT_COM_MODE_SOFTTRIG       0x08
-#define        DEF_PIT_COM_MODE_HARDTRIG       0x0A
-#define        DEF_PIT_COM_RL_LATCH            0x00
-#define        DEF_PIT_COM_RL_LSBONLY          0x10
-#define        DEF_PIT_COM_RL_MSBONLY          0x20
-#define        DEF_PIT_COM_RL_DATA                     0x30
-#define DEF_PIT_COM_COUNTER0           0x00
-#define        DEF_PIT_COM_COUNTER1            0x40
-#define        DEF_PIT_COM_COUNTER2            0x80
-
 #endif
index 84fc7ac..f300956 100644 (file)
@@ -30,6 +30,9 @@ extern int vram_start_address;
 extern char vmode;
 extern short scrnX,scrnY;
 
+void init_all(void);
+int getmsg(int msg_num);
+void sendmsg(int msg,int msg_num);
 
 #define COL8_000000            0
 #define COL8_FF0000            1
@@ -131,152 +134,4 @@ int fifo32_put(struct FIFO32 *fifo, int data);
 int fifo32_get(struct FIFO32 *fifo);
 int fifo32_status(struct FIFO32 *fifo);
 
-
-/*TYPEDEF*/
-/*GDT Segment Descriptor*/
-typedef struct
-{
-       unsigned short  limitLo;
-       unsigned short  baseLo;
-       unsigned char   baseMid;
-       unsigned short  flags;
-       unsigned char   baseHi;
-} __attribute__ ((packed)) SEGMENT_DESCRIPTOR;
-
-
-typedef struct
-{
-       unsigned short          size;
-       SEGMENT_DESCRIPTOR*     base;
-} __attribute__ ((packed)) GDTR;
-
-/*IDT*/
-typedef struct
-{
-       unsigned short  baseLo;
-       unsigned short  selector;
-       unsigned char   reserved;
-       unsigned char   flags;
-       unsigned short  baseHi;
-} __attribute__ ((packed)) GATE_DESCRIPTOR;
-
-typedef struct
-{
-       unsigned short          size;
-       GATE_DESCRIPTOR*        base;
-} __attribute__ ((packed)) IDTR;
-
-/*DEFINES*/
-/*IDT*/
-
-#define        NUM_IDT 256
-
-#define        DEF_IDT_FLAGS_INTGATE_16BIT             0x06
-#define        DEF_IDT_FLAGS_TSKGATE                   0x05
-#define        DEF_IDT_FLAGS_CALL_GATE                 0x0C
-#define        DEF_IDT_FLAGS_INTGATE_32BIT             0x0E
-#define        DEF_IDT_FLAGS_TRPGATE                   0x0F
-#define        DEF_IDT_FLAGS_DPL_LV0                   0x00
-#define        DEF_IDT_FLAGS_DPL_LV1                   0x20
-#define        DEF_IDT_FLAGS_DPL_LV2                   0x40
-#define        DEF_IDT_FLAGS_DPL_LV3                   0x60
-#define        DEF_IDT_FLAGS_PRESENT                   0x80
-
-#define DEF_IDT_INT_NUM_IRQ1                   33
-#define DEF_IDT_INT_NUM_IRQ0                   32
-#define DEF_IDT_INT_NUM_SYSC                   0x30
-#define DEF_IDT_INT_NUM_V86I                   0x31
-#define DEF_IDT_INT_NUM_V86O                   0x32
-
-#define        DEF_IDT_INT_SELECTOR                    0x08
-
-/*GDT*/
-
-#define        NUM_GDT 3
-#define        NULL_DESCRIPTOR                 0
-#define        CODE_DESCRIPTOR                 1
-#define        DATA_DESCRIPTOR                 2
-#define        TEMP_DESCRIPTOR                 3
-#define        TASK_CODE_DESCRIPTOR    3
-#define        TASK_DATA_DESCRIPTOR    4
-#define        KTSS_DESCRIPTOR                 5
-
-/* Null Descriptor             */
-#define        DEF_GDT_NULL_LIMIT              0x0000
-#define        DEF_GDT_NULL_BASELO             0x0000
-#define        DEF_GDT_NULL_BASEMID    0x00
-#define        DEF_GDT_NULL_FLAGS              0x0000
-#define        DEF_GDT_NULL_BASEHI             0x00
-
-/* Code Descriptor             */
-#define        DEF_GDT_CODE_LIMIT              0xFFFF
-#define        DEF_GDT_CODE_BASELO             0x0000
-#define        DEF_GDT_CODE_BASEMID    0x00
-#define        DEF_GDT_CODE_FLAGS_BL   0x9A
-#define        DEF_GDT_CODE_FLAGS_BH   0xCF
-#define        DEF_GDT_CODE_FLAGS              0xCF9A
-#define        DEF_GDT_CODE_BASEHI             0x00
-
-/* Data Descriptor             */
-#define        DEF_GDT_DATA_LIMIT              0xFFFF
-#define        DEF_GDT_DATA_BASELO             0x0000
-#define        DEF_GDT_DATA_BASEMID    0x00
-#define        DEF_GDT_DATA_FLAGS              0xCF92
-#define        DEF_GDT_DATA_FLAGS_BL   0x92
-#define        DEF_GDT_DATA_FLAGS_BH   0xCF
-#define        DEF_GDT_DATA_BASEHI             0x00
-
-/*PIC*/
-#define        PORT_MASTER_PIC_COMMAND 0x0020
-#define        PORT_MASTER_PIC_STATUS  0x0020
-#define        PORT_MASTER_PIC_DATA    0x0021
-#define        PORT_MASTER_PIC_IMR             0x0021
-#define        PORT_SLAVE_PIC_COMMAND  0x00A0
-#define        PORT_SLAVE_PIC_STATUS   0x00A0
-#define        PORT_SLAVE_PIC_DATA             0x00A1
-#define        PORT_SLAVE_PIC_IMR              0x00A1
-#define        PIC_ICW1                                0x11
-#define        PIC_MASTER_ICW2                 0x20
-#define        PIC_SLAVE_ICW2                  0x28
-#define        PIC_MASTER_ICW3                 0x04
-#define        PIC_SLAVE_ICW3                  0x02
-#define        PIC_MASTER_ICW4                 0x01
-#define        PIC_SLAVE_ICW4                  0x01
-/*IRQ*/
-#define        PIC_IMR_MASK_IRQ0               0x01
-#define        PIC_IMR_MASK_IRQ1               0x02
-#define        PIC_IMR_MASK_IRQ2               0x04
-#define        PIC_IMR_MASK_IRQ3               0x08
-#define        PIC_IMR_MASK_IRQ4               0x10
-#define        PIC_IMR_MASK_IRQ5               0x20
-#define        PIC_IMR_MASK_IRQ6               0x40
-#define        PIC_IMR_MASK_IRQ7               0x80
-#define        PIC_IMR_MASK_IRQ_ALL    0xFF
-
-/*PIT*/
-#define        PIT_REG_COUNTER0                        0x0040
-#define        PIT_REG_COUNTER1                        0x0041
-#define        PIT_REG_COUNTER2                        0x0042
-#define        PIT_REG_CONTROL                         0x0043
-#define        DEF_PIT_CLOCK                           1193181.67      
-#define        DEF_PIT_COM_MASK_BINCOUNT       0x01
-#define        DEF_PIT_COM_MASK_MODE           0x0E
-#define        DEF_PIT_COM_MASK_RL                     0x30
-#define        DEF_PIT_COM_MASK_COUNTER        0xC0
-#define        DEF_PIT_COM_BINCOUNT_BIN        0x00
-#define        DEF_PIT_COM_BINCOUNT_BCD        0x01
-#define        DEF_PIT_COM_MODE_TERMINAL       0x00
-#define        DEF_PIT_COM_MODE_PROGONE        0x02
-#define        DEF_PIT_COM_MODE_RATEGEN        0x04
-#define        DEF_PIT_COM_MODE_SQUAREWAVE     0x06
-#define        DEF_PIT_COM_MODE_SOFTTRIG       0x08
-#define        DEF_PIT_COM_MODE_HARDTRIG       0x0A
-#define        DEF_PIT_COM_RL_LATCH            0x00
-#define        DEF_PIT_COM_RL_LSBONLY          0x10
-#define        DEF_PIT_COM_RL_MSBONLY          0x20
-#define        DEF_PIT_COM_RL_DATA                     0x30
-#define DEF_PIT_COM_COUNTER0           0x00
-#define        DEF_PIT_COM_COUNTER1            0x40
-#define        DEF_PIT_COM_COUNTER2            0x80
-
 #endif
index e409e81..6910194 100644 (file)
@@ -30,9 +30,7 @@ extern unsigned int X,Y;
 #define DOUBLE_BYTE    8
 #define FLOAT_BYTE     4
 
-#if (!defined(NULL))
-       #define NULL    ((void *) 0)
-#endif
+#define NULL   ((void *) 0)
 
 #define NUM_NULL 0
 /*