-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathop_ff.c
More file actions
75 lines (64 loc) · 1.86 KB
/
op_ff.c
File metadata and controls
75 lines (64 loc) · 1.86 KB
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
#include"bin2inc.h"
boolean op_ff(void){
char * mod_rm_str;
char * o_size;
char * mnems[8] = { "inc", "dec", "call", "call", "jmp", "jmp", "push", 0 };
char * mnemonic;
char * imm_str;
address_mode = read_byte();
mnemonic = mnems[(address_mode >> 3) & 7];
if(!mnemonic) return boolean(0);
mod_rm_str = mod_rm();
if(operand_size == 32){
o_size = "dword ";
}
else if(operand_size == 16){
o_size = "word ";
}
else return boolean(0);
if(((address_mode >> 6) & 3) == 3) o_size = "";
switch((address_mode >> 3)&7){
case 2:
if(fx && (fx->size == 4)){
pushJumpTable(&(VirtualAddress){
.obj_n = fx->object_n,
.offset = fx->target
});
}
sprintf(ibuffer, iFORMAT"%s%s",
mnemonic, o_size, mod_rm_str);
break;
case 3:
sprintf(ibuffer, iFORMAT"far %sfar %s",
mnemonic, o_size, mod_rm_str);
break;
case 4:
if(fx && (fx->size == 4)){
pushJumpTable(&(VirtualAddress){
.obj_n = fx->object_n,
.offset = fx->target
});
}
sprintf(ibuffer, iFORMAT"near %s%s",
mnemonic, o_size, mod_rm_str);
mark_instruction();// comment_instruction();
return boolean(1);
case 5:
sprintf(ibuffer, iFORMAT"far %sfar %s",
mnemonic, o_size, mod_rm_str);
mark_instruction();// comment_instruction();
return boolean(1);
case 0:
case 1:
case 6:
sprintf(ibuffer, iFORMAT"%s%s",
mnemonic, o_size, mod_rm_str);
break;
default:
return boolean(0);
}
mark_instruction();// comment_instruction();
// push next instruction offset to stack
IDisasm.pushAddress(¤t_va);
return boolean(1);
}