Skip to content

Commit b73f584

Browse files
committed
accel/tcg: Split out getpc.h
Split out GETPC to a target-independent header. Signed-off-by: Richard Henderson <[email protected]> Reviewed-by: Pierrick Bouvier <[email protected]> Signed-off-by: Philippe Mathieu-Daudé <[email protected]> Message-ID: <[email protected]> Signed-off-by: Richard Henderson <[email protected]>
1 parent bf4a155 commit b73f584

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed

include/accel/tcg/getpc.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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 */

include/exec/exec-all.h

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "exec/translation-block.h"
2929

3030
#if defined(CONFIG_TCG)
31+
#include "accel/tcg/getpc.h"
3132

3233
/**
3334
* probe_access:
@@ -177,15 +178,6 @@ void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr);
177178
void tb_invalidate_phys_range(tb_page_addr_t start, tb_page_addr_t last);
178179
void tb_set_jmp_target(TranslationBlock *tb, int n, uintptr_t addr);
179180

180-
/* GETPC is the true target of the return instruction that we'll execute. */
181-
#if defined(CONFIG_TCG_INTERPRETER)
182-
extern __thread uintptr_t tci_tb_ptr;
183-
# define GETPC() tci_tb_ptr
184-
#else
185-
# define GETPC() \
186-
((uintptr_t)__builtin_extract_return_addr(__builtin_return_address(0)))
187-
#endif
188-
189181
#if !defined(CONFIG_USER_ONLY)
190182

191183
/**

0 commit comments

Comments
 (0)