feat(manifest): disallow overlap with `load-address`
Disallow overlaps between memory regions and `load-address`, unless the
memory region is relative.
Change-Id: I78a788925f97bdc056711b21371d63d8b8eb32d8
Signed-off-by: Karl Meakin <karl.meakin@arm.com>
diff --git a/inc/hf/mem_range.h b/inc/hf/mem_range.h
new file mode 100644
index 0000000..27e2461
--- /dev/null
+++ b/inc/hf/mem_range.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2024 The Hafnium Authors.
+ *
+ * Use of this source code is governed by a BSD-style
+ * license that can be found in the LICENSE file or at
+ * https://opensource.org/licenses/BSD-3-Clause.
+ */
+
+#pragma once
+
+#include "hf/addr.h"
+#include "hf/mm.h"
+
+struct mem_range {
+ paddr_t begin;
+ paddr_t end;
+};
+
+static inline struct mem_range make_mem_range(uintptr_t base_address,
+ uint32_t page_count)
+{
+ return (struct mem_range){
+ .begin = pa_init(base_address),
+ .end = pa_init(base_address + page_count * PAGE_SIZE - 1),
+ };
+}