1 // Copyright 2018 syzkaller project authors. All rights reserved.
2 // Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
3
4 #include <stdlib.h>
5 #include <sys/mman.h>
6 #include <unistd.h>
7
8 #include "nocover.h"
9
os_init(int argc,char ** argv,void * data,size_t data_size)10 static void os_init(int argc, char** argv, void* data, size_t data_size)
11 {
12 if (mmap(data, data_size, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE | MAP_FIXED, -1, 0) != data)
13 fail("mmap of data segment failed");
14 }
15
execute_syscall(const call_t * c,long a[kMaxArgs])16 static long execute_syscall(const call_t* c, long a[kMaxArgs])
17 {
18 return c->call(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8]);
19 }
20