mirror of https://github.com/xemu-project/xemu.git
linux-user: provide frame information in x86-64 safe_syscall
Use cfi directives in the x86-64 safe_syscall to allow gdb to get backtraces right from within it. (In particular this will be quite a common situation if the user interrupts QEMU while it's in a blocked safe-syscall: at the point of the syscall insn RBP is in use for something else, and so gdb can't find the frame then without assistance.) Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
This commit is contained in:
parent
90c0f080fe
commit
9e024732f5
|
@ -24,6 +24,7 @@
|
||||||
* -1-and-errno-set convention is done by the calling wrapper.
|
* -1-and-errno-set convention is done by the calling wrapper.
|
||||||
*/
|
*/
|
||||||
safe_syscall_base:
|
safe_syscall_base:
|
||||||
|
.cfi_startproc
|
||||||
/* This saves a frame pointer and aligns the stack for the syscall.
|
/* This saves a frame pointer and aligns the stack for the syscall.
|
||||||
* (It's unclear if the syscall ABI has the same stack alignment
|
* (It's unclear if the syscall ABI has the same stack alignment
|
||||||
* requirements as the userspace function call ABI, but better safe than
|
* requirements as the userspace function call ABI, but better safe than
|
||||||
|
@ -31,6 +32,8 @@ safe_syscall_base:
|
||||||
* does not list any ABI differences regarding stack alignment.)
|
* does not list any ABI differences regarding stack alignment.)
|
||||||
*/
|
*/
|
||||||
push %rbp
|
push %rbp
|
||||||
|
.cfi_adjust_cfa_offset 8
|
||||||
|
.cfi_rel_offset rbp, 0
|
||||||
|
|
||||||
/* The syscall calling convention isn't the same as the
|
/* The syscall calling convention isn't the same as the
|
||||||
* C one:
|
* C one:
|
||||||
|
@ -70,12 +73,19 @@ safe_syscall_start:
|
||||||
safe_syscall_end:
|
safe_syscall_end:
|
||||||
/* code path for having successfully executed the syscall */
|
/* code path for having successfully executed the syscall */
|
||||||
pop %rbp
|
pop %rbp
|
||||||
|
.cfi_remember_state
|
||||||
|
.cfi_def_cfa_offset 8
|
||||||
|
.cfi_restore rbp
|
||||||
ret
|
ret
|
||||||
|
|
||||||
return_ERESTARTSYS:
|
return_ERESTARTSYS:
|
||||||
/* code path when we didn't execute the syscall */
|
/* code path when we didn't execute the syscall */
|
||||||
|
.cfi_restore_state
|
||||||
mov $-TARGET_ERESTARTSYS, %rax
|
mov $-TARGET_ERESTARTSYS, %rax
|
||||||
pop %rbp
|
pop %rbp
|
||||||
|
.cfi_def_cfa_offset 8
|
||||||
|
.cfi_restore rbp
|
||||||
ret
|
ret
|
||||||
|
.cfi_endproc
|
||||||
|
|
||||||
.size safe_syscall_base, .-safe_syscall_base
|
.size safe_syscall_base, .-safe_syscall_base
|
||||||
|
|
Loading…
Reference in New Issue