cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

unwind_hints.h (1348B)


      1#ifndef _ASM_X86_UNWIND_HINTS_H
      2#define _ASM_X86_UNWIND_HINTS_H
      3
      4#include <linux/objtool.h>
      5
      6#include "orc_types.h"
      7
      8#ifdef __ASSEMBLY__
      9
     10.macro UNWIND_HINT_EMPTY
     11	UNWIND_HINT sp_reg=ORC_REG_UNDEFINED type=UNWIND_HINT_TYPE_CALL end=1
     12.endm
     13
     14.macro UNWIND_HINT_REGS base=%rsp offset=0 indirect=0 extra=1 partial=0
     15	.if \base == %rsp
     16		.if \indirect
     17			.set sp_reg, ORC_REG_SP_INDIRECT
     18		.else
     19			.set sp_reg, ORC_REG_SP
     20		.endif
     21	.elseif \base == %rbp
     22		.set sp_reg, ORC_REG_BP
     23	.elseif \base == %rdi
     24		.set sp_reg, ORC_REG_DI
     25	.elseif \base == %rdx
     26		.set sp_reg, ORC_REG_DX
     27	.elseif \base == %r10
     28		.set sp_reg, ORC_REG_R10
     29	.else
     30		.error "UNWIND_HINT_REGS: bad base register"
     31	.endif
     32
     33	.set sp_offset, \offset
     34
     35	.if \partial
     36		.set type, UNWIND_HINT_TYPE_REGS_PARTIAL
     37	.elseif \extra == 0
     38		.set type, UNWIND_HINT_TYPE_REGS_PARTIAL
     39		.set sp_offset, \offset + (16*8)
     40	.else
     41		.set type, UNWIND_HINT_TYPE_REGS
     42	.endif
     43
     44	UNWIND_HINT sp_reg=sp_reg sp_offset=sp_offset type=type
     45.endm
     46
     47.macro UNWIND_HINT_IRET_REGS base=%rsp offset=0
     48	UNWIND_HINT_REGS base=\base offset=\offset partial=1
     49.endm
     50
     51.macro UNWIND_HINT_FUNC
     52	UNWIND_HINT sp_reg=ORC_REG_SP sp_offset=8 type=UNWIND_HINT_TYPE_FUNC
     53.endm
     54
     55#else
     56
     57#define UNWIND_HINT_FUNC \
     58	UNWIND_HINT(ORC_REG_SP, 8, UNWIND_HINT_TYPE_FUNC, 0)
     59
     60#endif /* __ASSEMBLY__ */
     61
     62#endif /* _ASM_X86_UNWIND_HINTS_H */