mirror of
https://github.com/switchbrew/switch-tools.git
synced 2025-06-24 14:52:39 +02:00
elf2kip: allow specifying whether to use secure memory or not
This commit is contained in:
parent
026ed556df
commit
20cf1efd2b
@ -132,10 +132,11 @@ int cJSON_GetBooleanOptional(const cJSON *obj, const char *field, int *out) {
|
||||
fprintf(stderr, "Unknown boolean value in %s.\n", field);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
} else {
|
||||
*out = 0;
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int cJSON_GetU64(const cJSON *obj, const char *field, u64 *out) {
|
||||
@ -219,6 +220,17 @@ int ParseKipConfiguration(const char *json, KipHeader *kip_hdr) {
|
||||
goto PARSE_CAPS_END;
|
||||
}
|
||||
|
||||
/* Parse use secure memory. */
|
||||
/* This field is optional, and defaults to true (set before this function is called). */
|
||||
int use_secure_memory = 1;
|
||||
if (cJSON_GetBooleanOptional(npdm_json, "use_secure_memory", &use_secure_memory)) {
|
||||
if (use_secure_memory) {
|
||||
kip_hdr->Flags |= 0x20;
|
||||
} else {
|
||||
kip_hdr->Flags &= ~0x20;
|
||||
}
|
||||
}
|
||||
|
||||
/* Parse main_thread_stack_size. */
|
||||
u64 stack_size = 0;
|
||||
if (!cJSON_GetU64(npdm_json, "main_thread_stack_size", &stack_size)) {
|
||||
|
Loading…
Reference in New Issue
Block a user