ETISS 0.11.2
ExtendableTranslatingInstructionSetSimulator(version0.11.2)
Loading...
Searching...
No Matches
PTE.h
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-3-Clause
2//
3// This file is part of ETISS. It is licensed under the BSD 3-Clause License; you may not use this file except in
4// compliance with the License. You should have received a copy of the license along with this project. If not, see the
5// LICENSE file.
6
7#ifndef ETISS_INCLUDE_MM_PTE_H_
8#define ETISS_INCLUDE_MM_PTE_H_
9
10#include "etiss/mm/PTEFormat.h"
12
13#include "etiss/Misc.h"
14
15namespace etiss
16{
17namespace mm
18{
19
30class PTE
31{
32 public:
33 PTE() {};
34
35 PTE(uint64_t pte) { Update(pte); }
36
37 // PTE(const PTE & pte_cp_){
38 // Update(pte_cp_.pte_val_);
39
40 // }
41
42 // PTE & operator= (const PTE & pte_assign_){
43 // if (& pte_assign_ == this)
44 // return *this;
45 // Update(pte_assign_.pte_val_);
46 // return *this;
47 // }
48
53 void Update(uint64_t new_pte);
54
59 uint64_t GetByName(std::string const name) const;
60
65 void SetFlagByName(std::string name, uint64_t val);
66
71 void ClearFlagByName(std::string name);
72
77 void Dump();
78
79 uint64_t Get() const { return pte_val_; }
80
81 uint64_t GetPPN() const { return ppn_val_; }
82
83 private:
85 {
86 // In order to generate 64 bit mask, mask has to be declared
87 // as 64 bit integer.
88 if (len >= 64)
89 return static_cast<uint64_t>(-1);
90 else
91 return (static_cast<uint64_t>(1) << len) - 1;
92 }
93
94 void SetBit(uint32_t pos) { pte_val_ |= (static_cast<uint64_t>(1) << pos); }
95
96 void ClearBit(uint32_t pos) { pte_val_ &= (~(static_cast<uint64_t>(1) << pos)); }
97
98 bool CheckBit(uint32_t pos) const { return pte_val_ & (static_cast<uint64_t>(1) << pos) ? true : false; }
99
102};
103
104} // namespace mm
105} // namespace etiss
106
107#endif
general configuration and logging
static __inline__ uint32_t
Definition arm_cde.h:25
static __inline__ uint64_t
Definition arm_cde.h:31
Page Table Entry (PTE) defines the composition of Page Frame Number (PFN) and relavant flags.
Definition PTE.h:31
PTE(uint64_t pte)
Definition PTE.h:35
uint64_t ppn_val_
Definition PTE.h:100
void ClearFlagByName(std::string name)
Clear the bit field value with its name.
Definition PTE.cpp:85
uint64_t GetByName(std::string const name) const
Get the bit field value with its name.
Definition PTE.cpp:48
uint64_t GetPPN() const
Definition PTE.h:81
uint64_t Get() const
Definition PTE.h:79
bool CheckBit(uint32_t pos) const
Definition PTE.h:98
void Dump()
Dump the details of the PTE entry.
Definition PTE.cpp:104
void ClearBit(uint32_t pos)
Definition PTE.h:96
void SetBit(uint32_t pos)
Definition PTE.h:94
uint64_t pte_val_
Definition PTE.h:101
void SetFlagByName(std::string name, uint64_t val)
Set the bit field value with its name.
Definition PTE.cpp:65
void Update(uint64_t new_pte)
Update the PTE with a new value.
Definition PTE.cpp:24
uint64_t GenerateMask(uint64_t len) const
Definition PTE.h:84
forwards: include/jit/*
Definition Benchmark.h:17
#define true
Definition stdbool.h:16