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-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-11-29 13:42:07 +01:00
|
|
|
#include "memory.h"
|
2018-09-27 07:55:24 +02:00
|
|
|
|
2018-08-17 16:46:56 +02:00
|
|
|
static u8 warnmsg[] =
|
2018-12-12 15:25:04 +01: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-12-12 15:25:04 +01: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-12-12 15:25:04 +01: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
|
|
|
|
2018-12-19 16:13:47 +01:00
|
|
|
extern wrapper_timer;
|
2018-12-20 17:16:51 +01:00
|
|
|
extern wrapper_interruption20;
|
2018-12-19 16:13:47 +01:00
|
|
|
|
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-12-27 14:24:47 +01:00
|
|
|
int main(u8* info)
|
2018-08-17 16:46:56 +02:00
|
|
|
{
|
|
|
|
cli();
|
2018-11-22 17:21:15 +01:00
|
|
|
initdriver();
|
|
|
|
registerdriver(&vgafonctions);
|
|
|
|
registerdriver(&vesafonctions);
|
|
|
|
apply_bestdriver();
|
|
|
|
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-12-14 01:06:37 +01:00
|
|
|
print("\033[37m\033[0m -Initilisation de la memoire virtuelle");
|
2018-09-27 17:47:27 +02:00
|
|
|
initgdt(&&next);
|
2018-12-12 15:25:04 +01:00
|
|
|
next:
|
2018-11-22 17:21:15 +01:00
|
|
|
initpaging();
|
2018-12-12 15:25:04 +01:00
|
|
|
remap_memory(VESA_FBMEM);
|
2018-12-12 10:14:31 +01:00
|
|
|
ok();
|
|
|
|
|
2018-12-14 01:06:37 +01:00
|
|
|
print("\033[37m\033[0m -Initilisation des processus");
|
2018-12-12 10:14:31 +01:00
|
|
|
inittr();
|
2018-12-12 17:57:23 +01:00
|
|
|
initretry(&&retry);
|
2018-12-19 12:06:05 +01:00
|
|
|
initprocesses();
|
2018-12-14 01:06:37 +01:00
|
|
|
initsyscall();
|
2018-10-02 02:16:14 +02:00
|
|
|
ok();
|
|
|
|
|
2018-12-14 01:06:37 +01:00
|
|
|
print("\033[37m\033[0m -Initilisation des interruptions");
|
2018-08-17 16:46:56 +02:00
|
|
|
initidt();
|
|
|
|
initpic();
|
2018-12-20 17:16:51 +01:00
|
|
|
setidt((u32) &wrapper_interruption20, SEL_KERNEL_CODE,
|
|
|
|
ENTRY_PRESENT | ENTRY_RING3 | TRAPGATE, 20);
|
2018-08-17 16:46:56 +02:00
|
|
|
sti();
|
|
|
|
ok();
|
|
|
|
|
2018-12-19 16:13:47 +01:00
|
|
|
print(" -Installation de l'ordonnanceur et horloge systeme (IRQ 0)");
|
|
|
|
setidt((u32) &wrapper_timer, SEL_KERNEL_CODE,
|
2018-12-12 15:25:04 +01:00
|
|
|
ENTRY_PRESENT | ENTRY_RING0 | INTGATE, 32);
|
2018-08-17 16:46:56 +02:00
|
|
|
enableirq(0);
|
|
|
|
ok();
|
|
|
|
|
2018-12-14 01:06:37 +01:00
|
|
|
print(" -Installation du pilote clavier (IRQ 1)");
|
2018-12-19 16:13:47 +01:00
|
|
|
setidt((u32) &keyboard_handler, SEL_KERNEL_CODE,
|
2018-12-12 15:25:04 +01:00
|
|
|
ENTRY_PRESENT | ENTRY_RING0 | INTGATE, 33);
|
2018-08-17 16:46:56 +02:00
|
|
|
enableirq(1);
|
|
|
|
ok();
|
|
|
|
|
2018-12-14 01:06:37 +01:00
|
|
|
print(" -Installation du pilote souris (IRQ12+IRQ2)");
|
2018-12-19 16:13:47 +01:00
|
|
|
setidt((u32) &mouse_handler, SEL_KERNEL_CODE,
|
2018-12-12 15:25:04 +01:00
|
|
|
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-12-14 01:06:37 +01:00
|
|
|
printf(" -Installation du coprocesseur arithmetique");
|
2018-12-12 15:25:04 +01:00
|
|
|
finit();
|
2018-09-18 14:29:35 +02:00
|
|
|
ok();
|
2018-12-12 15:25:04 +01:00
|
|
|
|
|
|
|
retry:
|
2018-11-22 17:21:15 +01:00
|
|
|
sti();
|
2018-09-27 17:47:27 +02:00
|
|
|
shell();
|
2018-08-17 16:46:56 +02:00
|
|
|
}
|