commit 3cb08405293f0153822e7301496fc07d15080b37 parent b5299ae51ab72bb44bfab55faff2b1916880898a Author: Matsuda Kenji <info@mtkn.jp> Date: Thu, 7 Mar 2024 11:45:54 +0900 wip Diffstat:
M | ex3/main.c | | | 25 | ++++++++++++++++++++++++- |
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/ex3/main.c b/ex3/main.c @@ -3,15 +3,38 @@ int puts(char *); void printh(unsigned int); void set_alarm(unsigned int); +// A proc represents a process in execution. +typedef struct proc { + // Id is the unique identifier of the process. + unsigned int id; + // R is the registers of the process with r[13] be sp, r[14] lr, r[15] pc. + unsigned int r[16]; +} proc; + +// A proc_tab is the queue of waiting processes. +typedef struct proc_tab { + // Head is the head of the queue. + proc *head; + // Next is the next process to execute. + proc *next; + // Tail is the tail of the queue. + proc *tail; +} proc_tab; + +proc_tab *ptab; + int main(void) { init(); + + proc *p0 = (proc *)0x20001000, *p1 = (proc *) 0x20001100; + return 0; } void scheduler(void) { - puts("scheduler calledabc"); + puts("scheduler called"); } void