nso/kip: fix miscalculation when printing rwdata/bss extents

This commit is contained in:
Michael Scire 2021-01-17 22:51:40 -08:00
parent 09e01d5dd7
commit 4ca7afa601
2 changed files with 5 additions and 5 deletions

4
kip.c
View file

@ -255,8 +255,8 @@ void kip1_print(kip1_ctx_t *ctx, int suppress) {
printf(" Sections:\n");
printf(" .text: %08"PRIx32"-%08"PRIx32"\n", ctx->header->section_headers[0].out_offset, ctx->header->section_headers[0].out_offset + align(ctx->header->section_headers[0].out_size, 0x1000));
printf(" .rodata: %08"PRIx32"-%08"PRIx32"\n", ctx->header->section_headers[1].out_offset, ctx->header->section_headers[1].out_offset + align(ctx->header->section_headers[1].out_size, 0x1000));
printf(" .rwdata: %08"PRIx32"-%08"PRIx32"\n", ctx->header->section_headers[2].out_offset, ctx->header->section_headers[2].out_offset + align(ctx->header->section_headers[2].out_size, 0x1000));
printf(" .bss: %08"PRIx32"-%08"PRIx32"\n", ctx->header->section_headers[3].out_offset, ctx->header->section_headers[3].out_offset + align(ctx->header->section_headers[3].out_size, 0x1000));
printf(" .rwdata: %08"PRIx32"-%08"PRIx32"\n", ctx->header->section_headers[2].out_offset, ctx->header->section_headers[2].out_offset + ctx->header->section_headers[2].out_size);
printf(" .bss: %08"PRIx32"-%08"PRIx32"\n",ctx->header->section_headers[2].out_offset + ctx->header->section_headers[2].out_size, ctx->header->section_headers[3].out_offset + align(ctx->header->section_headers[3].out_size, 0x1000));
printf(" Kernel Access Control:\n");
kac_print(ctx->header->capabilities, 0x20);
printf("\n");

6
nso.c
View file

@ -102,11 +102,11 @@ void nso0_print(nso0_ctx_t *ctx) {
printf(" .rodata: %08"PRIx32"-%08"PRIx32"\n", ctx->header->segments[1].dst_off, ctx->header->segments[1].dst_off + align(ctx->header->segments[1].decomp_size, 0x1000));
}
if ((ctx->tool_ctx->action & ACTION_VERIFY) && ctx->segment_validities[2] != VALIDITY_UNCHECKED) {
printf(" .rwdata (%s): %08"PRIx32"-%08"PRIx32"\n", GET_VALIDITY_STR(ctx->segment_validities[2]), ctx->header->segments[2].dst_off, ctx->header->segments[2].dst_off + align(ctx->header->segments[2].decomp_size, 0x1000));
printf(" .rwdata (%s): %08"PRIx32"-%08"PRIx32"\n", GET_VALIDITY_STR(ctx->segment_validities[2]), ctx->header->segments[2].dst_off, ctx->header->segments[2].dst_off + ctx->header->segments[2].decomp_size);
} else {
printf(" .rwdata: %08"PRIx32"-%08"PRIx32"\n", ctx->header->segments[2].dst_off, ctx->header->segments[2].dst_off + align(ctx->header->segments[2].decomp_size, 0x1000));
printf(" .rwdata: %08"PRIx32"-%08"PRIx32"\n", ctx->header->segments[2].dst_off, ctx->header->segments[2].dst_off + ctx->header->segments[2].decomp_size);
}
printf(" .bss: %08"PRIx32"-%08"PRIx32"\n", ctx->header->segments[2].dst_off + align(ctx->header->segments[2].decomp_size, 0x1000), ctx->header->segments[2].dst_off + align(ctx->header->segments[2].decomp_size, 0x1000) + align(ctx->header->segments[2].align_or_total_size, 0x1000));
printf(" .bss: %08"PRIx32"-%08"PRIx32"\n", ctx->header->segments[2].dst_off + ctx->header->segments[2].decomp_size, ctx->header->segments[2].dst_off + align(ctx->header->segments[2].decomp_size + ctx->header->segments[2].align_or_total_size, 0x1000));
}
void nso0_save(nso0_ctx_t *ctx) {