Add rand() syscall
This commit is contained in:
8
kernel/syscall/randcrypto.c
Normal file
8
kernel/syscall/randcrypto.c
Normal file
@ -0,0 +1,8 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "hal/hal.h"
|
||||
#include "syscall.h"
|
||||
|
||||
int32_t SYSCALL0(sys_rand) {
|
||||
return hal_randnum();
|
||||
}
|
||||
8
kernel/syscall/randcrypto.h
Normal file
8
kernel/syscall/randcrypto.h
Normal file
@ -0,0 +1,8 @@
|
||||
#ifndef SYSCALL_RANDCRYPTO_H_
|
||||
#define SYSCALL_RANDCRYPTO_H_
|
||||
|
||||
#include "syscall.h"
|
||||
|
||||
int32_t SYSCALL0(sys_rand);
|
||||
|
||||
#endif // SYSCALL_RANDCRYPTO_H_
|
||||
@ -9,6 +9,7 @@
|
||||
#include "mman.h"
|
||||
#include "sched.h"
|
||||
#include "devctl.h"
|
||||
#include "randcrypto.h"
|
||||
|
||||
int32_t SYSCALL1(sys_debugprint, string) {
|
||||
char *p = (char *)string;
|
||||
@ -25,4 +26,5 @@ SyscallFn SYSCALL_TABLE[SYSCALLS_MAX] = {
|
||||
[SYS_MMAN_UNMAP] = &sys_mman_unmap,
|
||||
[SYS_SCHEDRELEASE] = &sys_schedrelease,
|
||||
[SYS_DEVCTL] = &sys_devctl,
|
||||
[SYS_RAND] = &sys_rand,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user