Commit e8e107ce by triazo

Add pcb initilization

parent 7ad4babe
Showing with 23 additions and 0 deletions
......@@ -61,4 +61,26 @@ void load_elf(elf_header* elf_start)
page_map(pgdir, highest_vpage + 0x1000);
page_map(pgdir, highest_vpage + 0x2000);
// initial esp = highest_vpage + 0x1000
process* pcb = kmalloc(sizeof(process) + sizeof(context) + sizeof(trapframe));
pcb->ctxt = pcb + sizeof(process);
pcb->tf = pcb + sizeof(process) + sizeof(context)
pcb->mem = pgdir;
pcb->pid = -1;
pcb->parent = 0;
pcb->kstack = 0;
pcb->name = "debugstuff";
pcb->procstate = RUNNABLE;
pcb->ctxt->edi = 0;
pcb->ctxt->esi = 0;
pcb->ctxt->ebx = 0;
pcb->ctxt->ebp = highest_vpage + 0x1000;
pcb->ctxt->eip = elf_start->program_entry_position;
pcb->tf->ebp = highest_vpage + 0x1000;
pcb->tf->eip = elf_start->program_entry_position;
}
......@@ -13,6 +13,7 @@
#include "mem.h"
#include "string.h"
#include "serial.h"
#include "PCB.h"
extern uint8_t elf_hello[] asm("_binary_hello_elf_start");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment