xref: /haiku/src/system/kernel/arch/m68k/paging/M68KPagingStructures.h (revision 820dca4df6c7bf955c46e8f6521b9408f50b2900)
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_M68K_PAGING_M68K_PAGING_STRUCTURES_H
10 #define KERNEL_ARCH_M68K_PAGING_M68K_PAGING_STRUCTURES_H
11 
12 
13 #include <SupportDefs.h>
14 
15 #include <heap.h>
16 
17 
18 struct M68KPagingStructures : DeferredDeletable {
19 	uint32						pgroot_phys;
20 	vint32						ref_count;
21 	vint32						active_on_cpus;
22 		// mask indicating on which CPUs the map is currently used
23 
24 								M68KPagingStructures();
25 	virtual						~M68KPagingStructures();
26 
27 	inline	void				AddReference();
28 	inline	void				RemoveReference();
29 
30 	virtual	void				Delete() = 0;
31 };
32 
33 
34 inline void
35 M68KPagingStructures::AddReference()
36 {
37 	atomic_add(&ref_count, 1);
38 }
39 
40 
41 inline void
42 M68KPagingStructures::RemoveReference()
43 {
44 	if (atomic_add(&ref_count, -1) == 1)
45 		Delete();
46 }
47 
48 
49 #endif	// KERNEL_ARCH_M68K_PAGING_M68K_PAGING_STRUCTURES_H
50