feat: test des breakpoint par DRx

This commit is contained in:
Nicolas Hordé 2018-10-04 16:29:54 +02:00
parent f07f637447
commit b72b0c2f11
3 changed files with 28 additions and 2 deletions

View File

@ -24,3 +24,5 @@ int invalidop();
int segfault();
int int3();
int generalfault();
int breakpoint();
void testing(void);

View File

@ -181,7 +181,14 @@ void exception0()
void exception1()
{
cpuerror("debug exception",NULL);
cli();
save_stack dump;
exception_stack_noerror *current = getESP()+0x28+sizeof(save_stack);
dump_cpu(&dump);
dump.eip=current->eip;
dump.cs=current->cs;
dump.esp=(current+1);
cpuerror("debug exception",&dump);
}
void exception2()

View File

@ -28,7 +28,9 @@ static command commands[] = {
{"INVALIDOP","", &invalidop},
{"INT3" , "", &int3},
{"GENERALFAULT" , "", &generalfault},
{"SEGFAULT","", &segfault}
{"SEGFAULT","", &segfault},
{"BREAKPOINT","", &breakpoint},
{"TESTING","", &testing}
};
/*******************************************************************************/
@ -62,6 +64,21 @@ void shell()
}
}
void testing(void)
{
print("Fonction de test !\r\n");
}
/*******************************************************************************/
/* Génère un breakpoint */
int breakpoint()
{
print("Creation d'un breakpoint !\r\n");
asm("movl %[address],%%dr0 \n \
movl $0x00000003, %%eax\n \
movl %%eax, %%dr7"::[address] "a" (&testing):);
}
/*******************************************************************************/
/* Génère une interruption 3 */
int int3()