blob: dd494565627bd46b46f8d5e456d23f0f2db610b4 (
plain) (
blame)
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
|
#include "process.h"
#include "arch/x86_64/hal/obj.h"
#include "hal/obj.h"
#include "init.h"
#include "smp.h"
#include "paging.h"
#include "jove.h"
PAGEALIGN char s_init_pcb_bytes[0x1000] = { 0 };
static pcb_t *s_init_pcb = (pcb_t*)&s_init_pcb_bytes;
void
processing_setup(void (*process_main))
{
uintptr_t ksp = (uintptr_t)&s_init_pcb_bytes + 8;
s_init_pcb->ksp = (void*)ksp;
s_init_pcb->pml4 = paging_get_pml4();
processor_t *proc = processor_current();
proc->pcb = s_init_pcb;
proc->tss.rsp[0] = (uintptr_t)s_init_pcb->ksp;
{
jove_owned_obj_t *process_obj = obj_take(objdir_getlocal(_rootdir_obj, ROOTDIR_PCB_I));
obj_settype(process_obj, JOVE_OBJ_PROCESS);
obj_setvalue(process_obj, (uintptr_t)s_init_pcb);
obj_release(process_obj);
}
__asm__ volatile("\
movq %0, %%rsp; \
movq $0, %%rbp; \
jmpq %1"::
"r"(s_init_pcb->ksp), "r"(process_main));
}
|