xref: /haiku/src/system/kernel/vm/VMKernelArea.cpp (revision 922e7ba1f3228e6f28db69b0ded8f86eb32dea17)
1 /*
2  * Copyright 2009-2010, Ingo Weinhold, ingo_weinhold@gmx.de.
3  * Distributed under the terms of the NewOS License.
4  */
5 
6 
7 #include "VMKernelArea.h"
8 
9 #include <heap.h>
10 #include <vm/vm_priv.h>
11 
12 
13 VMKernelArea::VMKernelArea(VMAddressSpace* addressSpace, uint32 wiring,
14 	uint32 protection)
15 	:
16 	VMArea(addressSpace, wiring, protection)
17 {
18 }
19 
20 
21 VMKernelArea::~VMKernelArea()
22 {
23 }
24 
25 
26 /*static*/ VMKernelArea*
27 VMKernelArea::Create(VMAddressSpace* addressSpace, const char* name,
28 	uint32 wiring, uint32 protection, uint32 allocationFlags)
29 {
30 	VMKernelArea* area = new(malloc_flags(allocationFlags)) VMKernelArea(
31 		addressSpace, wiring, protection);
32 	if (area == NULL)
33 		return NULL;
34 
35 	if (area->Init(name, allocationFlags) != B_OK) {
36 		area->~VMKernelArea();
37 		free_etc(area, allocationFlags);
38 		return NULL;
39 	}
40 
41 	return area;
42 }
43