kernel: add a temporary syscall dispatch system
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#ifndef MANGO_X86_64_INIT_H_
|
||||
#define MANGO_X86_64_INIT_H_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#ifndef MANGO_USER_PMAP_H_
|
||||
#define MANGO_USER_PMAP_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef uintptr_t ml_pmap_t;
|
||||
typedef uint64_t ml_pfn_t;
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <mango/machine/irq.h>
|
||||
#include <mango/panic.h>
|
||||
#include <mango/sched.h>
|
||||
#include <mango/syscall.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#define MAX_ISR_HANDLERS 16
|
||||
@@ -151,6 +152,8 @@ int idt_init(struct idt_ptr *ptr)
|
||||
init_global_idt();
|
||||
}
|
||||
|
||||
set_syscall_gate((uintptr_t)syscall_gate);
|
||||
|
||||
ptr->i_limit = sizeof(idt) - 1;
|
||||
ptr->i_base = (uintptr_t)&idt;
|
||||
|
||||
@@ -203,7 +206,7 @@ void irq_dispatch(struct ml_cpu_context *regs)
|
||||
void syscall_dispatch(struct ml_cpu_context *regs)
|
||||
{
|
||||
unsigned int sysid = regs->rax;
|
||||
virt_addr_t syscall_impl = 0; // TODO
|
||||
virt_addr_t syscall_impl = syscall_get_func(sysid);
|
||||
|
||||
if (syscall_impl == 0) {
|
||||
regs->rax = KERN_UNSUPPORTED;
|
||||
|
||||
Reference in New Issue
Block a user