ams: support building unit test programs on windows/linux/macos

This commit is contained in:
Michael Scire
2022-03-06 12:08:20 -08:00
committed by SciresM
parent 9a38be201a
commit 64a97576d0
756 changed files with 33359 additions and 9372 deletions

View File

@@ -59,7 +59,7 @@ namespace ams::htc::server::rpc {
HtcmiscPacketCategory category;
HtcmiscPacketType type;
s64 body_size;
u32 task_id;
u32 task_id{};
u64 params[5];
char data[];
};

View File

@@ -287,7 +287,7 @@ namespace ams::htc::server::rpc {
while (true) {
/* Get a task. */
Task *task;
u32 task_id;
u32 task_id{};
PacketCategory category;
do {
/* Dequeue a task. */

View File

@@ -112,7 +112,7 @@ namespace ams::htc::server::rpc {
std::scoped_lock lk(m_mutex);
/* Allocate a free task id. */
u32 task_id;
u32 task_id{};
R_TRY(m_task_id_free_list.Allocate(std::addressof(task_id)));
/* Create the new task. */

View File

@@ -34,11 +34,17 @@ namespace ams::htc::server::rpc {
/* htcs::ReceiveSmallTask/htcs::ReceiveSendTask are the largest tasks, containing an inline 0xE000 buffer. */
/* We allow for ~0x100 task overhead from the additional events those contain. */
/* NOTE: Nintendo hardcodes a maximum size of 0xE1D8, despite SendSmallTask being 0xE098 as of latest check. */
#if defined(ATMOSPHERE_OS_HORIZON)
static constexpr size_t MaxTaskSize = 0xE100;
#elif defined(ATMOSPHERE_OS_MACOS)
static constexpr size_t MaxTaskSize = 0xE400;
#else
static constexpr size_t MaxTaskSize = 0xE1D8;
#endif
using TaskStorage = typename std::aligned_storage<MaxTaskSize, alignof(void *)>::type;
private:
bool m_valid[MaxRpcCount];
TaskStorage m_storages[MaxRpcCount];
bool m_valid[MaxRpcCount]{};
TaskStorage m_storages[MaxRpcCount]{};
private:
template<typename T>
ALWAYS_INLINE T *GetPointer(u32 index) {

View File

@@ -32,7 +32,7 @@ namespace ams::htc::server::rpc {
PacketCategory category;
u16 type;
s64 body_size;
u32 task_id;
u32 task_id{};
u64 params[5];
char data[];
};