tlb.cc (7404:bfc74724914e) tlb.cc (7406:ddc26bd4ea7d)
1/*
2 * Copyright (c) 2010 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 33 unchanged lines hidden (view full) ---

42 * Steve Reinhardt
43 */
44
45#include <string>
46#include <vector>
47
48#include "arch/arm/faults.hh"
49#include "arch/arm/pagetable.hh"
1/*
2 * Copyright (c) 2010 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 33 unchanged lines hidden (view full) ---

42 * Steve Reinhardt
43 */
44
45#include <string>
46#include <vector>
47
48#include "arch/arm/faults.hh"
49#include "arch/arm/pagetable.hh"
50#include "arch/arm/table_walker.hh"
51#include "arch/arm/tlb.hh"
52#include "arch/arm/utility.hh"
53#include "base/inifile.hh"
54#include "base/str.hh"
55#include "base/trace.hh"
56#include "cpu/thread_context.hh"
57#include "mem/page_table.hh"
58#include "params/ArmTLB.hh"
59#include "sim/process.hh"
60
50#include "arch/arm/tlb.hh"
51#include "arch/arm/utility.hh"
52#include "base/inifile.hh"
53#include "base/str.hh"
54#include "base/trace.hh"
55#include "cpu/thread_context.hh"
56#include "mem/page_table.hh"
57#include "params/ArmTLB.hh"
58#include "sim/process.hh"
59
60#if FULL_SYSTEM
61#include "arch/arm/table_walker.hh"
62#endif
63
61using namespace std;
62using namespace ArmISA;
63
64TLB::TLB(const Params *p)
65 : BaseTLB(p), size(p->size), nlu(0)
66#if FULL_SYSTEM
67 , tableWalker(p->walker)
68#endif
69{
70 table = new TlbEntry[size];
71 memset(table, 0, sizeof(TlbEntry[size]));
72
64using namespace std;
65using namespace ArmISA;
66
67TLB::TLB(const Params *p)
68 : BaseTLB(p), size(p->size), nlu(0)
69#if FULL_SYSTEM
70 , tableWalker(p->walker)
71#endif
72{
73 table = new TlbEntry[size];
74 memset(table, 0, sizeof(TlbEntry[size]));
75
76#if FULL_SYSTEM
73 tableWalker->setTlb(this);
77 tableWalker->setTlb(this);
78#endif
74}
75
76TLB::~TLB()
77{
78 if (table)
79 delete [] table;
80}
81

--- 205 unchanged lines hidden (view full) ---

287 .desc("DTB accesses")
288 ;
289
290 hits = read_hits + write_hits;
291 misses = read_misses + write_misses;
292 accesses = read_accesses + write_accesses;
293}
294
79}
80
81TLB::~TLB()
82{
83 if (table)
84 delete [] table;
85}
86

--- 205 unchanged lines hidden (view full) ---

292 .desc("DTB accesses")
293 ;
294
295 hits = read_hits + write_hits;
296 misses = read_misses + write_misses;
297 accesses = read_accesses + write_accesses;
298}
299
295Fault
296TLB::trickBoxCheck(RequestPtr req, Mode mode, uint8_t domain, bool sNp)
297{
298 return NoFault;
299}
300
301Fault
302TLB::walkTrickBoxCheck(Addr pa, Addr va, Addr sz, bool is_exec,
303 uint8_t domain, bool sNp)
304{
305 return NoFault;
306}
307
308#if !FULL_SYSTEM
309Fault
310TLB::translateSe(RequestPtr req, ThreadContext *tc, Mode mode,
311 Translation *translation, bool &delay, bool timing)
312{
313 // XXX Cache misc registers and have miscreg write function inv cache
314 Addr vaddr = req->getVaddr() & ~PcModeMask;
315 SCTLR sctlr = tc->readMiscReg(MISCREG_SCTLR);

--- 19 unchanged lines hidden (view full) ---

335 req->setPaddr(paddr);
336
337 return NoFault;
338}
339
340#else // FULL_SYSTEM
341
342Fault
300#if !FULL_SYSTEM
301Fault
302TLB::translateSe(RequestPtr req, ThreadContext *tc, Mode mode,
303 Translation *translation, bool &delay, bool timing)
304{
305 // XXX Cache misc registers and have miscreg write function inv cache
306 Addr vaddr = req->getVaddr() & ~PcModeMask;
307 SCTLR sctlr = tc->readMiscReg(MISCREG_SCTLR);

--- 19 unchanged lines hidden (view full) ---

327 req->setPaddr(paddr);
328
329 return NoFault;
330}
331
332#else // FULL_SYSTEM
333
334Fault
335TLB::trickBoxCheck(RequestPtr req, Mode mode, uint8_t domain, bool sNp)
336{
337 return NoFault;
338}
339
340Fault
341TLB::walkTrickBoxCheck(Addr pa, Addr va, Addr sz, bool is_exec,
342 bool is_write, uint8_t domain, bool sNp)
343{
344 return NoFault;
345}
346
347Fault
343TLB::translateFs(RequestPtr req, ThreadContext *tc, Mode mode,
344 Translation *translation, bool &delay, bool timing)
345{
346 // XXX Cache misc registers and have miscreg write function inv cache
347 Addr vaddr = req->getVaddr() & ~PcModeMask;
348 SCTLR sctlr = tc->readMiscReg(MISCREG_SCTLR);
349 CPSR cpsr = tc->readMiscReg(MISCREG_CPSR);
350 uint32_t flags = req->getFlags();

--- 79 unchanged lines hidden (view full) ---

430
431 uint8_t ap = te->ap;
432
433 if (sctlr.afe == 1)
434 ap |= 1;
435
436 bool abt;
437
348TLB::translateFs(RequestPtr req, ThreadContext *tc, Mode mode,
349 Translation *translation, bool &delay, bool timing)
350{
351 // XXX Cache misc registers and have miscreg write function inv cache
352 Addr vaddr = req->getVaddr() & ~PcModeMask;
353 SCTLR sctlr = tc->readMiscReg(MISCREG_SCTLR);
354 CPSR cpsr = tc->readMiscReg(MISCREG_CPSR);
355 uint32_t flags = req->getFlags();

--- 79 unchanged lines hidden (view full) ---

435
436 uint8_t ap = te->ap;
437
438 if (sctlr.afe == 1)
439 ap |= 1;
440
441 bool abt;
442
443 /* if (!sctlr.xp)
444 ap &= 0x3;
445*/
438 switch (ap) {
439 case 0:
446 switch (ap) {
447 case 0:
440 abt = true;
448 DPRINTF(TLB, "Access permissions 0, checking rs:%#x\n", (int)sctlr.rs);
449 if (!sctlr.xp) {
450 switch ((int)sctlr.rs) {
451 case 2:
452 abt = is_write;
453 break;
454 case 1:
455 abt = is_write || !is_priv;
456 break;
457 case 0:
458 case 3:
459 default:
460 abt = true;
461 break;
462 }
463 } else {
464 abt = true;
465 }
441 break;
442 case 1:
443 abt = !is_priv;
444 break;
445 case 2:
446 abt = !is_priv && is_write;
447 break;
448 case 3:

--- 75 unchanged lines hidden ---
466 break;
467 case 1:
468 abt = !is_priv;
469 break;
470 case 2:
471 abt = !is_priv && is_write;
472 break;
473 case 3:

--- 75 unchanged lines hidden ---