aboutsummaryrefslogtreecommitdiff
path: root/kernel/features
diff options
context:
space:
mode:
authorMarvin Borner2021-03-20 19:52:56 +0100
committerMarvin Borner2021-03-20 19:52:56 +0100
commitb96c27bba0b242fc860fc9a2fcb63f121312fa7e (patch)
tree0febf9d97020f131055ee41fe6d8b8bd6593045a /kernel/features
parent635751fc2a75f66d1541469b3204efb1701bd91c (diff)
LGTM!
Diffstat (limited to 'kernel/features')
-rw-r--r--kernel/features/load.c5
-rw-r--r--kernel/features/mm.c26
-rw-r--r--kernel/features/syscall.c10
3 files changed, 22 insertions, 19 deletions
diff --git a/kernel/features/load.c b/kernel/features/load.c
index d3f3495..3430a75 100644
--- a/kernel/features/load.c
+++ b/kernel/features/load.c
@@ -104,9 +104,8 @@ s32 elf_load(const char *path, struct proc *proc)
struct memory_range prange = physical_alloc(vrange.size);
virtual_map(proc->page_dir, prange, vrange.base, MEMORY_CLEAR | MEMORY_USER);
- if ((u32)vfs_read(path, (void *)program.vaddr, program.offset, program.filesz) !=
- program.filesz) {
- print("OH NOSE!\n");
+ if ((u32)vfs_read(proc->name, (void *)program.vaddr, program.offset,
+ program.filesz) != program.filesz) {
memory_switch_dir(prev);
return -ENOEXEC;
}
diff --git a/kernel/features/mm.c b/kernel/features/mm.c
index b06657f..b804076 100644
--- a/kernel/features/mm.c
+++ b/kernel/features/mm.c
@@ -4,6 +4,7 @@
#include <assert.h>
#include <cpu.h>
#include <def.h>
+#include <fb.h>
#include <mem.h>
#include <mm.h>
#include <print.h>
@@ -15,23 +16,23 @@ static struct page_table kernel_tables[PAGE_KERNEL_COUNT] ALIGNED(PAGE_SIZE) = {
* Lowlevel paging
*/
-/*static void paging_disable(void)
+static void paging_switch_dir(u32 dir)
+{
+ cr3_set(dir);
+}
+
+extern void paging_invalidate_tlb(void);
+
+/*void paging_disable(void)
{
cr0_set(cr0_get() | 0x7fffffff);
}*/
-static void paging_enable(void)
+void paging_enable(void)
{
cr0_set(cr0_get() | 0x80000000);
}
-static void paging_switch_dir(u32 dir)
-{
- cr3_set(dir);
-}
-
-extern void paging_invalidate_tlb(void);
-
void page_fault_handler(struct regs *r)
{
print("--- PAGE FAULT! ---\n");
@@ -415,12 +416,12 @@ void memory_backup_dir(struct page_dir **backup)
static u8 memory_bypass_validity = 0;
void memory_bypass_enable(void)
{
- memory_bypass_validity = 1;
+ /* memory_bypass_validity = 1; */
}
void memory_bypass_disable(void)
{
- memory_bypass_validity = 0;
+ /* memory_bypass_validity = 0; */
}
// TODO: Limit by proc stack and data range
@@ -506,9 +507,10 @@ void memory_install(struct mem_info *mem_info, struct vid_info *vid_info)
memory_map_identity(&kernel_dir, memory_range_around(STACK_START - STACK_SIZE, STACK_SIZE),
MEMORY_NONE);
- // Map VBE data
+ // Map framebuffer
memory_map_identity(&kernel_dir, memory_range_around((u32)vid_info->vbe, 0x1000),
MEMORY_NONE);
+ fb_map_buffer(virtual_kernel_dir(), vid_info);
// Unmap NULL byte/page
struct memory_range zero = memory_range(0, PAGE_SIZE);
diff --git a/kernel/features/syscall.c b/kernel/features/syscall.c
index 2334947..7d68d93 100644
--- a/kernel/features/syscall.c
+++ b/kernel/features/syscall.c
@@ -73,11 +73,13 @@ static void syscall_handler(struct regs *r)
char *path = (char *)r->ebx;
struct proc *proc = proc_make(PROC_PRIV_NONE);
r->eax = (u32)elf_load(path, proc);
- if (r->eax != 0)
+ if (r->eax != 0) {
proc_exit(proc, -r->eax);
- // TODO: Reimplement argc,argv
- proc_stack_push(proc, 0);
- proc_yield(r);
+ } else {
+ // TODO: Reimplement argc,argv
+ proc_stack_push(proc, 0);
+ proc_yield(r);
+ }
break;
}
case SYS_EXIT: {