fix: test de sprint dans exception 14, et correction fin de string

This commit is contained in:
Nicolas Hordé 2018-10-07 13:11:16 +02:00
parent 12f395461e
commit 02948e1f0f
3 changed files with 18 additions and 18 deletions

View File

@ -339,39 +339,41 @@ void exception14()
{ {
cli(); cli();
save_stack dump; save_stack dump;
exception_stack *current = getESP()+0x28+sizeof(save_stack); exception_stack *current = getESP()+0x28+255+sizeof(save_stack);
dump_cpu(&dump); dump_cpu(&dump);
dump.eip=current->eip; dump.eip=current->eip;
dump.cs=current->cs; dump.cs=current->cs;
dump.esp=(current+1); dump.esp=(current+1);
u8 *errorstring="#PF Page fault"; u8* errorstring;
switch (current->error_code) { u8 completeerrorstring[255];
switch (current->error_code & 0xF) {
case 0: case 0:
errorstring="Page fault - Supervisory process tried to read a non-present page entry"; errorstring="Supervisory process tried to read a non-present page entry";
break; break;
case 1: case 1:
errorstring="Page fault - Supervisory process tried to read a page and caused a protection fault"; errorstring="Supervisory process tried to read a page and caused a protection fault";
break; break;
case 2: case 2:
errorstring="Page fault - Supervisory process tried to write to a non-present page entry"; errorstring="Supervisory process tried to write to a non-present page entry";
break; break;
case 3: case 3:
errorstring="Page fault - Supervisory process tried to write a page and caused a protection fault"; errorstring="Supervisory process tried to write a page and caused a protection fault";
break; break;
case 4: case 4:
errorstring="Page fault - User process tried to read a non-present page entry"; errorstring="User process tried to read a non-present page entry";
break; break;
case 5: case 5:
errorstring="Page fault - User process tried to read a page and caused a protection fault"; errorstring="User process tried to read a page and caused a protection fault";
break; break;
case 6: case 6:
errorstring="Page fault - User process tried to write to a non-present page entry"; errorstring="User process tried to write to a non-present page entry";
break; break;
case 7: case 7:
errorstring="Page fault - User process tried to write a page and caused a protection fault"; errorstring="User process tried to write a page and caused a protection fault";
break; break;
} }
cpuerror(errorstring,&dump); sprintf(&completeerrorstring,"#PF Page fault - %s at adress %X",errorstring,dump.cr2);
cpuerror(&completeerrorstring,&dump);
} }
void exception15() void exception15()

View File

@ -302,6 +302,7 @@ u32 print(u8 * string)
/* Fonction d'affichage (pour printf) */ /* Fonction d'affichage (pour printf) */
u32 printstr(u8* src, u8** dest, u32 len) { u32 printstr(u8* src, u8** dest, u32 len) {
if (*(src)=='\000') return;
for(u32 i=0;i<len;i++) for(u32 i=0;i<len;i++)
putchar(*(src++)); putchar(*(src++));
return len; return len;
@ -599,7 +600,8 @@ u32 format(const u8 * string, va_list args, u32 (*fonction)(u8* src, u8** dest,
} }
} }
} }
buffer[0]='\000';
fonction(&buffer,&dest,1);
return counter; return counter;
} }

View File

@ -106,10 +106,6 @@ int main(u32 magic, u32 addr)
printf(" -Installation des appels systemes utilisateur"); printf(" -Installation des appels systemes utilisateur");
initsyscall(); initsyscall();
ok(); ok();
static u8 tester[]="ceci est un test";
static u8 strings[255];
sprintf(&strings," pour voir : %u %d %f %s",123456789,-2522,3.14f,tester);
print(&strings);
retry: retry:
shell(); shell();