xref: /haiku/src/system/kernel/arch/arm/paging/ARMPagingStructures.h (revision 4466b89c65970de4c7236ac87faa2bee4589f413)
1 /*
2  * Copyright 2010, Ingo Weinhold, ingo_weinhold@gmx.de.
3  * Copyright 2005-2009, Axel Dörfler, axeld@pinc-software.de.
4  * Distributed under the terms of the MIT License.
5  *
6  * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
7  * Distributed under the terms of the NewOS License.
8  */
9 #ifndef KERNEL_ARCH_ARM_PAGING_ARM_PAGING_STRUCTURES_H
10 #define KERNEL_ARCH_ARM_PAGING_ARM_PAGING_STRUCTURES_H
11 
12 
13 #include <SupportDefs.h>
14 
15 #include <heap.h>
16 
17 
18 struct ARMPagingStructures : DeferredDeletable {
19 	uint32						pgdir_phys;
20 	vint32						ref_count;
21 	vint32						active_on_cpus;
22 		// mask indicating on which CPUs the map is currently used
23 
24 								ARMPagingStructures();
25 	virtual						~ARMPagingStructures();
26 
27 	inline	void				AddReference();
28 	inline	void				RemoveReference();
29 
30 	virtual	void				Delete() = 0;
31 };
32 
33 
34 inline void
35 ARMPagingStructures::AddReference()
36 {
37 	atomic_add(&ref_count, 1);
38 }
39 
40 
41 inline void
42 ARMPagingStructures::RemoveReference()
43 {
44 	if (atomic_add(&ref_count, -1) == 1)
45 		Delete();
46 }
47 
48 
49 #endif	// KERNEL_ARCH_ARM_PAGING_ARM_PAGING_STRUCTURES_H
50