gem5  v20.1.0.0
tlb.cc
Go to the documentation of this file.
1 /*
2  * Copyright 2019 Google Inc.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met: redistributions of source code must retain the above copyright
7  * notice, this list of conditions and the following disclaimer;
8  * redistributions in binary form must reproduce the above copyright
9  * notice, this list of conditions and the following disclaimer in the
10  * documentation and/or other materials provided with the distribution;
11  * neither the name of the copyright holders nor the names of its
12  * contributors may be used to endorse or promote products derived from
13  * this software without specific prior written permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
29 
32 #include "params/IrisTLB.hh"
33 #include "sim/faults.hh"
34 
35 Fault
37  const RequestPtr &req, ::ThreadContext *tc, Mode mode)
38 {
39  auto *itc = dynamic_cast<Iris::ThreadContext *>(tc);
40  panic_if(!itc, "Failed to cast to Iris::ThreadContext *");
41 
42  Addr vaddr = req->getVaddr();
43  Addr paddr = 0;
44  bool success = itc->translateAddress(paddr, vaddr);
45  if (!success) {
46  return std::make_shared<GenericISA::M5PanicFault>(
47  "Failed translation");
48  } else {
49  req->setPaddr(paddr);
50  return NoFault;
51  }
52 }
53 
54 Fault
56  const RequestPtr &req, ::ThreadContext *tc, Mode mode)
57 {
58  return translateFunctional(req, tc, mode);
59 }
60 
61 void
63  Translation *translation, Mode mode)
64 {
65  assert(translation);
66  translation->finish(translateAtomic(req, tc, mode), req, tc, mode);
67 }
68 
69 Iris::TLB *
70 IrisTLBParams::create()
71 {
72  return new Iris::TLB(this);
73 }
BaseTLB::Translation::finish
virtual void finish(const Fault &fault, const RequestPtr &req, ThreadContext *tc, Mode mode)=0
BaseTLB::Mode
Mode
Definition: tlb.hh:57
RequestPtr
std::shared_ptr< Request > RequestPtr
Definition: request.hh:82
faults.hh
Iris::TLB::translateAtomic
Fault translateAtomic(const RequestPtr &req, ::ThreadContext *tc, Mode mode) override
Definition: tlb.cc:55
Fault
std::shared_ptr< FaultBase > Fault
Definition: types.hh:240
MipsISA::vaddr
vaddr
Definition: pra_constants.hh:275
ArmISA::mode
Bitfield< 4, 0 > mode
Definition: miscregs_types.hh:70
BaseTLB::Translation
Definition: tlb.hh:59
NoFault
constexpr decltype(nullptr) NoFault
Definition: types.hh:245
Iris::TLB
Definition: tlb.hh:36
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
tlb.hh
panic_if
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
Definition: logging.hh:197
Iris::TLB::translateTiming
void translateTiming(const RequestPtr &req, ::ThreadContext *tc, Translation *translation, Mode mode) override
Definition: tlb.cc:62
Iris::TLB::translateFunctional
Fault translateFunctional(const RequestPtr &req, ::ThreadContext *tc, Mode mode) override
Definition: tlb.cc:36
debugfaults.hh
thread_context.hh
Iris::ThreadContext
Definition: thread_context.hh:47

Generated on Wed Sep 30 2020 14:01:59 for gem5 by doxygen 1.8.17