libstratosphere/fs.mitm: Push WIP support for Domains. Not yet fully working.

This commit is contained in:
Michael Scire 2018-06-12 16:00:09 -06:00
parent d8c9399cff
commit 237ff0d1e7
47 changed files with 1053 additions and 882 deletions

View file

@ -1,7 +1,7 @@
#include <switch.h>
#include <cstdio>
#include <algorithm>
#include <stratosphere.hpp>
#include "ldr_debug_monitor.hpp"
#include "ldr_launch_queue.hpp"
#include "ldr_registration.hpp"

View file

@ -10,7 +10,7 @@ enum DebugMonitorServiceCmd {
Dmnt_Cmd_GetNsoInfo = 2
};
class DebugMonitorService final : IServiceObject {
class DebugMonitorService final : public IServiceObject {
public:
Result dispatch(IpcParsedCommand &r, IpcCommand &out_c, u64 cmd_id, u8 *pointer_buffer, size_t pointer_buffer_size) override;
Result handle_deferred() override {

View file

@ -72,11 +72,11 @@ void __appInit(void) {
/* Check for exosphere API compatibility. */
u64 exosphere_cfg;
if (R_FAILED(splGetConfig((SplConfigItem)65000, &exosphere_cfg))) {
fatalSimple(0xCAFE << 4 | 0xFF);
//fatalSimple(0xCAFE << 4 | 0xFF);
/* TODO: Does Loader need to know about target firmware/master key revision? If so, extract from exosphere_cfg. */
}
splExit();
//splExit();
}
void __appExit(void) {

View file

@ -198,7 +198,7 @@ Result NsoUtils::CalculateNsoLoadExtents(u32 addspace_type, u32 args_size, NsoLo
}
Result NsoUtils::LoadNsoSegment(unsigned int index, unsigned int segment, FILE *f_nso, u8 *map_base, u8 *map_end) {
Result NsoUtils::LoadNsoSegment(u64 title_id, unsigned int index, unsigned int segment, FILE *f_nso, u8 *map_base, u8 *map_end) {
bool is_compressed = ((g_nso_headers[index].flags >> segment) & 1) != 0;
bool check_hash = ((g_nso_headers[index].flags >> (segment + 3)) & 1) != 0;
size_t out_size = g_nso_headers[index].segments[segment].decomp_size;
@ -259,7 +259,7 @@ Result NsoUtils::LoadNsosIntoProcessMemory(Handle process_h, u64 title_id, NsoLo
return 0xA09;
}
for (unsigned int seg = 0; seg < 3; seg++) {
if (R_FAILED((rc = LoadNsoSegment(i, seg, f_nso, map_base, map_base + extents->nso_sizes[i])))) {
if (R_FAILED((rc = LoadNsoSegment(title_id, i, seg, f_nso, map_base, map_base + extents->nso_sizes[i])))) {
fclose(f_nso);
return rc;
}

View file

@ -92,6 +92,6 @@ class NsoUtils {
static Result ValidateNsoLoadSet();
static Result CalculateNsoLoadExtents(u32 addspace_type, u32 args_size, NsoLoadExtents *extents);
static Result LoadNsoSegment(unsigned int index, unsigned int segment, FILE *f_nso, u8 *map_base, u8 *map_end);
static Result LoadNsoSegment(u64 title_id, unsigned int index, unsigned int segment, FILE *f_nso, u8 *map_base, u8 *map_end);
static Result LoadNsosIntoProcessMemory(Handle process_h, u64 title_id, NsoLoadExtents *extents, u8 *args, u32 args_size);
};

View file

@ -1,4 +1,5 @@
#include <switch.h>
#include <stratosphere.hpp>
#include "ldr_process_manager.hpp"
#include "ldr_registration.hpp"
#include "ldr_launch_queue.hpp"
@ -7,7 +8,7 @@
Result ProcessManagerService::dispatch(IpcParsedCommand &r, IpcCommand &out_c, u64 cmd_id, u8 *pointer_buffer, size_t pointer_buffer_size) {
Result rc = 0xF601;
switch ((ProcessManagerServiceCmd)cmd_id) {
case Pm_Cmd_CreateProcess:
rc = WrapIpcCommandImpl<&ProcessManagerService::create_process>(this, r, out_c, pointer_buffer, pointer_buffer_size);
@ -24,7 +25,6 @@ Result ProcessManagerService::dispatch(IpcParsedCommand &r, IpcCommand &out_c, u
default:
break;
}
return rc;
}

View file

@ -12,7 +12,7 @@ enum ProcessManagerServiceCmd {
Pm_Cmd_UnregisterTitle = 3
};
class ProcessManagerService final : IServiceObject {
class ProcessManagerService final : public IServiceObject {
struct ProgramInfo {
u8 main_thread_priority;
u8 default_cpu_id;

View file

@ -1,6 +1,7 @@
#include <switch.h>
#include <cstdio>
#include <algorithm>
#include <stratosphere.hpp>
#include "ldr_ro_service.hpp"
#include "ldr_registration.hpp"

View file

@ -12,7 +12,7 @@ enum RoServiceCmd {
Ro_Cmd_Initialize = 4,
};
class RelocatableObjectsService final : IServiceObject {
class RelocatableObjectsService final : public IServiceObject {
Handle process_handle;
u64 process_id;
bool has_initialized;

View file

@ -1,4 +1,5 @@
#include <switch.h>
#include <stratosphere.hpp>
#include "ldr_shell.hpp"
#include "ldr_launch_queue.hpp"

View file

@ -7,7 +7,7 @@ enum ShellServiceCmd {
Shell_Cmd_ClearLaunchQueue = 1
};
class ShellService final : IServiceObject {
class ShellService final : public IServiceObject {
public:
Result dispatch(IpcParsedCommand &r, IpcCommand &out_c, u64 cmd_id, u8 *pointer_buffer, size_t pointer_buffer_size) override;
Result handle_deferred() override {