1 /* 2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Distributed under the terms of the NewOS License. 4 */ 5 6 7 #include "VMUserArea.h" 8 9 #include <heap.h> 10 #include <vm/vm_priv.h> 11 12 13 VMUserArea::VMUserArea(VMAddressSpace* addressSpace, uint32 wiring, 14 uint32 protection) 15 : 16 VMArea(addressSpace, wiring, protection) 17 { 18 } 19 20 21 VMUserArea::~VMUserArea() 22 { 23 } 24 25 26 /*static*/ VMUserArea* 27 VMUserArea::Create(VMAddressSpace* addressSpace, const char* name, 28 uint32 wiring, uint32 protection) 29 { 30 VMUserArea* area = new(nogrow) VMUserArea(addressSpace, wiring, 31 protection); 32 if (area == NULL) 33 return NULL; 34 35 if (area->Init(name) != B_OK) { 36 delete area; 37 return NULL; 38 } 39 40 return area; 41 } 42 43 44 /*static*/ VMUserArea* 45 VMUserArea::CreateReserved(VMAddressSpace* addressSpace, uint32 flags) 46 { 47 VMUserArea* area = new(nogrow) VMUserArea(addressSpace, 0, 0); 48 if (area != NULL) 49 area->id = RESERVED_AREA_ID; 50 return area; 51 } 52