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
|
|
@ -1,8 +1,8 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
#include <arch/page.h>
|
||||
#include <arch/proc.h>
|
||||
#include <kernel/proc.h>
|
||||
#include <kernel/slab.h>
|
||||
#include <kernel/atomic.h>
|
||||
#include <lib/string.h>
|
||||
|
||||
#define USTACK_DEFAULT_SIZE 0x10000
|
||||
|
|
@ -10,6 +10,14 @@
|
|||
mem_cache_t *proc_slab;
|
||||
mem_cache_t *thread_slab;
|
||||
|
||||
/* PID allocator */
|
||||
static u64 _pid_counter = 1;
|
||||
|
||||
pid_t alloc_pid()
|
||||
{
|
||||
return atomic_xadd(&_pid_counter, 1);
|
||||
}
|
||||
|
||||
int proc_kill(struct proc *proc, int signal)
|
||||
{
|
||||
return -ENOSYS;
|
||||
|
|
@ -114,12 +122,6 @@ struct proc *proc_create(struct thread *parent)
|
|||
return ret;
|
||||
}
|
||||
|
||||
pid_t sys_fork()
|
||||
{
|
||||
struct thread *cur_thread = get_cur_thread();
|
||||
struct proc *ret = proc_create(cur_thread);
|
||||
}
|
||||
|
||||
void proc_free(struct proc *proc)
|
||||
{
|
||||
slab_free(proc_slab, proc);
|
||||
|
|
|
|||
Loading…
Reference in a new issue