-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathemu.cpp
101 lines (83 loc) · 2.48 KB
/
emu.cpp
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/*
IDA Pro Processor Module for Blackfin Instruction Set
Copyright (C) 2011
Andreas Schuler <[email protected]>
Based on parts of libopcodes (Free Software Foundation, Inc.) and
Simple Python Byte Code Module (Chris Eagle <[email protected]>)
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option)
any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <ida.hpp>
#include <frame.hpp>
#include "blackfin.h"
#include "dis-asm.h"
disassemble_info edi;
//----------------------------------------------------------------------
int idaapi blackfin_emu(void)
{
//Get Information from disassembler
disasm_insn_bfin(cmd.ea,&edi);
//Add autogenerated comments
if(strlen(edi.comment))
set_cmt(cmd.ea,edi.comment,true);
//Add jump/call code references
if(edi.feature&CF_JUMP)
{
ua_add_cref(0,edi.caddr,edi.ctype);
}
//Add data references
if(edi.drefmode==DMODE_LOAD_HIGH)
{
ua_add_dref(0,edi.daddr,edi.dtype);
}
//Add the sequential flow as long as CF_STOP is not set
if(!(edi.feature&CF_STOP))
{
//cmd.ea + cmd.size computes the address of the next instruction
ua_add_cref(0, cmd.ea + cmd.size, fl_F);
}
return cmd.size;
}
/*
static void setup_far_func(func_t *pfn)
{
if ( (pfn->flags & FUNC_FAR) == 0 )
{
ea_t ea1 = pfn->startEA;
ea_t ea2 = pfn->endEA;
while ( ea1 < ea2 )
{
if ( isCode(get_flags_novalue(ea1)) )
{
ua_ana0(ea1);
/*if ( is_far_ending() )
{
pfn->flags |= FUNC_FAR;
update_func(pfn);
break;
}
}
ea1 = next_head(ea1, ea2);
}
}
}
*/
bool create_func_frame(func_t *pfn)
{
if ( pfn != NULL )
{
// setup_far_func(pfn);
// uval_t argsize = find_ret_purged(pfn);
add_frame(pfn, 0, 0, 0/*argsize*/);
}
return true;
}