diff --git a/README.txt b/README.txt index 822b63c..ef63ccf 100644 --- a/README.txt +++ b/README.txt @@ -1,6 +1,10 @@ -You can visit The Video tutorial Linked to this archive at https://www.youtube.com/watch?v=CGkmfBHEODE -This Archive has been uploaded by Nidhal Abidi From IKOW -Please visit Iknow @ www.youtube.com/iknowbrain -or at: -www.iknowbrain.work -Thank you for your support :) +سلام + +سامانه عامل از ابتدا، سامانه ای آزمایشی و آموزشی است که نوشتن سامانه عامل از ابتدا را به شما می آموزد. + +شما می توانید راهنمای ویدیویی این سامانه عامل را از نشانی زیر مشاهده کنید + http://www.aparat.ir/v/mtKEP + +You can visit The Video tutorial Linked to this archive at http://www.aparat.ir/v/mtKEP + + diff --git a/include/idt.h b/include/idt.h index f80acc8..9db9e61 100644 --- a/include/idt.h +++ b/include/idt.h @@ -18,9 +18,7 @@ typedef struct { uint32 base; } __attribute__((packed)) idt_register_t; -#define IDT_ENTRIES 256 -idt_gate_t idt[IDT_ENTRIES]; -idt_register_t idt_reg; + /* Functions implemented in idt.c */ diff --git a/include/isr.h b/include/isr.h index 7210576..ef183bd 100644 --- a/include/isr.h +++ b/include/isr.h @@ -38,7 +38,7 @@ void isr30(); void isr31(); -string exception_messages[32]; +//string exception_messages[32]; void isr_install(); diff --git a/include/screen.h b/include/screen.h index 504e120..a9bfa72 100644 --- a/include/screen.h +++ b/include/screen.h @@ -2,8 +2,8 @@ #define SCREEN_H #include "system.h" #include "string.h" -int cursorX , cursorY; -const uint8 sw ,sh ,sd ; +//int cursorX , cursorY; +//const uint8 sw ,sh ,sd ; //We define the screen width, height, and depth. void clearLine(uint8 from,uint8 to); diff --git a/makefile b/makefile index a5399ad..c1c404b 100644 --- a/makefile +++ b/makefile @@ -8,17 +8,18 @@ EMULATOR = qemu-system-i386 EMULATOR_FLAGS = -kernel OBJS = obj/kasm.o obj/kc.o obj/idt.o obj/isr.o obj/kb.o obj/screen.o obj/string.o obj/system.o obj/util.o obj/shell.o -OUTPUT = iknow/boot/kernel.bin +OUTPUT = OSFS/boot/kernel.bin run: all $(EMULATOR) $(EMULATOR_FLAGS) $(OUTPUT) all:$(OBJS) - mkdir iknow/ -p - mkdir iknow/boot/ -p + mkdir OSFS/ -p + mkdir OSFS/boot/ -p $(LINKER) $(LDFLAGS) -o $(OUTPUT) $(OBJS) obj/kasm.o:src/kernel.asm + mkdir obj/ -p $(ASSEMBLER) $(ASFLAGS) -o obj/kasm.o src/kernel.asm obj/kc.o:src/kernel.c @@ -51,18 +52,19 @@ obj/shell.o:src/shell.c build:all #Activate the install xorr if you do not have it already installed #sudo apt-get install xorriso - rm iknow/boot/grub/ -r -f - mkdir iknow/boot/grub/ - echo set default=0 >> iknow/boot/grub/grub.cfg - echo set timeout=0 >> iknow/boot/grub/grub.cfg - echo menuentry "IKnow" { >> iknow/boot/grub/grub.cfg - echo set root='(hd96)' >> iknow/boot/grub/grub.cfg - echo multiboot /boot/kernel.bin >> iknow/boot/grub/grub.cfg - echo } >> iknow/boot/grub/grub.cfg + rm OSFS/boot/grub/ -r -f + mkdir OSFS/boot/grub/ + echo set default=0 >> OSFS/boot/grub/grub.cfg + echo set timeout=5 >> OSFS/boot/grub/grub.cfg + echo menuentry "Salam 0.0.10" { >> OSFS/boot/grub/grub.cfg + echo set root='(hd96)' >> OSFS/boot/grub/grub.cfg + echo multiboot /boot/kernel.bin >> OSFS/boot/grub/grub.cfg + echo } >> OSFS/boot/grub/grub.cfg - grub-mkrescue -o iknow.iso iknow/ + grub-mkrescue -o OSFS.iso OSFS/ clear: + rm -r -f obj/ rm -f obj/*.o - rm -r -f iknow/ + rm -r -f OSFS/ diff --git a/src/idt.c b/src/idt.c index 2f7ef6a..ceb1f24 100644 --- a/src/idt.c +++ b/src/idt.c @@ -1,6 +1,10 @@ #include "../include/idt.h" #include "../include/util.h" +#define IDT_ENTRIES 256 +idt_gate_t idt[IDT_ENTRIES]; +idt_register_t idt_reg; + void set_idt_gate(int n, uint32 handler) { idt[n].low_offset = low_16(handler); idt[n].sel = KERNEL_CS; diff --git a/src/isr.c b/src/isr.c index 6aa155e..f1f7400 100644 --- a/src/isr.c +++ b/src/isr.c @@ -3,6 +3,45 @@ #include "../include/screen.h" #include "../include/util.h" +/* To print the message which defines every exception */ +string exception_messages[] = { + "Division By Zero", + "Debug", + "Non Maskable Interrupt", + "Breakpoint", + "Into Detected Overflow", + "Out of Bounds", + "Invalid Opcode", + "No Coprocessor", + + "Double Fault", + "Coprocessor Segment Overrun", + "Bad TSS", + "Segment Not Present", + "Stack Fault", + "General Protection Fault", + "Page Fault", + "Unknown Interrupt", + + "Coprocessor Fault", + "Alignment Check", + "Machine Check", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "Reserved" +}; + void isr_install() { set_idt_gate(0, (uint32)isr0); set_idt_gate(1, (uint32)isr1); @@ -207,41 +246,4 @@ void isr31() -/* To print the message which defines every exception */ -string exception_messages[] = { - "Division By Zero", - "Debug", - "Non Maskable Interrupt", - "Breakpoint", - "Into Detected Overflow", - "Out of Bounds", - "Invalid Opcode", - "No Coprocessor", - - "Double Fault", - "Coprocessor Segment Overrun", - "Bad TSS", - "Segment Not Present", - "Stack Fault", - "General Protection Fault", - "Page Fault", - "Unknown Interrupt", - - "Coprocessor Fault", - "Alignment Check", - "Machine Check", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved" -}; diff --git a/src/kernel.c b/src/kernel.c index 5311484..36c254e 100644 --- a/src/kernel.c +++ b/src/kernel.c @@ -1,12 +1,43 @@ #include "../include/kb.h" #include "../include/isr.h" -#include "../include/idt.h" -#include "../include/util.h" #include "../include/shell.h" -kmain() + + +int kmain() { - isr_install(); + isr_install(); //interrupt service routin clearScreen(); - print("Hi and Welcome to NIDOS operating system\nPlease enter a command\n"); - launch_shell(0); -} + //int a = 5/0; //برای آزمایش وقفه- ۷ + print("Salam\nWelcome to OSFS 0.0.10\n Hi Mohammad \nthanks\n\nPlease Enter a command \n"); + + launch_shell(0); + /* برای قسمت ۲ تا ۹ بود- به جای پوسته + while(1){ + print ("\nOSFS> "); + + string ch = readStr(); + if(strEql(ch, "cmd")){ + print("\nYou are allready in cmd"); + } + else if(strEql(ch, "clear")){ + clearScreen(); + } + else{ + print("\nBad command!"); + } + print("\n"); + + + } + برای آموزش قسمت اول بود + char* vidmem=(char *)0xb8000; + vidmem[0] = 'A'; + vidmem[1] = 0x02; + vidmem[2] = 'L'; + vidmem[3] = 0x02; + vidmem[4] = 'I'; + vidmem[5] = 0x02; + + */ + return 0; +}