libtransistor
A userland library for the Nintendo Switch
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
module.h
Go to the documentation of this file.
1 
6 #pragma once
7 
10 
11 #include<stdint.h>
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 typedef enum {
18  MODULE_STATE_INVALID = 0,
19  MODULE_STATE_QUEUED = 1,
20  MODULE_STATE_SCANNED = 2,
21  MODULE_STATE_RELOCATED = 3,
22  MODULE_STATE_INITIALIZED = 4,
23  MODULE_STATE_FINALIZED = 5,
24  MODULE_STATE_UNLOADED = 6,
25 } module_state_t;
26 
27 typedef struct {
28  module_t *module;
29  trn_list_head_t list;
31 
32 struct module_t {
33  module_state_t state;
34  int refcount;
35 
36  // needed for MODULE_STATE_QUEUED
37  module_input_t input;
38 
39  trn_list_head_t dependencies;
40 
41  Elf64_Dyn *dynamic;
42  Elf64_Sym *symtab;
43  const char *strtab;
44  uint32_t *hash;
45 };
46 
47 // module operations
48 result_t ld_scan_module(module_t *mod);
49 result_t ld_relocate_module(module_t *mod);
50 result_t ld_initialize_module(module_t *mod);
51 result_t ld_finalize_module(module_t *mod);
52 result_t ld_destroy_module(module_t *mod);
53 // \ref ld_decref_module is a public API and goes in ld.h
54 
55 #ifdef __cplusplus
56 }
57 #endif
Definition: list.h:16
Definition: module.h:32
uint32_t result_t
Function result.
Definition: types.h:51
Definition: ld.h:22
Lists Inspired by the concepts of the Linux kernel list API.
ELF structures.
Definition: module.h:27
Definition: elf.h:16
Definition: elf.h:37