request.hh revision 6103
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{ 565745Snate@binkert.org friend class Packet; 575745Snate@binkert.org 585735Snate@binkert.org public: 595735Snate@binkert.org typedef uint32_t FlagsType; 605735Snate@binkert.org typedef ::Flags<FlagsType> Flags; 615735Snate@binkert.org 625735Snate@binkert.org /** ASI information for this request if it exists. */ 635735Snate@binkert.org static const FlagsType ASI_BITS = 0x000000FF; 645735Snate@binkert.org /** The request is a Load locked/store conditional. */ 656076Sgblack@eecs.umich.edu static const FlagsType LLSC = 0x00000100; 665735Snate@binkert.org /** The virtual address is also the physical address. */ 675735Snate@binkert.org static const FlagsType PHYSICAL = 0x00000200; 685735Snate@binkert.org /** The request is an ALPHA VPTE pal access (hw_ld). */ 695735Snate@binkert.org static const FlagsType VPTE = 0x00000400; 705735Snate@binkert.org /** Use the alternate mode bits in ALPHA. */ 715735Snate@binkert.org static const FlagsType ALTMODE = 0x00000800; 725735Snate@binkert.org /** The request is to an uncacheable address. */ 735735Snate@binkert.org static const FlagsType UNCACHEABLE = 0x00001000; 745735Snate@binkert.org /** The request should not cause a page fault. */ 755735Snate@binkert.org static const FlagsType NO_FAULT = 0x00002000; 765890Sgblack@eecs.umich.edu /** The request should not cause a memory access. */ 775890Sgblack@eecs.umich.edu static const FlagsType NO_ACCESS = 0x00004000; 786103Sgblack@eecs.umich.edu /** This request will lock or unlock the accessed memory. When used with 796103Sgblack@eecs.umich.edu * a load, the access locks the particular chunk of memory. When used 806103Sgblack@eecs.umich.edu * with a store, it unlocks. The rule is that locked accesses have to be 816103Sgblack@eecs.umich.edu * made up of a locked load, some operation on the data, and then a locked 826103Sgblack@eecs.umich.edu * store. 836103Sgblack@eecs.umich.edu */ 846077Sgblack@eecs.umich.edu static const FlagsType LOCKED = 0x00008000; 855735Snate@binkert.org /** The request should be prefetched into the exclusive state. */ 865735Snate@binkert.org static const FlagsType PF_EXCLUSIVE = 0x00010000; 875735Snate@binkert.org /** The request should be marked as LRU. */ 885735Snate@binkert.org static const FlagsType EVICT_NEXT = 0x00020000; 895735Snate@binkert.org /** The request should ignore unaligned access faults */ 905735Snate@binkert.org static const FlagsType NO_ALIGN_FAULT = 0x00040000; 915735Snate@binkert.org /** The request was an instruction read. */ 925735Snate@binkert.org static const FlagsType INST_READ = 0x00080000; 935735Snate@binkert.org /** This request is for a memory swap. */ 945735Snate@binkert.org static const FlagsType MEM_SWAP = 0x00100000; 955735Snate@binkert.org static const FlagsType MEM_SWAP_COND = 0x00200000; 965735Snate@binkert.org /** The request should ignore unaligned access faults */ 975735Snate@binkert.org static const FlagsType NO_HALF_WORD_ALIGN_FAULT = 0x00400000; 985735Snate@binkert.org /** This request is to a memory mapped register. */ 995735Snate@binkert.org static const FlagsType MMAPED_IPR = 0x00800000; 1005735Snate@binkert.org 1015735Snate@binkert.org private: 1026077Sgblack@eecs.umich.edu static const FlagsType PUBLIC_FLAGS = 0x00FFFFFF; 1035735Snate@binkert.org static const FlagsType PRIVATE_FLAGS = 0xFF000000; 1045735Snate@binkert.org 1055735Snate@binkert.org /** Whether or not the size is valid. */ 1065735Snate@binkert.org static const FlagsType VALID_SIZE = 0x01000000; 1075735Snate@binkert.org /** Whether or not paddr is valid (has been written yet). */ 1085735Snate@binkert.org static const FlagsType VALID_PADDR = 0x02000000; 1095735Snate@binkert.org /** Whether or not the vaddr & asid are valid. */ 1105735Snate@binkert.org static const FlagsType VALID_VADDR = 0x04000000; 1115735Snate@binkert.org /** Whether or not the pc is valid. */ 1125735Snate@binkert.org static const FlagsType VALID_PC = 0x10000000; 1135735Snate@binkert.org /** Whether or not the context ID is valid. */ 1145735Snate@binkert.org static const FlagsType VALID_CONTEXT_ID = 0x20000000; 1155735Snate@binkert.org static const FlagsType VALID_THREAD_ID = 0x40000000; 1165735Snate@binkert.org /** Whether or not the sc result is valid. */ 1175735Snate@binkert.org static const FlagsType VALID_EXTRA_DATA = 0x80000000; 1185735Snate@binkert.org 1192663Sstever@eecs.umich.edu private: 1202663Sstever@eecs.umich.edu /** 1212663Sstever@eecs.umich.edu * The physical address of the request. Valid only if validPaddr 1225735Snate@binkert.org * is set. 1235735Snate@binkert.org */ 1242663Sstever@eecs.umich.edu Addr paddr; 1252532SN/A 1262663Sstever@eecs.umich.edu /** 1272663Sstever@eecs.umich.edu * The size of the request. This field must be set when vaddr or 1282663Sstever@eecs.umich.edu * paddr is written via setVirt() or setPhys(), so it is always 1295735Snate@binkert.org * valid as long as one of the address fields is valid. 1305735Snate@binkert.org */ 1312381SN/A int size; 1322395SN/A 1332532SN/A /** Flag structure for the request. */ 1345735Snate@binkert.org Flags flags; 1352384SN/A 1362663Sstever@eecs.umich.edu /** 1372663Sstever@eecs.umich.edu * The time this request was started. Used to calculate 1382663Sstever@eecs.umich.edu * latencies. This field is set to curTick any time paddr or vaddr 1395735Snate@binkert.org * is written. 1405735Snate@binkert.org */ 1412663Sstever@eecs.umich.edu Tick time; 1422384SN/A 1432384SN/A /** The address space ID. */ 1442384SN/A int asid; 1453806Ssaidi@eecs.umich.edu 1462663Sstever@eecs.umich.edu /** The virtual address of the request. */ 1472663Sstever@eecs.umich.edu Addr vaddr; 1482384SN/A 1495735Snate@binkert.org /** 1505735Snate@binkert.org * Extra data for the request, such as the return value of 1514040Ssaidi@eecs.umich.edu * store conditional or the compare value for a CAS. */ 1524040Ssaidi@eecs.umich.edu uint64_t extraData; 1532384SN/A 1545714Shsul@eecs.umich.edu /** The context ID (for statistics, typically). */ 1555714Shsul@eecs.umich.edu int _contextId; 1565714Shsul@eecs.umich.edu /** The thread ID (id within this CPU) */ 1575714Shsul@eecs.umich.edu int _threadId; 1582384SN/A 1592381SN/A /** program counter of initiating access; for tracing/debugging */ 1602381SN/A Addr pc; 1612663Sstever@eecs.umich.edu 1622532SN/A public: 1632663Sstever@eecs.umich.edu /** Minimal constructor. No fields are initialized. */ 1642663Sstever@eecs.umich.edu Request() 1652663Sstever@eecs.umich.edu {} 1662532SN/A 1672663Sstever@eecs.umich.edu /** 1682663Sstever@eecs.umich.edu * Constructor for physical (e.g. device) requests. Initializes 1692663Sstever@eecs.umich.edu * just physical address, size, flags, and timestamp (to curTick). 1705735Snate@binkert.org * These fields are adequate to perform a request. 1715735Snate@binkert.org */ 1725735Snate@binkert.org Request(Addr paddr, int size, Flags flags) 1735735Snate@binkert.org { 1745735Snate@binkert.org setPhys(paddr, size, flags); 1755735Snate@binkert.org } 1762532SN/A 1775735Snate@binkert.org Request(int asid, Addr vaddr, int size, Flags flags, Addr pc, 1785735Snate@binkert.org int cid, int tid) 1792669Sktlim@umich.edu { 1805735Snate@binkert.org setThreadContext(cid, tid); 1815735Snate@binkert.org setVirt(asid, vaddr, size, flags, pc); 1822669Sktlim@umich.edu } 1832669Sktlim@umich.edu 1844610Ssaidi@eecs.umich.edu ~Request() {} // for FastAlloc 1854610Ssaidi@eecs.umich.edu 1862663Sstever@eecs.umich.edu /** 1875735Snate@binkert.org * Set up CPU and thread numbers. 1885735Snate@binkert.org */ 1895735Snate@binkert.org void 1905735Snate@binkert.org setThreadContext(int context_id, int thread_id) 1912663Sstever@eecs.umich.edu { 1925735Snate@binkert.org _contextId = context_id; 1935735Snate@binkert.org _threadId = thread_id; 1945735Snate@binkert.org flags.set(VALID_CONTEXT_ID|VALID_THREAD_ID); 1952663Sstever@eecs.umich.edu } 1962532SN/A 1972663Sstever@eecs.umich.edu /** 1982663Sstever@eecs.umich.edu * Set up a physical (e.g. device) request in a previously 1995735Snate@binkert.org * allocated Request object. 2005735Snate@binkert.org */ 2015735Snate@binkert.org void 2025735Snate@binkert.org setPhys(Addr _paddr, int _size, Flags _flags) 2032663Sstever@eecs.umich.edu { 2045731SSteve.Reinhardt@amd.com assert(_size >= 0); 2052663Sstever@eecs.umich.edu paddr = _paddr; 2062663Sstever@eecs.umich.edu size = _size; 2072663Sstever@eecs.umich.edu time = curTick; 2085735Snate@binkert.org 2095735Snate@binkert.org flags.set(VALID_PADDR|VALID_SIZE); 2105735Snate@binkert.org flags.clear(VALID_VADDR|VALID_PC|VALID_EXTRA_DATA|MMAPED_IPR); 2115735Snate@binkert.org flags.update(_flags, PUBLIC_FLAGS); 2122663Sstever@eecs.umich.edu } 2132532SN/A 2142663Sstever@eecs.umich.edu /** 2152663Sstever@eecs.umich.edu * Set up a virtual (e.g., CPU) request in a previously 2165735Snate@binkert.org * allocated Request object. 2175735Snate@binkert.org */ 2185735Snate@binkert.org void 2195735Snate@binkert.org setVirt(int _asid, Addr _vaddr, int _size, Flags _flags, Addr _pc) 2202663Sstever@eecs.umich.edu { 2215731SSteve.Reinhardt@amd.com assert(_size >= 0); 2222663Sstever@eecs.umich.edu asid = _asid; 2232663Sstever@eecs.umich.edu vaddr = _vaddr; 2242663Sstever@eecs.umich.edu size = _size; 2252663Sstever@eecs.umich.edu pc = _pc; 2262663Sstever@eecs.umich.edu time = curTick; 2275735Snate@binkert.org 2285735Snate@binkert.org flags.set(VALID_VADDR|VALID_SIZE|VALID_PC); 2295735Snate@binkert.org flags.clear(VALID_PADDR|VALID_EXTRA_DATA|MMAPED_IPR); 2305735Snate@binkert.org flags.update(_flags, PUBLIC_FLAGS); 2312663Sstever@eecs.umich.edu } 2322532SN/A 2335735Snate@binkert.org /** 2345735Snate@binkert.org * Set just the physical address. This should only be used to 2352663Sstever@eecs.umich.edu * record the result of a translation, and thus the vaddr must be 2362663Sstever@eecs.umich.edu * valid before this method is called. Otherwise, use setPhys() 2372663Sstever@eecs.umich.edu * to guarantee that the size and flags are also set. 2382663Sstever@eecs.umich.edu */ 2395735Snate@binkert.org void 2405735Snate@binkert.org setPaddr(Addr _paddr) 2412663Sstever@eecs.umich.edu { 2425764Snate@binkert.org assert(flags.isSet(VALID_VADDR)); 2432663Sstever@eecs.umich.edu paddr = _paddr; 2445735Snate@binkert.org flags.set(VALID_PADDR); 2452663Sstever@eecs.umich.edu } 2462532SN/A 2475735Snate@binkert.org /** 2485744Sgblack@eecs.umich.edu * Generate two requests as if this request had been split into two 2495744Sgblack@eecs.umich.edu * pieces. The original request can't have been translated already. 2505744Sgblack@eecs.umich.edu */ 2515744Sgblack@eecs.umich.edu void splitOnVaddr(Addr split_addr, RequestPtr &req1, RequestPtr &req2) 2525744Sgblack@eecs.umich.edu { 2535764Snate@binkert.org assert(flags.isSet(VALID_VADDR)); 2545764Snate@binkert.org assert(flags.noneSet(VALID_PADDR)); 2555744Sgblack@eecs.umich.edu assert(split_addr > vaddr && split_addr < vaddr + size); 2565744Sgblack@eecs.umich.edu req1 = new Request; 2575744Sgblack@eecs.umich.edu *req1 = *this; 2585744Sgblack@eecs.umich.edu req2 = new Request; 2595744Sgblack@eecs.umich.edu *req2 = *this; 2605744Sgblack@eecs.umich.edu req1->size = split_addr - vaddr; 2615744Sgblack@eecs.umich.edu req2->vaddr = split_addr; 2625744Sgblack@eecs.umich.edu req2->size = size - req1->size; 2635744Sgblack@eecs.umich.edu } 2645744Sgblack@eecs.umich.edu 2655744Sgblack@eecs.umich.edu /** 2665735Snate@binkert.org * Accessor for paddr. 2675735Snate@binkert.org */ 2685735Snate@binkert.org Addr 2695735Snate@binkert.org getPaddr() 2705735Snate@binkert.org { 2715764Snate@binkert.org assert(flags.isSet(VALID_PADDR)); 2725735Snate@binkert.org return paddr; 2735735Snate@binkert.org } 2742663Sstever@eecs.umich.edu 2755735Snate@binkert.org /** 2765735Snate@binkert.org * Accessor for size. 2775735Snate@binkert.org */ 2785735Snate@binkert.org int 2795735Snate@binkert.org getSize() 2805735Snate@binkert.org { 2815764Snate@binkert.org assert(flags.isSet(VALID_SIZE)); 2825735Snate@binkert.org return size; 2835735Snate@binkert.org } 2845735Snate@binkert.org 2852663Sstever@eecs.umich.edu /** Accessor for time. */ 2865735Snate@binkert.org Tick 2875735Snate@binkert.org getTime() 2885735Snate@binkert.org { 2895764Snate@binkert.org assert(flags.isSet(VALID_PADDR|VALID_VADDR)); 2905735Snate@binkert.org return time; 2915735Snate@binkert.org } 2925735Snate@binkert.org 2935607Snate@binkert.org void 2945607Snate@binkert.org setTime(Tick when) 2955607Snate@binkert.org { 2965764Snate@binkert.org assert(flags.isSet(VALID_PADDR|VALID_VADDR)); 2975607Snate@binkert.org time = when; 2985607Snate@binkert.org } 2992663Sstever@eecs.umich.edu 3002663Sstever@eecs.umich.edu /** Accessor for flags. */ 3015735Snate@binkert.org Flags 3025735Snate@binkert.org getFlags() 3035735Snate@binkert.org { 3045764Snate@binkert.org assert(flags.isSet(VALID_PADDR|VALID_VADDR)); 3055735Snate@binkert.org return flags & PUBLIC_FLAGS; 3065735Snate@binkert.org } 3075735Snate@binkert.org 3085735Snate@binkert.org Flags 3095735Snate@binkert.org anyFlags(Flags _flags) 3105735Snate@binkert.org { 3115764Snate@binkert.org assert(flags.isSet(VALID_PADDR|VALID_VADDR)); 3125764Snate@binkert.org assert(_flags.noneSet(~PUBLIC_FLAGS)); 3135764Snate@binkert.org return flags.isSet(_flags); 3145735Snate@binkert.org } 3155735Snate@binkert.org 3165735Snate@binkert.org Flags 3175735Snate@binkert.org allFlags(Flags _flags) 3185735Snate@binkert.org { 3195764Snate@binkert.org assert(flags.isSet(VALID_PADDR|VALID_VADDR)); 3205764Snate@binkert.org assert(_flags.noneSet(~PUBLIC_FLAGS)); 3215764Snate@binkert.org return flags.allSet(_flags); 3225735Snate@binkert.org } 3235735Snate@binkert.org 3245735Snate@binkert.org /** Accessor for flags. */ 3255735Snate@binkert.org void 3265735Snate@binkert.org setFlags(Flags _flags) 3275735Snate@binkert.org { 3285764Snate@binkert.org assert(flags.isSet(VALID_PADDR|VALID_VADDR)); 3295764Snate@binkert.org assert(_flags.noneSet(~PUBLIC_FLAGS)); 3305735Snate@binkert.org flags.set(_flags); 3315735Snate@binkert.org } 3325735Snate@binkert.org 3335735Snate@binkert.org void 3345735Snate@binkert.org clearFlags(Flags _flags) 3355735Snate@binkert.org { 3365764Snate@binkert.org assert(flags.isSet(VALID_PADDR|VALID_VADDR)); 3375764Snate@binkert.org assert(_flags.noneSet(~PUBLIC_FLAGS)); 3385735Snate@binkert.org flags.clear(_flags); 3395735Snate@binkert.org } 3405735Snate@binkert.org 3415735Snate@binkert.org void 3425735Snate@binkert.org clearFlags() 3435735Snate@binkert.org { 3445764Snate@binkert.org assert(flags.isSet(VALID_PADDR|VALID_VADDR)); 3455735Snate@binkert.org flags.clear(PUBLIC_FLAGS); 3465735Snate@binkert.org } 3472663Sstever@eecs.umich.edu 3482663Sstever@eecs.umich.edu /** Accessor function for vaddr.*/ 3495735Snate@binkert.org Addr 3505735Snate@binkert.org getVaddr() 3515735Snate@binkert.org { 3525764Snate@binkert.org assert(flags.isSet(VALID_VADDR)); 3535735Snate@binkert.org return vaddr; 3545735Snate@binkert.org } 3552663Sstever@eecs.umich.edu 3562663Sstever@eecs.umich.edu /** Accessor function for asid.*/ 3575735Snate@binkert.org int 3585735Snate@binkert.org getAsid() 3595735Snate@binkert.org { 3605764Snate@binkert.org assert(flags.isSet(VALID_VADDR)); 3615735Snate@binkert.org return asid; 3625735Snate@binkert.org } 3632663Sstever@eecs.umich.edu 3643804Ssaidi@eecs.umich.edu /** Accessor function for asi.*/ 3655735Snate@binkert.org uint8_t 3665735Snate@binkert.org getAsi() 3675735Snate@binkert.org { 3685764Snate@binkert.org assert(flags.isSet(VALID_VADDR)); 3695735Snate@binkert.org return flags & ASI_BITS; 3705735Snate@binkert.org } 3713804Ssaidi@eecs.umich.edu 3723804Ssaidi@eecs.umich.edu /** Accessor function for asi.*/ 3735735Snate@binkert.org void 3745735Snate@binkert.org setAsi(uint8_t a) 3755735Snate@binkert.org { 3765764Snate@binkert.org assert(flags.isSet(VALID_VADDR)); 3775735Snate@binkert.org flags.update(a, ASI_BITS); 3785735Snate@binkert.org } 3793806Ssaidi@eecs.umich.edu 3803804Ssaidi@eecs.umich.edu /** Accessor function for asi.*/ 3815735Snate@binkert.org bool 3825735Snate@binkert.org isMmapedIpr() 3835735Snate@binkert.org { 3845764Snate@binkert.org assert(flags.isSet(VALID_PADDR)); 3855764Snate@binkert.org return flags.isSet(MMAPED_IPR); 3865735Snate@binkert.org } 3873806Ssaidi@eecs.umich.edu 3883806Ssaidi@eecs.umich.edu /** Accessor function for asi.*/ 3895735Snate@binkert.org void 3905735Snate@binkert.org setMmapedIpr(bool r) 3915735Snate@binkert.org { 3925735Snate@binkert.org assert(VALID_VADDR); 3935735Snate@binkert.org flags.set(MMAPED_IPR); 3945735Snate@binkert.org } 3953804Ssaidi@eecs.umich.edu 3962679Sktlim@umich.edu /** Accessor function to check if sc result is valid. */ 3975735Snate@binkert.org bool 3985735Snate@binkert.org extraDataValid() 3995735Snate@binkert.org { 4005764Snate@binkert.org return flags.isSet(VALID_EXTRA_DATA); 4015735Snate@binkert.org } 4025735Snate@binkert.org 4032663Sstever@eecs.umich.edu /** Accessor function for store conditional return value.*/ 4045735Snate@binkert.org uint64_t 4055735Snate@binkert.org getExtraData() const 4065735Snate@binkert.org { 4075764Snate@binkert.org assert(flags.isSet(VALID_EXTRA_DATA)); 4085735Snate@binkert.org return extraData; 4095735Snate@binkert.org } 4105735Snate@binkert.org 4112663Sstever@eecs.umich.edu /** Accessor function for store conditional return value.*/ 4125735Snate@binkert.org void 4135735Snate@binkert.org setExtraData(uint64_t _extraData) 4145735Snate@binkert.org { 4155735Snate@binkert.org extraData = _extraData; 4165735Snate@binkert.org flags.set(VALID_EXTRA_DATA); 4175735Snate@binkert.org } 4182663Sstever@eecs.umich.edu 4196010Ssteve.reinhardt@amd.com bool 4206010Ssteve.reinhardt@amd.com hasContextId() const 4216010Ssteve.reinhardt@amd.com { 4226010Ssteve.reinhardt@amd.com return flags.isSet(VALID_CONTEXT_ID); 4236010Ssteve.reinhardt@amd.com } 4246010Ssteve.reinhardt@amd.com 4255714Shsul@eecs.umich.edu /** Accessor function for context ID.*/ 4265735Snate@binkert.org int 4275735Snate@binkert.org contextId() const 4285735Snate@binkert.org { 4295764Snate@binkert.org assert(flags.isSet(VALID_CONTEXT_ID)); 4305735Snate@binkert.org return _contextId; 4315735Snate@binkert.org } 4325735Snate@binkert.org 4335714Shsul@eecs.umich.edu /** Accessor function for thread ID. */ 4345735Snate@binkert.org int 4355735Snate@binkert.org threadId() const 4365735Snate@binkert.org { 4375764Snate@binkert.org assert(flags.isSet(VALID_THREAD_ID)); 4385735Snate@binkert.org return _threadId; 4395735Snate@binkert.org } 4402663Sstever@eecs.umich.edu 4415875Ssteve.reinhardt@amd.com bool 4425875Ssteve.reinhardt@amd.com hasPC() const 4435875Ssteve.reinhardt@amd.com { 4445875Ssteve.reinhardt@amd.com return flags.isSet(VALID_PC); 4455875Ssteve.reinhardt@amd.com } 4465875Ssteve.reinhardt@amd.com 4476010Ssteve.reinhardt@amd.com /** Accessor function for pc.*/ 4485735Snate@binkert.org Addr 4495735Snate@binkert.org getPC() const 4505735Snate@binkert.org { 4515764Snate@binkert.org assert(flags.isSet(VALID_PC)); 4525735Snate@binkert.org return pc; 4535735Snate@binkert.org } 4542532SN/A 4552811Srdreslin@umich.edu /** Accessor Function to Check Cacheability. */ 4565764Snate@binkert.org bool isUncacheable() const { return flags.isSet(UNCACHEABLE); } 4575764Snate@binkert.org bool isInstRead() const { return flags.isSet(INST_READ); } 4586102Sgblack@eecs.umich.edu bool isLLSC() const { return flags.isSet(LLSC); } 4596077Sgblack@eecs.umich.edu bool isLocked() const { return flags.isSet(LOCKED); } 4605764Snate@binkert.org bool isSwap() const { return flags.isSet(MEM_SWAP|MEM_SWAP_COND); } 4615764Snate@binkert.org bool isCondSwap() const { return flags.isSet(MEM_SWAP_COND); } 4622811Srdreslin@umich.edu 4635735Snate@binkert.org bool 4645735Snate@binkert.org isMisaligned() const 4655735Snate@binkert.org { 4665764Snate@binkert.org if (flags.isSet(NO_ALIGN_FAULT)) 4675735Snate@binkert.org return false; 4683170Sstever@eecs.umich.edu 4695735Snate@binkert.org if ((vaddr & 0x1)) 4705735Snate@binkert.org return true; 4712814Srdreslin@umich.edu 4725764Snate@binkert.org if (flags.isSet(NO_HALF_WORD_ALIGN_FAULT)) 4735735Snate@binkert.org return false; 4744040Ssaidi@eecs.umich.edu 4755735Snate@binkert.org if ((vaddr & 0x2)) 4765735Snate@binkert.org return true; 4774040Ssaidi@eecs.umich.edu 4785735Snate@binkert.org return false; 4795735Snate@binkert.org } 4802384SN/A}; 4812381SN/A 4822381SN/A#endif // __MEM_REQUEST_HH__ 483