mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-12-22 16:30:57 +01:00
core: hle: kernel: Add KEventInfo.
This commit is contained in:
parent
ddd3f48736
commit
37b17252d1
4 changed files with 102 additions and 1 deletions
|
@ -196,6 +196,7 @@ add_library(core STATIC
|
|||
hle/kernel/k_dynamic_slab_heap.h
|
||||
hle/kernel/k_event.cpp
|
||||
hle/kernel/k_event.h
|
||||
hle/kernel/k_event_info.h
|
||||
hle/kernel/k_handle_table.cpp
|
||||
hle/kernel/k_handle_table.h
|
||||
hle/kernel/k_interrupt_manager.cpp
|
||||
|
|
64
src/core/hle/kernel/k_event_info.h
Normal file
64
src/core/hle/kernel/k_event_info.h
Normal file
|
@ -0,0 +1,64 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
|
||||
#include <boost/intrusive/list.hpp>
|
||||
|
||||
#include "core/hle/kernel/slab_helpers.h"
|
||||
#include "core/hle/kernel/svc_types.h"
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
class KEventInfo : public KSlabAllocated<KEventInfo>, public boost::intrusive::list_base_hook<> {
|
||||
public:
|
||||
struct InfoCreateThread {
|
||||
u32 thread_id{};
|
||||
uintptr_t tls_address{};
|
||||
};
|
||||
|
||||
struct InfoExitProcess {
|
||||
Svc::ProcessExitReason reason{};
|
||||
};
|
||||
|
||||
struct InfoExitThread {
|
||||
Svc::ThreadExitReason reason{};
|
||||
};
|
||||
|
||||
struct InfoException {
|
||||
Svc::DebugException exception_type{};
|
||||
s32 exception_data_count{};
|
||||
uintptr_t exception_address{};
|
||||
std::array<uintptr_t, 4> exception_data{};
|
||||
};
|
||||
|
||||
struct InfoSystemCall {
|
||||
s64 tick{};
|
||||
s32 id{};
|
||||
};
|
||||
|
||||
public:
|
||||
KEventInfo() = default;
|
||||
~KEventInfo() = default;
|
||||
|
||||
public:
|
||||
Svc::DebugEvent event{};
|
||||
u32 thread_id{};
|
||||
u32 flags{};
|
||||
bool is_attached{};
|
||||
bool continue_flag{};
|
||||
bool ignore_continue{};
|
||||
bool close_once{};
|
||||
union {
|
||||
InfoCreateThread create_thread;
|
||||
InfoExitProcess exit_process;
|
||||
InfoExitThread exit_thread;
|
||||
InfoException exception;
|
||||
InfoSystemCall system_call;
|
||||
} info{};
|
||||
KThread* debug_thread{};
|
||||
};
|
||||
|
||||
} // namespace Kernel
|
|
@ -2246,7 +2246,7 @@ static u64 GetSystemTick(Core::System& system) {
|
|||
auto& core_timing = system.CoreTiming();
|
||||
|
||||
// Returns the value of cntpct_el0 (https://switchbrew.org/wiki/SVC#svcGetSystemTick)
|
||||
const u64 result{system.CoreTiming().GetClockTicks()};
|
||||
const u64 result{core_timing.GetClockTicks()};
|
||||
|
||||
if (!system.Kernel().IsMulticore()) {
|
||||
core_timing.AddTicks(400U);
|
||||
|
|
|
@ -32,6 +32,7 @@ enum class MemoryState : u32 {
|
|||
GeneratedCode = 0x14,
|
||||
CodeOut = 0x15,
|
||||
Coverage = 0x16,
|
||||
Insecure = 0x17,
|
||||
};
|
||||
DECLARE_ENUM_FLAG_OPERATORS(MemoryState);
|
||||
|
||||
|
@ -83,6 +84,13 @@ enum class YieldType : s64 {
|
|||
ToAnyThread = -2,
|
||||
};
|
||||
|
||||
enum class ThreadExitReason : u32 {
|
||||
ExitThread = 0,
|
||||
TerminateThread = 1,
|
||||
ExitProcess = 2,
|
||||
TerminateProcess = 3,
|
||||
};
|
||||
|
||||
enum class ThreadActivity : u32 {
|
||||
Runnable = 0,
|
||||
Paused = 1,
|
||||
|
@ -108,6 +116,34 @@ enum class ProcessState : u32 {
|
|||
DebugBreak = 7,
|
||||
};
|
||||
|
||||
enum class ProcessExitReason : u32 {
|
||||
ExitProcess = 0,
|
||||
TerminateProcess = 1,
|
||||
Exception = 2,
|
||||
};
|
||||
|
||||
constexpr inline size_t ThreadLocalRegionSize = 0x200;
|
||||
|
||||
// Debug types.
|
||||
enum class DebugEvent : u32 {
|
||||
CreateProcess = 0,
|
||||
CreateThread = 1,
|
||||
ExitProcess = 2,
|
||||
ExitThread = 3,
|
||||
Exception = 4,
|
||||
};
|
||||
|
||||
enum class DebugException : u32 {
|
||||
UndefinedInstruction = 0,
|
||||
InstructionAbort = 1,
|
||||
DataAbort = 2,
|
||||
AlignmentFault = 3,
|
||||
DebuggerAttached = 4,
|
||||
BreakPoint = 5,
|
||||
UserBreak = 6,
|
||||
DebuggerBreak = 7,
|
||||
UndefinedSystemCall = 8,
|
||||
MemorySystemError = 9,
|
||||
};
|
||||
|
||||
} // namespace Kernel::Svc
|
||||
|
|
Loading…
Reference in a new issue