fs9p.cc (10905:a6ca6831e775) fs9p.cc (11204:7a9eeecf2b52)
1/*
1/*
2 * Copyright (c) 2014 ARM Limited
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)
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)
207 : VirtIO9PBase(params), deviceUsed(false)
208{
209}
210
211VirtIO9PProxy::~VirtIO9PProxy()
212{
213}
214
215
216void
208{
209}
210
211VirtIO9PProxy::~VirtIO9PProxy()
212{
213}
214
215
216void
217VirtIO9PProxy::VirtIO9PProxy::serialize(CheckpointOut &cp) const
217VirtIO9PProxy::serialize(CheckpointOut &cp) const
218{
218{
219 fatal("Can't checkpoint a system with a VirtIO 9p proxy!\n");
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);
220}
221
222void
223VirtIO9PProxy::unserialize(CheckpointIn &cp)
224{
227}
228
229void
230VirtIO9PProxy::unserialize(CheckpointIn &cp)
231{
225 fatal("Can't checkpoint a system with a VirtIO 9p proxy!\n");
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);
226}
227
228
229void
230VirtIO9PProxy::recvTMsg(const P9MsgHeader &header,
231 const uint8_t *data, size_t size)
232{
240}
241
242
243void
244VirtIO9PProxy::recvTMsg(const P9MsgHeader &header,
245 const uint8_t *data, size_t size)
246{
247 deviceUsed = true;
233 assert(header.len == sizeof(header) + size);
234 // While technically not needed, we send the packet as one
235 // contiguous segment to make some packet dissectors happy.
236 uint8_t out[header.len];
237 P9MsgHeader header_out(htop9(header));
238 memcpy(out, (uint8_t *)&header_out, sizeof(header_out));
239 memcpy(out + sizeof(header_out), data, size);
240 writeAll(out, sizeof(header_out) + size);

--- 241 unchanged lines hidden ---
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 ---