Kernel, libc: Remove the rand() system call
That's why we now have a VFS and a /dev pseudo-filesystem. To provide that kind of things. Remember, everything is a file!! The new way to ask the kernel for random numbers is to read from /dev/random.
This commit is contained in:
parent
225284a6ca
commit
3a9dddaa57
@ -7,17 +7,16 @@
|
|||||||
#define SYS_sleep 2
|
#define SYS_sleep 2
|
||||||
#define SYS_write 3
|
#define SYS_write 3
|
||||||
#define SYS_paint 4
|
#define SYS_paint 4
|
||||||
#define SYS_rand 5
|
#define SYS_gettid 5
|
||||||
#define SYS_gettid 6
|
#define SYS_mmap 6
|
||||||
#define SYS_mmap 7
|
#define SYS_munmap 7
|
||||||
#define SYS_munmap 8
|
#define SYS_open 8
|
||||||
#define SYS_open 9
|
#define SYS_read 9
|
||||||
#define SYS_read 10
|
#define SYS_close 10
|
||||||
#define SYS_close 11
|
#define SYS_seek 11
|
||||||
#define SYS_seek 12
|
#define SYS_exec 12
|
||||||
#define SYS_exec 13
|
#define SYS_fcntl 13
|
||||||
#define SYS_fcntl 14
|
#define SYS_mprotect 14
|
||||||
#define SYS_mprotect 15
|
|
||||||
|
|
||||||
namespace Syscall
|
namespace Syscall
|
||||||
{
|
{
|
||||||
@ -31,7 +30,6 @@ void sys_yield(Context* context);
|
|||||||
void sys_sleep(Context* context, uint64_t ms);
|
void sys_sleep(Context* context, uint64_t ms);
|
||||||
void sys_write(Context* context, int fd, size_t size, const char* addr);
|
void sys_write(Context* context, int fd, size_t size, const char* addr);
|
||||||
void sys_paint(Context* context, uint64_t x, uint64_t y, uint64_t w, uint64_t h, uint64_t col);
|
void sys_paint(Context* context, uint64_t x, uint64_t y, uint64_t w, uint64_t h, uint64_t col);
|
||||||
void sys_rand(Context* context);
|
|
||||||
void sys_gettid(Context* context);
|
void sys_gettid(Context* context);
|
||||||
void sys_mmap(Context* context, void* address, size_t size, int prot);
|
void sys_mmap(Context* context, void* address, size_t size, int prot);
|
||||||
void sys_munmap(Context* context, void* address, size_t size);
|
void sys_munmap(Context* context, void* address, size_t size);
|
||||||
|
@ -16,7 +16,6 @@ void Syscall::entry(Context* context)
|
|||||||
case SYS_sleep: sys_sleep(context, context->rdi); break;
|
case SYS_sleep: sys_sleep(context, context->rdi); break;
|
||||||
case SYS_write: sys_write(context, (int)context->rdi, context->rsi, (const char*)context->rdx); break;
|
case SYS_write: sys_write(context, (int)context->rdi, context->rsi, (const char*)context->rdx); break;
|
||||||
case SYS_paint: sys_paint(context, context->rdi, context->rsi, context->rdx, context->r10, context->r8); break;
|
case SYS_paint: sys_paint(context, context->rdi, context->rsi, context->rdx, context->r10, context->r8); break;
|
||||||
case SYS_rand: sys_rand(context); break;
|
|
||||||
case SYS_gettid: sys_gettid(context); break;
|
case SYS_gettid: sys_gettid(context); break;
|
||||||
case SYS_mmap: sys_mmap(context, (void*)context->rdi, context->rsi, (int)context->rdx); break;
|
case SYS_mmap: sys_mmap(context, (void*)context->rdi, context->rsi, (int)context->rdx); break;
|
||||||
case SYS_munmap: sys_munmap(context, (void*)context->rdi, context->rsi); break;
|
case SYS_munmap: sys_munmap(context, (void*)context->rdi, context->rsi); break;
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
#include "interrupts/Context.h"
|
|
||||||
#include "rand/Mersenne.h"
|
|
||||||
|
|
||||||
void sys_rand(Context* context)
|
|
||||||
{
|
|
||||||
context->rax = Mersenne::get();
|
|
||||||
}
|
|
@ -6,17 +6,16 @@
|
|||||||
#define SYS_sleep 2
|
#define SYS_sleep 2
|
||||||
#define SYS_write 3
|
#define SYS_write 3
|
||||||
#define SYS_paint 4
|
#define SYS_paint 4
|
||||||
#define SYS_rand 5
|
#define SYS_gettid 5
|
||||||
#define SYS_gettid 6
|
#define SYS_mmap 6
|
||||||
#define SYS_mmap 7
|
#define SYS_munmap 7
|
||||||
#define SYS_munmap 8
|
#define SYS_open 8
|
||||||
#define SYS_open 9
|
#define SYS_read 9
|
||||||
#define SYS_read 10
|
#define SYS_close 10
|
||||||
#define SYS_close 11
|
#define SYS_seek 11
|
||||||
#define SYS_seek 12
|
#define SYS_exec 12
|
||||||
#define SYS_exec 13
|
#define SYS_fcntl 13
|
||||||
#define SYS_fcntl 14
|
#define SYS_mprotect 14
|
||||||
#define SYS_mprotect 15
|
|
||||||
|
|
||||||
#ifndef __want_syscalls
|
#ifndef __want_syscalls
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -33,8 +33,7 @@ extern "C"
|
|||||||
switch (number)
|
switch (number)
|
||||||
{
|
{
|
||||||
case SYS_yield:
|
case SYS_yield:
|
||||||
case SYS_gettid:
|
case SYS_gettid: result = __luna_syscall0(number); break;
|
||||||
case SYS_rand: result = __luna_syscall0(number); break;
|
|
||||||
case SYS_exit:
|
case SYS_exit:
|
||||||
case SYS_close:
|
case SYS_close:
|
||||||
case SYS_exec:
|
case SYS_exec:
|
||||||
|
Loading…
Reference in New Issue
Block a user