pagetable.hh revision 5877
16019Shines@cs.fsu.edu/* 210037SARM gem5 Developers * Copyright (c) 2007 The Hewlett-Packard Development Company 37399SAli.Saidi@ARM.com * All rights reserved. 47399SAli.Saidi@ARM.com * 57399SAli.Saidi@ARM.com * Redistribution and use of this software in source and binary forms, 67399SAli.Saidi@ARM.com * with or without modification, are permitted provided that the 77399SAli.Saidi@ARM.com * following conditions are met: 87399SAli.Saidi@ARM.com * 97399SAli.Saidi@ARM.com * The software must be used only for Non-Commercial Use which means any 107399SAli.Saidi@ARM.com * use which is NOT directed to receiving any direct monetary 117399SAli.Saidi@ARM.com * compensation for, or commercial advantage from such use. Illustrative 127399SAli.Saidi@ARM.com * examples of non-commercial use are academic research, personal study, 137399SAli.Saidi@ARM.com * teaching, education and corporate research & development. 146019Shines@cs.fsu.edu * Illustrative examples of commercial use are distributing products for 156019Shines@cs.fsu.edu * commercial advantage and providing services using the software for 166019Shines@cs.fsu.edu * commercial advantage. 176019Shines@cs.fsu.edu * 186019Shines@cs.fsu.edu * If you wish to use this software or functionality therein that may be 196019Shines@cs.fsu.edu * covered by patents for commercial use, please contact: 206019Shines@cs.fsu.edu * Director of Intellectual Property Licensing 216019Shines@cs.fsu.edu * Office of Strategy and Technology 226019Shines@cs.fsu.edu * Hewlett-Packard Company 236019Shines@cs.fsu.edu * 1501 Page Mill Road 246019Shines@cs.fsu.edu * Palo Alto, California 94304 256019Shines@cs.fsu.edu * 266019Shines@cs.fsu.edu * Redistributions of source code must retain the above copyright notice, 276019Shines@cs.fsu.edu * this list of conditions and the following disclaimer. Redistributions 286019Shines@cs.fsu.edu * in binary form must reproduce the above copyright notice, this list of 296019Shines@cs.fsu.edu * conditions and the following disclaimer in the documentation and/or 306019Shines@cs.fsu.edu * other materials provided with the distribution. Neither the name of 316019Shines@cs.fsu.edu * the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its 326019Shines@cs.fsu.edu * contributors may be used to endorse or promote products derived from 336019Shines@cs.fsu.edu * this software without specific prior written permission. No right of 346019Shines@cs.fsu.edu * sublicense is granted herewith. Derivatives of the software and 356019Shines@cs.fsu.edu * output created using the software may be prepared, but only for 366019Shines@cs.fsu.edu * Non-Commercial Uses. Derivatives of the software may be shared with 376019Shines@cs.fsu.edu * others provided: (i) the others agree to abide by the list of 386019Shines@cs.fsu.edu * conditions herein which includes the Non-Commercial Use restrictions; 396019Shines@cs.fsu.edu * and (ii) such Derivatives of the software include the above copyright 407399SAli.Saidi@ARM.com * notice to acknowledge the contribution from this software where 416019Shines@cs.fsu.edu * applicable, this list of conditions and the disclaimer below. 426019Shines@cs.fsu.edu * 436019Shines@cs.fsu.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 446019Shines@cs.fsu.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 456019Shines@cs.fsu.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 466019Shines@cs.fsu.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 476019Shines@cs.fsu.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 488229Snate@binkert.org * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 496019Shines@cs.fsu.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 506019Shines@cs.fsu.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 5110687SAndreas.Sandberg@ARM.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 526019Shines@cs.fsu.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 536019Shines@cs.fsu.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 546116Snate@binkert.org * 5510463SAndreas.Sandberg@ARM.com * Authors: Gabe Black 566019Shines@cs.fsu.edu */ 576019Shines@cs.fsu.edu 586019Shines@cs.fsu.edu#ifndef __ARCH_X86_PAGETABLE_HH__ 596019Shines@cs.fsu.edu#define __ARCH_X86_PAGETABLE_HH__ 606019Shines@cs.fsu.edu 617404SAli.Saidi@ARM.com#include <iostream> 6210037SARM gem5 Developers#include <string> 6310037SARM gem5 Developers 6411395Sandreas.sandberg@arm.com#include "sim/host.hh" 6511395Sandreas.sandberg@arm.com#include "base/bitunion.hh" 6611395Sandreas.sandberg@arm.com#include "base/misc.hh" 6711395Sandreas.sandberg@arm.com 6811395Sandreas.sandberg@arm.comclass Checkpoint; 6911395Sandreas.sandberg@arm.com 7011395Sandreas.sandberg@arm.comnamespace X86ISA 7111395Sandreas.sandberg@arm.com{ 7211395Sandreas.sandberg@arm.com BitUnion64(VAddr) 7311395Sandreas.sandberg@arm.com Bitfield<20, 12> longl1; 7411395Sandreas.sandberg@arm.com Bitfield<29, 21> longl2; 7511395Sandreas.sandberg@arm.com Bitfield<38, 30> longl3; 7611395Sandreas.sandberg@arm.com Bitfield<47, 39> longl4; 7711395Sandreas.sandberg@arm.com 7811395Sandreas.sandberg@arm.com Bitfield<20, 12> pael1; 7911395Sandreas.sandberg@arm.com Bitfield<29, 21> pael2; 8011395Sandreas.sandberg@arm.com Bitfield<31, 30> pael3; 8111395Sandreas.sandberg@arm.com 8211395Sandreas.sandberg@arm.com Bitfield<21, 12> norml1; 8311395Sandreas.sandberg@arm.com Bitfield<31, 22> norml2; 8411395Sandreas.sandberg@arm.com EndBitUnion(VAddr) 8511395Sandreas.sandberg@arm.com 8611395Sandreas.sandberg@arm.com struct TlbEntry 8711395Sandreas.sandberg@arm.com { 8811395Sandreas.sandberg@arm.com // The base of the physical page. 8911395Sandreas.sandberg@arm.com Addr paddr; 9011395Sandreas.sandberg@arm.com 9111395Sandreas.sandberg@arm.com // The beginning of the virtual page this entry maps. 9211395Sandreas.sandberg@arm.com Addr vaddr; 9311395Sandreas.sandberg@arm.com // The size of the page this entry represents. 9411395Sandreas.sandberg@arm.com Addr size; 9511395Sandreas.sandberg@arm.com 9611395Sandreas.sandberg@arm.com // Read permission is always available, assuming it isn't blocked by 9711395Sandreas.sandberg@arm.com // other mechanisms. 9811395Sandreas.sandberg@arm.com bool writable; 9911395Sandreas.sandberg@arm.com // Whether this page is accesible without being in supervisor mode. 10011395Sandreas.sandberg@arm.com bool user; 1017404SAli.Saidi@ARM.com // Whether to use write through or write back. M5 ignores this and 1026019Shines@cs.fsu.edu // lets the caches handle the writeback policy. 1036019Shines@cs.fsu.edu //bool pwt; 1047294Sgblack@eecs.umich.edu // Whether the page is cacheable or not. 1057294Sgblack@eecs.umich.edu bool uncacheable; 10610037SARM gem5 Developers // Whether or not to kick this page out on a write to CR3. 1077294Sgblack@eecs.umich.edu bool global; 1087294Sgblack@eecs.umich.edu // A bit used to form an index into the PAT table. 1097294Sgblack@eecs.umich.edu bool patBit; 11010037SARM gem5 Developers // Whether or not memory on this page can be executed. 11110037SARM gem5 Developers bool noExec; 11210037SARM gem5 Developers 11310037SARM gem5 Developers TlbEntry(Addr asn, Addr _vaddr, Addr _paddr); 1147294Sgblack@eecs.umich.edu TlbEntry() {} 11510037SARM gem5 Developers 1167404SAli.Saidi@ARM.com void 11710037SARM gem5 Developers updateVaddr(Addr new_vaddr) 1187294Sgblack@eecs.umich.edu { 1197294Sgblack@eecs.umich.edu vaddr = new_vaddr; 1207294Sgblack@eecs.umich.edu } 12110037SARM gem5 Developers 12210037SARM gem5 Developers Addr pageStart() 12310037SARM gem5 Developers { 12410037SARM gem5 Developers return paddr; 12510037SARM gem5 Developers } 12610037SARM gem5 Developers 12710037SARM gem5 Developers void serialize(std::ostream &os); 12810037SARM gem5 Developers void unserialize(Checkpoint *cp, const std::string §ion); 12910037SARM gem5 Developers }; 13010037SARM gem5 Developers} 1317294Sgblack@eecs.umich.edu 1326019Shines@cs.fsu.edu#endif 13310037SARM gem5 Developers