xref: /haiku/src/system/kernel/arch/arm/paging/ARMPagingStructures.h (revision 1e60bdeab63fa7a57bc9a55b032052e95a18bd2c)
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 #include <smp.h>
18 
19 
20 struct ARMPagingStructures : DeferredDeletable {
21 	phys_addr_t					pgdir_phys;
22 	int32						ref_count;
23 	CPUSet						active_on_cpus;
24 		// mask indicating on which CPUs the map is currently used
25 
26 								ARMPagingStructures();
27 	virtual						~ARMPagingStructures();
28 
29 	inline	void				AddReference();
30 	inline	void				RemoveReference();
31 
32 	virtual	void				Delete() = 0;
33 };
34 
35 
36 inline void
37 ARMPagingStructures::AddReference()
38 {
39 	atomic_add(&ref_count, 1);
40 }
41 
42 
43 inline void
44 ARMPagingStructures::RemoveReference()
45 {
46 	if (atomic_add(&ref_count, -1) == 1)
47 		Delete();
48 }
49 
50 
51 #endif	// KERNEL_ARCH_ARM_PAGING_ARM_PAGING_STRUCTURES_H
52