Skip to content

Commit

Permalink
core: print rwx flags for each MMU region when a user TA aborts
Browse files Browse the repository at this point in the history
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
  • Loading branch information
jforissier committed Sep 18, 2017
1 parent 1295874 commit 13b3ee9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
7 changes: 5 additions & 2 deletions core/arch/arm/kernel/user_ta.c
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,7 @@ static void user_ta_enter_close_session(struct tee_ta_session *s)
static void user_ta_dump_state(struct tee_ta_ctx *ctx)
{
struct user_ta_ctx *utc __maybe_unused = to_user_ta_ctx(ctx);
char flags[4] = { '\0', };
size_t n;

EMSG_RAW(" arch: %s load address: 0x%x ctx-idr: %d",
Expand All @@ -515,10 +516,12 @@ static void user_ta_dump_state(struct tee_ta_ctx *ctx)
mobj_get_pa(utc->mmu->regions[n].mobj,
utc->mmu->regions[n].offset, 0, &pa);

mattr_uflags_to_str(flags, sizeof(flags),
utc->mmu->regions[n].attr);
EMSG_RAW(" region %zu: va %#" PRIxVA " pa %#" PRIxPA
" size %#zx",
" size %#zx flags %s",
n, utc->mmu->regions[n].va, pa,
utc->mmu->regions[n].size);
utc->mmu->regions[n].size, flags);
}
}
KEEP_PAGER(user_ta_dump_state);
Expand Down
11 changes: 11 additions & 0 deletions core/include/mm/tee_mmu_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,15 @@ struct tee_mmu_info {
vaddr_t ta_private_vmem_end;
};

static inline void mattr_uflags_to_str(char *str, size_t size, uint32_t attr)
{
if (size < 4)
return;

str[0] = (attr & TEE_MATTR_UR) ? 'r' : '-';
str[1] = (attr & TEE_MATTR_UW) ? 'w' : '-';
str[2] = (attr & TEE_MATTR_UX) ? 'x' : '-';
str[3] = '\0';
}

#endif

0 comments on commit 13b3ee9

Please sign in to comment.