Files
my-os-project2/kernel/syscall/term.c

34 lines
662 B
C

#include <stdint.h>
#include <stddef.h>
#include "syscall/syscall.h"
#include "bootinfo/bootinfo.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;
}
int32_t SYSCALL2(sys_term_getsizes, w1, h1) {
uint16_t *w = (uint16_t *)w1;
uint16_t *h = (uint16_t *)h1;
if (w == NULL || h == NULL) {
return E_INVALIDARGUMENT;
}
*w = (uint16_t)(BOOT_INFO.fb->width / 16);
*h = (uint16_t)(BOOT_INFO.fb->height / 16);
return E_OK;
}