Sanitize vcoreid from untrusted sources
[akaros.git] / kern / include / ros / procdata.h
1 /* Copyright (c) 2009 The Regents of the University of California
2  * See LICENSE for details.  */
3
4 #pragma once
5
6 #include <ros/memlayout.h>
7 #include <ros/ring_syscall.h>
8 #include <ros/sysevent.h>
9 #include <ros/arch/arch.h>
10 #include <ros/common.h>
11 #include <ros/procinfo.h>
12 #include <ros/event.h>
13
14 typedef struct procdata {
15         /*
16         syscall_sring_t                 syscallring;
17         char                            pad1[SYSCALLRINGSIZE -
18                                              sizeof(syscall_sring_t)];
19         */
20         syscall_sring_t                 *syscallring;
21         sysevent_sring_t                syseventring;
22         char                            pad2[SYSEVENTRINGSIZE
23                                              - sizeof(sysevent_sring_t)];
24         bool                            printx_on;
25         uint8_t                         pad8;
26         uint16_t                        pad16;
27         uint32_t                        pad32;
28         struct resource_req             res_req[MAX_NUM_RESOURCES];
29         struct event_queue              *kernel_evts[MAX_NR_EVENT];
30         /* Long range, would like these to be mapped in lazily, as the vcores
31          * are requested.  Sharing MAX_NUM_CORES is a bit weird too. */
32         struct preempt_data             vcore_preempt_data[MAX_NUM_CORES];
33 } procdata_t;
34
35 #define PROCDATA_NUM_PAGES  ((sizeof(procdata_t)-1)/PGSIZE + 1)
36
37 /* TODO: I dislike having this not be a pointer (for kernel programming) */
38 #define __procdata (*(procdata_t*)UDATA)