From: David Devecsery Date: Mon, 18 May 2020 14:50:31 +0000 (-0400) Subject: Added read_ebp to x86.h X-Git-Url: https://git.devinivas.org/?a=commitdiff_plain;h=baba4d30acbebe683e27abfda9307195cdfea2fb;p=cs3210-lab1.git Added read_ebp to x86.h --- 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) {