xref: /haiku/src/system/kernel/vm/VMKernelArea.cpp (revision 820dca4df6c7bf955c46e8f6521b9408f50b2900)
1 /*
2  * Copyright 2009-2011, 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 <slab/Slab.h>
11 #include <vm/vm_priv.h>
12 
13 
14 VMKernelArea::VMKernelArea(VMAddressSpace* addressSpace, uint32 wiring,
15 	uint32 protection)
16 	:
17 	VMArea(addressSpace, wiring, protection)
18 {
19 }
20 
21 
22 VMKernelArea::~VMKernelArea()
23 {
24 }
25 
26 
27 /*static*/ VMKernelArea*
28 VMKernelArea::Create(VMAddressSpace* addressSpace, const char* name,
29 	uint32 wiring, uint32 protection, ObjectCache* objectCache,
30 	uint32 allocationFlags)
31 {
32 	VMKernelArea* area = new(objectCache, allocationFlags) VMKernelArea(
33 		addressSpace, wiring, protection);
34 	if (area == NULL)
35 		return NULL;
36 
37 	if (area->Init(name, allocationFlags) != B_OK) {
38 		object_cache_delete(objectCache, area);
39 		return NULL;
40 	}
41 
42 	return area;
43 }
44