memhelpers.hh (8442:b1f3dfae06f1) | memhelpers.hh (8444:56de1f9320df) |
---|---|
1/* 2 * Copyright (c) 2011 Google 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; --- 28 unchanged lines hidden (view full) --- 37#include "sim/insttracer.hh" 38 39/// Read from memory in timing mode. 40template <class XC, class MemT> 41Fault 42readMemTiming(XC *xc, Trace::InstRecord *traceData, Addr addr, 43 MemT &mem, unsigned flags) 44{ | 1/* 2 * Copyright (c) 2011 Google 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; --- 28 unchanged lines hidden (view full) --- 37#include "sim/insttracer.hh" 38 39/// Read from memory in timing mode. 40template <class XC, class MemT> 41Fault 42readMemTiming(XC *xc, Trace::InstRecord *traceData, Addr addr, 43 MemT &mem, unsigned flags) 44{ |
45 return xc->readBytes(addr, (uint8_t *)&mem, sizeof(MemT), flags); | 45 return xc->readMem(addr, (uint8_t *)&mem, sizeof(MemT), flags); |
46} 47 48/// Extract the data returned from a timing mode read. 49template <class MemT> 50void 51getMem(PacketPtr pkt, MemT &mem, Trace::InstRecord *traceData) 52{ 53 mem = pkt->get<MemT>(); --- 22 unchanged lines hidden (view full) --- 76Fault 77writeMemTiming(XC *xc, Trace::InstRecord *traceData, MemT mem, Addr addr, 78 unsigned flags, uint64_t *res) 79{ 80 if (traceData) { 81 traceData->setData(mem); 82 } 83 mem = TheISA::htog(mem); | 46} 47 48/// Extract the data returned from a timing mode read. 49template <class MemT> 50void 51getMem(PacketPtr pkt, MemT &mem, Trace::InstRecord *traceData) 52{ 53 mem = pkt->get<MemT>(); --- 22 unchanged lines hidden (view full) --- 76Fault 77writeMemTiming(XC *xc, Trace::InstRecord *traceData, MemT mem, Addr addr, 78 unsigned flags, uint64_t *res) 79{ 80 if (traceData) { 81 traceData->setData(mem); 82 } 83 mem = TheISA::htog(mem); |
84 return xc->writeBytes((uint8_t *)&mem, sizeof(MemT), addr, flags, res); | 84 return xc->writeMem((uint8_t *)&mem, sizeof(MemT), addr, flags, res); |
85} 86 87/// Write to memory in atomic mode. 88template <class XC, class MemT> 89Fault 90writeMemAtomic(XC *xc, Trace::InstRecord *traceData, const MemT &mem, 91 Addr addr, unsigned flags, uint64_t *res) 92{ 93 Fault fault = writeMemTiming(xc, traceData, mem, addr, flags, res); 94 if (fault == NoFault && res != NULL) { 95 *res = gtoh((MemT)*res); 96 } 97 return fault; 98} 99 100#endif | 85} 86 87/// Write to memory in atomic mode. 88template <class XC, class MemT> 89Fault 90writeMemAtomic(XC *xc, Trace::InstRecord *traceData, const MemT &mem, 91 Addr addr, unsigned flags, uint64_t *res) 92{ 93 Fault fault = writeMemTiming(xc, traceData, mem, addr, flags, res); 94 if (fault == NoFault && res != NULL) { 95 *res = gtoh((MemT)*res); 96 } 97 return fault; 98} 99 100#endif |