summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/svc/svc_thread_profiler.cpp
blob: 40de7708b29313a787f82e74ee1d64c8008e661f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

#include "core/hle/kernel/svc.h"
#include "core/hle/kernel/svc_results.h"

namespace Kernel::Svc {

Result GetDebugFutureThreadInfo(Core::System& system, lp64::LastThreadContext* out_context,
                                uint64_t* out_thread_id, Handle debug_handle, int64_t ns) {
    UNIMPLEMENTED();
    R_THROW(ResultNotImplemented);
}

Result GetLastThreadInfo(Core::System& system, lp64::LastThreadContext* out_context,
                         uint64_t* out_tls_address, uint32_t* out_flags) {
    UNIMPLEMENTED();
    R_THROW(ResultNotImplemented);
}

Result GetDebugFutureThreadInfo64(Core::System& system, lp64::LastThreadContext* out_context,
                                  uint64_t* out_thread_id, Handle debug_handle, int64_t ns) {
    R_RETURN(GetDebugFutureThreadInfo(system, out_context, out_thread_id, debug_handle, ns));
}

Result GetLastThreadInfo64(Core::System& system, lp64::LastThreadContext* out_context,
                           uint64_t* out_tls_address, uint32_t* out_flags) {
    R_RETURN(GetLastThreadInfo(system, out_context, out_tls_address, out_flags));
}

Result GetDebugFutureThreadInfo64From32(Core::System& system, ilp32::LastThreadContext* out_context,
                                        uint64_t* out_thread_id, Handle debug_handle, int64_t ns) {
    lp64::LastThreadContext context{};
    R_TRY(
        GetDebugFutureThreadInfo(system, std::addressof(context), out_thread_id, debug_handle, ns));

    *out_context = {
        .fp = static_cast<u32>(context.fp),
        .sp = static_cast<u32>(context.sp),
        .lr = static_cast<u32>(context.lr),
        .pc = static_cast<u32>(context.pc),
    };
    R_SUCCEED();
}

Result GetLastThreadInfo64From32(Core::System& system, ilp32::LastThreadContext* out_context,
                                 uint64_t* out_tls_address, uint32_t* out_flags) {
    lp64::LastThreadContext context{};
    R_TRY(GetLastThreadInfo(system, std::addressof(context), out_tls_address, out_flags));

    *out_context = {
        .fp = static_cast<u32>(context.fp),
        .sp = static_cast<u32>(context.sp),
        .lr = static_cast<u32>(context.lr),
        .pc = static_cast<u32>(context.pc),
    };
    R_SUCCEED();
}

} // namespace Kernel::Svc