22 LOADER_CONFIG_FLAG_RECOGNITION_MANDATORY =
BIT(0),
23 } loader_config_flags_t;
26 LCONFIG_KEY_END_OF_LIST = 0,
27 LCONFIG_KEY_MAIN_THREAD_HANDLE = 1,
28 LCONFIG_KEY_NEXT_LOAD_PATH = 2,
29 LCONFIG_KEY_OVERRIDE_HEAP = 3,
30 LCONFIG_KEY_OVERRIDE_SERVICE = 4,
32 LCONFIG_KEY_SYSCALL_AVAILABLE_HINT = 6,
33 LCONFIG_KEY_APPLET_TYPE = 7,
34 LCONFIG_KEY_APPLET_WORKAROUND = 8,
35 LCONFIG_KEY_STDIO_SOCKETS = 9,
36 LCONFIG_KEY_PROCESS_HANDLE = 10,
37 LCONFIG_KEY_LAST_LOAD_RESULT = 11,
38 LCONFIG_KEY_ALLOC_PAGES = 12,
39 LCONFIG_KEY_LOCK_REGION = 13,
41 LCONFIG_KEY_TWILI_PRESENT = 52,
42 } loader_config_key_t;
45 LCONFIG_APPLET_TYPE_APPLICATION = 0,
46 LCONFIG_APPLET_TYPE_SYSTEM_APPLET = 1,
47 LCONFIG_APPLET_TYPE_LIBRARY_APPLET = 2,
48 LCONFIG_APPLET_TYPE_OVERLAY_APPLET = 3,
49 LCONFIG_APPLET_TYPE_SYSTEM_APPLICATION = 4,
51 LCONFIG_APPLET_TYPE_UNKNOWN = 0xFFFFFFFFFFFFFFFF,
52 } loader_config_applet_type_t;
55 LCONFIG_SOCKET_SERVICE_BSD_U = 0,
56 LCONFIG_SOCKET_SERVICE_BSD_S = 1,
57 LCONFIG_SOCKET_SERVICE_MAX = 2,
59 LCONFIG_SOCKET_SERVICE_UNSPECIFIED = 0xFFFFFFFF,
60 } loader_config_socket_service_t;
63 uint64_t service_name;
78 char (*nro_path)[512];
79 char (*argv_str)[2048];
94 } syscall_available_hint;
96 loader_config_applet_type_t applet_type;
103 int32_t s_stdout, s_stdin, s_stderr;
104 loader_config_socket_service_t socket_service;
113 void *(*alloc_pages)(
size_t min,
size_t max,
size_t *actual);
131 bool heap_overridden;
136 int num_service_overrides;
144 uint64_t syscall_hints[2];
147 bool has_applet_type;
148 loader_config_applet_type_t applet_type;
151 bool applet_workaround_active;
152 aruid_t applet_workaround_aruid;
155 bool has_stdio_sockets;
156 int socket_stdout, socket_stdin, socket_stderr;
157 loader_config_socket_service_t socket_service;
160 bool has_process_handle;
164 bool has_alloc_pages;
165 void *(*alloc_pages)(
size_t min,
size_t max,
size_t *actual);
174 static_assert(
sizeof(
loader_config_entry_t) == 0x18,
"loader config entry size should be 0x18 bytes");
result_t lconfig_has_syscalls(const uint8_t *syscalls)
Checks if all the given syscalls are hinted.
result_t lconfig_has_syscall(uint8_t syscall)
Checks if a given syscall is hinted.
uint32_t result_t
Function result.
Definition: types.h:51
Definition: loader_config.h:62
Definition: loader_config.h:123
Definition: loader_config.h:67
uint32_t handle_t
Resource handle.
Definition: types.h:38
result_t lconfig_parse(loader_config_entry_t *config)
Parses loader config.
#define BIT(n)
Creates a bitmask from a bit number.
Definition: types.h:57
void lconfig_init_default(uint64_t thread_handle)
Initializes default loader config.
_Noreturn void trn_dirty_exit(int code)
Exits application without cleanup.
bool free_pages(void *pages)
Frees memory pages returned from alloc_pages.
Interprocess Communication data structures and functions.
void * alloc_pages(size_t min, size_t max, size_t *actual)
Allocates memory pages.
uint64_t aruid_t
Applet resource user id.
Definition: types.h:52