1 // Copyright 2017 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 <io.h>
5 #include <windows.h>
6
7 #include "nocover.h"
8
os_init(int argc,char ** argv,void * data,size_t data_size)9 static void os_init(int argc, char** argv, void* data, size_t data_size)
10 {
11 if (VirtualAlloc(data, data_size, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE) != data)
12 fail("mmap of data segment failed");
13 }
14
execute_syscall(const call_t * c,long a[kMaxArgs])15 static long execute_syscall(const call_t* c, long a[kMaxArgs])
16 {
17 __try {
18 return c->call(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8]);
19 } __except (EXCEPTION_EXECUTE_HANDLER) {
20 return -1;
21 }
22 }
23