diff options
author | Marvin Borner | 2020-08-22 17:38:40 +0200 |
---|---|---|
committer | Marvin Borner | 2020-08-22 17:38:40 +0200 |
commit | 424dc57424ee17de77d689443f95d2e1bed72f4a (patch) | |
tree | 1ae2f071ee2de984a2f112de0e69208e593ddc51 /kernel | |
parent | d748a6f54ce7af45afde487936d5a02cb2a91b05 (diff) |
Added random number generator
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/config.h | 14 | ||||
-rw-r--r-- | kernel/drivers/timer.c | 5 | ||||
-rw-r--r-- | kernel/features/syscall.c | 6 | ||||
-rw-r--r-- | kernel/inc/timer.h | 1 | ||||
-rw-r--r-- | kernel/main.c | 4 |
5 files changed, 12 insertions, 18 deletions
diff --git a/kernel/config.h b/kernel/config.h deleted file mode 100644 index 29c0e23..0000000 --- a/kernel/config.h +++ /dev/null @@ -1,14 +0,0 @@ -// MIT License, Copyright (c) 2020 Marvin Borner -// General kernel config - -#ifndef CONFIG_H -#define CONFIG_H - -int MELVIX_VERSION = 0; - -#define USERNAME "Neo" -//#define FONT_PATH "/font/ter-p32n.psf" -#define FONT_PATH "/font/spleen-16x32.psfu" -#define NETWORK "rtl8139" - -#endif diff --git a/kernel/drivers/timer.c b/kernel/drivers/timer.c index 0207cc0..79e3cd8 100644 --- a/kernel/drivers/timer.c +++ b/kernel/drivers/timer.c @@ -14,6 +14,11 @@ void timer_phase(int hz) outb(0x40, divisor >> 8); } +u32 timer_get() +{ + return timer_ticks; +} + // Executed 1000 times per second void timer_handler() { diff --git a/kernel/features/syscall.c b/kernel/features/syscall.c index 157f10c..c8da824 100644 --- a/kernel/features/syscall.c +++ b/kernel/features/syscall.c @@ -10,6 +10,7 @@ #include <proc.h> #include <str.h> #include <sys.h> +#include <timer.h> void syscall_handler(struct regs *r) { @@ -66,6 +67,11 @@ void syscall_handler(struct regs *r) proc_exit(proc_current(), r->ebx); break; } + case SYS_TIME: { + printf("time\n"); + r->eax = timer_get(); + break; + } case SYS_MAP: { printf("map\n"); event_map(r->ebx, proc_current(), (u32 *)r->ecx); diff --git a/kernel/inc/timer.h b/kernel/inc/timer.h index 7c4f077..0f8842b 100644 --- a/kernel/inc/timer.h +++ b/kernel/inc/timer.h @@ -5,6 +5,7 @@ #include <def.h> +u32 timer_get(); void timer_install(); void timer_handler(); // For scheduler diff --git a/kernel/main.c b/kernel/main.c index d431cf6..c4b51cf 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -1,15 +1,11 @@ // MIT License, Copyright (c) 2020 Marvin Borner -#include "config.h" #include <boot.h> #include <cpu.h> -#include <def.h> #include <fs.h> -#include <interrupts.h> #include <keyboard.h> #include <load.h> #include <mem.h> -#include <print.h> #include <serial.h> #include <syscall.h> #include <timer.h> |