xref: /haiku/headers/private/kernel/boot/addr_range.h (revision fc7456e9b1ec38c941134ed6d01c438cf289381e)
1 /*
2  * Copyright 2010, Ingo Weinhold, ingo_weinhold@gmx.de.
3  * Copyright 2004-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
4  * Distributed under the terms of the MIT License.
5  */
6 #ifndef KERNEL_BOOT_ADDR_RANGE_H
7 #define KERNEL_BOOT_ADDR_RANGE_H
8 
9 
10 #include <SupportDefs.h>
11 
12 
13 typedef struct addr_range {
14 	uint64 start;
15 	uint64 size;
16 } _PACKED addr_range;
17 
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 status_t insert_address_range(addr_range* ranges, uint32* _numRanges,
24 	uint32 maxRanges, uint64 start, uint64 size);
25 status_t remove_address_range(addr_range* ranges, uint32* _numRanges,
26 	uint32 maxRanges, uint64 start, uint64 size);
27 bool get_free_address_range(addr_range* ranges, uint32 numRanges, uint64 base,
28 	uint64 size, uint64* _rangeBase);
29 bool is_address_range_covered(addr_range* ranges, uint32 numRanges, uint64 base,
30 	uint64 size);
31 uint64 total_address_ranges_size(addr_range* ranges, uint32 numRanges);
32 void sort_address_ranges(addr_range* ranges, uint32 numRanges);
33 
34 status_t insert_physical_memory_range(uint64 start, uint64 size);
35 status_t remove_physical_memory_range(uint64 start, uint64 size);
36 uint64 total_physical_memory();
37 
38 status_t insert_physical_allocated_range(uint64 start, uint64 size);
39 status_t remove_physical_allocated_range(uint64 start, uint64 size);
40 
41 status_t insert_virtual_allocated_range(uint64 start, uint64 size);
42 status_t remove_virtual_allocated_range(uint64 start, uint64 size);
43 
44 void ignore_physical_memory_ranges_beyond_4gb();
45 
46 #ifdef __cplusplus
47 }
48 #endif
49 
50 #endif	/* KERNEL_BOOT_ADDR_RANGE_H */
51