proc: page: add pgd_clone
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
parent
d7477ae860
commit
baf8c4c7e5
11 changed files with 143 additions and 32 deletions
|
|
@ -1,9 +1,43 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
#include <kernel/proc.h>
|
||||
#include <kernel/slab.h>
|
||||
|
||||
mem_cache_t *proc_slab;
|
||||
mem_cache_t *thread_slab;
|
||||
|
||||
int proc_kill(struct proc *proc, int signal)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
struct proc *proc_create(struct proc *parent)
|
||||
{
|
||||
struct proc *ret = slab_alloc(proc_slab);
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
struct thread *r_mt = slab_alloc(thread_slab);
|
||||
if (!r_mt) {
|
||||
slab_free(proc_slab, ret);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pgd_t *p;
|
||||
if (parent)
|
||||
p = parent->pgd;
|
||||
else
|
||||
p = kpgd;
|
||||
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void proc_free(struct proc *proc)
|
||||
{
|
||||
slab_free(proc_slab, proc);
|
||||
}
|
||||
|
||||
void proc_init()
|
||||
{
|
||||
proc_slab = slab_create("proc_slab", sizeof(struct proc), 1 * MB, 8);
|
||||
|
|
|
|||
Loading…
Reference in a new issue