Karl Meakin | 6291eb2 | 2024-11-18 12:43:47 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2024 The Hafnium Authors. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style |
| 5 | * license that can be found in the LICENSE file or at |
| 6 | * https://opensource.org/licenses/BSD-3-Clause. |
| 7 | */ |
| 8 | |
| 9 | #pragma once |
| 10 | |
| 11 | #include "hf/addr.h" |
| 12 | #include "hf/mm.h" |
| 13 | |
| 14 | struct mem_range { |
| 15 | paddr_t begin; |
| 16 | paddr_t end; |
| 17 | }; |
| 18 | |
| 19 | static inline struct mem_range make_mem_range(uintptr_t base_address, |
| 20 | uint32_t page_count) |
| 21 | { |
| 22 | return (struct mem_range){ |
| 23 | .begin = pa_init(base_address), |
| 24 | .end = pa_init(base_address + page_count * PAGE_SIZE - 1), |
| 25 | }; |
| 26 | } |