os/kernelhwsrv/kernel/eka/include/memmodel/epoc/flexible/x86/mmboot.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kernel/eka/include/memmodel/epoc/flexible/x86/mmboot.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,142 @@
     1.4 +// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +/**
    1.20 + @file
    1.21 + @publishedPartner
    1.22 + @prototype
    1.23 +*/
    1.24 +
    1.25 +#ifndef __MMBOOT_H__
    1.26 +#define __MMBOOT_H__
    1.27 +
    1.28 +// Linear address map
    1.29 +// 00000000-003FFFFF	Unmapped
    1.30 +// 00400000-7FFFFFFF	Local data
    1.31 +// 80000000-			ROM
    1.32 +//         -8FFFFFFF	Global user area
    1.33 +// 90000000-EFFFFFFF	Kernel memory
    1.34 +// F0000000-FEBFFFFF	Fixed kernel mappings
    1.35 +// FEC00000-FEFFFFFF	IO APIC + Local APIC
    1.36 +// FF000000-FFFFFFFF	???
    1.37 +
    1.38 +// Linear addresses
    1.39 +
    1.40 +const TLinAddr KUserLocalDataBase		=0x00400000u;
    1.41 +
    1.42 +const TLinAddr KUserLocalDataEnd		=0x80000000u;
    1.43 +
    1.44 +/** Everything above here is global (visible to all processes).*/
    1.45 +const TLinAddr KGlobalMemoryBase		=0x80000000u;
    1.46 +
    1.47 +const TLinAddr KRomLinearBase			=0x80000000u;
    1.48 +
    1.49 +/** Everything below here has user access permissions, everything above is supervisor only. */
    1.50 +const TLinAddr KUserMemoryLimit			=0x90000000u;
    1.51 +
    1.52 +const TLinAddr KKernelSectionBase		=0x90000000u;
    1.53 +
    1.54 +const TLinAddr KPrimaryIOBase			=0xC6000000u; // XXX This magic constant is hard coded into baseports!
    1.55 +const TLinAddr KPrimaryIOEnd			=0xC8000000u;
    1.56 +
    1.57 +const TLinAddr KKernelDataBase			=0xC8000000u;
    1.58 +
    1.59 +const TLinAddr KKernelSectionEnd		=0xF0000000u;
    1.60 +
    1.61 +const TLinAddr KSuperPageLinAddr		=0xF0000000u;
    1.62 +const TLinAddr KMachineConfigLinAddr	=0xF0000800u;
    1.63 +
    1.64 +const TLinAddr KPageInfoMap				=0xF0010000u;
    1.65 +const TLinAddr KApTrampolinePageLin		=0xF0040000u;
    1.66 +const TLinAddr KTempAddr				=0xF0080000u;
    1.67 +const TLinAddr KTempAddrEnd				=0xF0100000u;
    1.68 +const TLinAddr KBiosInfoLin				=0xF0100000u;	// RAM info + MP info
    1.69 +
    1.70 +const TLinAddr KPageTableInfoBase		=0xF0C00000u;
    1.71 +const TLinAddr KPageTableInfoEnd		=0xF1000000u;
    1.72 +
    1.73 +const TLinAddr KPageArraySegmentBase	=0xF1000000u;
    1.74 +const TLinAddr KPageArraySegmentEnd		=0xF2000000u;
    1.75 +
    1.76 +const TLinAddr KPageInfoLinearBase		=0xF2000000u;
    1.77 +const TLinAddr KPageInfoLinearEnd		=0xF4000000u;
    1.78 +
    1.79 +const TLinAddr KPageDirectoryBase		=0xF4000000u;
    1.80 +const TLinAddr KPageDirectoryEnd		=0xF5000000u;
    1.81 +
    1.82 +const TLinAddr KIPCAlias				=0xF6000000u;
    1.83 +const TLinAddr KIPCAliasAreaSize		=0x02000000u;
    1.84 +
    1.85 +const TLinAddr KPageTableBase			=0xF8000000u;
    1.86 +const TLinAddr KPageTableEnd			=0xFEC00000u;
    1.87 +
    1.88 +										// FEC00000-FEFFFFFF	IO APIC + Local APIC
    1.89 +
    1.90 +
    1.91 +
    1.92 +// Constants for X86 MMU
    1.93 +#ifndef __KPAGESIZE_DEFINED__
    1.94 +const TInt KPageShift=12;
    1.95 +const TInt KPageSize=1<<KPageShift;
    1.96 +const TInt KPageMask=KPageSize-1;
    1.97 +#define __KPAGESIZE_DEFINED__
    1.98 +#endif
    1.99 +const TInt KChunkShift=22;
   1.100 +const TInt KChunkSize=1<<KChunkShift;
   1.101 +const TInt KChunkMask=KChunkSize-1;
   1.102 +const TInt KPageTableShift=KChunkShift-KPageShift+2;	// PTE is 4 bytes
   1.103 +const TInt KPageTableSize=1<<KPageTableShift;
   1.104 +const TInt KPageTableMask=KPageTableSize-1;
   1.105 +const TInt KPtClusterShift=KPageShift-KPageTableShift;
   1.106 +const TInt KPtClusterSize=1<<KPtClusterShift;
   1.107 +const TInt KPtClusterMask=KPtClusterSize-1;
   1.108 +const TInt KPtBlockShift=KPageShift-4;					/**< @internalTechnology */	// sizeof(SPageTableInfo)=16
   1.109 +const TInt KPtBlockSize=1<<KPtBlockShift;				/**< @internalTechnology */
   1.110 +const TInt KPtBlockMask=KPtBlockSize-1;					/**< @internalTechnology */
   1.111 +const TInt KPagesInPDEShift=KChunkShift-KPageShift;
   1.112 +const TInt KPagesInPDE=1<<KPagesInPDEShift;
   1.113 +const TInt KPagesInPDEMask=KPagesInPDE-1;
   1.114 +
   1.115 +const TInt KPageDirectoryShift=32-KChunkShift+2;		// PDE is 4 bytes
   1.116 +const TInt KPageDirectorySize=1<<KPageDirectoryShift;
   1.117 +const TInt KPageDirectoryMask=KPageDirectorySize-1;
   1.118 +
   1.119 +const TInt KNumOsAsids=1024;
   1.120 +const TUint KKernelOsAsid=0;
   1.121 +
   1.122 +const TUint32 KPdePtePresent=0x01;
   1.123 +const TUint32 KPdePteWrite=0x02;
   1.124 +const TUint32 KPdePteUser=0x04;
   1.125 +const TUint32 KPdePteWriteThrough=0x08;
   1.126 +const TUint32 KPdePteUncached=0x10;
   1.127 +const TUint32 KPdePteAccessed=0x20;
   1.128 +const TUint32 KPdePteDirty=0x40;
   1.129 +const TUint32 KPdeLargePage=0x80;						// Pentium and above, not 486
   1.130 +const TUint32 KPdePteGlobal=0x100;						// P6 and above, not 486 or Pentium
   1.131 +
   1.132 +const TUint32 KPdePtePhysAddrMask=0xfffff000u;
   1.133 +const TUint32 KPdeLargePagePhysAddrMask=0xffc00000u;	// Pentium and above, not 486
   1.134 +const TUint32 KPdeUnallocatedEntry=0;
   1.135 +const TUint32 KPteUnallocatedEntry=0;
   1.136 +const TUint32 KPdeMatchMask=KPdePteAccessed|KPdePteDirty|KPdePteUser|KPdePteWrite; // ignore 'user' and 'write' in PDEs
   1.137 +const TUint32 KPteMatchMask=KPdePteAccessed|KPdePteDirty;
   1.138 +
   1.139 +const TInt KPageInfoShift = 5;
   1.140 +
   1.141 +const TInt KPageColourShift=0;
   1.142 +const TInt KPageColourCount=(1<<KPageColourShift);
   1.143 +const TInt KPageColourMask=KPageColourCount-1;
   1.144 +
   1.145 +#endif	// __MMBOOT_H__