pagetable.hh revision 5237
17404SAli.Saidi@ARM.com/* 27404SAli.Saidi@ARM.com * Copyright (c) 2007 The Hewlett-Packard Development Company 37404SAli.Saidi@ARM.com * All rights reserved. 47404SAli.Saidi@ARM.com * 57404SAli.Saidi@ARM.com * Redistribution and use of this software in source and binary forms, 67404SAli.Saidi@ARM.com * with or without modification, are permitted provided that the 77404SAli.Saidi@ARM.com * following conditions are met: 87404SAli.Saidi@ARM.com * 97404SAli.Saidi@ARM.com * The software must be used only for Non-Commercial Use which means any 107404SAli.Saidi@ARM.com * use which is NOT directed to receiving any direct monetary 117404SAli.Saidi@ARM.com * compensation for, or commercial advantage from such use. Illustrative 127404SAli.Saidi@ARM.com * examples of non-commercial use are academic research, personal study, 137404SAli.Saidi@ARM.com * teaching, education and corporate research & development. 147404SAli.Saidi@ARM.com * Illustrative examples of commercial use are distributing products for 157404SAli.Saidi@ARM.com * commercial advantage and providing services using the software for 167404SAli.Saidi@ARM.com * commercial advantage. 177404SAli.Saidi@ARM.com * 187404SAli.Saidi@ARM.com * If you wish to use this software or functionality therein that may be 197404SAli.Saidi@ARM.com * covered by patents for commercial use, please contact: 207404SAli.Saidi@ARM.com * Director of Intellectual Property Licensing 217404SAli.Saidi@ARM.com * Office of Strategy and Technology 227404SAli.Saidi@ARM.com * Hewlett-Packard Company 237404SAli.Saidi@ARM.com * 1501 Page Mill Road 247404SAli.Saidi@ARM.com * Palo Alto, California 94304 257404SAli.Saidi@ARM.com * 267404SAli.Saidi@ARM.com * Redistributions of source code must retain the above copyright notice, 277404SAli.Saidi@ARM.com * this list of conditions and the following disclaimer. Redistributions 287404SAli.Saidi@ARM.com * in binary form must reproduce the above copyright notice, this list of 297404SAli.Saidi@ARM.com * conditions and the following disclaimer in the documentation and/or 307404SAli.Saidi@ARM.com * other materials provided with the distribution. Neither the name of 317404SAli.Saidi@ARM.com * the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its 327404SAli.Saidi@ARM.com * contributors may be used to endorse or promote products derived from 337404SAli.Saidi@ARM.com * this software without specific prior written permission. No right of 347404SAli.Saidi@ARM.com * sublicense is granted herewith. Derivatives of the software and 357404SAli.Saidi@ARM.com * output created using the software may be prepared, but only for 367404SAli.Saidi@ARM.com * Non-Commercial Uses. Derivatives of the software may be shared with 377404SAli.Saidi@ARM.com * others provided: (i) the others agree to abide by the list of 387404SAli.Saidi@ARM.com * conditions herein which includes the Non-Commercial Use restrictions; 397404SAli.Saidi@ARM.com * and (ii) such Derivatives of the software include the above copyright 407404SAli.Saidi@ARM.com * notice to acknowledge the contribution from this software where 417404SAli.Saidi@ARM.com * applicable, this list of conditions and the disclaimer below. 427404SAli.Saidi@ARM.com * 437404SAli.Saidi@ARM.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 447728SAli.Saidi@ARM.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 457404SAli.Saidi@ARM.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 467404SAli.Saidi@ARM.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 477404SAli.Saidi@ARM.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 487404SAli.Saidi@ARM.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 497404SAli.Saidi@ARM.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 507728SAli.Saidi@ARM.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 517728SAli.Saidi@ARM.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 527439Sdam.sunwoo@arm.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 537576SAli.Saidi@ARM.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 547439Sdam.sunwoo@arm.com * 557404SAli.Saidi@ARM.com * Authors: Gabe Black 567404SAli.Saidi@ARM.com */ 577404SAli.Saidi@ARM.com 587404SAli.Saidi@ARM.com#ifndef __ARCH_X86_PAGETABLE_HH__ 597404SAli.Saidi@ARM.com#define __ARCH_X86_PAGETABLE_HH__ 607404SAli.Saidi@ARM.com 617404SAli.Saidi@ARM.com#include <iostream> 627733SAli.Saidi@ARM.com#include <string> 637404SAli.Saidi@ARM.com 647733SAli.Saidi@ARM.com#include "sim/host.hh" 657733SAli.Saidi@ARM.com#include "base/bitunion.hh" 667733SAli.Saidi@ARM.com#include "base/misc.hh" 677733SAli.Saidi@ARM.com 687733SAli.Saidi@ARM.comclass Checkpoint; 697733SAli.Saidi@ARM.com 707733SAli.Saidi@ARM.comnamespace X86ISA 717733SAli.Saidi@ARM.com{ 727733SAli.Saidi@ARM.com BitUnion64(VAddr) 737733SAli.Saidi@ARM.com Bitfield<20, 12> longl1; 747733SAli.Saidi@ARM.com Bitfield<29, 21> longl2; 757733SAli.Saidi@ARM.com Bitfield<38, 30> longl3; 767404SAli.Saidi@ARM.com Bitfield<47, 39> longl4; 777404SAli.Saidi@ARM.com 787404SAli.Saidi@ARM.com Bitfield<20, 12> pael1; 797404SAli.Saidi@ARM.com Bitfield<29, 21> pael2; 807404SAli.Saidi@ARM.com Bitfield<31, 30> pael3; 817404SAli.Saidi@ARM.com 827404SAli.Saidi@ARM.com Bitfield<21, 12> norml1; 837404SAli.Saidi@ARM.com Bitfield<31, 22> norml2; 847404SAli.Saidi@ARM.com EndBitUnion(VAddr) 857404SAli.Saidi@ARM.com 867404SAli.Saidi@ARM.com struct TlbEntry 877404SAli.Saidi@ARM.com { 887404SAli.Saidi@ARM.com // The base of the physical page. 897404SAli.Saidi@ARM.com Addr paddr; 907404SAli.Saidi@ARM.com 917404SAli.Saidi@ARM.com // The beginning of the virtual page this entry maps. 927404SAli.Saidi@ARM.com Addr vaddr; 937404SAli.Saidi@ARM.com // The size of the page this entry represents. 947404SAli.Saidi@ARM.com Addr size; 957437Sdam.sunwoo@arm.com 967404SAli.Saidi@ARM.com // Read permission is always available, assuming it isn't blocked by 977404SAli.Saidi@ARM.com // other mechanisms. 987439Sdam.sunwoo@arm.com bool writable; 997439Sdam.sunwoo@arm.com // Whether this page is accesible without being in supervisor mode. 1007439Sdam.sunwoo@arm.com bool user; 1017439Sdam.sunwoo@arm.com // Whether to use write through or write back. M5 ignores this and 1027439Sdam.sunwoo@arm.com // lets the caches handle the writeback policy. 1037404SAli.Saidi@ARM.com //bool pwt; 1047439Sdam.sunwoo@arm.com // Whether the page is cacheable or not. 1057439Sdam.sunwoo@arm.com bool uncacheable; 1067439Sdam.sunwoo@arm.com // Whether or not to kick this page out on a write to CR3. 1077439Sdam.sunwoo@arm.com bool global; 1087439Sdam.sunwoo@arm.com // A bit used to form an index into the PAT table. 1097439Sdam.sunwoo@arm.com bool patBit; 1107439Sdam.sunwoo@arm.com // Whether or not memory on this page can be executed. 1117439Sdam.sunwoo@arm.com bool noExec; 1127439Sdam.sunwoo@arm.com 1137439Sdam.sunwoo@arm.com TlbEntry(Addr asn, Addr _vaddr, Addr _paddr); 1147439Sdam.sunwoo@arm.com TlbEntry() {} 1157439Sdam.sunwoo@arm.com 1167439Sdam.sunwoo@arm.com Addr pageStart() 1177439Sdam.sunwoo@arm.com { 1187404SAli.Saidi@ARM.com return paddr; 1197436Sdam.sunwoo@arm.com } 1207436Sdam.sunwoo@arm.com 1217720Sgblack@eecs.umich.edu void serialize(std::ostream &os); 1227439Sdam.sunwoo@arm.com void unserialize(Checkpoint *cp, const std::string §ion); 1237439Sdam.sunwoo@arm.com }; 1247439Sdam.sunwoo@arm.com} 1257439Sdam.sunwoo@arm.com 1267439Sdam.sunwoo@arm.com#endif 1277439Sdam.sunwoo@arm.com