kern

view src/proc.c @ 44:7bc74736c7e8

added the first test process code and system call numbers header
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 25 Jul 2011 11:29:57 +0300
parents e6de3c6015cb
children b8f02479e3f4
line source
1 #include "proc.h"
2 #include "tss.h"
4 static struct process proc[MAX_PROC];
5 static int cur_pid;
7 void init_proc(void)
8 {
9 cur_pid = -1;
11 /* prepare the first process */
13 /* create the virtual address space for this process */
14 proc[0].ctx.pgtbl_paddr = clone_vmem();
16 /* allocate a chunk of memory for the process image
17 * and copy the code of test_proc there.
18 * (should be mapped at a fixed address)
19 */
21 /* fill in the proc[0].ctx with the appropriate process stack
22 * and instruction pointers
23 */
25 /* switch to it by calling a function that takes the context
26 * of the current process, plugs the values into the interrupt
27 * stack, and calls iret.
28 * (should also set ss0/sp0 in TSS before returning)
29 */
30 }
32 /*
33 void save_context(struct intr_frame *ifrm)
34 {
35 proc[cur_pid].ctx->regs = ifrm->regs;
36 proc[cur_pid].ctx->instr_ptr = ifrm->eip;
37 proc[cur_pid].ctx->stack_ptr = ifrm->esp;
38 proc[cur_pid].ctx->flags = ifrm->eflags;
39 }*/