1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#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(
jove_owned_obj_t *pcb_obj,
jove_owned_obj_t *objdir,
jove_owned_obj_t *message_obj,
jove_owned_obj_t *target_obj,
struct syscall_header *header,
size_t bytes_left,
void *payload_data)
{
switch(header->callid) {
case 0:
return s_syscall_vtt_write(target_obj, bytes_left, payload_data);
default:
kprintf("syscall_vtt: vtt object does not support syscall %i\n", header->callid);
return EOOB;
}
}
|