request.hh revision 6106
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; 986106Ssteve.reinhardt@amd.com /** The request is a prefetch. */ 996106Ssteve.reinhardt@amd.com static const FlagsType PREFETCH = 0x01000000; 1005735Snate@binkert.org 1016104Ssteve.reinhardt@amd.com /** These flags are *not* cleared when a Request object is reused 1026104Ssteve.reinhardt@amd.com (assigned a new address). */ 1036105Ssteve.reinhardt@amd.com static const FlagsType STICKY_FLAGS = INST_FETCH; 1046104Ssteve.reinhardt@amd.com 1055735Snate@binkert.org private: 1066104Ssteve.reinhardt@amd.com typedef uint8_t PrivateFlagsType; 1076104Ssteve.reinhardt@amd.com typedef ::Flags<PrivateFlagsType> PrivateFlags; 1085735Snate@binkert.org 1095735Snate@binkert.org /** Whether or not the size is valid. */ 1106104Ssteve.reinhardt@amd.com static const PrivateFlagsType VALID_SIZE = 0x00000001; 1115735Snate@binkert.org /** Whether or not paddr is valid (has been written yet). */ 1126104Ssteve.reinhardt@amd.com static const PrivateFlagsType VALID_PADDR = 0x00000002; 1135735Snate@binkert.org /** Whether or not the vaddr & asid are valid. */ 1146104Ssteve.reinhardt@amd.com static const PrivateFlagsType VALID_VADDR = 0x00000004; 1155735Snate@binkert.org /** Whether or not the pc is valid. */ 1166104Ssteve.reinhardt@amd.com static const PrivateFlagsType VALID_PC = 0x00000010; 1175735Snate@binkert.org /** Whether or not the context ID is valid. */ 1186104Ssteve.reinhardt@amd.com static const PrivateFlagsType VALID_CONTEXT_ID = 0x00000020; 1196104Ssteve.reinhardt@amd.com static const PrivateFlagsType VALID_THREAD_ID = 0x00000040; 1205735Snate@binkert.org /** Whether or not the sc result is valid. */ 1216104Ssteve.reinhardt@amd.com static const PrivateFlagsType VALID_EXTRA_DATA = 0x00000080; 1226104Ssteve.reinhardt@amd.com 1236104Ssteve.reinhardt@amd.com /** These flags are *not* cleared when a Request object is reused 1246104Ssteve.reinhardt@amd.com (assigned a new address). */ 1256104Ssteve.reinhardt@amd.com static const PrivateFlagsType STICKY_PRIVATE_FLAGS = 1266104Ssteve.reinhardt@amd.com VALID_CONTEXT_ID | VALID_THREAD_ID; 1275735Snate@binkert.org 1282663Sstever@eecs.umich.edu private: 1292663Sstever@eecs.umich.edu /** 1302663Sstever@eecs.umich.edu * The physical address of the request. Valid only if validPaddr 1315735Snate@binkert.org * is set. 1325735Snate@binkert.org */ 1332663Sstever@eecs.umich.edu Addr paddr; 1342532SN/A 1352663Sstever@eecs.umich.edu /** 1362663Sstever@eecs.umich.edu * The size of the request. This field must be set when vaddr or 1372663Sstever@eecs.umich.edu * paddr is written via setVirt() or setPhys(), so it is always 1385735Snate@binkert.org * valid as long as one of the address fields is valid. 1395735Snate@binkert.org */ 1402381SN/A int size; 1412395SN/A 1422532SN/A /** Flag structure for the request. */ 1435735Snate@binkert.org Flags flags; 1442384SN/A 1456104Ssteve.reinhardt@amd.com /** Private flags for field validity checking. */ 1466104Ssteve.reinhardt@amd.com PrivateFlags privateFlags; 1476104Ssteve.reinhardt@amd.com 1482663Sstever@eecs.umich.edu /** 1492663Sstever@eecs.umich.edu * The time this request was started. Used to calculate 1502663Sstever@eecs.umich.edu * latencies. This field is set to curTick any time paddr or vaddr 1515735Snate@binkert.org * is written. 1525735Snate@binkert.org */ 1532663Sstever@eecs.umich.edu Tick time; 1542384SN/A 1552384SN/A /** The address space ID. */ 1562384SN/A int asid; 1573806Ssaidi@eecs.umich.edu 1582663Sstever@eecs.umich.edu /** The virtual address of the request. */ 1592663Sstever@eecs.umich.edu Addr vaddr; 1602384SN/A 1615735Snate@binkert.org /** 1625735Snate@binkert.org * Extra data for the request, such as the return value of 1634040Ssaidi@eecs.umich.edu * store conditional or the compare value for a CAS. */ 1644040Ssaidi@eecs.umich.edu uint64_t extraData; 1652384SN/A 1665714Shsul@eecs.umich.edu /** The context ID (for statistics, typically). */ 1675714Shsul@eecs.umich.edu int _contextId; 1685714Shsul@eecs.umich.edu /** The thread ID (id within this CPU) */ 1695714Shsul@eecs.umich.edu int _threadId; 1702384SN/A 1712381SN/A /** program counter of initiating access; for tracing/debugging */ 1722381SN/A Addr pc; 1732663Sstever@eecs.umich.edu 1742532SN/A public: 1752663Sstever@eecs.umich.edu /** Minimal constructor. No fields are initialized. */ 1762663Sstever@eecs.umich.edu Request() 1772663Sstever@eecs.umich.edu {} 1782532SN/A 1792663Sstever@eecs.umich.edu /** 1802663Sstever@eecs.umich.edu * Constructor for physical (e.g. device) requests. Initializes 1812663Sstever@eecs.umich.edu * just physical address, size, flags, and timestamp (to curTick). 1825735Snate@binkert.org * These fields are adequate to perform a request. 1835735Snate@binkert.org */ 1845735Snate@binkert.org Request(Addr paddr, int size, Flags flags) 1855735Snate@binkert.org { 1865735Snate@binkert.org setPhys(paddr, size, flags); 1875735Snate@binkert.org } 1882532SN/A 1895735Snate@binkert.org Request(int asid, Addr vaddr, int size, Flags flags, Addr pc, 1905735Snate@binkert.org int cid, int tid) 1912669Sktlim@umich.edu { 1926104Ssteve.reinhardt@amd.com setVirt(asid, vaddr, size, flags, pc); 1935735Snate@binkert.org setThreadContext(cid, tid); 1942669Sktlim@umich.edu } 1952669Sktlim@umich.edu 1964610Ssaidi@eecs.umich.edu ~Request() {} // for FastAlloc 1974610Ssaidi@eecs.umich.edu 1982663Sstever@eecs.umich.edu /** 1995735Snate@binkert.org * Set up CPU and thread numbers. 2005735Snate@binkert.org */ 2015735Snate@binkert.org void 2025735Snate@binkert.org setThreadContext(int context_id, int thread_id) 2032663Sstever@eecs.umich.edu { 2045735Snate@binkert.org _contextId = context_id; 2055735Snate@binkert.org _threadId = thread_id; 2066104Ssteve.reinhardt@amd.com privateFlags.set(VALID_CONTEXT_ID|VALID_THREAD_ID); 2072663Sstever@eecs.umich.edu } 2082532SN/A 2092663Sstever@eecs.umich.edu /** 2102663Sstever@eecs.umich.edu * Set up a physical (e.g. device) request in a previously 2115735Snate@binkert.org * allocated Request object. 2125735Snate@binkert.org */ 2135735Snate@binkert.org void 2145735Snate@binkert.org setPhys(Addr _paddr, int _size, Flags _flags) 2152663Sstever@eecs.umich.edu { 2165731SSteve.Reinhardt@amd.com assert(_size >= 0); 2172663Sstever@eecs.umich.edu paddr = _paddr; 2182663Sstever@eecs.umich.edu size = _size; 2192663Sstever@eecs.umich.edu time = curTick; 2205735Snate@binkert.org 2216104Ssteve.reinhardt@amd.com flags.clear(~STICKY_FLAGS); 2226104Ssteve.reinhardt@amd.com flags.set(_flags); 2236104Ssteve.reinhardt@amd.com privateFlags.clear(~STICKY_PRIVATE_FLAGS); 2246104Ssteve.reinhardt@amd.com privateFlags.set(VALID_PADDR|VALID_SIZE); 2252663Sstever@eecs.umich.edu } 2262532SN/A 2272663Sstever@eecs.umich.edu /** 2282663Sstever@eecs.umich.edu * Set up a virtual (e.g., CPU) request in a previously 2295735Snate@binkert.org * allocated Request object. 2305735Snate@binkert.org */ 2315735Snate@binkert.org void 2325735Snate@binkert.org setVirt(int _asid, Addr _vaddr, int _size, Flags _flags, Addr _pc) 2332663Sstever@eecs.umich.edu { 2345731SSteve.Reinhardt@amd.com assert(_size >= 0); 2352663Sstever@eecs.umich.edu asid = _asid; 2362663Sstever@eecs.umich.edu vaddr = _vaddr; 2372663Sstever@eecs.umich.edu size = _size; 2386104Ssteve.reinhardt@amd.com flags = _flags; 2392663Sstever@eecs.umich.edu pc = _pc; 2402663Sstever@eecs.umich.edu time = curTick; 2415735Snate@binkert.org 2426104Ssteve.reinhardt@amd.com flags.clear(~STICKY_FLAGS); 2436104Ssteve.reinhardt@amd.com flags.set(_flags); 2446104Ssteve.reinhardt@amd.com privateFlags.clear(~STICKY_PRIVATE_FLAGS); 2456104Ssteve.reinhardt@amd.com privateFlags.set(VALID_VADDR|VALID_SIZE|VALID_PC); 2462663Sstever@eecs.umich.edu } 2472532SN/A 2485735Snate@binkert.org /** 2495735Snate@binkert.org * Set just the physical address. This should only be used to 2502663Sstever@eecs.umich.edu * record the result of a translation, and thus the vaddr must be 2512663Sstever@eecs.umich.edu * valid before this method is called. Otherwise, use setPhys() 2522663Sstever@eecs.umich.edu * to guarantee that the size and flags are also set. 2532663Sstever@eecs.umich.edu */ 2545735Snate@binkert.org void 2555735Snate@binkert.org setPaddr(Addr _paddr) 2562663Sstever@eecs.umich.edu { 2576104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_VADDR)); 2582663Sstever@eecs.umich.edu paddr = _paddr; 2596104Ssteve.reinhardt@amd.com privateFlags.set(VALID_PADDR); 2602663Sstever@eecs.umich.edu } 2612532SN/A 2625735Snate@binkert.org /** 2635744Sgblack@eecs.umich.edu * Generate two requests as if this request had been split into two 2645744Sgblack@eecs.umich.edu * pieces. The original request can't have been translated already. 2655744Sgblack@eecs.umich.edu */ 2665744Sgblack@eecs.umich.edu void splitOnVaddr(Addr split_addr, RequestPtr &req1, RequestPtr &req2) 2675744Sgblack@eecs.umich.edu { 2686104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_VADDR)); 2696104Ssteve.reinhardt@amd.com assert(privateFlags.noneSet(VALID_PADDR)); 2705744Sgblack@eecs.umich.edu assert(split_addr > vaddr && split_addr < vaddr + size); 2715744Sgblack@eecs.umich.edu req1 = new Request; 2725744Sgblack@eecs.umich.edu *req1 = *this; 2735744Sgblack@eecs.umich.edu req2 = new Request; 2745744Sgblack@eecs.umich.edu *req2 = *this; 2755744Sgblack@eecs.umich.edu req1->size = split_addr - vaddr; 2765744Sgblack@eecs.umich.edu req2->vaddr = split_addr; 2775744Sgblack@eecs.umich.edu req2->size = size - req1->size; 2785744Sgblack@eecs.umich.edu } 2795744Sgblack@eecs.umich.edu 2805744Sgblack@eecs.umich.edu /** 2815735Snate@binkert.org * Accessor for paddr. 2825735Snate@binkert.org */ 2836104Ssteve.reinhardt@amd.com bool 2846104Ssteve.reinhardt@amd.com hasPaddr() 2856104Ssteve.reinhardt@amd.com { 2866104Ssteve.reinhardt@amd.com return privateFlags.isSet(VALID_PADDR); 2876104Ssteve.reinhardt@amd.com } 2886104Ssteve.reinhardt@amd.com 2895735Snate@binkert.org Addr 2905735Snate@binkert.org getPaddr() 2915735Snate@binkert.org { 2926104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_PADDR)); 2935735Snate@binkert.org return paddr; 2945735Snate@binkert.org } 2952663Sstever@eecs.umich.edu 2965735Snate@binkert.org /** 2975735Snate@binkert.org * Accessor for size. 2985735Snate@binkert.org */ 2996104Ssteve.reinhardt@amd.com bool 3006104Ssteve.reinhardt@amd.com hasSize() 3016104Ssteve.reinhardt@amd.com { 3026104Ssteve.reinhardt@amd.com return privateFlags.isSet(VALID_SIZE); 3036104Ssteve.reinhardt@amd.com } 3046104Ssteve.reinhardt@amd.com 3055735Snate@binkert.org int 3065735Snate@binkert.org getSize() 3075735Snate@binkert.org { 3086104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_SIZE)); 3095735Snate@binkert.org return size; 3105735Snate@binkert.org } 3115735Snate@binkert.org 3122663Sstever@eecs.umich.edu /** Accessor for time. */ 3135735Snate@binkert.org Tick 3145735Snate@binkert.org getTime() 3155735Snate@binkert.org { 3166104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_PADDR|VALID_VADDR)); 3175735Snate@binkert.org return time; 3185735Snate@binkert.org } 3195735Snate@binkert.org 3202663Sstever@eecs.umich.edu /** Accessor for flags. */ 3215735Snate@binkert.org Flags 3225735Snate@binkert.org getFlags() 3235735Snate@binkert.org { 3246104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_PADDR|VALID_VADDR)); 3256104Ssteve.reinhardt@amd.com return flags; 3265735Snate@binkert.org } 3275735Snate@binkert.org 3285735Snate@binkert.org void 3295735Snate@binkert.org setFlags(Flags _flags) 3305735Snate@binkert.org { 3316104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_PADDR|VALID_VADDR)); 3325735Snate@binkert.org flags.set(_flags); 3335735Snate@binkert.org } 3345735Snate@binkert.org 3352663Sstever@eecs.umich.edu /** Accessor function for vaddr.*/ 3365735Snate@binkert.org Addr 3375735Snate@binkert.org getVaddr() 3385735Snate@binkert.org { 3396104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_VADDR)); 3405735Snate@binkert.org return vaddr; 3415735Snate@binkert.org } 3422663Sstever@eecs.umich.edu 3432663Sstever@eecs.umich.edu /** Accessor function for asid.*/ 3445735Snate@binkert.org int 3455735Snate@binkert.org getAsid() 3465735Snate@binkert.org { 3476104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_VADDR)); 3485735Snate@binkert.org return asid; 3495735Snate@binkert.org } 3502663Sstever@eecs.umich.edu 3513804Ssaidi@eecs.umich.edu /** Accessor function for asi.*/ 3525735Snate@binkert.org uint8_t 3535735Snate@binkert.org getAsi() 3545735Snate@binkert.org { 3556104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_VADDR)); 3565735Snate@binkert.org return flags & ASI_BITS; 3575735Snate@binkert.org } 3583804Ssaidi@eecs.umich.edu 3596104Ssteve.reinhardt@amd.com /** Accessor function for MMAPED_IPR flag. */ 3605735Snate@binkert.org bool 3615735Snate@binkert.org isMmapedIpr() 3625735Snate@binkert.org { 3636104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_PADDR)); 3645764Snate@binkert.org return flags.isSet(MMAPED_IPR); 3655735Snate@binkert.org } 3663806Ssaidi@eecs.umich.edu 3675735Snate@binkert.org void 3685735Snate@binkert.org setMmapedIpr(bool r) 3695735Snate@binkert.org { 3705735Snate@binkert.org assert(VALID_VADDR); 3715735Snate@binkert.org flags.set(MMAPED_IPR); 3725735Snate@binkert.org } 3733804Ssaidi@eecs.umich.edu 3742679Sktlim@umich.edu /** Accessor function to check if sc result is valid. */ 3755735Snate@binkert.org bool 3765735Snate@binkert.org extraDataValid() 3775735Snate@binkert.org { 3786104Ssteve.reinhardt@amd.com return privateFlags.isSet(VALID_EXTRA_DATA); 3795735Snate@binkert.org } 3805735Snate@binkert.org 3812663Sstever@eecs.umich.edu /** Accessor function for store conditional return value.*/ 3825735Snate@binkert.org uint64_t 3835735Snate@binkert.org getExtraData() const 3845735Snate@binkert.org { 3856104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_EXTRA_DATA)); 3865735Snate@binkert.org return extraData; 3875735Snate@binkert.org } 3885735Snate@binkert.org 3892663Sstever@eecs.umich.edu /** Accessor function for store conditional return value.*/ 3905735Snate@binkert.org void 3915735Snate@binkert.org setExtraData(uint64_t _extraData) 3925735Snate@binkert.org { 3935735Snate@binkert.org extraData = _extraData; 3946104Ssteve.reinhardt@amd.com privateFlags.set(VALID_EXTRA_DATA); 3955735Snate@binkert.org } 3962663Sstever@eecs.umich.edu 3976010Ssteve.reinhardt@amd.com bool 3986010Ssteve.reinhardt@amd.com hasContextId() const 3996010Ssteve.reinhardt@amd.com { 4006104Ssteve.reinhardt@amd.com return privateFlags.isSet(VALID_CONTEXT_ID); 4016010Ssteve.reinhardt@amd.com } 4026010Ssteve.reinhardt@amd.com 4035714Shsul@eecs.umich.edu /** Accessor function for context ID.*/ 4045735Snate@binkert.org int 4055735Snate@binkert.org contextId() const 4065735Snate@binkert.org { 4076104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_CONTEXT_ID)); 4085735Snate@binkert.org return _contextId; 4095735Snate@binkert.org } 4105735Snate@binkert.org 4115714Shsul@eecs.umich.edu /** Accessor function for thread ID. */ 4125735Snate@binkert.org int 4135735Snate@binkert.org threadId() const 4145735Snate@binkert.org { 4156104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_THREAD_ID)); 4165735Snate@binkert.org return _threadId; 4175735Snate@binkert.org } 4182663Sstever@eecs.umich.edu 4195875Ssteve.reinhardt@amd.com bool 4205875Ssteve.reinhardt@amd.com hasPC() const 4215875Ssteve.reinhardt@amd.com { 4226104Ssteve.reinhardt@amd.com return privateFlags.isSet(VALID_PC); 4235875Ssteve.reinhardt@amd.com } 4245875Ssteve.reinhardt@amd.com 4256010Ssteve.reinhardt@amd.com /** Accessor function for pc.*/ 4265735Snate@binkert.org Addr 4275735Snate@binkert.org getPC() const 4285735Snate@binkert.org { 4296104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_PC)); 4305735Snate@binkert.org return pc; 4315735Snate@binkert.org } 4322532SN/A 4332811Srdreslin@umich.edu /** Accessor Function to Check Cacheability. */ 4345764Snate@binkert.org bool isUncacheable() const { return flags.isSet(UNCACHEABLE); } 4356105Ssteve.reinhardt@amd.com bool isInstFetch() const { return flags.isSet(INST_FETCH); } 4366106Ssteve.reinhardt@amd.com bool isPrefetch() const { return flags.isSet(PREFETCH); } 4376102Sgblack@eecs.umich.edu bool isLLSC() const { return flags.isSet(LLSC); } 4386077Sgblack@eecs.umich.edu bool isLocked() const { return flags.isSet(LOCKED); } 4395764Snate@binkert.org bool isSwap() const { return flags.isSet(MEM_SWAP|MEM_SWAP_COND); } 4405764Snate@binkert.org bool isCondSwap() const { return flags.isSet(MEM_SWAP_COND); } 4412811Srdreslin@umich.edu 4425735Snate@binkert.org bool 4435735Snate@binkert.org isMisaligned() const 4445735Snate@binkert.org { 4455764Snate@binkert.org if (flags.isSet(NO_ALIGN_FAULT)) 4465735Snate@binkert.org return false; 4473170Sstever@eecs.umich.edu 4485735Snate@binkert.org if ((vaddr & 0x1)) 4495735Snate@binkert.org return true; 4502814Srdreslin@umich.edu 4515764Snate@binkert.org if (flags.isSet(NO_HALF_WORD_ALIGN_FAULT)) 4525735Snate@binkert.org return false; 4534040Ssaidi@eecs.umich.edu 4545735Snate@binkert.org if ((vaddr & 0x2)) 4555735Snate@binkert.org return true; 4564040Ssaidi@eecs.umich.edu 4575735Snate@binkert.org return false; 4585735Snate@binkert.org } 4592384SN/A}; 4602381SN/A 4612381SN/A#endif // __MEM_REQUEST_HH__ 462