| 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 | #ifndef CONFIG_TCG |
| 12 | #error Can only include this header with TCG |
| 13 | #endif |
| 14 | |
| 15 | /* GETPC is the true target of the return instruction that we'll execute. */ |
| 16 | #ifdef CONFIG_TCG_INTERPRETER |
| 17 | extern __thread uintptr_t tci_tb_ptr; |
| 18 | # define GETPC() tci_tb_ptr |
| 19 | #else |
| 20 | # define GETPC() \ |
| 21 | ((uintptr_t)__builtin_extract_return_addr(__builtin_return_address(0))) |
| 22 | #endif |
| 23 | |
| 24 | #endif /* ACCEL_TCG_GETPC_H */ |