1 /* This file is part of the dynarmic project.
2  * Copyright (c) 2019 MerryMage
3  * SPDX-License-Identifier: 0BSD
4  */
5 
6 #include <dynarmic/A32/config.h>
7 #include "frontend/A32/translate/impl/translate_arm.h"
8 
9 namespace Dynarmic::A32 {
10 
arm_PLD_imm(bool add,bool R,Reg n,Imm<12> imm12)11 bool ArmTranslatorVisitor::arm_PLD_imm([[maybe_unused]] bool add,
12                                        bool R,
13                                        [[maybe_unused]] Reg n,
14                                        [[maybe_unused]] Imm<12> imm12) {
15     if (!options.hook_hint_instructions) {
16         return true;
17     }
18 
19     const auto exception = R ? Exception::PreloadData
20                              : Exception::PreloadDataWithIntentToWrite;
21     return RaiseException(exception);
22 }
23 
arm_PLD_reg(bool add,bool R,Reg n,Imm<5> imm5,ShiftType shift,Reg m)24 bool ArmTranslatorVisitor::arm_PLD_reg([[maybe_unused]] bool add,
25                                        bool R,
26                                        [[maybe_unused]] Reg n,
27                                        [[maybe_unused]] Imm<5> imm5,
28                                        [[maybe_unused]] ShiftType shift,
29                                        [[maybe_unused]] Reg m) {
30     if (!options.hook_hint_instructions) {
31         return true;
32     }
33 
34     const auto exception = R ? Exception::PreloadData
35                              : Exception::PreloadDataWithIntentToWrite;
36     return RaiseException(exception);
37 }
38 
arm_SEV()39 bool ArmTranslatorVisitor::arm_SEV() {
40     if (!options.hook_hint_instructions) {
41         return true;
42     }
43 
44     return RaiseException(Exception::SendEvent);
45 }
46 
arm_SEVL()47 bool ArmTranslatorVisitor::arm_SEVL() {
48     if (!options.hook_hint_instructions) {
49         return true;
50     }
51 
52     return RaiseException(Exception::SendEventLocal);
53 }
54 
arm_WFE()55 bool ArmTranslatorVisitor::arm_WFE() {
56     if (!options.hook_hint_instructions) {
57         return true;
58     }
59 
60     return RaiseException(Exception::WaitForEvent);
61 }
62 
arm_WFI()63 bool ArmTranslatorVisitor::arm_WFI() {
64     if (!options.hook_hint_instructions) {
65         return true;
66     }
67 
68     return RaiseException(Exception::WaitForInterrupt);
69 }
70 
arm_YIELD()71 bool ArmTranslatorVisitor::arm_YIELD() {
72     if (!options.hook_hint_instructions) {
73         return true;
74     }
75 
76     return RaiseException(Exception::Yield);
77 }
78 
79 } // namespace Dynarmic::A32
80