user thread/process and elf loader stub

This commit is contained in:
Matheus
2022-08-13 23:16:34 -03:00
parent e7f4245c6d
commit 33a516a611
14 changed files with 399 additions and 7 deletions
+13
View File
@@ -11,3 +11,16 @@ void arch_regs_setupkernel(arch_regs* regs, void* ip, void* stack, bool interrup
regs->ss = 0x30;
regs->rflags = interrupts ? 0x200 : 0;
}
void arch_regs_setupuser(arch_regs* regs, void* ip, void* stack, bool interrupts){
regs->rip = ip;
regs->rsp = stack;
regs->cs = 0x38 | 3;
regs->ds = 0x40 | 3;
regs->es = 0x40 | 3;
regs->fs = 0x40 | 3;
regs->gs = 0x40 | 3;
regs->ss = 0x40 | 3;
regs->rflags = interrupts ? 0x200 : 0;
}