fix: reprise du shell après erreur fatale, test avec commande pagefault
This commit is contained in:
parent
62bd72dfe0
commit
28c831870e
|
@ -17,3 +17,4 @@ int mode();
|
||||||
int clear();
|
int clear();
|
||||||
int dump_regs();
|
int dump_regs();
|
||||||
int info();
|
int info();
|
||||||
|
int pagefault();
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
/*******************************************************************************/
|
||||||
|
/* COS2000 - Compatible Operating System - LGPL v3 - Hordé Nicolas */
|
||||||
|
/* */extern restart;
|
|
@ -7,6 +7,7 @@
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
#include "gdt.h"
|
#include "gdt.h"
|
||||||
|
#include "system.h"
|
||||||
|
|
||||||
#define IDT_SIZE 256 /* nombre de descripteurs */
|
#define IDT_SIZE 256 /* nombre de descripteurs */
|
||||||
|
|
||||||
|
@ -16,6 +17,16 @@ static struct idtr idtreg;
|
||||||
/* table de IDT */
|
/* table de IDT */
|
||||||
static idtdes idt[IDT_SIZE];
|
static idtdes idt[IDT_SIZE];
|
||||||
|
|
||||||
|
static u32 retry_address;
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* Initialise la reprise après erreur */
|
||||||
|
|
||||||
|
void initretry(u32 address)
|
||||||
|
{
|
||||||
|
retry_address=address;
|
||||||
|
}
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* Initialise le controleur d'interruption 8259A */
|
/* Initialise le controleur d'interruption 8259A */
|
||||||
|
|
||||||
|
@ -130,6 +141,9 @@ void cpuerror(const u8 * src)
|
||||||
print("\033[31m***** ERREUR CPU ****\r\n -");
|
print("\033[31m***** ERREUR CPU ****\r\n -");
|
||||||
print(src);
|
print(src);
|
||||||
dump_regs();
|
dump_regs();
|
||||||
|
print("<Appuyer une touche pour continuer>\r\n");
|
||||||
|
waitascii();
|
||||||
|
initselectors(retry_address);
|
||||||
/*while (true) {
|
/*while (true) {
|
||||||
nop();
|
nop();
|
||||||
}*/
|
}*/
|
||||||
|
|
16
lib/shell.c
16
lib/shell.c
|
@ -21,7 +21,8 @@ static command commands[] = {
|
||||||
{"REGS" , "", &dump_regs},
|
{"REGS" , "", &dump_regs},
|
||||||
{"GDT" , "", &readgdt},
|
{"GDT" , "", &readgdt},
|
||||||
{"IDT" , "", &readidt},
|
{"IDT" , "", &readidt},
|
||||||
{"INFO", "", &info}
|
{"INFO" , "", &info},
|
||||||
|
{"PAGEFAULT" , "", &pagefault}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*******************************************************************************/
|
/*******************************************************************************/
|
||||||
|
@ -56,7 +57,15 @@ void shell()
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************/
|
/*******************************************************************************/
|
||||||
|
/* Génère une erreur de page à l'adresse 0xE0000000 */
|
||||||
|
int pagefault()
|
||||||
|
{
|
||||||
|
print("*** Creation d'une erreur de page ***\r\n");
|
||||||
|
asm("mov $0x66666666, %eax \n \
|
||||||
|
mov %eax,0xE0000000");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************/
|
||||||
/* Information sur le démarrage */
|
/* Information sur le démarrage */
|
||||||
int info()
|
int info()
|
||||||
{
|
{
|
||||||
|
@ -74,7 +83,6 @@ int regs()
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************/
|
/*******************************************************************************/
|
||||||
|
|
||||||
/* Change le mode */
|
/* Change le mode */
|
||||||
int mode()
|
int mode()
|
||||||
{
|
{
|
||||||
|
@ -190,10 +198,10 @@ int readgdt()
|
||||||
("\r\nSelecteur %hX: base:%X limit:%X access:%hX flags:%hX\r\n -> ",
|
("\r\nSelecteur %hX: base:%X limit:%X access:%hX flags:%hX\r\n -> ",
|
||||||
index * sizeof(gdtdes), base, limit, acces, flags);
|
index * sizeof(gdtdes), base, limit, acces, flags);
|
||||||
if ((acces >> 4) & 1 == 1)
|
if ((acces >> 4) & 1 == 1)
|
||||||
print("Systeme ");
|
print("System ");
|
||||||
else {
|
else {
|
||||||
if (acces & 1 == 1)
|
if (acces & 1 == 1)
|
||||||
print("Acces ");
|
print("Access ");
|
||||||
}
|
}
|
||||||
if ((acces >> 3) & 1 == 1) {
|
if ((acces >> 3) & 1 == 1) {
|
||||||
print("Code.");
|
print("Code.");
|
||||||
|
|
|
@ -81,6 +81,7 @@ int main(u32 magic, u32 addr)
|
||||||
print("\033[37m\033[0m -Initilisation des interruptions (IDT/PIC)");
|
print("\033[37m\033[0m -Initilisation des interruptions (IDT/PIC)");
|
||||||
initidt();
|
initidt();
|
||||||
initpic();
|
initpic();
|
||||||
|
initretry(&&retry);
|
||||||
sti();
|
sti();
|
||||||
ok();
|
ok();
|
||||||
|
|
||||||
|
@ -107,10 +108,6 @@ int main(u32 magic, u32 addr)
|
||||||
initsyscall();
|
initsyscall();
|
||||||
ok();
|
ok();
|
||||||
|
|
||||||
print(" -Create a double fault error");
|
retry:
|
||||||
asm("mov $0x66666666, %eax \n \
|
|
||||||
mov %eax,0xE0000000");
|
|
||||||
error();
|
|
||||||
|
|
||||||
shell();
|
shell();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue