Skip to content
Snippets Groups Projects
Commit ce747d68 authored by ManuelWelte's avatar ManuelWelte
Browse files

Initial syscall implementation

parent 6bc5a61b
No related branches found
No related tags found
No related merge requests found
......@@ -11,6 +11,43 @@ struct pb_plan {
};
typedef struct pb_plan pb_plan_t;
typedef struct pb_plan_info pb_plan_info_t;
SYSCALL_DEFINE1(pb_set_plan_debug, pb_plan_info_t*, plan_info) {
pb_plan_info_t _plan_info;
int res;
res = copy_from_user(&_plan_info, plan_info, sizeof(pb_plan_info_t));
struct task_struct* task = find_task_by_vpid(_plan_info.pid);
task->sched_class = &pb_sched_class;
struct rq* rq;
rq = this_rq();
struct pb_rq *pb_rq = &rq->pb;
set_pb_plan_size(pb_rq, _plan_info.num_tasks);
unsigned int i;
for(i = 0; i < _plan_info.num_tasks; i++ ) {
set_pb_plan_entry(
pb_rq,
i,
_plan_info.inst_cnt[i],
i,
task
);
}
pb_submit_plan(rq);
// TODO:
// - perf_event stuff
// - ...
return 0;
}
SYSCALL_DEFINE1(pb_set_plan, pb_plan_t*, plan) {
pb_plan_t _plan = {0};
int res;
......@@ -24,6 +61,7 @@ SYSCALL_DEFINE1(pb_set_plan, pb_plan_t*, plan) {
*/
int pb_submit_plan(struct rq *rq)
{
find_task_by_vpid(20);
/*
* Must be volatile to ensure correct initialization order
*/
......
......@@ -540,6 +540,12 @@ struct pb_init_struct
u64 n_admin_cycles; // amount of timer ticks before PB tasks are allowed to run
};
struct pb_plan_info {
pid_t pid;
uint64_t *inst_cnt;
size_t num_tasks;
};
struct pb_rq
{
struct plan_entry *plan; // plan (used to be proxy_task)
......@@ -891,6 +897,8 @@ static inline int cpu_of(struct rq *rq)
#endif
}
struct task_struct *find_task_by_vpid(pid_t vnr);
// used to determine the next mode of the PB-Scheduler
// This function is located in sched.h since pb.c and fair.c are using this function
static inline int determine_next_mode_pb(struct rq *rq)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment