aboutsummaryrefslogtreecommitdiff
path: root/fesvr/htif_pthread.h
diff options
context:
space:
mode:
authorAndrew Waterman <andrew@sifive.com>2019-03-31 00:49:57 -0700
committerAndrew Waterman <andrew@sifive.com>2019-03-31 00:50:15 -0700
commitf49618ca9d674ec7e596118f85027c4b503862ac (patch)
tree3b6ad73cbe8760309f930b743950a2853ad17668 /fesvr/htif_pthread.h
parent61cb96df00067ba61cf3816c74c18aef5677197a (diff)
downloadspike-static-link.zip
spike-static-link.tar.gz
spike-static-link.tar.bz2
Add fesvr; only globally install fesvr headers/libsstatic-link
Diffstat (limited to 'fesvr/htif_pthread.h')
-rw-r--r--fesvr/htif_pthread.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/fesvr/htif_pthread.h b/fesvr/htif_pthread.h
new file mode 100644
index 0000000..c00c382
--- /dev/null
+++ b/fesvr/htif_pthread.h
@@ -0,0 +1,38 @@
+// See LICENSE for license details.
+
+#ifndef _HTIF_PTHREAD_H
+#define _HTIF_PTHREAD_H
+
+#include "htif.h"
+#include "context.h"
+#include <deque>
+
+class htif_pthread_t : public htif_t
+{
+ public:
+ htif_pthread_t(int argc, char** argv);
+ virtual ~htif_pthread_t();
+
+ // target inteface
+ void send(const void* buf, size_t size);
+ void recv(void* buf, size_t size);
+ bool recv_nonblocking(void* buf, size_t size);
+
+ protected:
+ // host interface
+ virtual ssize_t read(void* buf, size_t max_size);
+ virtual ssize_t write(const void* buf, size_t size);
+
+ virtual size_t chunk_align() { return 64; }
+ virtual size_t chunk_max_size() { return 1024; }
+
+ private:
+ context_t host;
+ context_t* target;
+ std::deque<char> th_data;
+ std::deque<char> ht_data;
+
+ static void thread_main(void* htif);
+};
+
+#endif