-
Notifications
You must be signed in to change notification settings - Fork 0
/
JIT_compiler.h
60 lines (36 loc) · 1.04 KB
/
JIT_compiler.h
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef JIT_PROTECTION
#define JIT_PROTECTION
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/mman.h>
#include "./Assembler_PSL/enum.h"
#include "./Assembler_PSL/libr/Stack.h"
#include "./JIT_DSL.h"
const int Page_size = 4096;
const int Max_x86_cmd_size = 100; // if something went wrong, resize more
const int Addr_array_capacity = 1000;
typedef struct x86bin_code
{
char* x86_code;
char* PSL_code;
int PSL_size = 0;
int x86_size = 0;
size_t capacity = 0;
int step = 0;
int number_of_ip = 0;
int* x86_code_address ;
int* PSL_code_address ;
}x86bin_code;
int check_PSL_file(FILE* PSL);
void x86bin_code_con(FILE* ass, x86bin_code* x86struct);
int compile(x86bin_code* x86struct);
int find_ip(int* PSL_code_address, int cur_ip, int number_of_ip);
void print_x86_file(char* x86_code, int x86_size);
void show(int value);
int in(void);
int p_sqrt(int value);
void push_show_addr(char* x86_code);
void push_in_addr(char* x86_code);
void push_sqrt_addr(char* x86_code);
#endif