mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-06-04 08:29:44 -04:00
loader: refactor to use LoaderModuleInfo
This commit is contained in:
parent
5c9d0f05b1
commit
ed86c44a49
5 changed files with 36 additions and 44 deletions
|
@ -20,23 +20,16 @@
|
|||
|
||||
#include "ldr_map.hpp"
|
||||
|
||||
#define REGISTRATION_LIST_MAX (0x40)
|
||||
|
||||
#define NSO_INFO_MAX (0x20)
|
||||
#define NRR_INFO_MAX (0x40)
|
||||
#define NRO_INFO_MAX (0x40)
|
||||
|
||||
class Registration {
|
||||
public:
|
||||
struct NsoInfo {
|
||||
u64 base_address;
|
||||
u64 size;
|
||||
unsigned char build_id[0x20];
|
||||
};
|
||||
|
||||
struct NsoInfoHolder {
|
||||
static constexpr size_t MaxProcesses = 0x40;
|
||||
static constexpr size_t MaxModuleInfos = 0x20;
|
||||
static constexpr size_t MaxNrrInfos = 0x40;
|
||||
static constexpr size_t MaxNroInfos = 0x40;
|
||||
public:
|
||||
struct ModuleInfoHolder {
|
||||
bool in_use;
|
||||
NsoInfo info;
|
||||
LoaderModuleInfo info;
|
||||
};
|
||||
|
||||
struct NroInfo {
|
||||
|
@ -65,14 +58,14 @@ class Registration {
|
|||
u64 process_id;
|
||||
u64 title_id;
|
||||
Registration::TidSid tid_sid;
|
||||
std::array<Registration::NsoInfoHolder, NSO_INFO_MAX> nso_infos;
|
||||
std::array<Registration::NroInfo, NRO_INFO_MAX> nro_infos;
|
||||
std::array<MappedCodeMemory, NRR_INFO_MAX> nrr_infos;
|
||||
std::array<Registration::ModuleInfoHolder, MaxModuleInfos> module_infos;
|
||||
std::array<Registration::NroInfo, MaxNroInfos> nro_infos;
|
||||
std::array<MappedCodeMemory, MaxNrrInfos> nrr_infos;
|
||||
void *owner_ro_service;
|
||||
};
|
||||
|
||||
struct List {
|
||||
std::array<Registration::Process, REGISTRATION_LIST_MAX> processes;
|
||||
std::array<Registration::Process, MaxProcesses> processes;
|
||||
u64 num_processes;
|
||||
};
|
||||
|
||||
|
@ -84,7 +77,7 @@ class Registration {
|
|||
static bool RegisterTidSid(const TidSid *tid_sid, u64 *out_index);
|
||||
static bool UnregisterIndex(u64 index);
|
||||
static void SetProcessIdTidAndIs64BitAddressSpace(u64 index, u64 process_id, u64 tid, bool is_64_bit_addspace);
|
||||
static void AddNsoInfo(u64 index, u64 base_address, u64 size, const unsigned char *build_id);
|
||||
static void AddModuleInfo(u64 index, u64 base_address, u64 size, const unsigned char *build_id);
|
||||
static void CloseRoService(void *service, Handle process_h);
|
||||
static Result AddNrrInfo(u64 index, MappedCodeMemory *nrr_info);
|
||||
static Result RemoveNrrInfo(u64 index, u64 base_address);
|
||||
|
@ -92,7 +85,7 @@ class Registration {
|
|||
static bool IsNroAlreadyLoaded(u64 index, u8 *build_id);
|
||||
static void AddNroToProcess(u64 index, MappedCodeMemory *nro, MappedCodeMemory *bss, u32 text_size, u32 ro_size, u32 rw_size, u8 *build_id);
|
||||
static Result RemoveNroInfo(u64 index, Handle process_h, u64 base_address);
|
||||
static Result GetNsoInfosForProcessId(NsoInfo *out, u32 max_out, u64 process_id, u32 *num_written);
|
||||
static Result GetProcessModuleInfo(LoaderModuleInfo *out, u32 max_out, u64 process_id, u32 *num_written);
|
||||
|
||||
/* Atmosphere MitM Extension. */
|
||||
static void AssociatePidTidForMitM(u64 index);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue