taiHEN
1.0
CFW framework for PS Vita
|
Data structure for storing patches internally. More...
Data Structures | |
struct | _tai_proc_map |
The actual map in memory. More... | |
struct | _tai_proc |
Internal data for a process. More... | |
Typedefs | |
typedef struct _tai_proc_map | tai_proc_map_t |
The actual map in memory. | |
typedef struct _tai_proc | tai_proc_t |
Internal data for a process. | |
Functions | |
int | proc_map_init (void) |
Initializes the map system. More... | |
void | proc_map_deinit (void) |
Cleans up the map system. More... | |
tai_proc_map_t * | proc_map_alloc (int nbuckets) |
Allocates a new map. More... | |
void | proc_map_free (tai_proc_map_t *map) |
Frees a map. More... | |
int | proc_map_try_insert (tai_proc_map_t *map, tai_patch_t *patch, tai_patch_t **existing) |
Inserts into the map if no overlap or get patch that completely overlaps. More... | |
int | proc_map_remove_all_pid (tai_proc_map_t *map, SceUID pid, tai_patch_t **head) |
Removes every patch associated with a given pid from the map. More... | |
int | proc_map_remove (tai_proc_map_t *map, tai_patch_t *patch) |
Remove a single patch from the map. More... | |
Data structure for storing patches internally.
Internal map structure
This is a thread-safe map data structure for keeping track of mappings from PID to a linked-list of patches (stored in tai_proc_t
).
tai_proc_map_t* proc_map_alloc | ( | int | nbuckets | ) |
Allocates a new map.
[in] | nbuckets | The number of buckets for the map. |
Definition at line 69 of file proc_map.c.
void proc_map_deinit | ( | void | ) |
void proc_map_free | ( | tai_proc_map_t * | map | ) |
int proc_map_init | ( | void | ) |
Initializes the map system.
Must be called on startup.
Definition at line 38 of file proc_map.c.
int proc_map_remove | ( | tai_proc_map_t * | map, |
tai_patch_t * | patch | ||
) |
Remove a single patch from the map.
map | The map |
patch | The patch to remove |
Definition at line 233 of file proc_map.c.
int proc_map_remove_all_pid | ( | tai_proc_map_t * | map, |
SceUID | pid, | ||
tai_patch_t ** | head | ||
) |
Removes every patch associated with a given pid from the map.
Returned is a new linked list containing every patch that has been removed from the proc map. Use the next
pointer to iterate this linked list.
Since this invalidates all references for a PID, it should ONLY be called on the shutdown of a process. In other words, after calling this, any pointer reference for that process is invalid!
Also note that for optimization, all pointers to slab
in the list are considered invalid! Maybe we should null the pointers out in the future.
map | The map | |
[in] | pid | The pid to remove |
[out] | head | The head of the linked list contained items removed |
Definition at line 202 of file proc_map.c.
int proc_map_try_insert | ( | tai_proc_map_t * | map, |
tai_patch_t * | patch, | ||
tai_patch_t ** | existing | ||
) |
Inserts into the map if no overlap or get patch that completely overlaps.
If there is no overlap with any other element for a given PID, then insert the patch into the map. If there is overlap, the function will return zero and not insert the patch. If the overlap is complete (same address and size), then this will return a pointer to the overlapping patch also.
map | The map | |
[in] | patch | The patch to attempt insert |
[out] | existing | If and only if there exists a patch with the same address and size, then the function returns zero and this pointer will be set to the patch that overlaps. Otherwise, this will output null. |
Definition at line 114 of file proc_map.c.