feat: avancement de la création de tâche/processus

This commit is contained in:
Nicolas Hordé 2018-12-12 10:14:31 +01:00
parent 69fa9567a1
commit 524af1729c
11 changed files with 332 additions and 284 deletions

View File

@ -239,20 +239,41 @@ typedef struct regs {
u32 esp;
u32 ss;
} regs __attribute__ ((packed));
/* exception pile */
/* exception pile depuis code kernel*/
typedef struct exception_stack {
u32 error_code;
u32 eip;
u32 cs;
u32 eflags;
} exception_stack __attribute__ ((packed));
/* sans code erreur */
/* sans code erreur depuis code kernel*/
typedef struct exception_stack_noerror {
u32 eip;
u32 cs;
u32 eflags;
} exception_stack_noerror __attribute__ ((packed));
/* exception pile depuis code user */
typedef struct exception_stack_user {
u32 error_code;
u32 eip;
u32 cs;
u32 eflags;
u32 esp;
u32 ss;
} exception_stack_user __attribute__ ((packed));
/* sans code erreu depuis code user */
typedef struct exception_stack_noerror_user {
u32 eip;
u32 cs;
u32 eflags;
u32 esp;
u32 ss;
} exception_stack_noerror_user __attribute__ ((packed));
/* descripteur de segment */
typedef struct idtdes {
@ -268,7 +289,9 @@ struct idtr {
u32 base;
} __attribute__ ((packed));
void initretry(u32 address);
void initidt(void);
u32 getinitretry(void);
void setidt(u32 offset, u16 select, u16 type,u16 index);
void makeidtdes(u32 offset, u16 select, u16 type, idtdes* desc);
void initpic(void);

View File

@ -124,9 +124,10 @@ typedef struct stackdef {
typedef struct process {
u32 pid;
u32 pid;
bool kernel;
regs dump;
stackdef kstack;
stackdef kstack;
pd *pdd;
u32 result;
u8 status;
@ -142,7 +143,7 @@ typedef struct process {
void task_init();
u32 task_getfreePID ();
u32 task_usePID (u32 pid);
u32 task_create();
u32 task_create(u8 *code,bool kerneltask);
u32 elf_test(u8 *src);
u32 elf_load(u8 *src, u32 pid);
void task_switch(u32 pid, bool fromkernelmode);

195
lib/TEST/test.c Normal file
View File

@ -0,0 +1,195 @@
/*
Programme de test compilé en mode USER avec SYSCALL, le binaire est intégré au noyau pour test en attendant d'avoir un pilot de disque */
#include "types.h"
u8 programs_test[] = {
0x7f, 0x45, 0x4c, 0x46, 0x01, 0x01, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x40, 0x34, 0x00, 0x00, 0x00, 0xe4, 0x06, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x20, 0x00, 0x02, 0x00, 0x28, 0x00,
0x0c, 0x00, 0x09, 0x00, 0x01, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x40, 0xa0, 0x00, 0x00, 0x00,
0xa0, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x51, 0xe5, 0x74, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x06, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x8d, 0x4c, 0x24, 0x04,
0x83, 0xe4, 0xf0, 0xff, 0x71, 0xfc, 0x55, 0x89, 0xe5, 0x51, 0x83, 0xec,
0x04, 0xe8, 0x0a, 0x00, 0x00, 0x00, 0x90, 0x83, 0xc4, 0x04, 0x59, 0x5d,
0x8d, 0x61, 0xfc, 0xc3, 0x55, 0x89, 0xe5, 0x83, 0xec, 0x10, 0xb8, 0x00,
0x00, 0x00, 0x00, 0x89, 0xe1, 0xba, 0x34, 0x00, 0x00, 0x40, 0x0f, 0x34,
0x89, 0x45, 0xfc, 0x90, 0xc9, 0xc3, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x7a, 0x52, 0x00, 0x01, 0x7c, 0x08, 0x01,
0x1b, 0x0c, 0x04, 0x04, 0x88, 0x01, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00,
0x1c, 0x00, 0x00, 0x00, 0xa4, 0xff, 0xff, 0xff, 0x20, 0x00, 0x00, 0x00,
0x00, 0x44, 0x0c, 0x01, 0x00, 0x47, 0x10, 0x05, 0x02, 0x75, 0x00, 0x43,
0x0f, 0x03, 0x75, 0x7c, 0x06, 0x4d, 0xc1, 0x0c, 0x01, 0x00, 0x41, 0xc5,
0x43, 0x0c, 0x04, 0x04, 0x1c, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00,
0x98, 0xff, 0xff, 0xff, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x41, 0x0e, 0x08,
0x85, 0x02, 0x42, 0x0d, 0x05, 0x56, 0xc5, 0x0c, 0x04, 0x04, 0x00, 0x00,
0x80, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x01,
0x86, 0x00, 0x00, 0x00, 0x0c, 0x38, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x40, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x02, 0x01, 0x06, 0x33, 0x00, 0x00, 0x00, 0x02, 0x02, 0x05, 0x3f,
0x00, 0x00, 0x00, 0x03, 0x04, 0x05, 0x69, 0x6e, 0x74, 0x00, 0x02, 0x08,
0x05, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x05, 0x05, 0x00, 0x00, 0x00,
0x02, 0x01, 0x06, 0x2c, 0x00, 0x00, 0x00, 0x02, 0x01, 0x08, 0x2a, 0x00,
0x00, 0x00, 0x02, 0x02, 0x07, 0x49, 0x00, 0x00, 0x00, 0x02, 0x04, 0x07,
0x18, 0x00, 0x00, 0x00, 0x02, 0x08, 0x07, 0x13, 0x00, 0x00, 0x00, 0x02,
0x04, 0x07, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x0e, 0x00, 0x00, 0x00, 0x01,
0x08, 0x00, 0x00, 0x00, 0x40, 0x20, 0x00, 0x00, 0x00, 0x01, 0x9c, 0x00,
0xa7, 0x00, 0x00, 0x00, 0x04, 0x00, 0x42, 0x00, 0x00, 0x00, 0x04, 0x01,
0xe9, 0x00, 0x00, 0x00, 0x0c, 0x57, 0x01, 0x00, 0x00, 0x67, 0x01, 0x00,
0x00, 0x20, 0x00, 0x00, 0x40, 0x1a, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00,
0x00, 0x02, 0x01, 0x06, 0x33, 0x00, 0x00, 0x00, 0x02, 0x02, 0x05, 0x3f,
0x00, 0x00, 0x00, 0x03, 0x04, 0x05, 0x69, 0x6e, 0x74, 0x00, 0x02, 0x08,
0x05, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x05, 0x05, 0x00, 0x00, 0x00,
0x02, 0x01, 0x06, 0x2c, 0x00, 0x00, 0x00, 0x02, 0x01, 0x08, 0x2a, 0x00,
0x00, 0x00, 0x02, 0x02, 0x07, 0x49, 0x00, 0x00, 0x00, 0x02, 0x04, 0x07,
0x18, 0x00, 0x00, 0x00, 0x02, 0x08, 0x07, 0x13, 0x00, 0x00, 0x00, 0x04,
0x75, 0x33, 0x32, 0x00, 0x02, 0x1d, 0x76, 0x00, 0x00, 0x00, 0x02, 0x04,
0x07, 0x1d, 0x00, 0x00, 0x00, 0x05, 0x5e, 0x01, 0x00, 0x00, 0x01, 0x09,
0x6b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x40, 0x1a, 0x00, 0x00, 0x00,
0x01, 0x9c, 0x06, 0x26, 0x00, 0x00, 0x40, 0x11, 0x00, 0x00, 0x00, 0x07,
0x5f, 0x76, 0x00, 0x01, 0x0b, 0x6b, 0x00, 0x00, 0x00, 0x02, 0x91, 0x74,
0x00, 0x00, 0x00, 0x01, 0x11, 0x01, 0x25, 0x0e, 0x13, 0x0b, 0x03, 0x0e,
0x1b, 0x0e, 0x11, 0x01, 0x12, 0x06, 0x10, 0x17, 0x00, 0x00, 0x02, 0x24,
0x00, 0x0b, 0x0b, 0x3e, 0x0b, 0x03, 0x0e, 0x00, 0x00, 0x03, 0x24, 0x00,
0x0b, 0x0b, 0x3e, 0x0b, 0x03, 0x08, 0x00, 0x00, 0x04, 0x2e, 0x00, 0x3f,
0x19, 0x03, 0x0e, 0x3a, 0x0b, 0x3b, 0x0b, 0x27, 0x19, 0x11, 0x01, 0x12,
0x06, 0x40, 0x18, 0x96, 0x42, 0x19, 0x00, 0x00, 0x00, 0x01, 0x11, 0x01,
0x25, 0x0e, 0x13, 0x0b, 0x03, 0x0e, 0x1b, 0x0e, 0x11, 0x01, 0x12, 0x06,
0x10, 0x17, 0x00, 0x00, 0x02, 0x24, 0x00, 0x0b, 0x0b, 0x3e, 0x0b, 0x03,
0x0e, 0x00, 0x00, 0x03, 0x24, 0x00, 0x0b, 0x0b, 0x3e, 0x0b, 0x03, 0x08,
0x00, 0x00, 0x04, 0x16, 0x00, 0x03, 0x08, 0x3a, 0x0b, 0x3b, 0x0b, 0x49,
0x13, 0x00, 0x00, 0x05, 0x2e, 0x01, 0x3f, 0x19, 0x03, 0x0e, 0x3a, 0x0b,
0x3b, 0x0b, 0x27, 0x19, 0x49, 0x13, 0x11, 0x01, 0x12, 0x06, 0x40, 0x18,
0x97, 0x42, 0x19, 0x00, 0x00, 0x06, 0x0b, 0x01, 0x11, 0x01, 0x12, 0x06,
0x00, 0x00, 0x07, 0x34, 0x00, 0x03, 0x08, 0x3a, 0x0b, 0x3b, 0x0b, 0x49,
0x13, 0x02, 0x18, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x40, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x84, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x40, 0x1a, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x00,
0x00, 0x00, 0x02, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x01, 0x01, 0xfb, 0x0e,
0x0d, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
0x01, 0x00, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x63, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x05, 0x02, 0x00, 0x00, 0x00, 0x40, 0x1a, 0x08, 0x13, 0x59,
0x02, 0x0a, 0x00, 0x01, 0x01, 0x4b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x33,
0x00, 0x00, 0x00, 0x01, 0x01, 0xfb, 0x0e, 0x0d, 0x00, 0x01, 0x01, 0x01,
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x2e, 0x2e, 0x2f, 0x69,
0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x00, 0x00, 0x6c, 0x69, 0x62, 0x63,
0x2e, 0x63, 0x00, 0x00, 0x00, 0x00, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e,
0x68, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x05, 0x02, 0x20, 0x00, 0x00,
0x40, 0x03, 0x09, 0x01, 0x67, 0x08, 0x13, 0x02, 0x03, 0x00, 0x01, 0x01,
0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x69, 0x6e,
0x74, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x6c, 0x6f, 0x6e, 0x67, 0x20,
0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x75, 0x6e, 0x73, 0x69, 0x67, 0x6e, 0x65,
0x64, 0x20, 0x69, 0x6e, 0x74, 0x00, 0x75, 0x6e, 0x73, 0x69, 0x67, 0x6e,
0x65, 0x64, 0x20, 0x63, 0x68, 0x61, 0x72, 0x00, 0x74, 0x65, 0x73, 0x74,
0x2e, 0x63, 0x00, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x20, 0x69, 0x6e, 0x74,
0x00, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x20, 0x75, 0x6e, 0x73, 0x69, 0x67,
0x6e, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x74, 0x00, 0x2f, 0x68, 0x6f, 0x6d,
0x65, 0x2f, 0x68, 0x6f, 0x72, 0x64, 0x65, 0x2f, 0x42, 0x75, 0x72, 0x65,
0x61, 0x75, 0x2f, 0x50, 0x45, 0x52, 0x53, 0x4f, 0x2f, 0x63, 0x6f, 0x73,
0x32, 0x30, 0x30, 0x30, 0x2f, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x61, 0x6d,
0x73, 0x00, 0x47, 0x4e, 0x55, 0x20, 0x43, 0x31, 0x31, 0x20, 0x35, 0x2e,
0x34, 0x2e, 0x30, 0x20, 0x32, 0x30, 0x31, 0x36, 0x30, 0x36, 0x30, 0x39,
0x20, 0x2d, 0x6d, 0x33, 0x32, 0x20, 0x2d, 0x6d, 0x74, 0x75, 0x6e, 0x65,
0x3d, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x20, 0x2d, 0x6d, 0x61,
0x72, 0x63, 0x68, 0x3d, 0x69, 0x36, 0x38, 0x36, 0x20, 0x2d, 0x67, 0x20,
0x2d, 0x4f, 0x30, 0x20, 0x2d, 0x66, 0x66, 0x72, 0x65, 0x65, 0x73, 0x74,
0x61, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x2d, 0x66, 0x6e, 0x6f, 0x2d,
0x62, 0x75, 0x69, 0x6c, 0x74, 0x69, 0x6e, 0x20, 0x2d, 0x66, 0x6e, 0x6f,
0x2d, 0x70, 0x69, 0x65, 0x00, 0x47, 0x4e, 0x55, 0x20, 0x43, 0x31, 0x31,
0x20, 0x35, 0x2e, 0x34, 0x2e, 0x30, 0x20, 0x32, 0x30, 0x31, 0x36, 0x30,
0x36, 0x30, 0x39, 0x20, 0x2d, 0x46, 0x65, 0x6c, 0x66, 0x2d, 0x69, 0x33,
0x38, 0x36, 0x20, 0x2d, 0x6d, 0x33, 0x32, 0x20, 0x2d, 0x6d, 0x74, 0x75,
0x6e, 0x65, 0x3d, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x20, 0x2d,
0x6d, 0x61, 0x72, 0x63, 0x68, 0x3d, 0x69, 0x36, 0x38, 0x36, 0x20, 0x2d,
0x67, 0x20, 0x2d, 0x4f, 0x30, 0x20, 0x2d, 0x66, 0x66, 0x72, 0x65, 0x65,
0x73, 0x74, 0x61, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x2d, 0x66, 0x6e,
0x6f, 0x2d, 0x62, 0x75, 0x69, 0x6c, 0x74, 0x69, 0x6e, 0x20, 0x2d, 0x66,
0x6e, 0x6f, 0x2d, 0x70, 0x69, 0x65, 0x00, 0x6c, 0x69, 0x62, 0x63, 0x2e,
0x63, 0x00, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x70, 0x69, 0x00, 0x2f,
0x68, 0x6f, 0x6d, 0x65, 0x2f, 0x68, 0x6f, 0x72, 0x64, 0x65, 0x2f, 0x42,
0x75, 0x72, 0x65, 0x61, 0x75, 0x2f, 0x50, 0x45, 0x52, 0x53, 0x4f, 0x2f,
0x63, 0x6f, 0x73, 0x32, 0x30, 0x30, 0x30, 0x2f, 0x70, 0x72, 0x6f, 0x67,
0x72, 0x61, 0x6d, 0x73, 0x2f, 0x6c, 0x69, 0x62, 0x00, 0x47, 0x43, 0x43,
0x3a, 0x20, 0x28, 0x55, 0x62, 0x75, 0x6e, 0x74, 0x75, 0x20, 0x35, 0x2e,
0x34, 0x2e, 0x30, 0x2d, 0x36, 0x75, 0x62, 0x75, 0x6e, 0x74, 0x75, 0x31,
0x7e, 0x31, 0x36, 0x2e, 0x30, 0x34, 0x2e, 0x31, 0x30, 0x29, 0x20, 0x35,
0x2e, 0x34, 0x2e, 0x30, 0x20, 0x32, 0x30, 0x31, 0x36, 0x30, 0x36, 0x30,
0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x04, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x07, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0xf1, 0xff, 0x08, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0xf1, 0xff,
0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x20, 0x00, 0x00, 0x00,
0x12, 0x00, 0x01, 0x00, 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x40,
0x1a, 0x00, 0x00, 0x00, 0x12, 0x00, 0x01, 0x00, 0x00, 0x74, 0x65, 0x73,
0x74, 0x2e, 0x63, 0x00, 0x6c, 0x69, 0x62, 0x63, 0x2e, 0x63, 0x00, 0x6d,
0x61, 0x69, 0x6e, 0x00, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x70, 0x69,
0x00, 0x00, 0x2e, 0x73, 0x79, 0x6d, 0x74, 0x61, 0x62, 0x00, 0x2e, 0x73,
0x74, 0x72, 0x74, 0x61, 0x62, 0x00, 0x2e, 0x73, 0x68, 0x73, 0x74, 0x72,
0x74, 0x61, 0x62, 0x00, 0x2e, 0x74, 0x65, 0x78, 0x74, 0x00, 0x2e, 0x65,
0x68, 0x5f, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x00, 0x2e, 0x64, 0x65, 0x62,
0x75, 0x67, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x00, 0x2e, 0x64, 0x65, 0x62,
0x75, 0x67, 0x5f, 0x61, 0x62, 0x62, 0x72, 0x65, 0x76, 0x00, 0x2e, 0x64,
0x65, 0x62, 0x75, 0x67, 0x5f, 0x61, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73,
0x00, 0x2e, 0x64, 0x65, 0x62, 0x75, 0x67, 0x5f, 0x6c, 0x69, 0x6e, 0x65,
0x00, 0x2e, 0x64, 0x65, 0x62, 0x75, 0x67, 0x5f, 0x73, 0x74, 0x72, 0x00,
0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x74, 0x00, 0x00, 0x00,
0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x40,
0xb0, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x2b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x14, 0x01, 0x00, 0x00, 0x2f, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x02, 0x00, 0x00,
0xab, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xee, 0x02, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x54, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x2e, 0x03, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb4, 0x03, 0x00, 0x00,
0x95, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x49, 0x05, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x11, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x6d, 0x06, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00,
0xd0, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x50, 0x06, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
unsigned int programs_test_len = 2244;

View File

@ -29,6 +29,14 @@ void initretry(u32 address)
retry_address=address;
}
/******************************************************************************/
/* Récupère l'adresse de reprise après erreur */
u32 getinitretry(void)
{
return retry_address;
}
/******************************************************************************/
/* Initialise le controleur d'interruption 8259A */
@ -424,9 +432,9 @@ void exception14()
{
virtual_range_new(getcurrentprocess()->pdd, (u8 *) (dump->cr2 & 0xFFFFF000), PAGESIZE, PAGE_ALL);
}
else {
else {
printf("Page fault - %s at adress %Y cs:eip - %Y:%Y\r\n",ex14_errors[current->error_code & 0xF],dump->cr2,dump->cs,dump->eip);
cpuerror("#SS Page fault",dump);
cpuerror("#PGF Page fault",dump);
}
restdebugcpu();
iret();

View File

@ -111,7 +111,27 @@ void task_init() {
processes[i].pid=NULL;
processes[i].status=STATUS_FREE;
}
current=NULL;
processes[0].dump.ss = SEL_KERNEL_STACK;
processes[0].dump.esp = KERNEL_STACK_ADDR;
processes[0].dump.eflags = 0x0;
processes[0].dump.cs = SEL_KERNEL_CODE;
processes[0].dump.eip = getinitretry();
processes[0].dump.ds = SEL_KERNEL_DATA;
processes[0].dump.es = SEL_KERNEL_DATA;
processes[0].dump.fs = SEL_KERNEL_DATA;
processes[0].dump.gs = SEL_KERNEL_DATA;
processes[0].dump.cr3 = KERNEL_PD_ADDR;
processes[0].dump.eax = 0;
processes[0].dump.ecx = 0;
processes[0].dump.edx = 0;
processes[0].dump.ebx = 0;
processes[0].dump.ebp = 0;
processes[0].dump.esi = 0;
processes[0].dump.edi = 0;
processes[0].result = 0;
processes[0].status = STATUS_READY;
processes[0].kernel = true;
current=&processes[0];
lastpid=NULL;
}
@ -136,6 +156,7 @@ u32 task_getfreePID ()
/*******************************************************************************/
/* Récupère les informations sur le processus courant */
process *getcurrentprocess()
{
return current;
@ -156,7 +177,10 @@ void task_switch(u32 pid, bool fromkernelmode)
{
process *previous=current;
current = &processes[pid];
setTSS(current->kstack.ss0,current->kstack.esp0);
if (!current->kernel)
setTSS(current->kstack.ss0,current->kstack.esp0);
else
setTSS(0x0,0x0);
current->dump.eflags = (current->dump.eflags | 0x200) & 0xFFFFBFFF;
createdump(current->dump);
restdebugcpu();
@ -175,7 +199,7 @@ void task_run(u32 pid)
/*******************************************************************************/
/* Initialise une tâche */
u32 task_create(u8 *code)
u32 task_create(u8 *code,bool kerneltask)
{
process *previous=current;
u32 pid=task_getfreePID();
@ -184,41 +208,63 @@ u32 task_create(u8 *code)
processes[pid].pid = pid;
processes[pid].pdd = virtual_pd_create();
TAILQ_INIT(&processes[pid].page_head);
current = &processes[pid];
setcr3(processes[pid].pdd->addr->paddr);
kstack = virtual_page_getfree();
processes[pid].dump.ss = SEL_USER_STACK | RPL_RING3;
processes[pid].dump.esp = USER_STACK-16;
processes[pid].dump.eflags = 0x0;
processes[pid].dump.cs = SEL_USER_CODE | RPL_RING3;
processes[pid].dump.eip = elf_load(code,pid);
if (processes[pid].dump.eip==NULL)
return NULL;
processes[pid].dump.ds = SEL_USER_DATA | RPL_RING3;
processes[pid].dump.es = SEL_USER_DATA | RPL_RING3;
processes[pid].dump.fs = SEL_USER_DATA | RPL_RING3;
processes[pid].dump.gs = SEL_USER_DATA | RPL_RING3;
processes[pid].dump.cr3 = (u32) processes[pid].pdd->addr->paddr;
processes[pid].kstack.ss0 = SEL_KERNEL_STACK;
processes[pid].kstack.esp0 = (u32) kstack->vaddr + PAGESIZE - 16;
processes[pid].dump.eax = 0;
processes[pid].dump.ecx = 0;
processes[pid].dump.edx = 0;
processes[pid].dump.ebx = 0;
processes[pid].dump.ebp = 0;
processes[pid].dump.esi = 0;
processes[pid].dump.edi = 0;
processes[pid].result = 0;
processes[pid].status = STATUS_READY;
current = previous;
if (current==NULL)
{
u32 pd = KERNEL_PD_ADDR;
setcr3(pd);
}
else
{
setcr3(current->dump.cr3);
}
if (kerneltask)
{
processes[pid].dump.ss = SEL_KERNEL_STACK;
processes[pid].dump.esp = (u32) kstack->vaddr + PAGESIZE - 16;
processes[pid].dump.eflags = 0x0;
processes[pid].dump.cs = SEL_KERNEL_CODE;
processes[pid].dump.eip = elf_load(code,pid);
if (processes[pid].dump.eip==NULL)
return NULL;
processes[pid].dump.ds = SEL_KERNEL_DATA;
processes[pid].dump.es = SEL_KERNEL_DATA;
processes[pid].dump.fs = SEL_KERNEL_DATA;
processes[pid].dump.gs = SEL_KERNEL_DATA;
processes[pid].dump.cr3 = KERNEL_PD_ADDR;
processes[pid].dump.eax = 0;
processes[pid].dump.ecx = 0;
processes[pid].dump.edx = 0;
processes[pid].dump.ebx = 0;
processes[pid].dump.ebp = 0;
processes[pid].dump.esi = 0;
processes[pid].dump.edi = 0;
processes[pid].result = 0;
processes[pid].status = STATUS_READY;
processes[pid].kernel = true;
current = previous;
}
else
{
current = &processes[pid];
setcr3(processes[pid].pdd->addr->paddr);
kstack = virtual_page_getfree();
processes[pid].dump.ss = SEL_USER_STACK | RPL_RING3;
processes[pid].dump.esp = USER_STACK-16;
processes[pid].dump.eflags = 0x0;
processes[pid].dump.cs = SEL_USER_CODE | RPL_RING3;
processes[pid].dump.eip = elf_load(code,pid);
if (processes[pid].dump.eip==NULL)
return NULL;
processes[pid].dump.ds = SEL_USER_DATA | RPL_RING3;
processes[pid].dump.es = SEL_USER_DATA | RPL_RING3;
processes[pid].dump.fs = SEL_USER_DATA | RPL_RING3;
processes[pid].dump.gs = SEL_USER_DATA | RPL_RING3;
processes[pid].dump.cr3 = (u32) processes[pid].pdd->addr->paddr;
processes[pid].kstack.ss0 = SEL_KERNEL_STACK;
processes[pid].kstack.esp0 = (u32) kstack->vaddr + PAGESIZE - 16;
processes[pid].dump.eax = 0;
processes[pid].dump.ecx = 0;
processes[pid].dump.edx = 0;
processes[pid].dump.ebx = 0;
processes[pid].dump.ebp = 0;
processes[pid].dump.esi = 0;
processes[pid].dump.edi = 0;
processes[pid].result = 0;
processes[pid].status = STATUS_READY;
processes[pid].kernel = false;
current = previous;
setcr3(current->dump.cr3);
}
return pid;
}

View File

@ -87,13 +87,12 @@ int test(void)
/*******************************************************************************/
/* Test l'usage de création de tâche */
#include "test.c"
#include "TEST/test.c"
int testtask()
{
task_init();
print("*** Creation d'une tache");
u32 pid=task_create(&programs_test);
u32 pid=task_create(&programs_test,false);
task_run(pid);
}

View File

@ -1,225 +0,0 @@
/*
Programme de test compilé en mode USER avec SYSCALL, le binaire est intégré au noyau pour test en attendant d'avoir un pilot de disque */
#include "types.h"
static u8 programs_test[] = {
0x7f, 0x45, 0x4c, 0x46, 0x01, 0x01, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x40, 0x34, 0x00, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x20, 0x00, 0x02, 0x00, 0x28, 0x00,
0x0e, 0x00, 0x0d, 0x00, 0x01, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x40, 0xdc, 0x00, 0x00, 0x00,
0xdc, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x51, 0xe5, 0x74, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x06, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x8d, 0x4c, 0x24, 0x04,
0x83, 0xe4, 0xf0, 0xff, 0x71, 0xfc, 0x55, 0x89, 0xe5, 0x53, 0x51, 0xe8,
0x38, 0x00, 0x00, 0x00, 0x05, 0xbc, 0x00, 0x00, 0x00, 0x89, 0xc3, 0xe8,
0x08, 0x00, 0x00, 0x00, 0x90, 0x59, 0x5b, 0x5d, 0x8d, 0x61, 0xfc, 0xc3,
0x55, 0x89, 0xe5, 0x83, 0xec, 0x10, 0xe8, 0x19, 0x00, 0x00, 0x00, 0x05,
0x9d, 0x00, 0x00, 0x00, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x89, 0xe1, 0xba,
0x46, 0x00, 0x00, 0x40, 0x0f, 0x34, 0x89, 0x45, 0xfc, 0x90, 0xc9, 0xc3,
0x8b, 0x04, 0x24, 0xc3, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x7a, 0x52, 0x00, 0x01, 0x7c, 0x08, 0x01, 0x1b, 0x0c, 0x04, 0x04,
0x88, 0x01, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00,
0x90, 0xff, 0xff, 0xff, 0x28, 0x00, 0x00, 0x00, 0x00, 0x44, 0x0c, 0x01,
0x00, 0x47, 0x10, 0x05, 0x02, 0x75, 0x00, 0x44, 0x0f, 0x03, 0x75, 0x78,
0x06, 0x10, 0x03, 0x02, 0x75, 0x7c, 0x53, 0xc1, 0x0c, 0x01, 0x00, 0x41,
0xc3, 0x41, 0xc5, 0x43, 0x0c, 0x04, 0x04, 0x00, 0x10, 0x00, 0x00, 0x00,
0x50, 0x00, 0x00, 0x00, 0xa8, 0xff, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
0x70, 0xff, 0xff, 0xff, 0x24, 0x00, 0x00, 0x00, 0x00, 0x41, 0x0e, 0x08,
0x85, 0x02, 0x42, 0x0d, 0x05, 0x60, 0xc5, 0x0c, 0x04, 0x04, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x96, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x01,
0x2a, 0x00, 0x00, 0x00, 0x0c, 0x89, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x02, 0x01, 0x06, 0x84, 0x00, 0x00, 0x00, 0x02, 0x02, 0x05, 0xcc,
0x00, 0x00, 0x00, 0x03, 0x04, 0x05, 0x69, 0x6e, 0x74, 0x00, 0x02, 0x08,
0x05, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x05, 0x05, 0x00, 0x00, 0x00,
0x02, 0x01, 0x06, 0x7d, 0x00, 0x00, 0x00, 0x02, 0x01, 0x08, 0x7b, 0x00,
0x00, 0x00, 0x02, 0x02, 0x07, 0xb3, 0x00, 0x00, 0x00, 0x02, 0x04, 0x07,
0x18, 0x00, 0x00, 0x00, 0x02, 0x08, 0x07, 0x13, 0x00, 0x00, 0x00, 0x02,
0x04, 0x07, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x25, 0x00, 0x00, 0x00, 0x7d,
0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0xc6, 0x00, 0x00, 0x00, 0x02, 0x25,
0x72, 0x00, 0x00, 0x00, 0x07, 0x0e, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00,
0x00, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x01, 0x9c, 0x00, 0xbd, 0x00,
0x00, 0x00, 0x04, 0x00, 0x61, 0x00, 0x00, 0x00, 0x04, 0x01, 0x0d, 0x01,
0x00, 0x00, 0x0c, 0xd6, 0x00, 0x00, 0x00, 0xe6, 0x00, 0x00, 0x00, 0x28,
0x00, 0x00, 0x40, 0x24, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x02,
0x01, 0x06, 0x84, 0x00, 0x00, 0x00, 0x02, 0x02, 0x05, 0xcc, 0x00, 0x00,
0x00, 0x03, 0x04, 0x05, 0x69, 0x6e, 0x74, 0x00, 0x02, 0x08, 0x05, 0x00,
0x00, 0x00, 0x00, 0x02, 0x04, 0x05, 0x05, 0x00, 0x00, 0x00, 0x02, 0x01,
0x06, 0x7d, 0x00, 0x00, 0x00, 0x02, 0x01, 0x08, 0x7b, 0x00, 0x00, 0x00,
0x02, 0x02, 0x07, 0xb3, 0x00, 0x00, 0x00, 0x02, 0x04, 0x07, 0x18, 0x00,
0x00, 0x00, 0x02, 0x08, 0x07, 0x13, 0x00, 0x00, 0x00, 0x04, 0x75, 0x33,
0x32, 0x00, 0x02, 0x1d, 0x76, 0x00, 0x00, 0x00, 0x02, 0x04, 0x07, 0x1d,
0x00, 0x00, 0x00, 0x05, 0x25, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00,
0x06, 0x00, 0x07, 0xc6, 0x00, 0x00, 0x00, 0x02, 0x25, 0x7d, 0x00, 0x00,
0x00, 0x08, 0xdd, 0x00, 0x00, 0x00, 0x01, 0x09, 0x6b, 0x00, 0x00, 0x00,
0x28, 0x00, 0x00, 0x40, 0x24, 0x00, 0x00, 0x00, 0x01, 0x9c, 0x09, 0x38,
0x00, 0x00, 0x40, 0x11, 0x00, 0x00, 0x00, 0x0a, 0x5f, 0x76, 0x00, 0x01,
0x0b, 0x6b, 0x00, 0x00, 0x00, 0x02, 0x91, 0x74, 0x00, 0x00, 0x00, 0x01,
0x11, 0x01, 0x25, 0x0e, 0x13, 0x0b, 0x03, 0x0e, 0x1b, 0x0e, 0x11, 0x01,
0x12, 0x06, 0x10, 0x17, 0x00, 0x00, 0x02, 0x24, 0x00, 0x0b, 0x0b, 0x3e,
0x0b, 0x03, 0x0e, 0x00, 0x00, 0x03, 0x24, 0x00, 0x0b, 0x0b, 0x3e, 0x0b,
0x03, 0x08, 0x00, 0x00, 0x04, 0x01, 0x01, 0x49, 0x13, 0x01, 0x13, 0x00,
0x00, 0x05, 0x21, 0x00, 0x00, 0x00, 0x06, 0x34, 0x00, 0x03, 0x0e, 0x3a,
0x0b, 0x3b, 0x0b, 0x49, 0x13, 0x3f, 0x19, 0x3c, 0x19, 0x00, 0x00, 0x07,
0x2e, 0x00, 0x3f, 0x19, 0x03, 0x0e, 0x3a, 0x0b, 0x3b, 0x0b, 0x27, 0x19,
0x11, 0x01, 0x12, 0x06, 0x40, 0x18, 0x96, 0x42, 0x19, 0x00, 0x00, 0x00,
0x01, 0x11, 0x01, 0x25, 0x0e, 0x13, 0x0b, 0x03, 0x0e, 0x1b, 0x0e, 0x11,
0x01, 0x12, 0x06, 0x10, 0x17, 0x00, 0x00, 0x02, 0x24, 0x00, 0x0b, 0x0b,
0x3e, 0x0b, 0x03, 0x0e, 0x00, 0x00, 0x03, 0x24, 0x00, 0x0b, 0x0b, 0x3e,
0x0b, 0x03, 0x08, 0x00, 0x00, 0x04, 0x16, 0x00, 0x03, 0x08, 0x3a, 0x0b,
0x3b, 0x0b, 0x49, 0x13, 0x00, 0x00, 0x05, 0x01, 0x01, 0x49, 0x13, 0x01,
0x13, 0x00, 0x00, 0x06, 0x21, 0x00, 0x00, 0x00, 0x07, 0x34, 0x00, 0x03,
0x0e, 0x3a, 0x0b, 0x3b, 0x0b, 0x49, 0x13, 0x3f, 0x19, 0x3c, 0x19, 0x00,
0x00, 0x08, 0x2e, 0x01, 0x3f, 0x19, 0x03, 0x0e, 0x3a, 0x0b, 0x3b, 0x0b,
0x27, 0x19, 0x49, 0x13, 0x11, 0x01, 0x12, 0x06, 0x40, 0x18, 0x97, 0x42,
0x19, 0x00, 0x00, 0x09, 0x0b, 0x01, 0x11, 0x01, 0x12, 0x06, 0x00, 0x00,
0x0a, 0x34, 0x00, 0x03, 0x08, 0x3a, 0x0b, 0x3b, 0x0b, 0x49, 0x13, 0x02,
0x18, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40,
0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x1c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x9a, 0x00, 0x00, 0x00, 0x04, 0x00,
0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x40, 0x24, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00,
0x02, 0x00, 0x32, 0x00, 0x00, 0x00, 0x01, 0x01, 0xfb, 0x0e, 0x0d, 0x00,
0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x2e,
0x2f, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x00, 0x00, 0x74, 0x65,
0x73, 0x74, 0x2e, 0x63, 0x00, 0x00, 0x00, 0x00, 0x74, 0x79, 0x70, 0x65,
0x73, 0x2e, 0x68, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x05, 0x02, 0x00,
0x00, 0x00, 0x40, 0x1a, 0x08, 0x83, 0x75, 0x02, 0x08, 0x00, 0x01, 0x01,
0x4b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x33, 0x00, 0x00, 0x00, 0x01, 0x01,
0xfb, 0x0e, 0x0d, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x01, 0x2e, 0x2e, 0x2f, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64,
0x65, 0x00, 0x00, 0x6c, 0x69, 0x62, 0x63, 0x2e, 0x63, 0x00, 0x00, 0x00,
0x00, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x68, 0x00, 0x01, 0x00, 0x00,
0x00, 0x00, 0x05, 0x02, 0x28, 0x00, 0x00, 0x40, 0x03, 0x09, 0x01, 0xf3,
0x08, 0x13, 0x02, 0x03, 0x00, 0x01, 0x01, 0x6c, 0x6f, 0x6e, 0x67, 0x20,
0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x69, 0x6e, 0x74, 0x00, 0x6d, 0x61, 0x69,
0x6e, 0x00, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x6c, 0x6f, 0x6e, 0x67, 0x20,
0x75, 0x6e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x74,
0x00, 0x47, 0x4e, 0x55, 0x20, 0x43, 0x31, 0x31, 0x20, 0x37, 0x2e, 0x33,
0x2e, 0x30, 0x20, 0x2d, 0x6d, 0x33, 0x32, 0x20, 0x2d, 0x6d, 0x74, 0x75,
0x6e, 0x65, 0x3d, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x20, 0x2d,
0x6d, 0x61, 0x72, 0x63, 0x68, 0x3d, 0x69, 0x36, 0x38, 0x36, 0x20, 0x2d,
0x67, 0x20, 0x2d, 0x4f, 0x30, 0x20, 0x2d, 0x66, 0x66, 0x72, 0x65, 0x65,
0x73, 0x74, 0x61, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x2d, 0x66, 0x6e,
0x6f, 0x2d, 0x62, 0x75, 0x69, 0x6c, 0x74, 0x69, 0x6e, 0x00, 0x75, 0x6e,
0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x20, 0x63, 0x68, 0x61, 0x72, 0x00,
0x74, 0x65, 0x73, 0x74, 0x2e, 0x63, 0x00, 0x2f, 0x68, 0x6f, 0x6d, 0x65,
0x2f, 0x6e, 0x69, 0x6b, 0x6f, 0x2f, 0x42, 0x75, 0x72, 0x65, 0x61, 0x75,
0x2f, 0x63, 0x6f, 0x73, 0x32, 0x30, 0x30, 0x30, 0x2f, 0x70, 0x72, 0x6f,
0x67, 0x72, 0x61, 0x6d, 0x73, 0x00, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x20,
0x75, 0x6e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x74,
0x00, 0x63, 0x74, 0x79, 0x70, 0x65, 0x00, 0x73, 0x68, 0x6f, 0x72, 0x74,
0x20, 0x69, 0x6e, 0x74, 0x00, 0x6c, 0x69, 0x62, 0x63, 0x2e, 0x63, 0x00,
0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x70, 0x69, 0x00, 0x2f, 0x68, 0x6f,
0x6d, 0x65, 0x2f, 0x6e, 0x69, 0x6b, 0x6f, 0x2f, 0x42, 0x75, 0x72, 0x65,
0x61, 0x75, 0x2f, 0x63, 0x6f, 0x73, 0x32, 0x30, 0x30, 0x30, 0x2f, 0x70,
0x72, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x73, 0x2f, 0x6c, 0x69, 0x62, 0x00,
0x47, 0x4e, 0x55, 0x20, 0x43, 0x31, 0x31, 0x20, 0x37, 0x2e, 0x33, 0x2e,
0x30, 0x20, 0x2d, 0x46, 0x65, 0x6c, 0x66, 0x2d, 0x69, 0x33, 0x38, 0x36,
0x20, 0x2d, 0x6d, 0x33, 0x32, 0x20, 0x2d, 0x6d, 0x74, 0x75, 0x6e, 0x65,
0x3d, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x20, 0x2d, 0x6d, 0x61,
0x72, 0x63, 0x68, 0x3d, 0x69, 0x36, 0x38, 0x36, 0x20, 0x2d, 0x67, 0x20,
0x2d, 0x4f, 0x30, 0x20, 0x2d, 0x66, 0x66, 0x72, 0x65, 0x65, 0x73, 0x74,
0x61, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x2d, 0x66, 0x6e, 0x6f, 0x2d,
0x62, 0x75, 0x69, 0x6c, 0x74, 0x69, 0x6e, 0x00, 0x47, 0x43, 0x43, 0x3a,
0x20, 0x28, 0x55, 0x62, 0x75, 0x6e, 0x74, 0x75, 0x20, 0x37, 0x2e, 0x33,
0x2e, 0x30, 0x2d, 0x32, 0x37, 0x75, 0x62, 0x75, 0x6e, 0x74, 0x75, 0x31,
0x7e, 0x31, 0x38, 0x2e, 0x30, 0x34, 0x29, 0x20, 0x37, 0x2e, 0x33, 0x2e,
0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x40,
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
0xd0, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x04, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x07, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x0a, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0xf1, 0xff, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0xf1, 0xff, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0xf1, 0xff,
0x0f, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x04, 0x00, 0x25, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x40,
0x00, 0x00, 0x00, 0x00, 0x12, 0x02, 0x02, 0x00, 0x3b, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x12, 0x00, 0x01, 0x00,
0x40, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x40, 0x24, 0x00, 0x00, 0x00,
0x12, 0x00, 0x01, 0x00, 0x00, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x63, 0x00,
0x6c, 0x69, 0x62, 0x63, 0x2e, 0x63, 0x00, 0x5f, 0x47, 0x4c, 0x4f, 0x42,
0x41, 0x4c, 0x5f, 0x4f, 0x46, 0x46, 0x53, 0x45, 0x54, 0x5f, 0x54, 0x41,
0x42, 0x4c, 0x45, 0x5f, 0x00, 0x5f, 0x5f, 0x78, 0x38, 0x36, 0x2e, 0x67,
0x65, 0x74, 0x5f, 0x70, 0x63, 0x5f, 0x74, 0x68, 0x75, 0x6e, 0x6b, 0x2e,
0x61, 0x78, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x74, 0x65, 0x73, 0x74,
0x5f, 0x61, 0x70, 0x69, 0x00, 0x00, 0x2e, 0x73, 0x79, 0x6d, 0x74, 0x61,
0x62, 0x00, 0x2e, 0x73, 0x74, 0x72, 0x74, 0x61, 0x62, 0x00, 0x2e, 0x73,
0x68, 0x73, 0x74, 0x72, 0x74, 0x61, 0x62, 0x00, 0x2e, 0x74, 0x65, 0x78,
0x74, 0x00, 0x2e, 0x74, 0x65, 0x78, 0x74, 0x2e, 0x5f, 0x5f, 0x78, 0x38,
0x36, 0x2e, 0x67, 0x65, 0x74, 0x5f, 0x70, 0x63, 0x5f, 0x74, 0x68, 0x75,
0x6e, 0x6b, 0x2e, 0x61, 0x78, 0x00, 0x2e, 0x65, 0x68, 0x5f, 0x66, 0x72,
0x61, 0x6d, 0x65, 0x00, 0x2e, 0x67, 0x6f, 0x74, 0x2e, 0x70, 0x6c, 0x74,
0x00, 0x2e, 0x64, 0x65, 0x62, 0x75, 0x67, 0x5f, 0x69, 0x6e, 0x66, 0x6f,
0x00, 0x2e, 0x64, 0x65, 0x62, 0x75, 0x67, 0x5f, 0x61, 0x62, 0x62, 0x72,
0x65, 0x76, 0x00, 0x2e, 0x64, 0x65, 0x62, 0x75, 0x67, 0x5f, 0x61, 0x72,
0x61, 0x6e, 0x67, 0x65, 0x73, 0x00, 0x2e, 0x64, 0x65, 0x62, 0x75, 0x67,
0x5f, 0x6c, 0x69, 0x6e, 0x65, 0x00, 0x2e, 0x64, 0x65, 0x62, 0x75, 0x67,
0x5f, 0x73, 0x74, 0x72, 0x00, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e,
0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40,
0x74, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x21, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
0x4c, 0x00, 0x00, 0x40, 0xc0, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x40, 0xc4, 0x00, 0x00, 0x00,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x00, 0x40,
0x44, 0x01, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x50, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x50, 0x01, 0x00, 0x00, 0x5b, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xab, 0x02, 0x00, 0x00,
0xe9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x94, 0x03, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x79, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xd4, 0x03, 0x00, 0x00, 0x9b, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x85, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6f, 0x04, 0x00, 0x00,
0x69, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xd8, 0x05, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x04, 0x06, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00,
0x0c, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x10, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x07, 0x00, 0x00,
0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x6d, 0x07, 0x00, 0x00, 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

View File

@ -43,15 +43,15 @@ indent:
backup: clean
(cd .. ; tar cf - Source\ C | gzip -f - > backup.tar.gz)
test: bits32 harddisk qemu
test: programs bits32 harddisk qemu
test64: bits64 uefi qemu64
test64: programs bits64 uefi qemu64
retest: littleclean test
retest64: littleclean test64
testbochs: bits32 harddisk bochs-debug
testbochs: programs bits32 harddisk bochs-debug
view:
(hexdump -C ./final/harddisk.img.final|head -c10000)

View File

@ -1,4 +1,4 @@
CC=gcc -O0 -g -nostdinc -ffreestanding -fno-builtin -Wall -w -m32 -F elf-i386 -I ../include
CC=gcc -O0 -g -nostdinc -ffreestanding -fno-builtin -Wall -w -m32 -F elf-i386 -fno-pie -no-pie -I ../include
LINK=ld -m elf_i386 -r -o
SRCS= $(wildcard *.c)
OBJS= $(SRCS:.c=.o)

View File

@ -1,4 +1,4 @@
CC=gcc -O0 -g -nostdinc -ffreestanding -fno-builtin -Wall -w -m32 -I ./include -c -o
CC=gcc -O0 -g -nostdinc -ffreestanding -fno-builtin -Wall -w -m32 -I ./include -fno-pie -no-pie -c -o
LINK=ld -m elf_i386 -T linker.lds -n -o
SRCS= $(wildcard *.c)
EXECS= $(SRCS:.c=)

View File

@ -65,13 +65,14 @@ int main(u32 magic, u32 addr)
next:
ok();
print("\033[37m\033[0m -Initilisation des taches (TSR)");
inittr();
ok();
print("\033[37m\033[0m -Initilisation de la pagination (PAGING)");
initpaging();
remap_memory(VESA_FBMEM);
remap_memory(VESA_FBMEM);
ok();
print("\033[37m\033[0m -Initilisation des taches (TSR)");
inittr();
task_init();
ok();
print("\033[37m\033[0m -Initilisation des interruptions (IDT/PIC)");