diff options
author | Marvin Borner | 2020-05-06 19:04:05 +0200 |
---|---|---|
committer | Marvin Borner | 2020-05-06 19:04:05 +0200 |
commit | d94ffac4a584dc7a4f6f2ec567b8caab05ce9253 (patch) | |
tree | 559cd596a0a407d4b40c1d12d3c6a0686494da16 /src/kernel/syscall | |
parent | 1a8563a05608b5b5e27eada44cf4790926001c68 (diff) |
New build parameters and shared includes
This changes many files but I've just applied some replace commands.. So
- nothing special!
Diffstat (limited to 'src/kernel/syscall')
-rw-r--r-- | src/kernel/syscall/actions/sys_exec.c | 4 | ||||
-rw-r--r-- | src/kernel/syscall/actions/sys_exit.c | 4 | ||||
-rw-r--r-- | src/kernel/syscall/actions/sys_fork.c | 12 | ||||
-rw-r--r-- | src/kernel/syscall/actions/sys_free.c | 4 | ||||
-rw-r--r-- | src/kernel/syscall/actions/sys_get_pid.c | 4 | ||||
-rw-r--r-- | src/kernel/syscall/actions/sys_malloc.c | 6 | ||||
-rw-r--r-- | src/kernel/syscall/actions/sys_read.c | 4 | ||||
-rw-r--r-- | src/kernel/syscall/actions/sys_write.c | 4 | ||||
-rw-r--r-- | src/kernel/syscall/syscall.c | 37 | ||||
-rw-r--r-- | src/kernel/syscall/syscall.h | 18 |
10 files changed, 49 insertions, 48 deletions
diff --git a/src/kernel/syscall/actions/sys_exec.c b/src/kernel/syscall/actions/sys_exec.c index 000d185..049d085 100644 --- a/src/kernel/syscall/actions/sys_exec.c +++ b/src/kernel/syscall/actions/sys_exec.c @@ -1,7 +1,7 @@ #include <stdint.h> -#include <kernel/tasks/process.h> +#include <tasks/process.h> -uint32_t sys_exec(char *path) +u32 sys_exec(char *path) { return uexec(path); }
\ No newline at end of file diff --git a/src/kernel/syscall/actions/sys_exit.c b/src/kernel/syscall/actions/sys_exit.c index e2761fd..98e0c34 100644 --- a/src/kernel/syscall/actions/sys_exit.c +++ b/src/kernel/syscall/actions/sys_exit.c @@ -1,7 +1,7 @@ #include <stdint.h> -#include <kernel/tasks/process.h> +#include <tasks/process.h> -uint32_t sys_exit(uint32_t code) +u32 sys_exit(u32 code) { current_proc->state = PROC_ASLEEP; return code; diff --git a/src/kernel/syscall/actions/sys_fork.c b/src/kernel/syscall/actions/sys_fork.c index 5e2ee80..f0a5711 100644 --- a/src/kernel/syscall/actions/sys_fork.c +++ b/src/kernel/syscall/actions/sys_fork.c @@ -1,11 +1,11 @@ #include <stdint.h> -#include <kernel/interrupts/interrupts.h> -#include <kernel/memory/paging.h> -#include <kernel/tasks/process.h> -#include <kernel/lib/lib.h> -#include <kernel/system.h> +#include <interrupts/interrupts.h> +#include <memory/paging.h> +#include <tasks/process.h> +#include <lib/lib.h> +#include <system.h> -uint32_t sys_fork(struct regs *r) +u32 sys_fork(struct regs *r) { struct page_directory *dir = paging_copy_user_directory(current_proc->cr3); struct process *proc = process_make_new(); diff --git a/src/kernel/syscall/actions/sys_free.c b/src/kernel/syscall/actions/sys_free.c index 480cd53..a7daf2f 100644 --- a/src/kernel/syscall/actions/sys_free.c +++ b/src/kernel/syscall/actions/sys_free.c @@ -1,7 +1,7 @@ #include <stdint.h> -#include <kernel/memory/alloc.h> +#include <memory/alloc.h> -uint32_t sys_free(uint32_t ptr) +u32 sys_free(u32 ptr) { ufree((void *)ptr); return 0; diff --git a/src/kernel/syscall/actions/sys_get_pid.c b/src/kernel/syscall/actions/sys_get_pid.c index 7631230..1184ce7 100644 --- a/src/kernel/syscall/actions/sys_get_pid.c +++ b/src/kernel/syscall/actions/sys_get_pid.c @@ -1,7 +1,7 @@ #include <stdint.h> -#include <kernel/tasks/process.h> +#include <tasks/process.h> -uint32_t sys_get_pid() +u32 sys_get_pid() { return current_proc->pid; }
\ No newline at end of file diff --git a/src/kernel/syscall/actions/sys_malloc.c b/src/kernel/syscall/actions/sys_malloc.c index 8adc362..da21a2d 100644 --- a/src/kernel/syscall/actions/sys_malloc.c +++ b/src/kernel/syscall/actions/sys_malloc.c @@ -1,7 +1,7 @@ #include <stdint.h> -#include <kernel/memory/alloc.h> +#include <memory/alloc.h> -uint32_t sys_malloc(uint32_t count) +u32 sys_malloc(u32 count) { - return (uint32_t)umalloc(count); + return (u32)umalloc(count); }
\ No newline at end of file diff --git a/src/kernel/syscall/actions/sys_read.c b/src/kernel/syscall/actions/sys_read.c index 492e5fd..8b16064 100644 --- a/src/kernel/syscall/actions/sys_read.c +++ b/src/kernel/syscall/actions/sys_read.c @@ -1,7 +1,7 @@ #include <stdint.h> -#include <kernel/fs/fs.h> +#include <fs/fs.h> -uint32_t sys_read(char *path, uint32_t offset, uint32_t count, uint8_t *buf) +u32 sys_read(char *path, u32 offset, u32 count, u8 *buf) { return read(path, offset, count, buf); }
\ No newline at end of file diff --git a/src/kernel/syscall/actions/sys_write.c b/src/kernel/syscall/actions/sys_write.c index b9b30f3..4d4275a 100644 --- a/src/kernel/syscall/actions/sys_write.c +++ b/src/kernel/syscall/actions/sys_write.c @@ -1,7 +1,7 @@ #include <stdint.h> -#include <kernel/fs/fs.h> +#include <fs/fs.h> -uint32_t sys_write(char *path, uint32_t offset, uint32_t count, uint8_t *buf) +u32 sys_write(char *path, u32 offset, u32 count, u8 *buf) { return write(path, offset, count, buf); }
\ No newline at end of file diff --git a/src/kernel/syscall/syscall.c b/src/kernel/syscall/syscall.c index 53f94cd..92c0dbe 100644 --- a/src/kernel/syscall/syscall.c +++ b/src/kernel/syscall/syscall.c @@ -1,22 +1,23 @@ #include <stdint.h> -#include <kernel/syscall/syscall.h> -#include <kernel/interrupts/interrupts.h> -#include <kernel/system.h> -#include <kernel/lib/stdio.h> -#include <kernel/io/io.h> -#include <kernel/tasks/process.h> - -typedef uint32_t (*syscall_func)(uint32_t, ...); - -uint32_t (*syscalls[])() = { [0] = (uint32_t(*)())halt_loop, // DEBUG! - [1] = sys_exit, - [2] = sys_fork, - [3] = sys_read, - [4] = sys_write, - [5] = sys_exec, - [6] = sys_get_pid, - [7] = sys_malloc, - [8] = sys_free }; +#include <common.h> +#include <syscall/syscall.h> +#include <interrupts/interrupts.h> +#include <system.h> +#include <lib/stdio.h> +#include <io/io.h> +#include <tasks/process.h> + +typedef u32 (*syscall_func)(u32, ...); + +u32 (*syscalls[])() = { [SYS_HALT] = (u32(*)())halt_loop, // DEBUG! + [SYS_EXIT] = sys_exit, + [SYS_FORK] = sys_fork, + [SYS_READ] = sys_read, + [SYS_WRITE] = sys_write, + [SYS_EXEC] = sys_exec, + [SYS_GET_PID] = sys_get_pid, + [SYS_MALLOC] = sys_malloc, + [SYS_FREE] = sys_free }; void syscall_handler(struct regs *r) { diff --git a/src/kernel/syscall/syscall.h b/src/kernel/syscall/syscall.h index 9af18e8..7261afc 100644 --- a/src/kernel/syscall/syscall.h +++ b/src/kernel/syscall/syscall.h @@ -2,26 +2,26 @@ #define MELVIX_SYSCALL_H #include <stdint.h> -#include <kernel/interrupts/interrupts.h> +#include <interrupts/interrupts.h> extern void idt_syscall(); void syscalls_install(); -uint32_t sys_exit(uint32_t code); +u32 sys_exit(u32 code); -uint32_t sys_fork(struct regs *r); +u32 sys_fork(struct regs *r); -uint32_t sys_read(char *path, uint32_t offset, uint32_t count, uint8_t *buf); +u32 sys_read(char *path, u32 offset, u32 count, u8 *buf); -uint32_t sys_write(char *path, uint32_t offset, uint32_t count, uint8_t *buf); +u32 sys_write(char *path, u32 offset, u32 count, u8 *buf); -uint32_t sys_exec(char *path); +u32 sys_exec(char *path); -uint32_t sys_get_pid(); +u32 sys_get_pid(); -uint32_t sys_malloc(uint32_t count); +u32 sys_malloc(u32 count); -uint32_t sys_free(uint32_t ptr); +u32 sys_free(u32 ptr); #endif
\ No newline at end of file |