From 02948e1f0f522e34b812f6dcc0097bad9639cfa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Hord=C3=A9?= Date: Sun, 7 Oct 2018 13:11:16 +0200 Subject: [PATCH] fix: test de sprint dans exception 14, et correction fin de string --- lib/interrupts.c | 26 ++++++++++++++------------ lib/video.c | 4 +++- system/system.c | 6 +----- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/lib/interrupts.c b/lib/interrupts.c index dc31982..e782363 100755 --- a/lib/interrupts.c +++ b/lib/interrupts.c @@ -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() diff --git a/lib/video.c b/lib/video.c index 8af9d69..67a31b4 100755 --- a/lib/video.c +++ b/lib/video.c @@ -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