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 // +build
5 
6 #include <stdio.h>
7 
8 #define PRINT(x)                                   \
9 	extern const unsigned char x[], x##_end[]; \
10 	print(#x, x, x##_end);
11 
print(const char * name,const unsigned char * start,const unsigned char * end)12 void print(const char* name, const unsigned char* start, const unsigned char* end)
13 {
14 	printf("const char %s[] = \"", name);
15 	for (const unsigned char* p = start; p < end; p++)
16 		printf("\\x%02x", *p);
17 	printf("\";\n");
18 }
19 
main()20 int main()
21 {
22 	printf("// AUTOGENERATED FILE\n");
23 	PRINT(kvm_asm16_cpl3);
24 	PRINT(kvm_asm32_paged);
25 	PRINT(kvm_asm32_vm86);
26 	PRINT(kvm_asm32_paged_vm86);
27 	PRINT(kvm_asm64_vm86);
28 	PRINT(kvm_asm64_enable_long);
29 	PRINT(kvm_asm64_init_vm);
30 	PRINT(kvm_asm64_vm_exit);
31 	PRINT(kvm_asm64_cpl3);
32 	return 0;
33 }
34