gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
multi_level_page_table.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 Advanced Micro Devices, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met: redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer;
9  * redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution;
12  * neither the name of the copyright holders nor the names of its
13  * contributors may be used to endorse or promote products derived from
14  * this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  *
28  * Authors: Alexandru Dutu
29  */
30 
36 #ifndef __MEM_MULTI_LEVEL_PAGE_TABLE_HH__
37 #define __MEM_MULTI_LEVEL_PAGE_TABLE_HH__
38 
39 #include <string>
40 
41 #include "arch/tlb.hh"
42 #include "base/types.hh"
43 #include "config/the_isa.hh"
44 #include "mem/page_table.hh"
45 
46 class System;
47 
103 template <class ISAOps>
105 {
109  ISAOps pTableISAOps;
110 
115 
120 
125 
129  const uint64_t numLevels;
130 
140  bool walk(Addr vaddr, bool allocate, Addr &PTE_addr);
141 
142 public:
143  MultiLevelPageTable(const std::string &__name, uint64_t _pid,
144  System *_sys);
146 
147  void initState(ThreadContext* tc) override;
148 
149  void map(Addr vaddr, Addr paddr, int64_t size,
150  uint64_t flags = 0) override;
151  void remap(Addr vaddr, int64_t size, Addr new_vaddr) override;
152  void unmap(Addr vaddr, int64_t size) override;
153  bool isUnmapped(Addr vaddr, int64_t size) override;
154  bool lookup(Addr vaddr, TheISA::TlbEntry &entry) override;
155  void serialize(CheckpointOut &cp) const override;
156  void unserialize(CheckpointIn &cp) override;
157 };
158 #endif // __MEM_MULTI_LEVEL_PAGE_TABLE_HH__
ISAOps pTableISAOps
ISA specific operations.
Definition: system.hh:83
ThreadContext is the external interface to all thread state for anything outside of the CPU...
MultiLevelPageTable(const std::string &__name, uint64_t _pid, System *_sys)
bool lookup(Addr vaddr, TheISA::TlbEntry &entry) override
Lookup function.
void initState(ThreadContext *tc) override
const uint64_t numLevels
Number of levels contained by the page table.
void remap(Addr vaddr, int64_t size, Addr new_vaddr) override
TlbEntry(Addr asn, Addr _vaddr, Addr _paddr, bool uncacheable, bool read_only)
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
Declaration of base class for page table.
Definition: page_table.hh:57
void map(Addr vaddr, Addr paddr, int64_t size, uint64_t flags=0) override
Maps a virtual memory region to a physical memory region.
const std::vector< uint8_t > logLevelSize
Vector with sizes of all levels in base 2 logarithmic.
bool walk(Addr vaddr, bool allocate, Addr &PTE_addr)
Method for walking the page table.
int size()
Definition: pagetable.hh:146
Declarations of a non-full system Page Table.
This class implements an in-memory multi-level page table that can be configured to follow ISA specif...
std::ostream CheckpointOut
Definition: serialize.hh:67
void unserialize(CheckpointIn &cp) override
Unserialize an object.
void unmap(Addr vaddr, int64_t size) override
Addr basePtr
Physical address to the last level of the page table.
bool isUnmapped(Addr vaddr, int64_t size) override
Check if any pages in a region are already allocated.
System * system
Pointer to System object.
void serialize(CheckpointOut &cp) const override
Serialize an object.

Generated on Fri Jun 9 2017 13:03:49 for gem5 by doxygen 1.8.6