7 * L4Re's VCon server could have been declared as:
9 * virtual int dispatch() = 0;
10 * virtual int read() = 0;
11 * vitrual int write() = 0;
14 * However, someone disliked the idea of having these virtual
15 * functions for performance reasons (vtable lookup). Therefore,
16 * the class is now declared as
18 * class vcon_svr<SVR> {
19 * SVR* self() { return static_cast<SVR*>(this); }
22 * So in order to implement a valid VCon server class, we need to
23 * inherit from this server class _and_ pass our class name as the
24 * template parameter at the same time.
26 class vcon_srv : public L4Re::Util::Vcon_svr<Vcap::vcon_srv>
29 int vcon_write(const char *buffer, unsigned size)
31 static char const *prefix = "\033[35m";
32 static char const *suffix = "\033[0m";
33 Char buf[L4_VCON_WRITE_SIZE] = {0, };
35 VG_(sprintf)(buf, "%s", prefix);
36 VG_(memcpy)(buf + VG_(strlen)((Char const*)prefix), buffer, size);
37 VG_(sprintf)(buf + VG_(strlen)((Char const *)prefix) + size,
40 VG_(printf)("%s", buf);
45 int vcon_read(char *buffer, unsigned size)
47 enter_kdebug("vcon_read");
51 L4::Cap<void> vcon_get_irq()
53 enter_kdebug("vcon_get_irq");
54 return L4::Cap<void>(L4_INVALID_CAP);
59 enter_kdebug("vcon_end");