Kernel: Remove the sys_getversion() syscall

User programs can now acquire this information by reading /dev/version.
This commit is contained in:
apio 2022-10-11 21:31:28 +02:00
parent 112e375b5e
commit d3ac590e24
5 changed files with 13 additions and 37 deletions

View File

@ -8,13 +8,12 @@
#define SYS_write 3 #define SYS_write 3
#define SYS_paint 4 #define SYS_paint 4
#define SYS_rand 5 #define SYS_rand 5
#define SYS_getversion 6 #define SYS_gettid 6
#define SYS_gettid 7 #define SYS_mmap 7
#define SYS_mmap 8 #define SYS_munmap 8
#define SYS_munmap 9 #define SYS_open 9
#define SYS_open 10 #define SYS_read 10
#define SYS_read 11 #define SYS_close 11
#define SYS_close 12
namespace Syscall namespace Syscall
{ {
@ -27,7 +26,6 @@ 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_rand(Context* context);
void sys_getversion(Context* context, char* buffer, size_t max);
void sys_gettid(Context* context); void sys_gettid(Context* context);
void sys_mmap(Context* context, void* address, size_t size, int flags); void sys_mmap(Context* context, void* address, size_t size, int flags);
void sys_munmap(Context* context, void* address, size_t size); void sys_munmap(Context* context, void* address, size_t size);

View File

@ -22,7 +22,6 @@ void Syscall::entry(Context* context)
break; 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_rand: sys_rand(context); break;
case SYS_getversion: sys_getversion(context, (char*)context->rdi, context->rsi); 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;

View File

@ -1,19 +0,0 @@
#include "config.h"
#include "errno.h"
#include "interrupts/Context.h"
#include "std/stdio.h"
void sys_getversion(Context* context, char* buffer, size_t max)
{
if (!max)
{
context->rax = -EINVAL;
return;
}
if (!buffer)
{
context->rax = -EINVAL;
return;
}
context->rax = snprintf(buffer, max, "moon %s", moon_version());
}

View File

@ -7,13 +7,12 @@
#define SYS_write 3 #define SYS_write 3
#define SYS_paint 4 #define SYS_paint 4
#define SYS_rand 5 #define SYS_rand 5
#define SYS_getversion 6 #define SYS_gettid 6
#define SYS_gettid 7 #define SYS_mmap 7
#define SYS_mmap 8 #define SYS_munmap 8
#define SYS_munmap 9 #define SYS_open 9
#define SYS_open 10 #define SYS_read 10
#define SYS_read 11 #define SYS_close 11
#define SYS_close 12
#ifndef __want_syscalls #ifndef __want_syscalls
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -38,8 +38,7 @@ extern "C"
case SYS_close: case SYS_close:
case SYS_sleep: result = __luna_syscall1(number, va_arg(ap, arg)); break; case SYS_sleep: result = __luna_syscall1(number, va_arg(ap, arg)); break;
case SYS_munmap: case SYS_munmap:
case SYS_open: case SYS_open: {
case SYS_getversion: {
arg arg0 = va_arg(ap, arg); arg arg0 = va_arg(ap, arg);
arg arg1 = va_arg(ap, arg); arg arg1 = va_arg(ap, arg);
result = __luna_syscall2(number, arg0, arg1); result = __luna_syscall2(number, arg0, arg1);