1/* |
2 * Copyright (c) 2014-2015 ARM Limited |
3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software 9 * licensed hereunder. You may use the software subject to the license 10 * terms below provided that you ensure that this notice is replicated --- 188 unchanged lines hidden (view full) --- 199 header.len, header.type, header.tag); 200 } 201 DDUMP(VIO9PData, data, size); 202#endif 203} 204 205 206VirtIO9PProxy::VirtIO9PProxy(Params *params) |
207 : VirtIO9PBase(params), deviceUsed(false) |
208{ 209} 210 211VirtIO9PProxy::~VirtIO9PProxy() 212{ 213} 214 215 216void |
217VirtIO9PProxy::serialize(CheckpointOut &cp) const |
218{ |
219 if (deviceUsed) { 220 warn("Serializing VirtIO9Base device after device has been used. It is " 221 "likely that state will be lost, and that the device will cease " 222 "to work!"); 223 } 224 SERIALIZE_SCALAR(deviceUsed); 225 226 VirtIO9PBase::serialize(cp); |
227} 228 229void 230VirtIO9PProxy::unserialize(CheckpointIn &cp) 231{ |
232 UNSERIALIZE_SCALAR(deviceUsed); 233 234 if (deviceUsed) { 235 warn("Unserializing VirtIO9Base device after device has been used. It is " 236 "likely that state has been lost, and that the device will cease " 237 "to work!"); 238 } 239 VirtIO9PBase::unserialize(cp); |
240} 241 242 243void 244VirtIO9PProxy::recvTMsg(const P9MsgHeader &header, 245 const uint8_t *data, size_t size) 246{ |
247 deviceUsed = true; |
248 assert(header.len == sizeof(header) + size); 249 // While technically not needed, we send the packet as one 250 // contiguous segment to make some packet dissectors happy. 251 uint8_t out[header.len]; 252 P9MsgHeader header_out(htop9(header)); 253 memcpy(out, (uint8_t *)&header_out, sizeof(header_out)); 254 memcpy(out + sizeof(header_out), data, size); 255 writeAll(out, sizeof(header_out) + size); --- 241 unchanged lines hidden --- |