Skip to content

Commit

Permalink
Use the existing ARM MMU definitions and remove duplicates.
Browse files Browse the repository at this point in the history
  • Loading branch information
mmlr committed Dec 4, 2012
1 parent 7c45cf7 commit fd6e3a1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 23 deletions.
1 change: 1 addition & 0 deletions headers/private/kernel/arch/arm/arm_mmu.h
Expand Up @@ -52,6 +52,7 @@
* I will use the old format...
*/

#define ARM_MMU_L2_TYPE_LARGE 0x1
#define ARM_MMU_L2_TYPE_SMALLEXT 0x3

/* for new format entries (cortex-a8) */
Expand Down
Expand Up @@ -22,7 +22,6 @@
#include <thread.h>
#include <vm/vm.h>
#include <vm/VMAddressSpace.h>
#include <arm_mmu.h>

#include "paging/32bit/ARMPagingStructures32Bit.h"
#include "paging/32bit/ARMVMTranslationMap32Bit.h"
Expand Down Expand Up @@ -172,7 +171,7 @@ ARMPagingMethod32Bit::PhysicalPageSlotPool::Map(phys_addr_t physicalAddress,
page_table_entry& pte = fPageTable[
(virtualAddress - fVirtualBase) / B_PAGE_SIZE];
pte = (physicalAddress & ARM_PTE_ADDRESS_MASK)
| ARM_PTE_TYPE_SMALL_PAGE;
| ARM_MMU_L2_TYPE_SMALLEXT;

arch_cpu_invalidate_TLB_range(virtualAddress, virtualAddress + B_PAGE_SIZE);
// invalidate_TLB(virtualAddress);
Expand Down Expand Up @@ -462,8 +461,7 @@ ARMPagingMethod32Bit::IsKernelPageAccessible(addr_t virtualAddress,
ARMPagingMethod32Bit::PutPageTableInPageDir(page_directory_entry* entry,
phys_addr_t pgtablePhysical, uint32 attributes)
{
*entry = (pgtablePhysical & ARM_PDE_ADDRESS_MASK)
| ARM_PDE_TYPE_COARSE_L2_PAGE_TABLE;
*entry = (pgtablePhysical & ARM_PDE_ADDRESS_MASK) | ARM_MMU_L1_TYPE_COARSE;
// 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
Expand All @@ -480,7 +478,7 @@ ARMPagingMethod32Bit::PutPageTableEntryInTable(page_table_entry* entry,
bool globalPage)
{
page_table_entry page = (physicalAddress & ARM_PTE_ADDRESS_MASK)
| ARM_PTE_TYPE_SMALL_PAGE;
| ARM_MMU_L2_TYPE_SMALLEXT;
#if 0 //IRA
| ARM_PTE_PRESENT | (globalPage ? ARM_PTE_GLOBAL : 0)
| MemoryTypeToPageTableEntryFlags(memoryType);
Expand Down
19 changes: 1 addition & 18 deletions src/system/kernel/arch/arm/paging/32bit/paging.h
Expand Up @@ -16,25 +16,8 @@
#include <int.h>
#include <kernel.h>

#define VADDR_TO_PDENT(va) ((va) >> 20)
#define VADDR_TO_PTENT(va) (((va) & 0xff000) >> 12)
#define VADDR_TO_PGOFF(va) ((va) & 0x0fff)
#include <arm_mmu.h>

// page directory entry bits
#define ARM_PDE_TYPE_MASK 0x00000003
#define ARM_PDE_TYPE_COARSE_L2_PAGE_TABLE 0x00000001
#define ARM_PDE_TYPE_SECTION 0x00000002
#define ARM_PDE_TYPE_FINE_L2_PAGE_TABLE 0x00000003

#define ARM_PDE_ADDRESS_MASK 0xfffffc00

// page table entry bits
#define ARM_PTE_TYPE_MASK 0x00000003
#define ARM_PTE_TYPE_LARGE_PAGE 0x00000001
#define ARM_PTE_TYPE_SMALL_PAGE 0x00000002
#define ARM_PTE_TYPE_EXT_SMALL_PAGE 0x00000003

#define ARM_PTE_ADDRESS_MASK 0xfffff000

#define FIRST_USER_PGDIR_ENT (VADDR_TO_PDENT(USER_BASE))
#define NUM_USER_PGDIR_ENTS (VADDR_TO_PDENT(ROUNDUP(USER_SIZE, \
Expand Down

0 comments on commit fd6e3a1

Please sign in to comment.