Skip to content

Commit

Permalink
[IO] Added possibility to save and restore IO requests
Browse files Browse the repository at this point in the history
  • Loading branch information
Germain Haugou committed May 1, 2022
1 parent 76aa2f5 commit 049b082
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion engine/include/vp/itf/io.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#define __VP_ITF_IO_HPP__

#include "vp/vp.hpp"
#include "vp/queue.hpp"

namespace vp {

Expand Down Expand Up @@ -51,7 +52,7 @@ namespace vp {
typedef void (io_resp_meth_t)(void *, io_req *);
typedef void (io_grant_meth_t)(void *, io_req *);

class io_req
class io_req : public vp::queue_elem
{
friend class io_master;
friend class io_slave;
Expand All @@ -69,6 +70,9 @@ namespace vp {
void set_next(io_req *req) { next = req; }
io_req *get_next() { return next; }

inline void save();
inline void restore();

uint64_t get_addr() { return addr; }
void set_addr(uint64_t value) { addr = value; }

Expand Down Expand Up @@ -695,6 +699,22 @@ namespace vp {
}
}

inline void io_req::save()
{
arg_push((void *)(long)this->addr);
arg_push((void *)(long)this->size);
arg_push((void *)this->data);
arg_push((void *)(long)this->is_write);
}

inline void io_req::restore()
{
this->is_write = (long)arg_pop();
this->data = (uint8_t *)arg_pop();
this->size = (long)arg_pop();
this->addr = (long)arg_pop();
}

};

#endif

0 comments on commit 049b082

Please sign in to comment.