request.hh revision 6105
12381SN/A/* 22381SN/A * Copyright (c) 2002-2005 The Regents of The University of Michigan 32381SN/A * All rights reserved. 42381SN/A * 52381SN/A * Redistribution and use in source and binary forms, with or without 62381SN/A * modification, are permitted provided that the following conditions are 72381SN/A * met: redistributions of source code must retain the above copyright 82381SN/A * notice, this list of conditions and the following disclaimer; 92381SN/A * redistributions in binary form must reproduce the above copyright 102381SN/A * notice, this list of conditions and the following disclaimer in the 112381SN/A * documentation and/or other materials provided with the distribution; 122381SN/A * neither the name of the copyright holders nor the names of its 132381SN/A * contributors may be used to endorse or promote products derived from 142381SN/A * this software without specific prior written permission. 152381SN/A * 162381SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 172381SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 182381SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 192381SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 202381SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 212381SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 222381SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 232381SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 242381SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 252381SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 262381SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272665Ssaidi@eecs.umich.edu * 282665Ssaidi@eecs.umich.edu * Authors: Ron Dreslinski 292665Ssaidi@eecs.umich.edu * Steve Reinhardt 302665Ssaidi@eecs.umich.edu * Ali Saidi 312381SN/A */ 322381SN/A 332381SN/A/** 342982Sstever@eecs.umich.edu * @file 352982Sstever@eecs.umich.edu * Declaration of a request, the overall memory request consisting of 362381SN/A the parts of the request that are persistent throughout the transaction. 372381SN/A */ 382381SN/A 392381SN/A#ifndef __MEM_REQUEST_HH__ 402381SN/A#define __MEM_REQUEST_HH__ 412381SN/A 425735Snate@binkert.org#include <cassert> 435735Snate@binkert.org 444610Ssaidi@eecs.umich.edu#include "base/fast_alloc.hh" 455735Snate@binkert.org#include "base/flags.hh" 465744Sgblack@eecs.umich.edu#include "base/misc.hh" 472980Sgblack@eecs.umich.edu#include "sim/host.hh" 484167Sbinkertn@umich.edu#include "sim/core.hh" 492394SN/A 502394SN/Aclass Request; 512394SN/A 522394SN/Atypedef Request* RequestPtr; 532394SN/A 544610Ssaidi@eecs.umich.educlass Request : public FastAlloc 552381SN/A{ 565735Snate@binkert.org public: 575735Snate@binkert.org typedef uint32_t FlagsType; 585735Snate@binkert.org typedef ::Flags<FlagsType> Flags; 595735Snate@binkert.org 605735Snate@binkert.org /** ASI information for this request if it exists. */ 615735Snate@binkert.org static const FlagsType ASI_BITS = 0x000000FF; 625735Snate@binkert.org /** The request is a Load locked/store conditional. */ 636076Sgblack@eecs.umich.edu static const FlagsType LLSC = 0x00000100; 645735Snate@binkert.org /** The virtual address is also the physical address. */ 655735Snate@binkert.org static const FlagsType PHYSICAL = 0x00000200; 665735Snate@binkert.org /** The request is an ALPHA VPTE pal access (hw_ld). */ 675735Snate@binkert.org static const FlagsType VPTE = 0x00000400; 685735Snate@binkert.org /** Use the alternate mode bits in ALPHA. */ 695735Snate@binkert.org static const FlagsType ALTMODE = 0x00000800; 705735Snate@binkert.org /** The request is to an uncacheable address. */ 715735Snate@binkert.org static const FlagsType UNCACHEABLE = 0x00001000; 725735Snate@binkert.org /** The request should not cause a page fault. */ 735735Snate@binkert.org static const FlagsType NO_FAULT = 0x00002000; 745890Sgblack@eecs.umich.edu /** The request should not cause a memory access. */ 755890Sgblack@eecs.umich.edu static const FlagsType NO_ACCESS = 0x00004000; 766103Sgblack@eecs.umich.edu /** This request will lock or unlock the accessed memory. When used with 776103Sgblack@eecs.umich.edu * a load, the access locks the particular chunk of memory. When used 786103Sgblack@eecs.umich.edu * with a store, it unlocks. The rule is that locked accesses have to be 796103Sgblack@eecs.umich.edu * made up of a locked load, some operation on the data, and then a locked 806103Sgblack@eecs.umich.edu * store. 816103Sgblack@eecs.umich.edu */ 826077Sgblack@eecs.umich.edu static const FlagsType LOCKED = 0x00008000; 835735Snate@binkert.org /** The request should be prefetched into the exclusive state. */ 845735Snate@binkert.org static const FlagsType PF_EXCLUSIVE = 0x00010000; 855735Snate@binkert.org /** The request should be marked as LRU. */ 865735Snate@binkert.org static const FlagsType EVICT_NEXT = 0x00020000; 875735Snate@binkert.org /** The request should ignore unaligned access faults */ 885735Snate@binkert.org static const FlagsType NO_ALIGN_FAULT = 0x00040000; 896105Ssteve.reinhardt@amd.com /** The request was an instruction fetch. */ 906105Ssteve.reinhardt@amd.com static const FlagsType INST_FETCH = 0x00080000; 915735Snate@binkert.org /** This request is for a memory swap. */ 925735Snate@binkert.org static const FlagsType MEM_SWAP = 0x00100000; 935735Snate@binkert.org static const FlagsType MEM_SWAP_COND = 0x00200000; 945735Snate@binkert.org /** The request should ignore unaligned access faults */ 955735Snate@binkert.org static const FlagsType NO_HALF_WORD_ALIGN_FAULT = 0x00400000; 965735Snate@binkert.org /** This request is to a memory mapped register. */ 975735Snate@binkert.org static const FlagsType MMAPED_IPR = 0x00800000; 985735Snate@binkert.org 996104Ssteve.reinhardt@amd.com /** These flags are *not* cleared when a Request object is reused 1006104Ssteve.reinhardt@amd.com (assigned a new address). */ 1016105Ssteve.reinhardt@amd.com static const FlagsType STICKY_FLAGS = INST_FETCH; 1026104Ssteve.reinhardt@amd.com 1035735Snate@binkert.org private: 1046104Ssteve.reinhardt@amd.com typedef uint8_t PrivateFlagsType; 1056104Ssteve.reinhardt@amd.com typedef ::Flags<PrivateFlagsType> PrivateFlags; 1065735Snate@binkert.org 1075735Snate@binkert.org /** Whether or not the size is valid. */ 1086104Ssteve.reinhardt@amd.com static const PrivateFlagsType VALID_SIZE = 0x00000001; 1095735Snate@binkert.org /** Whether or not paddr is valid (has been written yet). */ 1106104Ssteve.reinhardt@amd.com static const PrivateFlagsType VALID_PADDR = 0x00000002; 1115735Snate@binkert.org /** Whether or not the vaddr & asid are valid. */ 1126104Ssteve.reinhardt@amd.com static const PrivateFlagsType VALID_VADDR = 0x00000004; 1135735Snate@binkert.org /** Whether or not the pc is valid. */ 1146104Ssteve.reinhardt@amd.com static const PrivateFlagsType VALID_PC = 0x00000010; 1155735Snate@binkert.org /** Whether or not the context ID is valid. */ 1166104Ssteve.reinhardt@amd.com static const PrivateFlagsType VALID_CONTEXT_ID = 0x00000020; 1176104Ssteve.reinhardt@amd.com static const PrivateFlagsType VALID_THREAD_ID = 0x00000040; 1185735Snate@binkert.org /** Whether or not the sc result is valid. */ 1196104Ssteve.reinhardt@amd.com static const PrivateFlagsType VALID_EXTRA_DATA = 0x00000080; 1206104Ssteve.reinhardt@amd.com 1216104Ssteve.reinhardt@amd.com /** These flags are *not* cleared when a Request object is reused 1226104Ssteve.reinhardt@amd.com (assigned a new address). */ 1236104Ssteve.reinhardt@amd.com static const PrivateFlagsType STICKY_PRIVATE_FLAGS = 1246104Ssteve.reinhardt@amd.com VALID_CONTEXT_ID | VALID_THREAD_ID; 1255735Snate@binkert.org 1262663Sstever@eecs.umich.edu private: 1272663Sstever@eecs.umich.edu /** 1282663Sstever@eecs.umich.edu * The physical address of the request. Valid only if validPaddr 1295735Snate@binkert.org * is set. 1305735Snate@binkert.org */ 1312663Sstever@eecs.umich.edu Addr paddr; 1322532SN/A 1332663Sstever@eecs.umich.edu /** 1342663Sstever@eecs.umich.edu * The size of the request. This field must be set when vaddr or 1352663Sstever@eecs.umich.edu * paddr is written via setVirt() or setPhys(), so it is always 1365735Snate@binkert.org * valid as long as one of the address fields is valid. 1375735Snate@binkert.org */ 1382381SN/A int size; 1392395SN/A 1402532SN/A /** Flag structure for the request. */ 1415735Snate@binkert.org Flags flags; 1422384SN/A 1436104Ssteve.reinhardt@amd.com /** Private flags for field validity checking. */ 1446104Ssteve.reinhardt@amd.com PrivateFlags privateFlags; 1456104Ssteve.reinhardt@amd.com 1462663Sstever@eecs.umich.edu /** 1472663Sstever@eecs.umich.edu * The time this request was started. Used to calculate 1482663Sstever@eecs.umich.edu * latencies. This field is set to curTick any time paddr or vaddr 1495735Snate@binkert.org * is written. 1505735Snate@binkert.org */ 1512663Sstever@eecs.umich.edu Tick time; 1522384SN/A 1532384SN/A /** The address space ID. */ 1542384SN/A int asid; 1553806Ssaidi@eecs.umich.edu 1562663Sstever@eecs.umich.edu /** The virtual address of the request. */ 1572663Sstever@eecs.umich.edu Addr vaddr; 1582384SN/A 1595735Snate@binkert.org /** 1605735Snate@binkert.org * Extra data for the request, such as the return value of 1614040Ssaidi@eecs.umich.edu * store conditional or the compare value for a CAS. */ 1624040Ssaidi@eecs.umich.edu uint64_t extraData; 1632384SN/A 1645714Shsul@eecs.umich.edu /** The context ID (for statistics, typically). */ 1655714Shsul@eecs.umich.edu int _contextId; 1665714Shsul@eecs.umich.edu /** The thread ID (id within this CPU) */ 1675714Shsul@eecs.umich.edu int _threadId; 1682384SN/A 1692381SN/A /** program counter of initiating access; for tracing/debugging */ 1702381SN/A Addr pc; 1712663Sstever@eecs.umich.edu 1722532SN/A public: 1732663Sstever@eecs.umich.edu /** Minimal constructor. No fields are initialized. */ 1742663Sstever@eecs.umich.edu Request() 1752663Sstever@eecs.umich.edu {} 1762532SN/A 1772663Sstever@eecs.umich.edu /** 1782663Sstever@eecs.umich.edu * Constructor for physical (e.g. device) requests. Initializes 1792663Sstever@eecs.umich.edu * just physical address, size, flags, and timestamp (to curTick). 1805735Snate@binkert.org * These fields are adequate to perform a request. 1815735Snate@binkert.org */ 1825735Snate@binkert.org Request(Addr paddr, int size, Flags flags) 1835735Snate@binkert.org { 1845735Snate@binkert.org setPhys(paddr, size, flags); 1855735Snate@binkert.org } 1862532SN/A 1875735Snate@binkert.org Request(int asid, Addr vaddr, int size, Flags flags, Addr pc, 1885735Snate@binkert.org int cid, int tid) 1892669Sktlim@umich.edu { 1906104Ssteve.reinhardt@amd.com setVirt(asid, vaddr, size, flags, pc); 1915735Snate@binkert.org setThreadContext(cid, tid); 1922669Sktlim@umich.edu } 1932669Sktlim@umich.edu 1944610Ssaidi@eecs.umich.edu ~Request() {} // for FastAlloc 1954610Ssaidi@eecs.umich.edu 1962663Sstever@eecs.umich.edu /** 1975735Snate@binkert.org * Set up CPU and thread numbers. 1985735Snate@binkert.org */ 1995735Snate@binkert.org void 2005735Snate@binkert.org setThreadContext(int context_id, int thread_id) 2012663Sstever@eecs.umich.edu { 2025735Snate@binkert.org _contextId = context_id; 2035735Snate@binkert.org _threadId = thread_id; 2046104Ssteve.reinhardt@amd.com privateFlags.set(VALID_CONTEXT_ID|VALID_THREAD_ID); 2052663Sstever@eecs.umich.edu } 2062532SN/A 2072663Sstever@eecs.umich.edu /** 2082663Sstever@eecs.umich.edu * Set up a physical (e.g. device) request in a previously 2095735Snate@binkert.org * allocated Request object. 2105735Snate@binkert.org */ 2115735Snate@binkert.org void 2125735Snate@binkert.org setPhys(Addr _paddr, int _size, Flags _flags) 2132663Sstever@eecs.umich.edu { 2145731SSteve.Reinhardt@amd.com assert(_size >= 0); 2152663Sstever@eecs.umich.edu paddr = _paddr; 2162663Sstever@eecs.umich.edu size = _size; 2172663Sstever@eecs.umich.edu time = curTick; 2185735Snate@binkert.org 2196104Ssteve.reinhardt@amd.com flags.clear(~STICKY_FLAGS); 2206104Ssteve.reinhardt@amd.com flags.set(_flags); 2216104Ssteve.reinhardt@amd.com privateFlags.clear(~STICKY_PRIVATE_FLAGS); 2226104Ssteve.reinhardt@amd.com privateFlags.set(VALID_PADDR|VALID_SIZE); 2232663Sstever@eecs.umich.edu } 2242532SN/A 2252663Sstever@eecs.umich.edu /** 2262663Sstever@eecs.umich.edu * Set up a virtual (e.g., CPU) request in a previously 2275735Snate@binkert.org * allocated Request object. 2285735Snate@binkert.org */ 2295735Snate@binkert.org void 2305735Snate@binkert.org setVirt(int _asid, Addr _vaddr, int _size, Flags _flags, Addr _pc) 2312663Sstever@eecs.umich.edu { 2325731SSteve.Reinhardt@amd.com assert(_size >= 0); 2332663Sstever@eecs.umich.edu asid = _asid; 2342663Sstever@eecs.umich.edu vaddr = _vaddr; 2352663Sstever@eecs.umich.edu size = _size; 2366104Ssteve.reinhardt@amd.com flags = _flags; 2372663Sstever@eecs.umich.edu pc = _pc; 2382663Sstever@eecs.umich.edu time = curTick; 2395735Snate@binkert.org 2406104Ssteve.reinhardt@amd.com flags.clear(~STICKY_FLAGS); 2416104Ssteve.reinhardt@amd.com flags.set(_flags); 2426104Ssteve.reinhardt@amd.com privateFlags.clear(~STICKY_PRIVATE_FLAGS); 2436104Ssteve.reinhardt@amd.com privateFlags.set(VALID_VADDR|VALID_SIZE|VALID_PC); 2442663Sstever@eecs.umich.edu } 2452532SN/A 2465735Snate@binkert.org /** 2475735Snate@binkert.org * Set just the physical address. This should only be used to 2482663Sstever@eecs.umich.edu * record the result of a translation, and thus the vaddr must be 2492663Sstever@eecs.umich.edu * valid before this method is called. Otherwise, use setPhys() 2502663Sstever@eecs.umich.edu * to guarantee that the size and flags are also set. 2512663Sstever@eecs.umich.edu */ 2525735Snate@binkert.org void 2535735Snate@binkert.org setPaddr(Addr _paddr) 2542663Sstever@eecs.umich.edu { 2556104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_VADDR)); 2562663Sstever@eecs.umich.edu paddr = _paddr; 2576104Ssteve.reinhardt@amd.com privateFlags.set(VALID_PADDR); 2582663Sstever@eecs.umich.edu } 2592532SN/A 2605735Snate@binkert.org /** 2615744Sgblack@eecs.umich.edu * Generate two requests as if this request had been split into two 2625744Sgblack@eecs.umich.edu * pieces. The original request can't have been translated already. 2635744Sgblack@eecs.umich.edu */ 2645744Sgblack@eecs.umich.edu void splitOnVaddr(Addr split_addr, RequestPtr &req1, RequestPtr &req2) 2655744Sgblack@eecs.umich.edu { 2666104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_VADDR)); 2676104Ssteve.reinhardt@amd.com assert(privateFlags.noneSet(VALID_PADDR)); 2685744Sgblack@eecs.umich.edu assert(split_addr > vaddr && split_addr < vaddr + size); 2695744Sgblack@eecs.umich.edu req1 = new Request; 2705744Sgblack@eecs.umich.edu *req1 = *this; 2715744Sgblack@eecs.umich.edu req2 = new Request; 2725744Sgblack@eecs.umich.edu *req2 = *this; 2735744Sgblack@eecs.umich.edu req1->size = split_addr - vaddr; 2745744Sgblack@eecs.umich.edu req2->vaddr = split_addr; 2755744Sgblack@eecs.umich.edu req2->size = size - req1->size; 2765744Sgblack@eecs.umich.edu } 2775744Sgblack@eecs.umich.edu 2785744Sgblack@eecs.umich.edu /** 2795735Snate@binkert.org * Accessor for paddr. 2805735Snate@binkert.org */ 2816104Ssteve.reinhardt@amd.com bool 2826104Ssteve.reinhardt@amd.com hasPaddr() 2836104Ssteve.reinhardt@amd.com { 2846104Ssteve.reinhardt@amd.com return privateFlags.isSet(VALID_PADDR); 2856104Ssteve.reinhardt@amd.com } 2866104Ssteve.reinhardt@amd.com 2875735Snate@binkert.org Addr 2885735Snate@binkert.org getPaddr() 2895735Snate@binkert.org { 2906104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_PADDR)); 2915735Snate@binkert.org return paddr; 2925735Snate@binkert.org } 2932663Sstever@eecs.umich.edu 2945735Snate@binkert.org /** 2955735Snate@binkert.org * Accessor for size. 2965735Snate@binkert.org */ 2976104Ssteve.reinhardt@amd.com bool 2986104Ssteve.reinhardt@amd.com hasSize() 2996104Ssteve.reinhardt@amd.com { 3006104Ssteve.reinhardt@amd.com return privateFlags.isSet(VALID_SIZE); 3016104Ssteve.reinhardt@amd.com } 3026104Ssteve.reinhardt@amd.com 3035735Snate@binkert.org int 3045735Snate@binkert.org getSize() 3055735Snate@binkert.org { 3066104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_SIZE)); 3075735Snate@binkert.org return size; 3085735Snate@binkert.org } 3095735Snate@binkert.org 3102663Sstever@eecs.umich.edu /** Accessor for time. */ 3115735Snate@binkert.org Tick 3125735Snate@binkert.org getTime() 3135735Snate@binkert.org { 3146104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_PADDR|VALID_VADDR)); 3155735Snate@binkert.org return time; 3165735Snate@binkert.org } 3175735Snate@binkert.org 3182663Sstever@eecs.umich.edu /** Accessor for flags. */ 3195735Snate@binkert.org Flags 3205735Snate@binkert.org getFlags() 3215735Snate@binkert.org { 3226104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_PADDR|VALID_VADDR)); 3236104Ssteve.reinhardt@amd.com return flags; 3245735Snate@binkert.org } 3255735Snate@binkert.org 3265735Snate@binkert.org void 3275735Snate@binkert.org setFlags(Flags _flags) 3285735Snate@binkert.org { 3296104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_PADDR|VALID_VADDR)); 3305735Snate@binkert.org flags.set(_flags); 3315735Snate@binkert.org } 3325735Snate@binkert.org 3332663Sstever@eecs.umich.edu /** Accessor function for vaddr.*/ 3345735Snate@binkert.org Addr 3355735Snate@binkert.org getVaddr() 3365735Snate@binkert.org { 3376104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_VADDR)); 3385735Snate@binkert.org return vaddr; 3395735Snate@binkert.org } 3402663Sstever@eecs.umich.edu 3412663Sstever@eecs.umich.edu /** Accessor function for asid.*/ 3425735Snate@binkert.org int 3435735Snate@binkert.org getAsid() 3445735Snate@binkert.org { 3456104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_VADDR)); 3465735Snate@binkert.org return asid; 3475735Snate@binkert.org } 3482663Sstever@eecs.umich.edu 3493804Ssaidi@eecs.umich.edu /** Accessor function for asi.*/ 3505735Snate@binkert.org uint8_t 3515735Snate@binkert.org getAsi() 3525735Snate@binkert.org { 3536104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_VADDR)); 3545735Snate@binkert.org return flags & ASI_BITS; 3555735Snate@binkert.org } 3563804Ssaidi@eecs.umich.edu 3576104Ssteve.reinhardt@amd.com /** Accessor function for MMAPED_IPR flag. */ 3585735Snate@binkert.org bool 3595735Snate@binkert.org isMmapedIpr() 3605735Snate@binkert.org { 3616104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_PADDR)); 3625764Snate@binkert.org return flags.isSet(MMAPED_IPR); 3635735Snate@binkert.org } 3643806Ssaidi@eecs.umich.edu 3655735Snate@binkert.org void 3665735Snate@binkert.org setMmapedIpr(bool r) 3675735Snate@binkert.org { 3685735Snate@binkert.org assert(VALID_VADDR); 3695735Snate@binkert.org flags.set(MMAPED_IPR); 3705735Snate@binkert.org } 3713804Ssaidi@eecs.umich.edu 3722679Sktlim@umich.edu /** Accessor function to check if sc result is valid. */ 3735735Snate@binkert.org bool 3745735Snate@binkert.org extraDataValid() 3755735Snate@binkert.org { 3766104Ssteve.reinhardt@amd.com return privateFlags.isSet(VALID_EXTRA_DATA); 3775735Snate@binkert.org } 3785735Snate@binkert.org 3792663Sstever@eecs.umich.edu /** Accessor function for store conditional return value.*/ 3805735Snate@binkert.org uint64_t 3815735Snate@binkert.org getExtraData() const 3825735Snate@binkert.org { 3836104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_EXTRA_DATA)); 3845735Snate@binkert.org return extraData; 3855735Snate@binkert.org } 3865735Snate@binkert.org 3872663Sstever@eecs.umich.edu /** Accessor function for store conditional return value.*/ 3885735Snate@binkert.org void 3895735Snate@binkert.org setExtraData(uint64_t _extraData) 3905735Snate@binkert.org { 3915735Snate@binkert.org extraData = _extraData; 3926104Ssteve.reinhardt@amd.com privateFlags.set(VALID_EXTRA_DATA); 3935735Snate@binkert.org } 3942663Sstever@eecs.umich.edu 3956010Ssteve.reinhardt@amd.com bool 3966010Ssteve.reinhardt@amd.com hasContextId() const 3976010Ssteve.reinhardt@amd.com { 3986104Ssteve.reinhardt@amd.com return privateFlags.isSet(VALID_CONTEXT_ID); 3996010Ssteve.reinhardt@amd.com } 4006010Ssteve.reinhardt@amd.com 4015714Shsul@eecs.umich.edu /** Accessor function for context ID.*/ 4025735Snate@binkert.org int 4035735Snate@binkert.org contextId() const 4045735Snate@binkert.org { 4056104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_CONTEXT_ID)); 4065735Snate@binkert.org return _contextId; 4075735Snate@binkert.org } 4085735Snate@binkert.org 4095714Shsul@eecs.umich.edu /** Accessor function for thread ID. */ 4105735Snate@binkert.org int 4115735Snate@binkert.org threadId() const 4125735Snate@binkert.org { 4136104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_THREAD_ID)); 4145735Snate@binkert.org return _threadId; 4155735Snate@binkert.org } 4162663Sstever@eecs.umich.edu 4175875Ssteve.reinhardt@amd.com bool 4185875Ssteve.reinhardt@amd.com hasPC() const 4195875Ssteve.reinhardt@amd.com { 4206104Ssteve.reinhardt@amd.com return privateFlags.isSet(VALID_PC); 4215875Ssteve.reinhardt@amd.com } 4225875Ssteve.reinhardt@amd.com 4236010Ssteve.reinhardt@amd.com /** Accessor function for pc.*/ 4245735Snate@binkert.org Addr 4255735Snate@binkert.org getPC() const 4265735Snate@binkert.org { 4276104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_PC)); 4285735Snate@binkert.org return pc; 4295735Snate@binkert.org } 4302532SN/A 4312811Srdreslin@umich.edu /** Accessor Function to Check Cacheability. */ 4325764Snate@binkert.org bool isUncacheable() const { return flags.isSet(UNCACHEABLE); } 4336105Ssteve.reinhardt@amd.com bool isInstFetch() const { return flags.isSet(INST_FETCH); } 4346102Sgblack@eecs.umich.edu bool isLLSC() const { return flags.isSet(LLSC); } 4356077Sgblack@eecs.umich.edu bool isLocked() const { return flags.isSet(LOCKED); } 4365764Snate@binkert.org bool isSwap() const { return flags.isSet(MEM_SWAP|MEM_SWAP_COND); } 4375764Snate@binkert.org bool isCondSwap() const { return flags.isSet(MEM_SWAP_COND); } 4382811Srdreslin@umich.edu 4395735Snate@binkert.org bool 4405735Snate@binkert.org isMisaligned() const 4415735Snate@binkert.org { 4425764Snate@binkert.org if (flags.isSet(NO_ALIGN_FAULT)) 4435735Snate@binkert.org return false; 4443170Sstever@eecs.umich.edu 4455735Snate@binkert.org if ((vaddr & 0x1)) 4465735Snate@binkert.org return true; 4472814Srdreslin@umich.edu 4485764Snate@binkert.org if (flags.isSet(NO_HALF_WORD_ALIGN_FAULT)) 4495735Snate@binkert.org return false; 4504040Ssaidi@eecs.umich.edu 4515735Snate@binkert.org if ((vaddr & 0x2)) 4525735Snate@binkert.org return true; 4534040Ssaidi@eecs.umich.edu 4545735Snate@binkert.org return false; 4555735Snate@binkert.org } 4562384SN/A}; 4572381SN/A 4582381SN/A#endif // __MEM_REQUEST_HH__ 459