xref: /haiku/src/system/boot/platform/openfirmware/mmu.cpp (revision 68d3fc6f8feaa39b413daa13fa6c0985416af1c5)
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 <stdarg.h>
11 
12 #include "openfirmware.h"
13 
14 
15 status_t
16 platform_allocate_region(void **_address, size_t size, uint8 protection)
17 {
18 	if (size == 0)
19 		return B_BAD_VALUE;
20 
21 	void *address = arch_mmu_allocate(*_address, size, protection);
22 	if (address == NULL)
23 		return B_NO_MEMORY;
24 
25 	*_address = address;
26 	return B_OK;
27 }
28 
29 
30 status_t
31 platform_free_region(void *address, size_t size)
32 {
33 	return arch_mmu_free(address, size);
34 }
35 
36