cppgc: Maintain frame pointer for x64 stack scan
Maintain a proper frame pointer in rbp when going through the trampoline. This ensures that e.g. gdb can properly unwind the stack. Bug: chromium:1056170 Change-Id: I7a9252316e7ce8d83cf54e1efc801b92476bc4ad Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2128050 Reviewed-by: Anton Bikineev <bikineev@chromium.org> Commit-Queue: Michael Lippautz <mlippautz@chromium.org> Cr-Commit-Position: refs/heads/master@{#66920}
This commit is contained in:
parent
17967c0773
commit
1340412a2d
@ -27,9 +27,12 @@ PushAllRegistersAndIterateStack:
|
||||
// on the stack and we push 56 bytes which maintains 16-byte stack alignment
|
||||
// at the call.
|
||||
// Source: https://github.com/hjl-tools/x86-psABI/wiki/x86-64-psABI-1.0.pdf
|
||||
//
|
||||
// rbp is callee-saved. Maintain proper frame pointer for debugging.
|
||||
push %rbp
|
||||
mov %rsp, %rbp
|
||||
push $0xCDCDCD // Dummy for alignment.
|
||||
push %rbx
|
||||
push %rbp
|
||||
push %r12
|
||||
push %r13
|
||||
push %r14
|
||||
@ -42,7 +45,8 @@ PushAllRegistersAndIterateStack:
|
||||
mov %rsp, %rdx
|
||||
// Call the callback.
|
||||
call *%r8
|
||||
// Pop the callee-saved registers. None of them were modified so no
|
||||
// restoring is needed.
|
||||
add $56, %rsp
|
||||
// Pop the callee-saved registers.
|
||||
add $48, %rsp
|
||||
// Restore rbp as it was used as frame pointer.
|
||||
pop %rbp
|
||||
ret
|
||||
|
@ -16,11 +16,14 @@ PushAllRegistersAndIterateStack:
|
||||
;; on the stack and we push 72 bytes which maintains 16-byte stack alignment
|
||||
;; at the call.
|
||||
;; Source: https://docs.microsoft.com/en-us/cpp/build/x64-calling-convention
|
||||
;;
|
||||
;; rbp is callee-saved. Maintain proper frame pointer for debugging.
|
||||
push rbp
|
||||
mov rbp, rsp
|
||||
push 0CDCDCDh ;; Dummy for alignment.
|
||||
push rsi
|
||||
push rdi
|
||||
push rbx
|
||||
push rbp
|
||||
push r12
|
||||
push r13
|
||||
push r14
|
||||
@ -33,9 +36,10 @@ PushAllRegistersAndIterateStack:
|
||||
mov r8, rsp
|
||||
;; Call the callback.
|
||||
call r9
|
||||
;; Pop the callee-saved registers. None of them were modified so no
|
||||
;; restoring is needed.
|
||||
add rsp, 72
|
||||
;; Pop the callee-saved registers.
|
||||
add rsp, 64
|
||||
;; Restore rbp as it was used as frame pointer.
|
||||
pop rbp
|
||||
ret
|
||||
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user