Kernel: Remove the paint() system call

That was a very old one from back in the old days. Now that the framebuffer is finally a device file,
and it can be memory-mapped by user programs for more performance,
this syscall is MORE than obsolete.
This commit is contained in:
apio 2022-11-02 20:35:06 +01:00
parent 8f2308c80d
commit feab66c0d3
5 changed files with 47 additions and 79 deletions

View File

@ -7,30 +7,29 @@
#define SYS_yield 1 #define SYS_yield 1
#define SYS_sleep 2 #define SYS_sleep 2
#define SYS_write 3 #define SYS_write 3
#define SYS_paint 4 #define SYS_getprocid 4
#define SYS_getprocid 5 #define SYS_mmap 5
#define SYS_mmap 6 #define SYS_munmap 6
#define SYS_munmap 7 #define SYS_open 7
#define SYS_open 8 #define SYS_read 8
#define SYS_read 9 #define SYS_close 9
#define SYS_close 10 #define SYS_seek 10
#define SYS_seek 11 #define SYS_execv 11
#define SYS_execv 12 #define SYS_fcntl 12
#define SYS_fcntl 13 #define SYS_mprotect 13
#define SYS_mprotect 14 #define SYS_clock_gettime 14
#define SYS_clock_gettime 15 #define SYS_mkdir 15
#define SYS_mkdir 16 #define SYS_fork 16
#define SYS_fork 17 #define SYS_waitpid 17
#define SYS_waitpid 18 #define SYS_access 18
#define SYS_access 19 #define SYS_fstat 19
#define SYS_fstat 20 #define SYS_pstat 20
#define SYS_pstat 21 #define SYS_getdents 21
#define SYS_getdents 22 #define SYS_stat 22
#define SYS_stat 23 #define SYS_dup2 23
#define SYS_dup2 24 #define SYS_setuid 24
#define SYS_setuid 25 #define SYS_setgid 25
#define SYS_setgid 26 #define SYS_umask 26
#define SYS_umask 27
struct stat; struct stat;
struct pstat; struct pstat;
@ -46,7 +45,6 @@ void sys_exit(Context* context, int status);
void sys_yield(Context* context); 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_getprocid(Context* context, int field); void sys_getprocid(Context* context, int field);
void sys_mmap(Context* context, void* address, size_t size, int prot, int fd, off_t offset); void sys_mmap(Context* context, void* address, size_t size, int prot, int fd, off_t offset);
void sys_munmap(Context* context, void* address, size_t size); void sys_munmap(Context* context, void* address, size_t size);

View File

@ -15,7 +15,6 @@ void Syscall::entry(Context* context)
case SYS_yield: sys_yield(context); break; case SYS_yield: sys_yield(context); break;
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_getprocid: sys_getprocid(context, (int)context->rdi); break; case SYS_getprocid: sys_getprocid(context, (int)context->rdi); break;
case SYS_mmap: sys_mmap(context, (void*)context->rdi, context->rsi, (int)context->rdx, (int)context->r10, (off_t)context->r8); break; case SYS_mmap: sys_mmap(context, (void*)context->rdi, context->rsi, (int)context->rdx, (int)context->r10, (off_t)context->r8); 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,27 +0,0 @@
#include "bootboot.h"
#include "interrupts/Context.h"
#include "render/Framebuffer.h"
#include "std/errno.h"
#include <stdint.h>
extern BOOTBOOT bootboot;
void sys_paint(Context* context, uint64_t x, uint64_t y, uint64_t w, uint64_t h, uint64_t c)
{
if ((x + w) > bootboot.fb_width)
{
context->rax = -EINVAL;
return;
}
if ((y + h) > bootboot.fb_height)
{
context->rax = -EINVAL;
return;
}
uint32_t color = (uint32_t)c;
framebuffer0.paint_rect((uint32_t)x, (uint32_t)y, (uint32_t)w, (uint32_t)h, Color::from_integer(color));
context->rax = 0;
}

View File

@ -5,29 +5,28 @@
#define SYS_yield 1 #define SYS_yield 1
#define SYS_sleep 2 #define SYS_sleep 2
#define SYS_write 3 #define SYS_write 3
#define SYS_paint 4 #define SYS_getprocid 4
#define SYS_getprocid 5 #define SYS_mmap 5
#define SYS_mmap 6 #define SYS_munmap 6
#define SYS_munmap 7 #define SYS_open 7
#define SYS_open 8 #define SYS_read 8
#define SYS_read 9 #define SYS_close 9
#define SYS_close 10 #define SYS_seek 10
#define SYS_seek 11 #define SYS_execv 11
#define SYS_execv 12 #define SYS_fcntl 12
#define SYS_fcntl 13 #define SYS_mprotect 13
#define SYS_mprotect 14 #define SYS_clock_gettime 14
#define SYS_clock_gettime 15 #define SYS_mkdir 15
#define SYS_mkdir 16 #define SYS_fork 16
#define SYS_fork 17 #define SYS_waitpid 17
#define SYS_waitpid 18 #define SYS_access 18
#define SYS_access 19 #define SYS_fstat 19
#define SYS_fstat 20 #define SYS_pstat 20
#define SYS_pstat 21 #define SYS_getdents 21
#define SYS_getdents 22 #define SYS_stat 22
#define SYS_stat 23 #define SYS_dup2 23
#define SYS_dup2 24 #define SYS_setuid 24
#define SYS_setuid 25 #define SYS_setgid 25
#define SYS_setgid 26 #define SYS_umask 26
#define SYS_umask 27
#endif #endif

View File

@ -49,8 +49,7 @@ extern "C" long syscall(long number, ...)
result = __luna_syscall3(number, arg0, arg1, arg2); result = __luna_syscall3(number, arg0, arg1, arg2);
break; break;
} }
case SYS_mmap: case SYS_mmap: {
case SYS_paint: {
arg arg0 = va_arg(ap, arg); arg arg0 = va_arg(ap, arg);
arg arg1 = va_arg(ap, arg); arg arg1 = va_arg(ap, arg);
arg arg2 = va_arg(ap, arg); arg arg2 = va_arg(ap, arg);