From baba4d30acbebe683e27abfda9307195cdfea2fb Mon Sep 17 00:00:00 2001 From: David Devecsery Date: Mon, 18 May 2020 10:50:31 -0400 Subject: [PATCH] Added read_ebp to x86.h --- include/asm/x86.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/asm/x86.h b/include/asm/x86.h index 12ff7d2..4f80570 100644 --- a/include/asm/x86.h +++ b/include/asm/x86.h @@ -103,6 +103,18 @@ readeflags(void) return eflags; } +// This needs to be always inlined, otherwise the ebp is modified +static __inline uint +read_ebp(void) +{ + uint ebp; + // Force the prologue before ebp + __asm __volatile("" : : :"memory"); + __asm __volatile("movl %%ebp,%0" : "=r" (ebp)); + + return ebp; +} + static inline void loadgs(ushort v) { -- 2.47.3