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; --- 30 unchanged lines hidden (view full) --- 39namespace X86ISA 40{ 41 42template <class XC> 43Fault 44readMemTiming(XC *xc, Trace::InstRecord *traceData, Addr addr, 45 uint64_t &mem, unsigned dataSize, unsigned flags) 46{ | 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; --- 30 unchanged lines hidden (view full) --- 39namespace X86ISA 40{ 41 42template <class XC> 43Fault 44readMemTiming(XC *xc, Trace::InstRecord *traceData, Addr addr, 45 uint64_t &mem, unsigned dataSize, unsigned flags) 46{ |
47 return xc->readBytes(addr, (uint8_t *)&mem, dataSize, flags); | 47 return xc->readMem(addr, (uint8_t *)&mem, dataSize, flags); |
48} 49 50static inline uint64_t 51getMem(PacketPtr pkt, unsigned dataSize, Trace::InstRecord *traceData) 52{ 53 uint64_t mem; 54 switch (dataSize) { 55 case 1: --- 38 unchanged lines hidden (view full) --- 94Fault 95writeMemTiming(XC *xc, Trace::InstRecord *traceData, uint64_t mem, 96 unsigned dataSize, Addr addr, unsigned flags, uint64_t *res) 97{ 98 if (traceData) { 99 traceData->setData(mem); 100 } 101 mem = TheISA::htog(mem); | 48} 49 50static inline uint64_t 51getMem(PacketPtr pkt, unsigned dataSize, Trace::InstRecord *traceData) 52{ 53 uint64_t mem; 54 switch (dataSize) { 55 case 1: --- 38 unchanged lines hidden (view full) --- 94Fault 95writeMemTiming(XC *xc, Trace::InstRecord *traceData, uint64_t mem, 96 unsigned dataSize, Addr addr, unsigned flags, uint64_t *res) 97{ 98 if (traceData) { 99 traceData->setData(mem); 100 } 101 mem = TheISA::htog(mem); |
102 return xc->writeBytes((uint8_t *)&mem, dataSize, addr, flags, res); | 102 return xc->writeMem((uint8_t *)&mem, dataSize, addr, flags, res); |
103} 104 105template <class XC> 106Fault 107writeMemAtomic(XC *xc, Trace::InstRecord *traceData, uint64_t mem, 108 unsigned dataSize, Addr addr, unsigned flags, uint64_t *res) 109{ 110 Fault fault = writeMemTiming(xc, traceData, mem, dataSize, addr, flags, 111 res); 112 if (fault == NoFault && res != NULL) { 113 *res = gtoh(*res); 114 } 115 return fault; 116} 117 118} 119 120#endif | 103} 104 105template <class XC> 106Fault 107writeMemAtomic(XC *xc, Trace::InstRecord *traceData, uint64_t mem, 108 unsigned dataSize, Addr addr, unsigned flags, uint64_t *res) 109{ 110 Fault fault = writeMemTiming(xc, traceData, mem, dataSize, addr, flags, 111 res); 112 if (fault == NoFault && res != NULL) { 113 *res = gtoh(*res); 114 } 115 return fault; 116} 117 118} 119 120#endif |