Merge upstream Atmosphere master into boot-storage
This commit is contained in:
223 files changed
+2769
-1401
No files matched your search
@@ -16,11 +16,11 @@
|
||||
#pragma once
|
||||
|
||||
#define ATMOSPHERE_RELEASE_VERSION_MAJOR 1
|
||||
#define ATMOSPHERE_RELEASE_VERSION_MINOR 11
|
||||
#define ATMOSPHERE_RELEASE_VERSION_MICRO 2
|
||||
#define ATMOSPHERE_RELEASE_VERSION_MINOR 12
|
||||
#define ATMOSPHERE_RELEASE_VERSION_MICRO 0
|
||||
|
||||
#define ATMOSPHERE_RELEASE_VERSION ATMOSPHERE_RELEASE_VERSION_MAJOR, ATMOSPHERE_RELEASE_VERSION_MINOR, ATMOSPHERE_RELEASE_VERSION_MICRO
|
||||
|
||||
#define ATMOSPHERE_SUPPORTED_HOS_VERSION_MAJOR 22
|
||||
#define ATMOSPHERE_SUPPORTED_HOS_VERSION_MINOR 5
|
||||
#define ATMOSPHERE_SUPPORTED_HOS_VERSION_MAJOR 23
|
||||
#define ATMOSPHERE_SUPPORTED_HOS_VERSION_MINOR 0
|
||||
#define ATMOSPHERE_SUPPORTED_HOS_VERSION_MICRO 0
|
||||
@@ -101,8 +101,9 @@
|
||||
#define ATMOSPHERE_TARGET_FIRMWARE_22_0_0 ATMOSPHERE_TARGET_FIRMWARE(22, 0, 0)
|
||||
#define ATMOSPHERE_TARGET_FIRMWARE_22_1_0 ATMOSPHERE_TARGET_FIRMWARE(22, 1, 0)
|
||||
#define ATMOSPHERE_TARGET_FIRMWARE_22_5_0 ATMOSPHERE_TARGET_FIRMWARE(22, 5, 0)
|
||||
#define ATMOSPHERE_TARGET_FIRMWARE_23_0_0 ATMOSPHERE_TARGET_FIRMWARE(23, 0, 0)
|
||||
|
||||
#define ATMOSPHERE_TARGET_FIRMWARE_CURRENT ATMOSPHERE_TARGET_FIRMWARE_22_5_0
|
||||
#define ATMOSPHERE_TARGET_FIRMWARE_CURRENT ATMOSPHERE_TARGET_FIRMWARE_23_0_0
|
||||
|
||||
#define ATMOSPHERE_TARGET_FIRMWARE_MIN ATMOSPHERE_TARGET_FIRMWARE(0, 0, 0)
|
||||
#define ATMOSPHERE_TARGET_FIRMWARE_MAX ATMOSPHERE_TARGET_FIRMWARE_CURRENT
|
||||
@@ -196,6 +197,7 @@ namespace ams {
|
||||
TargetFirmware_22_0_0 = ATMOSPHERE_TARGET_FIRMWARE_22_0_0,
|
||||
TargetFirmware_22_1_0 = ATMOSPHERE_TARGET_FIRMWARE_22_1_0,
|
||||
TargetFirmware_22_5_0 = ATMOSPHERE_TARGET_FIRMWARE_22_5_0,
|
||||
TargetFirmware_23_0_0 = ATMOSPHERE_TARGET_FIRMWARE_23_0_0,
|
||||
|
||||
TargetFirmware_Current = ATMOSPHERE_TARGET_FIRMWARE_CURRENT,
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace ams::crypto::impl {
|
||||
#ifdef ATMOSPHERE_IS_EXOSPHERE
|
||||
int m_slot;
|
||||
#endif
|
||||
#ifdef ATMOSPHERE_IS_STRATOSPHERE
|
||||
#if defined(ATMOSPHERE_IS_STRATOSPHERE) || defined(ATMOSPHERE_IS_MESOSPHERE)
|
||||
u32 m_round_keys[RoundKeySize / sizeof(u32)];
|
||||
#endif
|
||||
public:
|
||||
@@ -43,7 +43,7 @@ namespace ams::crypto::impl {
|
||||
void EncryptBlock(void *dst, size_t dst_size, const void *src, size_t src_size) const;
|
||||
void DecryptBlock(void *dst, size_t dst_size, const void *src, size_t src_size) const;
|
||||
|
||||
#ifdef ATMOSPHERE_IS_STRATOSPHERE
|
||||
#if defined(ATMOSPHERE_IS_STRATOSPHERE) || defined(ATMOSPHERE_IS_MESOSPHERE)
|
||||
const u8 *GetRoundKey() const {
|
||||
return reinterpret_cast<const u8 *>(m_round_keys);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,277 @@
|
||||
/*
|
||||
* Copyright (c) Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::crypto::impl {
|
||||
|
||||
constexpr inline int BitsPerByte = BITSIZEOF(u8);
|
||||
|
||||
/* Nintendo implements CTR_DRBG for their csrng. We will do the same. */
|
||||
template<typename BlockCipher, size_t KeySize, bool UseDerivation>
|
||||
class CtrDrbg {
|
||||
public:
|
||||
static constexpr int KeyLen = KeySize * BitsPerByte;
|
||||
static constexpr int OutLen = BlockCipher::BlockSize * BitsPerByte;
|
||||
static constexpr int SeedLen = KeyLen + OutLen;
|
||||
static constexpr int MaxNumberOfBitsPerRequest = (1 << 19);
|
||||
static constexpr int ReseedInterval = 0x7FFFFFF0;
|
||||
|
||||
static constexpr size_t OutSize = OutLen / BitsPerByte;
|
||||
static constexpr size_t SeedSize = SeedLen / BitsPerByte;
|
||||
static constexpr size_t RequestSizeMax = MaxNumberOfBitsPerRequest / BitsPerByte;
|
||||
|
||||
static_assert(SeedSize % OutSize == 0);
|
||||
private:
|
||||
class Bcc {
|
||||
private:
|
||||
u8 *m_buffer;
|
||||
const BlockCipher *m_cipher;
|
||||
size_t m_offset;
|
||||
public:
|
||||
Bcc(u8 *buffer, const BlockCipher *cipher) : m_buffer(buffer), m_cipher(cipher), m_offset(0) { /* ... */ }
|
||||
|
||||
void Process(const void *data, size_t size) {
|
||||
const u8 *data_8 = static_cast<const u8 *>(data);
|
||||
size_t remaining = size;
|
||||
|
||||
while (m_offset + remaining >= OutSize) {
|
||||
const size_t xor_size = OutSize - m_offset;
|
||||
|
||||
Xor(m_buffer + m_offset, data_8, xor_size);
|
||||
m_cipher->EncryptBlock(m_buffer, OutSize, m_buffer, OutSize);
|
||||
|
||||
data_8 += xor_size;
|
||||
remaining -= xor_size;
|
||||
|
||||
m_offset = 0;
|
||||
}
|
||||
|
||||
Xor(m_buffer + m_offset, data_8, remaining);
|
||||
m_offset += remaining;
|
||||
}
|
||||
|
||||
void Flush() {
|
||||
if (m_offset != 0) {
|
||||
m_cipher->EncryptBlock(m_buffer, OutSize, m_buffer, OutSize);
|
||||
m_offset = 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
private:
|
||||
BlockCipher m_block_cipher;
|
||||
u8 m_v[OutSize];
|
||||
u8 m_key[KeySize];
|
||||
u8 m_work1[SeedSize];
|
||||
u8 m_work2[SeedSize];
|
||||
int m_reseed_counter;
|
||||
private:
|
||||
static void Xor(void *dst, const void *src, size_t size) {
|
||||
const u8 *src_u8 = static_cast<const u8 *>(src);
|
||||
u8 *dst_u8 = static_cast<u8 *>(dst);
|
||||
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
dst_u8[i] ^= src_u8[i];
|
||||
}
|
||||
}
|
||||
|
||||
static void Increment(void *v) {
|
||||
u8 *v_8 = static_cast<u8 *>(v);
|
||||
|
||||
for (int i = OutSize - 1; i >= 0; --i) {
|
||||
if ((++v_8[i]) != 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
private:
|
||||
void DeriveSeed(void *seed, const void *a, size_t a_size, const void *b, size_t b_size, const void *c, size_t c_size) {
|
||||
/* Determine sizes. */
|
||||
const u32 in_size = a_size + b_size + c_size;
|
||||
const u32 out_size = SeedSize;
|
||||
|
||||
/* Create header/footer. */
|
||||
u32 header[2];
|
||||
util::StoreBigEndian(header + 0, in_size);
|
||||
util::StoreBigEndian(header + 1, out_size);
|
||||
const u8 footer = 0x80;
|
||||
|
||||
/* Create seed as 000102... */
|
||||
u8 *seed_8 = static_cast<u8 *>(seed);
|
||||
for (size_t i = 0; i < KeySize; ++i) {
|
||||
seed_8[i] = i;
|
||||
}
|
||||
|
||||
/* Initialize block cipher. */
|
||||
m_block_cipher.Initialize(seed_8, KeySize);
|
||||
|
||||
/* Perform derivation. */
|
||||
for (u32 block = 0; block < SeedSize / OutSize; ++block) {
|
||||
/* Create the block index value. */
|
||||
u32 block_value;
|
||||
util::StoreBigEndian(std::addressof(block_value), block);
|
||||
|
||||
/* Get the target block. */
|
||||
u8 *target = seed_8 + block * OutSize;
|
||||
std::memset(target, 0, OutSize);
|
||||
|
||||
/* Create block processor. */
|
||||
Bcc bcc(target, std::addressof(m_block_cipher));
|
||||
|
||||
/* Process block value. */
|
||||
bcc.Process(std::addressof(block_value), sizeof(block_value));
|
||||
bcc.Flush();
|
||||
|
||||
/* Process header/data. */
|
||||
bcc.Process(header, sizeof(header));
|
||||
bcc.Process(a, a_size);
|
||||
bcc.Process(b, b_size);
|
||||
bcc.Process(c, c_size);
|
||||
bcc.Process(footer, std::addressof(footer));
|
||||
bcc.Flush();
|
||||
}
|
||||
|
||||
/* Initialize block cipher. */
|
||||
m_block_cipher.Initialize(seed_8, KeySize);
|
||||
|
||||
/* Encrypt seed. */
|
||||
m_block_cipher.EncryptBlock(seed_8, OutSize, seed_8 + KeySize, OutSize);
|
||||
for (size_t offset = 0; offset < SeedSize - OutSize; offset += OutSize) {
|
||||
m_block_cipher.EncryptBlock(seed_8 + offset + OutSize, OutSize, seed_8 + offset, OutSize);
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateStates(void *key, void *v, const void *provided_data) {
|
||||
/* Initialize block cipher. */
|
||||
m_block_cipher.Initialize(key, KeySize);
|
||||
|
||||
/* Update work. */
|
||||
for (size_t offset = 0; offset < SeedSize; offset += OutSize) {
|
||||
Increment(v);
|
||||
m_block_cipher.EncryptBlock(std::addressof(m_work2[offset]), OutSize, v, OutSize);
|
||||
}
|
||||
|
||||
/* Xor work with provided data. */
|
||||
Xor(m_work2, provided_data, SeedSize);
|
||||
|
||||
/* Copy to key/v. */
|
||||
std::memcpy(key, m_work2 + 0, KeySize);
|
||||
std::memcpy(v, m_work2 + KeySize, OutSize);
|
||||
}
|
||||
public:
|
||||
constexpr CtrDrbg() = default;
|
||||
|
||||
void Initialize(const void *entropy, size_t entropy_size, const void *nonce, size_t nonce_size, const void *personalization, size_t personalization_size) {
|
||||
/* Handle init. */
|
||||
if constexpr (UseDerivation) {
|
||||
this->DeriveSeed(m_work1, entropy, entropy_size, nonce, nonce_size, personalization, personalization_size);
|
||||
} else {
|
||||
AMS_ASSERT(entropy_size == SeedSize);
|
||||
AMS_ASSERT(nonce_size == 0);
|
||||
AMS_ASSERT(personalization_size <= SeedSize);
|
||||
AMS_UNUSED(entropy_size, nonce, nonce_size);
|
||||
|
||||
std::memcpy(m_work1, entropy, SeedSize);
|
||||
Xor(m_work1, personalization, personalization_size);
|
||||
}
|
||||
|
||||
/* Clear key/v. */
|
||||
std::memset(m_key, 0, sizeof(m_key));
|
||||
std::memset(m_v, 0, sizeof(m_v));
|
||||
|
||||
/* Set key/v. */
|
||||
this->UpdateStates(m_key, m_v, m_work1);
|
||||
|
||||
/* Set reseed counter. */
|
||||
m_reseed_counter = 1;
|
||||
}
|
||||
|
||||
void Reseed(const void *entropy, size_t entropy_size, const void *addl, size_t addl_size) {
|
||||
/* Handle init. */
|
||||
if constexpr (UseDerivation) {
|
||||
this->DeriveSeed(m_work1, entropy, entropy_size, addl, addl_size, nullptr, 0);
|
||||
} else {
|
||||
AMS_ASSERT(entropy_size == SeedSize);
|
||||
AMS_ASSERT(addl_size <= SeedSize);
|
||||
AMS_UNUSED(entropy_size);
|
||||
|
||||
std::memcpy(m_work1, entropy, SeedSize);
|
||||
Xor(m_work1, addl, addl_size);
|
||||
}
|
||||
|
||||
/* Set key/v. */
|
||||
this->UpdateStates(m_key, m_v, m_work1);
|
||||
|
||||
/* Set reseed counter. */
|
||||
m_reseed_counter = 1;
|
||||
}
|
||||
|
||||
bool Generate(void *out, size_t size, const void *addl, size_t addl_size) {
|
||||
/* Check that the request is small enough. */
|
||||
if (size > RequestSizeMax) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Check if we need reseed. */
|
||||
if (m_reseed_counter > ReseedInterval) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Clear work buffer. */
|
||||
std::memset(m_work1, 0, sizeof(m_work1));
|
||||
|
||||
/* Process additional input, if we have any. */
|
||||
if (addl_size > 0) {
|
||||
if constexpr (UseDerivation) {
|
||||
this->DeriveSeed(m_work1, addl, addl_size, nullptr, 0, nullptr, 0);
|
||||
} else {
|
||||
AMS_ASSERT(addl_size <= SeedSize);
|
||||
std::memcpy(m_work1, addl, addl_size);
|
||||
}
|
||||
|
||||
/* Set key/v. */
|
||||
this->UpdateStates(m_key, m_v, m_work1);
|
||||
}
|
||||
|
||||
/* Get buffer and aligned size. */
|
||||
u8 *out_8 = static_cast<u8 *>(out);
|
||||
const size_t aligned_size = util::AlignDown(size, OutSize);
|
||||
|
||||
/* Generate ctr bytes. */
|
||||
m_block_cipher.Initialize(m_key, KeySize);
|
||||
for (size_t offset = 0; offset < aligned_size; offset += OutSize) {
|
||||
Increment(m_v);
|
||||
m_block_cipher.EncryptBlock(out_8 + offset, OutSize, m_v, OutSize);
|
||||
}
|
||||
|
||||
/* Handle any unaligned data. */
|
||||
if (size > aligned_size) {
|
||||
u8 temp[OutSize];
|
||||
Increment(m_v);
|
||||
m_block_cipher.EncryptBlock(temp, sizeof(temp), m_v, OutSize);
|
||||
std::memcpy(out_8 + aligned_size, temp, size - aligned_size);
|
||||
}
|
||||
|
||||
/* Set key/v. */
|
||||
this->UpdateStates(m_key, m_v, m_work1);
|
||||
|
||||
/* Increment reseed counter. */
|
||||
++m_reseed_counter;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
@@ -25,18 +25,20 @@ namespace ams::ro {
|
||||
R_DEFINE_ERROR_RESULT(OutOfAddressSpace, 2);
|
||||
R_DEFINE_ERROR_RESULT(AlreadyLoaded, 3);
|
||||
R_DEFINE_ERROR_RESULT(InvalidNro, 4);
|
||||
|
||||
R_DEFINE_ERROR_RESULT(NotFound, 5);
|
||||
R_DEFINE_ERROR_RESULT(InvalidNrr, 6);
|
||||
R_DEFINE_ERROR_RESULT(TooManyNro, 7);
|
||||
R_DEFINE_ERROR_RESULT(TooManyNrr, 8);
|
||||
R_DEFINE_ERROR_RESULT(NotAuthorized, 9);
|
||||
R_DEFINE_ERROR_RESULT(InvalidNrrKind, 10);
|
||||
|
||||
R_DEFINE_ERROR_RESULT(InvalidBssSize, 11);
|
||||
|
||||
R_DEFINE_ERROR_RESULT(NotImplemented, 1022);
|
||||
R_DEFINE_ERROR_RESULT(InternalError, 1023);
|
||||
|
||||
R_DEFINE_ERROR_RESULT(InvalidAddress, 1025);
|
||||
R_DEFINE_ERROR_RESULT(InvalidSize, 1026);
|
||||
|
||||
R_DEFINE_ERROR_RESULT(InvalidCurrentMemory, 1027);
|
||||
R_DEFINE_ERROR_RESULT(NotLoaded, 1028);
|
||||
R_DEFINE_ERROR_RESULT(NotRegistered, 1029);
|
||||
R_DEFINE_ERROR_RESULT(InvalidSession, 1030);
|
||||
|
||||
@@ -21,20 +21,23 @@ R_DEFINE_NAMESPACE_RESULT_MODULE(ams::sprofile, 246);
|
||||
|
||||
namespace ams::sprofile {
|
||||
|
||||
R_DEFINE_ERROR_RESULT(InvalidArgument, 100);
|
||||
R_DEFINE_ERROR_RESULT(InvalidState, 101);
|
||||
R_DEFINE_ERROR_RESULT(InvalidArgument, 100);
|
||||
R_DEFINE_ERROR_RESULT(InvalidState, 101);
|
||||
|
||||
R_DEFINE_ERROR_RESULT(NotImplemented, 300);
|
||||
R_DEFINE_ERROR_RESULT(NotSupported, 301);
|
||||
R_DEFINE_ERROR_RESULT(Delayed, 302);
|
||||
R_DEFINE_ERROR_RESULT(NotPermitted, 303);
|
||||
|
||||
R_DEFINE_ERROR_RESULT(NotPermitted, 303);
|
||||
R_DEFINE_ERROR_RESULT(AllocationFailed, 401);
|
||||
|
||||
R_DEFINE_ERROR_RESULT(AllocationFailed, 401);
|
||||
R_DEFINE_ERROR_RESULT(KeyNotFound, 600);
|
||||
R_DEFINE_ERROR_RESULT(InvalidDataType, 601);
|
||||
|
||||
R_DEFINE_ERROR_RESULT(KeyNotFound, 600);
|
||||
R_DEFINE_ERROR_RESULT(InvalidDataType, 601);
|
||||
|
||||
R_DEFINE_ERROR_RESULT(MaxListeners, 620);
|
||||
R_DEFINE_ERROR_RESULT(AlreadyListening, 621);
|
||||
R_DEFINE_ERROR_RESULT(NotListening, 622);
|
||||
R_DEFINE_ERROR_RESULT(MaxObservers, 623);
|
||||
R_DEFINE_ERROR_RESULT(MaxListeners, 620);
|
||||
R_DEFINE_ERROR_RESULT(AlreadyListening, 621);
|
||||
R_DEFINE_ERROR_RESULT(NotListening, 622);
|
||||
R_DEFINE_ERROR_RESULT(MaxObservers, 623);
|
||||
|
||||
R_DEFINE_ERROR_RESULT(InvalidMetadataVersion, 3210);
|
||||
R_DEFINE_ERROR_RESULT(InvalidMetadataHash, 3211);
|
||||
|
||||
@@ -37,6 +37,13 @@ namespace ams::svc {
|
||||
|
||||
constexpr inline size_t AddressMemoryRegion39Size = 512_GB;
|
||||
|
||||
constexpr inline size_t AddressMemoryRegionSmall42Size = 64_GB;
|
||||
constexpr inline size_t AddressMemoryRegionAlias42Size = 512_GB;
|
||||
constexpr inline size_t AddressMemoryRegionStack42Size = 2_GB;
|
||||
|
||||
constexpr inline size_t AddressMemoryRegion42Size = 4096_GB;
|
||||
|
||||
constexpr inline size_t AddressShadowStackRegionSize = 4_GB;
|
||||
#elif defined(ATMOSPHERE_ARCH_ARM)
|
||||
|
||||
constexpr inline size_t AddressMemoryRegionSmall32Size = 512_MB;
|
||||
@@ -56,6 +63,12 @@ namespace ams::svc {
|
||||
|
||||
constexpr inline size_t AddressMemoryRegion39Size = 0;
|
||||
|
||||
constexpr inline size_t AddressMemoryRegionSmall42Size = 0;
|
||||
constexpr inline size_t AddressMemoryRegionAlias42Size = 0;
|
||||
constexpr inline size_t AddressMemoryRegionStack42Size = 0;
|
||||
|
||||
constexpr inline size_t AddressMemoryRegion42Size = 0;
|
||||
|
||||
#else
|
||||
|
||||
#error "Unknown architecture for svc::AddressMemoryRegion*Size"
|
||||
@@ -97,4 +110,7 @@ namespace ams::svc {
|
||||
constexpr inline uintptr_t AddressMap39End = AddressMemoryRegion39Size;
|
||||
constexpr inline size_t AddressMap39Size = AddressMap39End - AddressMap39Start;
|
||||
|
||||
constexpr inline uintptr_t AddressMap42Start = 0 + AddressNullGuard64Size;
|
||||
constexpr inline uintptr_t AddressMap42End = AddressMemoryRegion42Size;
|
||||
constexpr inline size_t AddressMap42Size = AddressMap42End - AddressMap42Start;
|
||||
}
|
||||
@@ -96,6 +96,8 @@ namespace ams::svc {
|
||||
MemoryState_CodeOut = 0x15,
|
||||
MemoryState_Coverage = 0x16,
|
||||
MemoryState_Insecure = 0x17,
|
||||
/* ... */
|
||||
MemoryState_ShadowStack = 0x1A,
|
||||
};
|
||||
|
||||
enum MemoryPermission : u32 {
|
||||
@@ -191,8 +193,16 @@ namespace ams::svc {
|
||||
InfoType_IsSvcPermitted = 26,
|
||||
InfoType_IoRegionHint = 27,
|
||||
InfoType_AliasRegionExtraSize = 28,
|
||||
/* ... */
|
||||
InfoType_RemoteRegionAddress = 29,
|
||||
InfoType_RemoteRegionSize = 30,
|
||||
InfoType_RemoteMemorySize = 31,
|
||||
InfoType_RemoteMemoryUsageMax = 32,
|
||||
InfoType_AllocateAlignment = 33,
|
||||
InfoType_TransferMemoryHint = 34,
|
||||
/* ... */
|
||||
InfoType_AddressSpaceSize = 36,
|
||||
InfoType_ShadowStackRegionAddress = 37,
|
||||
InfoType_ShadowStackRegionSize = 38,
|
||||
|
||||
InfoType_MesosphereMeta = 65000,
|
||||
InfoType_MesosphereCurrentProcess = 65001,
|
||||
@@ -378,6 +388,7 @@ namespace ams::svc {
|
||||
/* Process types. */
|
||||
enum ProcessInfoType : u32 {
|
||||
ProcessInfoType_ProcessState = 0,
|
||||
ProcessInfoType_Unknown1 = 1,
|
||||
};
|
||||
|
||||
enum ProcessState : u32 {
|
||||
@@ -402,57 +413,62 @@ namespace ams::svc {
|
||||
ProcessActivity_Paused = 1,
|
||||
};
|
||||
|
||||
enum CreateProcessFlag : u32 {
|
||||
enum CreateProcessParameterFlag : u32 {
|
||||
/* Is 64 bit? */
|
||||
CreateProcessFlag_Is64Bit = (1 << 0),
|
||||
CreateProcessParameterFlag_64Bit = (1 << 0),
|
||||
|
||||
/* What kind of address space? */
|
||||
CreateProcessFlag_AddressSpaceShift = 1,
|
||||
CreateProcessFlag_AddressSpaceMask = (7 << CreateProcessFlag_AddressSpaceShift),
|
||||
CreateProcessFlag_AddressSpace32Bit = (0 << CreateProcessFlag_AddressSpaceShift),
|
||||
CreateProcessFlag_AddressSpace64BitDeprecated = (1 << CreateProcessFlag_AddressSpaceShift),
|
||||
CreateProcessFlag_AddressSpace32BitWithoutAlias = (2 << CreateProcessFlag_AddressSpaceShift),
|
||||
CreateProcessFlag_AddressSpace64Bit = (3 << CreateProcessFlag_AddressSpaceShift),
|
||||
CreateProcessParameterFlag_AddressSpaceShift = 1,
|
||||
CreateProcessParameterFlag_AddressSpaceMask = (7 << CreateProcessParameterFlag_AddressSpaceShift), /* Should be 15 but Nintendo didn't make 64K usable yet */
|
||||
CreateProcessParameterFlag_AddressSpace32Bit = (0 << CreateProcessParameterFlag_AddressSpaceShift),
|
||||
CreateProcessParameterFlag_AddressSpace64Bit36 = (1 << CreateProcessParameterFlag_AddressSpaceShift),
|
||||
CreateProcessParameterFlag_AddressSpace32BitNoReserved = (2 << CreateProcessParameterFlag_AddressSpaceShift),
|
||||
CreateProcessParameterFlag_AddressSpace64Bit39 = (3 << CreateProcessParameterFlag_AddressSpaceShift),
|
||||
CreateProcessParameterFlag_AddressSpace64Bit42 = (4 << CreateProcessParameterFlag_AddressSpaceShift),
|
||||
|
||||
/* Should JIT debug be done on crash? */
|
||||
CreateProcessFlag_EnableDebug = (1 << 4),
|
||||
CreateProcessParameterFlag_EnableJitDebug = (1 << 4),
|
||||
|
||||
/* Should ASLR be enabled for the process? */
|
||||
CreateProcessFlag_EnableAslr = (1 << 5),
|
||||
CreateProcessParameterFlag_EnableAslr = (1 << 5),
|
||||
|
||||
/* Is the process an application? */
|
||||
CreateProcessFlag_IsApplication = (1 << 6),
|
||||
CreateProcessParameterFlag_IsApplication = (1 << 6),
|
||||
|
||||
/* 4.x deprecated: Should use secure memory? */
|
||||
CreateProcessFlag_DeprecatedUseSecureMemory = (1 << 7),
|
||||
CreateProcessParameterFlag_DeprecatedUseSecureMemory = (1 << 7),
|
||||
|
||||
/* 5.x+ Pool partition type. */
|
||||
CreateProcessFlag_PoolPartitionShift = 7,
|
||||
CreateProcessFlag_PoolPartitionMask = (0xF << CreateProcessFlag_PoolPartitionShift),
|
||||
CreateProcessFlag_PoolPartitionApplication = (0 << CreateProcessFlag_PoolPartitionShift),
|
||||
CreateProcessFlag_PoolPartitionApplet = (1 << CreateProcessFlag_PoolPartitionShift),
|
||||
CreateProcessFlag_PoolPartitionSystem = (2 << CreateProcessFlag_PoolPartitionShift),
|
||||
CreateProcessFlag_PoolPartitionSystemNonSecure = (3 << CreateProcessFlag_PoolPartitionShift),
|
||||
CreateProcessParameterFlag_PoolPartitionShift = 7,
|
||||
CreateProcessParameterFlag_PoolPartitionMask = (0xF << CreateProcessParameterFlag_PoolPartitionShift),
|
||||
CreateProcessParameterFlag_PoolPartitionApplication = (0 << CreateProcessParameterFlag_PoolPartitionShift),
|
||||
CreateProcessParameterFlag_PoolPartitionApplet = (1 << CreateProcessParameterFlag_PoolPartitionShift),
|
||||
CreateProcessParameterFlag_PoolPartitionSystem = (2 << CreateProcessParameterFlag_PoolPartitionShift),
|
||||
CreateProcessParameterFlag_PoolPartitionSystemNonSecure = (3 << CreateProcessParameterFlag_PoolPartitionShift),
|
||||
|
||||
/* 7.x+ Should memory allocation be optimized? This requires IsApplication. */
|
||||
CreateProcessFlag_OptimizeMemoryAllocation = (1 << 11),
|
||||
CreateProcessParameterFlag_OptimizeMemoryAllocation = (1 << 11),
|
||||
|
||||
/* 11.x+ DisableDeviceAddressSpaceMerge. */
|
||||
CreateProcessFlag_DisableDeviceAddressSpaceMerge = (1 << 12),
|
||||
CreateProcessParameterFlag_DisableDeviceAddressSpaceMerge = (1 << 12),
|
||||
|
||||
/* 18.x EnableAliasRegionExtraSize. */
|
||||
CreateProcessFlag_EnableAliasRegionExtraSize = (1 << 13),
|
||||
/* 18.x EnableAddressSanitizer. */
|
||||
CreateProcessParameterFlag_EnableAddressSanitizer = (1 << 13),
|
||||
|
||||
/* 23.x EnableShadowStack. */
|
||||
CreateProcessParameterFlag_EnableShadowStack = (1 << 17),
|
||||
|
||||
/* Mask of all flags. */
|
||||
CreateProcessFlag_All = CreateProcessFlag_Is64Bit |
|
||||
CreateProcessFlag_AddressSpaceMask |
|
||||
CreateProcessFlag_EnableDebug |
|
||||
CreateProcessFlag_EnableAslr |
|
||||
CreateProcessFlag_IsApplication |
|
||||
CreateProcessFlag_PoolPartitionMask |
|
||||
CreateProcessFlag_OptimizeMemoryAllocation |
|
||||
CreateProcessFlag_DisableDeviceAddressSpaceMerge |
|
||||
CreateProcessFlag_EnableAliasRegionExtraSize,
|
||||
CreateProcessParameterFlag_All = CreateProcessParameterFlag_64Bit |
|
||||
CreateProcessParameterFlag_AddressSpaceMask |
|
||||
CreateProcessParameterFlag_EnableJitDebug |
|
||||
CreateProcessParameterFlag_EnableAslr |
|
||||
CreateProcessParameterFlag_IsApplication |
|
||||
CreateProcessParameterFlag_PoolPartitionMask |
|
||||
CreateProcessParameterFlag_OptimizeMemoryAllocation |
|
||||
CreateProcessParameterFlag_DisableDeviceAddressSpaceMerge |
|
||||
CreateProcessParameterFlag_EnableAddressSanitizer |
|
||||
CreateProcessParameterFlag_EnableShadowStack,
|
||||
};
|
||||
|
||||
/* Debug types. */
|
||||
@@ -470,6 +486,7 @@ namespace ams::svc {
|
||||
DebugThreadParam_IdealCore = 2,
|
||||
DebugThreadParam_CurrentCore = 3,
|
||||
DebugThreadParam_AffinityMask = 4,
|
||||
DebugThreadParam_Unknown5 = 5,
|
||||
};
|
||||
|
||||
enum DebugException : u32 {
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace ams::svc {
|
||||
|
||||
/* This is the highest SVC version supported by Atmosphere, to be updated on new kernel releases. */
|
||||
/* NOTE: Official kernel versions have SVC major = SDK major + 4, SVC minor = SDK minor. */
|
||||
constexpr inline u32 SupportedKernelMajorVersion = ConvertToSvcMajorVersion(22);
|
||||
constexpr inline u32 SupportedKernelMajorVersion = ConvertToSvcMajorVersion(23);
|
||||
constexpr inline u32 SupportedKernelMinorVersion = ConvertToSvcMinorVersion( 2);
|
||||
|
||||
constexpr inline u32 SupportedKernelVersion = EncodeKernelVersion(SupportedKernelMajorVersion, SupportedKernelMinorVersion);
|
||||
|
||||
Reference in new issue
Block a user