use actual lowest/highest priorities, ignoring field names

This commit is contained in:
Michael Scire 2022-03-13 16:59:59 -07:00 committed by Dave Murphy
parent 70d270d001
commit becb4df6f6
2 changed files with 12 additions and 4 deletions

View File

@ -341,13 +341,17 @@ int ParseKipConfiguration(const char *json, KipHeader *kip_hdr) {
status = 0;
goto PARSE_CAPS_END;
}
u8 real_highest_prio = (lowest_prio < highest_prio) ? lowest_prio : highest_prio;
u8 real_lowest_prio = (lowest_prio > highest_prio) ? lowest_prio : highest_prio;
desc = highest_cpu;
desc <<= 8;
desc |= lowest_cpu;
desc <<= 6;
desc |= (lowest_prio & 0x3F);
desc |= (real_highest_prio & 0x3F);
desc <<= 6;
desc |= (highest_prio & 0x3F);
desc |= (real_lowest_prio & 0x3F);
kip_hdr->Capabilities[cur_cap++] = (u32)((desc << 4) | (0x0007));
} else if (!strcmp(type_str, "syscalls")) {
if (!cJSON_IsObject(value)) {

View File

@ -646,13 +646,17 @@ int CreateNpdm(const char *json, void **dst, u32 *dst_size) {
status = 0;
goto NPDM_BUILD_END;
}
u8 real_highest_prio = (lowest_prio < highest_prio) ? lowest_prio : highest_prio;
u8 real_lowest_prio = (lowest_prio > highest_prio) ? lowest_prio : highest_prio;
desc = highest_cpu;
desc <<= 8;
desc |= lowest_cpu;
desc <<= 6;
desc |= (lowest_prio & 0x3F);
desc |= (real_highest_prio & 0x3F);
desc <<= 6;
desc |= (highest_prio & 0x3F);
desc |= (real_lowest_prio & 0x3F);
caps[cur_cap++] = (u32)((desc << 4) | (0x0007));
} else if (!strcmp(type_str, "syscalls")) {
if (!cJSON_IsObject(value)) {