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 "mman.h"
|
||||||
#include "sched.h"
|
#include "sched.h"
|
||||||
#include "devctl.h"
|
#include "devctl.h"
|
||||||
|
#include "randcrypto.h"
|
||||||
|
|
||||||
int32_t SYSCALL1(sys_debugprint, string) {
|
int32_t SYSCALL1(sys_debugprint, string) {
|
||||||
char *p = (char *)string;
|
char *p = (char *)string;
|
||||||
@ -25,4 +26,5 @@ SyscallFn SYSCALL_TABLE[SYSCALLS_MAX] = {
|
|||||||
[SYS_MMAN_UNMAP] = &sys_mman_unmap,
|
[SYS_MMAN_UNMAP] = &sys_mman_unmap,
|
||||||
[SYS_SCHEDRELEASE] = &sys_schedrelease,
|
[SYS_SCHEDRELEASE] = &sys_schedrelease,
|
||||||
[SYS_DEVCTL] = &sys_devctl,
|
[SYS_DEVCTL] = &sys_devctl,
|
||||||
|
[SYS_RAND] = &sys_rand,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -9,5 +9,6 @@
|
|||||||
#define SYS_MMAN_UNMAP 6
|
#define SYS_MMAN_UNMAP 6
|
||||||
#define SYS_SCHEDRELEASE 7
|
#define SYS_SCHEDRELEASE 7
|
||||||
#define SYS_DEVCTL 8
|
#define SYS_DEVCTL 8
|
||||||
|
#define SYS_RAND 9
|
||||||
|
|
||||||
#endif // SHARE_HDRS_SYSCALL_H_
|
#endif // SHARE_HDRS_SYSCALL_H_
|
||||||
|
|||||||
Reference in New Issue
Block a user