]> Zhao Yanbai Git Server - kernel.git/commitdiff
delete the pci and setup dir
authorAceVest <zhaoyanbai@126.com>
Fri, 27 Jun 2014 15:28:31 +0000 (23:28 +0800)
committeracevest <zhaoyanbai@126.com>
Wed, 3 Nov 2021 02:45:34 +0000 (10:45 +0800)
Makefile
drivers/keyboard.c
include/system.h
kernel/cpuid.c [moved from setup/cpuid.c with 100% similarity]
kernel/i8259.c
kernel/pci.c [moved from pci/setuppci.c with 99% similarity]
kernel/setup.c [moved from setup/setup.c with 100% similarity]
kernel/system.c
scripts/grub.cfg
setup/system.c [deleted file]

index d660621d9479b627f4e7f03f53f6bb95a2301280..a698a4d787ea67dd51880a568b5a261e25ed096d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@ SYSTEMMAP       = System.map
 KERNELBIN      = KERNEL.BIN
 LINKSCRIPT     = scripts/link.ld
 
-SRC_DIRS = boot setup mm lib fs kernel drivers pci
+SRC_DIRS = boot mm lib fs kernel drivers
 INC_DIRS = include drivers
 
 CFLAGS += ${INC_DIRS:%=-I%}
@@ -16,7 +16,7 @@ OBJS := $(patsubst %,%.o,$(SOURCE_FILES))
 
 ${KERNELBIN}: ${OBJS}
        ld -M -T$(LINKSCRIPT) $(OBJS) -o $@ > $(SYSTEMMAP)
-       rm setup/setup.c.o
+       rm kernel/setup.c.o
 
 %.S.o: %.S ${HEADER_FILES}
        ${CC} ${CFLAGS} $< -o $@
index 745e967dfe63dbeab8ab20d11558ace38d9b83d9..01d465a1d4207fa62a7b1ec6dccd14e229a844b0 100644 (file)
@@ -85,6 +85,5 @@ int sysc_read_kbd()
     DECLARE_WAIT_QUEUE(wait, current);
     add_wait_queue(&cnsl_rd_q.wait, &wait);
 
-
     return 0;
 }
index aa90148dac2d15d9631a84f5b59bd2488c620b3d..acd783448710a7b3049965d102cf63f8de897a8a 100644 (file)
@@ -256,6 +256,7 @@ extern    System system;
 #define INT_VECT_PAGEFAULT       0xE
 #define INT_VECT_COPROCERR       0x10
 #endif
+
 #define INT_VECT_IRQ0    0x20
 #define INT_VECT_IRQ8    0x28
 
similarity index 100%
rename from setup/cpuid.c
rename to kernel/cpuid.c
index 133c3a9bfbae21d90a592fc0410a523603f2440a..29a317f5534ba8570f1e4e62d259320cc0444175 100644 (file)
@@ -24,8 +24,6 @@ void mask_i8259()
     //mask all of 8259
     outb_p(0xFF, PIC_MASTER_IMR);
     outb_p(0xFF, PIC_SLAVE_IMR);
-    //outb_p(0x0, PIC_MASTER_IMR);
-    //outb_p(0x0, PIC_SLAVE_IMR);
 }
 
 void init_i8259()
similarity index 99%
rename from pci/setuppci.c
rename to kernel/pci.c
index da35004497b426bbbebfb675ac6fac40b1b4bcf0..1af8866ca770b1a4bc634073619b5af34b57915c 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *--------------------------------------------------------------------------
- *   File Name: setuppci.c
+ *   File Name: pci.c
  * 
  * Description: none
  * 
similarity index 100%
rename from setup/setup.c
rename to kernel/setup.c
index 21cf10f053ff9a2edce77dc8f541e1845ac40e0c..94749a303cdf96606c64eb7be6d484f256ff1f77 100644 (file)
  *--------------------------------------------------------------------------
  *   File Name: system.c
  * 
+ * Description: none
+ * 
+ * 
  *      Author: Zhao Yanbai [zhaoyanbai@126.com]
- *              Sun Jan 24 13:57:46 2010
  * 
- * Description: none
+ *     Version:    1.0
+ * Create Date: Wed Mar  4 21:34:47 2009
+ * Last Update: Wed Mar  4 21:34:47 2009
  * 
  *--------------------------------------------------------------------------
  */
 
-
+#include <system.h>
+#include <string.h>
+#include <processor.h>
+#include <page.h>
+#include <irq.h>
+#include <sched.h>
+#include <assert.h>
+#include <i8259.h>
+#include <fs.h>
+#include <ide.h>
 #include <syscall.h>
 
-int    sysc_reboot(int mode)
+void setup_gdt()
+{
+    pDesc    pdesc;
+    //change to new gdt.
+    sgdt();
+    memcpy(gdt, (void *)pa2va(*((unsigned long*)(gdtr+2))),
+                *((unsigned short *)gdtr));
+    *((unsigned short *)gdtr)    = NGDT*sizeof(Desc);
+    *((unsigned long  *)(gdtr+2))    = (unsigned long)gdt;
+    lgdt();
+    memcpy(gdt+INDEX_UCODE, gdt+INDEX_KCODE, sizeof(Desc));
+    memcpy(gdt+INDEX_UDATA, gdt+INDEX_KDATA, sizeof(Desc));
+    pdesc = gdt+INDEX_UCODE;
+    pdesc->seg.DPL = 3;
+    pdesc = gdt+INDEX_UDATA;
+    pdesc->seg.DPL = 3;
+}
+
+void setup_idt()
+{
+    *((unsigned short *)idtr)    = NIDT*sizeof(Gate);
+    *((unsigned long  *)(idtr+2))    = (unsigned long)idt;
+    lidt();
+}
+
+
+
+void setup_gate()
+{   int i;
+    set_sys_int(0x00, TRAP_GATE, PRIVILEGE_KRNL, DivideError);
+    set_sys_int(0x01, TRAP_GATE, PRIVILEGE_KRNL, Debug);
+    set_sys_int(0x02, INTR_GATE, PRIVILEGE_KRNL, NMI);    
+    set_sys_int(0x03, TRAP_GATE, PRIVILEGE_USER, BreakPoint);    
+    set_sys_int(0x04, TRAP_GATE, PRIVILEGE_USER, OverFlow);    
+    set_sys_int(0x05, TRAP_GATE, PRIVILEGE_USER, BoundsCheck);    
+    set_sys_int(0x06, TRAP_GATE, PRIVILEGE_KRNL, InvalidOpcode);    
+    set_sys_int(0x07, TRAP_GATE, PRIVILEGE_KRNL, DeviceNotAvailable);    
+    set_sys_int(0x08, TRAP_GATE, PRIVILEGE_KRNL, DoubleFault);    
+    set_sys_int(0x09, TRAP_GATE, PRIVILEGE_KRNL, CoprocSegOverRun);    
+    set_sys_int(0x0A, TRAP_GATE, PRIVILEGE_KRNL, InvalidTss);    
+    set_sys_int(0x0B, TRAP_GATE, PRIVILEGE_KRNL, SegNotPresent);    
+    set_sys_int(0x0C, TRAP_GATE, PRIVILEGE_KRNL, StackFault);    
+    set_sys_int(0x0D, TRAP_GATE, PRIVILEGE_KRNL, GeneralProtection);    
+    set_sys_int(0x0E, TRAP_GATE, PRIVILEGE_KRNL, PageFault);    
+    set_sys_int(0x10, TRAP_GATE, PRIVILEGE_KRNL, CoprocError);
+
+    for(i=0x20; i<256; i++)
+        set_sys_int(i, INTR_GATE, PRIVILEGE_KRNL, no_irq_handler);
+
+    set_sys_int(0x20, INTR_GATE, PRIVILEGE_KRNL, irq_0x00_handler);
+    set_sys_int(0x21, INTR_GATE, PRIVILEGE_KRNL, irq_0x01_handler);    
+    set_sys_int(0x22, INTR_GATE, PRIVILEGE_KRNL, irq_0x02_handler);    
+    set_sys_int(0x23, INTR_GATE, PRIVILEGE_KRNL, irq_0x03_handler);    
+    set_sys_int(0x24, INTR_GATE, PRIVILEGE_KRNL, irq_0x04_handler);    
+    set_sys_int(0x25, INTR_GATE, PRIVILEGE_KRNL, irq_0x05_handler);    
+    set_sys_int(0x26, INTR_GATE, PRIVILEGE_KRNL, irq_0x06_handler);    
+    set_sys_int(0x27, INTR_GATE, PRIVILEGE_KRNL, irq_0x07_handler);    
+    set_sys_int(0x28, INTR_GATE, PRIVILEGE_KRNL, irq_0x08_handler);    
+    set_sys_int(0x29, INTR_GATE, PRIVILEGE_KRNL, irq_0x09_handler);    
+    set_sys_int(0x2A, INTR_GATE, PRIVILEGE_KRNL, irq_0x0A_handler);    
+    set_sys_int(0x2B, INTR_GATE, PRIVILEGE_KRNL, irq_0x0B_handler);    
+    set_sys_int(0x2C, INTR_GATE, PRIVILEGE_KRNL, irq_0x0C_handler);    
+    set_sys_int(0x2D, INTR_GATE, PRIVILEGE_KRNL, irq_0x0D_handler);    
+    set_sys_int(0x2E, INTR_GATE, PRIVILEGE_KRNL, irq_0x0E_handler);    
+    set_sys_int(0x2F, INTR_GATE, PRIVILEGE_KRNL, irq_0x0F_handler);    
+}
+
+void ide_irq();
+void default_irq_handler(unsigned int irq, pt_regs_t * regs, void *dev_id)
+{
+    printk("default irq handler %d \n", irq);
+    ide_irq();
+}
+
+void setup_irqs()
+{
+    extern void init_i8259();
+    init_i8259();
+
+    int i;
+    for(i=0; i<NR_IRQS; i++)
+    {
+        irq_desc[i] = no_irq_desc;
+
+        if(i<16)
+            irq_desc[i].chip = &i8259_chip;
+    }
+
+    void    kbd_handler(unsigned int irq, pt_regs_t * regs, void *dev_id);
+    void    clk_handler(unsigned int irq, pt_regs_t * regs, void *dev_id);
+
+    request_irq(0x00, clk_handler,    "Intel 8254",    "Clock Chip");
+    request_irq(0x01, kbd_handler,    "Intel 8042",    "PS/2 Keyboard");
+    for(i=3; i<16; i++)
+    {
+        request_irq(i, default_irq_handler,   "default",    "default");
+    }
+
+    for(i=0; i<16; i++)
+        open_irq(i);
+
+    enable_irq();
+}
+
+void set_tss()
+{
+    pTSS p = &tss;
+    memset((void *)p, sizeof(TSS), 0);
+    p->esp0      = 0; // delay to init root_task
+    p->ss0       = SELECTOR_KRNL_DS;
+    p->ss        = SELECTOR_KRNL_DS;
+    p->gs        = SELECTOR_KRNL_DS;
+    p->fs        = SELECTOR_KRNL_DS;
+    p->es        = SELECTOR_KRNL_DS;
+    p->ds        = SELECTOR_KRNL_DS;
+    p->cs        = SELECTOR_KRNL_CS;
+    p->eflags    = 0x1200;
+    p->iomap_base    = sizeof(TSS);
+    set_tss_gate(INDEX_TSS, (u32)p);
+    asm("ltr %%ax"::"a"((INDEX_TSS<<3)+3));
+}
+
+void setup_root_dev()
+{
+    unsigned char dev;
+    dev = (unsigned char)(system.boot_device >> 24);
+    printk("root device: %08x\n", system.root_dev);
+}
+
+int sysc_reboot(int mode)
 {
 
     void do_reboot();
index 6db5b49fd71d36eb6872798368fff85aa174ec35..b2e84677dc120eba0c683406bfd0ca200b94f77d 100644 (file)
@@ -7,6 +7,6 @@ insmod ext2
 
 root=(hd0,msdos1)
 
-menuentry 'Kernel'  --class os {
+menuentry 'Kernel' --class os {
     multiboot /boot/Kernel root=(hd0,0) debug=1
 }
diff --git a/setup/system.c b/setup/system.c
deleted file mode 100644 (file)
index 6b27976..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- *--------------------------------------------------------------------------
- *   File Name: system.c
- * 
- * Description: none
- * 
- * 
- *      Author: Zhao Yanbai [zhaoyanbai@126.com]
- * 
- *     Version:    1.0
- * Create Date: Wed Mar  4 21:34:47 2009
- * Last Update: Wed Mar  4 21:34:47 2009
- * 
- *--------------------------------------------------------------------------
- */
-
-#include <system.h>
-#include <string.h>
-#include <processor.h>
-#include <page.h>
-#include <irq.h>
-#include <sched.h>
-#include <assert.h>
-#include <i8259.h>
-#include <fs.h>
-#include <ide.h>
-
-void    setup_gdt()
-{
-    pDesc    pdesc;
-    //change to new gdt.
-    sgdt();
-    memcpy(gdt, (void *)pa2va(*((unsigned long*)(gdtr+2))),
-                *((unsigned short *)gdtr));
-    *((unsigned short *)gdtr)    = NGDT*sizeof(Desc);
-    *((unsigned long  *)(gdtr+2))    = (unsigned long)gdt;
-    lgdt();
-    memcpy(gdt+INDEX_UCODE, gdt+INDEX_KCODE, sizeof(Desc));
-    memcpy(gdt+INDEX_UDATA, gdt+INDEX_KDATA, sizeof(Desc));
-    pdesc = gdt+INDEX_UCODE;
-    pdesc->seg.DPL = 3;
-    pdesc = gdt+INDEX_UDATA;
-    pdesc->seg.DPL = 3;
-}
-
-void    setup_idt()
-{
-    *((unsigned short *)idtr)    = NIDT*sizeof(Gate);
-    *((unsigned long  *)(idtr+2))    = (unsigned long)idt;
-    lidt();
-}
-
-
-
-void    setup_gate()
-{    int i;
-    set_sys_int(0x00, TRAP_GATE, PRIVILEGE_KRNL, DivideError);
-    set_sys_int(0x01, TRAP_GATE, PRIVILEGE_KRNL, Debug);
-    set_sys_int(0x02, INTR_GATE, PRIVILEGE_KRNL, NMI);    
-    set_sys_int(0x03, TRAP_GATE, PRIVILEGE_USER, BreakPoint);    
-    set_sys_int(0x04, TRAP_GATE, PRIVILEGE_USER, OverFlow);    
-    set_sys_int(0x05, TRAP_GATE, PRIVILEGE_USER, BoundsCheck);    
-    set_sys_int(0x06, TRAP_GATE, PRIVILEGE_KRNL, InvalidOpcode);    
-    set_sys_int(0x07, TRAP_GATE, PRIVILEGE_KRNL, DeviceNotAvailable);    
-    set_sys_int(0x08, TRAP_GATE, PRIVILEGE_KRNL, DoubleFault);    
-    set_sys_int(0x09, TRAP_GATE, PRIVILEGE_KRNL, CoprocSegOverRun);    
-    set_sys_int(0x0A, TRAP_GATE, PRIVILEGE_KRNL, InvalidTss);    
-    set_sys_int(0x0B, TRAP_GATE, PRIVILEGE_KRNL, SegNotPresent);    
-    set_sys_int(0x0C, TRAP_GATE, PRIVILEGE_KRNL, StackFault);    
-    set_sys_int(0x0D, TRAP_GATE, PRIVILEGE_KRNL, GeneralProtection);    
-    set_sys_int(0x0E, TRAP_GATE, PRIVILEGE_KRNL, PageFault);    
-    set_sys_int(0x10, TRAP_GATE, PRIVILEGE_KRNL, CoprocError);
-
-    for(i=0x20; i<256; i++)
-        set_sys_int(i, INTR_GATE, PRIVILEGE_KRNL, no_irq_handler);
-
-    set_sys_int(0x20, INTR_GATE, PRIVILEGE_KRNL, irq_0x00_handler);
-    set_sys_int(0x21, INTR_GATE, PRIVILEGE_KRNL, irq_0x01_handler);    
-    set_sys_int(0x22, INTR_GATE, PRIVILEGE_KRNL, irq_0x02_handler);    
-    set_sys_int(0x23, INTR_GATE, PRIVILEGE_KRNL, irq_0x03_handler);    
-    set_sys_int(0x24, INTR_GATE, PRIVILEGE_KRNL, irq_0x04_handler);    
-    set_sys_int(0x25, INTR_GATE, PRIVILEGE_KRNL, irq_0x05_handler);    
-    set_sys_int(0x26, INTR_GATE, PRIVILEGE_KRNL, irq_0x06_handler);    
-    set_sys_int(0x27, INTR_GATE, PRIVILEGE_KRNL, irq_0x07_handler);    
-    set_sys_int(0x28, INTR_GATE, PRIVILEGE_KRNL, irq_0x08_handler);    
-    set_sys_int(0x29, INTR_GATE, PRIVILEGE_KRNL, irq_0x09_handler);    
-    set_sys_int(0x2A, INTR_GATE, PRIVILEGE_KRNL, irq_0x0A_handler);    
-    set_sys_int(0x2B, INTR_GATE, PRIVILEGE_KRNL, irq_0x0B_handler);    
-    set_sys_int(0x2C, INTR_GATE, PRIVILEGE_KRNL, irq_0x0C_handler);    
-    set_sys_int(0x2D, INTR_GATE, PRIVILEGE_KRNL, irq_0x0D_handler);    
-    set_sys_int(0x2E, INTR_GATE, PRIVILEGE_KRNL, irq_0x0E_handler);    
-    set_sys_int(0x2F, INTR_GATE, PRIVILEGE_KRNL, irq_0x0F_handler);    
-}
-
-void ide_irq();
-void default_irq_handler(unsigned int irq, pt_regs_t * regs, void *dev_id)
-{
-    printk("default irq handler %d \n", irq);
-    ide_irq();
-}
-
-void    setup_irqs()
-{
-    extern    void init_i8259();
-    init_i8259();
-
-    int i;
-    for(i=0; i<NR_IRQS; i++)
-    {
-        irq_desc[i] = no_irq_desc;
-
-        if(i<16)
-            irq_desc[i].chip = &i8259_chip;
-    }
-
-    void    kbd_handler(unsigned int irq, pt_regs_t * regs, void *dev_id);
-    void    clk_handler(unsigned int irq, pt_regs_t * regs, void *dev_id);
-
-    request_irq(0x00, clk_handler,    "Intel 8254",    "Clock Chip");
-    request_irq(0x01, kbd_handler,    "Intel 8042",    "PS/2 Keyboard");
-    for(i=3; i<16; i++)
-    {
-        request_irq(i, default_irq_handler,   "default",    "default");
-    }
-
-    for(i=0; i<16; i++)
-        open_irq(i);
-
-    enable_irq();
-}
-
-void    set_tss()
-{
-    pTSS p = &tss;
-    memset((void *)p, sizeof(TSS), 0);
-    p->esp0      = 0; // delay to init root_task
-    p->ss0       = SELECTOR_KRNL_DS;
-    p->ss        = SELECTOR_KRNL_DS;
-    p->gs        = SELECTOR_KRNL_DS;
-    p->fs        = SELECTOR_KRNL_DS;
-    p->es        = SELECTOR_KRNL_DS;
-    p->ds        = SELECTOR_KRNL_DS;
-    p->cs        = SELECTOR_KRNL_CS;
-    p->eflags    = 0x1200;
-    p->iomap_base    = sizeof(TSS);
-    set_tss_gate(INDEX_TSS, (u32)p);
-    asm("ltr %%ax"::"a"((INDEX_TSS<<3)+3));
-}
-
-void setup_root_dev()
-{
-    unsigned char dev;
-    dev = (unsigned char)(system.boot_device >> 24);
-    printk("root device: %08x\n", system.root_dev);
-}