diff --git a/datashadow/datashadow_callbacks.c b/datashadow/datashadow_callbacks.c index 41370fb65236db2bafaa95691b75c511f2ae7d5f..dd5c1b79375a64acf936db9ddc0d79726610cdf7 100644 --- a/datashadow/datashadow_callbacks.c +++ b/datashadow/datashadow_callbacks.c @@ -2,6 +2,7 @@ * Function pointer shadowing */ +#include <stdlib.h> #ifdef STRATA #include "all.h" #include "../insn.h" @@ -30,7 +31,7 @@ __attribute__ ((externally_visible)) __attribute((used)) void fptr_shadow_check_ #define MAX_DIAGNOSTIC_SIZE 1024 -// put this in a include somewher +/* typedef struct { int edi; @@ -43,6 +44,30 @@ typedef struct int eax; int flags; } reg_values_t; +*/ + +/* the registers are saved onto the stack in this order */ +typedef struct reg_values reg_values_t; +struct reg_values +{ + size_t flags; + size_t r15; + size_t r14; + size_t r13; + size_t r12; + size_t r11; + size_t r10; + size_t r9; + size_t r8; + size_t rax; + size_t rbx; + size_t rcx; + size_t rdx; + size_t rsi; + size_t rdi; + size_t rbp; + size_t rsp; +}; #ifdef STRATA // leave this function so that the linker includes this file @@ -64,7 +89,9 @@ static void getDiagnostics(char *p_diagnostic, int p_shadowIndex, void* p_shadow // add to multi-valued table void fptr_shadow_define_64(void *p_retAddress, reg_values_t *p_rv, void *p_instrumented, int p_shadowIndex, void *p_shadowValue) { +#ifdef STRATA char msg[MAX_DIAGNOSTIC_SIZE]; +#endif add_shadow_entry(p_shadowIndex, p_shadowValue); @@ -78,7 +105,9 @@ void fptr_shadow_define_64(void *p_retAddress, reg_values_t *p_rv, void *p_instr // check to make sure values match void fptr_shadow_check_64(void *p_retAddress, reg_values_t *p_rv, void *p_instrumented, int p_shadowIndex, void **p_shadow) { +#ifdef STRATA char msg[MAX_DIAGNOSTIC_SIZE]; +#endif void *restored; int count = 0;