meso: skeleton libmesosphere in prep for kernelldr dev

This commit is contained in:
Michael Scire 2019-12-12 06:29:37 -08:00 committed by SciresM
parent 0b0fdc5c58
commit 36c47a0014
22 changed files with 732 additions and 13 deletions

View file

@ -36,7 +36,7 @@ namespace ams {
extern ncm::ProgramId CurrentProgramId;
void WEAK ExceptionHandler(FatalErrorContext *ctx) {
void WEAK_SYMBOL ExceptionHandler(FatalErrorContext *ctx) {
R_ASSERT(amsBpcInitialize());
R_ASSERT(amsBpcRebootToFatalError(ctx));
while (1) { /* ... */ }

View file

@ -19,13 +19,13 @@ namespace ams::pm::bm {
/* Boot Mode API. */
/* Both functions should be weakly linked, so that they can be overridden by ams::boot2 as needed. */
BootMode WEAK GetBootMode() {
BootMode WEAK_SYMBOL GetBootMode() {
PmBootMode boot_mode = PmBootMode_Normal;
R_ASSERT(pmbmGetBootMode(&boot_mode));
return static_cast<BootMode>(boot_mode);
}
void WEAK SetMaintenanceBoot() {
void WEAK_SYMBOL SetMaintenanceBoot() {
R_ASSERT(pmbmSetMaintenanceBoot());
}

View file

@ -49,7 +49,7 @@ namespace ams::pm::info {
return pminfoAtmosphereGetProcessInfo(reinterpret_cast<NcmProgramLocation *>(out_loc), reinterpret_cast<CfgOverrideStatus *>(out_status), static_cast<u64>(process_id));
}
Result WEAK HasLaunchedProgram(bool *out, ncm::ProgramId program_id) {
Result WEAK_SYMBOL HasLaunchedProgram(bool *out, ncm::ProgramId program_id) {
std::scoped_lock lk(g_info_lock);
if (g_cached_launched_programs.find(static_cast<u64>(program_id)) != g_cached_launched_programs.end()) {

View file

@ -18,7 +18,7 @@
namespace ams::pm::shell {
/* Shell API. */
Result WEAK LaunchProgram(os::ProcessId *out_process_id, const ncm::ProgramLocation &loc, u32 launch_flags) {
Result WEAK_SYMBOL LaunchProgram(os::ProcessId *out_process_id, const ncm::ProgramLocation &loc, u32 launch_flags) {
static_assert(sizeof(ncm::ProgramLocation) == sizeof(NcmProgramLocation));
static_assert(alignof(ncm::ProgramLocation) == alignof(NcmProgramLocation));
return pmshellLaunchProgram(launch_flags, reinterpret_cast<const NcmProgramLocation *>(&loc), reinterpret_cast<u64 *>(out_process_id));

View file

@ -23,7 +23,7 @@ namespace ams::result {
namespace ams::result::impl {
NORETURN WEAK void OnResultAssertion(Result result) {
NORETURN WEAK_SYMBOL void OnResultAssertion(Result result) {
/* Assert that we should call fatal on result assertion. */
/* If we shouldn't fatal, this will std::abort(); */
/* If we should, we'll continue onwards. */

View file

@ -20,13 +20,13 @@ namespace ams::settings::fwdbg {
/* TODO: Implement when libnx wrapper is added. */
bool IsDebugModeEnabled();
size_t WEAK GetSettingsItemValueSize(const char *name, const char *key) {
size_t WEAK_SYMBOL GetSettingsItemValueSize(const char *name, const char *key) {
u64 size = 0;
R_ASSERT(setsysGetSettingsItemValueSize(name, key, &size));
return size;
}
size_t WEAK GetSettingsItemValue(void *dst, size_t dst_size, const char *name, const char *key) {
size_t WEAK_SYMBOL GetSettingsItemValue(void *dst, size_t dst_size, const char *name, const char *key) {
u64 size = 0;
R_ASSERT(setsysGetSettingsItemValue(name, key, dst, dst_size, &size));
return size;