#pragma once #include #include #include #include #include #include #include #include /* Represents an A descriptor. */ template struct InBuffer { T *buffer; size_t num_elements; BufferType type; InBuffer(void *b, size_t n) : buffer((T *)b), num_elements(n/sizeof(T)) { } }; /* Represents a B descriptor. */ template struct OutBuffer { T *buffer; size_t num_elements; OutBuffer(void *b, size_t n) : buffer((T *)b), num_elements(n/sizeof(T)) { } }; /* Represents an X descriptor. */ template struct InPointer { T *pointer; size_t num_elements; InPointer(void *p, size_t n) : pointer((T *)p), num_elements(n/sizeof(T)) { } }; /* Represents a C descriptor. */ struct OutPointerWithServerSizeBase {}; template struct OutPointerWithServerSize : OutPointerWithServerSizeBase { T *pointer; static const size_t num_elements = n; OutPointerWithServerSize(void *p) : pointer((T *)p) { } }; /* Represents a C descriptor with size in raw data. */ template struct OutPointerWithClientSize { T *pointer; size_t num_elements; OutPointerWithClientSize(void *p, size_t n) : pointer((T *)p), num_elements(n/sizeof(T)) { } }; /* Represents an input PID. */ struct PidDescriptor { u64 pid; PidDescriptor(u64 p) : pid(p) { } }; /* Represents a moved handle. */ struct MovedHandle { Handle handle; MovedHandle(Handle h) : handle(h) { } }; /* Represents a copied handle. */ struct CopiedHandle { Handle handle; CopiedHandle(Handle h) : handle(h) { } }; /* Utilities. */ template class Template> struct is_specialization_of { static const bool value = false; }; template