blob: a37e4bbb90215bca08476abab31740730fa31a6d (
plain) (
blame)
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
|
#include "api/error.h"
#include "jove.h"
#include "lib/printf.h"
#include "proc/process.h"
#include "proc/scheduler.h"
#include "syscall.h"
#include "errno.h"
int
s_syscall_pcb_yield(jove_owned_obj_t *pcb_obj,
size_t bytes_left,
void *payload_data)
{
size_t bytes_needed = sizeof(pid_t);
CHECK_TOOSMALL(bytes_needed, bytes_left, "Message too small for payload");
pid_t subject_pid = *((pid_t*)payload_data);
return scheduler_yield(subject_pid);
}
int
_syscall_handle_pcb(syscall_context_t *ctx)
{
switch(ctx->header->callid) {
case SYSCALL_PCB_YIELD:
if(ctx->target.permissions & SYSCALL_PERM_PCB_YIELD)
return s_syscall_pcb_yield(ctx->target.obj, ctx->bytes_left, ctx->payload);
return -EPERM;
default:
return -EBADCALL;
}
}
|