kernel: pae paging: align *TableEntry() with 64bit paging
use SetTableEntry() in PutPageTableInPageDir() and PutPageTableEntryInTable().
This commit is contained in:
parent
6675afbae2
commit
dde876f9f8
@ -792,10 +792,10 @@ X86PagingMethodPAE::IsKernelPageAccessible(addr_t virtualAddress,
|
||||
X86PagingMethodPAE::PutPageTableInPageDir(pae_page_directory_entry* entry,
|
||||
phys_addr_t physicalTable, uint32 attributes)
|
||||
{
|
||||
*entry = (physicalTable & X86_PAE_PDE_ADDRESS_MASK)
|
||||
SetTableEntry(entry, (physicalTable & X86_PAE_PDE_ADDRESS_MASK)
|
||||
| X86_PAE_PDE_PRESENT
|
||||
| X86_PAE_PDE_WRITABLE
|
||||
| X86_PAE_PDE_USER;
|
||||
| X86_PAE_PDE_USER);
|
||||
// TODO: We ignore the attributes of the page table -- for compatibility
|
||||
// with BeOS we allow having user accessible areas in the kernel address
|
||||
// space. This is currently being used by some drivers, mainly for the
|
||||
@ -830,7 +830,7 @@ X86PagingMethodPAE::PutPageTableEntryInTable(pae_page_table_entry* entry,
|
||||
page |= X86_PAE_PTE_WRITABLE;
|
||||
|
||||
// put it in the page table
|
||||
*(volatile pae_page_table_entry*)entry = page;
|
||||
SetTableEntry(entry, page);
|
||||
}
|
||||
|
||||
|
||||
|
@ -74,18 +74,15 @@ public:
|
||||
phys_addr_t physicalAddress,
|
||||
uint32 attributes, uint32 memoryType,
|
||||
bool globalPage);
|
||||
static pae_page_table_entry SetPageTableEntry(pae_page_table_entry* entry,
|
||||
pae_page_table_entry newEntry);
|
||||
static pae_page_table_entry SetPageTableEntryFlags(
|
||||
pae_page_table_entry* entry, uint64 flags);
|
||||
static pae_page_table_entry TestAndSetPageTableEntry(
|
||||
pae_page_table_entry* entry,
|
||||
pae_page_table_entry newEntry,
|
||||
pae_page_table_entry oldEntry);
|
||||
static pae_page_table_entry ClearPageTableEntry(
|
||||
pae_page_table_entry* entry);
|
||||
static pae_page_table_entry ClearPageTableEntryFlags(
|
||||
pae_page_table_entry* entry, uint64 flags);
|
||||
static uint64_t SetTableEntry(uint64_t* entry,
|
||||
uint64_t newEntry);
|
||||
static uint64_t SetTableEntryFlags(uint64_t* entry,
|
||||
uint64_t flags);
|
||||
static uint64_t TestAndSetTableEntry(uint64_t* entry,
|
||||
uint64_t newEntry, uint64_t oldEntry);
|
||||
static uint64_t ClearTableEntry(uint64_t* entry);
|
||||
static uint64_t ClearTableEntryFlags(uint64_t* entry,
|
||||
uint64_t flags);
|
||||
|
||||
static pae_page_directory_entry* PageDirEntryForAddress(
|
||||
pae_page_directory_entry* const* pdpt,
|
||||
@ -156,40 +153,37 @@ X86PagingMethodPAE::PageDirEntryForAddress(
|
||||
}
|
||||
|
||||
|
||||
/*static*/ inline pae_page_table_entry
|
||||
X86PagingMethodPAE::SetPageTableEntry(pae_page_table_entry* entry,
|
||||
pae_page_table_entry newEntry)
|
||||
/*static*/ inline uint64_t
|
||||
X86PagingMethodPAE::SetTableEntry(uint64_t* entry, uint64_t newEntry)
|
||||
{
|
||||
return atomic_get_and_set64((int64*)entry, newEntry);
|
||||
}
|
||||
|
||||
|
||||
/*static*/ inline pae_page_table_entry
|
||||
X86PagingMethodPAE::SetPageTableEntryFlags(pae_page_table_entry* entry,
|
||||
uint64 flags)
|
||||
/*static*/ inline uint64_t
|
||||
X86PagingMethodPAE::SetTableEntryFlags(uint64_t* entry, uint64_t flags)
|
||||
{
|
||||
return atomic_or64((int64*)entry, flags);
|
||||
}
|
||||
|
||||
|
||||
/*static*/ inline pae_page_table_entry
|
||||
X86PagingMethodPAE::TestAndSetPageTableEntry(pae_page_table_entry* entry,
|
||||
pae_page_table_entry newEntry, pae_page_table_entry oldEntry)
|
||||
/*static*/ inline uint64_t
|
||||
X86PagingMethodPAE::TestAndSetTableEntry(uint64_t* entry,
|
||||
uint64_t newEntry, uint64_t oldEntry)
|
||||
{
|
||||
return atomic_test_and_set64((int64*)entry, newEntry, oldEntry);
|
||||
}
|
||||
|
||||
|
||||
/*static*/ inline pae_page_table_entry
|
||||
X86PagingMethodPAE::ClearPageTableEntry(pae_page_table_entry* entry)
|
||||
/*static*/ inline uint64_t
|
||||
X86PagingMethodPAE::ClearTableEntry(uint64_t* entry)
|
||||
{
|
||||
return SetPageTableEntry(entry, 0);
|
||||
return SetTableEntry(entry, 0);
|
||||
}
|
||||
|
||||
|
||||
/*static*/ inline pae_page_table_entry
|
||||
X86PagingMethodPAE::ClearPageTableEntryFlags(pae_page_table_entry* entry,
|
||||
uint64 flags)
|
||||
/*static*/ inline uint64_t
|
||||
X86PagingMethodPAE::ClearTableEntryFlags(uint64_t* entry, uint64_t flags)
|
||||
{
|
||||
return atomic_and64((int64*)entry, ~flags);
|
||||
}
|
||||
|
@ -477,7 +477,7 @@ X86VMTranslationMapPAE::Unmap(addr_t start, addr_t end)
|
||||
B_PRIxADDR "\n", start);
|
||||
|
||||
pae_page_table_entry oldEntry
|
||||
= X86PagingMethodPAE::ClearPageTableEntryFlags(
|
||||
= X86PagingMethodPAE::ClearTableEntryFlags(
|
||||
&pageTable[index], X86_PAE_PTE_PRESENT);
|
||||
|
||||
T(Unmap(this, start, oldEntry));
|
||||
@ -531,14 +531,14 @@ X86VMTranslationMapPAE::DebugMarkRangePresent(addr_t start, addr_t end,
|
||||
if (!markPresent)
|
||||
continue;
|
||||
|
||||
X86PagingMethodPAE::SetPageTableEntryFlags(
|
||||
X86PagingMethodPAE::SetTableEntryFlags(
|
||||
&pageTable[index], X86_PAE_PTE_PRESENT);
|
||||
} else {
|
||||
if (markPresent)
|
||||
continue;
|
||||
|
||||
pae_page_table_entry oldEntry
|
||||
= X86PagingMethodPAE::ClearPageTableEntryFlags(
|
||||
= X86PagingMethodPAE::ClearTableEntryFlags(
|
||||
&pageTable[index], X86_PAE_PTE_PRESENT);
|
||||
|
||||
if ((oldEntry & X86_PAE_PTE_ACCESSED) != 0) {
|
||||
@ -581,7 +581,7 @@ X86VMTranslationMapPAE::UnmapPage(VMArea* area, addr_t address,
|
||||
= (pae_page_table_entry*)fPageMapper->GetPageTableAt(
|
||||
*pageDirEntry & X86_PAE_PDE_ADDRESS_MASK);
|
||||
|
||||
pae_page_table_entry oldEntry = X86PagingMethodPAE::ClearPageTableEntry(
|
||||
pae_page_table_entry oldEntry = X86PagingMethodPAE::ClearTableEntry(
|
||||
&pageTable[address / B_PAGE_SIZE % kPAEPageTableEntryCount]);
|
||||
|
||||
T(Unmap(this, address, oldEntry));
|
||||
@ -665,7 +665,7 @@ X86VMTranslationMapPAE::UnmapPages(VMArea* area, addr_t base, size_t size,
|
||||
for (; index < kPAEPageTableEntryCount && start < end;
|
||||
index++, start += B_PAGE_SIZE) {
|
||||
pae_page_table_entry oldEntry
|
||||
= X86PagingMethodPAE::ClearPageTableEntry(&pageTable[index]);
|
||||
= X86PagingMethodPAE::ClearTableEntry(&pageTable[index]);
|
||||
if ((oldEntry & X86_PAE_PTE_PRESENT) == 0)
|
||||
continue;
|
||||
|
||||
@ -799,7 +799,7 @@ X86VMTranslationMapPAE::UnmapArea(VMArea* area, bool deletingAddressSpace,
|
||||
= (pae_page_table_entry*)fPageMapper->GetPageTableAt(
|
||||
*pageDirEntry & X86_PAE_PDE_ADDRESS_MASK);
|
||||
pae_page_table_entry oldEntry
|
||||
= X86PagingMethodPAE::ClearPageTableEntry(
|
||||
= X86PagingMethodPAE::ClearTableEntry(
|
||||
&pageTable[address / B_PAGE_SIZE
|
||||
% kPAEPageTableEntryCount]);
|
||||
|
||||
@ -1039,7 +1039,7 @@ X86VMTranslationMapPAE::Protect(addr_t start, addr_t end, uint32 attributes,
|
||||
// without changing the accessed or dirty flag
|
||||
pae_page_table_entry oldEntry;
|
||||
while (true) {
|
||||
oldEntry = X86PagingMethodPAE::TestAndSetPageTableEntry(
|
||||
oldEntry = X86PagingMethodPAE::TestAndSetTableEntry(
|
||||
&pageTable[index],
|
||||
(entry & ~(X86_PAE_PTE_PROTECTION_MASK
|
||||
| X86_PAE_PTE_MEMORY_TYPE_MASK))
|
||||
@ -1092,7 +1092,7 @@ X86VMTranslationMapPAE::ClearFlags(addr_t address, uint32 flags)
|
||||
|
||||
// clear out the flags we've been requested to clear
|
||||
pae_page_table_entry oldEntry
|
||||
= X86PagingMethodPAE::ClearPageTableEntryFlags(entry, flagsToClear);
|
||||
= X86PagingMethodPAE::ClearTableEntryFlags(entry, flagsToClear);
|
||||
|
||||
pinner.Unlock();
|
||||
|
||||
@ -1143,7 +1143,7 @@ X86VMTranslationMapPAE::ClearAccessedAndModified(VMArea* area, addr_t address,
|
||||
|
||||
if (oldEntry & X86_PAE_PTE_ACCESSED) {
|
||||
// page was accessed -- just clear the flags
|
||||
oldEntry = X86PagingMethodPAE::ClearPageTableEntryFlags(entry,
|
||||
oldEntry = X86PagingMethodPAE::ClearTableEntryFlags(entry,
|
||||
X86_PAE_PTE_ACCESSED | X86_PAE_PTE_DIRTY);
|
||||
T(ClearFlags(this, address, oldEntry,
|
||||
X86_PAE_PTE_ACCESSED | X86_PAE_PTE_DIRTY));
|
||||
@ -1151,7 +1151,7 @@ X86VMTranslationMapPAE::ClearAccessedAndModified(VMArea* area, addr_t address,
|
||||
}
|
||||
|
||||
// page hasn't been accessed -- unmap it
|
||||
if (X86PagingMethodPAE::TestAndSetPageTableEntry(entry, 0, oldEntry)
|
||||
if (X86PagingMethodPAE::TestAndSetTableEntry(entry, 0, oldEntry)
|
||||
== oldEntry) {
|
||||
T(ClearFlagsUnmap(this, address, oldEntry));
|
||||
break;
|
||||
@ -1160,7 +1160,7 @@ X86VMTranslationMapPAE::ClearAccessedAndModified(VMArea* area, addr_t address,
|
||||
// something changed -- check again
|
||||
}
|
||||
} else {
|
||||
oldEntry = X86PagingMethodPAE::ClearPageTableEntryFlags(entry,
|
||||
oldEntry = X86PagingMethodPAE::ClearTableEntryFlags(entry,
|
||||
X86_PAE_PTE_ACCESSED | X86_PAE_PTE_DIRTY);
|
||||
T(ClearFlags(this, address, oldEntry,
|
||||
X86_PAE_PTE_ACCESSED | X86_PAE_PTE_DIRTY));
|
||||
|
Loading…
Reference in New Issue
Block a user