-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsched.c
81 lines (58 loc) · 1.23 KB
/
sched.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
70
71
72
73
74
75
76
77
78
79
80
/*
* sched.c - initializes struct for task 0 anda task 1
*/
#include <sched.h>
#include <mm.h>
#include <io.h>
union task_union task[NR_TASKS]
__attribute__((__section__(".data.task")));
#if 0
struct task_struct *list_head_to_task_struct(struct list_head *l)
{
return list_entry( l, struct task_struct, list);
}
#endif
extern struct list_head blocked;
/* get_DIR - Returns the Page Directory address for task 't' */
page_table_entry * get_DIR (struct task_struct *t)
{
return t->dir_pages_baseAddr;
}
/* get_PT - Returns the Page Table address for task 't' */
page_table_entry * get_PT (struct task_struct *t)
{
return (page_table_entry *)(((unsigned int)(t->dir_pages_baseAddr->bits.pbase_addr))<<12);
}
int allocate_DIR(struct task_struct *t)
{
int pos;
pos = ((int)t-(int)task)/sizeof(union task_union);
t->dir_pages_baseAddr = (page_table_entry*) &dir_pages[pos];
return 1;
}
void cpu_idle(void)
{
__asm__ __volatile__("sti": : :"memory");
while(1)
{
;
}
}
void init_idle (void)
{
}
void init_task1(void)
{
}
void init_sched()
{
}
struct task_struct* current()
{
int ret_value;
__asm__ __volatile__(
"movl %%esp, %0"
: "=g" (ret_value)
);
return (struct task_struct*)(ret_value&0xfffff000);
}