sched: add basic scheduler, fork syscall
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
parent
8fc9f1396e
commit
b6a9ddd1d0
8 changed files with 133 additions and 8 deletions
|
|
@ -49,6 +49,7 @@ struct thread {
|
|||
|
||||
struct proc *proc;
|
||||
struct thread *next;
|
||||
uaddr_t kstack_top;
|
||||
};
|
||||
|
||||
struct proc {
|
||||
|
|
@ -85,5 +86,8 @@ struct proc *proc_create(struct thread *parent);
|
|||
void proc_free(struct proc *proc);
|
||||
void switch_to(struct thread *from, struct thread *to);
|
||||
void proc_init();
|
||||
pid_t sys_fork();
|
||||
void schedule();
|
||||
pid_t alloc_pid();
|
||||
|
||||
#endif /* _PROC_H_ */
|
||||
|
|
|
|||
9
include/kernel/sched.h
Normal file
9
include/kernel/sched.h
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
#ifndef _SCHED_H_
|
||||
#define _SCHED_H_
|
||||
|
||||
#include <kernel/proc.h>
|
||||
|
||||
void sched_add_thread(struct thread *t);
|
||||
|
||||
#endif /* _SCHED_H_ */
|
||||
|
|
@ -10,6 +10,8 @@
|
|||
#define SYS_close 3
|
||||
#define SYS_pread 4
|
||||
#define SYS_pwrite 5
|
||||
#define SYS_fork 57
|
||||
#define SYS_exit 60
|
||||
|
||||
typedef ssize_t (*syscall_t)(u64 arg1, u64 arg2, u64 arg3, u64 arg4, u64 arg5, u64 arg6);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue