VirtualBox

source: vbox/trunk/src/VBox/Runtime/common/dbg/dbgstackdumpself-amd64-x86.asm@ 100765

Last change on this file since 100765 was 98103, checked in by vboxsync, 23 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.8 KB
Line 
1; $Id: dbgstackdumpself-amd64-x86.asm 98103 2023-01-17 14:15:46Z vboxsync $
2;; @file
3; IPRT - RTDbgStackDumpSelf assembly wrapper calling rtDbgStackDumpSelfWorker.
4;
5
6;
7; Copyright (C) 2006-2023 Oracle and/or its affiliates.
8;
9; This file is part of VirtualBox base platform packages, as
10; available from https://www.virtualbox.org.
11;
12; This program is free software; you can redistribute it and/or
13; modify it under the terms of the GNU General Public License
14; as published by the Free Software Foundation, in version 3 of the
15; License.
16;
17; This program is distributed in the hope that it will be useful, but
18; WITHOUT ANY WARRANTY; without even the implied warranty of
19; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20; General Public License for more details.
21;
22; You should have received a copy of the GNU General Public License
23; along with this program; if not, see <https://www.gnu.org/licenses>.
24;
25; The contents of this file may alternatively be used under the terms
26; of the Common Development and Distribution License Version 1.0
27; (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
28; in the VirtualBox distribution, in which case the provisions of the
29; CDDL are applicable instead of those of the GPL.
30;
31; You may elect to license modified versions of this file under the
32; terms and conditions of either the GPL or the CDDL or both.
33;
34; SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
35;
36
37
38;*********************************************************************************************************************************
39;* Header Files *
40;*********************************************************************************************************************************
41%define RT_ASM_WITH_SEH64
42%include "iprt/asmdefs.mac"
43
44
45;*********************************************************************************************************************************
46;* Extern Symbols *
47;*********************************************************************************************************************************
48extern NAME(rtDbgStackDumpSelfWorker)
49
50
51BEGINCODE
52
53;;
54; Collects register state and calls C worker.
55;
56RT_BEGINPROC RTDbgStackDumpSelf
57 push xBP
58 SEH64_PUSH_xBP
59 mov xBP, xSP
60 SEH64_SET_FRAME_xBP 0
61
62 ;
63 ; Push all GPRS in reserve order...
64 ;
65%ifdef RT_ARCH_AMD64
66 push r15
67 SEH64_PUSH_GREG r15
68 push r14
69 SEH64_PUSH_GREG r14
70 push r13
71 SEH64_PUSH_GREG r13
72 push r12
73 SEH64_PUSH_GREG r12
74 push r13
75 SEH64_PUSH_GREG r13
76 push r12
77 SEH64_PUSH_GREG r12
78 push r11
79 SEH64_PUSH_GREG r11
80 push r10
81 SEH64_PUSH_GREG r10
82 push r9
83 SEH64_PUSH_GREG r9
84 push r8
85 SEH64_PUSH_GREG r8
86%endif
87 push xDI
88 SEH64_PUSH_GREG xDI
89 push xSI
90 SEH64_PUSH_GREG xSI
91%ifdef RT_ARCH_AMD64
92 mov r10, [xBP] ; Caller RBP.
93 push r10
94 lea r10, [xBP + xCB * 2] ; Caller RSP.
95 push r10
96%else
97 push dword [xBP] ; Caller EBP
98 push xAX
99 lea xAX, [xBP + xCB * 2] ; Caller ESP.
100 xchg xAX, [xSP]
101%endif
102 push xBX
103 SEH64_PUSH_GREG xBX
104 push xDX
105 SEH64_PUSH_GREG xDX
106 push xCX
107 SEH64_PUSH_GREG xCX
108 push xAX
109 SEH64_PUSH_GREG xAX
110
111 ;
112 ; ... preceeded by the EIP/RIP.
113 ;
114%ifdef RT_ARCH_AMD64
115 mov r10, [xBP + xCB]
116 push r10
117%else
118 push dword [xBP + xCB]
119%endif
120
121 ;
122 ; Call the worker function passing the register array as the fourth argument.
123 ;
124%ifdef ASM_CALL64_GCC
125 mov rcx, rsp ; 4th parameter = register array.
126 sub rsp, 8h ; Align stack.
127 SEH64_ALLOCATE_STACK 28h
128%elifdef ASM_CALL64_MSC
129 mov r9, rsp ; 4th parameter = register array.
130 sub rsp, 28h ; Aling stack and allocate spill area.
131 SEH64_ALLOCATE_STACK 28h
132%else
133 mov eax, esp ; Save register array location
134 and xSP, ~15 ; Align the stack.
135%endif
136SEH64_END_PROLOGUE
137
138%ifndef RT_ARCH_AMD64
139 push eax
140 push dword [xBP + xCB * 4]
141 push dword [xBP + xCB * 3]
142 push dword [xBP + xCB * 2]
143%endif
144%ifdef ASM_FORMAT_ELF
145 %ifdef PIC
146 call NAME(rtDbgStackDumpSelfWorker) wrt ..plt
147 %else
148 call NAME(rtDbgStackDumpSelfWorker)
149 %endif
150%else
151 call NAME(rtDbgStackDumpSelfWorker)
152%endif
153
154 leave
155 ret
156ENDPROC RTDbgStackDumpSelf
157
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette