2018-04-24 10:53:10 +01:00
|
|
|
#pragma once
|
|
|
|
#include <switch.h>
|
|
|
|
|
2018-04-27 01:04:30 +01:00
|
|
|
#include "ldr_registration.hpp"
|
|
|
|
|
2018-04-24 10:53:10 +01:00
|
|
|
class MapUtils {
|
|
|
|
public:
|
2018-04-27 01:04:30 +01:00
|
|
|
struct AddressSpaceInfo {
|
|
|
|
u64 heap_base;
|
|
|
|
u64 heap_size;
|
|
|
|
u64 heap_end;
|
|
|
|
u64 map_base;
|
|
|
|
u64 map_size;
|
|
|
|
u64 map_end;
|
|
|
|
u64 addspace_base;
|
|
|
|
u64 addspace_size;
|
|
|
|
u64 addspace_end;
|
|
|
|
};
|
|
|
|
static Result GetAddressSpaceInfo(AddressSpaceInfo *out, Handle process_h);
|
2018-04-24 10:53:10 +01:00
|
|
|
static Result LocateSpaceForMapDeprecated(u64 *out, u64 out_size);
|
|
|
|
static Result LocateSpaceForMapModern(u64 *out, u64 out_size);
|
|
|
|
static Result LocateSpaceForMap(u64 *out, u64 out_size);
|
2018-04-27 01:04:30 +01:00
|
|
|
|
|
|
|
|
|
|
|
static Result MapCodeMemoryForProcessDeprecated(Handle process_h, bool is_64_bit_address_space, u64 base_address, u64 size, u64 *out_code_memory_address);
|
|
|
|
static Result MapCodeMemoryForProcessModern(Handle process_h, u64 base_address, u64 size, u64 *out_code_memory_address);
|
|
|
|
static Result MapCodeMemoryForProcess(Handle process_h, bool is_64_bit_address_space, u64 base_address, u64 size, u64 *out_code_memory_address);
|
2018-04-24 10:53:10 +01:00
|
|
|
};
|