request.hh (13954:2f400a5f2627) request.hh (14297:b4519e586f5e)
1/*
2 * Copyright (c) 2012-2013,2017-2018 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

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

384
385 /** program counter of initiating access; for tracing/debugging */
386 Addr _pc;
387
388 /** Sequence number of the instruction that creates the request */
389 InstSeqNum _reqInstSeqNum;
390
391 /** A pointer to an atomic operation */
1/*
2 * Copyright (c) 2012-2013,2017-2018 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

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

384
385 /** program counter of initiating access; for tracing/debugging */
386 Addr _pc;
387
388 /** Sequence number of the instruction that creates the request */
389 InstSeqNum _reqInstSeqNum;
390
391 /** A pointer to an atomic operation */
392 AtomicOpFunctor *atomicOpFunctor;
392 AtomicOpFunctorPtr atomicOpFunctor;
393
394 public:
395
396 /**
397 * Minimal constructor. No fields are initialized. (Note that
398 * _flags and privateFlags are cleared by Flags default
399 * constructor.)
400 */

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

465 accessDelta(0), depth(0)
466 {
467 setVirt(asid, vaddr, size, flags, mid, pc);
468 setContext(cid);
469 }
470
471 Request(uint64_t asid, Addr vaddr, unsigned size, Flags flags,
472 MasterID mid, Addr pc, ContextID cid,
393
394 public:
395
396 /**
397 * Minimal constructor. No fields are initialized. (Note that
398 * _flags and privateFlags are cleared by Flags default
399 * constructor.)
400 */

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

465 accessDelta(0), depth(0)
466 {
467 setVirt(asid, vaddr, size, flags, mid, pc);
468 setContext(cid);
469 }
470
471 Request(uint64_t asid, Addr vaddr, unsigned size, Flags flags,
472 MasterID mid, Addr pc, ContextID cid,
473 AtomicOpFunctor *atomic_op)
473 AtomicOpFunctorPtr atomic_op)
474 {
474 {
475 setVirt(asid, vaddr, size, flags, mid, pc, atomic_op);
475 setVirt(asid, vaddr, size, flags, mid, pc, std::move(atomic_op));
476 setContext(cid);
477 }
478
479 Request(const Request& other)
480 : _paddr(other._paddr), _size(other._size),
481 _masterId(other._masterId),
482 _flags(other._flags),
483 _memSpaceConfigFlags(other._memSpaceConfigFlags),
484 privateFlags(other.privateFlags),
485 _time(other._time),
486 _taskId(other._taskId), _asid(other._asid), _vaddr(other._vaddr),
487 _extraData(other._extraData), _contextId(other._contextId),
488 _pc(other._pc), _reqInstSeqNum(other._reqInstSeqNum),
489 translateDelta(other.translateDelta),
490 accessDelta(other.accessDelta), depth(other.depth)
491 {
476 setContext(cid);
477 }
478
479 Request(const Request& other)
480 : _paddr(other._paddr), _size(other._size),
481 _masterId(other._masterId),
482 _flags(other._flags),
483 _memSpaceConfigFlags(other._memSpaceConfigFlags),
484 privateFlags(other.privateFlags),
485 _time(other._time),
486 _taskId(other._taskId), _asid(other._asid), _vaddr(other._vaddr),
487 _extraData(other._extraData), _contextId(other._contextId),
488 _pc(other._pc), _reqInstSeqNum(other._reqInstSeqNum),
489 translateDelta(other.translateDelta),
490 accessDelta(other.accessDelta), depth(other.depth)
491 {
492 if (other.atomicOpFunctor)
493 atomicOpFunctor = (other.atomicOpFunctor)->clone();
494 else
495 atomicOpFunctor = nullptr;
496 }
497
492
498 ~Request()
499 {
500 if (hasAtomicOpFunctor()) {
501 delete atomicOpFunctor;
502 }
493 atomicOpFunctor.reset(other.atomicOpFunctor ?
494 other.atomicOpFunctor->clone() : nullptr);
503 }
504
495 }
496
497 ~Request() {}
498
505 /**
506 * Set up Context numbers.
507 */
508 void
509 setContext(ContextID context_id)
510 {
511 _contextId = context_id;
512 privateFlags.set(VALID_CONTEXT_ID);

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

528 }
529
530 /**
531 * Set up a virtual (e.g., CPU) request in a previously
532 * allocated Request object.
533 */
534 void
535 setVirt(uint64_t asid, Addr vaddr, unsigned size, Flags flags,
499 /**
500 * Set up Context numbers.
501 */
502 void
503 setContext(ContextID context_id)
504 {
505 _contextId = context_id;
506 privateFlags.set(VALID_CONTEXT_ID);

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

522 }
523
524 /**
525 * Set up a virtual (e.g., CPU) request in a previously
526 * allocated Request object.
527 */
528 void
529 setVirt(uint64_t asid, Addr vaddr, unsigned size, Flags flags,
536 MasterID mid, Addr pc, AtomicOpFunctor *amo_op = nullptr)
530 MasterID mid, Addr pc, AtomicOpFunctorPtr amo_op = nullptr)
537 {
538 _asid = asid;
539 _vaddr = vaddr;
540 _size = size;
541 _masterId = mid;
542 _pc = pc;
543 _time = curTick();
544
545 _flags.clear(~STICKY_FLAGS);
546 _flags.set(flags);
547 privateFlags.clear(~STICKY_PRIVATE_FLAGS);
548 privateFlags.set(VALID_VADDR|VALID_SIZE|VALID_PC);
549 depth = 0;
550 accessDelta = 0;
551 translateDelta = 0;
531 {
532 _asid = asid;
533 _vaddr = vaddr;
534 _size = size;
535 _masterId = mid;
536 _pc = pc;
537 _time = curTick();
538
539 _flags.clear(~STICKY_FLAGS);
540 _flags.set(flags);
541 privateFlags.clear(~STICKY_PRIVATE_FLAGS);
542 privateFlags.set(VALID_VADDR|VALID_SIZE|VALID_PC);
543 depth = 0;
544 accessDelta = 0;
545 translateDelta = 0;
552 atomicOpFunctor = amo_op;
546 atomicOpFunctor = std::move(amo_op);
553 }
554
555 /**
556 * Set just the physical address. This usually used to record the
557 * result of a translation. However, when using virtualized CPUs
558 * setPhys() is sometimes called to finalize a physical address
559 * without a virtual address, so we can't check if the virtual
560 * address is valid.

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

664 }
665
666 /**
667 * Accessor for atomic-op functor.
668 */
669 bool
670 hasAtomicOpFunctor()
671 {
547 }
548
549 /**
550 * Set just the physical address. This usually used to record the
551 * result of a translation. However, when using virtualized CPUs
552 * setPhys() is sometimes called to finalize a physical address
553 * without a virtual address, so we can't check if the virtual
554 * address is valid.

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

658 }
659
660 /**
661 * Accessor for atomic-op functor.
662 */
663 bool
664 hasAtomicOpFunctor()
665 {
672 return atomicOpFunctor != NULL;
666 return (bool)atomicOpFunctor;
673 }
674
675 AtomicOpFunctor *
676 getAtomicOpFunctor()
677 {
667 }
668
669 AtomicOpFunctor *
670 getAtomicOpFunctor()
671 {
678 assert(atomicOpFunctor != NULL);
679 return atomicOpFunctor;
672 assert(atomicOpFunctor);
673 return atomicOpFunctor.get();
680 }
681
682 /** Accessor for flags. */
683 Flags
684 getFlags()
685 {
686 assert(privateFlags.isSet(VALID_PADDR|VALID_VADDR));
687 return _flags;

--- 337 unchanged lines hidden ---
674 }
675
676 /** Accessor for flags. */
677 Flags
678 getFlags()
679 {
680 assert(privateFlags.isSet(VALID_PADDR|VALID_VADDR));
681 return _flags;

--- 337 unchanged lines hidden ---