xref: /aosp_15_r20/art/runtime/arch/context-inl.h (revision 795d594fd825385562da6b089ea9b2033f3abf5a)
1*795d594fSAndroid Build Coastguard Worker /*
2*795d594fSAndroid Build Coastguard Worker  * Copyright (C) 2017 The Android Open Source Project
3*795d594fSAndroid Build Coastguard Worker  *
4*795d594fSAndroid Build Coastguard Worker  * Licensed under the Apache License, Version 2.0 (the "License");
5*795d594fSAndroid Build Coastguard Worker  * you may not use this file except in compliance with the License.
6*795d594fSAndroid Build Coastguard Worker  * You may obtain a copy of the License at
7*795d594fSAndroid Build Coastguard Worker  *
8*795d594fSAndroid Build Coastguard Worker  *      http://www.apache.org/licenses/LICENSE-2.0
9*795d594fSAndroid Build Coastguard Worker  *
10*795d594fSAndroid Build Coastguard Worker  * Unless required by applicable law or agreed to in writing, software
11*795d594fSAndroid Build Coastguard Worker  * distributed under the License is distributed on an "AS IS" BASIS,
12*795d594fSAndroid Build Coastguard Worker  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*795d594fSAndroid Build Coastguard Worker  * See the License for the specific language governing permissions and
14*795d594fSAndroid Build Coastguard Worker  * limitations under the License.
15*795d594fSAndroid Build Coastguard Worker  */
16*795d594fSAndroid Build Coastguard Worker 
17*795d594fSAndroid Build Coastguard Worker // This file is special-purpose for cases where you want a stack context. Most users should use
18*795d594fSAndroid Build Coastguard Worker // Context::Create().
19*795d594fSAndroid Build Coastguard Worker 
20*795d594fSAndroid Build Coastguard Worker #include "arch/instruction_set.h"
21*795d594fSAndroid Build Coastguard Worker #include "context.h"
22*795d594fSAndroid Build Coastguard Worker 
23*795d594fSAndroid Build Coastguard Worker #ifndef ART_RUNTIME_ARCH_CONTEXT_INL_H_
24*795d594fSAndroid Build Coastguard Worker #define ART_RUNTIME_ARCH_CONTEXT_INL_H_
25*795d594fSAndroid Build Coastguard Worker 
26*795d594fSAndroid Build Coastguard Worker #include "arm/context_arm.h"
27*795d594fSAndroid Build Coastguard Worker #include "arm64/context_arm64.h"
28*795d594fSAndroid Build Coastguard Worker #include "riscv64/context_riscv64.h"
29*795d594fSAndroid Build Coastguard Worker #include "x86/context_x86.h"
30*795d594fSAndroid Build Coastguard Worker #include "x86_64/context_x86_64.h"
31*795d594fSAndroid Build Coastguard Worker 
32*795d594fSAndroid Build Coastguard Worker namespace art HIDDEN {
33*795d594fSAndroid Build Coastguard Worker 
34*795d594fSAndroid Build Coastguard Worker namespace detail {
35*795d594fSAndroid Build Coastguard Worker 
36*795d594fSAndroid Build Coastguard Worker template <InstructionSet>
37*795d594fSAndroid Build Coastguard Worker struct ContextSelector;
38*795d594fSAndroid Build Coastguard Worker 
39*795d594fSAndroid Build Coastguard Worker template <>
40*795d594fSAndroid Build Coastguard Worker struct ContextSelector<InstructionSet::kArm> { using type = arm::ArmContext; };
41*795d594fSAndroid Build Coastguard Worker template <>
42*795d594fSAndroid Build Coastguard Worker struct ContextSelector<InstructionSet::kArm64> { using type = arm64::Arm64Context; };
43*795d594fSAndroid Build Coastguard Worker template <>
44*795d594fSAndroid Build Coastguard Worker struct ContextSelector<InstructionSet::kRiscv64> { using type = riscv64::Riscv64Context; };
45*795d594fSAndroid Build Coastguard Worker template <>
46*795d594fSAndroid Build Coastguard Worker struct ContextSelector<InstructionSet::kX86> { using type = x86::X86Context; };
47*795d594fSAndroid Build Coastguard Worker template <>
48*795d594fSAndroid Build Coastguard Worker struct ContextSelector<InstructionSet::kX86_64> { using type = x86_64::X86_64Context; };
49*795d594fSAndroid Build Coastguard Worker 
50*795d594fSAndroid Build Coastguard Worker }  // namespace detail
51*795d594fSAndroid Build Coastguard Worker 
52*795d594fSAndroid Build Coastguard Worker template <InstructionSet Isa>
53*795d594fSAndroid Build Coastguard Worker using RuntimeContextTypeArch = typename detail::ContextSelector<Isa>::type;
54*795d594fSAndroid Build Coastguard Worker using RuntimeContextType = RuntimeContextTypeArch<kRuntimeQuickCodeISA>;
55*795d594fSAndroid Build Coastguard Worker 
56*795d594fSAndroid Build Coastguard Worker }  // namespace art
57*795d594fSAndroid Build Coastguard Worker 
58*795d594fSAndroid Build Coastguard Worker #endif  // ART_RUNTIME_ARCH_CONTEXT_INL_H_
59