aboutsummaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/errors.h
blob: 56ee1ab9a46c7244b6b184ca29bf081cae02e88d (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// Copyright 2017 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.

#pragma once

#include "core/hle/result.h"

namespace Kernel {
namespace ErrCodes {
enum {
    OutOfSharedMems = 11,
    OutOfThreads = 12,
    OutOfMutexes = 13,
    OutOfSemaphores = 14,
    OutOfEvents = 15,
    OutOfTimers = 16,
    OutOfHandles = 19,
    SessionClosedByRemote = 26,
    PortNameTooLong = 30,
    WrongLockingThread = 31,
    NoPendingSessions = 35,
    WrongPermission = 46,
    InvalidBufferDescriptor = 48,
    OutOfAddressArbiters = 51,
    MaxConnectionsReached = 52,
    CommandTooLarge = 54,
};
}

// WARNING: The kernel is quite inconsistent in it's usage of errors code. Make sure to always
// double check that the code matches before re-using the constant.

constexpr Result ResultOutOfHandles(ErrCodes::OutOfHandles, ErrorModule::Kernel,
                                    ErrorSummary::OutOfResource,
                                    ErrorLevel::Permanent); // 0xD8600413
constexpr Result ResultSessionClosed(ErrCodes::SessionClosedByRemote, ErrorModule::OS,
                                     ErrorSummary::Canceled,
                                     ErrorLevel::Status); // 0xC920181A
constexpr Result ResultPortNameTooLong(ErrCodes::PortNameTooLong, ErrorModule::OS,
                                       ErrorSummary::InvalidArgument,
                                       ErrorLevel::Usage); // 0xE0E0181E
constexpr Result ResultWrongPermission(ErrCodes::WrongPermission, ErrorModule::OS,
                                       ErrorSummary::WrongArgument, ErrorLevel::Permanent);
constexpr Result ResultInvalidBufferDescriptor(ErrCodes::InvalidBufferDescriptor, ErrorModule::OS,
                                               ErrorSummary::WrongArgument, ErrorLevel::Permanent);
constexpr Result ResultMaxConnectionsReached(ErrCodes::MaxConnectionsReached, ErrorModule::OS,
                                             ErrorSummary::WouldBlock,
                                             ErrorLevel::Temporary); // 0xD0401834

constexpr Result ResultNotAuthorized(ErrorDescription::NotAuthorized, ErrorModule::OS,
                                     ErrorSummary::WrongArgument,
                                     ErrorLevel::Permanent); // 0xD9001BEA
constexpr Result ResultInvalidEnumValue(ErrorDescription::InvalidEnumValue, ErrorModule::Kernel,
                                        ErrorSummary::InvalidArgument,
                                        ErrorLevel::Permanent); // 0xD8E007ED
constexpr Result ResultInvalidEnumValueFnd(ErrorDescription::InvalidEnumValue, ErrorModule::FND,
                                           ErrorSummary::InvalidArgument,
                                           ErrorLevel::Permanent); // 0xD8E093ED
constexpr Result ResultInvalidCombination(ErrorDescription::InvalidCombination, ErrorModule::OS,
                                          ErrorSummary::InvalidArgument,
                                          ErrorLevel::Usage); // 0xE0E01BEE
constexpr Result ResultInvalidCombinationKernel(ErrorDescription::InvalidCombination,
                                                ErrorModule::Kernel, ErrorSummary::WrongArgument,
                                                ErrorLevel::Permanent); // 0xD90007EE
constexpr Result ResultMisalignedAddress(ErrorDescription::MisalignedAddress, ErrorModule::OS,
                                         ErrorSummary::InvalidArgument,
                                         ErrorLevel::Usage); // 0xE0E01BF1
constexpr Result ResultMisalignedSize(ErrorDescription::MisalignedSize, ErrorModule::OS,
                                      ErrorSummary::InvalidArgument,
                                      ErrorLevel::Usage); // 0xE0E01BF2
constexpr Result ResultOutOfMemory(ErrorDescription::OutOfMemory, ErrorModule::Kernel,
                                   ErrorSummary::OutOfResource,
                                   ErrorLevel::Permanent); // 0xD86007F3
/// Returned when out of heap or linear heap memory when allocating
constexpr Result ResultOutOfHeapMemory(ErrorDescription::OutOfMemory, ErrorModule::OS,
                                       ErrorSummary::OutOfResource,
                                       ErrorLevel::Status); // 0xC860180A
constexpr Result ResultNotImplemented(ErrorDescription::NotImplemented, ErrorModule::OS,
                                      ErrorSummary::InvalidArgument,
                                      ErrorLevel::Usage); // 0xE0E01BF4
constexpr Result ResultInvalidAddress(ErrorDescription::InvalidAddress, ErrorModule::OS,
                                      ErrorSummary::InvalidArgument,
                                      ErrorLevel::Usage); // 0xE0E01BF5
constexpr Result ResultInvalidAddressState(ErrorDescription::InvalidAddress, ErrorModule::OS,
                                           ErrorSummary::InvalidState,
                                           ErrorLevel::Usage); // 0xE0A01BF5
constexpr Result ResultInvalidPointer(ErrorDescription::InvalidPointer, ErrorModule::Kernel,
                                      ErrorSummary::InvalidArgument,
                                      ErrorLevel::Permanent); // 0xD8E007F6
constexpr Result ResultInvalidHandle(ErrorDescription::InvalidHandle, ErrorModule::Kernel,
                                     ErrorSummary::InvalidArgument,
                                     ErrorLevel::Permanent); // 0xD8E007F7
/// Alternate code returned instead of ResultInvalidHandle in some code paths.
constexpr Result ResultInvalidHandleOs(ErrorDescription::InvalidHandle, ErrorModule::OS,
                                       ErrorSummary::WrongArgument,
                                       ErrorLevel::Permanent); // 0xD9001BF7
constexpr Result ResultNotFound(ErrorDescription::NotFound, ErrorModule::Kernel,
                                ErrorSummary::NotFound, ErrorLevel::Permanent); // 0xD88007FA
constexpr Result ResultOutOfRange(ErrorDescription::OutOfRange, ErrorModule::OS,
                                  ErrorSummary::InvalidArgument,
                                  ErrorLevel::Usage); // 0xE0E01BFD
constexpr Result ResultOutOfRangeKernel(ErrorDescription::OutOfRange, ErrorModule::Kernel,
                                        ErrorSummary::InvalidArgument,
                                        ErrorLevel::Permanent); // 0xD8E007FD
constexpr Result ResultTimeout(ErrorDescription::Timeout, ErrorModule::OS,
                               ErrorSummary::StatusChanged, ErrorLevel::Info);
/// Returned when Accept() is called on a port with no sessions to be accepted.
constexpr Result ResultNoPendingSessions(ErrCodes::NoPendingSessions, ErrorModule::OS,
                                         ErrorSummary::WouldBlock,
                                         ErrorLevel::Permanent); // 0xD8401823

} // namespace Kernel