TODO - Distribute those changes earlier

This commit is contained in:
Thomas Lovén 2018-03-16 10:23:52 +01:00
parent 80aad418fc
commit 20ae7d56b3
2 changed files with 17 additions and 3 deletions

View File

@ -10,7 +10,9 @@
void thread_function() void thread_function()
{ {
while(1); char *p = 0xBADC0FFEE;
while(1)
p[0] = 1;
} }
@ -29,11 +31,15 @@ void kmain(uint64_t multiboot_magic, void *multiboot_data)
cpu_init(); cpu_init();
struct process *p1 = new_process((void (*)(void))0x10000); struct process *p1 = new_process((void (*)(void))0x10000);
procmm_brk(p1, (void *)0x10010); procmm_brk(p1, (void *)0x10100);
memcpy_to_p4(p1->P4, (void *)0x10000, (void *)(uintptr_t)thread_function, 100); memcpy_to_p4(p1->P4, (void *)0x10000, (void *)(uintptr_t)thread_function, 100);
ready(p1); ready(p1);
struct process *p2 = new_process((void (*)(void))0x10000);
procmm_brk(p2, (void *)0x10100);
memcpy_to_p4(p2->P4, (void *)0x10000, (void *)(uintptr_t)thread_function, 100);
ready(p2);
debug_ok("Boot \"Complete\"\n"); debug_ok("Boot \"Complete\"\n");
start_scheduler(); start_scheduler();

View File

@ -50,6 +50,14 @@ registers *proc_pagefault(registers *r)
return r; return r;
} }
// Very uggly and very temporary way of signaling the kernel from a user mode process.
// TODO: REMOVE THIS CRAP!
if(read_cr2() == 0xBADC0FFEE)
{
debug("Bad signal from process %d\n", cpu->proc->pid);
yield();
return r;
}
PANIC("Page fault in process\n"); PANIC("Page fault in process\n");
return r; return r;
} }