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
14VMKernelArea::VMKernelArea(VMAddressSpace* addressSpace, uint32 wiring,
15	uint32 protection)
16	:
17	VMArea(addressSpace, wiring, protection)
18{
19}
20
21
22VMKernelArea::~VMKernelArea()
23{
24}
25
26
27/*static*/ VMKernelArea*
28VMKernelArea::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