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; --- 216 unchanged lines hidden (view full) --- 225 * Set just the physical address. This should only be used to 226 * record the result of a translation, and thus the vaddr must be 227 * valid before this method is called. Otherwise, use setPhys() 228 * to guarantee that the size and flags are also set. 229 */ 230 void 231 setPaddr(Addr _paddr) 232 { |
233 assert(flags.isSet(VALID_VADDR)); |
234 paddr = _paddr; 235 flags.set(VALID_PADDR); 236 } 237 238 /** 239 * Generate two requests as if this request had been split into two 240 * pieces. The original request can't have been translated already. 241 */ 242 void splitOnVaddr(Addr split_addr, RequestPtr &req1, RequestPtr &req2) 243 { |
244 assert(flags.isSet(VALID_VADDR)); 245 assert(flags.noneSet(VALID_PADDR)); |
246 assert(split_addr > vaddr && split_addr < vaddr + size); 247 req1 = new Request; 248 *req1 = *this; 249 req2 = new Request; 250 *req2 = *this; 251 req1->size = split_addr - vaddr; 252 req2->vaddr = split_addr; 253 req2->size = size - req1->size; 254 } 255 256 /** 257 * Accessor for paddr. 258 */ 259 Addr 260 getPaddr() 261 { |
262 assert(flags.isSet(VALID_PADDR)); |
263 return paddr; 264 } 265 266 /** 267 * Accessor for size. 268 */ 269 int 270 getSize() 271 { |
272 assert(flags.isSet(VALID_SIZE)); |
273 return size; 274 } 275 276 /** Accessor for time. */ 277 Tick 278 getTime() 279 { |
280 assert(flags.isSet(VALID_PADDR|VALID_VADDR)); |
281 return time; 282 } 283 284 void 285 setTime(Tick when) 286 { |
287 assert(flags.isSet(VALID_PADDR|VALID_VADDR)); |
288 time = when; 289 } 290 |
291 /** Accessor for flags. */ 292 Flags 293 getFlags() 294 { |
295 assert(flags.isSet(VALID_PADDR|VALID_VADDR)); |
296 return flags & PUBLIC_FLAGS; 297 } 298 299 Flags 300 anyFlags(Flags _flags) 301 { |
302 assert(flags.isSet(VALID_PADDR|VALID_VADDR)); 303 assert(_flags.noneSet(~PUBLIC_FLAGS)); 304 return flags.isSet(_flags); |
305 } 306 307 Flags 308 allFlags(Flags _flags) 309 { |
310 assert(flags.isSet(VALID_PADDR|VALID_VADDR)); 311 assert(_flags.noneSet(~PUBLIC_FLAGS)); 312 return flags.allSet(_flags); |
313 } 314 315 /** Accessor for flags. */ 316 void 317 setFlags(Flags _flags) 318 { |
319 assert(flags.isSet(VALID_PADDR|VALID_VADDR)); 320 assert(_flags.noneSet(~PUBLIC_FLAGS)); |
321 flags.set(_flags); 322 } 323 324 void 325 clearFlags(Flags _flags) 326 { |
327 assert(flags.isSet(VALID_PADDR|VALID_VADDR)); 328 assert(_flags.noneSet(~PUBLIC_FLAGS)); |
329 flags.clear(_flags); 330 } 331 332 void 333 clearFlags() 334 { |
335 assert(flags.isSet(VALID_PADDR|VALID_VADDR)); |
336 flags.clear(PUBLIC_FLAGS); 337 } 338 339 /** Accessor function for vaddr.*/ 340 Addr 341 getVaddr() 342 { |
343 assert(flags.isSet(VALID_VADDR)); |
344 return vaddr; 345 } 346 347 /** Accessor function for asid.*/ 348 int 349 getAsid() 350 { |
351 assert(flags.isSet(VALID_VADDR)); |
352 return asid; 353 } 354 355 /** Accessor function for asi.*/ 356 uint8_t 357 getAsi() 358 { |
359 assert(flags.isSet(VALID_VADDR)); |
360 return flags & ASI_BITS; 361 } 362 363 /** Accessor function for asi.*/ 364 void 365 setAsi(uint8_t a) 366 { |
367 assert(flags.isSet(VALID_VADDR)); |
368 flags.update(a, ASI_BITS); 369 } 370 371 /** Accessor function for asi.*/ 372 bool 373 isMmapedIpr() 374 { |
375 assert(flags.isSet(VALID_PADDR)); 376 return flags.isSet(MMAPED_IPR); |
377 } 378 379 /** Accessor function for asi.*/ 380 void 381 setMmapedIpr(bool r) 382 { 383 assert(VALID_VADDR); 384 flags.set(MMAPED_IPR); 385 } 386 387 /** Accessor function to check if sc result is valid. */ 388 bool 389 extraDataValid() 390 { |
391 return flags.isSet(VALID_EXTRA_DATA); |
392 } 393 394 /** Accessor function for store conditional return value.*/ 395 uint64_t 396 getExtraData() const 397 { |
398 assert(flags.isSet(VALID_EXTRA_DATA)); |
399 return extraData; 400 } 401 402 /** Accessor function for store conditional return value.*/ 403 void 404 setExtraData(uint64_t _extraData) 405 { 406 extraData = _extraData; 407 flags.set(VALID_EXTRA_DATA); 408 } 409 410 /** Accessor function for context ID.*/ 411 int 412 contextId() const 413 { |
414 assert(flags.isSet(VALID_CONTEXT_ID)); |
415 return _contextId; 416 } 417 418 /** Accessor function for thread ID. */ 419 int 420 threadId() const 421 { |
422 assert(flags.isSet(VALID_THREAD_ID)); |
423 return _threadId; 424 } 425 426 /** Accessor function for pc.*/ 427 Addr 428 getPC() const 429 { |
430 assert(flags.isSet(VALID_PC)); |
431 return pc; 432 } 433 434 /** Accessor Function to Check Cacheability. */ |
435 bool isUncacheable() const { return flags.isSet(UNCACHEABLE); } 436 bool isInstRead() const { return flags.isSet(INST_READ); } 437 bool isLocked() const { return flags.isSet(LOCKED); } 438 bool isSwap() const { return flags.isSet(MEM_SWAP|MEM_SWAP_COND); } 439 bool isCondSwap() const { return flags.isSet(MEM_SWAP_COND); } |
440 441 bool 442 isMisaligned() const 443 { |
444 if (flags.isSet(NO_ALIGN_FAULT)) |
445 return false; 446 447 if ((vaddr & 0x1)) 448 return true; 449 |
450 if (flags.isSet(NO_HALF_WORD_ALIGN_FAULT)) |
451 return false; 452 453 if ((vaddr & 0x2)) 454 return true; 455 456 return false; 457 } 458}; 459 460#endif // __MEM_REQUEST_HH__ |