Reimplement the terminal user access via separate syscalls
This commit is contained in:
@ -11,6 +11,7 @@
|
||||
#include "syscall/dev.h"
|
||||
#include "syscall/time.h"
|
||||
#include "syscall/ipcmbus.h"
|
||||
#include "syscall/term.h"
|
||||
#include "errors.h"
|
||||
#include "kprintf.h"
|
||||
|
||||
@ -75,4 +76,6 @@ SyscallFn SYSCALL_TABLE[SYSCALLS_MAX] = {
|
||||
[SYS_IPC_MBUSCONSUME] = &sys_ipc_mbusconsume,
|
||||
[SYS_IPC_MBUSATTCH] = &sys_ipc_mbusattch,
|
||||
[SYS_IPC_MBUSDTTCH] = &sys_ipc_mbusdttch,
|
||||
|
||||
[SYS_TERM_WRITE] = &sys_term_write,
|
||||
};
|
||||
|
||||
18
kernel/syscall/term.c
Normal file
18
kernel/syscall/term.c
Normal file
@ -0,0 +1,18 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "syscall/syscall.h"
|
||||
#include "kprintf.h"
|
||||
#include "errors.h"
|
||||
|
||||
int32_t SYSCALL2(sys_term_write, buffer1, len1) {
|
||||
const char *buffer = (const char *)buffer1;
|
||||
size_t len = len1;
|
||||
|
||||
if (buffer == NULL) {
|
||||
return E_INVALIDARGUMENT;
|
||||
}
|
||||
|
||||
kprintf("%.*s", (int)len, buffer);
|
||||
|
||||
return E_OK;
|
||||
}
|
||||
10
kernel/syscall/term.h
Normal file
10
kernel/syscall/term.h
Normal file
@ -0,0 +1,10 @@
|
||||
#ifndef SYSCALL_TERM_H_
|
||||
#define SYSCALL_TERM_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "syscall/syscall.h"
|
||||
|
||||
int32_t SYSCALL2(sys_term_write, buffer1, len1);
|
||||
|
||||
#endif // SYSCALL_TERM_H_
|
||||
Reference in New Issue
Block a user