xref: /qemu/include/accel/tcg/getpc.h (revision 84307cd6027c4602913177ff09aeefa4743b7234)
1 /*
2  * Get host pc for helper unwinding.
3  *
4  * Copyright (c) 2003 Fabrice Bellard
5  * SPDX-License-Identifier: LGPL-2.1-or-later
6  */
7 
8 #ifndef ACCEL_TCG_GETPC_H
9 #define ACCEL_TCG_GETPC_H
10 
11 /* GETPC is the true target of the return instruction that we'll execute.  */
12 #ifdef CONFIG_TCG_INTERPRETER
13 extern __thread uintptr_t tci_tb_ptr;
14 # define GETPC() tci_tb_ptr
15 #else
16 # define GETPC() \
17     ((uintptr_t)__builtin_extract_return_addr(__builtin_return_address(0)))
18 #endif
19 
20 #endif /* ACCEL_TCG_GETPC_H */
21