00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "htatom.h"
00022 #include "htiobox.h"
00023 #include "srt.h"
00024 #include "symmath.h"
00025
00026
00027 #include "srt_x86.h"
00028
00029 #define ATOM_SYM_INT_REG MAGICD("SRT\x00")
00030 #define ATOM_SYM_INT_MEM MAGICD("SRT\x01")
00031
00032
00033
00034
00035
00036 state_mod::~state_mod()
00037 {
00038 if (ismem) {
00039 dest.mem.addr->done();
00040 delete dest.mem.addr;
00041 }
00042 if (isbool) {
00043 value.boolean->done();
00044 delete value.boolean;
00045 } else {
00046 value.integer->done();
00047 delete value.integer;
00048 }
00049 }
00050
00051
00052
00053
00054
00055 sym_int_reg::sym_int_reg(UINT r)
00056 {
00057 regidx = r;
00058 }
00059
00060 bool sym_int_reg::compare_eq(sym_int_token *t)
00061 {
00062 sym_int_reg *s = (sym_int_reg*)t;
00063 return (regidx == s->regidx);
00064 }
00065
00066 Object *sym_int_reg::duplicate()
00067 {
00068 return new sym_int_reg(regidx);
00069 }
00070
00071 bool sym_int_reg::evaluate(bool *i)
00072 {
00073 return false;
00074 }
00075
00076 int sym_int_reg::nstrfy(char *buf, int n)
00077 {
00078 return sprintf(buf, "reg%d", regidx);
00079 }
00080
00081 OBJECT_ID sym_int_reg::object_id() const
00082 {
00083 return ATOM_SYM_INT_REG;
00084 }
00085
00086
00087
00088
00089
00090
00091 sym_int_mem::sym_int_mem(sym_int_token *a, UINT s, srt_endian e)
00092 {
00093 addr = a;
00094 size = s;
00095 endian = e;
00096 }
00097
00098 bool sym_int_mem::compare_eq(sym_int_token *t)
00099 {
00100 return false;
00101 }
00102
00103 Object *sym_int_mem::duplicate()
00104 {
00105 return new sym_int_mem((sym_int*)addr->duplicate(), size, endian);
00106 }
00107
00108 bool sym_int_mem::evaluate(bool *i)
00109 {
00110 return false;
00111 }
00112
00113 int sym_int_mem::nstrfy(char *buf, int n)
00114 {
00115 int l = 0;
00116 l += sprintf(buf+l, "%s%d[", srt_endian_to_str(endian), size);
00117 l += addr->nstrfy(buf+l, n-l);
00118 buf[l++] = ']';
00119 buf[l] = 0;
00120 return l;
00121 }
00122
00123 OBJECT_ID sym_int_mem::object_id() const
00124 {
00125 return ATOM_SYM_INT_MEM;
00126 }
00127
00128
00129
00130 char *srt_endian_to_str(srt_endian endian)
00131 {
00132 switch (endian) {
00133 case srte_be: return "be";
00134 case srte_le: return "le";
00135 }
00136 return "?";
00137 }
00138
00139 void test_srt(Analyser *analy, Address *addr)
00140 {
00141
00142 OBJECT_ID a = analy->disasm->object_id();
00143 if (a == ATOM_DISASM_X86) {
00144 srt_x86(analy, addr);
00145 }
00146 }
00147