refactor(mm): document quirks
Log when quirks are triggered, and document them in `mm_test.cc`.
Change-Id: I591f43ae2e650d6a58c5823b7f69288717069f89
Signed-off-by: Karl Meakin <karl.meakin@arm.com>
diff --git a/src/mm.c b/src/mm.c
index 99a5144..04b33d9 100644
--- a/src/mm.c
+++ b/src/mm.c
@@ -456,9 +456,27 @@
/* Cap end to stay within the bounds of the page table. */
if (end > ptable_end) {
+ dlog_verbose(
+ "ptable_map: input range end falls outside of ptable "
+ "address space (%#016lx > %#016lx), capping to ptable "
+ "address space end\n",
+ end, ptable_end);
end = ptable_end;
}
+ if (begin >= end) {
+ dlog_verbose(
+ "ptable_map: input range is backwards (%#016lx >= "
+ "%#016lx), request will have no effect\n",
+ begin, end);
+ } else if (pa_addr(pa_begin) >= pa_addr(pa_end)) {
+ dlog_verbose(
+ "ptable_map: input range was backwards (%#016lx >= "
+ "%#016lx), but due to rounding the range %#016lx to "
+ "%#016lx will be mapped\n",
+ begin, end, pa_addr(pa_begin), pa_addr(pa_end));
+ }
+
while (begin < end) {
if (!mm_map_level(ptable, begin, end, attrs, root_table,
root_level - 1, flags, ppool)) {
@@ -900,6 +918,13 @@
struct mm_page_table *root_table;
bool got_attrs = false;
+ if (begin >= end) {
+ dlog_verbose(
+ "mm_get: input range is backwards (%#016lx >= "
+ "%#016lx)\n",
+ begin, end);
+ }
+
begin = mm_round_down_to_page(begin);
end = mm_round_up_to_page(end);