headers/bsd: Add sys/queue.h.
[haiku.git] / src / system / kernel / arch / x86 / paging / pae / X86PagingStructuresPAE.cpp
blob99e3f1db0e3a6d2e8ad4869bc8828a95927a0d06
1 /*
2 * Copyright 2010, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
7 #include "paging/pae/X86PagingStructuresPAE.h"
9 #include <stdlib.h>
10 #include <string.h>
12 #include <KernelExport.h>
14 #include <int.h>
16 #include "paging/pae/X86PagingMethodPAE.h"
19 #if B_HAIKU_PHYSICAL_BITS == 64
22 X86PagingStructuresPAE::X86PagingStructuresPAE()
24 fPageDirPointerTable(NULL)
26 memset(fVirtualPageDirs, 0, sizeof(fVirtualPageDirs));
30 X86PagingStructuresPAE::~X86PagingStructuresPAE()
32 // free the user page dirs
33 free(fVirtualPageDirs[0]);
34 // There's one contiguous allocation for 0 and 1.
36 // free the PDPT page
37 if (fPageDirPointerTable != NULL) {
38 X86PagingMethodPAE::Method()->Free32BitPage(fPageDirPointerTable,
39 pgdir_phys, fPageDirPointerTableHandle);
44 void
45 X86PagingStructuresPAE::Init(
46 pae_page_directory_pointer_table_entry* virtualPDPT,
47 phys_addr_t physicalPDPT, void* pdptHandle,
48 pae_page_directory_entry* const* virtualPageDirs,
49 const phys_addr_t* physicalPageDirs)
51 fPageDirPointerTable = virtualPDPT;
52 pgdir_phys = physicalPDPT;
53 fPageDirPointerTableHandle = pdptHandle;
54 memcpy(fVirtualPageDirs, virtualPageDirs, sizeof(fVirtualPageDirs));
55 memcpy(fPhysicalPageDirs, physicalPageDirs, sizeof(fPhysicalPageDirs));
59 void
60 X86PagingStructuresPAE::Delete()
62 if (are_interrupts_enabled())
63 delete this;
64 else
65 deferred_delete(this);
69 #endif // B_HAIKU_PHYSICAL_BITS == 64