os/kernelhwsrv/kernel/eka/include/memmodel/epoc/flexible/x86/mmboot.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 /**
    17  @file
    18  @publishedPartner
    19  @prototype
    20 */
    21 
    22 #ifndef __MMBOOT_H__
    23 #define __MMBOOT_H__
    24 
    25 // Linear address map
    26 // 00000000-003FFFFF	Unmapped
    27 // 00400000-7FFFFFFF	Local data
    28 // 80000000-			ROM
    29 //         -8FFFFFFF	Global user area
    30 // 90000000-EFFFFFFF	Kernel memory
    31 // F0000000-FEBFFFFF	Fixed kernel mappings
    32 // FEC00000-FEFFFFFF	IO APIC + Local APIC
    33 // FF000000-FFFFFFFF	???
    34 
    35 // Linear addresses
    36 
    37 const TLinAddr KUserLocalDataBase		=0x00400000u;
    38 
    39 const TLinAddr KUserLocalDataEnd		=0x80000000u;
    40 
    41 /** Everything above here is global (visible to all processes).*/
    42 const TLinAddr KGlobalMemoryBase		=0x80000000u;
    43 
    44 const TLinAddr KRomLinearBase			=0x80000000u;
    45 
    46 /** Everything below here has user access permissions, everything above is supervisor only. */
    47 const TLinAddr KUserMemoryLimit			=0x90000000u;
    48 
    49 const TLinAddr KKernelSectionBase		=0x90000000u;
    50 
    51 const TLinAddr KPrimaryIOBase			=0xC6000000u; // XXX This magic constant is hard coded into baseports!
    52 const TLinAddr KPrimaryIOEnd			=0xC8000000u;
    53 
    54 const TLinAddr KKernelDataBase			=0xC8000000u;
    55 
    56 const TLinAddr KKernelSectionEnd		=0xF0000000u;
    57 
    58 const TLinAddr KSuperPageLinAddr		=0xF0000000u;
    59 const TLinAddr KMachineConfigLinAddr	=0xF0000800u;
    60 
    61 const TLinAddr KPageInfoMap				=0xF0010000u;
    62 const TLinAddr KApTrampolinePageLin		=0xF0040000u;
    63 const TLinAddr KTempAddr				=0xF0080000u;
    64 const TLinAddr KTempAddrEnd				=0xF0100000u;
    65 const TLinAddr KBiosInfoLin				=0xF0100000u;	// RAM info + MP info
    66 
    67 const TLinAddr KPageTableInfoBase		=0xF0C00000u;
    68 const TLinAddr KPageTableInfoEnd		=0xF1000000u;
    69 
    70 const TLinAddr KPageArraySegmentBase	=0xF1000000u;
    71 const TLinAddr KPageArraySegmentEnd		=0xF2000000u;
    72 
    73 const TLinAddr KPageInfoLinearBase		=0xF2000000u;
    74 const TLinAddr KPageInfoLinearEnd		=0xF4000000u;
    75 
    76 const TLinAddr KPageDirectoryBase		=0xF4000000u;
    77 const TLinAddr KPageDirectoryEnd		=0xF5000000u;
    78 
    79 const TLinAddr KIPCAlias				=0xF6000000u;
    80 const TLinAddr KIPCAliasAreaSize		=0x02000000u;
    81 
    82 const TLinAddr KPageTableBase			=0xF8000000u;
    83 const TLinAddr KPageTableEnd			=0xFEC00000u;
    84 
    85 										// FEC00000-FEFFFFFF	IO APIC + Local APIC
    86 
    87 
    88 
    89 // Constants for X86 MMU
    90 #ifndef __KPAGESIZE_DEFINED__
    91 const TInt KPageShift=12;
    92 const TInt KPageSize=1<<KPageShift;
    93 const TInt KPageMask=KPageSize-1;
    94 #define __KPAGESIZE_DEFINED__
    95 #endif
    96 const TInt KChunkShift=22;
    97 const TInt KChunkSize=1<<KChunkShift;
    98 const TInt KChunkMask=KChunkSize-1;
    99 const TInt KPageTableShift=KChunkShift-KPageShift+2;	// PTE is 4 bytes
   100 const TInt KPageTableSize=1<<KPageTableShift;
   101 const TInt KPageTableMask=KPageTableSize-1;
   102 const TInt KPtClusterShift=KPageShift-KPageTableShift;
   103 const TInt KPtClusterSize=1<<KPtClusterShift;
   104 const TInt KPtClusterMask=KPtClusterSize-1;
   105 const TInt KPtBlockShift=KPageShift-4;					/**< @internalTechnology */	// sizeof(SPageTableInfo)=16
   106 const TInt KPtBlockSize=1<<KPtBlockShift;				/**< @internalTechnology */
   107 const TInt KPtBlockMask=KPtBlockSize-1;					/**< @internalTechnology */
   108 const TInt KPagesInPDEShift=KChunkShift-KPageShift;
   109 const TInt KPagesInPDE=1<<KPagesInPDEShift;
   110 const TInt KPagesInPDEMask=KPagesInPDE-1;
   111 
   112 const TInt KPageDirectoryShift=32-KChunkShift+2;		// PDE is 4 bytes
   113 const TInt KPageDirectorySize=1<<KPageDirectoryShift;
   114 const TInt KPageDirectoryMask=KPageDirectorySize-1;
   115 
   116 const TInt KNumOsAsids=1024;
   117 const TUint KKernelOsAsid=0;
   118 
   119 const TUint32 KPdePtePresent=0x01;
   120 const TUint32 KPdePteWrite=0x02;
   121 const TUint32 KPdePteUser=0x04;
   122 const TUint32 KPdePteWriteThrough=0x08;
   123 const TUint32 KPdePteUncached=0x10;
   124 const TUint32 KPdePteAccessed=0x20;
   125 const TUint32 KPdePteDirty=0x40;
   126 const TUint32 KPdeLargePage=0x80;						// Pentium and above, not 486
   127 const TUint32 KPdePteGlobal=0x100;						// P6 and above, not 486 or Pentium
   128 
   129 const TUint32 KPdePtePhysAddrMask=0xfffff000u;
   130 const TUint32 KPdeLargePagePhysAddrMask=0xffc00000u;	// Pentium and above, not 486
   131 const TUint32 KPdeUnallocatedEntry=0;
   132 const TUint32 KPteUnallocatedEntry=0;
   133 const TUint32 KPdeMatchMask=KPdePteAccessed|KPdePteDirty|KPdePteUser|KPdePteWrite; // ignore 'user' and 'write' in PDEs
   134 const TUint32 KPteMatchMask=KPdePteAccessed|KPdePteDirty;
   135 
   136 const TInt KPageInfoShift = 5;
   137 
   138 const TInt KPageColourShift=0;
   139 const TInt KPageColourCount=(1<<KPageColourShift);
   140 const TInt KPageColourMask=KPageColourCount-1;
   141 
   142 #endif	// __MMBOOT_H__