35a36
> #include <memory>
49a51
> #include "sim/byteswap.hh"
319a322,346
>
> protected:
> template<typename T>
> size_t
> simpleAsBytes(void *buf, size_t max_size, const T &t)
> {
> size_t size = sizeof(T);
> if (size <= max_size)
> *reinterpret_cast<T *>(buf) = htole<T>(t);
> return size;
> }
>
> public:
> /**
> * Instruction classes can override this function to return a
> * a representation of themselves as a blob of bytes, generally assumed to
> * be that instructions ExtMachInst.
> *
> * buf is a buffer to hold the bytes.
> * max_size is the size allocated for that buffer by the caller.
> * The return value is how much data was actually put into the buffer,
> * zero if no data was put in the buffer, or the necessary size of the
> * buffer if there wasn't enough space.
> */
> virtual size_t asBytes(void *buf, size_t max_size) { return 0; }