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
13typedef struct addr_range {
14	uint64 start;
15	uint64 size;
16} _PACKED addr_range;
17
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23status_t insert_address_range(addr_range* ranges, uint32* _numRanges,
24	uint32 maxRanges, uint64 start, uint64 size);
25status_t remove_address_range(addr_range* ranges, uint32* _numRanges,
26	uint32 maxRanges, uint64 start, uint64 size);
27bool get_free_address_range(addr_range* ranges, uint32 numRanges, uint64 base,
28	uint64 size, uint64* _rangeBase);
29bool is_address_range_covered(addr_range* ranges, uint32 numRanges, uint64 base,
30	uint64 size);
31uint64 total_address_ranges_size(addr_range* ranges, uint32 numRanges);
32void sort_address_ranges(addr_range* ranges, uint32 numRanges);
33
34status_t insert_physical_memory_range(uint64 start, uint64 size);
35status_t remove_physical_memory_range(uint64 start, uint64 size);
36uint64 total_physical_memory();
37
38status_t insert_physical_allocated_range(uint64 start, uint64 size);
39status_t insert_virtual_allocated_range(uint64 start, uint64 size);
40void ignore_physical_memory_ranges_beyond_4gb();
41
42#ifdef __cplusplus
43}
44#endif
45
46#endif	/* KERNEL_BOOT_ADDR_RANGE_H */
47