VirtualBox

source: vbox/trunk/src/VBox/VMM/VMMAll/IEMAllN8veHlpA-arm64.S@ 104312

Last change on this file since 104312 was 104230, checked in by vboxsync, 10 months ago

asmdefs-arm.mac,asmdefs-arm.h: Merge asmdefs-arm.mac into asmdefs-arm.h as the .mac file extension is assoicated with nasm/yasm and it is not expected to include asmdefs-arm.h into non assembly sources, bugref:10391

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.7 KB
Line 
1/* $Id: IEMAllN8veHlpA-arm64.S 104230 2024-04-08 13:45:54Z vboxsync $ */
2/** @file
3 * IEM - Native Recompiler Assembly Helpers, ARM64 variant.
4 */
5
6/*
7 * Copyright (C) 2024 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 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28
29/*********************************************************************************************************************************
30* Header Files *
31*********************************************************************************************************************************/
32#include <iprt/asmdefs-arm.h>
33
34
35BEGINCODE
36
37.extern NAME(iemThreadedFunc_BltIn_LogCpuStateWorker)
38
39/**
40 * This does the epilogue of a TB, given the RBP for the frame and eax value to return.
41 *
42 * @param pFrame (x0) The frame pointer.
43 * @param rc (w1) The return value.
44 *
45 * @note This doesn't really work for MSC since xmm6 thru xmm15 are non-volatile
46 * and since we don't save them in the TB prolog we'll potentially return
47 * with different values if any functions on the calling stack uses them
48 * as they're unlikely to restore them till they return.
49 *
50 * For the GCC calling convention all xmm registers are volatile and the
51 * only worry would be someone fiddling the control bits of MXCSR or FCW
52 * without restoring them. This is highly unlikely, unless we're doing
53 * it ourselves, I think.
54 */
55BEGINPROC_HIDDEN iemNativeTbLongJmp
56 /*
57 * This must exactly match what iemNativeEmitEpilog does.
58 */
59 sub sp, x0, #0x50
60 ldp x19, x20, [sp, #0x00]
61 ldp x21, x22, [sp, #0x10]
62 ldp x23, x24, [sp, #0x20]
63 ldp x25, x26, [sp, #0x30]
64 ldp x27, x28, [sp, #0x40]
65 ldp x29, x30, [sp, #0x50] /* the pFrame address points to this entry */
66 add sp, sp, #0x60
67 mov w0, w1 /* The return value */
68#ifdef RT_OS_DARWIN
69 retab
70#else
71 ret
72#endif
73 brk #1
74
75
76
77#define IEMNATIVE_HLP_FRAME_SIZE (11 * 16)
78
79/**
80 * This is wrapper function that saves and restores all volatile registers
81 * so the impact of inserting LogCpuState is minimal to the other TB code.
82 */
83BEGINPROC_HIDDEN iemNativeHlpAsmSafeWrapLogCpuState
84#ifdef RT_OS_DARWIN
85 pacibsp
86#endif
87
88 /*
89 * Save all volatile registers.
90 */
91 stp x29, x30, [sp, #-IEMNATIVE_HLP_FRAME_SIZE]!
92 stp x0, x1, [sp, #( 1 * 16)]
93 stp x2, x3, [sp, #( 2 * 16)]
94 stp x4, x5, [sp, #( 3 * 16)]
95 stp x5, x6, [sp, #( 4 * 16)]
96 stp x7, x8, [sp, #( 5 * 16)]
97 stp x9, x10, [sp, #( 6 * 16)]
98 stp x11, x12, [sp, #( 7 * 16)]
99 stp x13, x14, [sp, #( 8 * 16)]
100 stp x15, x16, [sp, #( 9 * 16)]
101 stp x17, x18, [sp, #(10 * 16)]
102
103 /*
104 * Move the pVCpu pointer from the fixed register to the first argument.
105 * @todo This needs syncing with what we use in IEMN8veRecompiler.h
106 * but we can't include that header right now, would need some #ifndef IN_ASM_CODE...
107 * in the header or splitting up the header into a asm safe one and a one included from C/C++.
108 */
109 mov x0, x28
110
111 /*
112 * Call C function to do the actual work.
113 */
114 bl NAME(iemThreadedFunc_BltIn_LogCpuStateWorker)
115
116 /*
117 * Restore volatile registers and return to the TB code.
118 */
119 ldp x29, x30, [sp, #( 0 * 16)]
120 ldp x0, x1, [sp, #( 1 * 16)]
121 ldp x2, x3, [sp, #( 2 * 16)]
122 ldp x4, x5, [sp, #( 3 * 16)]
123 ldp x5, x6, [sp, #( 4 * 16)]
124 ldp x7, x8, [sp, #( 5 * 16)]
125 ldp x9, x10, [sp, #( 6 * 16)]
126 ldp x11, x12, [sp, #( 7 * 16)]
127 ldp x13, x14, [sp, #( 8 * 16)]
128 ldp x15, x16, [sp, #( 9 * 16)]
129 ldp x17, x18, [sp, #(10 * 16)]
130 add sp, sp, #IEMNATIVE_HLP_FRAME_SIZE
131
132#ifdef RT_OS_DARWIN
133 retab
134#else
135 ret
136#endif
137 brk #1
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