2018-09-28 20:35:51 +02:00
|
|
|
/*******************************************************************************/
|
|
|
|
/* COS2000 - Compatible Operating System - LGPL v3 - Hordé Nicolas */
|
|
|
|
/* */
|
2007-04-02 14:52:01 +02:00
|
|
|
#include "vga.h"
|
2018-10-13 17:17:40 +02:00
|
|
|
#include "vesa.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"
|
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"
|
2018-09-27 17:12:12 +02:00
|
|
|
#include "multiboot2.h"
|
2018-09-27 07:55:24 +02:00
|
|
|
|
2018-08-17 16:46:56 +02:00
|
|
|
static u8 warnmsg[] =
|
2018-10-14 12:50:32 +02:00
|
|
|
"\033[150C\033[8D\033[37m\033[1m[ \033[36mNON\033[37m ]\033[0m";
|
2018-08-17 16:46:56 +02:00
|
|
|
static u8 okmsg[] =
|
2018-10-14 12:50:32 +02:00
|
|
|
"\033[150C\033[8D\033[37m\033[1m[ \033[32mOK\033[37m ]\033[0m";
|
2018-08-17 16:46:56 +02:00
|
|
|
static u8 errormsg[] =
|
2018-10-14 12:50:32 +02:00
|
|
|
"\033[150C\033[8D\033[37m\033[1m[\033[31mERREUR\033[37m]\033[0m";
|
2018-08-17 16:46:56 +02:00
|
|
|
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-09-27 21:01:02 +02:00
|
|
|
int main(u32 magic, u32 addr)
|
2018-08-17 16:46:56 +02:00
|
|
|
{
|
|
|
|
cli();
|
2018-10-13 17:17:40 +02:00
|
|
|
if (magic == MULTIBOOT2_BOOTLOADER_MAGIC) initmultiboot(addr);
|
|
|
|
initdriver();
|
|
|
|
registerdriver(&vgafonctions);
|
|
|
|
registerdriver(&vesafonctions);
|
|
|
|
apply_bestdriver();
|
2018-10-14 11:14:34 +02:00
|
|
|
changemode(0x1);
|
2018-09-27 17:32:25 +02:00
|
|
|
|
2018-10-13 17:17:40 +02:00
|
|
|
/* Efface l'ecran */
|
|
|
|
print("\033[2J\r\n\000");
|
2018-10-14 16:18:51 +02:00
|
|
|
logo();
|
2018-08-17 16:46:56 +02:00
|
|
|
|
2018-09-27 21:01:02 +02:00
|
|
|
print("\033[37m\033[0m -Chargement noyaux");
|
2018-09-27 17:47:27 +02:00
|
|
|
ok();
|
2018-09-27 17:32:25 +02:00
|
|
|
|
2018-09-27 21:01:02 +02:00
|
|
|
print("\033[37m\033[0m -Initilisation de la memoire (GDT)");
|
2018-09-27 17:47:27 +02:00
|
|
|
initgdt(&&next);
|
|
|
|
next:
|
2018-09-01 22:58:05 +02:00
|
|
|
ok();
|
|
|
|
|
2018-09-27 21:01:02 +02:00
|
|
|
print("\033[37m\033[0m -Initilisation des taches (TSR)");
|
2018-09-27 17:47:27 +02:00
|
|
|
inittr();
|
2018-09-18 15:11:50 +02:00
|
|
|
ok();
|
|
|
|
|
2018-10-02 02:16:14 +02:00
|
|
|
print("\033[37m\033[0m -Initilisation de la pagination (PAGING)");
|
2018-10-13 17:17:40 +02:00
|
|
|
//initpaging();
|
2018-10-02 02:16:14 +02:00
|
|
|
ok();
|
|
|
|
|
2018-09-27 21:01:02 +02:00
|
|
|
print("\033[37m\033[0m -Initilisation des interruptions (IDT/PIC)");
|
2018-08-17 16:46:56 +02:00
|
|
|
initidt();
|
|
|
|
initpic();
|
2018-10-02 13:49:10 +02:00
|
|
|
initretry(&&retry);
|
2018-08-17 16:46:56 +02:00
|
|
|
sti();
|
|
|
|
ok();
|
|
|
|
|
2018-09-27 21:01:02 +02:00
|
|
|
print(" -Installation du handler timer (IRQ 0)");
|
2018-10-04 14:55:41 +02:00
|
|
|
setidt((u32) timer, SEL_KERNEL_CODE, ENTRY_PRESENT | ENTRY_RING0 | INTGATE, 32);
|
2018-08-17 16:46:56 +02:00
|
|
|
enableirq(0);
|
|
|
|
ok();
|
|
|
|
|
2018-09-27 21:01:02 +02:00
|
|
|
print(" -Installation du handler clavier (IRQ 1)");
|
2018-10-04 14:55:41 +02:00
|
|
|
setidt((u32) keyboard, SEL_KERNEL_CODE, ENTRY_PRESENT | ENTRY_RING0 | INTGATE, 33);
|
2018-08-17 16:46:56 +02:00
|
|
|
enableirq(1);
|
|
|
|
ok();
|
|
|
|
|
2018-09-27 21:01:02 +02:00
|
|
|
print(" -Installation du handler souris (IRQ12+Cascade IRQ2)");
|
2018-10-04 14:55:41 +02:00
|
|
|
setidt((u32) mouse, SEL_KERNEL_CODE, ENTRY_PRESENT | ENTRY_RING0 | INTGATE, 100);
|
2018-08-17 16:46:56 +02:00
|
|
|
enableirq(2);
|
|
|
|
enableirq(12);
|
|
|
|
if (initmouse() != 1)
|
|
|
|
warning();
|
|
|
|
else
|
|
|
|
ok();
|
2018-10-04 21:49:06 +02:00
|
|
|
printf(" -Installation des appels systemes utilisateur");
|
2018-09-18 14:29:35 +02:00
|
|
|
initsyscall();
|
|
|
|
ok();
|
2018-10-07 13:11:16 +02:00
|
|
|
|
2018-10-02 13:49:10 +02:00
|
|
|
retry:
|
2018-09-27 17:47:27 +02:00
|
|
|
shell();
|
2018-08-17 16:46:56 +02:00
|
|
|
}
|