xref: /haiku/src/system/kernel/arch/x86/paging/pae/X86PagingStructuresPAE.cpp (revision 820dca4df6c7bf955c46e8f6521b9408f50b2900)
1 /*
2  * Copyright 2010, Ingo Weinhold, ingo_weinhold@gmx.de.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 
7 #include "paging/pae/X86PagingStructuresPAE.h"
8 
9 #include <stdlib.h>
10 #include <string.h>
11 
12 #include <KernelExport.h>
13 
14 #include <int.h>
15 
16 #include "paging/pae/X86PagingMethodPAE.h"
17 
18 
19 #if B_HAIKU_PHYSICAL_BITS == 64
20 
21 
22 X86PagingStructuresPAE::X86PagingStructuresPAE()
23 {
24 	fVirtualPageDirs[0] = NULL;
25 }
26 
27 
28 X86PagingStructuresPAE::~X86PagingStructuresPAE()
29 {
30 	// free the user page dirs
31 	free(fVirtualPageDirs[0]);
32 
33 	// free the PDPT page
34 	X86PagingMethodPAE::Method()->Free32BitPage(fPageDirPointerTable,
35 		pgdir_phys, fPageDirPointerTableHandle);
36 }
37 
38 
39 void
40 X86PagingStructuresPAE::Init(
41 	pae_page_directory_pointer_table_entry* virtualPDPT,
42 	phys_addr_t physicalPDPT, void* pdptHandle,
43 	pae_page_directory_entry* const* virtualPageDirs,
44 	const phys_addr_t* physicalPageDirs)
45 {
46 	fPageDirPointerTable = virtualPDPT;
47 	pgdir_phys = physicalPDPT;
48 	fPageDirPointerTableHandle = pdptHandle;
49 	memcpy(fVirtualPageDirs, virtualPageDirs, sizeof(fVirtualPageDirs));
50 	memcpy(fPhysicalPageDirs, physicalPageDirs, sizeof(fPhysicalPageDirs));
51 }
52 
53 
54 void
55 X86PagingStructuresPAE::Delete()
56 {
57 	if (are_interrupts_enabled())
58 		delete this;
59 	else
60 		deferred_delete(this);
61 }
62 
63 
64 #endif	// B_HAIKU_PHYSICAL_BITS == 64
65