Deleted Added
sdiff udiff text old ( 8551:4e09d02322fb ) new ( 8832:247fee427324 )
full compact
1/*
2 * Copyright (c) 2002-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

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

45#include "base/flags.hh"
46#include "base/misc.hh"
47#include "base/types.hh"
48#include "sim/core.hh"
49
50class Request;
51
52typedef Request* RequestPtr;
53
54class Request : public FastAlloc
55{
56 public:
57 typedef uint32_t FlagsType;
58 typedef ::Flags<FlagsType> Flags;
59
60 /** ASI information for this request if it exists. */

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

95 static const FlagsType PF_EXCLUSIVE = 0x02000000;
96 /** The request should be marked as LRU. */
97 static const FlagsType EVICT_NEXT = 0x04000000;
98
99 /** These flags are *not* cleared when a Request object is reused
100 (assigned a new address). */
101 static const FlagsType STICKY_FLAGS = INST_FETCH;
102
103 private:
104 typedef uint8_t PrivateFlagsType;
105 typedef ::Flags<PrivateFlagsType> PrivateFlags;
106
107 /** Whether or not the size is valid. */
108 static const PrivateFlagsType VALID_SIZE = 0x00000001;
109 /** Whether or not paddr is valid (has been written yet). */
110 static const PrivateFlagsType VALID_PADDR = 0x00000002;

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

132
133 /**
134 * The size of the request. This field must be set when vaddr or
135 * paddr is written via setVirt() or setPhys(), so it is always
136 * valid as long as one of the address fields is valid.
137 */
138 int _size;
139
140 /** Flag structure for the request. */
141 Flags _flags;
142
143 /** Private flags for field validity checking. */
144 PrivateFlags privateFlags;
145
146 /**
147 * The time this request was started. Used to calculate

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

177 Request()
178 {}
179
180 /**
181 * Constructor for physical (e.g. device) requests. Initializes
182 * just physical address, size, flags, and timestamp (to curTick()).
183 * These fields are adequate to perform a request.
184 */
185 Request(Addr paddr, int size, Flags flags)
186 {
187 setPhys(paddr, size, flags);
188 }
189
190 Request(Addr paddr, int size, Flags flags, Tick time)
191 {
192 setPhys(paddr, size, flags, time);
193 }
194
195 Request(Addr paddr, int size, Flags flags, Tick time, Addr pc)
196 {
197 setPhys(paddr, size, flags, time);
198 privateFlags.set(VALID_PC);
199 _pc = pc;
200 }
201
202 Request(int asid, Addr vaddr, int size, Flags flags, Addr pc,
203 int cid, ThreadID tid)
204 {
205 setVirt(asid, vaddr, size, flags, pc);
206 setThreadContext(cid, tid);
207 }
208
209 ~Request() {} // for FastAlloc
210
211 /**
212 * Set up CPU and thread numbers.
213 */

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

219 privateFlags.set(VALID_CONTEXT_ID|VALID_THREAD_ID);
220 }
221
222 /**
223 * Set up a physical (e.g. device) request in a previously
224 * allocated Request object.
225 */
226 void
227 setPhys(Addr paddr, int size, Flags flags, Tick time)
228 {
229 assert(size >= 0);
230 _paddr = paddr;
231 _size = size;
232 _time = time;
233
234 _flags.clear(~STICKY_FLAGS);
235 _flags.set(flags);
236 privateFlags.clear(~STICKY_PRIVATE_FLAGS);
237 privateFlags.set(VALID_PADDR|VALID_SIZE);
238 }
239
240 void
241 setPhys(Addr paddr, int size, Flags flags)
242 {
243 setPhys(paddr, size, flags, curTick());
244 }
245
246 /**
247 * Set up a virtual (e.g., CPU) request in a previously
248 * allocated Request object.
249 */
250 void
251 setVirt(int asid, Addr vaddr, int size, Flags flags, Addr pc)
252 {
253 assert(size >= 0);
254 _asid = asid;
255 _vaddr = vaddr;
256 _size = size;
257 _pc = pc;
258 _time = curTick();
259
260 _flags.clear(~STICKY_FLAGS);
261 _flags.set(flags);
262 privateFlags.clear(~STICKY_PRIVATE_FLAGS);
263 privateFlags.set(VALID_VADDR|VALID_SIZE|VALID_PC);
264 }

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

364 /** Accessor function for vaddr.*/
365 Addr
366 getVaddr()
367 {
368 assert(privateFlags.isSet(VALID_VADDR));
369 return _vaddr;
370 }
371
372 /** Accessor function for asid.*/
373 int
374 getAsid()
375 {
376 assert(privateFlags.isSet(VALID_VADDR));
377 return _asid;
378 }
379

--- 88 unchanged lines hidden ---