1 // SPDX-License-Identifier: BSD-2-Clause
2 /*
3  * Copyright (c) 2019, Linaro Limited
4  */
5 
6 #include <kernel/user_mode_ctx.h>
7 #include <trace.h>
8 #include <mm/mobj.h>
9 
user_mode_ctx_print_mappings(struct user_mode_ctx * uctx)10 void user_mode_ctx_print_mappings(struct user_mode_ctx *uctx)
11 {
12 	struct vm_region *r = NULL;
13 	char flags[7] = { '\0', };
14 	size_t n = 0;
15 
16 	TAILQ_FOREACH(r, &uctx->vm_info.regions, link) {
17 		paddr_t pa = 0;
18 
19 		if (r->mobj)
20 			mobj_get_pa(r->mobj, r->offset, 0, &pa);
21 
22 		mattr_perm_to_str(flags, sizeof(flags), r->attr);
23 		EMSG_RAW(" region %2zu: va 0x%0*" PRIxVA " pa 0x%0*" PRIxPA
24 			 " size 0x%06zx flags %s",
25 			 n, PRIxVA_WIDTH, r->va, PRIxPA_WIDTH, pa, r->size,
26 			 flags);
27 		n++;
28 	}
29 }
30