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();
save_stack dump;
exception_stack *current = getESP()+0x28+sizeof(save_stack);
exception_stack *current = getESP()+0x28+255+sizeof(save_stack);
dump_cpu(&dump);
dump.eip=current->eip;
dump.cs=current->cs;
dump.esp=(current+1);
u8 *errorstring="#PF Page fault";
switch (current->error_code) {
u8* errorstring;
u8 completeerrorstring[255];
switch (current->error_code & 0xF) {
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;
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;
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;
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;
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;
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;
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;
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;
}
cpuerror(errorstring,&dump);
sprintf(&completeerrorstring,"#PF Page fault - %s at adress %X",errorstring,dump.cr2);
cpuerror(&completeerrorstring,&dump);
}
void exception15()

View File

@ -302,6 +302,7 @@ u32 print(u8 * string)
/* Fonction d'affichage (pour printf) */
u32 printstr(u8* src, u8** dest, u32 len) {
if (*(src)=='\000') return;
for(u32 i=0;i<len;i++)
putchar(*(src++));
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;
}

View File

@ -106,11 +106,7 @@ int main(u32 magic, u32 addr)
printf(" -Installation des appels systemes utilisateur");
initsyscall();
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:
shell();
}