41 lines
1.3 KiB
C
41 lines
1.3 KiB
C
#ifndef _include_fail_h
|
|
#define _include_fail_h
|
|
|
|
#define INLINE __attribute__((always_inline)) inline
|
|
#define NOINLINE __attribute__((noinline))
|
|
|
|
#define __QUOTE(x) #x
|
|
#define QUOTE(x) __QUOTE(x)
|
|
|
|
#define MAIN() void os_main(void)
|
|
#define POSIX_PRINTF(...)
|
|
|
|
#define ARCH_ASM_CLOBBER_ALL "eax", "ebx", "ecx", "edx", "esi", "edi", "ebp"
|
|
#define MARKER(str) \
|
|
__asm__ volatile(QUOTE(str) ":" \
|
|
: /* no inputs */ \
|
|
: /* no outputs */ \
|
|
: "memory", ARCH_ASM_CLOBBER_ALL)
|
|
|
|
typedef __UINT8_TYPE__ uint8_t;
|
|
typedef __UINT16_TYPE__ uint16_t;
|
|
typedef __UINT32_TYPE__ uint32_t;
|
|
|
|
typedef __INT8_TYPE__ int8_t;
|
|
typedef __INT16_TYPE__ int16_t;
|
|
typedef __INT32_TYPE__ int32_t;
|
|
|
|
// Mark start of injection
|
|
void __attribute__((noinline)) fail_start_trace(void);
|
|
// Mark end of injection
|
|
void __attribute__((noinline)) fail_stop_trace(void);
|
|
|
|
// everything ok: valid code and right values
|
|
void __attribute__((noinline)) fail_marker_positive(void);
|
|
// everything ok: valid code but wrong values
|
|
void __attribute__((noinline)) fail_marker_negative(void);
|
|
// invalid code
|
|
void __attribute__((noinline)) fail_marker_detected(void);
|
|
|
|
#endif
|