aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.HLE/HOS/Kernel/Memory/MemoryState.cs
blob: da6fac63935a627ae4c3c176c9f13213bf9fa3d3 (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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
using System;

namespace Ryujinx.HLE.HOS.Kernel.Memory
{
    [Flags]
    enum MemoryState : uint
    {
        Unmapped = 0x0,
        Io = Mapped | 0x1,
        Normal = Mapped | QueryPhysicalAddressAllowed | 0x2,
        CodeStatic = ForceReadWritableByDebugSyscalls |
            IpcSendAllowedType0 |
            IpcSendAllowedType3 |
            IpcSendAllowedType1 |
            Mapped |
            ProcessPermissionChangeAllowed |
            QueryPhysicalAddressAllowed |
            MapDeviceAllowed |
            MapDeviceAlignedAllowed |
            IsPoolAllocated |
            MapProcessAllowed |
            LinearMapped |
            0x3,
        CodeMutable = PermissionChangeAllowed |
            IpcSendAllowedType0 |
            IpcSendAllowedType3 |
            IpcSendAllowedType1 |
            Mapped |
            MapAllowed |
            TransferMemoryAllowed |
            QueryPhysicalAddressAllowed |
            MapDeviceAllowed |
            MapDeviceAlignedAllowed |
            IpcBufferAllowed |
            IsPoolAllocated |
            MapProcessAllowed |
            AttributeChangeAllowed |
            CodeMemoryAllowed |
            LinearMapped |
            PermissionLockAllowed |
            0x4,
        Heap = PermissionChangeAllowed |
            IpcSendAllowedType0 |
            IpcSendAllowedType3 |
            IpcSendAllowedType1 |
            Mapped |
            MapAllowed |
            TransferMemoryAllowed |
            QueryPhysicalAddressAllowed |
            MapDeviceAllowed |
            MapDeviceAlignedAllowed |
            IpcBufferAllowed |
            IsPoolAllocated |
            AttributeChangeAllowed |
            CodeMemoryAllowed |
            LinearMapped |
            0x5,
        SharedMemory = Mapped | IsPoolAllocated | LinearMapped | 0x6,
        ModCodeStatic = ForceReadWritableByDebugSyscalls |
            IpcSendAllowedType0 |
            IpcSendAllowedType3 |
            IpcSendAllowedType1 |
            Mapped |
            ProcessPermissionChangeAllowed |
            UnmapProcessCodeMemoryAllowed |
            QueryPhysicalAddressAllowed |
            MapDeviceAllowed |
            MapDeviceAlignedAllowed |
            IsPoolAllocated |
            MapProcessAllowed |
            LinearMapped |
            0x8,
        ModCodeMutable = PermissionChangeAllowed |
            IpcSendAllowedType0 |
            IpcSendAllowedType3 |
            IpcSendAllowedType1 |
            Mapped |
            MapAllowed |
            UnmapProcessCodeMemoryAllowed |
            TransferMemoryAllowed |
            QueryPhysicalAddressAllowed |
            MapDeviceAllowed |
            MapDeviceAlignedAllowed |
            IpcBufferAllowed |
            IsPoolAllocated |
            MapProcessAllowed |
            AttributeChangeAllowed |
            CodeMemoryAllowed |
            LinearMapped |
            PermissionLockAllowed |
            0x9,
        IpcBuffer0 = IpcSendAllowedType0 |
            IpcSendAllowedType3 |
            IpcSendAllowedType1 |
            Mapped |
            QueryPhysicalAddressAllowed |
            MapDeviceAllowed |
            MapDeviceAlignedAllowed |
            IsPoolAllocated |
            LinearMapped |
            0xA,
        Stack = IpcSendAllowedType0 |
            IpcSendAllowedType3 |
            IpcSendAllowedType1 |
            Mapped |
            QueryPhysicalAddressAllowed |
            MapDeviceAllowed |
            MapDeviceAlignedAllowed |
            IsPoolAllocated |
            LinearMapped |
            0xB,
        ThreadLocal = Mapped | IsPoolAllocated | LinearMapped | 0xC,
        TransferMemoryIsolated = IpcSendAllowedType0 |
            IpcSendAllowedType3 |
            IpcSendAllowedType1 |
            Mapped |
            QueryPhysicalAddressAllowed |
            MapDeviceAllowed |
            MapDeviceAlignedAllowed |
            IsPoolAllocated |
            AttributeChangeAllowed |
            LinearMapped |
            0xD,
        TransferMemory = IpcSendAllowedType3 |
            IpcSendAllowedType1 |
            Mapped |
            QueryPhysicalAddressAllowed |
            MapDeviceAllowed |
            MapDeviceAlignedAllowed |
            IsPoolAllocated |
            LinearMapped |
            0xE,
        ProcessMemory = IpcSendAllowedType3 | IpcSendAllowedType1 | Mapped | IsPoolAllocated | LinearMapped | 0xF,
        Reserved = 0x10,
        IpcBuffer1 = IpcSendAllowedType3 |
            IpcSendAllowedType1 |
            Mapped |
            QueryPhysicalAddressAllowed |
            MapDeviceAllowed |
            MapDeviceAlignedAllowed |
            IsPoolAllocated |
            LinearMapped |
            0x11,
        IpcBuffer3 = IpcSendAllowedType3 | Mapped | QueryPhysicalAddressAllowed | MapDeviceAllowed | IsPoolAllocated | LinearMapped | 0x12,
        KernelStack = Mapped | 0x13,
        CodeReadOnly = ForceReadWritableByDebugSyscalls | Mapped | IsPoolAllocated | LinearMapped | 0x14,
        CodeWritable = Mapped | IsPoolAllocated | LinearMapped | 0x15,
        UserMask = 0xFF,
        Mask = 0xFFFFFFFF,

        PermissionChangeAllowed = 1 << 8,
        ForceReadWritableByDebugSyscalls = 1 << 9,
        IpcSendAllowedType0 = 1 << 10,
        IpcSendAllowedType3 = 1 << 11,
        IpcSendAllowedType1 = 1 << 12,
        Mapped = 1 << 13,
        ProcessPermissionChangeAllowed = 1 << 14,
        MapAllowed = 1 << 15,
        UnmapProcessCodeMemoryAllowed = 1 << 16,
        TransferMemoryAllowed = 1 << 17,
        QueryPhysicalAddressAllowed = 1 << 18,
        MapDeviceAllowed = 1 << 19,
        MapDeviceAlignedAllowed = 1 << 20,
        IpcBufferAllowed = 1 << 21,
        IsPoolAllocated = 1 << 22,
        MapProcessAllowed = 1 << 23,
        AttributeChangeAllowed = 1 << 24,
        CodeMemoryAllowed = 1 << 25,
        LinearMapped = 1 << 26,
        PermissionLockAllowed = 1 << 27,
    }
}