XenevaOS
Loading...
Searching...
No Matches
instruction_pointer.h
Go to the documentation of this file.
1/*
2 * DCL instruction_pointer.h -- _RET_IP_/_THIS_IP_ as plain addresses.
3 *
4 * linux/ww_mutex.h names these inside CONFIG_DEBUG_LOCK_ALLOC blocks that
5 * do not compile here; the definitions exist so the macros are still
6 * meaningful if any caller outside that guard asks.
7 */
8#ifndef _LINUX_INSTRUCTION_POINTER_H
9#define _LINUX_INSTRUCTION_POINTER_H
10
11/*
12 * upstream include/linux/instruction_pointer.h includes this too, and it has
13 * to come first: <asm/linkage.h>:46 defines arm64's _THIS_IP_ with `adr`, so
14 * pulling it in here means the real instruction address wins and the #ifndef
15 * below is what falls back. Without it, the order of the two headers decided
16 * the answer, and whichever came second redefined the macro -- the source of
17 * the "macro redefined: _THIS_IP_" warning in build6.
18 */
19#include <asm/linkage.h>
20
21#ifndef _RET_IP_
22#define _RET_IP_ ((unsigned long)__builtin_return_address(0))
23#endif
24#ifndef _THIS_IP_
25#define _THIS_IP_ ((unsigned long)__builtin_extract_return_addr(0))
26#endif
27
28#endif /* _LINUX_INSTRUCTION_POINTER_H */