提交 584950fd 编写于 作者: R Richard Henderson 提交者: Aurelien Jarno

tcg-i386: Remove abort from GETPC_LDST

Indeed, remove it entirely and remove the is_tcg_gen_code check
from GETPC_EXT.

Fixes https://bugs.launchpad.net/qemu/+bug/1218098 wherein a call
to a "normal" helper function performed a sequence of tail calls
all the way into the memory helper functions, leading to a stack
frame in which the memory helper function appeared to be called
directly from tcg.
Signed-off-by: NRichard Henderson <rth@twiddle.net>
上级 951fab99
...@@ -326,9 +326,7 @@ extern uintptr_t tci_tb_ptr; ...@@ -326,9 +326,7 @@ extern uintptr_t tci_tb_ptr;
(6) jump to corresponding code of the next of fast path (6) jump to corresponding code of the next of fast path
*/ */
# if defined(__i386__) || defined(__x86_64__) # if defined(__i386__) || defined(__x86_64__)
# define GETRA() ((uintptr_t)__builtin_return_address(0)) # define GETPC_EXT() GETPC()
/* The return address argument for ldst is passed directly. */
# define GETPC_LDST() (abort(), 0)
# elif defined (_ARCH_PPC) && !defined (_ARCH_PPC64) # elif defined (_ARCH_PPC) && !defined (_ARCH_PPC64)
# define GETRA() ((uintptr_t)__builtin_return_address(0)) # define GETRA() ((uintptr_t)__builtin_return_address(0))
# define GETPC_LDST() ((uintptr_t) ((*(int32_t *)(GETRA() - 4)) - 1)) # define GETPC_LDST() ((uintptr_t) ((*(int32_t *)(GETRA() - 4)) - 1))
...@@ -349,7 +347,7 @@ static inline uintptr_t tcg_getpc_ldst(uintptr_t ra) ...@@ -349,7 +347,7 @@ static inline uintptr_t tcg_getpc_ldst(uintptr_t ra)
not the start of the next opcode */ not the start of the next opcode */
return ra; return ra;
} }
#elif defined(__aarch64__) # elif defined(__aarch64__)
# define GETRA() ((uintptr_t)__builtin_return_address(0)) # define GETRA() ((uintptr_t)__builtin_return_address(0))
# define GETPC_LDST() tcg_getpc_ldst(GETRA()) # define GETPC_LDST() tcg_getpc_ldst(GETRA())
static inline uintptr_t tcg_getpc_ldst(uintptr_t ra) static inline uintptr_t tcg_getpc_ldst(uintptr_t ra)
...@@ -367,7 +365,9 @@ static inline uintptr_t tcg_getpc_ldst(uintptr_t ra) ...@@ -367,7 +365,9 @@ static inline uintptr_t tcg_getpc_ldst(uintptr_t ra)
# error "CONFIG_QEMU_LDST_OPTIMIZATION needs GETPC_LDST() implementation!" # error "CONFIG_QEMU_LDST_OPTIMIZATION needs GETPC_LDST() implementation!"
# endif # endif
bool is_tcg_gen_code(uintptr_t pc_ptr); bool is_tcg_gen_code(uintptr_t pc_ptr);
# ifndef GETPC_EXT
# define GETPC_EXT() (is_tcg_gen_code(GETRA()) ? GETPC_LDST() : GETPC()) # define GETPC_EXT() (is_tcg_gen_code(GETRA()) ? GETPC_LDST() : GETPC())
# endif
#else #else
# define GETPC_EXT() GETPC() # define GETPC_EXT() GETPC()
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册