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

@ -18,7 +18,7 @@
namespace ams::erpt::srv {
constinit JournalMeta JournalForMeta::s_journal_meta;
constinit JournalMeta JournalForMeta::s_journal_meta = {};
void JournalForMeta::InitializeJournal() {
std::memset(std::addressof(s_journal_meta), 0, sizeof(s_journal_meta));

View file

@ -25,7 +25,7 @@
namespace ams::erpt::srv {
constinit lmem::HeapHandle g_heap_handle;
constinit ams::sf::ExpHeapAllocator g_sf_allocator;
constinit ams::sf::ExpHeapAllocator g_sf_allocator = {};
namespace {

View file

@ -33,9 +33,6 @@ namespace ams::erpt::srv {
namespace {
constinit os::SdkMutex g_limit_mutex;
constinit bool g_submitted_limit = false;
class AppletActiveTimeInfoList {
private:
struct AppletActiveTimeInfo {
@ -91,6 +88,7 @@ namespace ams::erpt::srv {
constinit AppletActiveTimeInfoList g_applet_active_time_info_list;
#if defined(ATMOSPHERE_OS_HORIZON)
Result PullErrorContext(size_t *out_total_size, size_t *out_size, void *dst, size_t dst_size, const err::ContextDescriptor &descriptor, Result result) {
s32 unk0;
u32 total_size, size;
@ -135,6 +133,9 @@ namespace ams::erpt::srv {
record->Add(FieldId_ErrorContext, error_context, error_context_size);
}
constinit os::SdkMutex g_limit_mutex;
constinit bool g_submitted_limit = false;
void SubmitResourceLimitLimitContext() {
std::scoped_lock lk(g_limit_mutex);
if (g_submitted_limit) {
@ -222,6 +223,11 @@ namespace ams::erpt::srv {
SubmitResourceLimitLimitContext();
SubmitResourceLimitPeakContext();
}
#else
void SubmitErrorContext(ContextRecord *record, Result result) {
AMS_UNUSED(record, result);
}
#endif
Result ValidateCreateReportContext(const ContextEntry *ctx) {
R_UNLESS(ctx->category == CategoryId_ErrorInfo, erpt::ResultRequiredContextMissing());
@ -520,7 +526,9 @@ namespace ams::erpt::srv {
R_TRY(Context::SubmitContextRecord(std::move(record)));
/* Submit context for resource limits. */
#if defined(ATMOSPHERE_OS_HORIZON)
SubmitResourceLimitContexts();
#endif
return ResultSuccess();
}

View file

@ -138,7 +138,7 @@ namespace ams::erpt::srv {
}
}
constinit util::TypedStorage<ErrorReportServiceManager> g_erpt_server_manager;
constinit util::TypedStorage<ErrorReportServiceManager> g_erpt_server_manager = {};
}