1258945Sroberto/*
2280849Scy * Copyright 2010, Ingo Weinhold, ingo_weinhold@gmx.de.
3258945Sroberto * Copyright 2005-2009, Axel D��rfler, axeld@pinc-software.de.
4258945Sroberto * Distributed under the terms of the MIT License.
5258945Sroberto *
6258945Sroberto * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
7258945Sroberto * Distributed under the terms of the NewOS License.
8258945Sroberto */
9258945Sroberto#ifndef KERNEL_ARCH_ARM_PAGING_ARM_PAGING_STRUCTURES_H
10258945Sroberto#define KERNEL_ARCH_ARM_PAGING_ARM_PAGING_STRUCTURES_H
11258945Sroberto
12258945Sroberto
13258945Sroberto#include <SupportDefs.h>
14258945Sroberto
15258945Sroberto#include <heap.h>
16258945Sroberto
17258945Sroberto#include <smp.h>
18280849Scy
19258945Sroberto
20258945Srobertostruct ARMPagingStructures : DeferredDeletable {
21258945Sroberto	phys_addr_t					pgdir_phys;
22258945Sroberto	int32						ref_count;
23258945Sroberto	CPUSet						active_on_cpus;
24258945Sroberto		// mask indicating on which CPUs the map is currently used
25258945Sroberto
26258945Sroberto								ARMPagingStructures();
27258945Sroberto	virtual						~ARMPagingStructures();
28258945Sroberto
29258945Sroberto	inline	void				AddReference();
30258945Sroberto	inline	void				RemoveReference();
31258945Sroberto
32258945Sroberto	virtual	void				Delete() = 0;
33258945Sroberto};
34258945Sroberto
35258945Sroberto
36258945Srobertoinline void
37280849ScyARMPagingStructures::AddReference()
38280849Scy{
39280849Scy	atomic_add(&ref_count, 1);
40280849Scy}
41280849Scy
42280849Scy
43280849Scyinline void
44280849ScyARMPagingStructures::RemoveReference()
45280849Scy{
46280849Scy	if (atomic_add(&ref_count, -1) == 1)
47280849Scy		Delete();
48280849Scy}
49280849Scy
50280849Scy
51258945Sroberto#endif	// KERNEL_ARCH_ARM_PAGING_ARM_PAGING_STRUCTURES_H
52280849Scy