2007-04-02 14:52:01 +02:00
|
|
|
#include "vga.h"
|
2007-04-02 15:26:03 +02:00
|
|
|
#include "video.h"
|
2018-08-17 16:46:56 +02:00
|
|
|
#include "interrupts.h"
|
2007-04-02 15:47:30 +02:00
|
|
|
#include "timer.h"
|
|
|
|
#include "keyboard.h"
|
2007-04-02 16:19:44 +02:00
|
|
|
#include "mouse.h"
|
2007-04-02 15:47:30 +02:00
|
|
|
#include "asm.h"
|
2007-04-02 16:19:44 +02:00
|
|
|
#include "cpu.h"
|
|
|
|
#include "string.h"
|
2018-08-22 17:36:30 +02:00
|
|
|
#include "2d.h"
|
2007-04-02 16:19:44 +02:00
|
|
|
#include "ansi.c"
|
2018-08-31 02:48:03 +02:00
|
|
|
#include "gdt.h"
|
2018-09-17 18:17:11 +02:00
|
|
|
#include "shell.h"
|
2018-09-18 14:29:35 +02:00
|
|
|
#include "syscall.h"
|
2007-04-02 16:19:44 +02:00
|
|
|
|
2018-09-27 07:55:24 +02:00
|
|
|
static u8 __attribute__((section(".multiboot"))) magicmultiboot[28]={0xD6,0x50,0x52,0xE8,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x12,0xaf,0xad,0x17,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00};
|
|
|
|
|
2018-08-17 16:46:56 +02:00
|
|
|
static u8 warnmsg[] =
|
|
|
|
"\033[99C\033[8D\033[37m\033[1m[ \033[36mNON\033[37m ]\033[0m\000";
|
|
|
|
static u8 okmsg[] =
|
|
|
|
"\033[99C\033[8D\033[37m\033[1m[ \033[32mOK\033[37m ]\033[0m\000";
|
|
|
|
static u8 errormsg[] =
|
|
|
|
"\033[99C\033[8D\033[37m\033[1m[\033[31mERREUR\033[37m]\033[0m\000";
|
|
|
|
static u8 key = 0;
|
2007-04-02 16:19:44 +02:00
|
|
|
|
|
|
|
void ok()
|
|
|
|
{
|
2018-08-17 16:46:56 +02:00
|
|
|
print(okmsg);
|
|
|
|
return;
|
2007-04-02 16:19:44 +02:00
|
|
|
}
|
2007-04-02 14:52:01 +02:00
|
|
|
|
2018-08-17 16:46:56 +02:00
|
|
|
void warning()
|
|
|
|
{
|
|
|
|
print(warnmsg);
|
|
|
|
return;
|
|
|
|
}
|
2007-04-02 16:19:44 +02:00
|
|
|
|
2018-08-17 16:46:56 +02:00
|
|
|
void error()
|
|
|
|
{
|
|
|
|
print(errormsg);
|
|
|
|
return;
|
2007-04-02 15:26:03 +02:00
|
|
|
}
|
2007-04-02 15:47:30 +02:00
|
|
|
|
2018-08-17 16:46:56 +02:00
|
|
|
int main(void)
|
|
|
|
{
|
2018-09-27 07:55:24 +02:00
|
|
|
asm("movl $0x0000FFFF, %esp");
|
2018-08-17 16:46:56 +02:00
|
|
|
cli();
|
|
|
|
setvmode(0x02);
|
|
|
|
/* Efface l'ecran */
|
|
|
|
print("\033[2J\000");
|
|
|
|
printf(ansilogo);
|
|
|
|
|
2018-09-01 22:58:05 +02:00
|
|
|
print("\033[37m\033[0m -Chargement noyaux\000");
|
|
|
|
ok();
|
|
|
|
|
|
|
|
print("\033[37m\033[0m -Initilisation de la memoire (GDT)\000");
|
2018-09-17 18:17:11 +02:00
|
|
|
initgdt(&&next);
|
|
|
|
next:
|
2018-09-01 22:58:05 +02:00
|
|
|
ok();
|
|
|
|
|
2018-09-18 15:11:50 +02:00
|
|
|
print("\033[37m\033[0m -Initilisation des taches (TSR)\000");
|
|
|
|
inittr();
|
|
|
|
ok();
|
|
|
|
|
2018-09-01 22:58:05 +02:00
|
|
|
print("\033[37m\033[0m -Initilisation des interruptions (IDT/PIC)\000");
|
2018-08-17 16:46:56 +02:00
|
|
|
initidt();
|
|
|
|
initpic();
|
|
|
|
sti();
|
|
|
|
ok();
|
|
|
|
|
|
|
|
print(" -Installation du handler timer (IRQ 0)\000");
|
2018-09-17 18:17:11 +02:00
|
|
|
setidt((u32) timer, SEL_KERNEL_CODE, INTGATE, 32);
|
2018-08-17 16:46:56 +02:00
|
|
|
enableirq(0);
|
|
|
|
ok();
|
|
|
|
|
|
|
|
print(" -Installation du handler clavier (IRQ 1)\000");
|
2018-09-17 18:17:11 +02:00
|
|
|
setidt((u32) keyboard, SEL_KERNEL_CODE, INTGATE, 33);
|
2018-08-17 16:46:56 +02:00
|
|
|
enableirq(1);
|
|
|
|
ok();
|
|
|
|
|
|
|
|
print(" -Installation du handler souris (IRQ12+Cascade IRQ2)\000");
|
2018-09-17 18:17:11 +02:00
|
|
|
setidt((u32) mouse, SEL_KERNEL_CODE, INTGATE, 100);
|
2018-08-17 16:46:56 +02:00
|
|
|
enableirq(2);
|
|
|
|
enableirq(12);
|
|
|
|
if (initmouse() != 1)
|
|
|
|
warning();
|
|
|
|
else
|
|
|
|
ok();
|
2018-09-18 14:29:35 +02:00
|
|
|
|
|
|
|
print(" -Installation des appels systemes utilisateur\000");
|
|
|
|
initsyscall();
|
|
|
|
ok();
|
|
|
|
|
2018-09-17 18:17:11 +02:00
|
|
|
shell();
|
2018-08-17 16:46:56 +02:00
|
|
|
}
|