Sanitize vcoreid from untrusted sources
[akaros.git] / kern / include / ros / bcq_struct.h
1 /* Copyright (c) 2010 The Regents of the University of California
2  * Barret Rhoden <brho@cs.berkeley.edu>
3  * See LICENSE for details.
4  *
5  * Struct for the BCQ.  Needs to be in its own file so glibc doesn't try to
6  * include any of the atomics needed for the actual BCQ operations.  */
7
8 #pragma once
9
10 #include <ros/common.h>
11
12 struct bcq_header {
13         uint32_t prod_idx;      /* next to be produced in */
14         uint32_t cons_pub_idx;  /* last completely consumed */
15         uint32_t cons_pvt_idx;  /* last a consumer has dibs on */
16 };
17
18 #define DEFINE_BCQ_TYPES(__name, __elem_t, __num_elems)                        \
19                                                                                \
20 /* Wrapper, per element, with the consumption bool */                          \
21 struct __name##_bcq_wrap {                                                     \
22         __elem_t elem;                                                         \
23         bool rdy_for_cons;      /* elem is ready for consumption */            \
24 };                                                                             \
25                                                                                \
26 /* The actual BC queue */                                                      \
27 struct __name##_bcq {                                                          \
28         struct bcq_header hdr;                                                 \
29         struct __name##_bcq_wrap wraps[__num_elems];                           \
30 };