summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel
diff options
context:
space:
mode:
authorGravatar bunnei2022-10-29 13:19:33 -0700
committerGravatar bunnei2022-11-03 21:17:06 -0700
commit37b17252d175478dea7e1eeaf7332da1558f0373 (patch)
treee3e38213f59bbbc38938eec9c69097742cf3b8a0 /src/core/hle/kernel
parentcore: hle: kernel: Add KDebug. (diff)
downloadyuzu-37b17252d175478dea7e1eeaf7332da1558f0373.tar.gz
yuzu-37b17252d175478dea7e1eeaf7332da1558f0373.tar.xz
yuzu-37b17252d175478dea7e1eeaf7332da1558f0373.zip
core: hle: kernel: Add KEventInfo.
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r--src/core/hle/kernel/k_event_info.h64
-rw-r--r--src/core/hle/kernel/svc.cpp2
-rw-r--r--src/core/hle/kernel/svc_types.h36
3 files changed, 101 insertions, 1 deletions
diff --git a/src/core/hle/kernel/k_event_info.h b/src/core/hle/kernel/k_event_info.h
new file mode 100644
index 000000000..25b3ff594
--- /dev/null
+++ b/src/core/hle/kernel/k_event_info.h
@@ -0,0 +1,64 @@
1// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#pragma once
5
6#include <array>
7
8#include <boost/intrusive/list.hpp>
9
10#include "core/hle/kernel/slab_helpers.h"
11#include "core/hle/kernel/svc_types.h"
12
13namespace Kernel {
14
15class KEventInfo : public KSlabAllocated<KEventInfo>, public boost::intrusive::list_base_hook<> {
16public:
17 struct InfoCreateThread {
18 u32 thread_id{};
19 uintptr_t tls_address{};
20 };
21
22 struct InfoExitProcess {
23 Svc::ProcessExitReason reason{};
24 };
25
26 struct InfoExitThread {
27 Svc::ThreadExitReason reason{};
28 };
29
30 struct InfoException {
31 Svc::DebugException exception_type{};
32 s32 exception_data_count{};
33 uintptr_t exception_address{};
34 std::array<uintptr_t, 4> exception_data{};
35 };
36
37 struct InfoSystemCall {
38 s64 tick{};
39 s32 id{};
40 };
41
42public:
43 KEventInfo() = default;
44 ~KEventInfo() = default;
45
46public:
47 Svc::DebugEvent event{};
48 u32 thread_id{};
49 u32 flags{};
50 bool is_attached{};
51 bool continue_flag{};
52 bool ignore_continue{};
53 bool close_once{};
54 union {
55 InfoCreateThread create_thread;
56 InfoExitProcess exit_process;
57 InfoExitThread exit_thread;
58 InfoException exception;
59 InfoSystemCall system_call;
60 } info{};
61 KThread* debug_thread{};
62};
63
64} // namespace Kernel
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index 4aca5b27d..319c9f572 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -2246,7 +2246,7 @@ static u64 GetSystemTick(Core::System& system) {
2246 auto& core_timing = system.CoreTiming(); 2246 auto& core_timing = system.CoreTiming();
2247 2247
2248 // Returns the value of cntpct_el0 (https://switchbrew.org/wiki/SVC#svcGetSystemTick) 2248 // Returns the value of cntpct_el0 (https://switchbrew.org/wiki/SVC#svcGetSystemTick)
2249 const u64 result{system.CoreTiming().GetClockTicks()}; 2249 const u64 result{core_timing.GetClockTicks()};
2250 2250
2251 if (!system.Kernel().IsMulticore()) { 2251 if (!system.Kernel().IsMulticore()) {
2252 core_timing.AddTicks(400U); 2252 core_timing.AddTicks(400U);
diff --git a/src/core/hle/kernel/svc_types.h b/src/core/hle/kernel/svc_types.h
index abb9847fe..11bb0fe0f 100644
--- a/src/core/hle/kernel/svc_types.h
+++ b/src/core/hle/kernel/svc_types.h
@@ -32,6 +32,7 @@ enum class MemoryState : u32 {
32 GeneratedCode = 0x14, 32 GeneratedCode = 0x14,
33 CodeOut = 0x15, 33 CodeOut = 0x15,
34 Coverage = 0x16, 34 Coverage = 0x16,
35 Insecure = 0x17,
35}; 36};
36DECLARE_ENUM_FLAG_OPERATORS(MemoryState); 37DECLARE_ENUM_FLAG_OPERATORS(MemoryState);
37 38
@@ -83,6 +84,13 @@ enum class YieldType : s64 {
83 ToAnyThread = -2, 84 ToAnyThread = -2,
84}; 85};
85 86
87enum class ThreadExitReason : u32 {
88 ExitThread = 0,
89 TerminateThread = 1,
90 ExitProcess = 2,
91 TerminateProcess = 3,
92};
93
86enum class ThreadActivity : u32 { 94enum class ThreadActivity : u32 {
87 Runnable = 0, 95 Runnable = 0,
88 Paused = 1, 96 Paused = 1,
@@ -108,6 +116,34 @@ enum class ProcessState : u32 {
108 DebugBreak = 7, 116 DebugBreak = 7,
109}; 117};
110 118
119enum class ProcessExitReason : u32 {
120 ExitProcess = 0,
121 TerminateProcess = 1,
122 Exception = 2,
123};
124
111constexpr inline size_t ThreadLocalRegionSize = 0x200; 125constexpr inline size_t ThreadLocalRegionSize = 0x200;
112 126
127// Debug types.
128enum class DebugEvent : u32 {
129 CreateProcess = 0,
130 CreateThread = 1,
131 ExitProcess = 2,
132 ExitThread = 3,
133 Exception = 4,
134};
135
136enum class DebugException : u32 {
137 UndefinedInstruction = 0,
138 InstructionAbort = 1,
139 DataAbort = 2,
140 AlignmentFault = 3,
141 DebuggerAttached = 4,
142 BreakPoint = 5,
143 UserBreak = 6,
144 DebuggerBreak = 7,
145 UndefinedSystemCall = 8,
146 MemorySystemError = 9,
147};
148
113} // namespace Kernel::Svc 149} // namespace Kernel::Svc