-
Notifications
You must be signed in to change notification settings - Fork 1
/
glue.c
69 lines (47 loc) · 1.47 KB
/
glue.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include <uk/sched.h>
#include <uk/plat/lcpu.h>
#include <uk/schedcoop.h>
#include <uk/plat/memory.h>
#include <uk/plat/time.h>
#include "sched.h"
#ifdef __cplusplus
extern "C"{
#endif
uint64_t uk_schedcoop_init(struct uk_alloc *a){
struct schedcoop_private *prv = NULL;
struct uk_sched *sched = NULL;
rust_init_sched();
uk_pr_info("Initializing cooperative scheduler\n");
sched = uk_sched_create(a, 0);
if (sched == NULL)
return NULL;
ukplat_ctx_callbacks_init(&sched->plat_ctx_cbs, ukplat_ctx_sw);
uk_sched_idle_init(sched, NULL, idle_thread_fn);
uk_sched_init(sched,
schedcoop_yield,
schedcoop_thread_add,
schedcoop_thread_remove,
schedcoop_thread_blocked,
schedcoop_thread_woken,
NULL, NULL, NULL, NULL);
uk_pr_info("WOLO%p\n", sched);
return (uint64_t) sched;
}
void schedcoop_thread_woken(struct uk_sched *s, struct uk_thread *t) {
}
void schedcoop_schedule(struct uk_sched *s) {
}
int schedcoop_thread_add(struct uk_sched *s, struct uk_thread *t, const uk_thread_attr_t *attr __unused){
}
void schedcoop_thread_remove(struct uk_sched *s, struct uk_thread *t) {
}
void schedcoop_yield(struct uk_sched *s) {
}
void idle_thread_fn(void *unused __unused) {
}
void schedcoop_thread_blocked(struct uk_sched *s, struct uk_thread *t) {
UK_ASSERT(ukplat_lcpu_irqs_disabled());
}
#ifdef __cplusplus
}
#endif