xref: /haiku/src/system/boot/platform/openfirmware/mmu.cpp (revision 1e36cfc2721ef13a187c6f7354dc9cbc485e89d3)
1 /*
2  * Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 
7 #include <platform_arch.h>
8 #include <boot/platform.h>
9 #include <boot/stdio.h>
10 #include <platform/openfirmware/openfirmware.h>
11 #include <stdarg.h>
12 
13 
14 status_t
15 platform_allocate_region(void **_address, size_t size, uint8 protection,
16 	bool exactAddress)
17 {
18 	if (size == 0)
19 		return B_BAD_VALUE;
20 
21 	void *address = arch_mmu_allocate(*_address, size, protection,
22 		exactAddress);
23 	if (address == NULL)
24 		return B_NO_MEMORY;
25 
26 	*_address = address;
27 	return B_OK;
28 }
29 
30 
31 status_t
32 platform_free_region(void *address, size_t size)
33 {
34 	return arch_mmu_free(address, size);
35 }
36 
37