Skip to content

Commit d695626

Browse files
committed
mm/regions: add in_free_region() helper function
The functions returns true iff specified physical address does not belong to kernel, user nor init sections. Signed-off-by: Pawel Wieczorkiewicz <wipawel@amazon.de>
1 parent 4f652d3 commit d695626

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

include/mm/regions.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,12 @@ static inline bool in_kernel_section(const void *addr) {
125125
(addr >= _ptr(__start_symbols) && addr < _ptr(__end_symbols));
126126
}
127127

128+
static inline bool in_free_region(paddr_t pa) {
129+
return !in_kernel_section(paddr_to_virt_kern(pa)) &&
130+
!in_user_section(paddr_to_virt_user(pa)) &&
131+
!in_init_section(paddr_to_virt(pa));
132+
}
133+
128134
static inline uint32_t get_bios_ebda_addr(void) {
129135
return (*(uint16_t *) paddr_to_virt_kern(EBDA_ADDR_ENTRY)) << 4;
130136
}

0 commit comments

Comments
 (0)