forked from tenable/vld-sourceguardian
-
Notifications
You must be signed in to change notification settings - Fork 0
/
srm_oparray.h
83 lines (69 loc) · 2.31 KB
/
srm_oparray.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
+----------------------------------------------------------------------+
| Copyright (c) 1997-2016 Derick Rethans |
+----------------------------------------------------------------------+
| This source file is subject to the 2-Clause BSD license which is |
| available through the LICENSE file, or online at |
| http://opensource.org/licenses/bsd-license.php |
+----------------------------------------------------------------------+
| Authors: Derick Rethans <[email protected]> |
| Andrei Zmievski <[email protected]> |
+----------------------------------------------------------------------+
*/
/* $Id: srm_oparray.h,v 1.17 2006-11-12 13:45:03 helly Exp $ */
#ifndef VLD_OPARRAY_H
#define VLD_OPARRAY_H
#include "php.h"
#if PHP_VERSION_ID >= 50399
# define VLD_ZNODE znode_op
# define VLD_ZNODE_ELEM(node,var) node.var
# define VLD_TYPE(t) t##_type
# define VLD_EXTENDED_VALUE(o) extended_value
#else
# define VLD_ZNODE znode
# define VLD_ZNODE_ELEM(node,var) node.u.var
# define VLD_TYPE(t) t.op_type
# define VLD_EXTENDED_VALUE(o) o.u.EA.type
#endif
#if PHP_VERSION_ID >= 50700
# define VAR_NUM(v) EX_VAR_TO_NUM(v)
#else
# if PHP_VERSION_ID >= 50500
# define VAR_NUM(v) ((zend_uint)(EX_TMP_VAR_NUM(0, 0) - EX_TMP_VAR(0, v)))
# else
# define VAR_NUM(v) ((v)/(sizeof(temp_variable)))
# endif
#endif
// flags used in the op array list
#define OP1_USED 1<<0
#define OP2_USED 1<<1
#define RES_USED 1<<2
#define NONE_USED 0
#define ALL_USED 0x7
#define OP1_OPLINE 1<<3
#define OP2_OPLINE 1<<4
#define OP1_OPNUM 1<<5
#define OP2_OPNUM 1<<6
#define OP_FETCH 1<<7
#define EXT_VAL 1<<8
#define NOP2_OPNUM 1<<9
#define OP2_BRK_CONT 1<<10
#define OP1_CLASS 1<<11
#define RES_CLASS 1<<12
#define OP2_JMP_ARRAY 1<<13
#define SPECIAL 0xff
// special op-type flags
#define VLD_IS_OPLINE 1<<20
#define VLD_IS_OPNUM 1<<21
#define VLD_IS_CLASS 1<<22
#define OP2_INCLUDE 1<<23
#define EXT_VAL_JMP_REL 1<<24
#define EXT_VAL_JMP_ABS 1<<25
#define VLD_IS_JMP_ARRAY 1<<26
typedef struct _op_usage {
char *name;
unsigned int flags;
} op_usage;
void vld_dump_oparray (zend_op_array *opa TSRMLS_DC);
void vld_mark_dead_code (zend_op_array *opa);
#endif