1 | /* $Id: IEMInlineExec-armv8.h 108409 2025-02-27 10:35:39Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * IEM - Interpreted Execution Manager - ARMv8 target, Inline Exec/Decoder routines.
|
---|
4 | *
|
---|
5 | * Target specific stuff for IEMAll.cpp.
|
---|
6 | */
|
---|
7 |
|
---|
8 | /*
|
---|
9 | * Copyright (C) 2011-2025 Oracle and/or its affiliates.
|
---|
10 | *
|
---|
11 | * This file is part of VirtualBox base platform packages, as
|
---|
12 | * available from https://www.alldomusa.eu.org.
|
---|
13 | *
|
---|
14 | * This program is free software; you can redistribute it and/or
|
---|
15 | * modify it under the terms of the GNU General Public License
|
---|
16 | * as published by the Free Software Foundation, in version 3 of the
|
---|
17 | * License.
|
---|
18 | *
|
---|
19 | * This program is distributed in the hope that it will be useful, but
|
---|
20 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
22 | * General Public License for more details.
|
---|
23 | *
|
---|
24 | * You should have received a copy of the GNU General Public License
|
---|
25 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
26 | *
|
---|
27 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
28 | */
|
---|
29 |
|
---|
30 |
|
---|
31 | #ifndef VMM_INCLUDED_SRC_VMMAll_target_armv8_IEMInlineExec_armv8_h
|
---|
32 | #define VMM_INCLUDED_SRC_VMMAll_target_armv8_IEMInlineExec_armv8_h
|
---|
33 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
34 | # pragma once
|
---|
35 | #endif
|
---|
36 |
|
---|
37 |
|
---|
38 | DECL_FORCE_INLINE(VBOXSTRICTRC) iemExecDecodeAndInterpretTargetInstruction(PVMCPUCC pVCpu)
|
---|
39 | {
|
---|
40 | #if 1
|
---|
41 | RT_NOREF(pVCpu);
|
---|
42 | return VERR_NOT_IMPLEMENTED;
|
---|
43 | #else
|
---|
44 | uint32_t const u32 = iemOpcodeGetU32Jmp(pVCpu);
|
---|
45 | return FNIEMOP_CALL_1(g_apfnIemInterpretOnly???[u32 & ???], u32);
|
---|
46 | #endif
|
---|
47 | }
|
---|
48 |
|
---|
49 |
|
---|
50 | DECL_FORCE_INLINE(uint64_t) iemRegGetPC(PVMCPUCC pVCpu)
|
---|
51 | {
|
---|
52 | return pVCpu->cpum.GstCtx.Pc.u64;
|
---|
53 | }
|
---|
54 |
|
---|
55 |
|
---|
56 | DECL_FORCE_INLINE(bool) iemExecLoopTargetCheckMaskedCpuFFs(PVMCPUCC pVCpu, uint64_t fCpuForceFlags)
|
---|
57 | {
|
---|
58 | /* No FFs (irrelevant ones have already been masked out): */
|
---|
59 | if (!fCpuForceFlags)
|
---|
60 | return true;
|
---|
61 |
|
---|
62 | /* Remove IRQ and FIQ FFs that are masked by PSTATE and check if anything is left. */
|
---|
63 | AssertCompile(VMCPU_FF_INTERRUPT_IRQ_BIT < ARMV8_SPSR_EL2_AARCH64_I_BIT);
|
---|
64 | AssertCompile(VMCPU_FF_INTERRUPT_FIQ_BIT < ARMV8_SPSR_EL2_AARCH64_F_BIT);
|
---|
65 | #if 1 /** @todo ARMV8_SPSR_EL2_AARCH64_F/I are bits 6 and 7 respectively, while the
|
---|
66 | * VMCPU_FF_INTERRUPT_FIQ/IRQ are order reversely (bits 1 and 0 respectively).
|
---|
67 | * This makes it more tedious to ignore the masked FF here! */
|
---|
68 | fCpuForceFlags &= ~( ( (pVCpu->cpum.GstCtx.fPState >> (ARMV8_SPSR_EL2_AARCH64_I_BIT - VMCPU_FF_INTERRUPT_IRQ_BIT))
|
---|
69 | & VMCPU_FF_INTERRUPT_IRQ)
|
---|
70 | | ( (pVCpu->cpum.GstCtx.fPState >> (ARMV8_SPSR_EL2_AARCH64_F_BIT - VMCPU_FF_INTERRUPT_FIQ_BIT))
|
---|
71 | & VMCPU_FF_INTERRUPT_FIQ) );
|
---|
72 | #else
|
---|
73 | AssertCompile(VMCPU_FF_INTERRUPT_FIQ_BIT + 1 == VMCPU_FF_INTERRUPT_IRQ_BIT);
|
---|
74 | AssertCompile(ARMV8_SPSR_EL2_AARCH64_F_BIT + 1 == ARMV8_SPSR_EL2_AARCH64_I_BIT);
|
---|
75 | fCpuForceFlags &= ~( (pVCpu->cpum.GstCtx.fPState >> (ARMV8_SPSR_EL2_AARCH64_F_BIT - VMCPU_FF_INTERRUPT_IRQ_BIT))
|
---|
76 | & (VMCPU_FF_INTERRUPT_FIQ | VMCPU_FF_INTERRUPT_IRQ) );
|
---|
77 | #endif
|
---|
78 | return !fCpuForceFlags;
|
---|
79 | }
|
---|
80 |
|
---|
81 | #ifdef VBOX_STRICT
|
---|
82 |
|
---|
83 | DECLINLINE(void) iemInitDecoderStrictTarget(PVMCPUCC pVCpu)
|
---|
84 | {
|
---|
85 | RT_NOREF(pVCpu);
|
---|
86 | }
|
---|
87 |
|
---|
88 |
|
---|
89 | DECLINLINE(void) iemInitExecTailStrictTarget(PVMCPUCC pVCpu)
|
---|
90 | {
|
---|
91 | RT_NOREF(pVCpu);
|
---|
92 | }
|
---|
93 |
|
---|
94 |
|
---|
95 | DECLINLINE(void) iemInitExecTargetStrict(PVMCPUCC pVCpu) RT_NOEXCEPT
|
---|
96 | {
|
---|
97 | iemInitDecoderStrictTarget(pVCpu);
|
---|
98 |
|
---|
99 | # ifdef IEM_WITH_CODE_TLB
|
---|
100 | pVCpu->iem.s.offInstrNextByte = UINT16_MAX;
|
---|
101 | pVCpu->iem.s.pbInstrBuf = NULL;
|
---|
102 | pVCpu->iem.s.cbInstrBufTotal = UINT16_MAX;
|
---|
103 | pVCpu->iem.s.uInstrBufPc = UINT64_C(0xc0ffc0ffcff0c0ff);
|
---|
104 | # else
|
---|
105 | pVCpu->iem.s.cbOpcode = 127;
|
---|
106 | # endif
|
---|
107 | }
|
---|
108 |
|
---|
109 | #endif /* VBOX_STRICT*/
|
---|
110 |
|
---|
111 |
|
---|
112 | #ifdef DBGFTRACE_ENABLED
|
---|
113 | DECLINLINE(void) iemInitDecoderTraceTargetPc(PVMCPUCC pVCpu, uint32_t fExec)
|
---|
114 | {
|
---|
115 | switch (fExec & (IEM_F_MODE_ARM_32BIT | IEM_F_MODE_ARM_T32))
|
---|
116 | {
|
---|
117 | case 0:
|
---|
118 | RTTraceBufAddMsgF(pVCpu->CTX_SUFF(pVM)->CTX_SUFF(hTraceBuf), "A64/%u %08llx",
|
---|
119 | IEM_F_MODE_ARM_GET_EL(fExec), pVCpu->cpum.GstCtx.Pc.u64);
|
---|
120 | break;
|
---|
121 | case IEM_F_MODE_ARM_32BIT:
|
---|
122 | RTTraceBufAddMsgF(pVCpu->CTX_SUFF(pVM)->CTX_SUFF(hTraceBuf), "A32/%u %08llx",
|
---|
123 | IEM_F_MODE_ARM_GET_EL(fExec), pVCpu->cpum.GstCtx.Pc.u64); /** @todo not sure if we're using PC or R15 here... */
|
---|
124 | break;
|
---|
125 | case IEM_F_MODE_ARM_32BIT | IEM_F_MODE_ARM_T32:
|
---|
126 | RTTraceBufAddMsgF(pVCpu->CTX_SUFF(pVM)->CTX_SUFF(hTraceBuf), "T32/%u %08llx",
|
---|
127 | IEM_F_MODE_ARM_GET_EL(fExec), pVCpu->cpum.GstCtx.Pc.u64);
|
---|
128 | break;
|
---|
129 | case IEM_F_MODE_ARM_T32:
|
---|
130 | AssertFailedBreak();
|
---|
131 | }
|
---|
132 | }
|
---|
133 | #endif /* DBGFTRACE_ENABLED */
|
---|
134 |
|
---|
135 | #endif /* !VMM_INCLUDED_SRC_VMMAll_target_armv8_IEMInlineExec_armv8_h */
|
---|
136 |
|
---|