#include "jove.h" #include "lib/printf.h" #include "lib/virtterm.h" #include "syscall.h" static int s_syscall_vtt_write( jove_owned_obj_t *vtt, size_t payload_bytes, void *payload_data) { size_t bytes_needed = sizeof(struct syscall_generic_write); CHECK_TOOSMALL(bytes_needed, payload_bytes, "Message is too small for this syscall!"); struct syscall_generic_write *payload = payload_data; bytes_needed += payload->len * 2; CHECK_TOOSMALL(bytes_needed, payload_bytes, "Message is too small for write buffer!"); return vt_write(vtt, payload->data, payload->len); } int _syscall_handle_vtt(syscall_context_t *ctx) { switch(ctx->header->callid) { case SYSCALL_VTT_WRITE: return s_syscall_vtt_write(ctx->target.obj, ctx->bytes_left, ctx->payload); default: klogf("vtt object does not support syscall %i\n", ctx->header->callid); return -EBADCALL; } }