UVLoader
Userland Vita Loader
 All Data Structures Files Functions Variables Typedefs Macros Groups Pages
Data Structures | Macros | Typedefs
resolve.h File Reference

Functions to resolve NIDs and syscalls. More...

#include "types.h"

Data Structures

struct  resolve_entry
 Resolve table entry. More...
 
union  resolve_entry::value
 Value of the entry. More...
 
struct  module_info
 SCE module information section. More...
 
struct  module_exports
 SCE module export table. More...
 
struct  module_imports
 SCE module import table. More...
 
union  module_ports
 Either an SCE module import table or export table. More...
 
struct  segment_info
 A segment of the module in memory. More...
 
struct  loaded_module_info
 Loaded module information. More...
 

Macros

#define STUB_FUNC_MAX_LEN   16
 Max size for a stub function in bytes.
 
#define MAX_LOADED_MODS   128
 Maximum number of loaded modules.
 
#define MAX_RESOLVE_ENTRIES   0x10000
 Maximum number of resolves.
 
#define STUB_FUNC_SIZE   0x10
 Size of stub functions.
 
#define UVL_LIBKERN_BASE   0xE0000000
 sceLibKernel is where we import API calls from
 
#define UVL_LIBKERN_MAX_SIZE   0xE000
 Maximum size of sceLibKernel (for resolving loader)
 
Type of entry
#define RESOLVE_TYPE_UNKNOWN   0
 Unknown type.
 
#define RESOLVE_TYPE_FUNCTION   1
 Function call.
 
#define RESOLVE_TYPE_SYSCALL   2
 Syscall.
 
#define RESOLVE_TYPE_VARIABLE   3
 Imported variable.
 
Supported ARM instruction types
#define INSTRUCTION_UNKNOWN   0
 Unknown/unsupported instruction.
 
#define INSTRUCTION_MOVW   1
 MOVW Rd, #imm instruction.
 
#define INSTRUCTION_MOVT   2
 MOVT Rd, #imm instruction.
 
#define INSTRUCTION_SYSCALL   3
 SVC #imm instruction.
 
#define INSTRUCTION_BRANCH   4
 BX Rn instruction.
 
Search flags for importing loaded modules
See Also
uvl_resolve_all_loaded_modules
#define RESOLVE_MOD_IMPS   0x1
 Add entry from import function stubs.
 
#define RESOLVE_MOD_EXPS   0x2
 Add entry from exported information.
 
#define RESOLVE_IMPS_SVC_ONLY   0x4
 Used with RESOLVE_MOD_IMPS but only add syscalls for import entries.
 
Module infomation check
#define MOD_INFO_VALID_ATTR   0x0000
 
#define MOD_INFO_VALID_VER   0x0101
 

Typedefs

typedef struct resolve_entry resolve_entry_t
 Resolve table entry.
 
typedef struct module_info module_info_t
 SCE module information section.
 
typedef struct module_exports module_exports_t
 SCE module export table.
 
typedef struct module_imports module_imports_t
 SCE module import table.
 
typedef union module_ports module_ports_t
 Either an SCE module import table or export table.
 
typedef struct segment_info segment_info_t
 A segment of the module in memory.
 
typedef struct loaded_module_info loaded_module_info_t
 Loaded module information.
 

Functions

Interacting with the resolve table
int uvl_resolve_table_initialize ()
 Allocates memory for resolve table.
 
int uvl_resolve_table_destroy ()
 Frees memory for resolve table.
 
int uvl_resolve_table_add (resolve_entry_t *entry)
 Adds a resolve entry.
 
resolve_entry_tuvl_resolve_table_get (u32_t nid)
 Gets a resolve entry.
 
Estimating syscalls
resolve_entry_tuvl_estimate_syscall (u32_t nid)
 Estimates an unknown syscall.
 
Capturing and resolving stubs
int uvl_resolve_import_stub_to_entry (void *stub, u32_t nid, resolve_entry_t *entry)
 Creates resolve entry from stub function imported by a module.
 
int uvl_resolve_entry_to_import_stub (resolve_entry_t *entry, void *stub)
 Fills a stub with resolve entry.
 
ARM instruction functions
u32_t uvl_decode_arm_inst (u32_t cur_inst, u8_t *type)
 Get an instruction's type and immediate value.
 
u32_t uvl_encode_arm_inst (u8_t type, u16_t immed, u16_t reg)
 Creates an ARMv7 instruction.
 
Bulk add to resolve table
int uvl_resolve_add_imports (module_imports_t *imp_table, int syscalls_only)
 Add a module's import table's entries to the resolve table.
 
int uvl_resolve_add_exports (module_exports_t *exp_table)
 Add a module's export entries to the resolve table.
 
Resolving entries
int uvl_resolve_add_all_modules (int type)
 Adds entries from all loaded modules to resolve table.
 
int uvl_resolve_add_module (PsvUID modid, int type)
 Adds entries from a loaded module to resolve table.
 
int uvl_resolve_imports (module_imports_t *import)
 Resolves an import table.
 
int uvl_resolve_loader (u32_t nid, void *libkernel_base, void *stub)
 Resolves UVLoader imported function.
 

Detailed Description

Functions to resolve NIDs and syscalls.